Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nath54 committed Oct 30, 2022
1 parent c2d24c8 commit 543e460
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 15 deletions.
25 changes: 25 additions & 0 deletions global/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,35 @@ func load_data() -> void:
for e in asup:
c.elements.erase(e);
#
parcour_aux_sheets_with_func(self.data.directories, funcref(self, "diminush_time"));
#
Global.save_data();
else:
data = init_data();

func parcour_aux_sheets_with_func(d: Dictionary, fun: FuncRef):
for de in d.keys():
if typeof(d[de]) == TYPE_DICTIONARY:
if d[de]["@type"] == "dir":
parcour_aux_sheets_with_func(d[de], fun);
elif d[de]["@type"] == "sheet":
d[de] = fun.call_func(d[de]);

func diminush_time(sd: Dictionary) -> Dictionary:
var today: Dictionary = OS.get_datetime();
var tdarr: Array = [today["year"], today["month"], today["day"]];
if "dim_active" in sd.keys() and sd["dim_active"] == true:
if not "dim_last" in sd.keys():
sd["dim_last"] = tdarr;
if not "dim_vit" in sd.keys():
sd["dim_vit"] = 0.25;
var time_since: int = cal.distance_days(tdarr, sd["dim_last"]);
var qt: float = sd["dim_vit"] * time_since;
for i in range(len(sd["data"])):
sd["data"][i][2] = clamp(sd["data"][i][2]-qt, 0, 10);
return sd;


func percent_of_subtask(st: Array) -> float:
var nb_finis: float = 0;
var total: float = 0
Expand Down
8 changes: 4 additions & 4 deletions pages/events/Create_Event.tscn

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions pages/sheets/create_sheet.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
extends Control

var today: Dictionary = OS.get_datetime();
var tdarr: Array = [today["year"], today["month"], today["day"]];


# Called when the node enters the scene tree for the first time.
func _ready():
if Global.active_object == null:
Global.go_to_page("res://pages/sheets/page_dossiers_sheets.tscn", false);
Global.active_object["mode_aff"] = 1;
if not "dim_active" in Global.active_object.keys():
Global.active_object["dim_active"] = false;
Global.active_object["dim_last"] = tdarr;
Global.active_object["dim_vit"] = 0.25;
save_dt();
#
$VBoxContainer/Cb_diminution/Cb_diminution.pressed = Global.active_object["dim_active"];
$VBoxContainer/DIMINUTION.visible = Global.active_object["dim_active"];
$VBoxContainer/DIMINUTION/LineEdit.text = String(Global.active_object["dim_vit"]);
#
$VBoxContainer/Titre/Title.text = Global.active_object["titre"];
$VBoxContainer/SepChar/SepChars.text = Global.active_object["sep_chars"];
$VBoxContainer/Cols/Col1/col1.text = Global.active_object["col1"];
Expand Down Expand Up @@ -43,6 +54,14 @@ func delete_row_elt(elt, roelt):
save_dt();

func _on_Bt_back_pressed():
if $VBoxContainer/Cb_diminution/Cb_diminution.pressed:
var today: Dictionary = OS.get_time();
var tdarr: Array = [today["year"], today["month"], today["day"]];
Global.active_object["dim_active"] = true;
Global.active_object["dim_last"] = tdarr;
Global.active_object["dim_vit"] = 0.25;
if Global.is_str_float($VBoxContainer/DIMINUTION/LineEdit.text):
Global.active_object["dim_vit"] = float($VBoxContainer/DIMINUTION/LineEdit.text);
save_dt();
Global.go_to_page("res://pages/sheets/page_dossiers_sheets.tscn", false);

Expand Down
2 changes: 1 addition & 1 deletion pages/sheets/create_sheet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ autowrap = true
margin_left = 426.0
margin_right = 520.0
margin_bottom = 39.0
text = "0"
text = "0.25"

[node name="HSeparator4" type="HSeparator" parent="VBoxContainer"]
margin_top = 146.0
Expand Down
22 changes: 22 additions & 0 deletions pages/sheets/sheet_elt_list_mode2.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@ const col0: Color = Color(1, 0, 0);
const col1: Color = Color(0, 1, 0);
const colm1: Color = Color(0.5, 0.5, 0.5);

var today: Dictionary = OS.get_datetime();
var tdarr: Array = [today["year"], today["month"], today["day"]];

# Called when the node enters the scene tree for the first time.
func _ready():
if Global.active_object == null:
Global.go_to_page("res://pages/sheets/page_dossiers_sheets.tscn", false);
Global.active_object["mode_aff"] = 2;
if not "dim_active" in Global.active_object.keys():
Global.active_object["dim_active"] = false;
Global.active_object["dim_last"] = tdarr;
Global.active_object["dim_vit"] = 0.25;

save_dt();
#
$VBoxContainer/Cb_diminution/Cb_diminution.pressed = Global.active_object["dim_active"];
$VBoxContainer/DIMINUTION.visible = Global.active_object["dim_active"];
$VBoxContainer/DIMINUTION/LineEdit.text = String(Global.active_object["dim_vit"]);
#
$VBoxContainer/Titre/Title.text = Global.active_object["titre"];
$VBoxContainer/Cols/Col1/col1.text = Global.active_object["col1"];
$VBoxContainer/Cols/Col2/col2.text = Global.active_object["col2"];
Expand Down Expand Up @@ -58,6 +70,12 @@ func delete_row_elt(elt, roelt):
save_dt();

func _on_Bt_back_pressed():
if $VBoxContainer/Cb_diminution/Cb_diminution.pressed:
Global.active_object["dim_active"] = true;
Global.active_object["dim_last"] = tdarr;
Global.active_object["dim_vit"] = 0.25;
if Global.is_str_float($VBoxContainer/DIMINUTION/LineEdit.text):
Global.active_object["dim_vit"] = float($VBoxContainer/DIMINUTION/LineEdit.text);
save_dt();
Global.go_to_page("res://pages/sheets/page_dossiers_sheets.tscn", false);

Expand Down Expand Up @@ -135,3 +153,7 @@ func _on_Bt_toggle_mode_to_mode1_pressed():

func _on_Bt_Export_pressed():
Global.go_to_page("res://pages/sheets/Export_Sheet.tscn");


func _on_Cb_diminution_toggled(button_pressed):
$VBoxContainer/DIMINUTION.visible = button_pressed;
1 change: 1 addition & 0 deletions pages/sheets/sheet_elt_list_mode2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ size_flags_vertical = 3
[connection signal="pressed" from="VBoxContainer/Titre/Bt_validate_titre" to="." method="_on_Bt_validate_titre_pressed"]
[connection signal="pressed" from="VBoxContainer/Titre/Bt_edit_titre" to="." method="_on_Bt_edit_titre_pressed"]
[connection signal="pressed" from="VBoxContainer/Titre/Bt_delete_sheet" to="." method="_on_Bt_delete_sheet_pressed"]
[connection signal="toggled" from="VBoxContainer/Cb_diminution/Cb_diminution" to="." method="_on_Cb_diminution_toggled"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Bt_Export" to="." method="_on_Bt_Export_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Bt_toggle_mode_to_mode1" to="." method="_on_Bt_toggle_mode_to_mode1_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Bt_add_element" to="." method="_on_Bt_add_element_pressed"]
Expand Down
2 changes: 1 addition & 1 deletion pages/timetable/page_timetable.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends Control

const jours: Array = ["KEY_LUN", "KEY_MAR", "KEY_MER", "KEY_JEU", "KEY_VEN", "KEY_SAM", "KEY_DIM"];
const periods: Array = ["KEY_1DAY", "KEY_1DAY", "KEY_1DAY", "KEY_DAY"];
const periods: Array = ["KEY_1DAY", "KEY_3DAY", "KEY_5DAY", "KEY_7DAY"];
const iperiods: Array = [0, 2, 4, 6];
# Global.tt_crt_period
var cal: Calendar = Calendar.new();
Expand Down
24 changes: 24 additions & 0 deletions pages/todos/Bt_del.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://res/ui/icons_alpha/trash_icon.png" type="Texture" id=1]
[ext_resource path="res://res/ui/bts2/pressed.tres" type="StyleBox" id=2]
[ext_resource path="res://res/ui/bts2/hover.tres" type="StyleBox" id=3]
[ext_resource path="res://res/ui/bts2/normal.tres" type="StyleBox" id=4]

[node name="Bt_del" type="Button"]
modulate = Color( 1, 0, 0, 1 )
margin_right = 12.0
margin_bottom = 35.0
rect_min_size = Vector2( 40, 40 )
size_flags_horizontal = 4
size_flags_vertical = 6
custom_styles/hover = ExtResource( 3 )
custom_styles/pressed = ExtResource( 2 )
custom_styles/normal = ExtResource( 4 )

[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
expand = true
stretch_mode = 6
3 changes: 1 addition & 2 deletions pages/todos/Create_Todo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ func add_subtask_ui(t, done, idx):
var hb = HBoxContainer.new();
var cb = CheckBox.new();
var lb = Label.new();
var bt = Button.new();
var bt = preload("res://pages/todos/Bt_del.tscn").instance();
cb.add_icon_override("checked", preload("res://res/ui/checkbox/checked2.png"));
cb.add_icon_override("unchecked", preload("res://res/ui/checkbox/unchecked2.png"));
#
cb.pressed = done;
lb.text = t;
bt.text = "X";
hb.add_child(cb);
hb.add_child(lb);
hb.add_child(bt);
Expand Down
10 changes: 5 additions & 5 deletions pages/todos/Create_Todo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ margin_bottom = 185.0

[node name="Label" type="Label" parent="VBoxContainer/Calendrier"]
margin_top = 3.0
margin_right = 212.0
margin_right = 184.0
margin_bottom = 32.0
text = "KEY_CALELENDAR"
text = "KEY_CALENDAR"

[node name="OptionButton" type="OptionButton" parent="VBoxContainer/Calendrier"]
margin_left = 216.0
margin_right = 245.0
margin_left = 188.0
margin_right = 217.0
margin_bottom = 35.0

[node name="Date" type="HBoxContainer" parent="VBoxContainer"]
Expand Down Expand Up @@ -267,7 +267,7 @@ custom_colors/font_color_pressed = Color( 0, 0, 0, 1 )
custom_styles/hover = ExtResource( 3 )
custom_styles/pressed = ExtResource( 5 )
custom_styles/normal = ExtResource( 4 )
text = "KEY_DELETE"
text = "KEY_SUPPRIMER"

[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Bt_suppr"]
modulate = Color( 1, 1, 1, 0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ KEY_DONE,% Fait,Done,Hecho
KEY_CRT_EDIT_TODO,Créer/Modif Todo :,Create/Edit Todo :,Crear/Editar Todo :
KEY_TACHETODO,Tâche à faire,Todo task ,Tarea completa
KEY_DEADLINE,Deadline :,Deadline :,Fecha límite :
KEY_ADD_ELT,Ajouter,Add,Añadir
KEY_ADD,Ajouter,Add,Añadir
KEY_NEW_SUBTASK,nouvelle sous-tâche,New subtask,Nueva subtarea
KEY_TODOLIST,Liste des tâches à faire :,Todo list :,Lista de tareas :
KEY_DISPLAYALL,Tout afficher,Display all,Mostrar todo
KEY_DISPLAYALL,Tout afficher,Display all,Mostrar todo
KEY_DELETE,Supprimer,Delete,Borrar

0 comments on commit 543e460

Please sign in to comment.