Skip to content

Commit

Permalink
New Option to save docs page scroll position
Browse files Browse the repository at this point in the history
  • Loading branch information
Loregret committed Sep 30, 2023
1 parent dca3040 commit fa35293
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
4 changes: 4 additions & 0 deletions addons/script_panel_plus/configs/config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ list_vertical_spacing=5
list_horizontal_spacing=15
list_same_column_width=true
list_multiple_columns=true

[functionality]

docs_save_last_position=true
sorting_ignore_case=true

[naming]
Expand Down
3 changes: 3 additions & 0 deletions addons/script_panel_plus/configs/defaults.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ list_vertical_spacing=5
list_horizontal_spacing=15
list_same_column_width=true
list_multiple_columns=true

[functionality]
docs_save_last_position=true
sorting_ignore_case=true

[naming]
Expand Down
2 changes: 1 addition & 1 deletion addons/script_panel_plus/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="Script Panel Plus"
description="Script Panel Plus is a replacement plugin for a built-in Godot's scripting panel. It has more features and makes script-organizing a better experience."
author="Loregret"
version="1.7.6"
version="1.7.7"
script="plugin.gd"
19 changes: 18 additions & 1 deletion addons/script_panel_plus/script_panel/script_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1272,15 +1272,32 @@ func list_select_script(_script: ScriptItem, index := -1) -> void:
elif res_path.contains("Class Reference"):
## For Documentation
var editors := engine_script_editor.get_open_script_editors()

if not editors.is_empty():
var editor := editors[0]
editor.go_to_help.emit(res_path.get_slice(" Class Reference", 0))
var has_item := false

if settings['docs_remember_last_pos']: ## Load last position of the docs
## If script is in the list already, then reselect it
for idx in engine_script_list.item_count:
if str(engine_script_list.get_item_tooltip(idx)) == res_path:
engine_script_list.select(idx)
engine_script_list.item_selected.emit(idx)
has_item = true

if not has_item:
editor.go_to_help.emit(res_path.get_slice(" Class Reference", 0))

else: ## Alternative Search
var other_editors := engine_script_editor.find_children("*", "EditorHelp", true, false)

if other_editors.is_empty(): return

var editor_help = other_editors[0]

if editor_help:
editor_help.go_to_help.emit(res_path.get_slice(" Class Reference", 0))

else:
## Deleted
if index != -1: delete_script_item_by_index(index)
Expand Down
10 changes: 5 additions & 5 deletions addons/script_panel_plus/script_panel/script_panel.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://addons/script_panel_plus/script_panel/script_panel.gd" id="1_b1kur"]
[ext_resource type="Script" path="res://addons/script_panel_plus/script_panel/script_list.gd" id="2_g67jx"]

[sub_resource type="Image" id="Image_epfdh"]
[sub_resource type="Image" id="Image_n2kc8"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
Expand All @@ -12,8 +12,8 @@ data = {
"width": 16
}

[sub_resource type="ImageTexture" id="ImageTexture_twxr5"]
image = SubResource("Image_epfdh")
[sub_resource type="ImageTexture" id="ImageTexture_nn7n4"]
image = SubResource("Image_n2kc8")

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_06sl4"]

Expand Down Expand Up @@ -84,7 +84,7 @@ layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "Search"
clear_button_enabled = true
right_icon = SubResource("ImageTexture_twxr5")
right_icon = SubResource("ImageTexture_nn7n4")
select_all_on_focus = true

[node name="MenuButton" type="MenuButton" parent="VBoxContainer/SearchBar"]
Expand Down Expand Up @@ -150,7 +150,7 @@ layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "Search"
clear_button_enabled = true
right_icon = SubResource("ImageTexture_twxr5")
right_icon = SubResource("ImageTexture_nn7n4")
select_all_on_focus = true

[node name="MenuButton" type="MenuButton" parent="VBoxContainer/VSplitContainer/MethodListContainer/SearchBar"]
Expand Down

0 comments on commit fa35293

Please sign in to comment.