Skip to content

Commit 49b9d96

Browse files
committed
On the "Years" module, on the main class and sub-class "Verify_Current_Year", I added the creation of files that I had to create manually before.
These were the files that I added: Yearly statistics This Year I (Personal version) FutureMe
1 parent a104c1d commit 49b9d96

File tree

5 files changed

+170
-63
lines changed

5 files changed

+170
-63
lines changed

Module files/Food_Time/Times.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"Will be hungry": 3
1111
},
1212
"Ate": {
13-
"Object": "2025-01-04 02:17:59-03:00",
13+
"Object": "2025-01-04 19:18:31-03:00",
1414
"Time": 0,
15-
"Time text": "02:17",
15+
"Time text": "19:18",
1616
"Unit": {
1717
"en": "hours",
1818
"pt": "horas"
@@ -23,9 +23,9 @@
2323
}
2424
},
2525
"Can drink water": {
26-
"Object": "2025-01-04 02:57:59-03:00",
26+
"Object": "2025-01-04 19:58:31-03:00",
2727
"Time": 40,
28-
"Time text": "02:57",
28+
"Time text": "19:58",
2929
"Unit": {
3030
"en": "minutes",
3131
"pt": "minutos"
@@ -36,9 +36,9 @@
3636
}
3737
},
3838
"Will be hungry": {
39-
"Object": "2025-01-04 05:17:59-03:00",
39+
"Object": "2025-01-04 22:18:31-03:00",
4040
"Time": 3,
41-
"Time text": "05:17",
41+
"Time text": "22:18",
4242
"Unit": {
4343
"en": "hours",
4444
"pt": "horas"

Module files/Utility/Language/Texts.json

+8
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@
623623
"pt": "Este Ano Eu (post)",
624624
"en": "This Year I (post)"
625625
},
626+
"this_year_i_personal_version": {
627+
"pt": "Este Ano Eu (Versão pessoal)",
628+
"en": "This Year I (Personal version)"
629+
},
626630
"welcome, title()": {
627631
"en": "Welcome",
628632
"pt": "Bem-vindo"
@@ -2165,6 +2169,10 @@
21652169
"en": "My sister",
21662170
"pt": "Minha irmã"
21672171
},
2172+
"yearly_statistics": {
2173+
"en": "Yearly statistics",
2174+
"pt": "Estatísticas anuais"
2175+
},
21682176
"updated_statistic": {
21692177
"en": "Updated statistic",
21702178
"pt": "Estatística atualizada"

Modules/Diary_Slim/Write_On_Diary_Slim/__init__.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -581,19 +581,31 @@ def Manage_Statistic(self):
581581
# Define the statistic key
582582
statistic_key = data_key
583583

584+
# If the "Statistic key" key is inside the text dictionary
585+
if "Statistic key" in self.dictionary["Text"]:
586+
# Define the local statistic key as it
587+
statistic_key = self.dictionary["Text"]["Statistic key"]
588+
584589
# Define the "Statistics" dictionary inside the Diary Slim text dictionary
585590
self.dictionary["Text"]["Statistics"] = {
586591
"Number": 0,
587592
"Dictionary": {
588593
statistic["Key"]: {
589594
"Text": text,
590-
"Old number": current_year_statistics[statistic_key],
591-
"Number": current_year_statistics[statistic_key]
595+
"Old number": "",
596+
"Number": ""
592597
}
593598
},
594599
"Changed statistic": False
595600
}
596601

602+
# Get the current number
603+
current_number = current_year_statistics[statistic_key]
604+
605+
# Define the old and current number
606+
self.dictionary["Text"]["Statistics"]["Dictionary"][statistic["Key"]]["Old number"] = current_number
607+
self.dictionary["Text"]["Statistics"]["Dictionary"][statistic["Key"]]["Number"] = current_number
608+
597609
# Define the number to add as one
598610
number = 1
599611

Modules/Years/Verify_Current_Year/__init__.py

+47-10
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ def __init__(self):
1111
def Verify_Current_Year(self):
1212
from copy import deepcopy
1313

14+
# Show a five dash space separator
1415
print()
15-
print("-----")
16+
print(self.separators["5"])
1617
print()
1718

1819
# Define the "Files" dictionary
@@ -25,10 +26,22 @@ def Verify_Current_Year(self):
2526
"Text key": "edited_in",
2627
self.user_language: self.years["Current year"]["Folders"]["Text"]["root"] + self.Language.language_texts["edited_in"] + ".txt"
2728
},
29+
"Yearly statistics": {
30+
"Text key": "yearly_statistics",
31+
"Template": {}
32+
},
2833
"This Year I (post)": {
2934
"Text key": "this_year_i_post",
3035
"Template": {}
3136
},
37+
"This Year I (Personal version)": {
38+
"Text key": "this_year_i_personal_version",
39+
"Template": {}
40+
},
41+
"FutureMe": {
42+
"Text": "FutureMe",
43+
"Template": {}
44+
},
3245
"Christmas": {
3346
"Text key": "texts, title()",
3447
self.user_language: self.years["Current year"]["Folders"]["Text"]["Christmas"]["Merry Christmas"]["root"] + self.Language.language_texts["texts, title()"] + ".txt",
@@ -45,13 +58,24 @@ def Verify_Current_Year(self):
4558
}
4659
}
4760

48-
# Define the language "This Year I (post)" file
61+
# Define some language files related to the "This Year I" text
4962
for language in self.languages["small"]:
63+
# Define a shortcut for the folders dictionary
64+
folders = self.years["Current year"]["Folders"][language]
65+
5066
# Define the "This Year I (post)" file
51-
self.files["This Year I (post)"][language] = self.years["Current year"]["Folders"][language][self.Language.texts["this_year_i_post"]["en"]]
67+
self.files["This Year I (post)"][language] = folders[self.Language.texts["this_year_i_post"]["en"]]
5268

5369
# Define the template file
54-
self.files["This Year I (post)"]["Template"][language] = self.years["Texts"]["Folders"][language][self.Language.texts["this_year_i_post"]["en"]]
70+
self.files["This Year I (post)"]["Template"][language] = folders[self.Language.texts["this_year_i_post"]["en"]]
71+
72+
# Define the "This Year I (Personal version)" file
73+
self.files["This Year I (Personal version)"][language] = folders[self.Language.texts["this_year_i_post"]["en"]]
74+
75+
# If the "FutureMe" key is inside the folders dictionary
76+
if "FutureMe" in folders:
77+
# Define the "FutureMe" file
78+
self.files["FutureMe"][language] = folders["FutureMe"]
5579

5680
# If the current year did not existed in the years folder
5781
# Creates the folders and files of the current year folder
@@ -233,10 +257,16 @@ def Verify_Current_Year(self):
233257

234258
# Iterate through the files in the "Files" dictionary
235259
for key, files in self.files.items():
236-
# Define the small languages list
260+
# Define the list of small languages
237261
languages = self.languages["small"]
238262

239-
if key != "This Year I (post)":
263+
# If the key is not inside the defined list
264+
# Or is inside the second list
265+
if (
266+
key not in ["This Year I (post)"] or
267+
key in ["Yearly statistics", "FutureMe"]
268+
):
269+
# Define the list of small languages as just the user language
240270
languages = [
241271
self.user_language
242272
]
@@ -246,11 +276,18 @@ def Verify_Current_Year(self):
246276
# Get the file in the current language
247277
file = files[language]
248278

249-
# Define the text key
250-
text_key = files["Text key"]
279+
# If the "Text key" key is inside the files dictionary
280+
if "Text key" in files:
281+
# Define the text key
282+
text_key = files["Text key"]
283+
284+
# Define the language text
285+
language_text = self.Language.texts[text_key][language]
251286

252-
# Define the language text
253-
language_text = self.Language.texts[text_key][language]
287+
# If the "Text" key is inside the files dictionary
288+
if "Text" in files:
289+
# Define the language text
290+
language_text = files["Text"]
254291

255292
# Read the file and get its lines of text
256293
lines = self.File.Contents(file)["lines"]

0 commit comments

Comments
 (0)