Skip to content

WIP Virtual Devices BLACS Plugin #105

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions blacs/output_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ def remove_widget(self,widget,call_set_AO = True,new_AO = None):

# Further cleanup
widget.disconnect_value_change()
widget.block_combobox_signals()
widget.set_combobox_model(QStandardItemModel())
widget.unblock_combobox_signals()

def change_unit(self,unit,program=True):
# These values are always stored in base units!
Expand Down Expand Up @@ -492,7 +494,8 @@ def create_widget(self, *args, **kwargs):
def add_widget(self, widget, inverted=False):
if widget not in self._widget_list:
widget.set_DO(self,True,False)
widget.toggled.connect(self.set_value if not inverted else lambda state: self.set_value(not state))
widget.toggled.connect(self.set_value if not inverted else self.set_value_inverted)
widget.connection_inverted = inverted
self._widget_list.append(widget)
self.set_value(self._current_state,False)
self._update_lock(self._locked)
Expand All @@ -503,7 +506,10 @@ def remove_widget(self,widget):
if widget not in self._widget_list:
# TODO: Make this error better!
raise RuntimeError('The widget specified was not part of the DO object')
widget.toggled.disconnect(self.set_value)
if widget.connection_inverted:
widget.toggled.disconnect(self.set_value_inverted)
else:
widget.toggled.disconnect(self.set_value)
self._widget_list.remove(widget)

@property
Expand Down Expand Up @@ -547,7 +553,10 @@ def set_value(self,state,program=True):
widget.blockSignals(True)
widget.state = state
widget.blockSignals(False)


def set_value_inverted(self,state,program=True):
self.set_value(not state, program)

@property
def name(self):
return self._hardware_name + ' - ' + self._connection_name
Expand Down
Loading