1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Don't show the GUI on --verify or --upload

These are intended to be ran from the commandline, so showing the GUI
doesn't make so much sense.

This is not quite the perfect solution yet, because an Editor object and
all kinds of GUI objects are still created. This commit only prevents
them from being visible, which is a nice first step, but not quite
pretty yet. However, to do it properly, some code should be moved out of
the Editor class, so that's a bit more work.

Additionally, any messages shown with Base::showError and friends still
create a popup, they probably shouldn't do this either.
This commit is contained in:
Matthijs Kooijman
2013-10-29 19:10:43 +01:00
parent c6795dde73
commit 9196a8d943
2 changed files with 10 additions and 11 deletions

View File

@ -399,7 +399,7 @@ public class Base {
path = new File(currentDirectory, path).getAbsolutePath(); path = new File(currentDirectory, path).getAbsolutePath();
} }
if (handleOpen(path) == null) { if (handleOpen(path, nextEditorLocation(), !(doUpload || doVerify)) == null) {
String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path); String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode // Open failure is fatal in upload/verify mode
if (doUpload || doVerify) if (doUpload || doVerify)
@ -416,10 +416,6 @@ public class Base {
Editor editor = editors.get(0); Editor editor = editors.get(0);
// Wait until editor is initialized
while (!editor.status.isInitialized())
Thread.sleep(10);
// Do board selection if requested // Do board selection if requested
processBoardArgument(selectBoard); processBoardArgument(selectBoard);
@ -574,7 +570,7 @@ public class Base {
location = nextEditorLocation(); location = nextEditorLocation();
} }
// If file did not exist, null will be returned for the Editor // If file did not exist, null will be returned for the Editor
if (handleOpen(path, location) != null) { if (handleOpen(path, location, true) != null) {
opened++; opened++;
} }
} }
@ -888,11 +884,11 @@ public class Base {
* @throws Exception * @throws Exception
*/ */
public Editor handleOpen(String path) throws Exception { public Editor handleOpen(String path) throws Exception {
return handleOpen(path, nextEditorLocation()); return handleOpen(path, nextEditorLocation(), true);
} }
protected Editor handleOpen(String path, int[] location) throws Exception { protected Editor handleOpen(String path, int[] location, boolean showEditor) throws Exception {
// System.err.println("entering handleOpen " + path); // System.err.println("entering handleOpen " + path);
File file = new File(path); File file = new File(path);
@ -960,6 +956,7 @@ public class Base {
// now that we're ready, show the window // now that we're ready, show the window
// (don't do earlier, cuz we might move it based on a window being closed) // (don't do earlier, cuz we might move it based on a window being closed)
if (showEditor)
editor.setVisible(true); editor.setVisible(true);
// System.err.println("exiting handleOpen"); // System.err.println("exiting handleOpen");

View File

@ -113,6 +113,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void notice(String message) { public void notice(String message) {
mode = NOTICE; mode = NOTICE;
this.message = message; this.message = message;
if (copyErrorButton != null)
copyErrorButton.setVisible(false); copyErrorButton.setVisible(false);
//update(); //update();
repaint(); repaint();
@ -126,6 +127,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void error(String message) { public void error(String message) {
mode = ERR; mode = ERR;
this.message = message; this.message = message;
if (copyErrorButton != null)
copyErrorButton.setVisible(true); copyErrorButton.setVisible(true);
repaint(); repaint();
} }