Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 303171 Details for
Bug 437197
[PATCH] download progress bars scroll down in windows less than 80 characters wide
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
A patch to allow urlgrabber to take the terminal width into account
urlgrabber-terminal-width.diff (text/plain), 2.21 KB, created by
Mary Ellen Foster
on 2008-04-21 17:13:38 UTC
(
hide
)
Description:
A patch to allow urlgrabber to take the terminal width into account
Filename:
MIME Type:
Creator:
Mary Ellen Foster
Created:
2008-04-21 17:13:38 UTC
Size:
2.21 KB
patch
obsolete
>diff -ur urlgrabber-3.0.0.orig/urlgrabber/progress.py urlgrabber-3.0.0/urlgrabber/progress.py >--- urlgrabber-3.0.0.orig/urlgrabber/progress.py 2008-04-21 17:11:27.000000000 +0100 >+++ urlgrabber-3.0.0/urlgrabber/progress.py 2008-04-21 18:11:07.000000000 +0100 >@@ -24,6 +24,9 @@ > import math > import thread > import types >+import fcntl >+import struct >+import termios > > class BaseMeter: > def __init__(self): >@@ -95,6 +98,12 @@ > _text_meter_total_size = size > _text_meter_sofar_size = downloaded > >+# Code from http://mail.python.org/pipermail/python-list/2000-May/033365.html >+def get_terminal_width(): >+ buf = 'abcdefgh' >+ buf = fcntl.ioctl(0, termios.TIOCGWINSZ, buf) >+ return struct.unpack('hhhh', buf)[1] >+ > class TextMeter(BaseMeter): > def __init__(self, fo=sys.stderr): > BaseMeter.__init__(self) >@@ -116,8 +125,9 @@ > sofar_pc = (sofar_size * 100) / _text_meter_total_size > > if self.size is None: >- out = '\r%-60.60s %5sB %s ' % \ >- (text, fread, fetime) >+ width = get_terminal_width() - 20 >+ fmt = '\r%%-%d.%ds %%5sB %%s ' % (width, width) >+ out = fmt % (text, fread, fetime) > else: > rtime = self.re.remaining_time() > frtime = format_time(rtime) >@@ -126,10 +136,14 @@ > bar = '='*int(10 * frac) > ave_dl = format_number(self.re.average_rate()) > if sofar_size is None: >- out = '\r%-25.25s %3i%% |%-14.14s| %5sB/s | %5sB %9s ETA ' % \ >- (text, frac*100, bar, ave_dl, fread, frtime) >+ width = get_terminal_width() - 55 >+ fmt = '\r%%-%d.%ds %%3i%%%% |%%-14.14s| %%5sB/s | %%5sB %%9s ETA ' % \ >+ (width, width) >+ out = fmt % (text, frac*100, bar, ave_dl, fread, frtime) > else: >- fmt ='\r%-22.22s %3i%% |%4i%% |%-10.10s| %5sB/s | %5sB %9s ETA ' >+ width = get_terminal_width() - 58 >+ fmt ='\r%%-%d.%ds %%3i%%%% |%%4i%%%% |%%-10.10s| %%5sB/s | %%5sB %%9s ETA ' % \ >+ (width, width) > out = fmt % (text, sofar_pc,frac*100,bar,ave_dl, fread,frtime) > > self.fo.write(out)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 437197
:
303171
|
303174