itkdb-gtk 0.9.0__py3-none-any.whl → 0.10.0__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/CreateShipments.py +41 -55
- itkdb_gtk/GetShipments.py +4 -21
- itkdb_gtk/GlueWeight.py +2 -2
- itkdb_gtk/ITkDButils.py +25 -13
- itkdb_gtk/PanelVisualInspection.py +230 -0
- itkdb_gtk/{GroundVITests.py → PetalReceptionTests.py} +7 -6
- itkdb_gtk/SensorUtils.py +490 -0
- itkdb_gtk/UploadModuleIV.py +206 -497
- itkdb_gtk/UploadMultipleTests.py +2 -2
- itkdb_gtk/UploadPetalInformation.py +164 -94
- itkdb_gtk/UploadTest.py +6 -4
- itkdb_gtk/__init__.py +5 -3
- itkdb_gtk/dashBoard.py +13 -12
- itkdb_gtk/dbGtkUtils.py +93 -5
- itkdb_gtk/readAVSdata.py +204 -72
- {itkdb_gtk-0.9.0.dist-info → itkdb_gtk-0.10.0.dist-info}/METADATA +1 -1
- itkdb_gtk-0.10.0.dist-info/RECORD +29 -0
- {itkdb_gtk-0.9.0.dist-info → itkdb_gtk-0.10.0.dist-info}/entry_points.txt +2 -2
- itkdb_gtk-0.9.0.dist-info/RECORD +0 -27
- {itkdb_gtk-0.9.0.dist-info → itkdb_gtk-0.10.0.dist-info}/WHEEL +0 -0
- {itkdb_gtk-0.9.0.dist-info → itkdb_gtk-0.10.0.dist-info}/top_level.txt +0 -0
itkdb_gtk/dashBoard.py
CHANGED
|
@@ -13,7 +13,7 @@ except ImportError:
|
|
|
13
13
|
|
|
14
14
|
from itkdb_gtk import dbGtkUtils
|
|
15
15
|
from itkdb_gtk import GetShipments
|
|
16
|
-
from itkdb_gtk import
|
|
16
|
+
from itkdb_gtk import PetalReceptionTests
|
|
17
17
|
from itkdb_gtk import ITkDBlogin
|
|
18
18
|
from itkdb_gtk import CreateShipments
|
|
19
19
|
from itkdb_gtk import UploadTest
|
|
@@ -27,6 +27,7 @@ import gi
|
|
|
27
27
|
gi.require_version("Gtk", "3.0")
|
|
28
28
|
from gi.repository import Gtk
|
|
29
29
|
|
|
30
|
+
HELP_LINK="https://itkdb-gtk.docs.cern.ch"
|
|
30
31
|
|
|
31
32
|
class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
32
33
|
"""Dashboard class."""
|
|
@@ -41,7 +42,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
41
42
|
|
|
42
43
|
def __init__(self, session):
|
|
43
44
|
"""Initialization."""
|
|
44
|
-
super().__init__(title="ITkDB Dashboard", session=session)
|
|
45
|
+
super().__init__(title="ITkDB Dashboard", session=session, help=HELP_LINK)
|
|
45
46
|
self.mask = 0
|
|
46
47
|
|
|
47
48
|
# set border width
|
|
@@ -71,7 +72,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
71
72
|
grid.attach(btnTest, 1, irow, 1, 1)
|
|
72
73
|
|
|
73
74
|
irow += 1
|
|
74
|
-
btnGnd = Gtk.Button(label="Petal
|
|
75
|
+
btnGnd = Gtk.Button(label="Petal Reception")
|
|
75
76
|
btnGnd.connect("clicked", self.petal_gnd)
|
|
76
77
|
grid.attach(btnGnd, 0, irow, 1, 1)
|
|
77
78
|
|
|
@@ -80,7 +81,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
80
81
|
grid.attach(btnWeight, 1, irow, 1, 1)
|
|
81
82
|
|
|
82
83
|
irow += 1
|
|
83
|
-
btnModIV = Gtk.Button(label="Module IV")
|
|
84
|
+
btnModIV = Gtk.Button(label="Sensor/Module IV")
|
|
84
85
|
btnModIV.connect("clicked", self.module_IV)
|
|
85
86
|
grid.attach(btnModIV, 0, irow, 1, 1)
|
|
86
87
|
|
|
@@ -120,7 +121,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
120
121
|
return
|
|
121
122
|
|
|
122
123
|
self.mask |= bt
|
|
123
|
-
W = UploadTest.UploadTest(self.session)
|
|
124
|
+
W = UploadTest.UploadTest(self.session, help=HELP_LINK)
|
|
124
125
|
W.connect("destroy", self.app_closed, bitn)
|
|
125
126
|
|
|
126
127
|
def upload_multiple_tests(self, *args):
|
|
@@ -131,7 +132,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
131
132
|
return
|
|
132
133
|
|
|
133
134
|
self.mask |= bt
|
|
134
|
-
W = UploadMultipleTests.UploadMultipleTests(self.session)
|
|
135
|
+
W = UploadMultipleTests.UploadMultipleTests(self.session, help=HELP_LINK)
|
|
135
136
|
W.connect("destroy", self.app_closed, bitn)
|
|
136
137
|
|
|
137
138
|
def create_shipment(self, *args):
|
|
@@ -142,7 +143,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
142
143
|
return
|
|
143
144
|
|
|
144
145
|
self.mask |= bt
|
|
145
|
-
W = CreateShipments.CreateShipments(self.session)
|
|
146
|
+
W = CreateShipments.CreateShipments(self.session, help=HELP_LINK)
|
|
146
147
|
W.connect("destroy", self.app_closed, bitn)
|
|
147
148
|
|
|
148
149
|
def receive_shipment(self, *args):
|
|
@@ -153,7 +154,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
153
154
|
return
|
|
154
155
|
|
|
155
156
|
self.mask |= bt
|
|
156
|
-
W = GetShipments.ReceiveShipments(self.session)
|
|
157
|
+
W = GetShipments.ReceiveShipments(self.session, help=HELP_LINK)
|
|
157
158
|
W.connect("destroy", self.app_closed, bitn)
|
|
158
159
|
|
|
159
160
|
def petal_gnd(self, *args):
|
|
@@ -164,7 +165,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
164
165
|
return
|
|
165
166
|
|
|
166
167
|
self.mask |= bt
|
|
167
|
-
W =
|
|
168
|
+
W = PetalReceptionTests.PetalReceptionTests(self.session, help=HELP_LINK)
|
|
168
169
|
W.connect("destroy", self.app_closed, bitn)
|
|
169
170
|
|
|
170
171
|
def glue_weight(self, *args):
|
|
@@ -175,7 +176,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
175
176
|
return
|
|
176
177
|
|
|
177
178
|
self.mask |= bt
|
|
178
|
-
W = GlueWeight.GlueWeight(self.session)
|
|
179
|
+
W = GlueWeight.GlueWeight(self.session, help=HELP_LINK)
|
|
179
180
|
W.connect("destroy", self.app_closed, bitn)
|
|
180
181
|
|
|
181
182
|
def module_IV(self, *args):
|
|
@@ -186,7 +187,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
186
187
|
return
|
|
187
188
|
|
|
188
189
|
self.mask |= bt
|
|
189
|
-
W = UploadModuleIV.IVwindow(self.session)
|
|
190
|
+
W = UploadModuleIV.IVwindow(self.session, help=HELP_LINK)
|
|
190
191
|
W.connect("destroy", self.app_closed, bitn)
|
|
191
192
|
|
|
192
193
|
def wire_bond(self, *args):
|
|
@@ -197,7 +198,7 @@ class DashWindow(dbGtkUtils.ITkDBWindow):
|
|
|
197
198
|
return
|
|
198
199
|
|
|
199
200
|
self.mask |= bt
|
|
200
|
-
W = WireBondGui.WireBond(session=self.session, title="Wirebond")
|
|
201
|
+
W = WireBondGui.WireBond(session=self.session, title="Wirebond", help=HELP_LINK)
|
|
201
202
|
W.connect("destroy", self.app_closed, bitn)
|
|
202
203
|
|
|
203
204
|
def app_closed(self, *args):
|
itkdb_gtk/dbGtkUtils.py
CHANGED
|
@@ -1,18 +1,51 @@
|
|
|
1
1
|
"""A set of GTK utilities for DB scripts."""
|
|
2
2
|
import json
|
|
3
3
|
import time
|
|
4
|
+
import pathlib
|
|
5
|
+
|
|
4
6
|
from collections.abc import Iterable
|
|
5
7
|
from copy import deepcopy
|
|
6
8
|
from datetime import datetime
|
|
9
|
+
import webbrowser
|
|
10
|
+
import serial
|
|
7
11
|
|
|
8
12
|
import dateutil.parser
|
|
9
|
-
import gi
|
|
10
13
|
import numpy as np
|
|
11
14
|
|
|
12
15
|
|
|
16
|
+
import gi
|
|
13
17
|
gi.require_version("Gtk", "3.0")
|
|
14
18
|
from gi.repository import Gtk, GObject, Gio, GLib
|
|
15
19
|
|
|
20
|
+
|
|
21
|
+
def setup_scanner(callback):
|
|
22
|
+
"""Setup scanner and callback function."""
|
|
23
|
+
for fnam in ["/dev/ttyACM0", "/dev/cu.usbmodemS_N_G19F204881"]:
|
|
24
|
+
P = pathlib.Path(fnam)
|
|
25
|
+
if P.exists():
|
|
26
|
+
rdr = serial.Serial(fnam, 9600)
|
|
27
|
+
GLib.unix_fd_add_full(
|
|
28
|
+
GLib.PRIORITY_DEFAULT,
|
|
29
|
+
rdr.fileno(),
|
|
30
|
+
GLib.IOCondition.IN,
|
|
31
|
+
callback,
|
|
32
|
+
rdr,
|
|
33
|
+
)
|
|
34
|
+
break
|
|
35
|
+
|
|
36
|
+
def scanner_get_line(reader):
|
|
37
|
+
"""Reads a line from serial."""
|
|
38
|
+
available = reader.in_waiting
|
|
39
|
+
while True:
|
|
40
|
+
delta = reader.in_waiting - available
|
|
41
|
+
if not delta:
|
|
42
|
+
break
|
|
43
|
+
|
|
44
|
+
# Get data from serial device passed in via
|
|
45
|
+
data = reader.read_until(expected='\r', size=reader.in_waiting).strip()
|
|
46
|
+
txt = data.decode('utf-8')
|
|
47
|
+
return txt
|
|
48
|
+
|
|
16
49
|
def parse_date(txt):
|
|
17
50
|
"""Parse a date."""
|
|
18
51
|
try:
|
|
@@ -20,6 +53,7 @@ def parse_date(txt):
|
|
|
20
53
|
|
|
21
54
|
except Exception:
|
|
22
55
|
return None
|
|
56
|
+
|
|
23
57
|
def parse_date_as_string(txt):
|
|
24
58
|
"""Parse data and return DB compatible string."""
|
|
25
59
|
D = parse_date(txt)
|
|
@@ -62,6 +96,14 @@ def set_entry_style(container):
|
|
|
62
96
|
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS)
|
|
63
97
|
return container
|
|
64
98
|
|
|
99
|
+
def set_button_color(btn, bg_color, fg_color="white"):
|
|
100
|
+
"""Set button color"""
|
|
101
|
+
css = "#{} {{background-image: none; background-color: {}; color: {}}}".format(btn.get_name(), bg_color, fg_color)
|
|
102
|
+
provider = Gtk.CssProvider()
|
|
103
|
+
provider.load_from_data(css.encode())
|
|
104
|
+
style_context = btn.get_style_context()
|
|
105
|
+
style_context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
|
106
|
+
|
|
65
107
|
def set_combo_iter(combo, txt, col=0):
|
|
66
108
|
"""Set scombo active iter to that containing txt in column col."""
|
|
67
109
|
model = combo.get_model()
|
|
@@ -422,7 +464,7 @@ class MessagePanel(object):
|
|
|
422
464
|
end = self.textbuffer.get_end_iter()
|
|
423
465
|
self.text_view.scroll_to_iter(end, 0, False, 0, 0)
|
|
424
466
|
|
|
425
|
-
def write_message(self, text):
|
|
467
|
+
def write_message(self, text, write_date=True):
|
|
426
468
|
"""Writes text to Text Viewer."""
|
|
427
469
|
nlines = self.textbuffer.get_line_count()
|
|
428
470
|
if nlines > 100:
|
|
@@ -431,15 +473,23 @@ class MessagePanel(object):
|
|
|
431
473
|
self.textbuffer.delete(start, end)
|
|
432
474
|
|
|
433
475
|
end = self.textbuffer.get_end_iter()
|
|
434
|
-
|
|
476
|
+
if write_date:
|
|
477
|
+
msg = "[{}] {}".format(time.strftime("%d/%m/%y %T"), text)
|
|
478
|
+
else:
|
|
479
|
+
msg = text
|
|
480
|
+
|
|
435
481
|
self.textbuffer.insert(end, msg)
|
|
436
482
|
GLib.idle_add(self.scroll_to_end)
|
|
483
|
+
|
|
484
|
+
def write(self, txt):
|
|
485
|
+
"""A write method."""
|
|
486
|
+
self.write_message(txt, write_date=False)
|
|
437
487
|
|
|
438
488
|
|
|
439
489
|
class ITkDBWindow(Gtk.Window):
|
|
440
490
|
"""Base class for GUI main windows."""
|
|
441
491
|
|
|
442
|
-
def __init__(self, title="", session=None, show_search=None, gtk_runs=True, panel_size=100):
|
|
492
|
+
def __init__(self, title="", session=None, show_search=None, help=None, gtk_runs=True, panel_size=100):
|
|
443
493
|
"""Initialization.
|
|
444
494
|
|
|
445
495
|
Args:
|
|
@@ -455,6 +505,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
455
505
|
self.inst2code = {}
|
|
456
506
|
self.code2inst = {}
|
|
457
507
|
self.message_panel = None
|
|
508
|
+
self.help = help
|
|
458
509
|
|
|
459
510
|
if gtk_runs:
|
|
460
511
|
super().__init__(title=title)
|
|
@@ -482,6 +533,15 @@ class ITkDBWindow(Gtk.Window):
|
|
|
482
533
|
button.set_tooltip_text(show_search)
|
|
483
534
|
button.connect("clicked", self.query_db)
|
|
484
535
|
self.hb.pack_end(button)
|
|
536
|
+
|
|
537
|
+
if self.help:
|
|
538
|
+
button = Gtk.Button()
|
|
539
|
+
icon = Gio.ThemedIcon(name="help-browser-symbolic")
|
|
540
|
+
image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
|
|
541
|
+
button.add(image)
|
|
542
|
+
button.connect("clicked", self.show_help)
|
|
543
|
+
self.hb.pack_end(button)
|
|
544
|
+
|
|
485
545
|
|
|
486
546
|
# Create main content box
|
|
487
547
|
self.mainBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
@@ -507,6 +567,10 @@ class ITkDBWindow(Gtk.Window):
|
|
|
507
567
|
self.hide()
|
|
508
568
|
self.destroy()
|
|
509
569
|
|
|
570
|
+
def show_help(self, *args):
|
|
571
|
+
"""Show help"""
|
|
572
|
+
webbrowser.open(self.help)
|
|
573
|
+
|
|
510
574
|
def query_db(self, *args):
|
|
511
575
|
"""Search button clicked."""
|
|
512
576
|
pass
|
|
@@ -516,7 +580,9 @@ class ITkDBWindow(Gtk.Window):
|
|
|
516
580
|
if msg == "<OK>":
|
|
517
581
|
if hasattr(self.session, "user_gui"):
|
|
518
582
|
self.session = self.session.user_gui.get_client()
|
|
519
|
-
|
|
583
|
+
|
|
584
|
+
if self.userLabel.get_child():
|
|
585
|
+
self.userLabel.get_child().set_text(self.session.user.name)
|
|
520
586
|
|
|
521
587
|
else:
|
|
522
588
|
self.write_message("Could not login.\n{}".format(msg))
|
|
@@ -746,6 +812,28 @@ class DictDialog(Gtk.Grid):
|
|
|
746
812
|
self.show_values()
|
|
747
813
|
self.show_all()
|
|
748
814
|
self.queue_draw()
|
|
815
|
+
|
|
816
|
+
@staticmethod
|
|
817
|
+
def create_json_data_editor(data):
|
|
818
|
+
"""Create a dialog to show the JSon file."""
|
|
819
|
+
dlg = Gtk.Dialog(title="Test Data")
|
|
820
|
+
dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
|
821
|
+
Gtk.STOCK_OK, Gtk.ResponseType.OK)
|
|
822
|
+
|
|
823
|
+
dlg.set_property("height-request", 500)
|
|
824
|
+
box = dlg.get_content_area()
|
|
825
|
+
value = DictDialog(data)
|
|
826
|
+
scrolled = Gtk.ScrolledWindow()
|
|
827
|
+
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
|
828
|
+
scrolled.add(value)
|
|
829
|
+
box.pack_start(scrolled, True, True, 10)
|
|
830
|
+
|
|
831
|
+
dlg.show_all()
|
|
832
|
+
rc = dlg.run()
|
|
833
|
+
dlg.hide()
|
|
834
|
+
dlg.destroy()
|
|
835
|
+
|
|
836
|
+
return value.values, rc
|
|
749
837
|
|
|
750
838
|
|
|
751
839
|
def create_scrolled_dictdialog(the_dict, hidden=("component", "testType")):
|