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 # Preinitialization
func _init() -> void: func _init() -> void:
# Update configuration # 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 if OS.is_debug_build(): core_config.logger_level = CoreTypes.LoggerLevel.DIAG
else: core_config.logger_level = CoreTypes.LoggerLevel.INFO else: core_config.logger_level = CoreTypes.LoggerLevel.INFO
core_config.logui_enabled = false
# Preinitialize CORE Framework # Preinitialize CORE Framework
core = await Core.new(core_config) 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 # Apply command line arguments
logger.verb("Reloading CORE Configuration (applying cmdline args)") logger.verb("Reloading CORE Configuration (applying cmdline args)")
core_config.logger_level = args["logger_level"] core_config.logger_level = args["logger_level"]
core_config.logui_enabled = args["display_logui"]
core.reload_configuration(core_config) core.reload_configuration(core_config)
# Initialize internals # Initialize internals
@ -110,8 +110,8 @@ func cleanup() -> void:
# Parses all arguments # Parses all arguments
func parse_cmdline() -> Dictionary: func parse_cmdline() -> Dictionary:
logger.verb("Parsing command line arguments") logger.verb("Parsing command line arguments")
var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level } 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 } var processed: Dictionary = { "presentation": false, "logger_level": false, "display_logui": false }
for arg in OS.get_cmdline_user_args(): for arg in OS.get_cmdline_user_args():
logger.diag(core.misc.stringify_variables("Parsing cmdline argument %arg%", { "arg": arg })) 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: Further arguments:
--logger-level=<DIAG|VERB|INFO|WARN|ERROR> Sets the logger level, defaults to DIAG in debug --logger-level=<DIAG|VERB|INFO|WARN|ERROR> Sets the logger level, defaults to DIAG in debug
                                              builds and INFO in release builds.                                               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. /path/to/presentation.pcar Path to the presentation Presencode should open.
                                              If not supplied, a user interface will appear.                                               If not supplied, a user interface will appear.
+++ PRESENCODE HELP +++""") +++ PRESENCODE HELP +++""")
@ -159,6 +160,15 @@ Further arguments:
"WARN": args["logger_level"] = CoreTypes.LoggerLevel.WARN "WARN": args["logger_level"] = CoreTypes.LoggerLevel.WARN
"ERROR": args["logger_level"] = CoreTypes.LoggerLevel.ERROR "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" ] })) _: 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: else:
if arg.begins_with("--"): logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Option not recognized", { "arg": arg })) if arg.begins_with("--"): logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Option not recognized", { "arg": arg }))
else: else: