9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, QEvent, Qt |
13 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, QEvent, Qt |
14 from PyQt5.QtWidgets import QStackedWidget, QSplitter, QListWidget, \ |
14 from PyQt5.QtWidgets import ( |
15 QListWidgetItem, QSizePolicy, QMenu, QApplication |
15 QStackedWidget, QSplitter, QListWidget, QListWidgetItem, QSizePolicy, |
|
16 QMenu, QApplication |
|
17 ) |
16 |
18 |
17 from ViewManager.ViewManager import ViewManager |
19 from ViewManager.ViewManager import ViewManager |
18 |
20 |
19 import QScintilla.Editor |
21 import QScintilla.Editor |
20 from QScintilla.Editor import Editor |
22 from QScintilla.Editor import Editor |
789 def __contextMenuCloseOthers(self): |
791 def __contextMenuCloseOthers(self): |
790 """ |
792 """ |
791 Private method to close the other editors. |
793 Private method to close the other editors. |
792 """ |
794 """ |
793 index = self.contextMenuIndex |
795 index = self.contextMenuIndex |
794 for i in list(range(self.viewlist.count() - 1, index, -1)) + \ |
796 for i in ( |
795 list(range(index - 1, -1, -1)): |
797 list(range(self.viewlist.count() - 1, index, -1)) + |
|
798 list(range(index - 1, -1, -1)) |
|
799 ): |
796 editor = self.editors[i] |
800 editor = self.editors[i] |
797 self.closeEditorWindow(editor) |
801 self.closeEditorWindow(editor) |
798 |
802 |
799 def __contextMenuCloseAll(self): |
803 def __contextMenuCloseAll(self): |
800 """ |
804 """ |
893 @param event the event that occurred |
897 @param event the event that occurred |
894 @type QEvent |
898 @type QEvent |
895 @return flag indicating, if we handled the event |
899 @return flag indicating, if we handled the event |
896 @rtype bool |
900 @rtype bool |
897 """ |
901 """ |
898 if event.type() == QEvent.MouseButtonPress and \ |
902 if ( |
899 not event.button() == Qt.RightButton: |
903 event.type() == QEvent.MouseButtonPress and |
|
904 not event.button() == Qt.RightButton |
|
905 ): |
900 switched = True |
906 switched = True |
901 if isinstance(watched, QStackedWidget): |
907 if isinstance(watched, QStackedWidget): |
902 switched = watched is not self.currentStack |
908 switched = watched is not self.currentStack |
903 self.currentStack = watched |
909 self.currentStack = watched |
904 elif isinstance(watched, QScintilla.Editor.Editor): |
910 elif isinstance(watched, QScintilla.Editor.Editor): |