Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
calng
Commits
9b8eb7f8
Commit
9b8eb7f8
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Rudimentary overview scene starting for manager
parent
9e1c4a12
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!12
Snapshot: field test deployed version as of end of run 202201
,
!3
Base correction device, CalCat interaction, DSSC and AGIPD devices
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/calng/CalibrationManager.py
+27
-1
27 additions, 1 deletion
src/calng/CalibrationManager.py
src/calng/scenes.py
+37
-1
37 additions, 1 deletion
src/calng/scenes.py
with
64 additions
and
2 deletions
src/calng/CalibrationManager.py
+
27
−
1
View file @
9b8eb7f8
...
@@ -23,7 +23,7 @@ from karabo.middlelayer import (
...
@@ -23,7 +23,7 @@ from karabo.middlelayer import (
KaraboError
,
Device
,
DeviceClientBase
,
Descriptor
,
Hash
,
Configurable
,
KaraboError
,
Device
,
DeviceClientBase
,
Descriptor
,
Hash
,
Configurable
,
Slot
,
Node
,
Type
,
Slot
,
Node
,
Type
,
AccessMode
,
AccessLevel
,
Assignment
,
DaqPolicy
,
State
,
Unit
,
AccessMode
,
AccessLevel
,
Assignment
,
DaqPolicy
,
State
,
Unit
,
UInt16
,
UInt32
,
Bool
,
Double
,
String
,
VectorString
,
VectorHash
,
UInt16
,
UInt32
,
Bool
,
Double
,
Schema
,
String
,
VectorString
,
VectorHash
,
background
,
call
,
callNoWait
,
setNoWait
,
sleep
,
instantiate
,
slot
,
coslot
,
background
,
call
,
callNoWait
,
setNoWait
,
sleep
,
instantiate
,
slot
,
coslot
,
getDevice
,
getTopology
,
getConfiguration
,
getConfigurationFromPast
,
getDevice
,
getTopology
,
getConfiguration
,
getConfigurationFromPast
,
get_property
)
get_property
)
...
@@ -31,6 +31,7 @@ from karabo.middlelayer_api.proxy import ProxyFactory
...
@@ -31,6 +31,7 @@ from karabo.middlelayer_api.proxy import ProxyFactory
from
karabo
import
version
as
karaboVersion
from
karabo
import
version
as
karaboVersion
from
._version
import
version
as
deviceVersion
from
._version
import
version
as
deviceVersion
from
.
import
scenes
'''
'''
...
@@ -302,6 +303,28 @@ class CalibrationManager(DeviceClientBase, Device):
...
@@ -302,6 +303,28 @@ class CalibrationManager(DeviceClientBase, Device):
else
[]),
else
[]),
accessMode
=
AccessMode
.
READONLY
)
accessMode
=
AccessMode
.
READONLY
)
availableScenes
=
VectorString
(
displayedName
=
'
Available scenes
'
,
displayType
=
'
Scenes
'
,
requiredAccessLevel
=
AccessLevel
.
OBSERVER
,
accessMode
=
AccessMode
.
READONLY
,
defaultValue
=
[
'
overview
'
],
daqPolicy
=
DaqPolicy
.
OMIT
)
@slot
def
requestScene
(
self
,
params
):
name
=
params
.
get
(
'
name
'
,
default
=
'
overview
'
)
if
name
==
'
overview
'
:
# Assumes there are correction devices known to manager
scene_data
=
scenes
.
manager_device_overview_scene
(
self
.
deviceId
,
self
.
_correction_device_schema
,
self
.
_correction_device_ids
)
payload
=
Hash
(
'
success
'
,
True
,
'
name
'
,
name
,
'
data
'
,
scene_data
)
return
Hash
(
'
type
'
,
'
deviceScene
'
,
'
origin
'
,
self
.
deviceId
,
'
payload
'
,
payload
)
detectorType
=
String
(
detectorType
=
String
(
displayedName
=
'
Detector type
'
,
displayedName
=
'
Detector type
'
,
description
=
'
Type of the detector to manage.
'
,
description
=
'
Type of the detector to manage.
'
,
...
@@ -591,6 +614,9 @@ class CalibrationManager(DeviceClientBase, Device):
...
@@ -591,6 +614,9 @@ class CalibrationManager(DeviceClientBase, Device):
# Obtain the device schema from a correction device server.
# Obtain the device schema from a correction device server.
managed_schema
,
_
,
_
=
await
call
(
corr_server
,
'
slotGetClassSchema
'
,
managed_schema
,
_
,
_
=
await
call
(
corr_server
,
'
slotGetClassSchema
'
,
self
.
_correction_class_id
)
self
.
_correction_class_id
)
# saving this for later
self
.
_correction_device_schema
=
Schema
()
self
.
_correction_device_schema
.
copy
(
managed_schema
)
if
managed_schema
.
name
!=
self
.
_correction_class_id
:
if
managed_schema
.
name
!=
self
.
_correction_class_id
:
self
.
_set_fatal
(
self
.
_set_fatal
(
...
...
This diff is collapsed.
Click to expand it.
src/calng/scenes.py
+
37
−
1
View file @
9b8eb7f8
...
@@ -355,6 +355,9 @@ class CorrectionDeviceStatus:
...
@@ -355,6 +355,9 @@ class CorrectionDeviceStatus:
class
CompactCorrectionDeviceOverview
:
class
CompactCorrectionDeviceOverview
:
def
__init__
(
self
,
device_id
,
schema_hash
):
def
__init__
(
self
,
device_id
,
schema_hash
):
self
.
name
=
LabelModel
(
text
=
device_id
.
split
(
"
/
"
)[
-
1
],
width
=
5
*
BASE_INC
,
height
=
BASE_INC
)
self
.
status
=
DisplayStateColorModel
(
self
.
status
=
DisplayStateColorModel
(
show_string
=
True
,
show_string
=
True
,
keys
=
[
f
"
{
device_id
}
.state
"
],
keys
=
[
f
"
{
device_id
}
.state
"
],
...
@@ -375,6 +378,9 @@ class CompactCorrectionDeviceOverview:
...
@@ -375,6 +378,9 @@ class CompactCorrectionDeviceOverview:
self
.
ampeln
=
ConstantLoadedAmpeln
(
device_id
,
schema_hash
)
self
.
ampeln
=
ConstantLoadedAmpeln
(
device_id
,
schema_hash
)
def
render
(
self
,
x
,
y
):
def
render
(
self
,
x
,
y
):
self
.
name
.
x
=
x
self
.
name
.
y
=
y
x
+=
self
.
name
.
width
self
.
status
.
x
=
x
self
.
status
.
x
=
x
self
.
status
.
y
=
y
self
.
status
.
y
=
y
x
+=
self
.
status
.
width
x
+=
self
.
status
.
width
...
@@ -384,7 +390,13 @@ class CompactCorrectionDeviceOverview:
...
@@ -384,7 +390,13 @@ class CompactCorrectionDeviceOverview:
self
.
tid
.
x
=
x
self
.
tid
.
x
=
x
self
.
tid
.
y
=
y
self
.
tid
.
y
=
y
x
+=
self
.
tid
.
width
x
+=
self
.
tid
.
width
return
[
self
.
status
,
self
.
rate
,
self
.
tid
]
+
self
.
ampeln
.
render
(
x
,
y
)
return
[
self
.
name
,
self
.
status
,
self
.
rate
,
self
.
tid
]
+
self
.
ampeln
.
render
(
x
,
y
)
def
width
(
self
):
return
19
*
BASE_INC
+
self
.
ampeln
.
width
()
def
height
(
self
):
return
BASE_INC
def
correction_device_overview_scene
(
device_id
,
schema
):
def
correction_device_overview_scene
(
device_id
,
schema
):
...
@@ -416,3 +428,27 @@ def correction_device_overview_scene(device_id, schema):
...
@@ -416,3 +428,27 @@ def correction_device_overview_scene(device_id, schema):
children
=
subscenes
,
children
=
subscenes
,
)
)
return
write_scene
(
scene
)
return
write_scene
(
scene
)
def
manager_device_overview_scene
(
manager_device_id
,
correction_device_schema
,
correction_device_ids
):
if
isinstance
(
correction_device_schema
,
karathon
.
Schema
):
schema_hash
=
correction_device_schema
.
getParameterHash
()
else
:
schema_hash
=
correction_device_schema
.
hash
x
=
PADDING
y
=
PADDING
subscenes
=
[]
for
device_id
in
correction_device_ids
:
ccdo
=
CompactCorrectionDeviceOverview
(
device_id
,
schema_hash
)
subscenes
.
extend
(
ccdo
.
render
(
x
,
y
))
y
+=
ccdo
.
height
()
scene
=
SceneModel
(
height
=
y
+
2
*
PADDING
,
width
=
ccdo
.
width
()
+
2
*
PADDING
,
children
=
subscenes
,
)
return
write_scene
(
scene
)
This diff is collapsed.
Click to expand it.
David Hammer
@hammerd
mentioned in commit
3566342d
·
2 years ago
mentioned in commit
3566342d
mentioned in commit 3566342d031db1bb435b6430f100afdbaaa6c4bf
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment