plugins/python/python.py
changeset 427 7ac746c07ff2
parent 418 01f6bfc01251
child 430 5981ad8547f5
--- a/plugins/python/python.py	Thu Oct 22 17:20:24 2009 +0200
+++ b/plugins/python/python.py	Fri Oct 23 15:41:48 2009 +0200
@@ -141,14 +141,28 @@
     _View = None
     def _OpenView(self):
         if not self._View:
-            def _onclose():
-                self._View = None
-            def _onsave():
-                self.GetPlugRoot().SaveProject()
-            self._View = PythonEditorFrame(self.GetPlugRoot().AppFrame, self)
-            self._View._onclose = _onclose
-            self._View._onsave = _onsave
-            self._View.Show()
+            open_pyeditor = True
+            has_permissions = self.GetPlugRoot().CheckProjectPathPerm()
+            if not has_permissions:
+                dialog = wx.MessageDialog(self.GetPlugRoot().AppFrame,
+                                          _("You don't have write permissions.\nOpen PythonEditor anyway ?"),
+                                          _("Open PythonEditor"),
+                                          wx.YES_NO|wx.ICON_QUESTION)
+                open_pyeditor = dialog.ShowModal() == wx.ID_YES
+                dialog.Destroy()
+            if open_pyeditor:
+                def _onclose():
+                    self._View = None
+                if has_permissions:
+                    def _onsave():
+                        self.GetPlugRoot().SaveProject()
+                else:
+                    def _onsave():
+                        pass
+                self._View = PythonEditorFrame(self.GetPlugRoot().AppFrame, self)
+                self._View._onclose = _onclose
+                self._View._onsave = _onsave
+                self._View.Show()
     
     def OnPlugSave(self):
         filepath = self.PythonFileName()