itkdb-gtk 0.0.14__py3-none-any.whl → 0.0.16__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.
- itkdb_gtk/{getShipments.py → GetShipments.py} +9 -8
- itkdb_gtk/GlueWeight.py +8 -5
- itkdb_gtk/{groundVITests.py → GroundVITests.py} +10 -8
- itkdb_gtk/ITkDBlogin.py +1 -0
- itkdb_gtk/ITkDButils.py +6 -2
- itkdb_gtk/{sendShipments.py → SendShipments.py} +9 -7
- itkdb_gtk/ShowAttachments.py +136 -8
- itkdb_gtk/ShowComments.py +12 -3
- itkdb_gtk/ShowDefects.py +17 -5
- itkdb_gtk/UploadModuleIV.py +857 -0
- itkdb_gtk/{uploadMultipleTests.py → UploadMultipleTests.py} +13 -15
- itkdb_gtk/{uploadPetalInformation.py → UploadPetalInformation.py} +9 -9
- itkdb_gtk/{uploadTest.py → UploadTest.py} +87 -49
- itkdb_gtk/WireBondGui.py +863 -0
- itkdb_gtk/__init__.py +18 -10
- itkdb_gtk/dashBoard.py +68 -22
- itkdb_gtk/dbGtkUtils.py +165 -41
- itkdb_gtk/readAVSdata.py +8 -4
- itkdb_gtk/readGoogleSheet.py +1 -1
- itkdb_gtk/untrash_component.py +35 -0
- {itkdb_gtk-0.0.14.dist-info → itkdb_gtk-0.0.16.dist-info}/METADATA +13 -8
- itkdb_gtk-0.0.16.dist-info/RECORD +27 -0
- {itkdb_gtk-0.0.14.dist-info → itkdb_gtk-0.0.16.dist-info}/WHEEL +1 -1
- {itkdb_gtk-0.0.14.dist-info → itkdb_gtk-0.0.16.dist-info}/entry_points.txt +2 -0
- itkdb_gtk/checkComponent.py +0 -151
- itkdb_gtk/checkComponentTests.py +0 -116
- itkdb_gtk/checkJSon.py +0 -56
- itkdb_gtk/recover_component.py +0 -0
- itkdb_gtk-0.0.14.dist-info/RECORD +0 -28
- {itkdb_gtk-0.0.14.dist-info → itkdb_gtk-0.0.16.dist-info}/top_level.txt +0 -0
itkdb_gtk/__init__.py
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
__version__ = "0.0.14"
|
|
1
|
+
__version__ = "0.0.16"
|
|
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
|
|
|
11
10
|
def getShipments():
|
|
12
11
|
"""getShipments."""
|
|
13
|
-
from .
|
|
12
|
+
from .GetShipments import main
|
|
14
13
|
main()
|
|
15
14
|
|
|
16
15
|
|
|
@@ -22,23 +21,32 @@ def glueWeight():
|
|
|
22
21
|
|
|
23
22
|
def groundVITests():
|
|
24
23
|
"""GND/VI tests."""
|
|
25
|
-
from .
|
|
24
|
+
from .GroundVITests import main
|
|
26
25
|
main()
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def sendShipments():
|
|
30
29
|
"""Send items."""
|
|
31
|
-
from .
|
|
30
|
+
from .SendShipments import main
|
|
32
31
|
main()
|
|
33
32
|
|
|
34
|
-
|
|
35
33
|
def uploadTest():
|
|
36
|
-
"""Upload tests."""
|
|
37
|
-
from .
|
|
34
|
+
"""Upload a single tests."""
|
|
35
|
+
from .UploadTest import main
|
|
38
36
|
main()
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
def uploadMultipleTests():
|
|
42
40
|
"""Upload multiple tests."""
|
|
43
|
-
from .
|
|
41
|
+
from .UploadMultipleTests import main
|
|
42
|
+
main()
|
|
43
|
+
|
|
44
|
+
def uploadModuleIV():
|
|
45
|
+
"""Upload IV files of single and double modules"""
|
|
46
|
+
from .UploadModuleIV import main
|
|
47
|
+
main()
|
|
48
|
+
|
|
49
|
+
def wirebondTest():
|
|
50
|
+
"""Inputs data and eventually upload wirebod test."""
|
|
51
|
+
from .WireBondGui import main
|
|
44
52
|
main()
|
itkdb_gtk/dashBoard.py
CHANGED
|
@@ -3,17 +3,23 @@
|
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
5
|
try:
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
import itkdb_gtk
|
|
7
|
+
|
|
8
|
+
except ImportError:
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
cwd = Path(sys.argv[0]).parent.parent
|
|
11
|
+
sys.path.append(cwd.as_posix())
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from itkdb_gtk import dbGtkUtils
|
|
15
|
+
from itkdb_gtk import GetShipments
|
|
16
|
+
from itkdb_gtk import GroundVITests
|
|
17
|
+
from itkdb_gtk import ITkDBlogin
|
|
18
|
+
from itkdb_gtk import SendShipments
|
|
19
|
+
from itkdb_gtk import UploadMultipleTests
|
|
20
|
+
from itkdb_gtk import GlueWeight
|
|
21
|
+
from itkdb_gtk import UploadModuleIV
|
|
22
|
+
from itkdb_gtk import WireBondGui
|
|
17
23
|
|
|
18
24
|
import gi
|
|
19
25
|
|
|
@@ -23,7 +29,14 @@ from gi.repository import Gtk
|
|
|
23
29
|
|
|
24
30
|
class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
25
31
|
"""Dashboard class."""
|
|
26
|
-
|
|
32
|
+
UPLOAD_TEST = 1
|
|
33
|
+
CREATE_SHIPMNT = 2
|
|
34
|
+
RECV_SHIPMNT = 3
|
|
35
|
+
PETAL_GND = 4
|
|
36
|
+
GLUE_WEIGHT = 5
|
|
37
|
+
MOD_IV = 6
|
|
38
|
+
WIRE_BOND = 7
|
|
39
|
+
|
|
27
40
|
def __init__(self, session):
|
|
28
41
|
"""Initialization."""
|
|
29
42
|
super().__init__(title="ITkDB Dashboard", session=session)
|
|
@@ -60,6 +73,17 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
60
73
|
btnWeight.connect("clicked", self.glue_weight)
|
|
61
74
|
grid.attach(btnWeight, 0, irow, 1, 1)
|
|
62
75
|
|
|
76
|
+
btnModIV = Gtk.Button(label="Module IV")
|
|
77
|
+
btnModIV.connect("clicked", self.module_IV)
|
|
78
|
+
grid.attach(btnModIV, 1, irow, 1, 1)
|
|
79
|
+
|
|
80
|
+
irow +=1
|
|
81
|
+
btnWireBond = Gtk.Button(label="Wire Bond")
|
|
82
|
+
btnWireBond.connect("clicked", self.wire_bond)
|
|
83
|
+
grid.attach(btnWireBond, 0, irow, 1, 1)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
63
87
|
irow += 1
|
|
64
88
|
grid.attach(Gtk.Label(), 0, irow, 1, 1)
|
|
65
89
|
|
|
@@ -84,51 +108,51 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
84
108
|
|
|
85
109
|
def upload_test(self, *args):
|
|
86
110
|
"""Launch upload test."""
|
|
87
|
-
bitn =
|
|
111
|
+
bitn = DashWindow.UPLOAD_TEST
|
|
88
112
|
bt = 1 << bitn
|
|
89
113
|
if self.mask & bt:
|
|
90
114
|
return
|
|
91
115
|
|
|
92
116
|
self.mask |= bt
|
|
93
|
-
W =
|
|
117
|
+
W = UploadMultipleTests.UploadMultipleTests(self.session)
|
|
94
118
|
W.connect("destroy", self.app_closed, bitn)
|
|
95
119
|
|
|
96
120
|
def create_shipment(self, *args):
|
|
97
121
|
"""Launch sendShipment."""
|
|
98
|
-
bitn =
|
|
122
|
+
bitn = DashWindow.CREATE_SHIPMNT
|
|
99
123
|
bt = 1 << bitn
|
|
100
124
|
if self.mask & bt:
|
|
101
125
|
return
|
|
102
126
|
|
|
103
127
|
self.mask |= bt
|
|
104
|
-
W =
|
|
128
|
+
W = SendShipments.SendShipments(self.session)
|
|
105
129
|
W.connect("destroy", self.app_closed, bitn)
|
|
106
130
|
|
|
107
131
|
def receive_shipment(self, *args):
|
|
108
132
|
"""Launch getShipments."""
|
|
109
|
-
bitn =
|
|
133
|
+
bitn = DashWindow.RECV_SHIPMNT
|
|
110
134
|
bt = 1 << bitn
|
|
111
135
|
if self.mask & bt:
|
|
112
136
|
return
|
|
113
137
|
|
|
114
138
|
self.mask |= bt
|
|
115
|
-
W =
|
|
139
|
+
W = GetShipments.ReceiveShipments(self.session)
|
|
116
140
|
W.connect("destroy", self.app_closed, bitn)
|
|
117
141
|
|
|
118
142
|
def petal_gnd(self, *args):
|
|
119
143
|
"""Petal GND/VI test."""
|
|
120
|
-
bitn =
|
|
144
|
+
bitn = DashWindow.PETAL_GND
|
|
121
145
|
bt = 1 << bitn
|
|
122
146
|
if self.mask & bt:
|
|
123
147
|
return
|
|
124
148
|
|
|
125
149
|
self.mask |= bt
|
|
126
|
-
W =
|
|
150
|
+
W = GroundVITests.GroundingTest(self.session)
|
|
127
151
|
W.connect("destroy", self.app_closed, bitn)
|
|
128
152
|
|
|
129
153
|
def glue_weight(self, *args):
|
|
130
154
|
"""Glue Weight test."""
|
|
131
|
-
bitn =
|
|
155
|
+
bitn = DashWindow.GLUE_WEIGHT
|
|
132
156
|
bt = 1 << bitn
|
|
133
157
|
if self.mask & bt:
|
|
134
158
|
return
|
|
@@ -137,11 +161,33 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
137
161
|
W = GlueWeight.GlueWeight(self.session)
|
|
138
162
|
W.connect("destroy", self.app_closed, bitn)
|
|
139
163
|
|
|
164
|
+
def module_IV(self, *args):
|
|
165
|
+
"""Module IV tests."""
|
|
166
|
+
bitn = DashWindow.MOD_IV
|
|
167
|
+
bt = 1 << bitn
|
|
168
|
+
if self.mask & bt:
|
|
169
|
+
return
|
|
170
|
+
|
|
171
|
+
self.mask |= bt
|
|
172
|
+
W = UploadModuleIV.IVwindow(self.session)
|
|
173
|
+
W.connect("destroy", self.app_closed, bitn)
|
|
174
|
+
|
|
175
|
+
def wire_bond(self, *args):
|
|
176
|
+
"""Module IV tests."""
|
|
177
|
+
bitn = DashWindow.WIRE_BOND
|
|
178
|
+
bt = 1 << bitn
|
|
179
|
+
if self.mask & bt:
|
|
180
|
+
return
|
|
181
|
+
|
|
182
|
+
self.mask |= bt
|
|
183
|
+
W = WireBondGui.WireBond(session=self.session, title="Wirebond")
|
|
184
|
+
W.connect("destroy", self.app_closed, bitn)
|
|
185
|
+
|
|
140
186
|
def app_closed(self, *args):
|
|
141
187
|
"""Application window closed. Clear mask."""
|
|
142
188
|
bt = 1 << args[1]
|
|
143
189
|
self.mask &= ~bt
|
|
144
|
-
print(bt, self.mask)
|
|
190
|
+
# print(bt, self.mask)
|
|
145
191
|
|
|
146
192
|
|
|
147
193
|
def main():
|
itkdb_gtk/dbGtkUtils.py
CHANGED
|
@@ -7,20 +7,60 @@ 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
|
-
from gi.repository import Gtk, Gio, GLib
|
|
14
|
+
from gi.repository import Gtk, GObject, Gio, GLib
|
|
15
|
+
|
|
16
|
+
def parse_date(txt):
|
|
17
|
+
"""Parse a date."""
|
|
18
|
+
try:
|
|
19
|
+
return dateutil.parser.parse(txt, fuzzy=False)
|
|
13
20
|
|
|
21
|
+
except Exception:
|
|
22
|
+
return None
|
|
23
|
+
def parse_date_as_string(txt):
|
|
24
|
+
"""Parse data and return DB compatible string."""
|
|
25
|
+
D = parse_date(txt)
|
|
26
|
+
if D is None:
|
|
27
|
+
return D
|
|
28
|
+
|
|
29
|
+
out = D.isoformat(timespec='milliseconds')
|
|
30
|
+
if out[-1] not in ['zZ']:
|
|
31
|
+
out += 'Z'
|
|
32
|
+
|
|
33
|
+
return out
|
|
14
34
|
|
|
15
35
|
def is_a_date(txt):
|
|
16
36
|
"""check tha the input string is a date."""
|
|
17
37
|
try:
|
|
18
38
|
dateutil.parser.parse(txt, fuzzy=False)
|
|
19
39
|
return True
|
|
20
|
-
|
|
40
|
+
|
|
21
41
|
except Exception:
|
|
22
42
|
return False
|
|
23
43
|
|
|
44
|
+
def new_small_text_entry():
|
|
45
|
+
"""Returs a new, smaller Gtk.Entry."""
|
|
46
|
+
entry = Gtk.Entry()
|
|
47
|
+
provider = Gtk.CssProvider()
|
|
48
|
+
style_context = entry.get_style_context()
|
|
49
|
+
font_size = 2.25*style_context.get_property("font-size", 0)
|
|
50
|
+
css = "entry {{ min-height: {}px; }}".format(font_size)
|
|
51
|
+
provider.load_from_data(css.encode())
|
|
52
|
+
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS)
|
|
53
|
+
return entry
|
|
54
|
+
|
|
55
|
+
def set_entry_style(container):
|
|
56
|
+
"""Set max entry."""
|
|
57
|
+
provider = Gtk.CssProvider()
|
|
58
|
+
style_context = container.get_style_context()
|
|
59
|
+
font_size = 2.25*style_context.get_property("font-size", 0)
|
|
60
|
+
css = "{} {{ min-height: {}px; }}".format(container.get_name(), font_size)
|
|
61
|
+
provider.load_from_data(css.encode())
|
|
62
|
+
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS)
|
|
63
|
+
return container
|
|
24
64
|
|
|
25
65
|
def set_combo_iter(combo, txt, col=0):
|
|
26
66
|
"""Set scombo active iter to that containing txt in column col."""
|
|
@@ -35,17 +75,6 @@ def set_combo_iter(combo, txt, col=0):
|
|
|
35
75
|
iter = model.iter_next(iter)
|
|
36
76
|
|
|
37
77
|
|
|
38
|
-
def set_entry_style(container):
|
|
39
|
-
"""Set max entry."""
|
|
40
|
-
provider = Gtk.CssProvider()
|
|
41
|
-
print(container.get_name())
|
|
42
|
-
style_context = container.get_style_context()
|
|
43
|
-
font_size = 2.25*style_context.get_property("font-size", 0)
|
|
44
|
-
css = "{} {{ min-height: {}px; }}".format(container.get_name(), font_size)
|
|
45
|
-
provider.load_from_data(css.encode())
|
|
46
|
-
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS)
|
|
47
|
-
|
|
48
|
-
|
|
49
78
|
def is_iterable(obj):
|
|
50
79
|
"""Tell if an object is iterable. Strings are not considered iterables."""
|
|
51
80
|
if isinstance(obj, Iterable):
|
|
@@ -65,6 +94,12 @@ class MyEncoder(json.JSONEncoder):
|
|
|
65
94
|
if isinstance(o, datetime):
|
|
66
95
|
text = o.astimezone().isoformat()
|
|
67
96
|
return text
|
|
97
|
+
elif isinstance(o, np.integer):
|
|
98
|
+
return int(o)
|
|
99
|
+
elif isinstance(o, np.floating):
|
|
100
|
+
return float(o)
|
|
101
|
+
elif isinstance(o, np.ndarray):
|
|
102
|
+
return o.tolist()
|
|
68
103
|
else:
|
|
69
104
|
return super().default(o)
|
|
70
105
|
|
|
@@ -148,11 +183,16 @@ def ask_for_confirmation(main_title, second_text, parent=None):
|
|
|
148
183
|
return (out == Gtk.ResponseType.OK)
|
|
149
184
|
|
|
150
185
|
|
|
151
|
-
class TextEntry(
|
|
186
|
+
class TextEntry(GObject.GObject):
|
|
152
187
|
"""Create a Gtk text entry/view object."""
|
|
188
|
+
__gsignals__ = {
|
|
189
|
+
"text_changed": (GObject.SIGNAL_RUN_FIRST, None, (str,))
|
|
190
|
+
}
|
|
153
191
|
|
|
154
|
-
def __init__(self, n_lines=1):
|
|
192
|
+
def __init__(self, n_lines=1, small=False):
|
|
155
193
|
"""Init."""
|
|
194
|
+
GObject.GObject.__init__(self)
|
|
195
|
+
self.tmp_txt = ""
|
|
156
196
|
self.nlines = n_lines
|
|
157
197
|
if self.nlines > 1:
|
|
158
198
|
self.widget = Gtk.Frame()
|
|
@@ -166,9 +206,31 @@ class TextEntry(object):
|
|
|
166
206
|
scrolled.add(self.entry)
|
|
167
207
|
|
|
168
208
|
else:
|
|
169
|
-
|
|
209
|
+
if small:
|
|
210
|
+
self.widget = new_small_text_entry()
|
|
211
|
+
else:
|
|
212
|
+
self.widget = Gtk.Entry()
|
|
213
|
+
|
|
214
|
+
self.widget.connect("focus-in-event", self.on_enter)
|
|
215
|
+
self.widget.connect("focus-out-event", self.on_leave)
|
|
216
|
+
|
|
170
217
|
self.entry = self.widget
|
|
171
218
|
|
|
219
|
+
def do_my_signal(self, *args):
|
|
220
|
+
"""Signal handler."""
|
|
221
|
+
pass
|
|
222
|
+
|
|
223
|
+
def on_enter(self, *args):
|
|
224
|
+
"""On enter."""
|
|
225
|
+
self.tmp_txt = self.widget.get_text().strip()
|
|
226
|
+
return False
|
|
227
|
+
|
|
228
|
+
def on_leave(self, *args):
|
|
229
|
+
"""On leave."""
|
|
230
|
+
val = self.widget.get_text().strip()
|
|
231
|
+
if val != self.tmp_txt:
|
|
232
|
+
self.emit("text_changed", val)
|
|
233
|
+
|
|
172
234
|
def get_text(self):
|
|
173
235
|
"""Return the text."""
|
|
174
236
|
if self.nlines > 1:
|
|
@@ -180,6 +242,13 @@ class TextEntry(object):
|
|
|
180
242
|
else:
|
|
181
243
|
return self.entry.get_text()
|
|
182
244
|
|
|
245
|
+
def set_text(self, text):
|
|
246
|
+
"""Sets text."""
|
|
247
|
+
if self.nlines > 1:
|
|
248
|
+
self.entry.get_buffer().set_text(text)
|
|
249
|
+
else:
|
|
250
|
+
self.entry.set_text(text)
|
|
251
|
+
|
|
183
252
|
|
|
184
253
|
def get_a_value(main_title, second_text=None, is_tv=False, parent=None):
|
|
185
254
|
"""Open a dialog to get a value.
|
|
@@ -226,7 +295,7 @@ def get_a_value(main_title, second_text=None, is_tv=False, parent=None):
|
|
|
226
295
|
return out
|
|
227
296
|
|
|
228
297
|
|
|
229
|
-
def get_a_list_of_values(main_title, labels, second_text=None, parent=None):
|
|
298
|
+
def get_a_list_of_values(main_title, labels, defaults=None, second_text=None, parent=None):
|
|
230
299
|
"""Get a list of values.
|
|
231
300
|
|
|
232
301
|
Args:
|
|
@@ -234,6 +303,7 @@ def get_a_list_of_values(main_title, labels, second_text=None, parent=None):
|
|
|
234
303
|
main_title: Main title for window
|
|
235
304
|
labels: List of labes to get the values. If the label ends with /v
|
|
236
305
|
then a TextView will be shown instead of a TextEntry.
|
|
306
|
+
defaults (optional): default values-
|
|
237
307
|
second_text (optional): Second title for window-. Defaults to None.
|
|
238
308
|
|
|
239
309
|
Returns
|
|
@@ -262,7 +332,7 @@ def get_a_list_of_values(main_title, labels, second_text=None, parent=None):
|
|
|
262
332
|
is_text_view = []
|
|
263
333
|
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
264
334
|
area.pack_start(vbox, False, True, 0)
|
|
265
|
-
for txt in labels:
|
|
335
|
+
for i, txt in enumerate(labels):
|
|
266
336
|
use_tv = False
|
|
267
337
|
if txt.endswith("/v"):
|
|
268
338
|
is_text_view.append(True)
|
|
@@ -276,6 +346,11 @@ def get_a_list_of_values(main_title, labels, second_text=None, parent=None):
|
|
|
276
346
|
vbox.pack_start(lbl, False, False, 0)
|
|
277
347
|
|
|
278
348
|
entry = TextEntry(3 if use_tv else -1)
|
|
349
|
+
try:
|
|
350
|
+
entry.set_text(defaults[i])
|
|
351
|
+
except Exception:
|
|
352
|
+
pass
|
|
353
|
+
|
|
279
354
|
vbox.pack_start(entry.widget, False, False, 0)
|
|
280
355
|
entries.append(entry)
|
|
281
356
|
|
|
@@ -311,11 +386,70 @@ def add_button_to_container(box, label, tooltip=None, callback=None):
|
|
|
311
386
|
|
|
312
387
|
box.pack_start(btn, True, False, 0)
|
|
313
388
|
|
|
389
|
+
return btn
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
class MessagePanel(object):
|
|
393
|
+
"""Encapsulates a TExtView object to show messages."""
|
|
394
|
+
|
|
395
|
+
def __init__(self, size=100):
|
|
396
|
+
"""Initializarion."""
|
|
397
|
+
self.frame = None
|
|
398
|
+
self.text_view = Gtk.TextView()
|
|
399
|
+
self.textbuffer = self.text_view.get_buffer()
|
|
400
|
+
|
|
401
|
+
self.__create_message_panel(size)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def __create_message_panel(self, size):
|
|
405
|
+
"""Creates a message panel within a frame.
|
|
406
|
+
|
|
407
|
+
Args:
|
|
408
|
+
size: size of the panel
|
|
409
|
+
|
|
410
|
+
Returns
|
|
411
|
+
Gtk.TextBuffer, Gtk.Frame
|
|
412
|
+
"""
|
|
413
|
+
frame = Gtk.Frame()
|
|
414
|
+
frame.set_shadow_type(Gtk.ShadowType.IN)
|
|
415
|
+
|
|
416
|
+
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
417
|
+
box.set_size_request(-1, size)
|
|
418
|
+
frame.add(box)
|
|
419
|
+
|
|
420
|
+
# The title for the tet view
|
|
421
|
+
box.pack_start(Gtk.Label(label="Messages"), False, True, 0)
|
|
422
|
+
|
|
423
|
+
# A scroll window with the text view
|
|
424
|
+
scrolled = Gtk.ScrolledWindow()
|
|
425
|
+
scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
|
426
|
+
scrolled.add(self.text_view)
|
|
427
|
+
box.pack_start(scrolled, True, True, 0)
|
|
428
|
+
self.frame = frame
|
|
429
|
+
|
|
430
|
+
def scroll_to_end(self):
|
|
431
|
+
"""Scrolls text view to end."""
|
|
432
|
+
end = self.textbuffer.get_end_iter()
|
|
433
|
+
self.text_view.scroll_to_iter(end, 0, False, 0, 0)
|
|
434
|
+
|
|
435
|
+
def write_message(self, text):
|
|
436
|
+
"""Writes text to Text Viewer."""
|
|
437
|
+
nlines = self.textbuffer.get_line_count()
|
|
438
|
+
if nlines > 100:
|
|
439
|
+
start = self.textbuffer.get_iter_at_line(0)
|
|
440
|
+
end = self.textbuffer.get_iter_at_line(75)
|
|
441
|
+
self.textbuffer.delete(start, end)
|
|
442
|
+
|
|
443
|
+
end = self.textbuffer.get_end_iter()
|
|
444
|
+
msg = "[{}] {}".format(time.strftime("%d/%m/%y %T"), text)
|
|
445
|
+
self.textbuffer.insert(end, msg)
|
|
446
|
+
GLib.idle_add(self.scroll_to_end)
|
|
447
|
+
|
|
314
448
|
|
|
315
449
|
class ITkDBWindow(Gtk.Window):
|
|
316
450
|
"""Base class for GUI main windows."""
|
|
317
451
|
|
|
318
|
-
def __init__(self, title="", session=None, show_search=None, gtk_runs=True):
|
|
452
|
+
def __init__(self, title="", session=None, show_search=None, gtk_runs=True, panel_size=100):
|
|
319
453
|
"""Initialization.
|
|
320
454
|
|
|
321
455
|
Args:
|
|
@@ -331,12 +465,13 @@ class ITkDBWindow(Gtk.Window):
|
|
|
331
465
|
self.session = session
|
|
332
466
|
self.inst2code = {}
|
|
333
467
|
self.code2inst = {}
|
|
468
|
+
self.message_panel = None
|
|
334
469
|
|
|
335
470
|
if gtk_runs:
|
|
336
471
|
super().__init__(title=title)
|
|
337
|
-
self.prepare_window(show_search)
|
|
472
|
+
self.prepare_window(show_search, panel_size)
|
|
338
473
|
|
|
339
|
-
def prepare_window(self, show_search):
|
|
474
|
+
def prepare_window(self, show_search, panel_size):
|
|
340
475
|
"""Inititalizes GUI."""
|
|
341
476
|
# Prepare HeaderBar
|
|
342
477
|
self.hb = Gtk.HeaderBar()
|
|
@@ -361,11 +496,13 @@ class ITkDBWindow(Gtk.Window):
|
|
|
361
496
|
|
|
362
497
|
# Create main content box
|
|
363
498
|
self.mainBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
499
|
+
self.mainBox.set_property("margin-left", 6)
|
|
500
|
+
self.mainBox.set_property("margin-right", 6)
|
|
501
|
+
|
|
364
502
|
self.add(self.mainBox)
|
|
365
503
|
|
|
366
504
|
# The text view and buffer
|
|
367
|
-
self.
|
|
368
|
-
self.textbuffer = self.text_view.get_buffer()
|
|
505
|
+
self.message_panel = MessagePanel(size=panel_size)
|
|
369
506
|
|
|
370
507
|
# The button box
|
|
371
508
|
btnBox = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL)
|
|
@@ -388,7 +525,8 @@ class ITkDBWindow(Gtk.Window):
|
|
|
388
525
|
def new_login(self, obj, msg):
|
|
389
526
|
"""A new user logged in."""
|
|
390
527
|
if msg == "<OK>":
|
|
391
|
-
self.session
|
|
528
|
+
if hasattr(self.session, "user_gui"):
|
|
529
|
+
self.session = self.session.user_gui.get_client()
|
|
392
530
|
self.userLabel.get_child().set_text(self.session.user.name)
|
|
393
531
|
|
|
394
532
|
else:
|
|
@@ -460,29 +598,15 @@ class ITkDBWindow(Gtk.Window):
|
|
|
460
598
|
|
|
461
599
|
return frame
|
|
462
600
|
|
|
463
|
-
def scroll_to_end(self):
|
|
464
|
-
"""Scrolls text view to end."""
|
|
465
|
-
end = self.textbuffer.get_end_iter()
|
|
466
|
-
self.text_view.scroll_to_iter(end, 0, False, 0, 0)
|
|
467
|
-
|
|
468
601
|
def write_message(self, text):
|
|
469
602
|
"""Writes text to Text Viewer."""
|
|
470
|
-
|
|
471
|
-
if nlines > 100:
|
|
472
|
-
start = self.textbuffer.get_iter_at_line(0)
|
|
473
|
-
end = self.textbuffer.get_iter_at_line(75)
|
|
474
|
-
self.textbuffer.delete(start, end)
|
|
475
|
-
|
|
476
|
-
end = self.textbuffer.get_end_iter()
|
|
477
|
-
msg = "[{}] {}".format(time.strftime("%d/%m/%y %T"), text)
|
|
478
|
-
self.textbuffer.insert(end, msg)
|
|
479
|
-
GLib.idle_add(self.scroll_to_end)
|
|
603
|
+
self.message_panel.write_message(text)
|
|
480
604
|
|
|
481
605
|
|
|
482
606
|
class DictDialog(Gtk.Grid):
|
|
483
607
|
"""Creates a dialog to show and edit variables in a JSon dict."""
|
|
484
608
|
|
|
485
|
-
def __init__(self, values, hidden_keys=
|
|
609
|
+
def __init__(self, values, hidden_keys=None):
|
|
486
610
|
"""Create the Gtk.Grid.
|
|
487
611
|
|
|
488
612
|
Args:
|
|
@@ -498,7 +622,7 @@ class DictDialog(Gtk.Grid):
|
|
|
498
622
|
self.values = deepcopy(values)
|
|
499
623
|
self.keys = {}
|
|
500
624
|
self.containers = {}
|
|
501
|
-
self.hidden_keys = hidden_keys
|
|
625
|
+
self.hidden_keys = hidden_keys if hidden_keys else {}
|
|
502
626
|
self.show_values()
|
|
503
627
|
|
|
504
628
|
def factory_reset(self):
|
itkdb_gtk/readAVSdata.py
CHANGED
|
@@ -5,10 +5,14 @@ from argparse import ArgumentParser
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
except
|
|
11
|
-
from
|
|
8
|
+
import itkdb_gtk
|
|
9
|
+
|
|
10
|
+
except ImportError:
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
cwd = Path(sys.argv[0]).parent.parent
|
|
13
|
+
sys.path.append(cwd.as_posix())
|
|
14
|
+
|
|
15
|
+
from itkdb_gtk import ITkDBlogin, ITkDButils
|
|
12
16
|
|
|
13
17
|
import dateutil.parser
|
|
14
18
|
import openpyxl as XL
|
itkdb_gtk/readGoogleSheet.py
CHANGED
|
@@ -13,7 +13,7 @@ SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# Get spreadsheet ID from share link
|
|
16
|
-
re_sheet_id = re.compile(r"https://docs.google.com/spreadsheets/d/(?P<ID
|
|
16
|
+
re_sheet_id = re.compile(r"https://docs.google.com/spreadsheets/d/(?P<ID>[\w-]+)", re.DOTALL)
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_spreadsheet_service():
|
|
@@ -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))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.0.
|
|
2
|
+
Name: itkdb_gtk
|
|
3
|
+
Version: 0.0.16
|
|
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,7 +9,9 @@ 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
|
|
12
|
+
Requires-Dist: itkdb >=0.4.0
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: matplotlib
|
|
13
15
|
Requires-Dist: openpyxl
|
|
14
16
|
Requires-Dist: pyserial
|
|
15
17
|
Requires-Dist: python-dateutil
|
|
@@ -41,27 +43,30 @@ Reads the AVS Production Sheet and FAT reports. With this information it creates
|
|
|
41
43
|
the petal core in the DB, if not yet there, make the assembly of the components,
|
|
42
44
|
and uploadas the test runs made at AVS.
|
|
43
45
|
|
|
44
|
-
##
|
|
46
|
+
## UploadTest.py
|
|
45
47
|
A GUI to upload the JSON files corresponding to a test and, also, to add
|
|
46
48
|
attachmetns.
|
|
47
49
|
|
|
48
|
-
##
|
|
50
|
+
## UploadMultipleTests.py
|
|
49
51
|
This will allow to select various test files, or even scan a whole directory to
|
|
50
52
|
find them, and assign comments, defects or attachments to each of the tests found.
|
|
51
53
|
|
|
52
|
-
##
|
|
54
|
+
## GetShipments.py
|
|
53
55
|
Find all shipments to be received at a given site and list them. It handles a
|
|
54
56
|
barcode reader that helps identifying the items actually received for the
|
|
55
57
|
reception. It will finally make the DB aware of the items receptioned.
|
|
56
58
|
|
|
57
|
-
##
|
|
59
|
+
## SendShipments.py
|
|
58
60
|
Create a new shipment. Allows to add items with the QR reader as well as from a
|
|
59
61
|
GUI dialog. One can add comments and attachments to the shipment.
|
|
60
62
|
|
|
61
|
-
##
|
|
63
|
+
## GroundVITests.py
|
|
62
64
|
Allows to upload and enter valueos, comments and defects for those items in the gounding
|
|
63
65
|
and visual instpections tests of the petal core.
|
|
64
66
|
|
|
67
|
+
## UploadModuleIV.py
|
|
68
|
+
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.
|
|
69
|
+
|
|
65
70
|
## dashBoard.py
|
|
66
71
|
This is an launcher application from which we can start most of the other
|
|
67
72
|
applications. It is a very good starting point. There is a Gnome desktop file (ITkDB.desktop)
|