-
Notifications
You must be signed in to change notification settings - Fork 73
/
handler.py
120 lines (102 loc) · 3.83 KB
/
handler.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
112
113
114
115
116
117
118
119
120
from typing import List, Tuple
from bauh.api.abstract.view import MessageType, ViewComponent
class ProcessWatcher:
"""
Represents an view component watching background processes. It's a bridge for ApplicationManager instances notifiy the view of processes progression and also
request any user interaction without the need of knowing any GUI code.
"""
def print(self, msg: str):
"""
prints a given message to the user. In the current GUI implementation, the message is printed on the terminal window ("Details")
:param msg:
:return:
"""
pass
def request_confirmation(self, title: str, body: str, components: List[ViewComponent] = None, confirmation_label: str = None,
deny_label: str = None, deny_button: bool = True, window_cancel: bool = False) -> bool:
"""
request a user confirmation. In the current GUI implementation, it shows a popup to the user.
:param title: popup title
:param body: popup body
:param components: extra view components that will be rendered to the confirmation popup.
:param confirmation_label: optional confirmation button label (default to 'yes')
:param deny_label: optional deny button label (default to 'no')
:param deny_button: if the deny button should be displayed
:param window_cancel: if the window cancel button should be visible
:return: if the request was confirmed by the user
"""
pass
def request_reboot(self, msg: str) -> bool:
"""
:return: requests a system reboot
"""
pass
def show_message(self, title: str, body: str, type_: MessageType = MessageType.INFO):
"""
shows a message to the user. In the current GUI implementation, it shows a popup.
:param title:
:param body:
:param type_: determines the icon that will be displayed
:return:
"""
pass
def change_status(self, msg: str):
"""
Changes the process status. In the current GUI implementation, the process status is displayed above the toolbar.
:param msg: msg
:return:
"""
pass
def change_substatus(self, msg: str):
"""
Changes the process substatus. In the current GUI implementation, the process substatus is displayed above the progress bar.
:param msg:
:return:
"""
def change_progress(self, val: int):
"""
Changes the process progress. In the current GUI implementation, the progress is displayed as a bottom bar.
:param val: a val between 0 and 100
:return:
"""
def should_stop(self) -> bool:
"""
:return: if the use requested to stop the process.
"""
def request_root_password(self) -> Tuple[str, bool]:
"""
asks the root password for the user
:return: a tuple with the typed password and if it is valid
"""
class TaskManager:
def register_task(self, id_: str, label: str, icon_path: str):
"""
:param id_: an unique identifier for the task
:param label: an i18n label
:param icon_path: str
:return:
"""
pass
def update_progress(self, task_id: str, progress: float, substatus: str):
"""
:param task_id:
:param progress: a float between 0 and 100.
:param substatus: a substatus string representing the current state
:return:
"""
pass
def update_output(self, task_id: str, output: str):
"""
updates the task output
:param task_id:
:param output:
:return:
"""
pass
def finish_task(self, task_id: str):
"""
marks a task as finished
:param task_id:
:return:
"""
pass