taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

Make TaurusValue store third party subwidgets classID #1066

Closed AlejandroAMarin closed 4 years ago

AlejandroAMarin commented 4 years ago

Taurus doesn't store configs that don't have a classID. This is necessary to use third party subwidgets like Sardana poolmotor subwidgets. Instead of forcing taurus to store config subwidgets without classID like it was proposed on PR #1063 . We modify taurus to create classIDs from the class module and name. When appliying config, the created classID is used to restore the previous class wrapper. Fixes #840 and Fixes https://github.com/sardana-org/sardana/issues/1164

Example of ini file result on WriteWidget: PR #1063

{'delegate': {'__orderedConfigNames__': ['modifiableByUser', 'ModelInConfig', 'formatter', 'AbsRelindex'], '__pickable__': True, 'ConfigVersion': '__UNVERSIONED__', '__itemConfigurations__': {'formatter': 'taurus.qt.qtgui.base.taurusbase.defaultFormatter', 'ModelInConfig': False, 'modifiableByUser': False, 'AbsRelindex': 1}}}

This PR

{'delegate': {'ConfigVersion': '__UNVERSIONED__', '__orderedConfigNames__': ['modifiableByUser', 'ModelInConfig', 'formatter', 'AbsRelindex'], '__itemConfigurations__': {'formatter': 'taurus.qt.qtgui.base.taurusbase.defaultFormatter', 'AbsRelindex': 1, 'modifiableByUser': False, 'ModelInConfig': False}, '__pickable__': True}, 'classid': 'sardana.taurus.qt.qtgui.extra_pool.poolmotor:PoolMotorTVWriteWidget'}
AlejandroAMarin commented 4 years ago

Tested the changes with taurusgui. Everything seems to work correctly.

reszelaz commented 4 years ago

The TOXENV=py27-qt5 travis-ci job fails (we tried to restart it three times):

Worker information
0.14s0.01s0.00s0.02s
system_info
Build system information
0.09s0.01s0.76s0.00s0.00s6.03s0.00s2.41s0.00s2.22s
docker_mtu
resolvconf
services
0.01s$ sudo systemctl start docker
git.checkout
3.20s$ git clone --depth=50 https://github.com/taurus-org/taurus.git taurus-org/taurus
0.01s
Setting environment variables from .travis.yml
$ export TOXENV=py27-qt5
0.00s$ source ~/virtualenv/python3.6/bin/activate
$ python --version
Python 3.6.7
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pip (python 3.6)
before_install.1
0.73s$ wget -nv https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
before_install.2
5.78s$ bash miniconda.sh -b -p $HOME/miniconda
before_install.3
0.00s$ export PATH="$HOME/miniconda/bin:$PATH"
before_install.4
0.00s$ hash -r
before_install.5
0.11s$ conda config --set always_yes yes --set changeps1 no
before_install.6
6.05s$ conda update -q conda
before_install.7
0.31s$ conda info -a
before_install.8
$ if [[ "$TOXENV" == "flake8" ]]; then echo "Skipping tango initialization"; else docker-compose -f ci/tango_docker-compose.yml up -d; echo 'TANGO_HOST=localhost:10000' >> $HOME/.tangorc; fi
install
3.44s$ pip install -U tox tox-conda
120.78s$ tox
GLOB sdist-make: /home/travis/build/taurus-org/taurus/setup.py
py27-qt5 create: /home/travis/build/taurus-org/taurus/.tox/py27-qt5
py27-qt5 installcondadeps: pyqt=5, pytango, pyepics, guidata, cython, lxml, future, pillow, pint, ply, pyqtgraph, pythonqwt, numpy, scipy, pymca, click, spyder, pytest, pytest-xvfb, flaky
py27-qt5 installdeps: guiqwt
py27-qt5 inst: /home/travis/build/taurus-org/taurus/.tox/.tmp/package/1/taurus-4.6.5a0.zip
py27-qt5 installed: DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support,alabaster==0.7.12,astroid==1.6.5,attrs==19.3.0,Babel==2.8.0,backports-abc==0.5,backports.functools-lru-cache==1.6.1,backports.shutil-get-terminal-size==1.0.0,bleach==3.1.0,certifi==2019.11.28,chardet==3.0.4,Click==7.0,cloudpickle==1.3.0,configparser==3.7.3,Cython==0.29.15,decorator==4.4.1,defusedxml==0.6.0,docutils==0.16,EasyProcess==0.2.10,entrypoints==0.3,enum34==1.1.6,epicscorelibs==7.0.3.99.2.0,fisx==1.1.7,flaky==3.6.1,funcsigs==1.0.2,functools32==3.2.3.post2,future==0.18.2,futures==3.3.0,guidata==1.7.6,guiqwt==3.0.3,h5py==2.10.0,imagesize==1.2.0,importlib-metadata==0.5,ipykernel==4.10.0,ipython==5.8.0,ipython-genutils==0.2.0,isort==4.3.21,jedi==0.16.0,Jinja2==2.11.1,jsonschema==3.2.0,jupyter-client==5.3.4,jupyter-core==4.6.2,lazy-object-proxy==1.4.3,linecache2==1.0.0,lxml==3.8.0,MarkupSafe==1.1.1,mccabe==0.6.1,mistune==0.8.4,nbconvert==5.6.1,nbformat==4.4.0,numpy==1.16.5,numpydoc==0.9.2,olefile==0.46,packaging==20.1,pandocfilters==1.4.2,parso==0.6.1,pathlib2==2.3.5,pexpect==4.8.0,pickleshare==0.7.5,Pillow==6.2.1,Pint==0.9,ply==3.11,prompt-toolkit==1.0.15,psutil==5.6.7,ptyprocess==0.6.0,py==1.8.1,pycodestyle==2.5.0,pyepics==3.4.1,pyflakes==2.1.1,Pygments==2.5.2,pylint==1.8.4,PyMca5==5.5.4,pyparsing==2.4.6,pyqtgraph==0.11.0rc0,pyrsistent==0.15.7,pytango==9.3.1,pytest==3.2.2,pytest-xvfb==1.2.0,python-dateutil==2.8.1,PythonQwt==0.5.5,pytz==2019.3,PyVirtualDisplay==0.2.5,pyzmq==18.1.1,QtAwesome==0.7.0,qtconsole==4.6.0,QtPy==1.9.0,requests==2.12.5,rope==0.16.0,scandir==1.10.0,scipy==1.2.1,selectors2==2.0.1,simplegeneric==0.8.1,singledispatch==3.4.0.3,six==1.14.0,snowballstemmer==2.0.0,Sphinx==1.8.5,sphinxcontrib-websupport==1.1.2,spyder==3.3.6,spyder-kernels==0.5.2,taurus==4.6.5a0,testpath==0.4.4,tornado==5.1.1,traceback2==1.4.0,traitlets==4.3.3,typing==3.7.4.1,unittest2==1.1.0,wcwidth==0.1.8,webencodings==0.5.1,wrapt==1.12.0,wurlitzer==2.0.0
py27-qt5 run-test-pre: PYTHONHASHSEED='582632169'
py27-qt5 run-test: commands[0] | python -m pytest lib/taurus
============================= test session starts ==============================
platform linux2 -- Python 2.7.15, pytest-3.2.2, py-1.8.1, pluggy-0.4.0
rootdir: /home/travis/build/taurus-org/taurus, inifile:
plugins: xvfb-1.2.0, flaky-3.6.1
collected 589 items / 2 errors                                                  
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/main.py", line 110, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/main.py", line 145, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/main.py", line 155, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/main.py", line 648, in perform_collect
INTERNALERROR>     config=self.config, items=items)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/travis/build/taurus-org/taurus/.tox/py27-qt5/lib/python2.7/site-packages/pytest_xvfb.py", line 104, in pytest_collection_modifyitems
INTERNALERROR>     if item.get_closest_marker('no_xvfb') and item.config.xvfb is not None:
INTERNALERROR> AttributeError: 'TestCaseFunction' object has no attribute 'get_closest_marker'
=========================== 2 error in 1.62 seconds ============================
ERROR: InvocationError for command /home/travis/build/taurus-org/taurus/.tox/py27-qt5/bin/python -m pytest lib/taurus (exited with code 3)
___________________________________ summary ____________________________________
ERROR:   py27-qt5: commands failed
The command "tox" exited with 1.
Done. Your build exited with 1.

As agreed with @cpascual we merge it anyway. Thanks!