diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index ca37839..da986e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.idea/* -.virt_env/* +# Godot 4+ specific ignores +.godot/ todo.db commands.sql diff --git a/README.md b/README.md index a333c9d..4522cae 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # Ion-Todo-Planner ## Updates will break backwards compatibility for now! ## To get started you should first run fresh_db.sh + + Ion-Todo-Planner + Copyright (C) 2024 Ione 15 + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . diff --git a/addons/godot-sqlite/LICENSE.md b/addons/godot-sqlite/LICENSE.md new file mode 100644 index 0000000..68d6eb5 --- /dev/null +++ b/addons/godot-sqlite/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2024 Piet Bronders & Jeroen De Geeter + +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. diff --git a/addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so b/addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so new file mode 100644 index 0000000..48e88fc Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so b/addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so new file mode 100644 index 0000000..a59a3ae Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so b/addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so new file mode 100644 index 0000000..86252ff Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so b/addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so new file mode 100644 index 0000000..5b73614 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.dylib b/addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.dylib new file mode 100644 index 0000000..2110e9e Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.dylib differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.ios.template_release.arm64.dylib b/addons/godot-sqlite/bin/libgdsqlite.ios.template_release.arm64.dylib new file mode 100644 index 0000000..07641a6 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.ios.template_release.arm64.dylib differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so b/addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so new file mode 100644 index 0000000..6138985 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so b/addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so new file mode 100644 index 0000000..1f73deb Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework/libgdsqlite.macos.template_debug b/addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework/libgdsqlite.macos.template_debug new file mode 100644 index 0000000..e17c525 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework/libgdsqlite.macos.template_debug differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework/libgdsqlite.macos.template_release b/addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework/libgdsqlite.macos.template_release new file mode 100644 index 0000000..b977296 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework/libgdsqlite.macos.template_release differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm b/addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm new file mode 100644 index 0000000..d609539 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm b/addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm new file mode 100644 index 0000000..e17d8b0 Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll b/addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll new file mode 100644 index 0000000..b353f2f Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll differ diff --git a/addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll b/addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll new file mode 100644 index 0000000..3fb598e Binary files /dev/null and b/addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll differ diff --git a/addons/godot-sqlite/gdsqlite.gdextension b/addons/godot-sqlite/gdsqlite.gdextension new file mode 100644 index 0000000..bd87968 --- /dev/null +++ b/addons/godot-sqlite/gdsqlite.gdextension @@ -0,0 +1,38 @@ +[configuration] + +entry_symbol = "sqlite_library_init" +compatibility_minimum = 4.2 + +[libraries] + +macos = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework" +macos.template_release = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework" +windows.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll" +windows.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll" +linux.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so" +linux.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so" +android.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so" +android.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so" +android.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so" +android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so" +ios.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.dylib" +ios.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_release.arm64.dylib" +web.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm" +web.template_release.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm" + +[dependencies] + +macos = {} +macos.template_release = {} +windows.x86_64 = {} +windows.template_release.x86_64 = {} +linux.x86_64 = {} +linux.template_release.x86_64 = {} +android.arm64 = {} +android.template_release.arm64 = {} +android.x86_64 = {} +android.template_release.x86_64 = {} +ios.arm64 = {} +ios.template_release.arm64 = {} +web.wasm32 = {} +web.template_release.wasm32 = {} \ No newline at end of file diff --git a/addons/godot-sqlite/godot-sqlite.gd b/addons/godot-sqlite/godot-sqlite.gd new file mode 100644 index 0000000..f81d95c --- /dev/null +++ b/addons/godot-sqlite/godot-sqlite.gd @@ -0,0 +1,14 @@ +# ############################################################################ # +# Copyright © 2019-2024 Piet Bronders & Jeroen De Geeter +# Licensed under the MIT License. +# See LICENSE in the project root for license information. +# ############################################################################ # + +@tool +extends EditorPlugin + +func _enter_tree(): + pass + +func _exit_tree(): + pass diff --git a/addons/godot-sqlite/plugin.cfg b/addons/godot-sqlite/plugin.cfg new file mode 100644 index 0000000..3d69085 --- /dev/null +++ b/addons/godot-sqlite/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Godot SQLite" +description="GDNative wrapper for SQLite (Godot 4.X+), making it possible to use SQLite databases as data storage in all your future games." +author="Piet Bronders & Jeroen De Geeter" +version="4.3" +script="godot-sqlite.gd" diff --git a/control.tscn b/control.tscn new file mode 100644 index 0000000..fb20ec2 --- /dev/null +++ b/control.tscn @@ -0,0 +1,9 @@ +[gd_scene format=3 uid="uid://cqx66v4ij3ru5"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..9d65d92 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b2k64m1npsosh" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 diff --git a/main.py b/main.py deleted file mode 100644 index 33188b0..0000000 --- a/main.py +++ /dev/null @@ -1,147 +0,0 @@ -import sqlite3 -from datetime import datetime -import time -import tkinter as tk -from collections import OrderedDict - -con = sqlite3.connect("todo.db") -cur = con.cursor() -tasklist = OrderedDict() - - -def get_time(): - return (datetime.now() - datetime(1970, 1, 1)).total_seconds() + time.timezone # timezone so we get utc time! - - -def add_item_dialog(): - input_field = tk.Tk() - input_field.title("Add Item") - - input_window_width = 640 - input_window_height = 320 - - # find the center point - input_center_x = int(screen_width / 2 - input_window_width / 2) - input_center_y = int(screen_height / 2 - input_window_height / 2) - - input_field.geometry(f'{input_window_width}x{input_window_height}+{input_center_x}+{input_center_y}') - - # Create an entry for adding items - entry = tk.Entry(input_field, width=50) - entry.pack(padx=10, pady=5) - entry.focus() - - priority_selection_frame = tk.Frame(input_field) # container for prio and scale - priority_selection_frame.pack() - priority_label = tk.Label(priority_selection_frame, text="Priority:") - priority_label.pack(side=tk.LEFT, padx=25, pady=25) - priority_selection = tk.Scale(priority_selection_frame, from_=1, to=3, orient=tk.HORIZONTAL, width=20) - priority_selection.pack() - - input_confirm = tk.Button(input_field, text="Confirm", - command=lambda: add_item(entry, priority_selection, input_field)) - input_confirm.pack(side=tk.BOTTOM, padx=5, pady=5) - input_field.mainloop() - - -def add_item(entry, priority_selection, input_field): - item = entry.get() - priority = priority_selection.get() - if item: - listbox.insert(tk.END, item) - cur.execute("INSERT INTO todo(\"ID\",\"TODO\",\"CREATION_DATE\",\"DUE_DATE\",\"PRIO\",\"IMP\") VALUES (NULL, " - "'%s', '%s','%s', '%s', '%s' )" % (item, get_time(), get_time() + 60, priority, 0)) - con.commit() - update_list() - input_field.destroy() - - -def remove_item(): - if listbox.curselection(): - selected_index = listbox.curselection()[0] # selection returns tupel - selected_task_id = list(tasklist.keys())[selected_index] - listbox.delete(selected_index) - cur.execute("DELETE FROM todo WHERE ID = %s" % selected_task_id) - print("DELETE FROM todo WHERE ID = %s" % selected_task_id) - con.commit() - update_list() - - -def update_list(): - selected_task = listbox.curselection() # remember selection before rebuilding - listbox.delete(0, listbox.size()) # clear listbox - cur_time = get_time() - - total_time = [] # cleanup and init - remaining_time = [] - importance = [] - tasklist.clear() - - res = cur.execute("SELECT * FROM todo").fetchall() - for i, _tmp1 in enumerate(res): - total_time.append(res[i][3] - res[i][2]) - remaining_time.append(res[i][3] - cur_time) - importance.append((total_time[i] - remaining_time[i]) / total_time[i] * res[i][4] * 100) - cur.execute("UPDATE todo SET IMP = %s WHERE ID = %s" % (int(importance[i]), res[i][0])) - con.commit() - res = cur.execute("SELECT * FROM todo ORDER BY IMP DESC").fetchall() - for i, _tmp2 in enumerate(res): - tasklist[res[i][0]] = res[i][1] # create dictionary with id and the task - redraw_list(selected_task) - - -def redraw_list(selected_task): - listbox.delete(0, listbox.size()) # clear listbox - for task in tasklist.items(): - listbox.insert(tk.END, task[1]) # [0] = id - if selected_task: - listbox.selection_set(selected_task) # restore selection before refresh, if existing - - -# Create the main window -root = tk.Tk() -root.title("Ion-Todo-Planner") - -# get the screen dimension -screen_width = root.winfo_screenwidth() -screen_height = root.winfo_screenheight() - -window_width = 1280 -window_height = 720 - -# find the center point -center_x = int(screen_width / 2 - window_width / 2) -center_y = int(screen_height / 2 - window_height / 2) - -# set the position of the window to the center of the screen -root.geometry(f'{window_width}x{window_height}+{center_x}+{center_y}') - -root.minsize(window_width, window_height) # prevent making it smaller than min size - -# Create a listbox to display the items -listbox = tk.Listbox(root, width=100) -listbox.pack(padx=5, pady=5, expand=True, fill=tk.BOTH) - -# Create buttons to add and remove items -add_button = tk.Button(root, text="Add", command=add_item_dialog) -add_button.pack(side=tk.LEFT, padx=5, pady=5) - -update_button = tk.Button(root, text="Reload", command=update_list) -update_button.pack(side=tk.LEFT, padx=5, pady=5) - -remove_button = tk.Button(root, text="Remove", command=remove_item) -remove_button.pack(side=tk.LEFT, padx=5, pady=5) - -update_list() - -# Run the Tkinter event loop -refresh_time = 15 - - -def refresh_ever_x_seconds(): - update_list() - current_time = root.after(1000 * refresh_time, refresh_ever_x_seconds) - - -refresh_ever_x_seconds() -root.mainloop() diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..4f8b79d --- /dev/null +++ b/project.godot @@ -0,0 +1,20 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Ion-Todo-Planner" +config/features=PackedStringArray("4.2", "GL Compatibility") +config/icon="res://icon.svg" + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility"