Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
total_control_app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Drechsler
total_control_app
Commits
40d9ccf5
Commit
40d9ccf5
authored
Apr 29, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new control gui almost finished
parent
a1922349
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
23 deletions
+105
-23
MCDAQcontrolsignals.py
MCDAQcontrolsignals.py
+28
-7
controlGui.py
controlGui.py
+59
-7
myToolbar.py
myToolbar.py
+1
-1
controllayouts.py
subclasses/controllayouts.py
+17
-8
No files found.
MCDAQcontrolsignals.py
View file @
40d9ccf5
...
...
@@ -24,10 +24,10 @@ class anal_control_signal(QtCore.QObject):
self
.
name
=
name
self
.
ch
=
channel
self
.
ao_type
=
ao_type
try
:
self
.
AO
=
daq_AO
(
self
.
ch
)
except
:
show_warning
(
'Analog output
%
i not found. Daq might not be connected'
%
self
.
ch
)
self
.
AO
=
daq_AO
(
self
.
ch
)
self
.
is_feedwoward_enabled
=
feedfoward
self
.
initial_value
=
0
self
.
max
=
out_maximum
...
...
@@ -41,12 +41,9 @@ class anal_control_signal(QtCore.QObject):
self
.
scan_array_gen
=
None
def
make_connections
(
self
,
frontend
):
# internal connections
# external connections
for
layout
in
LaserControlLayout
.
_registry
:
if
self
.
name
in
layout
.
spinboxes
:
print
(
self
.
name
,
' connected'
,
layout
.
name
)
layout
.
spinboxes
[
self
.
name
]
.
setMinimum
(
self
.
min
)
layout
.
spinboxes
[
self
.
name
]
.
setMaximum
(
self
.
max
)
layout
.
spinboxes
[
self
.
name
]
.
setValue
(
self
.
initial_value
)
...
...
@@ -83,3 +80,27 @@ class anal_control_signal(QtCore.QObject):
def
sb_change
(
self
,
sb
,
value
):
self
.
AO
.
set_out
(
value
)
class
digital_control_signal
(
QtCore
.
QObject
):
_registry
=
[]
def
__init__
(
self
,
name
,
channel
,
inverse
=
False
):
super
()
.
__init__
()
self
.
_registry
.
append
(
self
)
self
.
name
=
name
self
.
ch
=
channel
self
.
initial_value
=
0
self
.
DO
=
daq_DO
(
self
.
ch
)
def
make_connections
(
self
,
frontend
):
for
layout
in
LaserControlLayout
.
_registry
:
if
self
.
name
in
layout
.
checkboxes
:
layout
.
checkboxes
[
self
.
name
]
.
stateChanged
.
connect
(
self
.
when_change_digital
)
@
QtCore
.
pyqtSlot
(
int
)
def
when_change_digital
(
self
,
state
):
if
state
==
QtCore
.
Qt
.
Checked
:
self
.
DO
.
set_out
(
True
)
else
:
self
.
DO
.
set_out
(
False
)
\ No newline at end of file
controlGui.py
View file @
40d9ccf5
...
...
@@ -16,6 +16,7 @@ from subclasses.controllayouts import LaserControlLayout
from
subclasses.controllayouts
import
LaserScanLayout
from
pyqtgraph
import
dockarea
from
MCDAQcontrolsignals
import
anal_control_signal
from
MCDAQcontrolsignals
import
digital_control_signal
class
ControlGui
(
QtGui
.
QFrame
):
...
...
@@ -31,19 +32,55 @@ class ControlGui(QtGui.QFrame):
self
.
dock_397
=
dockarea
.
Dock
(
'397'
,
(
100
,
100
))
self
.
dock_866
=
dockarea
.
Dock
(
'866'
,
(
100
,
100
))
self
.
dock_423
=
dockarea
.
Dock
(
'423'
,
(
100
,
100
))
self
.
dock_397_scan
=
dockarea
.
Dock
(
'397 scan'
,
(
100
,
100
))
self
.
dock_866_scan
=
dockarea
.
Dock
(
'866 scan'
,
(
100
,
100
))
self
.
dock_423_scan
=
dockarea
.
Dock
(
'423 scan'
,
(
100
,
100
))
self
.
dock_electrodes
=
dockarea
.
Dock
(
'dcElectrodes'
,
(
100
,
100
))
self
.
area
.
addDock
(
self
.
dock_397
)
self
.
area
.
addDock
(
self
.
dock_866
,
'left'
,
self
.
dock_397
)
self
.
area
.
addDock
(
self
.
dock_electrodes
)
self
.
area
.
addDock
(
self
.
dock_397
,
'bottom'
,
self
.
dock_electrodes
)
self
.
area
.
addDock
(
self
.
dock_866
,
'bottom'
,
self
.
dock_397
)
self
.
area
.
addDock
(
self
.
dock_423
,
'bottom'
,
self
.
dock_866
)
self
.
area
.
addDock
(
self
.
dock_397_scan
,
'right'
,
self
.
dock_397
)
self
.
area
.
addDock
(
self
.
dock_866_scan
,
'right'
,
self
.
dock_866
)
self
.
area
.
addDock
(
self
.
dock_423_scan
,
'right'
,
self
.
dock_423
)
self
.
laser397_control_layout
=
LaserControlLayout
(
'397'
,
checkboxes
=
[],
spinboxes
=
[
'piezoA397'
,
'piezoB397'
])
self
.
laser397_control_layout
=
LaserControlLayout
(
'397'
,
checkboxes
=
[
'shutter397'
],
spinboxes
=
[
'piezoA397'
,
'piezoB397'
])
self
.
laser397_scan_layout
=
LaserScanLayout
(
name
=
'piezoA397'
,
signal_to_scan_layout
=
self
.
laser397_control_layout
)
self
.
dock_397
.
addWidget
(
self
.
laser397_control_layout
)
self
.
dock_397
.
addWidget
(
self
.
laser397_scan_layout
)
self
.
dock_397
.
addWidget
(
self
.
laser397_control_layout
,
0
,
0
)
self
.
dock_397
_scan
.
addWidget
(
self
.
laser397_scan_layout
,
0
,
1
)
self
.
laser866_control_layout
=
LaserControlLayout
(
'866'
,
checkboxes
=
[],
spinboxes
=
[
'piezoA866'
,
'piezoB866'
])
self
.
laser866_control_layout
=
LaserControlLayout
(
'866'
,
checkboxes
=
[
'shutter866'
,
'shuter866WM'
],
spinboxes
=
[
'piezoA866'
,
'piezoB866'
])
self
.
laser866_scan_layout
=
LaserScanLayout
(
name
=
'piezoA866'
,
signal_to_scan_layout
=
self
.
laser866_control_layout
)
self
.
dock_866
.
addWidget
(
self
.
laser866_control_layout
)
self
.
dock_866
.
addWidget
(
self
.
laser866_scan_layout
)
self
.
dock_866_scan
.
addWidget
(
self
.
laser866_scan_layout
)
self
.
laser423_control_layout
=
LaserControlLayout
(
'423'
,
checkboxes
=
[
'shutter423'
],
spinboxes
=
[
'piezo423'
])
self
.
laser423_scan_layout
=
LaserScanLayout
(
name
=
'piezo423'
,
signal_to_scan_layout
=
self
.
laser423_control_layout
)
self
.
dock_423
.
addWidget
(
self
.
laser423_control_layout
)
self
.
dock_423_scan
.
addWidget
(
self
.
laser423_scan_layout
)
self
.
electrodes_control_layout
=
LaserControlLayout
(
'electrodes'
,
checkboxes
=
[],
spinboxes
=
[
'dcA'
,
'dcB'
,
'compC'
,
'compD'
,
'compOven'
,
'compExYb'
],
custom_geometry
=
True
)
self
.
dock_electrodes
.
addWidget
(
self
.
electrodes_control_layout
)
self
.
electrodes_control_layout
.
addWidget
(
QtGui
.
QLabel
(
'dcA'
),
0
,
0
)
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'dcA'
],
0
,
1
)
self
.
electrodes_control_layout
.
addWidget
(
QtGui
.
QLabel
(
'dcB'
),
1
,
0
)
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'dcB'
],
1
,
1
)
self
.
electrodes_control_layout
.
addWidget
(
QtGui
.
QLabel
(
'compC'
),
0
,
2
)
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'compC'
],
0
,
3
)
self
.
electrodes_control_layout
.
addWidget
(
QtGui
.
QLabel
(
'compD'
),
1
,
2
)
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'compD'
],
1
,
3
)
self
.
electrodes_control_layout
.
addWidget
(
QtGui
.
QLabel
(
'compOven'
),
0
,
4
)
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'compOven'
],
0
,
5
)
self
.
electrodes_control_layout
.
addWidget
(
QtGui
.
QLabel
(
'compExYb'
),
1
,
4
)
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'compExYb'
],
1
,
5
)
self
.
show
()
...
...
@@ -64,8 +101,20 @@ if __name__ == '__main__':
piezoB397
=
anal_control_signal
(
'piezoB397'
,
channel
=
1
,
ao_type
=
'cavity_piezo'
)
piezoA866
=
anal_control_signal
(
'piezoA866'
,
channel
=
2
,
ao_type
=
'cavity_piezo'
,
out_minimum
=
0
,
out_maximum
=
4
)
piezoB866
=
anal_control_signal
(
'piezoB866'
,
channel
=
3
,
ao_type
=
'cavity_piezo'
)
piezo423
=
anal_control_signal
(
'piezo423'
,
channel
=
4
,
ao_type
=
'laser_piezo'
)
trapDCA
=
anal_control_signal
(
'dcA'
,
channel
=
5
,
ao_type
=
'electrode'
)
trapDCB
=
anal_control_signal
(
'dcB'
,
channel
=
6
,
ao_type
=
'electrode'
)
trapCOMPC
=
anal_control_signal
(
'compC'
,
channel
=
7
,
ao_type
=
'electrode'
)
trapCOMPD
=
anal_control_signal
(
'compD'
,
channel
=
8
,
ao_type
=
'electrode'
)
trapOven
=
anal_control_signal
(
'compOven'
,
channel
=
9
,
ao_type
=
'electrode'
)
trapExYb
=
anal_control_signal
(
'CompExYb'
,
channel
=
10
,
ao_type
=
'electrode'
)
shutter866
=
digital_control_signal
(
'shutter866'
,
channel
=
0
)
shutter397
=
digital_control_signal
(
'shutter397'
,
channel
=
1
)
shutter423
=
digital_control_signal
(
'shutter423'
,
channel
=
2
)
shutter866WM
=
digital_control_signal
(
'shutter866WM'
,
channel
=
3
)
mcDAQthread
=
QtCore
.
QThread
()
for
ao
in
anal_control_signal
.
_registry
:
...
...
@@ -74,6 +123,9 @@ if __name__ == '__main__':
ao
.
moveToThread
(
mcDAQthread
)
ao
.
scanTimer
.
moveToThread
(
mcDAQthread
)
ao
.
scanTimer
.
timeout
.
connect
(
ao
.
scan_event
)
for
do
in
digital_control_signal
.
_registry
:
do
.
make_connections
(
controlGui
)
do
.
moveToThread
(
mcDAQthread
)
mcDAQthread
.
start
()
...
...
myToolbar.py
View file @
40d9ccf5
...
...
@@ -9,7 +9,7 @@ Created on Thu Jul 5 12:17:30 2018
from
PyQt5.QtCore
import
QSettings
from
PyQt5.QtWidgets
import
QAction
,
QFileDialog
,
QInputDialog
,
QWidget
from
threading
import
Thread
from
webcamROI
import
roiWindow
#
from webcamROI import roiWindow
#%%
class
myToolbarMenu
(
QWidget
):
...
...
subclasses/controllayouts.py
View file @
40d9ccf5
...
...
@@ -39,30 +39,39 @@ class LaserControlLayout(pg.LayoutWidget):
A class for creating a layout with spinboxes and checkboxes to control a laser.
"""
_registry
=
[]
def
__init__
(
self
,
name
,
spinboxes
=
[
'sbA'
,
'sbB'
],
checkboxes
=
[
'cbA'
,
'cbB'
]):
def
__init__
(
self
,
name
,
spinboxes
=
[
'sbA'
,
'sbB'
],
checkboxes
=
[
'cbA'
,
'cbB'
]
,
custom_geometry
=
False
):
super
()
.
__init__
()
self
.
_registry
.
append
(
self
)
self
.
name
=
name
self
.
layout
.
addWidget
(
QtGui
.
QLabel
(
self
.
name
),
0
,
0
)
if
custom_geometry
!=
True
:
self
.
layout
.
addWidget
(
QtGui
.
QLabel
(
self
.
name
),
0
,
0
)
self
.
spinboxes
=
{}
self
.
checkboxes
=
{}
for
i
,
sb_name
in
enumerate
(
spinboxes
,
start
=
1
):
self
.
spinboxes
[
sb_name
]
=
CustomSpinBox
(
siPrefix
=
True
,
suffix
=
'V'
)
self
.
addWidget
(
QtGui
.
QLabel
(
sb_name
),
i
,
0
)
self
.
addWidget
(
self
.
spinboxes
[
sb_name
],
i
,
1
)
if
custom_geometry
!=
True
:
self
.
addWidget
(
QtGui
.
QLabel
(
sb_name
),
i
,
0
)
self
.
addWidget
(
self
.
spinboxes
[
sb_name
],
i
,
1
)
for
i
,
cb_name
in
enumerate
(
checkboxes
,
start
=
0
):
self
.
checkboxes
[
cb_name
]
=
QtGui
.
QCheckBox
()
row
=
len
(
spinboxes
)
+
1
self
.
addWidget
(
QtGui
.
QLabel
(
cb_name
),
row
,
2
*
i
)
self
.
addWidget
(
self
.
checkboxes
[
cb_name
],
row
,
2
*
i
+
1
)
if
custom_geometry
!=
True
:
row
=
len
(
spinboxes
)
+
1
self
.
addWidget
(
QtGui
.
QLabel
(
cb_name
),
row
,
2
*
i
)
self
.
addWidget
(
self
.
checkboxes
[
cb_name
],
row
,
2
*
i
+
1
)
def
blink
(
self
,
cb
):
pass
class
LaserScanLayout
(
pg
.
LayoutWidget
):
"""
A class for creating a layout for scanning a laser piezo.
It is important that the name parameter coincides with the name of the spinbox to scan.
"""
_registry
=
[]
scanActionSignal
=
QtCore
.
pyqtSignal
(
object
)
...
...
@@ -76,7 +85,7 @@ class LaserScanLayout(pg.LayoutWidget):
self
.
spinboxes
=
{}
self
.
spinboxes
[
'start'
]
=
CustomSpinBox
(
siPrefix
=
True
,
suffix
=
'V'
)
self
.
spinboxes
[
'stop'
]
=
CustomSpinBox
(
siPrefix
=
True
,
suffix
=
'V'
)
self
.
spinboxes
[
'period'
]
=
CustomSpinBox
(
siPrefix
=
True
,
suffix
=
's'
)
self
.
spinboxes
[
'period'
]
=
CustomSpinBox
(
siPrefix
=
True
,
suffix
=
's'
,
step
=
1
)
self
.
scan_button
=
QPushButton
(
'Start scan'
)
self
.
scanpBar
=
QProgressBar
(
self
)
self
.
scanLabelValue
=
QLabel
(
self
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment