Skip to content

Commit

Permalink
Merge pull request #237 from zhujun98/fix_master_slave_mode_bug
Browse files Browse the repository at this point in the history
Fix master-slave reset bug
  • Loading branch information
zhujun98 authored Jun 23, 2020
2 parents 2eabc24 + 875b676 commit 4af4aa2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions extra_foam/gui/windows/correlation_w.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,18 @@ def refresh(self):
self._resolution = 0

self._plot.setData(item.x, y)
if y_slave is not None and len(y_slave) > 0:
# The following code looks awkward but it is by far
# the best solution. The user could choose to deactivate
# the master-slave mode and keep the slave data there.
# In this case, a legend is still required. Therefore,
# we cannot toggle the legend by the signal from the
# master-slave checkbox in the GUI.
if y_slave is not None:
self._plot_slave.setData(item.x_slave, y_slave)
self.showLegend()
if len(y_slave) > 0:
self.showLegend()
else:
self.hideLegend()
else:
self.hideLegend()
else:
Expand All @@ -84,11 +93,14 @@ def refresh(self):
self._resolution = resolution

self._plot.setData(item.x, y.avg, y_min=y.min, y_max=y.max)
if y_slave is not None and len(y_slave.avg) > 0:
if y_slave is not None:
self._plot_slave.setData(
item.x_slave, y_slave.avg,
y_min=y_slave.min, y_max=y_slave.max)
self.showLegend()
if len(y_slave.avg) > 0:
self.showLegend()
else:
self.hideLegend()
else:
self.hideLegend()

Expand Down

0 comments on commit 4af4aa2

Please sign in to comment.