Coverage for khufu/buttons/buttonGroup.py : 94%

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 buttonGroup(
5 buttonList=[],
6 format="default",
7 pull=False):
8 """
9 *Generate a buttonGroup - TBS style*
11 **Key Arguments**
13 - ``buttonList`` -- a list of buttons
14 - ``format`` -- format of the button [ default | toolbar | vertical ]
17 **Return**
19 - ``buttonGroup`` -- the buttonGroup
21 """
22 thisButtonList = ""
23 count = 1
24 for button in buttonList:
25 thisButtonList = "%(thisButtonList)s %(button)s" % locals()
26 count += 1
28 if pull is not False:
29 pull = "pull-%(pull)s" % locals()
30 else:
31 pull = ""
33 if format == "vertical":
34 vertical = "btn-group-vertical"
35 else:
36 vertical = ""
38 toolbar = ""
39 if format == "toolbar":
40 toolbar = "btn-toolbar"
42 buttonGroup = """
43 <div class="btn-group %(vertical)s %(toolbar)s %(pull)s" id=" ">
44 %(thisButtonList)s
45 </div>""" % locals()
47 return buttonGroup