Skip to content

Commit 836c4d5

Browse files
authored
Merge pull request #4 from sd18ub/main
2 parents 6708db5 + 8c688d0 commit 836c4d5

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

main.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from collections import deque
1414
from traceback import print_exception
1515
import re
16+
import datetime
1617

1718
from algorithmic_compiler import AlgorithmicCompiler
1819
from cpp_compiler import CppCompiler
@@ -505,22 +506,27 @@ def _on_crash_recover(self):
505506
"""
506507
If a crash file exists, asks the user if they want to recover.
507508
"""
509+
CRASH_FILE_PATH = os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME)
508510
def recover_crash_data():
509-
with open(os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME), "r", encoding="utf-8") as f:
511+
with open(CRASH_FILE_PATH, "r", encoding="utf-8") as f:
510512
self.current_text = f.read()
511513
self.display_text()
512514
self.is_crash_reboot = True
513515

516+
modify_time = os.path.getmtime(CRASH_FILE_PATH)
517+
modify_date = datetime.datetime.fromtimestamp(modify_time)
518+
dateD_H_str = modify_date.strftime("%d/%m/%Y %H:%M:%S")
519+
514520
display_menu(
515521
self.stdscr,
516522
(
517523
("Yes", recover_crash_data),
518524
("No", lambda: None)
519525
),
520-
label=self.get_translation("crash_recovery"),
526+
label=self.get_translation("crash_recovery", date=dateD_H_str),
521527
clear=False
522528
)
523-
os.remove(os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME))
529+
os.remove(CRASH_FILE_PATH)
524530

525531

526532
@property

translations/translations_en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
}
9292
}
9393
},
94-
"crash_recovery": "Data has been found from the last crash. Do you want to recover it ?",
94+
"crash_recovery": "Data has been found from the last crash ({date}). Do you want to recover it ?",
9595
"loaded_plugin": "Loaded plugin {plugin_name}",
9696
"theme_reloaded": "The theme was reloaded.",
9797
"yes": "Yes",

translations/translations_fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
}
9292
}
9393
},
94-
"crash_recovery": "Des données du document ont été trouvées après le dernier crash. Voulez-vous les récupérer ?",
94+
"crash_recovery": "Des données du document ont été trouvées après le dernier crash ({date}). Voulez-vous les récupérer ?",
9595
"loaded_plugin": "Plugin {plugin_name} chargé",
9696
"theme_reloaded": "Le thème a été mis à jour.",
9797
"yes": "Oui",

0 commit comments

Comments
 (0)