itkdb-gtk 0.0.1__tar.gz → 0.0.3__tar.gz

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.

Files changed (24) hide show
  1. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/PKG-INFO +1 -1
  2. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/GlueWeight.py +10 -4
  3. itkdb_gtk-0.0.3/itkdb_gtk/checkComponent.py +131 -0
  4. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/dashBoard.py +19 -1
  5. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk.egg-info/PKG-INFO +1 -1
  6. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk.egg-info/SOURCES.txt +1 -0
  7. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk.egg-info/entry_points.txt +1 -1
  8. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/pyproject.toml +8 -2
  9. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/README.md +0 -0
  10. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/ITkDBlogin.py +0 -0
  11. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/ITkDButils.py +0 -0
  12. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/__init__.py +0 -0
  13. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/dbGtkUtils.py +0 -0
  14. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/getShipments.py +0 -0
  15. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/groundingTest.py +0 -0
  16. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/readAVSdata.py +0 -0
  17. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/readGoogleSheet.py +0 -0
  18. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/sendShipments.py +0 -0
  19. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/uploadPetalInformation.py +0 -0
  20. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk/uploadTest.py +0 -0
  21. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk.egg-info/dependency_links.txt +0 -0
  22. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk.egg-info/requires.txt +0 -0
  23. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/itkdb_gtk.egg-info/top_level.txt +0 -0
  24. {itkdb_gtk-0.0.1 → itkdb_gtk-0.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itkdb_gtk
3
- Version: 0.0.1
3
+ Version: 0.0.3
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
@@ -136,7 +136,7 @@ class GlueWeight(Gtk.Window):
136
136
  hb.pack_end(button)
137
137
 
138
138
  self.userLabel = Gtk.Label()
139
- self.userLabel.set_text(session.user.name)
139
+ self.userLabel.set_text(self.session.user.name)
140
140
  hb.pack_start(self.userLabel)
141
141
 
142
142
  # Create main content box
@@ -166,7 +166,7 @@ class GlueWeight(Gtk.Window):
166
166
  self.notebook.append_page(box)
167
167
 
168
168
  if self.ifile:
169
- self.modules = self.parse_file(ifile)
169
+ self.modules = self.parse_file(self.ifile)
170
170
  self.populate_notebook()
171
171
 
172
172
  # The button box
@@ -186,14 +186,18 @@ class GlueWeight(Gtk.Window):
186
186
  btnBox.add(btn)
187
187
 
188
188
  btn = Gtk.Button(label="Quit")
189
- btn.connect("clicked", Gtk.main_quit)
189
+ btn.connect("clicked", self.quit)
190
190
  btnBox.add(btn)
191
191
 
192
192
  self.mainBox.pack_start(btnBox, False, True, 0)
193
- self.connect("destroy", Gtk.main_quit)
194
193
 
195
194
  self.show_all()
196
195
 
196
+ def quit(self, *args):
197
+ """Quits the application."""
198
+ self.hide()
199
+ self.destroy()
200
+
197
201
  def create_test_window(self, test_json, test_name, label):
198
202
  """Create the dialog for a DB test and add it to the notebook.
199
203
 
@@ -365,6 +369,7 @@ class GlueWeight(Gtk.Window):
365
369
  if resp is not None:
366
370
  print(resp)
367
371
 
372
+
368
373
  def main():
369
374
  """Main entry."""
370
375
  # Get input file
@@ -405,6 +410,7 @@ def main():
405
410
  GW.show_all()
406
411
  GW.set_accept_focus(True)
407
412
  GW.present()
413
+ GW.connect("destroy", Gtk.main_quit)
408
414
 
409
415
  try:
410
416
  Gtk.main()
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env python3
2
+ """Check childre of DB component."""
3
+
4
+ try:
5
+ import readAVSdata
6
+ import ITkDBlogin
7
+ import ITkDButils
8
+
9
+ from dbGtkUtils import replace_in_container, complain, DictDialog, ask_for_confirmation
10
+
11
+ except ModuleNotFoundError:
12
+ from itkdb_gtk import readAVSdata, ITkDBlogin, ITkDButils
13
+ from itkdb_gtk.dbGtkUtils import replace_in_container, complain, DictDialog, ask_for_confirmation
14
+
15
+ import json
16
+
17
+
18
+ def complain(main_msg, secondary_msg=None):
19
+ """Prints an error message
20
+
21
+ Args:
22
+ -----
23
+ main (): Main message
24
+ secondary (): Seconday message
25
+ """
26
+ print("**Error\n{}".format(main_msg))
27
+ if secondary_msg:
28
+ msg = secondary_msg.replace("\n", "\n\t")
29
+ print("\t{}".format(msg))
30
+
31
+
32
+ def find_petal(session, SN, silent=False):
33
+ """Finds petal with given SN."""
34
+ try:
35
+ petal_core = ITkDButils.get_DB_component(session, SN)
36
+
37
+ except Exception as E:
38
+ if not silent:
39
+ complain("Could not find Petal Core in DB", str(E))
40
+
41
+ petal_core = None
42
+ return
43
+
44
+ try:
45
+ if petal_core["type"]["code"] != "CORE_AVS":
46
+ complain("Wrong component type", "This is not an AVS petal core")
47
+
48
+ # print(json.dumps(petal_core, indent=3))
49
+
50
+ except KeyError:
51
+ # Petal is not there
52
+ petal_core = None
53
+
54
+ return petal_core
55
+
56
+
57
+ def get_type(child):
58
+ """Return object type
59
+
60
+ Args:
61
+ -----
62
+ child (): object
63
+
64
+ Returns
65
+ -------
66
+ str: object type
67
+
68
+ """
69
+ if child["type"] is not None:
70
+ ctype = child["type"]["code"]
71
+ else:
72
+ ctype = child["componentType"]["code"]
73
+
74
+ return ctype
75
+
76
+
77
+ def main():
78
+ """Main entry point."""
79
+ # ITk_PB authentication
80
+ dlg = ITkDBlogin.ITkDBlogin()
81
+ session = dlg.get_client()
82
+
83
+ # find all cores
84
+ # Now all the objects
85
+ payload = {
86
+ "componentType": ["BT"],
87
+ "componentType": ["CORE_PETAL"],
88
+ "type": ["CORE_AVS"],
89
+ }
90
+ core_list = session.get("listComponents", json=payload)
91
+
92
+ for obj in core_list:
93
+ SN = obj["serialNumber"]
94
+ id = obj['alternativeIdentifier']
95
+ core = find_petal(session, SN)
96
+ if core is None:
97
+ print("SN: not a petal core.")
98
+ continue
99
+
100
+ location = core["currentLocation"]['code']
101
+ stage = core["currentStage"]['code']
102
+ if "children" not in core:
103
+ complain("{}[{}]".format(SN, id), "Not assembled")
104
+ continue
105
+
106
+ print("Petal {} [{}] - {}. {}".format(SN, id, stage, location))
107
+ clist = []
108
+ for child in core["children"]:
109
+ cstage = "Missing"
110
+ if child["component"] is None:
111
+ ctype = get_type(child)
112
+ clist.append((ctype, cstage, None, None))
113
+
114
+ else:
115
+ SN = child["component"]["serialNumber"]
116
+ ctype = get_type(child)
117
+ cobj = ITkDButils.get_DB_component(session, SN)
118
+ cstage = cobj["currentStage"]['code']
119
+ clocation = cobj["currentLocation"]['code']
120
+ clist.append((ctype, cstage, SN, clocation))
121
+
122
+ for item in clist:
123
+ print("\t{} [{}] - {} at {}".format(item[2], item[0], item[1], item[3]))
124
+
125
+ print()
126
+
127
+ dlg.die()
128
+
129
+
130
+ if __name__ == "__main__":
131
+ main()
@@ -9,9 +9,10 @@ try:
9
9
  import ITkDBlogin
10
10
  import sendShipments
11
11
  import uploadTest
12
+ import GlueWeight
12
13
 
13
14
  except Exception:
14
- from itkdb_gtk import dbGtkUtils, getShipments, groundingTest, ITkDBlogin, sendShipments, uploadTest
15
+ from itkdb_gtk import dbGtkUtils, getShipments, groundingTest, ITkDBlogin, sendShipments, uploadTest, GlueWeight
15
16
 
16
17
  import gi
17
18
 
@@ -53,6 +54,11 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
53
54
  btnGnd.connect("clicked", self.petal_gnd)
54
55
  grid.attach(btnGnd, 1, irow, 1, 1)
55
56
 
57
+ irow += 1
58
+ btnWeight = Gtk.Button(label="GlueWeight")
59
+ btnWeight.connect("clicked", self.glue_weight)
60
+ grid.attach(btnWeight, 0, irow, 1, 1)
61
+
56
62
  irow += 1
57
63
  grid.attach(Gtk.Label(), 0, irow, 1, 1)
58
64
 
@@ -75,6 +81,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
75
81
 
76
82
  self.show_all()
77
83
 
84
+
78
85
  def upload_test(self, *args):
79
86
  """Launch upload test."""
80
87
  bitn = 1
@@ -119,6 +126,17 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
119
126
  W = groundingTest.GroundingTest(self.session)
120
127
  W.connect("destroy", self.app_closed, bitn)
121
128
 
129
+ def glue_weight(self, *args):
130
+ """Glue Weight test."""
131
+ bitn = 5
132
+ bt = 1 << bitn
133
+ if self.mask & bt:
134
+ return
135
+
136
+ self.mask |= bt
137
+ W = GlueWeight.GlueWeight(self.session)
138
+ W.connect("destroy", self.app_closed, bitn)
139
+
122
140
  def app_closed(self, *args):
123
141
  """Application window closed. Clear mask."""
124
142
  bt = 1 << args[1]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itkdb-gtk
3
- Version: 0.0.1
3
+ Version: 0.0.3
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
@@ -4,6 +4,7 @@ itkdb_gtk/GlueWeight.py
4
4
  itkdb_gtk/ITkDBlogin.py
5
5
  itkdb_gtk/ITkDButils.py
6
6
  itkdb_gtk/__init__.py
7
+ itkdb_gtk/checkComponent.py
7
8
  itkdb_gtk/dashBoard.py
8
9
  itkdb_gtk/dbGtkUtils.py
9
10
  itkdb_gtk/getShipments.py
@@ -1,7 +1,7 @@
1
1
  [gui_scripts]
2
- dash_board = itkdb_gtk:dash_board
3
2
  getShipments = itkdb_gtk:getShipments
4
3
  glueWeight = itkdb_gtk:glueWeight
5
4
  groundingTest = itkdb_gtk:groundingTest
5
+ itkdb_dashBoard = itkdb_gtk:dash_board
6
6
  sendShipments = itkdb_gtk:sendShipments
7
7
  uploadTest = itkdb_gtk:uploadTest
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "itkdb_gtk"
7
- version = "0.0.1"
7
+ version = "0.0.3"
8
8
  authors = [
9
9
  { name="Carlos Lacasta", email="carlos.lacasta@cern.ch" },
10
10
  ]
@@ -25,13 +25,19 @@ classifiers = [
25
25
  ]
26
26
 
27
27
  [project.gui-scripts]
28
- dash_board = "itkdb_gtk:dash_board"
28
+ itkdb_dashBoard = "itkdb_gtk:dash_board"
29
29
  getShipments = "itkdb_gtk:getShipments"
30
30
  glueWeight = "itkdb_gtk:glueWeight"
31
31
  groundingTest = "itkdb_gtk:groundingTest"
32
32
  sendShipments = "itkdb_gtk:sendShipments"
33
33
  uploadTest = "itkdb_gtk:uploadTest"
34
34
 
35
+ [tool.setuptools]
36
+ include-package-data = true
37
+
38
+ [tool.setuptools.package-data]
39
+ mypkg = ["*.desktop", "*.svg"]
40
+
35
41
  [project.urls]
36
42
  "Homepage" = "https://gitlab.cern.ch/atlas-itk/sw/db/itk-pdb-gtk-gui-utils"
37
43
  "Bug Tracker" = "https://gitlab.cern.ch/atlas-itk/sw/db/itk-pdb-gtk-gui-utils/-/issues"
File without changes
File without changes