pyrite-publisher (2.1.1-7) PyritePublisher/gui_wxwin.py

Summary

 PyritePublisher/gui_wxwin.py |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

    
download this patch

Patch contents

--- pyrite-publisher-2.1.1.orig/PyritePublisher/gui_wxwin.py
+++ pyrite-publisher-2.1.1/PyritePublisher/gui_wxwin.py
@@ -28,6 +28,15 @@
 
 __copyright__ = 'Copyright 2001 Rob Tillotson <rob@pyrite.org>'
 
+import os
+
+# NOTE -- the following line is X specific.  I don't care.
+# wxPython has a bug in which it will invoke the C exit() function
+# if there isn't a display available.
+
+if not os.environ.has_key("DISPLAY"):
+    raise ImportError, 'No display set; cannot import wxPython'
+
 from wxPython.wx import *
 
 import sys
@@ -73,7 +82,6 @@
         EVT_LISTBOX(self, self.ID_LISTBOX, self.listbox_select)
         
         notebook = wxNotebook(self, -1)
-        notebook_sizer = wxNotebookSizer(notebook)
         
         # notebook info page
         info_panel = wxPanel(notebook, -1)
@@ -102,7 +110,7 @@
         info_panel.SetAutoLayout(true)
         info_panel.SetSizer(sz0)
 
-        main_sizer.Add(notebook_sizer, 2, wxEXPAND)
+        main_sizer.Add(notebook, 2, wxEXPAND)
 
         top_sizer.Add(main_sizer, 1, wxEXPAND|wxALL, 5)
 
@@ -336,7 +344,7 @@
         wc = self.instance.wildcards.items()
         wc.sort(lambda x,y: cmp(x[1],y[1]))
         wc.insert(0, ('*.*', 'All files'))
-        wct = string.join(map(lambda p: '%s (%s)|%s' % (p[1],p[0],p[0]), wc), '|')
+        wct = '|'.join(map(lambda p: '%s (%s)|%s' % (p[1],p[0],p[0]), wc))
         
         dlg = wxFileDialog(self, "Choose a file to convert",
                            wildcard = wct, style=wxOPEN)