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