Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix faulty label visibility behaviour described in #451 #452

Merged
merged 1 commit into from
May 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/urh/controller/CompareFrameController.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,17 +849,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 @@ -894,13 +889,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