forked from M-Labs/artiq
1
0
Fork 0

schedule: style (NFC)

This commit is contained in:
Simon Renblad 2024-04-10 12:32:11 +08:00 committed by Sébastien Bourdeauducq
parent 4f302ee675
commit c1e6ae2193
1 changed files with 11 additions and 13 deletions

View File

@ -15,9 +15,8 @@ logger = logging.getLogger(__name__)
class Model(DictSyncModel): class Model(DictSyncModel):
def __init__(self, init): def __init__(self, init):
DictSyncModel.__init__(self, DictSyncModel.__init__(self,
["RID", "Pipeline", "Status", "Prio", "Due date", ["RID", "Pipeline", "Status", "Prio", "Due date",
"Revision", "File", "Class name"], "Revision", "File", "Class name"], init)
init)
def sort_key(self, k, v): def sort_key(self, k, v):
# order by priority, and then by due date and RID # order by priority, and then by due date and RID
@ -96,14 +95,14 @@ class ScheduleDock(QtWidgets.QDockWidget):
cw = QtGui.QFontMetrics(self.font()).averageCharWidth() cw = QtGui.QFontMetrics(self.font()).averageCharWidth()
h = self.table.horizontalHeader() h = self.table.horizontalHeader()
h.resizeSection(0, 7*cw) h.resizeSection(0, 7 * cw)
h.resizeSection(1, 12*cw) h.resizeSection(1, 12 * cw)
h.resizeSection(2, 16*cw) h.resizeSection(2, 16 * cw)
h.resizeSection(3, 6*cw) h.resizeSection(3, 6 * cw)
h.resizeSection(4, 16*cw) h.resizeSection(4, 16 * cw)
h.resizeSection(5, 30*cw) h.resizeSection(5, 30 * cw)
h.resizeSection(6, 20*cw) h.resizeSection(6, 20 * cw)
h.resizeSection(7, 20*cw) h.resizeSection(7, 20 * cw)
def set_model(self, model): def set_model(self, model):
self.table_model = model self.table_model = model
@ -143,7 +142,7 @@ class ScheduleDock(QtWidgets.QDockWidget):
selected_rid = self.table_model.row_to_key[row] selected_rid = self.table_model.row_to_key[row]
pipeline = self.table_model.backing_store[selected_rid]["pipeline"] pipeline = self.table_model.backing_store[selected_rid]["pipeline"]
logger.info("Requesting termination of all " logger.info("Requesting termination of all "
"experiments in pipeline '%s'", pipeline) "experiments in pipeline '%s'", pipeline)
rids = set() rids = set()
for rid, info in self.table_model.backing_store.items(): for rid, info in self.table_model.backing_store.items():
@ -151,7 +150,6 @@ class ScheduleDock(QtWidgets.QDockWidget):
rids.add(rid) rids.add(rid)
asyncio.ensure_future(self.request_term_multiple(rids)) asyncio.ensure_future(self.request_term_multiple(rids))
def save_state(self): def save_state(self):
return bytes(self.table.horizontalHeader().saveState()) return bytes(self.table.horizontalHeader().saveState())