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
@@ -1,225 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Test dashboard."""
3
- import json
4
- import sys
5
-
6
- try:
7
- import dbGtkUtils
8
- import ITkDBlogin
9
- import ITkDButils
10
- except ModuleNotFoundError:
11
- from itkdb_gtk import dbGtkUtils, ITkDBlogin, ITkDButils
12
-
13
- import gi
14
-
15
- gi.require_version("Gtk", "3.0")
16
- from gi.repository import Gtk, Gio
17
-
18
-
19
- class GroundingTest(dbGtkUtils.ITkDBWindow):
20
- """Dashboard class."""
21
-
22
- def __init__(self, session):
23
- """Initialization."""
24
- super().__init__(title="ITkDB Dashboard",
25
- session=session,
26
- show_search="Find object with given SN.")
27
-
28
- # Members
29
- self.dbObject = None
30
-
31
- # action button in header
32
- button = Gtk.Button()
33
- icon = Gio.ThemedIcon(name="document-send-symbolic")
34
- image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
35
- button.add(image)
36
- button.set_tooltip_text("Click to upload tests.")
37
- button.connect("clicked", self.upload_tests)
38
- self.hb.pack_end(button)
39
-
40
- grid = Gtk.Grid(column_spacing=5, row_spacing=1)
41
- self.mainBox.pack_start(grid, False, False, 5)
42
-
43
- lbl = Gtk.Label(label="Serial Number")
44
- lbl.set_xalign(0)
45
- grid.attach(lbl, 0, 0, 1, 1)
46
-
47
- self.SN = Gtk.Entry()
48
- grid.attach(self.SN, 1, 0, 1, 1)
49
-
50
- lbl = Gtk.Label(label="Institute")
51
- lbl.set_xalign(0)
52
- grid.attach(lbl, 0, 1, 1, 1)
53
-
54
- self.institute = "IFIC"
55
- inst = self.create_institute_combo()
56
- inst.connect("changed", self.new_institute)
57
- inst.set_tooltip_text("Select the Institute.")
58
- grid.attach(inst, 1, 1, 1, 1)
59
- self.inst_cmb = inst
60
-
61
- # The "Add/Remove/Send Item" buttons.
62
- box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL)
63
- box.set_layout(Gtk.ButtonBoxStyle.END)
64
- self.mainBox.pack_start(box, False, False, 0)
65
- dbGtkUtils.add_button_to_container(box, "Add Defect", "Click to add a defect", self.add_defect)
66
- dbGtkUtils.add_button_to_container(box, "Add Comment", "Click to add a comment", self.add_comment)
67
-
68
- # The notebook
69
- self.notebook = Gtk.Notebook()
70
- self.notebook.set_tab_pos(Gtk.PositionType.LEFT)
71
- self.notebook.set_size_request(-1, 250)
72
- self.mainBox.pack_start(self.notebook, True, True, 0)
73
-
74
- # Create the Notebook pages
75
- self.create_test_box("Visual Inspection", "VISUAL_INSPECTION")
76
- self.create_test_box("Grounding", "GROUNDING_CHECK")
77
-
78
- # The text view
79
- frame = self.create_text_view()
80
- self.mainBox.pack_end(frame, True, True, 5)
81
-
82
- self.show_all()
83
-
84
- def create_test_box(self, label, test_name, institute="IFIC"):
85
- """Create and add to notebook a test dialog.
86
-
87
- Args:
88
- ----
89
- label: The label for the Notebook
90
- test_name: The DB name of the test
91
- institute: The institute.
92
-
93
- """
94
- defaults = {
95
- "institution": institute,
96
- "runNumber": "1",
97
- }
98
- dto = ITkDButils.get_test_skeleton(self.session, "CORE_PETAL", test_name, defaults)
99
- if test_name == "VISUAL_INSPECTION":
100
- scrolled, gM = dbGtkUtils.create_scrolled_dictdialog(dto, ("component", "testType", "results"))
101
- else:
102
- scrolled, gM = dbGtkUtils.create_scrolled_dictdialog(dto)
103
-
104
- box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
105
- box.set_border_width(5)
106
- box.pack_end(scrolled, True, True, 0)
107
- box.dict_dialog = gM
108
- gM.box = box
109
-
110
- self.notebook.append_page(box, Gtk.Label(label=label))
111
-
112
- return gM
113
-
114
- def query_db(self, *args):
115
- """Search button clicked."""
116
- SN = self.SN.get_text()
117
- if len(SN) == 0:
118
- dbGtkUtils.complain("Empty Serial number",
119
- "You should enter a valid Serial number for the petal core.",
120
- parent=self)
121
-
122
- try:
123
- self.dbObject = ITkDButils.get_DB_component(self.session, SN)
124
-
125
- except Exception as E:
126
- self.write_message(str(E))
127
- dbGtkUtils.complain("Could not find object in DB", str(E))
128
- self.dbObject = None
129
- return
130
-
131
- print(json.dumps(self.dbObject, indent=3))
132
-
133
- def add_defect(self, btn):
134
- """Add a new defect."""
135
- page = self.notebook.get_nth_page(self.notebook.get_current_page())
136
- values = dbGtkUtils.get_a_list_of_values("Insert new defect", ("Type", "Description/v"))
137
- if len(values):
138
- defect = {"name": values[0], "description": values[1]}
139
- page.dict_dialog.values["defects"].append(defect)
140
- page.dict_dialog.refresh()
141
-
142
- def add_comment(self, btn):
143
- """Add a new comment."""
144
- page = self.notebook.get_nth_page(self.notebook.get_current_page())
145
- comment = dbGtkUtils.get_a_value("Insert new comment", is_tv=True)
146
- if comment:
147
- page.dict_dialog.values["comments"].append(comment)
148
- page.dict_dialog.refresh()
149
-
150
- def new_institute(self, combo):
151
- """A new institute has been selected."""
152
- inst = self.get_institute_from_combo(combo)
153
- if inst:
154
- self.institute = inst
155
-
156
- npages = self.notebook.get_n_pages()
157
- for i in range(npages):
158
- page = self.notebook.get_nth_page(i)
159
- page.dict_dialog.values["institution"] = self.institute
160
- page.dict_dialog.refresh()
161
-
162
- def upload_tests(self, *args):
163
- """Upload the current test."""
164
- SN = self.SN.get_text()
165
- if len(SN) == 0:
166
- dbGtkUtils.complain("Petal SN is empty")
167
- return
168
-
169
- def find_children(W):
170
- try:
171
- for c in W.get_children():
172
- if "DictDialog" in c.get_name():
173
- return c
174
-
175
- else:
176
- return find_children(c)
177
-
178
- except Exception:
179
- return None
180
-
181
- return None
182
-
183
- page = self.notebook.get_nth_page(self.notebook.get_current_page())
184
- dctD = find_children(page)
185
- if dctD is None:
186
- return
187
-
188
- values = dctD.values
189
- values["component"] = SN
190
- print(json.dumps(values, indent=2))
191
- rc = ITkDButils.upload_test(self.session, values)
192
- if rc is not None:
193
- dbGtkUtils.complain("Could not upload test", rc)
194
-
195
- else:
196
- dbGtkUtils.ask_for_confirmation("Test uploaded.",
197
- "{} - {}".format(values["component"], values["testType"]))
198
-
199
- def main():
200
- """Main entry."""
201
- # DB login
202
- dlg = ITkDBlogin.ITkDBlogin()
203
- client = dlg.get_client()
204
- if client is None:
205
- print("Could not connect to DB with provided credentials.")
206
- dlg.die()
207
- sys.exit()
208
-
209
- client.user_gui = dlg
210
-
211
- gTest = GroundingTest(client)
212
-
213
- gTest.present()
214
- gTest.connect("destroy", Gtk.main_quit)
215
- try:
216
- Gtk.main()
217
-
218
- except KeyboardInterrupt:
219
- print("Arrrgggg!!!")
220
-
221
- dlg.die()
222
-
223
-
224
- if __name__ == "__main__":
225
- main()