Disable Tag Images button when prediction is ongoing

This commit is contained in:
Denis-Cosmin NUTIU 2024-05-04 16:37:32 +03:00
parent 470491d9ac
commit cc62cc9fce
2 changed files with 9 additions and 2 deletions

View file

@ -67,6 +67,9 @@ class MainPageController {
@FXML
private lateinit var cancelButton: Button
@FXML
lateinit var tagImagesButton: Button
/**
* Initializes the controller. Needs to be called after the dependencies have been injected.
*/
@ -83,7 +86,10 @@ class MainPageController {
synchronized(this) {
val fileChooser = FileChooser().apply { title = "Choose images" }
val filePaths = fileChooser.showOpenMultipleDialog(null) ?: return
if (tagImagesButton.isDisable) {
return
}
tagImagesButton.isDisable = true
isCurrentTagsOperationCancelled = false
progressBar.isVisible = true
cancelButton.isVisible = true
@ -167,6 +173,7 @@ class MainPageController {
if (processedImageFilesCount.get() == imageFilesTotal) {
progressBar.isVisible = false
cancelButton.isVisible = false
tagImagesButton.isDisable = false
logger.info("Finished processing images.")
}
}

View file

@ -19,7 +19,7 @@
<padding>
<Insets bottom="5" left="5" right="5"/>
</padding>
<Button onAction="#onTagImagesButtonClick" text="Tag Images">
<Button fx:id="tagImagesButton" onAction="#onTagImagesButtonClick" text="Tag Images">
<graphic>
<FontIcon iconLiteral="far-images" iconSize="16"/>
</graphic>