487 @return reference to the current page (Editor) |
487 @return reference to the current page (Editor) |
488 """ |
488 """ |
489 if not self.editors: |
489 if not self.editors: |
490 return None |
490 return None |
491 else: |
491 else: |
492 try: |
492 return super().currentWidget() |
493 return super().currentWidget().getEditor() |
493 |
494 except AttributeError: |
494 def setCurrentWidget(self, assembly): |
495 return super().currentWidget() |
495 """ |
496 |
496 Public method to set the current tab by the given editor assembly. |
497 def setCurrentWidget(self, editor): |
497 |
498 """ |
498 @param assembly editor assembly to determine current tab from |
499 Public method to set the current tab by the given editor. |
499 (EditorAssembly.EditorAssembly) |
500 |
500 """ |
501 @param editor editor to determine current tab from (Editor) |
501 super().setCurrentWidget(assembly) |
502 """ |
|
503 super().setCurrentWidget(editor.parent()) |
|
504 |
502 |
505 def indexOf(self, object): |
503 def indexOf(self, object): |
506 """ |
504 """ |
507 Public method to get the tab index of the given editor. |
505 Public method to get the tab index of the given editor. |
508 |
506 |
668 for their status |
666 for their status |
669 @signal cursorChanged(Editor) emitted after the cursor position of the active |
667 @signal cursorChanged(Editor) emitted after the cursor position of the active |
670 window has changed |
668 window has changed |
671 @signal breakpointToggled(Editor) emitted when a breakpoint is toggled. |
669 @signal breakpointToggled(Editor) emitted when a breakpoint is toggled. |
672 @signal bookmarkToggled(Editor) emitted when a bookmark is toggled. |
670 @signal bookmarkToggled(Editor) emitted when a bookmark is toggled. |
|
671 @signal syntaxerrorToggled(Editor) emitted when a syntax error is toggled. |
673 """ |
672 """ |
674 changeCaption = pyqtSignal(str) |
673 changeCaption = pyqtSignal(str) |
675 editorChanged = pyqtSignal(str) |
674 editorChanged = pyqtSignal(str) |
676 |
675 |
677 lastEditorClosed = pyqtSignal() |
676 lastEditorClosed = pyqtSignal() |
866 |
865 |
867 def _showView(self, win, fn=None): |
866 def _showView(self, win, fn=None): |
868 """ |
867 """ |
869 Protected method to show a view (i.e. window) |
868 Protected method to show a view (i.e. window) |
870 |
869 |
871 @param win editor window to be shown |
870 @param win editor assembly to be shown |
872 @param fn filename of this editor (string) |
871 @param fn filename of this editor (string) |
873 """ |
872 """ |
874 win.show() |
873 win.show() |
|
874 editor = win.getEditor() |
875 for tw in self.tabWidgets: |
875 for tw in self.tabWidgets: |
876 if tw.hasEditor(win): |
876 if tw.hasEditor(editor): |
877 tw.setCurrentWidget(win) |
877 tw.setCurrentWidget(win) |
878 self.currentTabWidget.showIndicator(False) |
878 self.currentTabWidget.showIndicator(False) |
879 self.currentTabWidget = tw |
879 self.currentTabWidget = tw |
880 self.currentTabWidget.showIndicator(True) |
880 self.currentTabWidget.showIndicator(True) |
881 break |
881 break |
882 win.setFocus() |
882 editor.setFocus() |
883 |
883 |
884 def activeWindow(self): |
884 def activeWindow(self): |
885 """ |
885 """ |
886 Public method to return the active (i.e. current) window. |
886 Public method to return the active (i.e. current) window. |
887 |
887 |
888 @return reference to the active editor |
888 @return reference to the active editor |
889 """ |
889 """ |
890 return self.currentTabWidget.currentWidget() |
890 cw = self.currentTabWidget.currentWidget() |
|
891 if cw: |
|
892 return cw.getEditor() |
|
893 else: |
|
894 return None |
891 |
895 |
892 def showWindowMenu(self, windowMenu): |
896 def showWindowMenu(self, windowMenu): |
893 """ |
897 """ |
894 Public method to set up the viewmanager part of the Window menu. |
898 Public method to set up the viewmanager part of the Window menu. |
895 |
899 |