Author: bugman Date: Tue Jan 26 13:47:55 2010 New Revision: 10375 URL: http://svn.gna.org/viewcvs/relax?rev=10375&view=rev Log: Reverted the last revision (r10374) as the directory arg was lost. The command used was: svn merge -r10374:10373 . This directory arg will be useful in other parts of the GUI. Modified: branches/bieri_gui/gui_bieri/filedialog.py Modified: branches/bieri_gui/gui_bieri/filedialog.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/filedialog.py?rev=10375&r1=10374&r2=10375&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/filedialog.py (original) +++ branches/bieri_gui/gui_bieri/filedialog.py Tue Jan 26 13:47:55 2010 @@ -23,8 +23,6 @@ # file dialog script -# Python module imports. -from os import chdir, getcwd import wx @@ -56,15 +54,17 @@ return newdir -def openfile(msg, filetype, default): +def openfile(msg, directory, filetype, default): """Open a file. - For example to open save.relaxGUI, where the supported files to open are: *.relaxGUI, *.*: - openfile('select file to open', 'save.relaxGUI', 'relaxGUI files (*.relaxGUI)|*.relaxGUI|all files (*.*)|*.*') + For example to open /usr/save.relaxGUI, where the supported files to open are: *.relaxGUI, *.*: + openfile('select file to open', '/usr', 'save.relaxGUI', 'relaxGUI files (*.relaxGUI)|*.relaxGUI|all files (*.*)|*.*') @param msg: The message to display. @type msg: str + @param directory: The directory to open in. + @type directory: str @param filetype: The file to default selection to. @type filetype: str @param default: A list of supported files, indicated as "(Label)|os command|... @@ -72,13 +72,10 @@ """ # Open the dialog. - dialog = wx.FileDialog(None, message=msg, style=wx.OPEN, defaultDir=getcwd(), defaultFile=filetype, wildcard=default) + dialog = wx.FileDialog(None, message=msg, style=wx.OPEN, defaultDir=directory, defaultFile=filetype, wildcard=default) # A file was selected. if dialog.ShowModal() == wx.ID_OK: - # Change the current working directory. - chdir(dialog.GetDirectory()) - # Return the full file path. return dialog.GetPath()