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
8861f4dc
Commit
8861f4dc
authored
Jul 26, 2018
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Progress bar and label added to scan layouts.
parent
e655a548
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
52 deletions
+74
-52
myGUI.py
myGUI.py
+12
-46
myWidgets.py
myWidgets.py
+62
-6
No files found.
myGUI.py
View file @
8861f4dc
...
...
@@ -10,11 +10,11 @@ import sys
from
pyqtgraph.Qt
import
QtCore
,
QtGui
from
myWidgets
import
anal_control_signal
,
digital_control_signal
,
activation_button
from
myWidgets
import
anal_control_signal
,
digital_control_signal
,
activation_button
,
burleighWM
from
pyqtgraph
import
dockarea
import
pyqtgraph
as
pg
import
telnetlib
from
PyQt5.QtCore
import
QTimer
from
PyQt5.QtWidgets
import
QLCDNumber
...
...
@@ -125,7 +125,8 @@ layout397_scan.addWidget(QtGui.QLabel('start'), 1, 0), layout397_scan.addWidget(
layout397_scan
.
addWidget
(
QtGui
.
QLabel
(
'stop'
),
2
,
0
),
layout397_scan
.
addWidget
(
piezoA397
.
scan_sb_stop
,
2
,
1
)
layout397_scan
.
addWidget
(
QtGui
.
QLabel
(
'period'
),
3
,
0
),
layout397_scan
.
addWidget
(
piezoA397
.
scan_sb_period
,
3
,
1
)
layout397_scan
.
addWidget
(
QtGui
.
QLabel
(
'Scanning'
),
4
,
0
),
layout397_scan
.
addWidget
(
piezoA397
.
scan_button
,
4
,
1
)
layout397_scan
.
addWidget
(
piezoA397
.
scanLabelValue
,
5
,
0
)
layout397_scan
.
addWidget
(
piezoA397
.
scanpBar
,
5
,
1
)
#########################
...
...
@@ -140,6 +141,8 @@ layout866_scan.addWidget(QtGui.QLabel('start'), 1, 0), layout866_scan.addWidget(
layout866_scan
.
addWidget
(
QtGui
.
QLabel
(
'stop'
),
2
,
0
),
layout866_scan
.
addWidget
(
piezoB866
.
scan_sb_stop
,
2
,
1
)
layout866_scan
.
addWidget
(
QtGui
.
QLabel
(
'period'
),
3
,
0
),
layout866_scan
.
addWidget
(
piezoB866
.
scan_sb_period
,
3
,
1
)
layout866_scan
.
addWidget
(
QtGui
.
QLabel
(
'Scanning'
),
4
,
0
),
layout866_scan
.
addWidget
(
piezoB866
.
scan_button
,
4
,
1
)
layout866_scan
.
addWidget
(
piezoB866
.
scanLabelValue
,
5
,
0
)
layout866_scan
.
addWidget
(
piezoB866
.
scanpBar
,
5
,
1
)
#########################
######### PI ###########
...
...
@@ -153,6 +156,9 @@ layout423_scan.addWidget(QtGui.QLabel('start'), 1, 0), layout423_scan.addWidget(
layout423_scan
.
addWidget
(
QtGui
.
QLabel
(
'stop'
),
2
,
0
),
layout423_scan
.
addWidget
(
piezoA423
.
scan_sb_stop
,
2
,
1
)
layout423_scan
.
addWidget
(
QtGui
.
QLabel
(
'period'
),
3
,
0
),
layout423_scan
.
addWidget
(
piezoA423
.
scan_sb_period
,
3
,
1
)
layout423_scan
.
addWidget
(
QtGui
.
QLabel
(
'Scanning'
),
4
,
0
),
layout423_scan
.
addWidget
(
piezoA423
.
scan_button
,
4
,
1
)
layout423_scan
.
addWidget
(
piezoA423
.
scanLabelValue
,
5
,
0
)
layout423_scan
.
addWidget
(
piezoA423
.
scanpBar
,
5
,
1
)
#########################
######### trap electrodes ###########
...
...
@@ -162,15 +168,9 @@ layout_trap_electrodes.addWidget(QtGui.QLabel(trapDCB.name), 2, 1), layout_trap_
layout_trap_electrodes
.
addWidget
(
QtGui
.
QLabel
(
trapCompC
.
name
),
1
,
3
),
layout_trap_electrodes
.
addWidget
(
trapCompC
.
sb
,
1
,
4
)
layout_trap_electrodes
.
addWidget
(
QtGui
.
QLabel
(
trapCompD
.
name
),
2
,
3
),
layout_trap_electrodes
.
addWidget
(
trapCompD
.
sb
,
2
,
4
)
#########################
###########################################################
#all shutter start in False:
shutters
=
[
shutter397
,
shutter866
,
shutter423
,
shutterLED
]
try
:
...
...
@@ -178,45 +178,11 @@ try:
sh
.
DO
.
set_out
(
True
)
except
:
pass
###########################################################
###########################################################
#read wavemeter
wavemeter_ok
=
False
try
:
tn
=
telnetlib
.
Telnet
(
host
=
"wannanosaurus"
,
port
=
1234
,
timeout
=
1
)
wavemeter_ok
=
True
except
:
print
(
'wannanosaurus not connected'
)
if
wavemeter_ok
:
tn
.
write
(
b
'++eos 1
\n
'
)
lcd
=
QLCDNumber
()
lcd
.
setDigitCount
(
9
)
lcd
.
display
(
"000000 00"
)
def
update_label
():
tn
.
sock_avail
()
tn
.
write
(
b
'++read <cr>
\n
'
)
a
=
tn
.
read_very_eager
()
.
decode
(
"utf-8"
)
#print(a)
try
:
lcd
.
display
(
a
[
3
:
12
])
except
:
lcd
.
display
(
"000000 00"
)
layoutWM
.
setGeometry
(
300
,
300
,
250
,
150
)
layoutWM
.
show
()
layoutWM
.
timer
=
QTimer
()
layoutWM
.
timer
.
timeout
.
connect
(
update_label
)
layoutWM
.
timer
.
start
(
1000
)
# every 10,000 milliseconds
layoutWM
.
addWidget
(
lcd
)
dWM
.
addWidget
(
layoutWM
)
wavemeter
=
burleighWM
(
layoutWM
,
dWM
)
###############################################################################
myToolbar
.
incorporate_toolbar
(
win
,
anal_control_signal
.
_registry
)
###############################################################################
...
...
myWidgets.py
View file @
8861f4dc
...
...
@@ -8,8 +8,9 @@ This is a temporary script file.
import
pyqtgraph
as
pg
from
ADoutputs
import
daq_AO
,
daq_DO
from
pyqtgraph.Qt
import
QtGui
,
QtCore
from
PyQt5.QtCore
import
QBasicTimer
from
PyQt5.QtWidgets
import
(
QPushButton
,
QWidget
,
QVBoxLayout
)
from
PyQt5.QtCore
import
QTimer
from
PyQt5.QtWidgets
import
(
QPushButton
,
QWidget
,
QVBoxLayout
,
QLCDNumber
,
QProgressBar
,
QLabel
)
import
telnetlib
import
os
#An example of a class
...
...
@@ -38,10 +39,15 @@ class anal_control_signal(QWidget):
print
(
'Analog output
%
i not found. Daq might not be connected'
%
self
.
ch
)
self
.
sb
.
sigValueChanging
.
connect
(
self
.
sb_analog_change
)
self
.
scan_button
=
QPushButton
(
'Start scan'
)
self
.
timer
=
Q
Basic
Timer
()
self
.
timer
=
QTimer
()
self
.
scan_step
=
0
self
.
scanpBar
=
QProgressBar
(
self
)
#self.scanpBar.setTextVisible(False)
self
.
scanLabelValue
=
QLabel
(
self
)
self
.
scan_sb_start
=
pg
.
SpinBox
(
value
=
0
,
bounds
=
[
self
.
min
,
self
.
max
],
step
=
self
.
step
,
siPrefix
=
self
.
siPrefix
,
suffix
=
self
.
suffix
)
self
.
scan_sb_stop
=
pg
.
SpinBox
(
value
=
0
,
bounds
=
[
self
.
min
,
self
.
max
],
step
=
self
.
step
,
siPrefix
=
self
.
siPrefix
,
suffix
=
self
.
suffix
)
...
...
@@ -74,7 +80,7 @@ class anal_control_signal(QWidget):
def
timerEvent
(
self
,
e
):
def
scanEvent
(
self
):
if
abs
(
abs
(
self
.
scan_step
)
-
abs
(
float
(
self
.
scan_sb_start
.
val
)))
<
1e-6
or
abs
(
abs
(
self
.
scan_step
)
-
abs
(
float
(
self
.
scan_sb_stop
.
val
)))
<
1e-6
:
self
.
scan_direction
=
(
-
1
)
*
self
.
scan_direction
...
...
@@ -82,12 +88,17 @@ class anal_control_signal(QWidget):
self
.
scan_step
=
self
.
scan_step
+
self
.
scan_direction
self
.
AO
.
set_out
(
self
.
scan_step
)
self
.
scanpBar
.
setValue
(
100
*
float
(
self
.
scan_step
-
float
(
self
.
scan_sb_start
.
val
))
/
float
(
self
.
scan_sb_stop
.
val
-
self
.
scan_sb_start
.
val
)
)
self
.
scanLabelValue
.
setText
(
"
%.2
f"
%
self
.
scan_step
+
' V'
)
#print(self.scan_step)
def
doAction
(
self
):
self
.
scan_direction
=
-
float
(
(
self
.
scan_sb_stop
.
val
-
self
.
scan_sb_start
.
val
)
/
self
.
scan_sb_period
.
val
)
*
float
(
2
*
1e-3
)
self
.
scan_step
=
float
(
self
.
scan_sb_start
.
val
)
if
self
.
timer
.
isActive
():
self
.
timer
.
stop
()
self
.
scan_button
.
setText
(
'Start scan'
)
...
...
@@ -97,7 +108,8 @@ class anal_control_signal(QWidget):
self
.
AO
.
set_out
(
self
.
sb
.
val
)
else
:
self
.
scan_button
.
setStyleSheet
(
"background-color: green"
)
self
.
timer
.
start
(
1
,
self
)
self
.
timer
.
start
(
1
)
self
.
timer
.
timeout
.
connect
(
self
.
scanEvent
)
self
.
scan_button
.
setText
(
'Scanning'
)
...
...
@@ -146,4 +158,48 @@ class activation_button(QWidget):
def
handleButton
(
self
):
self
.
button
.
setIcon
(
QtGui
.
QIcon
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
snuffles.png"
))
\ No newline at end of file
class
burleighWM
(
QWidget
):
def
__init__
(
self
,
layout
,
dock
):
super
()
.
__init__
()
self
.
dockWM
=
dock
self
.
layoutWM
=
layout
wavemeter_ok
=
False
try
:
tn
=
telnetlib
.
Telnet
(
host
=
"wannanosaurus"
,
port
=
1234
,
timeout
=
1
)
wavemeter_ok
=
True
except
:
print
(
'wannanosaurus not connected'
)
if
wavemeter_ok
:
tn
.
write
(
b
'++eos 1
\n
'
)
lcd
=
QLCDNumber
()
lcd
.
setDigitCount
(
9
)
lcd
.
display
(
"000000 00"
)
def
update_label
():
tn
.
sock_avail
()
tn
.
write
(
b
'++read <cr>
\n
'
)
a
=
tn
.
read_very_eager
()
.
decode
(
"utf-8"
)
#print(a)
try
:
lcd
.
display
(
a
[
3
:
12
])
except
:
lcd
.
display
(
"000000 00"
)
self
.
layoutWM
.
setGeometry
(
300
,
300
,
250
,
150
)
self
.
layoutWM
.
timer
=
QTimer
()
self
.
layoutWM
.
timer
.
timeout
.
connect
(
update_label
)
self
.
layoutWM
.
timer
.
start
(
1000
)
# every 10,000 milliseconds
self
.
layoutWM
.
addWidget
(
lcd
)
self
.
dockWM
.
addWidget
(
self
.
layoutWM
)
\ No newline at end of file
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