Skip to content

Commit 4821c91

Browse files
committed
Add an option for the deployed project file
So, you could deploy two different files "project1.grip" and "project2.grip", then select one of them from the robot program at runtime.
1 parent 64058b0 commit 4821c91

3 files changed

Lines changed: 34 additions & 26 deletions

File tree

ui/src/main/java/edu/wpi/grip/ui/DeployController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
public class DeployController {
4848
private final static String GRIP_JAR = "grip.jar";
4949
private final static String GRIP_WRAPPER = "grip";
50-
private final static String PROJECT_FILE = "project.grip";
5150
private final static String LOCAL_GRIP_JAR = URLDecoder.decode(
5251
Project.class.getProtectionDomain().getCodeSource().getLocation().getPath());
5352

@@ -57,6 +56,7 @@ public class DeployController {
5756
@FXML private TextField javaHome;
5857
@FXML private TextField jvmArgs;
5958
@FXML private TextField deployDir;
59+
@FXML private TextField projectFile;
6060
@FXML private ProgressIndicator progress;
6161
@FXML private Label status;
6262
@FXML private TextArea console;
@@ -74,7 +74,7 @@ public class DeployController {
7474
public void initialize() {
7575
deploying.addListener((o, b, d) -> progress.setProgress(d ? ProgressIndicator.INDETERMINATE_PROGRESS : 0));
7676
command.bind(Bindings.concat(javaHome.textProperty(), "/bin/java ", jvmArgs.textProperty(), " -jar '",
77-
deployDir.textProperty(), "/", GRIP_JAR, "' '", deployDir.textProperty(), "/", PROJECT_FILE, "'"));
77+
deployDir.textProperty(), "/", GRIP_JAR, "' '", deployDir.textProperty(), "/", projectFile.textProperty(), "'"));
7878

7979
loadSettings(pipeline.getProjectSettings());
8080
}
@@ -162,7 +162,7 @@ public StreamCopier.Listener file(String name, long size) {
162162
final String pathStr = deployDir.getText() + "/";
163163
scp.upload(new FileSystemFile(LOCAL_GRIP_JAR), pathStr + GRIP_JAR);
164164
scp.upload(new StringInMemoryFile(GRIP_WRAPPER, "echo \"" + commandStr + "\"\n" + commandStr, 0755), pathStr);
165-
scp.upload(new StringInMemoryFile(PROJECT_FILE, projectWriter.toString()), pathStr);
165+
scp.upload(new StringInMemoryFile(projectFile.getText(), projectWriter.toString()), pathStr);
166166

167167
// Stop the pipeline before running it remotely, so the two instances of GRIP don't try to publish to the
168168
// same NetworkTables keys.

ui/src/main/java/edu/wpi/grip/ui/MainWindowController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ public void deploy() {
196196
graphic.setFitWidth(DPIUtility.SMALL_ICON_SIZE);
197197
graphic.setFitHeight(DPIUtility.SMALL_ICON_SIZE);
198198

199+
deployPane.requestFocus();
200+
199201
Dialog<ButtonType> dialog = new Dialog<>();
200202
dialog.setTitle("Deploy");
201203
dialog.setHeaderText("Deploy");

ui/src/main/resources/edu/wpi/grip/ui/Deploy.fxml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<?language javascript?>
44

5+
<?import edu.wpi.grip.ui.DeployController?>
56
<?import edu.wpi.grip.ui.util.DPIUtility?>
67
<?import javafx.beans.property.SimpleBooleanProperty?>
78
<?import javafx.beans.property.SimpleStringProperty?>
@@ -36,6 +37,10 @@
3637
<PasswordField disable="${deployButton.disabled}" fx:id="password" promptText="Password"
3738
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
3839

40+
<Label disable="${deployButton.disabled}" text="Project File" GridPane.columnIndex="0"
41+
GridPane.rowIndex="3"/>
42+
<TextField disable="${deployButton.disabled}" fx:id="projectFile" promptText="Project File"
43+
GridPane.columnIndex="1" GridPane.rowIndex="3" text="project.grip"/>
3944
</GridPane>
4045
<Separator orientation="VERTICAL" HBox.hgrow="NEVER" visible="false">
4146
<prefWidth>
@@ -61,34 +66,35 @@
6166
GridPane.rowIndex="2"/>
6267
<TextField disable="${deployButton.disabled}" fx:id="jvmArgs" promptText="JVM Arguments"
6368
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
69+
70+
<ButtonBar GridPane.columnIndex="0" GridPane.rowIndex="3" GridPane.columnSpan="2">
71+
<buttons>
72+
<Button fx:id="deployButton" defaultButton="true" onMouseClicked="#onDeploy" text="Deploy"
73+
ButtonBar.buttonData="APPLY">
74+
<fx:script>deployButton.disableProperty().bind(deploying)</fx:script>
75+
<graphic>
76+
<ImageView styleClass="menu-graphic">
77+
<fitWidth>
78+
<DPIUtility fx:constant="SMALL_ICON_SIZE"/>
79+
</fitWidth>
80+
<fitHeight>
81+
<DPIUtility fx:constant="SMALL_ICON_SIZE"/>
82+
</fitHeight>
83+
<image>
84+
<Image url="@icons/deploy.png"/>
85+
</image>
86+
</ImageView>
87+
</graphic>
88+
</Button>
89+
<Button text="Stop" ButtonBar.buttonData="CANCEL_CLOSE" onMouseClicked="#onStop"/>
90+
</buttons>
91+
</ButtonBar>
92+
6493
</GridPane>
6594
</HBox>
6695

6796
<Separator orientation="HORIZONTAL" VBox.vgrow="NEVER"/>
6897

69-
<ButtonBar>
70-
<buttons>
71-
<Button fx:id="deployButton" defaultButton="true" onMouseClicked="#onDeploy" text="Deploy"
72-
ButtonBar.buttonData="APPLY">
73-
<fx:script>deployButton.disableProperty().bind(deploying)</fx:script>
74-
<graphic>
75-
<ImageView styleClass="menu-graphic">
76-
<fitWidth>
77-
<DPIUtility fx:constant="SMALL_ICON_SIZE"/>
78-
</fitWidth>
79-
<fitHeight>
80-
<DPIUtility fx:constant="SMALL_ICON_SIZE"/>
81-
</fitHeight>
82-
<image>
83-
<Image url="@icons/deploy.png"/>
84-
</image>
85-
</ImageView>
86-
</graphic>
87-
</Button>
88-
<Button text="Stop" ButtonBar.buttonData="CANCEL_CLOSE" onMouseClicked="#onStop"/>
89-
</buttons>
90-
</ButtonBar>
91-
9298
<StackPane>
9399
<ProgressBar fx:id="progress" maxWidth="Infinity" progress="0">
94100
<fx:script>progress.disableProperty().bind(deploying.not())</fx:script>

0 commit comments

Comments
 (0)