mailr16174 - 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 10, 2012 - 11:17:
Author: bugman
Date: Thu May 10 11:17:44 2012
New Revision: 16174

URL: http://svn.gna.org/viewcvs/relax?rev=16174&view=rev
Log:
The integer user function GUI elements which can be None now are simply set 
to a wx.TextCtrl.

The wx.SpinCtrl used previously was incorrect, as a wx.SpinCtrl only handles 
integers, always
defaulting to the minimum of the control.  Therefore the can_be_none user 
function arg arg is now
propagated into the wizard page Value, Sequence and Sequence_2D elements 
(though they are not
functional in the Sequence* classes yet).


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=16174&r1=16173&r2=16174&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Thu May 10 11:17:44 2012
@@ -219,7 +219,7 @@
 
             # Value types.
             elif arg['py_type'] in ['float', 'int', 'num', 'str']:
-                self.element_value(key=arg['name'], default=arg['default'], 
element_type=arg['wiz_element_type'], value_type=arg['py_type'], 
min=arg['min'], max=arg['max'], sizer=sizer, desc=desc, 
combo_choices=arg['wiz_combo_choices'], combo_data=arg['wiz_combo_data'], 
tooltip=arg['desc'], read_only=arg['wiz_read_only'])
+                self.element_value(key=arg['name'], default=arg['default'], 
element_type=arg['wiz_element_type'], value_type=arg['py_type'], 
min=arg['min'], max=arg['max'], sizer=sizer, desc=desc, 
combo_choices=arg['wiz_combo_choices'], combo_data=arg['wiz_combo_data'], 
tooltip=arg['desc'], read_only=arg['wiz_read_only'], 
can_be_none=arg['can_be_none'])
 
             # Bool type.
             elif arg['py_type'] == 'bool':
@@ -246,7 +246,7 @@
                 if arg['py_type'] in ['float_or_float_list', 
'int_or_int_list', 'num_or_num_list', 'str_or_str_list', 
'float_or_float_tuple', 'int_or_int_tuple', 'num_or_num_tuple', 
'str_or_str_tuple']:
                     single_value = True
 
-                self.element_sequence(key=arg['name'], 
default=arg['default'], element_type=arg['wiz_element_type'], 
seq_type=seq_type, value_type=value_type, min=arg['min'], max=arg['max'], 
sizer=sizer, desc=desc, combo_choices=arg['wiz_combo_choices'], 
combo_data=arg['wiz_combo_data'], combo_list_size=arg['wiz_combo_list_size'], 
tooltip=arg['desc'], single_value=single_value, 
read_only=arg['wiz_read_only'])
+                self.element_sequence(key=arg['name'], 
default=arg['default'], element_type=arg['wiz_element_type'], 
seq_type=seq_type, value_type=value_type, min=arg['min'], max=arg['max'], 
sizer=sizer, desc=desc, combo_choices=arg['wiz_combo_choices'], 
combo_data=arg['wiz_combo_data'], combo_list_size=arg['wiz_combo_list_size'], 
tooltip=arg['desc'], single_value=single_value, 
read_only=arg['wiz_read_only'], can_be_none=arg['can_be_none'])
 
             # 2D sequence types.
             elif arg['py_type'] in ['float_list_of_lists', 
'int_list_of_lists', 'num_list_of_lists', 'str_list_of_lists', 
'float_tuple_of_tuples', 'int_tuple_of_tuples', 'num_tuple_of_tuples', 
'str_tuple_of_tuples']:
@@ -264,7 +264,7 @@
                 else:
                     value_type = 'str'
 
-                self.element_sequence_2D(key=arg['name'], 
default=arg['default'], sizer=sizer, element_type=arg['wiz_element_type'], 
seq_type=seq_type, value_type=value_type, min=arg['min'], max=arg['max'], 
titles=arg['list_titles'], desc=desc, combo_choices=arg['wiz_combo_choices'], 
combo_data=arg['wiz_combo_data'], combo_list_size=arg['wiz_combo_list_size'], 
tooltip=arg['desc'], read_only=arg['wiz_read_only'])
+                self.element_sequence_2D(key=arg['name'], 
default=arg['default'], sizer=sizer, element_type=arg['wiz_element_type'], 
seq_type=seq_type, value_type=value_type, min=arg['min'], max=arg['max'], 
titles=arg['list_titles'], desc=desc, combo_choices=arg['wiz_combo_choices'], 
combo_data=arg['wiz_combo_data'], combo_list_size=arg['wiz_combo_list_size'], 
tooltip=arg['desc'], read_only=arg['wiz_read_only'], 
can_be_none=arg['can_be_none'])
 
             # Unknown type.
             else:

Modified: branches/uf_redesign/gui/wizard.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard.py?rev=16174&r1=16173&r2=16174&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard.py (original)
+++ branches/uf_redesign/gui/wizard.py Thu May 10 11:17:44 2012
@@ -683,7 +683,7 @@
         self._elements[key] = element
 
 
-    def element_sequence(self, key=None, default=None, sizer=None, 
element_type='default', seq_type=None, value_type=None, min=None, max=None, 
desc=None, combo_choices=None, combo_data=None, combo_list_size=None, 
tooltip=None, divider=None, padding=0, spacer=None, single_value=False, 
read_only=False):
+    def element_sequence(self, key=None, default=None, sizer=None, 
element_type='default', seq_type=None, value_type=None, min=None, max=None, 
desc=None, combo_choices=None, combo_data=None, combo_list_size=None, 
tooltip=None, divider=None, padding=0, spacer=None, single_value=False, 
read_only=False, can_be_none=False):
         """Set up the element and store it.
 
         @keyword key:               The dictionary key to store the element 
with.
@@ -722,16 +722,18 @@
         @type single_value:         bool
         @keyword read_only:         A flag which if True means that the text 
of the element cannot be edited.
         @type read_only:            bool
+        @keyword can_be_none:       A flag which specifies if the element is 
allowed to have the None value.
+        @type can_be_none:          bool
         """
 
         # Create the element.
-        element = Sequence(name=key, default=default, 
element_type=element_type, seq_type=seq_type, value_type=value_type, min=min, 
max=max, parent=self, sizer=sizer, desc=desc, combo_choices=combo_choices, 
combo_data=combo_data, combo_list_size=combo_list_size, tooltip=tooltip, 
divider=divider, padding=padding, spacer=spacer, single_value=single_value, 
read_only=read_only)
+        element = Sequence(name=key, default=default, 
element_type=element_type, seq_type=seq_type, value_type=value_type, min=min, 
max=max, parent=self, sizer=sizer, desc=desc, combo_choices=combo_choices, 
combo_data=combo_data, combo_list_size=combo_list_size, tooltip=tooltip, 
divider=divider, padding=padding, spacer=spacer, single_value=single_value, 
read_only=read_only, can_be_none=can_be_none)
 
         # Store it.
         self._elements[key] = element
 
 
-    def element_sequence_2D(self, key=None, default=None, sizer=None, 
element_type='default', seq_type=None, value_type=None, min=None, max=None, 
titles=None, desc=None, combo_choices=None, combo_data=None, 
combo_list_size=None, tooltip=None, divider=None, padding=0, spacer=None, 
read_only=False):
+    def element_sequence_2D(self, key=None, default=None, sizer=None, 
element_type='default', seq_type=None, value_type=None, min=None, max=None, 
titles=None, desc=None, combo_choices=None, combo_data=None, 
combo_list_size=None, tooltip=None, divider=None, padding=0, spacer=None, 
read_only=False, can_be_none=False):
         """Set up the element and store it.
 
         @keyword key:               The dictionary key to store the element 
with.
@@ -770,16 +772,18 @@
         @type spacer:               None or int
         @keyword read_only:         A flag which if True means that the text 
of the element cannot be edited.
         @type read_only:            bool
+        @keyword can_be_none:       A flag which specifies if the element is 
allowed to have the None value.
+        @type can_be_none:          bool
         """
 
         # Create the element.
-        element = Sequence_2D(name=key, parent=self, default=default, 
sizer=sizer, element_type=element_type, seq_type=seq_type, 
value_type=value_type, min=min, max=max, titles=titles, desc=desc, 
combo_choices=combo_choices, combo_data=combo_data, 
combo_list_size=combo_list_size, tooltip=tooltip, divider=divider, 
padding=padding, spacer=spacer, read_only=read_only)
+        element = Sequence_2D(name=key, parent=self, default=default, 
sizer=sizer, element_type=element_type, seq_type=seq_type, 
value_type=value_type, min=min, max=max, titles=titles, desc=desc, 
combo_choices=combo_choices, combo_data=combo_data, 
combo_list_size=combo_list_size, tooltip=tooltip, divider=divider, 
padding=padding, spacer=spacer, read_only=read_only, can_be_none=can_be_none)
 
         # Store it.
         self._elements[key] = element
 
 
-    def element_value(self, key=None, default=None, element_type='text', 
value_type=None, min=None, max=None, sizer=None, desc=None, 
combo_choices=None, combo_data=None, tooltip=None, divider=None, padding=0, 
spacer=None, read_only=False):
+    def element_value(self, key=None, default=None, element_type='text', 
value_type=None, min=None, max=None, sizer=None, desc=None, 
combo_choices=None, combo_data=None, tooltip=None, divider=None, padding=0, 
spacer=None, read_only=False, can_be_none=False):
         """Set up the string element and store it.
 
         @keyword key:           The dictionary key to store the element with.
@@ -815,10 +819,12 @@
         @type spacer:           None or int
         @keyword read_only:     A flag which if True means that the text of 
the element cannot be edited.
         @type read_only:        bool
+        @keyword can_be_none:   A flag which specifies if the element is 
allowed to have the None value.
+        @type can_be_none:      bool
         """
 
         # Create the element.
-        element = Value(name=key, parent=self, default=default, 
element_type=element_type, value_type=value_type, min=min, max=max, 
sizer=sizer, desc=desc, combo_choices=combo_choices, combo_data=combo_data, 
tooltip=tooltip, divider=divider, padding=padding, spacer=spacer, 
read_only=read_only)
+        element = Value(name=key, parent=self, default=default, 
element_type=element_type, value_type=value_type, min=min, max=max, 
sizer=sizer, desc=desc, combo_choices=combo_choices, combo_data=combo_data, 
tooltip=tooltip, divider=divider, padding=padding, spacer=spacer, 
read_only=read_only, can_be_none=can_be_none)
 
         # 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=16174&r1=16173&r2=16174&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard_elements.py (original)
+++ branches/uf_redesign/gui/wizard_elements.py Thu May 10 11:17:44 2012
@@ -55,7 +55,7 @@
         - tuple of strings
     """
 
-    def __init__(self, name=None, default=None, parent=None, 
element_type='default', seq_type=None, value_type=None, min=0, max=1000, 
sizer=None, desc=None, combo_choices=None, combo_data=None, 
combo_list_size=None, tooltip=None, divider=None, padding=0, spacer=None, 
single_value=False, read_only=False):
+    def __init__(self, name=None, default=None, parent=None, 
element_type='default', seq_type=None, value_type=None, min=0, max=1000, 
sizer=None, desc=None, combo_choices=None, combo_data=None, 
combo_list_size=None, tooltip=None, divider=None, padding=0, spacer=None, 
single_value=False, read_only=False, can_be_none=False):
         """Set up the element.
 
         @keyword name:              The name of the element to use in 
titles, etc.
@@ -96,6 +96,8 @@
         @type single_value:         bool
         @keyword read_only:         A flag which if True means that the text 
of the element cannot be edited.
         @type read_only:            bool
+        @keyword can_be_none:       A flag which specifies if the element is 
allowed to have the None value.
+        @type can_be_none:          bool
         """
 
         # Store the args.
@@ -702,7 +704,7 @@
         - tuple of strings
     """
 
-    def __init__(self, name=None, default=None, parent=None, sizer=None, 
element_type='default', seq_type=None, value_type=None, min=0, max=1000, 
titles=None, desc=None, combo_choices=None, combo_data=None, 
combo_list_size=None, tooltip=None, divider=None, padding=0, spacer=None, 
read_only=False):
+    def __init__(self, name=None, default=None, parent=None, sizer=None, 
element_type='default', seq_type=None, value_type=None, min=0, max=1000, 
titles=None, desc=None, combo_choices=None, combo_data=None, 
combo_list_size=None, tooltip=None, divider=None, padding=0, spacer=None, 
read_only=False, can_be_none=False):
         """Set up the element.
 
         @keyword name:              The name of the element to use in 
titles, etc.
@@ -743,6 +745,8 @@
         @type spacer:               None or int
         @keyword read_only:         A flag which if True means that the text 
of the element cannot be edited.
         @type read_only:            bool
+        @keyword can_be_none:       A flag which specifies if the element is 
allowed to have the None value.
+        @type can_be_none:          bool
         """
 
         # Store some of the args.
@@ -1137,7 +1141,7 @@
         - strings
     """
 
-    def __init__(self, name=None, default=None, parent=None, 
element_type='default', value_type=None, sizer=None, desc=None, 
combo_choices=None, combo_data=None, min=0, max=1000, tooltip=None, 
divider=None, padding=0, spacer=None, read_only=False):
+    def __init__(self, name=None, default=None, parent=None, 
element_type='default', value_type=None, sizer=None, desc=None, 
combo_choices=None, combo_data=None, min=0, max=1000, tooltip=None, 
divider=None, padding=0, spacer=None, read_only=False, can_be_none=False):
         """Set up the base value element.
 
         @keyword name:          The name of the element to use in titles, 
etc.
@@ -1175,12 +1179,14 @@
         @type spacer:           None or int
         @keyword read_only:     A flag which if True means that the text of 
the element cannot be edited.
         @type read_only:        bool
+        @keyword can_be_none:   A flag which specifies if the element is 
allowed to have the None value.
+        @type can_be_none:      bool
         """
 
         # Set the default.
         if element_type == 'default':
             # Set the default to a SpinCtrl for integers.
-            if value_type == 'int':
+            if value_type == 'int' and not can_be_none:
                 element_type = 'spin'
 
             # Set the default to a TextCtrl for all other types.




Related Messages


Powered by MHonArc, Updated Thu May 10 11:20:01 2012