forked from M-Labs/artiq
1
0
Fork 0

gui: add empty explorer and console docks

This commit is contained in:
Sebastien Bourdeauducq 2015-05-22 23:30:46 +08:00
parent cff999f259
commit 2570444941
5 changed files with 38 additions and 16 deletions

View File

@ -7,11 +7,13 @@ import atexit
# Quamash must be imported first so that pyqtgraph picks up the Qt binding
# it has chosen.
from quamash import QEventLoop, QtGui
from pyqtgraph.dockarea import DockArea
from pyqtgraph import dockarea
from artiq.protocols.file_db import FlatFileDB
from artiq.gui.schedule import ScheduleDock
from artiq.gui.explorer import ExplorerDock
from artiq.gui.parameters import ParametersDock
from artiq.gui.console import ConsoleDock
from artiq.gui.schedule import ScheduleDock
def get_argparser():
@ -42,19 +44,25 @@ def main():
atexit.register(lambda: loop.close())
win = QtGui.QMainWindow()
area = DockArea()
area = dockarea.DockArea()
win.setCentralWidget(area)
win.resize(1000, 500)
win.resize(1400, 800)
win.setWindowTitle("ARTIQ")
d_params = ParametersDock(area)
area.addDock(d_params, "left")
d_explorer = ExplorerDock()
area.addDock(d_explorer, "top")
d_params = ParametersDock()
area.addDock(d_params, "right", d_explorer)
loop.run_until_complete(d_params.sub_connect(
args.server, args.port_notify))
atexit.register(lambda: loop.run_until_complete(d_params.sub_close()))
d_schedule = ScheduleDock(area)
area.addDock(d_schedule, "top", d_params)
d_console = ConsoleDock()
area.addDock(d_console, "bottom")
d_schedule = ScheduleDock()
area.addDock(d_schedule, "above", d_console)
loop.run_until_complete(d_schedule.sub_connect(
args.server, args.port_notify))
atexit.register(lambda: loop.run_until_complete(d_schedule.sub_close()))

7
artiq/gui/console.py Normal file
View File

@ -0,0 +1,7 @@
from quamash import QtGui
from pyqtgraph import dockarea
class ConsoleDock(dockarea.Dock):
def __init__(self):
dockarea.Dock.__init__(self, "Console", size=(1000, 300))

7
artiq/gui/explorer.py Normal file
View File

@ -0,0 +1,7 @@
from quamash import QtGui
from pyqtgraph import dockarea
class ExplorerDock(dockarea.Dock):
def __init__(self):
dockarea.Dock.__init__(self, "Explorer", size=(1100, 400))

View File

@ -1,7 +1,7 @@
import asyncio
from quamash import QtGui
from pyqtgraph.dockarea import Dock
from pyqtgraph import dockarea
from artiq.protocols.sync_struct import Subscriber
from artiq.gui.tools import DictSyncModel
@ -24,9 +24,9 @@ class ParametersModel(DictSyncModel):
raise ValueError
class ParametersDock(Dock):
def __init__(self, parent):
Dock.__init__(self, "Parameters", size=(500, 300))
class ParametersDock(dockarea.Dock):
def __init__(self):
dockarea.Dock.__init__(self, "Parameters", size=(500, 300))
self.table = QtGui.QTableView()
self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)

View File

@ -2,7 +2,7 @@ import asyncio
import time
from quamash import QtGui
from pyqtgraph.dockarea import Dock
from pyqtgraph import dockarea
from artiq.protocols.sync_struct import Subscriber
from artiq.gui.tools import DictSyncModel
@ -46,9 +46,9 @@ class _ScheduleModel(DictSyncModel):
raise ValueError
class ScheduleDock(Dock):
def __init__(self, parent):
Dock.__init__(self, "Schedule", size=(1000, 300))
class ScheduleDock(dockarea.Dock):
def __init__(self):
dockarea.Dock.__init__(self, "Schedule", size=(1000, 300))
self.table = QtGui.QTableView()
self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)