281 Commits

Author SHA1 Message Date
l_samenv
10dad6da47 client: change online state before callback
the client in NICOS is referring to the online state within the
callback.

+ better error handling
2021-04-08 10:11:04 +02:00
48230334af fix inheritance problem with mixin
- a mixin should not inherit from module then it has Parameters
- Parameters in mixins must be complete, not just overrides
- check precedence of read_<param> or handler

Change-Id: I72d9355a1982770d1a99d9552a20330103c97edb
2021-03-18 13:32:54 +01:00
fb01f81cb6 fix user friendly reporting of config errors
Change-Id: I42ec1ad2e18a0363fb7317c86743ff2f6665f049
2021-03-11 15:33:21 +01:00
3b03e578bb user friendly reporting of config errors
Config errors are collected first, and raised after processing
all modules. This is more user friendly.

+ remove redundant check for predefined accessibles in modules.py
+ fixed error handling for exporting parameters in params.py
+ fixed handling of bare attributes overwriting properties

Change-Id: I894bda291ab85ccec3d771c4903393c808af0a2a
2021-03-08 10:47:22 +01:00
804581546d user friendly reporting of config errors
Config errors are collected first, and raised after processing
all modules. This is more user friendly.

+ remove redundant check for predefined accessibles in modules.py
+ fixed error handling for exporting parameters in params.py
+ fixed handling of bare attributes overwriting properties

Change-Id: I894bda291ab85ccec3d771c4903393c808af0a2a
2021-03-08 10:33:20 +01:00
l_samenv
adc9a6da71 fixed bugs from syntax migration
- a new wrapper for a read function is not only to be created when
  the a new read method is in the class dict, but also when
  it is inherited, but not yet wrapped
- a handler must not be ignored, when a write method is inherited
- a proxy class must not call checkProperties

+ remove trailing spaces in tutorial_helevel.rst

Change-Id: I16024c14232ea200db91a1bc07ec23326219ab68
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25093
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-03-08 10:22:58 +01:00
l_samenv
1760881f56 fixed bugs from syntax migration
- a new wrapper for a read function is not only to be created when
  the a new read function is in the class dict, but also when
  it inherited, but not yet wrapped
- a proxy class must not call checkProperties
2021-03-03 14:40:36 +01:00
ffafd7344c removed obsolete files from merge
Change-Id: I98c6d06a680ef6885f38d4b3e6b3f51aa7ebd022
2021-03-03 10:19:59 +01:00
b4bb172ada Merge branch 'wip'
Change-Id: I3ba389775ce9b02269ca9c20a42ec1bddf6c5d21
2021-03-03 09:46:20 +01:00
4fd9c17bcb move historywriter to secop_psi
as historywriter currently could be used at psi only
secop_psi is a better place for it

+ add comment about a general config file

Change-Id: I9b0e74d3da83ac485bd4bcc13475695c3140822c
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25077
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-03-03 09:06:14 +01:00
12b0549cc0 merged master with work
Change-Id: Iedfb2bf7f28bfe45201adacec0645cc13abffe59
2021-03-03 09:00:45 +01:00
fee7c4904b added hook for optional history writer
- activated with envrionment variable FRAPPY_HISTORY
- using the (currently) private package 'frappyhistory'

Change-Id: I8f747b29d8311af677ed77268a4c38c8d71b08c2
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25064
Tested-by: Markus Zolliker <markus.zolliker@psi.ch>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
3141e22894 lookup cfg files in a list of directories
environment variable SECOP_CONFDIR may be a ':' separated
list of directories to lookup for cfg files

Change-Id: I058be6a270d3a3f6cd8ca45fdd4ab68c80fa5c23
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25063
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
fbccd0f9b7 remove obsolete code
- basic_validators is not needed any more since the implementation
  of datatypes.Stub
- client/baseclient.y is replaced by client/__init__.py both for
  the gui client and NICOS SECoP client
- lib/parsing.py used by baseclient only

Change-Id: I15b6ac880017000e155b8f6b7e2456e1bbf56dab
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25058
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
9071a5bcf7 fix inheritance order
+ hide pollperiod on PPMS Modules

Change-Id: I77ad5502884360bf6babfd226de0675ee06a6196
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25054
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
1588703f99 try to follow PEP8
- fixed most important code after checking with flake8
- ignored code which has to be reworked or removed
+ mark unused code with 'TODO: remove ...'

Change-Id: Ic45e541049e391e2853d29cd64bb0963bd9a2125
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25053
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
2021-02-26 17:27:13 +01:00
fe041bac0a after running isort
Change-Id: I6d7dbb8dee9480fc9242529089a1b40f17f068e7
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25052
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
07b758c3dd removed old style syntax
- removed secop/metaclass.py
- moved code from ModuleMeta to modules.HasAccessibles.__init_subclass__
- reworked properties:
  assignment obj.property = value now always allowed
- reworked Parameters and Command to be true descriptors
- Command must now be solely used as decorator
- renamed 'usercommand' to 'Command'
- command methods no longer start with 'do_'
- reworked mechanism to determine accessible order:
  the attribute paramOrder, if given, determines order of accessibles
+ fixed some issues makeing the IDE more happy
+ simplified code for StatusType and added a test for it

Change-Id: I8045cf38ee6f4d4862428272df0b12a7c8abaca7
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25049
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
f9a2152883 enhance documentation
- flatten hierarchy (some links do not work when using folders)
- add a tutorial for programming a simple driver
- clean description using inspect.cleandoc
+ fix a bug with 'unit' pseudo property in a Parameter used as override

Change-Id: I31ddba5d516d1ee5e785e28fbd79fca44ed23f5e
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25000
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
25891f296d new syntax for parameter/commands/properties
New Syntax:

- define properties and parameters as class attributes directly
  instead of items in class attribute dicts
- define commands with decorator @usercommand(...)
- old syntax is still supported for now

still to do (with decreasing priority):
- turn parameters into descriptors (vs. creating getters/setters)
- migrate all existing code to new syntax
- get rid of or reduce code in metaclasses using __set_name__ and
  __init_subclass__ instead, including a fix for allowing py < 3.6

Change-Id: Id47e0f89c506f50c40fa518b01822c6e5bbf4e98
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/24991
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
0d1c7ba76f make arguments of Parameter and Override consistent
- allow (description and) datatype being positional args in Override
- disallow ctr and unit being a positional arg in Parameter
- disallow reorder being a positional arg in Override

Change-Id: Ic5711d091af11d5843943b0b2b31567127f8ed8c
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/24934
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
9df43bb940 make order of accessibles work again
- when applying overrides with reorder=True, take ctr from Override,
  else copy from the cloned Accesible. This did not work properly
- reworked:
  - replaced CountedObj class by object_counter
  - accessibles created by a copy or by applying Overrides
    do not need fresh counted values
- adjusted tests

Change-Id: Id2fcf1ab1295aa1ea80ea81ae8cd02d36f86e969
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/24926
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 17:27:13 +01:00
fa71b8ee25 added hook for optional history writer
- activated with envrionment variable FRAPPY_HISTORY
- using the (currently) private package 'frappyhistory'

Change-Id: I8f747b29d8311af677ed77268a4c38c8d71b08c2
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25064
Tested-by: Markus Zolliker <markus.zolliker@psi.ch>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 15:29:44 +01:00
dbc6f17e5e lookup cfg files in a list of directories
environment variable SECOP_CONFDIR may be a ':' separated
list of directories to lookup for cfg files

Change-Id: I058be6a270d3a3f6cd8ca45fdd4ab68c80fa5c23
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25063
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 15:29:44 +01:00
0c23ee46a1 remove obsolete code
- basic_validators is not needed any more since the implementation
  of datatypes.Stub
- client/baseclient.y is replaced by client/__init__.py both for
  the gui client and NICOS SECoP client
- lib/parsing.py used by baseclient only

Change-Id: I15b6ac880017000e155b8f6b7e2456e1bbf56dab
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25058
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2021-02-26 15:29:44 +01:00
41baf5805f migrated secop_psi drivers to new syntax
- includes all changes up to 'fix inheritance order' from git_mlz
  6a32ecf34224c559ae558efd7c0d20078d09463b

Change-Id: Ie3ceee3dbd0a9284b47b1d5b5dbe262eebe8f283
2021-02-25 14:01:54 +01:00
bc5edec06f enhance documentation
- flatten hierarchy (some links do not work when using folders)
+ fix a bug with the redorder flag in Override
+ allow removal of parameters
+ clean description using inspect.cleandoc

Change-Id: I3dde4f4cb29c46e8a21014f1fad7aa3ad610a1bf
2021-01-25 15:12:47 +01:00
bc33933a1a update doc
- add properties, parameters and commands to the doc string autoatically
- change names to "Frappy"
- started tutorial
- changed doc structure slightly

Change-Id: I87bef91384d138c738d12ddcf3a1de7f758a0973
2021-01-19 17:20:53 +01:00
2d310bc612 TupleOf and StructOf create multiple curves
the components of TupleOf and StructOf are storead as separate
curves in history

Change-Id: I42ebf84653408de7148796763a4d4ea9dd309696
2021-01-12 15:41:06 +01:00
e0f9b4a858 add history writer
Change-Id: I2d577dcf0c543c26680d157be959b0a608ace759
2020-12-10 17:04:41 +01:00
l_samenv
569c0a3399 make arguments of Parameter and Override consistent
- allow description _and_ datatype being positional args
- disallow ctr, unit, reorder being positional
2020-12-04 13:28:04 +01:00
ad07ecdd69 fix typos in secop/modules.py doc
Change-Id: Idfbb85603b5efd0884ae9356dd96136c9c32ada1
2020-10-28 10:09:17 +01:00
cf24bbc3c3 improved doc on softcal and Module.registerCallback
Change-Id: I12b1f7a2d29435d989fb9953f72bea181e6cb4f7
2020-10-28 09:59:40 +01:00
25a887dcab fix initwrite behaviour
with handlers, a parameter from the cfg file which is not the
first of parameters with the same handler were not written.
fix: write_<param> method is called for all parameters in
<module>.writeDict even if there is no poll entry.

with this fix, when a parameter has the property initwrite=True,
the write_<param> method is called even when <param>
is not polled and even when <module>.pollerClass is None

Change-Id: I9b397deb5b20709fc4fa7c860c85b251a204c7f6
2020-10-28 08:35:01 +01:00
36ffb0a31f Merge branch 'mlz' into wip
Change-Id: I9dab1c32c4f0579f7f54bb68c60f7a8b14866652
2020-10-28 08:01:44 +01:00
4f1883ba27 fix initwrite behaviour
with handlers, a parameter from the cfg file which is not the
first of parameters with the same handler were not written.
fix: write_<param> method is called for all parameters in
<module>.writeDict even if there is no poll entry.

with this fix, when a parameter has the property initwrite=True,
the write_<param> method is called even when <param>
is not polled and even when <module>.pollerClass is None

Change-Id: I9b397deb5b20709fc4fa7c860c85b251a204c7f6
2020-09-25 13:28:12 +02:00
3043200012 fix initwrite behaviour
with handlers, a parameter from the cfg file which is not the
first of parameters with the same handler were not written.
fix: write_<param> method is called for all parameters in
<module>.writeDict even if there is no poll entry.

with this fix, when a parameter has the property initwrite=True,
the write_<param> method is called even when <param>
is not polled and even when <module>.pollerClass is None

Change-Id: I9b397deb5b20709fc4fa7c860c85b251a204c7f6
2020-09-25 12:05:16 +02:00
l_samenv
1b4865c608 Revert "support name mangling for parameter/command names"
This reverts commit 99bdafdd0c3293d17e3f23508d2b7762804474e7.
2020-09-25 11:30:23 +02:00
l_samenv
f7576cf541 fix initwrite behaviour
with handlers, a parameter from the cfg file which is not the
first of parameters with the same handler were not written.
fix: write_<param> method is called for all parameters in
<module>.writeDict even if there is no poll entry.

with this fix, the write_<method> is called even when a parameter
is not polled.
2020-09-25 11:19:17 +02:00
l_samenv
99bdafdd0c support name mangling for parameter/command names 2020-09-08 13:33:13 +02:00
l_samenv
ab21bb5e3f add timestamp to error reply 2020-09-08 13:32:18 +02:00
l_samenv
99e32065b1 simplyfy some error messages 2020-09-08 13:31:38 +02:00
l_samenv
c1ffc160a2 configurable search path for cfg files 2020-09-08 12:13:17 +02:00
7af4d572ab Param(..., initwrite=True) works only with poll=True
check this when creating a Parameter

Change-Id: I5d45f25fd67682de45b51c842323e9582f69e6e3
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23547
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2020-08-12 16:47:03 +02:00
2eb0aeba0d add readbytes method to AsynConn
+ flush_recv now also clears _rxbuffer

Change-Id: I33c7ea1a9a1d8b663e5cd3bd81cf7ad43448e0fa
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23548
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2020-08-12 16:46:48 +02:00
0641968715 add a lot of current stuff
this is not (yet) in the frm2 repo

Change-Id: Ia5b2996803c3dbb15b85ab1bc3a24717ac6297fb
2020-07-29 14:57:50 +02:00
aa4c8f1f04 improvements on PPMS and LS370
- PPMS: improved machanism for 10 K waiting
- LS370: fixed an issue with auto range
+ LS370: show test for all status bits

Change-Id: Ia6454141917893f0e5c6c4351df3a864942bb629
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23495
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2020-07-29 13:50:21 +02:00
a520e6e1e4 more flexible end_of_line in stringio
in the previous version, it was not possible to give a ASCII nul
character as end_of_line, because StringType refuses this

- end_of_line might be given as bytes, str or int
- end_of_line might be given as tuple (eol_read, eol_write)

Change-Id: I8b7942320ad3ffe162cdf3a673e113a66a84fb93
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23496
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2020-07-28 14:53:06 +02:00
d9a2045fca more flexible end_of_line in stringio
in the previous version, it was not possible to give a ASCII nul
character as end_of_line, because StringType refuses this

- end_of_line might be given as bytes, str or int
- end_of_line might be given as tuple (eol_read, eol_write)

Change-Id: I8b7942320ad3ffe162cdf3a673e113a66a84fb93
2020-07-23 16:12:14 +02:00
1655e252fc fix handling of StructOf datatype
- change secop.client.SecopClient to use native types instead of
  strings for its setParameter and execCommand methods.
- secop-gui: for now, setParameter accept strings for complex types.
  this should be changed to use native type in an other change
- fix bugs in parser.py

+ SecopClient: make visible in an error message that the error
  was generated on the SEC node
+ fix a bug when a command is called with 0 as argument

Change-Id: Id87d4678311ef8cf43a25153254d36127e16c6d9
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23299
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2020-07-06 15:46:37 +02:00