10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 import os |
12 import os |
13 |
13 |
14 from PyQt5.QtCore import QModelIndex, pyqtSignal, Qt, QCoreApplication, \ |
14 from PyQt5.QtCore import QModelIndex, pyqtSignal, Qt, QCoreApplication, \ |
15 QItemSelectionModel, QItemSelection |
15 QItemSelectionModel, QItemSelection, QElapsedTimer |
16 from PyQt5.QtGui import QCursor |
16 from PyQt5.QtGui import QCursor |
17 from PyQt5.QtWidgets import QTreeView, QApplication, QMenu, QDialog, \ |
17 from PyQt5.QtWidgets import QTreeView, QApplication, QMenu, QDialog, \ |
18 QAbstractItemView |
18 QAbstractItemView |
19 |
19 |
20 from E5Gui.E5Application import e5App |
20 from E5Gui.E5Application import e5App |
21 from E5Gui import E5MessageBox |
21 from E5Gui import E5MessageBox |
22 |
22 |
23 from UI.Browser import Browser |
23 from UI.Browser import Browser |
|
24 from UI.BrowserModel import BrowserDirectoryItem, BrowserFileItem |
24 |
25 |
25 from .ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem, \ |
26 from .ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem, \ |
26 ProjectBrowserDirectoryItem, ProjectBrowserFileItem |
27 ProjectBrowserDirectoryItem, ProjectBrowserFileItem |
27 from .ProjectBrowserSortFilterProxyModel import \ |
28 from .ProjectBrowserSortFilterProxyModel import \ |
28 ProjectBrowserSortFilterProxyModel |
29 ProjectBrowserSortFilterProxyModel |
78 self._createPopupMenus() |
79 self._createPopupMenus() |
79 |
80 |
80 self.currentItemName = None |
81 self.currentItemName = None |
81 |
82 |
82 self._init() # perform common initialization tasks |
83 self._init() # perform common initialization tasks |
|
84 |
|
85 self._keyboardSearchString = "" |
|
86 self._keyboardSearchTimer = QElapsedTimer() |
|
87 self._keyboardSearchTimer.invalidate() |
83 |
88 |
84 self._initHookMethods() # perform initialization of the hooks |
89 self._initHookMethods() # perform initialization of the hooks |
85 self.hooksMenuEntries = {} |
90 self.hooksMenuEntries = {} |
86 |
91 |
87 def _connectExpandedCollapsed(self): |
92 def _connectExpandedCollapsed(self): |
678 @return reference to the current item |
683 @return reference to the current item |
679 """ |
684 """ |
680 itm = self.model().item(self.currentIndex()) |
685 itm = self.model().item(self.currentIndex()) |
681 return itm |
686 return itm |
682 |
687 |
|
688 def _keyboardSearchType(self, item): |
|
689 """ |
|
690 Protected method to check, if the item is of the correct type. |
|
691 |
|
692 @param item reference to the item |
|
693 @type BrowserItem |
|
694 @return flag indicating a correct type |
|
695 @rtype bool |
|
696 """ |
|
697 return isinstance( |
|
698 item, (BrowserDirectoryItem, BrowserFileItem, |
|
699 ProjectBrowserSimpleDirectoryItem, |
|
700 ProjectBrowserDirectoryItem, ProjectBrowserFileItem)) |
|
701 |
683 ########################################################################### |
702 ########################################################################### |
684 ## Support for hooks below |
703 ## Support for hooks below |
685 ########################################################################### |
704 ########################################################################### |
686 |
705 |
687 def _initHookMethods(self): |
706 def _initHookMethods(self): |