svgui/svgui.py
changeset 1739 ec153828ded2
parent 1737 a39c2918c015
child 1740 b789b695b5c6
equal deleted inserted replaced
1738:d2e979738700 1739:ec153828ded2
    42 
    42 
    43 
    43 
    44 class SVGUI(PythonFileCTNMixin):
    44 class SVGUI(PythonFileCTNMixin):
    45 
    45 
    46     ConfNodeMethods = [
    46     ConfNodeMethods = [
    47         {"bitmap" : "ImportSVG",
    47         {
    48          "name" : _("Import SVG"),
    48             "bitmap":    "ImportSVG",
    49          "tooltip" : _("Import SVG"),
    49             "name":    _("Import SVG"),
    50          "method" : "_ImportSVG"},
    50             "tooltip": _("Import SVG"),
    51         {"bitmap" : "ImportSVG",  # should be something different
    51             "method":   "_ImportSVG"
    52          "name" : _("Inkscape"),
    52         },
    53          "tooltip" : _("Create HMI"),
    53         {
    54          "method" : "_StartInkscape"},
    54             "bitmap":    "ImportSVG",  # should be something different
       
    55             "name":    _("Inkscape"),
       
    56             "tooltip": _("Create HMI"),
       
    57             "method":   "_StartInkscape"
       
    58         },
    55     ]
    59     ]
    56 
    60 
    57     def ConfNodePath(self):
    61     def ConfNodePath(self):
    58         return paths.AbsDir(__file__)
    62         return paths.AbsDir(__file__)
    59 
    63 
   108         jsmodules = {"LiveSVGPage": "svguilib.js"}
   112         jsmodules = {"LiveSVGPage": "svguilib.js"}
   109         res += (("svguilib.js", file(svguilibpath,"rb")),)
   113         res += (("svguilib.js", file(svguilibpath,"rb")),)
   110 
   114 
   111         runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str)
   115         runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str)
   112         runtimefile = open(runtimefile_path, 'w')
   116         runtimefile = open(runtimefile_path, 'w')
   113         runtimefile.write(svguiservercode % {"svgfile" : "gui.svg"})
   117         runtimefile.write(svguiservercode % {"svgfile": "gui.svg"})
   114         runtimefile.write("""
   118         runtimefile.write("""
   115 def _runtime_%(location)s_start():
   119 def _runtime_%(location)s_start():
   116     website.LoadHMI(%(svgui_class)s, %(jsmodules)s)
   120     website.LoadHMI(%(svgui_class)s, %(jsmodules)s)
   117 
   121 
   118 def _runtime_%(location)s_stop():
   122 def _runtime_%(location)s_stop():
   119     website.UnLoadHMI()
   123     website.UnLoadHMI()
   120 
   124 
   121 """ % {"location": location_str,
   125 """ % {"location": location_str,
   122        "svgui_class": "SVGUI_HMI",
   126        "svgui_class": "SVGUI_HMI",
   123        "jsmodules" : str(jsmodules),
   127        "jsmodules": str(jsmodules),
   124       })
   128       })
   125         runtimefile.close()
   129         runtimefile.close()
   126 
   130 
   127         res += (("runtime_%s.py" % location_str, file(runtimefile_path,"rb")),)
   131         res += (("runtime_%s.py" % location_str, file(runtimefile_path,"rb")),)
   128 
   132