-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Indev * Table Views part 1 * Indev * Add dialogs * Task configurators * Use original file names * Implement logging & other features * Job config panel skinning * Make widgets static, add defaults configuration * WIP add files dialog, expanded Output module, progressbar listeners * Shared output module widgets, more css, Output tasks now control working dir. * Refactor i/o calculation sequence, style primary window * Bug fixes, improve directory selection widgets * Add directWrite output option, centralise workflow list, improve workflow name handling, add confirmation dialogs * Skin additional dialogs, resolve bugs * Styling tweaks * UI revisions, status bar, settings import/export * Fix "open directory" button for Windows * Style fixes * Skin about dialog * Handle jobs failing before start event. Add Taskbar/dock progress display * Stop a running job without killing entire task list * Copyright statements * Add update dialog * Fix taskbar * Notify popup on completion * Use native res logo * Pin table header heights * Use glencoe version json for update check * Implement progressbars * Update about dialog * Reset via picocli defaults * Don't delete initial input files during cleanup when steps were skipped * Disable debug statements * Exclude CreateNGFF step from ConvertToTiff when input is NGFF * Execution system revisions, bug fixes * Button behaviour tweaks * Code style and css tweaks * Completed Todo * Style progress bars * Unify progress listeners * Use exit events rather than Platform when closing GUI * Update b2r and r2o versions * Declare bf dependency * Fix global progress bar * Replace old b2r/r2o help windows with docs links * Ignore pre-release tags in version checker * Increment version * Jpackage doesn't allow -beta/-rc/-snapshot versions * GUI tweaks for Windows * Drop unified stage style * Clarify logging on aborted runs * Fix off-by-1 error on conversion counter * Release drag handler before processing dropped files * Cleanup * Apply chosen settings before trying to save defaults/export * Add "Add Folder" menu option for manually selecting zarrs * Fix drag/drop on Windows * Improve "Run Jobs" button state handling * Drop unused import * Fix "apply to all" * Fix window hierarchy * Fix tiff compression settings loader * Improve applySettings reliability and add warning system * Only perform UI updates on UI thread * Validate output write status * Fix directwrite mode * Rename output configurator menu option * Change b2rhelp link * Update NoValidFiles error message * Completed todo * Explicitly clean zarr folders before trying to delete * Add exception handler * Tweak progress listener text * Fix output write access check * Link 'Set Default' in AddFilesDialog to 'Do not show again' * Fix invalid setting export * Bump bioformats/bioformats2raw/raw2ometiff versions, handle new settings * Revise file copy system to account for split-planes mode * Don't set default compressionoptions if missing * Move notification popup on MacOS * Improve JSON read error handling * Tweak job name text overrun * Drop Output module checking of directwrite results * Add basic usage docs * Add program help menu item * Reduce screenshot size * Undupe license docs * Ensure correct extensions when setting custom output file names * Drop unnecessary semicolon * Update changelog
- Loading branch information
1 parent
55fee48
commit a75600f
Showing
56 changed files
with
6,176 additions
and
1,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/** | ||
* Copyright (c) 2022 Glencoe Software, Inc. All rights reserved. | ||
* | ||
* Copyright (c) 2023 Glencoe Software, Inc. All rights reserved. | ||
* This software is distributed under the terms described by the LICENSE.txt | ||
* file you can find at the root of the distribution bundle. If the file is | ||
* missing please request a copy by contacting [email protected] | ||
|
@@ -12,39 +11,86 @@ | |
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.Alert; | ||
import javafx.scene.control.ButtonType; | ||
import javafx.scene.image.Image; | ||
import javafx.stage.Stage; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
import java.util.concurrent.BlockingQueue; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ThreadPoolExecutor; | ||
|
||
/** | ||
* JavaFX App | ||
*/ | ||
public class App extends Application { | ||
|
||
private static Scene scene; | ||
private static PrimaryController controller; | ||
public static Scene scene; | ||
|
||
public static PrimaryController controller; | ||
|
||
public static String version; | ||
|
||
public static Image appIcon = new Image(Objects.requireNonNull(App.class.getResourceAsStream("main-icon.png"))); | ||
|
||
static { | ||
version = App.class.getPackage().getImplementationVersion(); | ||
if (version == null) { version = "DEV"; } | ||
} | ||
|
||
@Override | ||
public void start(Stage stage) throws IOException { | ||
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("primary.fxml")); | ||
Parent primary = fxmlLoader.load(); | ||
scene = new Scene(primary, 800, 550); | ||
scene = new Scene(primary, 1024, 600); | ||
controller = fxmlLoader.getController(); | ||
|
||
Thread.setDefaultUncaughtExceptionHandler((Thread t, Throwable e) -> { | ||
if (Platform.isFxApplicationThread()) controller.showExceptionDialog(e); | ||
else System.err.println("An unexpected error occurred in " + t); | ||
}); | ||
|
||
stage.setScene(scene); | ||
stage.setTitle("NGFF-Converter"); | ||
Image icon = new Image(Objects.requireNonNull(getClass().getResourceAsStream("main-icon.png"))); | ||
stage.getIcons().add(icon); | ||
stage.setOnCloseRequest(event -> Platform.exit()); | ||
stage.setTitle("NGFF-Converter - %s".formatted(version)); | ||
stage.getIcons().add(appIcon); | ||
stage.setOnCloseRequest(event -> { | ||
if (controller.jobsRunning()) { | ||
// Confirm exit if tasks are running | ||
Alert choice = new Alert(Alert.AlertType.CONFIRMATION); | ||
choice.initOwner(getScene().getWindow()); | ||
choice.setTitle("Close NGFF-Converter"); | ||
choice.setHeaderText("Conversions are still running!"); | ||
choice.setContentText( | ||
"File conversions are still running, are you sure you want to quit?" | ||
); | ||
choice.getDialogPane().getStylesheets().add( | ||
Objects.requireNonNull(App.class.getResource("Alert.css")).toExternalForm()); | ||
choice.showAndWait().ifPresent(response -> { | ||
if (response == ButtonType.CANCEL) { | ||
event.consume(); | ||
} else { | ||
stop(); | ||
Platform.exit(); | ||
} | ||
}); | ||
} else { | ||
stop(); | ||
Platform.exit(); | ||
} | ||
} | ||
); | ||
stage.show(); | ||
} | ||
|
||
@Override | ||
public void stop() throws InterruptedException { | ||
if (controller.isRunning) { | ||
public void stop() { | ||
if (controller.jobsRunning()) { | ||
controller.runCancel(); | ||
} | ||
executor.shutdownNow(); | ||
} | ||
|
||
public static Scene getScene() { | ||
|
@@ -55,4 +101,13 @@ public static void main(String[] args) { | |
launch(); | ||
} | ||
|
||
public static final ExecutorService executor = Executors.newFixedThreadPool(1, r -> { | ||
Thread t = new Thread(r, "Converter"); | ||
t.setDaemon(true); | ||
return t ; | ||
}); | ||
|
||
private static final BlockingQueue<Runnable> queue = ((ThreadPoolExecutor) executor).getQueue(); | ||
|
||
public static int queueSize() { return queue.size(); } | ||
} |
Oops, something went wrong.