84 @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND |
84 @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND |
85 """ |
85 """ |
86 |
86 |
87 current_location = self.GetCurrentLocation() |
87 current_location = self.GetCurrentLocation() |
88 # define a unique name for the generated C file |
88 # define a unique name for the generated C file |
89 location_str = "_".join(map(lambda x:str(x), current_location)) |
89 location_str = "_".join(map(lambda x: str(x), current_location)) |
90 |
90 |
91 res = ([], "", False) |
91 res = ([], "", False) |
92 |
92 |
93 svgfile=self._getSVGpath() |
93 svgfile=self._getSVGpath() |
94 if os.path.exists(svgfile): |
94 if os.path.exists(svgfile): |
95 res += (("gui.svg", file(svgfile,"rb")),) |
95 res += (("gui.svg", file(svgfile, "rb")),) |
96 |
96 |
97 svguiserverfile = open(self._getSVGUIserverpath(), 'r') |
97 svguiserverfile = open(self._getSVGUIserverpath(), 'r') |
98 svguiservercode = svguiserverfile.read() |
98 svguiservercode = svguiserverfile.read() |
99 svguiserverfile.close() |
99 svguiserverfile.close() |
100 |
100 |
108 svguilibfile.write("pyjslib();\nsvguilib();\n") |
108 svguilibfile.write("pyjslib();\nsvguilib();\n") |
109 svguilibfile.write(open(os.path.join(fpath, "pyjs", "lib", "json.js"), 'r').read()) |
109 svguilibfile.write(open(os.path.join(fpath, "pyjs", "lib", "json.js"), 'r').read()) |
110 svguilibfile.write(open(os.path.join(fpath, "livesvg.js"), 'r').read()) |
110 svguilibfile.write(open(os.path.join(fpath, "livesvg.js"), 'r').read()) |
111 svguilibfile.close() |
111 svguilibfile.close() |
112 jsmodules = {"LiveSVGPage": "svguilib.js"} |
112 jsmodules = {"LiveSVGPage": "svguilib.js"} |
113 res += (("svguilib.js", file(svguilibpath,"rb")),) |
113 res += (("svguilib.js", file(svguilibpath, "rb")),) |
114 |
114 |
115 runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str) |
115 runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str) |
116 runtimefile = open(runtimefile_path, 'w') |
116 runtimefile = open(runtimefile_path, 'w') |
117 runtimefile.write(svguiservercode % {"svgfile": "gui.svg"}) |
117 runtimefile.write(svguiservercode % {"svgfile": "gui.svg"}) |
118 runtimefile.write(""" |
118 runtimefile.write(""" |
126 "svgui_class": "SVGUI_HMI", |
126 "svgui_class": "SVGUI_HMI", |
127 "jsmodules": str(jsmodules), |
127 "jsmodules": str(jsmodules), |
128 }) |
128 }) |
129 runtimefile.close() |
129 runtimefile.close() |
130 |
130 |
131 res += (("runtime_%s.py" % location_str, file(runtimefile_path,"rb")),) |
131 res += (("runtime_%s.py" % location_str, file(runtimefile_path, "rb")),) |
132 |
132 |
133 return res |
133 return res |
134 |
134 |
135 def _ImportSVG(self): |
135 def _ImportSVG(self): |
136 dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "", _("SVG files (*.svg)|*.svg|All files|*.*"), wx.OPEN) |
136 dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "", _("SVG files (*.svg)|*.svg|All files|*.*"), wx.OPEN) |