Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DynamicAttributes
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
spe
ds
DynamicAttributes
Commits
fe09935e
Commit
fe09935e
authored
3 years ago
by
Martin Scarcia
Browse files
Options
Downloads
Patches
Plain Diff
added load cfg command
parent
45eb1d2a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dynamic-srv.py
+32
-1
32 additions, 1 deletion
src/dynamic-srv.py
with
32 additions
and
1 deletion
src/dynamic-srv.py
+
32
−
1
View file @
fe09935e
...
...
@@ -11,6 +11,7 @@ from collections import UserDict
import
PyTango
import
numpy
as
np
import
importlib
import
shutil
def
fromPyTango2NumpyType
(
pytango_type
):
"""
Return the numpy type based on the PyTango type
...
...
@@ -503,7 +504,37 @@ class Dynamic(PyTango.Device_4Impl):
self
.
myattrs
=
CaseLessDict
()
self
.
read_functions
=
CaseLessDict
()
self
.
write_functions
=
CaseLessDict
()
#------------------------------------------------------------------
# Load config from remote location
#------------------------------------------------------------------
def
LoadCfgFile
(
self
,
argin
):
"""
Load the file content as a String. Overwrite the existing cfg file.
:param argin: file content as String.
:type: PyTango.DevString
:return:
:rtype: PyTango.DevVoid
"""
# self.debug_stream("In LoadWorkingFile()")
if
len
(
self
.
attr_WorkingFile_read
)
==
0
:
self
.
error_stream
(
'
WorkingFile not defined, cannot procede.
'
)
self
.
set_status
(
'
WorkingFile not defined, cannot procede.
'
)
return
file_name
=
self
.
ConfiguratorScript
if
os
.
path
.
isfile
(
file_name
):
# File exists
backup_file
=
file_name
+
'
.bak
'
shutil
.
copyfile
(
file_name
,
backup_file
)
try
:
conf_file
=
open
(
file_name
,
'
w
'
)
conf_file
.
write
(
argin
)
self
.
debug_stream
(
'
Wrote file
'
+
file_name
)
except
Exception
as
ex
:
self
.
error_stream
(
'
Unable to write file
'
+
file_name
+
'
:
'
+
str
(
ex
))
self
.
set_status
(
'
Unable to write file
'
+
self
.
ConfiguratorScript
)
finally
:
conf_file
.
close
()
#==================================================================
#
# DynamicClass class utilities
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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