mailr16162 - 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 09, 2012 - 17:13:
Author: bugman
Date: Wed May  9 17:13:12 2012
New Revision: 16162

URL: http://svn.gna.org/viewcvs/relax?rev=16162&view=rev
Log:
The user function args can now have minimum and maximum values for integers 
specified.

This was accidentally partly committed in the last commit!  The min and max 
args can now be given,
and these are then propagated all the way to the GUI elements.  For the 
Sequence and Sequence_2D
elements this has no effect yet as they do not implement wx.SpinCtrl elements.


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=16162&r1=16161&r2=16162&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Wed May  9 17:13:12 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'], 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'])
 
             # Bool type.
             elif arg['py_type'] == 'bool':
@@ -246,9 +246,9 @@
                 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, 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'])
-
-            # String list of lists.
+                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'])
+
+            # 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']:
                 # The sequence type.
                 if arg['py_type'] in ['float_list_of_lists', 
'int_list_of_lists', 'num_list_of_lists', 'str_list_of_lists']:
@@ -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, 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'])
 
             # Unknown type.
             else:

Modified: branches/uf_redesign/gui/wizard.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard.py?rev=16162&r1=16161&r2=16162&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard.py (original)
+++ branches/uf_redesign/gui/wizard.py Wed May  9 17:13:12 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, 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):
         """Set up the element and store it.
 
         @keyword key:               The dictionary key to store the element 
with.
@@ -698,6 +698,10 @@
         @type seq_type:             str
         @keyword value_type:        The type of Python object that the 
values of the sequence should be.  This can be one of 'float', 'int', or 
'str'.
         @type value_type:           str
+        @keyword min:               The minimum value allowed for integer 
types.  This is used in the wx.SpinCtrl for example.
+        @type min:                  int
+        @keyword max:               The maximum value allowed for integer 
types.  This is used in the wx.SpinCtrl for example.
+        @type max:                  int
         @keyword desc:              The text description.
         @type desc:                 str
         @keyword combo_choices:     The list of choices to present to the 
user.  This is only used if the element_type is set to 'combo'.
@@ -721,13 +725,13 @@
         """
 
         # Create the element.
-        element = Sequence(name=key, default=default, 
element_type=element_type, seq_type=seq_type, value_type=value_type, 
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)
 
         # 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, 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):
         """Set up the element and store it.
 
         @keyword key:               The dictionary key to store the element 
with.
@@ -742,6 +746,10 @@
         @type seq_type:             str
         @keyword value_type:        The type of Python object that the 
values of the sequence should be.  This can be one of 'float', 'int', or 
'str'.
         @type value_type:           str
+        @keyword min:               The minimum value allowed for integer 
types.  This is used in the wx.SpinCtrl for example.
+        @type min:                  int
+        @keyword max:               The maximum value allowed for integer 
types.  This is used in the wx.SpinCtrl for example.
+        @type max:                  int
         @keyword titles:            The titles of each of the elements of 
the fixed width second dimension.
         @type titles:               list of str
         @keyword desc:              The text description.
@@ -765,13 +773,13 @@
         """
 
         # 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, 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)
 
         # Store it.
         self._elements[key] = element
 
 
-    def element_value(self, key=None, default=None, element_type='text', 
value_type=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):
         """Set up the string element and store it.
 
         @keyword key:           The dictionary key to store the element with.
@@ -785,6 +793,10 @@
         @type element_type:     str
         @keyword value_type:    The type of Python object that the value 
should be.  This can be one of 'float', 'int', or 'str'.
         @type value_type:       str
+        @keyword min:           The minimum value allowed for integer types. 
 This is used in the wx.SpinCtrl for example.
+        @type min:              int
+        @keyword max:           The maximum value allowed for integer types. 
 This is used in the wx.SpinCtrl for example.
+        @type max:              int
         @keyword sizer:         The sizer to put the input field widget into.
         @type sizer:            wx.Sizer instance
         @keyword desc:          The text description.
@@ -806,7 +818,7 @@
         """
 
         # Create the element.
-        element = Value(name=key, parent=self, default=default, 
element_type=element_type, value_type=value_type, 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)
 
         # 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=16162&r1=16161&r2=16162&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard_elements.py (original)
+++ branches/uf_redesign/gui/wizard_elements.py Wed May  9 17:13:12 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, 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):
         """Set up the element.
 
         @keyword name:              The name of the element to use in 
titles, etc.
@@ -70,6 +70,10 @@
         @type seq_type:             str
         @keyword value_type:        The type of Python object that the value 
should be.  This can be one of 'float', 'int', or 'str'.
         @type value_type:           str
+        @keyword min:               For a SpinCtrl, the minimum value 
allowed.
+        @type min:                  int
+        @keyword max:               For a SpinCtrl, the maximum value 
allowed.
+        @type max:                  int
         @keyword sizer:             The sizer to put the input field widget 
into.
         @type sizer:                wx.Sizer instance
         @keyword desc:              The text description.
@@ -698,7 +702,7 @@
         - tuple of strings
     """
 
-    def __init__(self, name=None, default=None, parent=None, sizer=None, 
element_type='default', seq_type=None, value_type=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 __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):
         """Set up the element.
 
         @keyword name:              The name of the element to use in 
titles, etc.
@@ -715,6 +719,10 @@
         @type seq_type:             str
         @keyword value_type:        The type of Python object that the value 
should be.  This can be one of 'float', 'int', or 'str'.
         @type value_type:           str
+        @keyword min:               For a SpinCtrl, the minimum value 
allowed.
+        @type min:                  int
+        @keyword max:               For a SpinCtrl, the maximum value 
allowed.
+        @type max:                  int
         @keyword titles:            The titles of each of the elements of 
the fixed width second dimension.
         @type titles:               list of str
         @keyword desc:              The text description.




Related Messages


Powered by MHonArc, Updated Wed May 09 17:40:01 2012