48 @param controller: Reference to project controller |
48 @param controller: Reference to project controller |
49 @param tagname: Tagname of project POU edited |
49 @param tagname: Tagname of project POU edited |
50 @param poss_div_types: Types of divergence that will be available in the dialog window |
50 @param poss_div_types: Types of divergence that will be available in the dialog window |
51 """ |
51 """ |
52 BlockPreviewDialog.__init__(self, parent, controller, tagname, |
52 BlockPreviewDialog.__init__(self, parent, controller, tagname, |
53 title=_('Create a new divergence or convergence')) |
53 title=_('Create a new divergence or convergence')) |
54 |
54 |
55 # Init common sizers |
55 # Init common sizers |
56 self._init_sizers(2, 0, 7, None, 2, 1) |
56 self._init_sizers(2, 0, 7, None, 2, 1) |
57 |
57 |
58 # Create label for divergence type |
58 # Create label for divergence type |
74 self.TypeRadioButtons = {} |
74 self.TypeRadioButtons = {} |
75 first = True |
75 first = True |
76 focusbtn = None |
76 focusbtn = None |
77 for type, label in poss_div_btns: |
77 for type, label in poss_div_btns: |
78 radio_button = wx.RadioButton(self, label=label, |
78 radio_button = wx.RadioButton(self, label=label, |
79 style=(wx.RB_GROUP if first else 0)) |
79 style=(wx.RB_GROUP if first else 0)) |
80 radio_button.SetValue(first) |
80 radio_button.SetValue(first) |
81 self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button) |
81 self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button) |
82 self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW) |
82 self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW) |
83 self.TypeRadioButtons[type] = radio_button |
83 self.TypeRadioButtons[type] = radio_button |
84 if first: |
84 if first: |
85 focusbtn = type |
85 focusbtn = type |
86 first = False |
86 first = False |
87 |
87 |
88 # Create label for number of divergence sequences |
88 # Create label for number of divergence sequences |
89 sequences_label = wx.StaticText(self, |
89 sequences_label = wx.StaticText(self, |
90 label=_('Number of sequences:')) |
90 label=_('Number of sequences:')) |
91 self.LeftGridSizer.AddWindow(sequences_label, flag=wx.GROW) |
91 self.LeftGridSizer.AddWindow(sequences_label, flag=wx.GROW) |
92 |
92 |
93 # Create spin control for defining number of divergence sequences |
93 # Create spin control for defining number of divergence sequences |
94 self.Sequences = wx.SpinCtrl(self, min=2, max=20, initial=2) |
94 self.Sequences = wx.SpinCtrl(self, min=2, max=20, initial=2) |
95 self.Bind(wx.EVT_SPINCTRL, self.OnSequencesChanged, self.Sequences) |
95 self.Bind(wx.EVT_SPINCTRL, self.OnSequencesChanged, self.Sequences) |
98 # Add preview panel and associated label to sizers |
98 # Add preview panel and associated label to sizers |
99 self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) |
99 self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) |
100 self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW) |
100 self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW) |
101 |
101 |
102 # Add buttons sizer to sizers |
102 # Add buttons sizer to sizers |
103 self.MainSizer.AddSizer(self.ButtonSizer, border=20, |
103 self.MainSizer.AddSizer( |
104 flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
104 self.ButtonSizer, border=20, |
|
105 flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
105 |
106 |
106 self.Fit() |
107 self.Fit() |
107 |
108 |
108 # Selection divergence radio button is default control having keyboard |
109 # Selection divergence radio button is default control having keyboard |
109 # focus |
110 # focus |