SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
script.progress_bar.ProgressBar Class Reference

Progress bar that can be updated concurrently. More...

Classes

class  TextIO
 Text wrapper to capture stdout. More...
 

Public Member Functions

 __init__ (self, int maxcount, str prefix)
 Create a new progress bar.
 
None rename (self, str prefix)
 Change the prefix of the progress bar.
 
None reset (self, int maxcount=None, str prefix=None)
 Reset the progress bar.
 
None start (self)
 Enable this progress bar.
 
 progress (self)
 Increment the progress bar.
 
 finish (self)
 Disable the progress bar, setting it to 100%.
 

Public Attributes

 maxcount
 
 stdout
 
 wrapper
 
 printer
 
 bar_len
 
 prefix
 
 counter
 
 run
 

Static Public Attributes

int bar_len = 10
 
int maxcount = 0
 
 lock = threading.Lock()
 
int counter = 0
 
 Lines = set()
 
bool run = True
 
str prefix = ""
 
str formatStr = "{} │{}│ {}{}\r"
 

Protected Member Functions

None _new_line (self, str line)
 The TextIO line handler.
 
 _progress (self, count, total, prefix="", str printString="")
 
 _print_thread (self)
 

Protected Attributes

 _new_line
 

Detailed Description

Progress bar that can be updated concurrently.

Definition at line 10 of file progress_bar.py.

Constructor & Destructor Documentation

◆ __init__()

script.progress_bar.ProgressBar.__init__ (   self,
int  maxcount,
str  prefix 
)

Create a new progress bar.

Args: maxcount (int): The target counter value prefix (str): The string to prefix the bar with

Definition at line 49 of file progress_bar.py.

Member Function Documentation

◆ _new_line()

None script.progress_bar.ProgressBar._new_line (   self,
str  line 
)
protected

The TextIO line handler.

Args: line (str): line to consume

Definition at line 94 of file progress_bar.py.

◆ _print_thread()

script.progress_bar.ProgressBar._print_thread (   self)
protected

Definition at line 121 of file progress_bar.py.

◆ _progress()

script.progress_bar.ProgressBar._progress (   self,
  count,
  total,
  prefix = "",
str   printString = "" 
)
protected

Definition at line 102 of file progress_bar.py.

◆ finish()

script.progress_bar.ProgressBar.finish (   self)

Disable the progress bar, setting it to 100%.

Definition at line 142 of file progress_bar.py.

◆ progress()

script.progress_bar.ProgressBar.progress (   self)

Increment the progress bar.

Definition at line 137 of file progress_bar.py.

◆ rename()

None script.progress_bar.ProgressBar.rename (   self,
str  prefix 
)

Change the prefix of the progress bar.

Args: prefix (str): The string to prefix the bar with

Definition at line 70 of file progress_bar.py.

◆ reset()

None script.progress_bar.ProgressBar.reset (   self,
int   maxcount = None,
str   prefix = None 
)

Reset the progress bar.

Args: maxcount (int): New target counter value. Defaults to current maxcount. prefix (str): New string to prefix the bar with. Defaults to current prefix.

Definition at line 81 of file progress_bar.py.

◆ start()

None script.progress_bar.ProgressBar.start (   self)

Enable this progress bar.

Definition at line 132 of file progress_bar.py.

Member Data Documentation

◆ _new_line

script.progress_bar.ProgressBar._new_line
protected

Definition at line 60 of file progress_bar.py.

◆ bar_len [1/2]

int script.progress_bar.ProgressBar.bar_len = 10
static

Definition at line 13 of file progress_bar.py.

◆ bar_len [2/2]

script.progress_bar.ProgressBar.bar_len

Definition at line 77 of file progress_bar.py.

◆ counter [1/2]

int script.progress_bar.ProgressBar.counter = 0
static

Definition at line 16 of file progress_bar.py.

◆ counter [2/2]

script.progress_bar.ProgressBar.counter

Definition at line 92 of file progress_bar.py.

◆ formatStr

str script.progress_bar.ProgressBar.formatStr = "{} │{}│ {}{}\r"
static

Definition at line 20 of file progress_bar.py.

◆ Lines

script.progress_bar.ProgressBar.Lines = set()
static

Definition at line 17 of file progress_bar.py.

◆ lock

script.progress_bar.ProgressBar.lock = threading.Lock()
static

Definition at line 15 of file progress_bar.py.

◆ maxcount [1/2]

int script.progress_bar.ProgressBar.maxcount = 0
static

Definition at line 14 of file progress_bar.py.

◆ maxcount [2/2]

script.progress_bar.ProgressBar.maxcount

Definition at line 56 of file progress_bar.py.

◆ prefix [1/2]

str script.progress_bar.ProgressBar.prefix = ""
static

Definition at line 19 of file progress_bar.py.

◆ prefix [2/2]

script.progress_bar.ProgressBar.prefix

Definition at line 79 of file progress_bar.py.

◆ printer

script.progress_bar.ProgressBar.printer

Definition at line 68 of file progress_bar.py.

◆ run [1/2]

bool script.progress_bar.ProgressBar.run = True
static

Definition at line 18 of file progress_bar.py.

◆ run [2/2]

script.progress_bar.ProgressBar.run

Definition at line 144 of file progress_bar.py.

◆ stdout

script.progress_bar.ProgressBar.stdout

Definition at line 57 of file progress_bar.py.

◆ wrapper

script.progress_bar.ProgressBar.wrapper

Definition at line 59 of file progress_bar.py.


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