I was wondering if anyone knows of a method to get the error windows that Ignition throws and read them, then do something with that. Of course you could use a try block somewhere, but the idea of this is to have the ability to read any error message, for a kind of bug submission by users. I see the “com.inductiveautomation.ignition.client.util.gui.errors” set of classes in the javadocs but I’m not sure how to actually access these. Any ideas?
You can train your users to click the ‘send report’ button on the error dialog:
Wow, I see these all the time and I think I never really registered that button existing, let alone that it could be directed. So that does help, but I was hoping on being able to get some more info, maybe a screenshot or something, etc. So if anyone knows how to do this I’m still looking
I found it. I’ll post my test code but in general you have to .parent your way up to the original frame, then go down from there. The error panel always exists, it just gets turned on and off. So go all the way up, then go down.
def findErrorPanel(comp): ep = None try: for c in comp.getComponents(): try: if ".ErrorPanel" in str(type(c)): return c dd = findErrorPanel(c) if dd is not None: return dd except Exception, e: pass except: pass i = 0 par = self for i in range(35): if par is not None: typ = str(type(par)) try: getwindows = [w for w in par.getWindows()] errwindow = [w for w in getwindows if "title=Error" in str(w)] errcomp = errwindow.getComponent() try: errorpanel = findErrorPanel(errcomp.getComponent()) if errorpanel is not None: print errorpanel print "do stuff with it" except Exception, e: pass except: pass try: par = par.parent except: break
Looks like that top frame that holds the error panel holds pretty much the other popups too. Should also be said that doing this isn’t supported, can change in an update, etc.
Then theres this page on the ErrorPanel: http://files.inductiveautomation.com/sdk/javadoc/ignition79/790-beta1/com/inductiveautomation/ignition/client/util/gui/errors/ErrorPanel.html
You may be able to simplify some of that with SwingUtilities:
1000x this. In fact, depending on how you’re reading the text out, I can guarantee you you’ll have to change this around a bit in 7.9.9; the way the dialog renders weird text (extremely long lines, or many lines) changed around.
That’s a great tip there, on both counts there. Thanks!