itkdb-gtk 0.10.9.dev3__py3-none-any.whl → 0.10.10.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/dbGtkUtils.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """A set of GTK utilities for DB scripts."""
2
+ import sys
2
3
  import json
3
4
  import time
4
5
  import pathlib
@@ -18,6 +19,16 @@ gi.require_version("Gtk", "3.0")
18
19
  from gi.repository import Gtk, GObject, Gio, GLib
19
20
 
20
21
 
22
+ try:
23
+ import itkdb_gtk
24
+
25
+ except ImportError:
26
+ cwd = pathlib.Path(__file__).parent.parent
27
+ sys.path.append(cwd.as_posix())
28
+
29
+ from itkdb_gtk import ITkDButils
30
+
31
+
21
32
  def setup_scanner(callback):
22
33
  """Setup scanner and callback function."""
23
34
  for fnam in ["/dev/ttyACM0", "/dev/cu.usbmodemS_N_G19F204881"]:
@@ -51,9 +62,10 @@ def parse_date(txt):
51
62
  try:
52
63
  return dateutil.parser.parse(txt, fuzzy=False)
53
64
 
54
- except Exception:
65
+ except dateutil.parser.ParserError:
55
66
  return None
56
67
 
68
+
57
69
  def parse_date_as_string(txt):
58
70
  """Parse data and return DB compatible string."""
59
71
  D = parse_date(txt)
@@ -76,7 +88,7 @@ def is_a_date(txt):
76
88
  dateutil.parser.parse(txt, fuzzy=False)
77
89
  return True
78
90
 
79
- except Exception:
91
+ except (dateutil.parser.ParserError, OverflowError):
80
92
  return False
81
93
 
82
94
  def new_small_text_entry():
@@ -111,14 +123,14 @@ def set_button_color(btn, bg_color, fg_color="white"):
111
123
  def set_combo_iter(combo, txt, col=0):
112
124
  """Set scombo active iter to that containing txt in column col."""
113
125
  model = combo.get_model()
114
- iter = model.get_iter_first()
115
- while iter:
116
- val = model.get_value(iter, col)
126
+ lv_iter = model.get_iter_first()
127
+ while lv_iter:
128
+ val = model.get_value(lv_iter, col)
117
129
  if val == txt:
118
- combo.set_active_iter(iter)
130
+ combo.set_active_iter(lv_iter)
119
131
  break
120
132
 
121
- iter = model.iter_next(iter)
133
+ lv_iter = model.iter_next(lv_iter)
122
134
 
123
135
 
124
136
  def is_iterable(obj):
@@ -223,7 +235,6 @@ def ask_for_confirmation(main_title, second_text, parent=None):
223
235
  dialog.destroy()
224
236
  return (out == Gtk.ResponseType.OK)
225
237
 
226
-
227
238
  class TextEntry(GObject.GObject):
228
239
  """Create a Gtk text entry/view object."""
229
240
  __gsignals__ = {
@@ -259,7 +270,7 @@ class TextEntry(GObject.GObject):
259
270
 
260
271
  def do_my_signal(self, *args):
261
272
  """Signal handler."""
262
- pass
273
+ return
263
274
 
264
275
  def on_enter(self, *args):
265
276
  """On enter."""
@@ -285,6 +296,9 @@ class TextEntry(GObject.GObject):
285
296
 
286
297
  def set_text(self, text):
287
298
  """Sets text."""
299
+ if text is None:
300
+ return
301
+
288
302
  if self.nlines > 1:
289
303
  self.entry.get_buffer().set_text(text)
290
304
  else:
@@ -304,7 +318,7 @@ def get_a_value(main_title, second_text=None, is_tv=False, parent=None):
304
318
  value: The value in the entry
305
319
 
306
320
  """
307
- dlg = Gtk.Dialog(title="Add Attachment",
321
+ dlg = Gtk.Dialog(title="Get a Value",
308
322
  transient_for=parent,
309
323
  flags=0)
310
324
  dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
@@ -385,7 +399,8 @@ def get_a_list_of_values(main_title, labels, defaults=None, second_text=None, pa
385
399
  entry = TextEntry(3 if use_tv else -1)
386
400
  try:
387
401
  entry.set_text(defaults[i])
388
- except Exception:
402
+
403
+ except (TypeError, IndexError):
389
404
  pass
390
405
 
391
406
  vbox.pack_start(entry.widget, False, False, 0)
@@ -493,7 +508,7 @@ class MessagePanel(object):
493
508
  class ITkDBWindow(Gtk.Window):
494
509
  """Base class for GUI main windows."""
495
510
 
496
- def __init__(self, title="", session=None, show_search=None, help=None, gtk_runs=True, panel_size=100):
511
+ def __init__(self, title="", session=None, show_search=None, help_link=None, gtk_runs=True, panel_size=100):
497
512
  """Initialization.
498
513
 
499
514
  Args:
@@ -509,13 +524,14 @@ class ITkDBWindow(Gtk.Window):
509
524
  self.inst2code = {}
510
525
  self.code2inst = {}
511
526
  self.message_panel = None
512
- self.help = help
527
+ self.help = help_link
528
+ self.pdb_user = ITkDButils.get_db_user(self.session)
513
529
 
514
530
  if gtk_runs:
515
531
  super().__init__(title=title)
516
- self.prepare_window(show_search, panel_size)
532
+ self.prepare_window(title, show_search, panel_size)
517
533
 
518
- def prepare_window(self, show_search, panel_size):
534
+ def prepare_window(self, title, show_search, panel_size):
519
535
  """Inititalizes GUI."""
520
536
  # Prepare HeaderBar
521
537
  self.hb = Gtk.HeaderBar()
@@ -552,6 +568,14 @@ class ITkDBWindow(Gtk.Window):
552
568
  self.mainBox.set_property("margin-left", 6)
553
569
  self.mainBox.set_property("margin-right", 6)
554
570
 
571
+ self.title_label = None
572
+ if len(title)>0:
573
+ lbl = Gtk.Label()
574
+ lbl.set_markup("<big><b>{}\n</b></big>".format(title))
575
+ lbl.set_xalign(0.5)
576
+ self.mainBox.pack_start(lbl, False, False, 2)
577
+ self.title_label = lbl
578
+
555
579
  self.add(self.mainBox)
556
580
 
557
581
  # The text view and buffer
@@ -566,6 +590,13 @@ class ITkDBWindow(Gtk.Window):
566
590
 
567
591
  self.mainBox.pack_end(btnBox, False, True, 0)
568
592
 
593
+ def set_window_title(self, title):
594
+ """Set window title."""
595
+ hb = self.get_titlebar()
596
+ hb.props.title = title
597
+ if self.title_label:
598
+ self.title_label.set_markup("<big><b>{}\n</b></big>".format(title))
599
+
569
600
  def quit(self, *args):
570
601
  """Quits the application."""
571
602
  self.hide()
@@ -577,7 +608,7 @@ class ITkDBWindow(Gtk.Window):
577
608
 
578
609
  def query_db(self, *args):
579
610
  """Search button clicked."""
580
- pass
611
+ return
581
612
 
582
613
  def new_login(self, obj, msg):
583
614
  """A new user logged in."""
@@ -596,18 +627,32 @@ class ITkDBWindow(Gtk.Window):
596
627
  if hasattr(self.session, "user_gui"):
597
628
  self.session.user_gui.reconnect(force=True)
598
629
 
599
- def create_institute_combo(self):
600
- """Create a combe with all institutes."""
601
- compltn = self.get_institute_list()
630
+ def create_institute_combo(self, only_user=False):
631
+ """Create a combe with all institutes.
632
+
633
+ Args:
634
+ only_user: if True, add only institutes the user belongs to.
635
+
636
+ """
637
+ compltn = self.get_institute_list(only_user)
602
638
  combo = Gtk.ComboBox.new_with_model_and_entry(compltn.get_model())
603
639
  combo.set_entry_text_column(0)
604
640
  combo.get_child().set_completion(compltn)
605
641
 
606
642
  return combo
607
643
 
608
- def get_institute_list(self):
609
- """Get the institute list."""
610
- sites = self.session.get("listInstitutions", json={})
644
+ def get_institute_list(self, only_user=False):
645
+ """Get the institute list.
646
+
647
+ Args:
648
+ only_user: if True, add only institutes the user belongs to.
649
+
650
+ """
651
+ if only_user and self.pdb_user:
652
+ sites = self.pdb_user["institutions"]
653
+ else:
654
+ sites = self.session.get("listInstitutions", json={})
655
+
611
656
  liststore = Gtk.ListStore(str, str)
612
657
  for site in sites:
613
658
  self.code2inst[site['code']] = site['name']
@@ -884,7 +929,8 @@ def create_scrolled_dictdialog(the_dict, hidden=("component", "testType")):
884
929
  return scrolled, gM
885
930
 
886
931
 
887
- if __name__ == "__main__":
932
+ def main():
933
+ """Main entry."""
888
934
  result = {
889
935
  "component": "the_serial_nukber",
890
936
  "testType": "METROLOGY_AVS",
@@ -946,3 +992,6 @@ if __name__ == "__main__":
946
992
 
947
993
  win.show_all()
948
994
  Gtk.main()
995
+
996
+ if __name__ == "__main__":
997
+ main()
itkdb_gtk/readAVSdata.py CHANGED
@@ -367,7 +367,7 @@ def check_for_problems(sheet, the_test, row_range):
367
367
  reason = cell_value(sheet, "i{}".format(row))
368
368
 
369
369
  if reason:
370
- if len(reason) < 20:
370
+ if len(reason) < 1:
371
371
  msg = "{}: {}".format(hdr, reason)
372
372
  the_test["defects"].append({"name": msg})
373
373
  else:
@@ -395,7 +395,7 @@ def readFATfile(session, file_path, SN=None):
395
395
  """
396
396
  # Open spreadsheet
397
397
  try:
398
- wb = XL.load_workbook(file_path)
398
+ wb = XL.load_workbook(file_path, data_only=True)
399
399
  except InvalidFileException as ee:
400
400
  print("Could not open input file: ", file_path)
401
401
  print(ee)
@@ -566,7 +566,7 @@ def readProductionSheet(session, file_path, SN):
566
566
 
567
567
  """
568
568
  try:
569
- wb = XL.load_workbook(file_path)
569
+ wb = XL.load_workbook(file_path, data_only=True)
570
570
  except InvalidFileException as ee:
571
571
  print("Could not open input file: ", file_path)
572
572
  print(ee.message)
@@ -688,6 +688,6 @@ if __name__ == "__main__":
688
688
  sys.exit()
689
689
 
690
690
  fnam = Path(options.files[0]).expanduser().resolve()
691
- # readProductionSheet(fnam, options.SN)
692
- readFATfile(client, fnam, options.SN)
691
+ readProductionSheet(client, fnam, options.SN)
692
+ # readFATfile(client, fnam, options.SN)
693
693
  dlg.die()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itkdb_gtk
3
- Version: 0.10.9.dev3
3
+ Version: 0.10.10.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
@@ -0,0 +1,29 @@
1
+ itkdb_gtk/CreateShipments.py,sha256=BC87vSINAgzCFkeisBn54NMUPm-jN0ysOA0JBj6m1Uo,13102
2
+ itkdb_gtk/GetShipments.py,sha256=qrQFXZYo48LzlSWGERsi1qCaerDGrlHJ4ZR-QqpzuGg,18049
3
+ itkdb_gtk/GlueWeight.py,sha256=tyF5-EAc6QkOLo9ZRp807Xx6zK6yYBGElvfmpUYeuUA,12284
4
+ itkdb_gtk/ITkDB.desktop,sha256=v_K4mHsDxb912J1XGo6mOlbW2TkHvYNGrKmiOnsBQqM,172
5
+ itkdb_gtk/ITkDB.svg,sha256=Ry702zrUkxvG61SqThbUNfXySyiLMqalwYpcM-b_KWo,24242
6
+ itkdb_gtk/ITkDBlogin.py,sha256=40tipm_j5eUS4dnZnBT8VyL6Bu_8csuqS9TPWKxvKSY,10038
7
+ itkdb_gtk/ITkDButils.py,sha256=SCp9NFAFcNM_9m2PCEYdnn3SJDU7JhDAXFcBWkgR6es,19201
8
+ itkdb_gtk/PanelVisualInspection.py,sha256=J9I8sEH899xckcTi-zUJ2v7bxqU6sDXliUU8TYhtaRc,20209
9
+ itkdb_gtk/PetalReceptionTests.py,sha256=4yCL6gsHouAUNK9BGYMQ3oOK_LaCOHnIfDHPidsXC9M,9889
10
+ itkdb_gtk/SensorUtils.py,sha256=fYWF9TeutAbore53dLWNlZnVn9P3OsKYcFLNGOs8cnI,15426
11
+ itkdb_gtk/ShowAttachments.py,sha256=KExxPCdbcb04XS8JSUkg5xF1McvlB8e9btwctDCKNXU,8498
12
+ itkdb_gtk/ShowComments.py,sha256=OiMTFLnhGbbKRj5x61D517BYHAt-qY5Y1lvR3EQz3c0,3151
13
+ itkdb_gtk/ShowDefects.py,sha256=aVAHeaE5IztmAPEuHwhi06KWo_pi9xX2J1fTLhKyAPI,3530
14
+ itkdb_gtk/UploadModuleIV.py,sha256=sqh52bSxANBwlmVWZlDqFXpqRGf0rV0QsjJWC-tY_qI,17792
15
+ itkdb_gtk/UploadMultipleTests.py,sha256=U94u9WJLeHPgBKT2lPOCxTaXf1Rv19mb5VzLq6bYPwA,22531
16
+ itkdb_gtk/UploadPetalInformation.py,sha256=N0OgGcbjB6uagUUJVwSNhuNPnGHh8PtqjOm2BncrYxI,25874
17
+ itkdb_gtk/UploadTest.py,sha256=g2NohkkRNJXsaODncyR6hnYpawURA6VBSqFe1Zg-h2A,16641
18
+ itkdb_gtk/WireBondGui.py,sha256=X2MIYXSTzz6odjkx-XGUYbbcWNuZQvbIC18RxVgmNvY,32956
19
+ itkdb_gtk/__init__.py,sha256=Ax7S_uyK8PeTfLYfnB26IWSU2hiD2XVyV_ySxcETXVs,1292
20
+ itkdb_gtk/dashBoard.py,sha256=FOmp0hwToN5Lo3cHf1a5RZv6fP9EsIs462PJErtz7Pw,9010
21
+ itkdb_gtk/dbGtkUtils.py,sha256=aM-XY3zWyrCwodBKPNZxIOYkRgA0K8w8HZonAWXS6tg,30239
22
+ itkdb_gtk/readAVSdata.py,sha256=NFJ7XYUeKbTxPKfu0kEjq8wBErS88bCFmNpjQyA2jcM,23478
23
+ itkdb_gtk/readGoogleSheet.py,sha256=Lzm_oPWwDqZZzKoBUgsp277F9-wCfr_BA0X4VD2Eolo,2673
24
+ itkdb_gtk/untrash_component.py,sha256=VrN46-f-kF7voOxtoh7OL-bZSWAaIFb7-Xbx6_WT7K8,757
25
+ itkdb_gtk-0.10.10.dev1.dist-info/METADATA,sha256=VQdXKrtGEOirYAsypcUB_VE7c-8TP2Q-nHFaYWS7Lqc,3156
26
+ itkdb_gtk-0.10.10.dev1.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
27
+ itkdb_gtk-0.10.10.dev1.dist-info/entry_points.txt,sha256=Xf_DDU3QlT2zogRFMOJdO4BdVuAKyAwmb2jHZ5KbBxE,501
28
+ itkdb_gtk-0.10.10.dev1.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
29
+ itkdb_gtk-0.10.10.dev1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.2.0)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,29 +0,0 @@
1
- itkdb_gtk/CreateShipments.py,sha256=c9TZVidWULQeZgVymGELcqrBrjtWGhj2DU59cagZOIc,13006
2
- itkdb_gtk/GetShipments.py,sha256=43EhLSZIo8F63B3NkeQBBkR7of11NxNMVK1l9ANDtGY,18885
3
- itkdb_gtk/GlueWeight.py,sha256=4oZOinyHPqG0Pk6AmEVKd_dFDZWPoLrx7ywCmhodveE,12258
4
- itkdb_gtk/ITkDB.desktop,sha256=v_K4mHsDxb912J1XGo6mOlbW2TkHvYNGrKmiOnsBQqM,172
5
- itkdb_gtk/ITkDB.svg,sha256=Ry702zrUkxvG61SqThbUNfXySyiLMqalwYpcM-b_KWo,24242
6
- itkdb_gtk/ITkDBlogin.py,sha256=b1xALIdGE2BIUMYbwpaUqBZmCXQcO4hNhnMMwIkpIwo,9947
7
- itkdb_gtk/ITkDButils.py,sha256=mvlo5F01_B0CZX-GZMkUHRzZSNR1A8IWrGtMRRwGFq4,15635
8
- itkdb_gtk/PanelVisualInspection.py,sha256=KYMrlIoXpHx2z9YMCBLtqheVDJQyyIYykUFpRnWLGeo,13159
9
- itkdb_gtk/PetalReceptionTests.py,sha256=y15sTg_ZnW8IYPPHCZyiPWIYPoGzevemsA8Kor5i0TE,9622
10
- itkdb_gtk/SensorUtils.py,sha256=S2Mc-Z1webACisj6waJcMqiqzoGSE7TYScVfxHSD700,15458
11
- itkdb_gtk/ShowAttachments.py,sha256=1pZo3P_yZwD0IyhbNyeqOE71mXkwuFYAK5bsBy2P-cI,8404
12
- itkdb_gtk/ShowComments.py,sha256=OiMTFLnhGbbKRj5x61D517BYHAt-qY5Y1lvR3EQz3c0,3151
13
- itkdb_gtk/ShowDefects.py,sha256=aVAHeaE5IztmAPEuHwhi06KWo_pi9xX2J1fTLhKyAPI,3530
14
- itkdb_gtk/UploadModuleIV.py,sha256=L5hndmkRf6cho5ZaBVLaczbPm5DzkmLKwI3IpirVv5U,17749
15
- itkdb_gtk/UploadMultipleTests.py,sha256=3cwEqq2CmWf-kEHxoXMv98tg4BXztqW-BWD9iyytl2k,22144
16
- itkdb_gtk/UploadPetalInformation.py,sha256=No7gQEUoO5HJP3Ch3t_j99_xCD9BWrb-PWsDUo7sU6M,24746
17
- itkdb_gtk/UploadTest.py,sha256=NyNX2itqbMvp4g7XZp5QvXKYZ-ILJrwzcLckLmSDuPw,16570
18
- itkdb_gtk/WireBondGui.py,sha256=e0asNrZUNmDKjqIXR3qcEsinSzX-Z7q71sIV2abcg2g,27179
19
- itkdb_gtk/__init__.py,sha256=AOd9yaYRW4xuINasBMt4irRC-s92S8etB_NadV-MuTw,1291
20
- itkdb_gtk/dashBoard.py,sha256=2V-AWb4AaqqoX0J9QmamlXXwqdZTSY2lFkXSmY8biIE,8974
21
- itkdb_gtk/dbGtkUtils.py,sha256=cJhlf8EZaQWOItVLfEHauN_Fb6WPep2vsmnU3pJirSc,28878
22
- itkdb_gtk/readAVSdata.py,sha256=Sc_pXrzYkGDIF5-0pHYLATQQoRb8gbHmi9jz64v267Y,23439
23
- itkdb_gtk/readGoogleSheet.py,sha256=Lzm_oPWwDqZZzKoBUgsp277F9-wCfr_BA0X4VD2Eolo,2673
24
- itkdb_gtk/untrash_component.py,sha256=VrN46-f-kF7voOxtoh7OL-bZSWAaIFb7-Xbx6_WT7K8,757
25
- itkdb_gtk-0.10.9.dev3.dist-info/METADATA,sha256=jl6HyY4FqnoW88HoAAvMkyoj9SZJw0h8gxYDP9YEd0I,3155
26
- itkdb_gtk-0.10.9.dev3.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
27
- itkdb_gtk-0.10.9.dev3.dist-info/entry_points.txt,sha256=Xf_DDU3QlT2zogRFMOJdO4BdVuAKyAwmb2jHZ5KbBxE,501
28
- itkdb_gtk-0.10.9.dev3.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
29
- itkdb_gtk-0.10.9.dev3.dist-info/RECORD,,