gui: Qt wants a central widget in the main window, use explorer

This commit is contained in:
Sebastien Bourdeauducq 2016-02-14 23:04:14 +01:00
parent 579e789ad7
commit d81ce15869
2 changed files with 8 additions and 13 deletions

View File

@ -100,10 +100,10 @@ def main():
smgr.register(expmgr) smgr.register(expmgr)
d_shortcuts = shortcuts.ShortcutsDock(main_window, expmgr) d_shortcuts = shortcuts.ShortcutsDock(main_window, expmgr)
smgr.register(d_shortcuts) smgr.register(d_shortcuts)
d_explorer = explorer.ExplorerDock(status_bar, expmgr, d_shortcuts, d_explorer = explorer.Explorer(status_bar, expmgr, d_shortcuts,
sub_clients["explist"], sub_clients["explist"],
rpc_clients["schedule"], rpc_clients["schedule"],
rpc_clients["experiment_db"]) rpc_clients["experiment_db"])
d_datasets = datasets.DatasetsDock(sub_clients["datasets"], d_datasets = datasets.DatasetsDock(sub_clients["datasets"],
rpc_clients["dataset_db"]) rpc_clients["dataset_db"])
@ -124,6 +124,7 @@ def main():
smgr.register(logmgr) smgr.register(logmgr)
# lay out docks # lay out docks
main_window.setCentralWidget(d_explorer)
if os.name != "nt": if os.name != "nt":
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_ttl_dds.dds_dock) main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_ttl_dds.dds_dock)
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_ttl_dds.ttl_dock) main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_ttl_dds.ttl_dock)
@ -133,7 +134,6 @@ def main():
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_applets) main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_applets)
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_datasets) main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_datasets)
main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d_shortcuts) main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d_shortcuts)
main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d_explorer)
main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d_schedule) main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d_schedule)
# load/initialize state # load/initialize state

View File

@ -115,18 +115,13 @@ class Model(DictSyncTreeSepModel):
DictSyncTreeSepModel.__init__(self, "/", ["Experiment"], init) DictSyncTreeSepModel.__init__(self, "/", ["Experiment"], init)
class ExplorerDock(QtWidgets.QDockWidget): class Explorer(QtWidgets.QWidget):
def __init__(self, status_bar, exp_manager, d_shortcuts, def __init__(self, status_bar, exp_manager, d_shortcuts,
explist_sub, schedule_ctl, experiment_db_ctl): explist_sub, schedule_ctl, experiment_db_ctl):
QtWidgets.QDockWidget.__init__(self, "Explorer") QtWidgets.QWidget.__init__(self)
self.setObjectName("Explorer")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable)
layout = QtWidgets.QGridLayout() layout = QtWidgets.QGridLayout()
top_widget = QtWidgets.QWidget() self.setLayout(layout)
top_widget.setLayout(layout)
self.setWidget(top_widget)
layout.setSpacing(5) layout.setSpacing(5)
layout.setContentsMargins(5, 5, 5, 5) layout.setContentsMargins(5, 5, 5, 5)