equal
deleted
inserted
replaced
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" |
158 "xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance", |
172 "xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance", |
159 "xsi:schemaLocation" : "python_xsd.xsd"} |
173 "xsi:schemaLocation" : "python_xsd.xsd"} |
160 text += self.PythonCode.generateXMLText("Python", 0, extras) |
174 text += self.PythonCode.generateXMLText("Python", 0, extras) |
161 |
175 |
162 xmlfile = open(filepath,"w") |
176 xmlfile = open(filepath,"w") |
163 xmlfile.write(text) |
177 xmlfile.write(text.encode("utf-8")) |
164 xmlfile.close() |
178 xmlfile.close() |
165 |
179 |
166 self.PythonBuffer.CurrentSaved() |
180 self.PythonBuffer.CurrentSaved() |
167 return True |
181 return True |
168 |
182 |