itkdb-gtk 0.10.6__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.

@@ -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([SN, nick, obj, loc, id])
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={}, uservalues={}):
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(3)
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
- 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
+ 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
- if not SN.startswith("20U") or len(SN)!=14:
147
- dbGtkUtils.complain("Invalid Serial Number",
148
- "{}: wrong SN".format(SN))
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([SN, True])
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()
@@ -63,10 +63,14 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
63
63
  lbl.set_xalign(0)
64
64
  grid.attach(lbl, 0, 0, 1, 1)
65
65
 
66
- self.SN = Gtk.Entry()
67
- self.SN.connect("focus-in-event", self.on_sn_enter)
68
- self.SN.connect("focus-out-event", self.on_sn_leave)
69
- grid.attach(self.SN, 1, 0, 1, 1)
66
+
67
+ self.SN = itkdb_gtk.dbGtkUtils.TextEntry()
68
+ self.SN.connect("text-changed", self.on_SN_changed)
69
+
70
+ #self.SN = Gtk.Entry()
71
+ #self.SN.connect("focus-in-event", self.on_sn_enter)
72
+ #self.SN.connect("focus-out-event", self.on_sn_leave)
73
+ grid.attach(self.SN.entry, 1, 0, 1, 1)
70
74
 
71
75
  self.alias = Gtk.Label(label="")
72
76
  grid.attach(self.alias, 2, 0, 1, 1)
@@ -109,28 +113,28 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
109
113
 
110
114
  self.show_all()
111
115
 
112
- def on_sn_enter(self, entry, *args):
113
- """Enter in SN entry."""
114
- self._sn = entry.get_text()
116
+ def on_SN_changed(self, entry, value):
117
+ """New SN given. Ask in PDB,"""
118
+ if len(value) <= 0:
119
+ return None
120
+
121
+ self.query_db()
122
+ current_location = self.dbObject["currentLocation"]["code"]
123
+ dbGtkUtils.set_combo_iter(self.inst_cmb, current_location, 0)
115
124
 
116
- def on_sn_leave(self, entry, *args):
117
- """Leave SN entry."""
118
- sn = entry.get_text()
119
- if sn != self._sn:
120
- self.query_db()
121
- current_location = self.dbObject["currentLocation"]["code"]
122
- dbGtkUtils.set_combo_iter(self.inst_cmb, current_location, 0)
125
+ stg = self.dbObject["currentStage"]["name"]
126
+ self.stage.set_text(stg)
123
127
 
124
- stg = self.dbObject["currentStage"]["name"]
125
- self.stage.set_text(stg)
128
+ entry.set_text(self.dbObject["serialNumber"])
126
129
 
127
- alias = self.dbObject["alternativeIdentifier"]
128
- self.alias.set_text(alias)
130
+ alias = self.dbObject["alternativeIdentifier"]
131
+ self.alias.set_text(alias)
129
132
 
130
- npages = self.notebook.get_n_pages()
131
- for i in range(npages):
132
- page = self.notebook.get_nth_page(i)
133
- page.dict_dialog.factory_reset()
133
+ npages = self.notebook.get_n_pages()
134
+ for i in range(npages):
135
+ page = self.notebook.get_nth_page(i)
136
+ page.dict_dialog.factory_reset()
137
+
134
138
 
135
139
  def create_test_box(self, label, test_name, institute="IFIC"):
136
140
  """Create and add to notebook a test dialog.
@@ -178,7 +182,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
178
182
  self.dbObject = None
179
183
  return
180
184
 
181
- print(json.dumps(self.dbObject, indent=3))
185
+ #print(json.dumps(self.dbObject, indent=3))
182
186
 
183
187
  def add_defect(self, btn):
184
188
  """Add a new defect."""
itkdb_gtk/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """ itkdb-gtk python module
2
2
  """
3
- __version__ = "0.10.6"
3
+ __version__ = "0.10.8"
4
4
 
5
5
 
6
6
  def dash_board():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itkdb_gtk
3
- Version: 0.10.6
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,12 +1,12 @@
1
- itkdb_gtk/CreateShipments.py,sha256=yk5FKAU2Tpaf3IxsbOEFfRzNZ-pgCn-A_jS_LG4JWbI,12848
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=ciBGBweCKHv31wcEP5DVfdioq_6BcdIs4FPUC0JNF5k,9916
7
- itkdb_gtk/ITkDButils.py,sha256=gPmGd37QvIfndl_l7ArjMt6IIT0q5eOfn3t34nIr2aQ,15188
8
- itkdb_gtk/PanelVisualInspection.py,sha256=WMTYeVUEnSwwkSsQA5afwAYYSwtiJAdbD6LLx0Jx4eA,7087
9
- itkdb_gtk/PetalReceptionTests.py,sha256=-vnvkE2cvjQCdLvLBF4I22u8WxcGHBCl1jRQuNWCpp8,9278
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
+ 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
12
12
  itkdb_gtk/ShowComments.py,sha256=OiMTFLnhGbbKRj5x61D517BYHAt-qY5Y1lvR3EQz3c0,3151
@@ -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=To8oFnpkr_qdJXA5Y0QOwwslOdlAvS19OLJi2p-VPSE,1151
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.6.dist-info/METADATA,sha256=vxtTvBxdzi8tvls20BEUOVoqpYCZ87hr5AgxamVP8r4,3150
26
- itkdb_gtk-0.10.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
- itkdb_gtk-0.10.6.dist-info/entry_points.txt,sha256=p7hiZPp4EPyRNzRdu6NqYlDmfflZGGDiDjIJGOcwfig,445
28
- itkdb_gtk-0.10.6.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
29
- itkdb_gtk-0.10.6.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5