Hide Log UI by default (reenable with arg)

This commit is contained in:
JeremyStar™ 2024-05-17 01:47:44 +02:00
parent 195116fe1f
commit 527bd23363
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -24,11 +24,10 @@ var logger: CoreLoggerInstance
# Preinitialization
func _init() -> void:
# Update configuration
core_config.hide_window_on_shutdown = false
#core_config.hide_window_on_shutdown = true
#core_config.automatic_shutdown = false
if OS.is_debug_build(): core_config.logger_level = CoreTypes.LoggerLevel.DIAG
else: core_config.logger_level = CoreTypes.LoggerLevel.INFO
core_config.logui_enabled = false
# Preinitialize CORE Framework
core = await Core.new(core_config)
@ -66,6 +65,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.""")
# Apply command line arguments
logger.verb("Reloading CORE Configuration (applying cmdline args)")
core_config.logger_level = args["logger_level"]
core_config.logui_enabled = args["display_logui"]
core.reload_configuration(core_config)
# Initialize internals
@ -110,8 +110,8 @@ func cleanup() -> void:
# Parses all arguments
func parse_cmdline() -> Dictionary:
logger.verb("Parsing command line arguments")
var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level }
var processed: Dictionary = { "presentation": false, "logger_level": false }
var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level, "display_logui": core_config.logui_enabled }
var processed: Dictionary = { "presentation": false, "logger_level": false, "display_logui": false }
for arg in OS.get_cmdline_user_args():
logger.diag(core.misc.stringify_variables("Parsing cmdline argument %arg%", { "arg": arg }))
@ -132,6 +132,7 @@ Usage (development setup): /path/to/godot.binary -d -v --path . ++ <further argu
Further arguments:
--logger-level=<DIAG|VERB|INFO|WARN|ERROR> Sets the logger level, defaults to DIAG in debug
                                              builds and INFO in release builds.
--display-logui Displays CORE's Log UI. May break stuff!
/path/to/presentation.pcar Path to the presentation Presencode should open.
                                              If not supplied, a user interface will appear.
+++ PRESENCODE HELP +++""")
@ -159,6 +160,15 @@ Further arguments:
"WARN": args["logger_level"] = CoreTypes.LoggerLevel.WARN
"ERROR": args["logger_level"] = CoreTypes.LoggerLevel.ERROR
_: logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Can't match logger level %got%, possible are: %expected%", { "arg": arg, "got": arg.replace("--logger-level=", ""), "expected": [ "DIAG", "VERB", "INFO", "WARN", "ERROR" ] }))
elif arg.contains("--display-logui"):
# Ensure this argument is not overridden
if processed["display_logui"]:
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Already set", { "arg": arg }))
continue
processed["display_logui"] = true
# Update 'args'
args["display_logui"] = true
else:
if arg.begins_with("--"): logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Option not recognized", { "arg": arg }))
else: