Skip to content

Commit df91334

Browse files
committed
In the "Social_Networks" module, on the "Add_Social_Network" sub-class, I made the following changes.
In the "Select_Information_Items" method, I added the possibility of adding custom information items to the social network. I also greatly improved the display and request for custom or not-custom information items, explaining better to the user how they can write them. I created a root dictionary, with the social network and information items dictionaries. I also created the states dictionary of the sub-class. The "Write_To_Files" method now writes to the setting and image folders files.
1 parent 0de559c commit df91334

File tree

26 files changed

+482
-171
lines changed

26 files changed

+482
-171
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": "2024-08-21 10:04:35-03:00",
13+
"Object": "2024-08-23 16:17:57-03:00",
1414
"Time": 0,
15-
"Time text": "10:04",
15+
"Time text": "16:17",
1616
"Unit": {
1717
"en": "hours",
1818
"pt": "horas"
@@ -23,9 +23,9 @@
2323
}
2424
},
2525
"Can drink water": {
26-
"Object": "2024-08-21 10:44:35-03:00",
26+
"Object": "2024-08-23 16:57:57-03:00",
2727
"Time": 40,
28-
"Time text": "10:44",
28+
"Time text": "16:57",
2929
"Unit": {
3030
"en": "minutes",
3131
"pt": "minutos"
@@ -36,9 +36,9 @@
3636
}
3737
},
3838
"Will be hungry": {
39-
"Object": "2024-08-21 13:04:35-03:00",
39+
"Object": "2024-08-23 19:17:57-03:00",
4040
"Time": 3,
41-
"Time text": "13:04",
41+
"Time text": "19:17",
4242
"Unit": {
4343
"en": "hours",
4444
"pt": "horas"

Module files/Social_Networks/Texts.json

+19-7
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,18 @@
8686
"pt": "O item de informação tem itens adicionais",
8787
"en": "Does the information item has additional items"
8888
},
89-
"does_the_social_network_has_custom_additional_items": {
90-
"pt": "A rede social tem itens adicionais personalizados",
91-
"en": "Does the social network has custom additional items"
92-
},
9389
"like_custom_profile_or_message_links": {
9490
"pt": "Como links de perfil ou mensagem personalizados",
9591
"en": "Like custom profile or message links"
9692
},
93+
"type_the_additional_item": {
94+
"pt": "Digite o item adicional",
95+
"en": "Type the additional item"
96+
},
97+
"additional_item_for_{}": {
98+
"pt": "Item adicional para {}",
99+
"en": "Additional item for {}"
100+
},
97101
"type_the_regex_format": {
98102
"pt": "Digite o formato do Regex",
99103
"en": "Type the Regex format"
@@ -102,9 +106,17 @@
102106
"pt": "Digite um exemplo do formato",
103107
"en": "Type an example of the format"
104108
},
105-
"type_the_additional_item": {
106-
"pt": "Digite o item adicional",
107-
"en": "Type the additional item"
109+
"does_the_social_network_has_custom_additional_items": {
110+
"pt": "A rede social tem itens adicionais personalizados",
111+
"en": "Does the social network has custom additional items"
112+
},
113+
"type_the_name_of_the_custom_additional_item": {
114+
"pt": "Digite o nome do item adicional personalizado (em Inglês)",
115+
"en": "Type the custom additional item"
116+
},
117+
"now_type_the_custom_additional_item": {
118+
"pt": "Agora digite o item adicional personalizado",
119+
"en": "Now type the custom additional item"
108120
},
109121
"you_can_use_the_{}_format_string_to_place_the_social_network_link, type: explanation": {
110122
"pt": "Você pode usar a string de formato {} para colocar o link da rede social.\nE a string de formato {} para colocar o item, trocando o [Item] por qualquer item que você selecionou (em Inglês).",

Module files/Utility/Language/Texts.json

+8
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
"en": "settings",
8989
"pt": "configurações"
9090
},
91+
"type_{}": {
92+
"en": "Type {}",
93+
"pt": "Digite {}"
94+
},
9195
"type_or_paste_the_text": {
9296
"en": "Type or paste the text",
9397
"pt": "Digite ou cole o texto"
@@ -207,6 +211,10 @@
207211
"en": "Original list",
208212
"pt": "Lista original"
209213
},
214+
"list_of_items": {
215+
"en": "List of items",
216+
"pt": "Lista de itens"
217+
},
210218
"current, title()": {
211219
"en": "Current",
212220
"pt": "Atual"

Modules/Database/Register/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def Define_File_Text(self, language_parameter = None):
250250

251251
i += 1
252252

253-
items.append(self.Text.From_List(titles, break_line = True) + "\n")
253+
items.append(self.Text.From_List(titles, next_line = True) + "\n")
254254

255255
# Add times to items list
256256
times = ""
@@ -263,7 +263,7 @@ def Define_File_Text(self, language_parameter = None):
263263
items.append(times)
264264

265265
# Define language entry text
266-
file_text = self.Text.From_List(lines, break_line = True)
266+
file_text = self.Text.From_List(lines, next_line = True)
267267

268268
return file_text.format(*items)
269269

Modules/Friends/Add_A_New_Friend/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def Write_To_Files(self):
533533
social_networks_list.remove(item)
534534

535535
# Update the "Social Networks.txt" file with the list above
536-
text_to_write = self.Text.From_List(social_networks_list, break_line = True)
536+
text_to_write = self.Text.From_List(social_networks_list, next_line = True)
537537

538538
self.File.Edit(self.friend["Files"]["Social Networks"]["List"], text_to_write, "w")
539539

Modules/Friends/Friends/__init__.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def Define_Information_Items(self):
379379
# Iterate through the information items list
380380
for key, dict_ in dictionary["Dictionary"].items():
381381
# Define the local gender "Words" dictionary
382-
dict_ = {}
382+
words = {}
383383

384384
# Define the gender words of the information item
385385
for item in dictionary["Gender"]["Items"]:
@@ -392,8 +392,17 @@ def Define_Information_Items(self):
392392
if key in dictionary["Gender"]["Feminine"]:
393393
gender = "feminine"
394394

395-
# Get the gender words dictionary
396-
dict_[item] = self.Language.texts["genders, type: dict"][self.user_language][gender][text_key]
395+
# Define the empty item dictionary
396+
words[item] = {}
397+
398+
# Iterate through the list of small languages
399+
for language in self.languages["small"]:
400+
# If the language dictionary does not exist, add it
401+
if language not in words[item]:
402+
words[item][language] = {}
403+
404+
# Define the gender text of the item in the current language
405+
words[item][language] = self.Language.texts["genders, type: dict"][language][gender][text_key]
397406

398407
# Define the gender inside the "Gender" dictionary
399408
dictionary["Dictionary"][key]["Gender"]["Text"] = gender
@@ -484,7 +493,7 @@ def Define_Friends_Dictionary(self):
484493
self.friends["List"] = self.JSON.To_Python(self.folders["Friends"]["Text"]["Friends"])["List"]
485494

486495
# Write the friends list to the "Friends list.txt" file
487-
text_to_write = self.Text.From_List(self.friends["List"], break_line = True)
496+
text_to_write = self.Text.From_List(self.friends["List"], next_line = True)
488497

489498
self.File.Edit(self.folders["Friends"]["Text"]["Friends list"], text_to_write, "w")
490499

@@ -669,7 +678,7 @@ def Define_Friends_Dictionary(self):
669678
social_networks_list.remove(item)
670679

671680
# Update the "Social Networks.txt" file with the list above
672-
text_to_write = self.Text.From_List(social_networks_list, break_line = True)
681+
text_to_write = self.Text.From_List(social_networks_list, next_line = True)
673682

674683
self.File.Edit(dictionary["Files"]["Social Networks"]["List"], text_to_write, "w")
675684

@@ -1046,7 +1055,7 @@ def Select_Information_Item(self, information_items = None, information_item = N
10461055
if information_item["Name"] not in information_items["Lists"]["Select"]:
10471056
if type_text == None:
10481057
# Define the type text
1049-
type_text = self.language_texts["type_{}"].format(information_item["Gender"]["Words"]["The"] + " " + information_item[self.user_language].lower())
1058+
type_text = self.language_texts["type_{}"].format(information_item["Gender"]["Words"]["The"][self.user_language] + " " + information_item[self.user_language].lower())
10501059

10511060
# Define the "accept_enter" variable
10521061
accept_enter = False
@@ -1146,7 +1155,7 @@ def Select_Information_Item(self, information_items = None, information_item = N
11461155
# If the selected option is "Custom Social Network"
11471156
if information["option"] == "Custom Social Network":
11481157
# Define the type text for the information item
1149-
type_text = self.language_texts["type_{}"].format(information_item["Gender"]["Words"]["The"] + " " + self.language_texts["custom_origin_social_network"])
1158+
type_text = self.language_texts["type_{}"].format(information_item["Gender"]["Words"]["The"][self.user_language] + " " + self.language_texts["custom_origin_social_network"])
11501159

11511160
# If the "testing" switch is False
11521161
# Or it is True and the "Custom Social Network" key is not inside the "Test information" dictionary

Modules/Friends/Open_Friend_File/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ def Show_Information(self):
347347
if self.dictionary["States"]["Exact match"] == True:
348348
item = self.information_item["Gender"]["Words"]["This"]
349349

350+
# Define the user language version of the item
351+
item = item[self.user_language]
352+
350353
# Add it
351354
items.append(item)
352355

@@ -369,7 +372,7 @@ def Show_Information(self):
369372

370373
# Define the list of items to be used to format the text template
371374
items = [
372-
self.information_item["Gender"]["Words"]["This"] + " " + information_item,
375+
self.information_item["Gender"]["Words"]["This"][self.user_language] + " " + information_item,
373376
file_name,
374377
self.dictionary["Search"]["Query"],
375378
file_name

Modules/GamePlayer/GamePlayer/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ def Define_Sub_Games(self, dictionary, play = False, sub_game_title = None):
12651265
game["Sub-game type"]["Items"]["List"] = self.Folder.Contents(game["Sub-game type"]["Folders"]["root"])["folder"]["names"]
12661266

12671267
# Update the "List.txt" file
1268-
self.File.Edit(game["Sub-game type"]["Folders"]["List"], self.Text.From_List(game["Sub-game type"]["Items"]["List"], break_line = True), "w")
1268+
self.File.Edit(game["Sub-game type"]["Folders"]["List"], self.Text.From_List(game["Sub-game type"]["Items"]["List"], next_line = True), "w")
12691269

12701270
# Update the number of sub-games
12711271
game["Sub-game type"]["Items"]["Number"] = len(game["Sub-game type"]["Items"]["List"])

Modules/GamePlayer/Register/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def Define_File_Text(self, language_parameter = None):
459459

460460
i += 1
461461

462-
items.append(self.Text.From_List(titles, break_line = True) + "\n")
462+
items.append(self.Text.From_List(titles, next_line = True) + "\n")
463463

464464
# ---------- #
465465

@@ -524,7 +524,7 @@ def Define_File_Text(self, language_parameter = None):
524524
# ---------- #
525525

526526
# Define the language entry text
527-
file_text = self.Text.From_List(lines, break_line = True)
527+
file_text = self.Text.From_List(lines, next_line = True)
528528

529529
return file_text.format(*items)
530530

0 commit comments

Comments
 (0)