fixed a small file selection problem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Roman Rolinsky
2003-01-30 10:36:18 +00:00
parent 5db1613aae
commit 0b02859ebf

View File

@@ -670,12 +670,15 @@ class ParamFile(PPanel):
if self.textModified: # text has newer value if self.textModified: # text has newer value
self.value = self.text.GetValue() self.value = self.text.GetValue()
dlg = wxFileDialog(self, dlg = wxFileDialog(self,
defaultDir = os.path.dirname(self.value), defaultDir = os.path.abspath(os.path.dirname(self.value)),
defaultFile = os.path.basename(self.value)) defaultFile = os.path.basename(self.value))
if dlg.ShowModal() == wxID_OK: if dlg.ShowModal() == wxID_OK:
# Make relative # Get common part of selected path and current
common = os.path.commonprefix([os.path.abspath(g.frame.dataFile), if g.frame.dataFile:
dlg.GetPath()]) curpath = os.path.abspath(g.frame.dataFile)
else:
curpath = os.path.join(os.getcwd(), '')
common = os.path.commonprefix([curpath, dlg.GetPath()])
self.SetValue(dlg.GetPath()[len(common):]) self.SetValue(dlg.GetPath()[len(common):])
self.SetModified() self.SetModified()
self.textModified = false self.textModified = false