forked from M-Labs/artiq
gui: autodetect whether QSortFilterProxyModel is in QtCore or QtGui
This commit is contained in:
parent
7f5e264971
commit
da83212c79
|
@ -12,6 +12,11 @@ from artiq.tools import short_format
|
||||||
from artiq.gui.tools import DictSyncModel
|
from artiq.gui.tools import DictSyncModel
|
||||||
from artiq.gui.displays import *
|
from artiq.gui.displays import *
|
||||||
|
|
||||||
|
try:
|
||||||
|
QSortFilterProxyModel = QtCore.QSortFilterProxyModel
|
||||||
|
except AttributeError:
|
||||||
|
QSortFilterProxyModel = QtGui.QSortFilterProxyModel
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -89,7 +94,7 @@ class DatasetsDock(dockarea.Dock):
|
||||||
|
|
||||||
def init_datasets_model(self, init):
|
def init_datasets_model(self, init):
|
||||||
self.table_model = DatasetsModel(self.table, init)
|
self.table_model = DatasetsModel(self.table, init)
|
||||||
self.table_model_filter = QtCore.QSortFilterProxyModel()
|
self.table_model_filter = QSortFilterProxyModel()
|
||||||
self.table_model_filter.setSourceModel(self.table_model)
|
self.table_model_filter.setSourceModel(self.table_model)
|
||||||
self.table.setModel(self.table_model_filter)
|
self.table.setModel(self.table_model_filter)
|
||||||
return self.table_model
|
return self.table_model
|
||||||
|
|
|
@ -8,6 +8,11 @@ from pyqtgraph import dockarea, LayoutWidget
|
||||||
from artiq.protocols.sync_struct import Subscriber
|
from artiq.protocols.sync_struct import Subscriber
|
||||||
from artiq.gui.tools import ListSyncModel
|
from artiq.gui.tools import ListSyncModel
|
||||||
|
|
||||||
|
try:
|
||||||
|
QSortFilterProxyModel = QtCore.QSortFilterProxyModel
|
||||||
|
except AttributeError:
|
||||||
|
QSortFilterProxyModel = QtGui.QSortFilterProxyModel
|
||||||
|
|
||||||
|
|
||||||
def _level_to_name(level):
|
def _level_to_name(level):
|
||||||
if level >= logging.CRITICAL:
|
if level >= logging.CRITICAL:
|
||||||
|
@ -67,9 +72,9 @@ class _LogModel(ListSyncModel):
|
||||||
return v[3]
|
return v[3]
|
||||||
|
|
||||||
|
|
||||||
class _LevelFilterProxyModel(QtCore.QSortFilterProxyModel):
|
class _LevelFilterProxyModel(QSortFilterProxyModel):
|
||||||
def __init__(self, min_level):
|
def __init__(self, min_level):
|
||||||
QtCore.QSortFilterProxyModel.__init__(self)
|
QSortFilterProxyModel.__init__(self)
|
||||||
self.min_level = min_level
|
self.min_level = min_level
|
||||||
|
|
||||||
def filterAcceptsRow(self, sourceRow, sourceParent):
|
def filterAcceptsRow(self, sourceRow, sourceParent):
|
||||||
|
|
Loading…
Reference in New Issue