itkdb-gtk 0.0.12__tar.gz → 0.0.16.dev0__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.
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/PKG-INFO +13 -5
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/README.md +7 -4
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ITkDBlogin.py +1 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ITkDButils.py +6 -2
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/__init__.py +9 -5
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/dashBoard.py +33 -9
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/dbGtkUtils.py +38 -0
- itkdb_gtk-0.0.12/itkdb_gtk/gndVITests.py → itkdb_gtk-0.0.16.dev0/itkdb_gtk/groundVITests.py +32 -0
- itkdb_gtk-0.0.16.dev0/itkdb_gtk/untrash_component.py +35 -0
- itkdb_gtk-0.0.16.dev0/itkdb_gtk/uploadIVfiles.py +484 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/uploadPetalInformation.py +1 -1
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/uploadTest.py +35 -10
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk.egg-info/PKG-INFO +14 -6
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk.egg-info/SOURCES.txt +3 -3
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk.egg-info/entry_points.txt +2 -1
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/pyproject.toml +3 -2
- itkdb_gtk-0.0.12/itkdb_gtk/checkComponent.py +0 -151
- itkdb_gtk-0.0.12/itkdb_gtk/checkJSon.py +0 -56
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/GlueWeight.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ITkDB.desktop +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ITkDB.svg +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ShowAttachments.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ShowComments.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/ShowDefects.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/getShipments.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/readAVSdata.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/readGoogleSheet.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/sendShipments.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk/uploadMultipleTests.py +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk.egg-info/dependency_links.txt +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk.egg-info/requires.txt +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/itkdb_gtk.egg-info/top_level.txt +0 -0
- {itkdb_gtk-0.0.12 → itkdb_gtk-0.0.16.dev0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itkdb_gtk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16.dev0
|
|
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
|
|
@@ -9,6 +9,11 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.7
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: itkdb>=0.4.0
|
|
13
|
+
Requires-Dist: openpyxl
|
|
14
|
+
Requires-Dist: pyserial
|
|
15
|
+
Requires-Dist: python_dateutil
|
|
16
|
+
Requires-Dist: requests
|
|
12
17
|
|
|
13
18
|
# Interaction with the ITk PDB.
|
|
14
19
|
|
|
@@ -53,12 +58,15 @@ reception. It will finally make the DB aware of the items receptioned.
|
|
|
53
58
|
Create a new shipment. Allows to add items with the QR reader as well as from a
|
|
54
59
|
GUI dialog. One can add comments and attachments to the shipment.
|
|
55
60
|
|
|
56
|
-
##
|
|
57
|
-
Allows to enter valueos, comments and defects for those
|
|
61
|
+
## groundVITests.py
|
|
62
|
+
Allows to upload and enter valueos, comments and defects for those items in the gounding
|
|
58
63
|
and visual instpections tests of the petal core.
|
|
59
64
|
|
|
65
|
+
## uploadIVfiles.py
|
|
66
|
+
The idea behind this is that we messure the IV on a Ring module and on only one of the to Half modules. The IV of the remaining half modules is derived from the other 2. Eventually the IV test can be uploaded to the DB.
|
|
67
|
+
|
|
60
68
|
## dashBoard.py
|
|
61
69
|
This is an launcher application from which we can start most of the other
|
|
62
70
|
applications. It is a very good starting point. There is a Gnome desktop file (ITkDB.desktop)
|
|
63
|
-
that needs to be copied to
|
|
64
|
-
needs to go to
|
|
71
|
+
that needs to be copied to `$HOME/.local/share/applications` and an icon (ITkDB.svg) that
|
|
72
|
+
needs to go to `$HOME/.local/share/icons`
|
|
@@ -41,12 +41,15 @@ reception. It will finally make the DB aware of the items receptioned.
|
|
|
41
41
|
Create a new shipment. Allows to add items with the QR reader as well as from a
|
|
42
42
|
GUI dialog. One can add comments and attachments to the shipment.
|
|
43
43
|
|
|
44
|
-
##
|
|
45
|
-
Allows to enter valueos, comments and defects for those
|
|
44
|
+
## groundVITests.py
|
|
45
|
+
Allows to upload and enter valueos, comments and defects for those items in the gounding
|
|
46
46
|
and visual instpections tests of the petal core.
|
|
47
47
|
|
|
48
|
+
## uploadIVfiles.py
|
|
49
|
+
The idea behind this is that we messure the IV on a Ring module and on only one of the to Half modules. The IV of the remaining half modules is derived from the other 2. Eventually the IV test can be uploaded to the DB.
|
|
50
|
+
|
|
48
51
|
## dashBoard.py
|
|
49
52
|
This is an launcher application from which we can start most of the other
|
|
50
53
|
applications. It is a very good starting point. There is a Gnome desktop file (ITkDB.desktop)
|
|
51
|
-
that needs to be copied to
|
|
52
|
-
needs to go to
|
|
54
|
+
that needs to be copied to `$HOME/.local/share/applications` and an icon (ITkDB.svg) that
|
|
55
|
+
needs to go to `$HOME/.local/share/icons`
|
|
@@ -235,9 +235,13 @@ def set_object_stage(client, SN, stage):
|
|
|
235
235
|
def get_DB_component(client, SN):
|
|
236
236
|
"""Get ta component by its serial number."""
|
|
237
237
|
global db_response
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
try:
|
|
239
|
+
db_response = client.get('getComponent', json={'component': SN})
|
|
240
|
+
return db_response
|
|
240
241
|
|
|
242
|
+
except Exception as e:
|
|
243
|
+
db_response = str(e)
|
|
244
|
+
return None
|
|
241
245
|
|
|
242
246
|
def upload_test(client, data, attachments=None):
|
|
243
247
|
"""Upload a test to the DB.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
__version__ = "0.0.12"
|
|
1
|
+
__version__ = "0.0.16.dev0"
|
|
4
2
|
|
|
5
3
|
|
|
6
4
|
def dash_board():
|
|
7
5
|
"""Launches the dash board."""
|
|
6
|
+
from .dashBoard import main
|
|
8
7
|
dashBoard.main()
|
|
9
8
|
|
|
10
9
|
|
|
@@ -20,9 +19,9 @@ def glueWeight():
|
|
|
20
19
|
main()
|
|
21
20
|
|
|
22
21
|
|
|
23
|
-
def
|
|
22
|
+
def groundVITests():
|
|
24
23
|
"""GND/VI tests."""
|
|
25
|
-
from .
|
|
24
|
+
from .groundVITests import main
|
|
26
25
|
main()
|
|
27
26
|
|
|
28
27
|
|
|
@@ -42,3 +41,8 @@ def uploadMultipleTests():
|
|
|
42
41
|
"""Upload multiple tests."""
|
|
43
42
|
from .uploadMultipleTests import main
|
|
44
43
|
main()
|
|
44
|
+
|
|
45
|
+
def uploadIVfiles():
|
|
46
|
+
"""Upload IV files of single and double modules"""
|
|
47
|
+
from .uploadIVfiles import main
|
|
48
|
+
main()
|
|
@@ -5,14 +5,16 @@ import sys
|
|
|
5
5
|
try:
|
|
6
6
|
import dbGtkUtils
|
|
7
7
|
import getShipments
|
|
8
|
-
import
|
|
8
|
+
import groundVITests
|
|
9
9
|
import ITkDBlogin
|
|
10
10
|
import sendShipments
|
|
11
11
|
import uploadMultipleTests
|
|
12
12
|
import GlueWeight
|
|
13
|
+
import uploadIVfiles
|
|
13
14
|
|
|
14
15
|
except Exception:
|
|
15
|
-
from itkdb_gtk import dbGtkUtils, getShipments,
|
|
16
|
+
from itkdb_gtk import dbGtkUtils, getShipments, groundVITests, uploadIVfiles
|
|
17
|
+
from itkdb_gtk import ITkDBlogin, sendShipments, uploadMultipleTests, GlueWeight
|
|
16
18
|
|
|
17
19
|
import gi
|
|
18
20
|
|
|
@@ -22,7 +24,13 @@ from gi.repository import Gtk
|
|
|
22
24
|
|
|
23
25
|
class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
24
26
|
"""Dashboard class."""
|
|
25
|
-
|
|
27
|
+
UPLOAD_TEST = 1
|
|
28
|
+
CREATE_SHIPMNT = 2
|
|
29
|
+
RECV_SHIPMNT = 3
|
|
30
|
+
PETAL_GND = 4
|
|
31
|
+
GLUE_WEIGHT = 5
|
|
32
|
+
MOD_IV = 6
|
|
33
|
+
|
|
26
34
|
def __init__(self, session):
|
|
27
35
|
"""Initialization."""
|
|
28
36
|
super().__init__(title="ITkDB Dashboard", session=session)
|
|
@@ -59,6 +67,11 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
59
67
|
btnWeight.connect("clicked", self.glue_weight)
|
|
60
68
|
grid.attach(btnWeight, 0, irow, 1, 1)
|
|
61
69
|
|
|
70
|
+
btnModIV = Gtk.Button(label="Module IV")
|
|
71
|
+
btnModIV.connect("clicked", self.module_IV)
|
|
72
|
+
grid.attach(btnModIV, 1, irow, 1, 1)
|
|
73
|
+
|
|
74
|
+
|
|
62
75
|
irow += 1
|
|
63
76
|
grid.attach(Gtk.Label(), 0, irow, 1, 1)
|
|
64
77
|
|
|
@@ -83,7 +96,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
83
96
|
|
|
84
97
|
def upload_test(self, *args):
|
|
85
98
|
"""Launch upload test."""
|
|
86
|
-
bitn =
|
|
99
|
+
bitn = DashWindow.UPLOAD_TEST
|
|
87
100
|
bt = 1 << bitn
|
|
88
101
|
if self.mask & bt:
|
|
89
102
|
return
|
|
@@ -94,7 +107,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
94
107
|
|
|
95
108
|
def create_shipment(self, *args):
|
|
96
109
|
"""Launch sendShipment."""
|
|
97
|
-
bitn =
|
|
110
|
+
bitn = DashWindow.CREATE_SHIPMNT
|
|
98
111
|
bt = 1 << bitn
|
|
99
112
|
if self.mask & bt:
|
|
100
113
|
return
|
|
@@ -105,7 +118,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
105
118
|
|
|
106
119
|
def receive_shipment(self, *args):
|
|
107
120
|
"""Launch getShipments."""
|
|
108
|
-
bitn =
|
|
121
|
+
bitn = DashWindow.RECV_SHIPMNT
|
|
109
122
|
bt = 1 << bitn
|
|
110
123
|
if self.mask & bt:
|
|
111
124
|
return
|
|
@@ -116,18 +129,18 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
116
129
|
|
|
117
130
|
def petal_gnd(self, *args):
|
|
118
131
|
"""Petal GND/VI test."""
|
|
119
|
-
bitn =
|
|
132
|
+
bitn = DashWindow.PETAL_GND
|
|
120
133
|
bt = 1 << bitn
|
|
121
134
|
if self.mask & bt:
|
|
122
135
|
return
|
|
123
136
|
|
|
124
137
|
self.mask |= bt
|
|
125
|
-
W =
|
|
138
|
+
W = groundVITests.GroundingTest(self.session)
|
|
126
139
|
W.connect("destroy", self.app_closed, bitn)
|
|
127
140
|
|
|
128
141
|
def glue_weight(self, *args):
|
|
129
142
|
"""Glue Weight test."""
|
|
130
|
-
bitn =
|
|
143
|
+
bitn = DashWindow.GLUE_WEIGHT
|
|
131
144
|
bt = 1 << bitn
|
|
132
145
|
if self.mask & bt:
|
|
133
146
|
return
|
|
@@ -136,6 +149,17 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
136
149
|
W = GlueWeight.GlueWeight(self.session)
|
|
137
150
|
W.connect("destroy", self.app_closed, bitn)
|
|
138
151
|
|
|
152
|
+
def module_IV(self, *args):
|
|
153
|
+
"""Module IV tests."""
|
|
154
|
+
bitn = DashWindow.MOD_IV
|
|
155
|
+
bt = 1 << bitn
|
|
156
|
+
if self.mask & bt:
|
|
157
|
+
return
|
|
158
|
+
|
|
159
|
+
self.mask |= bt
|
|
160
|
+
W = uploadIVfiles.IVwindow(self.session)
|
|
161
|
+
W.connect("destroy", self.app_closed, bitn)
|
|
162
|
+
|
|
139
163
|
def app_closed(self, *args):
|
|
140
164
|
"""Application window closed. Clear mask."""
|
|
141
165
|
bt = 1 << args[1]
|
|
@@ -7,11 +7,23 @@ from datetime import datetime
|
|
|
7
7
|
|
|
8
8
|
import dateutil.parser
|
|
9
9
|
import gi
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
gi.require_version("Gtk", "3.0")
|
|
12
14
|
from gi.repository import Gtk, Gio, GLib
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
def is_a_date(txt):
|
|
18
|
+
"""check tha the input string is a date."""
|
|
19
|
+
try:
|
|
20
|
+
dateutil.parser.parse(txt, fuzzy=False)
|
|
21
|
+
return True
|
|
22
|
+
|
|
23
|
+
except Exception:
|
|
24
|
+
return False
|
|
25
|
+
|
|
26
|
+
|
|
15
27
|
def set_combo_iter(combo, txt, col=0):
|
|
16
28
|
"""Set scombo active iter to that containing txt in column col."""
|
|
17
29
|
model = combo.get_model()
|
|
@@ -55,6 +67,12 @@ class MyEncoder(json.JSONEncoder):
|
|
|
55
67
|
if isinstance(o, datetime):
|
|
56
68
|
text = o.astimezone().isoformat()
|
|
57
69
|
return text
|
|
70
|
+
elif isinstance(o, np.integer):
|
|
71
|
+
return int(o)
|
|
72
|
+
elif isinstance(o, np.floating):
|
|
73
|
+
return float(o)
|
|
74
|
+
elif isinstance(o, np.ndarray):
|
|
75
|
+
return o.tolist()
|
|
58
76
|
else:
|
|
59
77
|
return super().default(o)
|
|
60
78
|
|
|
@@ -300,6 +318,8 @@ def add_button_to_container(box, label, tooltip=None, callback=None):
|
|
|
300
318
|
btn.connect("clicked", callback)
|
|
301
319
|
|
|
302
320
|
box.pack_start(btn, True, False, 0)
|
|
321
|
+
|
|
322
|
+
return btn
|
|
303
323
|
|
|
304
324
|
|
|
305
325
|
class ITkDBWindow(Gtk.Window):
|
|
@@ -351,6 +371,9 @@ class ITkDBWindow(Gtk.Window):
|
|
|
351
371
|
|
|
352
372
|
# Create main content box
|
|
353
373
|
self.mainBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
374
|
+
self.mainBox.set_property("margin-left", 6)
|
|
375
|
+
self.mainBox.set_property("margin-right", 6)
|
|
376
|
+
|
|
354
377
|
self.add(self.mainBox)
|
|
355
378
|
|
|
356
379
|
# The text view and buffer
|
|
@@ -484,12 +507,18 @@ class DictDialog(Gtk.Grid):
|
|
|
484
507
|
super().__init__(column_spacing=5, row_spacing=1)
|
|
485
508
|
|
|
486
509
|
self.set_border_width(10)
|
|
510
|
+
self.factory = deepcopy(values)
|
|
487
511
|
self.values = deepcopy(values)
|
|
488
512
|
self.keys = {}
|
|
489
513
|
self.containers = {}
|
|
490
514
|
self.hidden_keys = hidden_keys
|
|
491
515
|
self.show_values()
|
|
492
516
|
|
|
517
|
+
def factory_reset(self):
|
|
518
|
+
"""Set values to original values."""
|
|
519
|
+
self.values = deepcopy(self.factory)
|
|
520
|
+
self.refresh()
|
|
521
|
+
|
|
493
522
|
def on_enter(self, entry, *args):
|
|
494
523
|
"""Get the value when we first enter into the Entry."""
|
|
495
524
|
self.keys[args[2]] = entry.get_text()
|
|
@@ -519,6 +548,15 @@ class DictDialog(Gtk.Grid):
|
|
|
519
548
|
elif isinstance(itm[last_key], datetime):
|
|
520
549
|
itm[last_key] = dateutil.parser.parse(txt)
|
|
521
550
|
|
|
551
|
+
elif is_a_date(itm[last_key]):
|
|
552
|
+
D = dateutil.parser.parse(txt)
|
|
553
|
+
out = D.isoformat(timespec='milliseconds')
|
|
554
|
+
if out[-1] not in ['zZ']:
|
|
555
|
+
out += 'Z'
|
|
556
|
+
|
|
557
|
+
itm[last_key] = out
|
|
558
|
+
self.containers[name].set_text(out)
|
|
559
|
+
|
|
522
560
|
else:
|
|
523
561
|
tp = type(itm[last_key])
|
|
524
562
|
itm[last_key] = tp(txt)
|
|
@@ -61,8 +61,16 @@ class GroundingTest(dbGtkUtils.ITkDBWindow):
|
|
|
61
61
|
grid.attach(lbl, 0, 0, 1, 1)
|
|
62
62
|
|
|
63
63
|
self.SN = Gtk.Entry()
|
|
64
|
+
self.SN.connect("focus-in-event", self.on_sn_enter)
|
|
65
|
+
self.SN.connect("focus-out-event", self.on_sn_leave)
|
|
64
66
|
grid.attach(self.SN, 1, 0, 1, 1)
|
|
65
67
|
|
|
68
|
+
self.alias = Gtk.Label(label="")
|
|
69
|
+
grid.attach(self.alias, 2, 0, 1, 1)
|
|
70
|
+
|
|
71
|
+
self.stage = Gtk.Label(label="")
|
|
72
|
+
grid.attach(self.stage, 3, 0, 1, 1)
|
|
73
|
+
|
|
66
74
|
lbl = Gtk.Label(label="Institute")
|
|
67
75
|
lbl.set_xalign(0)
|
|
68
76
|
grid.attach(lbl, 0, 1, 1, 1)
|
|
@@ -91,6 +99,7 @@ class GroundingTest(dbGtkUtils.ITkDBWindow):
|
|
|
91
99
|
# Create the Notebook pages
|
|
92
100
|
self.create_test_box("Visual Inspection", "VISUAL_INSPECTION")
|
|
93
101
|
self.create_test_box("Grounding", "GROUNDING_CHECK")
|
|
102
|
+
self.create_test_box("Pipe bending", "BENDING120")
|
|
94
103
|
|
|
95
104
|
# The text view
|
|
96
105
|
frame = self.create_text_view()
|
|
@@ -98,6 +107,29 @@ class GroundingTest(dbGtkUtils.ITkDBWindow):
|
|
|
98
107
|
|
|
99
108
|
self.show_all()
|
|
100
109
|
|
|
110
|
+
def on_sn_enter(self, entry, *args):
|
|
111
|
+
"""Enter in SN entry."""
|
|
112
|
+
self._sn = entry.get_text()
|
|
113
|
+
|
|
114
|
+
def on_sn_leave(self, entry, *args):
|
|
115
|
+
"""Leave SN entry."""
|
|
116
|
+
sn = entry.get_text()
|
|
117
|
+
if sn != self._sn:
|
|
118
|
+
self.query_db()
|
|
119
|
+
current_location = self.dbObject["currentLocation"]["code"]
|
|
120
|
+
dbGtkUtils.set_combo_iter(self.inst_cmb, current_location, 0)
|
|
121
|
+
|
|
122
|
+
stg = self.dbObject["currentStage"]["name"]
|
|
123
|
+
self.stage.set_text(stg)
|
|
124
|
+
|
|
125
|
+
alias = self.dbObject["alternativeIdentifier"]
|
|
126
|
+
self.alias.set_text(alias)
|
|
127
|
+
|
|
128
|
+
npages = self.notebook.get_n_pages()
|
|
129
|
+
for i in range(npages):
|
|
130
|
+
page = self.notebook.get_nth_page(i)
|
|
131
|
+
page.dict_dialog.factory_reset()
|
|
132
|
+
|
|
101
133
|
def create_test_box(self, label, test_name, institute="IFIC"):
|
|
102
134
|
"""Create and add to notebook a test dialog.
|
|
103
135
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Un trash a trashed component."""
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def untrash_component(client, SN, reason="Accidentally trashed"):
|
|
6
|
+
"""Un trash given component.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
SN (str): Serial number of component to recover.
|
|
10
|
+
reason (str): message for the DB
|
|
11
|
+
Return:
|
|
12
|
+
dict: PDB response.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
DTO = {
|
|
16
|
+
'component': SN,
|
|
17
|
+
'trashed': False,
|
|
18
|
+
'reason': reason
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
response = client.post('setComponentTrashed', json=DTO)
|
|
22
|
+
return response
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == "__main__":
|
|
26
|
+
import sys
|
|
27
|
+
from itkdb_gtk import ITkDBlogin
|
|
28
|
+
dlg = ITkDBlogin.ITkDBlogin()
|
|
29
|
+
client = dlg.get_client()
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
response = untrash_component(client, sys.argv[1])
|
|
33
|
+
|
|
34
|
+
except Exception as E:
|
|
35
|
+
print(str(E))
|