mirror of https://github.com/m-labs/artiq.git
gui.log: export LogDock
This commit is contained in:
parent
7a71939201
commit
e5a75ea0f4
|
@ -188,7 +188,7 @@ class _LogFilterProxyModel(QtCore.QSortFilterProxyModel):
|
||||||
self.invalidateFilter()
|
self.invalidateFilter()
|
||||||
|
|
||||||
|
|
||||||
class _LogDock(QDockWidgetCloseDetect):
|
class LogDock(QDockWidgetCloseDetect):
|
||||||
def __init__(self, manager, name, log_sub):
|
def __init__(self, manager, name, log_sub):
|
||||||
QDockWidgetCloseDetect.__init__(self, "Log")
|
QDockWidgetCloseDetect.__init__(self, "Log")
|
||||||
self.setObjectName(name)
|
self.setObjectName(name)
|
||||||
|
@ -215,13 +215,14 @@ class _LogDock(QDockWidgetCloseDetect):
|
||||||
QtWidgets.QStyle.SP_ArrowDown))
|
QtWidgets.QStyle.SP_ArrowDown))
|
||||||
grid.addWidget(scrollbottom, 0, 3)
|
grid.addWidget(scrollbottom, 0, 3)
|
||||||
scrollbottom.clicked.connect(self.scroll_to_bottom)
|
scrollbottom.clicked.connect(self.scroll_to_bottom)
|
||||||
newdock = QtWidgets.QToolButton()
|
if manager:
|
||||||
newdock.setToolTip("Create new log dock")
|
newdock = QtWidgets.QToolButton()
|
||||||
newdock.setIcon(QtWidgets.QApplication.style().standardIcon(
|
newdock.setToolTip("Create new log dock")
|
||||||
QtWidgets.QStyle.SP_FileDialogNewFolder))
|
newdock.setIcon(QtWidgets.QApplication.style().standardIcon(
|
||||||
# note the lambda, the default parameter is overriden otherwise
|
QtWidgets.QStyle.SP_FileDialogNewFolder))
|
||||||
newdock.clicked.connect(lambda: manager.create_new_dock())
|
# note the lambda, the default parameter is overriden otherwise
|
||||||
grid.addWidget(newdock, 0, 4)
|
newdock.clicked.connect(lambda: manager.create_new_dock())
|
||||||
|
grid.addWidget(newdock, 0, 4)
|
||||||
grid.layout.setColumnStretch(2, 1)
|
grid.layout.setColumnStretch(2, 1)
|
||||||
|
|
||||||
self.log = QtWidgets.QTreeView()
|
self.log = QtWidgets.QTreeView()
|
||||||
|
@ -345,7 +346,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.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
|
self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
|
||||||
|
@ -375,7 +376,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)
|
||||||
self.docks[name] = dock
|
self.docks[name] = dock
|
||||||
dock.restore_state(dock_state)
|
dock.restore_state(dock_state)
|
||||||
self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
|
self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
|
||||||
|
|
Loading…
Reference in New Issue