itkdb-gtk 0.10.10.dev9__py3-none-any.whl → 0.12.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/GetShipments.py CHANGED
@@ -136,6 +136,12 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
136
136
  btn.connect("clicked", self.receive_items)
137
137
  grid.attach(btn, 2, 3, 1, 1)
138
138
 
139
+ self.check_all = Gtk.ToggleButton(label="Check A_ll", use_underline=True)
140
+ self.check_all.set_active(1)
141
+ self.check_all.set_tooltip_text("If toggled, items will need to be `received`\none by one by unchecking the check box.")
142
+ grid.attach(self.check_all, 3, 3, 1, 1)
143
+
144
+
139
145
  # Add a Separator
140
146
  self.mainBox.pack_start(Gtk.Separator(orientation=Gtk.Orientation.VERTICAL), False, True, 0)
141
147
 
@@ -300,34 +306,46 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
300
306
  else:
301
307
  self.cmb_shipment.set_active(-1)
302
308
  self.cmb_shipment.get_child().set_text("")
309
+ self.tree.set_model(Gtk.ListStore(str, str, str, bool))
303
310
 
311
+ def mark_all_as_delivered(self):
312
+ """Mark all items in current shipment as delivered."""
313
+ if self.store is None:
314
+ return
304
315
 
305
- self.tree.set_model(Gtk.ListStore(str, str, str, bool))
316
+ lv_iter = self.store.get_iter_first()
317
+ while lv_iter:
318
+ val = self.store[lv_iter][3]
319
+ self.store[lv_iter][3] = not val
320
+ lv_iter = self.store.iter_next(lv_iter)
306
321
 
307
322
  def receive_items(self, *args):
308
323
  """Receive shipment items."""
309
324
  data = {}
310
325
  names = {}
326
+ if not self.store:
327
+ self.write_message("Empty list of items.\n")
328
+ return
311
329
 
312
- # self.store is the model of the tree view
313
- if self.store:
314
- lv_iter = self.store.get_iter_first()
315
- while lv_iter:
316
- shpmnt = self.store.get_value(lv_iter, 2)
317
- if shpmnt not in data:
318
- data[shpmnt] = create_shipment_status(shpmnt)
319
- names[shpmnt] = self.store.get_value(lv_iter, 4)
330
+ if not self.check_all.get_active():
331
+ self.mark_all_as_delivered()
320
332
 
321
- item = {
322
- "code": self.store[lv_iter][5],
323
- "delivered": not self.store[lv_iter][3]
324
- }
325
- data[shpmnt]["shipmentItems"].append(item)
333
+ # self.store is the model of the tree view
334
+ lv_iter = self.store.get_iter_first()
335
+ while lv_iter:
336
+ shpmnt = self.store.get_value(lv_iter, 2)
337
+ if shpmnt not in data:
338
+ data[shpmnt] = create_shipment_status(shpmnt)
339
+ names[shpmnt] = self.store.get_value(lv_iter, 4)
340
+
341
+ item = {
342
+ "code": self.store[lv_iter][5],
343
+ "delivered": not self.store[lv_iter][3]
344
+ }
345
+ data[shpmnt]["shipmentItems"].append(item)
326
346
 
327
- lv_iter = self.store.iter_next(lv_iter)
347
+ lv_iter = self.store.iter_next(lv_iter)
328
348
 
329
- else:
330
- self.write_message("Empty list of items.\n")
331
349
 
332
350
  for oid, S in data.items():
333
351
  # Check that all items are there
itkdb_gtk/GlueWeight.py CHANGED
@@ -13,7 +13,7 @@ except ImportError:
13
13
  cwd = Path(__file__).parent.parent
14
14
  sys.path.append(cwd.as_posix())
15
15
 
16
- from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
16
+ from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils, UploadMultipleTests
17
17
  HELP_LINK="https://itkdb-gtk.docs.cern.ch"
18
18
 
19
19
 
@@ -332,22 +332,20 @@ class GlueWeight(dbGtkUtils.ITkDBWindow):
332
332
 
333
333
  def upload_tests(self):
334
334
  """Upload tests to DB."""
335
+ W = UploadMultipleTests.UploadMultipleTests(
336
+ self.session,
337
+ help_link="{}/uploadMultipleTests.html".format(HELP_LINK)
338
+ )
339
+
335
340
  if len(self.test_list)>0:
336
341
  for G in self.test_list:
337
342
  m = G.values
338
- print("### Uploading {} for module {}".format(m["testType"], m["component"]))
339
- resp = ITkDButils.upload_test(self.session, m)
340
-
341
- if resp is not None:
342
- print(resp)
343
+ W.add_test_data_to_view(m)
344
+
343
345
 
344
346
  else:
345
347
  for m in self.modules:
346
- print("### Uploading {} for module {}".format(m["testType"], m["component"]))
347
- resp = ITkDButils.upload_test(self.session, m)
348
-
349
- if resp is not None:
350
- print(resp)
348
+ W.add_test_data_to_view(m)
351
349
 
352
350
 
353
351
  def main():
itkdb_gtk/ITkDButils.py CHANGED
@@ -298,11 +298,11 @@ def upload_test(client, data, attachments=None, check_runNumber=False):
298
298
 
299
299
  if data["runNumber"] in runN:
300
300
  # if the given runNumber is there, try to create a new one.
301
- print("runNumber {} already in {} of {}".format(data["runNumber"], data["testType"], data["component"]))
301
+ #print("runNumber {} already in {} of {}".format(data["runNumber"], data["testType"], data["component"]))
302
302
  try:
303
303
  irun = int(data["runNumber"])
304
304
  for i in range(irun+1, 100):
305
- newRn = "{}".format(i+1)
305
+ newRn = "{}".format(i)
306
306
  if newRn not in runN:
307
307
  data["runNumber"] = newRn
308
308
  break
@@ -468,73 +468,81 @@ class UploadMultipleTests(dbGtkUtils.ITkDBWindow):
468
468
  self.write_message("Something went wrong with the stages\n")
469
469
  return [None, None]
470
470
 
471
+ def add_test_data_to_view(self, data, ifile=None, folder=None):
472
+ """Add a test data to the tree view."""
473
+ has_errors = False
474
+ default_site = None
475
+
476
+ errors, missing = check_data(data)
477
+ if len(missing) > 0:
478
+ self.write_message("Some keys are missing in the JSon file.\n")
479
+ self.write_message("{}\n".format("\n".join(['\t'+line for line in missing])))
480
+
481
+ if "institution" in missing and len(missing) == 1:
482
+ if default_site is None:
483
+ site, use_default = self.get_test_institute()
484
+ if use_default:
485
+ default_site = site
486
+ else:
487
+ site = default_site
488
+
489
+ if site:
490
+ data["institution"] = site
491
+ self.write_message("Setting Institution to {}\n".format(data["institution"]))
492
+
493
+ else:
494
+ has_errors = True
495
+ dbGtkUtils.complain("Invalid JSON file\n{}".format('\n'.join(errors)),"--")
496
+
497
+ if not has_errors:
498
+ attachments = []
499
+ if "attachments" in data:
500
+ for att in data["attachments"]:
501
+ path = Path(att["path"])
502
+ if path.exists():
503
+ path = path.expanduser().resolve()
504
+ else:
505
+ if folder is not None:
506
+ path = folder / path.name
507
+
508
+ if path.exists():
509
+ attachments.append(ITkDButils.Attachment(path=path,
510
+ title=att["title"],
511
+ desc=att["description"]))
512
+ else:
513
+ self.write_message("Ignoring atachment {}".format(data["path"]))
514
+
515
+ # We need to delete this, which is "unofficial"
516
+ del data["attachments"]
517
+
518
+ model = self.tree.get_model()
519
+ comments = data.get("comments", [])
520
+ defects = data.get("defects", [])
521
+ the_date = handle_test_date(data["date"])
522
+ combo, currentStage = self.get_component_stages(data["component"])
523
+ if data["passed"]:
524
+ if data["problems"]:
525
+ color = "orange"
526
+ else:
527
+ color = self.def_color
528
+ else:
529
+ color = "firebrick"
530
+
531
+ model.append([data["component"], data["testType"], data["runNumber"], the_date,
532
+ data["institution"], currentStage, currentStage,
533
+ ifile, data, len(attachments), attachments,
534
+ len(comments), comments, len(defects), defects, color])
535
+
471
536
  def add_tests_to_view(self, files):
472
537
  """Add the input fiels to the treeview."""
473
- default_site = None
474
538
  for ifile in files:
475
539
  try:
476
- has_errors = False
477
- data = json.loads(open(ifile, 'r', encoding="UTF-8").read())
478
- errors, missing = check_data(data)
479
- if len(missing) > 0:
480
- self.write_message("{}\n".format(Path(ifile).name))
481
- self.write_message("Some keys are missing in the JSon file.\n")
482
- self.write_message("{}\n".format("\n".join(['\t'+line for line in missing])))
483
-
484
- if "institution" in missing and len(missing) == 1:
485
- if default_site is None:
486
- site, use_default = self.get_test_institute()
487
- if use_default:
488
- default_site = site
489
- else:
490
- site = default_site
491
-
492
- if site:
493
- data["institution"] = site
494
- self.write_message("Setting Institution to {}\n".format(data["institution"]))
540
+ self.write_message("{}\n".format(Path(ifile).name))
541
+ folder = Path(ifile).parent
495
542
 
496
- else:
497
- has_errors = True
498
- dbGtkUtils.complain("Invalid JSON file\n{}".format('\n'.join(errors)), ifile)
499
-
500
- if not has_errors:
501
- attachments = []
502
- if "attachments" in data:
503
- folder = Path(ifile).parent
504
- for att in data["attachments"]:
505
- path = Path(att["path"])
506
- if path.exists():
507
- path = path.expanduser().resolve()
508
- else:
509
- path = folder / path.name
510
-
511
- if path.exists():
512
- attachments.append(ITkDButils.Attachment(path=path,
513
- title=att["title"],
514
- desc=att["description"]))
515
- else:
516
- self.write_message("Ignoring atachment {}".format(data["path"]))
517
-
518
- # We need to delete tis, which is "unofficial"
519
- del data["attachments"]
520
-
521
- model = self.tree.get_model()
522
- comments = data.get("comments", [])
523
- defects = data.get("defects", [])
524
- the_date = handle_test_date(data["date"])
525
- combo, currentStage = self.get_component_stages(data["component"])
526
- if data["passed"]:
527
- if data["problems"]:
528
- color = "orange"
529
- else:
530
- color = self.def_color
531
- else:
532
- color = "firebrick"
543
+ data = json.loads(open(ifile, 'r', encoding="UTF-8").read())
544
+ self.add_test_data_to_view(data, ifile=ifile, folder=folder)
533
545
 
534
- model.append([data["component"], data["testType"], data["runNumber"], the_date,
535
- data["institution"], currentStage, currentStage,
536
- ifile, data, len(attachments), attachments,
537
- len(comments), comments, len(defects), defects, color])
538
546
 
539
547
  except Exception as E:
540
548
  self.write_message("Cannot load file {}\n".format(ifile))
itkdb_gtk/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """ itkdb-gtk python module
2
2
  """
3
- __version__ = "0.10.10.dev9"
3
+ __version__ = "0.12.0"
4
4
 
5
5
 
6
6
  def dash_board():
@@ -20,13 +20,6 @@ def glueWeight():
20
20
  from .GlueWeight import main
21
21
  main()
22
22
 
23
-
24
- def petalReceptionTests():
25
- """GND/VI tests."""
26
- from .PetalReceptionTests import main
27
- main()
28
-
29
-
30
23
  def createShipments():
31
24
  """Send items."""
32
25
  from .CreateShipments import main
itkdb_gtk/dashBoard.py CHANGED
@@ -13,7 +13,6 @@ except ImportError:
13
13
 
14
14
  from itkdb_gtk import dbGtkUtils
15
15
  from itkdb_gtk import GetShipments
16
- from itkdb_gtk import PetalReceptionTests
17
16
  from itkdb_gtk import ITkDBlogin
18
17
  from itkdb_gtk import CreateShipments
19
18
  from itkdb_gtk import UploadTest
@@ -31,6 +30,7 @@ try:
31
30
  from petal_qc.thermal.coreThermal import CoreThermal
32
31
  from petal_qc.thermal.IRPetalParam import IRPetalParam
33
32
  from petal_qc.metrology.uploadPetalInformation import AVSPanel, AVSOptions
33
+ from petal_qc import PetalReceptionTests
34
34
 
35
35
  HAS_PETALQC = True
36
36
  except ImportError as E:
@@ -50,7 +50,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
50
50
  UPLOAD_MANY_TESTS = 2
51
51
  CREATE_SHIPMNT = 3
52
52
  RECV_SHIPMNT = 4
53
- PETAL_GND = 5
53
+ PETAL_RECEPTION = 5
54
54
  GLUE_WEIGHT = 6
55
55
  MOD_IV = 7
56
56
  WIRE_BOND = 8
@@ -69,9 +69,9 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
69
69
  self.set_border_width(10)
70
70
 
71
71
  # Prepare dashboard
72
- lbl = Gtk.Label()
73
- lbl.set_markup("<big><b>ITkDB available commands.</b></big>")
74
- self.mainBox.pack_start(lbl, True, True, 0)
72
+ #lbl = Gtk.Label()
73
+ #lbl.set_markup("<big><b>ITkDB available commands.</b></big>")
74
+ #self.mainBox.pack_start(lbl, True, True, 0)
75
75
 
76
76
  grid = Gtk.Grid(column_spacing=5, row_spacing=5)
77
77
  self.mainBox.pack_start(grid, False, True, 5)
@@ -91,15 +91,20 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
91
91
  btnTest.connect("clicked", self.upload_multiple_tests)
92
92
  grid.attach(btnTest, 1, irow, 1, 1)
93
93
 
94
- irow += 1
95
- btnGnd = Gtk.Button(label="Petal Reception")
96
- btnGnd.connect("clicked", self.petal_gnd)
97
- grid.attach(btnGnd, 0, irow, 1, 1)
94
+ irow +=1
95
+ separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
96
+ grid.attach(separator, 0, irow, 2, 1)
98
97
 
99
- btnWeight = Gtk.Button(label="GlueWeight")
100
- btnWeight.connect("clicked", self.glue_weight)
101
- grid.attach(btnWeight, 1, irow, 1, 1)
98
+ irow += 1
99
+ btnModVI = Gtk.Button(label="Module/Sensor Visual Insp.")
100
+ btnModVI.connect("clicked", self.module_VI)
101
+ grid.attach(btnModVI, 0, irow, 1, 1)
102
+
102
103
 
104
+ btnPanelVI = Gtk.Button(label="Panel Visual Insp.")
105
+ btnPanelVI.connect("clicked", self.panel_VI)
106
+ grid.attach(btnPanelVI, 1, irow, 1, 1)
107
+
103
108
  irow += 1
104
109
  btnModIV = Gtk.Button(label="Sensor/Module IV")
105
110
  btnModIV.connect("clicked", self.module_IV)
@@ -110,20 +115,26 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
110
115
  grid.attach(btnWireBond, 1, irow, 1, 1)
111
116
 
112
117
  irow += 1
113
- btnPanelVI = Gtk.Button(label="Panel Visual Insp.")
114
- btnPanelVI.connect("clicked", self.panel_VI)
115
- grid.attach(btnPanelVI, 1, irow, 1, 1)
118
+ btnWeight = Gtk.Button(label="GlueWeight")
119
+ btnWeight.connect("clicked", self.glue_weight)
120
+ grid.attach(btnWeight, 0, irow, 1, 1)
121
+
116
122
 
117
- btnModVI = Gtk.Button(label="Module/Sensor Visual Insp.")
118
- btnModVI.connect("clicked", self.module_VI)
119
- grid.attach(btnModVI, 0, irow, 1, 1)
120
123
 
121
124
  if HAS_PETALQC:
125
+ irow +=1
126
+ separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
127
+ grid.attach(separator, 0, irow, 2, 1)
128
+
122
129
  irow +=1
123
130
  btnPetalInfo = Gtk.Button(label="AVS Petal Info")
124
131
  btnPetalInfo.connect("clicked", self.upload_petal_info)
125
132
  grid.attach(btnPetalInfo, 0, irow, 1, 1)
126
133
 
134
+ btnGnd = Gtk.Button(label="Petal Reception")
135
+ btnGnd.connect("clicked", self.petal_reception)
136
+ grid.attach(btnGnd, 1, irow, 1, 1)
137
+
127
138
  irow +=1
128
139
  btnPetalMetrology = Gtk.Button(label="Petal Core Metrology")
129
140
  btnPetalMetrology.connect("clicked", self.petal_metrology)
@@ -211,19 +222,6 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
211
222
  )
212
223
  W.connect("destroy", self.app_closed, bitn)
213
224
 
214
- def petal_gnd(self, *args):
215
- """Petal GND/VI test."""
216
- bitn = DashWindow.PETAL_GND
217
- bt = 1 << bitn
218
- if self.mask & bt:
219
- return
220
-
221
- self.mask |= bt
222
- W = PetalReceptionTests.PetalReceptionTests(
223
- self.session,
224
- help_link="{}/petalReceptionTests.html".format(HELP_LINK)
225
- )
226
- W.connect("destroy", self.app_closed, bitn)
227
225
 
228
226
  def glue_weight(self, *args):
229
227
  """Glue Weight test."""
@@ -297,6 +295,21 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
297
295
  )
298
296
  W.connect("destroy", self.app_closed, bitn)
299
297
  W.show_all()
298
+
299
+ def petal_reception(self, *args):
300
+ """Petal GND/VI test."""
301
+ bitn = DashWindow.PETAL_RECEPTION
302
+ bt = 1 << bitn
303
+ if self.mask & bt:
304
+ return
305
+
306
+ self.mask |= bt
307
+ W = PetalReceptionTests.PetalReceptionTests(
308
+ self.session,
309
+ help_link="{}/petalReceptionTests.html".format(HELP_LINK)
310
+ )
311
+ W.connect("destroy", self.app_closed, bitn)
312
+
300
313
 
301
314
  def upload_petal_info(self, *srgs):
302
315
  """Upload petal Info."""
@@ -341,10 +354,13 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
341
354
 
342
355
  self.mask |= bt
343
356
  opt = IRPetalParam()
357
+ opt.files = []
358
+ opt.golden = None
344
359
  opt.folder = None
345
360
  opt.out = None
346
361
  opt.alias = None
347
362
  opt.SN = None
363
+ opt.desy = False
348
364
  W = CoreThermal(opt, self.session, title="Petal Thermal Test.")
349
365
  W.connect("destroy", self.app_closed, bitn)
350
366
  W.show_all()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itkdb_gtk
3
- Version: 0.10.10.dev9
3
+ Version: 0.12.0
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
@@ -1,28 +1,27 @@
1
1
  itkdb_gtk/CreateShipments.py,sha256=eiVjw7zGLGAoqWxThBc6IVvXLUFXmtQ-_hpZzfDOKx0,13249
2
- itkdb_gtk/GetShipments.py,sha256=tEGWAmfW86jiAkc6cflVWR2QpKwhOLSRZicwwcfQVKw,18465
3
- itkdb_gtk/GlueWeight.py,sha256=OSc5EJjyzgZC9sk21L7K_gs88peSrEcC2CWbl1uNXTU,11749
2
+ itkdb_gtk/GetShipments.py,sha256=b3TECQhHlK0kGXH6KjQs06yuzIfTN5tjtiu6wnEOuJ8,19172
3
+ 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=WYjE_DOnFJdxhhQ5ylVTupIOjrp2r83jQALa0Gc2xZg,19587
7
+ itkdb_gtk/ITkDButils.py,sha256=p1r1HqY0hP47Y0fRRweLPNR6rbPRebWS8d9y_vdj_lk,19586
8
8
  itkdb_gtk/PanelVisualInspection.py,sha256=ktAcYbdLBS7Zbxq9XsxB_AWTgAfFLa42NFTEsxnBn98,20531
9
- itkdb_gtk/PetalReceptionTests.py,sha256=N9_lBvao-HeHPwccjycUL7p3R3V_nPur1WibXbcqjgI,9992
10
9
  itkdb_gtk/SensorUtils.py,sha256=fYWF9TeutAbore53dLWNlZnVn9P3OsKYcFLNGOs8cnI,15426
11
10
  itkdb_gtk/ShowAttachments.py,sha256=KExxPCdbcb04XS8JSUkg5xF1McvlB8e9btwctDCKNXU,8498
12
11
  itkdb_gtk/ShowComments.py,sha256=OiMTFLnhGbbKRj5x61D517BYHAt-qY5Y1lvR3EQz3c0,3151
13
12
  itkdb_gtk/ShowDefects.py,sha256=aVAHeaE5IztmAPEuHwhi06KWo_pi9xX2J1fTLhKyAPI,3530
14
13
  itkdb_gtk/UploadModuleIV.py,sha256=sqh52bSxANBwlmVWZlDqFXpqRGf0rV0QsjJWC-tY_qI,17792
15
- itkdb_gtk/UploadMultipleTests.py,sha256=EaDM5t_-tkGlgg66Nb36iGN7dT3-wvsrWwChpbXGML0,24287
14
+ itkdb_gtk/UploadMultipleTests.py,sha256=TFEqcRd2ZZAVhK3P3Qn2vg81NouOCjkjqn9PhoHYhPM,24125
16
15
  itkdb_gtk/UploadTest.py,sha256=ukgJ5-IG12bqa1QIp3bXIV8hkdXCv5UDxh1lQswN_ko,16832
17
16
  itkdb_gtk/VisualInspection.py,sha256=i2i_9ttetMzGFRcBFm_ow7aziksTgvZzVLUxZhwiyBg,9850
18
17
  itkdb_gtk/WireBondGui.py,sha256=WFTLOw4l5JxSbvh4vZMxcF65fqlwvNw0fOyEru9ijqQ,39850
19
- itkdb_gtk/__init__.py,sha256=23qH2hGi_hozwXJbDTvLWJZWyRACKFft-8KsRf5TdCc,1269
20
- itkdb_gtk/dashBoard.py,sha256=b2QmPUtjo_gAxf3u5t5_V35J580i9V-4FLr2NvmDzAw,10999
18
+ itkdb_gtk/__init__.py,sha256=QfVXwkRQsVu9ek_4Ea5wQE8-2EW7TCaMBd8FxZToNI4,1156
19
+ itkdb_gtk/dashBoard.py,sha256=DHoCxqhCtOvh7s3lMDJIxFVKEVCVvlnlteEyOjmUgIk,11432
21
20
  itkdb_gtk/dbGtkUtils.py,sha256=THW-IT5UJB1YluvUVIfpy6oIY2faSHChNKGTpY5qzag,30480
22
21
  itkdb_gtk/readGoogleSheet.py,sha256=Lzm_oPWwDqZZzKoBUgsp277F9-wCfr_BA0X4VD2Eolo,2673
23
22
  itkdb_gtk/untrash_component.py,sha256=VrN46-f-kF7voOxtoh7OL-bZSWAaIFb7-Xbx6_WT7K8,757
24
- itkdb_gtk-0.10.10.dev9.dist-info/METADATA,sha256=FjbmJX0AH9AFQCI15uwKoWwlg7qZPzOjbr5m_npnetM,3156
25
- itkdb_gtk-0.10.10.dev9.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
26
- itkdb_gtk-0.10.10.dev9.dist-info/entry_points.txt,sha256=51wi4BRW1vYuLNySWC6bsmQPo7XPI7cvPFAaBD49Ib0,489
27
- itkdb_gtk-0.10.10.dev9.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
28
- itkdb_gtk-0.10.10.dev9.dist-info/RECORD,,
23
+ itkdb_gtk-0.12.0.dist-info/METADATA,sha256=Xb7vlboPsvtqE5Wzh37Y_yMrlGhHkDhhw8CLbPKLu6o,3150
24
+ itkdb_gtk-0.12.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
25
+ itkdb_gtk-0.12.0.dist-info/entry_points.txt,sha256=pKg7qpsrZh1GUQ-n3aFsSxmTVm0h4Qdb_6nsNO_PsFw,437
26
+ itkdb_gtk-0.12.0.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
27
+ itkdb_gtk-0.12.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -4,7 +4,6 @@ getShipments = itkdb_gtk:getShipments
4
4
  glueWeight = itkdb_gtk:glueWeight
5
5
  itkdb_dashBoard = itkdb_gtk:dash_board
6
6
  panelVisualInspection = itkdb_gtk:panelVisualInspection
7
- petalReceptionTests = itkdb_gtk:petalReceptionTests
8
7
  uploadModuleIV = itkdb_gtk:uploadModuleIV
9
8
  uploadMultipleTests = itkdb_gtk:uploadMultipleTests
10
9
  uploadTest = itkdb_gtk:uploadTest
@@ -1,308 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Test dashboard."""
3
- import sys
4
- import copy
5
- from pathlib import Path
6
-
7
- try:
8
- import itkdb_gtk
9
-
10
- except ImportError:
11
- cwd = Path(__file__).parent.parent
12
- sys.path.append(cwd.as_posix())
13
- import itkdb_gtk
14
-
15
- from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
16
-
17
- import gi
18
- gi.require_version("Gtk", "3.0")
19
- from gi.repository import Gtk, Gio
20
-
21
-
22
- def find_children(W):
23
- """Find DictDialog among the children."""
24
- try:
25
- for c in W.get_children():
26
- if "DictDialog" in c.get_name():
27
- return c
28
-
29
- else:
30
- return find_children(c)
31
-
32
- except Exception:
33
- return None
34
-
35
- return None
36
-
37
-
38
- class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
39
- """Petl Reception Test GUI."""
40
-
41
- def __init__(self, session, help_link=None):
42
- """Initialization."""
43
- super().__init__(title="Petal Reception Tests",
44
- session=session,
45
- show_search="Find object with given SN.",
46
- help_link=help_link)
47
-
48
- # Members
49
- self.dbObject = None
50
-
51
- # action button in header
52
- button = Gtk.Button()
53
- icon = Gio.ThemedIcon(name="document-send-symbolic")
54
- image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
55
- button.add(image)
56
- button.set_tooltip_text("Click to upload ALL tests.")
57
- button.connect("clicked", self.upload_tests)
58
- self.hb.pack_end(button)
59
-
60
- grid = Gtk.Grid(column_spacing=5, row_spacing=1)
61
- self.mainBox.pack_start(grid, False, False, 5)
62
-
63
- lbl = Gtk.Label(label="Serial Number")
64
- lbl.set_xalign(0)
65
- grid.attach(lbl, 0, 0, 1, 1)
66
-
67
-
68
- self.SN = itkdb_gtk.dbGtkUtils.TextEntry()
69
- self.SN.connect("text-changed", self.on_SN_changed)
70
-
71
- #self.SN = Gtk.Entry()
72
- #self.SN.connect("focus-in-event", self.on_sn_enter)
73
- #self.SN.connect("focus-out-event", self.on_sn_leave)
74
- grid.attach(self.SN.entry, 1, 0, 1, 1)
75
-
76
- self.alias = Gtk.Label(label="")
77
- grid.attach(self.alias, 2, 0, 1, 1)
78
-
79
- self.stage = Gtk.Label(label="")
80
- grid.attach(self.stage, 3, 0, 1, 1)
81
-
82
- lbl = Gtk.Label(label="Institute")
83
- lbl.set_xalign(0)
84
- grid.attach(lbl, 0, 1, 1, 1)
85
-
86
- self.institute = self.pdb_user["institutions"][0]["code"]
87
- inst = self.create_institute_combo(only_user=True)
88
- inst.connect("changed", self.new_institute)
89
- inst.set_tooltip_text("Select the Institute.")
90
- grid.attach(inst, 1, 1, 1, 1)
91
- self.inst_cmb = inst
92
-
93
- # The "Add/Remove/Send Item" buttons.
94
- box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL)
95
- box.set_layout(Gtk.ButtonBoxStyle.END)
96
- self.mainBox.pack_start(box, False, False, 0)
97
- dbGtkUtils.add_button_to_container(box, "Upload test", "Upload this test", self.upload_single_test)
98
- dbGtkUtils.add_button_to_container(box, "Add Defect", "Click to add a defect", self.add_defect)
99
- dbGtkUtils.add_button_to_container(box, "Add Comment", "Click to add a comment", self.add_comment)
100
-
101
- # The notebook
102
- self.notebook = Gtk.Notebook()
103
- self.notebook.set_tab_pos(Gtk.PositionType.LEFT)
104
- self.notebook.set_size_request(-1, 250)
105
- self.mainBox.pack_start(self.notebook, True, True, 0)
106
-
107
- # Create the Notebook pages
108
- self.create_test_box("Visual Inspection", "VISUAL_INSPECTION")
109
- self.create_test_box("Grounding", "GROUNDING_CHECK")
110
- self.create_test_box("Pipe bending", "BENDING120")
111
- self.create_test_box("X-rays", "XRAYIMAGING")
112
-
113
-
114
- # The text view
115
- self.mainBox.pack_end(self.message_panel.frame, True, True, 5)
116
-
117
- # Set the default institute
118
- dbGtkUtils.set_combo_iter(inst, self.institute)
119
-
120
-
121
- self.show_all()
122
-
123
- def on_SN_changed(self, entry, value):
124
- """New SN given. Ask in PDB,"""
125
- if len(value) <= 0:
126
- return None
127
-
128
- self.query_db()
129
- current_location = self.dbObject["currentLocation"]["code"]
130
- dbGtkUtils.set_combo_iter(self.inst_cmb, current_location, 0)
131
-
132
- stg = self.dbObject["currentStage"]["name"]
133
- self.stage.set_text(stg)
134
-
135
- entry.set_text(self.dbObject["serialNumber"])
136
-
137
- alias = self.dbObject["alternativeIdentifier"]
138
- self.alias.set_text(alias)
139
-
140
- npages = self.notebook.get_n_pages()
141
- for i in range(npages):
142
- page = self.notebook.get_nth_page(i)
143
- page.dict_dialog.factory_reset()
144
-
145
-
146
- def create_test_box(self, label, test_name, institute=None):
147
- """Create and add to notebook a test dialog.
148
-
149
- Args:
150
- label: The label for the Notebook
151
- test_name: The DB name of the test
152
- institute: The institute.
153
-
154
- """
155
- if institute is None:
156
- institute = self.institute
157
-
158
- defaults = {
159
- "institution": institute,
160
- "runNumber": "1",
161
- }
162
- dto = ITkDButils.get_test_skeleton(self.session, "CORE_PETAL", test_name, defaults)
163
- if test_name == "VISUAL_INSPECTION":
164
- scrolled, gM = dbGtkUtils.create_scrolled_dictdialog(dto, ("component", "testType", "results"))
165
- else:
166
- scrolled, gM = dbGtkUtils.create_scrolled_dictdialog(dto)
167
-
168
- box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
169
- box.set_border_width(5)
170
- box.pack_end(scrolled, True, True, 0)
171
- box.dict_dialog = gM
172
- gM.box = box
173
-
174
- self.notebook.append_page(box, Gtk.Label(label=label))
175
-
176
- return gM
177
-
178
- def query_db(self, *args):
179
- """Search button clicked."""
180
- SN = self.SN.get_text()
181
- if len(SN) == 0:
182
- dbGtkUtils.complain("Empty Serial number",
183
- "You should enter a valid Serial number for the petal core.",
184
- parent=self)
185
-
186
- try:
187
- self.dbObject = ITkDButils.get_DB_component(self.session, SN)
188
-
189
- except Exception as E:
190
- self.write_message(str(E)+'\n')
191
- dbGtkUtils.complain("Could not find object in DB", str(E))
192
- self.dbObject = None
193
- return
194
-
195
- #print(json.dumps(self.dbObject, indent=3))
196
-
197
- def add_defect(self, btn):
198
- """Add a new defect."""
199
- page = self.notebook.get_nth_page(self.notebook.get_current_page())
200
- values = dbGtkUtils.get_a_list_of_values("Insert new defect", ("Type", "Description/v"))
201
- if len(values)>0:
202
- defect = {"name": values[0], "description": values[1]}
203
- page.dict_dialog.values["defects"].append(defect)
204
- page.dict_dialog.refresh()
205
-
206
- def add_comment(self, btn):
207
- """Add a new comment."""
208
- page = self.notebook.get_nth_page(self.notebook.get_current_page())
209
- comment = dbGtkUtils.get_a_value("Insert new comment", is_tv=True)
210
- if comment:
211
- page.dict_dialog.values["comments"].append(comment)
212
- page.dict_dialog.refresh()
213
-
214
- def new_institute(self, combo):
215
- """A new institute has been selected."""
216
- inst = self.get_institute_from_combo(combo)
217
- if inst:
218
- self.institute = inst
219
-
220
- npages = self.notebook.get_n_pages()
221
- for i in range(npages):
222
- page = self.notebook.get_nth_page(i)
223
- page.dict_dialog.values["institution"] = self.institute
224
- page.dict_dialog.refresh()
225
-
226
- def upload_this_test(self, values):
227
- """Upload a single test."""
228
- # print(json.dumps(values, indent=2))
229
-
230
- attachments = []
231
- if values["testType"] == "XRAYIMAGING":
232
- fnam = values["results"]["IMAGELINK"]
233
- if fnam is not None and len(fnam)>0:
234
- P = Path(fnam).expanduser().resolve()
235
- if P.exists():
236
- A = ITkDButils.Attachment(path=P.as_posix(), title=P.name, desc="X-ray image")
237
- values["results"]["IMAGELINK"] = P.name
238
- attachments.append(A)
239
-
240
- rc = ITkDButils.upload_test(self.session, values, attachments=attachments, check_runNumber=True)
241
- if rc is not None:
242
- dbGtkUtils.complain("Could not upload test", rc)
243
-
244
- else:
245
- self.write_message("Test uploaded. {} - {}\n".format(values["component"], values["testType"]))
246
-
247
- def upload_single_test(self, *args):
248
- """Upload the current test."""
249
- SN = self.SN.get_text()
250
- if len(SN) == 0:
251
- dbGtkUtils.complain("Petal SN is empty")
252
- return
253
-
254
- page = self.notebook.get_nth_page(self.notebook.get_current_page())
255
- dctD = find_children(page)
256
- if dctD is None:
257
- return
258
-
259
- values = copy.deepcopy(dctD.values)
260
- values["component"] = SN
261
- self.upload_this_test(values)
262
-
263
- def upload_tests(self, *args):
264
- """Upload the current test."""
265
- SN = self.SN.get_text()
266
- if len(SN) == 0:
267
- dbGtkUtils.complain("Petal SN is empty")
268
- return
269
-
270
- for ipage in range(self.notebook.get_n_pages()):
271
- page = self.notebook.get_nth_page(ipage)
272
- dctD = find_children(page)
273
- if dctD is None:
274
- continue
275
-
276
- values = dctD.values
277
- values["component"] = SN
278
- self.upload_this_test(values)
279
-
280
- def main():
281
- """Main entry."""
282
- # DB login
283
- HELP_LINK="https://itkdb-gtk.docs.cern.ch/petalReceptionTests.html"
284
-
285
- dlg = ITkDBlogin.ITkDBlogin()
286
- client = dlg.get_client()
287
- if client is None:
288
- print("Could not connect to DB with provided credentials.")
289
- dlg.die()
290
- sys.exit()
291
-
292
- client.user_gui = dlg
293
-
294
- gTest = PetalReceptionTests(client, help_link=HELP_LINK)
295
-
296
- gTest.present()
297
- gTest.connect("destroy", Gtk.main_quit)
298
- try:
299
- Gtk.main()
300
-
301
- except KeyboardInterrupt:
302
- print("Arrrgggg!!!")
303
-
304
- dlg.die()
305
-
306
-
307
- if __name__ == "__main__":
308
- main()