-
Notifications
You must be signed in to change notification settings - Fork 3
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
Signal cleanup #99
base: master
Are you sure you want to change the base?
Signal cleanup #99
Changes from 2 commits
15bc06f
23a464a
67aaae7
efb5ef7
d690ff6
5a130cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ def update_title(filename): | |
title = 'AMI Client' | ||
if hutch: | ||
title += f' hutch: {hutch}' | ||
if filename: | ||
if filename is not None: | ||
title += ' - ' + filename.split('/')[-1] | ||
|
||
win.setWindowTitle(title) | ||
|
@@ -172,6 +172,7 @@ def __init__(self, msg, broker_addr="", graphmgr_addr="", checkpoint_addr="", lo | |
|
||
self.ctrlWidget = self.node.ctrlWidget(self.win) | ||
self.widget = None | ||
self.connected = False | ||
|
||
title = msg.name | ||
if hutch: | ||
|
@@ -230,9 +231,13 @@ def display(self, msg): | |
self.win.setCentralWidget(scrollarea) | ||
|
||
if msg.state and hasattr(self.widget, 'restoreState'): | ||
self.widget.blockSignals(True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do not block signals on the widget we cause a checkpoint to be emitted when restoring the state, which is unnecessary. |
||
self.widget.restoreState(msg.state) | ||
self.widget.blockSignals(False) | ||
|
||
self.node.sigStateChanged.connect(self.send_checkpoint) | ||
if not self.connected: | ||
self.node.sigStateChanged.connect(self.send_checkpoint) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are connecting the sigStateChanged signal multiple times. Whenever you close the window and reopen it we reconnect which causes N checkpoints to be sent each time you change the widget. |
||
self.connected = True | ||
|
||
self.win.show() | ||
if self.node.viewed: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated, but something that I noticed randomly. If you click new and then save it will save a chart as just '.fc'.