CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Private Attributes
progressbar.Bar Class Reference
Inheritance diagram for progressbar.Bar:
progressbar.WidgetHFill progressbar.Widget progressbar.BouncingBar

Public Member Functions

def __init__ (self, marker='#', left='|', right='|', fill=' ', fill_left=True)
 
def update (self, pbar, width)
 
- Public Member Functions inherited from progressbar.Widget
def update (self, pbar)
 

Public Attributes

 fill
 
 fill_left
 
 left
 
 marker
 
 right
 

Static Private Attributes

 __slots__
 

Additional Inherited Members

- Static Public Attributes inherited from progressbar.Widget
 TIME_SENSITIVE
 

Detailed Description

Definition at line 72 of file progressbar.py.

Constructor & Destructor Documentation

◆ __init__()

def progressbar.Bar.__init__ (   self,
  marker = '#',
  left = '|',
  right = '|',
  fill = ' ',
  fill_left = True 
)
Creates a customizable progress bar.

marker - string or updatable object to use as a marker
left - string or updatable object to use as a left border
right - string or updatable object to use as a right border
fill - character to use for the empty part of the progress bar
fill_left - whether to fill from the left or the right

Definition at line 77 of file progressbar.py.

77  def __init__(self, marker='#', left='|', right='|', fill=' ',
78  fill_left=True):
79  '''Creates a customizable progress bar.
80 
81  marker - string or updatable object to use as a marker
82  left - string or updatable object to use as a left border
83  right - string or updatable object to use as a right border
84  fill - character to use for the empty part of the progress bar
85  fill_left - whether to fill from the left or the right
86  '''
87  self.marker = marker
88  self.left = left
89  self.right = right
90  self.fill = fill
91  self.fill_left = fill_left
92 
93 

Member Function Documentation

◆ update()

def progressbar.Bar.update (   self,
  pbar,
  width 
)
Updates the widget providing the total width the widget must fill.

pbar - a reference to the calling ProgressBar
width - The total width the widget must fill

Reimplemented from progressbar.WidgetHFill.

Reimplemented in progressbar.BouncingBar.

Definition at line 94 of file progressbar.py.

94  def update(self, pbar, width):
95  'Updates the progress bar and its subcomponents'
96 
97  left, marked, right = (format_updatable(i, pbar) for i in
98  (self.left, self.marker, self.right))
99 
100  width -= len(left) + len(right)
101  # Marked must *always* have length of 1
102  if pbar.maxval:
103  marked *= int(pbar.currval / pbar.maxval * width)
104  else:
105  marked = ''
106 
107  if self.fill_left:
108  return '%s%s%s' % (left, marked.ljust(width, self.fill), right)
109  else:
110  return '%s%s%s' % (left, marked.rjust(width, self.fill), right)

References progressbar.Bar.fill, progressbar.Bar.fill_left, progressbar.format_updatable(), createfilelist.int, ShallowClustersProducer::NearDigis.left, JME::bimap< T, U >.left, BinaryOP.left, progressbar.Bar.left, progressbar.Bar.marker, HCAL_HLX::LUMI_RAW_HEADER.marker, ShallowClustersProducer::NearDigis.right, JME::bimap< T, U >.right, KDTreeNodes< DATA, DIM >.right, BinaryOP.right, progressbar.Bar.right, svgfig.Curve.Sample.right, and svgfig.Curve.Samples.right.

Referenced by progressbar.ProgressBar.__next__(), MatrixUtil.Matrix.__setitem__(), MatrixUtil.Steps.__setitem__(), progressbar.ProgressBar.finish(), and MatrixUtil.Steps.overwrite().

Member Data Documentation

◆ __slots__

progressbar.Bar.__slots__
staticprivate

Definition at line 75 of file progressbar.py.

◆ fill

progressbar.Bar.fill

Definition at line 89 of file progressbar.py.

Referenced by progressbar.Bar.update(), and progressbar.BouncingBar.update().

◆ fill_left

progressbar.Bar.fill_left

Definition at line 90 of file progressbar.py.

Referenced by progressbar.Bar.update(), and progressbar.BouncingBar.update().

◆ left

progressbar.Bar.left

◆ marker

progressbar.Bar.marker

Definition at line 86 of file progressbar.py.

Referenced by progressbar.Bar.update(), and progressbar.BouncingBar.update().

◆ right

progressbar.Bar.right

Definition at line 88 of file progressbar.py.

Referenced by progressbar.Bar.update(), and progressbar.BouncingBar.update().

createfilelist.int
int
Definition: createfilelist.py:10
progressbar.format_updatable
def format_updatable(updatable, pbar)
Definition: progressbar.py:411
update
#define update(a, b)
Definition: TrackClassifier.cc:10