grepros 1.2.2
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
ProgressBar Class Reference

A simple ASCII progress bar with a ticker thread. More...

Inheritance diagram for ProgressBar:
Inheritance graph

Public Member Functions

 __init__ (self, max=100, value=0, min=0, width=30, forechar="-", backchar=" ", foreword="", afterword="", interval=1, pulse=False, aftertemplate=" {afterword}", **afterargs)
 Creates a new progress bar, without drawing it yet.
 
 draw (self, flush=False)
 Prints the progress bar, from the beginning of the current line.
 
 run (self)
 
 stop (self)
 
 update (self, value=None, draw=True, flush=False)
 Updates the progress bar value, and refreshes by default; returns self.
 

Public Attributes

 afterargs
 
 aftertemplate
 
 afterword
 
 backchar
 
 bar
 
 daemon
 
 forechar
 
 foreword
 
 interval
 
 is_running
 
 max
 
 min
 
 pause
 
 percent
 
 printbar
 
 progresschar
 
 pulse
 
 pulse_pos
 
 value
 
 width
 

Detailed Description

A simple ASCII progress bar with a ticker thread.

Drawn like '[———/ 36% ] Progressing text..'. or for pulse mode '[ —- ] Progressing text..'.

Definition at line 546 of file common.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  max = 100,
  value = 0,
  min = 0,
  width = 30,
  forechar = "-",
  backchar = " ",
  foreword = "",
  afterword = "",
  interval = 1,
  pulse = False,
  aftertemplate = " {afterword}",
**  afterargs 
)

Creates a new progress bar, without drawing it yet.

Parameters
maxprogress bar maximum value, 100%
valueprogress bar initial value
minprogress bar minimum value, for 0%
widthprogress bar width (in characters)
forecharcharacter used for filling the progress bar
backcharcharacter used for filling the background
forewordtext in front of progress bar
afterwordtext after progress bar
intervalticker thread interval, in seconds
pulseignore value-min-max, use constant pulse instead
aftertemplateafterword format() template, populated with vars(self) and afterargs
afterargsadditional keywords for aftertemplate formatting

Definition at line 564 of file common.py.

Member Function Documentation

◆ draw()

draw (   self,
  flush = False 
)

Prints the progress bar, from the beginning of the current line.

Parameters
flushadd linefeed to end, forcing a new line for any next print

Definition at line 646 of file common.py.

◆ run()

run (   self)

Definition at line 654 of file common.py.

◆ stop()

stop (   self)

Definition at line 661 of file common.py.

◆ update()

update (   self,
  value = None,
  draw = True,
  flush = False 
)

Updates the progress bar value, and refreshes by default; returns self.

Definition at line 594 of file common.py.

Member Data Documentation

◆ afterargs

afterargs

Definition at line 579 of file common.py.

◆ aftertemplate

aftertemplate

Definition at line 578 of file common.py.

◆ afterword

afterword

Definition at line 575 of file common.py.

◆ backchar

backchar

Definition at line 573 of file common.py.

◆ bar

bar

Definition at line 585 of file common.py.

◆ daemon

daemon

Definition at line 580 of file common.py.

◆ forechar

forechar

Definition at line 572 of file common.py.

◆ foreword

foreword

Definition at line 574 of file common.py.

◆ interval

interval

Definition at line 576 of file common.py.

◆ is_running

is_running

Definition at line 591 of file common.py.

◆ max

max

Definition at line 568 of file common.py.

◆ min

min

Definition at line 570 of file common.py.

◆ pause

pause

Definition at line 583 of file common.py.

◆ percent

percent

Definition at line 581 of file common.py.

◆ printbar

printbar

Definition at line 589 of file common.py.

◆ progresschar

progresschar

Definition at line 590 of file common.py.

◆ pulse

pulse

Definition at line 577 of file common.py.

◆ pulse_pos

pulse_pos

Definition at line 584 of file common.py.

◆ value

value

Definition at line 569 of file common.py.

◆ width

width

Definition at line 571 of file common.py.


The documentation for this class was generated from the following file: