dialogs/ConnectionDialog.py
changeset 1768 691083b5682a
parent 1745 f9d32913bad4
child 1782 5b6ad7a7fd9d
equal deleted inserted replaced
1767:c74815729afd 1768:691083b5682a
    48         @param tagname: Tagname of project POU edited
    48         @param tagname: Tagname of project POU edited
    49         @param apply_button: Enable button for applying connector modification
    49         @param apply_button: Enable button for applying connector modification
    50         to all connector having the same name in POU (default: False)
    50         to all connector having the same name in POU (default: False)
    51         """
    51         """
    52         BlockPreviewDialog.__init__(self, parent, controller, tagname,
    52         BlockPreviewDialog.__init__(self, parent, controller, tagname,
    53               title=_('Connection Properties'))
    53                                     title=_('Connection Properties'))
    54 
    54 
    55         # Init common sizers
    55         # Init common sizers
    56         self._init_sizers(2, 0, 7, 1, 0, None)
    56         self._init_sizers(2, 0, 7, 1, 0, None)
    57 
    57 
    58         # Create label for connection type
    58         # Create label for connection type
    63         self.TypeRadioButtons = {}
    63         self.TypeRadioButtons = {}
    64         first = True
    64         first = True
    65         for type, label in [(CONNECTOR, _('Connector')),
    65         for type, label in [(CONNECTOR, _('Connector')),
    66                             (CONTINUATION, _('Continuation'))]:
    66                             (CONTINUATION, _('Continuation'))]:
    67             radio_button = wx.RadioButton(self, label=label,
    67             radio_button = wx.RadioButton(self, label=label,
    68                   style=(wx.RB_GROUP if first else 0))
    68                                           style=(wx.RB_GROUP if first else 0))
    69             radio_button.SetValue(first)
    69             radio_button.SetValue(first)
    70             self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
    70             self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
    71             self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
    71             self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
    72             self.TypeRadioButtons[type] = radio_button
    72             self.TypeRadioButtons[type] = radio_button
    73             first = False
    73             first = False
    86         self.Preview.SetMinSize(wx.Size(-1, 100))
    86         self.Preview.SetMinSize(wx.Size(-1, 100))
    87         self.LeftGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
    87         self.LeftGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
    88         self.LeftGridSizer.AddWindow(self.Preview, flag=wx.GROW)
    88         self.LeftGridSizer.AddWindow(self.Preview, flag=wx.GROW)
    89 
    89 
    90         # Add buttons sizer to sizers
    90         # Add buttons sizer to sizers
    91         self.MainSizer.AddSizer(self.ButtonSizer, border=20,
    91         self.MainSizer.AddSizer(
    92               flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
    92             self.ButtonSizer, border=20,
       
    93             flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
    93         self.ColumnSizer.RemoveSizer(self.RightGridSizer)
    94         self.ColumnSizer.RemoveSizer(self.RightGridSizer)
    94 
    95 
    95         # Add button for applying connection name modification to all connection
    96         # Add button for applying connection name modification to all connection
    96         # of POU
    97         # of POU
    97         if apply_button:
    98         if apply_button:
   212         Refresh preview panel of graphic element
   213         Refresh preview panel of graphic element
   213         Override BlockPreviewDialog function
   214         Override BlockPreviewDialog function
   214         """
   215         """
   215         # Set graphic element displayed, creating a FBD connection element
   216         # Set graphic element displayed, creating a FBD connection element
   216         self.Element = FBD_Connector(self.Preview,
   217         self.Element = FBD_Connector(self.Preview,
   217                 self.GetConnectionType(),
   218                                      self.GetConnectionType(),
   218                 self.ConnectionName.GetValue())
   219                                      self.ConnectionName.GetValue())
   219 
   220 
   220         # Call BlockPreviewDialog function
   221         # Call BlockPreviewDialog function
   221         BlockPreviewDialog.RefreshPreview(self)
   222         BlockPreviewDialog.RefreshPreview(self)