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
63fbc7da
Commit
63fbc7da
authored
May 11, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
camera parameters now in a layout with a grid, which includes the tree
parent
00659812
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
20 deletions
+93
-20
cameraGui.py
cameraGui.py
+7
-6
cameraParameterFrame.py
subclasses/cameraParameterFrame.py
+75
-0
cameraParameterTree.py
subclasses/cameraParameterTree.py
+11
-14
No files found.
cameraGui.py
View file @
63fbc7da
...
...
@@ -14,8 +14,8 @@ from pyqtgraph import console
from
subclasses.pyqtgraph_subclasses
import
CustomRectangularROI
from
zylaCameraWorker
import
CameraWorker
from
subclasses.cameraParameterTree
import
CameraParameterTree
from
subclasses.controllayouts
import
LaserControlLayout
,
LaserScanLayout
from
subclasses.cameraParameterFrame
import
CameraParameterFrame
from
resources.scanFunctions
import
create_measurement_array
from
measurement
import
MeasurementFrame
import
sys
...
...
@@ -76,9 +76,10 @@ class CameraGuiMainWindow(QMainWindow):
self
.
label
=
QLabel
(
"Counter of frames"
)
self
.
dCameraView
.
addWidget
(
self
.
label
)
self
.
param_tree
=
CameraParameterTree
(
self
.
win
)
self
.
param_tree
.
load
()
self
.
dCameraControl
.
addWidget
(
self
.
param_tree
.
t
)
#self.param_tree = CameraParameterTree()
self
.
cameraParamFrame
=
CameraParameterFrame
()
self
.
cameraParamFrame
.
paramTree
.
load
()
self
.
dCameraControl
.
addWidget
(
self
.
cameraParamFrame
)
# layouts and viewboxes
self
.
ImageLayout
=
pg
.
GraphicsLayoutWidget
()
...
...
@@ -136,7 +137,7 @@ class CameraGuiMainWindow(QMainWindow):
self
.
console
=
console
.
ConsoleWidget
(
namespace
=
{
'np'
:
np
,
'cam'
:
backend
.
cam
,
'roi'
:
self
.
rois
[
0
],
'storage'
:
backend
.
storage
,
'param_tree'
:
self
.
param_t
ree
'storage'
:
backend
.
storage
,
'param_tree'
:
self
.
cameraParamFrame
.
paramT
ree
}
)
self
.
dConsole
.
addWidget
(
self
.
console
)
...
...
@@ -201,7 +202,7 @@ class CameraGuiMainWindow(QMainWindow):
old_size
=
self
.
current_image_size
aux_dict
=
{
'1x1'
:
2048
,
'2x2'
:
1024
,
'4x4'
:
512
,
'8x8'
:
256
}
new_size
=
aux_dict
[
self
.
param_t
ree
.
p
.
child
(
'Basic acq parameters'
)
self
.
cameraParamFrame
.
paramT
ree
.
p
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()
]
print
(
'sizes:'
,
old_size
,
new_size
)
...
...
subclasses/cameraParameterFrame.py
0 → 100644
View file @
63fbc7da
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 11 11:22:27 2019
@author: martindrech
"""
from
PyQt5
import
QtWidgets
from
PyQt5
import
QtGui
from
subclasses.cameraParameterTree
import
CameraParameterTree
import
pyqtgraph
as
pg
class
CameraParameterFrame
(
QtWidgets
.
QFrame
):
def
__init__
(
self
):
super
()
.
__init__
()
self
.
grid
=
QtWidgets
.
QGridLayout
()
self
.
setLayout
(
self
.
grid
)
self
.
paramTree
=
CameraParameterTree
()
self
.
grid
.
addWidget
(
self
.
paramTree
.
t
,
0
,
0
,
1
,
2
)
self
.
saveButton
=
QtWidgets
.
QPushButton
(
'Save'
)
self
.
loadButton
=
QtWidgets
.
QPushButton
(
'Load'
)
self
.
saveToButton
=
QtWidgets
.
QPushButton
(
'Save To'
)
self
.
loadFromButton
=
QtWidgets
.
QPushButton
(
'Load From'
)
self
.
grid
.
addWidget
(
self
.
saveButton
,
1
,
0
)
self
.
grid
.
addWidget
(
self
.
loadButton
,
1
,
1
)
self
.
grid
.
addWidget
(
self
.
saveToButton
,
2
,
0
)
self
.
grid
.
addWidget
(
self
.
loadFromButton
,
2
,
1
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi X Position'
),
3
,
0
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi Y Position'
),
3
,
1
)
self
.
RoiXPosSb
=
pg
.
SpinBox
()
self
.
RoiYPosSb
=
pg
.
SpinBox
()
self
.
grid
.
addWidget
(
self
.
RoiXPosSb
,
4
,
0
)
self
.
grid
.
addWidget
(
self
.
RoiYPosSb
,
4
,
1
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi X Size'
),
5
,
0
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi Y Size'
),
5
,
1
)
self
.
RoiXPosSb
=
pg
.
SpinBox
()
self
.
RoiYPosSb
=
pg
.
SpinBox
()
self
.
grid
.
addWidget
(
self
.
RoiXPosSb
,
6
,
0
)
self
.
grid
.
addWidget
(
self
.
RoiYPosSb
,
6
,
1
)
self
.
make_connections
()
self
.
show
()
def
make_connections
(
self
):
self
.
saveButton
.
clicked
.
connect
(
self
.
paramTree
.
save
)
self
.
loadButton
.
clicked
.
connect
(
self
.
paramTree
.
load
)
self
.
saveToButton
.
clicked
.
connect
(
self
.
paramTree
.
save_to
)
self
.
loadFromButton
.
clicked
.
connect
(
self
.
paramTree
.
load_from
)
if
__name__
==
'__main__'
:
import
sys
app
=
QtWidgets
.
QApplication
([])
frame
=
CameraParameterFrame
()
frame
.
resize
(
300
,
600
)
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
subclasses/cameraParameterTree.py
View file @
63fbc7da
...
...
@@ -56,25 +56,22 @@ class BasicActionParameters(pTypes.GroupParameter):
class
CameraParameterTree
(
ParameterTree
):
def
__init__
(
self
,
win
):
def
__init__
(
self
):
super
()
.
__init__
()
self
.
win
=
win
self
.
params
=
[
BasicAcquisitonParameters
(
name
=
'Basic acq parameters'
),
BasicActionParameters
(
name
=
'Actions'
)
]
BasicAcquisitonParameters
(
name
=
'Basic acq parameters'
)]
self
.
p
=
Parameter
.
create
(
name
=
'params'
,
type
=
'group'
,
children
=
self
.
params
)
#self.p.sigTreeStateChanged.connect(self.change)
self
.
t
=
ParameterTree
()
self
.
t
.
setParameters
(
self
.
p
,
showTop
=
False
)
self
.
t
.
setWindowTitle
(
'Parameter Tree'
)
self
.
p
.
param
(
'Actions'
,
'Save State'
)
.
sigActivated
.
connect
(
lambda
:
self
.
save
())
self
.
p
.
param
(
'Actions'
,
'Load State'
)
.
sigActivated
.
connect
(
lambda
:
self
.
load
())
self
.
p
.
param
(
'Actions'
,
'Save State To'
)
.
sigActivated
.
connect
(
lambda
:
self
.
save_to
())
self
.
p
.
param
(
'Actions'
,
'Load State From'
)
.
sigActivated
.
connect
(
lambda
:
self
.
load_from
())
self
.
p
.
param
(
'Actions'
,
'Update State'
)
.
sigActivated
.
connect
(
self
.
print_params
)
# self.save()
#
self.p.param('Actions', 'Save State').sigActivated.connect(lambda: self.save())
#
self.p.param('Actions', 'Load State').sigActivated.connect(lambda: self.load())
#
self.p.param('Actions', 'Save State To').sigActivated.connect(lambda: self.save_to())
#
self.p.param('Actions', 'Load State From').sigActivated.connect(lambda: self.load_from())
#
self.p.param('Actions', 'Update State').sigActivated.connect(self.print_params)
#
# self.save()
def
change
(
self
,
param
,
changes
):
print
(
"tree changes:"
)
...
...
@@ -114,7 +111,7 @@ class CameraParameterTree(ParameterTree):
settings
.
endGroup
()
def
save_to
(
self
):
name
=
QFileDialog
.
getSaveFileName
(
self
.
win
,
'Save File'
)
name
=
QFileDialog
.
getSaveFileName
(
self
,
'Save File'
)
if
not
name
[
0
]:
print
(
'Saving was canceled'
)
return
0
...
...
@@ -124,7 +121,7 @@ class CameraParameterTree(ParameterTree):
self
.
save
(
filename
)
def
load_from
(
self
):
name
=
QFileDialog
.
getOpenFileName
(
self
.
win
,
'Open File'
)
name
=
QFileDialog
.
getOpenFileName
(
self
,
'Open File'
)
if
not
name
[
0
]:
print
(
'Opening was canceled'
)
return
0
...
...
@@ -140,7 +137,7 @@ if __name__ == '__main__':
win
=
QtGui
.
QWidget
()
layout
=
QtGui
.
QGridLayout
()
win
.
setLayout
(
layout
)
param_tree
=
CameraParameterTree
(
win
)
param_tree
=
CameraParameterTree
()
layout
.
addWidget
(
QtGui
.
QLabel
(
"Explanation of parameter tree."
),
0
,
0
,
1
,
2
)
layout
.
addWidget
(
param_tree
.
t
)
win
.
show
()
...
...
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