plugins/python/python.py
changeset 427 7ac746c07ff2
parent 418 01f6bfc01251
child 430 5981ad8547f5
equal deleted inserted replaced
426:3f285782ac9b 427:7ac746c07ff2
   139         return self.PythonCode.gettext()
   139         return self.PythonCode.gettext()
   140     
   140     
   141     _View = None
   141     _View = None
   142     def _OpenView(self):
   142     def _OpenView(self):
   143         if not self._View:
   143         if not self._View:
   144             def _onclose():
   144             open_pyeditor = True
   145                 self._View = None
   145             has_permissions = self.GetPlugRoot().CheckProjectPathPerm()
   146             def _onsave():
   146             if not has_permissions:
   147                 self.GetPlugRoot().SaveProject()
   147                 dialog = wx.MessageDialog(self.GetPlugRoot().AppFrame,
   148             self._View = PythonEditorFrame(self.GetPlugRoot().AppFrame, self)
   148                                           _("You don't have write permissions.\nOpen PythonEditor anyway ?"),
   149             self._View._onclose = _onclose
   149                                           _("Open PythonEditor"),
   150             self._View._onsave = _onsave
   150                                           wx.YES_NO|wx.ICON_QUESTION)
   151             self._View.Show()
   151                 open_pyeditor = dialog.ShowModal() == wx.ID_YES
       
   152                 dialog.Destroy()
       
   153             if open_pyeditor:
       
   154                 def _onclose():
       
   155                     self._View = None
       
   156                 if has_permissions:
       
   157                     def _onsave():
       
   158                         self.GetPlugRoot().SaveProject()
       
   159                 else:
       
   160                     def _onsave():
       
   161                         pass
       
   162                 self._View = PythonEditorFrame(self.GetPlugRoot().AppFrame, self)
       
   163                 self._View._onclose = _onclose
       
   164                 self._View._onsave = _onsave
       
   165                 self._View.Show()
   152     
   166     
   153     def OnPlugSave(self):
   167     def OnPlugSave(self):
   154         filepath = self.PythonFileName()
   168         filepath = self.PythonFileName()
   155         
   169         
   156         text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
   170         text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"