5371 """ |
5371 """ |
5372 prog = os.path.abspath(prog) |
5372 prog = os.path.abspath(prog) |
5373 # Open up the new files. |
5373 # Open up the new files. |
5374 self.openSourceFile(prog) |
5374 self.openSourceFile(prog) |
5375 |
5375 |
5376 def checkDirty(self, editor, autosave=False): |
5376 def checkDirty(self, editor, autosave=False, closeIt=False): |
5377 """ |
5377 """ |
5378 Public method to check the dirty status and open a message window. |
5378 Public method to check the dirty status and open a message window. |
5379 |
5379 |
5380 @param editor editor window to check |
5380 @param editor editor window to check |
5381 @type Editor |
5381 @type Editor |
5382 @param autosave flag indicating that the file should be saved |
5382 @param autosave flag indicating that the file should be saved |
5383 automatically |
5383 automatically (defaults to False) |
5384 @type bool |
5384 @type bool (optional) |
|
5385 @param closeIt flag indicating a check in order to close the editor |
|
5386 (defaults to False) |
|
5387 @type bool (optional) |
5385 @return flag indicating successful reset of the dirty flag |
5388 @return flag indicating successful reset of the dirty flag |
5386 @rtype bool |
5389 @rtype bool |
5387 """ |
5390 """ |
5388 if editor.isModified(): |
5391 if editor.isModified(): |
5389 fn = editor.getFileName() |
5392 fn = editor.getFileName() |
5390 # ignore the dirty status, if there is more than one open editor |
5393 # ignore the dirty status, if there is more than one open editor |
5391 # for the same file |
5394 # for the same file (only for closing) |
5392 if fn and self.getOpenEditorCount(fn) > 1 and not autosave: |
5395 if fn and self.getOpenEditorCount(fn) > 1 and closeIt: |
5393 return True |
5396 return True |
5394 |
5397 |
5395 if fn is None: |
5398 if fn is None: |
5396 fn = editor.getNoName() |
5399 fn = editor.getNoName() |
5397 autosave = False |
5400 autosave = False |
5461 @type bool |
5464 @type bool |
5462 @return flag indicating success |
5465 @return flag indicating success |
5463 @rtype bool |
5466 @rtype bool |
5464 """ |
5467 """ |
5465 # save file if necessary |
5468 # save file if necessary |
5466 if not ignoreDirty and not self.checkDirty(editor): |
5469 if not ignoreDirty and not self.checkDirty(editor, closeIt=True): |
5467 return False |
5470 return False |
5468 |
5471 |
5469 # get the filename of the editor for later use |
5472 # get the filename of the editor for later use |
5470 fn = editor.getFileName() |
5473 fn = editor.getFileName() |
5471 |
5474 |
5730 self.editors.append(editor) |
5733 self.editors.append(editor) |
5731 self.__connectEditor(editor) |
5734 self.__connectEditor(editor) |
5732 self.__editorOpened() |
5735 self.__editorOpened() |
5733 self.editorOpened.emit(fn) |
5736 self.editorOpened.emit(fn) |
5734 self.editorOpenedEd.emit(editor) |
5737 self.editorOpenedEd.emit(editor) |
|
5738 |
|
5739 if caller.isModified(): |
|
5740 editor.setModified(True) |
5735 |
5741 |
5736 return editor, assembly |
5742 return editor, assembly |
5737 |
5743 |
5738 def addToRecentList(self, fn): |
5744 def addToRecentList(self, fn): |
5739 """ |
5745 """ |