Hi all,
I have a perspective application that currently handles barcode scanning through session events. There is also a script in the Project Library that I use to output any error messages with a popup. This script sits in the functions
file within the project library, so I use that to access the function itself, shown below
def show_error_popup(header, message):
system.perspective.openPopup('error-popup', 'error-popup', params = {'header': header, 'message': message}, modal=True, draggable=True, resizable=False, closable=True )
Then the session event for onBarcodeDataReceived
has the following setup, where I check which type of barcode is expected, and query the database to see if it exists.
valueNotFound = 'Scanned item was not found, please verify that it is a valid warehouse barcode'
if context['event'] == 'scan':
# clicked to scan container
if context['barcode_type'] == 'container':
params = { 'container_uuid': data['text'] }
try:
res = system.db.runNamedQuery('check-container-type', params)
functions.show_error_popup('debug', res)
session.custom.scannedData.container = { 'data': data['text'] }
except:
functions.show_error_popup('WARNING', valueNotFound)
I believe it is failing when I call functions.show_error_popup()
. Is there any way to get access to those project library scripts within the session events?