added theme

This commit is contained in:
2023-04-22 22:02:31 +02:00
parent cbc64a0b02
commit b69be6e07c
11 changed files with 194 additions and 107 deletions

View File

@ -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

76
ui/composed_ui.tscn Normal file
View File

@ -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

View File

@ -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

View File

@ -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())

View File

@ -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

View File

@ -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