Adding priority choice #2
26 changed files with 160 additions and 149 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
|||
.idea/*
|
||||
.virt_env/*
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
todo.db
|
||||
commands.sql
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
|
21
addons/godot-sqlite/LICENSE.md
Normal file
21
addons/godot-sqlite/LICENSE.md
Normal file
|
@ -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.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
38
addons/godot-sqlite/gdsqlite.gdextension
Normal file
38
addons/godot-sqlite/gdsqlite.gdextension
Normal file
|
@ -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 = {}
|
14
addons/godot-sqlite/godot-sqlite.gd
Normal file
14
addons/godot-sqlite/godot-sqlite.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
# ############################################################################ #
|
||||
# Copyright © 2019-2024 Piet Bronders & Jeroen De Geeter <piet.bronders@gmail.com>
|
||||
# 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
|
7
addons/godot-sqlite/plugin.cfg
Normal file
7
addons/godot-sqlite/plugin.cfg
Normal file
|
@ -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"
|
9
control.tscn
Normal file
9
control.tscn
Normal file
|
@ -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
|
1
icon.svg
Normal file
1
icon.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
After Width: | Height: | Size: 950 B |
37
icon.svg.import
Normal file
37
icon.svg.import
Normal file
|
@ -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
|
147
main.py
147
main.py
|
@ -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()
|
20
project.godot
Normal file
20
project.godot
Normal file
|
@ -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"
|
Reference in a new issue