cleaned up

This commit is contained in:
xananax prozaxx 2023-04-22 04:04:35 +02:00
parent 17d8637156
commit cf171bcc63
7 changed files with 6 additions and 53 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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