mirror of https://github.com/m-labs/artiq.git
browser: refactor upload_clicked for dataset metadata
This commit is contained in:
parent
50a6dac178
commit
91442e2914
|
@ -28,7 +28,7 @@ class DatasetCtl:
|
||||||
self.master_host = master_host
|
self.master_host = master_host
|
||||||
self.master_port = master_port
|
self.master_port = master_port
|
||||||
|
|
||||||
async def _execute_rpc(self, op_name, key_or_mod, value=None, persist=None):
|
async def _execute_rpc(self, op_name, key_or_mod, value=None, persist=None, metadata=None):
|
||||||
logger.info("Starting %s operation on %s", op_name, key_or_mod)
|
logger.info("Starting %s operation on %s", op_name, key_or_mod)
|
||||||
try:
|
try:
|
||||||
remote = RPCClient()
|
remote = RPCClient()
|
||||||
|
@ -36,7 +36,7 @@ class DatasetCtl:
|
||||||
"master_dataset_db")
|
"master_dataset_db")
|
||||||
try:
|
try:
|
||||||
if op_name == "set":
|
if op_name == "set":
|
||||||
await remote.set(key_or_mod, value, persist)
|
await remote.set(key_or_mod, value, persist, metadata)
|
||||||
elif op_name == "update":
|
elif op_name == "update":
|
||||||
await remote.update(key_or_mod)
|
await remote.update(key_or_mod)
|
||||||
else:
|
else:
|
||||||
|
@ -51,8 +51,8 @@ class DatasetCtl:
|
||||||
logger.info("Finished %s operation on %s", op_name,
|
logger.info("Finished %s operation on %s", op_name,
|
||||||
key_or_mod)
|
key_or_mod)
|
||||||
|
|
||||||
async def set(self, key, value, persist=None):
|
async def set(self, key, value, persist=None, metadata=None):
|
||||||
await self._execute_rpc("set", key, value, persist)
|
await self._execute_rpc("set", key, value, persist, metadata)
|
||||||
|
|
||||||
async def update(self, mod):
|
async def update(self, mod):
|
||||||
await self._execute_rpc("update", mod)
|
await self._execute_rpc("update", mod)
|
||||||
|
@ -122,8 +122,8 @@ class DatasetsDock(QtWidgets.QDockWidget):
|
||||||
idx = self.table_model_filter.mapToSource(idx[0])
|
idx = self.table_model_filter.mapToSource(idx[0])
|
||||||
key = self.table_model.index_to_key(idx)
|
key = self.table_model.index_to_key(idx)
|
||||||
if key is not None:
|
if key is not None:
|
||||||
persist, value = self.table_model.backing_store[key]
|
persist, value, metadata = self.table_model.backing_store[key]
|
||||||
asyncio.ensure_future(self.dataset_ctl.set(key, value))
|
asyncio.ensure_future(self.dataset_ctl.set(key, value, metadata=metadata))
|
||||||
|
|
||||||
def save_state(self):
|
def save_state(self):
|
||||||
return bytes(self.table.header().saveState())
|
return bytes(self.table.header().saveState())
|
||||||
|
|
Loading…
Reference in New Issue