mailr16093 - in /branches/uf_redesign/gui: uf_objects.py wizard.py wizard_elements.py


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

Header


Content

Posted by edward on May 08, 2012 - 14:33:
Author: bugman
Date: Tue May  8 14:33:22 2012
New Revision: 16093

URL: http://svn.gna.org/viewcvs/relax?rev=16093&view=rev
Log:
Improvements to the Selector_dir wizard page GUI element.

The icon is now for a directory open and not file open, the tooltip is also 
fixed, and the default
value is now passed all the way through.


Modified:
    branches/uf_redesign/gui/uf_objects.py
    branches/uf_redesign/gui/wizard.py
    branches/uf_redesign/gui/wizard_elements.py

Modified: branches/uf_redesign/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16093&r1=16092&r2=16093&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Tue May  8 14:33:22 2012
@@ -202,7 +202,7 @@
 
             # Special arg type:  directory selection dialog.
             elif arg['arg_type'] == 'dir sel':
-                self.element_dir_sel(key=arg['name'], sizer=sizer, 
desc=desc, tooltip=arg['desc'], read_only=arg['wiz_read_only'])
+                self.element_dir_sel(key=arg['name'], 
default=arg['default'], sizer=sizer, desc=desc, tooltip=arg['desc'], 
read_only=arg['wiz_read_only'])
 
             # Special arg type:  free format file settings.
             elif arg['arg_type'] == 'free format':

Modified: branches/uf_redesign/gui/wizard.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard.py?rev=16093&r1=16092&r2=16093&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard.py (original)
+++ branches/uf_redesign/gui/wizard.py Tue May  8 14:33:22 2012
@@ -615,11 +615,13 @@
         self._elements[key] = element
 
 
-    def element_dir_sel(self, key=None, sizer=None, desc=None, 
message='Directory selection', tooltip=None, divider=None, padding=0, 
spacer=None, read_only=False):
+    def element_dir_sel(self, key=None, default=None, sizer=None, desc=None, 
message='Directory selection', tooltip=None, divider=None, padding=0, 
spacer=None, read_only=False):
         """Set up the integer element and store it.
 
         @keyword key:           The dictionary key to store the element with.
         @type key:              str
+        @keyword default:       The default value of the element.
+        @type default:          str
         @keyword sizer:         The sizer to put the input field widget into.
         @type sizer:            wx.Sizer instance
         @keyword desc:          The text description.
@@ -639,7 +641,7 @@
         """
 
         # Create the element.
-        element = Selector_dir(name=key, parent=self, sizer=sizer, 
desc=desc, message=message, tooltip=tooltip, divider=divider, 
padding=padding, spacer=spacer, read_only=read_only)
+        element = Selector_dir(name=key, default=default, parent=self, 
sizer=sizer, desc=desc, message=message, tooltip=tooltip, divider=divider, 
padding=padding, spacer=spacer, read_only=read_only)
 
         # Store it.
         self._elements[key] = element

Modified: branches/uf_redesign/gui/wizard_elements.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard_elements.py?rev=16093&r1=16092&r2=16093&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard_elements.py (original)
+++ branches/uf_redesign/gui/wizard_elements.py Tue May  8 14:33:22 2012
@@ -30,6 +30,7 @@
 import wx.lib.mixins.listctrl
 
 # relax module imports.
+from graphics import fetch_icon
 from relax_errors import RelaxError
 from status import Status; status = Status()
 
@@ -410,11 +411,13 @@
 class Selector_dir:
     """Wizard GUI element for selecting directories."""
 
-    def __init__(self, name=None, parent=None, sizer=None, desc=None, 
message='File selection', style=wx.FD_DEFAULT_STYLE, tooltip=None, 
divider=None, padding=0, spacer=None, read_only=False):
+    def __init__(self, name=None, default=None, parent=None, sizer=None, 
desc=None, message='File selection', style=wx.FD_DEFAULT_STYLE, tooltip=None, 
divider=None, padding=0, spacer=None, read_only=False):
         """Build the file selection element.
 
         @keyword name:      The name of the element to use in titles, etc.
         @type name:         str
+        @keyword default:   The default value of the element.
+        @type default:      str
         @keyword parent:    The wizard GUI element.
         @type parent:       wx.Panel instance
         @keyword sizer:     The sizer to put the input field into.
@@ -462,22 +465,24 @@
         # The input field.
         if not hasattr(parent, 'file_selection_field'):
             parent.file_selection_field = []
-        parent.file_selection_field.append(wx.TextCtrl(parent, -1, ''))
+        parent.file_selection_field.append(wx.TextCtrl(parent, -1, default))
         self._field = parent.file_selection_field[-1]
         self._field.SetMinSize((-1, parent.height_element))
         self._field.SetFont(font.normal)
         sub_sizer.Add(self._field, 1, 
wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)
 
-        # The file selection object.
-        obj = RelaxDirDialog(parent, field=self._field, message=message, 
style=style)
+        # The directory selection object.
+        if default == None:
+            default = wx.EmptyString
+        obj = RelaxDirDialog(parent, field=self._field, message=message, 
defaultPath=default, style=style)
 
         # A little spacing.
         sub_sizer.AddSpacer(5)
 
         # The file selection button.
-        button = wx.BitmapButton(parent, -1, 
wx.Bitmap(paths.icon_16x16.open, wx.BITMAP_TYPE_ANY))
+        button = wx.BitmapButton(parent, -1, 
wx.Bitmap(fetch_icon('oxygen.actions.document-open-folder'), 
wx.BITMAP_TYPE_ANY))
         button.SetMinSize((parent.height_element, parent.height_element))
-        button.SetToolTipString("Select the file.")
+        button.SetToolTipString("Select the directory.")
         sub_sizer.Add(button, 0, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 
0)
         parent.Bind(wx.EVT_BUTTON, obj.select_event, button)
 




Related Messages


Powered by MHonArc, Updated Tue May 08 14:40:02 2012