From 0eb8079b457eeefcf4a7f6a1bfee9ac056c4eb04 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 11 Dec 2015 00:20:20 +0800 Subject: [PATCH] gui: fix some dock sizing issues --- artiq/gui/console.py | 4 +++- artiq/gui/datasets.py | 3 +-- artiq/gui/displays.py | 9 +++------ artiq/gui/experiments.py | 5 ++--- artiq/gui/explorer.py | 3 ++- artiq/gui/log.py | 4 ++-- artiq/gui/moninj.py | 2 +- artiq/gui/schedule.py | 3 ++- artiq/gui/shortcuts.py | 2 +- 9 files changed, 17 insertions(+), 18 deletions(-) diff --git a/artiq/gui/console.py b/artiq/gui/console.py index 223fc7d6d..99fba1fd6 100644 --- a/artiq/gui/console.py +++ b/artiq/gui/console.py @@ -1,5 +1,6 @@ import asyncio +from quamash import QtCore from pyqtgraph import console, dockarea @@ -15,7 +16,8 @@ The following functions are available: class ConsoleDock(dockarea.Dock): def __init__(self, dataset_sub, dataset_ctl): - dockarea.Dock.__init__(self, "Console", size=(1000, 300)) + dockarea.Dock.__init__(self, "Console") + self.setMinimumSize(QtCore.QSize(850, 300)) self.dataset_sub = dataset_sub self.dataset_ctl = dataset_ctl ns = { diff --git a/artiq/gui/datasets.py b/artiq/gui/datasets.py index d06bf26ef..0d8d2b65d 100644 --- a/artiq/gui/datasets.py +++ b/artiq/gui/datasets.py @@ -43,7 +43,7 @@ def _get_display_type_name(display_cls): class DatasetsDock(dockarea.Dock): def __init__(self, dialog_parent, dock_area, datasets_sub): - dockarea.Dock.__init__(self, "Datasets", size=(1500, 500)) + dockarea.Dock.__init__(self, "Datasets") self.dialog_parent = dialog_parent self.dock_area = dock_area @@ -128,7 +128,6 @@ class DatasetsDock(dockarea.Dock): def on_close(): del self.displays[name] dsp.sigClosed.connect(on_close) - self.dock_area.addDock(dsp) self.dock_area.floatDock(dsp) return dsp diff --git a/artiq/gui/displays.py b/artiq/gui/displays.py index 5fb8069fc..80c4e689c 100644 --- a/artiq/gui/displays.py +++ b/artiq/gui/displays.py @@ -76,8 +76,7 @@ class NumberDisplaySettings(_SimpleSettings): class NumberDisplay(dockarea.Dock): def __init__(self, name, settings): - dockarea.Dock.__init__(self, "Display: " + name, size=(250, 250), - closable=True) + dockarea.Dock.__init__(self, "Display: " + name, closable=True) self.settings = settings self.number = QtGui.QLCDNumber() self.number.setDigitCount(10) @@ -108,8 +107,7 @@ class XYDisplaySettings(_SimpleSettings): class XYDisplay(dockarea.Dock): def __init__(self, name, settings): - dockarea.Dock.__init__(self, "XY: " + name, size=(640, 480), - closable=True) + dockarea.Dock.__init__(self, "XY: " + name, closable=True) self.settings = settings self.plot = pg.PlotWidget() self.addWidget(self.plot) @@ -175,8 +173,7 @@ class HistogramDisplaySettings(_SimpleSettings): class HistogramDisplay(dockarea.Dock): def __init__(self, name, settings): - dockarea.Dock.__init__(self, "Histogram: " + name, size=(640, 480), - closable=True) + dockarea.Dock.__init__(self, "Histogram: " + name, closable=True) self.settings = settings self.plot = pg.PlotWidget() self.addWidget(self.plot) diff --git a/artiq/gui/experiments.py b/artiq/gui/experiments.py index f33cc2c4d..675514727 100644 --- a/artiq/gui/experiments.py +++ b/artiq/gui/experiments.py @@ -235,8 +235,8 @@ class _ArgumentEditor(QtGui.QTreeWidget): class _ExperimentDock(dockarea.Dock): def __init__(self, manager, expurl): - dockarea.Dock.__init__(self, "Exp: " + expurl, - closable=True, size=(1500, 500)) + dockarea.Dock.__init__(self, "Exp: " + expurl, closable=True) + self.setMinimumSize(QtCore.QSize(1100, 700)) self.layout.setSpacing(5) self.layout.setContentsMargins(5, 5, 5, 5) @@ -487,7 +487,6 @@ class ExperimentManager: return self.open_experiments[expurl] dock = _ExperimentDock(self, expurl) self.open_experiments[expurl] = dock - self.dock_area.addDock(dock) self.dock_area.floatDock(dock) dock.sigClosed.connect(partial(self.on_dock_closed, expurl)) return dock diff --git a/artiq/gui/explorer.py b/artiq/gui/explorer.py index 0eb782f06..e492aea5d 100644 --- a/artiq/gui/explorer.py +++ b/artiq/gui/explorer.py @@ -119,7 +119,8 @@ class Model(DictSyncTreeSepModel): class ExplorerDock(dockarea.Dock): def __init__(self, status_bar, exp_manager, d_shortcuts, explist_sub, schedule_ctl, experiment_db_ctl): - dockarea.Dock.__init__(self, "Explorer", size=(1500, 500)) + dockarea.Dock.__init__(self, "Explorer") + self.setMinimumSize(QtCore.QSize(300, 300)) self.layout.setSpacing(5) self.layout.setContentsMargins(5, 5, 5, 5) diff --git a/artiq/gui/log.py b/artiq/gui/log.py index f3f1a1fe6..6ab5d0ae0 100644 --- a/artiq/gui/log.py +++ b/artiq/gui/log.py @@ -143,7 +143,8 @@ class _LogFilterProxyModel(QSortFilterProxyModel): class _LogDock(dockarea.Dock): def __init__(self, manager, name, log_sub): - dockarea.Dock.__init__(self, name, label="Log", size=(1000, 300)) + dockarea.Dock.__init__(self, name, label="Log") + self.setMinimumSize(QtCore.QSize(850, 450)) grid = LayoutWidget() self.addWidget(grid) @@ -276,7 +277,6 @@ class LogDockManager: dock = _LogDock(self, name, self.log_sub) self.docks[name] = dock if add_to_area: - self.dock_area.addDock(dock) self.dock_area.floatDock(dock) dock.sigClosed.connect(partial(self.on_dock_closed, name)) self.update_closable() diff --git a/artiq/gui/moninj.py b/artiq/gui/moninj.py index fa8d72a70..8982fa297 100644 --- a/artiq/gui/moninj.py +++ b/artiq/gui/moninj.py @@ -215,7 +215,7 @@ class _DeviceManager: class _MonInjDock(dockarea.Dock): def __init__(self, name): - dockarea.Dock.__init__(self, name, size=(1500, 500)) + dockarea.Dock.__init__(self, name) self.grid = QtGui.QGridLayout() gridw = QtGui.QWidget() diff --git a/artiq/gui/schedule.py b/artiq/gui/schedule.py index 53ecac6d8..ce1888448 100644 --- a/artiq/gui/schedule.py +++ b/artiq/gui/schedule.py @@ -57,7 +57,8 @@ class Model(DictSyncModel): class ScheduleDock(dockarea.Dock): def __init__(self, status_bar, schedule_ctl, schedule_sub): - dockarea.Dock.__init__(self, "Schedule", size=(1000, 300)) + dockarea.Dock.__init__(self, "Schedule") + self.setMinimumSize(QtCore.QSize(850, 300)) self.status_bar = status_bar self.schedule_ctl = schedule_ctl diff --git a/artiq/gui/shortcuts.py b/artiq/gui/shortcuts.py index 6db934b0b..07c39f5c4 100644 --- a/artiq/gui/shortcuts.py +++ b/artiq/gui/shortcuts.py @@ -15,7 +15,7 @@ logger = logging.getLogger(__name__) class ShortcutsDock(dockarea.Dock): def __init__(self, main_window, exp_manager): - dockarea.Dock.__init__(self, "Shortcuts", size=(1000, 300)) + dockarea.Dock.__init__(self, "Shortcuts") self.layout.setSpacing(5) self.layout.setContentsMargins(5, 5, 5, 5)