Skip to content

Commit

Permalink
Merge pull request #14 from opetany93/poprawki_Agaty
Browse files Browse the repository at this point in the history
Fixed capturing of data
  • Loading branch information
tainfante authored Jan 31, 2018
2 parents 8d93999 + fb80deb commit 6c84d01
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .idea/artifacts/RealTimeSerialPlotter_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Class-Path: purejavacomm-1.0.2.RELEASE.jar
Main-Class: application.Main

4 changes: 4 additions & 0 deletions src/application/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import mainwindow.CaptureController;
import plot.Plot;
Expand All @@ -22,6 +23,9 @@ public void start(Stage primaryStage) throws Exception
primaryStage.setMinHeight(450.0);
primaryStage.setMinWidth(620.0);

Image applicationIcon = new Image(getClass().getResourceAsStream("icon.png"));
primaryStage.getIcons().add(applicationIcon);

primaryStage.setOnCloseRequest(event ->
{
CaptureController.isActiveExport = false;
Expand Down
Binary file added src/application/RealTimeSerialPlotter_box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/application/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/mainwindow/CaptureController.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void startOverwriteClick()
{
file = new File(filePathTextField.getText());

if(file.exists())
if(file.getPath().substring(file.getPath().length() - 3, file.getPath().length()).equals("txt"))
{
if(PortReader.getInstance().isOpen())
{
Expand Down Expand Up @@ -155,7 +155,7 @@ public void startOverwriteClick()
}
else
{
showErrorAlert("Podana ścieżka jest niepoprawna!");
showErrorAlert("Given path is wrong!");
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/mainwindow/PortController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mainwindow;

import javafx.scene.control.Alert;
import plot.Plot;
import port.PortReader;
import javafx.fxml.FXML;
Expand Down Expand Up @@ -115,6 +116,17 @@ public void onActionConnectButton()
PortReader.getInstance().startReading();
Plot.getInstance().startPlotting();
}
else
{
Log.getInstance().log("An attempt to open the port was unsuccessful.");

Alert alert = new Alert(Alert.AlertType.WARNING);

alert.setTitle("Real Time Serial Plotter");
alert.setHeaderText(null);
alert.setContentText("Port is already in use. Cannot open.");
alert.showAndWait();
}
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow/captureView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<Font size="11.0" />
</font>
</Label>
<TextField fx:id="filePathTextField" focusTraversable="false" minHeight="20.0" prefHeight="10.0" prefWidth="268.0" text="C:\captureOfData.txt">
<TextField fx:id="filePathTextField" editable="false" focusTraversable="false" minHeight="20.0" prefHeight="10.0" prefWidth="268.0" text="C:\captureOfData.txt">
<HBox.margin>
<Insets left="5.0" right="5.0" />
</HBox.margin>
Expand Down
3 changes: 0 additions & 3 deletions src/port/Port.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ public boolean open(String serialPortName, int dataBits, int stopBits, int parit
}
catch (Throwable thwble)
{
Log.getInstance().log("An attempt to open the port was unsuccessful.");
thwble.printStackTrace();

return false;
}
}
Expand Down

0 comments on commit 6c84d01

Please sign in to comment.