Permalink
Browse files

allow file uploads without a connected machine

  • Loading branch information...
1 parent e73e4f4 commit d957e1f75197d68879d5baca378cf97bf6784256 Adam Mayer committed Nov 8, 2009
Showing with 10 additions and 14 deletions.
  1. +8 −12 src/replicatorg/app/ui/MainButtonPanel.java
  2. +2 −2 src/replicatorg/app/ui/MainWindow.java
@@ -44,6 +44,7 @@
import net.miginfocom.swing.MigLayout;
import replicatorg.app.Base;
+import replicatorg.app.MachineController;
import replicatorg.drivers.SDCardCapture;
import replicatorg.machine.MachineListener;
import replicatorg.machine.MachineProgressEvent;
@@ -235,21 +236,16 @@ public void machineStateChanged(MachineStateChangeEvent evt) {
boolean ready = s.isReady();
boolean building = s.isBuilding();
boolean paused = s.isPaused();
- boolean hasPlayback = (editor != null) &&
- (editor.machine != null) &&
- (editor.machine.driver != null) &&
- (editor.machine.driver instanceof SDCardCapture) &&
- (((SDCardCapture)editor.machine.driver).hasFeatureSDCardCapture());
-
- uploadButton.setVisible(hasPlayback);
- playbackButton.setVisible(hasPlayback);
- fileButton.setVisible(hasPlayback);
-
+ MachineController machine = evt.getSource();
+ boolean hasPlayback = (machine != null) &&
+ (machine.driver != null) &&
+ (machine.driver instanceof SDCardCapture) &&
+ (((SDCardCapture)machine.driver).hasFeatureSDCardCapture());
simButton.setEnabled(!building);
fileButton.setEnabled(!building);
buildButton.setEnabled(ready);
- uploadButton.setEnabled(ready);
- playbackButton.setEnabled(ready);
+ uploadButton.setEnabled(ready && hasPlayback);
+ playbackButton.setEnabled(ready && hasPlayback);
pauseButton.setEnabled(building);
stopButton.setEnabled(building);
@@ -2344,8 +2344,8 @@ public void loadMachine(String name) {
us.setSerial(new Serial(us.getPortName(),us));
machine.reset();
} catch (SerialException e) {
- System.err.println("Could not use serial port specified in machines.xml ("+us.getPortName()+").");
- e.printStackTrace();
+ System.err.println("Could not use/find serial port specified in machines.xml ("+us.getPortName()+").");
+ //e.printStackTrace();
}
}
else if (Base.preferences.getBoolean("autoscan",false)) {

0 comments on commit d957e1f

Please sign in to comment.