4415 else: |
4415 else: |
4416 return True |
4416 return True |
4417 |
4417 |
4418 res = self.checkDirty(editor) |
4418 res = self.checkDirty(editor) |
4419 return res |
4419 return res |
4420 |
4420 |
|
4421 def hasDirtyEditor(self): |
|
4422 """ |
|
4423 Public method to ask, if any of the open editors contains unsaved |
|
4424 changes. |
|
4425 |
|
4426 @return flag indicating at least one editor has unsaved changes |
|
4427 @rtype bool |
|
4428 """ |
|
4429 return any(editor.isModified() for editor in self.editors) |
|
4430 |
4421 def closeEditor(self, editor, ignoreDirty=False): |
4431 def closeEditor(self, editor, ignoreDirty=False): |
4422 """ |
4432 """ |
4423 Public method to close an editor window. |
4433 Public method to close an editor window. |
4424 |
4434 |
4425 @param editor editor window to be closed |
4435 @param editor editor window to be closed |
4469 if res and aw == self.currentEditor: |
4479 if res and aw == self.currentEditor: |
4470 self.currentEditor = None |
4480 self.currentEditor = None |
4471 |
4481 |
4472 return res |
4482 return res |
4473 |
4483 |
4474 def closeAllWindows(self): |
4484 def closeAllWindows(self, ignoreDirty=False): |
4475 """ |
4485 """ |
4476 Public method to close all editor windows via file menu. |
4486 Public method to close all editor windows. |
|
4487 |
|
4488 @param ignoreDirty flag indicating to ignore the 'dirty' status |
|
4489 @type bool |
4477 """ |
4490 """ |
4478 savedEditors = self.editors[:] |
4491 savedEditors = self.editors[:] |
4479 for editor in savedEditors: |
4492 for editor in savedEditors: |
4480 self.closeEditor(editor) |
4493 self.closeEditor(editor, ignoreDirty=ignoreDirty) |
4481 |
4494 |
4482 def closeWindow(self, fn, ignoreDirty=False): |
4495 def closeWindow(self, fn, ignoreDirty=False): |
4483 """ |
4496 """ |
4484 Public method to close an arbitrary source editor. |
4497 Public method to close an arbitrary source editor. |
4485 |
4498 |