mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01: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:
parent
c6795dde73
commit
9196a8d943
@ -399,7 +399,7 @@ public class Base {
|
||||
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);
|
||||
// Open failure is fatal in upload/verify mode
|
||||
if (doUpload || doVerify)
|
||||
@ -416,10 +416,6 @@ public class Base {
|
||||
|
||||
Editor editor = editors.get(0);
|
||||
|
||||
// Wait until editor is initialized
|
||||
while (!editor.status.isInitialized())
|
||||
Thread.sleep(10);
|
||||
|
||||
// Do board selection if requested
|
||||
processBoardArgument(selectBoard);
|
||||
|
||||
@ -574,7 +570,7 @@ public class Base {
|
||||
location = nextEditorLocation();
|
||||
}
|
||||
// If file did not exist, null will be returned for the Editor
|
||||
if (handleOpen(path, location) != null) {
|
||||
if (handleOpen(path, location, true) != null) {
|
||||
opened++;
|
||||
}
|
||||
}
|
||||
@ -888,11 +884,11 @@ public class Base {
|
||||
* @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);
|
||||
|
||||
File file = new File(path);
|
||||
@ -960,6 +956,7 @@ public class Base {
|
||||
|
||||
// now that we're ready, show the window
|
||||
// (don't do earlier, cuz we might move it based on a window being closed)
|
||||
if (showEditor)
|
||||
editor.setVisible(true);
|
||||
|
||||
// System.err.println("exiting handleOpen");
|
||||
|
@ -113,6 +113,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
||||
public void notice(String message) {
|
||||
mode = NOTICE;
|
||||
this.message = message;
|
||||
if (copyErrorButton != null)
|
||||
copyErrorButton.setVisible(false);
|
||||
//update();
|
||||
repaint();
|
||||
@ -126,6 +127,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
||||
public void error(String message) {
|
||||
mode = ERR;
|
||||
this.message = message;
|
||||
if (copyErrorButton != null)
|
||||
copyErrorButton.setVisible(true);
|
||||
repaint();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user