itkdb-gtk 0.17.0__py3-none-any.whl → 0.18.0.dev2__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/ITkDButils.py +16 -6
- itkdb_gtk/UploadMultipleTests.py +6 -3
- itkdb_gtk/__init__.py +6 -1
- itkdb_gtk/dashBoard.py +30 -0
- itkdb_gtk/findComponent.py +141 -0
- {itkdb_gtk-0.17.0.dist-info → itkdb_gtk-0.18.0.dev2.dist-info}/METADATA +1 -1
- {itkdb_gtk-0.17.0.dist-info → itkdb_gtk-0.18.0.dev2.dist-info}/RECORD +10 -9
- {itkdb_gtk-0.17.0.dist-info → itkdb_gtk-0.18.0.dev2.dist-info}/entry_points.txt +1 -0
- {itkdb_gtk-0.17.0.dist-info → itkdb_gtk-0.18.0.dev2.dist-info}/WHEEL +0 -0
- {itkdb_gtk-0.17.0.dist-info → itkdb_gtk-0.18.0.dev2.dist-info}/top_level.txt +0 -0
itkdb_gtk/ITkDButils.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Utilities for the inteaction with the ITkDB."""
|
|
2
2
|
import mimetypes
|
|
3
|
+
import traceback
|
|
3
4
|
from collections.abc import Iterable
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from pathlib import Path
|
|
@@ -7,6 +8,8 @@ import getpass
|
|
|
7
8
|
|
|
8
9
|
import dateutil.parser
|
|
9
10
|
import itkdb
|
|
11
|
+
import magic
|
|
12
|
+
import locale
|
|
10
13
|
|
|
11
14
|
# The response of the DB
|
|
12
15
|
db_response = ""
|
|
@@ -377,13 +380,18 @@ def upload_test(client, data, attachments=None, check_runNumber=False):
|
|
|
377
380
|
if newRn not in runN:
|
|
378
381
|
data["runNumber"] = newRn
|
|
379
382
|
break
|
|
380
|
-
|
|
383
|
+
|
|
381
384
|
# Try to upload the test
|
|
382
385
|
try:
|
|
383
386
|
db_response = client.post("uploadTestRunResults", json=data)
|
|
384
387
|
testRun = db_response["testRun"]["id"]
|
|
385
388
|
uploaded_test_runs.append(testRun)
|
|
386
389
|
|
|
390
|
+
except Exception as e:
|
|
391
|
+
msg = "Could not upload the test:\n{}".format(str(e))
|
|
392
|
+
return msg
|
|
393
|
+
|
|
394
|
+
try:
|
|
387
395
|
# Handle attachments.
|
|
388
396
|
attachment_urls = {}
|
|
389
397
|
if attachments is not None:
|
|
@@ -402,12 +410,12 @@ def upload_test(client, data, attachments=None, check_runNumber=False):
|
|
|
402
410
|
print("File {} does not exist".format(path))
|
|
403
411
|
continue
|
|
404
412
|
|
|
405
|
-
data["url"] = path.as_uri()
|
|
406
|
-
filetype =
|
|
407
|
-
attachment = {'data': (path.as_posix(), open(path.as_posix(), 'rb'), filetype
|
|
413
|
+
data["url"] = str(path.as_uri())
|
|
414
|
+
filetype = itkdb.utils.get_mimetype(path.as_posix(), None)
|
|
415
|
+
attachment = {'data': (path.as_posix(), open(path.as_posix(), 'rb'), filetype)}
|
|
408
416
|
else:
|
|
409
417
|
data["url"] = att.url
|
|
410
|
-
filetype =
|
|
418
|
+
filetype = itkdb.utils.get_mimetype(att.url, None)
|
|
411
419
|
attachment = {'data':(att.url, None, "text/x-uri") }
|
|
412
420
|
|
|
413
421
|
db_response = client.post('createTestRunAttachment',
|
|
@@ -424,7 +432,9 @@ def upload_test(client, data, attachments=None, check_runNumber=False):
|
|
|
424
432
|
return None
|
|
425
433
|
|
|
426
434
|
except Exception as e:
|
|
427
|
-
|
|
435
|
+
print(traceback.format_exc())
|
|
436
|
+
return "Could not upload attachment:\n{}".format(str(e))
|
|
437
|
+
|
|
428
438
|
|
|
429
439
|
def set_test_run_parameter(session, test_run, parameter, value):
|
|
430
440
|
"""Modify testRun Parameter
|
itkdb_gtk/UploadMultipleTests.py
CHANGED
|
@@ -687,8 +687,11 @@ class UploadMultipleTests(dbGtkUtils.ITkDBWindow):
|
|
|
687
687
|
rc = ITkDButils.upload_test(self.session, payload, values[TestList.Attachments], check_runNumber=True)
|
|
688
688
|
if rc:
|
|
689
689
|
ipos = rc.find("The following details may help:")
|
|
690
|
-
|
|
691
|
-
|
|
690
|
+
if ipos>=0:
|
|
691
|
+
msg = rc[ipos:]
|
|
692
|
+
else:
|
|
693
|
+
msg = rc
|
|
694
|
+
dbGtkUtils.complain("Failed uploading test {}-{}\n".format(payload["component"], payload["testType"]), msg)
|
|
692
695
|
self.write_message("Failed uploading test {}-{}\n{}\n".format(payload["component"], payload["testType"], msg))
|
|
693
696
|
nbad += 1
|
|
694
697
|
|
|
@@ -702,7 +705,7 @@ class UploadMultipleTests(dbGtkUtils.ITkDBWindow):
|
|
|
702
705
|
model.remove(past_iter)
|
|
703
706
|
|
|
704
707
|
if nbad>0:
|
|
705
|
-
dbGtkUtils.complain("Failed to upload
|
|
708
|
+
dbGtkUtils.complain("Failed to upload some tests", "{}/{} tests had errors.\nThey are left in the ListView.".format(nbad, ngood))
|
|
706
709
|
else:
|
|
707
710
|
dbGtkUtils.complain("All {} tests uploaded succesfully".format(ngood))
|
|
708
711
|
|
itkdb_gtk/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
""" itkdb-gtk python module
|
|
2
2
|
"""
|
|
3
|
-
__version__ = "0.
|
|
3
|
+
__version__ = "0.18.0.dev2"
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def dash_board():
|
|
@@ -55,3 +55,8 @@ def visualInspection():
|
|
|
55
55
|
"""Visual inspection of Modules/Sensors."""
|
|
56
56
|
from .VisualInspection import main
|
|
57
57
|
main()
|
|
58
|
+
|
|
59
|
+
def findDBComponent():
|
|
60
|
+
"""Find object from QR or bar code"""
|
|
61
|
+
from .findComponent import main
|
|
62
|
+
main()
|
itkdb_gtk/dashBoard.py
CHANGED
|
@@ -22,6 +22,7 @@ from itkdb_gtk import UploadModuleIV
|
|
|
22
22
|
from itkdb_gtk import WireBondGui
|
|
23
23
|
from itkdb_gtk import PanelVisualInspection
|
|
24
24
|
from itkdb_gtk import VisualInspection
|
|
25
|
+
from itkdb_gtk import findComponent
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
HAS_PETALQC=False
|
|
@@ -59,6 +60,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
59
60
|
PETAL_CORE_METRO = 11
|
|
60
61
|
PETAL_CORE_THERMAL = 12
|
|
61
62
|
PETAL_INFORMATION = 13
|
|
63
|
+
FIND_COMPONENT = 14
|
|
62
64
|
|
|
63
65
|
def __init__(self, session):
|
|
64
66
|
"""Initialization."""
|
|
@@ -162,6 +164,19 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
162
164
|
recS.connect("clicked", self.receive_shipment)
|
|
163
165
|
grid.attach(recS, 1, irow, 1, 1,)
|
|
164
166
|
|
|
167
|
+
irow += 1
|
|
168
|
+
lbl = Gtk.Label()
|
|
169
|
+
lbl.set_markup("<b>Utils</b>")
|
|
170
|
+
lbl.set_xalign(0)
|
|
171
|
+
grid.attach(lbl, 0, irow, 1, 1)
|
|
172
|
+
|
|
173
|
+
irow += 1
|
|
174
|
+
findC = Gtk.Button(label="Find Component")
|
|
175
|
+
findC.connect("clicked", self.find_component)
|
|
176
|
+
findC.set_tooltip_text("Scan your QR or bar code and get info from DB.")
|
|
177
|
+
grid.attach(findC, 0, irow, 1, 1,)
|
|
178
|
+
|
|
179
|
+
|
|
165
180
|
self.mainBox.pack_start(Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL), False, True, 5)
|
|
166
181
|
|
|
167
182
|
self.show_all()
|
|
@@ -296,6 +311,21 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
296
311
|
W.connect("destroy", self.app_closed, bitn)
|
|
297
312
|
W.show_all()
|
|
298
313
|
|
|
314
|
+
|
|
315
|
+
def find_component(self, *args):
|
|
316
|
+
"""Find Component."""
|
|
317
|
+
bitn = DashWindow.FIND_COMPONENT
|
|
318
|
+
bt = 1 << bitn
|
|
319
|
+
if self.mask & bt:
|
|
320
|
+
return
|
|
321
|
+
|
|
322
|
+
W = findComponent.FindComponent(
|
|
323
|
+
self.session,
|
|
324
|
+
help_link="{}/findComponent.html".format(HELP_LINK)
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
W.connect("destroy", self.app_closed, bitn)
|
|
328
|
+
|
|
299
329
|
def petal_reception(self, *args):
|
|
300
330
|
"""Petal GND/VI test."""
|
|
301
331
|
bitn = DashWindow.PETAL_RECEPTION
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""GUI to upload tests."""
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
import itkdb_gtk
|
|
10
|
+
|
|
11
|
+
except ImportError:
|
|
12
|
+
cwd = Path(__file__).parent.parent
|
|
13
|
+
sys.path.append(cwd.as_posix())
|
|
14
|
+
|
|
15
|
+
from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
|
|
16
|
+
from itkdb_gtk.GetShipments import find_vtrx
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
import gi
|
|
20
|
+
gi.require_version("Gtk", "3.0")
|
|
21
|
+
from gi.repository import Gtk, Gio
|
|
22
|
+
|
|
23
|
+
class FindComponent(dbGtkUtils.ITkDBWindow):
|
|
24
|
+
"""Read QR of bar code and retrieve information about component."""
|
|
25
|
+
|
|
26
|
+
def __init__(self, session, help_link=None):
|
|
27
|
+
"""Initialization.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
session: ITkDB session
|
|
31
|
+
help_link: link to help page.
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
super().__init__(session=session, title="Find Component", help_link=help_link)
|
|
35
|
+
self.init_window()
|
|
36
|
+
|
|
37
|
+
def init_window(self):
|
|
38
|
+
"""Create the Gtk window."""
|
|
39
|
+
# Initial tweaks
|
|
40
|
+
self.set_border_width(10)
|
|
41
|
+
|
|
42
|
+
# Prepare HeaderBar
|
|
43
|
+
self.hb.props.title = "Find Component"
|
|
44
|
+
|
|
45
|
+
# Object Data
|
|
46
|
+
lbl = Gtk.Label(label="Scan your QR or bar code. Information will appear below.")
|
|
47
|
+
self.mainBox.pack_start(lbl, True, True, 0)
|
|
48
|
+
|
|
49
|
+
#btn = Gtk.Button(label="Test Button")
|
|
50
|
+
#btn.connect("clicked", self.test_qrcode)
|
|
51
|
+
#self.mainBox.pack_start(btn, True, True, 0)
|
|
52
|
+
|
|
53
|
+
# The text view
|
|
54
|
+
self.mainBox.pack_start(self.message_panel.frame, True, True, 0)
|
|
55
|
+
|
|
56
|
+
self.show_all()
|
|
57
|
+
|
|
58
|
+
def get_qrcode(self, fd, state, reader):
|
|
59
|
+
"""Gets data from QR scanner."""
|
|
60
|
+
txt = dbGtkUtils.scanner_get_line(reader)
|
|
61
|
+
self.write_message("{}\n".format(txt))
|
|
62
|
+
|
|
63
|
+
if txt.find("J-SD") == 0:
|
|
64
|
+
try:
|
|
65
|
+
SN = find_vtrx(self.session, txt)
|
|
66
|
+
except ValueError as e:
|
|
67
|
+
self.write_message("Error: {}\n".format(e))
|
|
68
|
+
return
|
|
69
|
+
else:
|
|
70
|
+
SN = txt
|
|
71
|
+
|
|
72
|
+
obj = ITkDButils.get_DB_component(self.session, SN)
|
|
73
|
+
if obj is None:
|
|
74
|
+
self.write_message("Object not found in DB\n")
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
msg = "\nObject SN: {}\nObject Alt. ID: {}\nObject Type: {}\nObject Loc. {}\nObject stage: {} - {}".format(
|
|
78
|
+
obj["serialNumber"],
|
|
79
|
+
obj["alternativeIdentifier"],
|
|
80
|
+
obj["componentType"]["name"],
|
|
81
|
+
obj["currentLocation"]["name"],
|
|
82
|
+
obj["currentStage"]["code"],
|
|
83
|
+
obj["currentStage"]["name"])
|
|
84
|
+
|
|
85
|
+
self.write_message(msg)
|
|
86
|
+
|
|
87
|
+
def test_qrcode(self, *args):
|
|
88
|
+
"""Gets data from QR scanner."""
|
|
89
|
+
txt = "a3c671bf38d3957dc053c6e5471aa27e"
|
|
90
|
+
self.write_message("{}\n".format(txt))
|
|
91
|
+
|
|
92
|
+
if txt.find("J-SD") == 0:
|
|
93
|
+
try:
|
|
94
|
+
SN = find_vtrx(self.session, txt)
|
|
95
|
+
except ValueError as e:
|
|
96
|
+
self.write_message("Error: {}\n".format(e))
|
|
97
|
+
return
|
|
98
|
+
else:
|
|
99
|
+
SN = txt
|
|
100
|
+
|
|
101
|
+
obj = ITkDButils.get_DB_component(self.session, SN)
|
|
102
|
+
if obj is None:
|
|
103
|
+
self.write_message("Object not found in DB\n")
|
|
104
|
+
return
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
msg = "\n\nObject SN: {}\nObject Alt. ID: {}\nObject Type: {}\nObject Loc.: {}\nObject stage: {} - {}\n".format(
|
|
108
|
+
obj["serialNumber"],
|
|
109
|
+
obj["alternativeIdentifier"],
|
|
110
|
+
obj["componentType"]["name"],
|
|
111
|
+
obj["currentLocation"]["name"],
|
|
112
|
+
obj["currentStage"]["code"],
|
|
113
|
+
obj["currentStage"]["name"])
|
|
114
|
+
|
|
115
|
+
self.write_message(msg)
|
|
116
|
+
|
|
117
|
+
def main():
|
|
118
|
+
"""Main entry."""
|
|
119
|
+
HELP_LINK="https://itkdb-gtk.docs.cern.ch/uploadSingleTest.html"
|
|
120
|
+
|
|
121
|
+
# DB login
|
|
122
|
+
dlg = ITkDBlogin.ITkDBlogin()
|
|
123
|
+
client = dlg.get_client()
|
|
124
|
+
if client is None:
|
|
125
|
+
print("Could not connect to DB with provided credentials.")
|
|
126
|
+
dlg.die()
|
|
127
|
+
sys.exit()
|
|
128
|
+
|
|
129
|
+
client.user_gui = dlg
|
|
130
|
+
|
|
131
|
+
window = FindComponent(client, help_link=HELP_LINK)
|
|
132
|
+
try:
|
|
133
|
+
Gtk.main()
|
|
134
|
+
|
|
135
|
+
except KeyboardInterrupt:
|
|
136
|
+
print("Arrrgggg!!!")
|
|
137
|
+
|
|
138
|
+
dlg.die()
|
|
139
|
+
|
|
140
|
+
if __name__ == "__main__":
|
|
141
|
+
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itkdb_gtk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.18.0.dev2
|
|
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
|
|
@@ -4,24 +4,25 @@ itkdb_gtk/GlueWeight.py,sha256=IHgvbN2DlT8Ou-DMi-n3Z-3xSrPr0tlrkkEH10AshrA,11587
|
|
|
4
4
|
itkdb_gtk/ITkDB.desktop,sha256=v_K4mHsDxb912J1XGo6mOlbW2TkHvYNGrKmiOnsBQqM,172
|
|
5
5
|
itkdb_gtk/ITkDB.svg,sha256=Ry702zrUkxvG61SqThbUNfXySyiLMqalwYpcM-b_KWo,24242
|
|
6
6
|
itkdb_gtk/ITkDBlogin.py,sha256=40tipm_j5eUS4dnZnBT8VyL6Bu_8csuqS9TPWKxvKSY,10038
|
|
7
|
-
itkdb_gtk/ITkDButils.py,sha256=
|
|
7
|
+
itkdb_gtk/ITkDButils.py,sha256=SYGtE7D0xOEo5J9rWYfpzQydBpRR1zXPKToJvt_aTEk,21756
|
|
8
8
|
itkdb_gtk/PanelVisualInspection.py,sha256=96_JMfJXfaqxN4vq2Y9rjdRY7pikuobOTGmrSOxHwV8,20511
|
|
9
9
|
itkdb_gtk/SensorUtils.py,sha256=fYWF9TeutAbore53dLWNlZnVn9P3OsKYcFLNGOs8cnI,15426
|
|
10
10
|
itkdb_gtk/ShowAttachments.py,sha256=KExxPCdbcb04XS8JSUkg5xF1McvlB8e9btwctDCKNXU,8498
|
|
11
11
|
itkdb_gtk/ShowComments.py,sha256=OiMTFLnhGbbKRj5x61D517BYHAt-qY5Y1lvR3EQz3c0,3151
|
|
12
12
|
itkdb_gtk/ShowDefects.py,sha256=aVAHeaE5IztmAPEuHwhi06KWo_pi9xX2J1fTLhKyAPI,3530
|
|
13
13
|
itkdb_gtk/UploadModuleIV.py,sha256=sqh52bSxANBwlmVWZlDqFXpqRGf0rV0QsjJWC-tY_qI,17792
|
|
14
|
-
itkdb_gtk/UploadMultipleTests.py,sha256=
|
|
14
|
+
itkdb_gtk/UploadMultipleTests.py,sha256=tFXGyeIC-c1Gh_Fyjr_AddDnKReGMrMphdotRzIsR-s,25301
|
|
15
15
|
itkdb_gtk/UploadTest.py,sha256=ukgJ5-IG12bqa1QIp3bXIV8hkdXCv5UDxh1lQswN_ko,16832
|
|
16
16
|
itkdb_gtk/VisualInspection.py,sha256=akKPWGbE9DxqTM1csCbov9SqnlTvW_RRKtpqWV64zG4,9841
|
|
17
17
|
itkdb_gtk/WireBondGui.py,sha256=WFTLOw4l5JxSbvh4vZMxcF65fqlwvNw0fOyEru9ijqQ,39850
|
|
18
|
-
itkdb_gtk/__init__.py,sha256=
|
|
19
|
-
itkdb_gtk/dashBoard.py,sha256=
|
|
18
|
+
itkdb_gtk/__init__.py,sha256=rY6h1FOEbkt3srqgeHLzgndlOInsG9VG-8flGBuT0kg,1274
|
|
19
|
+
itkdb_gtk/dashBoard.py,sha256=1kNSJn-iJ-ME6Nhtz-TfjFQsdKIlBooExrD8U_LgyEA,12293
|
|
20
20
|
itkdb_gtk/dbGtkUtils.py,sha256=THW-IT5UJB1YluvUVIfpy6oIY2faSHChNKGTpY5qzag,30480
|
|
21
|
+
itkdb_gtk/findComponent.py,sha256=6ZKh9Uz1LdvN8AchSK-LV3qRQmzihBGiTajDJrrBWac,4078
|
|
21
22
|
itkdb_gtk/readGoogleSheet.py,sha256=Lzm_oPWwDqZZzKoBUgsp277F9-wCfr_BA0X4VD2Eolo,2673
|
|
22
23
|
itkdb_gtk/untrash_component.py,sha256=VrN46-f-kF7voOxtoh7OL-bZSWAaIFb7-Xbx6_WT7K8,757
|
|
23
|
-
itkdb_gtk-0.
|
|
24
|
-
itkdb_gtk-0.
|
|
25
|
-
itkdb_gtk-0.
|
|
26
|
-
itkdb_gtk-0.
|
|
27
|
-
itkdb_gtk-0.
|
|
24
|
+
itkdb_gtk-0.18.0.dev2.dist-info/METADATA,sha256=emf2dkerrJTiKUinpo_d2EsdbS94wY3mLeALecjtCRg,3154
|
|
25
|
+
itkdb_gtk-0.18.0.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
itkdb_gtk-0.18.0.dev2.dist-info/entry_points.txt,sha256=vN0_mqIT6NwsnHirFsf3JHu-wq8CSHXE1IlhZzB5sbU,481
|
|
27
|
+
itkdb_gtk-0.18.0.dev2.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
|
|
28
|
+
itkdb_gtk-0.18.0.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|