author | etisserant |
Tue, 19 Aug 2008 18:04:56 +0200 | |
changeset 232 | cbdfef9b2020 |
parent 231 | fc2d6cbb8b39 |
child 235 | 7b58a3b5b6ec |
permissions | -rw-r--r-- |
125 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
4 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
|
5 |
#based on the plcopen standard. |
|
6 |
# |
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
8 |
# |
|
9 |
#See COPYING file for copyrights details. |
|
10 |
# |
|
11 |
#This library is free software; you can redistribute it and/or |
|
12 |
#modify it under the terms of the GNU General Public |
|
13 |
#License as published by the Free Software Foundation; either |
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
|
15 |
# |
|
16 |
#This library is distributed in the hope that it will be useful, |
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
19 |
#General Public License for more details. |
|
20 |
# |
|
21 |
#You should have received a copy of the GNU General Public |
|
22 |
#License along with this library; if not, write to the Free Software |
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24 |
||
25 |
import wx |
|
26 |
import wx.grid |
|
27 |
import wx.gizmos |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
28 |
from plcopen.structures import IEC_KEYWORDS |
125 | 29 |
|
207 | 30 |
import re |
31 |
||
32 |
DIMENSION_MODEL = re.compile("([0-9]+)\.\.([0-9]+)$") |
|
33 |
||
125 | 34 |
if wx.VERSION >= (2, 8, 0): |
35 |
import wx.aui |
|
36 |
||
37 |
class MDIDataTypeEditor(wx.aui.AuiMDIChildFrame): |
|
38 |
def __init__(self, parent, tagname, window, controler): |
|
39 |
wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "") |
|
40 |
||
41 |
sizer = wx.BoxSizer(wx.HORIZONTAL) |
|
42 |
||
43 |
self.Viewer = DataTypeEditor(self, tagname, window, controler) |
|
44 |
||
45 |
sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW) |
|
46 |
||
47 |
self.SetSizer(sizer) |
|
48 |
||
49 |
def GetViewer(self): |
|
50 |
return self.Viewer |
|
51 |
||
52 |
#------------------------------------------------------------------------------- |
|
53 |
# Configuration Editor class |
|
54 |
#------------------------------------------------------------------------------- |
|
55 |
||
56 |
[ID_DATATYPEEDITOR, ID_DATATYPEEDITORSTATICBOX, |
|
57 |
ID_DATATYPEEDITORDERIVATIONTYPE, ID_DATATYPEEDITORDIRECTLYPANEL, |
|
58 |
ID_DATATYPEEDITORSUBRANGEPANEL, ID_DATATYPEEDITORDIRECTLYBASETYPE, |
|
59 |
ID_DATATYPEEDITORSUBRANGEBASETYPE, ID_DATATYPEEDITORSUBRANGEMINIMUM, |
|
60 |
ID_DATATYPEEDITORSUBRANGEMAXIMUM, ID_DATATYPEEDITORDIRECTLYINITIALVALUE, |
|
61 |
ID_DATATYPEEDITORSUBRANGEINITIALVALUE, ID_DATATYPEEDITORENUMERATEDPANEL, |
|
62 |
ID_DATATYPEEDITORENUMERATEDVALUES, ID_DATATYPEEDITORENUMERATEDINITIALVALUE, |
|
63 |
ID_DATATYPEEDITORARRAYPANEL, ID_DATATYPEEDITORARRAYBASETYPE, |
|
64 |
ID_DATATYPEEDITORARRAYDIMENSIONS, ID_DATATYPEEDITORARRAYINITIALVALUE, |
|
65 |
ID_DATATYPEEDITORSTATICTEXT1, ID_DATATYPEEDITORSTATICTEXT2, |
|
66 |
ID_DATATYPEEDITORSTATICTEXT3, ID_DATATYPEEDITORSTATICTEXT4, |
|
67 |
ID_DATATYPEEDITORSTATICTEXT5, ID_DATATYPEEDITORSTATICTEXT6, |
|
68 |
ID_DATATYPEEDITORSTATICTEXT7, ID_DATATYPEEDITORSTATICTEXT8, |
|
69 |
ID_DATATYPEEDITORSTATICTEXT9, ID_DATATYPEEDITORSTATICTEXT10, |
|
70 |
] = [wx.NewId() for _init_ctrls in range(28)] |
|
71 |
||
72 |
class DataTypeEditor(wx.Panel): |
|
73 |
||
74 |
def _init_coll_MainSizer_Items(self, parent): |
|
75 |
parent.AddSizer(self.TopSizer, 0, border=5, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT) |
|
76 |
parent.AddSizer(self.TypeInfosSizer, 0, border=5, flag=wx.GROW|wx.BOTTOM|wx.LEFT|wx.RIGHT) |
|
77 |
||
78 |
def _init_coll_MainSizer_Growables(self, parent): |
|
79 |
parent.AddGrowableCol(0) |
|
80 |
parent.AddGrowableRow(1) |
|
81 |
||
82 |
def _init_coll_TopSizer_Items(self, parent): |
|
83 |
parent.AddWindow(self.staticText1, 0, border=5, flag=wx.GROW|wx.LEFT) |
|
84 |
parent.AddWindow(self.DerivationType, 0, border=0, flag=wx.GROW) |
|
85 |
||
86 |
def _init_coll_TypeInfosSizer_Items(self, parent): |
|
87 |
parent.AddWindow(self.DirectlyPanel, 1, border=0, flag=wx.ALL) |
|
88 |
parent.AddWindow(self.SubrangePanel, 1, border=0, flag=wx.ALL) |
|
89 |
parent.AddWindow(self.EnumeratedPanel, 1, border=0, flag=wx.GROW|wx.ALL) |
|
90 |
parent.AddWindow(self.ArrayPanel, 1, border=0, flag=wx.ALL) |
|
91 |
||
92 |
def _init_coll_DirectlyPanelSizer_Items(self, parent): |
|
93 |
parent.AddWindow(self.staticText2, 1, border=5, flag=wx.GROW|wx.ALL) |
|
94 |
parent.AddWindow(self.DirectlyBaseType, 1, border=5, flag=wx.GROW|wx.ALL) |
|
95 |
parent.AddWindow(self.staticText3, 1, border=5, flag=wx.GROW|wx.ALL) |
|
96 |
parent.AddWindow(self.DirectlyInitialValue, 1, border=5, flag=wx.GROW|wx.ALL) |
|
97 |
||
98 |
def _init_coll_SubrangePanelSizer_Items(self, parent): |
|
99 |
parent.AddWindow(self.staticText4, 1, border=5, flag=wx.GROW|wx.ALL) |
|
100 |
parent.AddWindow(self.SubrangeBaseType, 1, border=5, flag=wx.GROW|wx.ALL) |
|
101 |
parent.AddWindow(self.staticText5, 1, border=5, flag=wx.GROW|wx.ALL) |
|
102 |
parent.AddWindow(self.SubrangeInitialValue, 1, border=5, flag=wx.GROW|wx.ALL) |
|
103 |
parent.AddWindow(self.staticText6, 1, border=5, flag=wx.GROW|wx.ALL) |
|
104 |
parent.AddWindow(self.SubrangeMinimum, 1, border=5, flag=wx.GROW|wx.ALL) |
|
105 |
parent.AddWindow(wx.Size(0, 0), 1, border=5, flag=wx.GROW|wx.ALL) |
|
106 |
parent.AddWindow(wx.Size(0, 0), 1, border=5, flag=wx.GROW|wx.ALL) |
|
107 |
parent.AddWindow(self.staticText7, 1, border=5, flag=wx.GROW|wx.ALL) |
|
108 |
parent.AddWindow(self.SubrangeMaximum, 1, border=5, flag=wx.GROW|wx.ALL) |
|
109 |
||
110 |
def _init_coll_EnumeratedPanelSizer_Items(self, parent): |
|
111 |
parent.AddWindow(self.EnumeratedValues, 2, border=5, flag=wx.GROW|wx.ALL) |
|
112 |
parent.AddWindow(self.staticText8, 1, border=5, flag=wx.GROW|wx.ALL) |
|
113 |
parent.AddWindow(self.EnumeratedInitialValue, 1, border=5, flag=wx.ALL) |
|
114 |
||
115 |
def _init_coll_ArrayPanelSizer_Items(self, parent): |
|
116 |
parent.AddSizer(self.ArrayPanelLeftSizer, 0, border=0, flag=wx.GROW) |
|
117 |
parent.AddSizer(self.ArrayPanelRightSizer, 0, border=0, flag=wx.GROW) |
|
118 |
parent.AddWindow(self.ArrayDimensions, 0, border=5, flag=wx.GROW|wx.ALL) |
|
119 |
||
120 |
def _init_coll_ArrayPanelSizer_Growables(self, parent): |
|
121 |
parent.AddGrowableCol(0) |
|
122 |
parent.AddGrowableCol(1) |
|
123 |
parent.AddGrowableRow(1) |
|
124 |
||
125 |
def _init_coll_ArrayPanelLeftSizer_Items(self, parent): |
|
126 |
parent.AddWindow(self.staticText9, 1, border=5, flag=wx.GROW|wx.ALL) |
|
127 |
parent.AddWindow(self.ArrayBaseType, 1, border=5, flag=wx.GROW|wx.ALL) |
|
128 |
||
129 |
def _init_coll_ArrayPanelRightSizer_Items(self, parent): |
|
130 |
parent.AddWindow(self.staticText10, 1, border=5, flag=wx.GROW|wx.ALL) |
|
131 |
parent.AddWindow(self.ArrayInitialValue, 1, border=5, flag=wx.GROW|wx.ALL) |
|
132 |
||
133 |
def _init_sizers(self): |
|
134 |
self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) |
|
135 |
self.TopSizer = wx.BoxSizer(wx.HORIZONTAL) |
|
136 |
self.TypeInfosSizer = wx.StaticBoxSizer(self.staticbox, wx.HORIZONTAL) |
|
137 |
self.DirectlyPanelSizer = wx.BoxSizer(wx.HORIZONTAL) |
|
138 |
self.SubrangePanelSizer = wx.GridSizer(cols=4, hgap=0, rows=3, vgap=0) |
|
139 |
self.EnumeratedPanelSizer = wx.BoxSizer(wx.HORIZONTAL) |
|
140 |
self.ArrayPanelSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=2, vgap=0) |
|
141 |
self.ArrayPanelLeftSizer = wx.BoxSizer(wx.HORIZONTAL) |
|
142 |
self.ArrayPanelRightSizer = wx.BoxSizer(wx.HORIZONTAL) |
|
143 |
||
144 |
self._init_coll_MainSizer_Items(self.MainSizer) |
|
145 |
self._init_coll_MainSizer_Growables(self.MainSizer) |
|
146 |
self._init_coll_TopSizer_Items(self.TopSizer) |
|
147 |
self._init_coll_TypeInfosSizer_Items(self.TypeInfosSizer) |
|
148 |
self._init_coll_DirectlyPanelSizer_Items(self.DirectlyPanelSizer) |
|
149 |
self._init_coll_SubrangePanelSizer_Items(self.SubrangePanelSizer) |
|
150 |
self._init_coll_EnumeratedPanelSizer_Items(self.EnumeratedPanelSizer) |
|
151 |
self._init_coll_ArrayPanelSizer_Items(self.ArrayPanelSizer) |
|
152 |
self._init_coll_ArrayPanelSizer_Growables(self.ArrayPanelSizer) |
|
153 |
self._init_coll_ArrayPanelLeftSizer_Items(self.ArrayPanelLeftSizer) |
|
154 |
self._init_coll_ArrayPanelRightSizer_Items(self.ArrayPanelRightSizer) |
|
155 |
||
156 |
self.SetSizer(self.MainSizer) |
|
157 |
self.DirectlyPanel.SetSizer(self.DirectlyPanelSizer) |
|
158 |
self.SubrangePanel.SetSizer(self.SubrangePanelSizer) |
|
159 |
self.EnumeratedPanel.SetSizer(self.EnumeratedPanelSizer) |
|
160 |
self.ArrayPanel.SetSizer(self.ArrayPanelSizer) |
|
161 |
||
162 |
def _init_ctrls(self, prnt): |
|
163 |
wx.Panel.__init__(self, id=ID_DATATYPEEDITOR, name='', parent=prnt, |
|
164 |
size=wx.Size(0, 0), style=wx.SUNKEN_BORDER) |
|
165 |
||
166 |
self.staticbox = wx.StaticBox(id=ID_DATATYPEEDITORSTATICBOX, |
|
167 |
label='Type infos:', name='staticBox1', parent=self, |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
168 |
pos=wx.Point(0, 0), size=wx.Size(10, 0), style=0) |
125 | 169 |
|
170 |
self.staticText1 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT1, |
|
171 |
label='Derivation Type:', name='staticText1', parent=self, |
|
172 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
173 |
||
174 |
self.DerivationType = wx.Choice(id=ID_DATATYPEEDITORDERIVATIONTYPE, |
|
175 |
name='DerivationType', parent=self, pos=wx.Point(0, 0), |
|
176 |
size=wx.Size(200, 24), style=0) |
|
177 |
self.Bind(wx.EVT_CHOICE, self.OnDerivationTypeChanged, id=ID_DATATYPEEDITORDERIVATIONTYPE) |
|
178 |
||
179 |
# Panel for Directly derived data types |
|
180 |
||
181 |
self.DirectlyPanel = wx.Panel(id=ID_DATATYPEEDITORDIRECTLYPANEL, |
|
182 |
name='DirectlyPanel', parent=self, pos=wx.Point(0, 0), |
|
183 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
|
184 |
||
185 |
self.staticText2 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT2, |
|
186 |
label='Base Type:', name='staticText2', parent=self.DirectlyPanel, |
|
187 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
188 |
||
189 |
self.DirectlyBaseType = wx.Choice(id=ID_DATATYPEEDITORDIRECTLYBASETYPE, |
|
190 |
name='DirectlyBaseType', parent=self.DirectlyPanel, pos=wx.Point(0, 0), |
|
191 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL) |
|
192 |
self.Bind(wx.EVT_CHOICE, self.OnInfosChanged, id=ID_DATATYPEEDITORDIRECTLYBASETYPE) |
|
193 |
||
194 |
self.staticText3 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT3, |
|
195 |
label='Initial Value:', name='staticText3', parent=self.DirectlyPanel, |
|
196 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
197 |
||
198 |
self.DirectlyInitialValue = wx.TextCtrl(id=ID_DATATYPEEDITORDIRECTLYINITIALVALUE, |
|
199 |
name='DirectlyInitialValue', parent=self.DirectlyPanel, pos=wx.Point(0, 0), |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
200 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL|wx.TE_PROCESS_ENTER|wx.TE_MULTILINE|wx.TE_RICH) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
201 |
self.Bind(wx.EVT_TEXT_ENTER, self.OnReturnKeyPressed, id=ID_DATATYPEEDITORDIRECTLYINITIALVALUE) |
125 | 202 |
|
203 |
# Panel for Subrange data types |
|
204 |
||
205 |
self.SubrangePanel = wx.Panel(id=ID_DATATYPEEDITORSUBRANGEPANEL, |
|
206 |
name='SubrangePanel', parent=self, pos=wx.Point(0, 0), |
|
207 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
|
208 |
||
209 |
self.staticText4 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT4, |
|
210 |
label='Base Type:', name='staticText4', parent=self.SubrangePanel, |
|
211 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
212 |
||
213 |
self.SubrangeBaseType = wx.Choice(id=ID_DATATYPEEDITORSUBRANGEBASETYPE, |
|
214 |
name='SubrangeBaseType', parent=self.SubrangePanel, pos=wx.Point(0, 0), |
|
215 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL) |
|
216 |
self.Bind(wx.EVT_CHOICE, self.OnSubrangeBaseTypeChanged, id=ID_DATATYPEEDITORSUBRANGEBASETYPE) |
|
217 |
||
218 |
self.staticText5 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT5, |
|
219 |
label='Initial Value:', name='staticText5', parent=self.SubrangePanel, |
|
220 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
221 |
||
222 |
self.SubrangeInitialValue = wx.SpinCtrl(id=ID_DATATYPEEDITORSUBRANGEINITIALVALUE, |
|
223 |
name='SubrangeInitialValue', parent=self.SubrangePanel, pos=wx.Point(0, 0), |
|
224 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL) |
|
225 |
self.Bind(wx.EVT_SPINCTRL, self.OnInfosChanged, id=ID_DATATYPEEDITORSUBRANGEINITIALVALUE) |
|
226 |
||
227 |
self.staticText6 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT6, |
|
228 |
label='Minimum:', name='staticText6', parent=self.SubrangePanel, |
|
229 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
230 |
||
231 |
self.SubrangeMinimum = wx.SpinCtrl(id=ID_DATATYPEEDITORSUBRANGEMINIMUM, |
|
232 |
name='SubrangeMinimum', parent=self.SubrangePanel, pos=wx.Point(0, 0), |
|
233 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL) |
|
234 |
self.Bind(wx.EVT_SPINCTRL, self.OnSubrangeMinimumChanged, id=ID_DATATYPEEDITORSUBRANGEMINIMUM) |
|
235 |
||
236 |
self.staticText7 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT7, |
|
237 |
label='Maximum:', name='staticText7', parent=self.SubrangePanel, |
|
238 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
239 |
||
240 |
self.SubrangeMaximum = wx.SpinCtrl(id=ID_DATATYPEEDITORSUBRANGEMAXIMUM, |
|
241 |
name='SubrangeMaximum', parent=self.SubrangePanel, pos=wx.Point(0, 0), |
|
242 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL) |
|
243 |
self.Bind(wx.EVT_SPINCTRL, self.OnSubrangeMaximumChanged, id=ID_DATATYPEEDITORSUBRANGEMAXIMUM) |
|
244 |
||
245 |
# Panel for Enumerated data types |
|
246 |
||
247 |
self.EnumeratedPanel = wx.Panel(id=ID_DATATYPEEDITORENUMERATEDPANEL, |
|
248 |
name='EnumeratedPanel', parent=self, pos=wx.Point(0, 0), |
|
249 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
|
250 |
||
251 |
self.EnumeratedValues = wx.gizmos.EditableListBox(id=ID_DATATYPEEDITORENUMERATEDVALUES, |
|
252 |
name='EnumeratedValues', parent=self.EnumeratedPanel, label="Values:", pos=wx.Point(0, 0), |
|
253 |
size=wx.Size(0, 0), style=wx.gizmos.EL_ALLOW_NEW | wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE) |
|
254 |
self.EnumeratedValues.GetListCtrl().Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEnumeratedValueEndEdit) |
|
255 |
self.EnumeratedValues.GetNewButton().Bind(wx.EVT_BUTTON, self.OnEnumeratedValuesChanged) |
|
256 |
self.EnumeratedValues.GetDelButton().Bind(wx.EVT_BUTTON, self.OnEnumeratedValuesChanged) |
|
257 |
self.EnumeratedValues.GetUpButton().Bind(wx.EVT_BUTTON, self.OnEnumeratedValuesChanged) |
|
258 |
self.EnumeratedValues.GetDownButton().Bind(wx.EVT_BUTTON, self.OnEnumeratedValuesChanged) |
|
259 |
||
260 |
self.staticText8 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT8, |
|
261 |
label='Initial Value:', name='staticText8', parent=self.EnumeratedPanel, |
|
262 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
263 |
||
264 |
self.EnumeratedInitialValue = wx.Choice(id=ID_DATATYPEEDITORENUMERATEDINITIALVALUE, |
|
265 |
name='EnumeratedInitialValue', parent=self.EnumeratedPanel, pos=wx.Point(0, 0), |
|
266 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL|wx.TE_PROCESS_ENTER) |
|
267 |
self.Bind(wx.EVT_CHOICE, self.OnInfosChanged, id=ID_DATATYPEEDITORENUMERATEDINITIALVALUE) |
|
268 |
||
269 |
# Panel for Array data types |
|
270 |
||
271 |
self.ArrayPanel = wx.Panel(id=ID_DATATYPEEDITORARRAYPANEL, |
|
272 |
name='ArrayPanel', parent=self, pos=wx.Point(0, 0), |
|
273 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
|
274 |
||
275 |
self.staticText9 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT9, |
|
276 |
label='Base Type:', name='staticText9', parent=self.ArrayPanel, |
|
277 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
278 |
||
279 |
self.ArrayBaseType = wx.Choice(id=ID_DATATYPEEDITORARRAYBASETYPE, |
|
280 |
name='SubrangeBaseType', parent=self.ArrayPanel, pos=wx.Point(0, 0), |
|
281 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL) |
|
282 |
self.Bind(wx.EVT_CHOICE, self.OnInfosChanged, id=ID_DATATYPEEDITORARRAYBASETYPE) |
|
283 |
||
284 |
self.ArrayDimensions = wx.gizmos.EditableListBox(id=ID_DATATYPEEDITORARRAYDIMENSIONS, |
|
285 |
name='ArrayDimensions', parent=self.ArrayPanel, label="Dimensions:", pos=wx.Point(0, 0), |
|
286 |
size=wx.Size(0, 24), style=wx.gizmos.EL_ALLOW_NEW | wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE) |
|
287 |
self.ArrayDimensions.GetListCtrl().Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnDimensionsChanged) |
|
288 |
self.ArrayDimensions.GetNewButton().Bind(wx.EVT_BUTTON, self.OnDimensionsChanged) |
|
289 |
self.ArrayDimensions.GetDelButton().Bind(wx.EVT_BUTTON, self.OnDimensionsChanged) |
|
290 |
self.ArrayDimensions.GetUpButton().Bind(wx.EVT_BUTTON, self.OnDimensionsChanged) |
|
291 |
self.ArrayDimensions.GetDownButton().Bind(wx.EVT_BUTTON, self.OnDimensionsChanged) |
|
292 |
||
293 |
self.staticText10 = wx.StaticText(id=ID_DATATYPEEDITORSTATICTEXT10, |
|
294 |
label='Initial Value:', name='staticText10', parent=self.ArrayPanel, |
|
295 |
pos=wx.Point(0, 0), size=wx.Size(150, 17), style=0) |
|
296 |
||
297 |
self.ArrayInitialValue = wx.TextCtrl(id=ID_DATATYPEEDITORARRAYINITIALVALUE, |
|
298 |
name='ArrayInitialValue', parent=self.ArrayPanel, pos=wx.Point(0, 0), |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
299 |
size=wx.Size(0, 24), style=wx.TAB_TRAVERSAL|wx.TE_PROCESS_ENTER|wx.TE_MULTILINE|wx.TE_RICH) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
300 |
self.Bind(wx.EVT_TEXT_ENTER, self.OnReturnKeyPressed, id=ID_DATATYPEEDITORARRAYINITIALVALUE) |
125 | 301 |
|
302 |
self._init_sizers() |
|
303 |
||
304 |
def __init__(self, parent, tagname, window, controler): |
|
305 |
self._init_ctrls(parent) |
|
306 |
||
307 |
self.DerivationType.Append("Directly") |
|
308 |
self.DerivationType.Append("Subrange") |
|
309 |
self.DerivationType.Append("Enumerated") |
|
310 |
self.DerivationType.Append("Array") |
|
311 |
self.SubrangePanel.Hide() |
|
312 |
self.EnumeratedPanel.Hide() |
|
313 |
self.ArrayPanel.Hide() |
|
314 |
self.CurrentPanel = "Directly" |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
315 |
self.Errors = [] |
130 | 316 |
self.Initializing = False |
125 | 317 |
|
318 |
self.ParentWindow = window |
|
319 |
self.Controler = controler |
|
320 |
self.TagName = tagname |
|
321 |
||
322 |
def OnEnumeratedValueEndEdit(self, event): |
|
323 |
text = event.GetText() |
|
192 | 324 |
values = self.EnumeratedValues.GetStrings() |
325 |
index = event.GetIndex() |
|
326 |
if index >= len(values) or values[index].upper() != text.upper(): |
|
327 |
if text.upper() in [value.upper() for value in values]: |
|
150 | 328 |
message = wx.MessageDialog(self, "\"%s\" value already defined!"%text, "Error", wx.OK|wx.ICON_ERROR) |
329 |
message.ShowModal() |
|
330 |
message.Destroy() |
|
331 |
event.Veto() |
|
332 |
elif text.upper() in IEC_KEYWORDS: |
|
333 |
message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%text, "Error", wx.OK|wx.ICON_ERROR) |
|
334 |
message.ShowModal() |
|
335 |
message.Destroy() |
|
336 |
else: |
|
337 |
wx.CallAfter(self.RefreshEnumeratedValues) |
|
338 |
wx.CallAfter(self.RefreshTypeInfos) |
|
339 |
event.Skip() |
|
125 | 340 |
else: |
341 |
wx.CallAfter(self.RefreshEnumeratedValues) |
|
342 |
wx.CallAfter(self.RefreshTypeInfos) |
|
343 |
event.Skip() |
|
344 |
||
345 |
def OnEnumeratedValuesChanged(self, event): |
|
346 |
wx.CallAfter(self.RefreshEnumeratedValues) |
|
347 |
wx.CallAfter(self.RefreshTypeInfos) |
|
348 |
event.Skip() |
|
349 |
||
350 |
def SetTagName(self, tagname): |
|
351 |
self.TagName = tagname |
|
352 |
||
353 |
def GetTagName(self): |
|
354 |
return self.TagName |
|
355 |
||
356 |
def IsViewing(self, tagname): |
|
357 |
return self.TagName == tagname |
|
358 |
||
359 |
def SetMode(self, mode): |
|
360 |
pass |
|
361 |
||
362 |
def ResetBuffer(self): |
|
363 |
pass |
|
364 |
||
365 |
def RefreshView(self): |
|
130 | 366 |
self.Initializing = True |
125 | 367 |
self.DirectlyBaseType.Clear() |
368 |
self.ArrayBaseType.Clear() |
|
369 |
for datatype in self.Controler.GetDataTypes(self.TagName): |
|
370 |
self.DirectlyBaseType.Append(datatype) |
|
371 |
self.ArrayBaseType.Append(datatype) |
|
372 |
self.DirectlyBaseType.SetSelection(0) |
|
373 |
self.SubrangeBaseType.Clear() |
|
374 |
words = self.TagName.split("::") |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
375 |
for base_type in self.Controler.GetSubrangeBaseTypes(words[1]): |
125 | 376 |
self.SubrangeBaseType.Append(base_type) |
377 |
self.SubrangeBaseType.SetSelection(0) |
|
378 |
self.RefreshBoundsRange() |
|
379 |
type_infos = self.Controler.GetDataTypeInfos(self.TagName) |
|
380 |
if type_infos is not None: |
|
381 |
self.DerivationType.SetStringSelection(type_infos["type"]) |
|
382 |
if type_infos["type"] == "Directly": |
|
383 |
self.DirectlyBaseType.SetStringSelection(type_infos["base_type"]) |
|
384 |
self.DirectlyInitialValue.SetValue(type_infos["initial"]) |
|
385 |
elif type_infos["type"] == "Subrange": |
|
386 |
self.SubrangeBaseType.SetStringSelection(type_infos["base_type"]) |
|
387 |
self.RefreshBoundsRange() |
|
388 |
self.SubrangeMinimum.SetValue(type_infos["min"]) |
|
389 |
self.SubrangeMaximum.SetValue(type_infos["max"]) |
|
390 |
self.RefreshSubrangeInitialValueRange() |
|
391 |
if type_infos["initial"] != "": |
|
392 |
self.SubrangeInitialValue.SetValue(int(type_infos["initial"])) |
|
393 |
else: |
|
394 |
self.SubrangeInitialValue.SetValue(type_infos["min"]) |
|
395 |
elif type_infos["type"] == "Enumerated": |
|
396 |
self.EnumeratedValues.SetStrings(type_infos["values"]) |
|
397 |
self.RefreshEnumeratedValues() |
|
398 |
self.EnumeratedInitialValue.SetStringSelection(type_infos["initial"]) |
|
399 |
elif type_infos["type"] == "Array": |
|
400 |
self.ArrayBaseType.SetStringSelection(type_infos["base_type"]) |
|
207 | 401 |
self.ArrayDimensions.SetStrings(map(lambda x : "..".join(map(str, x)), type_infos["dimensions"])) |
125 | 402 |
self.ArrayInitialValue.SetValue(type_infos["initial"]) |
403 |
self.RefreshDisplayedInfos() |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
404 |
self.ShowErrors() |
130 | 405 |
self.Initializing = False |
125 | 406 |
|
205 | 407 |
def RefreshScaling(self, refresh=True): |
408 |
pass |
|
409 |
||
125 | 410 |
def OnDerivationTypeChanged(self, event): |
411 |
self.RefreshDisplayedInfos() |
|
412 |
self.RefreshTypeInfos() |
|
413 |
event.Skip() |
|
414 |
||
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
415 |
def OnReturnKeyPressed(self, event): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
416 |
self.RefreshTypeInfos() |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
417 |
|
125 | 418 |
def OnInfosChanged(self, event): |
419 |
self.RefreshTypeInfos() |
|
420 |
event.Skip() |
|
421 |
||
422 |
def OnSubrangeBaseTypeChanged(self, event): |
|
423 |
self.RefreshBoundsRange() |
|
424 |
self.RefreshTypeInfos() |
|
425 |
event.Skip() |
|
426 |
||
427 |
def OnSubrangeMinimumChanged(self, event): |
|
215 | 428 |
if not self.Initializing: |
130 | 429 |
wx.CallAfter(self.SubrangeMinimum.SetValue, min(self.SubrangeMaximum.GetValue(), self.SubrangeMinimum.GetValue())) |
430 |
wx.CallAfter(self.RefreshSubrangeInitialValueRange) |
|
431 |
wx.CallAfter(self.RefreshTypeInfos) |
|
125 | 432 |
event.Skip() |
433 |
||
434 |
def OnSubrangeMaximumChanged(self, event): |
|
215 | 435 |
if not self.Initializing: |
130 | 436 |
wx.CallAfter(self.SubrangeMaximum.SetValue, max(self.SubrangeMinimum.GetValue(), self.SubrangeMaximum.GetValue())) |
437 |
wx.CallAfter(self.RefreshSubrangeInitialValueRange) |
|
438 |
wx.CallAfter(self.RefreshTypeInfos) |
|
125 | 439 |
event.Skip() |
440 |
||
441 |
def OnDimensionsChanged(self, event): |
|
442 |
wx.CallAfter(self.RefreshTypeInfos) |
|
443 |
event.Skip() |
|
444 |
||
445 |
def RefreshDisplayedInfos(self): |
|
446 |
selected = self.DerivationType.GetStringSelection() |
|
447 |
if selected != self.CurrentPanel: |
|
448 |
if self.CurrentPanel == "Directly": |
|
449 |
self.DirectlyPanel.Hide() |
|
450 |
elif self.CurrentPanel == "Subrange": |
|
451 |
self.SubrangePanel.Hide() |
|
452 |
elif self.CurrentPanel == "Enumerated": |
|
453 |
self.EnumeratedPanel.Hide() |
|
454 |
elif self.CurrentPanel == "Array": |
|
455 |
self.ArrayPanel.Hide() |
|
456 |
self.CurrentPanel = selected |
|
457 |
if selected == "Directly": |
|
458 |
self.DirectlyPanel.Show() |
|
459 |
elif selected == "Subrange": |
|
460 |
self.SubrangePanel.Show() |
|
461 |
elif selected == "Enumerated": |
|
462 |
self.EnumeratedPanel.Show() |
|
463 |
elif selected == "Array": |
|
464 |
self.ArrayPanel.Show() |
|
465 |
self.MainSizer.Layout() |
|
466 |
||
467 |
def RefreshEnumeratedValues(self): |
|
468 |
selected = self.EnumeratedInitialValue.GetStringSelection() |
|
469 |
self.EnumeratedInitialValue.Clear() |
|
470 |
self.EnumeratedInitialValue.Append("") |
|
471 |
for value in self.EnumeratedValues.GetStrings(): |
|
472 |
self.EnumeratedInitialValue.Append(value) |
|
473 |
self.EnumeratedInitialValue.SetStringSelection(selected) |
|
474 |
||
475 |
def RefreshBoundsRange(self): |
|
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
476 |
range = self.Controler.GetDataTypeRange(self.SubrangeBaseType.GetStringSelection()) |
125 | 477 |
if range is not None: |
478 |
min_value, max_value = range |
|
479 |
self.SubrangeMinimum.SetRange(min_value, max_value) |
|
480 |
self.SubrangeMinimum.SetValue(min(max(min_value, self.SubrangeMinimum.GetValue()), max_value)) |
|
481 |
self.SubrangeMaximum.SetRange(min_value, max_value) |
|
482 |
self.SubrangeMaximum.SetValue(min(max(min_value, self.SubrangeMaximum.GetValue()), max_value)) |
|
483 |
||
484 |
def RefreshSubrangeInitialValueRange(self): |
|
485 |
self.SubrangeInitialValue.SetRange(self.SubrangeMinimum.GetValue(), self.SubrangeMaximum.GetValue()) |
|
486 |
||
487 |
def RefreshTypeInfos(self): |
|
488 |
selected = self.DerivationType.GetStringSelection() |
|
489 |
infos = {"type" : selected} |
|
490 |
if selected == "Directly": |
|
491 |
infos["base_type"] = self.DirectlyBaseType.GetStringSelection() |
|
492 |
infos["initial"] = self.DirectlyInitialValue.GetValue() |
|
493 |
elif selected == "Subrange": |
|
494 |
infos["base_type"] = self.SubrangeBaseType.GetStringSelection() |
|
495 |
infos["min"] = self.SubrangeMinimum.GetValue() |
|
496 |
infos["max"] = self.SubrangeMaximum.GetValue() |
|
497 |
initial_value = self.SubrangeInitialValue.GetValue() |
|
498 |
if initial_value == infos["min"]: |
|
499 |
infos["initial"] = "" |
|
500 |
else: |
|
501 |
infos["initial"] = str(initial_value) |
|
502 |
elif selected == "Enumerated": |
|
503 |
infos["values"] = self.EnumeratedValues.GetStrings() |
|
504 |
infos["initial"] = self.EnumeratedInitialValue.GetStringSelection() |
|
505 |
elif selected == "Array": |
|
506 |
infos["base_type"] = self.ArrayBaseType.GetStringSelection() |
|
207 | 507 |
infos["dimensions"] = [] |
508 |
for dimensions in self.ArrayDimensions.GetStrings(): |
|
509 |
result = DIMENSION_MODEL.match(dimensions) |
|
510 |
if result is None: |
|
511 |
message = wx.MessageDialog(self, "\"%s\" value isn't a valid array dimension!"%dimensions, "Error", wx.OK|wx.ICON_ERROR) |
|
512 |
message.ShowModal() |
|
513 |
message.Destroy() |
|
514 |
self.RefreshView() |
|
515 |
return |
|
516 |
bounds = result.groups() |
|
517 |
if bounds[0] >= bounds[1]: |
|
518 |
message = wx.MessageDialog(self, "\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value."%dimensions, "Error", wx.OK|wx.ICON_ERROR) |
|
519 |
message.ShowModal() |
|
520 |
message.Destroy() |
|
521 |
self.RefreshView() |
|
522 |
return |
|
523 |
infos["dimensions"].append(map(int, bounds)) |
|
125 | 524 |
infos["initial"] = self.ArrayInitialValue.GetValue() |
525 |
self.Controler.SetDataTypeInfos(self.TagName, infos) |
|
526 |
self.ParentWindow.RefreshTitle() |
|
527 |
self.ParentWindow.RefreshEditMenu() |
|
528 |
||
231
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
529 |
#------------------------------------------------------------------------------- |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
530 |
# Errors showing functions |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
531 |
#------------------------------------------------------------------------------- |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
532 |
|
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
533 |
def ClearErrors(self): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
534 |
self.Errors = [] |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
535 |
self.RefreshView() |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
536 |
|
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
537 |
def AddShownError(self, infos, start, end): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
538 |
self.Errors.append((infos, start, end)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
539 |
|
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
540 |
def ShowErrors(self): |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
541 |
type_infos = self.Controler.GetDataTypeInfos(self.TagName) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
542 |
for infos, start, end in self.Errors: |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
543 |
if infos[0] == "base": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
544 |
if type_infos["type"] == "Directly": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
545 |
self.DirectlyBaseType.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
546 |
self.DirectlyBaseType.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
547 |
elif type_infos["type"] == "Subrange": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
548 |
self.SubrangeBaseType.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
549 |
self.SubrangeBaseType.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
550 |
elif type_infos["type"] == "Array": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
551 |
self.ArrayBaseType.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
552 |
self.ArrayBaseType.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
553 |
elif infos[0] == "lower": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
554 |
self.SubrangeMinimum.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
555 |
self.SubrangeMaximum.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
556 |
elif infos[0] == "upper": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
557 |
self.SubrangeMinimum.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
558 |
self.SubrangeMaximum.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
559 |
elif infos[0] == "value": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
560 |
listctrl = self.EnumeratedValues.GetListCtrl() |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
561 |
listctrl.SetItemBackgroundColour(infos[1], wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
562 |
listctrl.SetItemTextColour(infos[1], wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
563 |
listctrl.Select(listctrl.FocusedItem, False) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
564 |
elif infos[0] == "range": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
565 |
listctrl = self.EnumeratedValues.GetListCtrl() |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
566 |
listctrl.SetItemBackgroundColour(infos[1], wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
567 |
listctrl.SetItemTextColour(infos[1], wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
568 |
listctrl.SetStringSelection("") |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
569 |
elif infos[0] == "initial": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
570 |
if type_infos["type"] == "Directly": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
571 |
text = self.DirectlyInitialValue.GetValue() |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
572 |
self.DirectlyInitialValue.SetValue(text[:start[1]]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
573 |
self.DirectlyInitialValue.SetDefaultStyle(wx.TextAttr(wx.RED, wx.Colour(255, 255, 0))) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
574 |
self.DirectlyInitialValue.AppendText(text[start[1]:end[1] + 1]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
575 |
self.DirectlyInitialValue.SetDefaultStyle(wx.TextAttr(wx.BLACK, wx.WHITE)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
576 |
self.DirectlyInitialValue.AppendText(text[end[1] + 1:]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
577 |
elif type_infos["type"] == "Subrange": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
578 |
self.SubrangeInitialValue.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
579 |
self.SubrangeInitialValue.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
580 |
elif type_infos["type"] == "Enumerated": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
581 |
self.EnumeratedInitialValue.SetBackgroundColour(wx.Colour(255, 255, 0)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
582 |
self.EnumeratedInitialValue.SetForegroundColour(wx.RED) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
583 |
elif type_infos["type"] == "Array": |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
584 |
text = self.ArrayInitialValue.GetValue() |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
585 |
self.ArrayInitialValue.SetValue(text[:start[1]]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
586 |
self.ArrayInitialValue.SetDefaultStyle(wx.TextAttr(wx.RED, wx.Colour(255, 255, 0))) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
587 |
self.ArrayInitialValue.AppendText(text[start[1]:end[1] + 1]) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
588 |
self.ArrayInitialValue.SetDefaultStyle(wx.TextAttr(wx.BLACK, wx.WHITE)) |
fc2d6cbb8b39
Adding support for highlighing compiling errors from matiec
lbessard
parents:
215
diff
changeset
|
589 |
self.ArrayInitialValue.AppendText(text[end[1] + 1:]) |