Upgraded System, New Error Generated

I've finished upgrading our network to Slackware-11.0. This includes
wxGTK-2.8.0, wxPython-2.8.0.1, and python-2.4.3.

   When I try to run my application, it comes up, but as soon as I click the
"Open" button, I get a much different file dialog (a single text entry
widget for the file name rather than a list of directories) and this set of
error messages:

(python:2593): Gtk-CRITICAL **: gtk_file_system_unix_get_folder: assertion
`g_path_is_absolute (filename)' failed
Traceback (most recent call last):
   File "/data1/eikos/modelPage.py", line 201, in OnOpenMod
     pName = functions.openFile(self, event)
   File "/data1/eikos/functions.py", line 48, in openFile
     dlg.Destroy()
UnboundLocalError: local variable 'dlg' referenced before assignment

   The openFile() method that is referenced on line 48 is:

def openFile(self, event):
   """ Open a project file."""
   wd = wx.DirDialog(None, "Choose a default directory:", defaultPath=".",
                         style=wx.DD_DEFAULT_STYLE|wx.DD_NEW_DIR_BUTTON)
   result = wd.ShowModal()
   if result == wx.ID_OK:
     appData.dirname = wd.GetPath()
     wd.Destroy()
     wildcard = 'Project databases (*.db)|*.db|' \
                'All files (*.*)|*.*'
     dlg = wx.FileDialog(None, "Choose a project", appData.dirname,
                       wildcard=wildcard, style=wx.OPEN|wx.CHANGE_DIR)
     result = dlg.ShowModal()
     appData.projname=dlg.GetFilename()
     appData.dirname=dlg.GetDirectory()
     appData.dbFileName=dlg.GetFilename()
     titleStr = appData.projname[:-4]
     self.SetTitle(('FuzzyEI-Assessor: - %s') % appData.projname)
   dlg.Destroy()

   I don't know where to look for what changed, and what I need to change in
my code. A pointer would be very helpful.

TIA,

Rich

···

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

[snip]

def openFile(self, event):
   """ Open a project file."""
   wd = wx.DirDialog(None, "Choose a default directory:", defaultPath=".",
                         style=wx.DD_DEFAULT_STYLE|wx.DD_NEW_DIR_BUTTON)
   result = wd.ShowModal()
   if result == wx.ID_OK:
     appData.dirname = wd.GetPath()
     wd.Destroy()
     wildcard = 'Project databases (*.db)|*.db|' \
                'All files (*.*)|*.*'
     dlg = wx.FileDialog(None, "Choose a project", appData.dirname,
                       wildcard=wildcard, style=wx.OPEN|wx.CHANGE_DIR)
     result = dlg.ShowModal()
     appData.projname=dlg.GetFilename()
     appData.dirname=dlg.GetDirectory()
     appData.dbFileName=dlg.GetFilename()
     titleStr = appData.projname[:-4]
     self.SetTitle(('FuzzyEI-Assessor: - %s') % appData.projname)
   dlg.Destroy()

Indent that last line 2 more spaces so it lines up with the
"self.SetTitle..." line.

- Josiah

···

Rich Shepard <rshepard@appl-ecosys.com> wrote:

Josiah,

   Then do I need separate code to destroy the dialog if cancel is selected?

Thanks,

Rich

···

On Wed, 17 Jan 2007, Josiah Carlson wrote:

     self.SetTitle(('FuzzyEI-Assessor: - %s') % appData.projname)
   dlg.Destroy()

Indent that last line 2 more spaces so it lines up with the
"self.SetTitle..." line.

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Josiah,

   Well, that closes the dialog, but generates a different error.

   Commenting out code in that method strongly suggests that wx.DirDialog has
changed between 2.6.x and 2.8.x. What I see now is a horizontal dialog with
a text entry widget for a file name above the pwd directory in a combo box.

   The former wx.DirDialog had a tree of the directory structure on top and
the ability to choose a different directory beneath that. There was no file
selection option; that followed in a separate dialog.

   The code -- with the dlg.Destroy() undented worked fine with the 2.6
wxPython. Where do I look to learn how to regain the former functionality?

Thanks,

Rich

···

On Wed, 17 Jan 2007, Rich Shepard wrote:

Then do I need separate code to destroy the dialog if cancel is selected?

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Pardon me. It's a GTK+2 issue, and both gtk+2 and wxGTK were upgraded to
newer versions than I used before. But, I'd appreciate some insight from
folks here.

Rich

···

On Wed, 17 Jan 2007, Rich Shepard wrote:

Commenting out code in that method strongly suggests that wx.DirDialog has
changed between 2.6.x and 2.8.x. What I see now is a horizontal dialog with
a text entry widget for a file name above the pwd directory in a combo box.

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Rich Shepard wrote:

  Commenting out code in that method strongly suggests that wx.DirDialog has
changed between 2.6.x and 2.8.x. What I see now is a horizontal dialog with
a text entry widget for a file name above the pwd directory in a combo box.

What you're seeing is the native GTK dir dialog, not the generic Windows-like version that was being used for older versions of GTK. If you click on the "Browse for other folders" text (it's actually a collapsible panel) then it will expose other widgets and you'll be able to select other folders.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!