3 |
3 |
4 # This file is part of Beremiz, a Integrated Development Environment for |
4 # This file is part of Beremiz, a Integrated Development Environment for |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
6 # |
6 # |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
8 # Copyright (C) 2017: Andrey Skvortsov <andrej.skvortzov@gmail.com> |
8 # |
9 # |
9 # See COPYING file for copyrights details. |
10 # See COPYING file for copyrights details. |
10 # |
11 # |
11 # This program is free software; you can redistribute it and/or |
12 # This program is free software; you can redistribute it and/or |
12 # modify it under the terms of the GNU General Public License |
13 # modify it under the terms of the GNU General Public License |
58 @param controller: Reference to project controller |
59 @param controller: Reference to project controller |
59 @param tagname: Tagname of project POU edited |
60 @param tagname: Tagname of project POU edited |
60 @param exclude_input: Exclude input from variable class selection |
61 @param exclude_input: Exclude input from variable class selection |
61 """ |
62 """ |
62 BlockPreviewDialog.__init__(self, parent, controller, tagname, |
63 BlockPreviewDialog.__init__(self, parent, controller, tagname, |
63 size=wx.Size(400, 380), title=_('Variable Properties')) |
64 title=_('Variable Properties')) |
64 |
65 |
65 # Init common sizers |
66 # Init common sizers |
66 self._init_sizers(4, 2, 4, None, 3, 2) |
67 self._init_sizers(4, 2, 4, None, 3, 2) |
67 |
68 |
68 # Create label for variable class |
69 # Create label for variable class |
95 self.Bind(wx.EVT_TEXT, self.OnExpressionChanged, self.Expression) |
96 self.Bind(wx.EVT_TEXT, self.OnExpressionChanged, self.Expression) |
96 self.RightGridSizer.AddWindow(self.Expression, flag=wx.GROW) |
97 self.RightGridSizer.AddWindow(self.Expression, flag=wx.GROW) |
97 |
98 |
98 # Create a list box to selected variable expression in the list of |
99 # Create a list box to selected variable expression in the list of |
99 # variables defined in POU |
100 # variables defined in POU |
100 self.VariableName = wx.ListBox(self, size=wx.Size(0, 120), |
101 self.VariableName = wx.ListBox(self, size=wx.Size(-1,120), |
101 style=wx.LB_SINGLE|wx.LB_SORT) |
102 style=wx.LB_SINGLE|wx.LB_SORT) |
102 self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, self.VariableName) |
103 self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, self.VariableName) |
103 self.RightGridSizer.AddWindow(self.VariableName, flag=wx.GROW) |
104 self.RightGridSizer.AddWindow(self.VariableName, border=4, flag=wx.GROW|wx.TOP) |
104 |
105 |
105 # Add preview panel and associated label to sizers |
106 # Add preview panel and associated label to sizers |
106 self.MainSizer.AddWindow(self.PreviewLabel, border=20, |
107 self.MainSizer.AddWindow(self.PreviewLabel, border=20, |
107 flag=wx.GROW|wx.LEFT|wx.RIGHT) |
108 flag=wx.GROW|wx.LEFT|wx.RIGHT) |
108 self.MainSizer.AddWindow(self.Preview, border=20, |
109 self.MainSizer.AddWindow(self.Preview, border=20, |
122 self.RefreshVariableList() |
123 self.RefreshVariableList() |
123 |
124 |
124 # Refresh values in name list box |
125 # Refresh values in name list box |
125 self.RefreshNameList() |
126 self.RefreshNameList() |
126 |
127 |
|
128 self.Preview.SetInitialSize(wx.Size(-1, 60)) |
|
129 self.Fit() |
|
130 |
127 # Class combo box is default control having keyboard focus |
131 # Class combo box is default control having keyboard focus |
128 self.Class.SetFocus() |
132 self.Class.SetFocus() |
129 |
133 |
130 def RefreshNameList(self): |
134 def RefreshNameList(self): |
131 """ |
135 """ |
185 elif name == "executionOrder": |
189 elif name == "executionOrder": |
186 self.ExecutionOrder.SetValue(value) |
190 self.ExecutionOrder.SetValue(value) |
187 |
191 |
188 # Refresh preview panel |
192 # Refresh preview panel |
189 self.RefreshPreview() |
193 self.RefreshPreview() |
|
194 self.Fit() |
190 |
195 |
191 def GetValues(self): |
196 def GetValues(self): |
192 """ |
197 """ |
193 Return block parameters defined in dialog |
198 Return block parameters defined in dialog |
194 @return: {parameter_name: parameter_value,...} |
199 @return: {parameter_name: parameter_value,...} |