dialogs/SFCTransitionDialog.py
branchpython3
changeset 3750 f62625418bff
parent 3303 0ffb41625592
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
    21 #
    21 #
    22 # You should have received a copy of the GNU General Public License
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 from __future__ import absolute_import
    26 
    27 import wx
    27 import wx
    28 
    28 
    29 from graphics.SFC_Objects import SFC_Transition
    29 from graphics.SFC_Objects import SFC_Transition
    30 from dialogs.BlockPreviewDialog import BlockPreviewDialog
    30 from dialogs.BlockPreviewDialog import BlockPreviewDialog
    31 
    31 
   115         Return type selected for SFC transition and associated value
   115         Return type selected for SFC transition and associated value
   116         @return: Type selected and associated value (None if no value)
   116         @return: Type selected and associated value (None if no value)
   117         """
   117         """
   118         # Go through radio buttons and return type and value associated to the
   118         # Go through radio buttons and return type and value associated to the
   119         # one that is selected
   119         # one that is selected
   120         for type, (radio, control) in self.TypeRadioButtons.iteritems():
   120         for type, (radio, control) in self.TypeRadioButtons.items():
   121             if radio.GetValue():
   121             if radio.GetValue():
   122                 if isinstance(control, wx.ComboBox):
   122                 if isinstance(control, wx.ComboBox):
   123                     return type, control.GetStringSelection()
   123                     return type, control.GetStringSelection()
   124                 elif isinstance(control, wx.TextCtrl):
   124                 elif isinstance(control, wx.TextCtrl):
   125                     return type, control.GetValue()
   125                     return type, control.GetValue()
   134         """
   134         """
   135         # Extract transition value according to type
   135         # Extract transition value according to type
   136         type_value = values.get("value", None)
   136         type_value = values.get("value", None)
   137 
   137 
   138         # For each parameters defined, set corresponding control value
   138         # For each parameters defined, set corresponding control value
   139         for name, value in values.items():
   139         for name, value in list(values.items()):
   140 
   140 
   141             # Parameter is SFC transition priority
   141             # Parameter is SFC transition priority
   142             if name == "priority":
   142             if name == "priority":
   143                 self.Priority.SetValue(values["priority"])
   143                 self.Priority.SetValue(values["priority"])
   144 
   144 
   145             # Parameter is SFC transition type
   145             # Parameter is SFC transition type
   146             elif name == "type":
   146             elif name == "type":
   147                 for type, (radio, control) in self.TypeRadioButtons.iteritems():
   147                 for type, (radio, control) in self.TypeRadioButtons.items():
   148                     radio.SetValue(type == value)
   148                     radio.SetValue(type == value)
   149                     if control is not None:
   149                     if control is not None:
   150                         # Enable associated control to type and set value
   150                         # Enable associated control to type and set value
   151                         control.Enable(type == value)
   151                         control.Enable(type == value)
   152                         if type == value:
   152                         if type == value:
   195         """
   195         """
   196         Called when transition type changed
   196         Called when transition type changed
   197         @param event: wx.RadioButtonEvent
   197         @param event: wx.RadioButtonEvent
   198         """
   198         """
   199         # Refresh sensibility of control associated to transition types
   199         # Refresh sensibility of control associated to transition types
   200         for _type, (radio, control) in self.TypeRadioButtons.iteritems():
   200         for _type, (radio, control) in self.TypeRadioButtons.items():
   201             if control is not None:
   201             if control is not None:
   202                 control.Enable(radio.GetValue())
   202                 control.Enable(radio.GetValue())
   203 
   203 
   204         # Refresh preview panel
   204         # Refresh preview panel
   205         self.RefreshPreview()
   205         self.RefreshPreview()