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
adb5eb68
Commit
adb5eb68
authored
Jul 13, 2018
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new file: myToolbar and other minor changes (dc electrode added)
parent
317730db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
28 deletions
+122
-28
myGUI.py
myGUI.py
+52
-27
myToolbar.py
myToolbar.py
+69
-0
myWidgets.py
myWidgets.py
+1
-1
No files found.
myGUI.py
View file @
adb5eb68
...
@@ -49,6 +49,7 @@ layoutWM = pg.LayoutWidget()
...
@@ -49,6 +49,7 @@ layoutWM = pg.LayoutWidget()
layout397_scan
=
pg
.
LayoutWidget
()
layout397_scan
=
pg
.
LayoutWidget
()
layout866_scan
=
pg
.
LayoutWidget
()
layout866_scan
=
pg
.
LayoutWidget
()
layout423_scan
=
pg
.
LayoutWidget
()
layout423_scan
=
pg
.
LayoutWidget
()
layout_trap_electrodes
=
pg
.
LayoutWidget
()
# Here I create the docks
# Here I create the docks
...
@@ -61,10 +62,11 @@ dWM = dockarea.Dock("DockWM", size=(s1, s2))
...
@@ -61,10 +62,11 @@ dWM = dockarea.Dock("DockWM", size=(s1, s2))
d397_scan
=
dockarea
.
Dock
(
"Dock 397 scan"
,
size
=
(
s1
,
s2
))
d397_scan
=
dockarea
.
Dock
(
"Dock 397 scan"
,
size
=
(
s1
,
s2
))
d866_scan
=
dockarea
.
Dock
(
"Dock 866 scan"
,
size
=
(
s1
,
s2
))
d866_scan
=
dockarea
.
Dock
(
"Dock 866 scan"
,
size
=
(
s1
,
s2
))
d423_scan
=
dockarea
.
Dock
(
"Dock 423 scan"
,
size
=
(
s1
,
s2
))
d423_scan
=
dockarea
.
Dock
(
"Dock 423 scan"
,
size
=
(
s1
,
s2
))
dtrap_electrodes
=
dockarea
.
Dock
(
"Dock Trap Electrodes"
,
size
=
(
s1
,
s2
))
# Here I add the docks
# Here I add the docks
area
.
addDock
(
d397
,
'left'
)
area
.
addDock
(
dtrap_electrodes
)
area
.
addDock
(
d397
,
'bottom'
,
dtrap_electrodes
)
area
.
addDock
(
d866
,
'bottom'
,
d397
)
area
.
addDock
(
d866
,
'bottom'
,
d397
)
area
.
addDock
(
dPI
,
'bottom'
,
d866
)
area
.
addDock
(
dPI
,
'bottom'
,
d866
)
area
.
addDock
(
dWM
,
'bottom'
,
dPI
)
area
.
addDock
(
dWM
,
'bottom'
,
dPI
)
...
@@ -82,7 +84,7 @@ dWM.addWidget(layoutWM)
...
@@ -82,7 +84,7 @@ dWM.addWidget(layoutWM)
d397_scan
.
addWidget
(
layout397_scan
)
d397_scan
.
addWidget
(
layout397_scan
)
d866_scan
.
addWidget
(
layout866_scan
)
d866_scan
.
addWidget
(
layout866_scan
)
d423_scan
.
addWidget
(
layout423_scan
)
d423_scan
.
addWidget
(
layout423_scan
)
dtrap_electrodes
.
addWidget
(
layout_trap_electrodes
)
############ creating the controls ########################
############ creating the controls ########################
...
@@ -92,6 +94,11 @@ piezoA866 = anal_control_signal('piezoA866', 14, out_minimum=0, out_maximum=4, o
...
@@ -92,6 +94,11 @@ piezoA866 = anal_control_signal('piezoA866', 14, out_minimum=0, out_maximum=4, o
piezoB866
=
anal_control_signal
(
'piezoB866'
,
6
)
piezoB866
=
anal_control_signal
(
'piezoB866'
,
6
)
piezoA423
=
anal_control_signal
(
'piezoA423'
,
1
)
piezoA423
=
anal_control_signal
(
'piezoA423'
,
1
)
trapDCA
=
anal_control_signal
(
'DC A'
,
2
)
trapDCB
=
anal_control_signal
(
'DC B'
,
3
)
trapCompC
=
anal_control_signal
(
'Comp C'
,
4
)
trapCompD
=
anal_control_signal
(
'Comp D'
,
5
)
shutter397
=
digital_control_signal
(
'shutter397'
,
0
)
shutter397
=
digital_control_signal
(
'shutter397'
,
0
)
...
@@ -144,6 +151,16 @@ layout423_scan.addWidget(QtGui.QLabel('period'), 3, 1), layout423_scan.addWidget
...
@@ -144,6 +151,16 @@ layout423_scan.addWidget(QtGui.QLabel('period'), 3, 1), layout423_scan.addWidget
layout423_scan
.
addWidget
(
QtGui
.
QLabel
(
'Scanning'
),
4
,
1
),
layout423_scan
.
addWidget
(
piezoA423
.
scan_button
,
4
,
2
)
layout423_scan
.
addWidget
(
QtGui
.
QLabel
(
'Scanning'
),
4
,
1
),
layout423_scan
.
addWidget
(
piezoA423
.
scan_button
,
4
,
2
)
#########################
#########################
######### trap electrodes ###########
layout_trap_electrodes
.
addWidget
(
QtGui
.
QLabel
(
'Trap electrodes'
),
0
,
0
)
layout_trap_electrodes
.
addWidget
(
QtGui
.
QLabel
(
trapDCA
.
name
),
1
,
1
),
layout_trap_electrodes
.
addWidget
(
trapDCA
.
sb
,
1
,
2
)
layout_trap_electrodes
.
addWidget
(
QtGui
.
QLabel
(
trapDCB
.
name
),
2
,
1
),
layout_trap_electrodes
.
addWidget
(
trapDCB
.
sb
,
2
,
2
)
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
)
#########################
######### Here I define the connect functions ###########
######### Here I define the connect functions ###########
...
@@ -182,33 +199,41 @@ for sh in shutters:
...
@@ -182,33 +199,41 @@ for sh in shutters:
#read wavemeter
#read wavemeter
tn
=
telnetlib
.
Telnet
(
host
=
"wannanosaurus"
,
port
=
1234
)
wavemeter_ok
=
False
tn
.
write
(
b
'++eos 1
\n
'
)
lcd
=
QLCDNumber
()
try
:
tn
=
telnetlib
.
Telnet
(
host
=
"wannanosaurus"
,
port
=
1234
)
wavemeter_ok
=
True
except
:
print
(
'wm 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"
)
lcd
.
setDigitCount
(
9
)
layoutWM
.
setGeometry
(
300
,
300
,
250
,
150
)
lcd
.
display
(
"000000 00"
)
layoutWM
.
show
()
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
.
timer
=
QTimer
()
layoutWM
.
show
()
layoutWM
.
timer
.
timeout
.
connect
(
update_label
)
layoutWM
.
timer
.
start
(
1000
)
# every 10,000 milliseconds
layoutWM
.
timer
=
QTimer
()
layoutWM
.
timer
.
timeout
.
connect
(
update_label
)
layoutWM
.
addWidget
(
lcd
)
layoutWM
.
timer
.
start
(
1000
)
# every 10,000 milliseconds
dWM
.
addWidget
(
layoutWM
)
layoutWM
.
addWidget
(
lcd
)
dWM
.
addWidget
(
layoutWM
)
###############################################################################
###############################################################################
myToolbar
.
incorporate_toolbar
(
win
,
anal_control_signal
.
_registry
)
myToolbar
.
incorporate_toolbar
(
win
,
anal_control_signal
.
_registry
)
...
...
myToolbar.py
0 → 100644
View file @
adb5eb68
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 5 12:17:30 2018
@author: Usuario
"""
from
PyQt5.QtCore
import
QSettings
from
PyQt5.QtWidgets
import
QAction
from
threading
import
Thread
def
save
(
aos
):
settings
=
QSettings
(
'C:
\\
Users
\\
Usuario
\\
Documents
\\
control_app
\\
config.ini'
,
QSettings
.
IniFormat
)
settings
.
beginGroup
(
'Ventana'
)
for
ao
in
aos
:
spin_boxes
=
ao
.
spin_boxes
for
text
,
spinb
in
spin_boxes
:
settings
.
setValue
(
str
(
ao
.
name
)
+
'_'
+
text
,
spinb
.
value
())
#print(spinb.value() )
settings
.
endGroup
()
print
(
'saving'
)
def
load
(
aos
):
settings
=
QSettings
(
'C:
\\
Users
\\
Usuario
\\
Documents
\\
control_app
\\
config.ini'
,
QSettings
.
IniFormat
)
settings
.
beginGroup
(
'Ventana'
)
for
ao
in
aos
:
spin_boxes
=
ao
.
spin_boxes
for
text
,
spinb
in
spin_boxes
:
spin
=
settings
.
value
(
str
(
ao
.
name
)
+
'_'
+
text
)
spinb
.
setValue
(
float
(
spin
)
)
settings
.
endGroup
()
def
startWebcamsThread
():
exec
(
open
(
'C:
\\
Users
\\
Usuario
\\
Documents
\\
control_app
\\
webcams.py'
)
.
read
())
def
putWebcams
(
checked
):
if
checked
:
t
=
Thread
(
target
=
startWebcamsThread
,
args
=
())
t
.
start
()
else
:
pass
def
incorporate_toolbar
(
win
,
analog_control_signals
):
menubar
=
win
.
menuBar
()
saveAct
=
QAction
(
'Save'
,
win
)
loadAct
=
QAction
(
'Load'
,
win
)
win
.
statusBar
()
menubar
=
win
.
menuBar
()
fileMenu
=
menubar
.
addMenu
(
'&File'
)
fileMenu
.
addAction
(
saveAct
)
fileMenu
.
addAction
(
loadAct
)
viewMenu
=
menubar
.
addMenu
(
'Monitor'
)
viewWebcams
=
QAction
(
'View webcams'
,
checkable
=
True
)
viewWebcams
.
setChecked
(
False
)
viewMenu
.
addAction
(
viewWebcams
)
saveAct
.
triggered
.
connect
(
lambda
:
save
(
analog_control_signals
))
loadAct
.
triggered
.
connect
(
lambda
:
load
(
analog_control_signals
))
viewWebcams
.
toggled
.
connect
(
lambda
:
putWebcams
(
viewWebcams
.
isChecked
())
)
\ No newline at end of file
myWidgets.py
View file @
adb5eb68
...
@@ -83,7 +83,7 @@ class anal_control_signal(QWidget):
...
@@ -83,7 +83,7 @@ class anal_control_signal(QWidget):
def
doAction
(
self
):
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_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
)
self
.
scan_step
=
float
(
self
.
scan_sb_start
.
val
)
if
self
.
timer
.
isActive
():
if
self
.
timer
.
isActive
():
...
...
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