Frustration

2 views
Skip to first unread message

Bryan Buschmann

unread,
Jan 22, 2009, 2:57:17 PM1/22/09
to Egg of P'an Ku-development
I'm trying to finish up the XML settings. Almost everything works
exactly as it should except for the browse dialog boxes. (I added a
folder browser control for the image packs)

Code:

def OnGetImagesPath(self, event):
fdlg = wx.DirDialog(None, message='Please select the directory
containing the images', \
defaultPath=settings.dir_imagepacks, name='Select Images
Path')
if fdlg.ShowModal() == wx.ID_OK:
settings.dir_imagepacks = fdlg.GetPath()
print fdlg.GetPath()
print settings.dir_imagepacks
self.dirImagePacks.SetValue(settings.dir_imagepacks)
print self.dirImagePacks.GetValue()

Old directory is C:\Users\TorchDragon\Documents\EoPK\images\cards\KD
Run program, open preferences, go to database tab, click browse on
directory, select new directory (C:\Users\TorchDragon\Documents\EoPK
\images\cards\HV)

Output:

C:\Users\TorchDragon\Documents\EoPK\images\cards\HV
C:\Users\TorchDragon\Documents\EoPK\images\cards\KD
C:\Users\TorchDragon\Documents\EoPK\images\cards\KD

I'm going insane here.

Bryan Buschmann

unread,
Jan 23, 2009, 3:29:36 PM1/23/09
to Egg of P'an Ku-development
More fun with FROM IMPORT...

http://effbot.org/zone/import-confusion.htm

Found this while I was looking around. Apparently, its a scope issue.

The issue that we're running into here is that settings is being
called as a local scope as opposed to the xmlsettings.settings
variable.

So it looks like the code was setup in the way that the python devs
are saying not to set it up.

We can work around it using it the way that it is now or we can
refactor the code to properly use the variable/module scope as its
meant to be.

Thoughts?
Reply all
Reply to author
Forward
0 new messages