MCPcopy Index your code
hub / github.com/rawpython/remi / main

Method main

examples/examples_from_contributors/bootstrap.py:31–107  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 pass
30
31 def main(self):
32 #custom additional html head tags
33 my_html_head = """<title>Bootstrap Test</title>"""
34
35 #Load Boostrap Ressources from Online Source
36 #One could download the files and put them into res folder for access without internet connection
37
38 #Not all the Bootstrap functionality will work!! Just basic styling is possible.
39
40 #For valid Bootstrap Classes check: https://www.w3schools.com/bootstrap/bootstrap_ref_all_classes.asp
41
42 #custom css
43 my_css_head = """
44 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
45 """
46
47 #custom js
48 my_js_head = """
49 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
50 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
51 """
52 #appending elements to page header
53 self.page.children['head'].add_child('myhtml', my_html_head)
54 self.page.children['head'].add_child('mycss', my_css_head)
55 self.page.children['head'].add_child('myjs', my_js_head)
56
57 #creating a container VBox type, vertical (you can use also HBox or Widget)
58 main_container = gui.VBox(width='500px', height='500px', style={'margin':'0px auto','padding':'10px'})
59
60 #Label
61 self.lbl = gui.Label(" Label with Lock Icon")
62 self.lbl.add_class("glyphicon glyphicon-lock label label-primary")
63
64 #Text Input
65 self.tf = gui.TextInput(hint='Your Input')
66 self.tf.add_class("form-control input-lg")
67
68 #Drop Down
69 self.dd = gui.DropDown(width='200px')
70 self.dd.style.update({'font-size':'large'})
71 self.dd.add_class("form-control dropdown")
72 self.item1 = gui.DropDownItem("First Choice")
73 self.item2 = gui.DropDownItem("Second Item")
74 self.dd.append(self.item1,'item1')
75 self.dd.append(self.item2,'item2')
76
77 #Table
78 myList = [ ('ID','Lastname','Firstname','ZIP','City'),
79 ('1','Pan','Peter','99999','Neverland'),
80 ('2','Sepp','Schmuck','12345','Examplecity') ]
81
82 self.tbl = gui.Table.new_from_list(content=myList,width='400px',height='100px',margin='10px')
83 self.tbl.add_class("table table-striped")
84
85 #Buttons
86
87 #btn adds basic design to a button like rounded corners and stuff
88 #btn-success, btn-danger and similar adds theming based on the function

Callers

nothing calls this directly

Calls 5

add_childMethod · 0.80
add_classMethod · 0.80
updateMethod · 0.45
appendMethod · 0.45
new_from_listMethod · 0.45

Tested by

no test coverage detected