Bug fixes to FX GUI

This commit is contained in:
Jamie Mac 2022-04-28 10:52:28 +01:00
parent 1f86738f2d
commit b0f5ce85a8
5 changed files with 47 additions and 38 deletions

View File

@ -7,6 +7,7 @@ import Acquisition.FolderInputSystem;
import Acquisition.WavFileFuncs;
import PamUtils.PamAudioFileFilter;
import javafx.geometry.Insets;
import javafx.application.Platform;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
@ -89,6 +90,8 @@ public class CheckWavHeadersPane extends PamBorderPane {
*/
private SimpleDoubleProperty progressProperty = new SimpleDoubleProperty(0);
private PamButton runButton;
/**
* Constructor for the CheckWavHeadersPane
* @param folderInputSystem - the folder input system.
@ -102,20 +105,19 @@ public class CheckWavHeadersPane extends PamBorderPane {
this.folderInputSystem=folderInputSystem;
folderName = new Label(" ");
PamGuiManagerFX.titleFont2style(folderName);
//PamGuiManagerFX.titleFont2style(folderName);
textArea = new TextArea();
textArea.setEditable(false);
ScrollPane scrollPane = new ScrollPane(textArea);
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
//scrollPane.setPrefSize(322, 300);
this.setCenter(scrollPane);
PamHBox pamHBox = new PamHBox();
pamHBox.setAlignment(Pos.CENTER_LEFT);
pamHBox.setSpacing(5);
PamButton runButton = new PamButton();
runButton = new PamButton();
runButton.setGraphic(PamGlyphDude.createPamIcon("mdi2p-play"));
runButton.setOnAction((action)->{
checkFiles();
@ -128,15 +130,15 @@ public class CheckWavHeadersPane extends PamBorderPane {
pamHBox.getChildren().addAll(runButton, progressBar);
progressBar.setMaxWidth(Double.MAX_VALUE);
mainPane.getChildren().addAll(folderName, textArea, pamHBox);
this.setPadding(new Insets(5,0,5,15));
this.setCenter(mainPane);
this.setPadding(new Insets(5,0,5,15));
}
private void setParams() {
void setParams() {
running = ran = false;
subFolders = folderInputSystem.getFolderInputParameters().subFolders;
if (subFolders) {
@ -149,7 +151,7 @@ public class CheckWavHeadersPane extends PamBorderPane {
textArea.setText(" ");
allFiles.clear();
nFiles = countFiles(folder);
progressBar.setProgress(0);
progressProperty.setValue(0);
progressBar.progressProperty().bind(progressProperty);
//progressBar.setMaximum(Math.max(nFiles, 1));
enableControls();
@ -213,6 +215,10 @@ public class CheckWavHeadersPane extends PamBorderPane {
nErrors = 0;
enableControls();
checkFilesWorker = new CheckFiles();
Thread th = new Thread(checkFilesWorker);
th.setDaemon(true);
th.start();
}
@ -245,10 +251,16 @@ public class CheckWavHeadersPane extends PamBorderPane {
* for each file, report on progress with it's name and
* whether or not it had an error
*/
int error;
File aFile;
System.out.println("Analaysing files: Start: " + allFiles.size() );
for (int i = 0; i < allFiles.size(); i++) {
error = checkFile(aFile = allFiles.get(i));
System.out.println("Analaysing files: " + i);
final int error = checkFile(aFile = allFiles.get(i));
final File aFile1 = aFile;
Platform.runLater(()->{
textArea.appendText(String.format("\n File %s %s" , aFile1.getName() ,
error == AudioFileFuncs.FILE_OK ? "OK" : ("Error " + error)));
});
//progressBar.progressProperty().bind(null);
progressProperty.setValue(100*i/(double) allFiles.size());
}

View File

@ -304,6 +304,7 @@ public class FolderInputPane extends DAQSettingsPane<FolderInputParameters>{
wavFix.setOnAction((action)->{
acquisitionPaneFX.getAdvancedLabel().setText("Fix Wave Files");
acquisitionPaneFX.getAdvancedPane().setCenter(this.fixWavPane);
fixWavPane.setParams();
acquisitionPaneFX.getFlipPane().flipToBack();
});

View File

@ -35,8 +35,8 @@
-fx-font-color: -fx-text;
-fx-font-family: "Ubuntu";
-fx-border-radius: 5 5 5 5;
-fx-background-radius: 5 5 5 5;
-fx-border-radius: 5 5 5 5;
-fx-background-radius: 5 5 5 5;
-icons-color: -fx-icon_col;
}
@ -615,7 +615,7 @@
-fx-background: -fx-darkbackground;
-fx-background-color: -fx-darkbackground;
-fx-border-radius: 0 0 0 0;
-fx-padding: 7 0 7 0;
-fx-padding: 5 0 5 0;
-fx-border-color: transparent;
}
@ -623,9 +623,9 @@
-fx-text-fill: white;
-fx-background-color: -fx-darkbackground;
-fx-border-color: -fx-border_col;
-fx-background-radius: 6 6 0 0;
-fx-border-radius: 6 6 0 0;
-fx-padding: 7 0 7 0;
-fx-background-radius: 5 5 0 0;
-fx-border-radius: 5 5 0 0;
-fx-padding: 5 0 5 0;
}
.spinner .increment-arrow {
@ -635,16 +635,16 @@
.spinner .increment-arrow-button:hover {
-fx-background-color: -fx-highlight;
-fx-border-color: -fx-highlight_border;
-fx-background-radius: 6 6 0 0;
-fx-border-radius: 6 6 0 0;
-fx-background-radius: 5 5 0 0;
-fx-border-radius: 5 5 0 0;
}
.spinner .decrement-arrow-button {
-fx-text-fill: white;
-fx-background-color: -fx-darkbackground;
-fx-border-color: -fx-border_col;
-fx-background-radius: 0 0 6 6;
-fx-border-radius: 0 0 6 6
-fx-background-radius: 0 0 5 5;
-fx-border-radius: 0 0 5 5
}
.spinner .decrement-arrow {
@ -654,8 +654,8 @@
.spinner .decrement-arrow-button:hover {
-fx-background-color: -fx-highlight;
-fx-border-color: -fx-highlight_border;
-fx-background-radius: 0 0 6 6;
-fx-border-radius: 0 0 6 6;
-fx-background-radius: 0 0 5 5;
-fx-border-radius: 0 0 5 5;
}
/*Arrows are horizontal either side of text box*/
@ -663,7 +663,7 @@
-fx-text-fill: white;
-fx-background-color: -fx-darkbackground;
-fx-border-color: -fx-border_col;
-fx-border-radius: 0 6 6 0
-fx-border-radius: 0 5 5 0
}
@ -671,22 +671,22 @@
-fx-text-fill: white;
-fx-background-color: -fx-darkbackground;
-fx-border-color: -fx-border_col;
-fx-border-radius: 6 0 0 6
-fx-border-radius: 5 0 0 5
}
.spinner.split-arrows-horizontal .increment-arrow-button:hover {
-fx-background-color: -fx-highlight;
-fx-border-color: -fx-highlight_border;
-fx-background-radius: 0 6 6 0;
-fx-border-radius: 0 6 6 0;
-fx-background-radius: 0 5 5 0;
-fx-border-radius: 0 5 5 0;
}
.spinner.split-arrows-horizontal .decrement-arrow-button:hover {
-fx-background-color: -fx-highlight;
-fx-border-color: -fx-highlight_border;
-fx-background-radius: 6 0 0 6;
-fx-border-radius: 6 0 0 6;
-fx-background-radius: 5 0 0 5;
-fx-border-radius: 5 0 0 5;
}
.spinner.split-arrows-horizontal .text-field {

View File

@ -1,7 +1,6 @@
package pamViewFX.fxNodes.utilityPanes;
import java.io.Serializable;
import javafx.geometry.Pos;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;

View File

@ -3,12 +3,10 @@ package spectrogramNoiseReduction.layoutFX;
import java.util.ArrayList;
import org.controlsfx.control.ToggleSwitch;
import pamViewFX.PamGuiManagerFX;
import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamHBox;
import pamViewFX.fxNodes.PamVBox;
import pamViewFX.fxNodes.utilityPanes.PamToggleSwitch;
import pamViewFX.fxNodes.utilityPanes.SourcePaneFX;
import spectrogramNoiseReduction.SpecNoiseMethod;
import spectrogramNoiseReduction.SpectrogramNoiseProcess;
@ -16,10 +14,8 @@ import spectrogramNoiseReduction.SpectrogramNoiseSettings;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.Pane;
import PamController.SettingsPane;
import PamguardMVC.PamDataBlock;
@ -39,7 +35,7 @@ public class SpectrogramNoisePaneFX extends SettingsPane<SpectrogramNoiseSetting
private SpectrogramNoiseSettings spectrogramNoiseSettings=new SpectrogramNoiseSettings();
private ToggleSwitch[] enableMethod;
private PamToggleSwitch[] enableMethod;
private PamDataBlock dataSource;
@ -58,7 +54,7 @@ public class SpectrogramNoisePaneFX extends SettingsPane<SpectrogramNoiseSetting
PamVBox methodPane;
SpecNoiseNodeFX dC;
Node node;
enableMethod = new ToggleSwitch[methods.size()];
enableMethod = new PamToggleSwitch[methods.size()];
for (int i = 0; i < methods.size(); i++) {
@ -66,13 +62,14 @@ public class SpectrogramNoisePaneFX extends SettingsPane<SpectrogramNoiseSetting
methodPane.setSpacing(10);
//create name
Label title=new Label(methods.get(i).getName());
PamGuiManagerFX.titleFont2style(title);
// title.setFont(PamGuiManagerFX.titleFontSize2);
PamHBox toggleHolder = new PamHBox();
toggleHolder.setSpacing(5);
toggleHolder.getChildren().addAll(enableMethod[i] =
new ToggleSwitch(), title);
new PamToggleSwitch(methods.get(i).getName()));
PamGuiManagerFX.titleFont2style(enableMethod[i].getLabel());
enableMethod[i].setAlignment(Pos.CENTER_LEFT);
toggleHolder.setAlignment(Pos.CENTER_LEFT);