itkdb-gtk 0.0.3__py3-none-any.whl → 0.20.1__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.
Files changed (37) hide show
  1. itkdb_gtk/{sendShipments.py → CreateShipments.py} +74 -78
  2. itkdb_gtk/{getShipments.py → GetShipments.py} +99 -106
  3. itkdb_gtk/GlueWeight.py +45 -66
  4. itkdb_gtk/ITkDB.desktop +8 -0
  5. itkdb_gtk/ITkDB.svg +380 -0
  6. itkdb_gtk/ITkDBlogin.py +10 -6
  7. itkdb_gtk/ITkDButils.py +295 -57
  8. itkdb_gtk/PanelVisualInspection.py +590 -0
  9. itkdb_gtk/QRScanner.py +120 -0
  10. itkdb_gtk/SensorUtils.py +492 -0
  11. itkdb_gtk/ShowAttachments.py +267 -0
  12. itkdb_gtk/ShowComments.py +94 -0
  13. itkdb_gtk/ShowDefects.py +103 -0
  14. itkdb_gtk/UploadModuleIV.py +566 -0
  15. itkdb_gtk/UploadMultipleTests.py +746 -0
  16. itkdb_gtk/UploadTest.py +509 -0
  17. itkdb_gtk/VisualInspection.py +297 -0
  18. itkdb_gtk/WireBondGui.py +1304 -0
  19. itkdb_gtk/__init__.py +38 -12
  20. itkdb_gtk/dashBoard.py +292 -33
  21. itkdb_gtk/dbGtkUtils.py +356 -75
  22. itkdb_gtk/findComponent.py +242 -0
  23. itkdb_gtk/findVTRx.py +36 -0
  24. itkdb_gtk/readGoogleSheet.py +1 -2
  25. itkdb_gtk/untrash_component.py +35 -0
  26. {itkdb_gtk-0.0.3.dist-info → itkdb_gtk-0.20.1.dist-info}/METADATA +21 -12
  27. itkdb_gtk-0.20.1.dist-info/RECORD +30 -0
  28. {itkdb_gtk-0.0.3.dist-info → itkdb_gtk-0.20.1.dist-info}/WHEEL +1 -1
  29. itkdb_gtk-0.20.1.dist-info/entry_points.txt +12 -0
  30. itkdb_gtk/checkComponent.py +0 -131
  31. itkdb_gtk/groundingTest.py +0 -225
  32. itkdb_gtk/readAVSdata.py +0 -565
  33. itkdb_gtk/uploadPetalInformation.py +0 -604
  34. itkdb_gtk/uploadTest.py +0 -384
  35. itkdb_gtk-0.0.3.dist-info/RECORD +0 -19
  36. itkdb_gtk-0.0.3.dist-info/entry_points.txt +0 -7
  37. {itkdb_gtk-0.0.3.dist-info → itkdb_gtk-0.20.1.dist-info}/top_level.txt +0 -0
itkdb_gtk/uploadTest.py DELETED
@@ -1,384 +0,0 @@
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 dbGtkUtils
10
- import ITkDBlogin
11
- import ITkDButils
12
- except ModuleNotFoundError:
13
- from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
14
-
15
- import gi
16
- gi.require_version("Gtk", "3.0")
17
- from gi.repository import Gtk, Gio
18
-
19
- # Check if Gtk can be open
20
- gtk_runs, gtk_args = Gtk.init_check()
21
-
22
-
23
- def check_data(data):
24
- """Checks validity of JSon data.
25
-
26
- Args:
27
- ----
28
- data (): The json data
29
-
30
- Returns
31
- -------
32
- boolean: True if valid, False otherwise.
33
-
34
- """
35
- if "component" not in data:
36
- print("Need reference to component, hex string")
37
- return False
38
-
39
- if "testType" not in data:
40
- print("Need to know test type, short code")
41
- return False
42
-
43
- if "institution" not in data:
44
- print("Need to know institution, short code")
45
- return False
46
-
47
- if "results" not in data:
48
- print("Need some test results")
49
- return False
50
-
51
- return True
52
-
53
-
54
- class UploadTest(dbGtkUtils.ITkDBWindow):
55
- """Collects informatio to upload a test and its attachments."""
56
-
57
- def __init__(self, session, payload=None, attachment=None):
58
- """Initialization.
59
-
60
- Args:
61
- ----
62
- session: ITkDB session
63
- payload: path of test file
64
- attachment: an Attachment object.
65
-
66
- """
67
- self.payload = payload
68
- self.data = None
69
- self.attachments = []
70
- if attachment is not None:
71
- if isinstance(attachment, ITkDButils.Attachment):
72
- if attachment.path is not None:
73
- self.attachments.append(attachment)
74
- else:
75
- print("Wrong attachment: {}".format(attachment))
76
-
77
- global gtk_runs
78
- if gtk_runs:
79
- super().__init__(session=session, title="Upload Test", gtk_runs=gtk_runs)
80
- self.init_window()
81
-
82
- def init_window(self):
83
- """Creates the Gtk window."""
84
- # Initial tweaks
85
- self.set_border_width(10)
86
-
87
- # Prepare HeaderBar
88
- self.hb.props.title = "Upload Tests"
89
-
90
- # Active buttin in header
91
- button = Gtk.Button()
92
- icon = Gio.ThemedIcon(name="document-send-symbolic")
93
- image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
94
- button.add(image)
95
- button.set_tooltip_text("Click to upload test")
96
- button.connect("clicked", self.upload_test_gui)
97
- self.hb.pack_end(button)
98
-
99
- # Data panel
100
- grid = Gtk.Grid(column_spacing=5, row_spacing=1)
101
- self.mainBox.pack_start(grid, True, False, 0)
102
-
103
- # The test file widgets
104
- lbl = Gtk.Label(label="Test file")
105
- lbl.set_xalign(0)
106
- grid.attach(lbl, 0, 0, 1, 1)
107
-
108
- self.testF = Gtk.FileChooserButton()
109
- self.testF.set_tooltip_text("Click to select JSon test file.")
110
-
111
- grid.attach(self.testF, 1, 0, 1, 1)
112
- self.testF.connect("file-set", self.on_test_file)
113
- if self.payload:
114
- the_path = Path(self.payload).expanduser().resolve()
115
- if the_path.exists():
116
- ifile = Path(self.payload).expanduser().resolve().as_posix()
117
- self.testF.set_filename(ifile)
118
- self.on_test_file(self.testF)
119
-
120
- else:
121
- print("Input file does not exists: {}".format(self.payload))
122
-
123
- # This is to show/edit the test file data
124
- btn = Gtk.Button()
125
- icon = Gio.ThemedIcon(name="view-paged-symbolic")
126
- image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
127
- btn.add(image)
128
- btn.set_tooltip_text("Click to view/edit test data.")
129
- btn.connect("clicked", self.show_data)
130
- grid.attach(btn, 2, 0, 1, 1)
131
-
132
- # Object Data
133
- lbl = Gtk.Label(label="Serial Number")
134
- lbl.set_xalign(0)
135
- grid.attach(lbl, 0, 1, 1, 1)
136
-
137
- self.entrySN = Gtk.Entry()
138
- grid.attach(self.entrySN, 1, 1, 1, 1)
139
-
140
- # Test type
141
- lbl = Gtk.Label(label="Test Type")
142
- lbl.set_xalign(0)
143
- grid.attach(lbl, 0, 2, 1, 1)
144
-
145
- self.entryTest = Gtk.Entry()
146
- grid.attach(self.entryTest, 1, 2, 1, 1)
147
-
148
- # The "Add attachment" button.
149
- box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
150
- self.mainBox.pack_start(box, False, False, 0)
151
-
152
- dbGtkUtils.add_button_to_container(box, "Add attachment",
153
- "Click to add a new attachment.",
154
- self.add_attachment)
155
-
156
- dbGtkUtils.add_button_to_container(box, "Remove attachment",
157
- "Click to remove selected attachment.",
158
- self.remove_attachment)
159
-
160
- dbGtkUtils.add_button_to_container(box, "Upload Test",
161
- "Click to upload test.",
162
- self.upload_test_gui)
163
-
164
- # Paned object
165
- paned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
166
- paned.set_size_request(-1, 200)
167
- self.mainBox.pack_start(paned, True, True, 0)
168
-
169
- # the list of attachments
170
- tree_view = self.create_tree_view()
171
- paned.add1(tree_view)
172
-
173
- # The text view
174
- frame = self.create_text_view()
175
- paned.add2(frame)
176
-
177
- self.show_all()
178
-
179
- def create_tree_view(self, size=150):
180
- """Creates the tree vew with the attachments."""
181
- model = Gtk.ListStore(str, str, str, str)
182
- self.tree = Gtk.TreeView(model=model)
183
- scrolled = Gtk.ScrolledWindow()
184
- scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
185
- scrolled.add(self.tree)
186
- scrolled.set_size_request(-1, size)
187
-
188
- renderer = Gtk.CellRendererText()
189
- column = Gtk.TreeViewColumn("Attachment", renderer, text=0)
190
- self.tree.append_column(column)
191
-
192
- renderer = Gtk.CellRendererText()
193
- column = Gtk.TreeViewColumn("Title", renderer, text=1)
194
- self.tree.append_column(column)
195
-
196
- renderer = Gtk.CellRendererText()
197
- column = Gtk.TreeViewColumn("Description", renderer, text=2)
198
- self.tree.append_column(column)
199
-
200
- return scrolled
201
-
202
- def on_test_file(self, fdlg):
203
- """Test file browser clicked."""
204
- fnam = fdlg.get_filename()
205
-
206
- # The file exists by definition
207
- try:
208
- self.data = json.loads(open(fnam).read())
209
- if not check_data(self.data):
210
- dbGtkUtils.complain("Invalid JSON file", fnam)
211
- return
212
-
213
- self.entrySN.set_text(self.data["component"])
214
- self.entryTest.set_text(self.data["testType"])
215
-
216
- except Exception as E:
217
- self.data = None
218
- print("Cannot load file {}".format(fnam))
219
- print(E)
220
-
221
- def show_data(self, *args):
222
- """Show data button clicked."""
223
- if self.data is None:
224
- return
225
-
226
- dlg = Gtk.Dialog(title="Test Data")
227
- dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
228
- Gtk.STOCK_OK, Gtk.ResponseType.OK)
229
-
230
- dlg.set_property("height-request", 500)
231
- box = dlg.get_content_area()
232
- value = dbGtkUtils.DictDialog(self.data)
233
- scrolled = Gtk.ScrolledWindow()
234
- scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
235
- scrolled.add(value)
236
- box.pack_start(scrolled, True, True, 10)
237
-
238
- dlg.show_all()
239
-
240
- rc = dlg.run()
241
- if rc == Gtk.ResponseType.OK:
242
- self.data = value.values
243
-
244
- dlg.hide()
245
- dlg.destroy()
246
-
247
- def add_attachment_dialog(self):
248
- """Create the add attachment dialog."""
249
- dlg = Gtk.Dialog(title="Add Attachment")
250
- dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
251
- Gtk.STOCK_OK, Gtk.ResponseType.OK)
252
- grid = Gtk.Grid(column_spacing=5, row_spacing=1)
253
- box = dlg.get_content_area()
254
- box.add(grid)
255
-
256
- lbl = Gtk.Label(label="File")
257
- lbl.set_xalign(0)
258
- grid.attach(lbl, 0, 0, 1, 1)
259
-
260
- lbl = Gtk.Label(label="Title")
261
- lbl.set_xalign(0)
262
- grid.attach(lbl, 0, 1, 1, 1)
263
-
264
- lbl = Gtk.Label(label="Description")
265
- lbl.set_xalign(0)
266
- grid.attach(lbl, 0, 2, 1, 1)
267
-
268
- dlg.fC = Gtk.FileChooserButton()
269
- grid.attach(dlg.fC, 1, 0, 1, 1)
270
-
271
- dlg.att_title = Gtk.Entry()
272
- grid.attach(dlg.att_title, 1, 1, 1, 1)
273
-
274
- dlg.att_desc = Gtk.Entry()
275
- grid.attach(dlg.att_desc, 1, 2, 1, 1)
276
-
277
- dlg.show_all()
278
- return dlg
279
-
280
- def add_attachment(self, *args):
281
- """Add Attachment button clicked."""
282
- dlg = self.add_attachment_dialog()
283
- rc = dlg.run()
284
- model = self.tree.get_model()
285
- if rc == Gtk.ResponseType.OK:
286
- path = Path(dlg.fC.get_filename())
287
- name = path.name
288
- T = dlg.att_title.get_text().strip()
289
- D = dlg.att_desc.get_text().strip()
290
- model.append([name, T, D, path.as_posix()])
291
-
292
- T = T if len(T) else None
293
- D = D if len(D) else None
294
- att = ITkDButils.Attachment(path.as_posix(), T, D)
295
- self.attachments.append(att)
296
-
297
- dlg.hide()
298
- dlg.destroy()
299
-
300
- def remove_attachment(self, *args):
301
- """Remove selected attachment."""
302
- select = self.tree.get_selection()
303
- model, iter = select.get_selected()
304
- if iter:
305
- values = model[iter]
306
- for a in self.attachments:
307
- if a.path == values[3]:
308
- rc = dbGtkUtils.ask_for_confirmation("Remove this attachment ?",
309
- "{} - {}\n{}".format(a.title, a.desc, values[0]))
310
- if rc:
311
- self.attachments.remove(a)
312
- model.remove(iter)
313
-
314
- break
315
-
316
- def upload_test_gui(self, *args):
317
- """Uploads test and attachments."""
318
- self.upload_test()
319
-
320
- def upload_test(self):
321
- """Uploads test and attachments."""
322
- if self.data is None:
323
- self.write_message("No data available to upload\n")
324
- return
325
-
326
- rc = ITkDButils.upload_test(self.session, self.data, self.attachments)
327
- if rc:
328
- ipos = rc.find("The following details may help:")
329
- msg = rc[ipos:]
330
- dbGtkUtils.complain("Failed uploading test", msg)
331
-
332
- else:
333
- self.write_message("Upload successfull")
334
- dbGtkUtils.ask_for_confirmation("Upload successfull", "")
335
-
336
- def main():
337
- """Main entry."""
338
- parser = argparse.ArgumentParser()
339
-
340
- parser.add_argument("--test-file", help="Name of json file with test data")
341
- parser.add_argument("--component-id", help="Override component code")
342
- parser.add_argument("--raw_data", help="Raw data file", default=None)
343
- parser.add_argument("--attachment", help="Attachment to upload with the test", default=None)
344
- parser.add_argument("--attach_title", default=None, type=str, help="The attachment description")
345
- parser.add_argument("--attach_desc", default="", type=str, help="The attachment description")
346
- parser.add_argument("--verbose", action="store_true", help="Print what's being sent and received")
347
-
348
- args = parser.parse_args()
349
-
350
- # DB login
351
- dlg = ITkDBlogin.ITkDBlogin()
352
- client = dlg.get_client()
353
- if client is None:
354
- print("Could not connect to DB with provided credentials.")
355
- dlg.die()
356
- sys.exit()
357
-
358
- client.user_gui = dlg
359
-
360
- # Start GUI
361
- UpT = UploadTest(client,
362
- payload=args.test_file,
363
- attachment=ITkDButils.Attachment(args.attachment,
364
- args.attach_title,
365
- args.attach_desc))
366
-
367
- if gtk_runs:
368
- UpT.present()
369
- UpT.connect("destroy", Gtk.main_quit)
370
- try:
371
- Gtk.main()
372
-
373
- except KeyboardInterrupt:
374
- print("Arrrgggg!!!")
375
-
376
- else:
377
- # Think
378
- pass
379
-
380
- dlg.die()
381
-
382
-
383
- if __name__ == "__main__":
384
- main()
@@ -1,19 +0,0 @@
1
- itkdb_gtk/GlueWeight.py,sha256=XQZgSbIjzQX34mpbd0h4Gtk3E4qqOltGHupsBjgeYe0,12287
2
- itkdb_gtk/ITkDBlogin.py,sha256=oP7v5uppBqb27rRKv-v82LsyjPPtAXj55TwH6pzB40Q,9902
3
- itkdb_gtk/ITkDButils.py,sha256=uWe2lv5EHvMdJFsiQFfqvGUhnBInW09VkKKlPlAZZig,14205
4
- itkdb_gtk/__init__.py,sha256=mUdCKf_N7JZbDCTASH8qSEC10YNeuAzRocrxYd91Dic,552
5
- itkdb_gtk/checkComponent.py,sha256=WSyJOQ8asCFWBoBknmPx6P7xH1vAlCHmi0Oh_XaCa4o,3342
6
- itkdb_gtk/dashBoard.py,sha256=EpIJ2yPrDuBAic58QfnNWfHt3Mt17nZnt9GHO1LwG_8,4376
7
- itkdb_gtk/dbGtkUtils.py,sha256=iv7ObvYzs-kTFbdDjULQhYqa-7KMbQHCUpSoCjzLx58,20708
8
- itkdb_gtk/getShipments.py,sha256=6xNTFAQ1Xon8M20U5BSRJkRc4P7vfNuG4liktoMTaa0,18718
9
- itkdb_gtk/groundingTest.py,sha256=xG4xSzbHkqKj-96Xwd3bbFFuvxVF5GI3Gap333BoRCc,7140
10
- itkdb_gtk/readAVSdata.py,sha256=sdTZhGRlJBsfBWr6OpcEyHXp-D_tk4A3urNjBGpUVko,19401
11
- itkdb_gtk/readGoogleSheet.py,sha256=cQ_pVsS_nwUh0bnXl7AP4in9kQ3Q-p8BIvXvvrTRInc,2679
12
- itkdb_gtk/sendShipments.py,sha256=yaKQ30fMG7bt3Zk7Rkgmla04nqfboA8zg3a-rleG9-g,13133
13
- itkdb_gtk/uploadPetalInformation.py,sha256=TisusbFwSfsgI_USQNJMnsADpyzNyh1pUovy6uFi2Os,21093
14
- itkdb_gtk/uploadTest.py,sha256=2kP3a68ssib8cgQpcvgwU-kCJy2rsd7cp5Vb5tgBjKY,12171
15
- itkdb_gtk-0.0.3.dist-info/METADATA,sha256=kMAi11_VdIjOIR2YKXBjPt-VnxAetbF6135zBn-AOFA,2654
16
- itkdb_gtk-0.0.3.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
17
- itkdb_gtk-0.0.3.dist-info/entry_points.txt,sha256=Sp0fME6Pa5Fssfli0-Y0AfYNBs-ebHqX5E6fhAGh_9E,239
18
- itkdb_gtk-0.0.3.dist-info/top_level.txt,sha256=KVRrH4OS8ovzNR9bvADE0ABn5bNpSk987tuH0jCfkbU,10
19
- itkdb_gtk-0.0.3.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- [gui_scripts]
2
- getShipments = itkdb_gtk:getShipments
3
- glueWeight = itkdb_gtk:glueWeight
4
- groundingTest = itkdb_gtk:groundingTest
5
- itkdb_dashBoard = itkdb_gtk:dash_board
6
- sendShipments = itkdb_gtk:sendShipments
7
- uploadTest = itkdb_gtk:uploadTest