author | lbessard |
Fri, 21 Dec 2007 18:06:11 +0100 | |
changeset 84 | 8bc2669828e9 |
parent 82 | d7b4dd1f543f |
child 105 | 434aed8dc58d |
permissions | -rw-r--r-- |
20 | 1 |
import os, sys |
2 |
base_folder = os.path.split(sys.path[0])[0] |
|
3 |
sys.path.append(os.path.join(base_folder, "wxsvg", "defeditor")) |
|
4 |
||
37 | 5 |
from DEFControler import * |
6 |
from defeditor import * |
|
7 |
from FBD_Objects import * |
|
11 | 8 |
|
13
f1f0edbeb313
More precise design for plugins.... to be continued...
etisserant
parents:
12
diff
changeset
|
9 |
class _EditorFramePlug(EditorFrame): |
37 | 10 |
""" |
11 |
This Class add IEC specific features to the SVGUI DEFEditor : |
|
12 |
- FDB preview |
|
13 |
- FBD begin drag |
|
14 |
""" |
|
15 |
def __init__(self,controller): |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
16 |
EditorFrame.__init__(self,controller, solo_mode=False) |
37 | 17 |
self.FbdWindow = wx.Panel(name='fbdwindow',parent=self.EditorPanel, |
18 |
pos=wx.Point(300, 355),size=wx.Size(240, 240), |
|
19 |
style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER) |
|
20 |
self.FbdWindow.SetBackgroundColour(wxColour(255,255,255)) |
|
21 |
self.FbdWindow.Bind(wx.EVT_LEFT_DOWN, self.OnFbdClick) |
|
22 |
wx.EVT_PAINT(self.FbdWindow,self.OnPaintFBD) |
|
23 |
||
24 |
self.FbdData = None |
|
25 |
self.RefreshProjectTree() |
|
26 |
if (controller.SvgFilepath): |
|
27 |
self.OpenSVGFile(controller.filepath) |
|
28 |
self.mySVGctrl.Refresh() |
|
29 |
self.OnNewFile() |
|
30 |
self.RefreshFBD() |
|
31 |
||
32 |
def SetFbdDragData(self,selected_type): |
|
33 |
self.FbdBlock = FBD_Block(parent=self.FbdWindow,type=selected_type,name='') |
|
34 |
name = self.Controler.GetSelectedElementName() |
|
35 |
self.FbdData = str((selected_type,"functionBlock", name)) |
|
36 |
||
37 |
def RefreshFBD(self): |
|
38 |
dc = wx.ClientDC(self.FbdWindow) |
|
39 |
dc.Clear() |
|
40 |
if self.Controler.HasOpenedProject(): |
|
41 |
selected_type = self.Controler.GetSelectedElementType() |
|
42 |
if selected_type: |
|
43 |
self.SetFbdDragData(selected_type) |
|
44 |
self.FbdBlock = FBD_Block(parent=self.FbdWindow,type=selected_type,name='') |
|
45 |
width,height = self.FbdBlock.GetMinSize() |
|
46 |
self.FbdBlock.SetSize(width,height) |
|
47 |
clientsize = self.FbdWindow.GetClientSize() |
|
48 |
x = (clientsize.width - width) / 2 |
|
49 |
y = (clientsize.height - height) / 2 |
|
50 |
self.FbdBlock.SetPosition(x, y) |
|
51 |
self.FbdBlock.Draw(dc) |
|
52 |
||
53 |
def OnPaintFBD(self,event): |
|
54 |
self.RefreshFBD() |
|
55 |
event.Skip() |
|
56 |
||
57 |
def OnFbdClick(self,event): |
|
58 |
if self.FbdData: |
|
59 |
data = wx.TextDataObject(self.FbdData) |
|
60 |
DropSrc = wx.DropSource(self.FbdWindow) |
|
61 |
DropSrc.SetData(data) |
|
62 |
DropSrc.DoDragDrop() |
|
63 |
||
64 |
def OnProjectTreeItemSelected(self,event): |
|
65 |
EditorFrame.OnProjectTreeItemSelected(self,event) |
|
66 |
self.RefreshFBD() |
|
67 |
||
68 |
def OnNew(self,event): |
|
69 |
EditorFrame.OnNew(self,event) |
|
70 |
self.RefreshFBD() |
|
71 |
||
72 |
def OnOpen(self,event): |
|
73 |
EditorFrame.OnOpen(self,event) |
|
74 |
self.RefreshFBD() |
|
75 |
||
76 |
def OnGenerate(self,event): |
|
77 |
self.SaveProject() |
|
78 |
self.Controler.PlugGenerate_C(sys.path[0],(0,0,4,5),None) |
|
79 |
event.Skip() |
|
80 |
||
12 | 81 |
def OnClose(self, event): |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
82 |
self._onclose() |
12 | 83 |
event.Skip() |
37 | 84 |
|
85 |
""" |
|
86 |
TYPECONVERSION = {"BOOL" : "X", "SINT" : "B", "INT" : "W", "DINT" : "D", "LINT" : "L", |
|
87 |
"USINT" : "B", "UINT" : "W", "UDINT" : "D", "ULINT" : "L", "REAL" : "D", "LREAL" : "L", |
|
88 |
"STRING" : "B", "BYTE" : "B", "WORD" : "W", "DWORD" : "D", "LWORD" : "L", "WSTRING" : "W"} |
|
89 |
""" |
|
90 |
TYPECONVERSION = {"BOOL" : "X", "UINT" : "W","REAL" : "D","STRING" : "B"} |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
91 |
CTYPECONVERSION = {"BOOL" : "IEC_BOOL", "UINT" : "IEC_UINT", "STRING" : "IEC_STRING", "REAL" : "IEC_REAL"} |
37 | 92 |
CPRINTTYPECONVERSION = {"BOOL" : "d", "UINT" : "d", "STRING" : "s", "REAL" : "f"} |
93 |
class RootClass(DEFControler): |
|
94 |
||
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
95 |
def __init__(self): |
37 | 96 |
DEFControler.__init__(self) |
97 |
filepath = os.path.join(self.PlugPath(), "gui.def") |
|
98 |
||
12 | 99 |
if os.path.isfile(filepath): |
37 | 100 |
svgfile = os.path.join(self.PlugPath(), "gui.svg") |
101 |
if os.path.isfile(svgfile): |
|
102 |
self.SvgFilepath = svgfile |
|
12 | 103 |
self.OpenXMLFile(filepath) |
13
f1f0edbeb313
More precise design for plugins.... to be continued...
etisserant
parents:
12
diff
changeset
|
104 |
else: |
12 | 105 |
self.CreateRootElement() |
106 |
self.SetFilePath(filepath) |
|
107 |
||
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
108 |
_View = None |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
109 |
def _OpenView(self, logger): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
110 |
if not self._View: |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
111 |
def _onclose(): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
112 |
self._View = None |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
113 |
def _onsave(): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
114 |
self.GetPlugRoot().SaveProject() |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
115 |
self._View = _EditorFramePlug(self) |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
116 |
self._View._onclose = _onclose |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
117 |
self._View._onsave = _onsave |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
118 |
filepath = os.path.join(self.PlugPath(), "gui.def") |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
119 |
self._View.OpenSVGFile(filepath) |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
120 |
self._View.Show() |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
121 |
|
65 | 122 |
PluginMethods = [ |
82
d7b4dd1f543f
Beremiz layout improved for wx2.8 by inserting all control in TreeCtrl
lbessard
parents:
73
diff
changeset
|
123 |
{"bitmap" : os.path.join("images","HMIEditor"), |
65 | 124 |
"name" : "HMI Editor", |
125 |
"tooltip" : "HMI Editor", |
|
126 |
"method" : _OpenView}, |
|
82
d7b4dd1f543f
Beremiz layout improved for wx2.8 by inserting all control in TreeCtrl
lbessard
parents:
73
diff
changeset
|
127 |
{"bitmap" : os.path.join("images","ImportSVG"), |
65 | 128 |
"name" : "Import SVG", |
129 |
"tooltip" : "Import SVG", |
|
130 |
"method" : _OpenView}, |
|
82
d7b4dd1f543f
Beremiz layout improved for wx2.8 by inserting all control in TreeCtrl
lbessard
parents:
73
diff
changeset
|
131 |
{"bitmap" : os.path.join("images","ImportDEF"), |
65 | 132 |
"name" : "Import DEF", |
133 |
"tooltip" : "Import DEF", |
|
134 |
"method" : _OpenView}, |
|
135 |
] |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
136 |
|
37 | 137 |
def OnPlugSave(self): |
12 | 138 |
self.SaveXMLFile() |
139 |
return True |
|
37 | 140 |
|
141 |
def GenerateProgramHeadersPublicVars(self): |
|
142 |
fct = "" |
|
143 |
fct += " void OnPlcOutEvent(wxEvent& event);\n\n" |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
144 |
fct += " void Retrive();\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
145 |
fct += " void Publish();\n" |
37 | 146 |
fct += " void Initialize();\n" |
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
147 |
# fct += " void Print();\n" |
37 | 148 |
return fct |
149 |
||
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
150 |
def GenerateIECVars(self): |
37 | 151 |
text = "" |
152 |
elementsTab = self.GetElementsTab() |
|
153 |
for element in elementsTab: |
|
154 |
infos = element.getElementAttributes() |
|
155 |
for info in infos: |
|
156 |
if info["name"] == "id": |
|
157 |
element_id = str(info["value"]) |
|
39 | 158 |
text += "volatile int out_state_"+element_id+";\n" |
159 |
text += "volatile int in_state_"+element_id+";\n" |
|
37 | 160 |
text +="\n" |
161 |
#Declaration des variables |
|
162 |
for element in elementsTab: |
|
163 |
infos = element.getElementAttributes() |
|
164 |
for info in infos: |
|
165 |
if info["name"] == "id": |
|
166 |
element_id = str(info["value"]) |
|
167 |
type = element.GetElementInfos()["type"] |
|
168 |
FbdBlock = self.GetBlockType(type) |
|
169 |
element_num_patte = 1 |
|
170 |
for input in FbdBlock["inputs"]: |
|
171 |
element_type = TYPECONVERSION[input[1]] |
|
172 |
element_c_type = CTYPECONVERSION[input[1]] |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
173 |
line = "__Q"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte)+";\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
174 |
text += element_c_type+" "+line |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
175 |
text += element_c_type+" _copy"+line |
37 | 176 |
element_num_patte +=1 |
177 |
element_num_patte = 1 |
|
178 |
for output in FbdBlock["outputs"]: |
|
179 |
element_type = TYPECONVERSION[output[1]] |
|
180 |
element_c_type = CTYPECONVERSION[output[1]] |
|
181 |
||
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
182 |
line = "__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte)+";\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
183 |
text += element_c_type+" "+line |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
184 |
text += element_c_type+" _copy"+line |
37 | 185 |
element_num_patte +=1 |
186 |
text +="\n" |
|
187 |
return text |
|
188 |
||
189 |
def GenerateGlobalVarsAndFuncs(self): |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
190 |
text = "#include \"iec_types.h\"\n\n" |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
191 |
pri_vars = self.GenerateIECVars() |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
192 |
if (pri_vars): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
193 |
text += pri_vars |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
194 |
|
37 | 195 |
text += "IMPLEMENT_APP_NO_MAIN(SVGViewApp);\n" |
196 |
text += "IMPLEMENT_WX_THEME_SUPPORT;\n" |
|
39 | 197 |
text += "SVGViewApp *myapp = NULL;\n" |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
198 |
text += "pthread_t wxMainLoop;\n" |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
199 |
# text += "pthread_t wxMainLoop,automate;\n" |
39 | 200 |
text += "int myargc = 0;\n" |
201 |
text += "char** myargv = NULL;\n\n" |
|
202 |
||
203 |
text += "#define UNCHANGED 1 \n" |
|
37 | 204 |
text += "#define PLC_BUSY 2 \n" |
39 | 205 |
text += "#define CHANGED 3 \n" |
206 |
text += "#define GUI_BUSY 4 \n\n" |
|
37 | 207 |
|
208 |
||
209 |
text += "void* InitWxEntry(void* args)\n{\n" |
|
210 |
text += " wxEntry(myargc,myargv);\n" |
|
211 |
text += " return args;\n" |
|
212 |
text += "}\n\n" |
|
213 |
||
39 | 214 |
# text += "void* SimulAutomate(void* args)\n{\n" |
215 |
# text += " while(1){\n" |
|
216 |
# text += " myapp->frame->m_svgCtrl->IN_"+self.BusNumber+"();\n" |
|
217 |
# text += " //printf(\"AUTOMATE\\n\");\n" |
|
218 |
# text += " myapp->frame->m_svgCtrl->OUT_"+self.BusNumber+"();\n" |
|
219 |
# text += " sleep(1);\n" |
|
220 |
# text += " }\n" |
|
221 |
# text += " return args;\n" |
|
222 |
# text += "}\n\n" |
|
37 | 223 |
|
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
224 |
# if (self.SVGUIRootElement): |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
225 |
# width = self.SVGUIRootElement.GetBBox().GetWidth() |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
226 |
# height = self.SVGUIRootElement.GetBBox().GetHeight() |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
227 |
# else : |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
228 |
# width = 250 |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
229 |
# height = 350 |
37 | 230 |
text += "bool SVGViewApp::OnInit()\n{\n" |
231 |
text += " #ifndef __WXMSW__\n" |
|
232 |
text += " setlocale(LC_NUMERIC, \"C\");\n" |
|
233 |
text += " #endif\n" |
|
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
234 |
#text += " frame = new MainFrame(NULL, wxT(\"Program\"),wxDefaultPosition, wxSize((int)"+str(width)+", (int)"+str(height)+"));\n" |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
235 |
text += " frame = new MainFrame(NULL, wxT(\"Program\"),wxDefaultPosition, wxDefaultSize);\n" |
37 | 236 |
text += " myapp = this;\n" |
39 | 237 |
# text += " pthread_create(&automate, NULL, SimulAutomate, NULL);\n" |
37 | 238 |
text += " return true;\n" |
239 |
text += "}\n\n" |
|
240 |
||
39 | 241 |
text += "int __init_"+self.BusNumber+"(int argc, char** argv)\n{\n" |
37 | 242 |
text += " myargc = argc;\n" |
243 |
text += " myargv = argv;\n" |
|
244 |
text += " pthread_create(&wxMainLoop, NULL, InitWxEntry, NULL);\n" |
|
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
245 |
text += "}\n\n" |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
246 |
|
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
247 |
text += "int __cleanup_"+self.BusNumber+"()\n{\n" |
37 | 248 |
text += "}\n\n" |
39 | 249 |
|
250 |
text += "int __retrive_"+self.BusNumber+"()\n{\n" |
|
251 |
text += " if(myapp){" |
|
252 |
text += " myapp->Retrive()" |
|
253 |
text += " }" |
|
254 |
text += "}\n\n" |
|
255 |
||
256 |
text += "int __publish_"+self.BusNumber+"()\n{\n" |
|
257 |
text += " if(myapp){" |
|
258 |
text += " myapp->Publish()" |
|
259 |
text += " }" |
|
260 |
text += "}\n\n" |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
261 |
|
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
262 |
text += "IEC_STRING wxStringToIEC_STRING(wxString s)\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
263 |
text += "{\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
264 |
text += " STRING res = {0,""};\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
265 |
text += " for(int i=0; i<s.Length() && i<STR_MAX_LEN; i++)\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
266 |
text += " res.body[i] = s.GetChar(i);\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
267 |
text += " res.len = i;\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
268 |
text += " return res;\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
269 |
text += "}\n\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
270 |
|
37 | 271 |
|
272 |
return text |
|
273 |
||
274 |
def GenerateProgramEventTable(self): |
|
275 |
evt = "" |
|
276 |
elementsTab = self.GetElementsTab() |
|
277 |
#evt += "wxEVT_PLCOUT = wxNewEventType();\n\n"; |
|
278 |
evt += "BEGIN_DECLARE_EVENT_TYPES()\n" |
|
279 |
evt += "DECLARE_LOCAL_EVENT_TYPE( EVT_PLC, wxNewEventType() )\n" |
|
280 |
evt += "END_DECLARE_EVENT_TYPES()\n\n" |
|
281 |
||
282 |
evt += "DEFINE_LOCAL_EVENT_TYPE( EVT_PLC )\n\n" |
|
283 |
#Event Table Declaration |
|
284 |
evt += "BEGIN_EVENT_TABLE(Program, SVGUIWindow)\n" |
|
285 |
for element in elementsTab: |
|
286 |
infos = element.getElementAttributes() |
|
287 |
for info in infos: |
|
288 |
if info["name"] == "id": |
|
289 |
element_id = str(info["value"]) |
|
290 |
if info["name"] == "name": |
|
291 |
element_name = str(info["value"]) |
|
292 |
type = element.GetElementInfos()["type"] |
|
293 |
if type == "Button": |
|
294 |
evt += " EVT_BUTTON (SVGUIID(\""+element_id+"\"), Program::On"+element_name+"Click)\n" |
|
295 |
elif type == "ScrollBar": |
|
296 |
pass |
|
297 |
#evt += " EVT_LEFT_UP (Program::OnClick)\n" |
|
298 |
#evt += " EVT_COMMAND_SCROLL_THUMBTRACK (SVGUIID(\""+element_id+"\"), Program::On"+element_name+"Changed)\n" |
|
299 |
elif type == "RotatingCtrl": |
|
300 |
evt += " EVT_COMMAND_SCROLL_THUMBTRACK (SVGUIID(\""+element_id+"\"), Program::On"+element_name+"Changed)\n" |
|
301 |
elif type == "NoteBook": |
|
302 |
evt += " EVT_NOTEBOOK_PAGE_CHANGED (SVGUIID(\""+element_id+"\"), Program::On"+element_name+"TabChanged)\n" |
|
303 |
elif type == "Container" or type == "Transform": |
|
304 |
evt += " EVT_PAINT(Program::On"+element_name+"Paint)\n" |
|
305 |
evt += " EVT_LEFT_UP (Program::OnClick)\n" |
|
306 |
evt += " EVT_CUSTOM( EVT_PLC, wxID_ANY, Program::OnPlcOutEvent )\n" |
|
307 |
evt += "END_EVENT_TABLE()\n\n" |
|
308 |
return evt |
|
309 |
||
310 |
def GenerateProgramInitFrame(self): |
|
311 |
text = "MainFrame::MainFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,const wxSize& size, long style): wxFrame(parent, wxID_ANY, title, pos, size, style)\n{\n" |
|
312 |
text += " m_svgCtrl = new Program(this);\n" |
|
313 |
text += " if (m_svgCtrl->LoadFiles(wxT(\""+self.SvgFilepath+"\"), wxT(\""+self.filepath+"\")))\n" |
|
314 |
text += " {\n" |
|
315 |
text += " Show(true);\n" |
|
316 |
text += " m_svgCtrl->SetFocus();\n" |
|
317 |
text += " m_svgCtrl->SetFitToFrame(true);\n" |
|
318 |
text += " m_svgCtrl->RefreshScale();\n" |
|
319 |
text += " m_svgCtrl->InitScrollBars();\n" |
|
320 |
text += " m_svgCtrl->Initialize();\n" |
|
321 |
text += " m_svgCtrl->Update();\n" |
|
322 |
text += " //m_svgCtrl->Print();\n" |
|
323 |
text += " }\n" |
|
324 |
text += " else\n" |
|
325 |
text += " {\n" |
|
326 |
text += " printf(\"Error while opening files\\n\");\n" |
|
327 |
text += " exit(0);\n" |
|
328 |
text += " }\n" |
|
329 |
text += "}\n\n\n" |
|
330 |
return text |
|
331 |
||
332 |
def GenerateProgramInitProgram(self): |
|
333 |
elementsTab = self.GetElementsTab() |
|
334 |
text = "Program::Program(wxWindow* parent):SVGUIWindow(parent)\n{\n" |
|
335 |
for element in elementsTab: |
|
336 |
infos = element.getElementAttributes() |
|
337 |
for info in infos: |
|
338 |
if info["name"] == "id": |
|
339 |
element_id = str(info["value"]) |
|
39 | 340 |
text += " out_state_"+element_id+" = UNCHANGED;\n" |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
341 |
text += " in_state_"+element_id+" = UNCHANGED;\n" |
37 | 342 |
text += "}\n\n" |
343 |
return text |
|
344 |
||
345 |
def GenerateProgramEventFunctions(self): |
|
346 |
fct="" |
|
347 |
elementsTab = self.GetElementsTab() |
|
348 |
for element in elementsTab: |
|
349 |
infos = element.getElementAttributes() |
|
350 |
for info in infos: |
|
351 |
if info["name"] == "id": |
|
352 |
element_id = str(info["value"]) |
|
39 | 353 |
_lock = " in_state_"+element_id+" = GUI_BUSY;\n" |
354 |
_unlock = " in_state_"+element_id+" = CHANGED;\n" |
|
37 | 355 |
if info["name"] == "name": |
356 |
element_name = str(info["value"]) |
|
357 |
type = element.GetElementInfos()["type"] |
|
358 |
FbdBlock = self.GetBlockType(type) |
|
359 |
if type == "Button": |
|
360 |
fct += "void Program::On"+element_name+"Click(wxCommandEvent& event)\n{\n" |
|
39 | 361 |
fct += _lock |
37 | 362 |
element_num_patte = 1 |
363 |
for output in FbdBlock["outputs"]: |
|
364 |
element_type = TYPECONVERSION[output[1]] |
|
39 | 365 |
fct += " _copy__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte)+" = true;\n" |
37 | 366 |
element_num_patte +=1 |
39 | 367 |
fct += _unlock |
37 | 368 |
fct += " event.Skip();\n" |
369 |
fct += "}\n\n" |
|
370 |
||
371 |
elif type == "RotatingCtrl": |
|
372 |
fct += "void Program::On"+element_name+"Changed(wxScrollEvent& event)\n{\n" |
|
373 |
fct += " SVGUIRotatingCtrl* rotating = (SVGUIRotatingCtrl*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
374 |
fct += " rotating->SendScrollEvent(event);\n" |
|
375 |
fct += " double angle = rotating->GetAngle();\n" |
|
39 | 376 |
fct += _lock |
37 | 377 |
element_num_patte = 1 |
378 |
for output in FbdBlock["outputs"]: |
|
379 |
element_type = TYPECONVERSION[output[1]] |
|
380 |
||
381 |
if element_num_patte == 1: |
|
382 |
value = "angle" |
|
383 |
elif element_num_patte == 2: |
|
384 |
value = "true" |
|
39 | 385 |
fct += " _copy__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte)+" = "+value+";\n" |
37 | 386 |
element_num_patte +=1 |
39 | 387 |
fct += _unlock |
37 | 388 |
fct += "}\n\n" |
389 |
elif type == "NoteBook": |
|
390 |
fct += "void Program::On"+element_name+"TabChanged(wxNotebookEvent& event)\n{\n" |
|
391 |
fct += " SVGUINoteBook* notebook = (SVGUINoteBook*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
392 |
fct += " notebook->SendNotebookEvent(event);\n" |
|
393 |
fct += " unsigned int selected = notebook->GetCurrentPage();\n" |
|
39 | 394 |
fct += _lock |
37 | 395 |
element_num_patte = 1 |
396 |
for output in FbdBlock["outputs"]: |
|
397 |
element_type = TYPECONVERSION[output[1]] |
|
398 |
||
399 |
if element_num_patte == 1: |
|
400 |
value = "selected" |
|
401 |
elif element_num_patte == 2: |
|
402 |
value = "true" |
|
39 | 403 |
fct += " _copy__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte)+" = "+value+";\n" |
37 | 404 |
element_num_patte +=1 |
39 | 405 |
fct += _unlock |
37 | 406 |
fct += "}\n\n" |
407 |
elif type == "Transform": |
|
408 |
fct += "void Program::On"+element_name+"Paint(wxPaintEvent& event)\n{\n" |
|
409 |
fct += " SVGUITransform* transform = (SVGUITransform*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
39 | 410 |
fct += _lock |
37 | 411 |
element_num_patte = 1 |
412 |
for output in FbdBlock["outputs"]: |
|
413 |
if element_num_patte == 1: |
|
39 | 414 |
fct += " if (transform->GetX() != _copy__ID"+self.BusNumber+"_"+element_id+"_1)\n" |
415 |
fct += " {\n" |
|
416 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_1 = transform->GetX();\n" |
|
417 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = true;\n" |
|
418 |
fct += " }\n" |
|
37 | 419 |
elif element_num_patte == 2: |
39 | 420 |
fct += " if (transform->GetY() != _copy__ID"+self.BusNumber+"_"+element_id+"_2)\n" |
421 |
fct += " {\n" |
|
422 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_2 = transform->GetY();\n" |
|
423 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = true;\n" |
|
424 |
fct += " }\n" |
|
37 | 425 |
elif element_num_patte == 3: |
39 | 426 |
fct += " if (transform->GetXScale() != _copy__ID"+self.BusNumber+"_"+element_id+"_3)\n" |
427 |
fct += " {\n" |
|
428 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_3 = transform->GetXScale();\n" |
|
429 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = true;\n" |
|
430 |
fct += " }\n" |
|
37 | 431 |
elif element_num_patte == 4: |
39 | 432 |
fct += " if (transform->GetYScale() != _copy__ID"+self.BusNumber+"_"+element_id+"_4)\n" |
433 |
fct += " {\n" |
|
434 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_4 = transform->GetYScale();\n" |
|
435 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = true;\n" |
|
436 |
fct += " }\n" |
|
37 | 437 |
elif element_num_patte == 5: |
39 | 438 |
fct += " if (transform->GetAngle() != _copy__ID"+self.BusNumber+"_"+element_id+"_5)\n" |
439 |
fct += " {\n" |
|
440 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_5 = transform->GetAngle();\n" |
|
441 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = true;\n" |
|
442 |
fct += " }\n" |
|
37 | 443 |
element_num_patte +=1 |
39 | 444 |
fct += _unlock |
37 | 445 |
fct += " event.Skip();\n" |
446 |
fct += "}\n\n" |
|
447 |
elif type == "Container": |
|
448 |
fct += "void Program::On"+element_name+"Paint(wxPaintEvent& event)\n{\n" |
|
449 |
fct += " SVGUIContainer* container = (SVGUIContainer*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
39 | 450 |
fct += " bool isvisible = container->IsVisible();\n" |
451 |
fct += _lock |
|
452 |
fct += " if (isvisible != _copy__IX"+self.BusNumber+"_"+element_id+"_1)\n" |
|
37 | 453 |
fct += " {\n" |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
454 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_1 = container->IsVisible();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
455 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n" |
37 | 456 |
fct += " }\n" |
39 | 457 |
fct += _unlock |
37 | 458 |
fct += " event.Skip();\n" |
459 |
fct += "}\n\n" |
|
460 |
||
461 |
fct += "void Program::OnChar(wxKeyEvent& event)\n{\n" |
|
462 |
fct += " SVGUIContainer* container = GetSVGUIRootElement();\n" |
|
463 |
fct += " if (container->GetFocusedElementName() == wxT(\"TextCtrl\"))\n" |
|
464 |
fct += " {\n" |
|
465 |
fct += " wxString focusedId = container->GetFocusedElement();\n" |
|
466 |
fct += " SVGUITextCtrl* text = (SVGUITextCtrl*)GetElementById(container->GetFocusedElement());\n" |
|
467 |
fct += " text->SendKeyEvent(event);\n" |
|
468 |
for element in elementsTab: |
|
469 |
infos = element.getElementAttributes() |
|
470 |
for info in infos: |
|
471 |
if info["name"] == "id": |
|
472 |
element_id = str(info["value"]) |
|
39 | 473 |
_lock = " in_state_"+element_id+" = GUI_BUSY;\n" |
474 |
_unlock = " in_state_"+element_id+" = CHANGED;\n" |
|
37 | 475 |
type = element.GetElementInfos()["type"] |
476 |
FbdBlock = self.GetBlockType(type) |
|
477 |
if type == "TextCtrl": |
|
39 | 478 |
fct += " if (focusedId == wxT(\""+element_id+"\"))\n" |
37 | 479 |
fct += " {\n" |
39 | 480 |
fct += _lock |
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
481 |
fct += " _copy__IB"+self.BusNumber+"_"+element_id+"_1 = wxStringToIEC_STRING(text->GetValue());\n" |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
482 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n" |
39 | 483 |
fct += _unlock |
37 | 484 |
fct += " }\n" |
485 |
fct += " }\n" |
|
486 |
fct += "}\n" |
|
487 |
||
488 |
||
489 |
||
490 |
fct += "void Program::OnClick(wxMouseEvent& event)\n{\n" |
|
491 |
fct += " SVGUIContainer* container = GetSVGUIRootElement();\n" |
|
492 |
fct += " if (container->GetFocusedElementName() == wxT(\"ScrollBar\"))\n" |
|
493 |
fct += " {\n" |
|
494 |
fct += " wxString focusedId = container->GetFocusedElement();\n" |
|
495 |
fct += " SVGUIScrollBar* scrollbar = (SVGUIScrollBar*)GetElementById(focusedId);\n" |
|
496 |
fct += " scrollbar->SendMouseEvent(event);\n" |
|
497 |
for element in elementsTab: |
|
498 |
infos = element.getElementAttributes() |
|
499 |
for info in infos: |
|
500 |
if info["name"] == "id": |
|
501 |
element_id = str(info["value"]) |
|
502 |
type = element.GetElementInfos()["type"] |
|
503 |
FbdBlock = self.GetBlockType(type) |
|
504 |
if type == "ScrollBar": |
|
39 | 505 |
fct += " if (focusedId == wxT(\""+element_id+"\"))\n" |
37 | 506 |
fct += " {\n" |
507 |
fct += " unsigned int scrollPos = scrollbar->GetThumbPosition();\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
508 |
fct += " _copy__IW"+self.BusNumber+"_"+element_id+"_1 = scrollPos;\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
509 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n" |
37 | 510 |
fct += " }\n" |
511 |
fct += " }\n" |
|
512 |
fct += " event.Skip();\n" |
|
513 |
fct += "}\n" |
|
514 |
||
515 |
||
516 |
||
517 |
||
39 | 518 |
fct += "/* OnPlcOutEvent updatde GUI with provided IEC __Q* PLC output variables */\n" |
37 | 519 |
fct += "void Program::OnPlcOutEvent(wxEvent& event)\n{\n" |
39 | 520 |
for element in elementsTab: |
521 |
infos = element.getElementAttributes() |
|
522 |
for info in infos: |
|
523 |
if info["name"] == "id": |
|
524 |
element_id = str(info["value"]) |
|
525 |
_lock = " if (__sync_val_compare_and_swap (&out_state_"+element_id+", CHANGED, GUI_BUSY) == CHANGED)" |
|
526 |
_lock += " {\n" |
|
527 |
_unlock = " __sync_val_compare_and_swap (&out_state_"+element_id+", GUI_BUSY, UNCHANGED);\n" |
|
528 |
_unlock +=" }\n" |
|
37 | 529 |
type = element.GetElementInfos()["type"] |
530 |
FbdBlock = self.GetBlockType(type) |
|
531 |
if type == "Button": |
|
39 | 532 |
fct += _lock |
533 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_2)\n" |
|
37 | 534 |
fct += " {\n" |
535 |
fct += " SVGUIButton* button = (SVGUIButton*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
536 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_1)\n" |
37 | 537 |
fct += " button->Show();\n" |
538 |
fct += " else\n" |
|
539 |
fct += " button->Hide();\n" |
|
540 |
fct += " }\n" |
|
39 | 541 |
fct += _unlock |
37 | 542 |
elif type == "Container": |
39 | 543 |
fct += _lock |
544 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_2)\n" |
|
37 | 545 |
fct += " {\n" |
546 |
fct += " SVGUIContainer* container = (SVGUIContainer*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
547 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_1)\n" |
37 | 548 |
fct += " container->Show();\n" |
549 |
fct += " else\n" |
|
550 |
fct += " container->Hide();\n" |
|
551 |
fct += " }\n" |
|
39 | 552 |
fct += _unlock |
37 | 553 |
elif type == "TextCtrl": |
39 | 554 |
fct += _lock |
555 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_2)\n" |
|
37 | 556 |
fct += " {\n" |
557 |
fct += " SVGUITextCtrl* text = (SVGUITextCtrl*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
558 |
fct += " wxString str = wxString::FromAscii(_copy__QB"+self.BusNumber+"_"+element_id+"_1);\n" |
37 | 559 |
fct += " text->SetText(str);\n" |
560 |
fct += " }\n" |
|
39 | 561 |
fct += _unlock |
37 | 562 |
elif type == "ScrollBar": |
39 | 563 |
fct += _lock |
564 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_2)\n" |
|
37 | 565 |
fct += " {\n" |
566 |
fct += " SVGUIScrollBar* scrollbar = (SVGUIScrollBar*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
567 |
fct += " scrollbar->SetThumbPosition(_copy__QW"+self.BusNumber+"_"+element_id+"_1);\n" |
37 | 568 |
fct += " }\n" |
39 | 569 |
fct += _unlock |
37 | 570 |
elif type == "RotatingCtrl": |
39 | 571 |
fct += _lock |
572 |
fct += " if (_copy__QX"+self.BusNumber+"_"+element_id+"_2)\n" |
|
37 | 573 |
fct += " {\n" |
574 |
fct += " SVGUIRotatingCtrl* rotating = (SVGUIRotatingCtrl*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
575 |
fct += " rotating->SetAngle(_copy__QD"+self.BusNumber+"_"+element_id+"_1);\n" |
37 | 576 |
fct += " }\n" |
39 | 577 |
fct += _unlock |
37 | 578 |
elif type == "NoteBook": |
39 | 579 |
fct += _lock |
580 |
fct += " if (copy__QX"+self.BusNumber+"_"+element_id+"_2)\n" |
|
37 | 581 |
fct += " {\n" |
582 |
fct += " SVGUINoteBook* notebook = (SVGUINoteBook*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
583 |
fct += " notebook->SetCurrentPage(_copy__QB"+self.BusNumber+"_"+element_id+"_1);\n" |
37 | 584 |
fct += " }\n" |
39 | 585 |
fct += _unlock |
37 | 586 |
elif type == "Transform": |
39 | 587 |
fct += _lock |
588 |
fct += " if (copy__QX"+self.BusNumber+"_"+element_id+"_6)\n" |
|
37 | 589 |
fct += " {\n" |
590 |
fct += " SVGUITransform* transform = (SVGUITransform*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
591 |
fct += " transform->Move(_copy__QD"+self.BusNumber+"_"+element_id+"_1,_copy__QD"+self.BusNumber+"_"+element_id+"_2);\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
592 |
fct += " transform->Scale(_copy__QD"+self.BusNumber+"_"+element_id+"_3,_copy__QD"+self.BusNumber+"_"+element_id+"_4);\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
593 |
fct += " transform->Rotate(_copy__QD"+self.BusNumber+"_"+element_id+"_5);\n" |
37 | 594 |
fct += " }\n" |
39 | 595 |
fct += _unlock |
37 | 596 |
fct += " Update_Elements();\n" |
597 |
fct += " Refresh();\n" |
|
598 |
fct += " event.Skip();\n" |
|
599 |
fct += "}\n\n" |
|
600 |
return fct |
|
601 |
||
602 |
def GenerateProgramPrivateFunctions(self): |
|
603 |
elementsTab = self.GetElementsTab() |
|
39 | 604 |
fct = "void Program::Retrive()\n{\n" |
37 | 605 |
for element in elementsTab: |
606 |
infos = element.getElementAttributes() |
|
607 |
for info in infos: |
|
608 |
if info["name"] == "id": |
|
609 |
element_id = str(info["value"]) |
|
610 |
type = element.GetElementInfos()["type"] |
|
611 |
FbdBlock = self.GetBlockType(type) |
|
39 | 612 |
fct += " if ( __sync_val_compare_and_swap (&out_state_"+element_id+", UNCHANGED, PLC_BUSY) == UNCHANGED ||\n" |
613 |
fct += " __sync_val_compare_and_swap (&out_state_"+element_id+", CHANGED, PLC_BUSY) == CHANGED){\n" |
|
614 |
fct += " bool diff = False;\n" |
|
37 | 615 |
element_num_patte = 1 |
616 |
for input in FbdBlock["inputs"]: |
|
617 |
element_type = TYPECONVERSION[input[1]] |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
618 |
var = "__Q"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte) |
39 | 619 |
fct +=" diff |= _copy"+var+ " != "+var+";\n" |
37 | 620 |
fct +=" _copy"+var+ " = "+var+";\n" |
621 |
element_num_patte +=1 |
|
39 | 622 |
fct += " if(diff) out_state_"+element_id+" = CHANGED;\n" |
37 | 623 |
fct += " }\n" |
39 | 624 |
fct +=" /*Replace this with determinist signal if called from RT*/;\n" |
37 | 625 |
fct +=" wxCommandEvent event( EVT_PLC );\n" |
626 |
fct +=" ProcessEvent(event);\n" |
|
627 |
fct +="};\n\n" |
|
628 |
||
39 | 629 |
fct += "void Program::Publish()\n{\n" |
37 | 630 |
|
631 |
for element in elementsTab: |
|
632 |
infos = element.getElementAttributes() |
|
633 |
for info in infos: |
|
634 |
if info["name"] == "id": |
|
635 |
element_id = str(info["value"]) |
|
636 |
type = element.GetElementInfos()["type"] |
|
637 |
FbdBlock = self.GetBlockType(type) |
|
39 | 638 |
fct += " do{\n" |
639 |
fct += " if ( __sync_val_compare_and_swap (&in_state_"+element_id+", CHANGED, PLC_BUSY) == CHANGED){\n" |
|
37 | 640 |
element_num_patte = 1 |
641 |
for output in FbdBlock["outputs"]: |
|
642 |
element_type = TYPECONVERSION[output[1]] |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
643 |
var = "__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte) |
39 | 644 |
fct +=" "+var+ " = _copy"+var+";\n" |
37 | 645 |
element_num_patte +=1 |
39 | 646 |
fct += " /* reset change status pin */\n" |
647 |
if type == "Button": |
|
648 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = false;\n" |
|
649 |
elif type == "Container": |
|
650 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = false;\n" |
|
651 |
elif type == "TextCtrl": |
|
652 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = false;\n" |
|
653 |
elif type == "ScrollBar": |
|
654 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = false;\n" |
|
655 |
elif type == "RotatingCtrl": |
|
656 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = false;\n" |
|
657 |
elif type == "NoteBook": |
|
658 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = false;\n" |
|
659 |
elif type == "Transform": |
|
660 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = false;\n" |
|
661 |
fct += " }else{\n" |
|
662 |
fct += " break;\n" |
|
663 |
fct += " }\n" |
|
664 |
#If GUI did change data while publishing, do it again (in real-time this should be avoided with priority stuff) |
|
665 |
fct += " }while(__sync_val_compare_and_swap (&in_state_"+element_id+", PLC_BUSY, UNCHANGED) != PLC_BUSY)\n" |
|
37 | 666 |
fct +="};\n\n" |
667 |
||
668 |
fct += "void Program::Initialize()\n{\n" |
|
669 |
button = False |
|
670 |
container = False |
|
671 |
textctrl = False |
|
672 |
scrollbar = False |
|
673 |
rotatingctrl = False |
|
674 |
notebook = False |
|
675 |
transform = False |
|
676 |
for element in elementsTab: |
|
677 |
infos = element.getElementAttributes() |
|
678 |
for info in infos: |
|
679 |
if info["name"] == "id": |
|
680 |
element_id = str(info["value"]) |
|
681 |
type = element.GetElementInfos()["type"] |
|
682 |
FbdBlock = self.GetBlockType(type) |
|
683 |
if type == "Button": |
|
684 |
if (not button): |
|
685 |
fct += " SVGUIButton* button;\n" |
|
686 |
fct += " button = (SVGUIButton*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
687 |
fct += " if (button->IsVisible())\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
688 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_1 = true;\n" |
37 | 689 |
fct += " else\n" |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
690 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_1 = false;\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
691 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n\n" |
37 | 692 |
button = True |
693 |
elif type == "Container": |
|
694 |
if (not container): |
|
695 |
fct += " SVGUIContainer* container;\n" |
|
696 |
fct += " container = (SVGUIContainer*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
697 |
fct += " if (container->IsVisible())\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
698 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_1 = true;\n" |
37 | 699 |
fct += " else\n" |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
700 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_1 = false;\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
701 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n\n" |
37 | 702 |
container = True |
703 |
elif type == "TextCtrl": |
|
704 |
if (not textctrl): |
|
705 |
fct += " SVGUITextCtrl* text;\n" |
|
706 |
fct += " text = (SVGUITextCtrl*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
707 |
fct += " _copy__IB"+self.BusNumber+"_"+element_id+"_1 = wxStringToIEC_STRING(text->GetValue());\n" |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
708 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n\n" |
37 | 709 |
textctrl = True |
710 |
elif type == "ScrollBar": |
|
711 |
if (not scrollbar): |
|
712 |
fct += " SVGUIScrollBar* scrollbar;\n" |
|
713 |
fct += " scrollbar = (SVGUIScrollBar*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
714 |
fct += " _copy__IW"+self.BusNumber+"_"+element_id+"_1 = scrollbar->GetThumbPosition();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
715 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n\n" |
37 | 716 |
scrollbar = True |
717 |
elif type == "RotatingCtrl": |
|
718 |
if (not rotatingctrl): |
|
719 |
fct += " SVGUIRotatingCtrl* rotating;\n" |
|
720 |
fct += " rotating = (SVGUIRotatingCtrl*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
721 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_1 = rotating->GetAngle();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
722 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n\n" |
37 | 723 |
rotatingctrl = True |
724 |
elif type == "NoteBook": |
|
725 |
if (not notebook): |
|
726 |
fct += " SVGUINoteBook* notebook;\n" |
|
727 |
fct += " notebook = (SVGUINoteBook*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
728 |
fct += " _copy__IB"+self.BusNumber+"_"+element_id+"_1 = notebook->GetCurrentPage();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
729 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_2 = true;\n\n" |
37 | 730 |
notebook = True |
731 |
elif type == "Transform": |
|
732 |
if (not transform): |
|
733 |
fct += " SVGUITransform* transform;\n" |
|
734 |
fct += " transform = (SVGUITransform*)GetElementById(wxT(\""+element_id+"\"));\n" |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
735 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_1 = transform->GetX();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
736 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_2 = transform->GetY();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
737 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_3 = transform->GetXScale();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
738 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_4 = transform->GetYScale();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
739 |
fct += " _copy__ID"+self.BusNumber+"_"+element_id+"_5 = transform->GetAngle();\n" |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
740 |
fct += " _copy__IX"+self.BusNumber+"_"+element_id+"_6 = true;\n\n" |
37 | 741 |
transform = True |
742 |
fct += "}\n\n" |
|
743 |
||
744 |
#DEBUG Fonction d'affichage |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
745 |
# fct += "void Program::Print()\n{\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
746 |
# for element in elementsTab: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
747 |
# infos = element.getElementAttributes() |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
748 |
# for info in infos: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
749 |
# if info["name"] == "id": |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
750 |
# element_id = str(info["value"]) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
751 |
# type = element.GetElementInfos()["type"] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
752 |
# FbdBlock = self.GetBlockType(type) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
753 |
# element_num_patte = 1 |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
754 |
# for input in FbdBlock["inputs"]: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
755 |
# element_type = TYPECONVERSION[input[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
756 |
# c_type = CPRINTTYPECONVERSION[input[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
757 |
# var = "_copy__Q"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
758 |
# fct +=" printf(\""+var+": %"+c_type+"\\n\","+var+");\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
759 |
# element_num_patte +=1 |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
760 |
# element_num_patte = 1 |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
761 |
# for output in FbdBlock["outputs"]: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
762 |
# element_type = TYPECONVERSION[output[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
763 |
# c_type = CPRINTTYPECONVERSION[output[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
764 |
# var = "_copy__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
765 |
# fct +=" printf(\""+var+": %"+c_type+"\\n\","+var+");\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
766 |
# element_num_patte +=1 |
37 | 767 |
#fct +=" wxPostEvent(Program,wxEVT_PLCOUT);\n" |
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
768 |
# fct +="};\n\n" |
37 | 769 |
return fct |
770 |
||
771 |
def PlugGenerate_C(self, buildpath, locations, logger): |
|
772 |
current_location = self.GetCurrentLocation() |
|
773 |
self.BusNumber = "_".join(map(lambda x:str(x), current_location)) |
|
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
47
diff
changeset
|
774 |
progname = "SVGUI_" + self.BusNumber |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
775 |
self.GenerateProgram(buildpath, progname) |
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
776 |
Gen_C_file = os.path.join(buildpath, progname+".cpp" ) |
55
9c26e67c041a
Updated plugins PluGenerate_C to conform to plugger.py
etisserant
parents:
49
diff
changeset
|
777 |
return [(Gen_C_file,"")],"",True |
13
f1f0edbeb313
More precise design for plugins.... to be continued...
etisserant
parents:
12
diff
changeset
|
778 |
|
12 | 779 |
def BlockTypesFactory(self): |
73 | 780 |
def generate_svgui_block(generator, block, body, link, order=False): |
12 | 781 |
name = block.getInstanceName() |
42 | 782 |
block_id = self.GetElementIdFromName(name) |
12 | 783 |
if block_id == None: |
784 |
raise ValueError, "No corresponding block found" |
|
43 | 785 |
type = block.getTypeName() |
786 |
block_infos = self.GetBlockType(type) |
|
787 |
current_location = ".".join(map(str, self.GetCurrentLocation())) |
|
73 | 788 |
if not generator.ComputedBlocks.get(name, False) and not order: |
12 | 789 |
for num, variable in enumerate(block.inputVariables.getVariable()): |
790 |
connections = variable.connectionPointIn.getConnections() |
|
791 |
if connections and len(connections) == 1: |
|
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
792 |
parameter = "%sQ%s%s.%d.%d"%("%", TYPECONVERSION[block_infos["inputs"][num][1]], current_location, block_id, num+1) |
12 | 793 |
value = generator.ComputeFBDExpression(body, connections[0]) |
794 |
generator.Program += (" %s := %s;\n"%(parameter, generator.ExtractModifier(variable, value))) |
|
73 | 795 |
generator.ComputedBlocks[block] = True |
12 | 796 |
if link: |
797 |
connectionPoint = link.getPosition()[-1] |
|
798 |
for num, variable in enumerate(block.outputVariables.getVariable()): |
|
799 |
blockPointx, blockPointy = variable.connectionPointOut.getRelPosition() |
|
800 |
if block.getX() + blockPointx == connectionPoint.getX() and block.getY() + blockPointy == connectionPoint.getY(): |
|
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
801 |
return "%sI%s%s.%d.%d"%("%", TYPECONVERSION[block_infos["outputs"][num][1]], current_location, block_id, num+1) |
12 | 802 |
raise ValueError, "No output variable found" |
803 |
else: |
|
804 |
return None |
|
11 | 805 |
|
43 | 806 |
def initialise_block(type, name): |
807 |
block_id = self.GetElementIdFromName(name) |
|
808 |
if block_id == None: |
|
809 |
raise ValueError, "No corresponding block found" |
|
810 |
block_infos = self.GetBlockType(type) |
|
811 |
current_location = ".".join(map(str, self.GetCurrentLocation())) |
|
812 |
variables = [] |
|
813 |
for num, (input_name, input_type, input_modifier) in enumerate(block_infos["inputs"]): |
|
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
814 |
variables.append((input_type, None, "%sQ%s%s.%d.%d"%("%", TYPECONVERSION[input_type], current_location, block_id, num+1), None)) |
43 | 815 |
for num, (output_name, output_type, output_modifier) in enumerate(block_infos["outputs"]): |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
816 |
variables.append((output_type, None, "%sI%s%s.%d.%d"%("%", TYPECONVERSION[input_type], current_location, block_id, num+1), None)) |
43 | 817 |
return variables |
818 |
||
12 | 819 |
return [{"name" : "SVGUI function blocks", "list" : |
820 |
[{"name" : "Container", "type" : "functionBlock", "extensible" : False, |
|
37 | 821 |
"inputs" : [("Show","BOOL","none"),("Set State","BOOL","none")], |
822 |
"outputs" : [("Show","BOOL","none"),("State Changed","BOOL","none")], |
|
42 | 823 |
"comment" : "SVGUI Container", |
43 | 824 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 825 |
{"name" : "Button", "type" : "functionBlock", "extensible" : False, |
826 |
"inputs" : [("Show","BOOL","none"),("Toggle","BOOL","none")], |
|
827 |
"outputs" : [("Visible","BOOL","none"),("State","BOOL","none")], |
|
42 | 828 |
"comment" : "SVGUI Button", |
43 | 829 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 830 |
{"name" : "TextCtrl", "type" : "functionBlock", "extensible" : False, |
831 |
"inputs" : [("Text","STRING","none"),("Set Text","BOOL","none")], |
|
832 |
"outputs" : [("Text","STRING","none"),("Text Changed","BOOL","none")], |
|
42 | 833 |
"comment" : "SVGUI Text Control", |
43 | 834 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 835 |
{"name" : "ScrollBar", "type" : "functionBlock", "extensible" : False, |
836 |
"inputs" : [("Position","UINT","none"),("Set Position","BOOL","none")], |
|
837 |
"outputs" : [("Position","UINT","none"),("Position Changed","BOOL","none")], |
|
42 | 838 |
"comment" : "SVGUI ScrollBar", |
43 | 839 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 840 |
{"name" : "NoteBook", "type" : "functionBlock", "extensible" : False, |
841 |
"inputs" : [("Selected","UINT","none"),("Set Selected","BOOL","none")], |
|
842 |
"outputs" : [("Selected","UINT","none"),("Selected Changed","BOOL","none")], |
|
42 | 843 |
"comment" : "SVGUI Notebook", |
43 | 844 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 845 |
{"name" : "RotatingCtrl", "type" : "functionBlock", "extensible" : False, |
846 |
"inputs" : [("Angle","REAL","none"),("Set Angle","BOOL","none")], |
|
847 |
"outputs" : [("Angle","REAL","none"),("Angle changed","BOOL","none")], |
|
42 | 848 |
"comment" : "SVGUI Rotating Control", |
43 | 849 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 850 |
{"name" : "Transform", "type" : "functionBlock", "extensible" : False, |
851 |
"inputs" : [("X","REAL","none"),("Y","REAL","none"),("Scale X","REAL","none"),("Scale Y","REAL","none"),("Angle","REAL","none"),("Set","BOOL","none")], |
|
852 |
"outputs" : [("X","REAL","none"),("Y","REAL","none"),("Scale X","REAL","none"),("Scale Y","REAL","none"),("Angle","REAL","none"),("Changed","BOOL","none")], |
|
42 | 853 |
"comment" : "SVGUI Transform", |
43 | 854 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 855 |
]} |
856 |
] |
|
857 |
||
858 |
def GetBlockType(self,type): |
|
859 |
for category in self.BlockTypesFactory(): |
|
860 |
for blocktype in category["list"]: |
|
861 |
if blocktype["name"] == type: |
|
862 |
return blocktype |
|
863 |
return None |
|
864 |
||
865 |
#DEBUG |
|
866 |
if __name__ == '__main__': |
|
867 |
app = wxPySimpleApp() |
|
868 |
wxInitAllImageHandlers() |
|
869 |
||
870 |
# Install a exception handle for bug reports |
|
871 |
#wxAddExceptHook(os.getcwd(),__version__) |
|
872 |
||
873 |
cont = RootClass(sys.path[0]) |
|
874 |
frame = _EditorFramePlug(cont) |
|
875 |
||
876 |
frame.Show() |
|
877 |
app.MainLoop() |
|
878 |
#DEBUG |
|
879 |
||
880 |
||
881 |
||
882 |
||
883 |