itkdb-gtk 0.10.8__py3-none-any.whl → 0.10.9.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of itkdb-gtk might be problematic. Click here for more details.
- itkdb_gtk/ITkDBlogin.py +1 -1
- itkdb_gtk/PanelVisualInspection.py +176 -26
- itkdb_gtk/PetalReceptionTests.py +33 -23
- itkdb_gtk/UploadMultipleTests.py +1 -1
- itkdb_gtk/WireBondGui.py +1 -0
- itkdb_gtk/__init__.py +6 -1
- itkdb_gtk/dashBoard.py +24 -2
- itkdb_gtk/dbGtkUtils.py +39 -12
- {itkdb_gtk-0.10.8.dist-info → itkdb_gtk-0.10.9.dev1.dist-info}/METADATA +2 -1
- {itkdb_gtk-0.10.8.dist-info → itkdb_gtk-0.10.9.dev1.dist-info}/RECORD +13 -13
- {itkdb_gtk-0.10.8.dist-info → itkdb_gtk-0.10.9.dev1.dist-info}/WHEEL +1 -1
- {itkdb_gtk-0.10.8.dist-info → itkdb_gtk-0.10.9.dev1.dist-info}/entry_points.txt +1 -0
- {itkdb_gtk-0.10.8.dist-info → itkdb_gtk-0.10.9.dev1.dist-info}/top_level.txt +0 -0
itkdb_gtk/ITkDBlogin.py
CHANGED
|
@@ -306,7 +306,7 @@ class ITkDBlogin(Gtk.Dialog):
|
|
|
306
306
|
# token_file.write(json.dumps(self.token))
|
|
307
307
|
self.hide()
|
|
308
308
|
|
|
309
|
-
def get_client(self, use_eos=
|
|
309
|
+
def get_client(self, use_eos=True):
|
|
310
310
|
"""Return the client."""
|
|
311
311
|
if not self.is_connected():
|
|
312
312
|
return None
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""PB/Hybrid panel Visual inspection GUI.."""
|
|
3
3
|
import json
|
|
4
4
|
import sys
|
|
5
|
+
import copy
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
|
|
7
8
|
try:
|
|
@@ -12,23 +13,42 @@ except ImportError:
|
|
|
12
13
|
sys.path.append(cwd.as_posix())
|
|
13
14
|
|
|
14
15
|
from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
|
|
16
|
+
from itkdb_gtk.ShowComments import ShowComments
|
|
17
|
+
from itkdb_gtk.ShowDefects import ShowDefects
|
|
18
|
+
from itkdb_gtk.UploadTest import create_json_data_editor
|
|
19
|
+
|
|
20
|
+
|
|
15
21
|
|
|
16
22
|
import gi
|
|
17
23
|
gi.require_version("Gtk", "3.0")
|
|
18
|
-
from gi.repository import Gtk, Gdk, Gio
|
|
24
|
+
from gi.repository import Gtk, Gdk, Gio, GObject
|
|
19
25
|
|
|
20
26
|
HELP_LINK="https://itkdb-gtk.docs.cern.ch"
|
|
21
27
|
|
|
28
|
+
class TestJson(GObject.Object):
|
|
29
|
+
"""To store test JSOn."""
|
|
30
|
+
__gtype_name__ = "TestJson"
|
|
31
|
+
|
|
32
|
+
def __init__(self, js=None):
|
|
33
|
+
super().__init__()
|
|
34
|
+
self.js = copy.deepcopy(js)
|
|
35
|
+
|
|
36
|
+
def set_js(self, js):
|
|
37
|
+
"""SEts the dictionary"""
|
|
38
|
+
self.js = copy.deepcopy(js)
|
|
39
|
+
|
|
40
|
+
|
|
22
41
|
class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
23
42
|
"""PB/Hybryd panel visual inspection GUI."""
|
|
24
|
-
SN, PASSED, F_NAME, F_PATH, ALL = range(
|
|
43
|
+
SN, PASSED, F_NAME, F_PATH, TEST_J, ALL = range(6)
|
|
25
44
|
|
|
26
|
-
def __init__(self, session, help=HELP_LINK):
|
|
45
|
+
def __init__(self, session, title="PanelVisualInspection", help=HELP_LINK):
|
|
27
46
|
super().__init__(title="ITkDB Dashboard",
|
|
28
47
|
session=session,
|
|
29
48
|
show_search="Find object with given SN.",
|
|
30
49
|
help=help)
|
|
31
50
|
|
|
51
|
+
self.institute = "IFIC"
|
|
32
52
|
# action button in header
|
|
33
53
|
button = Gtk.Button()
|
|
34
54
|
icon = Gio.ThemedIcon(name="document-send-symbolic")
|
|
@@ -41,17 +61,36 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
41
61
|
grid = Gtk.Grid(column_spacing=5, row_spacing=1)
|
|
42
62
|
self.mainBox.pack_start(grid, False, False, 5)
|
|
43
63
|
|
|
64
|
+
irow = 0
|
|
65
|
+
receiver = self.create_institute_combo()
|
|
66
|
+
receiver.connect("changed", self.on_institute)
|
|
67
|
+
receiver.set_tooltip_text("Select the Institute making the test.")
|
|
68
|
+
dbGtkUtils.set_combo_iter(receiver, self.institute)
|
|
69
|
+
grid.attach(Gtk.Label(label="Institute"), 0, irow, 1, 1)
|
|
70
|
+
grid.attach(receiver, 1, irow, 1, 1)
|
|
71
|
+
|
|
72
|
+
irow += 1
|
|
44
73
|
lbl = Gtk.Label(label="Serial Number")
|
|
45
74
|
lbl.set_xalign(0)
|
|
46
|
-
grid.attach(lbl, 0,
|
|
75
|
+
grid.attach(lbl, 0, irow, 1, 1)
|
|
47
76
|
|
|
48
|
-
self.SN = dbGtkUtils.TextEntry()
|
|
77
|
+
self.SN = dbGtkUtils.TextEntry(small=True)
|
|
49
78
|
self.SN.connect("text_changed", self.SN_ready)
|
|
50
79
|
self.SN.widget.set_tooltip_text("Enter SN of PWD or Hybrid panel.")
|
|
51
|
-
grid.attach(self.SN.widget, 1,
|
|
80
|
+
grid.attach(self.SN.widget, 1, irow, 1, 1)
|
|
52
81
|
|
|
53
82
|
self.panel_type = Gtk.Label(label="")
|
|
54
|
-
grid.attach(self.panel_type, 2,
|
|
83
|
+
grid.attach(self.panel_type, 2, irow, 1, 1)
|
|
84
|
+
|
|
85
|
+
irow += 1
|
|
86
|
+
lbl = Gtk.Label(label="Date")
|
|
87
|
+
lbl.set_xalign(0)
|
|
88
|
+
grid.attach(lbl, 0, irow, 1, 1)
|
|
89
|
+
|
|
90
|
+
self.date = dbGtkUtils.TextEntry(small=True)
|
|
91
|
+
grid.attach(self.date.widget, 1, irow, 1, 1)
|
|
92
|
+
self.date.entry.set_text(ITkDButils.get_db_date())
|
|
93
|
+
self.date.connect("text_changed", self.new_date)
|
|
55
94
|
|
|
56
95
|
# Paned object
|
|
57
96
|
paned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
|
|
@@ -70,9 +109,26 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
70
109
|
|
|
71
110
|
dbGtkUtils.setup_scanner(self.get_qrcode)
|
|
72
111
|
|
|
112
|
+
def on_institute(self, combo):
|
|
113
|
+
"""A new recipient has been chosen."""
|
|
114
|
+
name = self.get_institute_from_combo(combo)
|
|
115
|
+
if name:
|
|
116
|
+
self.institute = name
|
|
117
|
+
|
|
118
|
+
def new_date(self, entry, value):
|
|
119
|
+
"""new date given at input."""
|
|
120
|
+
d = dbGtkUtils.parse_date_as_string(value)
|
|
121
|
+
if d is not None:
|
|
122
|
+
self.date.set_text(d)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def create_model(self):
|
|
126
|
+
"""Create tree view model."""
|
|
127
|
+
return Gtk.ListStore(str, bool, str, str, TestJson)
|
|
128
|
+
|
|
73
129
|
def create_tree_view(self, size=150):
|
|
74
130
|
"""Create the TreeView with the children."""
|
|
75
|
-
model =
|
|
131
|
+
model = self.create_model()
|
|
76
132
|
self.tree = Gtk.TreeView(model=model)
|
|
77
133
|
self.tree.connect("button-press-event", self.button_pressed)
|
|
78
134
|
|
|
@@ -80,7 +136,7 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
80
136
|
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
|
81
137
|
scrolled.add(self.tree)
|
|
82
138
|
scrolled.set_size_request(-1, size)
|
|
83
|
-
|
|
139
|
+
|
|
84
140
|
renderer = Gtk.CellRendererText()
|
|
85
141
|
column = Gtk.TreeViewColumn("SN", renderer, text=PanelVisualInspection.SN)
|
|
86
142
|
self.tree.append_column(column)
|
|
@@ -89,12 +145,12 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
89
145
|
renderer.set_property("activatable", True)
|
|
90
146
|
renderer.set_property("radio", True)
|
|
91
147
|
renderer.set_padding(5, 0)
|
|
92
|
-
|
|
148
|
+
|
|
93
149
|
x, y = renderer.get_alignment()
|
|
94
150
|
renderer.set_alignment(0, y)
|
|
95
151
|
# renderer.set_property("inconsistent", True)
|
|
96
152
|
renderer.connect("toggled", self.btn_toggled)
|
|
97
|
-
|
|
153
|
+
|
|
98
154
|
column = Gtk.TreeViewColumn("Passed", renderer, active=PanelVisualInspection.PASSED)
|
|
99
155
|
self.tree.append_column(column)
|
|
100
156
|
|
|
@@ -111,7 +167,7 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
111
167
|
model = self.tree.get_model()
|
|
112
168
|
val = not model[path][PanelVisualInspection.PASSED]
|
|
113
169
|
model[path][PanelVisualInspection.PASSED] = val
|
|
114
|
-
|
|
170
|
+
|
|
115
171
|
|
|
116
172
|
def button_pressed(self, tree, event):
|
|
117
173
|
"""Button pressed on tree view."""
|
|
@@ -139,12 +195,25 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
139
195
|
|
|
140
196
|
if not values:
|
|
141
197
|
return
|
|
142
|
-
|
|
198
|
+
|
|
143
199
|
menu = Gtk.Menu()
|
|
200
|
+
|
|
144
201
|
item_show = Gtk.MenuItem(label="Upload Image")
|
|
145
202
|
item_show.connect("activate", self.on_upload_image, (model, iter, values))
|
|
146
203
|
menu.append(item_show)
|
|
147
|
-
|
|
204
|
+
|
|
205
|
+
item_show_json = Gtk.MenuItem(label="Show JSOn")
|
|
206
|
+
item_show_json.connect("activate", self.on_show_json, (model, iter, values))
|
|
207
|
+
menu.append(item_show_json)
|
|
208
|
+
|
|
209
|
+
item_show_com = Gtk.MenuItem(label="Edit Comments")
|
|
210
|
+
item_show_com.connect("activate", self.on_show_comments, (model, iter, values))
|
|
211
|
+
menu.append(item_show_com)
|
|
212
|
+
|
|
213
|
+
item_show_def = Gtk.MenuItem(label="Edit Defects")
|
|
214
|
+
item_show_def.connect("activate", self.on_show_defects, (model, iter, values))
|
|
215
|
+
menu.append(item_show_def)
|
|
216
|
+
|
|
148
217
|
menu.show_all()
|
|
149
218
|
menu.popup_at_pointer(event)
|
|
150
219
|
|
|
@@ -156,19 +225,58 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
156
225
|
ifiles = [ipath for ipath in fdlg.get_filenames()]
|
|
157
226
|
if len(ifiles)<1:
|
|
158
227
|
return
|
|
159
|
-
|
|
228
|
+
|
|
160
229
|
if len(ifiles) > 1:
|
|
161
230
|
dbGtkUtils.complain("More than one file selected","Choosing first.")
|
|
162
|
-
|
|
231
|
+
|
|
163
232
|
fnam = ifiles[0]
|
|
164
233
|
model, iter, val = data
|
|
165
234
|
model.set_value(iter, PanelVisualInspection.F_PATH, fnam)
|
|
166
235
|
model.set_value(iter, PanelVisualInspection.F_NAME, Path(fnam).name)
|
|
167
|
-
|
|
168
|
-
|
|
236
|
+
|
|
237
|
+
|
|
169
238
|
self.write_message("Upload image\n")
|
|
170
239
|
|
|
171
240
|
|
|
241
|
+
def on_show_json(self, item, data):
|
|
242
|
+
"""Test JSon."""
|
|
243
|
+
model, iter, val = data
|
|
244
|
+
payload = val[PanelVisualInspection.TEST_J].js
|
|
245
|
+
value, dlg = create_json_data_editor(payload)
|
|
246
|
+
rc = dlg.run()
|
|
247
|
+
if rc == Gtk.ResponseType.OK:
|
|
248
|
+
payload = value.values
|
|
249
|
+
model.set_value(iter, PanelVisualInspection.TEST_J, TestJson(payload))
|
|
250
|
+
|
|
251
|
+
dlg.hide()
|
|
252
|
+
dlg.destroy()
|
|
253
|
+
|
|
254
|
+
def on_show_comments(self, item, data):
|
|
255
|
+
"""Show comments"""
|
|
256
|
+
model, iter, val = data
|
|
257
|
+
js = val[PanelVisualInspection.TEST_J].js
|
|
258
|
+
SC = ShowComments("Test Comments", js["comments"], self)
|
|
259
|
+
rc = SC.run()
|
|
260
|
+
if rc == Gtk.ResponseType.OK:
|
|
261
|
+
js["comments"] = SC.comments
|
|
262
|
+
model.set_value(iter, PanelVisualInspection.TEST_J, TestJson(js))
|
|
263
|
+
|
|
264
|
+
SC.hide()
|
|
265
|
+
SC.destroy()
|
|
266
|
+
|
|
267
|
+
def on_show_defects(self, item, data):
|
|
268
|
+
"""Show comments"""
|
|
269
|
+
model, iter, val = data
|
|
270
|
+
js = val[PanelVisualInspection.TEST_J].js
|
|
271
|
+
SD = ShowDefects("Test Defects", js["defects"], self)
|
|
272
|
+
rc = SD.run()
|
|
273
|
+
if rc == Gtk.ResponseType.OK:
|
|
274
|
+
js["defects"] = SD.defects
|
|
275
|
+
model.set_value(iter, PanelVisualInspection.TEST_J, TestJson(js))
|
|
276
|
+
|
|
277
|
+
SD.hide()
|
|
278
|
+
SD.destroy()
|
|
279
|
+
|
|
172
280
|
def SN_ready(self, *args):
|
|
173
281
|
"""SN is ready in the TextEnttry."""
|
|
174
282
|
SN = self.SN.get_text()
|
|
@@ -180,7 +288,14 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
180
288
|
|
|
181
289
|
SN = panel["serialNumber"]
|
|
182
290
|
args[0].set_text(SN)
|
|
183
|
-
|
|
291
|
+
is_PWB = False
|
|
292
|
+
defaults = {
|
|
293
|
+
"institution": self.institute,
|
|
294
|
+
"runNumber": "1",
|
|
295
|
+
"date": self.date.get_text()
|
|
296
|
+
}
|
|
297
|
+
component_type = None
|
|
298
|
+
test_code = None
|
|
184
299
|
if "USED" in SN:
|
|
185
300
|
# Powerboard Carrier
|
|
186
301
|
if not SN[6].isdigit():
|
|
@@ -190,15 +305,23 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
190
305
|
return
|
|
191
306
|
|
|
192
307
|
self.panel_type.set_text("PWB carrier")
|
|
308
|
+
is_PWB = True
|
|
309
|
+
component_type = "PWB"
|
|
310
|
+
test_code = "PICTURE"
|
|
193
311
|
|
|
194
312
|
elif "USET" in SN:
|
|
195
313
|
# Hybrid test panel
|
|
314
|
+
component_type = "HYBRID_TEST_PANEL"
|
|
315
|
+
test_code = "VISUAL_INSPECTION_RECEPTION"
|
|
316
|
+
|
|
196
317
|
if not SN[6].isdigit or int(SN[6])>5:
|
|
197
318
|
dbGtkUtils.complain("Not a Hybrid Test Panel",
|
|
198
319
|
"{}: wrong SN for a hybrid test panel".format(SN))
|
|
199
320
|
self.SN.widget.set_text("")
|
|
200
321
|
return
|
|
201
322
|
|
|
323
|
+
self.panel_type.set_text("HYB test panel")
|
|
324
|
+
|
|
202
325
|
else:
|
|
203
326
|
dbGtkUtils.complain("Invalid SN.",
|
|
204
327
|
"{}\nNot a PWB carrier not HYB test panel.".format(SN))
|
|
@@ -206,16 +329,14 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
206
329
|
return
|
|
207
330
|
|
|
208
331
|
# GEt children.
|
|
209
|
-
|
|
332
|
+
skltn = ITkDButils.get_test_skeleton(self.session, component_type, test_code, defaults)
|
|
333
|
+
model = self.create_model()
|
|
210
334
|
for child in panel["children"]:
|
|
211
335
|
if child["component"] is not None:
|
|
212
|
-
|
|
213
|
-
|
|
336
|
+
child_SN = child["component"]["serialNumber"]
|
|
337
|
+
skltn["component"] = child_SN
|
|
338
|
+
model.append([child_SN, True, "", "", TestJson(skltn)])
|
|
214
339
|
|
|
215
|
-
model = Gtk.ListStore(str, bool, str, str)
|
|
216
|
-
for child in children:
|
|
217
|
-
model.append([child, True, "", ""])
|
|
218
|
-
|
|
219
340
|
self.tree.set_model(model)
|
|
220
341
|
|
|
221
342
|
|
|
@@ -223,6 +344,32 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
223
344
|
"""Upload the current test."""
|
|
224
345
|
SN = self.SN.get_text()
|
|
225
346
|
|
|
347
|
+
model = self.tree.get_model()
|
|
348
|
+
iter = model.get_iter_first()
|
|
349
|
+
n_items = 0
|
|
350
|
+
while iter:
|
|
351
|
+
values = model[iter]
|
|
352
|
+
payload = values[PanelVisualInspection.TEST_J].js
|
|
353
|
+
ifile = values[PanelVisualInspection.F_PATH]
|
|
354
|
+
if len(ifile)>0:
|
|
355
|
+
attachments = [ITkDButils.Attachment(ifile, "Image", "Image")]
|
|
356
|
+
else:
|
|
357
|
+
attachments = []
|
|
358
|
+
|
|
359
|
+
rc = ITkDButils.upload_test(self.session, payload, attachments)
|
|
360
|
+
if rc:
|
|
361
|
+
ipos = rc.find("The following details may help:")
|
|
362
|
+
msg = rc[ipos:]
|
|
363
|
+
dbGtkUtils.complain("Failed uploading test {}-{}".format(payload["component"], payload["testType"]), msg)
|
|
364
|
+
self.write_message(msg)
|
|
365
|
+
|
|
366
|
+
else:
|
|
367
|
+
self.write_message("Upload {}-{} successfull\n".format(payload["component"], payload["testType"]))
|
|
368
|
+
|
|
369
|
+
n_items += 1
|
|
370
|
+
iter = model.iter_next(iter)
|
|
371
|
+
|
|
372
|
+
|
|
226
373
|
def get_qrcode(self, fd, state, reader):
|
|
227
374
|
"""Read SN from scanner."""
|
|
228
375
|
txt = dbGtkUtils.scanner_get_line(reader)
|
|
@@ -253,3 +400,6 @@ def main():
|
|
|
253
400
|
print("Arrrgggg!!!")
|
|
254
401
|
|
|
255
402
|
dlg.die()
|
|
403
|
+
|
|
404
|
+
if __name__ == "__main__":
|
|
405
|
+
main()
|
itkdb_gtk/PetalReceptionTests.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Test dashboard."""
|
|
3
|
-
import json
|
|
4
3
|
import sys
|
|
4
|
+
import copy
|
|
5
|
+
from pathlib import Path
|
|
5
6
|
|
|
6
7
|
try:
|
|
7
8
|
import itkdb_gtk
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
except ImportError:
|
|
10
|
-
from pathlib import Path
|
|
11
11
|
cwd = Path(__file__).parent.parent
|
|
12
12
|
sys.path.append(cwd.as_posix())
|
|
13
|
+
import itkdb_gtk
|
|
13
14
|
|
|
14
15
|
from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
|
|
15
16
|
|
|
@@ -66,7 +67,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
66
67
|
|
|
67
68
|
self.SN = itkdb_gtk.dbGtkUtils.TextEntry()
|
|
68
69
|
self.SN.connect("text-changed", self.on_SN_changed)
|
|
69
|
-
|
|
70
|
+
|
|
70
71
|
#self.SN = Gtk.Entry()
|
|
71
72
|
#self.SN.connect("focus-in-event", self.on_sn_enter)
|
|
72
73
|
#self.SN.connect("focus-out-event", self.on_sn_leave)
|
|
@@ -107,6 +108,8 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
107
108
|
self.create_test_box("Visual Inspection", "VISUAL_INSPECTION")
|
|
108
109
|
self.create_test_box("Grounding", "GROUNDING_CHECK")
|
|
109
110
|
self.create_test_box("Pipe bending", "BENDING120")
|
|
111
|
+
self.create_test_box("X-rays", "XRAYIMAGING")
|
|
112
|
+
|
|
110
113
|
|
|
111
114
|
# The text view
|
|
112
115
|
self.mainBox.pack_end(self.message_panel.frame, True, True, 5)
|
|
@@ -117,7 +120,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
117
120
|
"""New SN given. Ask in PDB,"""
|
|
118
121
|
if len(value) <= 0:
|
|
119
122
|
return None
|
|
120
|
-
|
|
123
|
+
|
|
121
124
|
self.query_db()
|
|
122
125
|
current_location = self.dbObject["currentLocation"]["code"]
|
|
123
126
|
dbGtkUtils.set_combo_iter(self.inst_cmb, current_location, 0)
|
|
@@ -134,7 +137,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
134
137
|
for i in range(npages):
|
|
135
138
|
page = self.notebook.get_nth_page(i)
|
|
136
139
|
page.dict_dialog.factory_reset()
|
|
137
|
-
|
|
140
|
+
|
|
138
141
|
|
|
139
142
|
def create_test_box(self, label, test_name, institute="IFIC"):
|
|
140
143
|
"""Create and add to notebook a test dialog.
|
|
@@ -213,6 +216,27 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
213
216
|
page.dict_dialog.values["institution"] = self.institute
|
|
214
217
|
page.dict_dialog.refresh()
|
|
215
218
|
|
|
219
|
+
def upload_this_test(self, values):
|
|
220
|
+
"""Upload a single test."""
|
|
221
|
+
# print(json.dumps(values, indent=2))
|
|
222
|
+
|
|
223
|
+
attachments = []
|
|
224
|
+
if values["testType"] == "XRAYIMAGING":
|
|
225
|
+
fnam = values["results"]["IMAGELINK"]
|
|
226
|
+
if fnam is not None and len(fnam)>0:
|
|
227
|
+
P = Path(fnam).expanduser().resolve()
|
|
228
|
+
if P.exists():
|
|
229
|
+
A = ITkDButils.Attachment(P.as_posix(), P.name, "X-ray image")
|
|
230
|
+
values["results"]["IMAGELINK"] = P.name
|
|
231
|
+
attachments.append(A)
|
|
232
|
+
|
|
233
|
+
rc = ITkDButils.upload_test(self.session, values, attachments=attachments)
|
|
234
|
+
if rc is not None:
|
|
235
|
+
dbGtkUtils.complain("Could not upload test", rc)
|
|
236
|
+
|
|
237
|
+
else:
|
|
238
|
+
self.write_message("Test uploaded. {} - {}\n".format(values["component"], values["testType"]))
|
|
239
|
+
|
|
216
240
|
def upload_single_test(self, *args):
|
|
217
241
|
"""Upload the current test."""
|
|
218
242
|
SN = self.SN.get_text()
|
|
@@ -225,16 +249,9 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
225
249
|
if dctD is None:
|
|
226
250
|
return
|
|
227
251
|
|
|
228
|
-
values = dctD.values
|
|
252
|
+
values = copy.deepcopy(dctD.values)
|
|
229
253
|
values["component"] = SN
|
|
230
|
-
|
|
231
|
-
rc = ITkDButils.upload_test(self.session, values)
|
|
232
|
-
if rc is not None:
|
|
233
|
-
dbGtkUtils.complain("Could not upload test", rc)
|
|
234
|
-
|
|
235
|
-
else:
|
|
236
|
-
dbGtkUtils.ask_for_confirmation("Test uploaded.",
|
|
237
|
-
"{} - {}".format(values["component"], values["testType"]))
|
|
254
|
+
self.upload_this_test(values)
|
|
238
255
|
|
|
239
256
|
def upload_tests(self, *args):
|
|
240
257
|
"""Upload the current test."""
|
|
@@ -251,14 +268,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
251
268
|
|
|
252
269
|
values = dctD.values
|
|
253
270
|
values["component"] = SN
|
|
254
|
-
|
|
255
|
-
rc = ITkDButils.upload_test(self.session, values)
|
|
256
|
-
if rc is not None:
|
|
257
|
-
dbGtkUtils.complain("Could not upload test", rc)
|
|
258
|
-
|
|
259
|
-
else:
|
|
260
|
-
self.write_message("Test uploaded. {} - {}\n".format(values["component"], values["testType"]))
|
|
261
|
-
|
|
271
|
+
self.upload_this_test(values)
|
|
262
272
|
|
|
263
273
|
def main():
|
|
264
274
|
"""Main entry."""
|
itkdb_gtk/UploadMultipleTests.py
CHANGED
|
@@ -469,7 +469,7 @@ class UploadMultipleTests(dbGtkUtils.ITkDBWindow):
|
|
|
469
469
|
if path.exists():
|
|
470
470
|
path = path.expanduser().resolve()
|
|
471
471
|
else:
|
|
472
|
-
path = folder / path
|
|
472
|
+
path = folder / path.name
|
|
473
473
|
|
|
474
474
|
if path.exists():
|
|
475
475
|
attachments.append(ITkDButils.Attachment(path, att["title"], att["description"]))
|
itkdb_gtk/WireBondGui.py
CHANGED
itkdb_gtk/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
""" itkdb-gtk python module
|
|
2
2
|
"""
|
|
3
|
-
__version__ = "0.10.
|
|
3
|
+
__version__ = "0.10.9.dev1"
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def dash_board():
|
|
@@ -57,3 +57,8 @@ def uploadPetalInformation():
|
|
|
57
57
|
"""Read files from AVS nd create Petal core in PDB."""
|
|
58
58
|
from .UploadPetalInformation import main
|
|
59
59
|
main()
|
|
60
|
+
|
|
61
|
+
def panelVisualInspection():
|
|
62
|
+
"""Visual inspection of PWB or HYB panels."""
|
|
63
|
+
from .panelVisualInspection import main
|
|
64
|
+
main()
|
itkdb_gtk/dashBoard.py
CHANGED
|
@@ -21,6 +21,7 @@ from itkdb_gtk import UploadMultipleTests
|
|
|
21
21
|
from itkdb_gtk import GlueWeight
|
|
22
22
|
from itkdb_gtk import UploadModuleIV
|
|
23
23
|
from itkdb_gtk import WireBondGui
|
|
24
|
+
from itkdb_gtk import PanelVisualInspection
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
HAS_PETALQC=False
|
|
@@ -51,8 +52,10 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
51
52
|
GLUE_WEIGHT = 6
|
|
52
53
|
MOD_IV = 7
|
|
53
54
|
WIRE_BOND = 8
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
PANEL_VI = 9
|
|
56
|
+
PETAL_CORE_METRO = 10
|
|
57
|
+
PETAL_CORE_THERMAL = 11
|
|
58
|
+
|
|
56
59
|
|
|
57
60
|
def __init__(self, session):
|
|
58
61
|
"""Initialization."""
|
|
@@ -102,6 +105,12 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
102
105
|
btnWireBond = Gtk.Button(label="Wire Bond")
|
|
103
106
|
btnWireBond.connect("clicked", self.wire_bond)
|
|
104
107
|
grid.attach(btnWireBond, 1, irow, 1, 1)
|
|
108
|
+
|
|
109
|
+
irow += 1
|
|
110
|
+
btnModIV = Gtk.Button(label="Panel Visual Insp.")
|
|
111
|
+
btnModIV.connect("clicked", self.panel_VI)
|
|
112
|
+
grid.attach(btnModIV, 0, irow, 1, 1)
|
|
113
|
+
|
|
105
114
|
|
|
106
115
|
if HAS_PETALQC:
|
|
107
116
|
irow +=1
|
|
@@ -225,6 +234,19 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
225
234
|
W.connect("destroy", self.app_closed, bitn)
|
|
226
235
|
W.show_all()
|
|
227
236
|
|
|
237
|
+
def panel_VI(self, *args):
|
|
238
|
+
"""Panel VI tests."""
|
|
239
|
+
bitn = DashWindow.PANEL_VI
|
|
240
|
+
bt = 1 << bitn
|
|
241
|
+
if self.mask & bt:
|
|
242
|
+
return
|
|
243
|
+
|
|
244
|
+
self.mask |= bt
|
|
245
|
+
W = PanelVisualInspection.PanelVisualInspection(session=self.session, title="Panel Visual Inspection", help=HELP_LINK)
|
|
246
|
+
W.connect("destroy", self.app_closed, bitn)
|
|
247
|
+
W.show_all()
|
|
248
|
+
|
|
249
|
+
|
|
228
250
|
def petal_metrology(self, *args):
|
|
229
251
|
"""Do petal metrology"""
|
|
230
252
|
if not HAS_PETALQC:
|
itkdb_gtk/dbGtkUtils.py
CHANGED
|
@@ -69,6 +69,10 @@ def parse_date_as_string(txt):
|
|
|
69
69
|
def is_a_date(txt):
|
|
70
70
|
"""check tha the input string is a date."""
|
|
71
71
|
try:
|
|
72
|
+
tl = txt.lower()
|
|
73
|
+
if len(txt)<5 and (tl!="now" and tl!="today"):
|
|
74
|
+
return False
|
|
75
|
+
|
|
72
76
|
dateutil.parser.parse(txt, fuzzy=False)
|
|
73
77
|
return True
|
|
74
78
|
|
|
@@ -94,7 +98,7 @@ def set_entry_style(container):
|
|
|
94
98
|
css = "{} {{ min-height: {}px; }}".format(container.get_name(), font_size)
|
|
95
99
|
provider.load_from_data(css.encode())
|
|
96
100
|
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS)
|
|
97
|
-
return container
|
|
101
|
+
return container
|
|
98
102
|
|
|
99
103
|
def set_button_color(btn, bg_color, fg_color="white"):
|
|
100
104
|
"""Set button color"""
|
|
@@ -103,7 +107,7 @@ def set_button_color(btn, bg_color, fg_color="white"):
|
|
|
103
107
|
provider.load_from_data(css.encode())
|
|
104
108
|
style_context = btn.get_style_context()
|
|
105
109
|
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
|
106
|
-
|
|
110
|
+
|
|
107
111
|
def set_combo_iter(combo, txt, col=0):
|
|
108
112
|
"""Set scombo active iter to that containing txt in column col."""
|
|
109
113
|
model = combo.get_model()
|
|
@@ -247,7 +251,7 @@ class TextEntry(GObject.GObject):
|
|
|
247
251
|
self.widget = new_small_text_entry()
|
|
248
252
|
else:
|
|
249
253
|
self.widget = Gtk.Entry()
|
|
250
|
-
|
|
254
|
+
|
|
251
255
|
self.widget.connect("focus-in-event", self.on_enter)
|
|
252
256
|
self.widget.connect("focus-out-event", self.on_leave)
|
|
253
257
|
|
|
@@ -480,7 +484,7 @@ class MessagePanel(object):
|
|
|
480
484
|
|
|
481
485
|
self.textbuffer.insert(end, msg)
|
|
482
486
|
GLib.idle_add(self.scroll_to_end)
|
|
483
|
-
|
|
487
|
+
|
|
484
488
|
def write(self, txt):
|
|
485
489
|
"""A write method."""
|
|
486
490
|
self.write_message(txt, write_date=False)
|
|
@@ -533,7 +537,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
533
537
|
button.set_tooltip_text(show_search)
|
|
534
538
|
button.connect("clicked", self.query_db)
|
|
535
539
|
self.hb.pack_end(button)
|
|
536
|
-
|
|
540
|
+
|
|
537
541
|
if self.help:
|
|
538
542
|
button = Gtk.Button()
|
|
539
543
|
icon = Gio.ThemedIcon(name="help-browser-symbolic")
|
|
@@ -541,7 +545,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
541
545
|
button.add(image)
|
|
542
546
|
button.connect("clicked", self.show_help)
|
|
543
547
|
self.hb.pack_end(button)
|
|
544
|
-
|
|
548
|
+
|
|
545
549
|
|
|
546
550
|
# Create main content box
|
|
547
551
|
self.mainBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
@@ -570,7 +574,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
570
574
|
def show_help(self, *args):
|
|
571
575
|
"""Show help"""
|
|
572
576
|
webbrowser.open(self.help)
|
|
573
|
-
|
|
577
|
+
|
|
574
578
|
def query_db(self, *args):
|
|
575
579
|
"""Search button clicked."""
|
|
576
580
|
pass
|
|
@@ -580,7 +584,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
580
584
|
if msg == "<OK>":
|
|
581
585
|
if hasattr(self.session, "user_gui"):
|
|
582
586
|
self.session = self.session.user_gui.get_client()
|
|
583
|
-
|
|
587
|
+
|
|
584
588
|
if self.userLabel.get_child():
|
|
585
589
|
self.userLabel.get_child().set_text(self.session.user.name)
|
|
586
590
|
|
|
@@ -725,7 +729,7 @@ class DictDialog(Gtk.Grid):
|
|
|
725
729
|
else:
|
|
726
730
|
if itm[last_key] is None:
|
|
727
731
|
itm[last_key] = txt
|
|
728
|
-
else:
|
|
732
|
+
else:
|
|
729
733
|
tp = type(itm[last_key])
|
|
730
734
|
itm[last_key] = tp(txt)
|
|
731
735
|
|
|
@@ -765,6 +769,7 @@ class DictDialog(Gtk.Grid):
|
|
|
765
769
|
css = "entry {{ min-height: {}px; }}".format(font_size)
|
|
766
770
|
provider.load_from_data(css.encode())
|
|
767
771
|
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS)
|
|
772
|
+
container.connect("populate-popup", self.add_insert_path)
|
|
768
773
|
|
|
769
774
|
if name:
|
|
770
775
|
container.set_name(name)
|
|
@@ -775,6 +780,28 @@ class DictDialog(Gtk.Grid):
|
|
|
775
780
|
|
|
776
781
|
return container
|
|
777
782
|
|
|
783
|
+
def add_insert_path(self, entry, menu, *args):
|
|
784
|
+
"""Adds a new item in the pop-up menu."""
|
|
785
|
+
item = Gtk.MenuItem(label="Get file path")
|
|
786
|
+
item.connect("activate", self.on_set_path, entry)
|
|
787
|
+
menu.append(item)
|
|
788
|
+
menu.show_all()
|
|
789
|
+
|
|
790
|
+
def on_set_path(self, menu_item, entry):
|
|
791
|
+
"""Sets the path to the entry."""
|
|
792
|
+
fdlg = Gtk.FileChooserNative(action=Gtk.FileChooserAction.OPEN, accept_label="Select")
|
|
793
|
+
response = fdlg.run()
|
|
794
|
+
if response == Gtk.ResponseType.ACCEPT:
|
|
795
|
+
ifiles = [ipath for ipath in fdlg.get_filenames()]
|
|
796
|
+
if len(ifiles)<1:
|
|
797
|
+
return
|
|
798
|
+
if len(ifiles) > 1:
|
|
799
|
+
complain("More than one file selected","Choosing first.")
|
|
800
|
+
|
|
801
|
+
fnam = ifiles[0]
|
|
802
|
+
entry.set_text(fnam)
|
|
803
|
+
self.on_leave(entry, None, None, entry.get_name())
|
|
804
|
+
|
|
778
805
|
def set_value(self, key, value):
|
|
779
806
|
"""Set value of a container and key."""
|
|
780
807
|
try:
|
|
@@ -815,7 +842,7 @@ class DictDialog(Gtk.Grid):
|
|
|
815
842
|
self.show_values()
|
|
816
843
|
self.show_all()
|
|
817
844
|
self.queue_draw()
|
|
818
|
-
|
|
845
|
+
|
|
819
846
|
@staticmethod
|
|
820
847
|
def create_json_data_editor(data):
|
|
821
848
|
"""Create a dialog to show the JSon file."""
|
|
@@ -835,7 +862,7 @@ class DictDialog(Gtk.Grid):
|
|
|
835
862
|
rc = dlg.run()
|
|
836
863
|
dlg.hide()
|
|
837
864
|
dlg.destroy()
|
|
838
|
-
|
|
865
|
+
|
|
839
866
|
return value.values, rc
|
|
840
867
|
|
|
841
868
|
|
|
@@ -844,7 +871,7 @@ def create_scrolled_dictdialog(the_dict, hidden=("component", "testType")):
|
|
|
844
871
|
|
|
845
872
|
Args:
|
|
846
873
|
the_dict: the input dictionary with values.
|
|
847
|
-
|
|
874
|
+
|
|
848
875
|
Returns:
|
|
849
876
|
scrolled: the scrolled window
|
|
850
877
|
gM: the DictDialog
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itkdb_gtk
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.9.dev1
|
|
4
4
|
Summary: A collection of Gtk based GUI to access ITkDB.
|
|
5
5
|
Author-email: Carlos Lacasta <carlos.lacasta@cern.ch>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.cern.ch/atlas-itk/sw/db/itk-pdb-gtk-gui-utils
|
|
@@ -16,6 +16,7 @@ Requires-Dist: openpyxl
|
|
|
16
16
|
Requires-Dist: pyserial
|
|
17
17
|
Requires-Dist: python-dateutil
|
|
18
18
|
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: PyGObject
|
|
19
20
|
|
|
20
21
|
# Interaction with the ITk PDB.
|
|
21
22
|
|
|
@@ -3,27 +3,27 @@ itkdb_gtk/GetShipments.py,sha256=Bj46Y-Q1O9yxLd5ZvQF6uoLRIU4hAhPmBfjQGmqqF0I,181
|
|
|
3
3
|
itkdb_gtk/GlueWeight.py,sha256=4oZOinyHPqG0Pk6AmEVKd_dFDZWPoLrx7ywCmhodveE,12258
|
|
4
4
|
itkdb_gtk/ITkDB.desktop,sha256=v_K4mHsDxb912J1XGo6mOlbW2TkHvYNGrKmiOnsBQqM,172
|
|
5
5
|
itkdb_gtk/ITkDB.svg,sha256=Ry702zrUkxvG61SqThbUNfXySyiLMqalwYpcM-b_KWo,24242
|
|
6
|
-
itkdb_gtk/ITkDBlogin.py,sha256=
|
|
6
|
+
itkdb_gtk/ITkDBlogin.py,sha256=b1xALIdGE2BIUMYbwpaUqBZmCXQcO4hNhnMMwIkpIwo,9947
|
|
7
7
|
itkdb_gtk/ITkDButils.py,sha256=mvlo5F01_B0CZX-GZMkUHRzZSNR1A8IWrGtMRRwGFq4,15635
|
|
8
|
-
itkdb_gtk/PanelVisualInspection.py,sha256=
|
|
9
|
-
itkdb_gtk/PetalReceptionTests.py,sha256=
|
|
8
|
+
itkdb_gtk/PanelVisualInspection.py,sha256=KYMrlIoXpHx2z9YMCBLtqheVDJQyyIYykUFpRnWLGeo,13159
|
|
9
|
+
itkdb_gtk/PetalReceptionTests.py,sha256=y15sTg_ZnW8IYPPHCZyiPWIYPoGzevemsA8Kor5i0TE,9622
|
|
10
10
|
itkdb_gtk/SensorUtils.py,sha256=S2Mc-Z1webACisj6waJcMqiqzoGSE7TYScVfxHSD700,15458
|
|
11
11
|
itkdb_gtk/ShowAttachments.py,sha256=1pZo3P_yZwD0IyhbNyeqOE71mXkwuFYAK5bsBy2P-cI,8404
|
|
12
12
|
itkdb_gtk/ShowComments.py,sha256=OiMTFLnhGbbKRj5x61D517BYHAt-qY5Y1lvR3EQz3c0,3151
|
|
13
13
|
itkdb_gtk/ShowDefects.py,sha256=aVAHeaE5IztmAPEuHwhi06KWo_pi9xX2J1fTLhKyAPI,3530
|
|
14
14
|
itkdb_gtk/UploadModuleIV.py,sha256=L5hndmkRf6cho5ZaBVLaczbPm5DzkmLKwI3IpirVv5U,17749
|
|
15
|
-
itkdb_gtk/UploadMultipleTests.py,sha256=
|
|
15
|
+
itkdb_gtk/UploadMultipleTests.py,sha256=3cwEqq2CmWf-kEHxoXMv98tg4BXztqW-BWD9iyytl2k,22144
|
|
16
16
|
itkdb_gtk/UploadPetalInformation.py,sha256=No7gQEUoO5HJP3Ch3t_j99_xCD9BWrb-PWsDUo7sU6M,24746
|
|
17
17
|
itkdb_gtk/UploadTest.py,sha256=NyNX2itqbMvp4g7XZp5QvXKYZ-ILJrwzcLckLmSDuPw,16570
|
|
18
|
-
itkdb_gtk/WireBondGui.py,sha256=
|
|
19
|
-
itkdb_gtk/__init__.py,sha256=
|
|
20
|
-
itkdb_gtk/dashBoard.py,sha256=
|
|
21
|
-
itkdb_gtk/dbGtkUtils.py,sha256=
|
|
18
|
+
itkdb_gtk/WireBondGui.py,sha256=e0asNrZUNmDKjqIXR3qcEsinSzX-Z7q71sIV2abcg2g,27179
|
|
19
|
+
itkdb_gtk/__init__.py,sha256=tEKI2Bgk2luSbW1DPnWrj9e7799uKZW2BP7hJaxxoS4,1291
|
|
20
|
+
itkdb_gtk/dashBoard.py,sha256=2V-AWb4AaqqoX0J9QmamlXXwqdZTSY2lFkXSmY8biIE,8974
|
|
21
|
+
itkdb_gtk/dbGtkUtils.py,sha256=cJhlf8EZaQWOItVLfEHauN_Fb6WPep2vsmnU3pJirSc,28878
|
|
22
22
|
itkdb_gtk/readAVSdata.py,sha256=Sc_pXrzYkGDIF5-0pHYLATQQoRb8gbHmi9jz64v267Y,23439
|
|
23
23
|
itkdb_gtk/readGoogleSheet.py,sha256=Lzm_oPWwDqZZzKoBUgsp277F9-wCfr_BA0X4VD2Eolo,2673
|
|
24
24
|
itkdb_gtk/untrash_component.py,sha256=VrN46-f-kF7voOxtoh7OL-bZSWAaIFb7-Xbx6_WT7K8,757
|
|
25
|
-
itkdb_gtk-0.10.
|
|
26
|
-
itkdb_gtk-0.10.
|
|
27
|
-
itkdb_gtk-0.10.
|
|
28
|
-
itkdb_gtk-0.10.
|
|
29
|
-
itkdb_gtk-0.10.
|
|
25
|
+
itkdb_gtk-0.10.9.dev1.dist-info/METADATA,sha256=B1abk8-sB6o-7HI0E3n59oOZMPiC1mWYLCs8dRG2tec,3155
|
|
26
|
+
itkdb_gtk-0.10.9.dev1.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
27
|
+
itkdb_gtk-0.10.9.dev1.dist-info/entry_points.txt,sha256=Xf_DDU3QlT2zogRFMOJdO4BdVuAKyAwmb2jHZ5KbBxE,501
|
|
28
|
+
itkdb_gtk-0.10.9.dev1.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
|
|
29
|
+
itkdb_gtk-0.10.9.dev1.dist-info/RECORD,,
|
|
@@ -3,6 +3,7 @@ createShipments = itkdb_gtk:createShipments
|
|
|
3
3
|
getShipments = itkdb_gtk:getShipments
|
|
4
4
|
glueWeight = itkdb_gtk:glueWeight
|
|
5
5
|
itkdb_dashBoard = itkdb_gtk:dash_board
|
|
6
|
+
panelVisualInspection = itkdb_gtk:panelVisualInspection
|
|
6
7
|
petalReceptionTests = itkdb_gtk:petalReceptionTests
|
|
7
8
|
uploadModuleIV = itkdb_gtk:uploadModuleIV
|
|
8
9
|
uploadMultipleTests = itkdb_gtk:uploadMultipleTests
|
|
File without changes
|