From 69f534cc20f55c4a119b971c26480592f38e9a91 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Mon, 4 Apr 2016 11:47:53 +0800 Subject: [PATCH] gui.models: style --- artiq/gui/models.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/artiq/gui/models.py b/artiq/gui/models.py index 4ab1da633..069aa6665 100644 --- a/artiq/gui/models.py +++ b/artiq/gui/models.py @@ -55,8 +55,9 @@ class DictSyncModel(QtCore.QAbstractTableModel): def __init__(self, headers, init): self.headers = headers self.backing_store = init - self.row_to_key = sorted(self.backing_store.keys(), - key=lambda k: self.sort_key(k, self.backing_store[k])) + self.row_to_key = sorted( + self.backing_store.keys(), + key=lambda k: self.sort_key(k, self.backing_store[k])) QtCore.QAbstractTableModel.__init__(self) def rowCount(self, parent): @@ -73,8 +74,8 @@ class DictSyncModel(QtCore.QAbstractTableModel): return self.convert(k, self.backing_store[k], index.column()) def headerData(self, col, orientation, role): - if (orientation == QtCore.Qt.Horizontal - and role == QtCore.Qt.DisplayRole): + if (orientation == QtCore.Qt.Horizontal and + role == QtCore.Qt.DisplayRole): return self.headers[col] return None @@ -84,8 +85,8 @@ class DictSyncModel(QtCore.QAbstractTableModel): while lo < hi: mid = (lo + hi)//2 if (self.sort_key(self.row_to_key[mid], - self.backing_store[self.row_to_key[mid]]) - < self.sort_key(k, v)): + self.backing_store[self.row_to_key[mid]]) < + self.sort_key(k, v)): lo = mid + 1 else: hi = mid @@ -152,8 +153,8 @@ class ListSyncModel(QtCore.QAbstractTableModel): index.column()) def headerData(self, col, orientation, role): - if (orientation == QtCore.Qt.Horizontal - and role == QtCore.Qt.DisplayRole): + if (orientation == QtCore.Qt.Horizontal and + role == QtCore.Qt.DisplayRole): return self.headers[col] return None @@ -204,8 +205,8 @@ class _DictSyncTreeSepItem: self.is_node = False def __repr__(self): - return ("" - .format(self.name, self.row, len(self.children_by_row))) + return ("". + format(self.name, self.row, len(self.children_by_row))) def _bisect_item(a, name): @@ -246,8 +247,8 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel): return len(self.headers) def headerData(self, col, orientation, role): - if (orientation == QtCore.Qt.Horizontal - and role == QtCore.Qt.DisplayRole): + if (orientation == QtCore.Qt.Horizontal and + role == QtCore.Qt.DisplayRole): return self.headers[col] return None @@ -301,7 +302,7 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel): next_item.row += 1 name_dict[name] = item self.endInsertRows() - + return item def __setitem__(self, k, v):