confnodes/python/modules/wxglade_hmi/wxglade_hmi.py
changeset 718 5d4dc150b956
parent 717 1c23952dbde1
equal deleted inserted replaced
717:1c23952dbde1 718:5d4dc150b956
    14          "method" : "_editWXGLADE"},
    14          "method" : "_editWXGLADE"},
    15     ]
    15     ]
    16 
    16 
    17     def _getWXGLADEpath(self):
    17     def _getWXGLADEpath(self):
    18         # define name for IEC raw code file
    18         # define name for IEC raw code file
    19         return os.path.join(self.PlugPath(), "hmi.wxg")
    19         return os.path.join(self.CTNPath(), "hmi.wxg")
    20 
    20 
    21     def launch_wxglade(self, options, wait=False):
    21     def launch_wxglade(self, options, wait=False):
    22         from wxglade import __file__ as fileName
    22         from wxglade import __file__ as fileName
    23         path = os.path.dirname(fileName)
    23         path = os.path.dirname(fileName)
    24         glade = os.path.join(path, 'wxglade.py')
    24         glade = os.path.join(path, 'wxglade.py')
    26             glade = "\"%s\""%glade
    26             glade = "\"%s\""%glade
    27         mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
    27         mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
    28         os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options)
    28         os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options)
    29 
    29 
    30 
    30 
    31     def PlugGenerate_C(self, buildpath, locations):
    31     def CTNGenerate_C(self, buildpath, locations):
    32         """
    32         """
    33         Return C code generated by iec2c compiler 
    33         Return C code generated by iec2c compiler 
    34         when _generate_softPLC have been called
    34         when _generate_softPLC have been called
    35         @param locations: ignored
    35         @param locations: ignored
    36         @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND
    36         @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND
    99         return [], "", False, ("runtime_%s.py"%location_str, file(runtimefile_path,"rb"))
    99         return [], "", False, ("runtime_%s.py"%location_str, file(runtimefile_path,"rb"))
   100 
   100 
   101     def _editWXGLADE(self):
   101     def _editWXGLADE(self):
   102         wxg_filename = self._getWXGLADEpath()
   102         wxg_filename = self._getWXGLADEpath()
   103         open_wxglade = True
   103         open_wxglade = True
   104         if not self.GetPlugRoot().CheckProjectPathPerm():
   104         if not self.GetCTRoot().CheckProjectPathPerm():
   105             dialog = wx.MessageDialog(self.GetPlugRoot().AppFrame,
   105             dialog = wx.MessageDialog(self.GetCTRoot().AppFrame,
   106                                       _("You don't have write permissions.\nOpen wxGlade anyway ?"),
   106                                       _("You don't have write permissions.\nOpen wxGlade anyway ?"),
   107                                       _("Open wxGlade"),
   107                                       _("Open wxGlade"),
   108                                       wx.YES_NO|wx.ICON_QUESTION)
   108                                       wx.YES_NO|wx.ICON_QUESTION)
   109             open_wxglade = dialog.ShowModal() == wx.ID_YES
   109             open_wxglade = dialog.ShowModal() == wx.ID_YES
   110             dialog.Destroy()
   110             dialog.Destroy()