-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (32 loc) · 1.07 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
from utils import OsTools
from pdfManagement import pdf_file, pdf_collection
def print_general_message(first_opening=False, valid_input=True):
OsTools.cls()
print("---------- PDF Tools ----------\n")
if not valid_input:
print("Fehler bei der Eingabe! Versuchen Sie es erneut.\n")
elif not first_opening:
print("Die Eingabe wurde erfolgreich verarbeitet!\n")
print("1) einzelne PDF-Datei")
print("2) Ordner mit PDF-Dateien")
print("3) Programm beenden")
def validate_and_handle_start_menu_input():
try:
choice = int(input("\nEingabe: "))
except ValueError:
return False
if choice == 1:
return pdf_file()
elif choice == 2:
return pdf_collection()
elif choice == 3:
sys.exit()
else:
return False
if __name__ == '__main__':
print_general_message(first_opening=True)
valid_input = validate_and_handle_start_menu_input()
while True:
print_general_message(valid_input=valid_input)
valid_input = validate_and_handle_start_menu_input()