-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtable_formatting.py
165 lines (122 loc) · 6.61 KB
/
table_formatting.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import shutil
import pymysql
import os
from reportlab.lib.units import inch
from report import *
from tkinter import messagebox
from tkinter import filedialog
from tkinter import *
from doc_test import *
from reportlab.platypus import *
from reportlab.lib import colors
def data_for_table(run_id):
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `id`,`distance`, `feature`, `joint` ,`length`, `depth` ,`width`, `angle` , `clock` , `remark` '
'from inspection_feature_list where runId =%s', run_id)
table_inspection = cur.fetchall()
list_table_attributes = ['Id', 'Distance', 'Feature', 'Joint', 'Length', 'Depth', 'Width', 'Angle', 'O` clock', 'Remarks']
table_inspection_list = list(table_inspection)
color_to_use = [colors.lavender, colors.floralwhite]
table_inspection_list.insert(0, list_table_attributes)
t = Table(table_inspection_list, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (9, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t
def data_for_table_1():
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `parameter`,`parameter_value` '
'from runsummary ')
new_table = cur.fetchall()
list_table_attributes = ['Parameter', 'Parameter Value']
new_table = list(new_table)
color_to_use = [colors.lavender, colors.floralwhite]
new_table.insert(0, list_table_attributes)
t = Table(new_table, colWidths=[3*inch]*2, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (1, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t
def data_for_table_14():
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `parameter`,`parameter_value` '
'from primary_sensor_performace ')
new_table = cur.fetchall()
list_table_attributes = ['Parameter', 'Parameter Value']
new_table = list(new_table)
color_to_use = [colors.lavender, colors.floralwhite]
new_table.insert(0, list_table_attributes)
t = Table(new_table, colWidths=[3*inch]*2, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (1, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t
def data_for_table_15():
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `parameter`,`parameter_value` '
'from inertial_sensor_performance ')
new_table = cur.fetchall()
list_table_attributes = ['Parameter', 'Parameter Value']
new_table = list(new_table)
color_to_use = [colors.lavender, colors.floralwhite]
new_table.insert(0, list_table_attributes)
t = Table(new_table, colWidths=[3*inch]*2, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (1, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t
def data_for_table_16():
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `parameter`,`parameter_value` '
'from distance ')
new_table = cur.fetchall()
list_table_attributes = ['Parameter', 'Parameter Value']
new_table = list(new_table)
color_to_use = [colors.lavender, colors.floralwhite]
new_table.insert(0, list_table_attributes)
t = Table(new_table, colWidths=[3*inch]*2, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (1, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t
def data_for_table_17():
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `parameter`,`parameter_value`,`distance` '
'from tool_velocity ')
new_table = cur.fetchall()
list_table_attributes = ['Parameter', 'Parameter Value']
new_table = list(new_table)
color_to_use = [colors.lavender, colors.floralwhite]
t = Table(new_table, colWidths=[2*inch]*3, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (2, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t
def data_for_table_18():
db = pymysql.connect(host="localhost", user="root", password="root", db="test")
cur = db.cursor()
cur.execute('select `parameter`,`parameter_value` '
'from data_summary ')
new_table = cur.fetchall()
list_table_attributes = ['Parameter', 'Parameter Value']
new_table = list(new_table)
color_to_use = [colors.lavender, colors.floralwhite]
new_table.insert(0, list_table_attributes)
t = Table(new_table, colWidths=[3*inch]*2, style=[('INNERGRID', (0, 0), (-1, -1), 0.75, colors.black,),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BACKGROUND', (0, 0), (1, 0), colors.grey),
('ROWBACKGROUNDS', (0, 1), (-1, -1), color_to_use),
])
return t