From cf171bcc633eb31b005eae196ac5aa53b78a6d8e Mon Sep 17 00:00:00 2001 From: Xananax Date: Sat, 22 Apr 2023 04:04:35 +0200 Subject: [PATCH] cleaned up --- scripts/config_manager.gd | 15 --------------- scripts/file_watcher.gd | 1 - scripts/time_entry_tree_item.gd | 4 ---- scripts/time_sheet.gd | 2 -- ui/settings.gd | 8 ++++---- ui/tasks_list.gd | 15 --------------- ui/time_counter.gd | 14 ++------------ 7 files changed, 6 insertions(+), 53 deletions(-) diff --git a/scripts/config_manager.gd b/scripts/config_manager.gd index 21d9b76..c4a4af8 100644 --- a/scripts/config_manager.gd +++ b/scripts/config_manager.gd @@ -42,10 +42,6 @@ func _load_timesheet(path: String) -> TimeSheet: # warning-ignore:return_value_discarded _watcher.connect("file_changed", self, "reload_timesheet") _watcher.start() - # warning-ignore:return_value_discarded - #timesheet.connect("entry_started", self, "_on_entry_started") - # warning-ignore:return_value_discarded - #timesheet.connect("entry_stopped", self, "_on_entry_stopped") return new_timesheet @@ -119,17 +115,6 @@ func get_theme_file_path() -> String: return _config.get_value("MAIN", "theme", preload("res://assets/default_theme.theme").resource_path) -#var current_task_name: String = "" setget set_current_task_name, get_current_task_name -# -#func set_current_task_name(value: String) -> void: -# current_task_name = value -# _config.set_value("MAIN", "current_task_name", value) -# save() -# -#func get_current_task_name() -> String: -# return _config.get_value("MAIN", "current_task_name", "") - - ############################################################################### # # SOUND OPTION diff --git a/scripts/file_watcher.gd b/scripts/file_watcher.gd index f5e1bb2..cce9620 100644 --- a/scripts/file_watcher.gd +++ b/scripts/file_watcher.gd @@ -37,7 +37,6 @@ func check() -> void: var new_modified := _file.get_modified_time(file_name) if new_modified != _last_modified: _last_modified = new_modified - print("file changed") emit_signal("file_changed") diff --git a/scripts/time_entry_tree_item.gd b/scripts/time_entry_tree_item.gd index 5cd5275..25f84bb 100644 --- a/scripts/time_entry_tree_item.gd +++ b/scripts/time_entry_tree_item.gd @@ -36,10 +36,6 @@ func append(new_time_entry: TimeEntry) -> void: var TimeEntryTreeItem = load("res://scripts/time_entry_tree_item.gd") var time_entry_tree_item = TimeEntryTreeItem.new() time_entry_tree_item.time_entry = new_time_entry - # warning-ignore:return_value_discarded - # new_time_entry.connect("end_time_updated", time_entry_tree_item, "_on_end_time_updated") - # warning-ignore:return_value_discarded - # time_entry_tree_item.connect("end_time_updated", self, "_on_end_time_updated") time_entries.append(time_entry_tree_item) diff --git a/scripts/time_sheet.gd b/scripts/time_sheet.gd index 9d9e0fd..1b4d41b 100644 --- a/scripts/time_sheet.gd +++ b/scripts/time_sheet.gd @@ -62,7 +62,6 @@ func add_entry(entry_name: String) -> TimeEntry: func stop_entry(entry_name: String, do_save := true) -> bool: - prints("stopping", entry_name) for _entry in entries: var current_time_entry := _entry as TimeEntry if current_time_entry.name == entry_name and not current_time_entry.is_closed: @@ -99,7 +98,6 @@ func save() -> void: if success != OK: printerr("Could not open file") return - prints("saving") for time_entry in entries: file.store_csv_line(time_entry.to_csv_line()) diff --git a/ui/settings.gd b/ui/settings.gd index 165f06c..0987d95 100644 --- a/ui/settings.gd +++ b/ui/settings.gd @@ -18,7 +18,7 @@ func _ready() -> void: config.connect("theme_changed", self, "_on_theme_changed") # warning-ignore:return_value_discarded - config.connect("file_changed", self, "_on_current_file_changed") + config.connect("time_sheet_loaded", self, "_on_current_file_changed") # warning-ignore:return_value_discarded file_path_button.connect("pressed", self, "_on_file_path_button_pressed") @@ -52,9 +52,9 @@ func _ready() -> void: func _on_current_file_changed() -> void: - file_path_file_dialog.current_path = config.current_file - file_path_file_dialog.current_dir = config.current_file.get_base_dir() - file_path_line_edit.text = config.current_file + file_path_file_dialog.current_path = config.current_timesheet_file_path + file_path_file_dialog.current_dir = config.current_timesheet_file_path.get_base_dir() + file_path_line_edit.text = config.current_timesheet_file_path func _on_theme_changed() -> void: diff --git a/ui/tasks_list.gd b/ui/tasks_list.gd index 428ca56..9a261a2 100644 --- a/ui/tasks_list.gd +++ b/ui/tasks_list.gd @@ -28,21 +28,6 @@ func populate_entries() -> void: var item_entries_tree := config.timesheet.make_items_tree() _populate_from_entry(tree_items_root, item_entries_tree) _timer.start() - #for item in entries: - # warning-ignore:return_value_discarded - # set_entry(entry) - - -# warning-ignore:unused_argument -func set_time_elapsed(total_elapsed: int) -> void: - #current_item.set_text(COL.TIME, TimeEntry.time_to_period(total_elapsed)) - #current_item.set_metadata(COL.TIME, total_elapsed) - pass - - -func set_current_item(_task_name: String) -> void: - #current_item = append_name_to_tree(task_name, 0) - pass func _on_timer_timeout() -> void: diff --git a/ui/time_counter.gd b/ui/time_counter.gd index 28cdc9c..d9f941a 100644 --- a/ui/time_counter.gd +++ b/ui/time_counter.gd @@ -25,15 +25,6 @@ func _ready() -> void: # warning-ignore:return_value_discarded config.connect("time_sheet_loaded", self, "_on_time_sheet_loaded") update_timer_state() - # warning-ignore:return_value_discarded - #config.connect("entry_started", self, "set_button_as_started") - # warning-ignore:return_value_discarded - #config.connect("entry_stopped", self, "set_button_as_stopped") - # TODO: connect this: - #time_entries_items_tree.item_selected.connect( - # func item_selected() -> void: - # task_name_line_edit.text = time_entries_items_tree.get_current_text() - #) func _on_timer_timeout() -> void: @@ -45,8 +36,10 @@ func _on_start_button_toggled(_is_on: bool) -> void: if config.sound_fx_on: audio_stream_player.play() if current_time_entry != null: + # warning-ignore:return_value_discarded config.timesheet.stop_entry(task_name_line_edit.text) else: + # warning-ignore:return_value_discarded config.timesheet.add_entry(task_name_line_edit.text) @@ -56,7 +49,6 @@ func _on_task_name_line_edit_text_changed(new_text: String) -> void: func _on_time_sheet_loaded(): - print("loaded") update_timer_state() func update_timer_state() -> void: @@ -76,8 +68,6 @@ func set_button_as_stopped() -> void: func set_button_as_started() -> void: - ## TODO: make this independent - # time_entries_items_tree.set_current_item(config.timesheet.current_entry.name) start_button.set_pressed_no_signal(true) start_button.hint_tooltip = tr(Consts.STOP) start_button.theme_type_variation = Consts.THEME_OVERRIDE_STOP