From 26344e6802ebe0da68fc241e43b117304b20a4ca Mon Sep 17 00:00:00 2001 From: Carter Turn Date: Tue, 2 May 2023 09:08:08 -0400 Subject: [PATCH 1/2] Fix the set_DO function for InvertedDigitalOutput --- labscript_utils/qtwidgets/digitaloutput.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/labscript_utils/qtwidgets/digitaloutput.py b/labscript_utils/qtwidgets/digitaloutput.py index 0704d6d..1821119 100644 --- a/labscript_utils/qtwidgets/digitaloutput.py +++ b/labscript_utils/qtwidgets/digitaloutput.py @@ -30,13 +30,13 @@ def __init__(self,*args,**kwargs): self._DO = None # Setting and getting methods for the Digitl Out object in charge of this button - def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True): + def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True,inverted=False): # If we are setting a new DO, remove this widget from the old one (if it isn't None) and add it to the new one (if it isn't None) if DO != self._DO: if self._DO is not None and notify_old_DO: self._DO.remove_widget(self) if DO is not None and notify_new_DO: - DO.add_widget(self) + DO.add_widget(self, inverted) # Store a reference to the digital out object self._DO = DO @@ -93,6 +93,9 @@ def state(self,state): class InvertedDigitalOutput(DigitalOutput): + def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True,inverted=True): + return DigitalOutput.set_DO(self, DO, notify_old_DO, notify_new_DO, inverted) + @property def state(self): return not DigitalOutput.state.fget(self) From 09b624998907aef7ececaa98689a1ffbd13c4478 Mon Sep 17 00:00:00 2001 From: Carter Turn Date: Tue, 30 May 2023 19:02:07 -0400 Subject: [PATCH 2/2] Removed unneeded return --- labscript_utils/qtwidgets/digitaloutput.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labscript_utils/qtwidgets/digitaloutput.py b/labscript_utils/qtwidgets/digitaloutput.py index 1821119..54a73e2 100644 --- a/labscript_utils/qtwidgets/digitaloutput.py +++ b/labscript_utils/qtwidgets/digitaloutput.py @@ -94,7 +94,7 @@ def state(self,state): class InvertedDigitalOutput(DigitalOutput): def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True,inverted=True): - return DigitalOutput.set_DO(self, DO, notify_old_DO, notify_new_DO, inverted) + DigitalOutput.set_DO(self, DO, notify_old_DO, notify_new_DO, inverted) @property def state(self):