This repository has been archived by the owner on Nov 12, 2017. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:RealOrangeOne/Printr
- Loading branch information
Showing
13 changed files
with
101 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,5 @@ target/ | |
|
||
|
||
# Other | ||
MANIFEST | ||
MANIFEST | ||
README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pandoc --from=markdown --to=rst --output=README README.md | ||
pandoc --from=markdown --to=rst --output=README.rst README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
'name' : 'Python-Printr', | ||
'packages' : ['printr'], | ||
'version' : '0.0.1', | ||
'description' : 'Python module to allow a print line to be updated after printing', | ||
'author' : 'Jake Howard', | ||
'author_email' : 'me@theorangeone.net ', | ||
'url' : 'https://github.com/RealOrangeOne/Printr', | ||
'license':'MIT', | ||
'platforms':['any'] | ||
"name": "Python-Printr", | ||
"packages": ["printr"], | ||
"version": "0.0.3", | ||
"description": "Python module to allow a print line to be updated after printing", | ||
"author": "Jake Howard", | ||
"author_email": "me@theorangeone.net ", | ||
"url": "https://github.com/RealOrangeOne/Printr", | ||
"license": "MIT", | ||
"platforms": ["any"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from printr.utils import write | ||
|
||
class EllipsisPrintr(): | ||
def __init__(self, string, max=3, erase_after=False): | ||
self.string = string | ||
self.max = max | ||
self.count = -1 | ||
self.erase_after = erase_after | ||
|
||
def update(self, commit=False): | ||
self.clear() | ||
ellipsis = "." * self.count | ||
write(self.string + ellipsis, commit=commit) | ||
if self.count >= self.max: | ||
self.zero() | ||
self.count += 1 | ||
|
||
def zero(self): | ||
self.count = -1 | ||
|
||
def commit(self): | ||
print() | ||
|
||
def clear(self): | ||
print(' ' * (len(self.string) + self.max), end='\r') | ||
|
||
def __enter__(self): | ||
return self | ||
def __exit__(self, type, value, traceback): | ||
if self.erase_after: | ||
self.clear() | ||
self.commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class FormattingError(Exception): | ||
message = "Provided string doesn't contain formatting placeholders for {c} and/or {m}" | ||
def __init__(self): | ||
super().__init__(self.message) | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def write(string, commit=False): | ||
ending = '\n' if commit else '\r' | ||
print(string, end=ending) | ||
|
||
def commit(): | ||
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from printr import EllipsisPrintr | ||
from time import sleep | ||
|
||
with EllipsisPrintr('Printing') as p: | ||
for i in range(30): | ||
p.update() | ||
sleep(0.1) |