From b69be6e07c8d4ec528b4497863b847439b2b6d80 Mon Sep 17 00:00:00 2001 From: Xananax Date: Sat, 22 Apr 2023 22:02:31 +0200 Subject: [PATCH] added theme --- .../Cairo-VariableFont_slnt,wght.ttf.import | 33 -------- ...o-VariableFont_slnt,wght.ttf => Cairo.ttf} | Bin assets/default_theme.theme | Bin 157 -> 1413 bytes assets/toggle_button_up.svg | 53 ++++++++++++ assets/toggle_button_up.svg.import | 35 ++++++++ ui/{main.gd => composed_ui.gd} | 6 +- ui/composed_ui.tscn | 76 ++++++++++++++++++ ui/main.tscn | 68 ---------------- ui/settings.gd | 9 ++- ui/settings.tscn | 14 +++- ui/time_counter.tscn | 7 ++ 11 files changed, 194 insertions(+), 107 deletions(-) delete mode 100644 assets/Cairo-VariableFont_slnt,wght.ttf.import rename assets/{Cairo-VariableFont_slnt,wght.ttf => Cairo.ttf} (100%) create mode 100644 assets/toggle_button_up.svg create mode 100644 assets/toggle_button_up.svg.import rename ui/{main.gd => composed_ui.gd} (87%) create mode 100644 ui/composed_ui.tscn delete mode 100644 ui/main.tscn diff --git a/assets/Cairo-VariableFont_slnt,wght.ttf.import b/assets/Cairo-VariableFont_slnt,wght.ttf.import deleted file mode 100644 index 3ab7e3c..0000000 --- a/assets/Cairo-VariableFont_slnt,wght.ttf.import +++ /dev/null @@ -1,33 +0,0 @@ -[remap] - -importer="font_data_dynamic" -type="FontFile" -uid="uid://xixlsyswj6mv" -path="res://.godot/imported/Cairo-VariableFont_slnt,wght.ttf-8e1ad3a3f88c2663b83086e73553b314.fontdata" - -[deps] - -source_file="res://assets/Cairo-VariableFont_slnt,wght.ttf" -dest_files=["res://.godot/imported/Cairo-VariableFont_slnt,wght.ttf-8e1ad3a3f88c2663b83086e73553b314.fontdata"] - -[params] - -Rendering=null -antialiasing=1 -generate_mipmaps=false -multichannel_signed_distance_field=false -msdf_pixel_range=8 -msdf_size=48 -allow_system_fallback=true -force_autohinter=false -hinting=1 -subpixel_positioning=1 -oversampling=0.0 -Fallbacks=null -fallbacks=[] -Compress=null -compress=true -preload=[] -language_support={} -script_support={} -opentype_features={} diff --git a/assets/Cairo-VariableFont_slnt,wght.ttf b/assets/Cairo.ttf similarity index 100% rename from assets/Cairo-VariableFont_slnt,wght.ttf rename to assets/Cairo.ttf diff --git a/assets/default_theme.theme b/assets/default_theme.theme index 231bc883835e05086bd465d76fc0475b126a96e0..e8fb9a5ca997be84db74001865b8d795cb05ac37 100644 GIT binary patch literal 1413 zcmV;01$z2YQ$s@n000005C8zU5C8!D1ONbS0000ewJ-f(01uTX0Jie0M8H}}IzR}Z zKxY~;5)A`@0CTNJ4Dxw}WuKwJtV-Qp$h3S${ML66EC<&01^jeNVV8dWZ`t^$t6@5NKbX70wpgVc3NE?Q`r z+MIKgr)I-oK>}8D(g<4SY}Jf-#-+SLqZmIlOx|PTa}|onc~mv16d&Q`B7FQqjf01v z(Yen|>OEtw!Z08lkH+2kT#&7+Uu@uA_fEAk5@EOb-iTp9mu*qgYGRYENRNvCBlv&% zWGzm}E!kh~8=+s^aL(AeM{#~~f(ChdUTyeaLhAe-HRKyLjH9kEQ&%PzE714-y~*AxSX|5-G(H5s3sTX*p#j!vS?G2r*&t zSLZOkEW4A#@9LNzwRo(3X|#ku&4lrrV429{`9piX#l*-_S7tb`1zseMIo!dFy(dSy zU@-S4OM%n+#@PG~TB9*$ZL5K+;SND2r;yx!$XZak(%PsPEjspM&MOf4B{1#6Ie!P9 zf*c>xn-F*8!DDGOu)`(A#Nkw%)R^4F4K0)aZtLVj`UjY)#1wbUl=KcKb3}UkPY?Vy z!{dPo5AY)#xCr?nCZUlN)}lJN1z}Psf9SHIhNw2a`GLQToU^R z>vohBKD4PrugU4`k%l8-$Z>ZYrMy0=Zkow`X^^Hw8rI|PkgCR0DI`P<|#YYq( zESVTkujg1{To-NWO>P{UVTt0dF87zB3&G0>d{Zs_uSDiH(YmVcAO{+YQ#cx3YSINI z9Epfs_X9z(FK+S_)^$goce$Ws7vX~RgF%w*=_4XrLrY3V+)Z6QE2&F@ITX+H1~G|m zpf$@$F3|)iwJ-f3xFrJsLd6goaBa&00Il>@>I{Rf9EsTM3;+NDfoKwHLQ;z<*b~AX z41ZSF8jQrNw8g^#VUJXS@a4^5MDiX*9eTRp&Y1%qI0*~@z@)0X9~&U%k!S;mMxW7y T1XCJp0T>tfW0R>TQd2`ihd7aY literal 157 zcmWFvc6MfB00IF9hR;B%6^J#q>i<>v{FIqt(J?WF37RkegFtbnb+2j* + + + + + + + + + + + diff --git a/assets/toggle_button_up.svg.import b/assets/toggle_button_up.svg.import new file mode 100644 index 0000000..5940f24 --- /dev/null +++ b/assets/toggle_button_up.svg.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/toggle_button_up.svg-42d50bf036f845a14cc3c73e27b9d2ba.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/toggle_button_up.svg" +dest_files=[ "res://.import/toggle_button_up.svg-42d50bf036f845a14cc3c73e27b9d2ba.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/ui/main.gd b/ui/composed_ui.gd similarity index 87% rename from ui/main.gd rename to ui/composed_ui.gd index 369db2f..62d6f33 100644 --- a/ui/main.gd +++ b/ui/composed_ui.gd @@ -1,4 +1,4 @@ -extends VBoxContainer +extends Control var config: ConfigManager = preload("res://config_manager.tres") @@ -22,7 +22,9 @@ func _on_toggle_tab_container_button_toggled(is_toggled: bool) -> void: func set_window_size() -> void: - OS.window_size = v_box_container_primary.rect_size + var style_box := theme.get_stylebox("panel", "background") as StyleBoxFlat + var margin := style_box.content_margin_bottom * 2 + OS.window_size = v_box_container_primary.rect_size + Vector2.ONE * margin if tab_container.visible: OS.window_size.y += tab_container.rect_size.y diff --git a/ui/composed_ui.tscn b/ui/composed_ui.tscn new file mode 100644 index 0000000..6f70e37 --- /dev/null +++ b/ui/composed_ui.tscn @@ -0,0 +1,76 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://assets/default_theme.theme" type="Theme" id=1] +[ext_resource path="res://ui/tasks_list.tscn" type="PackedScene" id=2] +[ext_resource path="res://ui/time_counter.tscn" type="PackedScene" id=3] +[ext_resource path="res://ui/settings.tscn" type="PackedScene" id=4] +[ext_resource path="res://ui/composed_ui.gd" type="Script" id=5] + +[node name="PanelContainer" type="PanelContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +theme_type_variation = "background" +script = ExtResource( 5 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_left = 5.0 +margin_top = 5.0 +margin_right = 355.0 +margin_bottom = 755.0 + +[node name="VBoxContainerPrimary" type="VBoxContainer" parent="VBoxContainer"] +unique_name_in_owner = true +margin_right = 350.0 +margin_bottom = 187.0 + +[node name="TimeCounter" parent="VBoxContainer/VBoxContainerPrimary" instance=ExtResource( 3 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 350.0 +margin_bottom = 141.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/VBoxContainerPrimary"] +margin_top = 148.0 +margin_right = 350.0 +margin_bottom = 187.0 +alignment = 2 + +[node name="ToggleTabContainerButton" type="Button" parent="VBoxContainer/VBoxContainerPrimary/HBoxContainer"] +unique_name_in_owner = true +margin_left = 329.0 +margin_right = 350.0 +margin_bottom = 39.0 +theme_type_variation = "panel_toggle_button" +toggle_mode = true + +[node name="TabContainer" type="TabContainer" parent="VBoxContainer"] +unique_name_in_owner = true +margin_top = 194.0 +margin_right = 350.0 +margin_bottom = 750.0 +size_flags_vertical = 3 + +[node name="TasksList" parent="VBoxContainer/TabContainer" instance=ExtResource( 2 )] +margin_left = 5.0 +margin_top = 46.0 +margin_right = -5.0 +margin_bottom = -5.0 +size_flags_horizontal = 3 + +[node name="Settings" type="ScrollContainer" parent="VBoxContainer/TabContainer"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Settings" parent="VBoxContainer/TabContainer/Settings" instance=ExtResource( 4 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 342.0 +margin_bottom = 520.0 diff --git a/ui/main.tscn b/ui/main.tscn deleted file mode 100644 index 455e399..0000000 --- a/ui/main.tscn +++ /dev/null @@ -1,68 +0,0 @@ -[gd_scene load_steps=6 format=2] - -[ext_resource path="res://ui/time_counter.tscn" type="PackedScene" id=1] -[ext_resource path="res://ui/tasks_list.tscn" type="PackedScene" id=2] -[ext_resource path="res://ui/settings.tscn" type="PackedScene" id=3] -[ext_resource path="res://ui/main.gd" type="Script" id=4] -[ext_resource path="res://assets/default_theme.theme" type="Theme" id=5] - -[node name="Main" type="VBoxContainer"] -anchor_right = 1.0 -anchor_bottom = 1.0 -theme = ExtResource( 5 ) -script = ExtResource( 4 ) - -[node name="VBoxContainerPrimary" type="VBoxContainer" parent="."] -unique_name_in_owner = true -margin_right = 360.0 -margin_bottom = 72.0 - -[node name="TimeCounter" parent="VBoxContainerPrimary" instance=ExtResource( 1 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_right = 360.0 -margin_bottom = 48.0 - -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainerPrimary"] -margin_top = 52.0 -margin_right = 360.0 -margin_bottom = 72.0 -alignment = 2 - -[node name="ToggleTabContainerButton" type="Button" parent="VBoxContainerPrimary/HBoxContainer"] -unique_name_in_owner = true -margin_left = 348.0 -margin_right = 360.0 -margin_bottom = 20.0 -toggle_mode = true - -[node name="TabContainer" type="TabContainer" parent="."] -unique_name_in_owner = true -margin_top = 76.0 -margin_right = 360.0 -margin_bottom = 760.0 -size_flags_vertical = 3 - -[node name="TasksList" parent="TabContainer" instance=ExtResource( 2 )] -margin_left = 4.0 -margin_top = 32.0 -margin_right = -4.0 -margin_bottom = -4.0 -size_flags_horizontal = 3 - -[node name="Settings" type="ScrollContainer" parent="TabContainer"] -visible = false -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 4.0 -margin_top = 32.0 -margin_right = -4.0 -margin_bottom = -4.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="Settings" parent="TabContainer/Settings" instance=ExtResource( 3 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_right = 352.0 -margin_bottom = 648.0 diff --git a/ui/settings.gd b/ui/settings.gd index 0987d95..f8dfae8 100644 --- a/ui/settings.gd +++ b/ui/settings.gd @@ -7,6 +7,7 @@ onready var file_path_button := $"%FilePathButton" as Button onready var theme_path_button := $"%ThemePathButton" as Button onready var sound_check_box := $"%SoundCheckBox" as CheckBox onready var open_data_dir_button := $"%OpenDataDirButton" as Button +onready var file_path_open_button := $"%FilePathOpenButton" as Button onready var attributions_rich_text_label := $"%AttributionsRichTextLabel" as RichTextLabel onready var file_path_file_dialog := $"%FilePathFileDialog" as FileDialog onready var theme_path_file_dialog := $"%ThemePathFileDialog" as FileDialog @@ -47,7 +48,8 @@ func _ready() -> void: # warning-ignore:return_value_discarded open_data_dir_button.connect("pressed", self, "_on_open_data_dir_button_pressed") - +# warning-ignore:return_value_discarded + file_path_open_button.connect("pressed", self, "_on_file_path_open_button_pressed") _on_current_file_changed() @@ -90,3 +92,8 @@ func _on_attributions_rich_text_label_meta_clicked(meta) -> void: func _on_open_data_dir_button_pressed() -> void: # warning-ignore:return_value_discarded OS.shell_open(OS.get_user_data_dir()) + + +func _on_file_path_open_button_pressed() -> void: + # warning-ignore:return_value_discarded + OS.shell_open(config.current_timesheet_file_path.get_base_dir()) diff --git a/ui/settings.tscn b/ui/settings.tscn index b400c02..9c069bb 100644 --- a/ui/settings.tscn +++ b/ui/settings.tscn @@ -29,7 +29,7 @@ text = "File Path" [node name="FilePathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true margin_left = 59.0 -margin_right = 332.0 +margin_right = 223.0 margin_bottom = 24.0 size_flags_horizontal = 3 caret_blink = true @@ -37,11 +37,18 @@ caret_blink_speed = 0.5 [node name="FilePathButton" type="Button" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true -margin_left = 336.0 -margin_right = 360.0 +margin_left = 227.0 +margin_right = 251.0 margin_bottom = 24.0 text = "..." +[node name="FilePathOpenButton" type="Button" parent="VBoxContainer/HBoxContainer"] +unique_name_in_owner = true +margin_left = 255.0 +margin_right = 360.0 +margin_bottom = 24.0 +text = "open directory" + [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] margin_top = 28.0 margin_right = 360.0 @@ -86,6 +93,7 @@ margin_top = 104.0 margin_right = 360.0 margin_bottom = 760.0 size_flags_vertical = 3 +theme_type_variation = "small_text" bbcode_enabled = true bbcode_text = "Font: Cairo, Designed by Mohamed Gaber, Accademia di Belle Arti di Urbino diff --git a/ui/time_counter.tscn b/ui/time_counter.tscn index 1344ebd..5ced5a3 100644 --- a/ui/time_counter.tscn +++ b/ui/time_counter.tscn @@ -11,6 +11,7 @@ script = ExtResource( 1 ) unique_name_in_owner = true margin_right = 360.0 margin_bottom = 24.0 +placeholder_text = "Task Name. Use \"/\" to create subtasks" [node name="HBoxContainer" type="HBoxContainer" parent="."] margin_top = 28.0 @@ -25,12 +26,18 @@ margin_top = 359.0 margin_right = 344.0 margin_bottom = 373.0 size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_type_variation = "time_label" +text = "00:00:00" +align = 1 +valign = 1 [node name="StartButton" type="Button" parent="HBoxContainer"] unique_name_in_owner = true margin_left = 348.0 margin_right = 360.0 margin_bottom = 732.0 +theme_type_variation = "play_button" [node name="Timer" type="Timer" parent="."] unique_name_in_owner = true