9 from SVGUIControler import * |
9 from SVGUIControler import * |
10 from SVGUIEditor import * |
10 from SVGUIEditor import * |
11 from FBD_Objects import * |
11 from FBD_Objects import * |
12 |
12 |
13 from wxPopen import ProcessLogger |
13 from wxPopen import ProcessLogger |
|
14 from wx.wxsvg import SVGDocument |
14 |
15 |
15 [ID_SVGUIEDITORFBDPANEL, |
16 [ID_SVGUIEDITORFBDPANEL, |
16 ] = [wx.NewId() for _init_ctrls in range(1)] |
17 ] = [wx.NewId() for _init_ctrls in range(1)] |
17 |
18 |
18 SVGUIFB_Types = {ITEM_CONTAINER : "Container", |
19 SVGUIFB_Types = {ITEM_CONTAINER : "Container", |
178 return True |
179 return True |
179 |
180 |
180 def PlugGenerate_C(self, buildpath, locations, logger): |
181 def PlugGenerate_C(self, buildpath, locations, logger): |
181 progname = "SVGUI_%s"%"_".join(map(str, self.GetCurrentLocation())) |
182 progname = "SVGUI_%s"%"_".join(map(str, self.GetCurrentLocation())) |
182 |
183 |
|
184 doc = SVGDocument(self.GetSVGFilePath()) |
|
185 root_element = doc.GetRootElement() |
|
186 window_size = (int(root_element.GetAttribute("width")), |
|
187 int(root_element.GetAttribute("height"))) |
|
188 |
183 generator = _SVGUICGenerator(self.GetElementsByType(), self.GetSVGFilePath(), self.GetFilePath(), self.GetCurrentLocation()) |
189 generator = _SVGUICGenerator(self.GetElementsByType(), self.GetSVGFilePath(), self.GetFilePath(), self.GetCurrentLocation()) |
184 generator.GenerateProgram((0, 0), buildpath, progname) |
190 generator.GenerateProgram(window_size, buildpath, progname) |
185 Gen_C_file = os.path.join(buildpath, progname+".cpp" ) |
191 Gen_C_file = os.path.join(buildpath, progname+".cpp" ) |
186 |
192 |
187 if wx.Platform == '__WXMSW__': |
193 if wx.Platform == '__WXMSW__': |
188 cxx_flags = "-I..\\..\\wxPython-src-2.8.7.1\\bld\\lib\\wx\\include\\msw-unicode-release-2.8 -I..\\..\\wxPython-src-2.8.7.1\\include -I..\\..\\wxPython-src-2.8.7.1\\contrib\\include -I..\\..\\matiec\\lib -DWXUSINGDLL -D__WXMSW__ -mthreads" |
194 cxx_flags = "-I..\\..\\wxPython-src-2.8.7.1\\bld\\lib\\wx\\include\\msw-unicode-release-2.8 -I..\\..\\wxPython-src-2.8.7.1\\include -I..\\..\\wxPython-src-2.8.7.1\\contrib\\include -I..\\..\\matiec\\lib -DWXUSINGDLL -D__WXMSW__ -mthreads" |
189 libs = "\"..\\lib\\libwxsvg.a\" \"..\\lib\\libwxsvg_agg.a\" \"..\\lib\\libagg.a\" \"..\\lib\\libaggplatformwin32.a\" \"..\\lib\\libaggfontwin32tt.a\" -L..\\..\\wxPython-src-2.8.7.1\\bld\\lib -mno-cygwin -mwindows -mthreads -mno-cygwin -mwindows -Wl,--subsystem,windows -mwindows -lwx_mswu_richtext-2.8 -lwx_mswu_aui-2.8 -lwx_mswu_xrc-2.8 -lwx_mswu_qa-2.8 -lwx_mswu_html-2.8 -lwx_mswu_adv-2.8 -lwx_mswu_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8" |
195 libs = "\"..\\lib\\libwxsvg.a\" \"..\\lib\\libwxsvg_agg.a\" \"..\\lib\\libagg.a\" \"..\\lib\\libaggplatformwin32.a\" \"..\\lib\\libaggfontwin32tt.a\" -L..\\..\\wxPython-src-2.8.7.1\\bld\\lib -mno-cygwin -mwindows -mthreads -mno-cygwin -mwindows -Wl,--subsystem,windows -mwindows -lwx_mswu_richtext-2.8 -lwx_mswu_aui-2.8 -lwx_mswu_xrc-2.8 -lwx_mswu_qa-2.8 -lwx_mswu_html-2.8 -lwx_mswu_adv-2.8 -lwx_mswu_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8" |
383 wxEntry(myargc,myargv); |
388 wxEntry(myargc,myargv); |
384 return 0; |
389 return 0; |
385 } |
390 } |
386 |
391 |
387 """ |
392 """ |
388 # text += """void* SimulAutomate(void* args) |
393 |
389 #{ |
|
390 # while(1){ |
|
391 # myapp->frame->m_svgCtrl->IN_"+self.BusNumber+"(); |
|
392 # //printf(\"AUTOMATE\\n\"); |
|
393 # myapp->frame->m_svgCtrl->OUT_"+self.BusNumber+"(); |
|
394 # sleep(1); |
|
395 # } |
|
396 # return args; |
|
397 #} |
|
398 # |
|
399 #""" |
|
400 |
|
401 text += """bool SVGViewApp::OnInit() |
394 text += """bool SVGViewApp::OnInit() |
402 { |
395 { |
403 #ifndef __WXMSW__ |
396 #ifndef __WXMSW__ |
404 setlocale(LC_NUMERIC, "C"); |
397 setlocale(LC_NUMERIC, "C"); |
405 #endif |
398 #endif |
406 """ |
399 """ |
407 #text += " frame = new MainFrame(NULL, wxT(\"Program\"),wxDefaultPosition, wxSize(%d, %d));\n"%size |
400 |
408 text += """ frame = new MainFrame(NULL, wxT("Program"),wxDefaultPosition, wxDefaultSize); |
401 text += """ frame = new MainFrame(NULL, wxT("Program"),wxDefaultPosition, wxSize(%d, %d)); |
409 frame->Show(); |
402 frame->Show(); |
410 myapp = this; |
403 myapp = this; |
411 """ |
404 """%size |
412 # text += " pthread_create(&automate, NULL, SimulAutomate, NULL);\n" |
|
413 text += """ return true; |
405 text += """ return true; |
414 } |
406 } |
415 |
407 |
416 extern "C" { |
408 extern "C" { |
417 |
409 |