Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seblu
installsystems
Commits
53226773
Commit
53226773
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
Add a download size information on download progressbar
parent
cac33624
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
installsystems/progressbar/widgets.py
+21
-0
21 additions, 0 deletions
installsystems/progressbar/widgets.py
installsystems/tools.py
+3
-2
3 additions, 2 deletions
installsystems/tools.py
with
24 additions
and
2 deletions
installsystems/progressbar/widgets.py
+
21
−
0
View file @
53226773
...
...
@@ -140,6 +140,27 @@ class FileTransferSpeed(Widget):
return
self
.
format
%
(
scaled
,
self
.
prefixes
[
power
],
self
.
unit
)
class
FileTransferSize
(
Widget
):
'
Widget for showing the transfer size (useful for file transfers).
'
format
=
'
%6.2f %s%s
'
prefixes
=
'
kMGTPEZY
'
__slots__
=
(
'
unit
'
,
'
format
'
)
def
__init__
(
self
,
unit
=
'
B
'
):
self
.
unit
=
unit
def
update
(
self
,
pbar
):
'
Updates the widget with the current SI prefixed speed.
'
if
pbar
.
currval
<
2e-6
:
# =~ 0
scaled
=
power
=
0
else
:
power
=
int
(
math
.
log
(
pbar
.
currval
,
1000
))
scaled
=
pbar
.
currval
/
1000.
**
power
return
self
.
format
%
(
scaled
,
self
.
prefixes
[
power
],
self
.
unit
)
class
AnimatedMarker
(
Widget
):
'''
An animated marker for the progress bar which defaults to appear as if
...
...
This diff is collapsed.
Click to expand it.
installsystems/tools.py
+
3
−
2
View file @
53226773
...
...
@@ -16,7 +16,8 @@ import time
from
subprocess
import
call
,
check_call
,
CalledProcessError
import
installsystems
from
installsystems.progressbar
import
ProgressBar
,
Percentage
,
FileTransferSpeed
from
installsystems.progressbar
import
ProgressBar
,
Percentage
from
installsystems.progressbar
import
FileTransferSpeed
,
FileTransferSize
from
installsystems.progressbar
import
Bar
,
BouncingBar
,
ETA
,
UnknownLength
from
installsystems.tarball
import
Tarball
from
installsystems.printer
import
*
...
...
@@ -72,7 +73,7 @@ class PipeFile(object):
# init progress bar
# we use 0 because a null file is cannot show a progression during write
if
self
.
size
==
0
:
widget
=
[
BouncingBar
(),
"
"
,
FileTransferSpeed
()
]
widget
=
[
FileTransferSize
(),
"
"
,
BouncingBar
(),
"
"
,
FileTransferSpeed
()
]
maxval
=
UnknownLength
else
:
widget
=
[
Percentage
(),
"
"
,
Bar
(),
"
"
,
FileTransferSpeed
(),
"
"
,
ETA
()
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment