diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingWebWidget.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingWebWidget.java index a195a01..ee52151 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingWebWidget.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingWebWidget.java @@ -311,6 +311,10 @@ public void loadCodeFromGist(String addr, WebEngine engine) this.addr = addr; this.engine = engine; loadGist = true; + fileListBox.valueProperty().removeListener(this); + Platform.runLater(()->runfx.setDisable(true)); + Platform.runLater(()->edit.setDisable(true)); + Platform.runLater(()->fileListBox.getItems().clear()); currentGist = ScriptingEngine.getCurrentGist(addr, engine).get(0); ArrayList fileList = ScriptingEngine.filesInGist(currentGist); @@ -318,12 +322,14 @@ public void loadCodeFromGist(String addr, WebEngine engine) if(fileList.size()==1) loadGistLocal(currentGist, fileList.get(0)); Platform.runLater(()->{ - fileListBox.getItems().clear(); + for(String s:fileList){ fileListBox.getItems().add(s); } fileListBox.setValue(fileList.get(0)); fileListBox.valueProperty().addListener(this); + Platform.runLater(()->runfx.setDisable(false)); + Platform.runLater(()->edit.setDisable(false)); }); } diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/tabs/ScriptingGistTab.java b/src/main/java/com/neuronrobotics/bowlerstudio/tabs/ScriptingGistTab.java index 0b1b15e..d3d3125 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/tabs/ScriptingGistTab.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/tabs/ScriptingGistTab.java @@ -121,21 +121,14 @@ public void run(){ finishLoadingComponents(); } - if(scripting==null) - finishLoadingComponents(); - System.out.println("Loading code from "+Current_URL); - try { - scripting.loadCodeFromGist(Current_URL, webEngine); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - //System.err.println("Done Loading to: "+webEngine.getLocation()); + else{ + try { + scripting.loadCodeFromGist(Current_URL, webEngine); + } catch (Exception e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + } } }.start(); @@ -289,53 +282,66 @@ private void finishLoadingComponents(){ }catch(Exception E){ E.printStackTrace(); } - finishedLoadingScriptingWidget=false; - try{ - scripting = new ScriptingWebWidget( null ,Current_URL, webEngine); - Platform.runLater(() -> { - vBox.getChildren().add(scripting); - if(!isTutorialTab){ - Platform.runLater(()->{ - try{ - - myTab.setText(scripting.getFileName()); - }catch(java.lang.NullPointerException ex){ - // web page contains no gist - ex.printStackTrace(); - myTab.setText("Web"); + new Thread() { + public void run() { + finishedLoadingScriptingWidget=false; + try{ + scripting = new ScriptingWebWidget( null ,Current_URL, webEngine); + Platform.runLater(() -> { + vBox.getChildren().add(scripting); + if(!isTutorialTab){ + Platform.runLater(()->{ + try{ + + myTab.setText(scripting.getFileName()); + }catch(java.lang.NullPointerException ex){ + // web page contains no gist + ex.printStackTrace(); + myTab.setText("Web"); + } + finishedLoadingScriptingWidget=true; + }); } - finishedLoadingScriptingWidget=true; + else + finishedLoadingScriptingWidget=true; }); - } - else + + }catch(Exception ex){ + ex.printStackTrace(); finishedLoadingScriptingWidget=true; - }); - - }catch(Exception ex){ - ex.printStackTrace(); - finishedLoadingScriptingWidget=true; - } + } + + while(!finishedLoadingScriptingWidget){ + ThreadUtil.wait(10); + } + System.out.println("Loading code from "+Current_URL); + try { + scripting.loadCodeFromGist(Current_URL, webEngine); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(firstBoot){ + firstBoot=false; + //now that the application is totally loaded check for connections to add - while(!finishedLoadingScriptingWidget){ - ThreadUtil.wait(10); - } - - if(firstBoot){ - firstBoot=false; - //now that the application is totally loaded check for connections to add - - new Thread() { - public void run() { - setName("Get First Connection"); - List devs = SerialConnection.getAvailableSerialPorts(); - if (devs.size() == 0) { - return; - } else { - DeviceManager.addConnection(); - } + new Thread() { + public void run() { + setName("Get First Connection"); + List devs = SerialConnection.getAvailableSerialPorts(); + if (devs.size() == 0) { + return; + } else { + DeviceManager.addConnection(); + } + } + }.start(); } - }.start(); - } + } + }.start(); } public String goBack() diff --git a/src/main/resources/com/neuronrobotics/bowlerstudio/build.properties b/src/main/resources/com/neuronrobotics/bowlerstudio/build.properties index 86fadb3..3805aa0 100644 --- a/src/main/resources/com/neuronrobotics/bowlerstudio/build.properties +++ b/src/main/resources/com/neuronrobotics/bowlerstudio/build.properties @@ -1,4 +1,4 @@ app.name=BowlerStudio -app.version=0.6.8 +app.version=0.6.9