itkdb-gtk 0.9.1.dev1__py3-none-any.whl → 0.10.0__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/CreateShipments.py +41 -55
- itkdb_gtk/GetShipments.py +2 -19
- itkdb_gtk/GlueWeight.py +1 -1
- itkdb_gtk/ITkDButils.py +24 -12
- itkdb_gtk/PanelVisualInspection.py +230 -0
- itkdb_gtk/PetalReceptionTests.py +2 -2
- itkdb_gtk/UploadModuleIV.py +1 -1
- itkdb_gtk/UploadPetalInformation.py +164 -94
- itkdb_gtk/UploadTest.py +1 -1
- itkdb_gtk/__init__.py +1 -1
- itkdb_gtk/dbGtkUtils.py +73 -3
- itkdb_gtk/readAVSdata.py +204 -72
- {itkdb_gtk-0.9.1.dev1.dist-info → itkdb_gtk-0.10.0.dist-info}/METADATA +1 -1
- itkdb_gtk-0.10.0.dist-info/RECORD +29 -0
- itkdb_gtk-0.9.1.dev1.dist-info/RECORD +0 -28
- {itkdb_gtk-0.9.1.dev1.dist-info → itkdb_gtk-0.10.0.dist-info}/WHEEL +0 -0
- {itkdb_gtk-0.9.1.dev1.dist-info → itkdb_gtk-0.10.0.dist-info}/entry_points.txt +0 -0
- {itkdb_gtk-0.9.1.dev1.dist-info → itkdb_gtk-0.10.0.dist-info}/top_level.txt +0 -0
itkdb_gtk/CreateShipments.py
CHANGED
|
@@ -5,6 +5,7 @@ Items can be added via a QR reader.
|
|
|
5
5
|
"""
|
|
6
6
|
import pathlib
|
|
7
7
|
import sys
|
|
8
|
+
import re
|
|
8
9
|
|
|
9
10
|
try:
|
|
10
11
|
import itkdb_gtk
|
|
@@ -17,7 +18,6 @@ except ImportError:
|
|
|
17
18
|
from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
|
|
18
19
|
|
|
19
20
|
import gi
|
|
20
|
-
import serial
|
|
21
21
|
gi.require_version("Gtk", "3.0")
|
|
22
22
|
from gi.repository import Gtk, Gio, GLib
|
|
23
23
|
|
|
@@ -50,7 +50,7 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
50
50
|
self.set_border_width(10)
|
|
51
51
|
|
|
52
52
|
# intercept keyboard
|
|
53
|
-
|
|
53
|
+
dbGtkUtils.setup_scanner(self.get_qrcode)
|
|
54
54
|
|
|
55
55
|
# Prepare HeaderBar
|
|
56
56
|
self.hb.props.title = "Create Shipment"
|
|
@@ -97,8 +97,8 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
97
97
|
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
|
98
98
|
self.mainBox.pack_start(box, False, False, 0)
|
|
99
99
|
|
|
100
|
-
dbGtkUtils.add_button_to_container(box, "Add
|
|
101
|
-
"Click to add a new
|
|
100
|
+
dbGtkUtils.add_button_to_container(box, "Add Items",
|
|
101
|
+
"Click to add a new items.\nAdd SNs separated by\n\tnew line,\n\ttab\n\tespace or\n\tcomma.",
|
|
102
102
|
self.add_item)
|
|
103
103
|
|
|
104
104
|
dbGtkUtils.add_button_to_container(box, "Remove Item",
|
|
@@ -176,43 +176,46 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
176
176
|
|
|
177
177
|
def add_item(self, *args):
|
|
178
178
|
"""Add new item."""
|
|
179
|
-
# We will get the input either from a Dialog or from the QR
|
|
179
|
+
# We will get the input either from a Dialog or from the QR reader.
|
|
180
180
|
# For the later we get the SN in the argument list.
|
|
181
181
|
if isinstance(args[0], Gtk.Button):
|
|
182
|
-
|
|
182
|
+
txt = dbGtkUtils.get_a_value("Enter item SN", is_tv=True)
|
|
183
|
+
tmp = re.split(';|,| |\n|\t', txt)
|
|
184
|
+
SNlist = [s.strip() for s in tmp if len(s.strip())>0]
|
|
183
185
|
else:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
try:
|
|
187
|
-
# Check that the object exists and get some information about it.
|
|
188
|
-
rc = ITkDButils.get_DB_component(self.session, SN)
|
|
189
|
-
if 'inTransit' in rc and rc['inTransit']:
|
|
190
|
-
dbGtkUtils.complain("Item {} is already in transit".format(SN),
|
|
191
|
-
"This item is already in transit to {}".format(rc['shipmentDestination']['code']))
|
|
192
|
-
return
|
|
193
|
-
nick = rc['alternativeIdentifier']
|
|
194
|
-
id = rc['id']
|
|
195
|
-
obj = rc['componentType']['name']
|
|
196
|
-
loc = rc['currentLocation']['code']
|
|
197
|
-
|
|
198
|
-
# Check tha tthe input is not already there
|
|
199
|
-
model = self.tree.get_model()
|
|
200
|
-
iter = model.get_iter_first()
|
|
201
|
-
while iter:
|
|
202
|
-
if model.get_value(iter, 0) == SN:
|
|
203
|
-
dbGtkUtils.complain("Duplicated item.",
|
|
204
|
-
"Object {} is already in the list".format(SN))
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
iter = model.iter_next(iter)
|
|
208
|
-
|
|
209
|
-
# Add the item in the liststore.
|
|
210
|
-
model.append([SN, nick, obj, loc, id])
|
|
186
|
+
SNlist = [args[0]]
|
|
211
187
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
188
|
+
for SN in SNlist:
|
|
189
|
+
try:
|
|
190
|
+
# Check that the object exists and get some information about it.
|
|
191
|
+
rc = ITkDButils.get_DB_component(self.session, SN)
|
|
192
|
+
if 'inTransit' in rc and rc['inTransit']:
|
|
193
|
+
dbGtkUtils.complain("Item {} is already in transit".format(SN),
|
|
194
|
+
"This item is already in transit to {}".format(rc['shipmentDestination']['code']))
|
|
195
|
+
return
|
|
196
|
+
nick = rc['alternativeIdentifier']
|
|
197
|
+
id = rc['id']
|
|
198
|
+
obj = rc['componentType']['name']
|
|
199
|
+
loc = rc['currentLocation']['code']
|
|
200
|
+
|
|
201
|
+
# Check tha tthe input is not already there
|
|
202
|
+
model = self.tree.get_model()
|
|
203
|
+
iter = model.get_iter_first()
|
|
204
|
+
while iter:
|
|
205
|
+
if model.get_value(iter, 0) == SN:
|
|
206
|
+
dbGtkUtils.complain("Duplicated item.",
|
|
207
|
+
"Object {} is already in the list".format(SN))
|
|
208
|
+
return
|
|
209
|
+
|
|
210
|
+
iter = model.iter_next(iter)
|
|
211
|
+
|
|
212
|
+
# Add the item in the liststore.
|
|
213
|
+
model.append([SN, nick, obj, loc, id])
|
|
214
|
+
|
|
215
|
+
except Exception:
|
|
216
|
+
dbGtkUtils.complain("Error querying DB",
|
|
217
|
+
"object {} does not exist.".format(SN))
|
|
218
|
+
print(ITkDButils.get_db_response())
|
|
216
219
|
|
|
217
220
|
def remove_item(self, *args):
|
|
218
221
|
"""Remove selected item."""
|
|
@@ -289,26 +292,9 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
289
292
|
else:
|
|
290
293
|
self.write_message("No attachment found\n")
|
|
291
294
|
|
|
292
|
-
def setup_scanner(self):
|
|
293
|
-
"""Setup scanner."""
|
|
294
|
-
for fnam in ["/dev/ttyACM0", "/dev/cu.usbmodemS_N_G19F204881"]:
|
|
295
|
-
P = pathlib.Path(fnam)
|
|
296
|
-
if P.exists():
|
|
297
|
-
rdr = serial.Serial(fnam, 9600)
|
|
298
|
-
GLib.unix_fd_add_full(GLib.PRIORITY_DEFAULT, rdr.fileno(), GLib.IOCondition.IN, self.get_qrcode, rdr)
|
|
299
|
-
break
|
|
300
|
-
|
|
301
295
|
def get_qrcode(self, fd, state, reader):
|
|
302
296
|
"""Gets data from QR scanner."""
|
|
303
|
-
|
|
304
|
-
while True:
|
|
305
|
-
delta = reader.in_waiting - available
|
|
306
|
-
if not delta:
|
|
307
|
-
break
|
|
308
|
-
|
|
309
|
-
# Get data from serial device passed in via
|
|
310
|
-
data = reader.read_until(expected='\r', size=reader.in_waiting).strip()
|
|
311
|
-
txt = data.decode('utf-8')
|
|
297
|
+
txt = dbGtkUtils.scanner_get_line(reader)
|
|
312
298
|
self.write_message("{}\n".format(txt))
|
|
313
299
|
|
|
314
300
|
# Try to add item to the list
|
itkdb_gtk/GetShipments.py
CHANGED
|
@@ -54,7 +54,7 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
54
54
|
self.set_border_width(10)
|
|
55
55
|
|
|
56
56
|
# intercept keyboard
|
|
57
|
-
|
|
57
|
+
dbGtkUtils.setup_scanner(self.get_qrcode)
|
|
58
58
|
|
|
59
59
|
# Prepare HeaderBar
|
|
60
60
|
self.hb.props.title = "{} shipments".format(self.recipient)
|
|
@@ -154,26 +154,9 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
154
154
|
|
|
155
155
|
return scrolled
|
|
156
156
|
|
|
157
|
-
def setup_scanner(self):
|
|
158
|
-
"""Setup scanner."""
|
|
159
|
-
for fnam in ["/dev/ttyACM0", "/dev/cu.usbmodemS_N_G19F204881"]:
|
|
160
|
-
P = pathlib.Path(fnam)
|
|
161
|
-
if P.exists():
|
|
162
|
-
rdr = serial.Serial(fnam, 9600)
|
|
163
|
-
GLib.unix_fd_add_full(GLib.PRIORITY_DEFAULT, rdr.fileno(), GLib.IOCondition.IN, self.get_qrcode, rdr)
|
|
164
|
-
break
|
|
165
|
-
|
|
166
157
|
def get_qrcode(self, fd, state, reader):
|
|
167
158
|
"""Gets data from QR scanner."""
|
|
168
|
-
|
|
169
|
-
while True:
|
|
170
|
-
delta = reader.in_waiting - available
|
|
171
|
-
if not delta:
|
|
172
|
-
break
|
|
173
|
-
|
|
174
|
-
# Get data from serial device passed in via
|
|
175
|
-
data = reader.read_until(expected='\r', size=reader.in_waiting).strip()
|
|
176
|
-
txt = data.decode('utf-8')
|
|
159
|
+
txt = dbGtkUtils.scanner_get_line(reader)
|
|
177
160
|
self.write_message("{}\n".format(txt))
|
|
178
161
|
|
|
179
162
|
# search code in the list
|
itkdb_gtk/GlueWeight.py
CHANGED
|
@@ -113,7 +113,7 @@ class GlueWeight(Gtk.Window):
|
|
|
113
113
|
session, "MODULE", "GLUE_WEIGHT", defaults)
|
|
114
114
|
|
|
115
115
|
if gtk_runs:
|
|
116
|
-
super().__init__(title="Upload Glue Weight"
|
|
116
|
+
super().__init__(title="Upload Glue Weight")
|
|
117
117
|
self.init_window()
|
|
118
118
|
|
|
119
119
|
def init_window(self):
|
itkdb_gtk/ITkDButils.py
CHANGED
|
@@ -228,10 +228,19 @@ def set_object_stage(client, SN, stage):
|
|
|
228
228
|
def get_DB_component(client, SN):
|
|
229
229
|
"""Get ta component by its serial number."""
|
|
230
230
|
global db_response
|
|
231
|
+
|
|
231
232
|
try:
|
|
232
|
-
db_response = client.get(
|
|
233
|
+
db_response = client.get("getComponent", json={"component": SN})
|
|
233
234
|
return db_response
|
|
234
235
|
|
|
236
|
+
except Exception as e:
|
|
237
|
+
db_response = str(e)
|
|
238
|
+
|
|
239
|
+
try:
|
|
240
|
+
out = client.get('getComponent', json={'component': SN, "alternativeIdentifier":True})
|
|
241
|
+
db_response = out
|
|
242
|
+
return out
|
|
243
|
+
|
|
235
244
|
except Exception as e:
|
|
236
245
|
db_response = str(e)
|
|
237
246
|
return None
|
|
@@ -409,16 +418,19 @@ def from_full_test_to_test_data(full_test):
|
|
|
409
418
|
for P in full_test["properties"]:
|
|
410
419
|
test["properties"][P["code"]] = P['value']
|
|
411
420
|
|
|
412
|
-
|
|
413
|
-
|
|
421
|
+
if full_test["results"]:
|
|
422
|
+
for P in full_test["results"]:
|
|
423
|
+
test["results"][P["code"]] = P['value']
|
|
414
424
|
|
|
415
|
-
|
|
416
|
-
|
|
425
|
+
if full_test["comments"]:
|
|
426
|
+
for C in full_test["comments"]:
|
|
427
|
+
test["comments"].append(C["comment"])
|
|
417
428
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
429
|
+
if full_test["defects"]:
|
|
430
|
+
for D in full_test["defects"]:
|
|
431
|
+
test["defects"].append({"name": D["name"],
|
|
432
|
+
"description": D["description"],
|
|
433
|
+
"properties": D["properties"]})
|
|
422
434
|
|
|
423
435
|
return test
|
|
424
436
|
|
|
@@ -498,12 +510,12 @@ def get_test_skeleton(session, component, test_code, userdef={}, uservalues={}):
|
|
|
498
510
|
}
|
|
499
511
|
|
|
500
512
|
# Set default values
|
|
501
|
-
for key in skltn.
|
|
513
|
+
for key, val in skltn.items():
|
|
502
514
|
if key in userdef:
|
|
503
|
-
if isinstance(
|
|
515
|
+
if isinstance(val, dict):
|
|
504
516
|
continue
|
|
505
517
|
|
|
506
|
-
|
|
518
|
+
val = userdef[key]
|
|
507
519
|
|
|
508
520
|
def get_default(vin, default=None):
|
|
509
521
|
# print(json.dumps(vin, indent=1))
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""PB/Hybrid panel Visual inspection GUI.."""
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
import itkdb_gtk
|
|
8
|
+
|
|
9
|
+
except ImportError:
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
cwd = Path(__file__).parent.parent
|
|
12
|
+
sys.path.append(cwd.as_posix())
|
|
13
|
+
|
|
14
|
+
from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
|
|
15
|
+
|
|
16
|
+
import gi
|
|
17
|
+
gi.require_version("Gtk", "3.0")
|
|
18
|
+
from gi.repository import Gtk, Gdk, Gio
|
|
19
|
+
|
|
20
|
+
HELP_LINK="https://itkdb-gtk.docs.cern.ch"
|
|
21
|
+
|
|
22
|
+
class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
23
|
+
"""PB/Hybryd panel visual inspection GUI."""
|
|
24
|
+
SN, PASSED, ALL = range(3)
|
|
25
|
+
|
|
26
|
+
def __init__(self, session, help=HELP_LINK):
|
|
27
|
+
super().__init__(title="ITkDB Dashboard",
|
|
28
|
+
session=session,
|
|
29
|
+
show_search="Find object with given SN.",
|
|
30
|
+
help=help)
|
|
31
|
+
|
|
32
|
+
# action button in header
|
|
33
|
+
button = Gtk.Button()
|
|
34
|
+
icon = Gio.ThemedIcon(name="document-send-symbolic")
|
|
35
|
+
image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
|
|
36
|
+
button.add(image)
|
|
37
|
+
button.set_tooltip_text("Click to upload ALL tests.")
|
|
38
|
+
button.connect("clicked", self.upload_tests)
|
|
39
|
+
self.hb.pack_end(button)
|
|
40
|
+
|
|
41
|
+
grid = Gtk.Grid(column_spacing=5, row_spacing=1)
|
|
42
|
+
self.mainBox.pack_start(grid, False, False, 5)
|
|
43
|
+
|
|
44
|
+
lbl = Gtk.Label(label="Serial Number")
|
|
45
|
+
lbl.set_xalign(0)
|
|
46
|
+
grid.attach(lbl, 0, 0, 1, 1)
|
|
47
|
+
|
|
48
|
+
self.SN = dbGtkUtils.TextEntry()
|
|
49
|
+
self.SN.connect("text_changed", self.SN_ready)
|
|
50
|
+
self.SN.widget.set_tooltip_text("Enter SN of PWD or Hybrid panel.")
|
|
51
|
+
grid.attach(self.SN.widget, 1, 0, 1, 1)
|
|
52
|
+
|
|
53
|
+
self.panel_type = Gtk.Label(label="")
|
|
54
|
+
grid.attach(self.panel_type, 2, 0, 1, 1)
|
|
55
|
+
|
|
56
|
+
# Paned object
|
|
57
|
+
paned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
|
|
58
|
+
paned.set_size_request(-1, 200)
|
|
59
|
+
self.mainBox.pack_start(paned, True, True, 5)
|
|
60
|
+
|
|
61
|
+
# the list of attachments
|
|
62
|
+
tree_view = self.create_tree_view()
|
|
63
|
+
paned.add1(tree_view)
|
|
64
|
+
|
|
65
|
+
# The text view
|
|
66
|
+
paned.add2(self.message_panel.frame)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
self.show_all()
|
|
70
|
+
|
|
71
|
+
dbGtkUtils.setup_scanner(self.get_qrcode)
|
|
72
|
+
|
|
73
|
+
def create_tree_view(self, size=150):
|
|
74
|
+
"""Create the TreeView with the children."""
|
|
75
|
+
model = Gtk.ListStore(str, bool)
|
|
76
|
+
self.tree = Gtk.TreeView(model=model)
|
|
77
|
+
|
|
78
|
+
scrolled = Gtk.ScrolledWindow()
|
|
79
|
+
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
|
80
|
+
scrolled.add(self.tree)
|
|
81
|
+
scrolled.set_size_request(-1, size)
|
|
82
|
+
|
|
83
|
+
renderer = Gtk.CellRendererText()
|
|
84
|
+
column = Gtk.TreeViewColumn("SN", renderer, text=PanelVisualInspection.SN)
|
|
85
|
+
self.tree.append_column(column)
|
|
86
|
+
|
|
87
|
+
renderer = Gtk.CellRendererToggle()
|
|
88
|
+
renderer.set_property("activatable", True)
|
|
89
|
+
renderer.set_property("radio", True)
|
|
90
|
+
renderer.set_padding(5, 0)
|
|
91
|
+
|
|
92
|
+
x, y = renderer.get_alignment()
|
|
93
|
+
renderer.set_alignment(0, y)
|
|
94
|
+
# renderer.set_property("inconsistent", True)
|
|
95
|
+
renderer.connect("toggled", self.btn_toggled)
|
|
96
|
+
|
|
97
|
+
column = Gtk.TreeViewColumn("Passed", renderer, active=PanelVisualInspection.PASSED)
|
|
98
|
+
self.tree.append_column(column)
|
|
99
|
+
|
|
100
|
+
return scrolled
|
|
101
|
+
|
|
102
|
+
def btn_toggled(self, renderer, path, *args):
|
|
103
|
+
"""Toggled."""
|
|
104
|
+
model = self.tree.get_model()
|
|
105
|
+
val = not model[path][PanelVisualInspection.PASSED]
|
|
106
|
+
model[path][PanelVisualInspection.PASSED] = val
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def button_pressed(self, tree, event):
|
|
110
|
+
"""Button pressed on tree view."""
|
|
111
|
+
# double click shows attachments
|
|
112
|
+
if event.button == 1 and event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS:
|
|
113
|
+
select = self.tree.get_selection()
|
|
114
|
+
model, iter = select.get_selected()
|
|
115
|
+
if not iter:
|
|
116
|
+
return
|
|
117
|
+
|
|
118
|
+
self.on_show_json(None, (model, iter, model[iter]))
|
|
119
|
+
# self.on_show_attachments(None, (model, iter, model[iter]))
|
|
120
|
+
return
|
|
121
|
+
|
|
122
|
+
if event.button != 3:
|
|
123
|
+
return
|
|
124
|
+
|
|
125
|
+
# Create popup menu
|
|
126
|
+
select = self.tree.get_selection()
|
|
127
|
+
model, iter = select.get_selected()
|
|
128
|
+
values = None
|
|
129
|
+
if iter:
|
|
130
|
+
values = model[iter]
|
|
131
|
+
|
|
132
|
+
if not iter:
|
|
133
|
+
P = tree.get_path_at_pos(event.x, event.y)
|
|
134
|
+
if P:
|
|
135
|
+
print(P[0].to_string())
|
|
136
|
+
iter = model.get_iter(P[0])
|
|
137
|
+
values = model[iter]
|
|
138
|
+
|
|
139
|
+
if not values:
|
|
140
|
+
return
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def SN_ready(self, *args):
|
|
144
|
+
"""SN is ready in the TextEnttry."""
|
|
145
|
+
SN = self.SN.get_text()
|
|
146
|
+
if not SN.startswith("20U") or len(SN)!=14:
|
|
147
|
+
dbGtkUtils.complain("Invalid Serial Number",
|
|
148
|
+
"{}: wrong SN".format(SN))
|
|
149
|
+
return
|
|
150
|
+
|
|
151
|
+
if "USED" in SN:
|
|
152
|
+
# Powerboard Carrier
|
|
153
|
+
if not SN[6].isdigit():
|
|
154
|
+
dbGtkUtils.complain("Not a Powerboard Carrier",
|
|
155
|
+
"{}: wrong SN for a powerboard carrier".format(SN))
|
|
156
|
+
self.SN.widget.set_text("")
|
|
157
|
+
return
|
|
158
|
+
|
|
159
|
+
self.panel_type.set_text("PWB carrier")
|
|
160
|
+
|
|
161
|
+
elif "USET" in SN:
|
|
162
|
+
# Hybrid test panel
|
|
163
|
+
if not SN[6].isdigit or int(SN[6])>5:
|
|
164
|
+
dbGtkUtils.complain("Not a Hybrid Test Panel",
|
|
165
|
+
"{}: wrong SN for a hybrid test panel".format(SN))
|
|
166
|
+
self.SN.widget.set_text("")
|
|
167
|
+
return
|
|
168
|
+
|
|
169
|
+
else:
|
|
170
|
+
dbGtkUtils.complain("Invalid SN.",
|
|
171
|
+
"{}\nNot a PWB carrier not HYB test panel.".format(SN))
|
|
172
|
+
self.SN.widget.set_text("")
|
|
173
|
+
return
|
|
174
|
+
|
|
175
|
+
# GEt children.
|
|
176
|
+
panel = ITkDButils.get_DB_component(self.session, SN)
|
|
177
|
+
if panel is None:
|
|
178
|
+
self.write_message(ITkDButils.get_db_response())
|
|
179
|
+
return
|
|
180
|
+
|
|
181
|
+
children = []
|
|
182
|
+
for child in panel["children"]:
|
|
183
|
+
if child["component"] is not None:
|
|
184
|
+
if child["componentType"]["name"] == "Powerboard":
|
|
185
|
+
children.append(child["component"]["serialNumber"])
|
|
186
|
+
|
|
187
|
+
model = Gtk.ListStore(str, bool)
|
|
188
|
+
for child in children:
|
|
189
|
+
model.append([SN, True])
|
|
190
|
+
|
|
191
|
+
self.tree.set_model(model)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def upload_tests(self, *args):
|
|
195
|
+
"""Upload the current test."""
|
|
196
|
+
SN = self.SN.get_text()
|
|
197
|
+
|
|
198
|
+
def get_qrcode(self, fd, state, reader):
|
|
199
|
+
"""Read SN from scanner."""
|
|
200
|
+
txt = dbGtkUtils.scanner_get_line(reader)
|
|
201
|
+
self.write_message("SN: {}\n".format(txt))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def main():
|
|
205
|
+
"""Main entry."""
|
|
206
|
+
# DB login
|
|
207
|
+
dlg = ITkDBlogin.ITkDBlogin()
|
|
208
|
+
client = dlg.get_client()
|
|
209
|
+
if client is None:
|
|
210
|
+
print("Could not connect to DB with provided credentials.")
|
|
211
|
+
dlg.die()
|
|
212
|
+
sys.exit()
|
|
213
|
+
|
|
214
|
+
client.user_gui = dlg
|
|
215
|
+
|
|
216
|
+
gTest = PanelVisualInspection(client)
|
|
217
|
+
|
|
218
|
+
gTest.present()
|
|
219
|
+
gTest.connect("destroy", Gtk.main_quit)
|
|
220
|
+
try:
|
|
221
|
+
Gtk.main()
|
|
222
|
+
|
|
223
|
+
except KeyboardInterrupt:
|
|
224
|
+
print("Arrrgggg!!!")
|
|
225
|
+
|
|
226
|
+
dlg.die()
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
if __name__ == "__main__":
|
|
230
|
+
main()
|
itkdb_gtk/PetalReceptionTests.py
CHANGED
|
@@ -8,7 +8,7 @@ try:
|
|
|
8
8
|
|
|
9
9
|
except ImportError:
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
cwd = Path(
|
|
11
|
+
cwd = Path(__file__).parent.parent
|
|
12
12
|
sys.path.append(cwd.as_posix())
|
|
13
13
|
|
|
14
14
|
from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
|
|
@@ -35,7 +35,7 @@ def find_children(W):
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
38
|
-
"""
|
|
38
|
+
"""Petl Reception Test GUI."""
|
|
39
39
|
|
|
40
40
|
def __init__(self, session, help=None):
|
|
41
41
|
"""Initialization."""
|
itkdb_gtk/UploadModuleIV.py
CHANGED
|
@@ -56,7 +56,7 @@ def remove_files(W, flist):
|
|
|
56
56
|
class IVwindow(dbGtkUtils.ITkDBWindow):
|
|
57
57
|
"""GUI for IV file handling."""
|
|
58
58
|
|
|
59
|
-
def __init__(self, session, title="IV window", options=None, help=
|
|
59
|
+
def __init__(self, session, title="IV window", options=None, help=None):
|
|
60
60
|
"""Initialization."""
|
|
61
61
|
super().__init__(
|
|
62
62
|
session=session, title=title, show_search=None, gtk_runs=gtk_runs, help=help
|