Coverage for khufu/labelsAndBadges/stackedProgressBar.py : 78%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# encoding: utf-8
2from . import *
4def stackedProgressBar(
5 barStyle="plain",
6 infoWidth="10",
7 successWidth="10",
8 warningWidth="10",
9 errorWidth="10"
10):
11 """
12 *Generate a progress bar - TBS style*
14 **Key Arguments**
16 - ``barLevel`` -- the level/color of progress [ "info" | "success" | "warning" | "danger"]
17 - ``barStyle`` -- style of the progress bar [ "plain" | "striped" | "striped-active" ]
18 - ``infoWidth`` -- the precentage width of the info level bar
19 - ``successWidth`` -- the precentage width of the success level bar
20 - ``warningWidth`` -- the precentage width of the warning level bar
21 - ``errorWidth`` -- the precentage width of the error level bar
24 **Return**
26 - ``progressBar`` -- the progressBar
28 """
29 if barStyle == "striped":
30 barStyle = "progress-striped"
31 elif barStyle == "striped-active":
32 barStyle = "progress-striped active"
33 else:
34 barStyle = ""
36 stackedProgressBar = """
37 <div class="progress %(barStyle)s">
38 <div class="bar bar-info" style="width: %(infoWidth)s%%;"></div>
39 <div class="bar bar-success" style="width: %(successWidth)s%%;"></div>
40 <div class="bar bar-warning" style="width: %(warningWidth)s%%;"></div>
41 <div class="bar bar-danger" style="width: %(errorWidth)s%%;"></div>
42 </div>""" % locals()
43 return stackedProgressBar