Skip to content

Commit 1ddc22d

Browse files
committed
In the "Stories" module, I greatly improved the definition of story chapters.
I created a new dictionary of chapters, to contain the information for each chapter. Each chapter dictionary has its number, titles in supported languages, and dates of writing, revision, and translation. In its "Write" sub-class, I added information explaining the writing steps, to better inform the user. Such as the opening of the chapter files, server, story website, and music player. I moved the server definition and opening methods to the root class of the "PHP" module, to make it easier to use. I added the ability to pause the writing session, subtracting the pause time from the total duration of the session, with the new "Pause_Writing" method. I also added the ability to postpone the writing session. Just registering the writing time, not writing on Diary Slim, and not asking if the user has finished writing the entire chapter. The sub-class now creates or updates the chapter dictionary, also registering its revision or translation date, not just the writing date. It does this using the new "Update_Chapter_Dictionary" method, the method also updates the chapter titles inside its dictionary.
1 parent d94dc20 commit 1ddc22d

File tree

15 files changed

+643
-88
lines changed

15 files changed

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

Module Files/PHP/Texts.json

+8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
"pt": "Você terminou de atualizar estes sites",
5656
"en": "You finished updating these websites"
5757
},
58+
"opening_the_server": {
59+
"pt": "Abrindo o servidor",
60+
"en": "Opening the server"
61+
},
62+
"closing_the_server": {
63+
"pt": "Fechando o servidor",
64+
"en": "Closing the server"
65+
},
5866
"the_file_of_colors_was_not_modified": {
5967
"pt": "O arquivo de cores não foi modificado",
6068
"en": "The file of colors was not modified"

Module Files/Stories/Texts.json

+32
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,38 @@
205205
"pt": "traduzido"
206206
}
207207
},
208+
"opening_the_chapter_file_in": {
209+
"en": "Opening the chapter file in",
210+
"pt": "Abrindo o arquivo do capítulo em"
211+
},
212+
"opening_the_story_website_in": {
213+
"en": "Opening the story website in",
214+
"pt": "Abrindo o site da história em"
215+
},
216+
"opening_{}_for_you_to_listen_to_the_soundtrack_of_the_story": {
217+
"en": "Opening \"{}\" for you to listen to the soundtrack of the story",
218+
"pt": "Abrindo o \"{}\" para você ouvir a trilha sonora da história"
219+
},
208220
"press_enter_to_start_counting_the_time_of": {
209221
"en": "Press Enter to start counting the time of",
210222
"pt": "Pressione Enter para começar a contar o tempo de"
211223
},
224+
"do_you_want_to_pause_the_{}_session": {
225+
"en": "Do you want to pause the {} session",
226+
"pt": "Você quer pausar a sessão de {}"
227+
},
228+
"do_you_want_to_postpone_the_{}_session_to_continue_{}_later": {
229+
"en": "Do you want to postpone the {} session to continue {} later",
230+
"pt": "Você quer adiar a sessão de {} para continuar {} depois"
231+
},
232+
"press_enter_to_unpause_the_{}_session": {
233+
"en": "Press Enter to unpause the {} session",
234+
"pt": "Pressione Enter para despausar a sessão de {}"
235+
},
236+
"the_time_subtracted_from_the_total_{}_time": {
237+
"en": "the time subtracted from the total {} time",
238+
"pt": "o tempo subtraído do tempo total de {}"
239+
},
212240
"press_enter_when_you_stop": {
213241
"en": "Press Enter when you stop",
214242
"pt": "Pressione Enter quando você parar de"
@@ -221,6 +249,10 @@
221249
"en": "this chapter",
222250
"pt": "este capítulo"
223251
},
252+
"do_you_want_to_update_the_chapter_titles": {
253+
"en": "Do you want to update the chapter titles",
254+
"pt": "Você quer atualizar os títulos do capítulo"
255+
},
224256
"type_the_chapter_title_in_{}": {
225257
"en": "Type the chapter title in {}",
226258
"pt": "Digite o título do capítulo em {}"

Module Files/Utility/Language/Texts.json

+12
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,10 @@
563563
"en": "Total duration of",
564564
"pt": "Duração total de"
565565
},
566+
"pause, type: item": {
567+
"en": "Pause",
568+
"pt": "Pausa"
569+
},
566570
"totaling, title()": {
567571
"en": "Totaling",
568572
"pt": "Totalizando"
@@ -1077,6 +1081,10 @@
10771081
"en": "Opening",
10781082
"pt": "Abrindo"
10791083
},
1084+
"opening_the": {
1085+
"en": "Opening",
1086+
"pt": "Abrindo o"
1087+
},
10801088
"opening_this_file": {
10811089
"en": "Opening this file",
10821090
"pt": "Abrindo este arquivo"
@@ -2013,6 +2021,10 @@
20132021
"pt": "Datas",
20142022
"en": "Dates"
20152023
},
2024+
"writing_dates": {
2025+
"pt": "Datas de escrita",
2026+
"en": "Writing dates"
2027+
},
20162028
"operational_system": {
20172029
"en": "Operational System",
20182030
"pt": "Sistema Operacional"

Modules/Christmas/Christmas/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def Define_Lists_And_Dictionaries(self):
178178
"Texts": self.current_year["Folders"]["Christmas"]["Merry Christmas"]["Texts"]
179179
},
180180
"Programs": {
181-
"Foobar2000": self.folders["Program Files (x86)"]["Foobar2000"]["root"] + "foobar2000.exe"
181+
"Foobar2000": self.folders["Program Files (x86)"]["Foobar2000"]["Foobar2000"]
182182
},
183183
"Social Network links": {
184184
"YouTube": "https://www.youtube.com/@Stake2_/",

Modules/PHP/PHP/__init__.py

+64-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def __init__(self):
1414
# Define the dictionaries
1515
self.Define_Dictionaries()
1616

17+
# Define the server
18+
self.Define_Server()
19+
1720
def Define_Basic_Variables(self):
1821
from copy import deepcopy
1922

@@ -109,4 +112,64 @@ def Define_Dictionaries(self):
109112
self.url = self.JSON.To_Python(self.folders["Mega"]["PHP"]["JSON"]["URL"])
110113

111114
# Read the "Colors.json" file to get the "Colors" dictionary
112-
self.colors = self.JSON.To_Python(self.folders["Mega"]["PHP"]["JSON"]["Colors"])
115+
self.colors = self.JSON.To_Python(self.folders["Mega"]["PHP"]["JSON"]["Colors"])
116+
117+
def Define_Server(self):
118+
# Define the "Server" dictionary
119+
self.server = {
120+
"Name": "XAMPP",
121+
"Server": self.folders["XAMPP"]["XAMPP Control"],
122+
"Programs": [
123+
"xampp-control",
124+
"httpd",
125+
"mysql"
126+
]
127+
}
128+
129+
def Manage_Server(self, open = False, close = False, show_text = True):
130+
# Get the class name
131+
class_name = type(self).__name__
132+
133+
# Define the separator as the five dash space separator
134+
separator = self.separators["5"]
135+
136+
# If the class name is not "Update_Websites"
137+
if class_name != "Update_Websites":
138+
# Define the separator as the one dash space separator
139+
separator = self.separators["1"]
140+
141+
# If the "open" parameter is True
142+
if open == True:
143+
# Define the text as "opening"
144+
text = self.language_texts["opening_the_server"]
145+
146+
# If the "close" parameter is True
147+
if close == True:
148+
# Define the text as "closing"
149+
text = self.language_texts["closing_the_server"]
150+
151+
# Add the server name to the text
152+
text += ' "' + self.server["Name"] + '"'
153+
154+
# If the "show text" parameter is True
155+
if show_text == True:
156+
# Show the text
157+
print()
158+
print(separator)
159+
print()
160+
print(text + "...")
161+
162+
# If the "open" parameter is True
163+
if open == True:
164+
# Open the server
165+
self.System.Open(self.server["Server"], verbose = False)
166+
167+
if self.switches["testing"] == False:
168+
# Wait for three seconds
169+
self.Date.Sleep(3)
170+
171+
# If the "close" parameter is True
172+
if close == True:
173+
# Close the programs of the server
174+
for program in self.server["Programs"]:
175+
self.System.Close(program)

Modules/PHP/Update_Websites/__init__.py

-29
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,6 @@ def Define_Languages(self):
137137
# Add the full translated language
138138
self.dictionary["Languages"]["Full translated"][language] = self.languages["full_translated"][language]
139139

140-
def Define_Server(self):
141-
# Define the "Server" dictionary
142-
self.dictionary["Server"] = {
143-
"Name": "XAMPP",
144-
"Server": self.folders["XAMPP"]["XAMPP Control"],
145-
"Programs": [
146-
"xampp-control",
147-
"httpd",
148-
"mysql"
149-
]
150-
}
151-
152140
def Define_Websites(self, dictionary):
153141
# Iterate through the dictionary of websites
154142
for title, website in self.websites["Dictionary"].items():
@@ -406,23 +394,6 @@ def Define_Custom_Options(self, dictionary, parameters):
406394
# Return the dictionary and parameters
407395
return dictionary, parameters
408396

409-
def Manage_Server(self, open = False, close = False):
410-
# If the "testing" switch is False
411-
if self.switches["testing"] == False:
412-
# If the "open" parameter is True
413-
if open == True:
414-
# Open the server
415-
self.System.Open(self.dictionary["Server"]["Server"])
416-
417-
# Wait for 4 miliseconds
418-
self.Date.Sleep(4)
419-
420-
# If the "close" parameter is True
421-
if close == True:
422-
# Close the programs of the server
423-
for program in self.dictionary["Server"]["Programs"]:
424-
self.System.Close(program)
425-
426397
def Update_Websites(self):
427398
# If the "One website" state is False, then there is more than one website to update
428399
if self.states["One website"] == False:

Modules/Stories/Create_New_Story/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,18 @@ def Type_Story_Information(self):
8989
"Last posted chapter": 0
9090
},
9191
"Titles": {},
92-
"Dates": []
92+
"Dates": [],
93+
"Dictionary": {}
9394
}
9495

9596
# ---------- #
9697

97-
# Show the text telling the user to type the details about the story
98+
# Show a five dash space separator
9899
print()
99100
print(self.separators["5"])
100101
print()
102+
103+
# Show the text telling the user to type the details about the story
101104
print(self.language_texts["type_the_information_of_the_story"] + ":")
102105

103106
# Define the list of keys
@@ -479,7 +482,7 @@ def Add_To_Stories_List(self):
479482
keys = [
480483
"Folders",
481484
"Story pack",
482-
"Writing links",
485+
"Writing",
483486
"Directories",
484487
"Information items",
485488
"Cover types"

Modules/Stories/Show_Story_Information/__init__.py

+20
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,26 @@ def Show_Information(self):
124124

125125
print()
126126

127+
# Show the chapters of the story if they exist
128+
if story["Information"]["Chapters"]["Numbers"]["Total"] != 0:
129+
print(self.Language.language_texts["chapters, title()"] + ":")
130+
131+
# Show the number of chapters
132+
print("\t" + self.Language.language_texts["number, title()"] + ":")
133+
print("\t\t" + str(story["Information"]["Chapters"]["Numbers"]["Total"]))
134+
print()
135+
136+
# Show the titles of the chapters in the user language with their numbers
137+
print("\t" + self.Language.language_texts["titles, title()"] + ":")
138+
139+
t = 1
140+
for title in story["Information"]["Chapters"]["Titles"][self.user_language]:
141+
print("\t\t" + str(t) + " - " + title)
142+
143+
t += 1
144+
145+
print()
146+
127147
# Show the folder of the story
128148
print(self.Folder.language_texts["folder, title()"] + ":")
129149
print("\t" + story["Folders"]["root"])

0 commit comments

Comments
 (0)