plugins/python/modules/wxglade_hmi/wxglade_hmi.py
changeset 427 7ac746c07ff2
parent 384 50f2069a06b3
equal deleted inserted replaced
426:3f285782ac9b 427:7ac746c07ff2
    98         
    98         
    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         if not os.path.exists(wxg_filename):
   103         open_wxglade = True
   104             hmi_name = self.BaseParams.getName()
   104         if not self.GetPlugRoot().CheckProjectPathPerm():
   105             open(wxg_filename,"w").write("""<?xml version="1.0"?>
   105             dialog = wx.MessageDialog(self.GetPlugRoot().AppFrame,
   106 <application path="" name="" class="" option="0" language="python" top_window="%(name)s" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
   106                                       _("You don't have write permissions.\nOpen wxGlade anyway ?"),
   107     <object class="%(class)s" name="%(name)s" base="EditFrame">
   107                                       _("Open wxGlade"),
   108         <style>wxDEFAULT_FRAME_STYLE</style>
   108                                       wx.YES_NO|wx.ICON_QUESTION)
   109         <title>frame_1</title>
   109             open_wxglade = dialog.ShowModal() == wx.ID_YES
   110     </object>
   110             dialog.Destroy()
   111 </application>
   111         if open_wxglade:
   112 """ % {"name": hmi_name, "class": "Class_%s" % hmi_name})
   112             if not os.path.exists(wxg_filename):
   113         if wx.Platform == '__WXMSW__':
   113                 hmi_name = self.BaseParams.getName()
   114             wxg_filename = "\"%s\""%wxg_filename
   114                 open(wxg_filename,"w").write("""<?xml version="1.0"?>
   115         self.launch_wxglade([wxg_filename])
   115     <application path="" name="" class="" option="0" language="python" top_window="%(name)s" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
       
   116         <object class="%(class)s" name="%(name)s" base="EditFrame">
       
   117             <style>wxDEFAULT_FRAME_STYLE</style>
       
   118             <title>frame_1</title>
       
   119         </object>
       
   120     </application>
       
   121     """ % {"name": hmi_name, "class": "Class_%s" % hmi_name})
       
   122             if wx.Platform == '__WXMSW__':
       
   123                 wxg_filename = "\"%s\""%wxg_filename
       
   124             self.launch_wxglade([wxg_filename])