diff --git a/.github/workflows/godot_export.yml b/.github/workflows/godot_export.yml index 85b4308..acc18a1 100644 --- a/.github/workflows/godot_export.yml +++ b/.github/workflows/godot_export.yml @@ -30,9 +30,9 @@ jobs: godot_export_templates_download_url : https://downloads.tuxfamily.org/godotengine/3.3/Godot_v3.3-stable_export_templates.tpz relative_project_path : ./Godot archive_export_output : true - base_version : 1.1.0 + base_version : 1.2.0 create_release : true - generate_release_notes : true + generate_release_notes : false relative_export_path : ./releases/ #Set export_debug : true for test branches only export_debug : false diff --git a/Godot/assets/minus.png b/Godot/assets/minus.png new file mode 100644 index 0000000..e0cfbf7 Binary files /dev/null and b/Godot/assets/minus.png differ diff --git a/Godot/assets/minus.png.import b/Godot/assets/minus.png.import new file mode 100644 index 0000000..6ef1fb8 --- /dev/null +++ b/Godot/assets/minus.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/minus.png-4762f967f2398859383593e0213c863b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/minus.png" +dest_files=[ "res://.import/minus.png-4762f967f2398859383593e0213c863b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Godot/assets/plus.png b/Godot/assets/plus.png new file mode 100644 index 0000000..3280065 Binary files /dev/null and b/Godot/assets/plus.png differ diff --git a/Godot/assets/plus.png.import b/Godot/assets/plus.png.import new file mode 100644 index 0000000..cc7c5d5 --- /dev/null +++ b/Godot/assets/plus.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/plus.png" +dest_files=[ "res://.import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Godot/src/dialogs/about_dialog.tscn b/Godot/src/dialogs/about_dialog.tscn index ce3838e..2e43aa6 100644 --- a/Godot/src/dialogs/about_dialog.tscn +++ b/Godot/src/dialogs/about_dialog.tscn @@ -83,7 +83,7 @@ margin_bottom = 50.0 [node name="VersionLabel" type="Label" parent="MarginContainer/VBoxContainer/CenterContainer2/VBoxContainer"] margin_right = 279.0 margin_bottom = 14.0 -text = "Version : 1.1.0" +text = "Version : 1.2.0" align = 1 [node name="LicenseLabel" type="Label" parent="MarginContainer/VBoxContainer/CenterContainer2/VBoxContainer"] diff --git a/Godot/src/interface/output_display.gd b/Godot/src/interface/output_display.gd index 49db208..ebef15c 100644 --- a/Godot/src/interface/output_display.gd +++ b/Godot/src/interface/output_display.gd @@ -22,40 +22,54 @@ #-- - Updated _ready to call _load_preferences #-- - Added _load_preferences fonction. #-- - Added the signal handlers to update in real time the display. +#-- +#-- - 27/07/2021 Lyaaaaa +#-- - Declared a preferences object. +#-- - Added _on_PlusButton_pressed and _on_MinusButton_pressed functions. +#-- - preferences object is used in these two functions to save the new value +#-- of the font size. +#-- - Updated _load_preferences to adapt to the changes. preferences becomes +#-- settings. +#-- - Deleted the _clipboard_button and replaced it with _buttons_container. +#-- - Declared the return type of the forgotten functions. #------------------------------------------------------------------------------ extends Panel -var _rich_label : RichTextLabel -var _clipboard_button : Button -var _rich_label_font : DynamicFont -var font_data_path := "res://assets/fonts/" +var _rich_label : RichTextLabel +var _buttons_container : HBoxContainer +var _rich_label_font : DynamicFont +var font_data_path := "res://assets/fonts/" +var preferences := Preferences.new() + func _ready() -> void: _init_variables() _load_preferences() + func append_text(p_text : String) -> void: _rich_label.add_text(p_text + "\n") - _clipboard_button.visible = true + _buttons_container.visible = true + func clear() -> void: _rich_label.clear() - _clipboard_button.visible = false + _buttons_container.visible = false func _init_variables() -> void: _rich_label = find_node("RichLabel") - _clipboard_button = find_node("ClipboardButton") + _buttons_container = find_node("ButtonsContainer") _rich_label_font = _rich_label.get_font("normal_font") func _load_preferences() -> void: - var preferences = Preferences.new().output_display - var font_name = preferences["font"] - var font_color = preferences["font_color"] - var font_size = preferences["font_size"] - var line_separation = preferences["line_separation"] - var selection_color = preferences["selection_color"] + var settings = preferences.output_display + var font_name = settings["font"] + var font_color = settings["font_color"] + var font_size = settings["font_size"] + var line_separation = settings["line_separation"] + var selection_color = settings["selection_color"] _rich_label_font.font_data = load(font_data_path + font_name + ".ttf") _rich_label_font.size = font_size @@ -70,21 +84,33 @@ func _on_ClipboardButton_pressed() -> void: Os.set_clipboard(_rich_label.text) -func _on_PreferencesDialog_font_changed(p_font_name : String): +func _on_PreferencesDialog_font_changed(p_font_name : String) -> void: _rich_label_font.font_data = load(font_data_path + p_font_name + ".ttf") -func _on_PreferencesDialog_font_color_changed(p_color : Color): +func _on_PreferencesDialog_font_color_changed(p_color : Color) -> void: _rich_label.add_color_override("default_color", p_color) -func _on_PreferencesDialog_font_size_changed(p_value : int): +func _on_PreferencesDialog_font_size_changed(p_value : int) -> void: _rich_label_font.size = p_value -func _on_PreferencesDialog_line_separation_changed(p_value : int): +func _on_PreferencesDialog_line_separation_changed(p_value : int) -> void: _rich_label.add_constant_override("line_separation", p_value) -func _on_PreferencesDialog_selection_color_changed(p_color : Color): +func _on_PreferencesDialog_selection_color_changed(p_color : Color) -> void: _rich_label.add_color_override("selection_color", p_color) + + +func _on_PlusButton_pressed() -> void: + _rich_label_font.size += 1 + preferences.output_display["font_size"] += 1 + preferences.save() + + +func _on_MinusButton_pressed() -> void: + _rich_label_font.size -= 1 + preferences.output_display["font_size"] -= 1 + preferences.save() diff --git a/Godot/src/interface/output_display.tscn b/Godot/src/interface/output_display.tscn index e9afbf7..d4c0902 100644 --- a/Godot/src/interface/output_display.tscn +++ b/Godot/src/interface/output_display.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://src/interface/output_display.gd" type="Script" id=1] [ext_resource path="res://assets/clipboard.png" type="Texture" id=2] [ext_resource path="res://assets/fonts/DejaVuSansMono.ttf" type="DynamicFontData" id=3] +[ext_resource path="res://assets/plus.png" type="Texture" id=4] +[ext_resource path="res://assets/minus.png" type="Texture" id=5] [sub_resource type="Theme" id=1] @@ -56,7 +58,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="ClipboardButton" type="Button" parent="."] +[node name="ButtonsContainer" type="HBoxContainer" parent="."] visible = false anchor_left = 1.0 anchor_right = 1.0 @@ -64,6 +66,38 @@ margin_left = -74.0 margin_top = 4.0 margin_right = -12.0 margin_bottom = 60.0 +grow_horizontal = 0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PlusButton" type="Button" parent="ButtonsContainer"] +margin_right = 60.0 +margin_bottom = 66.0 +hint_tooltip = "Increase font size." +mouse_default_cursor_shape = 2 +icon = ExtResource( 4 ) +flat = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MinusButton" type="Button" parent="ButtonsContainer"] +margin_left = 64.0 +margin_right = 124.0 +margin_bottom = 66.0 +hint_tooltip = "Decrease font size." +mouse_default_cursor_shape = 2 +icon = ExtResource( 5 ) +flat = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ClipboardButton" type="Button" parent="ButtonsContainer"] +margin_left = 128.0 +margin_right = 190.0 +margin_bottom = 66.0 hint_tooltip = "Save to clipboard" mouse_default_cursor_shape = 2 icon = ExtResource( 2 ) @@ -72,4 +106,6 @@ __meta__ = { "_edit_use_anchors_": false } -[connection signal="pressed" from="ClipboardButton" to="." method="_on_ClipboardButton_pressed"] +[connection signal="pressed" from="ButtonsContainer/PlusButton" to="." method="_on_PlusButton_pressed"] +[connection signal="pressed" from="ButtonsContainer/MinusButton" to="." method="_on_MinusButton_pressed"] +[connection signal="pressed" from="ButtonsContainer/ClipboardButton" to="." method="_on_ClipboardButton_pressed"] diff --git a/Godot/src/main.gd b/Godot/src/main.gd index 97a1ee7..7ade36d 100644 --- a/Godot/src/main.gd +++ b/Godot/src/main.gd @@ -5,6 +5,10 @@ #-- #-- Implementation Notes: #-- - +#-- +#-- Anticipated changes: +#-- - Update _on_files_dropped to open a tab for each file. +#-- #-- Changelog: #-- - 27/04/2021 Lyaaaaa #-- - Created the empty file. @@ -50,6 +54,14 @@ #-- - 23/07/2021 Lyaaaaa #-- - Added preferences_dialog variable. #-- - Added _on_TopMenu_preferences_button_pressed. +#-- +#-- - 27/07/2021 Lyaaaaa +#-- - Added _ready function. It connects the signal "files_dropped" to +#-- _on_files_dropped. +#-- - Added _on_files_dropped function which calls open_file. +#-- - Added open_file function. +#-- - Updated _on_FileDialog_file_selected to call open_file. +#-- - Declared _on_TopMenu_preferences_button_pressed return type is void. #------------------------------------------------------------------------------ extends Control @@ -67,6 +79,8 @@ onready var about_dialog = find_node("AboutDialog") onready var file_dialog = find_node("FileDialog") onready var preferences_dialog = find_node("PreferencesDialog") +func _ready(): + get_tree().connect("files_dropped", self, "_on_files_dropped") func search_file(p_display_all : bool = false) -> void: var line : String @@ -109,6 +123,13 @@ func reset_counters() -> void: total_lines = 0 +func open_file(p_path : String) -> void: + tool_bar.enable_buttons() + top_menu.set_text_top_label(p_path) + + file.open(p_path, File.READ) + + func _on_ToolBar_search_button_pressed(p_filters : Array) -> void: reset_counters() output_display.clear() @@ -126,10 +147,7 @@ func _on_ToolBar_switch_case_sensitive_button_pressed() -> void: func _on_FileDialog_file_selected(p_path : String) -> void: - tool_bar.enable_buttons() - top_menu.set_text_top_label(p_path) - - file.open(p_path, File.READ) + open_file(p_path) func _on_TopMenu_open_file_button_pressed() -> void: @@ -148,5 +166,9 @@ func _on_ToolBar_display_all_button_pressed() -> void: search_file(display_all) -func _on_TopMenu_preferences_button_pressed(): +func _on_TopMenu_preferences_button_pressed() -> void: preferences_dialog.popup_centered() + + +func _on_files_dropped(p_files : Array, p_screen : int) -> void: + open_file(p_files[0]) diff --git a/Godot/tests/preferences.test.gd b/Godot/tests/preferences.test.gd index 172726b..e749f3c 100644 --- a/Godot/tests/preferences.test.gd +++ b/Godot/tests/preferences.test.gd @@ -12,6 +12,13 @@ #-- Changelog: #-- - 26/07/2021 Lyaaaaa #-- - Created the file. +#-- +#-- - 27/07/2021 +#-- - Fixed some errors +#-- - Renamed file_path into _file_path +#-- - Updated post to delete the saved file between two functions. +#-- - Deleted the lines changing the file_path. No need to use a specific +#-- path to test. #------------------------------------------------------------------------------ extends WAT.Test @@ -22,10 +29,11 @@ var context : String func pre() -> void: preferences = Preferences.new() - preferences.file_path = "user://test" func post() -> void: + var directory = Directory.new() + directory.remove(preferences._file_path) preferences.free() context = "" @@ -41,8 +49,8 @@ func test_save() -> void: old_value = preferences.output_display["font"] preferences.output_display["font"] = "Test" preferences.save() - - file.open(preferences.file_path, File.READ) + + file.open(preferences._file_path, File.READ) output_display = file.get_var() new_value = output_display["font"] @@ -60,8 +68,7 @@ func test_load() -> void: preferences.save() preferences.free() - preferences = Preferences.new() - preferences.file_path = "user://test" + preferences = Preferences.new() preferences.load() output_display = preferences.output_display diff --git a/README.md b/README.md index 9a102d5..1608d46 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ right-hand corner of the application. clipboard. - **Saved preferences** - You can change the size, style or color of the font and more. +- **Drag and drop** - Don't waste time! Drag your log file directly into the software. ## Why is this project useful? diff --git a/management/class_diagram b/management/class_diagram index e44cc2e..3c864b9 100644 --- a/management/class_diagram +++ b/management/class_diagram @@ -1,271 +1,280 @@ - + umbrello uml modeller 2.32.2 http://umbrello.kde.org 1.6.19 UnicodeUTF8 - + - + - - + + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + + - + - - + + - + - - + + - + + + + + + + + + + + + + - - - - - - - + - - - - - - + + + + + + - - + + - + - + - + - + - - - - + + + + - - + + - - - - - + + + + + - - - - - - - + + + + + + + - - + + - + - - - - - + + + + + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/management/class_diagram.png b/management/class_diagram.png index c18df3a..eaac3a7 100644 Binary files a/management/class_diagram.png and b/management/class_diagram.png differ