Skip to content

Commit

Permalink
python progress bar v 1.1 and progress bar version pacman
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Brunel committed May 3, 2020
1 parent a1135c8 commit 264b88f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
14 changes: 9 additions & 5 deletions FramePhotoLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,15 @@ def assemble(self):
# Start progress bar process
numberframed = multiprocessing.Value("i", 0)
progressbar = FramePhotoHelpers.ProgressBar(pretext="Framing photos: ",
progresschar="■",
# loadingchars="◧◩◪◨",
loadingchars="▄▀",
# progresschar="■",
# remainingbarchar=" ",
# loadingchars="▄▀",
# startendchar="",
progresschar="·",
remainingbarchar="•",
loadingchars="ᗧ",
startendchar="·🍒",
barwidth=33,
startendchar="",
displaypercentage=True,
displaycount=True)
pr = multiprocessing.Process(target=progressbar.inThread, args=(numberframed,total,0.1))
Expand All @@ -251,6 +255,6 @@ def assemble(self):
print("\n\nFramed "+str(total)+" photos in about "+str(timespent)+" seconds!")
print("Result images at "+self.resultDirectory)
print()
print("Happy? Support us at https://github.com/Photography-Utils/photoframer")
print("Happy with the result? Just like Pacman, we need to eat (cherries and more).\nSupport us at https://github.com/Photography-Utils/photoframer")
print("Thank you (:")

2 changes: 1 addition & 1 deletion ProgressBar/ProgressBar.info
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This is tag 1.0 of git project https://github.com/oldabl/python-progress-bar.git
This is tag 1.1 of git project https://github.com/oldabl/python-progress-bar.git

12 changes: 6 additions & 6 deletions ProgressBar/ProgressBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
# TO USE IN YOUR CODE
#from folder.ProgressBar import ProgressBar

# Class: ProgressBar
# Role: Set progress bar parameters and define its printing functions
class ProgressBar:
def __init__(self,
pretext=r"", # Text to print before the bar
progresschar=r"█", # Character to show progress
remainingbarchar=r" ", # Character to fill the remaining bar with
loadingchars=r"█▓▒░▒▓", # Last character of bar moving as bar loads (moves even if no progress)
startendchar=r"||", # Characters going around the bar
startendchar=r"||", # The two characters going around the bar
barwidth=int(os.get_terminal_size().columns/2), # Length of the bar in characters (does not include what's around the bar)
displaypercentage=False, # Show percentage as well or not
displaycount=False # Show count as well or not
):
self.pretext = str(pretext)
self.progresschar = str(progresschar)
self.remainingbarchar = str(remainingbarchar)
self.loadingchars = loadingchars
self.startendchar = str(startendchar)
self.barwidth = int(barwidth)
self.displaypercentage = displaypercentage
self.displaycount = displaycount

# loadingchars ideas
# characters = "-/|\"
# characters = ["-_="]

# Private
self.loadingcharsindex = 0
self.firstprint = True
Expand Down Expand Up @@ -87,7 +87,7 @@ def print(self,number,max):
self.loadingcharsindex = (self.loadingcharsindex+1) % len(self.loadingchars)
remainingbar -= 1
#Add remaining gap
barstring += remainingbar*" "
barstring += remainingbar*self.remainingbarchar
#End char
if self.startendchar:
if len(self.startendchar) >= 2:
Expand Down
3 changes: 2 additions & 1 deletion ProgressBar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ for i in range(0,max)
You can give the following optional arguments to the ProgressBar constructor:
- pretext: Text to print before the bar (default "")
- progresschar: Character to show progress (default '█')
- remainingbarchar: Character to fill the remaining bar with (default ' ')
- loadingchars: Last character of bar moving as bar loads (moves even if no progress) (default "█▓▒░▒▓")
- startendchar: Characters going around the bar (default "||")
- startendchar: The two characters going around the bar (default "||")
- barwidth: Length of the bar in characters (does not include optionally printed pretext, progresschar, percentage and count) (default terminal width/2)
- displaypercentage: Show percentage as well or not (default False)
- displaycount: Show count as well or not (default False)
Expand Down

0 comments on commit 264b88f

Please sign in to comment.