From 893c768f75b7109e9b5d3bffd29cfca0ae66e4d5 Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Sat, 6 Jan 2024 22:34:24 +1300 Subject: [PATCH] Update gdtoolkit to version 4.2.2 --- .github/workflows/main.yml | 2 +- addons/gut/doubler.gd | 7 +++++-- addons/gut/gui/GutBottomPanel.gd | 34 ++++++++++---------------------- addons/gut/gui/GutRunner.gd | 10 +++------- addons/gut/gui/RunResults.gd | 14 ++++--------- addons/gut/gui/gut_config_gui.gd | 6 +++--- addons/gut/gut_cmdln.gd | 23 ++++++++++++--------- addons/gut/hook_script.gd | 8 ++------ addons/gut/test.gd | 7 +++++-- misc/hooks/pre-commit-gdformat | 2 +- requirements.txt | 10 +--------- test/platform/unix/unix.test.gd | 23 +++++++++++---------- 12 files changed, 62 insertions(+), 84 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ede4ad6..ba9de31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -327,7 +327,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.x + python-version: 3.9 cache: 'pip' - name: Install python dependencies run: pip install -r requirements.txt diff --git a/addons/gut/doubler.gd b/addons/gut/doubler.gd index e81591a..59293c0 100644 --- a/addons/gut/doubler.gd +++ b/addons/gut/doubler.gd @@ -280,8 +280,11 @@ func _parse_script(obj): if inner_class_registry.has(obj): parsed = _script_collector.parse(inner_class_registry.get_base_resource(obj), obj) else: - _lgr.error( - "Doubling Inner Classes requires you register them first. Call register_inner_classes passing the script that contains the inner class." + ( + _lgr + . error( + "Doubling Inner Classes requires you register them first. Call register_inner_classes passing the script that contains the inner class." + ) ) else: parsed = _script_collector.parse(obj) diff --git a/addons/gut/gui/GutBottomPanel.gd b/addons/gut/gui/GutBottomPanel.gd index 43fcf97..adc4b14 100644 --- a/addons/gut/gui/GutBottomPanel.gd +++ b/addons/gut/gui/GutBottomPanel.gd @@ -63,22 +63,14 @@ func _ready(): _ctrls.output_button.icon = get_theme_icon("Font", "EditorIcons") _ctrls.run_results.set_output_control(_ctrls.output_ctrl) - ( - _ctrls - . run_results - . set_font( - _gut_config.options.panel_options.font_name, _gut_config.options.panel_options.font_size - ) + _ctrls.run_results.set_font( + _gut_config.options.panel_options.font_name, _gut_config.options.panel_options.font_size ) var check_import = load("res://addons/gut/images/red.png") if check_import == null: - ( - _ctrls - . run_results - . add_centered_text( - "GUT got some new images that are not imported yet. Please restart Godot." - ) + _ctrls.run_results.add_centered_text( + "GUT got some new images that are not imported yet. Please restart Godot." ) print("GUT got some new images that are not imported yet. Please restart Godot.") else: @@ -94,12 +86,8 @@ func _apply_options_to_controls(): _ctrls.output_ctrl.set_all_fonts(_gut_config.options.panel_options.font_name) _ctrls.output_ctrl.set_font_size(_gut_config.options.panel_options.font_size) - ( - _ctrls - . run_results - . set_font( - _gut_config.options.panel_options.font_name, _gut_config.options.panel_options.font_size - ) + _ctrls.run_results.set_font( + _gut_config.options.panel_options.font_name, _gut_config.options.panel_options.font_size ) _ctrls.run_results.set_show_orphans(!_gut_config.options.hide_orphans) @@ -178,10 +166,10 @@ func _apply_shortcuts(): _ctrls.run_button.shortcut = _ctrls.shortcut_dialog.get_run_all() _ctrls.run_at_cursor.get_script_button().shortcut = ( - _ctrls . shortcut_dialog . get_run_current_script() + _ctrls.shortcut_dialog.get_run_current_script() ) _ctrls.run_at_cursor.get_inner_button().shortcut = ( - _ctrls . shortcut_dialog . get_run_current_inner() + _ctrls.shortcut_dialog.get_run_current_inner() ) _ctrls.run_at_cursor.get_test_button().shortcut = _ctrls.shortcut_dialog.get_run_current_test() @@ -337,10 +325,8 @@ func set_current_script(script): func set_interface(value): _interface = value - ( - _interface - . get_script_editor() - . connect("editor_script_changed", Callable(self, "_on_editor_script_changed")) + _interface.get_script_editor().connect( + "editor_script_changed", Callable(self, "_on_editor_script_changed") ) var ste = ScriptTextEditors.new(_interface.get_script_editor()) diff --git a/addons/gut/gui/GutRunner.gd b/addons/gut/gui/GutRunner.gd index db0042b..fe08d07 100644 --- a/addons/gut/gui/GutRunner.gd +++ b/addons/gut/gui/GutRunner.gd @@ -47,13 +47,9 @@ func run_tests(show_gui = true): add_child(_gut) if !_cmdln_mode: - ( - _gut - . end_run - . connect( - _on_tests_finished.bind( - _gut_config.options.should_exit, _gut_config.options.should_exit_on_success - ) + _gut.end_run.connect( + _on_tests_finished.bind( + _gut_config.options.should_exit, _gut_config.options.should_exit_on_success ) ) diff --git a/addons/gut/gui/RunResults.gd b/addons/gut/gui/RunResults.gd index 6c0d6a4..b5bb129 100644 --- a/addons/gut/gui/RunResults.gd +++ b/addons/gut/gui/RunResults.gd @@ -81,17 +81,11 @@ func _ready(): _set_toolbutton_icon(_ctrls.toolbar.show_script, "Script", "ss") _set_toolbutton_icon(_ctrls.toolbar.scroll_output, "Font", "so") - ( - _ctrls - . toolbar - . hide_passing - . set("custom_icons/checked", get_theme_icon("GuiVisibilityHidden", "EditorIcons")) + _ctrls.toolbar.hide_passing.set( + "custom_icons/checked", get_theme_icon("GuiVisibilityHidden", "EditorIcons") ) - ( - _ctrls - . toolbar - . hide_passing - . set("custom_icons/unchecked", get_theme_icon("GuiVisibilityVisible", "EditorIcons")) + _ctrls.toolbar.hide_passing.set( + "custom_icons/unchecked", get_theme_icon("GuiVisibilityVisible", "EditorIcons") ) if get_parent() == get_tree().root: diff --git a/addons/gut/gui/gut_config_gui.gd b/addons/gut/gui/gut_config_gui.gd index bf4c1ec..51e90f4 100644 --- a/addons/gut/gui/gut_config_gui.gd +++ b/addons/gut/gui/gut_config_gui.gd @@ -480,9 +480,9 @@ func get_options(base_opts): to_return.should_exit_on_success = _cfg_ctrls.should_exit_on_success.button_pressed #Output - to_return.panel_options.font_name = ( - _cfg_ctrls . output_font_name . get_item_text(_cfg_ctrls.output_font_name.selected) - ) + to_return.panel_options.font_name = (_cfg_ctrls.output_font_name.get_item_text( + _cfg_ctrls.output_font_name.selected + )) to_return.panel_options.font_size = _cfg_ctrls.output_font_size.value # Runner Appearance diff --git a/addons/gut/gut_cmdln.gd b/addons/gut/gut_cmdln.gd index b0af74e..55f3ad6 100644 --- a/addons/gut/gut_cmdln.gd +++ b/addons/gut/gut_cmdln.gd @@ -210,10 +210,13 @@ func setup_options(options, font_names): ) opts.add("-gpo", false, "Print option values from all sources and the value used, then quit.") opts.add("-ginclude_subdirs", false, "Include subdirectories of -gdir.") - opts.add( - "-gdouble_strategy", - "partial", - 'Default strategy to use when doubling. Valid values are [partial, full]. Default "[default]"' + ( + opts + . add( + "-gdouble_strategy", + "partial", + 'Default strategy to use when doubling. Valid values are [partial, full]. Default "[default]"' + ) ) opts.add("-gdisable_colors", false, "Disable command line colors.") opts.add("-gpre_run_script", "", "pre-run hook script path") @@ -364,9 +367,8 @@ func _run_gut(): _tester = runner.get_gut() _tester.connect( "end_run", - ( - Callable(self, "_on_tests_finished") - . bind(_final_opts.should_exit, _final_opts.should_exit_on_success) + Callable(self, "_on_tests_finished").bind( + _final_opts.should_exit, _final_opts.should_exit_on_success ) ) @@ -378,8 +380,11 @@ func _on_tests_finished(should_exit, should_exit_on_success): if _final_opts.dirs.size() == 0: if _tester.get_summary().get_totals().scripts == 0: var lgr = _tester.get_logger() - lgr.error( - "No directories configured. Add directories with options or a super.gutconfig.json file. Use the -gh option for more information." + ( + lgr + . error( + "No directories configured. Add directories with options or a super.gutconfig.json file. Use the -gh option for more information." + ) ) if _tester.get_fail_count(): diff --git a/addons/gut/hook_script.gd b/addons/gut/hook_script.gd index 85fd6dc..d410b32 100644 --- a/addons/gut/hook_script.gd +++ b/addons/gut/hook_script.gd @@ -21,12 +21,8 @@ var _should_abort = false # Virtual method that will be called by GUT after instantiating # this script. func run(): - ( - gut - . logger - . error( - "Run method not overloaded. Create a 'run()' method in your hook script to run your code." - ) + gut.logger.error( + "Run method not overloaded. Create a 'run()' method in your hook script to run your code." ) diff --git a/addons/gut/test.gd b/addons/gut/test.gd index dd2af31..171176c 100644 --- a/addons/gut/test.gd +++ b/addons/gut/test.gd @@ -1565,8 +1565,11 @@ func double_inner(path, subpath, strategy = null): # ------------------------------------------------------------------------------ func ignore_method_when_doubling(thing, method_name): if typeof(thing) == TYPE_STRING: - _lgr.error( - "ignore_method_when_doubling no longer supports paths to scripts or scenes. Load them and pass them instead." + ( + _lgr + . error( + "ignore_method_when_doubling no longer supports paths to scripts or scenes. Load them and pass them instead." + ) ) return diff --git a/misc/hooks/pre-commit-gdformat b/misc/hooks/pre-commit-gdformat index a8b2761..ccbc424 100755 --- a/misc/hooks/pre-commit-gdformat +++ b/misc/hooks/pre-commit-gdformat @@ -6,7 +6,7 @@ set -e -GDTOOLKIT_VERSION=5f4405e1d5f47e581860103106c96a0504bdf74a +GDTOOLKIT_VERSION=4.2.2 FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.gd$' | grep -v '^addons/gd-plug' | grep -v '^addons/gut' | sed 's| |\\ |g') echo $FILES diff --git a/requirements.txt b/requirements.txt index b51f1b2..562d971 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1 @@ -colorama==0.4.5 -docopt==0.6.2 -future==0.18.2 -git+https://github.com/Scony/godot-gdscript-toolkit@5f4405e1d5f47e581860103106c96a0504bdf74a -lark-parser==0.12.0 -mando==0.6.4 -PyYAML==6.0 -radon==5.1.0 -six==1.16.0 +gdtoolkit==4.2.2 diff --git a/test/platform/unix/unix.test.gd b/test/platform/unix/unix.test.gd index c209d39..c9f80dc 100644 --- a/test/platform/unix/unix.test.gd +++ b/test/platform/unix/unix.test.gd @@ -149,16 +149,19 @@ class Helper: ) var python_path = output[0].strip_edges() - var exit_code = OS.execute( - python_path, - [ - "-c", - ( - "import struct, fcntl, termios; print(struct.unpack('HH', fcntl.ioctl(%d, termios.TIOCGWINSZ, '1234')))" - % fd - ) - ], - output + var exit_code = ( + OS + . execute( + python_path, + [ + "-c", + ( + "import struct, fcntl, termios; print(struct.unpack('HH', fcntl.ioctl(%d, termios.TIOCGWINSZ, '1234')))" + % fd + ) + ], + output + ) ) assert(exit_code == 0, "Failed to run python command for this test.")