mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
SplashScreenHelper output progress in console for text-only mode
This commit makes this changes: - SplashScreenHelper is now local in Base constructor - if SplashScreenHelper is instantiated with a null SplashScreen instance then it outputs progress in console and avoid to make calls to Swing toolkit - The parsing of command line arguments is anticipated so we can determine if we are in command line or GUI mode early and setup objects that produces output to not use graphics toolkits. - In this case the SplashScreenHelper is initialized with a real splashscreen only if we are in GUI mode
This commit is contained in:
parent
fbe6bf3792
commit
cf54cce660
@ -51,8 +51,12 @@ public class SplashScreenHelper {
|
||||
|
||||
public SplashScreenHelper(SplashScreen splash) {
|
||||
this.splash = splash;
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
desktopHints = (Map) tk.getDesktopProperty("awt.font.desktophints");
|
||||
if (splash != null) {
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
desktopHints = (Map) tk.getDesktopProperty("awt.font.desktophints");
|
||||
} else {
|
||||
desktopHints = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void splashText(String text) {
|
||||
|
@ -84,7 +84,6 @@ public class Base {
|
||||
private static boolean commandLine;
|
||||
public static volatile Base INSTANCE;
|
||||
|
||||
public static SplashScreenHelper splashScreenHelper = new SplashScreenHelper(SplashScreen.getSplashScreen());
|
||||
public static Map<String, Object> FIND_DIALOG_STATE = new HashMap<>();
|
||||
private final ContributionInstaller contributionInstaller;
|
||||
private final LibraryInstaller libraryInstaller;
|
||||
@ -195,9 +194,20 @@ public class Base {
|
||||
|
||||
BaseNoGui.initPortableFolder();
|
||||
|
||||
// Look for a possible "--preferences-file" parameter and load preferences
|
||||
BaseNoGui.initParameters(args);
|
||||
|
||||
splashScreenHelper.splashText(tr("Loading configuration..."));
|
||||
CommandlineParser parser = new CommandlineParser(args);
|
||||
parser.parseArgumentsPhase1();
|
||||
|
||||
SplashScreenHelper splash;
|
||||
if (parser.isGuiMode()) {
|
||||
splash = new SplashScreenHelper(SplashScreen.getSplashScreen());
|
||||
} else {
|
||||
splash = new SplashScreenHelper(null);
|
||||
}
|
||||
|
||||
splash.splashText(tr("Loading configuration..."));
|
||||
|
||||
BaseNoGui.initVersion();
|
||||
|
||||
@ -224,9 +234,6 @@ public class Base {
|
||||
|
||||
BaseNoGui.notifier = new GUIUserNotifier(this);
|
||||
|
||||
CommandlineParser parser = new CommandlineParser(args);
|
||||
parser.parseArgumentsPhase1();
|
||||
|
||||
BaseNoGui.checkInstallationFolder();
|
||||
|
||||
// If no path is set, get the default sketchbook folder for this platform
|
||||
@ -241,9 +248,9 @@ public class Base {
|
||||
}
|
||||
}
|
||||
|
||||
splashScreenHelper.splashText(tr("Initializing packages..."));
|
||||
splash.splashText(tr("Initializing packages..."));
|
||||
BaseNoGui.initPackages();
|
||||
splashScreenHelper.splashText(tr("Preparing boards..."));
|
||||
splash.splashText(tr("Preparing boards..."));
|
||||
rebuildBoardsMenu();
|
||||
rebuildProgrammerMenu();
|
||||
|
||||
@ -372,7 +379,7 @@ public class Base {
|
||||
System.exit(0);
|
||||
|
||||
} else if (parser.isVerifyOrUploadMode()) {
|
||||
splashScreenHelper.close();
|
||||
splash.close();
|
||||
// Set verbosity for command line build
|
||||
PreferencesData.set("build.verbose", "" + parser.isDoVerboseBuild());
|
||||
PreferencesData.set("upload.verbose", "" + parser.isDoVerboseUpload());
|
||||
@ -385,10 +392,10 @@ public class Base {
|
||||
Editor editor = editors.get(0);
|
||||
|
||||
if (parser.isUploadMode()) {
|
||||
splashScreenHelper.splashText(tr("Verifying and uploading..."));
|
||||
splash.splashText(tr("Verifying and uploading..."));
|
||||
editor.exportHandler.run();
|
||||
} else {
|
||||
splashScreenHelper.splashText(tr("Verifying..."));
|
||||
splash.splashText(tr("Verifying..."));
|
||||
editor.runHandler.run();
|
||||
}
|
||||
|
||||
@ -400,7 +407,7 @@ public class Base {
|
||||
// No errors exit gracefully
|
||||
System.exit(0);
|
||||
} else if (parser.isGuiMode()) {
|
||||
splashScreenHelper.splashText(tr("Starting..."));
|
||||
splash.splashText(tr("Starting..."));
|
||||
|
||||
installKeyboardInputMap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user