Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
59 lines (49 loc) · 1.52 KB

File metadata and controls

59 lines (49 loc) · 1.52 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import time
import progressbar
class CrazyFileTransferSpeed(progressbar.FileTransferSpeed):
"It's bigger between 45 and 80 percent"
def update(self, pbar):
if 45 < pbar.percentage() < 80:
return 'Bigger Now ' + progressbar.FileTransferSpeed.update(self,
pbar)
else:
return progressbar.FileTransferSpeed.update(self, pbar)
def test_crazy_file_transfer_speed_widget():
widgets = [
# CrazyFileTransferSpeed(),
' <<<',
progressbar.Bar(),
'>>> ',
progressbar.Percentage(),
' ',
progressbar.ETA(),
]
p = progressbar.ProgressBar(widgets=widgets, max_value=1000)
# maybe do something
p.start()
for i in range(0, 200, 5):
# do something
time.sleep(0.1)
p.update(i + 1)
p.finish()
def test_dynamic_message_widget():
widgets = [
' [', progressbar.Timer(), '] ',
progressbar.Bar(),
' (', progressbar.ETA(), ') ',
progressbar.DynamicMessage('loss'),
progressbar.DynamicMessage('text'),
progressbar.DynamicMessage('error', precision=None),
]
p = progressbar.ProgressBar(widgets=widgets, max_value=1000)
p.start()
for i in range(0, 200, 5):
time.sleep(0.1)
p.update(i + 1, loss=.5, text='spam', error=1)
i += 1
p.update(i, text=None)
i += 1
p.update(i, text=False)
i += 1
p.update(i, text=True, error='a')
p.finish()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.