mirror of
https://github.com/verigak/progress.git
synced 2025-12-10 04:05:35 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5c911ed83 | ||
|
|
5d52c5b299 | ||
|
|
a83f91f4b8 | ||
|
|
292a031c4b | ||
|
|
83f3b79137 | ||
|
|
84c3b9197a | ||
|
|
715a2e130f |
@@ -21,7 +21,7 @@ from sys import stderr
|
|||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
|
|
||||||
__version__ = '1.3'
|
__version__ = '1.4'
|
||||||
|
|
||||||
|
|
||||||
class Infinite(object):
|
class Infinite(object):
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from . import Progress
|
from . import Progress
|
||||||
from .helpers import WritelnMixin
|
from .helpers import WritelnMixin
|
||||||
|
|
||||||
@@ -61,7 +64,10 @@ class FillingCirclesBar(ChargingBar):
|
|||||||
|
|
||||||
|
|
||||||
class IncrementalBar(Bar):
|
class IncrementalBar(Bar):
|
||||||
phases = (' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█')
|
if sys.platform.startswith('win'):
|
||||||
|
phases = (u' ', u'▌', u'█')
|
||||||
|
else:
|
||||||
|
phases = (' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█')
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
nphases = len(self.phases)
|
nphases = len(self.phases)
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ class WriteMixin(object):
|
|||||||
if message:
|
if message:
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
if self.file.isatty():
|
if self.file and self.file.isatty():
|
||||||
if self.hide_cursor:
|
if self.hide_cursor:
|
||||||
print(HIDE_CURSOR, end='', file=self.file)
|
print(HIDE_CURSOR, end='', file=self.file)
|
||||||
print(self.message, end='', file=self.file)
|
print(self.message, end='', file=self.file)
|
||||||
self.file.flush()
|
self.file.flush()
|
||||||
|
|
||||||
def write(self, s):
|
def write(self, s):
|
||||||
if self.file.isatty():
|
if self.file and self.file.isatty():
|
||||||
b = '\b' * self._width
|
b = '\b' * self._width
|
||||||
c = s.ljust(self._width)
|
c = s.ljust(self._width)
|
||||||
print(b + c, end='', file=self.file)
|
print(b + c, end='', file=self.file)
|
||||||
@@ -43,7 +43,7 @@ class WriteMixin(object):
|
|||||||
self.file.flush()
|
self.file.flush()
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
if self.file.isatty() and self.hide_cursor:
|
if self.file and self.file.isatty() and self.hide_cursor:
|
||||||
print(SHOW_CURSOR, end='', file=self.file)
|
print(SHOW_CURSOR, end='', file=self.file)
|
||||||
|
|
||||||
|
|
||||||
@@ -55,21 +55,21 @@ class WritelnMixin(object):
|
|||||||
if message:
|
if message:
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
if self.file.isatty() and self.hide_cursor:
|
if self.file and self.file.isatty() and self.hide_cursor:
|
||||||
print(HIDE_CURSOR, end='', file=self.file)
|
print(HIDE_CURSOR, end='', file=self.file)
|
||||||
|
|
||||||
def clearln(self):
|
def clearln(self):
|
||||||
if self.file.isatty():
|
if self.file and self.file.isatty():
|
||||||
print('\r\x1b[K', end='', file=self.file)
|
print('\r\x1b[K', end='', file=self.file)
|
||||||
|
|
||||||
def writeln(self, line):
|
def writeln(self, line):
|
||||||
if self.file.isatty():
|
if self.file and self.file.isatty():
|
||||||
self.clearln()
|
self.clearln()
|
||||||
print(line, end='', file=self.file)
|
print(line, end='', file=self.file)
|
||||||
self.file.flush()
|
self.file.flush()
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
if self.file.isatty():
|
if self.file and self.file.isatty():
|
||||||
print(file=self.file)
|
print(file=self.file)
|
||||||
if self.hide_cursor:
|
if self.hide_cursor:
|
||||||
print(SHOW_CURSOR, end='', file=self.file)
|
print(SHOW_CURSOR, end='', file=self.file)
|
||||||
|
|||||||
8
setup.py
8
setup.py
@@ -21,9 +21,9 @@ setup(
|
|||||||
'License :: OSI Approved :: ISC License (ISCL)',
|
'License :: OSI Approved :: ISC License (ISCL)',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
'Programming Language :: Python :: 3.3'
|
'Programming Language :: Python :: 3.3',
|
||||||
'Programming Language :: Python :: 3.4'
|
'Programming Language :: Python :: 3.4',
|
||||||
'Programming Language :: Python :: 3.5'
|
'Programming Language :: Python :: 3.5',
|
||||||
'Programming Language :: Python :: 3.6'
|
'Programming Language :: Python :: 3.6',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user