-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMacros.py
85 lines (77 loc) · 2.67 KB
/
Macros.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from flask import Flask, render_template
from macros.pillbar.pillbar_classes import SearchPill, TablePill
app = Flask(__name__)
@app.route('/')
def hello_world():
pill1 = SearchPill()
pill1.makepill('myclass', 'data', 'user', 'Profile', '/links')
pill1.load_table([[1],[2],[3]])
pill1.fillpill('data.0', 'profile_stuff', 'profile', 5, '/stuff')
pill2 = TablePill()
pill2.makepill('myclass', 'things', 'user', 'Stuff')
pill2.load_table([[1,2],[2,3],[3,4]])
pill2.fillpill('theid', 'stuff')
return render_template('pillbar/pillbartest.html',
pill1=pill1.export_pill(),
pill2=pill2.export_pill())
if __name__ == '__main__':
app.run()
# class tablepill(object):
# def __init__(self):
# self.pill = None
# self.pill_contents = None
#
# def makepill(self, pillclass, pillid, pillglyph, pilltitle):
# self.pill = { 'pill-class': pillclass,
# 'pill-id': pillid,
# 'pill-glyph': pillglyph,
# 'pill-title': pilltitle,
# 'pill-type': 'table'
# }
#
# def load_table(self, table):
# self.table_contents = table
#
# def fillpill(self, contentid, multilabel, nonelabel="You don't have any"):
# self.pill_contents = {
# 'id':contentid,
# 'contents':self.table_contents,
# 'multilabel':multilabel,
# 'nonelabel':nonelabel
# }
#
# def export_pill(self):
# return {**self.pill, "pill-contents":self.pill_contents}
#
#
# class searchpill(object):
#
# def __init__(self):
# self.pill = None
# self.table_contents = None
# self.pill_contents = None
# self.export = None
#
# def makepill(self, pillclass, pillid, pillglyph, pilltitle):
# self.pill = {'pill-class':pillclass,
# 'pill-id':pillid,
# 'pill-glyph':pillglyph,
# 'pill-title':pilltitle,
# 'pill-type': 'searchtable'
# }
#
# def load_table(self, table_contents):
# self.table_contents = table_contents
#
# def fillpill(self, contentid, input_id, multilabel, displaylimit, nonelabel="You don't have any"):
# self.pill_contents = {
# 'id': contentid,
# 'database_location': input_id,
# 'multilabel': multilabel,
# 'contents': self.table_contents,
# 'display-limit': displaylimit,
# 'nonelabel':nonelabel,
# }
#
# def export_pill(self):
# return {**self.pill, "pill-contents":self.pill_contents}