Printer working - User Feedback needed because of long waits until print, maybe get lpstat status, modify & display.
closed #45
This commit is contained in:
Generated
+1
-11
@@ -48,17 +48,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.45" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
|
||||
Generated
-3
@@ -12,9 +12,6 @@
|
||||
<list>
|
||||
<option value="clean" />
|
||||
<option value="assembly:assembly" />
|
||||
<option value="release:prepare" />
|
||||
<option value="release:perform" />
|
||||
<option value="-B" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="profilesMap">
|
||||
|
||||
@@ -3,13 +3,10 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.selfomat</groupId>
|
||||
<artifactId>selfomat-single-user</artifactId>
|
||||
<version>0.4.0.14-SNAPSHOT</version>
|
||||
<version>0.4.1.1-SNAPSHOT</version>
|
||||
|
||||
<scm>
|
||||
<url>scm:svn:svn://simongehrig:L4ut5pr3ch3r!@svn.picture.tools/selfomat/trunk/selfomat-java-single-user</url>
|
||||
<developerConnection>scm:svn:svn://simongehrig:L4ut5pr3ch3r!@svn.picture.tools/selfomat/trunk
|
||||
</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
<url>scm:git:http://192.168.100.78/git/selfomat-software.git</url>
|
||||
</scm>
|
||||
<distributionManagement>
|
||||
<!-- Publish the versioned releases here -->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
|
||||
@@ -10,6 +10,7 @@ import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Font;
|
||||
import model.SOMConfig;
|
||||
import model.SOMEvent;
|
||||
import model.SOMImage;
|
||||
import model.SOMLayout;
|
||||
import workers.FilesWorker;
|
||||
@@ -194,6 +195,8 @@ public class CaptureCtl {
|
||||
SOMGUI.galleryCtl.setPage();
|
||||
// update the Gallery
|
||||
SOMGUI.galleryCtl.getGalleryImages();
|
||||
// set current Image
|
||||
SOMEvent.getInstance().createAndSetImage(SOMEvent.getInstance().getLastImage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ public class GalleryCtl {
|
||||
SOMGUI.pictureCtl.image.setImage(new Image(somPageImagesArray[finalI].getPrv().toURI().toString()));
|
||||
SOMGUI.captureCtl.image.setImage(new Image(somPageImagesArray[finalI].getPrv().toURI().toString()));
|
||||
SOMGUI.changetopicture();
|
||||
|
||||
SOMEvent.getInstance().createAndSetImage(somPageImagesArray[finalI]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import javafx.scene.layout.StackPane;
|
||||
import model.SOMEvent;
|
||||
import model.SOMImage;
|
||||
import model.SOMLayout;
|
||||
import workers.FilesWorker;
|
||||
import workers.ScaleWorker;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,10 +35,17 @@ public class PictureCtl {
|
||||
public Button seriesBtn;
|
||||
@FXML
|
||||
public Button galleryBtn;
|
||||
@FXML
|
||||
public Button printBtn;
|
||||
|
||||
@FXML
|
||||
public ImageView image;
|
||||
|
||||
// Get the Event Images
|
||||
List<SOMImage> somImageList = SOMEvent.getInstance().getImages();
|
||||
int numberOfImages = somImageList.size();
|
||||
|
||||
|
||||
public void initialize() {
|
||||
|
||||
// Basic Layout setup
|
||||
@@ -48,6 +56,7 @@ public class PictureCtl {
|
||||
setGalleryBtn();
|
||||
setSeriesBtn();
|
||||
setSingleBtn();
|
||||
setPrintBtn();
|
||||
|
||||
// Image Setup
|
||||
setImage();
|
||||
@@ -239,6 +248,58 @@ public class PictureCtl {
|
||||
});
|
||||
}
|
||||
|
||||
private void setPrintBtn() {
|
||||
// get the button height & width
|
||||
int height = (SOMLayout.screenHeight / 4);
|
||||
|
||||
// set the Button height & width
|
||||
printBtn.setPrefSize(height, height);
|
||||
|
||||
// Make it a circle
|
||||
printBtn.setBackground(SOMLayout.getTransparentBG10rounded(height / 2));
|
||||
|
||||
//Set Text Color
|
||||
printBtn.setTextFill(SOMLayout.WHITE);
|
||||
printBtn.setText(null);
|
||||
|
||||
// Set Image
|
||||
ImageView imageView = new ImageView(SOMLayout.PRINT_IMAGE);
|
||||
|
||||
printBtn.setGraphic(imageView);
|
||||
|
||||
// Set Mouse Press Action
|
||||
printBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent event) {
|
||||
// Feedback
|
||||
printBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
|
||||
}
|
||||
});
|
||||
|
||||
// Check if active
|
||||
if (numberOfImages == 0) {
|
||||
printBtn.setDisable(true);
|
||||
} else {
|
||||
printBtn.setDisable(false);
|
||||
}
|
||||
|
||||
// Set Mouse Release Action
|
||||
printBtn.setOnMouseReleased(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent event) {
|
||||
|
||||
// Feedback
|
||||
printBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
|
||||
|
||||
// Action
|
||||
action();
|
||||
}
|
||||
|
||||
// Action Performed
|
||||
private void action() {
|
||||
FilesWorker.print();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setImage() {
|
||||
// // Set the image aspect ratio to be preserved
|
||||
// image.setPreserveRatio(true);
|
||||
@@ -283,6 +344,15 @@ public class PictureCtl {
|
||||
|
||||
// set the Image to UI
|
||||
image.setImage(new Image(somImage.getPrv().toURI().toString()));
|
||||
|
||||
// If the current image is not already set, set the last image
|
||||
if (SOMEvent.getInstance().getCurrentimage() == null) {
|
||||
SOMEvent event = SOMEvent.getInstance();
|
||||
event.createAndSetLastImage();
|
||||
event.createAndSetImage(event.getLastImage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,5 @@ public class Start extends SOMGUI {
|
||||
// get event instance
|
||||
SOMEvent event = SOMEvent.getInstance();
|
||||
event.getEventImages();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
*/
|
||||
package workers;
|
||||
|
||||
import com.sun.java.util.jar.pack.Package;
|
||||
import model.SOMImage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
@@ -38,6 +40,7 @@ class CaptureWorker {
|
||||
|
||||
// MOVE & RENAME THE IMAGE
|
||||
Files.move(image.getTmp().toPath(), image.getSrc().toPath(), ATOMIC_MOVE);
|
||||
|
||||
} else {
|
||||
System.out.println("Capture Process failed");
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
|
||||
import static java.nio.file.StandardWatchEventKinds.*;
|
||||
|
||||
public class FilesWorker {
|
||||
@@ -107,6 +108,29 @@ public class FilesWorker {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static void print() {
|
||||
try {
|
||||
|
||||
System.out.println(
|
||||
SOMEvent.getInstance().getCurrentimage().getSrc().toString()
|
||||
);
|
||||
// get a process taking the image
|
||||
ProcessBuilder builder = new ProcessBuilder(
|
||||
"lp",
|
||||
SOMEvent.getInstance().getCurrentimage().getSrc().toString()
|
||||
);
|
||||
|
||||
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
// launch capture!
|
||||
Process process = builder.start();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean internet() {
|
||||
|
||||
Socket sock = new Socket();
|
||||
|
||||
@@ -27,5 +27,7 @@
|
||||
GridPane.rowIndex="2"/>
|
||||
<Button fx:id="seriesBtn" mnemonicParsing="false" prefHeight="183.0" prefWidth="221.0" text="Button"
|
||||
GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
||||
<Button fx:id="printBtn" mnemonicParsing="false" prefHeight="1" prefWidth="1" text="Button"
|
||||
GridPane.columnIndex="2" GridPane.rowIndex="0"/>
|
||||
</GridPane>
|
||||
</StackPane>
|
||||
|
||||
Reference in New Issue
Block a user