forked from M-Labs/artiq
gui/console: use network clients directly
This commit is contained in:
parent
4166f4e928
commit
62c0eb85b1
|
@ -120,14 +120,8 @@ def main():
|
|||
d_log = log.LogDock(sub_clients["log"])
|
||||
smgr.register(d_log)
|
||||
|
||||
def _set_dataset(k, v):
|
||||
asyncio.ensure_future(rpc_clients["dataset_db"].set(k, v))
|
||||
def _del_dataset(k):
|
||||
asyncio.ensure_future(rpc_clients["dataset_db"].delete(k))
|
||||
d_console = console.ConsoleDock(
|
||||
d_datasets.get_dataset,
|
||||
_set_dataset,
|
||||
_del_dataset)
|
||||
d_console = console.ConsoleDock(sub_clients["datasets"],
|
||||
rpc_clients["dataset_db"])
|
||||
|
||||
area.addDock(d_console, "bottom")
|
||||
area.addDock(d_log, "above", d_console)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import asyncio
|
||||
|
||||
from pyqtgraph import console, dockarea
|
||||
|
||||
|
||||
|
@ -12,12 +14,25 @@ The following functions are available:
|
|||
"""
|
||||
|
||||
class ConsoleDock(dockarea.Dock):
|
||||
def __init__(self, get_dataset, set_dataset, del_dataset):
|
||||
def __init__(self, dataset_sub, dataset_ctl):
|
||||
dockarea.Dock.__init__(self, "Console", size=(1000, 300))
|
||||
self.dataset_sub = dataset_sub
|
||||
self.dataset_ctl = dataset_ctl
|
||||
ns = {
|
||||
"get_dataset": get_dataset,
|
||||
"set_dataset": set_dataset,
|
||||
"del_dataset": del_dataset
|
||||
"get_dataset": self.get_dataset,
|
||||
"set_dataset": self.set_dataset,
|
||||
"del_dataset": self.del_dataset
|
||||
}
|
||||
c = console.ConsoleWidget(namespace=ns, text=_help)
|
||||
self.addWidget(c)
|
||||
|
||||
def get_dataset(self, k):
|
||||
if self.dataset_sub.model is None:
|
||||
raise IOError("Datasets not available yet")
|
||||
return self.dataset_sub.model.backing_store[k][1]
|
||||
|
||||
def set_dataset(self, k, v):
|
||||
asyncio.ensure_future(self.dataset_ctl.set(k, v))
|
||||
|
||||
def del_dataset(self, k):
|
||||
asyncio.ensure_future(self.dataset_ctl.delete(k))
|
||||
|
|
|
@ -84,9 +84,6 @@ class DatasetsDock(dockarea.Dock):
|
|||
self.table_model_filter.setFilterFixedString(
|
||||
self.search.displayText())
|
||||
|
||||
def get_dataset(self, key):
|
||||
return self.table_model.backing_store[key][1]
|
||||
|
||||
def set_model(self, model):
|
||||
self.table_model = model
|
||||
self.table_model_filter = QSortFilterProxyModel()
|
||||
|
|
Loading…
Reference in New Issue