-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
controller.py
111 lines (87 loc) · 2.89 KB
/
controller.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from tvlib import *
from ui import *
resolution = None
done: bool = False
image_settings = {
'rotation': Rotation.NONE,
'flip': Flip.NONE,
'imagemode': None
}
def init():
global resolution
welcome()
Config.load()
config_loaded()
resolution = Config.get_res()
def main ():
init()
imageModeSelect()
def imageModeSelect() -> None:
global image_settings
mode: ImageMode
while True:
ImageModeMenuPrintout()
mode = ImageModeMenu()
if mode is ImageMode.NAC:
message_err("Please select a choice from the menu given.")
continue
elif mode is ImageMode.BACK:
return None
else:
image_settings['imagemode'] = mode
rotationModeSelect()
if done: return None
def rotationModeSelect() -> None:
global image_settings
mode: RotationMode
while True:
RotationModeMenuPrintout()
mode = RotationModeMenu()
if mode is RotationMode.NAC:
message_err("Please select a choice from the menu given.")
continue
elif mode is RotationMode.BACK:
return None
else:
match mode:
case RotationMode.BACK:
return None
case RotationMode.ROTATE_90:
image_settings['rotation'] = Rotation.ROTATE_90
case RotationMode.ROTATE_180:
image_settings['rotation'] = Rotation.ROTATE_180
case RotationMode.ROTATE_270:
image_settings['rotation'] = Rotation.ROTATE_270
case RotationMode.NONE:
image_settings['rotation'] = Rotation.NONE
case _:
image_settings['rotation'] = Rotation.NONE
flipModeSelect()
if done: return None
def flipModeSelect() -> FlipMode:
global image_settings
global done
mode: FlipMode
while True:
FlipModeMenuPrintout()
mode = FlipModeMenu()
if mode is FlipMode.NAC:
message_err("Please select a choice from the menu given.")
continue
elif mode is FlipMode.BACK:
return None
else:
match mode:
case FlipMode.BACK:
return None
case FlipMode.VERTICAL_FLIP:
image_settings['flip'] = Flip.VERTICAL_FLIP
case FlipMode.HORIZONTAL_FLIP:
image_settings['flip'] = Flip.HORIZONTAL_FLIP
case FlipMode.VERTICAL_AND_HORIZONTAL_FLIP:
image_settings['flip'] = Flip.VERTICAL_AND_HORIZONTAL_FLIP
case FlipMode.NONE:
image_settings['flip'] = Flip.NONE
case _:
image_settings['flip'] = Flip.NONE
done = True