Skip to content

Commit 739ab8c

Browse files
committed
Removed 2secs wait while using IDE from command line
1 parent 730f81e commit 739ab8c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

app/src/processing/app/Base.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,18 @@ public Base(String[] args) throws Exception {
331331
System.out.println(_("Can't open source sketch!"));
332332
System.exit(2);
333333
}
334-
Thread.sleep(2000);
334+
335335
// Set verbosity for command line build
336336
Preferences.set("build.verbose", "" + doVerbose);
337337
Preferences.set("upload.verbose", "" + doVerbose);
338338

339-
// Do board selection if requested
340339
Editor editor = editors.get(0);
340+
341+
// Wait until editor is initialized
342+
while (!editor.status.isInitialized())
343+
Thread.sleep(10);
344+
345+
// Do board selection if requested
341346
if (selectBoard != null)
342347
selectBoard(selectBoard, editor);
343348

app/src/processing/app/EditorStatus.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
7272
//Thread promptThread;
7373
int response;
7474

75+
boolean initialized = false;
7576

7677
public EditorStatus(Editor editor) {
7778
this.editor = editor;
@@ -237,7 +238,10 @@ public void update(Graphics g) {
237238

238239
public void paintComponent(Graphics screen) {
239240
//if (screen == null) return;
240-
if (okButton == null) setup();
241+
if (!initialized) {
242+
setup();
243+
initialized = true;
244+
}
241245

242246
//System.out.println("status.paintComponent");
243247

@@ -500,4 +504,8 @@ public void actionPerformed(ActionEvent e) {
500504
}
501505
}
502506
}
507+
508+
public boolean isInitialized() {
509+
return initialized;
510+
}
503511
}

0 commit comments

Comments
 (0)