From 21f33f25158417d49637e6f5ec5bf5a0bf3366b9 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 19:59:11 +0200 Subject: [PATCH] [plugin|licenses] Fix code style --- addons/licenses/internal/components_tree.gd | 4 +--- addons/licenses/internal/handler/object.gd | 4 ++-- addons/licenses/internal/licenses.gd | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/licenses/internal/components_tree.gd b/addons/licenses/internal/components_tree.gd index e602bf8..497f53c 100644 --- a/addons/licenses/internal/components_tree.gd +++ b/addons/licenses/internal/components_tree.gd @@ -77,7 +77,7 @@ func _add_tree_item(component: Component, idx: int, parent: TreeItem) -> TreeIte var tooltip = component.name var comp_warnings: PackedStringArray = component.get_warnings() if comp_warnings.size() != 0: - tooltip += "\n- " + "\n - ".join(comp_warnings) + tooltip += "\n- " + "\n- ".join(comp_warnings) item.set_icon(0, self.get_theme_icon("NodeWarning", "EditorIcons")) item.set_tooltip_text(0, tooltip) return item @@ -98,7 +98,6 @@ func reload() -> void: var readonly_idx: int = 0 # count current added custom components var idx: int = 0 - var component_selected: bool = false while idx < len(self._components) or readonly_idx < len(self._readonly_components): var component: Component = null @@ -118,7 +117,6 @@ func reload() -> void: var item: TreeItem = self._add_component(component, category_cache, root, cur_idx) if component == self._component_detail.get_component(): - component_selected = true self.scroll_to_item(item) item.select(0) diff --git a/addons/licenses/internal/handler/object.gd b/addons/licenses/internal/handler/object.gd index 30db819..320f51b 100644 --- a/addons/licenses/internal/handler/object.gd +++ b/addons/licenses/internal/handler/object.gd @@ -11,12 +11,12 @@ func _init(tree_: ComponentDetailTree, item_: TreeItem, value_: Variant, propert # ignore private variables and ignore non supported types and already added items if prop["name"].begins_with("_"): continue - self.tree._add_item(self.item, self.value.get(prop["name"]), prop) + self.tree._add_item(self.item, (self.value as Object).get(prop["name"]), prop) static func can_handle(property: Dictionary) -> bool: return property["type"] == TYPE_OBJECT and property.get("class_name", "") != "Script" func child_edited(item: TreeItem) -> void: var child = item.get_meta("handler") - self.value.set(child.property["name"], child.value) + (self.value as Object).set(child.property["name"], child.value) self.tree._on_item_edited(self.item) diff --git a/addons/licenses/internal/licenses.gd b/addons/licenses/internal/licenses.gd index 9460619..c82be8c 100644 --- a/addons/licenses/internal/licenses.gd +++ b/addons/licenses/internal/licenses.gd @@ -30,7 +30,7 @@ func reload() -> void: res.components.sort_custom(Licenses.new().compare_components_ascending) self._components_tree.set_components(res.components) -func _update_set_license_filepath_button(): +func _update_set_license_filepath_button() -> void: if Licenses.get_license_data_filepath() == self._license_file_edit.text: self._set_license_filepath_button.icon = self.get_theme_icon("ImportCheck", "EditorIcons") self._set_license_filepath_button.tooltip_text = "Selected file is set as the project license file."