Skip to content

Commit

Permalink
Merge pull request #424 from klauer/issue_404
Browse files Browse the repository at this point in the history
FIX: signal_name_to_info changed during iteration
  • Loading branch information
klauer authored Feb 22, 2021
2 parents 003cf48 + 4d60c63 commit 22a3a55
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions typhos/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def signals(self):
"""
return {
name: info['signal']
for name, info in self.signal_name_to_info.items()
for name, info in list(self.signal_name_to_info.items())
if info['signal'] is not None
}

Expand All @@ -169,7 +169,7 @@ def visible_signals(self):
"""
return {
name: info['signal']
for name, info in self.signal_name_to_info.items()
for name, info in list(self.signal_name_to_info.items())
if info['signal'] is not None and info['visible']
}

Expand Down Expand Up @@ -227,9 +227,10 @@ def _got_signal_widget_info(self, obj, info):
for widget in widgets[1:]:
widget.setVisible(visible)

signal_pairs = list(self.signal_name_to_info.items())
if all(sig_info['widget_info'] is not None
for name, sig_info in self.signal_name_to_info.items()):
self.loading_complete.emit(list(self.signal_name_to_info))
for _, sig_info in signal_pairs):
self.loading_complete.emit([name for name, _ in signal_pairs])

def _create_row_label(self, attr, dotted_name, tooltip):
"""Create a row label (i.e., the one used to display the name)."""
Expand Down Expand Up @@ -539,7 +540,7 @@ def filter_signals(self, kinds, name_filter=None):
name_filter : str, optional
Additionally filter signals by name.
"""
for name, info in self.signal_name_to_info.items():
for name, info in list(self.signal_name_to_info.items()):
item = info['signal'] or info['component']
visible = self._should_show(item.kind, name,
kinds=kinds, name_filter=name_filter)
Expand Down

0 comments on commit 22a3a55

Please sign in to comment.