Skip to content

Commit

Permalink
clean up the regeneration pathway
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Apr 10, 2024
1 parent bf850a3 commit dcbfb2f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void initializeUI(BowlerAbstractDevice pm) {

disable();
autoRegen.setOnAction(event -> {
baseManager.setAutoRegen(autoRegen.isSelected());
//BowlerStudio.runLater(() -> {
regenFromUiEvent();
//});
Expand Down Expand Up @@ -138,9 +139,6 @@ private void regenFromUiEvent() {
BowlerStudio.runLater(() -> {
if (autoRegen.isSelected()) {
disable();
}
baseManager.setAutoRegen(autoRegen.isSelected());
if (autoRegen.isSelected()) {
generateCad();
}
});
Expand Down Expand Up @@ -287,19 +285,19 @@ public void run() {
setCadMode(true);// start the UI in config mode
generateCad();

pi.progressProperty().addListener((observable, oldValue, newValue)-> {
//System.out.println("Progress listener " + newValue);
if (newValue.doubleValue() > 0.99) {
BowlerStudio.runLater(() -> {
enable();
});
}else {
BowlerStudio.runLater(() -> {
disable();
});
}

});
// pi.progressProperty().addListener((observable, oldValue, newValue)-> {
// //System.out.println("Progress listener " + newValue);
// if (newValue.doubleValue() > 0.99) {
// BowlerStudio.runLater(() -> {
// enable();
// });
// }else {
// BowlerStudio.runLater(() -> {
// disable();
// });
// }
//
// });
}
private void enable() {
autoRegen.setDisable(false);
Expand All @@ -320,8 +318,14 @@ private void setCadMode(boolean mode) {
}

public void generateCad() {
// new Exception().printStackTrace();
baseManager.generateCad();
BowlerStudio.runLater(()->{
disable();
});
baseManager.generateCadWithEnd(()->{
BowlerStudio.runLater(()->{
enable();
});
});
}

@Override
Expand Down

0 comments on commit dcbfb2f

Please sign in to comment.