forked from M-Labs/artiq
1
0
Fork 0

gui/log: improve vertical scrolling

This commit is contained in:
Sebastien Bourdeauducq 2015-11-27 19:18:20 +08:00
parent 3c9b53b07b
commit 6671bb33a4
1 changed files with 5 additions and 3 deletions

View File

@ -151,7 +151,7 @@ class _LogFilterProxyModel(QSortFilterProxyModel):
self.invalidateFilter() self.invalidateFilter()
class LogDock(dockarea.Dock): class _LogDock(dockarea.Dock):
def __init__(self, manager, name, log_sub): def __init__(self, manager, name, log_sub):
dockarea.Dock.__init__(self, name, label="Log", size=(1000, 300)) dockarea.Dock.__init__(self, name, label="Log", size=(1000, 300))
@ -181,6 +181,8 @@ class LogDock(dockarea.Dock):
self.log.verticalHeader().hide() self.log.verticalHeader().hide()
self.log.setHorizontalScrollMode( self.log.setHorizontalScrollMode(
QtGui.QAbstractItemView.ScrollPerPixel) QtGui.QAbstractItemView.ScrollPerPixel)
self.log.setVerticalScrollMode(
QtGui.QAbstractItemView.ScrollPerPixel)
self.log.setShowGrid(False) self.log.setShowGrid(False)
self.log.setTextElideMode(QtCore.Qt.ElideNone) self.log.setTextElideMode(QtCore.Qt.ElideNone)
grid.addWidget(self.log, 1, 0, colspan=4) grid.addWidget(self.log, 1, 0, colspan=4)
@ -278,7 +280,7 @@ class LogDockManager:
n += 1 n += 1
name = "log" + str(n) name = "log" + str(n)
dock = LogDock(self, name, self.log_sub) dock = _LogDock(self, name, self.log_sub)
self.docks[name] = dock self.docks[name] = dock
if add_to_area: if add_to_area:
self.dock_area.addDock(dock) self.dock_area.addDock(dock)
@ -303,7 +305,7 @@ class LogDockManager:
if self.docks: if self.docks:
raise NotImplementedError raise NotImplementedError
for name, dock_state in state.items(): for name, dock_state in state.items():
dock = LogDock(self, name, self.log_sub) dock = _LogDock(self, name, self.log_sub)
dock.restore_state(dock_state) dock.restore_state(dock_state)
self.dock_area.addDock(dock) self.dock_area.addDock(dock)
self.docks[name] = dock self.docks[name] = dock