-
Notifications
You must be signed in to change notification settings - Fork 1
/
ggeiger.py
6911 lines (5317 loc) · 313 KB
/
ggeiger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
class ggeiger - A part of GeigerLog - cannot be used on its own
"""
###############################################################################
# This file is part of GeigerLog.
#
# GeigerLog is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GeigerLog is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GeigerLog. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
__author__ = "ullix"
__copyright__ = "Copyright 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024"
__credits__ = [""]
__license__ = "GPL3"
from gsup_utils import *
import gsup_sql
import gsup_tools
import gsup_plot
# if g.TelegramActivation: import gsup_telegram
import gweb_monserv
import gweb_radworld
import gstat_poisson
import gstat_fft
import gstat_convfft
import gstat_synth
if g.Devices["GMC"] [g.ACTIV]: import gdev_gmc # both needed
if g.Devices["GMC"] [g.ACTIV]: import gdev_gmc_hist # both needed
if g.Devices["Audio"] [g.ACTIV]: import gdev_audio #
if g.Devices["IoT"] [g.ACTIV]: import gdev_iot # IoT Device
if g.Devices["RadMon"] [g.ACTIV]: import gdev_radmon # RadMon
if g.Devices["AmbioMon"] [g.ACTIV]: import gdev_ambiomon #
if g.Devices["GammaScout"] [g.ACTIV]: import gdev_gammascout #
if g.Devices["I2C"] [g.ACTIV]: import gdev_i2c # I2C - then imports dongles and sensor modules
if g.Devices["LabJack"] [g.ACTIV]: import gdev_labjack # LabJack - then imports the LabJack modules
if g.Devices["Formula"] [g.ACTIV]: import gdev_formula #
if g.Devices["MiniMon"] [g.ACTIV]: import gdev_minimon #
if g.Devices["WiFiClient"] [g.ACTIV]: import gdev_wificlient #
if g.Devices["WiFiServer"] [g.ACTIV]: import gdev_wifiserver #
if g.Devices["RaspiI2C"] [g.ACTIV]: import gdev_raspii2c #
if g.Devices["RaspiPulse"] [g.ACTIV]: import gdev_raspipulse #
if g.Devices["SerialPulse"][g.ACTIV]: import gdev_serialpulse # to support pulse counting via USB-to-Serial adapter
if g.Devices["Manu"] [g.ACTIV]: import gdev_manu #
if g.Devices["RadPro"] [g.ACTIV]: import gdev_radpro #
# Modality
# Qt: A modal dialog is a dialog that blocks input to other visible windows in the same application.
#
# Modale Dialoge sperren den Rest der Anwendung (oder sogar der Benutzeroberfläche), solange der Dialog angezeigt wird.
# Nichtmodale Dialoge erlauben auch Eingaben in der Applikation außerhalb des Dialogs.
#
# vergleiche Menu Show IP und MonServer: gleiche Programmierung, anderes Verhalten???
#
# d.setWindowModality(Qt.WindowModal)
# d.setWindowModality(Qt.ApplicationModal) # The window is modal to the application and blocks input to all windows.
# d.setWindowModality(Qt.NonModal) # The window is not modal and does not block input to other windows.
class ggeiger(QMainWindow):
def __init__(self):
"""init the ggeiger class"""
defname = "ggeiger__init__: "
super().__init__()
g.exgg = self
# hold the updated variable values
self.vlabels = None
self.svlabels = None
# from email: John Thornton <[email protected]> to: [email protected] from: 13.12.2023, 22:54
sys.excepthook = self.excepthook
#
# getting font(s)
#
#
# default font type
# custom_font = QFont()
# custom_font.setWeight(18);
# QApplication.setFont(custom_font, "QLabel")
# set the font for the top level window (and any of its children):
# self.window().setFont(someFont)
# # set the font for *any* widget created in this QApplication:
# QApplication.instance().setFont(QFont("Deja Vue"))
# QApplication.instance().setFont(QFont("Helvetica"))
#
# edprint(QFont.family())
# edprint(QApplication.instance().font())
# edprint(QApplication.font())
self.window().setFont(QFont("Sans Serif"))
#
# platform dependent!
# cdprint("Platform: ", platform.platform())
# Raspi: Bullseye Platform: Linux-5.15.32-v8+-aarch64-with-glibc2.31
# Intel: Ubuntu 16.04: Platform: Linux-4.15.0-142-generic-x86_64-with-glibc2.23
if "WINDOWS" in platform.platform().upper():
dprint("WINDOWS: Setting QFontDatabase.FixedFont")
self.fontstd = QFontDatabase.systemFont(QFontDatabase.FixedFont) # worked! got Courier New
#self.fontstd = QFont("Consolas", 10) # alternative
elif "LINUX" in platform.platform().upper():
dprint("LINUX: Setting QFontDatabase.FixedFont")
self.fontstd = QFont("Mono", 9)
else:
dprint("Other System: Setting QFontDatabase.FixedFont")
self.fontstd = QFontDatabase.systemFont(QFontDatabase.FixedFont) # result ?
#self.fontstd = QFont("Courier New") # alternative
#
# # font standard
# #self.fontstd = QFont()
# #self.fontstd = QFont("Deja Vue", 10)
# #self.fontstd = QFont("pritzelbmpr", 10)
# #self.fontstd = QFont("Courier New", 10)
# #self.fontstd.setFamily('Monospace') # options: 'Lucida'
# #self.fontstd.StyleHint(QFont.TypeWriter) # options: QFont.Monospace, QFont.Courier
# #self.fontstd.StyleHint(QFont.Monospace) # options: QFont.Monospace, QFont.Courier
# #self.fontstd.setStyleStrategy(QFont.PreferMatch)
# #self.fontstd.setFixedPitch(True)
# #self.fontstd.setPointSize(11) # 11 is too big
# #self.fontstd.setWeight(60) # options: 0 (thin) ... 99 (very thick); 60:ok, 65:too fat
# g.fontstd = self.fontstd
#
# self.fontstd = QFontDatabase.systemFont(QFontDatabase.FixedFont) # did NOT work on Raspi!
self.fontstd.setFixedPitch(True)
self.fontstd.setWeight(45) # "Qt uses a weighting scale from 0 to 99"
# options: 0 (thin) ... 99 (very thick); 60:ok, 65:fat NOTE: >60 wirkt matschig
g.fontstd = self.fontstd
# fatfont used for HEADINGS: Data, Device, Graph
self.fatfont = QFont("Deja Vue")
self.fatfont.setWeight(65)
self.fatfont.setPointSize(11)
# window
# ?
# icon
iconpath = os.path.join(g.resDir, 'icon_geigerlog.png')
self.iconGeigerLog = QIcon(QPixmap(iconpath))
# rdprint("availableSizes:", self.iconGeigerLog.availableSizes())
g.iconGeigerLog = self.iconGeigerLog
self.setWindowIcon(g.iconGeigerLog)
# this is used for Web sites
try:
with open(iconpath, "rb") as file_handle:
g.iconGeigerLogWeb = file_handle.read()
except Exception as e:
exceptPrint(e, defname + "reading binary from iconpath")
#title
wtitle = "GeigerLog v{}".format(g.__version__)
if g.devel: wtitle += " Python: {} sys.argv: {} venv: {}".format(sys.version[:6], sys.argv, g.VenvName)
self.setWindowTitle(wtitle)
#figure and its toolbar
# weder figsize=(18, 18) noch figsize=(18, 18) in plt.figure() hat Auswirkungen auf die Plot Größe
self.figure = plt.figure(facecolor = "#DFDEDD", edgecolor='#b8b8b8', linewidth = 0.1, dpi=g.hidpiScaleMPL) # facecolor in lighter gray
plt.clf() # clear figure or it will show an empty figure !!
# canvas - this is the Canvas Widget that displays the `figure`
self.canvas = FigureCanvas(self.figure)
self.canvas.mpl_connect('motion_notify_event', self.updatecursorposition) # where the cursor is
self.canvas.mpl_connect('button_press_event' , self.onclick) # send a mouse click
self.canvas.setContentsMargins(10,10,10,10)
# self.canvas.setMinimumHeight(450)
self.canvas.setMinimumHeight(408)
# rdprint(defname, "self.canvas.__sizeof__: ", self.canvas.__sizeof__()) # --> ggeiger__init__: self.canvas.__sizeof__: 120 ???
# rdprint(defname, "self.canvas.size(): ", self.canvas.size()) # --> ggeiger__init__: self.canvas.size(): PyQt5.QtCore.QSize(640, 480)
# this is the figure Navigation widget; it takes the Canvas widget and a parent
self.navtoolbar = NavigationToolbar(self.canvas, self)
self.navtoolbar.setToolTip("Graph Toolbar - available only when NOT logging")
self.navtoolbar.setIconSize(QSize(32,32))
self.navtoolbar.setEnabled(True)
# self.navtoolbar.setStyleSheet("background-color:lightgreen;")
#print("self.navtoolbar.iconSize()", self.navtoolbar.iconSize())
# menubar, statusbar, and toolbar
self.menubar = self.menuBar()
self.menubar.setFocus()
self.menubar.setFont(QFont("Deja Vu Sans", 11))
self.statusBar = QStatusBar()
self.setStatusBar(self.statusBar)
toolbar = self.addToolBar('File')
toolbar.setToolTip("File Toolbar")
toolbar.setOrientation(Qt.Horizontal) # is default; alt: Qt.Vertical
toolbar.setIconSize(QSize(32,32)) # standard size is too small
#print("toolbar.iconSize()", toolbar.iconSize())
#file menu
#clearNotePad
clearNPAction = QAction("Clear NotePad", self)
addMenuTip(clearNPAction, "Delete all content of the NotePad")
clearNPAction.triggered.connect(self.clearNotePad)
#searchNotePad
SearchNPAction = QAction("Search NotePad ...", self)
SearchNPAction.setShortcut('Ctrl+F')
addMenuTip(SearchNPAction, "Search NotePad for occurence of a text (Shortcut: CTRL-F)")
SearchNPAction.triggered.connect(self.searchNotePad)
#saveNotePad
SaveNPAction = QAction("Save NotePad to File", self)
addMenuTip(SaveNPAction, "Save Content of NotePad as text file named <current filename>.txt")
SaveNPAction.triggered.connect(self.saveNotePad)
#printNotePad
PrintNPAction = QAction("Print NotePad ...", self)
addMenuTip(PrintNPAction, "Print Content of NotePad to Printer or PDF-File")
PrintNPAction.triggered.connect(self.printNotePad)
# exit
exitAction = QAction('Exit', self)
exitAction.setIcon(QIcon(QPixmap(os.path.join(g.resDir, 'icon_exit.png')))) # Flat icon
exitAction.setShortcut('Ctrl+Q')
addMenuTip(exitAction, 'Exit the GeigerLog program')
exitAction.triggered.connect(self.close)
fileMenu = self.menubar.addMenu('&File')
fileMenu.setToolTipsVisible(True)
fileMenu.addAction(clearNPAction)
fileMenu.addAction(SearchNPAction)
fileMenu.addAction(SaveNPAction)
fileMenu.addAction(PrintNPAction)
fileMenu.addSeparator()
fileMenu.addAction(exitAction)
#fileMenu.triggered[QAction].connect(self.processtrigger)
toolbar.addAction(exitAction)
# Device menu
self.toggleDeviceConnectionAction = QAction(QIcon(QPixmap(os.path.join(g.resDir, 'icon_plug_open.png'))), 'Connect / Disconnect Devices', self)
addMenuTip(self.toggleDeviceConnectionAction, 'Toggle connection of GeigerLog with the devices')
self.toggleDeviceConnectionAction.triggered.connect(self.toggleDeviceConnection)
self.DeviceConnectAction = QAction(QIcon(QPixmap(os.path.join(g.resDir, 'icon_plug_open.png'))), 'Connect Devices', self)
self.DeviceConnectAction.setShortcut('Ctrl+C')
addMenuTip(self.DeviceConnectAction, 'Connect the computer to the devices')
self.DeviceConnectAction.triggered.connect(lambda : self.switchAllDeviceConnections("ON"))
self.DeviceDisconnectAction = QAction(QIcon(QPixmap(os.path.join(g.resDir, 'icon_plug_closed.png'))), 'Disconnect Devices', self, enabled = False)
self.DeviceDisconnectAction.setShortcut('Ctrl+D')
addMenuTip(self.DeviceDisconnectAction, 'Disconnect the computer from the devices')
self.DeviceDisconnectAction.triggered.connect(lambda : self.switchAllDeviceConnections("OFF"))
self.DeviceMappingAction = QAction('Show Device Mappings', self, enabled = True)
addMenuTip(self.DeviceMappingAction, 'Show the mapping of variables of the activated devices')
self.DeviceMappingAction.triggered.connect(self.showDeviceMappings)
self.DevicePortSettingAction = QAction('Show Device Port Settings', self, enabled = True)
addMenuTip(self.DevicePortSettingAction, 'Show the port settings for all activated devices')
self.DevicePortSettingAction.triggered.connect(lambda : showPortSettings())
self.DeviceCalibAction = QAction("Geiger Tubes ...", self, enabled = True)
addMenuTip(self.DeviceCalibAction, "Set sensitivities for all Geiger tubes temporarily")
self.DeviceCalibAction.triggered.connect(self.setTemporaryTubeSensitivities)
# build the Device menu
deviceMenu = self.menubar.addMenu('&Device')
deviceMenu.setToolTipsVisible(True)
# all devices
deviceMenu.addAction(self.DeviceConnectAction)
deviceMenu.addAction(self.DeviceDisconnectAction)
deviceMenu.addSeparator()
deviceMenu.addAction(self.DeviceMappingAction)
deviceMenu.addAction(self.DevicePortSettingAction)
deviceMenu.addAction(self.DeviceCalibAction)
deviceMenu.addSeparator()
# now following all device specific submenus
# submenu GMC
if g.Devices["GMC"][g.ACTIV] :
self.GMCInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.GMCInfoAction, 'Show basic info on GMC device')
self.GMCInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("GMC"))
self.GMCInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.GMCInfoActionExt, 'Show extended info on GMC device')
self.GMCInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("GMC", extended = True))
self.GMCConfigEditAction = QAction("Set GMC Configuration ...", self, enabled=False)
addMenuTip(self.GMCConfigEditAction, 'View, Edit and Set the GMC device configuration')
self.GMCConfigEditAction.triggered.connect(lambda: gdev_gmc.editGMC_Configuration())
self.GMCConfigMemoryAction = QAction('Show Configuration Memory', self, enabled=False)
addMenuTip(self.GMCConfigMemoryAction, 'Show the GMC device configuration memory as binary in human readable format')
self.GMCConfigMemoryAction.triggered.connect(gdev_gmc.fprintGMC_ConfigMemory)
self.GMCONAction = QAction('Switch Power ON', self, enabled=False)
addMenuTip(self.GMCONAction, 'Switch the GMC device power to ON')
self.GMCONAction.triggered.connect(lambda: self.switchGMCPower("ON"))
self.GMCOFFAction = QAction('Switch Power OFF', self, enabled=False)
addMenuTip(self.GMCOFFAction, 'Switch the GMC device power to OFF')
self.GMCOFFAction.triggered.connect(lambda: self.switchGMCPower("OFF"))
self.GMCSetTimeAction = QAction('Set GMC DateTime to GeigerLog DateTime', self, enabled=False)
addMenuTip(self.GMCSetTimeAction, "Set the Date and Time of the GMC device to GeigerLog's Date and Time")
self.GMCSetTimeAction.triggered.connect(gdev_gmc.GMC_setDateTime)
self.GMCEraseSavedDataAction = QAction('Erase Saved Data ...', self, enabled=False)
addMenuTip(self.GMCEraseSavedDataAction, 'Erase all data from the History memory of the GMC device')
self.GMCEraseSavedDataAction.triggered.connect(lambda: gdev_gmc.doEraseSavedData())
self.GMCREBOOTAction = QAction('Reboot ...', self, enabled=False)
addMenuTip(self.GMCREBOOTAction, 'Reboot the GMC device')
self.GMCREBOOTAction.triggered.connect(lambda: gdev_gmc.doREBOOT(False))
self.GMCFACTORYRESETAction = QAction('FACTORYRESET ...', self, enabled=False)
addMenuTip(self.GMCFACTORYRESETAction, 'Reset the GMC device to factory configuration')
self.GMCFACTORYRESETAction.triggered.connect(lambda: gdev_gmc.doFACTORYRESET(False))
self.GMCSerialAction = QAction('Set Serial Port ...', self, enabled=True)
addMenuTip(self.GMCSerialAction, 'Manually set the serial port of the GMC device')
self.GMCSerialAction.triggered.connect(lambda: setDeviceSerialPort("GMC", g.GMC_usbport))
self.GMCREBOOT_forceAction = QAction('DVL Force Reboot', self, enabled=True)
addMenuTip(self.GMCREBOOT_forceAction, 'Force a Reboot of the GMC device')
self.GMCREBOOT_forceAction.triggered.connect(lambda: gdev_gmc.doREBOOT(True))
self.GMCFACTORYRESET_forceAction = QAction('DVL Force FACTORYRESET', self, enabled=True)
addMenuTip(self.GMCFACTORYRESET_forceAction, 'Force a Reset of the GMC device to factory configuration')
self.GMCFACTORYRESET_forceAction.triggered.connect(lambda: gdev_gmc.doFACTORYRESET(True))
deviceSubMenuGMC = deviceMenu.addMenu("GMC Series")
deviceSubMenuGMC.setToolTipsVisible(True)
deviceSubMenuGMC.addAction(self.GMCInfoAction)
deviceSubMenuGMC.addAction(self.GMCInfoActionExt)
deviceSubMenuGMC.addAction(self.GMCConfigEditAction)
deviceSubMenuGMC.addAction(self.GMCConfigMemoryAction)
deviceSubMenuGMC.addAction(self.GMCSetTimeAction)
deviceSubMenuGMC.addAction(self.GMCEraseSavedDataAction)
deviceSubMenuGMC.addAction(self.GMCONAction)
deviceSubMenuGMC.addAction(self.GMCOFFAction)
deviceSubMenuGMC.addAction(self.GMCREBOOTAction)
deviceSubMenuGMC.addAction(self.GMCFACTORYRESETAction)
deviceSubMenuGMC.addAction(self.GMCSerialAction)
if g.devel: # on devel allow Factory Reset without checking
deviceSubMenuGMC.addAction(self.GMCREBOOT_forceAction)
deviceSubMenuGMC.addAction(self.GMCFACTORYRESET_forceAction)
# if 0 and g.devel:
# # do not use
# deviceSubMenuGMC.addAction(self.GMCONAction)
# deviceSubMenuGMC.addAction(self.GMCOFFAction)
# deviceSubMenuGMC.addAction(self.GMCAlarmONAction)
# deviceSubMenuGMC.addAction(self.GMCAlarmOFFAction)
# deviceSubMenuGMC.addAction(self.GMCSpeakerONAction)
# deviceSubMenuGMC.addAction(self.GMCSpeakerOFFAction)
# deviceSubMenuGMC.addAction(self.GMCSavingStateAction)
#deviceMenu.triggered[QAction].connect(self.processtrigger)
# submenu AudioCounter
if g.Devices["Audio"][g.ACTIV] :
self.AudioInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.AudioInfoAction, 'Show basic info on AudioCounter device')
self.AudioInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("Audio"))
self.AudioInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.AudioInfoActionExt, 'Show extended info on AudioCounter device')
self.AudioInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("Audio", extended = True))
self.AudioPlotAction = QAction("Plot Pulse", self, enabled=False)
addMenuTip(self.AudioPlotAction, 'Plot the audio pulse recordings of the AudioCounter Device')
self.AudioPlotAction.triggered.connect(lambda: gdev_audio.reloadAudioData("Recording"))
self.AudioSignalAction = QAction("Show Live Audio Signal", self, enabled=False)
addMenuTip(self.AudioSignalAction, 'Show the live, raw audio signal as received by the audio input')
self.AudioSignalAction.triggered.connect(lambda: gdev_audio.showLiveAudioSignal())
self.AudioEiaAction = QAction("Eia", self, enabled=False)
self.AudioEiaAction.triggered.connect(lambda: gdev_audio.showAudioEia())
deviceSubMenuAudio = deviceMenu.addMenu("AudioCounter Series")
deviceSubMenuAudio.setToolTipsVisible(True)
deviceSubMenuAudio.addAction(self.AudioInfoAction)
deviceSubMenuAudio.addAction(self.AudioInfoActionExt)
deviceSubMenuAudio.addAction(self.AudioPlotAction)
if g.devel:
deviceSubMenuAudio.addAction(self.AudioSignalAction)
if g.AudioOei:
deviceSubMenuAudio.addAction(self.AudioEiaAction)
# submenu SerialPulseCounter
if g.Devices["SerialPulse"][g.ACTIV] :
self.PulseInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.PulseInfoAction, 'Show basic info on SerialPulse device')
self.PulseInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("SerialPulse"))
# self.PulseInfoActionExt = QAction('Show Extended Info', self, enabled=False)
# addMenuTip(self.PulseInfoActionExt, 'Show extended info on PulseCounter device')
# self.PulseInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("SerialPulse", extended = True))
self.PulseSerialAction = QAction('Set Serial Port ...', self, enabled=True)
addMenuTip(self.PulseSerialAction, 'Manually set the serial port of the SerialPulse device')
self.PulseSerialAction.triggered.connect(lambda: setDeviceSerialPort("SerialPulse", g.SerialPulseUsbport))
deviceSubMenuPulse = deviceMenu.addMenu("SerialPulseCounter Series")
deviceSubMenuPulse.setToolTipsVisible(True)
deviceSubMenuPulse.addAction(self.PulseInfoAction)
deviceSubMenuPulse.addAction(self.PulseSerialAction)
# deviceSubMenuPulse.addAction(self.PulseInfoActionExt)
# submenu IoT
if g.Devices["IoT"][g.ACTIV] :
self.IoTInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.IoTInfoAction, 'Show basic info on IoT device')
self.IoTInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("IoT"))
self.IoTInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.IoTInfoActionExt, 'Show extended info on IoT device')
self.IoTInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("IoT", extended = True))
deviceSubMenuIoT = deviceMenu.addMenu("IoT Series")
deviceSubMenuIoT.setToolTipsVisible(True)
deviceSubMenuIoT.addAction(self.IoTInfoAction)
deviceSubMenuIoT.addAction(self.IoTInfoActionExt)
# submenu RadMon
if g.Devices["RadMon"][g.ACTIV] :
self.RMInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.RMInfoAction, 'Show basic info on RadMon device')
self.RMInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("RadMon"))
self.RMInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.RMInfoActionExt, 'Show extended info on RadMon device')
self.RMInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("RadMon", extended = True))
deviceSubMenuRM = deviceMenu.addMenu("RadMon Series")
deviceSubMenuRM.setToolTipsVisible(True)
deviceSubMenuRM.addAction(self.RMInfoAction)
deviceSubMenuRM.addAction(self.RMInfoActionExt)
# submenu AmbioMon
if g.Devices["AmbioMon"][g.ACTIV] :
self.AmbioInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.AmbioInfoAction, 'Show basic info on AmbioMon device')
self.AmbioInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("AmbioMon"))
self.AmbioInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.AmbioInfoActionExt, 'Show extended info on AmbioMon device')
self.AmbioInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("AmbioMon", extended = True))
self.AmbioSetServerIP = QAction('Set AmbioMon Device IP ...', self, enabled=True)
addMenuTip(self.AmbioSetServerIP, 'Set the IP Adress or Domain Name of the AmbioMon device')
self.AmbioSetServerIP.triggered.connect(gdev_ambiomon.setAmbioServerIP)
self.AmbioDataModeAction = QAction('Select AmbioMon Data Type Mode ...', self, enabled=False)
addMenuTip(self.AmbioDataModeAction, "Select what type of data the AmbioMon device sends during logging: 'LAST' for last available data value, or 'AVG' for last 1 minute average of values")
self.AmbioDataModeAction.triggered.connect(gdev_ambiomon.setAmbioLogDatatype)
AmbioPingAction = QAction("Ping AmbioMon Server", self)
addMenuTip(AmbioPingAction, 'Ping AmbioMon Server and report success or failure')
AmbioPingAction.triggered.connect(lambda: gdev_ambiomon.pingAmbioServer())
AmbioSerialAction = QAction("Send Message to AmbioMon via Serial", self)
addMenuTip(AmbioSerialAction, "Send Message to AmbioMon via a USB-To-Serial Connection ")
AmbioSerialAction.triggered.connect(lambda: gdev_ambiomon.sendToSerial())
deviceSubMenuAmbio = deviceMenu.addMenu("Ambiomon Series")
deviceSubMenuAmbio.setToolTipsVisible(True)
deviceSubMenuAmbio.addAction(self.AmbioInfoAction)
deviceSubMenuAmbio.addAction(self.AmbioInfoActionExt)
deviceSubMenuAmbio.addAction(self.AmbioSetServerIP)
deviceSubMenuAmbio.addAction(self.AmbioDataModeAction)
deviceSubMenuAmbio.addAction(AmbioPingAction)
deviceSubMenuAmbio.addAction(AmbioSerialAction)
# submenu Gamma-Scout counter
if g.Devices["GammaScout"][g.ACTIV] :
self.GSInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.GSInfoAction, 'Show basic info on GS device')
self.GSInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("GammaScout"))
self.GSInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.GSInfoActionExt, 'Show extended info on GS device')
self.GSInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("GammaScout", extended = True))
self.GSResetAction = QAction('Set to Normal Mode', self, enabled=False)
addMenuTip(self.GSResetAction, 'Set the Gamma-Scout counter to its Normal Mode')
self.GSResetAction.triggered.connect(lambda: gdev_gammascout.GSsetMode("Normal"))
self.GSSetPCModeAction = QAction('Set to PC Mode', self, enabled=False)
addMenuTip(self.GSSetPCModeAction, 'Set the Gamma-Scout counter to its PC Mode')
self.GSSetPCModeAction.triggered.connect(lambda: gdev_gammascout.GSsetMode("PC"))
self.GSDateTimeAction = QAction("Set Gamma-Scout DateTime to GeigerLog's DateTime", self, enabled=False)
addMenuTip(self.GSDateTimeAction, "Set the Gamma-Scout counter clock to the GeigerLog Date and Time")
self.GSDateTimeAction.triggered.connect(lambda: gdev_gammascout.setGSDateTime())
self.GSSetOnlineAction = QAction('Set to Online Mode ...', self, enabled=False)
addMenuTip(self.GSSetOnlineAction, "Set the Gamma-Scout counter to its Online Mode\nAvailable only for 'Online' models")
self.GSSetOnlineAction.triggered.connect(lambda: gdev_gammascout.GSsetMode("Online"))
self.GSRebootAction = QAction('Reboot', self, enabled=False)
addMenuTip(self.GSRebootAction, "Do a Gamma-Scout reboot as warm-start\nAvailable only for 'Online' models")
self.GSRebootAction.triggered.connect(lambda: gdev_gammascout.GSreboot())
self.GSSerialAction = QAction('Set Serial Port ...', self, enabled=True)
addMenuTip(self.GSSerialAction, 'Manually set the serial port of the I2C device')
# self.GSSerialAction.triggered.connect(lambda: gdev_gammascout.setGS_SerialPort())
self.GSSerialAction.triggered.connect(lambda: setDeviceSerialPort("GammaScout", g.GSusbport))
deviceSubMenuGS = deviceMenu.addMenu("Gamma-Scout Series")
deviceSubMenuGS.setToolTipsVisible(True)
deviceSubMenuGS.addAction(self.GSInfoAction)
deviceSubMenuGS.addAction(self.GSInfoActionExt)
deviceSubMenuGS.addAction(self.GSDateTimeAction)
deviceSubMenuGS.addAction(self.GSResetAction)
deviceSubMenuGS.addAction(self.GSSetPCModeAction)
deviceSubMenuGS.addAction(self.GSSetOnlineAction)
deviceSubMenuGS.addAction(self.GSRebootAction)
deviceSubMenuGS.addAction(self.GSSerialAction)
# submenu I2C
if g.Devices["I2C"][g.ACTIV] :
self.I2CInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.I2CInfoAction, 'Show basic info on I2C device')
self.I2CInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("I2C"))
self.I2CInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.I2CInfoActionExt, 'Show extended info on I2C device')
self.I2CInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("I2C", extended = True))
self.I2CForceCalibAction = QAction('Calibrate CO2 Sensor', self, enabled=False)
addMenuTip(self.I2CForceCalibAction, 'Force a CO2 calibration of the SCD41 sensor')
self.I2CForceCalibAction.triggered.connect(lambda: gdev_i2c.forceCalibration())
self.I2CScanAction = QAction('Scan I2C Bus', self, enabled=False)
addMenuTip(self.I2CScanAction, 'Scan I2C bus for any sensors and report to NotePad (only when not-logging)')
self.I2CScanAction.triggered.connect(lambda: gdev_i2c.scanI2CBus())
self.I2CResetAction = QAction('Reset System', self, enabled=False)
addMenuTip(self.I2CResetAction, 'Reset the I2C ELV dongle and attached sensors (only when not-logging)')
self.I2CResetAction.triggered.connect(lambda: gdev_i2c.resetI2C())
self.I2CSerialAction = QAction('Set Serial Port ...', self, enabled=True)
addMenuTip(self.I2CSerialAction, 'Manually set the serial port of the I2C device')
self.I2CSerialAction.triggered.connect(lambda: setDeviceSerialPort("I2C", g.I2Cusbport))
deviceSubMenuI2C = deviceMenu.addMenu("I2C Series")
deviceSubMenuI2C.setToolTipsVisible(True)
deviceSubMenuI2C.addAction(self.I2CInfoAction)
deviceSubMenuI2C.addAction(self.I2CInfoActionExt)
deviceSubMenuI2C.addAction(self.I2CForceCalibAction)
deviceSubMenuI2C.addAction(self.I2CScanAction)
deviceSubMenuI2C.addAction(self.I2CResetAction)
deviceSubMenuI2C.addAction(self.I2CSerialAction)
# submenu LabJack
if g.Devices["LabJack"][g.ACTIV] :
self.LJInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.LJInfoAction, 'Show basic info on LabJack device')
self.LJInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("LabJack"))
self.LJInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.LJInfoActionExt, 'Show extended info on LabJack device')
self.LJInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("LabJack", extended = True))
deviceSubMenuLJ = deviceMenu.addMenu("LabJack Series")
deviceSubMenuLJ.setToolTipsVisible(True)
deviceSubMenuLJ.addAction(self.LJInfoAction)
deviceSubMenuLJ.addAction(self.LJInfoActionExt)
# submenu MiniMon
if g.Devices["MiniMon"][g.ACTIV] :
self.MiniMonInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.MiniMonInfoAction, 'Show basic info on MiniMon device')
self.MiniMonInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("MiniMon"))
deviceSubMenuMiniMon = deviceMenu.addMenu("MiniMon Series")
deviceSubMenuMiniMon.setToolTipsVisible(True)
deviceSubMenuMiniMon.addAction(self.MiniMonInfoAction)
# submenu Formula
if g.Devices["Formula"][g.ACTIV] :
self.FormulaInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.FormulaInfoAction, 'Show basic info on Formula device')
self.FormulaInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("Formula"))
deviceSubMenuFormula = deviceMenu.addMenu("Formula Device Series")
deviceSubMenuFormula.setToolTipsVisible(True)
deviceSubMenuFormula.addAction(self.FormulaInfoAction)
# submenu Manu
if g.Devices["Manu"][g.ACTIV] :
self.ManuInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.ManuInfoAction, 'Show basic info on Manu device')
self.ManuInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("Manu"))
# self.ManuInfoActionExt = QAction('Show Extended Info', self, enabled=False)
# addMenuTip(self.ManuInfoActionExt, 'Show extended info on Manu device')
# self.ManuInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("Manu", extended = True))
# self.ManuValAction = QAction('Enter Values Manually', self, enabled=False)
self.ManuValAction = QAction('Enter Values Manually', self, enabled=True)
addMenuTip(self.ManuValAction, "Enter Values Manually")
self.ManuValAction.triggered.connect(gdev_manu.setManuValue)
deviceSubMenuManu = deviceMenu.addMenu("Manu Series")
deviceSubMenuManu.setToolTipsVisible(True)
deviceSubMenuManu.addAction(self.ManuInfoAction)
#deviceSubMenuManu.addAction(self.ManuInfoActionExt)
deviceSubMenuManu.addAction(self.ManuValAction)
# submenu WiFiServer
if g.Devices["WiFiServer"][g.ACTIV] :
self.WiFiInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.WiFiInfoAction, 'Show basic info on WiFiServer device')
self.WiFiInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("WiFiServer"))
# self.WiFiInfoActionExt = QAction('Show Extended Info', self, enabled=False)
# addMenuTip(self.WiFiInfoActionExt, 'Show extended info on WiFiServer device')
# self.WiFiInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("WiFiServer", extended = True))
self.WiFiPingAction = QAction("Ping WiFiServer Device", self)
addMenuTip(self.WiFiPingAction, 'Ping WiFiServer Device and report success or failure')
self.WiFiPingAction.triggered.connect(lambda: gdev_wifiserver.pingWiFiServer())
# self.WiFiSettingsAction = QAction('Set WiFiServer Data Type ...', self, enabled=True)
# addMenuTip(self.WiFiSettingsAction, "Set data type LAST or AVG")
# self.WiFiSettingsAction.triggered.connect(gdev_wifiserver.setWiFiServerProperties)
# self.WiFiResetServerAction = QAction("Reset WiFiServer", self)
# addMenuTip(self.WiFiResetServerAction, 'Reset the WiFiServer itself, but not the devices')
# self.WiFiResetServerAction.triggered.connect(lambda: gdev_wifiserver.resetWiFiServer())
self.WiFiResetDevicesAction = QAction("Reset WiFiServer Devices", self)
addMenuTip(self.WiFiResetDevicesAction, 'Reset all WiFiServer Devices, but not the WiFiServer itself')
self.WiFiResetDevicesAction.triggered.connect(lambda: gdev_wifiserver.resetWiFiServerDevices())
deviceSubMenuWiFi = deviceMenu.addMenu("WiFiServer Series")
deviceSubMenuWiFi.setToolTipsVisible(True)
deviceSubMenuWiFi.addAction(self.WiFiInfoAction)
# deviceSubMenuWiFi.addAction(self.WiFiInfoActionExt)
deviceSubMenuWiFi.addAction(self.WiFiPingAction)
# deviceSubMenuWiFi.addAction(self.WiFiSettingsAction)
# deviceSubMenuWiFi.addAction(self.WiFiResetServerAction)
deviceSubMenuWiFi.addAction(self.WiFiResetDevicesAction)
# submenu WiFiClient
if g.Devices["WiFiClient"][g.ACTIV] :
self.WiFiClientInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.WiFiClientInfoAction, 'Show basic info on WiFiClient device')
self.WiFiClientInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("WiFiClient"))
# self.WiFiClientInfoActionExt = QAction('Show Extended Info', self, enabled=False)
# addMenuTip(self.WiFiClientInfoActionExt, 'Show extended info on WiFiClient device')
# self.WiFiClientInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("WiFiClient", extended = True))
# self.WiFiClientSettingsAction = QAction('Set WiFiClient Properties ...', self, enabled=True)
# addMenuTip(self.WiFiClientSettingsAction, "Set properties like IP and data type")
# self.WiFiClientSettingsAction.triggered.connect(gdev_wificlient.setWiFiClientProperties)
deviceSubMenuWiFiClient = deviceMenu.addMenu("WiFiClient Series")
deviceSubMenuWiFiClient.setToolTipsVisible(True)
deviceSubMenuWiFiClient.addAction(self.WiFiClientInfoAction)
# deviceSubMenuWiFiClient.addAction(self.WiFiClientInfoActionExt) # presently no extended info
# deviceSubMenuWiFiClient.addAction(self.WiFiClientSettingsAction)
# submenu RaspiPulse
if g.Devices["RaspiPulse"][g.ACTIV] :
self.RaspiPulseInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.RaspiPulseInfoAction, 'Show basic info on RaspiPulse device')
self.RaspiPulseInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("RaspiPulse"))
self.RaspiPulseInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.RaspiPulseInfoActionExt, 'Show extended info on RaspiPulse device')
self.RaspiPulseInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("RaspiPulse", extended = True))
self.RaspiPulseResetAction = QAction("Reset RaspiPulse Device", self)
addMenuTip(self.RaspiPulseResetAction, 'Reset RaspiPulse Device')
self.RaspiPulseResetAction.triggered.connect(lambda: gdev_raspipulse.resetRaspiPulse("Reset"))
deviceSubMenuRaspiPulse = deviceMenu.addMenu("RaspiPulse Series")
deviceSubMenuRaspiPulse.setToolTipsVisible(True)
deviceSubMenuRaspiPulse.addAction(self.RaspiPulseInfoAction)
deviceSubMenuRaspiPulse.addAction(self.RaspiPulseInfoActionExt)
deviceSubMenuRaspiPulse.addAction(self.RaspiPulseResetAction)
# submenu RaspiI2C
if g.Devices["RaspiI2C"][g.ACTIV] :
self.RaspiI2CInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.RaspiI2CInfoAction, 'Show basic info on RaspiI2C device')
self.RaspiI2CInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("RaspiI2C"))
self.RaspiI2CInfoActionExt = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.RaspiI2CInfoActionExt, 'Show extended info on RaspiI2C device')
self.RaspiI2CInfoActionExt.triggered.connect(lambda: self.fprintDeviceInfo("RaspiI2C", extended = True))
# self.RaspiI2CResetAction = QAction("Reset RaspiI2C Device", self)
# addMenuTip(self.RaspiI2CResetAction, 'Reset RaspiI2C Device')
# self.RaspiI2CResetAction.triggered.connect(lambda: gdev_raspii2c.resetRaspiI2C())
self.RaspiI2CResetAction = QAction("Reset RaspiI2C Device", self, enabled=False)
addMenuTip(self.RaspiI2CResetAction, 'Reset RaspiI2C Device')
self.RaspiI2CResetAction.triggered.connect(lambda: gdev_raspii2c.resetRaspiI2C())
deviceSubMenuRaspiI2C = deviceMenu.addMenu("RaspiI2C Series")
deviceSubMenuRaspiI2C.setToolTipsVisible(True)
deviceSubMenuRaspiI2C.addAction(self.RaspiI2CInfoAction)
deviceSubMenuRaspiI2C.addAction(self.RaspiI2CInfoActionExt)
deviceSubMenuRaspiI2C.addAction(self.RaspiI2CResetAction)
# submenu RadPro
if g.Devices["RadPro"][g.ACTIV] :
self.RadProInfoAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.RadProInfoAction, 'Show basic info on RadPro device')
self.RadProInfoAction.triggered.connect(lambda: self.fprintDeviceInfo("RadPro"))
self.RadProInfoExtAction = QAction('Show Info', self, enabled=True)
addMenuTip(self.RadProInfoExtAction, 'Show basic info on RadPro device')
self.RadProInfoExtAction.triggered.connect(lambda: self.fprintDeviceInfo("RadPro", extended = False))
self.RadProInfoExtAction = QAction('Show Extended Info', self, enabled=False)
addMenuTip(self.RadProInfoExtAction, 'Show extended info on RaspiI2C device')
self.RadProInfoExtAction.triggered.connect(lambda: self.fprintDeviceInfo("RadPro", extended = True))
self.RadProSetTimeAction = QAction('Set RadPro DateTime to GeigerLog DateTime', self, enabled=False)
addMenuTip(self.RadProSetTimeAction, "Set the Date and Time of the RadPro device to GeigerLog's Date and Time")
self.RadProSetTimeAction.triggered.connect(lambda: gdev_radpro.setRadProDateTime())
self.RadProConfigAction = QAction('Set RadPro Config for Anode Voltage', self, enabled=False)
addMenuTip(self.RadProConfigAction, "Set the Frequency and Duty Cycle of the Anode-High-Voltage Generator")
self.RadProConfigAction.triggered.connect(lambda: gdev_radpro.editRadProConfig())
self.RadProSetSerialPortAction = QAction('Set Serial Port ...', self, enabled=True)
addMenuTip(self.RadProSetSerialPortAction, 'Manually set the serial port of the RadPro device')
self.RadProSetSerialPortAction.triggered.connect(lambda: setDeviceSerialPort("RadPro", g.RadProPort))
deviceSubMenuRadPro = deviceMenu.addMenu("RadPro Series")
deviceSubMenuRadPro.setToolTipsVisible(True)
deviceSubMenuRadPro.addAction(self.RadProInfoAction)
deviceSubMenuRadPro.addAction(self.RadProInfoExtAction)
deviceSubMenuRadPro.addAction(self.RadProSetTimeAction)
deviceSubMenuRadPro.addAction(self.RadProConfigAction)
deviceSubMenuRadPro.addAction(self.RadProSetSerialPortAction)
# widgets for device in toolbar
# devBtnSize = 65
devBtnSize = 70
# '#00C853', # Google color green
# '#ffe500', # Google color yellow
# '#EA4335', # Google color red
# !!! MUST NOT have a colon ':' after QPushButton !!!
self.dbtnStyleSheetOFF = "QPushButton {margin-right:5px; }"
self.dbtnStyleSheetError = "QPushButton {margin-right:5px; background-color: #EA4335; border-radius: 2px; border:1px solid silver; color: black; font-size:14px; font-weight:bold}"
self.dbtnStyleSheetSimul = "QPushButton {margin-right:5px; background-color: #ffe500; border-radius: 2px; border:1px solid silver; color: black; font-size:14px; font-weight:bold}"
self.dbtnStyleSheetON = "QPushButton {margin-right:5px; background-color: #00C853; border-radius: 2px; border:1px solid silver; color: black; font-size:14px; font-weight:bold}"
# Power button (for GMC only)
self.dbtnGMCPower = QPushButton()
self.dbtnGMCPower.setIcon(QIcon(QPixmap(os.path.join(g.resDir, 'icon_power-round_off.png'))))
self.dbtnGMCPower.setFixedSize(32, 33)
self.dbtnGMCPower.setEnabled(False)
self.dbtnGMCPower.setStyleSheet("QPushButton {margin-right:1px; border:0px; }")
self.dbtnGMCPower.setIconSize(QSize(31, 31))
self.dbtnGMCPower.setToolTip ('Toggle GMC Device Power ON / OFF')
self.dbtnGMCPower.setAutoFillBackground(True) # This is important!! Why???
self.dbtnGMCPower.clicked.connect(lambda: self.toggleGMCPower())
self.connectTextGMC = 'GMC'
self.dbtnGMC = QPushButton(self.connectTextGMC)
self.dbtnGMC.setFixedSize(devBtnSize, 32)
self.dbtnGMC.setToolTip("GMC Device - Click Button for Device Info")
self.dbtnGMC.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnGMC.setAutoFillBackground(True) # This is important!! Why???
self.dbtnGMC.clicked.connect(lambda: self.fprintDeviceInfo("GMC"))
self.connectTextAudio = 'Audio'
self.dbtnAudio = QPushButton(self.connectTextAudio)
self.dbtnAudio.setFixedSize(devBtnSize, 32)
self.dbtnAudio.setToolTip("AudioCounter Device - Click Button for Device Info")
self.dbtnAudio.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnAudio.setAutoFillBackground(True)
self.dbtnAudio.clicked.connect(lambda: self.fprintDeviceInfo(self.connectTextAudio))
self.connectTextPulse = 'SPulse'
self.dbtnPulse = QPushButton(self.connectTextPulse)
self.dbtnPulse.setFixedSize(devBtnSize, 32)
self.dbtnPulse.setToolTip("SerialPulseCounter Device - Click Button for Device Info")
self.dbtnPulse.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnPulse.setAutoFillBackground(True)
# self.dbtnPulse.clicked.connect(lambda: self.fprintDeviceInfo(self.connectTextPulse))
self.dbtnPulse.clicked.connect(lambda: self.fprintDeviceInfo("SerialPulse"))
self.connectTextIoT = 'IoT'
self.dbtnIoT = QPushButton(self.connectTextIoT)
self.dbtnIoT.setFixedSize(devBtnSize,32)
self.dbtnIoT.setToolTip("IoT Device - Click Button for Device Info")
self.dbtnIoT.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnIoT.setAutoFillBackground(True)
self.dbtnIoT.clicked.connect(lambda: self.fprintDeviceInfo("IoT"))
self.connectTextRM = 'RadM'
self.dbtnRM = QPushButton(self.connectTextRM)
self.dbtnRM.setFixedSize(devBtnSize,32)
self.dbtnRM.setToolTip("RadMon Device - Click Button for Device Info")
self.dbtnRM.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnRM.setAutoFillBackground(True)
self.dbtnRM.clicked.connect(lambda: self.fprintDeviceInfo("RadMon"))
self.connectTextAmbio = 'Ambio'
self.dbtnAmbio = QPushButton(self.connectTextAmbio)
self.dbtnAmbio.setFixedSize(devBtnSize, 32)
self.dbtnAmbio.setToolTip("AmbioMon++ Device - Click Button for Device Info")
self.dbtnAmbio.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnAmbio.setAutoFillBackground(True)
self.dbtnAmbio.clicked.connect(lambda: self.fprintDeviceInfo("AmbioMon"))
self.connectTextGS = 'GScout'
self.dbtnGS = QPushButton(self.connectTextGS)
self.dbtnGS.setFixedSize(devBtnSize, 32)
self.dbtnGS.setToolTip("GammaScout Device - Click Button for Device Info")
self.dbtnGS.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnGS.setAutoFillBackground(True)
self.dbtnGS.clicked.connect(lambda: self.fprintDeviceInfo("GammaScout"))
self.connectTextI2C = 'I2C'
self.dbtnI2C = QPushButton(self.connectTextI2C)
self.dbtnI2C.setFixedSize(devBtnSize, 32)
self.dbtnI2C.setToolTip("I2C Device - Click Button for Device Info")
self.dbtnI2C.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnI2C.setAutoFillBackground(True)
self.dbtnI2C.clicked.connect(lambda: self.fprintDeviceInfo("I2C" ))
self.connectTextLJ = 'LabJck'
self.dbtnLJ = QPushButton(self.connectTextLJ)
self.dbtnLJ.setFixedSize(devBtnSize, 32)
self.dbtnLJ.setToolTip("LabJack Device - Click Button for Device Info")
self.dbtnLJ.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnLJ.setAutoFillBackground(True)
self.dbtnLJ.clicked.connect(lambda: self.fprintDeviceInfo("LabJack"))
self.connectTextMiniMon = 'MiniM'
self.dbtnMiniMon = QPushButton(self.connectTextMiniMon)
self.dbtnMiniMon.setFixedSize(devBtnSize, 32)
self.dbtnMiniMon.setToolTip("MiniMon Device - Click Button for Device Info")
self.dbtnMiniMon.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnMiniMon.setAutoFillBackground(True)
self.dbtnMiniMon.clicked.connect(lambda: self.fprintDeviceInfo("MiniMon"))
self.connectTextFormula = 'Forml'
self.dbtnFormula = QPushButton(self.connectTextFormula)
self.dbtnFormula.setFixedSize(devBtnSize, 32)
self.dbtnFormula.setToolTip("Formula Device - Click Button for Device Info")
self.dbtnFormula.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnFormula.setAutoFillBackground(True)
self.dbtnFormula.clicked.connect(lambda: self.fprintDeviceInfo("Formula"))
self.connectTextWiFiClient = 'WiFiC'
self.dbtnWClient = QPushButton(self.connectTextWiFiClient)
self.dbtnWClient.setFixedSize(devBtnSize, 32)
self.dbtnWClient.setToolTip("WiFiClient Device - Click Button for Device Info")
self.dbtnWClient.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnWClient.setAutoFillBackground(True)
self.dbtnWClient.clicked.connect(lambda: self.fprintDeviceInfo("WiFiClient"))
self.connectTextWiFiServer = 'WiFiS'
self.dbtnWServer = QPushButton(self.connectTextWiFiServer)
self.dbtnWServer.setFixedSize(devBtnSize, 32)
self.dbtnWServer.setToolTip("WiFiServer Device - Click Button for Device Info")
self.dbtnWServer.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnWServer.setAutoFillBackground(True)
self.dbtnWServer.clicked.connect(lambda: self.fprintDeviceInfo("WiFiServer"))
self.connectTextRaspiI2C = 'RI2C'
self.dbtnRI2C = QPushButton(self.connectTextRaspiI2C)
self.dbtnRI2C.setFixedSize(devBtnSize, 32)
self.dbtnRI2C.setToolTip("Raspi I2C Device - Click Button for Device Info")
self.dbtnRI2C.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnRI2C.setAutoFillBackground(True)
self.dbtnRI2C.clicked.connect(lambda: self.fprintDeviceInfo("RaspiI2C"))
self.connectTextRaspiPulse = 'RPuls'
self.dbtnRPulse = QPushButton(self.connectTextRaspiPulse)
self.dbtnRPulse.setFixedSize(devBtnSize, 32)
self.dbtnRPulse.setToolTip("Raspi Pulse Device - Click Button for Device Info")
self.dbtnRPulse.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnRPulse.setAutoFillBackground(True)
self.dbtnRPulse.clicked.connect(lambda: self.fprintDeviceInfo("RaspiPulse"))
self.connectTextManu = 'Manu'
self.dbtnManu = QPushButton(self.connectTextManu)
self.dbtnManu.setFixedSize(devBtnSize, 32)
self.dbtnManu.setToolTip("Manu Device - Click Button for Device Info")
self.dbtnManu.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnManu.setAutoFillBackground(True)
self.dbtnManu.clicked.connect(lambda: self.fprintDeviceInfo("Manu"))
self.connectTextRadPro = "RadPro"
self.dbtnRadPro = QPushButton(self.connectTextRadPro)
self.dbtnRadPro.setFixedSize(devBtnSize, 32)
self.dbtnRadPro.setToolTip("RadPro Device - Click for Device Info")
self.dbtnRadPro.setStyleSheet(self.dbtnStyleSheetOFF)
self.dbtnRadPro.setAutoFillBackground(True)
self.dbtnRadPro.clicked.connect(lambda: self.fprintDeviceInfo("RadPro"))
# toolbar Device
toolbar = self.addToolBar('Device')
toolbar.setToolTip("Device Toolbar")
toolbar.setIconSize(QSize(32,32)) # standard size is too small
toolbar.addAction(self.toggleDeviceConnectionAction) # Connect icon
toolbar.addWidget(QLabel(" ")) # spacer
if g.Devices["GMC"] [g.ACTIV] : toolbar.addWidget(self.dbtnGMCPower) # GMC power icon
if g.Devices["GMC"] [g.ACTIV] : toolbar.addWidget(self.dbtnGMC) # GMC device display
if g.Devices["Audio"] [g.ACTIV] : toolbar.addWidget(self.dbtnAudio) # AudioCounter device display
if g.Devices["SerialPulse"] [g.ACTIV] : toolbar.addWidget(self.dbtnPulse) # Pulse Counter by USB-to-Serial adapter
if g.Devices["IoT"] [g.ACTIV] : toolbar.addWidget(self.dbtnIoT) # IoT device display
if g.Devices["RadMon"] [g.ACTIV] : toolbar.addWidget(self.dbtnRM) # RadMon device display
if g.Devices["AmbioMon"] [g.ACTIV] : toolbar.addWidget(self.dbtnAmbio) # Manu device display
if g.Devices["GammaScout"] [g.ACTIV] : toolbar.addWidget(self.dbtnGS) # Gamma-Scout device display
if g.Devices["I2C"] [g.ACTIV] : toolbar.addWidget(self.dbtnI2C) # I2C device display
if g.Devices["LabJack"] [g.ACTIV] : toolbar.addWidget(self.dbtnLJ) # LabJack device display
if g.Devices["MiniMon"] [g.ACTIV] : toolbar.addWidget(self.dbtnMiniMon) # MiniMon device display
if g.Devices["Formula"] [g.ACTIV] : toolbar.addWidget(self.dbtnFormula) # Formula device display
if g.Devices["WiFiClient"] [g.ACTIV] : toolbar.addWidget(self.dbtnWClient) # WiFiClient device display
if g.Devices["WiFiServer"] [g.ACTIV] : toolbar.addWidget(self.dbtnWServer) # WiFiServer device display
if g.Devices["RaspiI2C"] [g.ACTIV] : toolbar.addWidget(self.dbtnRI2C) # RaspiI2C device display
if g.Devices["RaspiPulse"] [g.ACTIV] : toolbar.addWidget(self.dbtnRPulse) # RaspiPulse device display
if g.Devices["Manu"] [g.ACTIV] : toolbar.addWidget(self.dbtnManu) # Manu device display
if g.Devices["RadPro"] [g.ACTIV] : toolbar.addWidget(self.dbtnRadPro) # RadPro device display
#Log Menu