Compare commits

..

1 Commits

Author SHA1 Message Date
ac9e94c9b0 api for plugins 2023-03-03 21:23:11 +04:00
63 changed files with 1289 additions and 2850 deletions

24
.gitignore vendored
View File

@ -1,22 +1,2 @@
# .gitignore generated by Hourglass
# For more information on what files should be excluded from version control,
# see <https://docs.godotengine.org/en/stable/getting_started/workflow/project_setup/version_control_systems.html#files-to-exclude-from-vcs>
.import/
export.cfg
exports/*.apk
exports/*.exe
exports/*.pck
exports/*.x86_64
exports/*.zip
exports/web/
# Exclude imported translations
*.translation
# Mono-specific
.mono/
data_*/
# Don't include those pesky .DS_Store files on macOS
.DS_Store
.godot/
exports/

View File

@ -1,431 +0,0 @@
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
COOPERATIVE NON-VIOLENT PUBLIC LICENSE (\"LICENSE\"). THE WORK IS
PROTECTED BY COPYRIGHT AND ALL OTHER APPLICABLE LAWS. ANY USE OF THE
WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED IN THIS
LICENSE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE
EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR
GRANTS YOU THE RIGHTS CONTAINED HERE IN AS CONSIDERATION FOR ACCEPTING
THE TERMS AND CONDITIONS OF THIS LICENSE AND FOR AGREEING TO BE BOUND BY
THE TERMS AND CONDITIONS OF THIS LICENSE.
# Definitions
An Act of War is any action of one country against any group either with
an intention to provoke a conflict or an action that occurs during a
declared war or during armed conflict between military forces of any
origin. This includes but is not limited to enforcing sanctions or
sieges, supplying armed forces, or profiting from the manufacture of
tools or weaponry used in military conflict.
An Adaptation is a work based upon the Work, or upon the Work and other
pre-existing works, such as a translation, adaptation, derivative work,
arrangement of music or other alterations of a literary or artistic
work, or phonogram or performance and includes cinematographic
adaptations or any other form in which the Work may be recast,
transformed, or adapted including in any form recognizably derived from
the original, except that a work that constitutes a Collection will not
be considered an Adaptation for the purpose of this License. For the
avoidance of doubt, where the Work is a musical work, performance or
phonogram, the synchronization of the Work in timed-relation with a
moving image (\"synching\") will be considered an Adaptation for the
purpose of this License. In addition, where the Work is designed to
output a neural network the output of the neural network will be
considered an Adaptation for the purpose of this license.
Bodily Harm is any physical hurt or injury to a person that interferes
with the health or comfort of the person and that is more than merely
transient or trifling in nature.
Distribute is to make available to the public the original and copies of
the Work or Adaptation, as appropriate, through sale, gift or any other
transfer of possession or ownership.
Incarceration is Confinement in a jail, prison, or any other place where
individuals of any kind are held against either their will or (if their
will cannot be determined) the will of their legal guardian or
guardians. In the case of a conflict between the will of the individual
and the will of their legal guardian or guardians, the will of the
individual will take precedence.
Licensor is The individual, individuals, entity, or entities that
offer(s) the Work under the terms of this License
Original Author is in the case of a literary or artistic work, the
individual, individuals, entity or entities who created the Work or if
no individual or entity can be identified, the publisher; and in
addition
- in the case of a performance the actors, singers, musicians,
dancers, and other persons who act, sing, deliver, declaim, play in,
interpret or otherwise perform literary or artistic works or
expressions of folklore;
- in the case of a phonogram the producer being the person or legal
entity who first fixes the sounds of a performance or other sounds;
and,
- in the case of broadcasts, the organization that transmits the
broadcast.
Work is the literary and/or artistic work offered under the terms of
this License including without limitation any production in the
literary, scientific and artistic domain, whatever may be the mode or
form of its expression including digital form, such as a book, pamphlet
and other writing; a lecture, address, sermon or other work of the same
nature; a dramatic or dramatico-musical work; a choreographic work or
entertainment in dumb show; a musical composition with or without words;
a cinematographic work to which are assimilated works expressed by a
process analogous to cinematography; a work of drawing, painting,
architecture, sculpture, engraving or lithography; a photographic work
to which are assimilated works expressed by a process analogous to
photography; a work of applied art; an illustration, map, plan, sketch
or three-dimensional work relative to geography, topography,
architecture or science; a performance; a broadcast; a phonogram; a
compilation of data to the extent it is protected as a copyrightable
work; or a work performed by a variety or circus performer to the extent
it is not otherwise considered a literary or artistic work.
You means an individual or entity exercising rights under this License
who has not previously violated the terms of this License with respect
to the Work, or who has received express permission from the Licensor to
exercise rights under this License despite a previous violation.
Publicly Perform means to perform public recitations of the Work and to
communicate to the public those public recitations, by any means or
process, including by wire or wireless means or public digital
performances; to make available to the public Works in such a way that
members of the public may access these Works from a place and at a place
individually chosen by them; to perform the Work to the public by any
means or process and the communication to the public of the performances
of the Work, including by public digital performance; to broadcast and
rebroadcast the Work by any means including signs, sounds or images.
Reproduce is to make copies of the Work by any means including without
limitation by sound or visual recordings and the right of fixation and
reproducing fixations of the Work, including storage of a protected
performance or phonogram in digital form or other electronic medium.
Software is any digital Work which, through use of a third-party piece
of Software or through the direct usage of itself on a computer system,
the memory of the computer is modified dynamically or semi-dynamically.
\"Software\", secondly, processes or interprets information.
Source Code is Any digital Work which, through use of a third-party
piece of Software or through the direct usage of itself on a computer
system, the memory of the computer is modified dynamically or
semi-dynamically. \"Software\", secondly, processes or interprets
information.
Surveilling is the use of the Work to either overtly or covertly observe
and record persons and or their activities.
A Network Service is the use of a piece of Software to interpret or
modify information that is subsequently and directly served to users
over the Internet.
To Discriminate is use of a work to differentiate between humans in a
such a way which prioritizes some above others on the basis of percieved
membership within certain groups.
Hate Speech is Communication or any form of expression which is solely
for the purpose of expressing hatred for some group or advocating a form
of Discrimination between humans.
Coercion is leveraging of the threat of force or use of force to
intimidate a person in order to gain compliance, or to offer large
incentives which aim to entice a person to act against their will.
# Fair Dealing Rights
Nothing in this License is intended to reduce, limit, or restrict any
uses free from copyright or rights arising from limitations or
exceptions that are provided for in connection with the copyright
protection under copyright law or other applicable laws.
# License Grant
Subject to the terms and conditions of this License, Licensor hereby
grants You a worldwide, royalty-free, non-exclusive, perpetual (for the
duration of the applicable copyright) license to exercise the rights in
the Work as stated below:
To Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections
To create and Reproduce Adaptations provided that any such Adaptation,
including any translation in any medium, takes reasonable steps to
clearly label, demarcate or otherwise identify that changes were made to
the original Work. For example, a translation could be marked \"The
original work was translated from English to Spanish,\" or a
modification could indicate \"The original work has been modified.\"
To Distribute and Publicly Perform the Work including as incorporated in
Collections.
To Distribute and Publicly Perform Adaptations. The above rights may be
exercised in all media and formats whether now known or hereafter
devised. The above rights include the right to make such modifications
as are technically necessary to exercise the rights in other media and
formats. This License constitutes the entire agreement between the
parties with respect to the Work licensed here. There are no
understandings, agreements or representations with respect to the Work
not specified here. Licensor shall not be bound by any additional
provisions that may appear in any communication from You. This License
may not be modified without the mutual written agreement of the Licensor
and You. All rights not expressly granted by Licensor are hereby
reserved, including but not limited to the rights set forth in
Non-waivable Compulsory License Schemes, Waivable Compulsory License
Schemes, and Voluntary License Schemes in the restrictions.
# Restrictions
The license granted in the license grant above is expressly made subject
to and limited by the following restrictions:
You may Distribute or Publicly Perform the Work only under the terms of
this License. You must include a copy of, or the Uniform Resource
Identifier (URI) for, this License with every copy of the Work You
Distribute or Publicly Perform. You may not offer or impose any terms on
the Work that restrict the terms of this License or the ability of the
recipient of the Work to exercise the rights granted to that recipient
under the terms of the License. You may not sublicense the Work. You
must keep intact all notices that refer to this License and to the
disclaimer of warranties with every copy of the Work You Distribute or
Publicly Perform. When You Distribute or Publicly Perform the Work, You
may not impose any effective technological measures on the Work that
restrict the ability of a recipient of the Work from You to exercise the
rights granted to that recipient under the terms of the License. This
Section applies to the Work as incorporated in a Collection, but this
does not require the Collection apart from the Work itself to be made
subject to the terms of this License. If You create a Collection, upon
notice from any Licensor You must, to the extent practicable, remove
from the Collection any credit as requested. If You create an
Adaptation, upon notice from any Licensor You must, to the extent
practicable, remove from the Adaptation any credit as requested.
If the Work meets the definition of Software, You may exercise the
rights granted in the license grant only if You provide a copy of the
corresponding Source Code from which the Work was derived in digital
form, or You provide a URI for the corresponding Source Code of the
Work, to any recipients upon request.
If the Work is used as or for a Network Service, You may exercise the
rights granted in the license grant only if You provide a copy of the
corresponding Source Code from which the Work was derived in digital
form, or You provide a URI for the corresponding Source Code to the
Work, to any recipients of the data served or modified by the Web
Service.
##
You may exercise the rights granted in the license grant for any
purposes only if:
i. You do not use the Work for the purpose of inflicting Bodily Harm on
human beings (subject to criminal prosecution or otherwise) outside
of providing medical aid or undergoing a voluntary procedure under
no form of Coercion.
ii. You do not use the Work for the purpose of Surveilling or tracking
individuals for financial gain.
iii. You do not use the Work in an Act of War.
iv. You do not use the Work for the purpose of supporting or profiting
from an Act of War.
v. You do not use the Work for the purpose of Incarceration.
vi. You do not use the Work for the purpose of extracting, processing,
or refining, oil, gas, or coal. Or to in any other way to
deliberately pollute the environment as a byproduct of manufacturing
or irresponsible disposal of hazardous materials.
vii. You do not use the Work for the purpose of expediting,
coordinating, or facilitating paid work undertaken by individuals
under the age of 12 years.
viii. You do not use the Work to either Discriminate or spread Hate
Speech on the basis of sex, sexual orientation, gender identity,
race, age, disability, color, national origin, religion, caste, or
lower economic status.
##
If You Distribute, or Publicly Perform the Work or any Adaptations or
Collections, You must, unless a request has been made by any Licensor to
remove credit from a Collection or Adaptation, keep intact all copyright
notices for the Work and provide, reasonable to the medium or means You
are utilizing:
i. the name of the Original Author (or pseudonym, if applicable) if
supplied, and/or if the Original Author and/or Licensor designate
another party or parties (e.g., a sponsor institute, publishing
entity, journal) for attribution (\"Attribution Parties\") in
Licensor\'s copyright notice, terms of service or by other
reasonable means, the name of such party or parties;
ii. the title of the Work if supplied;
iii. to the extent reasonably practicable, the URI, if any, that
Licensor to be associated with the Work, unless such URI does not
refer to the copyright notice or licensing information for the
Work; and,
iv. in the case of an Adaptation, a credit identifying the use of the
Work in the Adaptation (e.g., \"French translation of the Work by
Original Author,\" or \"Screenplay based on original Work by
Original Author\").
If any Licensor has sent notice to request removing credit, You must, to
the extent practicable, remove any credit as requested. The credit
required by this Section may be implemented in any reasonable manner;
provided, however, that in the case of an Adaptation or Collection, at a
minimum such credit will appear, if a credit for all contributing
authors of the Adaptation or Collection appears, then as part of these
credits and in a manner at least as prominent as the credits for the
other contributing authors. For the avoidance of doubt, You may only use
the credit required by this Section for the purpose of attribution in
the manner set out above and, by exercising Your rights under this
License, You may not implicitly or explicitly assert or imply any
connection with, sponsorship or endorsement by the Original Author,
Licensor and/or Attribution Parties, as appropriate, of You or Your use
of the Work, without the separate, express prior written permission of
the Original Author, Licensor and/or Attribution Parties.
Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce, Distribute or
Publicly Perform the Work either by itself or as part of any Adaptations
or Collections, You must not distort, mutilate, modify or take other
derogatory action in relation to the Work which would be prejudicial to
the Original Author\'s honor or reputation. Licensor agrees that in
those jurisdictions (e.g. Japan), in which any exercise of the right
granted in the license grant of this License (the right to make
Adaptations) would be deemed to be a distortion, mutilation,
modification or other derogatory action prejudicial to the Original
Author\'s honor and reputation, the Licensor will waive or not assert,
as appropriate, this Section, to the fullest extent permitted by the
applicable national law, to enable You to reasonably exercise Your right
under the license grant of this License (right to make Adaptations) but
not otherwise.
Do not make any legal claim against anyone accusing the Work, with or
without changes, alone or with other works, of infringing any patent
claim.
# Representations Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
# Limitation on Liability
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF
THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES.
# Termination
This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or Collections
from You under this License, however, will not have their licenses
terminated provided such individuals or entities remain in full
compliance with those licenses. The Sections on definitions, fair
dealing rights, representations, warranties, and disclaimer, limitation
on liability, termination, and revised license versions will survive any
termination of this License.
Subject to the above terms and conditions, the license granted here is
perpetual (for the duration of the applicable copyright in the Work).
Notwithstanding the above, Licensor reserves the right to release the
Work under different license terms or to stop distributing the Work at
any time; provided, however that any such election will not serve to
withdraw this License (or any other license that has been, or is
required to be, granted under the terms of this License), and this
License will continue in full force and effect unless terminated as
stated above.
# Revised License Versions
This License may receive future revisions in the original spirit of the
license intended to strengthen This License. Each version of This
License has an incrementing version number.
Unless otherwise specified like in the below subsection The Licensor has
only granted this current version of This License for The Work. In this
case future revisions do not apply.
The Licensor may specify that the latest available revision of This
License be used for The Work by either explicitly writing so or by
suffixing the License URI with a \"+\" symbol.
The Licensor may specify that The Work is also available under the terms
of This License\'s current revision as well as specific future
revisions. The Licensor may do this by writing it explicitly or
suffixing the License URI with any additional version numbers each
separated by a comma.
# Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection,
the Licensor offers to the recipient a license to the Work on the same
terms and conditions as the license granted to You under this License.
Each time You Distribute or Publicly Perform an Adaptation, Licensor
offers to the recipient a license to the original Work on the same terms
and conditions as the license granted to You under this License.
If the Work is classified as Software, each time You Distribute or
Publicly Perform an Adaptation, Licensor offers to the recipient a copy
and/or URI of the corresponding Source Code on the same terms and
conditions as the license granted to You under this License.
If the Work is used as a Network Service, each time You Distribute or
Publicly Perform an Adaptation, or serve data derived from the Software,
the Licensor offers to any recipients of the data a copy and/or URI of
the corresponding Source Code on the same terms and conditions as the
license granted to You under this License.
If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action
by the parties to this agreement, such provision shall be reformed to
the minimum extent necessary to make such provision valid and
enforceable.
No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or consent.
This License constitutes the entire agreement between the parties with
respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified
here. Licensor shall not be bound by any additional provisions that may
appear in any communication from You. This License may not be modified
without the mutual written agreement of the Licensor and You.
The rights granted under, and the subject matter referenced, in this
License were drafted utilizing the terminology of the Berne Convention
for the Protection of Literary and Artistic Works (as amended on
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and
the Universal Copyright Convention (as revised on July 24, 1971). These
rights and subject matter take effect in the relevant jurisdiction in
which the License terms are sought to be enforced according to the
corresponding provisions of the implementation of those treaty
provisions in the applicable national law. If the standard suite of
rights granted under applicable copyright law includes additional rights
not granted under this License, such additional rights are deemed to be
included in the License; this License is not intended to restrict the
license of any rights under applicable law.

365
Main.gd Normal file
View File

@ -0,0 +1,365 @@
extends Control
const CONFIG_PATH := "user://settings.cfg"
enum COL{
TEXT,
TIME
}
const STRINGS := {
START = "start",
STOP = "stop",
NO_TIME = "00:00:00",
}
@onready var time_label: Label = %TimeLabel
@onready var start_button: Button = %StartButton
@onready var task_name_line_edit: LineEdit = %TaskNameLineEdit
@onready var previous_tasks_tree: Tree = %PreviousTasksTree
@onready var timer: Timer = %Timer
@onready var tasks_button: Button = %TasksButton
@onready var settings_button: Button = %SettingsButton
@onready var previous_tasks_window: Window = %PreviousTasksWindow
@onready var settings_window: Window = %SettingsWindow
@onready var file_path_file_dialog: FileDialog = %FilePathFileDialog
@onready var file_path_line_edit: LineEdit = %FilePathLineEdit
@onready var file_path_button: Button = %FilePathButton
@onready var theme_path_file_dialog: FileDialog = %ThemePathFileDialog
@onready var theme_path_button: Button = %ThemePathButton
@onready var sound_check_box: CheckBox = %SoundCheckBox
@onready var attributions_rich_text_label: RichTextLabel = %AttributionsRichTextLabel
@onready var audio_stream_player: AudioStreamPlayer = %AudioStreamPlayer
@onready var open_data_dir_button: Button = %OpenDataDirButton
var previous_entries: Array[TimeEntry] = []
var current_entry := TimeEntry.new()
var current_item: TreeItem
var config := ConfigFile.new()
var current_file := ""
func _init() -> void:
config.load(CONFIG_PATH)
var default_path := OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS, true).path_join("mouse_timer.csv")
current_file = config.get_value("MAIN", "file", default_path)
if config.has_section_key("MAIN", "theme"):
var new_theme: Theme = ResourceLoader.load(config.get_value("MAIN", "theme", "res://default_theme.theme"), "Theme")
if new_theme != null:
theme = new_theme
func _ready() -> void:
get_tree().set_auto_accept_quit(false)
var _root := previous_tasks_tree.create_item()
file_path_button.pressed.connect(
file_path_file_dialog.popup_centered
)
file_path_file_dialog.file_selected.connect(set_current_file)
file_path_line_edit.text_submitted.connect(set_current_file)
theme_path_button.pressed.connect(
theme_path_file_dialog.popup_centered
)
theme_path_file_dialog.file_selected.connect(
func theme_selected(theme_path: String) -> void:
var new_theme: Theme = ResourceLoader.load(theme_path, "Theme")
if new_theme != null:
theme = new_theme
config.set_value("MAIN", "theme", theme_path)
config.save(CONFIG_PATH)
)
theme_path_file_dialog.hide()
file_path_file_dialog.hide()
previous_tasks_window.hide()
settings_window.hide()
timer.timeout.connect(
func on_timer_timeout() -> void:
current_entry.update()
time_label.text = current_entry.get_period()
var total_elapsed: int = current_entry.get_total_elapsed_seconds()
current_item.set_text(COL.TIME, TimeEntry.time_to_period(total_elapsed))
current_item.set_metadata(COL.TIME, total_elapsed)
)
start_button.tooltip_text = tr(STRINGS.START)
start_button.toggle_mode = true
start_button.toggled.connect(
func start(is_on: bool) -> void:
if sound_check_box.button_pressed:
audio_stream_player.play()
if is_on:
current_entry = TimeEntry.new().start_recording()
current_entry.name = task_name_line_edit.text
current_item = append_name_to_tree(task_name_line_edit.text)
current_entry.previous_total = current_item.get_metadata(COL.TIME)
start_button.tooltip_text = tr(STRINGS.STOP)
timer.start()
else:
add_to_entries()
start_button.tooltip_text = tr(STRINGS.START)
time_label.text = STRINGS.NO_TIME
timer.stop()
)
task_name_line_edit.text = config.get_value("MAIN", "last_task_name", "")
task_name_line_edit.text_changed.connect(
func(new_text: String) -> void:
config.set_value("MAIN", "last_task_name", new_text)
config.save(CONFIG_PATH)
)
previous_tasks_tree.item_selected.connect(
func item_selected() -> void:
var item := previous_tasks_tree.get_selected()
task_name_line_edit.text = item.get_metadata(COL.TEXT)
)
tasks_button.toggle_mode = true
tasks_button.toggled.connect(
func tasks_toggled(is_on: bool) -> void:
previous_tasks_window.visible = is_on
)
previous_tasks_window.close_requested.connect(
func close() -> void:
tasks_button.set_pressed_no_signal(false)
previous_tasks_window.hide()
)
settings_button.toggle_mode = true
settings_button.toggled.connect(
func settings_toggled(is_on: bool) -> void:
settings_window.visible = is_on
)
settings_window.close_requested.connect(
func close() -> void:
settings_button.set_pressed_no_signal(false)
settings_window.hide()
)
sound_check_box.button_pressed = config.get_value("MAIN", "sound_fx", true)
sound_check_box.toggled.connect(
func sound_toggle(is_on: bool) -> void:
config.set_value("MAIN", "sound_fx", is_on)
)
open_data_dir_button.pressed.connect(
OS.shell_open.bind(OS.get_user_data_dir())
)
attributions_rich_text_label.meta_clicked.connect(OS.shell_open)
set_current_file(current_file)
## Adds a new time entry to the tree and to the data file
func add_to_entries() -> void:
previous_entries.append(current_entry)
var file := FileAccess.open(current_file, FileAccess.WRITE)
if file == null:
printerr("Could not open file")
file.store_csv_line(current_entry.to_csv_line())
## Adds a new item to the tree, or returns the old item if it exists
func append_name_to_tree(task_name: String, total_time := 0) -> TreeItem:
var item := previous_tasks_tree.get_root()
for item_name in task_name.split("/"):
item.collapsed = false
item = find_item(item, item_name, true)
item.set_metadata(COL.TEXT, task_name)
if not item.get_metadata(COL.TIME):
item.set_metadata(COL.TIME, total_time)
previous_tasks_tree.scroll_to_item(item)
return item
## Finds an item in the tree by text
func find_item(root: TreeItem, item_name: String, or_create: bool) -> TreeItem:
for child in root.get_children():
if child.get_text(COL.TEXT) == item_name:
return child
if or_create:
var child := root.create_child()
child.set_text(COL.TEXT, item_name)
child.set_text(COL.TIME, STRINGS.NO_TIME)
return child
return null
## Changes the data file path, and loads the new path
func set_current_file(new_current_file: String) -> void:
if not load_file(new_current_file):
return
previous_entries.clear()
current_file = new_current_file
config.set_value("MAIN", "file", current_file)
config.save(CONFIG_PATH)
file_path_file_dialog.current_path = current_file
file_path_file_dialog.current_dir = current_file.get_base_dir()
file_path_line_edit.text = current_file
## Loads the data file
func load_file(source_path: String) -> bool:
var file := FileAccess.open(source_path, FileAccess.READ)
if file == null:
file = FileAccess.open(source_path, FileAccess.WRITE)
if file == null:
printerr("Failed to open file %s"%[ProjectSettings.globalize_path(source_path)])
return false
return true
var collector := {}
while not file.eof_reached():
var line := file.get_csv_line()
if line.size() == 0 or "".join(line).length() == 0:
continue
if not TimeEntry.is_csv_line_valid(line):
push_warning("CSV Line `%s` is not conform"%[",".join(line)])
continue
var entry := TimeEntry.new().from_csv_line(line)
previous_entries.append(entry)
if not collector.has(entry.name):
collector[entry.name] = 0
collector[entry.name] += entry.get_elapsed_seconds()
for entry_name in collector:
append_name_to_tree(entry_name, collector[entry_name])
file.close()
return true
func _notification(what: int) -> void:
if what == NOTIFICATION_WM_CLOSE_REQUEST:
if start_button.button_pressed:
add_to_entries()
get_tree().quit()
## Unused; if a manual quit button is added, this would be used
func quit() -> void:
get_tree().notification(NOTIFICATION_WM_CLOSE_REQUEST)
class TimeEntry:
var name := ""
var start_time := TimeStamp.new()
var end_time := TimeStamp.new()
var previous_total := 0
func start_recording() -> TimeEntry:
start_time = start_time.from_current_time()
end_time = end_time.from_current_time()
return self
func update() -> void:
end_time = end_time.from_current_time()
func get_elapsed_seconds() -> int:
var elapsed := end_time.get_difference(start_time)
return elapsed
func get_total_elapsed_seconds() -> int:
var elapsed := get_elapsed_seconds() + previous_total
return elapsed
func get_period() -> String:
var time_in_secs := get_elapsed_seconds()
return TimeEntry.time_to_period(time_in_secs)
func get_total_period() -> String:
var time_in_secs := get_total_elapsed_seconds()
return TimeEntry.time_to_period(time_in_secs)
static func time_to_period(time_in_secs: int) -> String:
var seconds := time_in_secs%60
@warning_ignore("integer_division")
var minutes := (time_in_secs/60)%60
@warning_ignore("integer_division")
var hours := (time_in_secs/60)/60
return "%02d:%02d:%02d" % [hours, minutes, seconds]
func to_csv_line() -> PackedStringArray:
return PackedStringArray([
name,
start_time,
end_time,
str(get_elapsed_seconds()),
])
static func is_csv_line_valid(line: PackedStringArray) -> bool:
return line.size() > 2
func from_csv_line(line: PackedStringArray) -> TimeEntry:
name = line[0]
start_time.from_string(line[1])
end_time.from_string(line[2])
return self
class TimeStamp:
var year := 0
var month := 0
var day := 0
var weekday := 0
var hour := 0
var minute := 0
var second := 0
var unix := 0
func from_current_time() -> TimeStamp:
return from_dict(Time.get_datetime_dict_from_system())
func from_dict(time: Dictionary) -> TimeStamp:
year = time.year
month = time.month
day = time.day
weekday = time.weekday
hour = time.hour
minute = time.minute
second = time.second
unix = Time.get_unix_time_from_datetime_dict(time)
return self
func to_dict() -> Dictionary:
return {
year = year,
month = month,
day = day,
weekday = weekday,
hour = hour,
minute = minute,
second = second,
}
func get_difference(other_timestamp: TimeStamp) -> int:
return unix - other_timestamp.unix
func from_string(time_string: String) -> TimeStamp:
var time := Time.get_datetime_dict_from_datetime_string(time_string, true)
return from_dict(time)
func _to_string() -> String:
return Time.get_datetime_string_from_datetime_dict(to_dict(), false)

236
Main.tscn Normal file
View File

@ -0,0 +1,236 @@
[gd_scene load_steps=6 format=3 uid="uid://bmlciwscreowf"]
[ext_resource type="Theme" uid="uid://bd8ancgbfsvmd" path="res://assets/default_theme.theme" id="1_1mila"]
[ext_resource type="Script" path="res://Main.gd" id="1_vrowr"]
[ext_resource type="AudioStream" uid="uid://cdsbhoidgyx70" path="res://assets/pop.ogg" id="3_o37py"]
[sub_resource type="InputEventKey" id="InputEventKey_guuii"]
device = -1
pressed = true
keycode = 32
unicode = 32
[sub_resource type="Shortcut" id="Shortcut_irhvi"]
events = [SubResource("InputEventKey_guuii")]
[node name="PanelContainer" type="PanelContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_1mila")
theme_type_variation = &"background"
[node name="Main" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
script = ExtResource("1_vrowr")
[node name="VBoxContainer" type="VBoxContainer" parent="Main"]
layout_mode = 2
size_flags_horizontal = 3
[node name="HBoxContainer2" type="HBoxContainer" parent="Main/VBoxContainer"]
layout_mode = 2
[node name="SettingsButton" type="Button" parent="Main/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Settings"
theme_type_variation = &"settings_button"
icon_alignment = 1
[node name="TaskNameLineEdit" type="LineEdit" parent="Main/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "Task Name. Use \"/\" to create subtasks"
caret_blink = true
caret_blink_interval = 0.5
[node name="TasksButton" type="Button" parent="Main/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Tasks"
theme_type_variation = &"tasks_button"
icon_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Main/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="TimeLabel" type="Label" parent="Main/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
theme_type_variation = &"time_label"
text = "00:00:00"
horizontal_alignment = 1
vertical_alignment = 1
[node name="StartButton" type="Button" parent="Main/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_type_variation = &"play_button"
shortcut = SubResource("Shortcut_irhvi")
[node name="Timer" type="Timer" parent="Main"]
unique_name_in_owner = true
[node name="FilePathFileDialog" type="FileDialog" parent="Main"]
unique_name_in_owner = true
title = "Pick Tracker File"
size = Vector2i(800, 600)
ok_button_text = "Save"
access = 2
filters = PackedStringArray("*.csv ; Comma Separated Files")
[node name="ThemePathFileDialog" type="FileDialog" parent="Main"]
unique_name_in_owner = true
title = "Open a File"
size = Vector2i(800, 600)
ok_button_text = "Open"
file_mode = 0
access = 2
filters = PackedStringArray("*.theme ; Theme Files")
[node name="PreviousTasksWindow" type="Window" parent="Main"]
unique_name_in_owner = true
title = "Tasks"
size = Vector2i(300, 300)
visible = false
always_on_top = true
[node name="PanelContainer" type="PanelContainer" parent="Main/PreviousTasksWindow"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_type_variation = &"background"
[node name="MarginContainer" type="MarginContainer" parent="Main/PreviousTasksWindow/PanelContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="PreviousTasksTree" type="Tree" parent="Main/PreviousTasksWindow/PanelContainer/MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
[node name="SettingsWindow" type="Window" parent="Main"]
unique_name_in_owner = true
title = "Settings"
size = Vector2i(300, 300)
visible = false
always_on_top = true
[node name="PanelContainer" type="PanelContainer" parent="Main/SettingsWindow"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_type_variation = &"background"
[node name="MarginContainer" type="MarginContainer" parent="Main/SettingsWindow/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="Main/SettingsWindow/PanelContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 10
[node name="HBoxContainer" type="HBoxContainer" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "File Path"
[node name="FilePathLineEdit" type="LineEdit" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
caret_blink = true
caret_blink_interval = 0.5
[node name="FilePathButton" type="Button" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "..."
[node name="HBoxContainer2" type="HBoxContainer" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Alternative theme
"
[node name="ThemePathButton" type="Button" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "load"
[node name="HBoxContainer3" type="HBoxContainer" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="SoundCheckBox" type="CheckBox" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer3"]
unique_name_in_owner = true
layout_mode = 2
button_pressed = true
text = "Sounds"
[node name="OpenDataDirButton" type="Button" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "open data dir"
[node name="AttributionsRichTextLabel" type="RichTextLabel" parent="Main/SettingsWindow/PanelContainer/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_type_variation = &"small_text"
bbcode_enabled = true
text = "Font: Cairo, Designed by Mohamed Gaber, Accademia di Belle Arti di Urbino
Sound: [url]https://opengameart.org/content/bubbles-pop[/url]
This game uses Godot Engine, available under the following license:
Copyright (c) 2014-present Godot Engine contributors. Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("3_o37py")

View File

@ -1,38 +1,9 @@
# ![Logo representing a rat's butt](assets/logo.png) Rat Times
# Rat Times
Track your time, save it to a CSV file.
Uses Godot 3.5
![screenshot of the app](info/screenshot.png)
![screenshot of the app in usage](exports/screenshot.png)
That's it I guess
## Features
- Saves to custom CSV file. Sync this file with syncthing/nextcloud/dropbox/whatever you like
- File watcher. Change the CSV externally, see the update in the UI
- Versions for Linux, Windows, Android, and presumably IOS and Mac (untested)
- Custom theming possible
- Does not depend on a timer, so you can close the app immediately after starting a task
- Create nested tasks with `task/subtask` notation
## Coming Up
- Command line version supplied for your scripting needs or for terminal lovers
- Plugin interface to change/add functionality
- price per task
## License
This work is released under the The Nonviolent Public License (NVPLv7+)
https://thufie.lain.haus/NPL.html
In short: you can do whatever you want with with the work, including using it commercially, provided that you release the work under the same terms.
Exception:
- you cannot use the work for patents
- you cannot use the work for harm, surveillance, discrimination, law enforcement, pollution
- in a corporation, you cannot use the work commercially, unless in a worker-owned cooperative, or otherwise a company that redistributes surplus equally amongst workers.
Please read the [full terms](./LICENSE.md) for proper wording.
Uses Godot 4

View File

@ -0,0 +1,33 @@
[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={}

Binary file not shown.

Binary file not shown.

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/logo.png-e2220799298e3631eb0e245316e0501a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/logo.png"
dest_files=[ "res://.import/logo.png-e2220799298e3631eb0e245316e0501a.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

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/logo.svg-01597fe4b7eb446be26a49e8a22b6f42.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/logo.svg"
dest_files=[ "res://.import/logo.svg-01597fe4b7eb446be26a49e8a22b6f42.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

View File

@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/play.svg-1c68bc58d294f89383fc6b13dae7f4f1.stex"
type="CompressedTexture2D"
uid="uid://bcledyqebmri"
path="res://.godot/imported/play.svg-1c68bc58d294f89383fc6b13dae7f4f1.ctex"
metadata={
"vram_texture": false
}
@ -10,26 +11,27 @@ metadata={
[deps]
source_file="res://assets/play.svg"
dest_files=[ "res://.import/play.svg-1c68bc58d294f89383fc6b13dae7f4f1.stex" ]
dest_files=["res://.godot/imported/play.svg-1c68bc58d294f89383fc6b13dae7f4f1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="13"
height="13"
viewBox="0 0 3.4395833 3.4395833"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="play_small.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="35.356609"
inkscape:cx="6.3495909"
inkscape:cy="5.8263506"
inkscape:window-width="1896"
inkscape:window-height="1029"
inkscape:window-x="12"
inkscape:window-y="39"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid7036"
originx="0"
originy="0" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="rect11457"
style="fill:#ffffff;stroke-width:1.85208;paint-order:stroke markers fill;stop-color:#000000"
d="M 0.26458333,0.26458333 3.175,1.7197917 0.26458333,3.175 Z"
sodipodi:nodetypes="cccc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/play_small.svg-6ecf1cf55097c1673c0917a7e7624a3c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/play_small.svg"
dest_files=[ "res://.import/play_small.svg-6ecf1cf55097c1673c0917a7e7624a3c.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

View File

@ -1,15 +1,19 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/pop.ogg-1ea32f2d825ac1e6d9420f3fecda89df.oggstr"
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://cdsbhoidgyx70"
path="res://.godot/imported/pop.ogg-1ea32f2d825ac1e6d9420f3fecda89df.oggvorbisstr"
[deps]
source_file="res://assets/pop.ogg"
dest_files=[ "res://.import/pop.ogg-1ea32f2d825ac1e6d9420f3fecda89df.oggstr" ]
dest_files=["res://.godot/imported/pop.ogg-1ea32f2d825ac1e6d9420f3fecda89df.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="64"
height="64"
viewBox="0 0 16.933333 16.933333"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="stop.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#323232"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="8.8391522"
inkscape:cx="39.766257"
inkscape:cy="42.424883"
inkscape:window-width="1896"
inkscape:window-height="977"
inkscape:window-x="12"
inkscape:window-y="91"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid7036"
originx="0"
originy="0"
empspacing="8" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:0.994836;stroke-width:4;stroke-linecap:round;stroke-opacity:0;paint-order:stroke markers fill;stop-color:#000000"
id="rect341"
width="11.641667"
height="11.641667"
x="2.6458325"
y="2.6458325" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stop.svg-fc65124eb2fb3129fbdd4f17f48ea6f3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/stop.svg"
dest_files=[ "res://.import/stop.svg-fc65124eb2fb3129fbdd4f17f48ea6f3.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

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="22"
height="22"
viewBox="0 0 5.8208333 5.8208333"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="stop_small.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#323232"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="35.356609"
inkscape:cx="12.402208"
inkscape:cy="11.115319"
inkscape:window-width="1896"
inkscape:window-height="1029"
inkscape:window-x="12"
inkscape:window-y="39"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid7036"
originx="0"
originy="0"
empspacing="8" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:0.994836;stroke-width:4;stroke-linecap:round;stroke-opacity:0;paint-order:stroke markers fill;stop-color:#000000"
id="rect341"
width="4.7624998"
height="4.7624998"
x="0.52916664"
y="0.5291667" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stop_small.svg-d7819f3a82ff689d7390798487abb123.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/stop_small.svg"
dest_files=[ "res://.import/stop_small.svg-d7819f3a82ff689d7390798487abb123.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=0.6

View File

@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/tasks.svg-78ebb4f2e18a1507072d2a7762176d95.stex"
type="CompressedTexture2D"
uid="uid://ctxkpfc0syh2m"
path="res://.godot/imported/tasks.svg-78ebb4f2e18a1507072d2a7762176d95.ctex"
metadata={
"vram_texture": false
}
@ -10,26 +11,27 @@ metadata={
[deps]
source_file="res://assets/tasks.svg"
dest_files=[ "res://.import/tasks.svg-78ebb4f2e18a1507072d2a7762176d95.stex" ]
dest_files=["res://.godot/imported/tasks.svg-78ebb4f2e18a1507072d2a7762176d95.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="13"
height="13"
viewBox="0 0 3.4395833 3.4395833"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="toggle_button.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="50.001796"
inkscape:cx="6.3597716"
inkscape:cy="6.4797673"
inkscape:window-width="1896"
inkscape:window-height="1029"
inkscape:window-x="12"
inkscape:window-y="39"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid7036"
originx="0"
originy="0" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="rect11457"
style="fill:#ffffff;stroke-width:1.85208;paint-order:stroke markers fill;stop-color:#000000"
d="M 1.7197916 0.79374999 L 0.26458333 2.1166666 L 0.84645995 2.1166666 L 1.7197916 1.3229167 L 2.5931233 2.1166666 L 3.175 2.1166666 L 1.7197916 0.79374999 z " />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,35 +0,0 @@
[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

View File

@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/wheel.svg-6ab291b0608b06b66eec00e4d4332248.stex"
type="CompressedTexture2D"
uid="uid://dskgsrua03gwe"
path="res://.godot/imported/wheel.svg-6ab291b0608b06b66eec00e4d4332248.ctex"
metadata={
"vram_texture": false
}
@ -10,26 +11,27 @@ metadata={
[deps]
source_file="res://assets/wheel.svg"
dest_files=[ "res://.import/wheel.svg-6ab291b0608b06b66eec00e4d4332248.stex" ]
dest_files=["res://.godot/imported/wheel.svg-6ab291b0608b06b66eec00e4d4332248.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

View File

@ -1,6 +0,0 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://scripts/config_manager.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )

View File

@ -1,7 +0,0 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View File

@ -1,81 +1,82 @@
[preset.0]
name="HTML5"
platform="HTML5"
name="Linux/X11"
platform="Linux/X11"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="exports/web/index.html"
script_export_mode=1
export_path="exports/rat-times-x64.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
variant/export_type=0
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color( 0, 0, 0, 1 )
debug/export_console_script=1
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Mac OSX"
platform="Mac OSX"
name="macOS"
platform="macOS"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="exports/rat-times.zip"
script_export_mode=1
export_path="exports/Rat Times.app"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.1.options]
binary_format/architecture="universal"
custom_template/debug=""
custom_template/release=""
application/name="Rat Times"
application/info="Made with Godot Engine"
application/icon="res://assets/logo.icns"
application/identifier="io.mutnt.app.rattimes"
debug/export_console_script=1
application/icon="res://logo.icns"
application/icon_interpolation=4
application/bundle_identifier="org.mutnt.io.rat-times"
application/signature=""
application/app_category="Games"
application/app_category="Productivity"
application/short_version="1.0"
application/version="1.0"
application/copyright=""
display/high_res=false
privacy/microphone_usage_description=""
privacy/camera_usage_description=""
privacy/location_usage_description=""
privacy/address_book_usage_description=""
privacy/calendar_usage_description=""
privacy/photos_library_usage_description=""
privacy/desktop_folder_usage_description=""
privacy/documents_folder_usage_description="Documents required to save file"
privacy/downloads_folder_usage_description=""
privacy/network_volumes_usage_description=""
privacy/removable_volumes_usage_description=""
codesign/enable=true
application/copyright_localized={}
display/high_res=true
codesign/codesign=1
codesign/identity=""
codesign/timestamp=true
codesign/hardened_runtime=true
codesign/replace_existing_signature=true
codesign/certificate_file=""
codesign/certificate_password=""
codesign/entitlements/custom_file=""
codesign/entitlements/allow_jit_code_execution=false
codesign/entitlements/allow_unsigned_executable_memory=false
@ -98,105 +99,75 @@ codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/custom_options=PoolStringArray( )
notarization/enable=false
codesign/entitlements/app_sandbox/helper_executables=[]
codesign/custom_options=PackedStringArray()
notarization/notarization=0
notarization/apple_id_name=""
notarization/apple_id_password=""
notarization/apple_team_id=""
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
notarization/api_uuid=""
notarization/api_key=""
notarization/api_key_id=""
privacy/microphone_usage_description=""
privacy/microphone_usage_description_localized={}
privacy/camera_usage_description=""
privacy/camera_usage_description_localized={}
privacy/location_usage_description=""
privacy/location_usage_description_localized={}
privacy/address_book_usage_description=""
privacy/address_book_usage_description_localized={}
privacy/calendar_usage_description=""
privacy/calendar_usage_description_localized={}
privacy/photos_library_usage_description=""
privacy/photos_library_usage_description_localized={}
privacy/desktop_folder_usage_description=""
privacy/desktop_folder_usage_description_localized={}
privacy/documents_folder_usage_description=""
privacy/documents_folder_usage_description_localized={}
privacy/downloads_folder_usage_description=""
privacy/downloads_folder_usage_description_localized={}
privacy/network_volumes_usage_description=""
privacy/network_volumes_usage_description_localized={}
privacy/removable_volumes_usage_description=""
privacy/removable_volumes_usage_description_localized={}
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.2]
name="Linux/X11"
platform="Linux/X11"
name="Android"
platform="Android"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="exports/rat-times.x86_64"
script_export_mode=1
export_path="exports/rat-times-x64.apk"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.2.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
[preset.3]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="exports/rat-times.exe"
script_export_mode=1
script_encryption_key=""
[preset.3.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PoolStringArray( )
application/modify_resources=true
application/icon="res://assets/logo.ico"
application/file_version=""
application/product_version=""
application/company_name="Mutnt"
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
[preset.4]
name="Android"
platform="Android"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="exports/rat-times.apk"
script_export_mode=1
script_encryption_key=""
[preset.4.options]
custom_template/debug=""
custom_template/release=""
custom_build/use_custom_build=false
custom_build/export_format=0
custom_build/min_sdk=""
custom_build/target_sdk=""
architectures/armeabi-v7a=true
gradle_build/use_gradle_build=false
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
@ -206,13 +177,12 @@ keystore/debug_password="android"
keystore/release=""
keystore/release_user=""
keystore/release_password=""
one_click_deploy/clear_previous_install=false
version/code=1
version/name="1.0"
package/unique_name="io.mutnt.app.$genname"
package/unique_name="org.mutnt.io.ratstimes"
package/name=""
package/signed=true
package/classify_as_game=true
package/app_category=2
package/retain_data_on_uninstall=false
package/exclude_from_recents=false
launcher_icons/main_192x192=""
@ -233,7 +203,7 @@ command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PoolStringArray( )
permissions/custom_permissions=PackedStringArray()
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
@ -380,3 +350,146 @@ permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false
[preset.3]
name="iOS"
platform="iOS"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.3.options]
custom_template/debug=""
custom_template/release=""
architectures/arm64=true
application/app_store_team_id="org.mutnt.io"
application/provisioning_profile_uuid_debug=""
application/code_sign_identity_debug=""
application/export_method_debug=1
application/provisioning_profile_uuid_release=""
application/code_sign_identity_release=""
application/export_method_release=0
application/targeted_device_family=2
application/bundle_identifier="rat-times"
application/signature=""
application/short_version="1.0"
application/version="1.0"
application/icon_interpolation=4
application/launch_screens_interpolation=4
capabilities/access_wifi=false
capabilities/push_notifications=false
user_data/accessible_from_files_app=false
user_data/accessible_from_itunes_sharing=false
privacy/camera_usage_description=""
privacy/camera_usage_description_localized={}
privacy/microphone_usage_description=""
privacy/microphone_usage_description_localized={}
privacy/photolibrary_usage_description=""
privacy/photolibrary_usage_description_localized={}
icons/iphone_120x120=""
icons/iphone_180x180=""
icons/ipad_76x76=""
icons/ipad_152x152=""
icons/ipad_167x167=""
icons/app_store_1024x1024=""
icons/spotlight_40x40=""
icons/spotlight_80x80=""
icons/settings_58x58=""
icons/settings_87x87=""
icons/notification_40x40=""
icons/notification_60x60=""
storyboard/use_launch_screen_storyboard=false
storyboard/image_scale_mode=0
storyboard/custom_image@2x=""
storyboard/custom_image@3x=""
storyboard/use_custom_bg_color=false
storyboard/custom_bg_color=Color(0, 0, 0, 1)
landscape_launch_screens/iphone_2436x1125=""
landscape_launch_screens/iphone_2208x1242=""
landscape_launch_screens/ipad_1024x768=""
landscape_launch_screens/ipad_2048x1536=""
portrait_launch_screens/iphone_640x960=""
portrait_launch_screens/iphone_640x1136=""
portrait_launch_screens/iphone_750x1334=""
portrait_launch_screens/iphone_1125x2436=""
portrait_launch_screens/ipad_768x1024=""
portrait_launch_screens/ipad_1536x2048=""
portrait_launch_screens/iphone_1242x2208=""
[preset.4]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="exports/rat-times-x64.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.4.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_script=1
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/architecture="x86_64"
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=false
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"

View File

View File

@ -1,47 +0,0 @@
#!/usr/bin/env bash
usage(){
echo "Copies the rat-times binary, data, and icon to the specified directory,"
echo "then copies the desktop file to ~/.local/share/applications, while"
echo "setting the correct path"
echo ""
echo "Example Usage: install-linux.sh ~/Applications"
}
if [ $# -eq 0 ]; then
>&2 echo "No arguments provided, please provide a valid path for installation"
usage
exit 1
fi
if [ $1 = "--help" ]; then
usage
exit 0
fi
if [ $1 = "-h" ]; then
usage
exit 0
fi
dir_resolve(){
cd "$1" 2>/dev/null || return $? # cd to desired directory; if fail, quell any error messages but return exit status
echo "`pwd -P`" # output full, link-resolved path
}
if APP_PATH="`dir_resolve \"$1\"`"; then
SHORTCUT_PATH="$HOME/.local/share/applications/rat-times.desktop"
mkdir -p $APP_PATH
cp rat-times.x86_64 rat-times.pck rat-times.svg $APP_PATH
sed "s@REPLACE_WITH_PATH@$APP_PATH@g" rat-times.desktop > $SHORTCUT_PATH
echo "Rat Times is installed. To remove, please delete:"
echo "$APP_PATH/rat-times.x86_64"
echo "$APP_PATH/rat-times.pck"
echo "$APP_PATH/rat-times.svg"
echo "$SHORTCUT_PATH"
else
echo "Could not reach $1"
fi

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Name=Rat Times
Comment=Track your time
Exec=REPLACE_WITH_PATH/rat-times.x86_64
Icon=REPLACE_WITH_PATH/rat-times.svg
Terminal=false
Type=Application
Categories=Game;

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="64"
height="64"
viewBox="0 0 16.933333 16.933333"
version="1.1"
id="svg13794"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="logo.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview13796"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="6.2502245"
inkscape:cx="22.479193"
inkscape:cy="24.159132"
inkscape:window-width="1896"
inkscape:window-height="1029"
inkscape:window-x="12"
inkscape:window-y="39"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs13791" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<ellipse
style="fill:#1d86ff;fill-opacity:1;stroke-width:1.85208;paint-order:stroke markers fill;stop-color:#000000"
id="circle14391"
cx="4.0016642"
cy="4.8131599"
rx="2.9889076"
ry="2.9889104" />
<path
style="fill:#d588ff;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 10.040695,15.90349 6.892697,-1.588035 -1.494564,-0.466127 1.045969,-0.83042 -1.837551,0.445927 v -0.84077 z"
id="path14447" />
<path
style="fill:#d588ff;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6.8926369,16.389379 -5.9950227e-5,14.801343 1.4945043,14.335217 0.44853556,13.504797 2.2860868,13.950724 v -0.84077 z"
id="path14449" />
<ellipse
style="fill:#1d86ff;fill-opacity:1;stroke-width:1.85208;paint-order:stroke markers fill;stop-color:#000000"
id="path13969"
cx="8.1552019"
cy="9.9386654"
rx="6.4920444"
ry="6.4920506" />
<path
sodipodi:type="spiral"
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#4200cb;stroke-width:0.230262;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
id="path14024"
sodipodi:cx="8.4666662"
sodipodi:cy="8.4666662"
sodipodi:expansion="2"
sodipodi:revolution="1.5184656"
sodipodi:radius="2.3796637"
sodipodi:argument="-19.12742"
sodipodi:t0="0"
d="m 8.4666662,8.4666662 c 0.027537,-0.00785 0.021565,0.052556 0.017694,0.06203 -0.044361,0.108565 -0.2002796,0.066923 -0.2658124,0.00874 C 8.0210701,8.3621249 8.1306116,8.0511576 8.307424,7.9083989 8.6808232,7.6069157 9.2185608,7.8211538 9.4591415,8.1835689 9.8827565,8.8217104 9.5243913,9.6591442 8.9090057,10.017409 7.9391013,10.582067 6.7291388,10.039501 6.2335968,9.1036351 6.1901155,9.0215177 6.1515675,8.9367957 6.1180994,8.8501155"
transform="matrix(-3.9529526,2.2775757,-2.3165148,-4.0094692,60.938259,26.017524)"
inkscape:transform-center-x="-0.51754845"
inkscape:transform-center-y="-2.4484256" />
<ellipse
style="fill:#1d86ff;fill-opacity:1;stroke-width:1.85208;paint-order:stroke markers fill;stop-color:#000000"
id="circle14389"
cx="11.931787"
cy="4.8131599"
rx="2.9889076"
ry="2.9889104" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

BIN
info/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

34
logo.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpmyyivxx0dlt"
path="res://.godot/imported/logo.png-cca8726399059c8d4f806e28e356b14d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://logo.png"
dest_files=["res://.godot/imported/logo.png-cca8726399059c8d4f806e28e356b14d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

37
logo.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://fk5s6m8qlsei"
path="res://.godot/imported/logo.svg-8d8cf086b974db23ad31f8a2f3ea7d0f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://logo.svg"
dest_files=["res://.godot/imported/logo.svg-8d8cf086b974db23ad31f8a2f3ea7d0f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -1,48 +0,0 @@
#!/usr/bin/env -S godot --no-window -s
extends SceneTree
var config: ConfigManager = preload("res://config_manager.tres")
const valid_commands := ["list", "stop", "start"]
func _init():
var cmd := CMD.new()
for command in valid_commands:
if cmd.has_argument(command):
call(command, cmd.get_argument(command))
return
print("no command provided -- exiting")
help()
quit(1)
func help(_show: bool = true) -> void:
print("Valid commands are:")
for command in valid_commands:
prints(" -",command)
func list(show_all: bool = true) -> void:
var entries := config.timesheet.entries
for item in entries:
if show_all:
print(item)
else:
if not item.is_closed:
print(item)
quit()
func stop(entry_name: String) -> void:
var success := config.timesheet.stop_entry(entry_name)
if success:
print("closed %s"%[entry_name])
else:
print("could not close %s"%[entry_name])
quit()
func start(entry_name: String) -> void:
# warning-ignore:return_value_discarded
config.timesheet.add_entry(entry_name)
quit()

249
plugin_loader.gd Normal file
View File

@ -0,0 +1,249 @@
## This resource works in two stages:
## 1. loads resource packs from a specified location
## 2. verifies each resource pack is conform to a spec
## 3. list all plugins
## 4. loads all plugins marked as "enabled"
##
## Notes: Enabling a plugin does _not_ run it. It's expected that the app would
## be restarted for the loading to happen. If you want to immediately load and
## unload, use the signals
##
## ## Expected Flow:
##
## 1. use `PluginLoader.restore().load_plugins()` to load all plugins
## 2. use `PluginLoader.restore().provide_interface()` to get a bunch of
## checkboxes to use in an UI
## 3. that's it! You can also provide an initial set of plugins (expected to be
## found with the app's files
class_name PluginLoader extends Resource
################################################################################
#
# GENERAL SINGLETON BEHAVIOR
#
## Default resource path.
const _RESOURCE_PATH := "user://plugins.tres"
## Loads the plugin loader resource.
## Always returns a PluginLoader instance; if the path is wrong, a new instance will
## be created.
static func restore(path := _RESOURCE_PATH) -> PluginLoader:
var file: PluginLoader = ResourceLoader.load(path, "PluginLoader")
if file == null:
return PluginLoader.new()
file.refresh_from_disk()
return file
## Saves the current plugins status.
## This is called automatically when changing a plugin status. You shouldn't have to
## call it manually.
func save() -> void:
ResourceSaver.save(self, _RESOURCE_PATH)
################################################################################
#
# PLUGIN PACKS LOADING
#
enum STATUS{
AVAILABLE,
LOADED,
ERROR,
NOT_FOUND
}
## Defines where plugin packs should be fetched from
@export var plugins_packs_directory := "user://"
## An object of [plugin_name: String, status: STATUS]
@export var plugins_status := {}
## These represent plugins that come with the application
@export var native_plugins := {}
## Lists all plugin packs from their designated location. Refreshes the "plugins
## status" array
## Returns a Dictionary with keys "added" and "removed", each respectively listing
## all added or removed packs as strings
func read_available_plugins() -> Dictionary:
var dir := DirAccess.open(plugins_packs_directory)
if dir == null:
return {}
dir.list_dir_begin()
var file_name = dir.get_next()
var old_plugins := plugins_status.duplicate()
plugins_status = {}
var removed: Array[String] = []
var added: Array[String] = []
# read the resource packs directory
while file_name != "":
if not dir.current_is_dir():
if file_name.get_extension().to_lower() == "pck":
var plugin_name := file_name.get_basename()
var path := plugins_packs_directory.path_join(file_name)
var success := ProjectSettings.load_resource_pack(path, false)
if not success:
printerr("Could not load resource pack %s"%[file_name])
else:
if old_plugins.has(plugin_name):
plugins_status[plugin_name] = old_plugins[plugin_name]
else:
added.append(plugin_name)
plugins_status[plugin_name] = STATUS.AVAILABLE
file_name = dir.get_next()
# read the native plugins list
for plugin_name in native_plugins:
if not old_plugins.has(plugin_name):
plugins_status[plugin_name] = old_plugins[plugin_name]
else:
plugins_status[plugin_name] = native_plugins[plugin_name]
# check if anything was removed
for plugin_name in old_plugins:
if not plugins_status.has(plugin_name):
removed.append(plugin_name)
save()
return {
added = added,
removed = removed,
}
################################################################################
#
# PLUGINS STATES
#
# Changing a plugin state does not mean anything before calling `load_plugins()`
#
signal plugin_status_changed(plugin_name: String, status: STATUS)
## Sets a plugin on or off. Does not immediately load it.
func set_plugin_status(plugin_name: String, status: STATUS) -> void:
if not plugins_status.has(plugin_name):
printerr("Plugin %s does not exist"%[plugin_name])
return
if plugins_status[plugin_name] == status:
return
plugins_status[plugin_name] = status
plugin_status_changed.emit(plugin_name, status)
save()
## Returns a plugin status.
func get_plugin_status(plugin_name: String) -> STATUS:
if not plugins_status.has(plugin_name):
printerr("Plugin %s does not exist"%[plugin_name])
return STATUS.NOT_FOUND
return (plugins_status[plugin_name]) as STATUS
################################################################################
#
# PLUGINS INSTANCING
#
## Defines where plugins are expected to be found after a plugin pack is loaded
## this is also where native plugins are located
@export var plugins_local_directory := "res://mods"
signal plugin_error(plugin_name: String)
signal plugin_started(plugin_name: String)
func start_plugin_if_enabled(plugin_name: String) -> bool:
var status := get_plugin_status(plugin_name)
match status:
STATUS.LOADED:
var instance := instance_plugin_if_valid(plugin_name)
if instance == null:
plugins_status[plugin_name] = STATUS.ERROR
plugin_error.emit(plugin_name)
else:
instance.plugin_start()
plugin_started.emit(plugin_name)
return true
return false
## This loads a local plugin and instances it. If the plugin comes from a resource pack,
## the resource pack needs to have been loaded before
func instance_plugin_if_valid(plugin_name: String) -> Plugin_V1:
var entry_point_path := plugins_local_directory.path_join(plugin_name).path_join("plugin.gd")
var entry_point_file := FileAccess.open(entry_point_path, FileAccess.READ)
if entry_point_file == null:
printerr("The entry point does not exist or is not readable")
return null
var entry_point_text := entry_point_file.get_as_text()
if not entry_point_text.match("extends"):
printerr("The entry point is not text, which is not allowed for security reasons")
return null
if entry_point_text.match("func _init():"):
printerr("The entry point contains _init(), which is a security issue, mod will not load")
return null
var entry_point_script = load(entry_point_path)
if entry_point_script == null:
printerr("Tried loading %s but did not find the expected entry point"%[entry_point_path])
return null
var instance: Plugin_V1 = (entry_point_script as Plugin_V1).new()
if not (instance is Plugin_V1):
printerr("Tried loading %s but it is not the right format"%[entry_point_path])
return null
return instance
################################################################################
#
# UTILITIES
#
## Utility function to provide a list of checkboxes that turn plugins on or off.
func provide_interface() -> Array[CheckBox]:
var checkboxes: Array[CheckBox] = []
for plugin in plugins_status:
var plugin_name: String = plugin as String
var checkbox := CheckBox.new()
checkbox.text = plugin_name.get_basename()
checkbox.button_pressed = get_plugin_status(plugin_name) == STATUS.LOADED
checkbox.toggled.connect(
func checkbox_toggled(is_on: bool) -> void:
set_plugin_status(plugin_name, STATUS.LOADED if is_on else STATUS.AVAILABLE)
)
checkboxes.append(checkbox)
return checkboxes
################################################################################
#
# BOOSTRAPPING
#
## For each plugin that's on, load it.
## This function makes no assumptions and no checks. Not loading plugins twice
## is on you
func load_plugins() -> void:
var report := read_available_plugins()
var removed := report.removed as Array[String]
var added := report.added as Array[String]
if removed.size():
print_rich("Removed plugins %s"%[", ".join(removed)])
if added.size():
print_rich("Added plugins %s"%[", ".join(removed)])
for plugin_name in plugins_status:
start_plugin_if_enabled(plugin_name)

9
plugin_v1.gd Normal file
View File

@ -0,0 +1,9 @@
class_name Plugin_V1
func plugin_start() -> void:
pass
func plugin_stop() -> void:
pass

View File

@ -6,111 +6,38 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ {
"base": "Reference",
"class": "CMD",
"language": "GDScript",
"path": "res://scripts/cmd.gd"
}, {
"base": "Resource",
"class": "ConfigManager",
"language": "GDScript",
"path": "res://scripts/config_manager.gd"
}, {
"base": "Reference",
"class": "Consts",
"language": "GDScript",
"path": "res://scripts/consts.gd"
}, {
"base": "Reference",
"class": "FileWatcher",
"language": "GDScript",
"path": "res://scripts/file_watcher.gd"
}, {
"base": "Tree",
"class": "TimeEntriesItemsTree",
"language": "GDScript",
"path": "res://ui/tasks_list.gd"
}, {
"base": "Reference",
"class": "TimeEntry",
"language": "GDScript",
"path": "res://scripts/time_entry.gd"
}, {
"base": "Reference",
"class": "TimeEntryTreeItem",
"language": "GDScript",
"path": "res://scripts/time_entry_tree_item.gd"
}, {
"base": "Reference",
"class": "TimeSheet",
"language": "GDScript",
"path": "res://scripts/time_sheet.gd"
}, {
"base": "Reference",
"class": "TimeStamp",
"language": "GDScript",
"path": "res://scripts/time_stamp.gd"
} ]
_global_script_class_icons={
"CMD": "",
"ConfigManager": "",
"Consts": "",
"FileWatcher": "",
"TimeEntriesItemsTree": "",
"TimeEntry": "",
"TimeEntryTreeItem": "",
"TimeSheet": "",
"TimeStamp": ""
}
config_version=5
[application]
config/name="Rat Times"
run/main_scene="res://ui/composed_ui.tscn"
config/description="Track your time(s)s"
run/main_scene="res://Main.tscn"
config/use_custom_user_dir=true
config/custom_user_dir_name="rat_times"
run/low_processor_mode=true
boot_splash/show_image=false
config/features=PackedStringArray("4.0")
boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 0)
config/icon="res://assets/logo.png"
config/macos_native_icon="res://build/logo.icns"
config/windows_native_icon="res://build/logo.ico"
[debug]
settings/fps/force_fps=60
boot_splash/show_image=false
config/icon="res://logo.svg"
config/macos_native_icon="res://logo.icns"
config/windows_native_icon="res://logo.ico"
[display]
window/size/width=360
window/size/height=760
window/size/viewport_width=500
window/size/viewport_height=151
window/size/resizable=false
window/size/always_on_top=true
window/size/transparent=true
window/per_pixel_transparency/allowed=true
window/per_pixel_transparency/enabled=true
window/energy_saving/keep_screen_on=false
window/handheld/orientation="portrait"
window/ios/hide_home_indicator=false
window/stretch/aspect="keep"
window/subwindows/embed_subwindows=false
[global]
[physics]
rced=false
[gui]
theme/use_hidpi=true
[logging]
file_logging/log_path="user://logs/rat-times.log"
common/enable_pause_aware_picking=true
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
textures/vram_compression/import_etc2_astc=true
viewport/transparent_background=true
environment/default_environment="res://default_env.tres"

View File

@ -1,70 +0,0 @@
class_name CMD
var _parsed := false
## @type Dictionary[String, String|bool]
var command_line_arguments: Dictionary = {} setget set_command_line_arguments, get_command_line_arguments
## Removes the first element find from the `quotes` array from the start and end of a string
## Also removes any whitespace resulting from removing the quoting elements
static func unsurround(value: String, quotes := PoolStringArray(['"', "'"])) -> String:
for quote_str in quotes:
if value.begins_with(quote_str) \
and value.ends_with(quote_str) \
and value[value.length() - 2] != "\\":
return value.trim_prefix(quote_str).trim_suffix(quote_str).strip_edges()
return value
## Returns a dictionary of all arguments passed after `--` on the command line
## arguments take one of 2 forms:
## - `--arg` which is a boolean (using `--no-arg` for `false` is possible)
## - `--arg=value`. If the value is quoted with `"` or `'`, this function will
## unsurround the string
## This function does no evaluation and does not attempt to guess the type of
## arguments. You will receive either bools, or strings.
static func parse_cmd_arguments() -> Dictionary:
var arguments := {}
for arg in OS.get_cmdline_args():
var argument: String = arg.lstrip("--").to_lower()
if argument.find("=") > -1:
var arg_tuple := argument.split("=")
var key := arg_tuple[0]
var value := unsurround(arg_tuple[1])
arguments[key] = value
else:
var key := argument
var value := true
if argument.begins_with("no-"):
value = false
key = argument.lstrip("no-")
arguments[key] = value
return arguments
func set_command_line_arguments(_arguments: Dictionary) -> void:
printerr("get_command_line_arguments is a read only value")
func get_command_line_arguments() -> Dictionary:
if not _parsed:
_parsed = true
command_line_arguments = parse_cmd_arguments()
return command_line_arguments
## Returns a single argument passed after `--` on the command line
## if the argument does not exist, `default` is returned instead
## _parse_cmd_arguments() has to be called first
func get_argument(name: String, default = null):
if get_command_line_arguments().has(name):
return get_command_line_arguments()[name]
return default
## Verifies an argument exists on the command line
## _parse_cmd_arguments() has to be called first
func has_argument(name: String) -> bool:
return get_command_line_arguments().has(name)

View File

@ -1,180 +0,0 @@
## Reads the config, sets values. Acts a singleton because it proxies a const
## file path.
class_name ConfigManager extends Resource
const CONFIG_PATH := "user://settings.cfg"
var _config := ConfigFile.new()
var _watcher: FileWatcher
###############################################################################
#
# SIGNAL
#
signal time_sheet_loaded
func emit_loaded() -> void:
emit_signal("time_sheet_loaded")
###############################################################################
#
# TIMESHEET FILE LOADING AND PARSING
#
var timesheet: TimeSheet setget ,get_timesheet
func get_timesheet() -> TimeSheet:
if timesheet == null:
timesheet = _load_timesheet(get_current_timesheet_file_path())
return timesheet
func _load_timesheet(path: String) -> TimeSheet:
var new_timesheet := TimeSheet.restore(path)
if new_timesheet == null:
return null
_watcher = FileWatcher.new()
_watcher.file_name = path
# warning-ignore:return_value_discarded
_watcher.connect("file_changed", self, "reload_timesheet")
_watcher.start()
return new_timesheet
func reload_timesheet() -> void:
var new_timesheet = _load_timesheet(get_current_timesheet_file_path())
if new_timesheet == null:
printerr("failed to load new timesheet")
return
timesheet = new_timesheet
emit_loaded()
###############################################################################
#
# TIMESHEET FILE PATH
#
var current_timesheet_file_path: String = "" setget set_current_timesheet_file_path, get_current_timesheet_file_path
func set_current_timesheet_file_path(value: String) -> void:
if current_timesheet_file_path == value:
return
timesheet = _load_timesheet(value)
if timesheet == null:
return
current_timesheet_file_path = value
_config.set_value("MAIN", "file", value)
emit_loaded()
save()
func get_current_timesheet_file_path() -> String:
var _default_path := OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS, true).plus_file("mouse_timer.csv")
return _config.get_value("MAIN", "file", _default_path)
###############################################################################
#
# THEME FILE LOADING AND PARSING
#
var theme: Theme setget , get_theme
func get_theme() -> Theme:
if theme == null:
theme = ResourceLoader.load(theme_file_path, "Theme")
return theme
###############################################################################
#
# THEME FILE PATH
#
signal theme_changed
var theme_file_path: String = "" setget set_theme_file_path, get_theme_file_path
func set_theme_file_path(value: String) -> void:
var new_theme: Theme = ResourceLoader.load(value, "Theme")
if new_theme != null:
theme = new_theme
theme_file_path = value
_config.set_value("MAIN", "theme", value)
emit_signal("theme_changed")
save()
func get_theme_file_path() -> String:
return _config.get_value("MAIN", "theme", preload("res://assets/default_theme.theme").resource_path)
###############################################################################
#
# SOUND OPTION
#
var sound_fx_on: bool = true setget set_sound_fx_on, get_sound_fx_on
func set_sound_fx_on(value: bool) -> void:
sound_fx_on = value
_config.set_value("MAIN", "sound_fx_on", value)
save()
func get_sound_fx_on() -> bool:
return _config.get_value("MAIN", "sound_fx", true)
###############################################################################
#
# SOME SETTINGS CACHE
#
var current_task_name := "" setget set_current_task_name, get_current_task_name
func set_current_task_name(value: String) -> void:
current_task_name = value
_config.set_value("CACHE", "current_task_name", value)
save()
func get_current_task_name() -> String:
return _config.get_value("CACHE", "current_task_name", "")
var last_window_position := Vector2() setget set_last_window_position, get_last_window_position
func set_last_window_position(value: Vector2) -> void:
last_window_position = value
_config.set_value("CACHE", "last_window_position", value)
save()
func get_last_window_position() -> Vector2:
return _config.get_value("CACHE", "last_window_position", OS.get_screen_size()/2)
###############################################################################
#
# BOOTSTRAP
#
func _init() -> void:
# warning-ignore:return_value_discarded
_config.load(CONFIG_PATH)
func save() -> void:
# warning-ignore:return_value_discarded
_config.save(CONFIG_PATH)

View File

@ -1,8 +0,0 @@
class_name Consts
const START := "start"
const STOP := "stop"
const NO_TIME := "00:00:00"
const ONGOING := "ongoing"
const THEME_OVERRIDE_START := "play_button"
const THEME_OVERRIDE_STOP := "stop_button"

View File

@ -1,60 +0,0 @@
class_name FileWatcher
signal file_changed
var file_name: String setget set_file_name
var scan_delay_s: float = 1.0 setget set_scan_delay_s
var _file := File.new()
var _last_modified: int = 0
var _timer := Timer.new()
func _init() -> void:
# warning-ignore:return_value_discarded
_timer.connect("timeout", self, "check")
_timer.wait_time = scan_delay_s
func set_file_name(new_file_name: String) -> void:
if file_name == new_file_name:
return
file_name = new_file_name
if file_name.begins_with("res://") or file_name.begins_with("user://"):
file_name = ProjectSettings.globalize_path(file_name)
_last_modified = _file.get_modified_time(file_name)
_timer.name = "__file_watcher_%s"%[file_name]
func set_scan_delay_s(new_scan_delay_s: float) -> void:
scan_delay_s = new_scan_delay_s
_timer.wait_time = scan_delay_s
func check() -> void:
if file_name == "":
return
var new_modified := _file.get_modified_time(file_name)
if new_modified != _last_modified:
_last_modified = new_modified
emit_signal("file_changed")
func start() -> void:
if not _timer.is_inside_tree():
var main_loop: SceneTree = Engine.get_main_loop()
var root := main_loop.root
if root == null:
printerr("Called start before any scene is loaded")
return
if not root.is_inside_tree():
yield(root, "ready")
root.call_deferred("add_child", _timer, true)
yield(_timer, "ready")
_timer.start()
func stop() -> void:
_timer.stop()

View File

@ -1,103 +0,0 @@
## Describes a row in a timesheet
## Has a beginning and an end
class_name TimeEntry
var name := ""
var is_closed := false
var start_time := TimeStamp.new()
var end_time := TimeStamp.new()
func start_recording() -> TimeEntry:
# warning-ignore:return_value_discarded
start_time.from_current_time()
# warning-ignore:return_value_discarded
end_time.from_current_time()
return self
func update() -> void:
# warning-ignore:return_value_discarded
end_time.from_current_time()
func close() -> void:
update()
is_closed = true
func get_elapsed_seconds() -> int:
var elapsed := end_time.get_difference(start_time)
return elapsed
func get_period() -> String:
var time_in_secs := get_elapsed_seconds()
return time_to_period(time_in_secs)
static func time_to_period(time_in_secs: int) -> String:
# warning-ignore:integer_division
var seconds := time_in_secs%60
# warning-ignore:integer_division
var minutes := (time_in_secs/60)%60
# warning-ignore:integer_division
var hours := (time_in_secs/60)/60
return "%02d:%02d:%02d" % [hours, minutes, seconds]
static func period_to_time(period_string: String) -> int:
var period := period_string.split(":")
if period.size() < 3:
return -1
var hours := int(period[0])
var minutes := int(period[1])
var seconds := int(period[2])
var time := seconds + (minutes * 60) + (hours * 60 * 60)
return time
func to_csv_line() -> PoolStringArray:
return PoolStringArray([
name,
start_time,
end_time,
str(get_elapsed_seconds()) if is_closed else tr(Consts.ONGOING)
])
static func is_csv_line_valid(line: PoolStringArray) -> bool:
return line.size() > 3
func from_csv_line(line: PoolStringArray) -> TimeEntry:
name = line[0]
var start_time_string = line[1]
# warning-ignore:return_value_discarded
start_time.from_string(start_time_string)
var elapsed_seconds = int(line[3]) if line[3].is_valid_integer() else 0
is_closed = elapsed_seconds > 0
if is_closed == true:
var end_time_string = line[2]
# warning-ignore:return_value_discarded
end_time.from_string(end_time_string)
else:
# warning-ignore:return_value_discarded
end_time.from_current_time()
return self
func to_dict() -> Dictionary:
return {
start_time = start_time,
closed = is_closed,
}
func _to_string() -> String:
return "%s\t%s\t%s"%[name, tr(Consts.ONGOING) if is_closed == false else end_time.to_string(), start_time]

View File

@ -1,77 +0,0 @@
class_name TimeEntryTreeItem
signal end_time_updated
var time_entry: TimeEntry
var children := {}
var time_entries := []
func get_child(parts: Array, or_create := false):
# workaround for cyclic dependencies bug
var TimeEntryTreeItem = load("res://scripts/time_entry_tree_item.gd")
if parts.size() == 0:
return self
var part: String = parts.pop_front()
if not children.has(part):
if or_create == false:
return null
var time_entry_tree_item = TimeEntryTreeItem.new()
# warning-ignore:return_value_discarded
time_entry_tree_item.connect("end_time_updated", self, "_on_end_time_updated")
children[part] = time_entry_tree_item
return children[part].get_child(parts, or_create)
func find_active_time_entry() -> TimeEntry:
for _time_entry_tree_item in time_entries:
var time_entry_tree_item := _time_entry_tree_item as TimeEntryTreeItem
var current_time_entry := time_entry_tree_item.time_entry
if not current_time_entry.is_closed:
return current_time_entry
return null
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
time_entries.append(time_entry_tree_item)
func _on_end_time_updated() -> void:
emit_signal("end_time_updated")
func get_elapsed_seconds() -> int:
var seconds := time_entry.get_elapsed_seconds() if time_entry != null else 0
for child_name in children:
var child = children[child_name]
seconds += child.get_elapsed_seconds()
for entry in time_entries:
seconds += entry.get_elapsed_seconds()
return seconds
func get_period() -> String:
var time_in_secs := get_elapsed_seconds()
return TimeEntry.time_to_period(time_in_secs)
func to_dict() -> Dictionary:
var json := {}
var times := []
if time_entries.size() > 0:
for entry in time_entries:
times.append(entry.to_dict())
json["__time"] = times
if children.size() > 0:
for name in children:
json[name] = children[name].to_dict()
return json
func _to_string() -> String:
var json := to_dict()
var json_string := JSON.print(json, "\t")
return json_string

View File

@ -1,170 +0,0 @@
class_name TimeSheet
var source_path := ""
var entries := []
# warning-ignore:integer_division
var _last_update := Time.get_ticks_msec() / 1000
## Loads the data file
func load_file() -> bool:
var file := File.new()
var success := file.open(source_path, File.READ)
if success != OK:
success = file.open(source_path, File.WRITE)
if success != OK:
printerr("Failed to open file %s"%[ProjectSettings.globalize_path(source_path)])
return false
return true
while not file.eof_reached():
var line := file.get_csv_line()
if line.size() == 0 or "".join(line).length() == 0:
continue
if not TimeEntry.is_csv_line_valid(line):
push_warning("CSV Line `%s` is not conform"%[",".join(line)])
continue
var entry := TimeEntry.new().from_csv_line(line)
entries.append(entry)
file.close()
return true
func get_active_entry_from_name(task_name: String) -> TimeEntry:
for _entry in entries:
var current_time_entry := _entry as TimeEntry
if current_time_entry.name == task_name and not current_time_entry.is_closed:
return current_time_entry
return null
## Adds a new time entry to the tree and to the data file
func add_entry(entry_name: String) -> TimeEntry:
var current_entry := TimeEntry.new().start_recording()
current_entry.name = entry_name
current_entry.is_closed = false
var file := File.new()
var success := file.open(source_path, File.READ_WRITE)
if success != OK:
printerr("Could not open file")
return null
file.seek_end()
entries.append(current_entry)
file.store_csv_line(current_entry.to_csv_line())
return current_entry
func stop_entry(entry_name: String, do_save := true) -> bool:
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:
current_time_entry.close()
if do_save:
save()
return true
return false
func toggle_entry(entry_name: String, do_save := true) -> void:
if stop_entry(entry_name, do_save):
return
else:
# warning-ignore:return_value_discarded
add_entry(entry_name)
func update() -> void:
# warning-ignore:integer_division
var current_time := Time.get_ticks_msec() / 1000
if current_time == _last_update:
return
_last_update = current_time
for entry in entries:
var time_entry := entry as TimeEntry
if time_entry.is_closed == false:
time_entry.update()
func save() -> void:
var file := File.new()
var success := file.open(source_path, File.WRITE)
if success != OK:
printerr("Could not open file")
return
for time_entry in entries:
file.store_csv_line(time_entry.to_csv_line())
func make_items_tree() -> TimeEntryTreeItem:
var sorted_entries := EntrySorter.new(entries).sort_by([["name"], ["start_date", true]]).entries
var tree := TimeEntryTreeItem.new()
for entry_index in sorted_entries.size():
var entry := sorted_entries[entry_index] as TimeEntry
var parts := entry.name.split("/")
var repo: TimeEntryTreeItem = tree.get_child(parts, true)
repo.append(entry)
return tree
static func restore(file_path: String) -> TimeSheet:
var timesheet = load("res://scripts/time_sheet.gd").new()
timesheet.source_path = file_path
var success: bool = timesheet.load_file()
if success:
return timesheet
return null
class EntrySorter:
var entries: Array
var _sorters := PoolStringArray()
func _init(initial_entries: Array) -> void:
entries = initial_entries.duplicate()
func by_name(reverse := false) -> EntrySorter:
return sort_by_one("name", reverse)
func by_date(reverse := false) -> EntrySorter:
return sort_by_one("date", reverse)
func sort_by_one(property: String, reverse := false) -> EntrySorter:
var method_name := "_by_%s"%[property]
assert(has_method(method_name), "%s is not a valid sorting property"%[property])
entries.sort_custom(self, method_name)
if reverse:
entries.invert()
return self
func sort_by(initial_sorters: Array) -> EntrySorter:
for item in initial_sorters:
var property = item[0]
var reversed = item[1] if item.size() > 1 else false
var method_name := "_by_%s"%[property]
assert(has_method(method_name), "%s is not a valid sorting property"%[property])
assert(reversed == null or reversed is bool, "The second item is not a boolean")
return self
_sorters = initial_sorters
entries.sort_custom(self, "__by_multiple")
_sorters = PoolStringArray()
return self
func __by_multiple(a: TimeEntry, b: TimeEntry) -> bool:
for item in _sorters:
var property = item[0]
var reversed = item[1]
var method_name := "_by_%s"%[property]
var result: bool = call(method_name, a, b)
if reversed:
result = not result
if result == false:
return false
return true
func _by_name(a: TimeEntry, b: TimeEntry) -> bool:
return a.name < b.name
func _by_date(a: TimeEntry, b: TimeEntry) -> bool:
return a.start_time < b.start_time

View File

@ -1,73 +0,0 @@
## A simple proxy for the object returned by Godot's time functions
## Ensures proper typing
class_name TimeStamp
var year := 0
var month := 0
var day := 0
var weekday := 0
var hour := 0
var minute := 0
var second := 0
var unix := 0
func from_current_time() -> TimeStamp:
return from_dict(Time.get_datetime_dict_from_system())
func from_dict(time: Dictionary) -> TimeStamp:
year = time.year
month = time.month
day = time.day
weekday = time.weekday
hour = time.hour
minute = time.minute
second = time.second
unix = Time.get_unix_time_from_datetime_dict(time)
return self
func to_dict() -> Dictionary:
return {
year = year,
month = month,
day = day,
weekday = weekday,
hour = hour,
minute = minute,
second = second,
}
func get_difference(other_timestamp: TimeStamp) -> int:
return unix - other_timestamp.unix
func from_string(time_string: String) -> TimeStamp:
var time := Time.get_datetime_dict_from_datetime_string(time_string, true)
return from_dict(time)
func from_unix_time(unix_time: int) -> TimeStamp:
var time := Time.get_datetime_dict_from_unix_time(unix_time)
return from_dict(time)
func equals(other) -> bool:
return (
other.year == year and \
other.month == month and \
other.day == day and \
other.weekday == weekday and \
other.hour == hour and \
other.minute == minute and \
other.second == second and \
other.unix == unix
)
func _to_string() -> String:
return Time.get_datetime_string_from_datetime_dict(to_dict(), false)

View File

@ -1,51 +0,0 @@
extends Control
var config: ConfigManager = preload("res://config_manager.tres")
onready var v_box_container_primary := $"%VBoxContainerPrimary" as VBoxContainer
onready var toggle_tab_container_button := $"%ToggleTabContainerButton" as Button
onready var tab_container := $"%TabContainer" as TabContainer
func _ready() -> void:
toggle_tab_container_button.toggle_mode = true
# warning-ignore:return_value_discarded
toggle_tab_container_button.connect("toggled", self, "_on_toggle_tab_container_button_toggled")
tab_container.visible = toggle_tab_container_button.pressed
OS.window_position = config.last_window_position
set_window_size()
get_tree().get_root().set_transparent_background(true)
func _on_toggle_tab_container_button_toggled(is_toggled: bool) -> void:
tab_container.visible = is_toggled
set_window_size()
func set_window_size() -> void:
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
var mouse_button_is_pressed := false
var dragging_start_position = Vector2()
func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if event.get_button_index() == 1:
mouse_button_is_pressed = !mouse_button_is_pressed
dragging_start_position = get_local_mouse_position()
func _process(_delta: float) -> void:
if mouse_button_is_pressed:
OS.set_window_position(OS.window_position + get_global_mouse_position() - dragging_start_position)
func _notification(what: int) -> void:
match what:
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
config.last_window_position = OS.window_position
get_tree().quit()

View File

@ -1,104 +0,0 @@
[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 = 142.0
[node name="TimeCounter" parent="VBoxContainer/VBoxContainerPrimary" instance=ExtResource( 3 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 350.0
margin_bottom = 142.0
[node name="HBoxContainer2" parent="VBoxContainer/VBoxContainerPrimary/TimeCounter" index="0"]
margin_right = 350.0
margin_bottom = 40.0
[node name="ToggleTabContainerButton" type="Button" parent="VBoxContainer/VBoxContainerPrimary/TimeCounter/HBoxContainer2" index="0"]
unique_name_in_owner = true
margin_right = 40.0
margin_bottom = 40.0
theme_type_variation = "panel_toggle_button"
toggle_mode = true
[node name="TaskNameLineEdit" parent="VBoxContainer/VBoxContainerPrimary/TimeCounter/HBoxContainer2" index="1"]
margin_left = 48.0
margin_right = 350.0
margin_bottom = 40.0
[node name="HBoxContainer" parent="VBoxContainer/VBoxContainerPrimary/TimeCounter" index="1"]
margin_top = 47.0
margin_right = 350.0
margin_bottom = 142.0
[node name="TimeLabel" parent="VBoxContainer/VBoxContainerPrimary/TimeCounter/HBoxContainer" index="0"]
margin_top = 0.0
margin_right = 270.0
margin_bottom = 95.0
[node name="StartButton" parent="VBoxContainer/VBoxContainerPrimary/TimeCounter/HBoxContainer" index="1"]
margin_left = 278.0
margin_right = 350.0
margin_bottom = 95.0
[node name="TabContainer" type="TabContainer" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 149.0
margin_right = 350.0
margin_bottom = 750.0
size_flags_vertical = 3
[node name="Task List" type="VBoxContainer" parent="VBoxContainer/TabContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 5.0
margin_top = 46.0
margin_right = -5.0
margin_bottom = -5.0
[node name="TasksList" parent="VBoxContainer/TabContainer/Task List" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 340.0
margin_bottom = 550.0
size_flags_horizontal = 3
size_flags_vertical = 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 = 565.0
[editable path="VBoxContainer/VBoxContainerPrimary/TimeCounter"]

View File

@ -1,124 +0,0 @@
extends Control
var config: ConfigManager = preload("res://config_manager.tres")
onready var file_path_line_edit: LineEdit = $"%FilePathLineEdit" as LineEdit
onready var file_path_button: Button = $"%FilePathButton" as Button
onready var theme_path_button: Button = $"%ThemePathButton" as Button
onready var sound_check_box: CheckBox = $"%SoundCheckBox" as CheckBox
onready var open_data_dir_button: Button = $"%OpenDataDirButton" as Button
onready var file_path_open_button: Button = $"%FilePathOpenButton" as Button
onready var attributions_rich_text_label: RichTextLabel = $"%AttributionsRichTextLabel" as RichTextLabel
onready var file_path_file_dialog: FileDialog = $"%FilePathFileDialog" as FileDialog
onready var theme_path_file_dialog: FileDialog = $"%ThemePathFileDialog" as FileDialog
func _ready() -> void:
# warning-ignore:return_value_discarded
config.connect("theme_changed", self, "_on_theme_changed")
# warning-ignore:return_value_discarded
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")
# warning-ignore:return_value_discarded
file_path_file_dialog.connect("visibility_changed", self, "_resize_on_dialog", [file_path_file_dialog])
# warning-ignore:return_value_discarded
file_path_file_dialog.connect("file_selected", self, "_on_current_file_selected")
# warning-ignore:return_value_discarded
file_path_line_edit.connect("text_entered", self, "_on_current_file_selected")
# warning-ignore:return_value_discarded
theme_path_button.connect("pressed", self, "_on_theme_path_button_pressed")
# warning-ignore:return_value_discarded
theme_path_file_dialog.connect("visibility_changed", self, "_resize_on_dialog", [theme_path_file_dialog])
# warning-ignore:return_value_discarded
theme_path_file_dialog.connect("file_selected", self, "_on_new_theme_selected")
theme_path_file_dialog.hide()
file_path_file_dialog.hide()
sound_check_box.pressed = config.sound_fx_on
# warning-ignore:return_value_discarded
sound_check_box.connect("toggled", self, "_on_sound_toggle")
# warning-ignore:return_value_discarded
attributions_rich_text_label.connect("meta_clicked", self, "_on_attributions_rich_text_label_meta_clicked")
# 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()
func _on_current_file_changed() -> void:
#file_path_file_dialog.initial_path = config.current_timesheet_file_path.get_base_dir()
file_path_line_edit.text = config.current_timesheet_file_path
func _on_theme_changed() -> void:
theme = config.theme
func _on_file_path_button_pressed() -> void:
_set_file_dialog_file_path(file_path_file_dialog, config.current_timesheet_file_path)
func _on_current_file_selected(new_file: String) -> void:
config.current_timesheet_file_path = new_file
func _on_sound_toggle(is_on: bool) -> void:
config.sound_fx_on = is_on
func _on_theme_path_button_pressed() -> void:
_set_file_dialog_file_path(theme_path_file_dialog, config.theme_file_path)
theme_path_file_dialog.show()
func _on_new_theme_selected(new_theme_path: String) -> void:
config.theme_file_path = new_theme_path
func _on_attributions_rich_text_label_meta_clicked(meta) -> void:
if meta is String:
# warning-ignore:return_value_discarded
OS.shell_open(meta)
func _on_open_data_dir_button_pressed() -> void:
_open_path(OS.get_user_data_dir())
func _on_file_path_open_button_pressed() -> void:
_open_path(config.current_timesheet_file_path.get_base_dir())
func _open_path(path: String):
var canonical_path := ProjectSettings.globalize_path(path).strip_edges()
# warning-ignore:return_value_discarded
OS.shell_open("file://"+canonical_path)
func _set_file_dialog_file_path(dialog: FileDialog, path: String) -> void:
#dialog.current_path = path
#dialog.current_file = path
dialog.current_dir = path.get_base_dir()
dialog.show()
dialog.invalidate()
var previous_window_size := OS.window_size
func _resize_on_dialog(dialog: Control) -> void:
if dialog.visible == true:
previous_window_size = OS.window_size
OS.window_size = file_path_file_dialog.rect_size
else:
OS.window_size = previous_window_size

View File

@ -1,151 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://ui/settings.gd" type="Script" id=1]
[node name="Settings" type="MarginContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 505.0
margin_bottom = 760.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 505.0
margin_bottom = 45.0
size_flags_horizontal = 3
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_top = 10.0
margin_right = 92.0
margin_bottom = 35.0
text = "File Path"
[node name="FilePathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
margin_left = 100.0
margin_right = 264.0
margin_bottom = 45.0
size_flags_horizontal = 3
caret_blink = true
caret_blink_speed = 0.5
[node name="FilePathButton" type="Button" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
margin_left = 272.0
margin_right = 314.0
margin_bottom = 45.0
text = "..."
[node name="FilePathOpenButton" type="Button" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
margin_left = 322.0
margin_right = 505.0
margin_bottom = 45.0
text = "open directory"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 53.0
margin_right = 505.0
margin_bottom = 90.0
size_flags_horizontal = 3
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_top = 6.0
margin_right = 199.0
margin_bottom = 31.0
text = "Alternative Theme"
[node name="ThemePathButton" type="Button" parent="VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
margin_left = 207.0
margin_right = 278.0
margin_bottom = 37.0
text = "load"
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 98.0
margin_right = 505.0
margin_bottom = 146.0
size_flags_horizontal = 3
[node name="SoundCheckBox" type="CheckBox" parent="VBoxContainer/HBoxContainer3"]
unique_name_in_owner = true
margin_right = 134.0
margin_bottom = 48.0
text = "sounds"
[node name="OpenDataDirButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 154.0
margin_right = 505.0
margin_bottom = 191.0
text = "Open data dir"
[node name="AttributionsRichTextLabel" type="RichTextLabel" parent="VBoxContainer"]
unique_name_in_owner = true
margin_top = 199.0
margin_right = 505.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
Sound: [url]https://opengameart.org/content/bubbles-pop[/url]
This game uses Godot Engine, available under the following license:
Copyright (c) 2014-present Godot Engine contributors. Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"
text = "Font: Cairo, Designed by Mohamed Gaber, Accademia di Belle Arti di Urbino
Sound: https://opengameart.org/content/bubbles-pop
This game uses Godot Engine, available under the following license:
Copyright (c) 2014-present Godot Engine contributors. Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Popups" type="Control" parent="CanvasLayer"]
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2
[node name="FilePathFileDialog" type="FileDialog" parent="CanvasLayer/Popups"]
unique_name_in_owner = true
margin_right = 1092.0
margin_bottom = 762.0
window_title = "Select CSV"
dialog_hide_on_ok = true
access = 2
filters = PoolStringArray( "*.csv ; CSV Files" )
[node name="ThemePathFileDialog" type="FileDialog" parent="CanvasLayer/Popups"]
unique_name_in_owner = true
margin_right = 1092.0
margin_bottom = 762.0
window_title = "Select a Theme File"
dialog_hide_on_ok = true
mode = 0
access = 2
filters = PoolStringArray( "*.theme ; Theme Files" )

View File

@ -1,155 +0,0 @@
class_name TimeEntriesItemsTree extends Tree
enum COL{
TEXT,
TIME
}
const META_KEY = "time_entry"
var config: ConfigManager = preload("res://config_manager.tres")
var _timer := Timer.new()
func _ready() -> void:
hide_root = true
add_child(_timer)
# warning-ignore:return_value_discarded
connect("button_pressed", self, "_on_button_pressed")
# warning-ignore:return_value_discarded
_timer.connect("timeout", self, "_on_timer_timeout")
# warning-ignore:return_value_discarded
config.connect("time_sheet_loaded", self, "populate_entries")
# warning-ignore:return_value_discarded
connect("item_edited", self, "on_Tree_item_edited")
populate_entries()
func on_Tree_item_edited():
var tree_item := get_edited()
var time_entry := tree_item.get_meta(META_KEY) as TimeEntry
if time_entry == null:
return
var edited_start_time_str := tree_item.get_text(COL.TEXT)
var edited_start_time := TimeStamp.new().from_string(edited_start_time_str)
if edited_start_time.year == 1970:
_update_from_time_entry(time_entry, tree_item)
return
var edited_duration_str := tree_item.get_text(COL.TIME)
var edited_duration := TimeEntry.period_to_time(edited_duration_str)
if edited_duration == -1:
_update_from_time_entry(time_entry, tree_item)
return
var edited_end_time_unix := edited_start_time.unix + edited_duration
var edited_end_time := TimeStamp.new().from_unix_time(edited_end_time_unix)
if edited_start_time.equals(time_entry.start_time) \
and edited_end_time.equals(time_entry.end_time):
_update_from_time_entry(time_entry, tree_item)
return
time_entry.start_time = edited_start_time
time_entry.end_time = edited_end_time
config.timesheet.save()
func populate_entries() -> void:
clear()
var tree_items_root := create_item()
var item_entries_tree := config.timesheet.make_items_tree()
_populate_from_entry(tree_items_root, item_entries_tree)
_timer.start()
func _on_timer_timeout() -> void:
config.timesheet.update()
func _populate_from_entry(tree_item_root: TreeItem, time_entry_item_root: TimeEntryTreeItem):
var children := time_entry_item_root.children
for time_entry_name in children:
var time_entry_item: TimeEntryTreeItem = children[time_entry_name]
var item := find_or_create_item(tree_item_root, time_entry_name)
item.set_metadata(COL.TEXT, time_entry_name)
item.set_text(COL.TIME, time_entry_item.get_period())
# warning-ignore:return_value_discarded
time_entry_item.connect("end_time_updated", self, "_on_time_entry_changed_update_item", [time_entry_item, item])
_populate_from_entry(item, time_entry_item)
var has_at_least_one_running_entry := time_entry_item.find_active_time_entry() != null
var texture := preload("res://assets/stop_small.svg") \
if has_at_least_one_running_entry \
else preload("res://assets/play_small.svg")
item.add_button(COL.TIME, texture)
var entries = time_entry_item_root.time_entries
for entry_item in entries:
var time_entry_item := entry_item as TimeEntryTreeItem
var item := create_item(tree_item_root)
var time_entry := time_entry_item.time_entry
item.set_meta(META_KEY, time_entry)
item.set_metadata(COL.TEXT, time_entry.name)
item.set_editable(COL.TEXT, true)
item.set_editable(COL.TIME, true)
_update_from_time_entry(time_entry, item)
# warning-ignore:return_value_discarded
time_entry_item.connect("end_time_updated", self, "_on_time_entry_changed_update_item", [time_entry_item, item])
func _update_from_time_entry(time_entry: TimeEntry, item: TreeItem) -> void:
item.set_text(COL.TEXT, time_entry.start_time.to_string())
item.set_text(COL.TIME, time_entry.get_period())
if time_entry.is_closed == false:
if item.get_button_count(COL.TIME) < 1:
var texture := preload("res://assets/stop_small.svg")
item.add_button(COL.TIME, texture, 0)
else:
if item.get_button_count(COL.TIME) > 0:
item.erase_button(COL.TIME, 0)
func _on_time_entry_changed_update_item(time_entry_item: TimeEntryTreeItem, item: TreeItem) -> void:
item.set_text(COL.TIME, time_entry_item.get_period())
func _on_button_pressed(item: TreeItem, _column: int, _id: int) -> void:
var task_name: String = item.get_metadata(COL.TEXT)
if task_name == "":
return
config.timesheet.toggle_entry(task_name)
## Unecessary in Godot 4, can bre replaced with get_children()
static func _get_tree_item_children(item: TreeItem):
var children = []
var child = item.get_children()
if child == null:
return children
children.append(child)
child = child.get_next()
while child != null:
children.append(child)
child = child.get_next()
return children
## Finds an item in the tree by text
func find_item(root: TreeItem, item_name: String) -> TreeItem:
for child in _get_tree_item_children(root):
if child.get_text(COL.TEXT) == item_name:
return child
return null
func find_or_create_item(root: TreeItem, item_name: String) -> TreeItem:
var child := find_item(root, item_name)
if child != null:
return child
child = create_item(root)
child.set_text(COL.TEXT, item_name)
return child

View File

@ -1,9 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://ui/tasks_list.gd" type="Script" id=1]
[node name="TasksList" type="Tree"]
anchor_right = 1.0
anchor_bottom = 1.0
columns = 2
script = ExtResource( 1 )

View File

@ -1,74 +0,0 @@
extends VBoxContainer
var config: ConfigManager = preload("res://config_manager.tres")
onready var task_name_line_edit := $"%TaskNameLineEdit" as LineEdit
onready var time_label := $"%TimeLabel" as Label
onready var start_button := $"%StartButton" as Button
onready var timer := $"%Timer" as Timer
onready var audio_stream_player := $"%AudioStreamPlayer" as AudioStreamPlayer
var current_time_entry: TimeEntry
func _ready() -> void:
# warning-ignore:return_value_discarded
timer.connect("timeout", self, "_on_timer_timeout")
start_button.hint_tooltip = tr(Consts.START)
start_button.toggle_mode = true
# warning-ignore:return_value_discarded
start_button.connect("toggled", self, "_on_start_button_toggled")
task_name_line_edit.text = config.current_task_name
# warning-ignore:return_value_discarded
task_name_line_edit.connect("text_changed", self, "_on_task_name_line_edit_text_changed")
# warning-ignore:return_value_discarded
config.connect("time_sheet_loaded", self, "_on_time_sheet_loaded")
update_timer_state()
func _on_timer_timeout() -> void:
config.timesheet.update()
time_label.text = current_time_entry.get_period()
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)
func _on_task_name_line_edit_text_changed(new_text: String) -> void:
config.current_task_name = new_text
update_timer_state()
func _on_time_sheet_loaded():
update_timer_state()
func update_timer_state() -> void:
current_time_entry = config.timesheet.get_active_entry_from_name(config.current_task_name)
if current_time_entry:
set_button_as_started()
else:
set_button_as_stopped()
func set_button_as_stopped() -> void:
start_button.set_pressed_no_signal(false)
start_button.hint_tooltip = tr(Consts.START)
time_label.text = Consts.NO_TIME
start_button.theme_type_variation = Consts.THEME_OVERRIDE_START
timer.stop()
func set_button_as_started() -> void:
start_button.set_pressed_no_signal(true)
start_button.hint_tooltip = tr(Consts.STOP)
start_button.theme_type_variation = Consts.THEME_OVERRIDE_STOP
timer.start()

View File

@ -1,51 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://ui/time_counter.gd" type="Script" id=1]
[node name="TimeCounter" type="VBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
margin_right = 360.0
margin_bottom = 45.0
[node name="TaskNameLineEdit" type="LineEdit" parent="HBoxContainer2"]
unique_name_in_owner = true
margin_right = 360.0
margin_bottom = 45.0
size_flags_horizontal = 3
placeholder_text = "Task Name. Use \"/\" to create subtasks"
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_top = 53.0
margin_right = 360.0
margin_bottom = 760.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="TimeLabel" type="Label" parent="HBoxContainer"]
unique_name_in_owner = true
margin_top = 341.0
margin_right = 328.0
margin_bottom = 366.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 = 336.0
margin_right = 360.0
margin_bottom = 707.0
theme_type_variation = "play_button"
[node name="Timer" type="Timer" parent="."]
unique_name_in_owner = true
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true