Cleanup; show "loading…" message when loading from cache on first click.
This commit is contained in:
parent
659680cce6
commit
3d5d0c4161
11
SearchBox.py
11
SearchBox.py
|
@ -2,6 +2,7 @@ print("Loaded file SearchBox.py")
|
|||
import os
|
||||
from PySide import QtGui
|
||||
from PySide import QtCore
|
||||
import FreeCADGui # just used for FreeCADGui.updateGui()
|
||||
from SearchBoxLight import SearchBoxLight
|
||||
|
||||
globalIgnoreFocusOut = False
|
||||
|
@ -77,6 +78,7 @@ class SearchBox(QtGui.QLineEdit):
|
|||
self.listView.selectionModel().selectionChanged.connect(self.onSelectionChanged)
|
||||
# Initialize the model with the full list (assuming the text() is empty)
|
||||
#self.proxyFilterModel(self.text()) # This is done by refreshItemGroups on focusInEvent, because the initial loading from cache can take time
|
||||
self.firstShowList = True
|
||||
self.isInitialized = True
|
||||
return self
|
||||
|
||||
|
@ -87,6 +89,15 @@ class SearchBox(QtGui.QLineEdit):
|
|||
|
||||
@staticmethod
|
||||
def proxyFocusInEvent(self, qFocusEvent):
|
||||
if self.firstShowList:
|
||||
mdl = QtGui.QStandardItemModel()
|
||||
mdl.appendRow([QtGui.QStandardItem(genericToolIcon, 'Please wait, loading results from cache…'),
|
||||
QtGui.QStandardItem('0'),
|
||||
QtGui.QStandardItem('-1')])
|
||||
self.proxyModel.setSourceModel(mdl)
|
||||
self.showList()
|
||||
self.firstShowList = False
|
||||
FreeCADGui.updateGui()
|
||||
global globalIgnoreFocusOut
|
||||
if not globalIgnoreFocusOut:
|
||||
self.refreshItemGroups()
|
||||
|
|
|
@ -44,35 +44,3 @@ class SearchBoxLight(QtGui.QLineEdit):
|
|||
self.proxyOnSelectionChanged(*args, **kwargs)
|
||||
def filterModel(self, *args, **kwargs):
|
||||
self.proxyFilterModel(*args, **kwargs)
|
||||
|
||||
# .focusInEvent(self, qFocusEvent)
|
||||
#
|
||||
# def focusInEvent(self, qFocusEvent):
|
||||
# def focusOutEvent(self, qFocusEvent):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.focusOutEvent(self, qFocusEvent)
|
||||
# def keyPressEvent(self, qKeyEvent):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.keyPressEvent(self, qKeyEvent)
|
||||
# def showList(self):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.showList(self)
|
||||
# def hideList(self):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.hideList(self)
|
||||
# def hideExtraInfo(self):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.hideExtraInfo(self)
|
||||
# def showExtraInfo(self):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.showExtraInfo(self)
|
||||
# def filterModel(self, userInput):
|
||||
# import SearchBox
|
||||
# SearchBox.SearchBox.lazyInit(self)
|
||||
# SearchBox.SearchBox.filterModel(self, userInput)
|
Loading…
Reference in New Issue
Block a user