itkdb-gtk 0.10.7__py3-none-any.whl → 0.10.8__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 +7 -3
- itkdb_gtk/ITkDBlogin.py +2 -2
- itkdb_gtk/ITkDButils.py +20 -1
- itkdb_gtk/PanelVisualInspection.py +49 -24
- itkdb_gtk/__init__.py +1 -1
- {itkdb_gtk-0.10.7.dist-info → itkdb_gtk-0.10.8.dist-info}/METADATA +1 -2
- {itkdb_gtk-0.10.7.dist-info → itkdb_gtk-0.10.8.dist-info}/RECORD +10 -10
- {itkdb_gtk-0.10.7.dist-info → itkdb_gtk-0.10.8.dist-info}/WHEEL +1 -1
- {itkdb_gtk-0.10.7.dist-info → itkdb_gtk-0.10.8.dist-info}/entry_points.txt +0 -0
- {itkdb_gtk-0.10.7.dist-info → itkdb_gtk-0.10.8.dist-info}/top_level.txt +0 -0
itkdb_gtk/CreateShipments.py
CHANGED
|
@@ -28,7 +28,7 @@ gtk_runs, gtk_args = Gtk.init_check()
|
|
|
28
28
|
class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
29
29
|
"""Create a shipment from input."""
|
|
30
30
|
|
|
31
|
-
def __init__(self, session):
|
|
31
|
+
def __init__(self, session, help=None):
|
|
32
32
|
"""Initialization.
|
|
33
33
|
|
|
34
34
|
Args:
|
|
@@ -41,7 +41,7 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
41
41
|
self.attachment = None
|
|
42
42
|
global gtk_runs
|
|
43
43
|
if gtk_runs:
|
|
44
|
-
super().__init__(session=session, title="Upload AVS Data", gtk_runs=gtk_runs)
|
|
44
|
+
super().__init__(session=session, title="Upload AVS Data", help=help, gtk_runs=gtk_runs)
|
|
45
45
|
self.init_window()
|
|
46
46
|
|
|
47
47
|
def init_window(self):
|
|
@@ -193,10 +193,14 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
193
193
|
dbGtkUtils.complain("Item {} is already in transit".format(SN),
|
|
194
194
|
"This item is already in transit to {}".format(rc['shipmentDestination']['code']))
|
|
195
195
|
return
|
|
196
|
+
|
|
196
197
|
nick = rc['alternativeIdentifier']
|
|
197
198
|
id = rc['id']
|
|
198
199
|
obj = rc['componentType']['name']
|
|
199
200
|
loc = rc['currentLocation']['code']
|
|
201
|
+
serialN = rc['serialNumber']
|
|
202
|
+
if serialN is None:
|
|
203
|
+
serialN = id
|
|
200
204
|
|
|
201
205
|
# Check tha tthe input is not already there
|
|
202
206
|
model = self.tree.get_model()
|
|
@@ -210,7 +214,7 @@ class CreateShipments(dbGtkUtils.ITkDBWindow):
|
|
|
210
214
|
iter = model.iter_next(iter)
|
|
211
215
|
|
|
212
216
|
# Add the item in the liststore.
|
|
213
|
-
model.append([
|
|
217
|
+
model.append([serialN, nick, obj, loc, id])
|
|
214
218
|
|
|
215
219
|
except Exception:
|
|
216
220
|
dbGtkUtils.complain("Error querying DB",
|
itkdb_gtk/ITkDBlogin.py
CHANGED
|
@@ -306,12 +306,12 @@ class ITkDBlogin(Gtk.Dialog):
|
|
|
306
306
|
# token_file.write(json.dumps(self.token))
|
|
307
307
|
self.hide()
|
|
308
308
|
|
|
309
|
-
def get_client(self):
|
|
309
|
+
def get_client(self, use_eos=False):
|
|
310
310
|
"""Return the client."""
|
|
311
311
|
if not self.is_connected():
|
|
312
312
|
return None
|
|
313
313
|
|
|
314
|
-
return itkdb.Client(user=self.user)
|
|
314
|
+
return itkdb.Client(user=self.user, use_eos=use_eos)
|
|
315
315
|
|
|
316
316
|
def __del__(self):
|
|
317
317
|
"""Delete."""
|
itkdb_gtk/ITkDButils.py
CHANGED
|
@@ -3,8 +3,10 @@ import mimetypes
|
|
|
3
3
|
from collections.abc import Iterable
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
import getpass
|
|
6
7
|
|
|
7
8
|
import dateutil.parser
|
|
9
|
+
import itkdb
|
|
8
10
|
|
|
9
11
|
# The response of the DB
|
|
10
12
|
db_response = ""
|
|
@@ -281,6 +283,7 @@ def upload_test(client, data, attachments=None):
|
|
|
281
283
|
db_response = client.post('createTestRunAttachment',
|
|
282
284
|
data=data,
|
|
283
285
|
files=attachment)
|
|
286
|
+
|
|
284
287
|
|
|
285
288
|
return None
|
|
286
289
|
|
|
@@ -453,7 +456,7 @@ def get_testrun(session, test_id, out_type="object"):
|
|
|
453
456
|
return None
|
|
454
457
|
|
|
455
458
|
|
|
456
|
-
def get_test_skeleton(session, component, test_code, userdef=
|
|
459
|
+
def get_test_skeleton(session, component, test_code, userdef=None, uservalues=None):
|
|
457
460
|
"""Get the skeleton of the given test.
|
|
458
461
|
|
|
459
462
|
Args:
|
|
@@ -465,6 +468,13 @@ def get_test_skeleton(session, component, test_code, userdef={}, uservalues={}):
|
|
|
465
468
|
|
|
466
469
|
"""
|
|
467
470
|
global db_response
|
|
471
|
+
|
|
472
|
+
if userdef is None:
|
|
473
|
+
userdef = {}
|
|
474
|
+
|
|
475
|
+
if uservalues is None:
|
|
476
|
+
uservalues = {}
|
|
477
|
+
|
|
468
478
|
defvalues = {
|
|
469
479
|
"string": "",
|
|
470
480
|
"integer": -9999,
|
|
@@ -550,3 +560,12 @@ def get_test_skeleton(session, component, test_code, userdef={}, uservalues={}):
|
|
|
550
560
|
skltn['results'][key] = get_default(par)
|
|
551
561
|
|
|
552
562
|
return skltn
|
|
563
|
+
|
|
564
|
+
def create_client():
|
|
565
|
+
"""Create a Client."""
|
|
566
|
+
client = itkdb.Client()
|
|
567
|
+
client.user._access_code1 = getpass.getpass("Access 1: ")
|
|
568
|
+
client.user._access_code2 = getpass.getpass("Access 2: ")
|
|
569
|
+
client.user.authenticate()
|
|
570
|
+
print("Hello {} !".format(client.user.name))
|
|
571
|
+
return client
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"""PB/Hybrid panel Visual inspection GUI.."""
|
|
3
3
|
import json
|
|
4
4
|
import sys
|
|
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
13
|
|
|
@@ -21,7 +21,7 @@ HELP_LINK="https://itkdb-gtk.docs.cern.ch"
|
|
|
21
21
|
|
|
22
22
|
class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
23
23
|
"""PB/Hybryd panel visual inspection GUI."""
|
|
24
|
-
SN, PASSED, ALL = range(
|
|
24
|
+
SN, PASSED, F_NAME, F_PATH, ALL = range(5)
|
|
25
25
|
|
|
26
26
|
def __init__(self, session, help=HELP_LINK):
|
|
27
27
|
super().__init__(title="ITkDB Dashboard",
|
|
@@ -72,8 +72,9 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
72
72
|
|
|
73
73
|
def create_tree_view(self, size=150):
|
|
74
74
|
"""Create the TreeView with the children."""
|
|
75
|
-
model = Gtk.ListStore(str, bool)
|
|
75
|
+
model = Gtk.ListStore(str, bool, str, str)
|
|
76
76
|
self.tree = Gtk.TreeView(model=model)
|
|
77
|
+
self.tree.connect("button-press-event", self.button_pressed)
|
|
77
78
|
|
|
78
79
|
scrolled = Gtk.ScrolledWindow()
|
|
79
80
|
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
|
@@ -97,6 +98,12 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
97
98
|
column = Gtk.TreeViewColumn("Passed", renderer, active=PanelVisualInspection.PASSED)
|
|
98
99
|
self.tree.append_column(column)
|
|
99
100
|
|
|
101
|
+
|
|
102
|
+
renderer = Gtk.CellRendererText()
|
|
103
|
+
column = Gtk.TreeViewColumn("Image", renderer, text=PanelVisualInspection.F_NAME)
|
|
104
|
+
self.tree.append_column(column)
|
|
105
|
+
|
|
106
|
+
|
|
100
107
|
return scrolled
|
|
101
108
|
|
|
102
109
|
def btn_toggled(self, renderer, path, *args):
|
|
@@ -110,13 +117,7 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
110
117
|
"""Button pressed on tree view."""
|
|
111
118
|
# double click shows attachments
|
|
112
119
|
if event.button == 1 and event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS:
|
|
113
|
-
|
|
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
|
+
self.write_message("This is a double click.\n")
|
|
120
121
|
return
|
|
121
122
|
|
|
122
123
|
if event.button != 3:
|
|
@@ -138,16 +139,48 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
138
139
|
|
|
139
140
|
if not values:
|
|
140
141
|
return
|
|
142
|
+
|
|
143
|
+
menu = Gtk.Menu()
|
|
144
|
+
item_show = Gtk.MenuItem(label="Upload Image")
|
|
145
|
+
item_show.connect("activate", self.on_upload_image, (model, iter, values))
|
|
146
|
+
menu.append(item_show)
|
|
147
|
+
|
|
148
|
+
menu.show_all()
|
|
149
|
+
menu.popup_at_pointer(event)
|
|
150
|
+
|
|
151
|
+
def on_upload_image(self, item, data):
|
|
152
|
+
"""Choose file."""
|
|
153
|
+
fdlg = Gtk.FileChooserNative(action=Gtk.FileChooserAction.OPEN, accept_label="Select")
|
|
154
|
+
response = fdlg.run()
|
|
155
|
+
if response == Gtk.ResponseType.ACCEPT:
|
|
156
|
+
ifiles = [ipath for ipath in fdlg.get_filenames()]
|
|
157
|
+
if len(ifiles)<1:
|
|
158
|
+
return
|
|
159
|
+
|
|
160
|
+
if len(ifiles) > 1:
|
|
161
|
+
dbGtkUtils.complain("More than one file selected","Choosing first.")
|
|
162
|
+
|
|
163
|
+
fnam = ifiles[0]
|
|
164
|
+
model, iter, val = data
|
|
165
|
+
model.set_value(iter, PanelVisualInspection.F_PATH, fnam)
|
|
166
|
+
model.set_value(iter, PanelVisualInspection.F_NAME, Path(fnam).name)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
self.write_message("Upload image\n")
|
|
141
170
|
|
|
142
171
|
|
|
143
172
|
def SN_ready(self, *args):
|
|
144
173
|
"""SN is ready in the TextEnttry."""
|
|
145
174
|
SN = self.SN.get_text()
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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())
|
|
149
179
|
return
|
|
150
180
|
|
|
181
|
+
SN = panel["serialNumber"]
|
|
182
|
+
args[0].set_text(SN)
|
|
183
|
+
|
|
151
184
|
if "USED" in SN:
|
|
152
185
|
# Powerboard Carrier
|
|
153
186
|
if not SN[6].isdigit():
|
|
@@ -173,20 +206,15 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
173
206
|
return
|
|
174
207
|
|
|
175
208
|
# 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
209
|
children = []
|
|
182
210
|
for child in panel["children"]:
|
|
183
211
|
if child["component"] is not None:
|
|
184
212
|
if child["componentType"]["name"] == "Powerboard":
|
|
185
213
|
children.append(child["component"]["serialNumber"])
|
|
186
214
|
|
|
187
|
-
model = Gtk.ListStore(str, bool)
|
|
215
|
+
model = Gtk.ListStore(str, bool, str, str)
|
|
188
216
|
for child in children:
|
|
189
|
-
model.append([
|
|
217
|
+
model.append([child, True, "", ""])
|
|
190
218
|
|
|
191
219
|
self.tree.set_model(model)
|
|
192
220
|
|
|
@@ -199,6 +227,7 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
199
227
|
"""Read SN from scanner."""
|
|
200
228
|
txt = dbGtkUtils.scanner_get_line(reader)
|
|
201
229
|
self.write_message("SN: {}\n".format(txt))
|
|
230
|
+
self.SN_ready(txt, self.SN.widget)
|
|
202
231
|
|
|
203
232
|
|
|
204
233
|
def main():
|
|
@@ -224,7 +253,3 @@ def main():
|
|
|
224
253
|
print("Arrrgggg!!!")
|
|
225
254
|
|
|
226
255
|
dlg.die()
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if __name__ == "__main__":
|
|
230
|
-
main()
|
itkdb_gtk/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itkdb_gtk
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.8
|
|
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,7 +16,6 @@ Requires-Dist: openpyxl
|
|
|
16
16
|
Requires-Dist: pyserial
|
|
17
17
|
Requires-Dist: python-dateutil
|
|
18
18
|
Requires-Dist: requests
|
|
19
|
-
Requires-Dist: PyGObject
|
|
20
19
|
|
|
21
20
|
# Interaction with the ITk PDB.
|
|
22
21
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
itkdb_gtk/CreateShipments.py,sha256=
|
|
1
|
+
itkdb_gtk/CreateShipments.py,sha256=c9TZVidWULQeZgVymGELcqrBrjtWGhj2DU59cagZOIc,13006
|
|
2
2
|
itkdb_gtk/GetShipments.py,sha256=Bj46Y-Q1O9yxLd5ZvQF6uoLRIU4hAhPmBfjQGmqqF0I,18123
|
|
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=
|
|
7
|
-
itkdb_gtk/ITkDButils.py,sha256=
|
|
8
|
-
itkdb_gtk/PanelVisualInspection.py,sha256=
|
|
6
|
+
itkdb_gtk/ITkDBlogin.py,sha256=dyUgQVWxZ8aa6_PzhIyLXshdDBYiQxH524uEwwL6kUc,9948
|
|
7
|
+
itkdb_gtk/ITkDButils.py,sha256=mvlo5F01_B0CZX-GZMkUHRzZSNR1A8IWrGtMRRwGFq4,15635
|
|
8
|
+
itkdb_gtk/PanelVisualInspection.py,sha256=u9BrcF4w9qv4sqsrd3tGpZ1lVQ6du7MYO7tnGym0hAQ,8124
|
|
9
9
|
itkdb_gtk/PetalReceptionTests.py,sha256=qLD1RaFVheopmXf2TfBjoz94SCFybiX4Dnb8qSAWNBw,9334
|
|
10
10
|
itkdb_gtk/SensorUtils.py,sha256=S2Mc-Z1webACisj6waJcMqiqzoGSE7TYScVfxHSD700,15458
|
|
11
11
|
itkdb_gtk/ShowAttachments.py,sha256=1pZo3P_yZwD0IyhbNyeqOE71mXkwuFYAK5bsBy2P-cI,8404
|
|
@@ -16,14 +16,14 @@ itkdb_gtk/UploadMultipleTests.py,sha256=o2jmrxNCk65-pj8W0otKVkV-hqzsLuAdAjaVtaeW
|
|
|
16
16
|
itkdb_gtk/UploadPetalInformation.py,sha256=No7gQEUoO5HJP3Ch3t_j99_xCD9BWrb-PWsDUo7sU6M,24746
|
|
17
17
|
itkdb_gtk/UploadTest.py,sha256=NyNX2itqbMvp4g7XZp5QvXKYZ-ILJrwzcLckLmSDuPw,16570
|
|
18
18
|
itkdb_gtk/WireBondGui.py,sha256=t5Oc89VwvtA562u9bPtFMGTMEXcWFd-K-slrsf61DNY,27120
|
|
19
|
-
itkdb_gtk/__init__.py,sha256=
|
|
19
|
+
itkdb_gtk/__init__.py,sha256=R8jnrJt9Cok-4BP3A9hon27p9RqlNBiQu8uDKBarSU4,1151
|
|
20
20
|
itkdb_gtk/dashBoard.py,sha256=GM5WKEted7zvNyckCiyEpbDotTDQo9T55_mhwMsuWi0,8329
|
|
21
21
|
itkdb_gtk/dbGtkUtils.py,sha256=_DgoE0TmZWxKv2gHXpDa7bgQppVBIcHS0FbByuZy6AE,27936
|
|
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.8.dist-info/METADATA,sha256=Lsegbvx8tfoniCboqqwLSEfMjOqA0A5jB47gP-fA9M8,3125
|
|
26
|
+
itkdb_gtk-0.10.8.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
|
|
27
|
+
itkdb_gtk-0.10.8.dist-info/entry_points.txt,sha256=p7hiZPp4EPyRNzRdu6NqYlDmfflZGGDiDjIJGOcwfig,445
|
|
28
|
+
itkdb_gtk-0.10.8.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
|
|
29
|
+
itkdb_gtk-0.10.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|