Skip to content

Commit

Permalink
fix faulty label visibility behaviour described in #451
Browse files Browse the repository at this point in the history
  • Loading branch information
jopohl committed May 30, 2018
1 parent 93dd981 commit 2dd16d9
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/urh/controller/CompareFrameController.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,17 +850,12 @@ def set_show_only_status(self):
def show_only_labels(self):
visible_columns = set()
for msg in self.proto_analyzer.messages:
for lbl in msg.message_type:
if lbl.show:
start, end = msg.get_label_range(lbl=lbl, view=self.ui.cbProtoView.currentIndex(),
decode=True)
visible_columns |= (set(range(start, end)))
for lbl in filter(lambda lbl: lbl.show, msg.message_type):
start, end = msg.get_label_range(lbl=lbl, view=self.ui.cbProtoView.currentIndex(), decode=True)
visible_columns |= set(range(start, end))

for i in range(self.protocol_model.col_count):
if i in visible_columns:
self.ui.tblViewProtocol.showColumn(i)
else:
self.ui.tblViewProtocol.hideColumn(i)
self.ui.tblViewProtocol.setColumnHidden(i, i not in visible_columns)

def show_only_diffs(self):
visible_rows = [i for i in range(self.protocol_model.row_count) if not self.ui.tblViewProtocol.isRowHidden(i)
Expand Down Expand Up @@ -895,13 +890,12 @@ def show_only_diffs_and_labels(self):
self.ui.tblViewProtocol.hideColumn(j)

def restore_visibility(self):
selected = self.ui.tblViewProtocol.selectionModel().selection()
""":type: QtWidgets.QItemSelection """
selected = self.ui.tblViewProtocol.selectionModel().selection() # type: QItemSelection

for i in range(self.protocol_model.col_count):
self.ui.tblViewProtocol.showColumn(i)

for lbl in self.proto_analyzer.protocol_labels:
for lbl in filter(lambda lbl: not lbl.show, self.proto_analyzer.protocol_labels):
self.set_protocol_label_visibility(lbl)

if not selected.isEmpty():
Expand Down

0 comments on commit 2dd16d9

Please sign in to comment.