104 svguilibfile.write(open(os.path.join(fpath, "livesvg.js"), 'r').read()) |
104 svguilibfile.write(open(os.path.join(fpath, "livesvg.js"), 'r').read()) |
105 svguilibfile.close() |
105 svguilibfile.close() |
106 jsmodules = {"LiveSVGPage": "svguilib.js"} |
106 jsmodules = {"LiveSVGPage": "svguilib.js"} |
107 res += (("svguilib.js", file(svguilibpath,"rb")),) |
107 res += (("svguilib.js", file(svguilibpath,"rb")),) |
108 |
108 |
109 runtimefile_path = os.path.join(buildpath, "runtime_%s.py"%location_str) |
109 runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str) |
110 runtimefile = open(runtimefile_path, 'w') |
110 runtimefile = open(runtimefile_path, 'w') |
111 runtimefile.write(svguiservercode % {"svgfile" : "gui.svg"}) |
111 runtimefile.write(svguiservercode % {"svgfile" : "gui.svg"}) |
112 runtimefile.write(""" |
112 runtimefile.write(""" |
113 def _runtime_%(location)s_start(): |
113 def _runtime_%(location)s_start(): |
114 website.LoadHMI(%(svgui_class)s, %(jsmodules)s) |
114 website.LoadHMI(%(svgui_class)s, %(jsmodules)s) |
120 "svgui_class": "SVGUI_HMI", |
120 "svgui_class": "SVGUI_HMI", |
121 "jsmodules" : str(jsmodules), |
121 "jsmodules" : str(jsmodules), |
122 }) |
122 }) |
123 runtimefile.close() |
123 runtimefile.close() |
124 |
124 |
125 res += (("runtime_%s.py"%location_str, file(runtimefile_path,"rb")),) |
125 res += (("runtime_%s.py" % location_str, file(runtimefile_path,"rb")),) |
126 |
126 |
127 return res |
127 return res |
128 |
128 |
129 def _ImportSVG(self): |
129 def _ImportSVG(self): |
130 dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "", _("SVG files (*.svg)|*.svg|All files|*.*"), wx.OPEN) |
130 dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "", _("SVG files (*.svg)|*.svg|All files|*.*"), wx.OPEN) |
131 if dialog.ShowModal() == wx.ID_OK: |
131 if dialog.ShowModal() == wx.ID_OK: |
132 svgpath = dialog.GetPath() |
132 svgpath = dialog.GetPath() |
133 if os.path.isfile(svgpath): |
133 if os.path.isfile(svgpath): |
134 shutil.copy(svgpath, self._getSVGpath()) |
134 shutil.copy(svgpath, self._getSVGpath()) |
135 else: |
135 else: |
136 self.GetCTRoot().logger.write_error(_("No such SVG file: %s\n")%svgpath) |
136 self.GetCTRoot().logger.write_error(_("No such SVG file: %s\n") % svgpath) |
137 dialog.Destroy() |
137 dialog.Destroy() |
138 |
138 |
139 def _StartInkscape(self): |
139 def _StartInkscape(self): |
140 svgfile = self._getSVGpath() |
140 svgfile = self._getSVGpath() |
141 open_inkscape = True |
141 open_inkscape = True |