mailr10373 - /branches/bieri_gui/gui_bieri/filedialog.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 26, 2010 - 13:40:
Author: bugman
Date: Tue Jan 26 13:40:54 2010
New Revision: 10373

URL: http://svn.gna.org/viewcvs/relax?rev=10373&view=rev
Log:
Modified the openfile() function to match the relax conventions.

The function comments were converted to the function docstring, comments were 
added to the code,
and the spacing was fixed.


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=10373&r1=10372&r2=10373&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/filedialog.py (original)
+++ branches/bieri_gui/gui_bieri/filedialog.py Tue Jan 26 13:40:54 2010
@@ -54,23 +54,30 @@
         return newdir
 
 
-def openfile(msg, directory, filetype, default): # open a file
+def openfile(msg, directory, filetype, default):
+    """Open a file.
 
-    #Input format:
-    #msg:              message to display
-    #directory:        directory, where dialog opens as default
-    #filetype:         proposed file to open
-    #default:          list of supported files, indicated as "(Label)|os 
command|...
+    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 (*.*)|*.*')
 
-    #command:
-    #openfile('select file to open', '/usr', 'save.relaxGUI', 'relaxGUI 
files (*.relaxGUI)|*.relaxGUI|all files (*.*)|*.*')
-    #suggests to open /usr/save.relaxGUI, supported files to open are: 
*.relaxGUI, *.*
 
-    newfile = None
-    dialog = wx.FileDialog ( None, message = msg, style = wx.OPEN, 
defaultDir= directory, defaultFile = filetype, wildcard = default)
+    @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|...
+    @type default:      str
+    """
+
+    # Open the dialog.
+    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:
-        newfile = dialog.GetPath()
-        return newfile
+        # Return the full file path.
+        return dialog.GetPath()
 
 
 def savefile(msg, directory, filetype, default): # save a file




Related Messages


Powered by MHonArc, Updated Tue Jan 26 14:00:02 2010