CRESS-Surrey / eXtraWidgets

An extension for creating additional interface tabs in the NetLogo GUI and putting custom widgets on them.
MIT License
13 stars 4 forks source link

Internal Error when building extra widgets #161

Closed ftho closed 6 years ago

ftho commented 7 years ago

I get this internal error every time when i build extra widgets using the xw-extension, e.g. using a startup call or when using xw:import. All widgets work fine and pushing the button "dont show again" suppresses the error further as long as netlogo remains open. However when restarting netlogo the error occurs again. Is there any way to suppress this error so it wont re-appear when starting netlogo? or even better, a way to detect what is causing this error? btw using Netlogo 5.3.1 thanks in advance. br Flemming

NetLogo is unable to supply you with more details about this error. Please report the problem at https://github.com/NetLogo/NetLogo/issues, or to bugs@ccl.northwestern.edu, and paste the contents of this window into your report.

java.security.PrivilegedActionException: uk.ac.surrey.xw.api.XWException: Tab t1 not in application tabs. at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: uk.ac.surrey.xw.api.XWException: Tab t1 not in application tabs. at uk.ac.surrey.xw.api.Tab$$anonfun$index$2.apply(Tab.scala:70) at uk.ac.surrey.xw.api.Tab$$anonfun$index$2.apply(Tab.scala:70) at scala.Option.getOrElse(Option.scala:108) at uk.ac.surrey.xw.api.Tab.index(Tab.scala:70) at uk.ac.surrey.xw.api.Tab.removeFromAppTabs(Tab.scala:102) at uk.ac.surrey.xw.gui.GUI$$anonfun$uk$ac$surrey$xw$gui$GUI$$removeWidget$1.apply(GUI.scala:78) at uk.ac.surrey.xw.gui.GUI$$anonfun$uk$ac$surrey$xw$gui$GUI$$removeWidget$1.apply(GUI.scala:77) at scala.Option.foreach(Option.scala:197) at uk.ac.surrey.xw.gui.GUI.uk$ac$surrey$xw$gui$GUI$$removeWidget(GUI.scala:77) at uk.ac.surrey.xw.gui.GUI$$anonfun$notify$3.apply$mcV$sp(GUI.scala:48) at uk.ac.surrey.xw.gui.GUI$$anonfun$notify$3.apply(GUI.scala:48) at uk.ac.surrey.xw.gui.GUI$$anonfun$notify$3.apply(GUI.scala:48) at uk.ac.surrey.xw.api.package$$anon$1.run(package.scala:28) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) ... 9 more

NetLogo 5.3.1 main: org.nlogo.app.AppFrame thread: AWT-EventQueue-0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_74 (Oracle Corporation; 1.8.0_74-b02) operating system: Windows 7 6.1 (amd64 processor) Scala version 2.9.2 JOGL: (3D View not initialized) OpenGL Graphics: (3D View not initialized) model: SRAAM_dev_gui_v2

08:53:57.722 OutputEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 08:53:57.682 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0 08:53:57.682 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0 08:53:57.681 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0 08:53:57.675 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0 08:53:56.246 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0 08:53:56.246 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0 08:53:56.246 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0 08:53:56.246 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0 08:53:56.246 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0

nicolaspayette commented 7 years ago

The extension should certainly give a better error message, but I suspect the part about:

Tab t1 not in application tabs.

has something to do with it.

Do you have a tab "t1"? Are you trying to reference it somewhere?

ftho commented 7 years ago

Hi Nicolas Thank you for your prompt response! Yes I have a tab “t1”, and no I don’t have a reference to it anywhere except in an export/import call, but this is not called during startup. Here is the code building the tab : Best regards Flemming

to startup

createtab1 ;createtab2 ;createtab3

end

to createtab1

set IBMLIBdir "ibmrun" set SimParFile "simpar.txt"

;** ;** ;*** Simulation tab ;** ;**

xw:clear-all xw:create-tab "t1" [ xw:set-title "Simulation" ]

;** ;*** Hydrographic input ;**

xw:create-note "note-hydro"[ xw:set-text "Hydrographic input" xw:set-font-size 30 xw:set-width 300 xw:set-height 50 ]

xw:create-note "note-workdir"[ xw:set-text "Set working directory:" xw:set-font-size 18 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height] xw:of "note-hydro" ]

xw:create-text-input "workdir" [ xw:set-label "Working directory:" xw:set-text "C:/root/SRAAM/" xw:set-font-size 14 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-workdir" xw:set-color orange ]

xw:create-note "note-HDdata"[ xw:set-text "Select Hydrographic data format:" xw:set-font-size 18 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height + 5] xw:of "workdir" ]

xw:create-chooser "chooser-HDdata" [ xw:set-label "Select Hydrographic data format:" xw:set-font-size 14 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-HDdata" xw:set-color orange xw:set-items (list "Stationary_flow_field" "HBM" "POM") ]

;** ;*** Create Simulation settings input GUI ;**

xw:create-note "note-simpar"[ xw:set-text "Simulation settings" xw:set-font-size 30 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height + 50] xw:of "chooser-HDdata" ]

;*** simulation start end time

xw:create-note "note-simdur"[ xw:set-text "Simulation start and end time..." xw:set-font-size 18 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-simpar" ]

xw:create-text-input "Start_time" [ xw:set-label "Start_time" xw:set-text "2009 03 02 0" xw:set-font-size 14 xw:set-width 120 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-simdur" xw:set-color yellow xw:set-font-color black ]

xw:create-text-input "End_time" [ xw:set-label "End_time" xw:set-text "2009 06 03 0" xw:set-font-size 14 xw:set-width 120 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-simdur" xw:set-x [ xw:x + xw:width + 10 ] xw:of "Start_time" xw:set-color yellow xw:set-font-color black ]

xw:create-text-input "timestep" [ xw:set-label "Time step" xw:set-text "1800" xw:set-font-size 14 xw:set-width 80 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-simdur" xw:set-x [ xw:x + xw:width + 10 ] xw:of "End_time" xw:set-color yellow xw:set-font-color black ]

;*** simulation result storing frequency

xw:create-note "note-simstor"[ xw:set-text "Simulation results storing frequency..." xw:set-font-size 18 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "Start_time" ]

xw:create-numeric-input "storefreq" [ xw:set-label "Storing Frequency" xw:set-value 86400 xw:set-font-size 14 xw:set-width 150 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-simstor" xw:set-color yellow xw:set-font-color black ]

;*** simulation result file

xw:create-note "note-simres"[ xw:set-text "Simulation result file name" xw:set-font-size 18 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "storefreq" ]

xw:create-text-input "simres" [ xw:set-label "File Name" xw:set-text "results_staticHD_1000.nc" xw:set-font-size 14 xw:set-width 300 xw:set-height 50 xw:set-y [ xw:y + xw:height ] xw:of "note-simres" xw:set-color yellow xw:set-font-color black ]

;*** Run IBM Lib

xw:create-note "note-IBMlib"[
xw:set-text "Run Simulation!"
xw:set-font-size 30
xw:set-width 300
xw:set-height 50
xw:set-y [ xw:y + xw:height + 20 ] xw:of "simres"

]

xw:create-button "runibm" [ xw:set-label "Run IBMLib" xw:set-commands "xw:select-tab 1 runibmlib" xw:set-y [ xw:y + xw:height + 10 ] xw:of "note-IBMlib" ]

;***** save / load settings

xw:create-button "savegui" [ xw:set-label "Save Settings" xw:set-commands "savesettings1" xw:set-y [ xw:y + xw:height + 30 ] xw:of "runibm"

]

xw:create-button "loadgui" [ xw:set-label "Load Settings" xw:set-commands "loadsettings1" xw:set-y [ xw:y + xw:height + 30 ] xw:of "runibm" xw:set-x [ xw:x + xw:width + 10 ] xw:of "savegui" ]

xw:select-tab 1 ; show our newly created tab

end

;** ;** ;* Save load Tab input ;** ;***

to savesettings1 xw:export "t1.json" end

to loadsettings1 if user-yes-or-no? "Reload previous settings?" [ xw:clear-all xw:import "t1.json" ] end

From: Nicolas Payette [mailto:notifications@github.com] Sent: 05 May 2017 09:16 To: CRESS-Surrey/eXtraWidgets Cc: Flemming Thorbjørn Hansen; Author Subject: Re: [CRESS-Surrey/eXtraWidgets] Internal Error when building extra widgets (#161)

The extension should certainly give a better error message, but I suspect the part about:

Tab t1 not in application tabs.

has something to do with it.

Do you have a tab "t1"? Are you trying to reference it somewhere?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/CRESS-Surrey/eXtraWidgets/issues/161#issuecomment-299398365, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXYoVJYLHRgFEhKNwYd-WoGd8Y2SFoc2ks5r2szBgaJpZM4NRkDL.

nicolaspayette commented 7 years ago

Thanks for sharing your code! I am going to give you the frustrating answer, however: it works for me.

You already said you're on NetLogo 5.3.1. Are you using release 1.1.0 of xw? (https://github.com/CRESS-Surrey/eXtraWidgets/releases/tag/v1.1.0)

And I'm assuming you're on Windows, given the "C:" in your path. Any chance you can try it on another platform? I developed this thing on Linux, but I have seen platform dependent bugs before (e.g. #143).

nicolaspayette commented 6 years ago

Given that I'm unable to reproduce the problem and that I'm trying to get out a release for NetLogo 6.0.2, I'm going to close this issue for now. Feel free to reopen if it still doesn't work for you in 6.0.2.