14 ] |
14 ] |
15 |
15 |
16 def ConfNodePath(self): |
16 def ConfNodePath(self): |
17 return os.path.join(os.path.dirname(__file__)) |
17 return os.path.join(os.path.dirname(__file__)) |
18 |
18 |
19 def _getWXGLADEpath(self): |
19 def _getWXGLADEpath(self, project_path=None): |
20 # define name for IEC raw code file |
20 if project_path is None: |
21 return os.path.join(self.CTNPath(), "hmi.wxg") |
21 project_path = self.CTNPath() |
|
22 # define name for wxGlade gui file |
|
23 return os.path.join(project_path, "hmi.wxg") |
22 |
24 |
23 def launch_wxglade(self, options, wait=False): |
25 def launch_wxglade(self, options, wait=False): |
24 from wxglade import __file__ as fileName |
26 from wxglade import __file__ as fileName |
25 path = os.path.dirname(fileName) |
27 path = os.path.dirname(fileName) |
26 glade = os.path.join(path, 'wxglade.py') |
28 glade = os.path.join(path, 'wxglade.py') |
27 if wx.Platform == '__WXMSW__': |
29 if wx.Platform == '__WXMSW__': |
28 glade = "\"%s\""%glade |
30 glade = "\"%s\""%glade |
29 mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait] |
31 mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait] |
30 os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options) |
32 os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options) |
31 |
33 |
|
34 def OnCTNSave(self, from_project_path=None): |
|
35 if from_project_path is not None: |
|
36 shutil.copyfile(self._getWXGLADEpath(from_project_path), |
|
37 self._getWXGLADEpath()) |
|
38 return PythonFileCTNMixin.OnCTNSave(self, from_project_path) |
32 |
39 |
33 def CTNGenerate_C(self, buildpath, locations): |
40 def CTNGenerate_C(self, buildpath, locations): |
34 """ |
41 """ |
35 Return C code generated by iec2c compiler |
42 Return C code generated by iec2c compiler |
36 when _generate_softPLC have been called |
43 when _generate_softPLC have been called |