I originally wrote this code with 8.1.24, there has been a lot of stuff to happen so I'm not sure exactly what is causing my script to stop working correctly. Seems like there is a change in how Ignition handle mouseDown/mouseUp events. When I click and hold a button with this code, it automatically performs the < 1s action instead of waiting for my finger to lift off the mouse button. (I am still holding down the button when the mouseUp event triggers.
Here is my onMouseDown event script:
def runAction(self, event):
import time
self.custom.mouseDown = time.time()
here is my onMouseUp script:
def runAction(self, event):
import time
import utils
if (time.time() - self.custom.mouseDown) < 1:
params = {
'action': 'func',
'stub': 'canPerformQCCheck',
'func': 'requestQCCheck',
'label': 'Request QC Check',
'kwargs': {
'line': self.view.params.line
}
}
system.perspective.openPopup("badgeScanPopup", 'Components/Badge Scan', params)
else:
params = {
'action': 'func',
'stub': 'canPerformQCCheck',
'func': 'clearQCCheck',
'label': 'Clear QC Check',
'kwargs': {
'line': self.view.params.line
}
}
system.perspective.openPopup("badgeScanPopup", 'Components/Badge Scan', params)
Anyone see a error in my script or is there something else going on?