Skip to content

Commit 27c5a2e

Browse files
author
Federico Fissore
committed
reviewed pull req #115. fixed a compilation error, fixed a weird behaviour of the monitor when failing to find a proper port to use, made the monitor show up only at the end of a successfull upload
1 parent 5ff13f9 commit 27c5a2e

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

app/src/processing/app/Editor.java

+13-21
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,8 @@ public void actionPerformed(ActionEvent e) {
538538
item = newJMenuItem(_("Upload"), 'U');
539539
item.addActionListener(new ActionListener() {
540540
public void actionPerformed(ActionEvent e) {
541-
handleExport(false);
542-
// Hide the serial monitor window. It will reopen at the appropriate time
543-
// if "auto show" is enabled
544541
serialMonitor.setVisible(false);
542+
handleExport(false);
545543
}
546544
});
547545
fileMenu.add(item);
@@ -961,6 +959,7 @@ protected void selectSerialPort(String name) {
961959
serialMonitor.closeSerialPort();
962960

963961
serialMonitor = new SerialMonitor(Preferences.get("serial.port"));
962+
serialMonitor.setIconImage(getIconImage());
964963
//System.out.println("set to " + get("serial.port"));
965964
}
966965

@@ -2393,15 +2392,6 @@ public void run() {
23932392
try {
23942393
serialMonitor.closeSerialPort();
23952394

2396-
// If "auto show" is disabled make sure we hide the serial monitor window.
2397-
// This causes the IDE to act the way it always has in the the past.
2398-
if (Preferences.getBoolean("serial.auto_show_monitor_window")) {
2399-
serialMonitor.setVisible(true);
2400-
}
2401-
else {
2402-
serialMonitor.setVisible(false);
2403-
}
2404-
24052395
uploading = true;
24062396

24072397
boolean success = sketch.exportApplet(false);
@@ -2413,9 +2403,14 @@ public void run() {
24132403
}
24142404
} catch (SerialNotFoundException e) {
24152405
populateSerialMenu();
2416-
if (serialMenu.getItemCount() == 0) statusError(e);
2417-
else if (serialPrompt()) run();
2418-
else statusNotice(_("Upload canceled."));
2406+
if (serialMenu.getItemCount() == 0) {
2407+
statusError(e);
2408+
} else if (serialPrompt()) {
2409+
run();
2410+
return;
2411+
} else {
2412+
statusNotice(_("Upload canceled."));
2413+
}
24192414
} catch (RunnerException e) {
24202415
//statusError("Error during upload.");
24212416
//e.printStackTrace();
@@ -2428,12 +2423,9 @@ public void run() {
24282423
uploading = false;
24292424

24302425
// If auto show is enabled make sure the serial monitor is hooked up and visible
2431-
if (uploadSuccessful) {
2432-
if (Preferences.getBoolean("serial.auto_show_monitor_window")) {
2433-
handleSerial(true);
2434-
}
2435-
}
2436-
else {
2426+
if (uploadSuccessful && Preferences.getBoolean("serial.auto_show_monitor_window")) {
2427+
handleSerial(true);
2428+
} else {
24372429
serialMonitor.setVisible(false);
24382430
}
24392431

app/src/processing/app/EditorToolbar.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,12 @@ public void mousePressed(MouseEvent e) {
346346
break;
347347

348348
case EXPORT:
349+
Editor.serialMonitor.setVisible(false);
349350
editor.handleExport(e.isShiftDown());
350351
break;
351352

352353
case SERIAL:
353-
editor.handleSerial();
354+
editor.handleSerial(true);
354355
break;
355356
}
356357
}

0 commit comments

Comments
 (0)