forked from M-Labs/artiq
gui,client: do now show arguments
This commit is contained in:
parent
8402f1cdcd
commit
bd2bd68a54
|
@ -12,7 +12,6 @@ from prettytable import PrettyTable
|
||||||
from artiq.protocols.pc_rpc import Client
|
from artiq.protocols.pc_rpc import Client
|
||||||
from artiq.protocols.sync_struct import Subscriber
|
from artiq.protocols.sync_struct import Subscriber
|
||||||
from artiq.protocols import pyon
|
from artiq.protocols import pyon
|
||||||
from artiq.tools import format_arguments
|
|
||||||
|
|
||||||
|
|
||||||
def clear_screen():
|
def clear_screen():
|
||||||
|
@ -149,7 +148,7 @@ def _show_schedule(schedule):
|
||||||
x[1]["due_date"] or 0,
|
x[1]["due_date"] or 0,
|
||||||
x[0]))
|
x[0]))
|
||||||
table = PrettyTable(["RID", "Pipeline", " Status ", "Prio",
|
table = PrettyTable(["RID", "Pipeline", " Status ", "Prio",
|
||||||
"Due date", "File", "Class name", "Arguments"])
|
"Due date", "File", "Class name"])
|
||||||
for rid, v in l:
|
for rid, v in l:
|
||||||
row = [rid, v["pipeline"], v["status"], v["priority"]]
|
row = [rid, v["pipeline"], v["status"], v["priority"]]
|
||||||
if v["due_date"] is None:
|
if v["due_date"] is None:
|
||||||
|
@ -162,7 +161,6 @@ def _show_schedule(schedule):
|
||||||
row.append("")
|
row.append("")
|
||||||
else:
|
else:
|
||||||
row.append(v["expid"]["class_name"])
|
row.append(v["expid"]["class_name"])
|
||||||
row.append(format_arguments(v["expid"]["arguments"]))
|
|
||||||
table.add_row(row)
|
table.add_row(row)
|
||||||
print(table)
|
print(table)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -6,14 +6,13 @@ from pyqtgraph import dockarea
|
||||||
|
|
||||||
from artiq.protocols.sync_struct import Subscriber
|
from artiq.protocols.sync_struct import Subscriber
|
||||||
from artiq.gui.tools import DictSyncModel
|
from artiq.gui.tools import DictSyncModel
|
||||||
from artiq.tools import format_arguments
|
|
||||||
|
|
||||||
|
|
||||||
class _ScheduleModel(DictSyncModel):
|
class _ScheduleModel(DictSyncModel):
|
||||||
def __init__(self, parent, init):
|
def __init__(self, parent, init):
|
||||||
DictSyncModel.__init__(self,
|
DictSyncModel.__init__(self,
|
||||||
["RID", "Pipeline", "Status", "Prio", "Due date",
|
["RID", "Pipeline", "Status", "Prio", "Due date",
|
||||||
"File", "Class name", "Arguments"],
|
"File", "Class name"],
|
||||||
parent, init)
|
parent, init)
|
||||||
|
|
||||||
def sort_key(self, k, v):
|
def sort_key(self, k, v):
|
||||||
|
@ -42,8 +41,6 @@ class _ScheduleModel(DictSyncModel):
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
return v["expid"]["class_name"]
|
return v["expid"]["class_name"]
|
||||||
elif column == 7:
|
|
||||||
return format_arguments(v["expid"]["arguments"])
|
|
||||||
else:
|
else:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ import inspect
|
||||||
|
|
||||||
from artiq.protocols import pyon
|
from artiq.protocols import pyon
|
||||||
from artiq.protocols.asyncio_server import AsyncioServer as _AsyncioServer
|
from artiq.protocols.asyncio_server import AsyncioServer as _AsyncioServer
|
||||||
from artiq.tools import format_arguments
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -375,6 +374,16 @@ class BestEffortClient:
|
||||||
return proxy
|
return proxy
|
||||||
|
|
||||||
|
|
||||||
|
def _format_arguments(arguments):
|
||||||
|
fmtargs = []
|
||||||
|
for k, v in sorted(arguments.items(), key=itemgetter(0)):
|
||||||
|
fmtargs.append(k + "=" + repr(v))
|
||||||
|
if fmtargs:
|
||||||
|
return ", ".join(fmtargs)
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
class _PrettyPrintCall:
|
class _PrettyPrintCall:
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
self.obj = obj
|
self.obj = obj
|
||||||
|
@ -383,7 +392,7 @@ class _PrettyPrintCall:
|
||||||
r = self.obj["name"] + "("
|
r = self.obj["name"] + "("
|
||||||
args = ", ".join([repr(a) for a in self.obj["args"]])
|
args = ", ".join([repr(a) for a in self.obj["args"]])
|
||||||
r += args
|
r += args
|
||||||
kwargs = format_arguments(self.obj["kwargs"])
|
kwargs = _format_arguments(self.obj["kwargs"])
|
||||||
if args and kwargs:
|
if args and kwargs:
|
||||||
r += ", "
|
r += ", "
|
||||||
r += kwargs
|
r += kwargs
|
||||||
|
|
|
@ -19,16 +19,6 @@ def parse_arguments(arguments):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
def format_arguments(arguments):
|
|
||||||
fmtargs = []
|
|
||||||
for k, v in sorted(arguments.items(), key=itemgetter(0)):
|
|
||||||
fmtargs.append(k + "=" + repr(v))
|
|
||||||
if fmtargs:
|
|
||||||
return ", ".join(fmtargs)
|
|
||||||
else:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
def file_import(filename):
|
def file_import(filename):
|
||||||
linecache.checkcache(filename)
|
linecache.checkcache(filename)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue