-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathprogressHelper.py
More file actions
41 lines (35 loc) · 1.18 KB
/
progressHelper.py
File metadata and controls
41 lines (35 loc) · 1.18 KB
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
from wx import ProgressDialog
class ProgressHelper:
def __init__(self, message, maximum=None, callback=None):
#type: (str, int, function) -> None
self.message = message
self.current = 0
self.maximum = maximum
self.workerWorking = True # type: bool
self.dlgWorking = True # type: bool
self.error = None # type: str
self.callback = callback
self.cbArgs = [] # type: list[str]
self.dlg = None # type: ProgressDialog
def setRange(self, max):
# type: (int) -> None
"""
call ProgressDialog.SetRange(max)
"""
self.maximum = max
if (self.dlg):
self.dlg.SetRange(max)
# def pulse(self, msg):
# # type: (str) -> None
# if (self.dlg):
# self.dlgWorking, skip = self.dlg.Pulse(msg)
# def update(self, value, msg):
# # type: (int, str) -> None
# if (self.dlg):
# self.dlgWorking, skip = self.dlg.Update(value, msg)
@property
def working(self):
return self.workerWorking and self.dlgWorking and not self.error
@property
def userCancelled(self):
return not self.dlgWorking