gui: fix some dock sizing issues

This commit is contained in:
Sebastien Bourdeauducq 2015-12-11 00:20:20 +08:00
parent c4b33bdf84
commit 0eb8079b45
9 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,6 @@
import asyncio import asyncio
from quamash import QtCore
from pyqtgraph import console, dockarea from pyqtgraph import console, dockarea
@ -15,7 +16,8 @@ The following functions are available:
class ConsoleDock(dockarea.Dock): class ConsoleDock(dockarea.Dock):
def __init__(self, dataset_sub, dataset_ctl): 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_sub = dataset_sub
self.dataset_ctl = dataset_ctl self.dataset_ctl = dataset_ctl
ns = { ns = {

View File

@ -43,7 +43,7 @@ def _get_display_type_name(display_cls):
class DatasetsDock(dockarea.Dock): class DatasetsDock(dockarea.Dock):
def __init__(self, dialog_parent, dock_area, datasets_sub): 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.dialog_parent = dialog_parent
self.dock_area = dock_area self.dock_area = dock_area
@ -128,7 +128,6 @@ class DatasetsDock(dockarea.Dock):
def on_close(): def on_close():
del self.displays[name] del self.displays[name]
dsp.sigClosed.connect(on_close) dsp.sigClosed.connect(on_close)
self.dock_area.addDock(dsp)
self.dock_area.floatDock(dsp) self.dock_area.floatDock(dsp)
return dsp return dsp

View File

@ -76,8 +76,7 @@ class NumberDisplaySettings(_SimpleSettings):
class NumberDisplay(dockarea.Dock): class NumberDisplay(dockarea.Dock):
def __init__(self, name, settings): def __init__(self, name, settings):
dockarea.Dock.__init__(self, "Display: " + name, size=(250, 250), dockarea.Dock.__init__(self, "Display: " + name, closable=True)
closable=True)
self.settings = settings self.settings = settings
self.number = QtGui.QLCDNumber() self.number = QtGui.QLCDNumber()
self.number.setDigitCount(10) self.number.setDigitCount(10)
@ -108,8 +107,7 @@ class XYDisplaySettings(_SimpleSettings):
class XYDisplay(dockarea.Dock): class XYDisplay(dockarea.Dock):
def __init__(self, name, settings): def __init__(self, name, settings):
dockarea.Dock.__init__(self, "XY: " + name, size=(640, 480), dockarea.Dock.__init__(self, "XY: " + name, closable=True)
closable=True)
self.settings = settings self.settings = settings
self.plot = pg.PlotWidget() self.plot = pg.PlotWidget()
self.addWidget(self.plot) self.addWidget(self.plot)
@ -175,8 +173,7 @@ class HistogramDisplaySettings(_SimpleSettings):
class HistogramDisplay(dockarea.Dock): class HistogramDisplay(dockarea.Dock):
def __init__(self, name, settings): def __init__(self, name, settings):
dockarea.Dock.__init__(self, "Histogram: " + name, size=(640, 480), dockarea.Dock.__init__(self, "Histogram: " + name, closable=True)
closable=True)
self.settings = settings self.settings = settings
self.plot = pg.PlotWidget() self.plot = pg.PlotWidget()
self.addWidget(self.plot) self.addWidget(self.plot)

View File

@ -235,8 +235,8 @@ class _ArgumentEditor(QtGui.QTreeWidget):
class _ExperimentDock(dockarea.Dock): class _ExperimentDock(dockarea.Dock):
def __init__(self, manager, expurl): def __init__(self, manager, expurl):
dockarea.Dock.__init__(self, "Exp: " + expurl, dockarea.Dock.__init__(self, "Exp: " + expurl, closable=True)
closable=True, size=(1500, 500)) self.setMinimumSize(QtCore.QSize(1100, 700))
self.layout.setSpacing(5) self.layout.setSpacing(5)
self.layout.setContentsMargins(5, 5, 5, 5) self.layout.setContentsMargins(5, 5, 5, 5)
@ -487,7 +487,6 @@ class ExperimentManager:
return self.open_experiments[expurl] return self.open_experiments[expurl]
dock = _ExperimentDock(self, expurl) dock = _ExperimentDock(self, expurl)
self.open_experiments[expurl] = dock self.open_experiments[expurl] = dock
self.dock_area.addDock(dock)
self.dock_area.floatDock(dock) self.dock_area.floatDock(dock)
dock.sigClosed.connect(partial(self.on_dock_closed, expurl)) dock.sigClosed.connect(partial(self.on_dock_closed, expurl))
return dock return dock

View File

@ -119,7 +119,8 @@ class Model(DictSyncTreeSepModel):
class ExplorerDock(dockarea.Dock): class ExplorerDock(dockarea.Dock):
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):
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.setSpacing(5)
self.layout.setContentsMargins(5, 5, 5, 5) self.layout.setContentsMargins(5, 5, 5, 5)

View File

@ -143,7 +143,8 @@ class _LogFilterProxyModel(QSortFilterProxyModel):
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")
self.setMinimumSize(QtCore.QSize(850, 450))
grid = LayoutWidget() grid = LayoutWidget()
self.addWidget(grid) self.addWidget(grid)
@ -276,7 +277,6 @@ class LogDockManager:
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.floatDock(dock) self.dock_area.floatDock(dock)
dock.sigClosed.connect(partial(self.on_dock_closed, name)) dock.sigClosed.connect(partial(self.on_dock_closed, name))
self.update_closable() self.update_closable()

View File

@ -215,7 +215,7 @@ class _DeviceManager:
class _MonInjDock(dockarea.Dock): class _MonInjDock(dockarea.Dock):
def __init__(self, name): def __init__(self, name):
dockarea.Dock.__init__(self, name, size=(1500, 500)) dockarea.Dock.__init__(self, name)
self.grid = QtGui.QGridLayout() self.grid = QtGui.QGridLayout()
gridw = QtGui.QWidget() gridw = QtGui.QWidget()

View File

@ -57,7 +57,8 @@ class Model(DictSyncModel):
class ScheduleDock(dockarea.Dock): class ScheduleDock(dockarea.Dock):
def __init__(self, status_bar, schedule_ctl, schedule_sub): 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.status_bar = status_bar
self.schedule_ctl = schedule_ctl self.schedule_ctl = schedule_ctl

View File

@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
class ShortcutsDock(dockarea.Dock): class ShortcutsDock(dockarea.Dock):
def __init__(self, main_window, exp_manager): 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.setSpacing(5)
self.layout.setContentsMargins(5, 5, 5, 5) self.layout.setContentsMargins(5, 5, 5, 5)