Skip to content

Commit 3ab11ce

Browse files
authoredJan 16, 2025
Merge pull request #109 from carterturn/cartertu-digitaloutput-inverted-fix
Handling inverted for DigitalOutput set_DO
2 parents 5e3fb28 + 09b6249 commit 3ab11ce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎labscript_utils/qtwidgets/digitaloutput.py

Lines changed: 5 additions & 2 deletions
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+
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)
Failed to load comments.