Hello I have an error in ignition 7.9.21 that I cannot figure out. I am new to ignition. The script and error are below. The error is coming from a button press that is linked to the script. In the script tools there is no error though.
Error in first box is actionperformed but still pops up my GUI.
Traceback (most recent call last):
File "<event:actionPerformed>", line 1, in <module>
TypeError: 'com.inductiveautomation.ignition.common.script.ScriptModule' object is not callable
Ignition v7.9.21 (b2022072613)
Java: Oracle Corporation 1.8.0_371
from javax.swing import JFrame, JTextField, JTextArea, JScrollPane, JButton, JPanel
from java.awt import BorderLayout
from java.awt.event import ActionListener, KeyAdapter, KeyEvent
from java.awt import GridLayout
def process_user_input():
user_input = input_field.getText()
output_area.append("User: " + user_input + "\n")
input_field.setText("")
response = ""
if user_input.lower() == "hello":
response = "Hello! How can I assist you?"
elif user_input.lower() == "goodbye":
response = "Goodbye! Have a great day!"
elif user_input.lower() == "stuck in back-to-bottom?":
display_new_question_set()
return
elif user_input.lower() == "pump not ramping up?":
response = "To troubleshoot 'Pump not ramping up?', you can try the following:\n\n" \
"1. Check if Edge Autopilot is enabled and pumps are turned on from the Native system.\n" \
"2. Check if IBOP is open.\n" \
"3. If it still does not work, please call the hotline at (+1832-459-4507)."
else:
response = "I'm sorry, I didn't understand that. Can you please rephrase?"
output_area.append("Bot: " + response + "\n")
def display_new_question_set():
question_panel.removeAll()
new_questions = [
"Pump not ramping up?",
"Rotary not ramping up?",
"Not lowering the blocks?",
"Auto-Zeroes not working?"
]
for question in new_questions:
question_button = JButton(question)
question_button.addActionListener(question_button_clicked)
question_panel.add(question_button)
frame.revalidate()
frame.repaint()
def question_button_clicked(event):
question = event.getActionCommand()
input_field.setText(question)
process_user_input()
frame = JFrame("Chatbot")
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
frame.setSize(400, 300)
frame.setLayout(BorderLayout())
input_field = JTextField()
frame.add(input_field, BorderLayout.NORTH)
output_area = JTextArea()
output_area.setEditable(False)
scroll_pane = JScrollPane(output_area)
frame.add(scroll_pane, BorderLayout.CENTER)
question_panel = JPanel()
question_panel.setLayout(GridLayout(2, 2))
# Add the "Stuck in Back-to-bottom?" question as a subset question
stuck_question_button = JButton("Stuck in Back-to-bottom?")
stuck_question_button.addActionListener(lambda event: display_new_question_set())
question_panel.add(stuck_question_button)
# Add additional subset questions
subset_questions = [
"Pump not ramping up?",
"Rotary not ramping up?",
"Not lowering the blocks?",
"Auto-Zeroes not working?"
]
for question in subset_questions:
question_button = JButton(question)
question_button.addActionListener(question_button_clicked)
question_panel.add(question_button)
frame.add(question_panel, BorderLayout.SOUTH)
frame.setVisible(True)```