278 self.isResourcesFile = False |
278 self.isResourcesFile = False |
279 if editor is None: |
279 if editor is None: |
280 if self.fileName is not None: |
280 if self.fileName is not None: |
281 if (QFileInfo(self.fileName).size() // 1024) > \ |
281 if (QFileInfo(self.fileName).size() // 1024) > \ |
282 Preferences.getEditor("WarnFilesize"): |
282 Preferences.getEditor("WarnFilesize"): |
283 res = E5MessageBox.warning(self, |
283 res = E5MessageBox.yesNo(self, |
284 self.trUtf8("Open File"), |
284 self.trUtf8("Open File"), |
285 self.trUtf8("""<p>The size of the file <b>{0}</b>""" |
285 self.trUtf8("""<p>The size of the file <b>{0}</b>""" |
286 """ is <b>{1} KB</b>.""" |
286 """ is <b>{1} KB</b>.""" |
287 """ Do you really want to load it?</p>""")\ |
287 """ Do you really want to load it?</p>""")\ |
288 .format(self.fileName, |
288 .format(self.fileName, |
289 QFileInfo(self.fileName).size() // 1024), |
289 QFileInfo(self.fileName).size() // 1024), |
290 QMessageBox.StandardButtons(\ |
290 type_ = E5MessageBox.Warning) |
291 QMessageBox.No | \ |
291 if not res: |
292 QMessageBox.Yes), |
|
293 QMessageBox.No) |
|
294 if res == QMessageBox.No or res == QMessageBox.Cancel: |
|
295 raise IOError() |
292 raise IOError() |
296 self.readFile(self.fileName, True) |
293 self.readFile(self.fileName, True) |
297 bindName = self.__bindName(self.text(0)) |
294 bindName = self.__bindName(self.text(0)) |
298 self.__bindLexer(bindName) |
295 self.__bindLexer(bindName) |
299 self.__bindCompleter(bindName) |
296 self.__bindCompleter(bindName) |
4673 def macroRecordingStart(self): |
4670 def macroRecordingStart(self): |
4674 """ |
4671 """ |
4675 Public method to start macro recording. |
4672 Public method to start macro recording. |
4676 """ |
4673 """ |
4677 if self.recording: |
4674 if self.recording: |
4678 res = E5MessageBox.warning(self, |
4675 res = E5MessageBox.yesNo(self, |
4679 self.trUtf8("Start Macro Recording"), |
4676 self.trUtf8("Start Macro Recording"), |
4680 self.trUtf8("Macro recording is already active. Start new?"), |
4677 self.trUtf8("Macro recording is already active. Start new?"), |
4681 QMessageBox.StandardButtons(\ |
4678 type_ = E5MessageBox.Warning, |
4682 QMessageBox.No | \ |
4679 yesDefault = True) |
4683 QMessageBox.Yes), |
4680 if res: |
4684 QMessageBox.Yes) |
|
4685 if res == QMessageBox.Yes: |
|
4686 self.macroRecordingStop() |
4681 self.macroRecordingStop() |
4687 else: |
4682 else: |
4688 return |
4683 return |
4689 else: |
4684 else: |
4690 self.recording = True |
4685 self.recording = True |
4816 else: |
4811 else: |
4817 self.inReopenPrompt = True |
4812 self.inReopenPrompt = True |
4818 msg = self.trUtf8(\ |
4813 msg = self.trUtf8(\ |
4819 """<p>The file <b>{0}</b> has been changed while it was opened in""" |
4814 """<p>The file <b>{0}</b> has been changed while it was opened in""" |
4820 """ eric5. Reread it?</p>""").format(self.fileName) |
4815 """ eric5. Reread it?</p>""").format(self.fileName) |
4821 default = QMessageBox.Yes |
4816 yesDefault = True |
4822 if self.isModified(): |
4817 if self.isModified(): |
4823 msg += self.trUtf8(\ |
4818 msg += self.trUtf8(\ |
4824 """<br><b>Warning:</b> You will loose""" |
4819 """<br><b>Warning:</b> You will loose""" |
4825 """ your changes upon reopening it.""") |
4820 """ your changes upon reopening it.""") |
4826 default = QMessageBox.No |
4821 yesDefault = False |
4827 res = E5MessageBox.warning(self, |
4822 res = E5MessageBox.yesNo(self, |
4828 self.trUtf8("File changed"), msg, |
4823 self.trUtf8("File changed"), msg, |
4829 QMessageBox.StandardButtons(\ |
4824 type_ = E5MessageBox.Warning, |
4830 QMessageBox.Yes | \ |
4825 yesDefault = yesDefault) |
4831 QMessageBox.No), |
4826 if res: |
4832 default) |
|
4833 if res == QMessageBox.Yes: |
|
4834 self.refresh() |
4827 self.refresh() |
4835 else: |
4828 else: |
4836 # do not prompt for this change again... |
4829 # do not prompt for this change again... |
4837 self.lastModified = QFileInfo(self.fileName).lastModified() |
4830 self.lastModified = QFileInfo(self.fileName).lastModified() |
4838 self.inReopenPrompt = False |
4831 self.inReopenPrompt = False |
5171 if not self.checkDirty(): |
5164 if not self.checkDirty(): |
5172 return |
5165 return |
5173 |
5166 |
5174 package = os.path.isdir(self.fileName) and self.fileName \ |
5167 package = os.path.isdir(self.fileName) and self.fileName \ |
5175 or os.path.dirname(self.fileName) |
5168 or os.path.dirname(self.fileName) |
5176 res = E5MessageBox.question(self, |
5169 res = E5MessageBox.yesNo(self, |
5177 self.trUtf8("Package Diagram"), |
5170 self.trUtf8("Package Diagram"), |
5178 self.trUtf8("""Include class attributes?"""), |
5171 self.trUtf8("""Include class attributes?"""), |
5179 QMessageBox.StandardButtons(\ |
5172 yesDefault = True) |
5180 QMessageBox.No | \ |
5173 self.packageDiagram = PackageDiagram(package, self, noAttrs = not res) |
5181 QMessageBox.Yes), |
|
5182 QMessageBox.Yes) |
|
5183 self.packageDiagram = PackageDiagram(package, self, |
|
5184 noAttrs = (res == QMessageBox.No)) |
|
5185 self.packageDiagram.show() |
5174 self.packageDiagram.show() |
5186 |
5175 |
5187 def __showImportsDiagram(self): |
5176 def __showImportsDiagram(self): |
5188 """ |
5177 """ |
5189 Private method to handle the Imports Diagram context menu action. |
5178 Private method to handle the Imports Diagram context menu action. |
5192 if not self.checkDirty(): |
5181 if not self.checkDirty(): |
5193 return |
5182 return |
5194 |
5183 |
5195 package = os.path.isdir(self.fileName) and self.fileName \ |
5184 package = os.path.isdir(self.fileName) and self.fileName \ |
5196 or os.path.dirname(self.fileName) |
5185 or os.path.dirname(self.fileName) |
5197 res = E5MessageBox.question(self, |
5186 res = E5MessageBox.yesNo(self, |
5198 self.trUtf8("Imports Diagram"), |
5187 self.trUtf8("Imports Diagram"), |
5199 self.trUtf8("""Include imports from external modules?"""), |
5188 self.trUtf8("""Include imports from external modules?""")) |
5200 QMessageBox.StandardButtons(\ |
|
5201 QMessageBox.No | \ |
|
5202 QMessageBox.Yes), |
|
5203 QMessageBox.No) |
|
5204 self.importsDiagram = ImportsDiagram(package, self, |
5189 self.importsDiagram = ImportsDiagram(package, self, |
5205 showExternalImports = (res == QMessageBox.Yes)) |
5190 showExternalImports = res) |
5206 self.importsDiagram.show() |
5191 self.importsDiagram.show() |
5207 |
5192 |
5208 def __showApplicationDiagram(self): |
5193 def __showApplicationDiagram(self): |
5209 """ |
5194 """ |
5210 Private method to handle the Imports Diagram context menu action. |
5195 Private method to handle the Imports Diagram context menu action. |
5211 """ |
5196 """ |
5212 from Graphics.ApplicationDiagram import ApplicationDiagram |
5197 from Graphics.ApplicationDiagram import ApplicationDiagram |
5213 res = E5MessageBox.question(self, |
5198 res = E5MessageBox.yesNo(self, |
5214 self.trUtf8("Application Diagram"), |
5199 self.trUtf8("Application Diagram"), |
5215 self.trUtf8("""Include module names?"""), |
5200 self.trUtf8("""Include module names?"""), |
5216 QMessageBox.StandardButtons(\ |
5201 yesDefault = True) |
5217 QMessageBox.No | \ |
|
5218 QMessageBox.Yes), |
|
5219 QMessageBox.Yes) |
|
5220 self.applicationDiagram = ApplicationDiagram(self.project, |
5202 self.applicationDiagram = ApplicationDiagram(self.project, |
5221 self, noModules = (res == QMessageBox.No)) |
5203 self, noModules = not res) |
5222 self.applicationDiagram.show() |
5204 self.applicationDiagram.show() |
5223 |
5205 |
5224 ####################################################################### |
5206 ####################################################################### |
5225 ## Typing aids related methods below |
5207 ## Typing aids related methods below |
5226 ####################################################################### |
5208 ####################################################################### |