Author: bugman Date: Thu Dec 30 16:58:21 2010 New Revision: 12044 URL: http://svn.gna.org/viewcvs/relax?rev=12044&view=rev Log: Fix for the file selection widget in the user function windows - the file type is now not hardcoded. The code was copied from the script user function window so that the filetype was hardcoded to *.py!!! Modified: branches/bieri_gui/gui_bieri/user_functions/base.py branches/bieri_gui/gui_bieri/user_functions/sequence.py Modified: branches/bieri_gui/gui_bieri/user_functions/base.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/base.py?rev=12044&r1=12043&r2=12044&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/base.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/base.py Thu Dec 30 16:58:21 2010 @@ -42,15 +42,21 @@ class File_selector: """Class for handling file selection dialogs and updating the respective fields.""" - def __init__(self, field): + def __init__(self, field, title='File selection', default="all files (*.*)|*"): """Setup the class and store the field. @param field: The field to update with the file selection. @type field: wx.TextCtrl instance + @keyword title: The text title to put at the top of the dialog window. + @type title: str + @keyword default: The default file type. + @type default: str """ # Store the args. self.field = field + self.title = title + self.default = default def select(self, event): @@ -61,7 +67,7 @@ """ # Open the file selection dialog. - file = openfile(msg='Select the relax script to execute', default='relax scripts (*.py)|*.py') + file = openfile(msg=self.title, default=self.default) # Check the file. if not file: @@ -461,15 +467,19 @@ raise RelaxImplementError - def file_selection(self, sizer, desc): + def file_selection(self, sizer, desc, title='File selection', default="all files (*.*)|*"): """Build the file selection element. - @param sizer: The sizer to put the input field into. - @type sizer: wx.Sizer instance - @param desc: The text description. - @type desc: str - @return: The file selection GUI element. - @rtype: wx.TextCtrl + @param sizer: The sizer to put the input field into. + @type sizer: wx.Sizer instance + @param desc: The text description. + @type desc: str + @keyword title: The text title to put at the top of the dialog window. + @type title: str + @keyword default: The default file type. + @type default: str + @return: The file selection GUI element. + @rtype: wx.TextCtrl """ # Init. @@ -489,7 +499,7 @@ sub_sizer.Add(field, 0, wx.ALIGN_CENTER_VERTICAL, 0) # The file selection object. - obj = File_selector(field) + obj = File_selector(field, title=title, default=default) # The file selection button. button = wx.BitmapButton(self, -1, wx.Bitmap(paths.icon_16x16.open, wx.BITMAP_TYPE_ANY)) Modified: branches/bieri_gui/gui_bieri/user_functions/sequence.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/sequence.py?rev=12044&r1=12043&r2=12044&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/sequence.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/sequence.py Thu Dec 30 16:58:21 2010 @@ -78,7 +78,7 @@ """ # Add a file selection. - self.file = self.file_selection(sizer, "The sequence file:") + self.file = self.file_selection(sizer, "The sequence file:", title="Sequence file selection") # The parameter file settings. self.free_file_format(sizer)