Skip to content

Commit 26344e6

Browse files
committed
Fix the set_DO function for InvertedDigitalOutput
1 parent b042db4 commit 26344e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

labscript_utils/qtwidgets/digitaloutput.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ def __init__(self,*args,**kwargs):
3030
self._DO = None
3131

3232
# Setting and getting methods for the Digitl Out object in charge of this button
33-
def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True):
33+
def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True,inverted=False):
3434
# 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)
3535
if DO != self._DO:
3636
if self._DO is not None and notify_old_DO:
3737
self._DO.remove_widget(self)
3838
if DO is not None and notify_new_DO:
39-
DO.add_widget(self)
39+
DO.add_widget(self, inverted)
4040
# Store a reference to the digital out object
4141
self._DO = DO
4242

@@ -93,6 +93,9 @@ def state(self,state):
9393

9494

9595
class InvertedDigitalOutput(DigitalOutput):
96+
def set_DO(self,DO,notify_old_DO=True,notify_new_DO=True,inverted=True):
97+
return DigitalOutput.set_DO(self, DO, notify_old_DO, notify_new_DO, inverted)
98+
9699
@property
97100
def state(self):
98101
return not DigitalOutput.state.fget(self)

0 commit comments

Comments
 (0)