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
3644de2a
Commit
3644de2a
authored
Jun 04, 2018
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
myParam added, where I build the gui with all the needed parameters for now
parent
dd41c921
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
12 deletions
+118
-12
myGUI.py
myGUI.py
+8
-12
myParam.py
myParam.py
+110
-0
No files found.
myGUI.py
View file @
3644de2a
...
...
@@ -5,20 +5,15 @@ Created on Thu May 31 14:22:48 2018
@author: Usuario
"""
from
ADoutputs
import
daq_AO
,
daq_DO
#
from ADoutputs import daq_AO, daq_DO
import
pyqtgraph
as
pg
from
pyqtgraph.Qt
import
QtCore
,
QtGui
from
pyqtgraph.Qt
import
QtGui
#This creates the window for the gui
app
=
QtGui
.
QApplication
([])
spins
=
[(
"Floating-point spin box, min=0, no maximum."
,
pg
.
SpinBox
(
value
=
5.0
,
bounds
=
[
0
,
None
])
)]
spin2
=
(
"Floating-point spin box, min=0, no maximum."
,
pg
.
SpinBox
(
value
=
5.0
,
bounds
=
[
0
,
None
])
)
win
=
QtGui
.
QMainWindow
()
win
.
setWindowTitle
(
'pyqtgraph example: SpinBox'
)
cw
=
QtGui
.
QWidget
()
...
...
@@ -27,6 +22,7 @@ cw.setLayout(layout)
win
.
setCentralWidget
(
cw
)
win
.
show
()
text
=
"Mi prueba fantastica"
spin
=
pg
.
SpinBox
(
value
=
0.0
,
bounds
=
[
-
10
,
10
],
step
=
.1
)
...
...
@@ -34,9 +30,9 @@ label = QtGui.QLabel(text)
layout
.
addWidget
(
label
)
layout
.
addWidget
(
spin
)
analog0
=
daq_AO
(
0
)
#
analog0 = daq_AO(0)
def
whenChange
(
sb
):
analog0
.
set_analog_out
(
sb
.
value
())
#
def whenChange(sb):
#
analog0.set_analog_out(sb.value())
spin
.
sigValueChanging
.
connect
(
whenChange
)
\ No newline at end of file
#spin.sigValueChanging.connect(whenChange)
\ No newline at end of file
myParam.py
0 → 100644
View file @
3644de2a
# -*- coding: utf-8 -*-
"""
This example demonstrates the use of pyqtgraph's parametertree system. This provides
a simple way to generate user interfaces that control sets of parameters. The example
demonstrates a variety of different parameter types (int, float, list, etc.)
as well as some customized parameter types
"""
import
pyqtgraph
as
pg
from
pyqtgraph.Qt
import
QtCore
,
QtGui
app
=
QtGui
.
QApplication
([])
from
pyqtgraph.parametertree
import
Parameter
,
ParameterTree
,
registerParameterType
params
=
[
{
'name'
:
'397 laser parameters'
,
'type'
:
'group'
,
'children'
:
[
{
'name'
:
'piezoA'
,
'type'
:
'float'
,
'value'
:
0
,
'step'
:
0.05
,
'limits'
:
(
-
1
,
1
),
'siPrefix'
:
True
,
'suffix'
:
'V'
},
{
'name'
:
'piezoB'
,
'type'
:
'float'
,
'value'
:
0
,
'step'
:
0.05
,
'limits'
:
(
-
1
,
1
),
'siPrefix'
:
True
,
'suffix'
:
'V'
},
{
'name'
:
'shutter1'
,
'type'
:
'bool'
,
'value'
:
True
,
'tip'
:
"This is a checkbox"
},
{
'name'
:
'shutter2'
,
'type'
:
'bool'
,
'value'
:
True
,
'tip'
:
"This is a checkbox"
},
]},
{
'name'
:
'866 laser parameters'
,
'type'
:
'group'
,
'children'
:
[
{
'name'
:
'piezoA'
,
'type'
:
'float'
,
'value'
:
0
,
'step'
:
0.05
,
'limits'
:
(
-
1
,
1
),
'siPrefix'
:
True
,
'suffix'
:
'V'
},
{
'name'
:
'piezoB'
,
'type'
:
'float'
,
'value'
:
0
,
'step'
:
0.05
,
'limits'
:
(
-
1
,
1
),
'siPrefix'
:
True
,
'suffix'
:
'V'
},
{
'name'
:
'shutter1'
,
'type'
:
'bool'
,
'value'
:
True
,
'tip'
:
"This is a checkbox"
},
{
'name'
:
'shutter2'
,
'type'
:
'bool'
,
'value'
:
True
,
'tip'
:
"This is a checkbox"
},
]},
{
'name'
:
'423 laser parameters'
,
'type'
:
'group'
,
'children'
:
[
{
'name'
:
'piezo'
,
'type'
:
'float'
,
'value'
:
0
,
'step'
:
0.05
,
'limits'
:
(
-
1
,
1
),
'siPrefix'
:
True
,
'suffix'
:
'V'
},
{
'name'
:
'shutter1'
,
'type'
:
'bool'
,
'value'
:
True
,
'tip'
:
"This is a checkbox"
},
]},
{
'name'
:
'Save/Restore functionality'
,
'type'
:
'group'
,
'children'
:
[
{
'name'
:
'Save State'
,
'type'
:
'action'
},
{
'name'
:
'Restore State'
,
'type'
:
'action'
,
'children'
:
[
{
'name'
:
'Add missing items'
,
'type'
:
'bool'
,
'value'
:
True
},
{
'name'
:
'Remove extra items'
,
'type'
:
'bool'
,
'value'
:
True
},
]},
]},
]
## Create tree of Parameter objects
p
=
Parameter
.
create
(
name
=
'params'
,
type
=
'group'
,
children
=
params
)
## If anything changes in the tree, print a message
def
change
(
param
,
changes
):
print
(
"tree changes:"
)
for
param
,
change
,
data
in
changes
:
path
=
p
.
childPath
(
param
)
if
path
is
not
None
:
childName
=
'.'
.
join
(
path
)
else
:
childName
=
param
.
name
()
print
(
' parameter:
%
s'
%
childName
)
print
(
' change:
%
s'
%
change
)
print
(
' data:
%
s'
%
str
(
data
))
print
(
' ----------'
)
p
.
sigTreeStateChanged
.
connect
(
change
)
def
valueChanging
(
param
,
value
):
print
(
"Value changing (not finalized):
%
s
%
s"
%
(
param
,
value
))
def
save
():
global
state
state
=
p
.
saveState
()
def
restore
():
global
state
add
=
p
[
'Save/Restore functionality'
,
'Restore State'
,
'Add missing items'
]
rem
=
p
[
'Save/Restore functionality'
,
'Restore State'
,
'Remove extra items'
]
p
.
restoreState
(
state
,
addChildren
=
add
,
removeChildren
=
rem
)
p
.
param
(
'Save/Restore functionality'
,
'Save State'
)
.
sigActivated
.
connect
(
save
)
p
.
param
(
'Save/Restore functionality'
,
'Restore State'
)
.
sigActivated
.
connect
(
restore
)
## Create two ParameterTree widgets, both accessing the same data
t
=
ParameterTree
()
t
.
setParameters
(
p
,
showTop
=
False
)
t
.
setWindowTitle
(
'pyqtgraph example: Parameter Tree'
)
win
=
QtGui
.
QWidget
()
layout
=
QtGui
.
QGridLayout
()
win
.
setLayout
(
layout
)
layout
.
addWidget
(
QtGui
.
QLabel
(
"These are two views of the same data. They should always display the same values."
),
0
,
0
,
1
,
2
)
layout
.
addWidget
(
t
,
1
,
0
,
1
,
1
)
win
.
show
()
win
.
resize
(
800
,
800
)
## test save/restore
s
=
p
.
saveState
()
p
.
restoreState
(
s
)
## Start Qt event loop unless running in interactive mode or using pyside.
if
__name__
==
'__main__'
:
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
QtGui
.
QApplication
.
instance
()
.
exec_
()
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