@@ -19,7 +19,9 @@ def __init__(self, dictionary = {}):
19
19
},
20
20
"Diary Slim" : {
21
21
"Text" : "" ,
22
- "Clean text" : ""
22
+ "Clean text" : "" ,
23
+ "Descriptions" : {},
24
+ "Write description" : False
23
25
},
24
26
"States" : {
25
27
"Post on the Social Networks" : False
@@ -29,14 +31,19 @@ def __init__(self, dictionary = {}):
29
31
# Define the media variable to make typing the media dictionary easier
30
32
self .game = self .dictionary ["Game" ]
31
33
34
+ # Check the game status
32
35
self .Check_Game_Status ()
33
36
34
37
if (
35
38
self .game ["States" ]["Re-playing" ] == False and
36
39
self .game ["States" ]["Completed game" ] == True
37
40
):
41
+ # Check the game dates
38
42
self .Check_Game_Dates ()
39
43
44
+ # Ask the user if it wants to write a description for the gaming session
45
+ self .Ask_For_Gaming_Session_Description ()
46
+
40
47
# Database related methods
41
48
self .Register_In_JSON ()
42
49
self .Create_Entry_File ()
@@ -45,8 +52,10 @@ def __init__(self, dictionary = {}):
45
52
# Diary Slim related methods
46
53
self .Define_Diary_Slim_Text ()
47
54
55
+ # Post the gaming session on the social networks
48
56
self .Post_On_Social_Networks ()
49
57
58
+ # Write the information about the session on Diary Slim
50
59
self .Write_On_Diary_Slim ()
51
60
52
61
# Show the information about the game session
@@ -83,6 +92,50 @@ def Type_Entry_Information(self):
83
92
# Get the dictionary from the "Play" class with the session and time related keys
84
93
self .dictionary = self .Play .dictionary
85
94
95
+ def Ask_For_Gaming_Session_Description (self ):
96
+ # Ask the user if it wants to write a description for the gaming session
97
+ print ()
98
+ print (self .separators ["5" ])
99
+
100
+ self .dictionary ["Entry" ]["Diary Slim" ]["Write description" ] = self .Input .Yes_Or_No (self .language_texts ["write_a_description_for_the_gaming_session" ])
101
+
102
+ # If the user wants to write a description
103
+ if self .dictionary ["Entry" ]["Diary Slim" ]["Write description" ] == True :
104
+ # Define the keyword parameters dictionary
105
+ parameters = {
106
+ "line_options_parameter" : {
107
+ "print" : True ,
108
+ "next_line" : False ,
109
+ "show_finish_text" : True
110
+ }
111
+ }
112
+
113
+ # Iterate through the small languages list
114
+ for language in self .languages ["small" ]:
115
+ # If the language is not the first one
116
+ if language != self .languages ["small" ][0 ]:
117
+ # Enumerate the lines
118
+ parameters ["line_options_parameter" ]["enumerate" ] = True
119
+ parameters ["line_options_parameter" ]["enumerate_text" ] = False
120
+
121
+ # Get the last description
122
+ last_description = list (self .dictionary ["Entry" ]["Diary Slim" ]["Descriptions" ].values ())[0 ]
123
+
124
+ # Define the number of needed lines as the number of lines of the previous description
125
+ parameters ["length" ] = last_description ["length" ]
126
+
127
+ # Get the translated language in the user language
128
+ translated_language = self .languages ["full_translated" ][language ][self .user_language ]
129
+
130
+ # Define the type text
131
+ type_text = self .Language .language_texts ["description_in_{}" ] + ":"
132
+
133
+ # Format it
134
+ type_text = type_text .format (translated_language )
135
+
136
+ # Ask the user to type a session description
137
+ self .dictionary ["Entry" ]["Diary Slim" ]["Descriptions" ][language ] = self .Input .Lines (type_text , ** parameters )
138
+
86
139
def Register_In_JSON (self ):
87
140
self .game_type = self .dictionary ["Type" ]["Type" ]["en" ]
88
141
@@ -257,6 +310,9 @@ def Create_Entry_File(self):
257
310
#
258
311
# Session duration:
259
312
# [Session duration]
313
+ #
314
+ # Session description:
315
+ # [Session description]
260
316
#
261
317
# File name:
262
318
# [Number. Type (Time)]
@@ -299,12 +355,16 @@ def Define_File_Text(self, language_parameter = None):
299
355
300
356
full_language = self .languages ["full" ][language ]
301
357
358
+ # ---------- #
359
+
302
360
# Define the entry text lines
303
361
lines = [
304
362
self .Language .texts ["number, title()" ][language ] + ": " + str (self .dictionaries ["Sessions" ]["Numbers" ]["Total" ]),
305
363
self .Language .texts ["type_number" ][language ] + ": " + str (self .dictionaries ["Game type" ][self .game_type ]["Numbers" ]["Total" ])
306
364
]
307
365
366
+ # ---------- #
367
+
308
368
# Add the entry title lines
309
369
if language_parameter != "General" :
310
370
text = self .Language .texts ["title, title()" ][language ]
@@ -314,6 +374,8 @@ def Define_File_Text(self, language_parameter = None):
314
374
315
375
lines .append ("\n " + text + ":" + "\n " + "{}" )
316
376
377
+ # ---------- #
378
+
317
379
# If the game has sub-games
318
380
# And the sub-game title is not the same as the game title
319
381
if (
@@ -325,16 +387,36 @@ def Define_File_Text(self, language_parameter = None):
325
387
326
388
lines .append (text + ":" + "\n " + "{}" )
327
389
390
+ # ---------- #
391
+
328
392
# Add the rest of the lines
329
393
lines .extend ([
330
394
self .Language .texts ["type, title()" ][language ] + ":" + "\n " + self .dictionary ["Type" ]["Type" ][language ] + "\n " ,
331
395
self .Language .texts ["platform, title()" ][language ] + ":" + "\n " + self .game ["Platform" ][language ] + "\n " ,
332
396
self .Date .texts ["times, title()" ][language ] + ":" + "\n " + "{}" ,
333
- self .Language .texts ["session_duration" ][language ] + ":" + "\n " + "{}" ,
334
- self .Language .texts ["entry, title()" ][language ] + ":" + "\n " + self .dictionary ["Entry" ]["Name" ]["Normal" ]
397
+ self .Language .texts ["session_duration" ][language ] + ":" + "\n " + "{}"
335
398
])
336
399
337
- # Add states texts lines
400
+ # ---------- #
401
+
402
+ # If the user wrote a description for the gaming session
403
+ if self .dictionary ["Entry" ]["Diary Slim" ]["Write description" ] == True :
404
+ # Define the description text
405
+ text = self .texts ["gaming_session_description" ][language ] + ":" + "\n " + "{}"
406
+
407
+ # Add it to the list of lines
408
+ lines .append (text )
409
+
410
+ # ---------- #
411
+
412
+ # Add the entry name
413
+ entry = self .Language .texts ["entry, title()" ][language ] + ":" + "\n " + self .dictionary ["Entry" ]["Name" ]["Normal" ]
414
+
415
+ lines .append (entry )
416
+
417
+ # ---------- #
418
+
419
+ # Add the states text lines
338
420
if self .dictionary ["States" ]["Texts" ] != {}:
339
421
text = "\n " + self .Language .texts ["states, title()" ][language ] + ":" + "\n "
340
422
@@ -348,9 +430,13 @@ def Define_File_Text(self, language_parameter = None):
348
430
349
431
lines .append (text )
350
432
433
+ # ---------- #
434
+
351
435
# Define items to be added to file text format
352
436
items = []
353
437
438
+ # ---------- #
439
+
354
440
# Add the entry titles to the items list
355
441
titles = []
356
442
@@ -375,6 +461,8 @@ def Define_File_Text(self, language_parameter = None):
375
461
376
462
items .append (self .Text .From_List (titles , break_line = True ) + "\n " )
377
463
464
+ # ---------- #
465
+
378
466
# If the game has sub-games
379
467
# And the sub-game title is not the same as the game title
380
468
if (
@@ -394,9 +482,9 @@ def Define_File_Text(self, language_parameter = None):
394
482
395
483
items .append (times )
396
484
397
- # Add session duration to items list
398
- session_duration = self .dictionary ["Entry" ]["Session duration" ]["Text" ][language ] + "\n "
485
+ # ---------- #
399
486
487
+ # Add the session duration to the list of items
400
488
if language_parameter != "General" :
401
489
session_duration = self .dictionary ["Entry" ]["Session duration" ]["Text" ][language ] + "\n "
402
490
@@ -411,7 +499,31 @@ def Define_File_Text(self, language_parameter = None):
411
499
412
500
items .append (session_duration )
413
501
414
- # Define language entry text
502
+ # ---------- #
503
+
504
+ # If the user wrote a description for the gaming session
505
+ if self .dictionary ["Entry" ]["Diary Slim" ]["Write description" ] == True :
506
+ # Get the description in the current language
507
+ if language_parameter != "General" :
508
+ description = self .dictionary ["Entry" ]["Diary Slim" ]["Descriptions" ][language ]["string" ] + "\n "
509
+
510
+ # If the language parameter is "General"
511
+ if language_parameter == "General" :
512
+ # Create the descriptions text in all languages
513
+ description = ""
514
+
515
+ for language in self .languages ["small" ]:
516
+ text = self .dictionary ["Entry" ]["Diary Slim" ]["Descriptions" ][language ]["string" ] + "\n "
517
+
518
+ if text not in description :
519
+ description += text
520
+
521
+ # Add the description to the list of items
522
+ items .append (description )
523
+
524
+ # ---------- #
525
+
526
+ # Define the language entry text
415
527
file_text = self .Text .From_List (lines , break_line = True )
416
528
417
529
return file_text .format (* items )
@@ -589,30 +701,10 @@ def Define_Diary_Slim_Text(self):
589
701
590
702
self .dictionary ["Entry" ]["Diary Slim" ]["Clean text" ] = self .dictionary ["Entry" ]["Diary Slim" ]["Text" ]
591
703
592
- # Ask the user if it wants to write a description for the gaming session
593
- print ()
594
- print (self .separators ["5" ])
595
-
596
- self .dictionary ["Entry" ]["Diary Slim" ]["Write description" ] = self .Input .Yes_Or_No (self .language_texts ["write_a_description_for_the_gaming_session" ])
597
-
704
+ # If the user wants to write a description
598
705
if self .dictionary ["Entry" ]["Diary Slim" ]["Write description" ] == True :
599
- # Define the type text
600
- type_text = self .Language .language_texts ["description, title()" ] + ":"
601
-
602
- # Define the keyword parameters dictionary
603
- parameters = {
604
- "line_options_parameter" : {
605
- "print" : True ,
606
- "next_line" : False ,
607
- "show_finish_text" : True
608
- }
609
- }
610
-
611
- # Ask the user to type a session description
612
- self .dictionary ["Entry" ]["Diary Slim" ]["Description" ] = self .Input .Lines (type_text , ** parameters )
613
-
614
706
# Add the session description to the "Diary Slim" text
615
- self .dictionary ["Entry" ]["Diary Slim" ]["Text" ] += "\n \n " + self .dictionary ["Entry" ]["Diary Slim" ]["Description" ]["string" ]
707
+ self .dictionary ["Entry" ]["Diary Slim" ]["Text" ] += "\n \n " + self .dictionary ["Entry" ]["Diary Slim" ]["Descriptions" ][ self . user_language ]["string" ]
616
708
617
709
# If there are states, add the texts to the Diary Slim text
618
710
if self .dictionary ["States" ]["States" ] != {}:
0 commit comments