eric6/ViewManager/ViewManager.py

branch
maintenance
changeset 8400
b3eefd7e58d1
parent 8273
698ae46f40a4
parent 8379
ef170cde761b
equal deleted inserted replaced
8274:197414ba11cc 8400:b3eefd7e58d1
1446 ## Below follow the actions for QScintilla standard commands. 1446 ## Below follow the actions for QScintilla standard commands.
1447 #################################################################### 1447 ####################################################################
1448 1448
1449 self.esm = QSignalMapper(self) 1449 self.esm = QSignalMapper(self)
1450 try: 1450 try:
1451 self.alignMapper.mappedInt.connect(self.__editorCommand) 1451 self.esm.mappedInt.connect(self.__editorCommand)
1452 except AttributeError: 1452 except AttributeError:
1453 # pre Qt 5.15 1453 # pre Qt 5.15
1454 self.esm.mapped[int].connect(self.__editorCommand) 1454 self.esm.mapped[int].connect(self.__editorCommand)
1455 1455
1456 self.editorActGrp = createActionGroup(self.editActGrp) 1456 self.editorActGrp = createActionGroup(self.editActGrp)
4418 else: 4418 else:
4419 return True 4419 return True
4420 4420
4421 res = self.checkDirty(editor) 4421 res = self.checkDirty(editor)
4422 return res 4422 return res
4423 4423
4424 def hasDirtyEditor(self):
4425 """
4426 Public method to ask, if any of the open editors contains unsaved
4427 changes.
4428
4429 @return flag indicating at least one editor has unsaved changes
4430 @rtype bool
4431 """
4432 return any(editor.isModified() for editor in self.editors)
4433
4424 def closeEditor(self, editor, ignoreDirty=False): 4434 def closeEditor(self, editor, ignoreDirty=False):
4425 """ 4435 """
4426 Public method to close an editor window. 4436 Public method to close an editor window.
4427 4437
4428 @param editor editor window to be closed 4438 @param editor editor window to be closed
4472 if res and aw == self.currentEditor: 4482 if res and aw == self.currentEditor:
4473 self.currentEditor = None 4483 self.currentEditor = None
4474 4484
4475 return res 4485 return res
4476 4486
4477 def closeAllWindows(self): 4487 def closeAllWindows(self, ignoreDirty=False):
4478 """ 4488 """
4479 Public method to close all editor windows via file menu. 4489 Public method to close all editor windows.
4490
4491 @param ignoreDirty flag indicating to ignore the 'dirty' status
4492 @type bool
4480 """ 4493 """
4481 savedEditors = self.editors[:] 4494 savedEditors = self.editors[:]
4482 for editor in savedEditors: 4495 for editor in savedEditors:
4483 self.closeEditor(editor) 4496 self.closeEditor(editor, ignoreDirty=ignoreDirty)
4484 4497
4485 def closeWindow(self, fn, ignoreDirty=False): 4498 def closeWindow(self, fn, ignoreDirty=False):
4486 """ 4499 """
4487 Public method to close an arbitrary source editor. 4500 Public method to close an arbitrary source editor.
4488 4501

eric ide

mercurial