summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoutinho <coutinho@esrf.fr>2015-03-26 12:21:41 +0100
committercoutinho <coutinho@esrf.fr>2015-03-26 12:21:41 +0100
commit6f2a9f4d65212ef253a5ce6fc173d52b8a470c57 (patch)
tree674c3ba22a326794b20abf345ec5e01c102a1b11
parent3d39d0a483286c6cc6abc58d5514dc5390104736 (diff)
First commit in tauruslib. Restructure according to SEP10
-rw-r--r--.gitignore10
-rw-r--r--.mailmap26
-rw-r--r--LICENSE.txt (renamed from taurus/LICENSE.txt)0
-rw-r--r--MANIFEST.in20
-rw-r--r--doc/api_AllClasses.rst (renamed from taurus/doc/api_AllClasses.rst)0
-rw-r--r--doc/api_class.rst (renamed from taurus/doc/api_class.rst)0
-rw-r--r--doc/api_class_simple.rst (renamed from taurus/doc/api_class_simple.rst)0
-rw-r--r--doc/api_module.rst (renamed from taurus/doc/api_module.rst)0
-rw-r--r--doc/auto_rst4api.py (renamed from taurus/doc/auto_rst4api.py)0
-rw-r--r--doc/buildmock.py (renamed from taurus/doc/buildmock.py)0
-rw-r--r--doc/logo.bmpbin119070 -> 0 bytes
-rwxr-xr-xdoc/makeman (renamed from taurus/doc/makeman)0
-rw-r--r--doc/man/MacroServer.138
-rw-r--r--doc/man/Pool.138
-rw-r--r--doc/man/Sardana.138
-rw-r--r--doc/man/macroexecutor.136
-rw-r--r--doc/man/sequencer.136
-rw-r--r--doc/man/spock.1389
-rw-r--r--doc/man/tau2taurus.1 (renamed from taurus/doc/man/tau2taurus.1)0
-rw-r--r--doc/man/taurusconfigbrowser.1 (renamed from taurus/doc/man/taurusconfigbrowser.1)0
-rw-r--r--doc/man/tauruscurve.1 (renamed from taurus/doc/man/tauruscurve.1)0
-rw-r--r--doc/man/taurusdemo.1 (renamed from taurus/doc/man/taurusdemo.1)0
-rw-r--r--doc/man/taurusdesigner.1 (renamed from taurus/doc/man/taurusdesigner.1)0
-rw-r--r--doc/man/taurusdevicepanel.1 (renamed from taurus/doc/man/taurusdevicepanel.1)0
-rw-r--r--doc/man/taurusdoc.1 (renamed from taurus/doc/man/taurusdoc.1)0
-rw-r--r--doc/man/taurusform.1 (renamed from taurus/doc/man/taurusform.1)0
-rw-r--r--doc/man/taurusgui.1 (renamed from taurus/doc/man/taurusgui.1)0
-rw-r--r--doc/man/taurusimage.1 (renamed from taurus/doc/man/taurusimage.1)0
-rw-r--r--doc/man/tauruspanel.1 (renamed from taurus/doc/man/tauruspanel.1)0
-rw-r--r--doc/man/taurusplot.1 (renamed from taurus/doc/man/taurusplot.1)0
-rw-r--r--doc/man/taurusremotelogmonitor.1 (renamed from taurus/doc/man/taurusremotelogmonitor.1)0
-rw-r--r--doc/man/taurustrend.1 (renamed from taurus/doc/man/taurustrend.1)0
-rw-r--r--doc/man/taurustrend1d.1 (renamed from taurus/doc/man/taurustrend1d.1)0
-rw-r--r--doc/man/taurustrend2d.1 (renamed from taurus/doc/man/taurustrend2d.1)0
-rw-r--r--doc/man/taurusui.1 (renamed from taurus/doc/man/taurusui.1)0
-rw-r--r--doc/man/taurusuic4.1 (renamed from taurus/doc/man/taurusuic4.1)0
-rw-r--r--doc/mock.zip (renamed from taurus/doc/mock.zip)bin2128510 -> 2128510 bytes
-rw-r--r--doc/sketches/daqboard.pngbin390598 -> 0 bytes
-rw-r--r--doc/sketches/icepaphw.pngbin19422 -> 0 bytes
-rw-r--r--doc/sketches/multimeter.pngbin596151 -> 0 bytes
-rw-r--r--doc/sketches/nanopiezo.pngbin126710 -> 0 bytes
-rw-r--r--doc/sketches/sketches.odpbin1500245 -> 0 bytes
-rw-r--r--doc/source/_static/attributechooser01.png (renamed from taurus/doc/source/_static/attributechooser01.png)bin32644 -> 32644 bytes
-rw-r--r--doc/source/_static/codelogo01.pngbin15223 -> 0 bytes
-rw-r--r--doc/source/_static/default.css14
-rw-r--r--doc/source/_static/designer01.png (renamed from taurus/doc/source/_static/designer01.png)bin154405 -> 154405 bytes
-rw-r--r--doc/source/_static/designer02.png (renamed from taurus/doc/source/_static/designer02.png)bin54323 -> 54323 bytes
-rw-r--r--doc/source/_static/designer03.png (renamed from taurus/doc/source/_static/designer03.png)bin34908 -> 34908 bytes
-rw-r--r--doc/source/_static/designer04.png (renamed from taurus/doc/source/_static/designer04.png)bin55401 -> 55401 bytes
-rw-r--r--doc/source/_static/designer05.png (renamed from taurus/doc/source/_static/designer05.png)bin56016 -> 56016 bytes
-rw-r--r--doc/source/_static/designer_plugins01.png (renamed from taurus/doc/source/_static/designer_plugins01.png)bin45425 -> 45425 bytes
-rw-r--r--doc/source/_static/dyn.pngbin819319 -> 0 bytes
-rw-r--r--doc/source/_static/edit01.png (renamed from taurus/doc/source/_static/edit01.png)bin6063 -> 6063 bytes
-rw-r--r--doc/source/_static/edit02.png (renamed from taurus/doc/source/_static/edit02.png)bin6572 -> 6572 bytes
-rw-r--r--doc/source/_static/edit03.png (renamed from taurus/doc/source/_static/edit03.png)bin7068 -> 7068 bytes
-rw-r--r--doc/source/_static/forms-pendingops01.png (renamed from taurus/doc/source/_static/forms-pendingops01.png)bin32098 -> 32098 bytes
-rw-r--r--doc/source/_static/forms01.png (renamed from taurus/doc/source/_static/forms01.png)bin20846 -> 20846 bytes
-rw-r--r--doc/source/_static/forms02.png (renamed from taurus/doc/source/_static/forms02.png)bin21174 -> 21174 bytes
-rw-r--r--doc/source/_static/forms03.png (renamed from taurus/doc/source/_static/forms03.png)bin36541 -> 36541 bytes
-rw-r--r--doc/source/_static/gallery/gallery01.pngbin234100 -> 0 bytes
-rw-r--r--doc/source/_static/gallery/gallery02.pngbin396727 -> 0 bytes
-rw-r--r--doc/source/_static/gap_offset.pngbin16202 -> 0 bytes
-rw-r--r--doc/source/_static/gap_read.pngbin67799 -> 0 bytes
-rw-r--r--doc/source/_static/gap_write.pngbin15770 -> 0 bytes
-rw-r--r--doc/source/_static/gedit_config.pngbin401299 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot01.pngbin160854 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot02.pngbin56686 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot03.pngbin136469 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot04.pngbin129974 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot05.pngbin37673 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot06.pngbin102552 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot07.pngbin129932 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot08.pngbin121919 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot09.pngbin115900 -> 0 bytes
-rw-r--r--doc/source/_static/gui_snapshot10.pngbin203829 -> 0 bytes
-rw-r--r--doc/source/_static/hard.pngbin934455 -> 0 bytes
-rw-r--r--doc/source/_static/intro.png (renamed from taurus/doc/source/_static/intro.png)bin897777 -> 897777 bytes
-rw-r--r--doc/source/_static/kwrite_config.pngbin758790 -> 0 bytes
-rw-r--r--doc/source/_static/label01.png (renamed from taurus/doc/source/_static/label01.png)bin4325 -> 4325 bytes
-rw-r--r--doc/source/_static/label02.png (renamed from taurus/doc/source/_static/label02.png)bin5668 -> 5668 bytes
-rw-r--r--doc/source/_static/label03.png (renamed from taurus/doc/source/_static/label03.png)bin5327 -> 5327 bytes
-rw-r--r--doc/source/_static/label04.png (renamed from taurus/doc/source/_static/label04.png)bin5897 -> 5897 bytes
-rw-r--r--doc/source/_static/label05.png (renamed from taurus/doc/source/_static/label05.png)bin4448 -> 4448 bytes
-rw-r--r--doc/source/_static/label06.png (renamed from taurus/doc/source/_static/label06.png)bin2502 -> 2502 bytes
-rw-r--r--doc/source/_static/limit.pngbin116282 -> 0 bytes
-rw-r--r--doc/source/_static/logo.pngbin36269 -> 25070 bytes
-rw-r--r--doc/source/_static/logo.svg (renamed from taurus/doc/source/_static/logo.svg)0
-rw-r--r--doc/source/_static/macro_edit.pngbin32384 -> 0 bytes
-rw-r--r--doc/source/_static/macro_fractal.pngbin59971 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input.pngbin14861 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input_float_title.pngbin16024 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input_float_title_label_unit.pngbin19014 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input_integer.pngbin16331 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input_moveable.pngbin16926 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input_select_multiple.pngbin22031 -> 0 bytes
-rw-r--r--doc/source/_static/macro_input_select_radio.pngbin18041 -> 0 bytes
-rw-r--r--doc/source/_static/macro_plotting1.pngbin30089 -> 0 bytes
-rw-r--r--doc/source/_static/macro_progress.pngbin56000 -> 0 bytes
-rw-r--r--doc/source/_static/macrogui01.png (renamed from taurus/doc/source/_static/macrogui01.png)bin119855 -> 119855 bytes
-rw-r--r--doc/source/_static/macros/favouriteeditor01.png (renamed from taurus/doc/source/_static/macros/favouriteeditor01.png)bin12205 -> 12205 bytes
-rw-r--r--doc/source/_static/macros/macroexecutor01.odg (renamed from taurus/doc/source/_static/macros/macroexecutor01.odg)bin42236 -> 42236 bytes
-rw-r--r--doc/source/_static/macros/macroexecutor01.png (renamed from taurus/doc/source/_static/macros/macroexecutor01.png)bin1111166 -> 1111166 bytes
-rw-r--r--doc/source/_static/macros/macroexecutor01_raw.png (renamed from taurus/doc/source/_static/macros/macroexecutor01_raw.png)bin21869 -> 21869 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor01.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor01.png)bin8124 -> 8124 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor02.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor02.png)bin7635 -> 7635 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor03.odg (renamed from taurus/doc/source/_static/macros/macroparameterseditor03.odg)bin20268 -> 20268 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor03.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor03.png)bin604944 -> 604944 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor03_raw.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor03_raw.png)bin7773 -> 7773 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor04.odg (renamed from taurus/doc/source/_static/macros/macroparameterseditor04.odg)bin23179 -> 23179 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor04.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor04.png)bin604944 -> 604944 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor04_raw.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor04_raw.png)bin10110 -> 10110 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor05.odg (renamed from taurus/doc/source/_static/macros/macroparameterseditor05.odg)bin22524 -> 22524 bytes
-rw-r--r--doc/source/_static/macros/macroparameterseditor05.png (renamed from taurus/doc/source/_static/macros/macroparameterseditor05.png)bin604944 -> 604944 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor01.png (renamed from taurus/doc/source/_static/macros/sequenceeditor01.png)bin13687 -> 13687 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor02.odg (renamed from taurus/doc/source/_static/macros/sequenceeditor02.odg)bin27793 -> 27793 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor02.png (renamed from taurus/doc/source/_static/macros/sequenceeditor02.png)bin672669 -> 672669 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor02_raw.png (renamed from taurus/doc/source/_static/macros/sequenceeditor02_raw.png)bin13687 -> 13687 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor03.odg (renamed from taurus/doc/source/_static/macros/sequenceeditor03.odg)bin30108 -> 30108 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor03.png (renamed from taurus/doc/source/_static/macros/sequenceeditor03.png)bin628299 -> 628299 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor03_raw.png (renamed from taurus/doc/source/_static/macros/sequenceeditor03_raw.png)bin15806 -> 15806 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor04.odg (renamed from taurus/doc/source/_static/macros/sequenceeditor04.odg)bin29610 -> 29610 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor04.png (renamed from taurus/doc/source/_static/macros/sequenceeditor04.png)bin628299 -> 628299 bytes
-rw-r--r--doc/source/_static/macros/sequenceeditor05_raw.png (renamed from taurus/doc/source/_static/macros/sequenceeditor05_raw.png)bin19830 -> 19830 bytes
-rw-r--r--doc/source/_static/macros/sequencer01.odg (renamed from taurus/doc/source/_static/macros/sequencer01.odg)bin47998 -> 47998 bytes
-rw-r--r--doc/source/_static/macros/sequencer01.png (renamed from taurus/doc/source/_static/macros/sequencer01.png)bin1233154 -> 1233154 bytes
-rw-r--r--doc/source/_static/macros/sequencer01_raw.png (renamed from taurus/doc/source/_static/macros/sequencer01_raw.png)bin29047 -> 29047 bytes
-rw-r--r--doc/source/_static/macroserver_pool_server.pngbin1016700 -> 0 bytes
-rw-r--r--doc/source/_static/macroserver_server.pngbin466152 -> 0 bytes
-rw-r--r--doc/source/_static/motor.pngbin604281 -> 0 bytes
-rw-r--r--doc/source/_static/perspectives-toolbar01.png (renamed from taurus/doc/source/_static/perspectives-toolbar01.png)bin4841 -> 4841 bytes
-rw-r--r--doc/source/_static/pm_pipeline.pngbin52522 -> 0 bytes
-rw-r--r--doc/source/_static/pool_server.pngbin719880 -> 0 bytes
-rw-r--r--doc/source/_static/sardana.pngbin641152 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_pool_server.pngbin1748863 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_screenshot.pngbin278962 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server.pngbin853448 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_controller.pngbin1490875 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_empty.pngbin62157 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_icepap.pngbin1222165 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_icepap_np200.pngbin2261479 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal.pngbin513448 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_0D.pngbin550858 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_countertimer.pngbin615452 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_motor.pngbin714615 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_motor_read_position_flow.pngbin1728360 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_motor_read_state_flow.pngbin1807587 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_motor_write_position_flow.pngbin2139933 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_internal_pseudomotor.pngbin1511449 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_server_np200.pngbin1161353 -> 0 bytes
-rw-r--r--doc/source/_static/sardana_sketch.pngbin116201 -> 0 bytes
-rw-r--r--doc/source/_static/slideshow.js32
-rw-r--r--doc/source/_static/snapshot01.pngbin96957 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot02.pngbin93424 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot03.pngbin61709 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot04.pngbin87412 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot05.pngbin125021 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot06.pngbin139914 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot07.pngbin110429 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot08.pngbin55169 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot09.pngbin1216205 -> 0 bytes
-rw-r--r--doc/source/_static/snapshot10.pngbin203829 -> 0 bytes
-rw-r--r--doc/source/_static/spock_snapshot01.pngbin87691 -> 0 bytes
-rw-r--r--doc/source/_static/spock_snapshot02.pngbin57285 -> 0 bytes
-rw-r--r--doc/source/_static/synoptic01.png (renamed from taurus/doc/source/_static/synoptic01.png)bin65788 -> 65788 bytes
-rw-r--r--doc/source/_static/taurus_codelogo01.png (renamed from taurus/doc/source/_static/taurus_codelogo01.png)bin15223 -> 15223 bytes
-rw-r--r--doc/source/_static/taurus_layers.png (renamed from taurus/doc/source/_static/taurus_layers.png)bin24514 -> 24514 bytes
-rw-r--r--doc/source/_static/taurus_spock01.png (renamed from taurus/doc/source/_static/taurus_spock01.png)bin27102 -> 27102 bytes
-rw-r--r--doc/source/_static/taurus_tree01.png (renamed from taurus/doc/source/_static/taurus_tree01.png)bin50819 -> 50819 bytes
-rw-r--r--doc/source/_static/taurusarrayeditor01.png (renamed from taurus/doc/source/_static/taurusarrayeditor01.png)bin48226 -> 48226 bytes
-rw-r--r--doc/source/_static/taurusform_example01.png (renamed from taurus/doc/source/_static/taurusform_example01.png)bin19401 -> 19401 bytes
-rw-r--r--doc/source/_static/taurusform_example02.png (renamed from taurus/doc/source/_static/taurusform_example02.png)bin26189 -> 26189 bytes
-rw-r--r--doc/source/_static/taurusgui-newpanel01.png (renamed from taurus/doc/source/_static/taurusgui-newpanel01.png)bin88874 -> 88874 bytes
-rw-r--r--doc/source/_static/taurusgui-permanentpanels01.png (renamed from taurus/doc/source/_static/taurusgui-permanentpanels01.png)bin30721 -> 30721 bytes
-rw-r--r--doc/source/_static/taurusgui01.png (renamed from taurus/doc/source/_static/taurusgui01.png)bin308329 -> 308329 bytes
-rw-r--r--doc/source/_static/taurusimage01.png (renamed from taurus/doc/source/_static/taurusimage01.png)bin34376 -> 34376 bytes
-rw-r--r--doc/source/_static/taurusmodelchooser01.png (renamed from taurus/doc/source/_static/taurusmodelchooser01.png)bin63847 -> 63847 bytes
-rw-r--r--doc/source/_static/taurusplot-config01.png (renamed from taurus/doc/source/_static/taurusplot-config01.png)bin58529 -> 58529 bytes
-rw-r--r--doc/source/_static/taurusplot-context01.png (renamed from taurus/doc/source/_static/taurusplot-context01.png)bin13365 -> 13365 bytes
-rw-r--r--doc/source/_static/taurusplot-datainfo01.png (renamed from taurus/doc/source/_static/taurusplot-datainfo01.png)bin3206 -> 3206 bytes
-rw-r--r--doc/source/_static/taurusplot-datainfo02.png (renamed from taurus/doc/source/_static/taurusplot-datainfo02.png)bin3048 -> 3048 bytes
-rw-r--r--doc/source/_static/taurusplot-datainfo03.png (renamed from taurus/doc/source/_static/taurusplot-datainfo03.png)bin15846 -> 15846 bytes
-rw-r--r--doc/source/_static/taurusplot-exportascii01.png (renamed from taurus/doc/source/_static/taurusplot-exportascii01.png)bin29171 -> 29171 bytes
-rw-r--r--doc/source/_static/taurusplot-inputdata01.png (renamed from taurus/doc/source/_static/taurusplot-inputdata01.png)bin42250 -> 42250 bytes
-rw-r--r--doc/source/_static/taurusplot-inputdata02.png (renamed from taurus/doc/source/_static/taurusplot-inputdata02.png)bin33513 -> 33513 bytes
-rw-r--r--doc/source/_static/taurusplot-timesupport01.png (renamed from taurus/doc/source/_static/taurusplot-timesupport01.png)bin2218 -> 2218 bytes
-rw-r--r--doc/source/_static/taurusplot-timesupport02.png (renamed from taurus/doc/source/_static/taurusplot-timesupport02.png)bin6674 -> 6674 bytes
-rw-r--r--doc/source/_static/taurusplot-timesupport03.png (renamed from taurus/doc/source/_static/taurusplot-timesupport03.png)bin5266 -> 5266 bytes
-rw-r--r--doc/source/_static/taurusplot01.png (renamed from taurus/doc/source/_static/taurusplot01.png)bin15961 -> 15961 bytes
-rw-r--r--doc/source/_static/taurusplot02.png (renamed from taurus/doc/source/_static/taurusplot02.png)bin11018 -> 11018 bytes
-rw-r--r--doc/source/_static/taurusplot03.png (renamed from taurus/doc/source/_static/taurusplot03.png)bin14379 -> 14379 bytes
-rw-r--r--doc/source/_static/taurusplot04.png (renamed from taurus/doc/source/_static/taurusplot04.png)bin20688 -> 20688 bytes
-rw-r--r--doc/source/_static/taurusplot_example01.png (renamed from taurus/doc/source/_static/taurusplot_example01.png)bin15845 -> 15845 bytes
-rw-r--r--doc/source/_static/taurustrend-fixedRange01.png (renamed from taurus/doc/source/_static/taurustrend-fixedRange01.png)bin6251 -> 6251 bytes
-rw-r--r--doc/source/_static/taurustrend01.png (renamed from taurus/doc/source/_static/taurustrend01.png)bin12529 -> 12529 bytes
-rw-r--r--doc/source/_static/taurustrend02.png (renamed from taurus/doc/source/_static/taurustrend02.png)bin27361 -> 27361 bytes
-rw-r--r--doc/source/_static/taurustrend03.png (renamed from taurus/doc/source/_static/taurustrend03.png)bin20565 -> 20565 bytes
-rw-r--r--doc/source/_static/taurusvalue01.png (renamed from taurus/doc/source/_static/taurusvalue01.png)bin6676 -> 6676 bytes
-rw-r--r--doc/source/_static/trend_a2scanc.pngbin32554 -> 0 bytes
-rw-r--r--doc/source/_static/trend_ascanVSascanc.pngbin39847 -> 0 bytes
-rw-r--r--doc/source/_static/whatsthiscursor.png (renamed from taurus/doc/source/_static/whatsthiscursor.png)bin219 -> 219 bytes
-rw-r--r--doc/source/_templates/layout.html27
-rw-r--r--doc/source/conf.py158
-rw-r--r--doc/source/devel/api/api_0D.rst20
-rw-r--r--doc/source/devel/api/api_1D.rst20
-rw-r--r--doc/source/devel/api/api_2D.rst20
-rw-r--r--doc/source/devel/api/api_IOR.rst20
-rw-r--r--doc/source/devel/api/api_controller.rst81
-rw-r--r--doc/source/devel/api/api_countertimer.rst20
-rw-r--r--doc/source/devel/api/api_macro.rst37
-rw-r--r--doc/source/devel/api/api_motor.rst207
-rw-r--r--doc/source/devel/api/api_pseudocounter.rst20
-rw-r--r--doc/source/devel/api/api_pseudomotor.rst20
-rw-r--r--doc/source/devel/api/api_sardana.rst24
-rw-r--r--doc/source/devel/api/api_test.rst102
-rw-r--r--doc/source/devel/api/motion.dot102
-rw-r--r--doc/source/devel/api/motion_complete.dot151
-rw-r--r--doc/source/devel/api/sardana/macroserver.rst25
-rw-r--r--doc/source/devel/api/sardana/macroserver/macros.rst602
-rw-r--r--doc/source/devel/api/sardana/macroserver/macroserver.rst24
-rw-r--r--doc/source/devel/api/sardana/macroserver/msbase.rst34
-rw-r--r--doc/source/devel/api/sardana/macroserver/mscontainer.rst24
-rw-r--r--doc/source/devel/api/sardana/macroserver/msdoor.rst24
-rw-r--r--doc/source/devel/api/sardana/macroserver/msenvmanager.rst24
-rw-r--r--doc/source/devel/api/sardana/macroserver/msexception.rst21
-rw-r--r--doc/source/devel/api/sardana/macroserver/msmacromanager.rst28
-rw-r--r--doc/source/devel/api/sardana/macroserver/msmanager.rst24
-rw-r--r--doc/source/devel/api/sardana/macroserver/msmetamacro.rst45
-rw-r--r--doc/source/devel/api/sardana/macroserver/msparameter.rst21
-rw-r--r--doc/source/devel/api/sardana/macroserver/mstypemanager.rst21
-rw-r--r--doc/source/devel/api/sardana/pool.rst62
-rw-r--r--doc/source/devel/api/sardana/pool/controller.rst215
-rw-r--r--doc/source/devel/api/sardana/pool/pool.rst31
-rw-r--r--doc/source/devel/api/sardana/pool/poolacquisition.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolaction.rst69
-rw-r--r--doc/source/devel/api/sardana/pool/poolbasechannel.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolbaseobject.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolcontainer.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolcontroller.rst49
-rw-r--r--doc/source/devel/api/sardana/pool/poolcontrollermanager.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolcountertimer.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/pooldefs.rst13
-rw-r--r--doc/source/devel/api/sardana/pool/poolelement.rst36
-rw-r--r--doc/source/devel/api/sardana/pool/poolexception.rst50
-rw-r--r--doc/source/devel/api/sardana/pool/poolexternal.rst45
-rw-r--r--doc/source/devel/api/sardana/pool/poolgroupelement.rst36
-rw-r--r--doc/source/devel/api/sardana/pool/poolinstrument.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolioregister.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolmeasurementgroup.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolmetacontroller.rst71
-rw-r--r--doc/source/devel/api/sardana/pool/poolmonitor.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolmotion.rst41
-rw-r--r--doc/source/devel/api/sardana/pool/poolmotor.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolmotorgroup.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolmoveable.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolobject.rst24
-rw-r--r--doc/source/devel/api/sardana/pool/poolonedexpchannel.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolpseudocounter.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/poolpseudomotor.rst26
-rw-r--r--doc/source/devel/api/sardana/pool/pooltwodexpchannel.rst25
-rw-r--r--doc/source/devel/api/sardana/pool/poolutil.rst8
-rw-r--r--doc/source/devel/api/sardana/pool/poolzerodexpchannel.rst25
-rw-r--r--doc/source/devel/api/sardana/sardana.rst30
-rw-r--r--doc/source/devel/api/sardana/sardanaattribute.rst60
-rw-r--r--doc/source/devel/api/sardana/sardanabase.rst36
-rw-r--r--doc/source/devel/api/sardana/sardanacontainer.rst26
-rw-r--r--doc/source/devel/api/sardana/sardanadefs.rst63
-rw-r--r--doc/source/devel/api/sardana/sardanaevent.rst49
-rw-r--r--doc/source/devel/api/sardana/sardanamanager.rst24
-rw-r--r--doc/source/devel/api/sardana/sardanameta.rst36
-rw-r--r--doc/source/devel/api/sardana/sardanamodulemanager.rst25
-rw-r--r--doc/source/devel/api/sardana/sardanavalue.rst24
-rw-r--r--doc/source/devel/api/sardana/tango.rst15
-rw-r--r--doc/source/devel/api/sardana/tango/core.rst14
-rw-r--r--doc/source/devel/api/sardana/tango/core/SardanaDevice.rst38
-rw-r--r--doc/source/devel/api/sardana/tango/macroserver.rst13
-rw-r--r--doc/source/devel/api/sardana/tango/macroserver/test/macroexecutor.rst75
-rw-r--r--doc/source/devel/api/sardana/tango/pool.rst23
-rw-r--r--doc/source/devel/api/sardana/tango/pool/CTExpChannel.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/Controller.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/IORegister.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/Motor.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/OneDExpChannel.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/Pool.rst36
-rw-r--r--doc/source/devel/api/sardana/tango/pool/PoolDevice.rst84
-rw-r--r--doc/source/devel/api/sardana/tango/pool/PseudoCounter.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/PseudoMotor.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/TwoDExpChannel.rst37
-rw-r--r--doc/source/devel/api/sardana/tango/pool/ZeroDExpChannel.rst37
-rw-r--r--doc/source/devel/api/tango_device_pool.rst4660
-rw-r--r--doc/source/devel/api/tango_macroserver.rst38
-rw-r--r--doc/source/devel/coding_guide.rst (renamed from taurus/doc/source/devel/coding_guide.rst)0
-rw-r--r--doc/source/devel/color_guide.rst (renamed from taurus/doc/source/devel/color_guide.rst)0
-rw-r--r--doc/source/devel/core_tutorial.rst (renamed from taurus/doc/source/devel/core_tutorial.rst)0
-rw-r--r--doc/source/devel/designer_tutorial.rst (renamed from taurus/doc/source/devel/designer_tutorial.rst)0
-rw-r--r--doc/source/devel/examples.rst (renamed from taurus/doc/source/devel/examples.rst)0
-rw-r--r--doc/source/devel/examples/ControllerTemplate.py204
-rw-r--r--doc/source/devel/examples/TaurusTest.py (renamed from taurus/doc/source/devel/examples/TaurusTest.py)0
-rw-r--r--doc/source/devel/examples/controller_examples.rst16
-rw-r--r--doc/source/devel/examples/dumpy-bakeout.jdw (renamed from taurus/doc/source/devel/examples/dumpy-bakeout.jdw)0
-rw-r--r--doc/source/devel/examples/edit01.py (renamed from taurus/doc/source/devel/examples/edit01.py)0
-rw-r--r--doc/source/devel/examples/edit02.py (renamed from taurus/doc/source/devel/examples/edit02.py)0
-rw-r--r--doc/source/devel/examples/edit03.py (renamed from taurus/doc/source/devel/examples/edit03.py)0
-rw-r--r--doc/source/devel/examples/examples.rst12
-rw-r--r--doc/source/devel/examples/forms01.py (renamed from taurus/doc/source/devel/examples/forms01.py)0
-rw-r--r--doc/source/devel/examples/forms02.py (renamed from taurus/doc/source/devel/examples/forms02.py)0
-rw-r--r--doc/source/devel/examples/label01.py (renamed from taurus/doc/source/devel/examples/label01.py)0
-rw-r--r--doc/source/devel/examples/label02.py (renamed from taurus/doc/source/devel/examples/label02.py)0
-rw-r--r--doc/source/devel/examples/label03.py (renamed from taurus/doc/source/devel/examples/label03.py)0
-rw-r--r--doc/source/devel/examples/label04.py (renamed from taurus/doc/source/devel/examples/label04.py)0
-rw-r--r--doc/source/devel/examples/label05.py (renamed from taurus/doc/source/devel/examples/label05.py)0
-rw-r--r--doc/source/devel/examples/label06.py (renamed from taurus/doc/source/devel/examples/label06.py)0
-rw-r--r--doc/source/devel/examples/macro_call_examples.rst13
-rw-r--r--doc/source/devel/examples/macro_examples.rst15
-rw-r--r--doc/source/devel/examples/macro_input_examples.rst17
-rw-r--r--doc/source/devel/examples/macro_parameter_examples.rst14
-rw-r--r--doc/source/devel/examples/macro_plotting_examples.rst17
-rw-r--r--doc/source/devel/examples/parentmodel_issue_demo.py (renamed from taurus/doc/source/devel/examples/parentmodel_issue_demo.py)0
-rw-r--r--doc/source/devel/examples/pyqwt_issue_test.py (renamed from taurus/doc/source/devel/examples/pyqwt_issue_test.py)0
-rw-r--r--doc/source/devel/examples/taurusplot01.py (renamed from taurus/doc/source/devel/examples/taurusplot01.py)0
-rw-r--r--doc/source/devel/examples/taurusplot02.py (renamed from taurus/doc/source/devel/examples/taurusplot02.py)0
-rw-r--r--doc/source/devel/examples/taurusplot03.py (renamed from taurus/doc/source/devel/examples/taurusplot03.py)0
-rw-r--r--doc/source/devel/examples/taurustrend01.py (renamed from taurus/doc/source/devel/examples/taurustrend01.py)0
-rw-r--r--doc/source/devel/examples/taurusvalue01.py (renamed from taurus/doc/source/devel/examples/taurusvalue01.py)0
-rw-r--r--doc/source/devel/guide_coding.rst137
-rw-r--r--doc/source/devel/guide_migration.rst212
-rw-r--r--doc/source/devel/howto_controllers/howto_0dcontroller.rst37
-rw-r--r--doc/source/devel/howto_controllers/howto_1dcontroller.rst37
-rw-r--r--doc/source/devel/howto_controllers/howto_2dcontroller.rst37
-rw-r--r--doc/source/devel/howto_controllers/howto_controller.rst533
-rw-r--r--doc/source/devel/howto_controllers/howto_countertimercontroller.rst105
-rw-r--r--doc/source/devel/howto_controllers/howto_ioregistercontroller.rst37
-rw-r--r--doc/source/devel/howto_controllers/howto_motorcontroller.rst694
-rw-r--r--doc/source/devel/howto_controllers/howto_pseudocountercontroller.rst37
-rw-r--r--doc/source/devel/howto_controllers/howto_pseudomotorcontroller.rst37
-rw-r--r--doc/source/devel/howto_controllers/index.rst32
-rw-r--r--doc/source/devel/howto_controllers/sf_ct_ctrl.py122
-rw-r--r--doc/source/devel/howto_controllers/sf_motor_ctrl.py141
-rw-r--r--doc/source/devel/howto_controllers/springfieldlib.py653
-rw-r--r--doc/source/devel/howto_macros/index.rst15
-rw-r--r--doc/source/devel/howto_macros/macros_general.rst1190
-rw-r--r--doc/source/devel/howto_macros/scan_framework.rst255
-rw-r--r--doc/source/devel/howto_test/index.rst17
-rw-r--r--doc/source/devel/howto_test/test_example.rst323
-rw-r--r--doc/source/devel/howto_test/test_general.rst109
-rw-r--r--doc/source/devel/howto_test/test_run_commands.rst35
-rw-r--r--doc/source/devel/howto_test/tests/index.rst19
-rw-r--r--doc/source/devel/howto_test/tests/test_ct.rst26
-rw-r--r--doc/source/devel/howto_test/tests/test_list.rst114
-rw-r--r--doc/source/devel/howto_test/tests/test_parameter.rst25
-rw-r--r--doc/source/devel/howto_test/tests/test_sardanavalue.rst25
-rw-r--r--doc/source/devel/howto_test/tests/test_scan.rst96
-rw-r--r--doc/source/devel/howto_test/tests/test_wm.rst37
-rw-r--r--doc/source/devel/icon_example.py (renamed from taurus/doc/source/devel/icon_example.py)0
-rw-r--r--doc/source/devel/icon_guide.rst (renamed from taurus/doc/source/devel/icon_guide.rst)0
-rw-r--r--doc/source/devel/index.rst22
-rw-r--r--doc/source/devel/overview/index.rst23
-rw-r--r--doc/source/devel/overview/overview.rst122
-rw-r--r--doc/source/devel/overview/overview_0D.rst17
-rw-r--r--doc/source/devel/overview/overview_1D.rst17
-rw-r--r--doc/source/devel/overview/overview_2D.rst17
-rw-r--r--doc/source/devel/overview/overview_IOR.rst17
-rw-r--r--doc/source/devel/overview/overview_controller.rst232
-rw-r--r--doc/source/devel/overview/overview_countertimer.rst17
-rw-r--r--doc/source/devel/overview/overview_macroserver.rst82
-rw-r--r--doc/source/devel/overview/overview_motor.rst62
-rw-r--r--doc/source/devel/overview/overview_pool.rst77
-rw-r--r--doc/source/devel/overview/overview_pseudocounter.rst17
-rw-r--r--doc/source/devel/overview/overview_pseudomotor.rst17
-rw-r--r--doc/source/devel/popupmenu_tutorial.rst (renamed from taurus/doc/source/devel/popupmenu_tutorial.rst)0
-rw-r--r--doc/source/devel/tau2taurus_migration_guide.rst (renamed from taurus/doc/source/devel/tau2taurus_migration_guide.rst)0
-rw-r--r--doc/source/devel/widget_tutorial.rst (renamed from taurus/doc/source/devel/widget_tutorial.rst)0
-rw-r--r--doc/source/docs.rst24
-rw-r--r--doc/source/glossary.rst430
-rw-r--r--doc/source/index.rst78
-rw-r--r--doc/source/revision.rst30
-rw-r--r--doc/source/sphinxext/ipython_console_highlighting.py137
-rw-r--r--doc/source/sphinxext/sardanaextension.py187
-rw-r--r--doc/source/sphinxext/spock_console_highlighting.py145
-rw-r--r--doc/source/sphinxext/taurusextension.py (renamed from taurus/doc/source/sphinxext/taurusextension.py)0
-rw-r--r--doc/source/todo.rst6
-rw-r--r--doc/source/users/faq.rst193
-rw-r--r--doc/source/users/getting_started.rst (renamed from taurus/doc/source/users/getting_started.rst)0
-rw-r--r--doc/source/users/getting_started/index.rst17
-rw-r--r--doc/source/users/getting_started/installing.rst113
-rw-r--r--doc/source/users/getting_started/running_cli.rst101
-rw-r--r--doc/source/users/getting_started/running_server.rst111
-rw-r--r--doc/source/users/index.rst15
-rw-r--r--doc/source/users/introduction.rst (renamed from taurus/doc/source/users/introduction.rst)0
-rw-r--r--doc/source/users/overview.rst243
-rw-r--r--doc/source/users/scan.rst155
-rw-r--r--doc/source/users/screenshots.rst138
-rw-r--r--doc/source/users/spock.rst471
-rw-r--r--doc/source/users/standard_macro_catalog.rst140
-rw-r--r--doc/source/users/ui/arrayeditor.rst (renamed from taurus/doc/source/users/ui/arrayeditor.rst)0
-rw-r--r--doc/source/users/ui/attributechooser.rst (renamed from taurus/doc/source/users/ui/attributechooser.rst)0
-rw-r--r--doc/source/users/ui/experimentconfiguration.rst (renamed from taurus/doc/source/users/ui/experimentconfiguration.rst)0
-rw-r--r--doc/source/users/ui/forms.rst (renamed from taurus/doc/source/users/ui/forms.rst)0
-rw-r--r--doc/source/users/ui/index.rst (renamed from taurus/doc/source/users/ui/index.rst)0
-rw-r--r--doc/source/users/ui/macros/index.rst (renamed from taurus/doc/source/users/ui/macros/index.rst)0
-rw-r--r--doc/source/users/ui/macros/macroexecutor.rst (renamed from taurus/doc/source/users/ui/macros/macroexecutor.rst)0
-rw-r--r--doc/source/users/ui/macros/sequencer.rst (renamed from taurus/doc/source/users/ui/macros/sequencer.rst)0
-rw-r--r--doc/source/users/ui/modelchooser.rst (renamed from taurus/doc/source/users/ui/modelchooser.rst)0
-rw-r--r--doc/source/users/ui/plot.rst (renamed from taurus/doc/source/users/ui/plot.rst)0
-rw-r--r--doc/source/users/ui/sardanaeditor.rst (renamed from taurus/doc/source/users/ui/sardanaeditor.rst)0
-rw-r--r--doc/source/users/ui/synoptics.rst (renamed from taurus/doc/source/users/ui/synoptics.rst)0
-rw-r--r--doc/source/users/ui/taurusgui.rst (renamed from taurus/doc/source/users/ui/taurusgui.rst)0
-rw-r--r--doc/source/users/ui/taurusimage.rst (renamed from taurus/doc/source/users/ui/taurusimage.rst)0
-rw-r--r--doc/source/users/ui/trend.rst (renamed from taurus/doc/source/users/ui/trend.rst)0
-rw-r--r--doc/source/users/ui/ui_colors.rst (renamed from taurus/doc/source/users/ui/ui_colors.rst)0
-rw-r--r--doc/thumbnails.zip (renamed from taurus/doc/thumbnails.zip)bin881911 -> 881911 bytes
-rw-r--r--lib/taurus/__init__.py (renamed from taurus/lib/taurus/__init__.py)0
-rw-r--r--lib/taurus/console/__init__.py (renamed from taurus/lib/taurus/console/__init__.py)0
-rw-r--r--lib/taurus/console/enums.py (renamed from taurus/lib/taurus/console/enums.py)0
-rw-r--r--lib/taurus/console/list.py (renamed from taurus/lib/taurus/console/list.py)0
-rw-r--r--lib/taurus/console/table.py (renamed from taurus/lib/taurus/console/table.py)0
-rw-r--r--lib/taurus/console/util/__init__.py (renamed from taurus/lib/taurus/console/util/__init__.py)0
-rw-r--r--lib/taurus/core/__init__.py (renamed from taurus/lib/taurus/core/__init__.py)0
-rw-r--r--lib/taurus/core/epics/__init__.py (renamed from taurus/lib/taurus/core/epics/__init__.py)0
-rw-r--r--lib/taurus/core/epics/__taurus_plugin__ (renamed from taurus/lib/taurus/core/epics/__taurus_plugin__)0
-rw-r--r--lib/taurus/core/epics/epicsfactory.py (renamed from taurus/lib/taurus/core/epics/epicsfactory.py)0
-rw-r--r--lib/taurus/core/evaluation/__init__.py (renamed from taurus/lib/taurus/core/evaluation/__init__.py)0
-rw-r--r--lib/taurus/core/evaluation/__taurus_plugin__ (renamed from taurus/lib/taurus/core/evaluation/__taurus_plugin__)0
-rw-r--r--lib/taurus/core/evaluation/dev_example.py (renamed from taurus/lib/taurus/core/evaluation/dev_example.py)0
-rw-r--r--lib/taurus/core/evaluation/evalfactory.py (renamed from taurus/lib/taurus/core/evaluation/evalfactory.py)0
-rw-r--r--lib/taurus/core/evaluation/ipap_example.py (renamed from taurus/lib/taurus/core/evaluation/ipap_example.py)0
-rw-r--r--lib/taurus/core/init_bkcomp.py (renamed from taurus/lib/taurus/core/init_bkcomp.py)0
-rw-r--r--lib/taurus/core/init_lightweight.py (renamed from taurus/lib/taurus/core/init_lightweight.py)0
-rw-r--r--lib/taurus/core/release.py (renamed from taurus/lib/taurus/core/release.py)0
-rw-r--r--lib/taurus/core/resource/__init__.py (renamed from taurus/lib/taurus/core/resource/__init__.py)0
-rw-r--r--lib/taurus/core/resource/__taurus_plugin__ (renamed from taurus/lib/taurus/core/resource/__taurus_plugin__)0
-rw-r--r--lib/taurus/core/resource/resfactory.py (renamed from taurus/lib/taurus/core/resource/resfactory.py)0
-rw-r--r--lib/taurus/core/simulation/__init__.py (renamed from taurus/lib/taurus/core/simulation/__init__.py)0
-rw-r--r--lib/taurus/core/simulation/__taurus_plugin__ (renamed from taurus/lib/taurus/core/simulation/__taurus_plugin__)0
-rw-r--r--lib/taurus/core/simulation/simfactory.py (renamed from taurus/lib/taurus/core/simulation/simfactory.py)0
-rw-r--r--lib/taurus/core/tango/__init__.py (renamed from taurus/lib/taurus/core/tango/__init__.py)0
-rw-r--r--lib/taurus/core/tango/__taurus_plugin__ (renamed from taurus/lib/taurus/core/tango/__taurus_plugin__)0
-rw-r--r--lib/taurus/core/tango/enums.py (renamed from taurus/lib/taurus/core/tango/enums.py)0
-rw-r--r--lib/taurus/core/tango/img/__init__.py (renamed from taurus/lib/taurus/core/tango/img/__init__.py)0
-rw-r--r--lib/taurus/core/tango/img/img.py (renamed from taurus/lib/taurus/core/tango/img/img.py)0
-rw-r--r--lib/taurus/core/tango/search.py (renamed from taurus/lib/taurus/core/tango/search.py)0
-rw-r--r--lib/taurus/core/tango/starter.py (renamed from taurus/lib/taurus/core/tango/starter.py)0
-rwxr-xr-xlib/taurus/core/tango/tangoattribute.py (renamed from taurus/lib/taurus/core/tango/tangoattribute.py)0
-rw-r--r--lib/taurus/core/tango/tangoconfiguration.py (renamed from taurus/lib/taurus/core/tango/tangoconfiguration.py)0
-rw-r--r--lib/taurus/core/tango/tangodatabase.py (renamed from taurus/lib/taurus/core/tango/tangodatabase.py)0
-rw-r--r--lib/taurus/core/tango/tangodevice.py (renamed from taurus/lib/taurus/core/tango/tangodevice.py)0
-rw-r--r--lib/taurus/core/tango/tangofactory.py (renamed from taurus/lib/taurus/core/tango/tangofactory.py)0
-rw-r--r--lib/taurus/core/taurusattribute.py (renamed from taurus/lib/taurus/core/taurusattribute.py)0
-rw-r--r--lib/taurus/core/taurusbasetypes.py (renamed from taurus/lib/taurus/core/taurusbasetypes.py)0
-rw-r--r--lib/taurus/core/taurusconfiguration.py (renamed from taurus/lib/taurus/core/taurusconfiguration.py)0
-rw-r--r--lib/taurus/core/taurusdatabase.py (renamed from taurus/lib/taurus/core/taurusdatabase.py)0
-rw-r--r--lib/taurus/core/taurusdevice.py (renamed from taurus/lib/taurus/core/taurusdevice.py)0
-rw-r--r--lib/taurus/core/taurusexception.py (renamed from taurus/lib/taurus/core/taurusexception.py)0
-rw-r--r--lib/taurus/core/taurusfactory.py (renamed from taurus/lib/taurus/core/taurusfactory.py)0
-rw-r--r--lib/taurus/core/taurushelper.py (renamed from taurus/lib/taurus/core/taurushelper.py)0
-rw-r--r--lib/taurus/core/tauruslistener.py (renamed from taurus/lib/taurus/core/tauruslistener.py)0
-rw-r--r--lib/taurus/core/taurusmanager.py (renamed from taurus/lib/taurus/core/taurusmanager.py)0
-rw-r--r--lib/taurus/core/taurusmodel.py (renamed from taurus/lib/taurus/core/taurusmodel.py)0
-rw-r--r--lib/taurus/core/taurusoperation.py (renamed from taurus/lib/taurus/core/taurusoperation.py)0
-rw-r--r--lib/taurus/core/tauruspollingtimer.py (renamed from taurus/lib/taurus/core/tauruspollingtimer.py)0
-rw-r--r--lib/taurus/core/taurusvalidator.py (renamed from taurus/lib/taurus/core/taurusvalidator.py)0
-rw-r--r--lib/taurus/core/util/__init__.py (renamed from taurus/lib/taurus/core/util/__init__.py)0
-rw-r--r--lib/taurus/core/util/argparse/__init__.py (renamed from taurus/lib/taurus/core/util/argparse/__init__.py)0
-rw-r--r--lib/taurus/core/util/argparse/taurusargparse.py (renamed from taurus/lib/taurus/core/util/argparse/taurusargparse.py)0
-rw-r--r--lib/taurus/core/util/codecs.py (renamed from taurus/lib/taurus/core/util/codecs.py)0
-rw-r--r--lib/taurus/core/util/colors.py (renamed from taurus/lib/taurus/core/util/colors.py)0
-rw-r--r--lib/taurus/core/util/console.py (renamed from taurus/lib/taurus/core/util/console.py)0
-rw-r--r--lib/taurus/core/util/constant.py (renamed from taurus/lib/taurus/core/util/constant.py)0
-rw-r--r--lib/taurus/core/util/containers.py (renamed from taurus/lib/taurus/core/util/containers.py)0
-rw-r--r--lib/taurus/core/util/decorator/__init__.py (renamed from taurus/lib/taurus/core/util/decorator/__init__.py)0
-rw-r--r--lib/taurus/core/util/decorator/decorator.py (renamed from taurus/lib/taurus/core/util/decorator/decorator.py)0
-rw-r--r--lib/taurus/core/util/decorator/deprecated.py (renamed from taurus/lib/taurus/core/util/decorator/deprecated.py)0
-rw-r--r--lib/taurus/core/util/decorator/memoize.py (renamed from taurus/lib/taurus/core/util/decorator/memoize.py)0
-rw-r--r--lib/taurus/core/util/decorator/typecheck.py (renamed from taurus/lib/taurus/core/util/decorator/typecheck.py)0
-rw-r--r--lib/taurus/core/util/enumeration.py (renamed from taurus/lib/taurus/core/util/enumeration.py)0
-rw-r--r--lib/taurus/core/util/event.py (renamed from taurus/lib/taurus/core/util/event.py)0
-rw-r--r--lib/taurus/core/util/eventfilters.py (renamed from taurus/lib/taurus/core/util/eventfilters.py)0
-rw-r--r--lib/taurus/core/util/excepthook.py (renamed from taurus/lib/taurus/core/util/excepthook.py)0
-rw-r--r--lib/taurus/core/util/init_bkcomp.py (renamed from taurus/lib/taurus/core/util/init_bkcomp.py)0
-rw-r--r--lib/taurus/core/util/init_lightweight.py (renamed from taurus/lib/taurus/core/util/init_lightweight.py)0
-rw-r--r--lib/taurus/core/util/lock.py (renamed from taurus/lib/taurus/core/util/lock.py)0
-rw-r--r--lib/taurus/core/util/log.py (renamed from taurus/lib/taurus/core/util/log.py)0
-rw-r--r--lib/taurus/core/util/object.py (renamed from taurus/lib/taurus/core/util/object.py)0
-rw-r--r--lib/taurus/core/util/prop.py (renamed from taurus/lib/taurus/core/util/prop.py)0
-rw-r--r--lib/taurus/core/util/property_parser.py (renamed from taurus/lib/taurus/core/util/property_parser.py)0
-rw-r--r--lib/taurus/core/util/propertyfile.py (renamed from taurus/lib/taurus/core/util/propertyfile.py)0
-rw-r--r--lib/taurus/core/util/remotelogmonitor.py (renamed from taurus/lib/taurus/core/util/remotelogmonitor.py)0
-rw-r--r--lib/taurus/core/util/report/__init__.py (renamed from taurus/lib/taurus/core/util/report/__init__.py)0
-rw-r--r--lib/taurus/core/util/report/report.py (renamed from taurus/lib/taurus/core/util/report/report.py)0
-rw-r--r--lib/taurus/core/util/safeeval.py (renamed from taurus/lib/taurus/core/util/safeeval.py)0
-rw-r--r--lib/taurus/core/util/singleton.py (renamed from taurus/lib/taurus/core/util/singleton.py)0
-rw-r--r--lib/taurus/core/util/sourcecode.py (renamed from taurus/lib/taurus/core/util/sourcecode.py)0
-rw-r--r--lib/taurus/core/util/tablepprint.py (renamed from taurus/lib/taurus/core/util/tablepprint.py)0
-rw-r--r--lib/taurus/core/util/tb.py (renamed from taurus/lib/taurus/core/util/tb.py)0
-rw-r--r--lib/taurus/core/util/test/__init__.py (renamed from taurus/lib/taurus/core/util/test/__init__.py)0
-rw-r--r--lib/taurus/core/util/test/test_codecs.py (renamed from taurus/lib/taurus/core/util/test/test_codecs.py)0
-rw-r--r--lib/taurus/core/util/test/test_timer.py (renamed from taurus/lib/taurus/core/util/test/test_timer.py)0
-rw-r--r--lib/taurus/core/util/threadpool.py (renamed from taurus/lib/taurus/core/util/threadpool.py)0
-rw-r--r--lib/taurus/core/util/timer.py (renamed from taurus/lib/taurus/core/util/timer.py)0
-rw-r--r--lib/taurus/core/util/user.py (renamed from taurus/lib/taurus/core/util/user.py)0
-rw-r--r--lib/taurus/core/util/whichexecutable.py (renamed from taurus/lib/taurus/core/util/whichexecutable.py)0
-rw-r--r--lib/taurus/core/util/wrap.py (renamed from taurus/lib/taurus/core/util/wrap.py)0
-rw-r--r--lib/taurus/core/utils/__init__.py (renamed from taurus/lib/taurus/core/utils/__init__.py)0
-rw-r--r--lib/taurus/external/__init__.py (renamed from taurus/lib/taurus/external/__init__.py)0
-rw-r--r--lib/taurus/external/argparse/LICENSE.txt (renamed from taurus/lib/taurus/external/argparse/LICENSE.txt)0
-rw-r--r--lib/taurus/external/argparse/__init__.py (renamed from taurus/lib/taurus/external/argparse/__init__.py)0
-rw-r--r--lib/taurus/external/argparse/argparse_local.py (renamed from taurus/lib/taurus/external/argparse/argparse_local.py)0
-rw-r--r--lib/taurus/external/enum/__init__.py (renamed from taurus/lib/taurus/external/enum/__init__.py)0
-rw-r--r--lib/taurus/external/enum/enum/__init__.py (renamed from taurus/lib/taurus/external/enum/enum/__init__.py)0
-rw-r--r--lib/taurus/external/ordereddict/__init__.py (renamed from taurus/lib/taurus/external/ordereddict/__init__.py)0
-rw-r--r--lib/taurus/external/ordereddict/ordereddict.py (renamed from taurus/lib/taurus/external/ordereddict/ordereddict.py)0
-rw-r--r--lib/taurus/external/pint/__init__.py (renamed from taurus/lib/taurus/external/pint/__init__.py)0
-rw-r--r--lib/taurus/external/pint/pint/__init__.py (renamed from taurus/lib/taurus/external/pint/pint/__init__.py)0
-rw-r--r--lib/taurus/external/pint/pint/compat.py (renamed from taurus/lib/taurus/external/pint/pint/compat.py)0
-rw-r--r--lib/taurus/external/pint/pint/constants_en.txt (renamed from taurus/lib/taurus/external/pint/pint/constants_en.txt)0
-rw-r--r--lib/taurus/external/pint/pint/context.py (renamed from taurus/lib/taurus/external/pint/pint/context.py)0
-rw-r--r--lib/taurus/external/pint/pint/default_en.txt (renamed from taurus/lib/taurus/external/pint/pint/default_en.txt)0
-rw-r--r--lib/taurus/external/pint/pint/measurement.py (renamed from taurus/lib/taurus/external/pint/pint/measurement.py)0
-rw-r--r--lib/taurus/external/pint/pint/quantity.py (renamed from taurus/lib/taurus/external/pint/pint/quantity.py)0
-rw-r--r--lib/taurus/external/pint/pint/unit.py (renamed from taurus/lib/taurus/external/pint/pint/unit.py)0
-rw-r--r--lib/taurus/external/pint/pint/util.py (renamed from taurus/lib/taurus/external/pint/pint/util.py)0
-rw-r--r--lib/taurus/external/qt/Qt.py (renamed from taurus/lib/taurus/external/qt/Qt.py)0
-rw-r--r--lib/taurus/external/qt/QtCore.py (renamed from taurus/lib/taurus/external/qt/QtCore.py)0
-rw-r--r--lib/taurus/external/qt/QtDesigner.py (renamed from taurus/lib/taurus/external/qt/QtDesigner.py)0
-rw-r--r--lib/taurus/external/qt/QtGui.py (renamed from taurus/lib/taurus/external/qt/QtGui.py)0
-rw-r--r--lib/taurus/external/qt/QtHelp.py (renamed from taurus/lib/taurus/external/qt/QtHelp.py)0
-rw-r--r--lib/taurus/external/qt/QtNetwork.py (renamed from taurus/lib/taurus/external/qt/QtNetwork.py)0
-rw-r--r--lib/taurus/external/qt/QtSvg.py (renamed from taurus/lib/taurus/external/qt/QtSvg.py)0
-rw-r--r--lib/taurus/external/qt/QtUiTools.py (renamed from taurus/lib/taurus/external/qt/QtUiTools.py)0
-rw-r--r--lib/taurus/external/qt/QtWebKit.py (renamed from taurus/lib/taurus/external/qt/QtWebKit.py)0
-rw-r--r--lib/taurus/external/qt/Qwt5.py (renamed from taurus/lib/taurus/external/qt/Qwt5.py)0
-rw-r--r--lib/taurus/external/qt/__init__.py (renamed from taurus/lib/taurus/external/qt/__init__.py)0
-rw-r--r--lib/taurus/external/qt/uic.py (renamed from taurus/lib/taurus/external/qt/uic.py)0
-rw-r--r--lib/taurus/external/test/__init__.py (renamed from taurus/lib/taurus/external/test/__init__.py)0
-rw-r--r--lib/taurus/external/test/test_qt.py (renamed from taurus/lib/taurus/external/test/test_qt.py)0
-rw-r--r--lib/taurus/external/unittest/__init__.py (renamed from taurus/lib/taurus/external/unittest/__init__.py)0
-rw-r--r--lib/taurus/qt/Qt.py (renamed from taurus/lib/taurus/qt/Qt.py)0
-rw-r--r--lib/taurus/qt/QtCore.py (renamed from taurus/lib/taurus/qt/QtCore.py)0
-rw-r--r--lib/taurus/qt/QtDesigner.py (renamed from taurus/lib/taurus/qt/QtDesigner.py)0
-rw-r--r--lib/taurus/qt/QtGui.py (renamed from taurus/lib/taurus/qt/QtGui.py)0
-rw-r--r--lib/taurus/qt/QtNetwork.py (renamed from taurus/lib/taurus/qt/QtNetwork.py)0
-rw-r--r--lib/taurus/qt/QtSvg.py (renamed from taurus/lib/taurus/qt/QtSvg.py)0
-rw-r--r--lib/taurus/qt/QtUiTools.py (renamed from taurus/lib/taurus/qt/QtUiTools.py)0
-rw-r--r--lib/taurus/qt/QtWebKit.py (renamed from taurus/lib/taurus/qt/QtWebKit.py)0
-rw-r--r--lib/taurus/qt/Qwt5.py (renamed from taurus/lib/taurus/qt/Qwt5.py)0
-rw-r--r--lib/taurus/qt/__init__.py (renamed from taurus/lib/taurus/qt/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/communication/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/communication/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/communication/communication.py (renamed from taurus/lib/taurus/qt/qtcore/communication/communication.py)0
-rw-r--r--lib/taurus/qt/qtcore/configuration/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/configuration/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/configuration/configuration.py (renamed from taurus/lib/taurus/qt/qtcore/configuration/configuration.py)0
-rw-r--r--lib/taurus/qt/qtcore/mimetypes/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/mimetypes/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/mimetypes/mimetypes.py (renamed from taurus/lib/taurus/qt/qtcore/mimetypes/mimetypes.py)0
-rw-r--r--lib/taurus/qt/qtcore/model/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/model/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/model/taurusdatabasemodel.py (renamed from taurus/lib/taurus/qt/qtcore/model/taurusdatabasemodel.py)0
-rw-r--r--lib/taurus/qt/qtcore/model/taurusmodel.py (renamed from taurus/lib/taurus/qt/qtcore/model/taurusmodel.py)0
-rw-r--r--lib/taurus/qt/qtcore/tango/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/tango/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/taurusqlistener.py (renamed from taurus/lib/taurus/qt/qtcore/taurusqlistener.py)0
-rw-r--r--lib/taurus/qt/qtcore/util/__init__.py (renamed from taurus/lib/taurus/qt/qtcore/util/__init__.py)0
-rw-r--r--lib/taurus/qt/qtcore/util/emitter.py (renamed from taurus/lib/taurus/qt/qtcore/util/emitter.py)0
-rw-r--r--lib/taurus/qt/qtcore/util/properties.py (renamed from taurus/lib/taurus/qt/qtcore/util/properties.py)0
-rw-r--r--lib/taurus/qt/qtcore/util/tauruslog.py (renamed from taurus/lib/taurus/qt/qtcore/util/tauruslog.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/__init__.py (renamed from taurus/lib/taurus/qt/qtdesigner/__init__.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/containerplugin.py (renamed from taurus/lib/taurus/qt/qtdesigner/containerplugin.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/extraguiqwtplugin.py (renamed from taurus/lib/taurus/qt/qtdesigner/extraguiqwtplugin.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/taurusdesigner.py (renamed from taurus/lib/taurus/qt/qtdesigner/taurusdesigner.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/taurusplugin/__init__.py (renamed from taurus/lib/taurus/qt/qtdesigner/taurusplugin/__init__.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/taurusplugin/taurusplugin.py (renamed from taurus/lib/taurus/qt/qtdesigner/taurusplugin/taurusplugin.py)0
-rw-r--r--lib/taurus/qt/qtdesigner/tauruspluginplugin.py (renamed from taurus/lib/taurus/qt/qtdesigner/tauruspluginplugin.py)0
-rw-r--r--lib/taurus/qt/qtgui/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/application/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/application/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/application/taurusapplication.py (renamed from taurus/lib/taurus/qt/qtgui/application/taurusapplication.py)0
-rw-r--r--lib/taurus/qt/qtgui/base/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/base/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/base/taurusbase.py (renamed from taurus/lib/taurus/qt/qtgui/base/taurusbase.py)0
-rw-r--r--lib/taurus/qt/qtgui/base/tauruscontroller.py (renamed from taurus/lib/taurus/qt/qtgui/base/tauruscontroller.py)0
-rw-r--r--lib/taurus/qt/qtgui/base/taurusqattribute.py (renamed from taurus/lib/taurus/qt/qtgui/base/taurusqattribute.py)0
-rw-r--r--lib/taurus/qt/qtgui/button/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/button/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/button/qbuttonbox.py (renamed from taurus/lib/taurus/qt/qtgui/button/qbuttonbox.py)0
-rw-r--r--lib/taurus/qt/qtgui/button/taurusbutton.py (renamed from taurus/lib/taurus/qt/qtgui/button/taurusbutton.py)0
-rw-r--r--lib/taurus/qt/qtgui/button/test/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/button/test/__init__.py)0
-rwxr-xr-xlib/taurus/qt/qtgui/button/test/res/Timeout (renamed from taurus/lib/taurus/qt/qtgui/button/test/res/Timeout)0
-rw-r--r--lib/taurus/qt/qtgui/button/test/res/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/button/test/res/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/button/test/test_taurusbutton.py (renamed from taurus/lib/taurus/qt/qtgui/button/test/test_taurusbutton.py)0
-rw-r--r--lib/taurus/qt/qtgui/compact/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/compact/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/compact/abstractswitcher.py (renamed from taurus/lib/taurus/qt/qtgui/compact/abstractswitcher.py)0
-rw-r--r--lib/taurus/qt/qtgui/compact/basicswitcher.py (renamed from taurus/lib/taurus/qt/qtgui/compact/basicswitcher.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/console/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/taurusconsole.py (renamed from taurus/lib/taurus/qt/qtgui/console/taurusconsole.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/taurusconsoleapplication.py (renamed from taurus/lib/taurus/qt/qtgui/console/taurusconsoleapplication.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/taurusconsoleextensions.py (renamed from taurus/lib/taurus/qt/qtgui/console/taurusconsoleextensions.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/taurusconsolefactory.py (renamed from taurus/lib/taurus/qt/qtgui/console/taurusconsolefactory.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/taurusconsolewidget.py (renamed from taurus/lib/taurus/qt/qtgui/console/taurusconsolewidget.py)0
-rw-r--r--lib/taurus/qt/qtgui/console/taurusconsolewindow.py (renamed from taurus/lib/taurus/qt/qtgui/console/taurusconsolewindow.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/container/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/qcontainer.py (renamed from taurus/lib/taurus/qt/qtgui/container/qcontainer.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/taurusbasecontainer.py (renamed from taurus/lib/taurus/qt/qtgui/container/taurusbasecontainer.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/taurusframe.py (renamed from taurus/lib/taurus/qt/qtgui/container/taurusframe.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/taurusgroupbox.py (renamed from taurus/lib/taurus/qt/qtgui/container/taurusgroupbox.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/taurusgroupwidget.py (renamed from taurus/lib/taurus/qt/qtgui/container/taurusgroupwidget.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/taurusmainwindow.py (renamed from taurus/lib/taurus/qt/qtgui/container/taurusmainwindow.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/taurusscrollarea.py (renamed from taurus/lib/taurus/qt/qtgui/container/taurusscrollarea.py)0
-rw-r--r--lib/taurus/qt/qtgui/container/tauruswidget.py (renamed from taurus/lib/taurus/qt/qtgui/container/tauruswidget.py)0
-rw-r--r--lib/taurus/qt/qtgui/dialog/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/dialog/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/dialog/taurusconfigurationdialog.py (renamed from taurus/lib/taurus/qt/qtgui/dialog/taurusconfigurationdialog.py)0
-rw-r--r--lib/taurus/qt/qtgui/dialog/taurusinputdialog.py (renamed from taurus/lib/taurus/qt/qtgui/dialog/taurusinputdialog.py)0
-rw-r--r--lib/taurus/qt/qtgui/dialog/taurusmessagebox.py (renamed from taurus/lib/taurus/qt/qtgui/dialog/taurusmessagebox.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/display/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/demo/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/display/demo/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/demo/qpixmapwidgetdemo.py (renamed from taurus/lib/taurus/qt/qtgui/display/demo/qpixmapwidgetdemo.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/demo/tauruslabeldemo.py (renamed from taurus/lib/taurus/qt/qtgui/display/demo/tauruslabeldemo.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/demo/tauruslcddemo.py (renamed from taurus/lib/taurus/qt/qtgui/display/demo/tauruslcddemo.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/demo/taurusleddemo.py (renamed from taurus/lib/taurus/qt/qtgui/display/demo/taurusleddemo.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/qfallback.py (renamed from taurus/lib/taurus/qt/qtgui/display/qfallback.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/qled.py (renamed from taurus/lib/taurus/qt/qtgui/display/qled.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/qlogo.py (renamed from taurus/lib/taurus/qt/qtgui/display/qlogo.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/qpixmapwidget.py (renamed from taurus/lib/taurus/qt/qtgui/display/qpixmapwidget.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/qsevensegment.py (renamed from taurus/lib/taurus/qt/qtgui/display/qsevensegment.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/taurusboolled.py (renamed from taurus/lib/taurus/qt/qtgui/display/taurusboolled.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/taurusconfiglabel.py (renamed from taurus/lib/taurus/qt/qtgui/display/taurusconfiglabel.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/tauruslabel.py (renamed from taurus/lib/taurus/qt/qtgui/display/tauruslabel.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/tauruslcd.py (renamed from taurus/lib/taurus/qt/qtgui/display/tauruslcd.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/tauruslcdvalue.py (renamed from taurus/lib/taurus/qt/qtgui/display/tauruslcdvalue.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/taurusled.py (renamed from taurus/lib/taurus/qt/qtgui/display/taurusled.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/taurusstateled.py (renamed from taurus/lib/taurus/qt/qtgui/display/taurusstateled.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/taurusvaluelabel.py (renamed from taurus/lib/taurus/qt/qtgui/display/taurusvaluelabel.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/test/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/display/test/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/display/test/test_tauruslabel.py (renamed from taurus/lib/taurus/qt/qtgui/display/test/test_tauruslabel.py)0
-rw-r--r--lib/taurus/qt/qtgui/editor/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/editor/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/editor/tauruseditor.py (renamed from taurus/lib/taurus/qt/qtgui/editor/tauruseditor.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/builder.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/builder.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/curve.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/curve.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/curvesmodel.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/curvesmodel.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/image.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/image.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/plot.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/plot.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/styles.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/styles.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/taurustrend2d.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/taurustrend2d.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/tools.py (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/tools.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_guiqwt/ui/CurveItemConfDlg.ui (renamed from taurus/lib/taurus/qt/qtgui/extra_guiqwt/ui/CurveItemConfDlg.ui)0
-rw-r--r--lib/taurus/qt/qtgui/extra_macroexecutor/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/extra_macroexecutor/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_nexus/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/extra_nexus/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_nexus/taurusnexuswidget.py (renamed from taurus/lib/taurus/qt/qtgui/extra_nexus/taurusnexuswidget.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_pool/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/extra_pool/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_sardana/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/extra_sardana/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_xterm/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/extra_xterm/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/extra_xterm/qxtermwidget.py (renamed from taurus/lib/taurus/qt/qtgui/extra_xterm/qxtermwidget.py)0
-rw-r--r--lib/taurus/qt/qtgui/gauge/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/gauge/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/gauge/demo/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/gauge/demo/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/gauge/demo/qmeterdemo.py (renamed from taurus/lib/taurus/qt/qtgui/gauge/demo/qmeterdemo.py)0
-rw-r--r--lib/taurus/qt/qtgui/gauge/qmeter.py (renamed from taurus/lib/taurus/qt/qtgui/gauge/qmeter.py)0
-rw-r--r--lib/taurus/qt/qtgui/gauge/taurusgauge.py (renamed from taurus/lib/taurus/qt/qtgui/gauge/taurusgauge.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/jdraw_parser.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_parser.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/test/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/test/res/SimpleScalarViewer.jdw (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/SimpleScalarViewer.jdw)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/test/res/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/jdraw/test/res/styles.jdw (renamed from taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/styles.jdw)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/taurusgraphic.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/taurusgraphic.py)0
-rw-r--r--lib/taurus/qt/qtgui/graphic/taurusgraphicview.py (renamed from taurus/lib/taurus/qt/qtgui/graphic/taurusgraphicview.py)0
-rw-r--r--lib/taurus/qt/qtgui/help/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/help/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/help/aboutdialog.py (renamed from taurus/lib/taurus/qt/qtgui/help/aboutdialog.py)0
-rw-r--r--lib/taurus/qt/qtgui/help/assistant.py (renamed from taurus/lib/taurus/qt/qtgui/help/assistant.py)0
-rw-r--r--lib/taurus/qt/qtgui/help/helppanel.py (renamed from taurus/lib/taurus/qt/qtgui/help/helppanel.py)0
-rw-r--r--lib/taurus/qt/qtgui/help/ui/AboutDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/help/ui/AboutDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/image/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/image/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/image/taurusqub.py (renamed from taurus/lib/taurus/qt/qtgui/image/taurusqub.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/input/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/choicedlg.py (renamed from taurus/lib/taurus/qt/qtgui/input/choicedlg.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/qwheel.py (renamed from taurus/lib/taurus/qt/qtgui/input/qwheel.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/tauruscheckbox.py (renamed from taurus/lib/taurus/qt/qtgui/input/tauruscheckbox.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/tauruscombobox.py (renamed from taurus/lib/taurus/qt/qtgui/input/tauruscombobox.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/tauruslineedit.py (renamed from taurus/lib/taurus/qt/qtgui/input/tauruslineedit.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/taurusspinbox.py (renamed from taurus/lib/taurus/qt/qtgui/input/taurusspinbox.py)0
-rw-r--r--lib/taurus/qt/qtgui/input/tauruswheel.py (renamed from taurus/lib/taurus/qt/qtgui/input/tauruswheel.py)0
-rw-r--r--lib/taurus/qt/qtgui/model/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/model/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/model/qbasemodel.py (renamed from taurus/lib/taurus/qt/qtgui/model/qbasemodel.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/panel/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/qdataexportdialog.py (renamed from taurus/lib/taurus/qt/qtgui/panel/qdataexportdialog.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/qdoublelist.py (renamed from taurus/lib/taurus/qt/qtgui/panel/qdoublelist.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/qrawdatachooser.py (renamed from taurus/lib/taurus/qt/qtgui/panel/qrawdatachooser.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/report/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/panel/report/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/report/albareport.py (renamed from taurus/lib/taurus/qt/qtgui/panel/report/albareport.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/report/basicreport.py (renamed from taurus/lib/taurus/qt/qtgui/panel/report/basicreport.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/report/ui/SendMailForm.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/report/ui/SendMailForm.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusattributechooser.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusattributechooser.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusconfigbrowser.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusconfigbrowser.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusconfigeditor.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusconfigeditor.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusconfigurationpanel.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusconfigurationpanel.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusdevicepanel.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusdevicepanel.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusfilterpanel.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusfilterpanel.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusform.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusform.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusinputpanel.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusinputpanel.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusmessagepanel.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusmessagepanel.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusmodelchooser.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusmodelchooser.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusmodellist.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusmodellist.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/taurusvalue.py (renamed from taurus/lib/taurus/qt/qtgui/panel/taurusvalue.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/test/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/panel/test/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/test/test_taurusform.py (renamed from taurus/lib/taurus/qt/qtgui/panel/test/test_taurusform.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/test/test_taurusvalue.py (renamed from taurus/lib/taurus/qt/qtgui/panel/test/test_taurusvalue.py)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/QDataExportDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/QDataExportDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/QDoubleListDlg.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/QDoubleListDlg.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/QRawDataWidget.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/QRawDataWidget.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/TaurusAttributeChooser.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/TaurusAttributeChooser.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/TaurusConfigurationPanel.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/TaurusConfigurationPanel.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/TaurusDevPanel.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/TaurusDevPanel.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/TaurusFilterPanel.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/TaurusFilterPanel.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/TaurusInputPanel.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/TaurusInputPanel.ui)0
-rw-r--r--lib/taurus/qt/qtgui/panel/ui/TaurusMessagePanel.ui (renamed from taurus/lib/taurus/qt/qtgui/panel/ui/TaurusMessagePanel.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/plot/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/arrayedit.py (renamed from taurus/lib/taurus/qt/qtgui/plot/arrayedit.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/curveStatsDlg.py (renamed from taurus/lib/taurus/qt/qtgui/plot/curveStatsDlg.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/curveprops.py (renamed from taurus/lib/taurus/qt/qtgui/plot/curveprops.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/curvesAppearanceChooserDlg.py (renamed from taurus/lib/taurus/qt/qtgui/plot/curvesAppearanceChooserDlg.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/monitor.py (renamed from taurus/lib/taurus/qt/qtgui/plot/monitor.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/qwtdialog.py (renamed from taurus/lib/taurus/qt/qtgui/plot/qwtdialog.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/qwtplot.py (renamed from taurus/lib/taurus/qt/qtgui/plot/qwtplot.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/scales.py (renamed from taurus/lib/taurus/qt/qtgui/plot/scales.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/taurusarrayedit.py (renamed from taurus/lib/taurus/qt/qtgui/plot/taurusarrayedit.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/taurusplot.py (renamed from taurus/lib/taurus/qt/qtgui/plot/taurusplot.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/taurusplotconf.py (renamed from taurus/lib/taurus/qt/qtgui/plot/taurusplotconf.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/taurustrend.py (renamed from taurus/lib/taurus/qt/qtgui/plot/taurustrend.py)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/AddCPointsDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/AddCPointsDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/ArrayEditor.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/ArrayEditor.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/ControllerBox.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/ControllerBox.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/CurvePropertiesView.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/CurvePropertiesView.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/CurveStatsDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/CurveStatsDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/CurvesAppearanceChooser.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/CurvesAppearanceChooser.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/EditCPointsDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/EditCPointsDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfDlg.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfDlg.ui)0
-rw-r--r--lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfigDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfigDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/resource/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/resource/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/resource/external/class.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/class.png)bin377 -> 377 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/function.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/function.png)bin407 -> 407 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/ipython.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/ipython.png)bin714 -> 714 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/jive/class.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/jive/class.png)bin1179 -> 1179 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/jive/device.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/jive/device.png)bin1179 -> 1179 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/jive/server.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/jive/server.png)bin1179 -> 1179 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/python-console.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/python-console.png)bin9452 -> 9452 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/python-file.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/python-file.png)bin226347 -> 226347 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/python-module.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/python-module.png)bin654 -> 654 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/python-package.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/python-package.png)bin226347 -> 226347 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/python.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/python.png)bin3218 -> 3218 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/pythonw-console.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/pythonw-console.png)bin194192 -> 194192 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/external/tango.png (renamed from taurus/lib/taurus/qt/qtgui/resource/external/tango.png)bin65946 -> 65946 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-all.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-all.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-selection.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-selection.png)bin712 -> 712 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse.png)bin596 -> 596 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-all.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-all.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-selection.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-selection.png)bin728 -> 728 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/expand.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand.png)bin607 -> 607 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/go-backward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-backward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/go-forward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-forward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-backward-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-backward-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-forward-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-forward-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_backward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_backward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_pause.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_pause.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_start.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_start.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop_green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop_green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_backward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_backward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_forward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_forward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_backward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_backward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_forward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_forward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/actions/stop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/stop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/arrow01.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/arrow01.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/color-fill.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/color-fill.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/arrayedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/arrayedit.png)bin686 -> 686 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/back.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/back.png)bin678 -> 678 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/calendarwidget.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/calendarwidget.png)bin968 -> 968 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/checkbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/checkbox.png)bin817 -> 817 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/circular_gauge.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/circular_gauge.png)bin1526 -> 1526 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/columnview.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/columnview.png)bin518 -> 518 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/combobox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/combobox.png)bin853 -> 853 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/commandlinkbutton.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/commandlinkbutton.png)bin1208 -> 1208 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/compression.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/compression.png)bin2097 -> 2097 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/dateedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dateedit.png)bin672 -> 672 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/datetimeedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/datetimeedit.png)bin1132 -> 1132 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_table.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_table.png)bin606 -> 606 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_tree.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_tree.png)bin3709 -> 3709 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/dial.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dial.png)bin978 -> 978 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/dialogbuttonbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dialogbuttonbox.png)bin1003 -> 1003 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/dockwidget.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dockwidget.png)bin638 -> 638 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/doublespinbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/doublespinbox.png)bin749 -> 749 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/down.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/down.png)bin594 -> 594 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/editdelete.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/editdelete.png)bin831 -> 831 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/extra_motor.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/extra_motor.png)bin2134 -> 2134 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/filereader.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/filereader.png)bin1275 -> 1275 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/fontcombobox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/fontcombobox.png)bin966 -> 966 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/forward.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/forward.png)bin655 -> 655 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/frame.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/frame.png)bin721 -> 721 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/graphicsview.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/graphicsview.png)bin1182 -> 1182 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/grid.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/grid.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/groupbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupbox.png)bin439 -> 439 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/groupboxcollapsible.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupboxcollapsible.png)bin702 -> 702 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/groupwidget.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupwidget.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/horizontal_linear_gauge.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/horizontal_linear_gauge.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/hscrollbar.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hscrollbar.png)bin408 -> 408 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/hslider.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hslider.png)bin729 -> 729 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/hsplit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hsplit.png)bin164 -> 164 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/label.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/label.png)bin953 -> 953 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/lcdnumber.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/lcdnumber.png)bin555 -> 555 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/ledgreen.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledgreen.png)bin1415 -> 1415 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/ledred.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledred.png)bin1416 -> 1416 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/line.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/line.png)bin287 -> 287 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/lineedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/lineedit.png)bin405 -> 405 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/listbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/listbox.png)bin797 -> 797 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/listview.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/listview.png)bin756 -> 756 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/macroserver.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/macroserver.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/mdiarea.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/mdiarea.png)bin643 -> 643 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/minus.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/minus.png)bin250 -> 250 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/plaintextedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/plaintextedit.png)bin807 -> 807 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/plus.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/plus.png)bin462 -> 462 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/progress.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/progress.png)bin559 -> 559 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/props_table.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/props_table.png)bin606 -> 606 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/pushbutton.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/pushbutton.png)bin408 -> 408 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/qwtplot.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/qwtplot.png)bin543 -> 543 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/radiobutton.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/radiobutton.png)bin586 -> 586 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/scheduler.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/scheduler.png)bin1212 -> 1212 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/scrollarea.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/scrollarea.png)bin548 -> 548 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/spacer.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/spacer.png)bin686 -> 686 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/spinbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/spinbox.png)bin680 -> 680 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/state.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/state.png)bin2097 -> 2097 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/tabbar.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabbar.png)bin623 -> 623 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/table.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/table.png)bin483 -> 483 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/tabwidget.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabwidget.png)bin572 -> 572 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/tau.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tau.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/taurus.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/taurus.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/textedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/textedit.png)bin823 -> 823 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/timeedit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/timeedit.png)bin1353 -> 1353 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbox.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbox.png)bin783 -> 783 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbutton.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbutton.png)bin1167 -> 1167 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/up.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/up.png)bin692 -> 692 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/vertical_linear_gauge.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vertical_linear_gauge.png)bin2116 -> 2116 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/vline.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vline.png)bin314 -> 314 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/vscrollbar.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vscrollbar.png)bin415 -> 415 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/vslider.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vslider.png)bin726 -> 726 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/vspacer.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vspacer.png)bin677 -> 677 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/wheeledit.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/wheeledit.png)bin2079 -> 2079 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/widget.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/widget.png)bin716 -> 716 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/widgetstack.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/widgetstack.png)bin828 -> 828 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/wizard.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/wizard.png)bin898 -> 898 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomin.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomin.png)bin1208 -> 1208 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomout.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomout.png)bin1226 -> 1226 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblue.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblue.png)bin1363 -> 1363 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblueoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblueoff.png)bin1248 -> 1248 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreen.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreen.png)bin1307 -> 1307 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreenoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreenoff.png)bin1244 -> 1244 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorange.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorange.png)bin1260 -> 1260 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorangeoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorangeoff.png)bin1223 -> 1223 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledred.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledred.png)bin1165 -> 1165 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledredoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledredoff.png)bin1188 -> 1188 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellow.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellow.png)bin1257 -> 1257 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellowoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellowoff.png)bin1256 -> 1256 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_off.png)bin29069 -> 29069 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_on.png)bin29069 -> 29069 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_off.png)bin44340 -> 44340 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_on.png)bin50315 -> 50315 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_off.png)bin46475 -> 46475 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_on.png)bin51280 -> 51280 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_off.png)bin33008 -> 33008 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_on.png)bin35547 -> 35547 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_off.png)bin29804 -> 29804 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_on.png)bin34363 -> 34363 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_off.png)bin29069 -> 29069 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_off.png)bin46366 -> 46366 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_on.png)bin50776 -> 50776 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_off.png)bin46567 -> 46567 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_on.png)bin51718 -> 51718 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_off.png)bin262963 -> 262963 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_on.png)bin29566 -> 29566 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_off.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_off.png)bin48203 -> 48203 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_on.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_on.png)bin51378 -> 51378 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblue.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblue.png)bin3370 -> 3370 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblueoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblueoff.png)bin3102 -> 3102 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreen.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreen.png)bin3152 -> 3152 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreenoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreenoff.png)bin3043 -> 3043 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorange.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorange.png)bin2935 -> 2935 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorangeoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorangeoff.png)bin2981 -> 2981 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledred.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledred.png)bin2889 -> 2889 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledredoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledredoff.png)bin2793 -> 2793 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellow.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellow.png)bin3164 -> 3164 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellowoff.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellowoff.png)bin3119 -> 3119 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/lock_locked.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/lock_locked_unpreviledged.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked_unpreviledged.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/lock_unknown.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_unknown.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/lock_unlocked.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_unlocked.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close.png)bin690 -> 690 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_black.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_black.png)bin724 -> 724 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_gray.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_gray.png)bin724 -> 724 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_white.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_white.png)bin219 -> 219 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock.png)bin690 -> 690 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_black.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_black.png)bin724 -> 724 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_gray.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_gray.png)bin724 -> 724 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_white.png (renamed from taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_white.png)bin214 -> 214 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/TaurusSplash.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/TaurusSplash.png)bin41538 -> 41538 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/SardanaEditor.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/SardanaEditor.png)bin623967 -> 623967 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusArrayEditor.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusArrayEditor.png)bin44580 -> 44580 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDbTreeWidget.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDbTreeWidget.png)bin50819 -> 50819 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDevicePanel.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDevicePanel.png)bin107528 -> 107528 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusForm.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusForm.png)bin20154 -> 20154 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusImageDialog.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusImageDialog.png)bin46362 -> 46362 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusJDrawSynopticsView.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusJDrawSynopticsView.png)bin39486 -> 39486 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusNeXusBrowser.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusNeXusBrowser.png)bin40049 -> 40049 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusPlot.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusPlot.png)bin12991 -> 12991 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusQubDataImageDisplay.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusQubDataImageDisplay.png)bin161558 -> 161558 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusShell.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusShell.png)bin10061 -> 10061 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend.png)bin21837 -> 21837 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend2DDialog.png (renamed from taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend2DDialog.png)bin24448 -> 24448 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/action-undo.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/action-undo.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/add-participant.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add-participant.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/add.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/approval.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/approval.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/arrange-boxes.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/arrange-boxes.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/back-to-ou.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/back-to-ou.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/data-transfer.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/data-transfer.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/delete-all-participants.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/delete-all-participants.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/dial-in.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dial-in.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/down-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/down.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/download.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/download.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-down.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-down.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-left.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-left.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-right.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-right.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-up.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-up.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/email-not-available.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/email-not-available.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/filter.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/filter.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-bottom.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-bottom.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-top.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-top.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/hide.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/hide.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/left-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/left.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/list-all-participants.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/list-all-participants.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/load-settings.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/load-settings.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-in.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-in.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-out.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-out.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/manage-settings.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/manage-settings.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/merge-affiliation.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/merge-affiliation.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/monitoring.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/monitoring.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-to-participant-green-arrow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-to-participant-green-arrow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/print.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/print.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/refuse.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/refuse.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/right-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/right.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/run.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/run.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-group.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-group.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user-other.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user-other.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/show.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/show.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/split-affiliation.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/split-affiliation.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-down_up.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-down_up.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-left_right.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-left_right.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-right_left.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-right_left.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-up_down.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-up_down.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/up-grey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up-grey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/up.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/upload.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/upload.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/view.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/view.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/actions/workflow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/workflow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-employee.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-employee.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-guest.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-guest.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-student.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-student.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/alumni-group.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/alumni-group.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/book-marks.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book-marks.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/book.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/bookmark.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/bookmark.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/icon-inspector.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/icon-inspector.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/magnifying-glass.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/magnifying-glass.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-yellow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-yellow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin-gear.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin-gear.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-business.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-business.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-customer.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-customer.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-digital-person.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-digital-person.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-disabled.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-disabled.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-employee.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-employee.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-endcustomer.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-endcustomer.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-enrolee.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-enrolee.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner-group.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner-group.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-expert.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-expert.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-group.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-group.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk-faq.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk-faq.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-library.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-library.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-manager.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-manager.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-business.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-business.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-female.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-female.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-partner.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-partner.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd-group.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd-group.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-real-person.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-real-person.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student-assistant.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student-assistant.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-unknown.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-unknown.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/database-locked.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/database-locked.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/modem.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/modem.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/router.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/router.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-access.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-access.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-accounting.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-accounting.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-blades.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-blades.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-book.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-book.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-firebird.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-firebird.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-mysql.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-mysql.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-otrs.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-otrs.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-postgres.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-postgres.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-yellow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-yellow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-yellow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-yellow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email-relay.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email-relay.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-file.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-file.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-firewall.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-firewall.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-monitoring.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-monitoring.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-multiple.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-multiple.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-print.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-print.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-radius.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-radius.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-subversion.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-subversion.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-user.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-user.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-vpn.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-vpn.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-secure.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-secure.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-yellow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-yellow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-yellow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-yellow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/server.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/switch.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/switch.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-access-point.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-access-point.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-controller.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-controller.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/devices/workstation.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/workstation.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-delete.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-delete.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-edit.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-edit.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation-abstract.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation-abstract.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affirmation.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affirmation.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/all-per-page.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/all-per-page.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/at.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/at.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes-u.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes-u.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-visual-slide.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-visual-slide.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-delete.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-delete.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-firebird.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-firebird.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-mysql.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-mysql.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-openldap.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-openldap.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-otrs.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-otrs.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-postgres.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-postgres.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-vcs-subversion.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-vcs-subversion.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-attribute.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-attribute.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object-class.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object-class.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-schema.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-schema.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-syntax.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-syntax.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/doctoral-cap.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/doctoral-cap.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/email.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/email.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/entitlement.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/entitlement.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/export.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/export.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/fifty-per-page.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/fifty-per-page.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/firewall.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/firewall.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/floppy-disc-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/floppy-disc-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/folder.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/folder.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-delete.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-delete.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-edit.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-edit.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/for-free.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/for-free.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/geo-id.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/geo-id.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/globe.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/globe.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/id.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/id.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/index.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/index.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/information.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/information.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/inspector-hat.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/inspector-hat.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/lock.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/lock.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/mailbox.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/mailbox.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-film.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-film.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-floppy-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-floppy-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/message-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/message-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/money.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/money.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/movie-audio.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/movie-audio.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/network-cloud.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/network-cloud.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/note.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/note.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-excel.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-excel.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-word.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-word.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organisational-unit-tree.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organisational-unit-tree.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organizational-unit.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organizational-unit.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-25.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-25.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-50.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-50.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-all.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-all.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/peace-sign.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/peace-sign.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/pen.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/pen.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/phone.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/phone.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/promotion-data.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/promotion-data.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/relay.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/relay.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-delete.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-delete.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-edit.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-edit.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-run.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-run.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-upload.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-upload.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/rss-feed.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/rss-feed.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/single-sign-on.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/single-sign-on.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide-audio.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide-audio.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/statistic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/statistic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/structured-program-stay-abroad.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/structured-program-stay-abroad.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/table.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/table.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/task.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/task.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/template.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/template.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/ten-per-page.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/ten-per-page.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tomcat.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tomcat.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-delete.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-delete.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-move.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-move.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/twenty-five-per-page.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/twenty-five-per-page.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/unix.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/unix.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/video-film.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/video-film.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/webview.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/webview.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-connection.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-connection.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-link.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-link.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wifi.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wifi.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/emblems/zipper.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/zipper.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp3.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp3.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp4.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp4.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/document-pdf.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/document-pdf.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes-u.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes-u.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-visual-slide.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-visual-slide.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie-audio.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie-audio.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-slide-audio.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-slide-audio.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-video-film.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-video-film.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-excel.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-excel.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-word.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-word.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/text-csv-text.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/text-csv-text.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-m4v.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-m4v.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-mov.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-mov.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/available.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/available.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting-plus.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting-plus.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/binational.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/binational.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/error.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/error.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/exclamation-mark.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/exclamation-mark.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/expired.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/expired.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/false.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/false.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/female.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/female.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-clock.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-clock.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-mail.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-mail.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-clock.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-clock.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-mail.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-mail.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-clock.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-clock.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-mail.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-mail.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/hourglass.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/hourglass.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/important.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/important.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/maintenance-time.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/maintenance-time.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/male.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/male.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/not-available.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-available.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/not-known.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-known.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/not-specified.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-specified.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/not-synchronized.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-synchronized.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/synchronized.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/synchronized.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available-clock.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available-clock.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/true-orange.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/true-orange.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/true.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/true.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/unlocked.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/unlocked.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/rrze-icons/status/warning.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/warning.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/address-book-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/address-book-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/appointment-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/appointment-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/bookmark-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/bookmark-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/contact-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/contact-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-open.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-open.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print-preview.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print-preview.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-properties.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-properties.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save-as.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save-as.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-clear.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-clear.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-copy.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-copy.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-cut.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-cut.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-delete.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-delete.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find-replace.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find-replace.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-paste.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-paste.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-redo.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-redo.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-select-all.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-select-all.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-undo.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-undo.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/folder-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/folder-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-less.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-less.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-more.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-more.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-center.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-center.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-fill.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-fill.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-left.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-left.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-right.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-right.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-bold.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-bold.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-italic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-italic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-strikethrough.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-strikethrough.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-underline.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-underline.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-bottom.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-bottom.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-down.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-down.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-first.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-first.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-home.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-home.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-jump.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-jump.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-last.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-last.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-next.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-next.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-previous.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-previous.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-top.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-top.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/go-up.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-up.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/list-add.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-add.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/list-remove.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-remove.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-forward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-forward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-junk.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-junk.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-not-junk.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-not-junk.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-message-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-message-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-all.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-all.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-sender.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-sender.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-send-receive.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-send-receive.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-eject.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-eject.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-pause.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-pause.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-start.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-start.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-stop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-stop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-record.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-record.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-backward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-backward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-forward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-forward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-backward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-backward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-forward.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-forward.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/process-stop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/process-stop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/system-lock-screen.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-lock-screen.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/system-log-out.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-log-out.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/system-search.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-search.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/system-shutdown.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-shutdown.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/tab-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/tab-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/view-fullscreen.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-fullscreen.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/view-refresh.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-refresh.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/actions/window-new.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/window-new.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-calculator.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-calculator.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-character-map.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-character-map.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-text-editor.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-text-editor.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/help-browser.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/help-browser.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-group-chat.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-group-chat.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-mail.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-mail.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-news-reader.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-news-reader.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-web-browser.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-web-browser.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/office-calendar.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/office-calendar.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-accessibility.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-accessibility.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-assistive-technology.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-assistive-technology.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-font.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-font.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-keyboard-shortcuts.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-keyboard-shortcuts.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-locale.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-locale.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-multimedia.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-multimedia.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-remote-desktop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-remote-desktop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-screensaver.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-screensaver.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-theme.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-theme.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-wallpaper.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-wallpaper.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-network-proxy.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-network-proxy.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-session.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-session.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-windows.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-windows.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/system-file-manager.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-file-manager.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/system-installer.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-installer.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/system-software-update.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-software-update.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/system-users.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-users.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-system-monitor.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-system-monitor.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-terminal.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-terminal.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-accessories.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-accessories.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-development.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-development.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-games.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-games.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-graphics.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-graphics.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-internet.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-internet.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-multimedia.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-multimedia.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-office.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-office.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-other.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-other.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-system.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-system.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop-peripherals.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop-peripherals.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-system.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-system.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-card.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-card.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-input-microphone.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-input-microphone.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/battery.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/battery.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-photo.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-photo.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-video.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-video.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/computer.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/computer.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-harddisk.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-harddisk.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-optical.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-optical.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-removable-media.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-removable-media.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/input-gaming.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-gaming.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/input-keyboard.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-keyboard.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/input-mouse.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-mouse.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/media-flash.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-flash.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/media-floppy.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-floppy.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/media-optical.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-optical.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/multimedia-player.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/multimedia-player.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wired.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wired.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wireless.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wireless.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/printer.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/printer.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/devices/video-display.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/video-display.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-favorite.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-favorite.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-important.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-important.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-photos.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-photos.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-readonly.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-readonly.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-symbolic-link.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-symbolic-link.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-system.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-system.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-unreadable.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-unreadable.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-angel.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-angel.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-cool.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-cool.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-crying.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-crying.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-devilish.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-devilish.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-glasses.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-glasses.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-grin.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-grin.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-kiss.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-kiss.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-monkey.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-monkey.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-plain.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-plain.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-sad.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-sad.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile-big.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile-big.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-surprise.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-surprise.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-wink.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-wink.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-certificate.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-certificate.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-x-executable.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-x-executable.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/audio-x-generic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/audio-x-generic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/font-x-generic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/font-x-generic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/image-x-generic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/image-x-generic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/package-x-generic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/package-x-generic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-html.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-html.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic-template.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic-template.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-script.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-script.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/video-x-generic.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/video-x-generic.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-address-book.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-address-book.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-calendar.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-calendar.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document-template.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document-template.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing-template.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing-template.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation-template.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation-template.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet-template.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet-template.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/folder-remote.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-remote.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/folder-saved-search.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-saved-search.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/folder.icon (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.icon)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/folder.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/network-server.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/network-server.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/network-workgroup.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/network-workgroup.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/start-here.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/start-here.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/user-desktop.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-desktop.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/user-home.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-home.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/places/user-trash.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-trash.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-high.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-high.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-low.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-low.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-medium.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-medium.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-muted.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-muted.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/battery-caution.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/battery-caution.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-error.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-error.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-information.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-information.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-warning.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-warning.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.icon (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.icon)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/folder-open.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-open.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.icon (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.icon)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/image-loading.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/image-loading.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/image-missing.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/image-missing.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/mail-attachment.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/mail-attachment.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-error.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-error.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-idle.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-idle.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-offline.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-offline.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-receive.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-receive.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit-receive.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit-receive.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/network-wireless-encrypted.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-wireless-encrypted.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/printer-error.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/printer-error.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-available.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-available.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-urgent.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-urgent.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/user-trash-full.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/user-trash-full.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear-night.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear-night.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds-night.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds-night.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-overcast.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-overcast.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-severe-alert.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-severe-alert.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers-scattered.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers-scattered.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-snow.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-snow.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tango-icons/status/weather-storm.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-storm.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/tau.png (renamed from taurus/lib/taurus/qt/qtgui/resource/tau.png)bin1897 -> 1897 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/taurus.png (renamed from taurus/lib/taurus/qt/qtgui/resource/taurus.png)bin1095 -> 1095 bytes
-rw-r--r--lib/taurus/qt/qtgui/resource/taurus.svg (renamed from taurus/lib/taurus/qt/qtgui/resource/taurus.svg)0
-rw-r--r--lib/taurus/qt/qtgui/resource/taurus_resource_utils.py (renamed from taurus/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py)0
-rw-r--r--lib/taurus/qt/qtgui/style/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/style/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/style/nebula.py (renamed from taurus/lib/taurus/qt/qtgui/style/nebula.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/table/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/qdictionary.py (renamed from taurus/lib/taurus/qt/qtgui/table/qdictionary.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/qlogtable.py (renamed from taurus/lib/taurus/qt/qtgui/table/qlogtable.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/qtable.py (renamed from taurus/lib/taurus/qt/qtgui/table/qtable.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/taurusdbtable.py (renamed from taurus/lib/taurus/qt/qtgui/table/taurusdbtable.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/taurusdevicepropertytable.py (renamed from taurus/lib/taurus/qt/qtgui/table/taurusdevicepropertytable.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/taurusgrid.py (renamed from taurus/lib/taurus/qt/qtgui/table/taurusgrid.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/taurustable.py (renamed from taurus/lib/taurus/qt/qtgui/table/taurustable.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/taurusvaluestable.py (renamed from taurus/lib/taurus/qt/qtgui/table/taurusvaluestable.py)0
-rw-r--r--lib/taurus/qt/qtgui/table/taurusvaluestable_ro.py (renamed from taurus/lib/taurus/qt/qtgui/table/taurusvaluestable_ro.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/PermanentCustomPanelsDlg.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/PermanentCustomPanelsDlg.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/appsettingswizard.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/appsettingswizard.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/__init__.py)0
-rwxr-xr-xlib/taurus/qt/qtgui/taurusgui/conf/gui_noconf.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_noconf.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/gui_pureconf.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_pureconf.py)0
-rwxr-xr-xlib/taurus/qt/qtgui/taurusgui/conf/gui_selfconf.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_selfconf.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/config.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/config.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jdw (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jdw)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jpg (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jpg)bin69071 -> 69071 bytes
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jdw (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jdw)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jpg (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jpg)bin45491 -> 45491 bytes
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/config.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/config.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/tgconf_macrogui.ini (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/tgconf_macrogui.ini)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/macrolistener.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/macrolistener.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/paneldescriptionwizard.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/paneldescriptionwizard.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/taurusgui.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/taurusgui.py)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/ui/AssociationDialog.ui (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/ui/AssociationDialog.ui)0
-rw-r--r--lib/taurus/qt/qtgui/taurusgui/utils.py (renamed from taurus/lib/taurus/qt/qtgui/taurusgui/utils.py)0
-rw-r--r--lib/taurus/qt/qtgui/test/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/test/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/test/base.py (renamed from taurus/lib/taurus/qt/qtgui/test/base.py)0
-rw-r--r--lib/taurus/qt/qtgui/tree/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/tree/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/tree/qtree.py (renamed from taurus/lib/taurus/qt/qtgui/tree/qtree.py)0
-rw-r--r--lib/taurus/qt/qtgui/tree/taurusdbtree.py (renamed from taurus/lib/taurus/qt/qtgui/tree/taurusdbtree.py)0
-rw-r--r--lib/taurus/qt/qtgui/tree/taurusdevicetree.py (renamed from taurus/lib/taurus/qt/qtgui/tree/taurusdevicetree.py)0
-rw-r--r--lib/taurus/qt/qtgui/tree/taurustree.py (renamed from taurus/lib/taurus/qt/qtgui/tree/taurustree.py)0
-rw-r--r--lib/taurus/qt/qtgui/ui/DevMainVariable.ui (renamed from taurus/lib/taurus/qt/qtgui/ui/DevMainVariable.ui)0
-rw-r--r--lib/taurus/qt/qtgui/ui/SaveDataDir.ui (renamed from taurus/lib/taurus/qt/qtgui/ui/SaveDataDir.ui)0
-rw-r--r--lib/taurus/qt/qtgui/util/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/util/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/qdraganddropdebug.py (renamed from taurus/lib/taurus/qt/qtgui/util/qdraganddropdebug.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/taurusaction.py (renamed from taurus/lib/taurus/qt/qtgui/util/taurusaction.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/taurusactionfactory.py (renamed from taurus/lib/taurus/qt/qtgui/util/taurusactionfactory.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/tauruscolor.py (renamed from taurus/lib/taurus/qt/qtgui/util/tauruscolor.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/taurusropepatch.py (renamed from taurus/lib/taurus/qt/qtgui/util/taurusropepatch.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/taurusscreenshot.py (renamed from taurus/lib/taurus/qt/qtgui/util/taurusscreenshot.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/tauruswidget_qtdesignerplugin_template (renamed from taurus/lib/taurus/qt/qtgui/util/tauruswidget_qtdesignerplugin_template)0
-rw-r--r--lib/taurus/qt/qtgui/util/tauruswidget_template (renamed from taurus/lib/taurus/qt/qtgui/util/tauruswidget_template)0
-rw-r--r--lib/taurus/qt/qtgui/util/tauruswidgetfactory.py (renamed from taurus/lib/taurus/qt/qtgui/util/tauruswidgetfactory.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/tauruswidgettree.py (renamed from taurus/lib/taurus/qt/qtgui/util/tauruswidgettree.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/util/test/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/test_ui/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/util/test/test_ui/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/__init__.py (renamed from taurus/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/__init__.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/ui/MyWidget3.ui (renamed from taurus/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/ui/MyWidget3.ui)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/test_ui/test_ui.py (renamed from taurus/lib/taurus/qt/qtgui/util/test/test_ui/test_ui.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/test_ui/ui/MyWidget1.ui (renamed from taurus/lib/taurus/qt/qtgui/util/test/test_ui/ui/MyWidget1.ui)0
-rw-r--r--lib/taurus/qt/qtgui/util/test/test_ui/ui/mywidget2/mywidget2_custom.ui (renamed from taurus/lib/taurus/qt/qtgui/util/test/test_ui/ui/mywidget2/mywidget2_custom.ui)0
-rw-r--r--lib/taurus/qt/qtgui/util/ui.py (renamed from taurus/lib/taurus/qt/qtgui/util/ui.py)0
-rw-r--r--lib/taurus/qt/qtgui/util/widgetgen.py (renamed from taurus/lib/taurus/qt/qtgui/util/widgetgen.py)0
-rw-r--r--lib/taurus/qt/qtopengl/__init__.py (renamed from taurus/lib/taurus/qt/qtopengl/__init__.py)0
-rw-r--r--lib/taurus/qt/uic/__init__.py (renamed from taurus/lib/taurus/qt/uic/__init__.py)0
-rw-r--r--lib/taurus/qt/uic/pyuic4/taurus.py (renamed from taurus/lib/taurus/qt/uic/pyuic4/taurus.py)0
-rw-r--r--lib/taurus/qt/uic/tau2taurus_map.py (renamed from taurus/lib/taurus/qt/uic/tau2taurus_map.py)0
-rw-r--r--lib/taurus/tauruscustomsettings.py (renamed from taurus/lib/taurus/tauruscustomsettings.py)0
-rw-r--r--lib/taurus/test/__init__.py (renamed from taurus/lib/taurus/test/__init__.py)0
-rw-r--r--lib/taurus/test/base.py (renamed from taurus/lib/taurus/test/base.py)0
-rw-r--r--lib/taurus/test/fuzzytest.py (renamed from taurus/lib/taurus/test/fuzzytest.py)0
-rw-r--r--lib/taurus/test/moduleexplorer.py (renamed from taurus/lib/taurus/test/moduleexplorer.py)0
-rw-r--r--lib/taurus/test/resource.py (renamed from taurus/lib/taurus/test/resource.py)0
-rw-r--r--lib/taurus/test/skip.py (renamed from taurus/lib/taurus/test/skip.py)0
-rw-r--r--lib/taurus/test/test_import.py (renamed from taurus/lib/taurus/test/test_import.py)0
-rw-r--r--lib/taurus/test/testsuite.py (renamed from taurus/lib/taurus/test/testsuite.py)0
-rw-r--r--lib/taurus/web/__init__.py (renamed from taurus/lib/taurus/web/__init__.py)0
-rw-r--r--lib/taurus/web/examples/tornado/countclient.html (renamed from taurus/lib/taurus/web/examples/tornado/countclient.html)0
-rw-r--r--lib/taurus/web/examples/tornado/countserver.py (renamed from taurus/lib/taurus/web/examples/tornado/countserver.py)0
-rw-r--r--lib/taurus/web/examples/tornado/demo.html (renamed from taurus/lib/taurus/web/examples/tornado/demo.html)0
-rw-r--r--lib/taurus/web/examples/tornado/demo.py (renamed from taurus/lib/taurus/web/examples/tornado/demo.py)0
-rw-r--r--lib/taurus/web/examples/tornado/demo1.html (renamed from taurus/lib/taurus/web/examples/tornado/demo1.html)0
-rw-r--r--lib/taurus/web/examples/tornado/demo2.html (renamed from taurus/lib/taurus/web/examples/tornado/demo2.html)0
-rw-r--r--lib/taurus/web/examples/tornado/demo3.html (renamed from taurus/lib/taurus/web/examples/tornado/demo3.html)0
-rw-r--r--lib/taurus/web/examples/tornado/demo4.html (renamed from taurus/lib/taurus/web/examples/tornado/demo4.html)0
-rw-r--r--lib/taurus/web/examples/tornado/machinestatus.html (renamed from taurus/lib/taurus/web/examples/tornado/machinestatus.html)0
-rw-r--r--lib/taurus/web/examples/tornado/machinestatus.py (renamed from taurus/lib/taurus/web/examples/tornado/machinestatus.py)0
-rw-r--r--lib/taurus/web/examples/tornado/static/css/demo.css (renamed from taurus/lib/taurus/web/examples/tornado/static/css/demo.css)0
-rw-r--r--lib/taurus/web/examples/tornado/static/css/machinestatus.css (renamed from taurus/lib/taurus/web/examples/tornado/static/css/machinestatus.css)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/countclient.coffee (renamed from taurus/lib/taurus/web/examples/tornado/static/js/countclient.coffee)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/countclient.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/countclient.js)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/demo.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/demo.js)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/demo1.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/demo1.js)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/demo2.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/demo2.js)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/demo3.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/demo3.js)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/demo4.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/demo4.js)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/machinestatus.coffee (renamed from taurus/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee)0
-rw-r--r--lib/taurus/web/examples/tornado/static/js/machinestatus.js (renamed from taurus/lib/taurus/web/examples/tornado/static/js/machinestatus.js)0
-rw-r--r--lib/taurus/web/static/css/digital.ttf (renamed from taurus/lib/taurus/web/static/css/digital.ttf)bin23200 -> 23200 bytes
-rw-r--r--lib/taurus/web/static/css/taurus.css (renamed from taurus/lib/taurus/web/static/css/taurus.css)0
-rw-r--r--lib/taurus/web/static/favicon.ico (renamed from taurus/lib/taurus/web/static/favicon.ico)bin1226 -> 1226 bytes
-rw-r--r--lib/taurus/web/static/js/taurus.coffee (renamed from taurus/lib/taurus/web/static/js/taurus.coffee)0
-rw-r--r--lib/taurus/web/static/js/taurus.js (renamed from taurus/lib/taurus/web/static/js/taurus.js)0
-rw-r--r--lib/taurus/web/taurustornado.py (renamed from taurus/lib/taurus/web/taurustornado.py)0
-rw-r--r--lib/taurus/web/template/index.html (renamed from taurus/lib/taurus/web/template/index.html)0
-rwxr-xr-xmakedist.sh3
-rwxr-xr-xsandbox/mntgrp_gui34
-rw-r--r--sandbox/mntgrp_gui.py343
-rw-r--r--sandbox/mntgrp_gui.ui597
-rwxr-xr-xsandbox/motgrp_gui302
-rw-r--r--sandbox/pool_gui281
-rw-r--r--sardanaConfig/doc/Makefile130
-rw-r--r--sardanaConfig/doc/source/add_device_wizard.rst35
-rw-r--r--sardanaConfig/doc/source/conf.py224
-rw-r--r--sardanaConfig/doc/source/index.rst26
-rw-r--r--sardanaConfig/doc/source/new_sardana_wizard.rst56
-rw-r--r--sardanaConfig/doc/source/settings_widget.rst55
-rw-r--r--sardanaConfig/doc/source/simple_tree_model.rst13
-rw-r--r--sardanaConfig/src/wizards/add_device_wizard.py912
-rw-r--r--sardanaConfig/src/wizards/add_new_hw.py18
-rw-r--r--sardanaConfig/src/wizards/ms_editor_UI.py152
-rw-r--r--sardanaConfig/src/wizards/new_sardana_wizard.py1450
-rw-r--r--sardanaConfig/src/wizards/pool_editor_UI.py119
-rw-r--r--sardanaConfig/src/wizards/pool_page.py156
-rw-r--r--sardanaConfig/src/wizards/res/logo.jpgbin17005 -> 0 bytes
-rw-r--r--sardanaConfig/src/wizards/res/watermark.jpgbin114911 -> 0 bytes
-rw-r--r--sardanaConfig/src/wizards/sardana_page.py124
-rw-r--r--sardanaConfig/src/wizards/settings_widget.py780
-rw-r--r--sardanaConfig/src/wizards/simple_tree_model.py247
-rw-r--r--sardanaConfig/src/wizards/tango_host_page.py80
-rw-r--r--sardanaConfig/src/wizards/wiz.py117
-rw-r--r--sardanaConfig/src/wizards/wiz.qrc6
-rw-r--r--sardanaConfig/src/wizards/wiz.rccbin132040 -> 0 bytes
-rwxr-xr-xscripts/MacroServer56
-rwxr-xr-xscripts/Pool56
-rwxr-xr-xscripts/Sardana56
-rwxr-xr-xscripts/h5toascii118
-rwxr-xr-xscripts/h5tospec230
-rwxr-xr-xscripts/macroexecutor27
-rwxr-xr-xscripts/sequencer27
-rwxr-xr-xscripts/spectoascii87
-rwxr-xr-xscripts/spock51
-rwxr-xr-xscripts/tau2taurus (renamed from taurus/scripts/tau2taurus)0
-rwxr-xr-xscripts/taurusconfigbrowser (renamed from taurus/scripts/taurusconfigbrowser)0
-rwxr-xr-xscripts/tauruscurve (renamed from taurus/scripts/tauruscurve)0
-rwxr-xr-xscripts/taurusdemo (renamed from taurus/scripts/taurusdemo)0
-rwxr-xr-xscripts/taurusdesigner (renamed from taurus/scripts/taurusdesigner)0
-rwxr-xr-xscripts/taurusdevicepanel (renamed from taurus/scripts/taurusdevicepanel)0
-rwxr-xr-xscripts/taurusdoc (renamed from taurus/scripts/taurusdoc)0
-rwxr-xr-xscripts/taurusform (renamed from taurus/scripts/taurusform)0
-rwxr-xr-xscripts/taurusgui (renamed from taurus/scripts/taurusgui)0
-rwxr-xr-xscripts/taurusimage (renamed from taurus/scripts/taurusimage)0
-rwxr-xr-xscripts/tauruspanel (renamed from taurus/scripts/tauruspanel)0
-rwxr-xr-xscripts/taurusplot (renamed from taurus/scripts/taurusplot)0
-rwxr-xr-xscripts/taurusremotelogmonitor (renamed from taurus/scripts/taurusremotelogmonitor)0
-rwxr-xr-xscripts/taurustrend (renamed from taurus/scripts/taurustrend)0
-rwxr-xr-xscripts/taurustrend1d (renamed from taurus/scripts/taurustrend1d)0
-rwxr-xr-xscripts/taurustrend2d (renamed from taurus/scripts/taurustrend2d)0
-rwxr-xr-xscripts/taurusui (renamed from taurus/scripts/taurusui)0
-rwxr-xr-xscripts/taurusuic4 (renamed from taurus/scripts/taurusuic4)0
-rw-r--r--scripts/upgrade/from_01_to_02.py530
-rw-r--r--scripts/upgrade/from_02_to_03.py437
-rw-r--r--scripts/upgrade/res/logo.jpgbin17005 -> 0 bytes
-rw-r--r--scripts/upgrade/res/watermark.jpgbin114911 -> 0 bytes
-rw-r--r--scripts/upgrade/upgradeCLI.py50
-rw-r--r--scripts/upgrade/upgradeGUI.py333
-rw-r--r--scripts/upgrade/upgradeGUI.qrc6
-rw-r--r--scripts/upgrade/upgradeGUI.rccbin132040 -> 0 bytes
-rw-r--r--scripts/upgrade/upgrade_sardana.py16
-rw-r--r--scripts/upgrade/upgrade_utils.py94
-rw-r--r--setup.py992
-rw-r--r--src/sardana/__init__.py41
-rw-r--r--src/sardana/macroserver/__init__.py30
-rw-r--r--src/sardana/macroserver/basetypes.py129
-rw-r--r--src/sardana/macroserver/macro.py2324
-rw-r--r--src/sardana/macroserver/macro_template.txt6
-rw-r--r--src/sardana/macroserver/macros/__init__.py30
-rw-r--r--src/sardana/macroserver/macros/communication.py62
-rw-r--r--src/sardana/macroserver/macros/demo.py171
-rw-r--r--src/sardana/macroserver/macros/env.py288
-rw-r--r--src/sardana/macroserver/macros/examples/__init__.py29
-rw-r--r--src/sardana/macroserver/macros/examples/debug.py38
-rw-r--r--src/sardana/macroserver/macros/examples/funcs.py69
-rw-r--r--src/sardana/macroserver/macros/examples/hooks.py161
-rw-r--r--src/sardana/macroserver/macros/examples/parameters.py168
-rw-r--r--src/sardana/macroserver/macros/examples/plotting.py59
-rw-r--r--src/sardana/macroserver/macros/examples/scans.py611
-rw-r--r--src/sardana/macroserver/macros/examples/specific_experiments.py113
-rw-r--r--src/sardana/macroserver/macros/examples/submacros.py156
-rw-r--r--src/sardana/macroserver/macros/examples/user_input.py87
-rw-r--r--src/sardana/macroserver/macros/expert.py433
-rw-r--r--src/sardana/macroserver/macros/ioregister.py68
-rw-r--r--src/sardana/macroserver/macros/lists.py239
-rw-r--r--src/sardana/macroserver/macros/mca.py58
-rw-r--r--src/sardana/macroserver/macros/scan.py1363
-rw-r--r--src/sardana/macroserver/macros/sequence.py92
-rw-r--r--src/sardana/macroserver/macros/standard.py675
-rw-r--r--src/sardana/macroserver/macros/test/__init__.py29
-rw-r--r--src/sardana/macroserver/macros/test/base.py322
-rw-r--r--src/sardana/macroserver/macros/test/macroexecutor.py315
-rw-r--r--src/sardana/macroserver/macros/test/sardemoenv.py167
-rw-r--r--src/sardana/macroserver/macros/test/test_ct.py46
-rw-r--r--src/sardana/macroserver/macros/test/test_list.py164
-rw-r--r--src/sardana/macroserver/macros/test/test_scan.py182
-rw-r--r--src/sardana/macroserver/macros/test/test_wm.py74
-rw-r--r--src/sardana/macroserver/macroserver.py862
-rw-r--r--src/sardana/macroserver/msbase.py73
-rw-r--r--src/sardana/macroserver/mscontainer.py37
-rw-r--r--src/sardana/macroserver/msdoor.py390
-rw-r--r--src/sardana/macroserver/msenvmanager.py486
-rw-r--r--src/sardana/macroserver/msexception.py73
-rw-r--r--src/sardana/macroserver/msmacromanager.py1328
-rw-r--r--src/sardana/macroserver/msmanager.py61
-rw-r--r--src/sardana/macroserver/msmetamacro.py301
-rw-r--r--src/sardana/macroserver/msoptions.py61
-rw-r--r--src/sardana/macroserver/msparameter.py398
-rw-r--r--src/sardana/macroserver/mstypemanager.py166
-rw-r--r--src/sardana/macroserver/scan/__init__.py31
-rw-r--r--src/sardana/macroserver/scan/gscan.py2220
-rw-r--r--src/sardana/macroserver/scan/recorder/__init__.py33
-rw-r--r--src/sardana/macroserver/scan/recorder/datarecorder.py180
-rw-r--r--src/sardana/macroserver/scan/recorder/output.py270
-rw-r--r--src/sardana/macroserver/scan/recorder/sharedmemory.py320
-rw-r--r--src/sardana/macroserver/scan/recorder/storage.py1300
-rw-r--r--src/sardana/macroserver/scan/scandata.py301
-rw-r--r--src/sardana/pool/__init__.py33
-rw-r--r--src/sardana/pool/controller.py1378
-rw-r--r--src/sardana/pool/pool.py708
-rw-r--r--src/sardana/pool/poolacquisition.py558
-rw-r--r--src/sardana/pool/poolaction.py645
-rw-r--r--src/sardana/pool/poolbasechannel.py167
-rw-r--r--src/sardana/pool/poolbaseelement.py360
-rw-r--r--src/sardana/pool/poolbasegroup.py384
-rw-r--r--src/sardana/pool/poolbaseobject.py58
-rw-r--r--src/sardana/pool/poolcontainer.py51
-rw-r--r--src/sardana/pool/poolcontroller.py948
-rw-r--r--src/sardana/pool/poolcontrollermanager.py552
-rw-r--r--src/sardana/pool/poolcontrollers/DiscretePseudoMotorController.py174
-rw-r--r--src/sardana/pool/poolcontrollers/DummyCounterTimerController.py187
-rw-r--r--src/sardana/pool/poolcontrollers/DummyIORController.py60
-rw-r--r--src/sardana/pool/poolcontrollers/DummyMotorController.py798
-rw-r--r--src/sardana/pool/poolcontrollers/DummyOneDController.py243
-rw-r--r--src/sardana/pool/poolcontrollers/DummyTwoDController.py243
-rw-r--r--src/sardana/pool/poolcontrollers/DummyZeroDController.py77
-rw-r--r--src/sardana/pool/poolcontrollers/IoverI0.py50
-rw-r--r--src/sardana/pool/poolcontrollers/Slit.py96
-rw-r--r--src/sardana/pool/poolcontrollers/TangoController.py200
-rw-r--r--src/sardana/pool/poolcontrollers/__init__.py26
-rw-r--r--src/sardana/pool/poolcountertimer.py60
-rw-r--r--src/sardana/pool/pooldefs.py35
-rw-r--r--src/sardana/pool/poolelement.py150
-rw-r--r--src/sardana/pool/poolexception.py46
-rw-r--r--src/sardana/pool/poolextension.py90
-rw-r--r--src/sardana/pool/poolexternal.py125
-rw-r--r--src/sardana/pool/poolgroupelement.py104
-rw-r--r--src/sardana/pool/poolinstrument.py107
-rw-r--r--src/sardana/pool/poolioregister.py143
-rw-r--r--src/sardana/pool/poolmeasurementgroup.py523
-rw-r--r--src/sardana/pool/poolmetacontroller.py350
-rw-r--r--src/sardana/pool/poolmonitor.py164
-rw-r--r--src/sardana/pool/poolmotion.py503
-rw-r--r--src/sardana/pool/poolmotor.py783
-rw-r--r--src/sardana/pool/poolmotorgroup.py271
-rw-r--r--src/sardana/pool/poolmoveable.py46
-rw-r--r--src/sardana/pool/poolobject.py49
-rw-r--r--src/sardana/pool/poolonedexpchannel.py68
-rw-r--r--src/sardana/pool/poolpseudocounter.py358
-rw-r--r--src/sardana/pool/poolpseudomotor.py583
-rw-r--r--src/sardana/pool/pooltwodexpchannel.py66
-rw-r--r--src/sardana/pool/poolutil.py60
-rw-r--r--src/sardana/pool/poolzerodexpchannel.py310
-rw-r--r--src/sardana/pool/test/__init__.py30
-rw-r--r--src/sardana/pool/test/dummyconfs.py59
-rw-r--r--src/sardana/pool/test/fake.py47
-rw-r--r--src/sardana/pool/test/helper.py62
-rw-r--r--src/sardana/pool/test/test_ctacquisition.py83
-rw-r--r--src/sardana/pool/test/test_poolcontroller.py48
-rw-r--r--src/sardana/pool/test/test_poolcontrollermanager.py45
-rw-r--r--src/sardana/pool/test/test_poolcountertimer.py51
-rw-r--r--src/sardana/release.py77
-rw-r--r--src/sardana/requirements.py101
-rw-r--r--src/sardana/sardanaattribute.py366
-rw-r--r--src/sardana/sardanabase.py203
-rw-r--r--src/sardana/sardanacontainer.py248
-rw-r--r--src/sardana/sardanacustomsettings.py48
-rw-r--r--src/sardana/sardanadefs.py507
-rw-r--r--src/sardana/sardanaevent.py190
-rw-r--r--src/sardana/sardanaexception.py105
-rw-r--r--src/sardana/sardanalock.py105
-rw-r--r--src/sardana/sardanamanager.py97
-rw-r--r--src/sardana/sardanameta.py510
-rw-r--r--src/sardana/sardanamodulemanager.py288
-rw-r--r--src/sardana/sardanathreadpool.py54
-rw-r--r--src/sardana/sardanautils.py192
-rw-r--r--src/sardana/sardanavalue.py60
-rw-r--r--src/sardana/spock/__init__.py30
-rw-r--r--src/sardana/spock/colors.py110
-rw-r--r--src/sardana/spock/config.py39
-rw-r--r--src/sardana/spock/exception.py45
-rw-r--r--src/sardana/spock/genutils.py72
-rw-r--r--src/sardana/spock/inputhandler.py166
-rw-r--r--src/sardana/spock/ipython_00_10/__init__.py27
-rw-r--r--src/sardana/spock/ipython_00_10/genutils.py1023
-rw-r--r--src/sardana/spock/ipython_00_11/__init__.py27
-rw-r--r--src/sardana/spock/ipython_00_11/genutils.py1154
-rw-r--r--src/sardana/spock/ipython_01_00/__init__.py27
-rw-r--r--src/sardana/spock/ipython_01_00/genutils.py1159
-rw-r--r--src/sardana/spock/magic.py274
-rw-r--r--src/sardana/spock/parameter.py184
-rw-r--r--src/sardana/spock/release.py65
-rwxr-xr-xsrc/sardana/spock/spockms.py586
-rw-r--r--src/sardana/spock/test/__init__.py24
-rw-r--r--src/sardana/spock/test/test_parameter.py69
-rw-r--r--src/sardana/tango/__init__.py41
-rw-r--r--src/sardana/tango/core/SardanaDevice.py484
-rw-r--r--src/sardana/tango/core/__init__.py72
-rw-r--r--src/sardana/tango/core/attributehandler.py87
-rw-r--r--src/sardana/tango/core/util.py967
-rw-r--r--src/sardana/tango/macroserver/Door.py503
-rw-r--r--src/sardana/tango/macroserver/MacroServer.py418
-rw-r--r--src/sardana/tango/macroserver/__init__.py57
-rw-r--r--src/sardana/tango/macroserver/test/__init__.py26
-rw-r--r--src/sardana/tango/macroserver/test/macroexecutor.py203
-rw-r--r--src/sardana/tango/pool/CTExpChannel.py231
-rw-r--r--src/sardana/tango/pool/Controller.py294
-rw-r--r--src/sardana/tango/pool/IORegister.py252
-rw-r--r--src/sardana/tango/pool/MeasurementGroup.py250
-rw-r--r--src/sardana/tango/pool/Motor.py683
-rw-r--r--src/sardana/tango/pool/MotorGroup.py227
-rw-r--r--src/sardana/tango/pool/OneDExpChannel.py231
-rw-r--r--src/sardana/tango/pool/Pool.py1478
-rw-r--r--src/sardana/tango/pool/PoolDevice.py819
-rw-r--r--src/sardana/tango/pool/PseudoCounter.py245
-rw-r--r--src/sardana/tango/pool/PseudoMotor.py301
-rw-r--r--src/sardana/tango/pool/TwoDExpChannel.py231
-rw-r--r--src/sardana/tango/pool/ZeroDExpChannel.py254
-rw-r--r--src/sardana/tango/pool/__init__.py94
-rw-r--r--src/sardana/tango/pool/test/__init__.py27
-rw-r--r--src/sardana/tango/pool/test/base.py176
-rw-r--r--src/sardana/tango/pool/test/test_Motor.py76
-rw-r--r--src/sardana/taurus/__init__.py26
-rw-r--r--src/sardana/taurus/core/__init__.py26
-rw-r--r--src/sardana/taurus/core/tango/__init__.py26
-rw-r--r--src/sardana/taurus/core/tango/sardana/__init__.py45
-rw-r--r--src/sardana/taurus/core/tango/sardana/macro.py1126
-rw-r--r--src/sardana/taurus/core/tango/sardana/macroserver.py1166
-rw-r--r--src/sardana/taurus/core/tango/sardana/motion.py567
-rw-r--r--src/sardana/taurus/core/tango/sardana/pool.py1794
-rw-r--r--src/sardana/taurus/core/tango/sardana/sardana.py713
-rw-r--r--src/sardana/taurus/qt/__init__.py26
-rw-r--r--src/sardana/taurus/qt/qtcore/__init__.py26
-rw-r--r--src/sardana/taurus/qt/qtcore/tango/__init__.py26
-rw-r--r--src/sardana/taurus/qt/qtcore/tango/sardana/__init__.py38
-rw-r--r--src/sardana/taurus/qt/qtcore/tango/sardana/macroserver.py175
-rw-r--r--src/sardana/taurus/qt/qtcore/tango/sardana/model.py461
-rw-r--r--src/sardana/taurus/qt/qtcore/tango/sardana/pool.py93
-rw-r--r--src/sardana/taurus/qt/qtgui/__init__.py26
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/__init__.py34
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/common.py340
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/dooroutput.py212
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/__init__.py27
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/favouriteseditor.py217
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/historyviewer.py177
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/model.py104
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/globals.py186
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrobutton.py423
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrodescriptionviewer.py101
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroeditor.py239
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroexecutor.py997
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/__init__.py30
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/__init__.py26
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/senv.py374
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/delegate.py126
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/macroparameterseditor.py379
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/model.py225
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/parameditors.py327
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/scanplotter.py158
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/__init__.py30
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/delegate.py155
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/model.py408
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/sequenceeditor.py875
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_macroexecutor/ui/MacroButton.ui101
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/__init__.py35
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/motor.py1136
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/poolchannel.py130
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/poolioregister.py302
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/poolmotor.py1578
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperature.ui211
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperatureAlarms.ui255
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolIORegisterButtons.ui56
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolMotorSlim.ui380
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH.ui226
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH2.ui235
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV.ui224
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV2.ui882
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/__init__.py41
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/cmdline.py110
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/controllertree.py344
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/elementtree.py100
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/environment.py102
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/expdescription.py425
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/macrotree.py319
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py980
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/sardanabasewizard.py82
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/sardanaeditor.py557
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/startup.py184
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/ui/ExpDescriptionEditor.ui282
-rw-r--r--src/sardana/taurus/qt/qtgui/extra_sardana/ui/__init__.py24
-rw-r--r--src/sardana/test/__init__.py98
-rw-r--r--src/sardana/test/test_sardanavalue.py91
-rw-r--r--src/sardana/test/testsuite.py53
-rw-r--r--src/sardana/tools/config/FODS_TO_SAR.xslt821
-rw-r--r--src/sardana/tools/config/SAR_TO_FODS.xslt798
-rw-r--r--src/sardana/tools/config/XLS_TO_SAR.xslt878
-rw-r--r--src/sardana/tools/config/fods_to_sar.py37
-rw-r--r--src/sardana/tools/config/get_pool_config.py158
-rw-r--r--src/sardana/tools/config/pexpect23.py1845
-rw-r--r--src/sardana/tools/config/sar_to_fods.py20
-rw-r--r--src/sardana/tools/config/sardana.py1788
-rw-r--r--src/sardana/tools/config/sardana.xsd234
-rw-r--r--src/sardana/tools/config/tango.xsd166
-rw-r--r--src/sardana/tools/config/to_sar.py34
-rw-r--r--src/sardana/tools/config/xls_to_sar.py37
-rw-r--r--src/sardana/util/__init__.py28
-rw-r--r--src/sardana/util/deepreload.py366
-rw-r--r--src/sardana/util/motion/__init__.py32
-rw-r--r--src/sardana/util/motion/motion.py696
-rw-r--r--src/sardana/util/tree.py28
-rw-r--r--src/sardana/util/wrap.py63
-rw-r--r--taurus.bmp (renamed from taurus/taurus.bmp)bin158742 -> 158742 bytes
-rw-r--r--taurus.png (renamed from taurus/taurus.png)bin242832 -> 242832 bytes
-rw-r--r--taurus.svg (renamed from taurus/taurus.svg)0
-rw-r--r--taurus/.gitignore12
-rw-r--r--taurus/MANIFEST.in10
-rw-r--r--taurus/doc/source/_static/default.css323
-rw-r--r--taurus/doc/source/_static/logo.pngbin25070 -> 0 bytes
-rw-r--r--taurus/doc/source/_templates/layout.html28
-rw-r--r--taurus/doc/source/conf.py327
-rw-r--r--taurus/doc/source/devel/index.rst21
-rw-r--r--taurus/doc/source/docs.rst22
-rw-r--r--taurus/doc/source/index.rst68
-rw-r--r--taurus/doc/source/users/index.rst14
-rw-r--r--taurus/doc/source/users/screenshots.rst56
-rwxr-xr-xtaurus/makedist.sh35
-rw-r--r--taurus/setup.py1090
-rw-r--r--test/HTMLTestRunner.py774
-rw-r--r--test/go.py20
-rw-r--r--test/pool.py1022
-rw-r--r--test/poolunittest.py981
-rw-r--r--test/setenv.sh2
-rw-r--r--test/test.css43
-rw-r--r--test/test_ctrl/ElecMeter.py98
-rw-r--r--test/test_ctrl/ElecMeter_init.py105
-rw-r--r--test/test_ctrl/ElecMeter_syn.py98
-rw-r--r--test/test_ctrl/FirePapCtrl.py130
-rw-r--r--test/test_ctrl/Vct6Ctrl.py146
-rw-r--r--test/test_ctrl/Vct6Ctrl_init.py97
-rw-r--r--test/test_ctrl/Vct6Ctrl_syn.py84
-rw-r--r--test/test_ctrl/WaterPapCtrl.py162
-rw-r--r--test/test_ctrl/WaterPapCtrl_init.py148
-rw-r--r--test/test_ctrl/WaterPapCtrl_mis.py134
-rw-r--r--test/test_ctrl/WaterPapCtrl_mis_extra.py144
-rw-r--r--test/test_ctrl/WaterPapCtrl_mis_feat.py147
-rw-r--r--test/test_ctrl/WaterPapCtrl_prop.py86
-rw-r--r--test/test_ctrl/WaterPapCtrl_stat1.py142
-rw-r--r--test/test_ctrl/WaterPapCtrl_stat2.py142
-rw-r--r--test/test_ctrl/WaterPapCtrl_syn.py139
1895 files changed, 1058 insertions, 111829 deletions
diff --git a/.gitignore b/.gitignore
index fbb16473..96b0b415 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,12 @@
-/MANIFEST
-/contrib
+MANIFEST
/dist
*.pyc
*.qrc
*.rcc
/build/
+/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_lextab.py
+/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_yacctab.py
+parser.out
+parsetab.py
/setup.cfg
-/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_lextab.py
-/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_yacctab.py
+doc/~thumbnails.zip
diff --git a/.mailmap b/.mailmap
deleted file mode 100644
index cdb0485c..00000000
--- a/.mailmap
+++ /dev/null
@@ -1,26 +0,0 @@
-Tiago Coutinho <coutinho@esrf.fr>
-Tiago Coutinho <coutinho@esrf.fr> <tiagocoutinho@users.sourceforge.net>
-Carlos Pascual-Izarra <cpascual@cells.es>
-Carlos Pascual-Izarra <cpascual@cells.es> <cpascual@users.sourceforge.net>
-Gabriel Jover-Manas <gjover@cells.es>
-Zbigniew Reszela <zreszela@cells.es>
-Zbigniew Reszela <zreszela@cells.es> <zreszela@users.sourceforge.net>
-Zbigniew Reszela <zreszela@cells.es> <sardana@sardanademo.cells.es>
-Zbigniew Reszela <zreszela@cells.es> <zreszela@>
-Guifre Cuni <gcuni@cells.es> <guifre@users.sourceforge.net>
-Sergi Rubio <srubio@cells.es> <sergi_rubio@users.sourceforge.net>
-Sergi Rubio <srubio@cells.es> <srubio@pc148.cells.es>
-Jairo Moldes <jmoldes@cells.es> <JairoMoldes@users.sourceforge.net>
-Jairo Moldes <jmoldes@cells.es> <jairomoldes@sf.net>
-Carlos Falcon <cfalcon@cells.es>
-Carlos Falcon <cfalcon@cells.es> <cmft@users.sourceforge.net>
-Sergi Blanch <sblanch@cells.es> <sergiblanch@users.sourceforge.net>
-Marc Rosanes <mrosanes@cells.es>
-Marek Raszewski <mraszewski@cells.es> <mraszewski@users.sourceforge.net>
-Teresa Nunez <tnunez@mail.desy.de>
-Teresa Nunez <tnunez@mail.desy.de> <tere29@users.sourceforge.net>
-Teresa Nunez <tnunez@mail.desy.de> <tnunez@haso111tb.desy.de>
-Thorsten Kracht <thorsten.kracht@desy.de> <tkracht@users.sourceforge.net>
-Emmanuel Taurel <taurel@esrf.fr> <taurel@users.sourceforge.net>
-Andreas Persson <andreas_g.persson@maxlab.lu.se>
-Johannes Blume <jblume@mail.desy.de> <jblume@users.sourceforge.net>
diff --git a/taurus/LICENSE.txt b/LICENSE.txt
index cd2afc91..cd2afc91 100644
--- a/taurus/LICENSE.txt
+++ b/LICENSE.txt
diff --git a/MANIFEST.in b/MANIFEST.in
index b080457f..d2bdb148 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,12 +1,10 @@
-recursive-include src *.py
-
-graft src
graft doc
-graft build/sphinx/html
-
-global-exclude *.pyc .cvsignore .svnignore .gitignore
-exclude setup.cfg
-exclude .project
-exclude .pydevproject
-exclude .ropeproject
-exclude build_*
+graft lib/taurus
+graft scripts
+graft tests
+global-exclude *.pyc .cvsignore .svnignore .ropeproject .gitignore jdraw_lextab.py jdraw_yacctab.py
+recursive-exclude lib/taurus/qt/qtgui/resource *.rcc *.qrc qrc_*.py
+include LICENSE.txt
+include taurus.bmp
+include taurus.png
+include taurus.svg \ No newline at end of file
diff --git a/taurus/doc/api_AllClasses.rst b/doc/api_AllClasses.rst
index 62465db5..62465db5 100644
--- a/taurus/doc/api_AllClasses.rst
+++ b/doc/api_AllClasses.rst
diff --git a/taurus/doc/api_class.rst b/doc/api_class.rst
index f34c1175..f34c1175 100644
--- a/taurus/doc/api_class.rst
+++ b/doc/api_class.rst
diff --git a/taurus/doc/api_class_simple.rst b/doc/api_class_simple.rst
index c45afc86..c45afc86 100644
--- a/taurus/doc/api_class_simple.rst
+++ b/doc/api_class_simple.rst
diff --git a/taurus/doc/api_module.rst b/doc/api_module.rst
index 7e16b107..7e16b107 100644
--- a/taurus/doc/api_module.rst
+++ b/doc/api_module.rst
diff --git a/taurus/doc/auto_rst4api.py b/doc/auto_rst4api.py
index a21dbcbb..a21dbcbb 100644
--- a/taurus/doc/auto_rst4api.py
+++ b/doc/auto_rst4api.py
diff --git a/taurus/doc/buildmock.py b/doc/buildmock.py
index acff6c44..acff6c44 100644
--- a/taurus/doc/buildmock.py
+++ b/doc/buildmock.py
diff --git a/doc/logo.bmp b/doc/logo.bmp
deleted file mode 100644
index 8ab0241b..00000000
--- a/doc/logo.bmp
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/makeman b/doc/makeman
index ae81e754..ae81e754 100755
--- a/taurus/doc/makeman
+++ b/doc/makeman
diff --git a/doc/man/MacroServer.1 b/doc/man/MacroServer.1
deleted file mode 100644
index 628cbc4e..00000000
--- a/doc/man/MacroServer.1
+++ /dev/null
@@ -1,38 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
-.TH MACROSERVER "1" "February 2015" "MacroServer 1.5.0" "User Commands"
-.SH NAME
-MacroServer \- manual page for MacroServer 1.5.0
-.SH SYNOPSIS
-.B usage:
-\fIMacroServer instance_name \fR[\fIoptions\fR]
-.SH OPTIONS
-.TP
-\fB\-\-version\fR
-show program's version number and exit
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-show this help message and exit
-.TP
-\fB\-\-log\-level\fR=\fILOG_LEVEL\fR
-log output level. Possible values are (case
-sensitive): critical (or 0), error (1), warning (2),
-info (3) debug (4), trace (5) [default: warning]
-.TP
-\fB\-\-log\-file\-level\fR=\fILOG_FILE_LEVEL\fR
-log file level. Possible values are (case sensitive):
-critical (or 0), error (1), warning (2), info (3)
-debug (4), trace (5) [default: debug]. Ignored if
-\fB\-\-without\-log\-file\fR is True
-.TP
-\fB\-\-log\-file\-name\fR=\fILOG_FILE_NAME\fR
-log file name. When given, MUST be absolute file name.
-[default: /tmp/tango/<DS name>/<DS instance name lower
-case>/log.txt]. Ignored if \fB\-\-without\-log\-file\fR is True
-.TP
-\fB\-\-without\-log\-file\fR=\fIWITHOUT_LOG_FILE\fR
-When set to True disables logging into a file
-[default: False]
-.TP
-\fB\-\-rconsole\-port\fR=\fIRCONSOLE_PORT\fR
-rconsole port number. [default: 0 meaning rconsole NOT
-active]
diff --git a/doc/man/Pool.1 b/doc/man/Pool.1
deleted file mode 100644
index 190fa1c0..00000000
--- a/doc/man/Pool.1
+++ /dev/null
@@ -1,38 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
-.TH POOL "1" "February 2015" "Pool 1.5.0" "User Commands"
-.SH NAME
-Pool \- manual page for Pool 1.5.0
-.SH SYNOPSIS
-.B usage:
-\fIPool instance_name \fR[\fIoptions\fR]
-.SH OPTIONS
-.TP
-\fB\-\-version\fR
-show program's version number and exit
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-show this help message and exit
-.TP
-\fB\-\-log\-level\fR=\fILOG_LEVEL\fR
-log output level. Possible values are (case
-sensitive): critical (or 0), error (1), warning (2),
-info (3) debug (4), trace (5) [default: warning]
-.TP
-\fB\-\-log\-file\-level\fR=\fILOG_FILE_LEVEL\fR
-log file level. Possible values are (case sensitive):
-critical (or 0), error (1), warning (2), info (3)
-debug (4), trace (5) [default: debug]. Ignored if
-\fB\-\-without\-log\-file\fR is True
-.TP
-\fB\-\-log\-file\-name\fR=\fILOG_FILE_NAME\fR
-log file name. When given, MUST be absolute file name.
-[default: /tmp/tango/<DS name>/<DS instance name lower
-case>/log.txt]. Ignored if \fB\-\-without\-log\-file\fR is True
-.TP
-\fB\-\-without\-log\-file\fR=\fIWITHOUT_LOG_FILE\fR
-When set to True disables logging into a file
-[default: False]
-.TP
-\fB\-\-rconsole\-port\fR=\fIRCONSOLE_PORT\fR
-rconsole port number. [default: 0 meaning rconsole NOT
-active]
diff --git a/doc/man/Sardana.1 b/doc/man/Sardana.1
deleted file mode 100644
index a297ca5c..00000000
--- a/doc/man/Sardana.1
+++ /dev/null
@@ -1,38 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
-.TH SARDANA "1" "February 2015" "Sardana 1.5.0" "User Commands"
-.SH NAME
-Sardana \- manual page for Sardana 1.5.0
-.SH SYNOPSIS
-.B usage:
-\fISardana instance_name \fR[\fIoptions\fR]
-.SH OPTIONS
-.TP
-\fB\-\-version\fR
-show program's version number and exit
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-show this help message and exit
-.TP
-\fB\-\-log\-level\fR=\fILOG_LEVEL\fR
-log output level. Possible values are (case
-sensitive): critical (or 0), error (1), warning (2),
-info (3) debug (4), trace (5) [default: warning]
-.TP
-\fB\-\-log\-file\-level\fR=\fILOG_FILE_LEVEL\fR
-log file level. Possible values are (case sensitive):
-critical (or 0), error (1), warning (2), info (3)
-debug (4), trace (5) [default: debug]. Ignored if
-\fB\-\-without\-log\-file\fR is True
-.TP
-\fB\-\-log\-file\-name\fR=\fILOG_FILE_NAME\fR
-log file name. When given, MUST be absolute file name.
-[default: /tmp/tango/<DS name>/<DS instance name lower
-case>/log.txt]. Ignored if \fB\-\-without\-log\-file\fR is True
-.TP
-\fB\-\-without\-log\-file\fR=\fIWITHOUT_LOG_FILE\fR
-When set to True disables logging into a file
-[default: False]
-.TP
-\fB\-\-rconsole\-port\fR=\fIRCONSOLE_PORT\fR
-rconsole port number. [default: 0 meaning rconsole NOT
-active]
diff --git a/doc/man/macroexecutor.1 b/doc/man/macroexecutor.1
deleted file mode 100644
index a2de0a8e..00000000
--- a/doc/man/macroexecutor.1
+++ /dev/null
@@ -1,36 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
-.TH MACROEXECUTOR "1" "February 2015" "macroexecutor 3.4.0" "User Commands"
-.SH NAME
-macroexecutor \- manual page for macroexecutor 3.4.0
-.SH SYNOPSIS
-.B macroexecutor
-[\fIoptions\fR]
-.SH OPTIONS
-.TP
-\fB\-\-version\fR
-show program's version number and exit
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-show this help message and exit
-.IP
-Taurus Options:
-.IP
-Basic options present in any taurus application
-.TP
-\fB\-\-taurus\-log\-level\fR=\fILEVEL\fR
-taurus log level. Allowed values are (case
-insensitive): critical, error, warning/warn, info,
-debug, trace
-.TP
-\fB\-\-taurus\-polling\-period\fR=\fIMILLISEC\fR
-taurus global polling period in milliseconds
-.TP
-\fB\-\-taurus\-serialization\-mode\fR=\fISERIAL\fR
-taurus serialization mode. Allowed values are (case
-insensitive): serial, concurrent (default)
-.TP
-\fB\-\-tango\-host\fR=\fITANGO_HOST\fR
-Tango host name
-.TP
-\fB\-\-remote\-console\-port\fR=\fIPORT\fR
-enables remote debugging using the given port
diff --git a/doc/man/sequencer.1 b/doc/man/sequencer.1
deleted file mode 100644
index 81aa8187..00000000
--- a/doc/man/sequencer.1
+++ /dev/null
@@ -1,36 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
-.TH SEQUENCER "1" "February 2015" "sequencer 3.4.0" "User Commands"
-.SH NAME
-sequencer \- manual page for sequencer 3.4.0
-.SH SYNOPSIS
-.B sequencer
-[\fIoptions\fR]
-.SH OPTIONS
-.TP
-\fB\-\-version\fR
-show program's version number and exit
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-show this help message and exit
-.IP
-Taurus Options:
-.IP
-Basic options present in any taurus application
-.TP
-\fB\-\-taurus\-log\-level\fR=\fILEVEL\fR
-taurus log level. Allowed values are (case
-insensitive): critical, error, warning/warn, info,
-debug, trace
-.TP
-\fB\-\-taurus\-polling\-period\fR=\fIMILLISEC\fR
-taurus global polling period in milliseconds
-.TP
-\fB\-\-taurus\-serialization\-mode\fR=\fISERIAL\fR
-taurus serialization mode. Allowed values are (case
-insensitive): serial, concurrent (default)
-.TP
-\fB\-\-tango\-host\fR=\fITANGO_HOST\fR
-Tango host name
-.TP
-\fB\-\-remote\-console\-port\fR=\fIPORT\fR
-enables remote debugging using the given port
diff --git a/doc/man/spock.1 b/doc/man/spock.1
deleted file mode 100644
index d4e32e4e..00000000
--- a/doc/man/spock.1
+++ /dev/null
@@ -1,389 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
-.TH SPOCK "1" "February 2015" "spock 1.5.0" "User Commands"
-.SH NAME
-spock \- manual page for spock 1.5.0
-.SH DESCRIPTION
-=========
-.IP
-IPython
-.PP
-=========
-.PP
-Tools for Interactive Computing in Python
-=========================================
-.IP
-A Python shell with automatic history (input and output), dynamic object
-introspection, easier configuration, command completion, access to the
-system shell and more. IPython can also be embedded in running programs.
-.PP
-Usage
-.IP
-ipython [subcommand] [options] [\-c cmd | \fB\-m\fR mod | file] [\-\-] [arg] ...
-.IP
-If invoked with no options, it executes the file and exits, passing the
-remaining arguments to the script, just as if you had specified the same
-command with python. You may need to specify `\-\-` before args to be passed
-to the script, to prevent IPython from attempting to parse them. If you
-specify the option `\-i` before the filename, it will enter an interactive
-IPython session after running the script, rather than exiting. Files ending
-in .py will be treated as normal Python, but files ending in .ipy can
-contain special IPython syntax (magic commands, shell expansions, etc.).
-.IP
-Almost all configuration in IPython is available via the command\-line. Do
-`ipython \fB\-\-help\-all\fR` to see all available options. For persistent
-configuration, look into your `ipython_config.py` configuration file for
-details.
-.IP
-This file is typically installed in the `IPYTHONDIR` directory, and there
-is a separate configuration directory for each profile. The default profile
-directory will be located in \fI$IPYTHONDIR/profile_default\fP. For Linux users,
-IPYTHONDIR defaults to `$HOME/.config/ipython`, and for other Unix systems
-to `$HOME/.ipython`. For Windows users, $HOME resolves to C:\eDocuments
-and Settings\eYourUserName in most instances.
-.IP
-To initialize a profile with the default configuration file, do::
-.IP
-$> ipython profile create
-.IP
-and start editing `IPYTHONDIR/profile_default/ipython_config.py`
-.IP
-In IPython's documentation, we will refer to this directory as
-`IPYTHONDIR`, you can change its default location by creating an
-environment variable with this name and setting it to the desired path.
-.IP
-For more information, see the manual available in HTML and PDF in your
-installation, or online at http://ipython.org/documentation.html.
-.PP
-Subcommands
-\fB\-\-\-\-\-\-\-\-\-\-\-\fR
-.PP
-Subcommands are launched as `spock cmd [args]`. For information on using
-subcommand 'cmd', do: `spock cmd \fB\-h\fR`.
-.PP
-locate
-.IP
-print the path to the IPython dir
-.PP
-profile
-.IP
-Create and manage IPython profiles.
-.PP
-console
-.IP
-Launch the IPython terminal\-based Console.
-.PP
-kernel
-.IP
-Start a kernel without an attached frontend.
-.PP
-notebook
-.IP
-Launch the IPython HTML Notebook Server.
-.PP
-nbconvert
-.IP
-Convert notebooks to/from other formats.
-.PP
-qtconsole
-.IP
-Launch the IPython Qt Console.
-.PP
-history
-.IP
-Manage the IPython history database.
-.PP
-Options
-\fB\-\-\-\-\-\-\-\fR
-.PP
-Arguments that take values are actually convenience aliases to full
-Configurables, whose aliases are listed on the help line. For more information
-on full configurables, see '\-\-help\-all'.
-.PP
-\fB\-\-no\-autoindent\fR
-.IP
-Turn off autoindenting.
-.PP
-\fB\-\-autoedit\-syntax\fR
-.IP
-Turn on auto editing of files with syntax errors.
-.PP
-\fB\-\-deep\-reload\fR
-.IP
-Enable deep (recursive) reloading by default. IPython can use the
-deep_reload module which reloads changes in modules recursively (it
-replaces the reload() function, so you don't need to change anything to
-use it). deep_reload() forces a full reload of modules whose code may
-have changed, which the default reload() function does not. When
-deep_reload is off, IPython will use the normal reload(), but
-deep_reload will still be available as dreload(). This feature is off
-by default [which means that you have both normal reload() and
-dreload()].
-.PP
-\fB\-\-confirm\-exit\fR
-.IP
-Set to confirm when you try to exit IPython with an EOF (Control\-D
-in Unix, Control\-Z/Enter in Windows). By typing 'exit' or 'quit',
-you can force a direct exit without any confirmation.
-.PP
-\fB\-\-pylab\fR
-.IP
-Pre\-load matplotlib and numpy for interactive use with
-the default matplotlib backend.
-.PP
-\fB\-\-matplotlib\fR
-.IP
-Configure matplotlib for interactive use with
-the default matplotlib backend.
-.PP
-\fB\-\-term\-title\fR
-.IP
-Enable auto setting the terminal title.
-.PP
-\fB\-\-classic\fR
-.IP
-Gives IPython a similar feel to the classic Python prompt.
-.PP
-\fB\-\-autoindent\fR
-.IP
-Turn on autoindenting.
-.PP
-\fB\-\-no\-automagic\fR
-.IP
-Turn off the auto calling of magic commands.
-.PP
-\fB\-\-banner\fR
-.IP
-Display a banner upon starting IPython.
-.PP
-\fB\-\-automagic\fR
-.IP
-Turn on the auto calling of magic commands. Type %%magic at the
-IPython prompt for more information.
-.PP
-\fB\-\-no\-deep\-reload\fR
-.IP
-Disable deep (recursive) reloading by default.
-.PP
-\fB\-\-no\-term\-title\fR
-.IP
-Disable auto setting the terminal title.
-.PP
-\fB\-\-nosep\fR
-.IP
-Eliminate all spacing between prompts.
-.PP
-\fB\-i\fR
-.IP
-If running code from the command line, become interactive afterwards.
-Note: can also be given simply as '\-i.'
-.PP
-\fB\-\-debug\fR
-.IP
-set log level to logging.DEBUG (maximize logging output)
-.PP
-\fB\-\-pprint\fR
-.IP
-Enable auto pretty printing of results.
-.PP
-\fB\-\-no\-autoedit\-syntax\fR
-.IP
-Turn off auto editing of files with syntax errors.
-.PP
-\fB\-\-quiet\fR
-.IP
-set log level to logging.CRITICAL (minimize logging output)
-.PP
-\fB\-\-no\-color\-info\fR
-.IP
-Disable using colors for info related things.
-.PP
-\fB\-\-color\-info\fR
-.IP
-IPython can display information about objects via a set of functions, and optionally can use colors for this, syntax highlighting
-source code and various other elements. However, because this
-information is passed through a pager (like 'less') and many pagers get
-confused with color codes, this option is off by default. You can test
-it and turn it on permanently in your ipython_config.py file if it
-works for you. Test it and turn it on permanently if it works with
-your system. The magic function %%color_info allows you to toggle this
-interactively for testing.
-.PP
-\fB\-\-init\fR
-.TP
-Initialize profile with default config files.
-This is equivalent
-.IP
-to running `ipython profile create <profile>` prior to startup.
-.PP
-\fB\-\-no\-pdb\fR
-.IP
-Disable auto calling the pdb debugger after every exception.
-.PP
-\fB\-\-quick\fR
-.IP
-Enable quick startup with no config files.
-.PP
-\fB\-\-no\-confirm\-exit\fR
-.IP
-Don't prompt the user when exiting.
-.PP
-\fB\-\-pydb\fR
-.IP
-Use the third party 'pydb' package as debugger, instead of pdb.
-Requires that pydb is installed.
-.PP
-\fB\-\-pdb\fR
-.IP
-Enable auto calling the pdb debugger after every exception.
-.PP
-\fB\-\-no\-pprint\fR
-.IP
-Disable auto pretty printing of results.
-.PP
-\fB\-\-no\-banner\fR
-.IP
-Don't display a banner upon starting IPython.
-.PP
-\fB\-\-profile=\fR<Unicode> (BaseIPythonApplication.profile)
-.IP
-Default: u'default'
-The IPython profile to use.
-.PP
-\fB\-c\fR <Unicode> (InteractiveShellApp.code_to_run)
-.IP
-Default: ''
-Execute the given command string.
-.PP
-\fB\-\-pylab=\fR<CaselessStrEnum> (InteractiveShellApp.pylab)
-.IP
-Default: None
-Choices: ['auto', 'gtk', 'inline', 'osx', 'qt', 'qt4', 'tk', 'wx']
-Pre\-load matplotlib and numpy for interactive use, selecting a particular
-matplotlib backend and loop integration.
-.PP
-\fB\-\-autocall=\fR<Enum> (InteractiveShell.autocall)
-.IP
-Default: 0
-Choices: (0, 1, 2)
-Make IPython automatically call any callable object even if you didn't type
-explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
-The value can be '0' to disable the feature, '1' for 'smart' autocall, where
-it is not applied if there are no more arguments on the line, and '2' for
-\&'full' autocall, where all callable objects are automatically called (even
-if no arguments are present).
-.PP
-\fB\-\-ipython\-dir=\fR<Unicode> (BaseIPythonApplication.ipython_dir)
-.IP
-Default: u'/home/zreszela/.ipython'
-The name of the IPython directory. This directory is used for logging
-configuration (through profiles), history storage, etc. The default is
-usually $HOME/.ipython. This options can also be specified through the
-environment variable IPYTHONDIR.
-.PP
-\fB\-\-gui=\fR<CaselessStrEnum> (InteractiveShellApp.gui)
-.IP
-Default: None
-Choices: ('qt', 'wx', 'gtk', 'glut', 'pyglet', 'osx')
-Enable GUI event loop integration ('qt', 'wx', 'gtk', 'glut', 'pyglet',
-\&'osx').
-.PP
-\fB\-\-logappend=\fR<Unicode> (InteractiveShell.logappend)
-.IP
-Default: ''
-Start logging to the given file in append mode.
-.PP
-\fB\-m\fR <Unicode> (InteractiveShellApp.module_to_run)
-.IP
-Default: ''
-Run the module as a script.
-.PP
-\fB\-\-ext=\fR<Unicode> (InteractiveShellApp.extra_extension)
-.IP
-Default: ''
-dotted module name of an IPython extension to load.
-.PP
-\fB\-\-log\-level=\fR<Enum> (Application.log_level)
-.IP
-Default: 30
-Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
-Set the log level by value or name.
-.PP
-\fB\-\-colors=\fR<CaselessStrEnum> (InteractiveShell.colors)
-.IP
-Default: 'Linux'
-Choices: ('NoColor', 'LightBG', 'Linux')
-Set the color scheme (NoColor, Linux, or LightBG).
-.PP
-\fB\-\-matplotlib=\fR<CaselessStrEnum> (InteractiveShellApp.matplotlib)
-.IP
-Default: None
-Choices: ['auto', 'gtk', 'inline', 'osx', 'qt', 'qt4', 'tk', 'wx']
-Configure matplotlib for interactive use with the default matplotlib
-backend.
-.PP
-\fB\-\-cache\-size=\fR<Integer> (InteractiveShell.cache_size)
-.IP
-Default: 1000
-Set the size of the output cache. The default is 1000, you can change it
-permanently in your config file. Setting it to 0 completely disables the
-caching system, and the minimum value accepted is 20 (if you provide a value
-less than 20, it is reset to 0 and a warning is issued). This limit is
-defined because otherwise you'll spend more time re\-flushing a too small
-cache than working
-.PP
-\fB\-\-logfile=\fR<Unicode> (InteractiveShell.logfile)
-.IP
-Default: ''
-The name of the logfile to use.
-.PP
-\fB\-\-config=\fR<Unicode> (BaseIPythonApplication.extra_config_file)
-.IP
-Default: u''
-Path to an extra config file to load.
-If specified, load this config file in addition to any other IPython config.
-.PP
-To see all available configurables, use `\-\-help\-all`
-.PP
-Examples
-\fB\-\-\-\-\-\-\-\-\fR
-.TP
-ipython \fB\-\-matplotlib\fR
-# enable matplotlib integration
-.TP
-ipython \fB\-\-matploltib\fR=\fIqt\fR
-# enable matplotlib integration with qt4 backend
-.TP
-ipython \fB\-\-log\-level\fR=\fIDEBUG\fR
-# set logging to DEBUG
-.TP
-ipython \fB\-\-profile\fR=\fIfoo\fR
-# start with profile foo
-.TP
-ipython qtconsole
-# start the qtconsole GUI application
-.TP
-ipython help qtconsole
-# show the help for the qtconsole subcmd
-.TP
-ipython console
-# start the terminal\-based console application
-.TP
-ipython help console
-# show the help for the console subcmd
-.TP
-ipython notebook
-# start the IPython notebook
-.TP
-ipython help notebook
-# show the help for the notebook subcmd
-.IP
-ipython profile create foo # create profile foo w/ default config files
-ipython help profile # show the help for the profile subcmd
-.TP
-ipython locate
-# print the path to the IPython directory
-.IP
-ipython locate profile foo # print the path to the directory for profile `foo`
-.TP
-ipython nbconvert
-# convert notebooks to/from other formats
diff --git a/taurus/doc/man/tau2taurus.1 b/doc/man/tau2taurus.1
index 3826f0fa..3826f0fa 100644
--- a/taurus/doc/man/tau2taurus.1
+++ b/doc/man/tau2taurus.1
diff --git a/taurus/doc/man/taurusconfigbrowser.1 b/doc/man/taurusconfigbrowser.1
index c82f4356..c82f4356 100644
--- a/taurus/doc/man/taurusconfigbrowser.1
+++ b/doc/man/taurusconfigbrowser.1
diff --git a/taurus/doc/man/tauruscurve.1 b/doc/man/tauruscurve.1
index 0c6aef4c..0c6aef4c 100644
--- a/taurus/doc/man/tauruscurve.1
+++ b/doc/man/tauruscurve.1
diff --git a/taurus/doc/man/taurusdemo.1 b/doc/man/taurusdemo.1
index dad64262..dad64262 100644
--- a/taurus/doc/man/taurusdemo.1
+++ b/doc/man/taurusdemo.1
diff --git a/taurus/doc/man/taurusdesigner.1 b/doc/man/taurusdesigner.1
index a1aecb35..a1aecb35 100644
--- a/taurus/doc/man/taurusdesigner.1
+++ b/doc/man/taurusdesigner.1
diff --git a/taurus/doc/man/taurusdevicepanel.1 b/doc/man/taurusdevicepanel.1
index d699e04e..d699e04e 100644
--- a/taurus/doc/man/taurusdevicepanel.1
+++ b/doc/man/taurusdevicepanel.1
diff --git a/taurus/doc/man/taurusdoc.1 b/doc/man/taurusdoc.1
index 15ccacb4..15ccacb4 100644
--- a/taurus/doc/man/taurusdoc.1
+++ b/doc/man/taurusdoc.1
diff --git a/taurus/doc/man/taurusform.1 b/doc/man/taurusform.1
index 21d7e707..21d7e707 100644
--- a/taurus/doc/man/taurusform.1
+++ b/doc/man/taurusform.1
diff --git a/taurus/doc/man/taurusgui.1 b/doc/man/taurusgui.1
index 918d3a05..918d3a05 100644
--- a/taurus/doc/man/taurusgui.1
+++ b/doc/man/taurusgui.1
diff --git a/taurus/doc/man/taurusimage.1 b/doc/man/taurusimage.1
index 59ad39da..59ad39da 100644
--- a/taurus/doc/man/taurusimage.1
+++ b/doc/man/taurusimage.1
diff --git a/taurus/doc/man/tauruspanel.1 b/doc/man/tauruspanel.1
index 80eecb22..80eecb22 100644
--- a/taurus/doc/man/tauruspanel.1
+++ b/doc/man/tauruspanel.1
diff --git a/taurus/doc/man/taurusplot.1 b/doc/man/taurusplot.1
index 61cebef7..61cebef7 100644
--- a/taurus/doc/man/taurusplot.1
+++ b/doc/man/taurusplot.1
diff --git a/taurus/doc/man/taurusremotelogmonitor.1 b/doc/man/taurusremotelogmonitor.1
index d0c8e6d9..d0c8e6d9 100644
--- a/taurus/doc/man/taurusremotelogmonitor.1
+++ b/doc/man/taurusremotelogmonitor.1
diff --git a/taurus/doc/man/taurustrend.1 b/doc/man/taurustrend.1
index 13d372fc..13d372fc 100644
--- a/taurus/doc/man/taurustrend.1
+++ b/doc/man/taurustrend.1
diff --git a/taurus/doc/man/taurustrend1d.1 b/doc/man/taurustrend1d.1
index 774fafba..774fafba 100644
--- a/taurus/doc/man/taurustrend1d.1
+++ b/doc/man/taurustrend1d.1
diff --git a/taurus/doc/man/taurustrend2d.1 b/doc/man/taurustrend2d.1
index fa580892..fa580892 100644
--- a/taurus/doc/man/taurustrend2d.1
+++ b/doc/man/taurustrend2d.1
diff --git a/taurus/doc/man/taurusui.1 b/doc/man/taurusui.1
index 645a40f3..645a40f3 100644
--- a/taurus/doc/man/taurusui.1
+++ b/doc/man/taurusui.1
diff --git a/taurus/doc/man/taurusuic4.1 b/doc/man/taurusuic4.1
index 0383b74c..0383b74c 100644
--- a/taurus/doc/man/taurusuic4.1
+++ b/doc/man/taurusuic4.1
diff --git a/taurus/doc/mock.zip b/doc/mock.zip
index 6dc47bff..6dc47bff 100644
--- a/taurus/doc/mock.zip
+++ b/doc/mock.zip
Binary files differ
diff --git a/doc/sketches/daqboard.png b/doc/sketches/daqboard.png
deleted file mode 100644
index 089d3b66..00000000
--- a/doc/sketches/daqboard.png
+++ /dev/null
Binary files differ
diff --git a/doc/sketches/icepaphw.png b/doc/sketches/icepaphw.png
deleted file mode 100644
index 07614bee..00000000
--- a/doc/sketches/icepaphw.png
+++ /dev/null
Binary files differ
diff --git a/doc/sketches/multimeter.png b/doc/sketches/multimeter.png
deleted file mode 100644
index 84262e30..00000000
--- a/doc/sketches/multimeter.png
+++ /dev/null
Binary files differ
diff --git a/doc/sketches/nanopiezo.png b/doc/sketches/nanopiezo.png
deleted file mode 100644
index 0f44649a..00000000
--- a/doc/sketches/nanopiezo.png
+++ /dev/null
Binary files differ
diff --git a/doc/sketches/sketches.odp b/doc/sketches/sketches.odp
deleted file mode 100644
index a76ef21e..00000000
--- a/doc/sketches/sketches.odp
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/attributechooser01.png b/doc/source/_static/attributechooser01.png
index 10930fb5..10930fb5 100644
--- a/taurus/doc/source/_static/attributechooser01.png
+++ b/doc/source/_static/attributechooser01.png
Binary files differ
diff --git a/doc/source/_static/codelogo01.png b/doc/source/_static/codelogo01.png
deleted file mode 100644
index 1e85c61d..00000000
--- a/doc/source/_static/codelogo01.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/default.css b/doc/source/_static/default.css
index 43a01fd2..db3b1205 100644
--- a/doc/source/_static/default.css
+++ b/doc/source/_static/default.css
@@ -320,16 +320,4 @@ div.versioninfo {
padding: 8px;
line-height: 1.3em;
font-size: 0.9em;
-}
-
-#gallery {
- overflow: hidden;
- width: 90%;
- height: 450px;
- text-align: center;
-}
-
-#gallery img {
- height: 450px;
-}
-
+} \ No newline at end of file
diff --git a/taurus/doc/source/_static/designer01.png b/doc/source/_static/designer01.png
index 6d3157f0..6d3157f0 100644
--- a/taurus/doc/source/_static/designer01.png
+++ b/doc/source/_static/designer01.png
Binary files differ
diff --git a/taurus/doc/source/_static/designer02.png b/doc/source/_static/designer02.png
index 27968c2a..27968c2a 100644
--- a/taurus/doc/source/_static/designer02.png
+++ b/doc/source/_static/designer02.png
Binary files differ
diff --git a/taurus/doc/source/_static/designer03.png b/doc/source/_static/designer03.png
index 4936ce90..4936ce90 100644
--- a/taurus/doc/source/_static/designer03.png
+++ b/doc/source/_static/designer03.png
Binary files differ
diff --git a/taurus/doc/source/_static/designer04.png b/doc/source/_static/designer04.png
index 81f46b1c..81f46b1c 100644
--- a/taurus/doc/source/_static/designer04.png
+++ b/doc/source/_static/designer04.png
Binary files differ
diff --git a/taurus/doc/source/_static/designer05.png b/doc/source/_static/designer05.png
index 461c09b8..461c09b8 100644
--- a/taurus/doc/source/_static/designer05.png
+++ b/doc/source/_static/designer05.png
Binary files differ
diff --git a/taurus/doc/source/_static/designer_plugins01.png b/doc/source/_static/designer_plugins01.png
index 33ba9255..33ba9255 100644
--- a/taurus/doc/source/_static/designer_plugins01.png
+++ b/doc/source/_static/designer_plugins01.png
Binary files differ
diff --git a/doc/source/_static/dyn.png b/doc/source/_static/dyn.png
deleted file mode 100644
index 06a5f19c..00000000
--- a/doc/source/_static/dyn.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/edit01.png b/doc/source/_static/edit01.png
index 61dce33c..61dce33c 100644
--- a/taurus/doc/source/_static/edit01.png
+++ b/doc/source/_static/edit01.png
Binary files differ
diff --git a/taurus/doc/source/_static/edit02.png b/doc/source/_static/edit02.png
index f9de2980..f9de2980 100644
--- a/taurus/doc/source/_static/edit02.png
+++ b/doc/source/_static/edit02.png
Binary files differ
diff --git a/taurus/doc/source/_static/edit03.png b/doc/source/_static/edit03.png
index bf03b461..bf03b461 100644
--- a/taurus/doc/source/_static/edit03.png
+++ b/doc/source/_static/edit03.png
Binary files differ
diff --git a/taurus/doc/source/_static/forms-pendingops01.png b/doc/source/_static/forms-pendingops01.png
index 0cd3a20f..0cd3a20f 100644
--- a/taurus/doc/source/_static/forms-pendingops01.png
+++ b/doc/source/_static/forms-pendingops01.png
Binary files differ
diff --git a/taurus/doc/source/_static/forms01.png b/doc/source/_static/forms01.png
index 7105f19e..7105f19e 100644
--- a/taurus/doc/source/_static/forms01.png
+++ b/doc/source/_static/forms01.png
Binary files differ
diff --git a/taurus/doc/source/_static/forms02.png b/doc/source/_static/forms02.png
index 6168d76a..6168d76a 100644
--- a/taurus/doc/source/_static/forms02.png
+++ b/doc/source/_static/forms02.png
Binary files differ
diff --git a/taurus/doc/source/_static/forms03.png b/doc/source/_static/forms03.png
index 256571de..256571de 100644
--- a/taurus/doc/source/_static/forms03.png
+++ b/doc/source/_static/forms03.png
Binary files differ
diff --git a/doc/source/_static/gallery/gallery01.png b/doc/source/_static/gallery/gallery01.png
deleted file mode 100644
index 6d2b5818..00000000
--- a/doc/source/_static/gallery/gallery01.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gallery/gallery02.png b/doc/source/_static/gallery/gallery02.png
deleted file mode 100644
index d8689e73..00000000
--- a/doc/source/_static/gallery/gallery02.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gap_offset.png b/doc/source/_static/gap_offset.png
deleted file mode 100644
index 1839566c..00000000
--- a/doc/source/_static/gap_offset.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gap_read.png b/doc/source/_static/gap_read.png
deleted file mode 100644
index 343fd45b..00000000
--- a/doc/source/_static/gap_read.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gap_write.png b/doc/source/_static/gap_write.png
deleted file mode 100644
index 2e692429..00000000
--- a/doc/source/_static/gap_write.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gedit_config.png b/doc/source/_static/gedit_config.png
deleted file mode 100644
index b1e9b4f8..00000000
--- a/doc/source/_static/gedit_config.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot01.png b/doc/source/_static/gui_snapshot01.png
deleted file mode 100644
index ffb2a44c..00000000
--- a/doc/source/_static/gui_snapshot01.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot02.png b/doc/source/_static/gui_snapshot02.png
deleted file mode 100644
index 85c0abd4..00000000
--- a/doc/source/_static/gui_snapshot02.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot03.png b/doc/source/_static/gui_snapshot03.png
deleted file mode 100644
index a8678659..00000000
--- a/doc/source/_static/gui_snapshot03.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot04.png b/doc/source/_static/gui_snapshot04.png
deleted file mode 100644
index df2b0e63..00000000
--- a/doc/source/_static/gui_snapshot04.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot05.png b/doc/source/_static/gui_snapshot05.png
deleted file mode 100644
index e40b9805..00000000
--- a/doc/source/_static/gui_snapshot05.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot06.png b/doc/source/_static/gui_snapshot06.png
deleted file mode 100644
index 0d897ea4..00000000
--- a/doc/source/_static/gui_snapshot06.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot07.png b/doc/source/_static/gui_snapshot07.png
deleted file mode 100644
index aeec99bd..00000000
--- a/doc/source/_static/gui_snapshot07.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot08.png b/doc/source/_static/gui_snapshot08.png
deleted file mode 100644
index 990bc143..00000000
--- a/doc/source/_static/gui_snapshot08.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot09.png b/doc/source/_static/gui_snapshot09.png
deleted file mode 100644
index 4eb7a9df..00000000
--- a/doc/source/_static/gui_snapshot09.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/gui_snapshot10.png b/doc/source/_static/gui_snapshot10.png
deleted file mode 100644
index a4cf12bf..00000000
--- a/doc/source/_static/gui_snapshot10.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/hard.png b/doc/source/_static/hard.png
deleted file mode 100644
index 988b9136..00000000
--- a/doc/source/_static/hard.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/intro.png b/doc/source/_static/intro.png
index 282d1ee6..282d1ee6 100644
--- a/taurus/doc/source/_static/intro.png
+++ b/doc/source/_static/intro.png
Binary files differ
diff --git a/doc/source/_static/kwrite_config.png b/doc/source/_static/kwrite_config.png
deleted file mode 100644
index f02eaa1d..00000000
--- a/doc/source/_static/kwrite_config.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/label01.png b/doc/source/_static/label01.png
index 02ceeb00..02ceeb00 100644
--- a/taurus/doc/source/_static/label01.png
+++ b/doc/source/_static/label01.png
Binary files differ
diff --git a/taurus/doc/source/_static/label02.png b/doc/source/_static/label02.png
index ee189c68..ee189c68 100644
--- a/taurus/doc/source/_static/label02.png
+++ b/doc/source/_static/label02.png
Binary files differ
diff --git a/taurus/doc/source/_static/label03.png b/doc/source/_static/label03.png
index 2851fd1c..2851fd1c 100644
--- a/taurus/doc/source/_static/label03.png
+++ b/doc/source/_static/label03.png
Binary files differ
diff --git a/taurus/doc/source/_static/label04.png b/doc/source/_static/label04.png
index 02ced663..02ced663 100644
--- a/taurus/doc/source/_static/label04.png
+++ b/doc/source/_static/label04.png
Binary files differ
diff --git a/taurus/doc/source/_static/label05.png b/doc/source/_static/label05.png
index 5897e3bc..5897e3bc 100644
--- a/taurus/doc/source/_static/label05.png
+++ b/doc/source/_static/label05.png
Binary files differ
diff --git a/taurus/doc/source/_static/label06.png b/doc/source/_static/label06.png
index e54bf79a..e54bf79a 100644
--- a/taurus/doc/source/_static/label06.png
+++ b/doc/source/_static/label06.png
Binary files differ
diff --git a/doc/source/_static/limit.png b/doc/source/_static/limit.png
deleted file mode 100644
index 2b8e44f4..00000000
--- a/doc/source/_static/limit.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/logo.png b/doc/source/_static/logo.png
index c046c660..eeab13bb 100644
--- a/doc/source/_static/logo.png
+++ b/doc/source/_static/logo.png
Binary files differ
diff --git a/taurus/doc/source/_static/logo.svg b/doc/source/_static/logo.svg
index 1b03ad84..1b03ad84 100644
--- a/taurus/doc/source/_static/logo.svg
+++ b/doc/source/_static/logo.svg
diff --git a/doc/source/_static/macro_edit.png b/doc/source/_static/macro_edit.png
deleted file mode 100644
index a4d10b11..00000000
--- a/doc/source/_static/macro_edit.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_fractal.png b/doc/source/_static/macro_fractal.png
deleted file mode 100644
index eb3e2511..00000000
--- a/doc/source/_static/macro_fractal.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input.png b/doc/source/_static/macro_input.png
deleted file mode 100644
index 617e6ea3..00000000
--- a/doc/source/_static/macro_input.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input_float_title.png b/doc/source/_static/macro_input_float_title.png
deleted file mode 100644
index 1544ac03..00000000
--- a/doc/source/_static/macro_input_float_title.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input_float_title_label_unit.png b/doc/source/_static/macro_input_float_title_label_unit.png
deleted file mode 100644
index 4cfd6350..00000000
--- a/doc/source/_static/macro_input_float_title_label_unit.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input_integer.png b/doc/source/_static/macro_input_integer.png
deleted file mode 100644
index 21775cd7..00000000
--- a/doc/source/_static/macro_input_integer.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input_moveable.png b/doc/source/_static/macro_input_moveable.png
deleted file mode 100644
index 03da21d2..00000000
--- a/doc/source/_static/macro_input_moveable.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input_select_multiple.png b/doc/source/_static/macro_input_select_multiple.png
deleted file mode 100644
index a0f72e13..00000000
--- a/doc/source/_static/macro_input_select_multiple.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_input_select_radio.png b/doc/source/_static/macro_input_select_radio.png
deleted file mode 100644
index 744fd5ac..00000000
--- a/doc/source/_static/macro_input_select_radio.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_plotting1.png b/doc/source/_static/macro_plotting1.png
deleted file mode 100644
index 8bbb84d9..00000000
--- a/doc/source/_static/macro_plotting1.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macro_progress.png b/doc/source/_static/macro_progress.png
deleted file mode 100644
index f0bf7923..00000000
--- a/doc/source/_static/macro_progress.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/macrogui01.png b/doc/source/_static/macrogui01.png
index 733075e6..733075e6 100644
--- a/taurus/doc/source/_static/macrogui01.png
+++ b/doc/source/_static/macrogui01.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/favouriteeditor01.png b/doc/source/_static/macros/favouriteeditor01.png
index 808e0601..808e0601 100644
--- a/taurus/doc/source/_static/macros/favouriteeditor01.png
+++ b/doc/source/_static/macros/favouriteeditor01.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroexecutor01.odg b/doc/source/_static/macros/macroexecutor01.odg
index 75113e28..75113e28 100644
--- a/taurus/doc/source/_static/macros/macroexecutor01.odg
+++ b/doc/source/_static/macros/macroexecutor01.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroexecutor01.png b/doc/source/_static/macros/macroexecutor01.png
index 055b58fd..055b58fd 100644
--- a/taurus/doc/source/_static/macros/macroexecutor01.png
+++ b/doc/source/_static/macros/macroexecutor01.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroexecutor01_raw.png b/doc/source/_static/macros/macroexecutor01_raw.png
index a2443702..a2443702 100644
--- a/taurus/doc/source/_static/macros/macroexecutor01_raw.png
+++ b/doc/source/_static/macros/macroexecutor01_raw.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor01.png b/doc/source/_static/macros/macroparameterseditor01.png
index 69ba02a9..69ba02a9 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor01.png
+++ b/doc/source/_static/macros/macroparameterseditor01.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor02.png b/doc/source/_static/macros/macroparameterseditor02.png
index 8847a38d..8847a38d 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor02.png
+++ b/doc/source/_static/macros/macroparameterseditor02.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor03.odg b/doc/source/_static/macros/macroparameterseditor03.odg
index 10023576..10023576 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor03.odg
+++ b/doc/source/_static/macros/macroparameterseditor03.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor03.png b/doc/source/_static/macros/macroparameterseditor03.png
index 10ed847c..10ed847c 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor03.png
+++ b/doc/source/_static/macros/macroparameterseditor03.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor03_raw.png b/doc/source/_static/macros/macroparameterseditor03_raw.png
index db86a09c..db86a09c 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor03_raw.png
+++ b/doc/source/_static/macros/macroparameterseditor03_raw.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor04.odg b/doc/source/_static/macros/macroparameterseditor04.odg
index 244c2a5b..244c2a5b 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor04.odg
+++ b/doc/source/_static/macros/macroparameterseditor04.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor04.png b/doc/source/_static/macros/macroparameterseditor04.png
index c9085722..c9085722 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor04.png
+++ b/doc/source/_static/macros/macroparameterseditor04.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor04_raw.png b/doc/source/_static/macros/macroparameterseditor04_raw.png
index 86c2a578..86c2a578 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor04_raw.png
+++ b/doc/source/_static/macros/macroparameterseditor04_raw.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor05.odg b/doc/source/_static/macros/macroparameterseditor05.odg
index 8007ac6f..8007ac6f 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor05.odg
+++ b/doc/source/_static/macros/macroparameterseditor05.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/macroparameterseditor05.png b/doc/source/_static/macros/macroparameterseditor05.png
index ab65c577..ab65c577 100644
--- a/taurus/doc/source/_static/macros/macroparameterseditor05.png
+++ b/doc/source/_static/macros/macroparameterseditor05.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor01.png b/doc/source/_static/macros/sequenceeditor01.png
index 34dbcfa2..34dbcfa2 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor01.png
+++ b/doc/source/_static/macros/sequenceeditor01.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor02.odg b/doc/source/_static/macros/sequenceeditor02.odg
index 5f4cedb4..5f4cedb4 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor02.odg
+++ b/doc/source/_static/macros/sequenceeditor02.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor02.png b/doc/source/_static/macros/sequenceeditor02.png
index 89b9db32..89b9db32 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor02.png
+++ b/doc/source/_static/macros/sequenceeditor02.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor02_raw.png b/doc/source/_static/macros/sequenceeditor02_raw.png
index 34dbcfa2..34dbcfa2 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor02_raw.png
+++ b/doc/source/_static/macros/sequenceeditor02_raw.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor03.odg b/doc/source/_static/macros/sequenceeditor03.odg
index 497a5f62..497a5f62 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor03.odg
+++ b/doc/source/_static/macros/sequenceeditor03.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor03.png b/doc/source/_static/macros/sequenceeditor03.png
index b51ab807..b51ab807 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor03.png
+++ b/doc/source/_static/macros/sequenceeditor03.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor03_raw.png b/doc/source/_static/macros/sequenceeditor03_raw.png
index 06acb0b6..06acb0b6 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor03_raw.png
+++ b/doc/source/_static/macros/sequenceeditor03_raw.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor04.odg b/doc/source/_static/macros/sequenceeditor04.odg
index 34936757..34936757 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor04.odg
+++ b/doc/source/_static/macros/sequenceeditor04.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor04.png b/doc/source/_static/macros/sequenceeditor04.png
index cada20e2..cada20e2 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor04.png
+++ b/doc/source/_static/macros/sequenceeditor04.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequenceeditor05_raw.png b/doc/source/_static/macros/sequenceeditor05_raw.png
index abc285ce..abc285ce 100644
--- a/taurus/doc/source/_static/macros/sequenceeditor05_raw.png
+++ b/doc/source/_static/macros/sequenceeditor05_raw.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequencer01.odg b/doc/source/_static/macros/sequencer01.odg
index 37868ecf..37868ecf 100644
--- a/taurus/doc/source/_static/macros/sequencer01.odg
+++ b/doc/source/_static/macros/sequencer01.odg
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequencer01.png b/doc/source/_static/macros/sequencer01.png
index 8a563d81..8a563d81 100644
--- a/taurus/doc/source/_static/macros/sequencer01.png
+++ b/doc/source/_static/macros/sequencer01.png
Binary files differ
diff --git a/taurus/doc/source/_static/macros/sequencer01_raw.png b/doc/source/_static/macros/sequencer01_raw.png
index a14b78cc..a14b78cc 100644
--- a/taurus/doc/source/_static/macros/sequencer01_raw.png
+++ b/doc/source/_static/macros/sequencer01_raw.png
Binary files differ
diff --git a/doc/source/_static/macroserver_pool_server.png b/doc/source/_static/macroserver_pool_server.png
deleted file mode 100644
index 6d623f7d..00000000
--- a/doc/source/_static/macroserver_pool_server.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/macroserver_server.png b/doc/source/_static/macroserver_server.png
deleted file mode 100644
index 5ba5e16b..00000000
--- a/doc/source/_static/macroserver_server.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/motor.png b/doc/source/_static/motor.png
deleted file mode 100644
index 80b08c98..00000000
--- a/doc/source/_static/motor.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/perspectives-toolbar01.png b/doc/source/_static/perspectives-toolbar01.png
index 6669eb50..6669eb50 100644
--- a/taurus/doc/source/_static/perspectives-toolbar01.png
+++ b/doc/source/_static/perspectives-toolbar01.png
Binary files differ
diff --git a/doc/source/_static/pm_pipeline.png b/doc/source/_static/pm_pipeline.png
deleted file mode 100644
index cbb7ea45..00000000
--- a/doc/source/_static/pm_pipeline.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/pool_server.png b/doc/source/_static/pool_server.png
deleted file mode 100644
index c3bcdd8e..00000000
--- a/doc/source/_static/pool_server.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana.png b/doc/source/_static/sardana.png
deleted file mode 100644
index 1d097e20..00000000
--- a/doc/source/_static/sardana.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_pool_server.png b/doc/source/_static/sardana_pool_server.png
deleted file mode 100644
index af4d2cdb..00000000
--- a/doc/source/_static/sardana_pool_server.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_screenshot.png b/doc/source/_static/sardana_screenshot.png
deleted file mode 100644
index de44a615..00000000
--- a/doc/source/_static/sardana_screenshot.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server.png b/doc/source/_static/sardana_server.png
deleted file mode 100644
index 42a6a464..00000000
--- a/doc/source/_static/sardana_server.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_controller.png b/doc/source/_static/sardana_server_controller.png
deleted file mode 100644
index 6a0cb7a4..00000000
--- a/doc/source/_static/sardana_server_controller.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_empty.png b/doc/source/_static/sardana_server_empty.png
deleted file mode 100644
index 8f1f3255..00000000
--- a/doc/source/_static/sardana_server_empty.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_icepap.png b/doc/source/_static/sardana_server_icepap.png
deleted file mode 100644
index f73381a4..00000000
--- a/doc/source/_static/sardana_server_icepap.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_icepap_np200.png b/doc/source/_static/sardana_server_icepap_np200.png
deleted file mode 100644
index 2b7af5d6..00000000
--- a/doc/source/_static/sardana_server_icepap_np200.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal.png b/doc/source/_static/sardana_server_internal.png
deleted file mode 100644
index 4c9a13fd..00000000
--- a/doc/source/_static/sardana_server_internal.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_0D.png b/doc/source/_static/sardana_server_internal_0D.png
deleted file mode 100644
index edbf70f8..00000000
--- a/doc/source/_static/sardana_server_internal_0D.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_countertimer.png b/doc/source/_static/sardana_server_internal_countertimer.png
deleted file mode 100644
index fb8f6257..00000000
--- a/doc/source/_static/sardana_server_internal_countertimer.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_motor.png b/doc/source/_static/sardana_server_internal_motor.png
deleted file mode 100644
index b9d2f5f4..00000000
--- a/doc/source/_static/sardana_server_internal_motor.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_motor_read_position_flow.png b/doc/source/_static/sardana_server_internal_motor_read_position_flow.png
deleted file mode 100644
index b6d28d7f..00000000
--- a/doc/source/_static/sardana_server_internal_motor_read_position_flow.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_motor_read_state_flow.png b/doc/source/_static/sardana_server_internal_motor_read_state_flow.png
deleted file mode 100644
index 5066b3e0..00000000
--- a/doc/source/_static/sardana_server_internal_motor_read_state_flow.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_motor_write_position_flow.png b/doc/source/_static/sardana_server_internal_motor_write_position_flow.png
deleted file mode 100644
index 0907ff94..00000000
--- a/doc/source/_static/sardana_server_internal_motor_write_position_flow.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_internal_pseudomotor.png b/doc/source/_static/sardana_server_internal_pseudomotor.png
deleted file mode 100644
index 281df34b..00000000
--- a/doc/source/_static/sardana_server_internal_pseudomotor.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_server_np200.png b/doc/source/_static/sardana_server_np200.png
deleted file mode 100644
index ee8dfa51..00000000
--- a/doc/source/_static/sardana_server_np200.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/sardana_sketch.png b/doc/source/_static/sardana_sketch.png
deleted file mode 100644
index 3cd2d13f..00000000
--- a/doc/source/_static/sardana_sketch.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/slideshow.js b/doc/source/_static/slideshow.js
deleted file mode 100644
index 79799afc..00000000
--- a/doc/source/_static/slideshow.js
+++ /dev/null
@@ -1,32 +0,0 @@
-$(document).ready(function()
-{
- var index = 0;
- var images = $("#gallery img");
- var thumbs = $("#thumbs img");
- //var imgHeight = $(thumbs).attr("height");
- //$(thumbs).slice(0,3).clone().appendTo("#thumbs");
- for (i=0; i<images.length; i++)
- {
- $(images[i]).addClass("image-"+i).hide();
- }
-
- show(index);
- setInterval(switch_image, 5000);
-
- function switch_image()
- {
- if (index<(images.length-1)){index+=1 ; }
- else {index=0}
- show (index);
- }
-
- function show(num)
- {
- $(images).fadeOut(600);
- $(".image-"+num).stop().fadeIn(600);
- console.log("Showing image " + num);
- //var scrollPos = (num+1)*imgHeight;
- //$("#thumbs").stop().animate({scrollTop: scrollPos}, 400);
- //console.log(scrollPos, "img.image-"+num);
- }
-});
diff --git a/doc/source/_static/snapshot01.png b/doc/source/_static/snapshot01.png
deleted file mode 100644
index e2616a4d..00000000
--- a/doc/source/_static/snapshot01.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot02.png b/doc/source/_static/snapshot02.png
deleted file mode 100644
index 7c713a7a..00000000
--- a/doc/source/_static/snapshot02.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot03.png b/doc/source/_static/snapshot03.png
deleted file mode 100644
index dbfad64c..00000000
--- a/doc/source/_static/snapshot03.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot04.png b/doc/source/_static/snapshot04.png
deleted file mode 100644
index c4c785f1..00000000
--- a/doc/source/_static/snapshot04.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot05.png b/doc/source/_static/snapshot05.png
deleted file mode 100644
index 82867544..00000000
--- a/doc/source/_static/snapshot05.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot06.png b/doc/source/_static/snapshot06.png
deleted file mode 100644
index 4fb0353b..00000000
--- a/doc/source/_static/snapshot06.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot07.png b/doc/source/_static/snapshot07.png
deleted file mode 100644
index 549df3e7..00000000
--- a/doc/source/_static/snapshot07.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot08.png b/doc/source/_static/snapshot08.png
deleted file mode 100644
index 7052fa8b..00000000
--- a/doc/source/_static/snapshot08.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot09.png b/doc/source/_static/snapshot09.png
deleted file mode 100644
index 8de05b41..00000000
--- a/doc/source/_static/snapshot09.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/snapshot10.png b/doc/source/_static/snapshot10.png
deleted file mode 100644
index a4cf12bf..00000000
--- a/doc/source/_static/snapshot10.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/spock_snapshot01.png b/doc/source/_static/spock_snapshot01.png
deleted file mode 100644
index c0752ed4..00000000
--- a/doc/source/_static/spock_snapshot01.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/spock_snapshot02.png b/doc/source/_static/spock_snapshot02.png
deleted file mode 100644
index 2a9d21d2..00000000
--- a/doc/source/_static/spock_snapshot02.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/synoptic01.png b/doc/source/_static/synoptic01.png
index 3e289228..3e289228 100644
--- a/taurus/doc/source/_static/synoptic01.png
+++ b/doc/source/_static/synoptic01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurus_codelogo01.png b/doc/source/_static/taurus_codelogo01.png
index 1e85c61d..1e85c61d 100644
--- a/taurus/doc/source/_static/taurus_codelogo01.png
+++ b/doc/source/_static/taurus_codelogo01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurus_layers.png b/doc/source/_static/taurus_layers.png
index cd8269d6..cd8269d6 100644
--- a/taurus/doc/source/_static/taurus_layers.png
+++ b/doc/source/_static/taurus_layers.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurus_spock01.png b/doc/source/_static/taurus_spock01.png
index 94ea7dae..94ea7dae 100644
--- a/taurus/doc/source/_static/taurus_spock01.png
+++ b/doc/source/_static/taurus_spock01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurus_tree01.png b/doc/source/_static/taurus_tree01.png
index 048eeeb0..048eeeb0 100644
--- a/taurus/doc/source/_static/taurus_tree01.png
+++ b/doc/source/_static/taurus_tree01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusarrayeditor01.png b/doc/source/_static/taurusarrayeditor01.png
index 99559541..99559541 100644
--- a/taurus/doc/source/_static/taurusarrayeditor01.png
+++ b/doc/source/_static/taurusarrayeditor01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusform_example01.png b/doc/source/_static/taurusform_example01.png
index b9c13607..b9c13607 100644
--- a/taurus/doc/source/_static/taurusform_example01.png
+++ b/doc/source/_static/taurusform_example01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusform_example02.png b/doc/source/_static/taurusform_example02.png
index 81df3636..81df3636 100644
--- a/taurus/doc/source/_static/taurusform_example02.png
+++ b/doc/source/_static/taurusform_example02.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusgui-newpanel01.png b/doc/source/_static/taurusgui-newpanel01.png
index 3474caac..3474caac 100644
--- a/taurus/doc/source/_static/taurusgui-newpanel01.png
+++ b/doc/source/_static/taurusgui-newpanel01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusgui-permanentpanels01.png b/doc/source/_static/taurusgui-permanentpanels01.png
index 4af432fb..4af432fb 100644
--- a/taurus/doc/source/_static/taurusgui-permanentpanels01.png
+++ b/doc/source/_static/taurusgui-permanentpanels01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusgui01.png b/doc/source/_static/taurusgui01.png
index b5497a55..b5497a55 100644
--- a/taurus/doc/source/_static/taurusgui01.png
+++ b/doc/source/_static/taurusgui01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusimage01.png b/doc/source/_static/taurusimage01.png
index b43fde19..b43fde19 100644
--- a/taurus/doc/source/_static/taurusimage01.png
+++ b/doc/source/_static/taurusimage01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusmodelchooser01.png b/doc/source/_static/taurusmodelchooser01.png
index c3868037..c3868037 100644
--- a/taurus/doc/source/_static/taurusmodelchooser01.png
+++ b/doc/source/_static/taurusmodelchooser01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-config01.png b/doc/source/_static/taurusplot-config01.png
index 0ee7a5ed..0ee7a5ed 100644
--- a/taurus/doc/source/_static/taurusplot-config01.png
+++ b/doc/source/_static/taurusplot-config01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-context01.png b/doc/source/_static/taurusplot-context01.png
index 2b862d5a..2b862d5a 100644
--- a/taurus/doc/source/_static/taurusplot-context01.png
+++ b/doc/source/_static/taurusplot-context01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-datainfo01.png b/doc/source/_static/taurusplot-datainfo01.png
index 1714271c..1714271c 100644
--- a/taurus/doc/source/_static/taurusplot-datainfo01.png
+++ b/doc/source/_static/taurusplot-datainfo01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-datainfo02.png b/doc/source/_static/taurusplot-datainfo02.png
index c23ee12f..c23ee12f 100644
--- a/taurus/doc/source/_static/taurusplot-datainfo02.png
+++ b/doc/source/_static/taurusplot-datainfo02.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-datainfo03.png b/doc/source/_static/taurusplot-datainfo03.png
index dc0ac28a..dc0ac28a 100644
--- a/taurus/doc/source/_static/taurusplot-datainfo03.png
+++ b/doc/source/_static/taurusplot-datainfo03.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-exportascii01.png b/doc/source/_static/taurusplot-exportascii01.png
index 3cbcaa0c..3cbcaa0c 100644
--- a/taurus/doc/source/_static/taurusplot-exportascii01.png
+++ b/doc/source/_static/taurusplot-exportascii01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-inputdata01.png b/doc/source/_static/taurusplot-inputdata01.png
index a63d889e..a63d889e 100644
--- a/taurus/doc/source/_static/taurusplot-inputdata01.png
+++ b/doc/source/_static/taurusplot-inputdata01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-inputdata02.png b/doc/source/_static/taurusplot-inputdata02.png
index ae75bb1d..ae75bb1d 100644
--- a/taurus/doc/source/_static/taurusplot-inputdata02.png
+++ b/doc/source/_static/taurusplot-inputdata02.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-timesupport01.png b/doc/source/_static/taurusplot-timesupport01.png
index 79e3f271..79e3f271 100644
--- a/taurus/doc/source/_static/taurusplot-timesupport01.png
+++ b/doc/source/_static/taurusplot-timesupport01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-timesupport02.png b/doc/source/_static/taurusplot-timesupport02.png
index ff7486a8..ff7486a8 100644
--- a/taurus/doc/source/_static/taurusplot-timesupport02.png
+++ b/doc/source/_static/taurusplot-timesupport02.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot-timesupport03.png b/doc/source/_static/taurusplot-timesupport03.png
index 556b7c66..556b7c66 100644
--- a/taurus/doc/source/_static/taurusplot-timesupport03.png
+++ b/doc/source/_static/taurusplot-timesupport03.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot01.png b/doc/source/_static/taurusplot01.png
index 3b7cc3a6..3b7cc3a6 100644
--- a/taurus/doc/source/_static/taurusplot01.png
+++ b/doc/source/_static/taurusplot01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot02.png b/doc/source/_static/taurusplot02.png
index 1c9da387..1c9da387 100644
--- a/taurus/doc/source/_static/taurusplot02.png
+++ b/doc/source/_static/taurusplot02.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot03.png b/doc/source/_static/taurusplot03.png
index 4c32ec3d..4c32ec3d 100644
--- a/taurus/doc/source/_static/taurusplot03.png
+++ b/doc/source/_static/taurusplot03.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot04.png b/doc/source/_static/taurusplot04.png
index 8a196af6..8a196af6 100644
--- a/taurus/doc/source/_static/taurusplot04.png
+++ b/doc/source/_static/taurusplot04.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusplot_example01.png b/doc/source/_static/taurusplot_example01.png
index 5f9819c2..5f9819c2 100644
--- a/taurus/doc/source/_static/taurusplot_example01.png
+++ b/doc/source/_static/taurusplot_example01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurustrend-fixedRange01.png b/doc/source/_static/taurustrend-fixedRange01.png
index 3d6d0a39..3d6d0a39 100644
--- a/taurus/doc/source/_static/taurustrend-fixedRange01.png
+++ b/doc/source/_static/taurustrend-fixedRange01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurustrend01.png b/doc/source/_static/taurustrend01.png
index c3ac8874..c3ac8874 100644
--- a/taurus/doc/source/_static/taurustrend01.png
+++ b/doc/source/_static/taurustrend01.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurustrend02.png b/doc/source/_static/taurustrend02.png
index d6d5c0da..d6d5c0da 100644
--- a/taurus/doc/source/_static/taurustrend02.png
+++ b/doc/source/_static/taurustrend02.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurustrend03.png b/doc/source/_static/taurustrend03.png
index 4d9ce3de..4d9ce3de 100644
--- a/taurus/doc/source/_static/taurustrend03.png
+++ b/doc/source/_static/taurustrend03.png
Binary files differ
diff --git a/taurus/doc/source/_static/taurusvalue01.png b/doc/source/_static/taurusvalue01.png
index 9f844ecd..9f844ecd 100644
--- a/taurus/doc/source/_static/taurusvalue01.png
+++ b/doc/source/_static/taurusvalue01.png
Binary files differ
diff --git a/doc/source/_static/trend_a2scanc.png b/doc/source/_static/trend_a2scanc.png
deleted file mode 100644
index c5fc4945..00000000
--- a/doc/source/_static/trend_a2scanc.png
+++ /dev/null
Binary files differ
diff --git a/doc/source/_static/trend_ascanVSascanc.png b/doc/source/_static/trend_ascanVSascanc.png
deleted file mode 100644
index 921b5781..00000000
--- a/doc/source/_static/trend_ascanVSascanc.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_static/whatsthiscursor.png b/doc/source/_static/whatsthiscursor.png
index 4b300080..4b300080 100644
--- a/taurus/doc/source/_static/whatsthiscursor.png
+++ b/doc/source/_static/whatsthiscursor.png
Binary files differ
diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html
index 0a678b1a..1eb19403 100644
--- a/doc/source/_templates/layout.html
+++ b/doc/source/_templates/layout.html
@@ -1,19 +1,28 @@
{% extends "sphinxdoc/layout.html" %}
{% block rootrellink %}
- <li><a href="http://sardana-controls.org">home</a>|&nbsp;</li>
- <li><a href="http://sourceforge.net/projects/sardana">project</a>|&nbsp;</li>
- <li><a href="https://pypi.python.org/pypi/sardana">download</a>|&nbsp;</li>
- <li><a href="http://sardana.readthedocs.org">documentation </a> &raquo;</li>
-
-
+ <li><a href="http://taurus-scada.org">home</a>|&nbsp;</li>
+ <li><a href="http://sourceforge.net/projects/sardana/">project</a>|&nbsp;</li>
+ <li><a href="https://pypi.python.org/pypi/taurus">download</a>|&nbsp;</li>
+ <li><a href="http://taurus.readthedocs.org">documentation </a> &raquo;</li>
{% endblock %}
{% block relbar1 %}
+<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+ <table cellpading='0' cellspacing='0' width='100%'>
+ <tr>
+ <td align='left'>
+ <a href="{{ pathto('index') }}">
+ <img src="{{ pathto("_static/logo.png", 1) }}" border="0" alt="taurus"/>
+ </a>
+ </td>
+ <td align='right'>
+ <img src="{{ pathto("_static/taurus_codelogo01.png", 1) }}" border="0" alt="taurus"/>
+ </td>
+ </tr>
+ </table>
+</div>
{{ super() }}
{% endblock %}
-{% block sidebar2 %}
-{{ super() }}
-{% endblock %}
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 9fefe9c2..1a6f7f1a 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -3,71 +3,112 @@
##############################################################################
##
-## This file is part of Sardana
+## This file is part of Taurus
##
-## http://www.sardana-controls.org/
+## http://taurus-scada.org
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
-## Sardana is free software: you can redistribute it and/or modify
+## Taurus is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
-## Sardana is distributed in the hope that it will be useful,
+## Taurus is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
+## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################
+import sys, os
-import sys
-import os
# declare some useful absolute paths
_this_dir = os.path.dirname(os.path.abspath(__file__))
_setup_dir = os.path.abspath(os.path.join(_this_dir, os.path.pardir,
os.path.pardir))
-_src_dir = os.path.join(_setup_dir, 'src')
-_taurus_dir = os.path.join(_setup_dir, 'taurus')
-_taurus_lib_dir = os.path.join(_taurus_dir, 'lib')
-_mock_path = os.path.join(_taurus_dir, 'doc', 'mock.zip')
+_lib_dir = os.path.join(_setup_dir, 'lib')
+_doc_dir = os.path.join(_setup_dir, 'doc')
+_api_dir = os.path.join(_doc_dir, 'source', 'devel', 'api')
+_mock_path = os.path.join(_doc_dir, 'mock.zip')
# append mock dir to the sys path (mocks will be used if needed)
sys.path.append(_mock_path)
-
-# fix the mock so that the docs work with it
-import PyTango
-if not isinstance(PyTango.Release.version_info, tuple):
- PyTango.Release.version_info=(999, 99, 9, 'mock', 0)
-
-# Import code from src distribution
-sys.path.insert(0, _src_dir)
-sys.path.insert(0, _taurus_lib_dir)
-
-import sardana
-
-def fix_sardana_for_doc():
-
- def type_getattr(self, name):
- if name not in self._pending_type_names:
- self._pending_type_names[name] = name
- return self._pending_type_names[name]
- import sardana.macroserver.msparameter
- sardana.macroserver.msparameter.TypeNames.__getattr__ = type_getattr
+# Import code from src distribution
+sys.path.insert(0, os.path.abspath(_lib_dir))
-fix_sardana_for_doc()
+import taurus
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('sphinxext'))
+# -- RTD hack -----------------------------------------------------------------
+# This code is to allow RTD to build the catalog and the api
+# it has no effect on local builds
+
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+if on_rtd:
+ # unfortunately, RTD installs sardana instead of taurus
+ # and it fails because of the PyTango mocked version
+ # fix the PyTango mock so that rtd can install sardana
+ import PyTango
+ if not isinstance(PyTango.Release.version_info, tuple):
+ PyTango.Release.version_info=(999, 99, 9, 'mock', 0)
+
+ import imp
+
+ def _build_catalog():
+ #import setup.py as a module
+ name = 'setup'
+ data = imp.find_module(name, [_setup_dir])
+ setupmod = imp.load_module(name, *data)
+ catalog = setupmod.build_catalog()
+ #build
+ fname = os.path.join(_doc_dir, 'source', 'devel', 'catalog.html')
+ catalog.fname = fname
+ catalog.builder_target_dir = _this_dir
+ catalog.thumbnails_source = os.path.join(_doc_dir, 'thumbnails.zip')
+ catalog.verbose = True
+ catalog.out = sys.stdout
+ catalog.run()
+
+ def _build_doc_api():
+ #import auto_rst4api from the doc dir
+ name = 'auto_rst4api'
+ data = imp.find_module(name, [_doc_dir])
+ auto_rst4api = imp.load_module(name, *data)
+ API_Creator = auto_rst4api.Auto_rst4API_Creator
+ # prepare api creator
+ excl = ['_[^\.]*[^_]', '.*.extra_sardana', '.*.extra_pool',
+ '.*.extra_macroexecutor', 'taurus.external']
+ rstCreator = API_Creator(exclude_patterns=excl,
+ templatespath=_doc_dir,
+ overwrite_old=True,
+ verbose=True)
+ # clean previously existing rst files
+ rstCreator.cleanAutogenerated(_api_dir)
+ # generate api
+ import taurus
+ r = rstCreator.documentModule('taurus', _api_dir)
+ # report
+ print("Auto Creation of API docs Finished with %i warnings:" % len(r))
+ for i in r:
+ print(i)
+
+ #build the api and the catalog
+ _build_catalog()
+ _build_doc_api()
+
+# ------------------------------------------------------------------------------
+
+
# -- General configuration -----------------------------------------------------
#autosummary_generate = True
@@ -83,17 +124,8 @@ extensions = ['sphinx.ext.pngmath',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
- 'sardanaextension',
- 'ipython_console_highlighting',
- 'spock_console_highlighting',
-]
+ 'taurusextension']
-try:
- import rst2pdf.pdfbuilder
- extensions.append('rst2pdf.pdfbuilder')
-except:
- pass
-
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -107,8 +139,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'sardana'
-copyright = u'2012, ALBA - CELLS, Creative Commons Attribution-Share Alike 3.0'
+project = u'taurus'
+copyright = u'2011, ALBA - CELLS, Creative Commons Attribution-Share Alike 3.0'
copyright = u"""Except where otherwise noted, content on this site is
licensed under a Creative Commons Attribution 3.0 License"""
@@ -120,9 +152,9 @@ licensed under a Creative Commons Attribution 3.0 License"""
# built documents.
#
# The short X.Y version.
-version = '.'.join(sardana.Release.version.split('.')[:2])
+version = '.'.join(taurus.Release.version.split('.')[:2])
# The full version, including alpha/beta/rc tags.
-release = sardana.Release.version
+release = taurus.Release.version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -157,7 +189,6 @@ add_module_names = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
-pygments_style = 'spock_console_highlighting.SpockStyle'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
@@ -167,8 +198,8 @@ pygments_style = 'spock_console_highlighting.SpockStyle'
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
+#html_theme = 'default'
html_theme = 'default'
-#html_theme = 'sphinxdoc'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -188,7 +219,7 @@ html_theme_path = []
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-html_logo = os.path.join("_static", "logo.png")
+#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -236,32 +267,27 @@ html_static_path = ['_static']
#html_file_suffix = ''
# Output file base name for HTML help builder.
-htmlhelp_basename = 'sardanadoc'
+htmlhelp_basename = 'taurusdoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
-latex_paper_size = 'a4'
+#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
-latex_font_size = '10pt'
+#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'sardana.tex', u'Sardana Documentation',
- u'Sardana team', 'manual'),
+ ('index', 'taurus.tex', u'taurus Documentation',
+ u'taurus team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
-latex_logo = '_static/sardana_screenshot.png'
-
-latex_elements = {
- 'fontpkg': '\\usepackage{palatino}',
-}
-latex_show_urls = 'footnote'
+#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
@@ -278,18 +304,14 @@ latex_show_urls = 'footnote'
todo_include_todos = True
-autodoc_member_order = "bysource"
-
# -- Options for Graphviz -----------------------------------------------------
inheritance_node_attrs = dict(shape='box', fontcolor='black',
- height=0.4,
- color='brown', style='rounded')
+ height=0.5,
+ color='dodgerblue1', style='rounded')
inheritance_graph_attrs = dict(rankdir="UD", ratio='compress')
-graphviz_output_format = 'png' # 'svg'
-
#inheritance_graph_attrs = dict(rankdir="LR", size='"6.0, 8.0"',
# fontsize=14, ratio='compress')
@@ -299,11 +321,7 @@ intersphinx_mapping = {
'http://docs.python.org/dev': None,
'http://docs.scipy.org/doc/scipy/reference' : None,
'http://docs.scipy.org/doc/numpy' : None,
- 'http://ipython.org/ipython-doc/stable/' : None,
'http://www.esrf.fr/computing/cs/tango/tango_doc/kernel_doc/pytango/latest/': None,
- 'http://www.taurus-scada.org' : None,
'http://pyqt.sourceforge.net/Docs/PyQt4/' : None,
- 'http://matplotlib.sourceforge.net/' : None,
- 'http://packages.python.org/guiqwt/' : None,
}
diff --git a/doc/source/devel/api/api_0D.rst b/doc/source/devel/api/api_0D.rst
deleted file mode 100644
index 6cb919c0..00000000
--- a/doc/source/devel/api/api_0D.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.poolzerodexpchannel
-
-.. _sardana-0d-api:
-
-=============================
-0D channel API reference
-=============================
-
-.. todo:: document 0D channel API reference
-
-.. seealso::
-
- :ref:`sardana-0d-overview`
- the 0D experiment channel overview
-
- :class:`~sardana.tango.pool.ZeroDExpChannel.ZeroDExpChannel`
- the 0D experiment channel tango device :term:`API`
-
-.. :class:`~sardana.pool.poolzerodexpchannel.Pool0DExpChannel`
-.. the 0D experiment channel class :term:`API`
diff --git a/doc/source/devel/api/api_1D.rst b/doc/source/devel/api/api_1D.rst
deleted file mode 100644
index ae210a46..00000000
--- a/doc/source/devel/api/api_1D.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.poolonedexpchannel
-
-.. _sardana-1d-api:
-
-=============================
-1D channel API reference
-=============================
-
-.. todo:: document 1D channel API reference
-
-.. seealso::
-
- :ref:`sardana-1d-overview`
- the 1D experiment channel overview
-
- :class:`~sardana.tango.pool.OneDExpChannel.OneDExpChannel`
- the 1D experiment channel tango device :term:`API`
-
-.. :class:`~sardana.pool.poolonedexpchannel.Pool1DExpChannel`
-.. the 1D experiment channel class :term:`API`
diff --git a/doc/source/devel/api/api_2D.rst b/doc/source/devel/api/api_2D.rst
deleted file mode 100644
index 5d80590a..00000000
--- a/doc/source/devel/api/api_2D.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.pooltwodexpchannel
-
-.. _sardana-2d-api:
-
-=============================
-2D channel API reference
-=============================
-
-.. todo:: document 2D channel API reference
-
-.. seealso::
-
- :ref:`sardana-2d-overview`
- the 2D experiment channel overview
-
- :class:`~sardana.tango.pool.TwoDExpChannel.TwoDExpChannel`
- the 2D experiment channel tango device :term:`API`
-
-.. :class:`~sardana.pool.pooltwodexpchannel.Pool2DExpChannel`
-.. the 2D experiment channel class :term:`API`
diff --git a/doc/source/devel/api/api_IOR.rst b/doc/source/devel/api/api_IOR.rst
deleted file mode 100644
index 43638824..00000000
--- a/doc/source/devel/api/api_IOR.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.poolioregister
-
-.. _sardana-ior-api:
-
-=============================
-I/O register API reference
-=============================
-
-.. todo:: document I/O register API reference
-
-.. seealso::
-
- :ref:`sardana-ior-overview`
- the I/O register overview
-
- :class:`~sardana.tango.pool.IORegister.IORegister`
- the I/O register tango device :term:`API`
-
-.. :class:`~sardana.pool.poolioregister.PoolIORegister`
-.. the I/O register class :term:`API`
diff --git a/doc/source/devel/api/api_controller.rst b/doc/source/devel/api/api_controller.rst
deleted file mode 100644
index f77e55bf..00000000
--- a/doc/source/devel/api/api_controller.rst
+++ /dev/null
@@ -1,81 +0,0 @@
-
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-controller-api:
-
-========================
-Controller API reference
-========================
-
- * :class:`Controller` - Base API for all controller types
- * :class:`MotorController` - Motor controller API
- * :class:`CounterTimerController` - Counter/Timer controller API
- * :class:`ZeroDController` - 0D controller API
- * :class:`PseudoMotorController` - PseudoMotor controller API
- * :class:`PseudoCounterController` - PseudoCounter controller API
- * :class:`IORegisterController` - IORegister controller API
-
-.. _sardana-controller-data-type:
-
-Data Type definition
-----------------------
-
-When writing a new controller you may need to specify extra attributes (per
-controller or/and per axis) as well as extra properties. This chapter describes
-how to describe the data type for each of this additional members.
-Controller data type definition has the following equivalences. This means you
-can use any of the given possibilities to describe a field data type. The
-possibilities are ordered by preference (example: usage of :obj:`int` is
-preferred to "int" or "PyTango.DevLong"):
-
-- for 0D data types:
- - **integer**: :obj:`int` | :data:`DataType.Integer <sardana.sardanadefs.DataType>` | "int" | "integer" | "long" | :obj:`long` | [ "PyTango." ] "DevLong"
- - **double**: :obj:`float` | :data:`DataType.Double <sardana.sardanadefs.DataType>` | "double" | "float" | [ "PyTango." ] "DevDouble"
- - **string**: :obj:`str` | :data:`DataType.String <sardana.sardanadefs.DataType>` | "str" | "string" | [ "PyTango." ] "DevString"
- - **boolean**: :obj:`bool` | :data:`DataType.Boolean <sardana.sardanadefs.DataType>` | "bool" | "boolean" | [ "PyTango." ] "DevBoolean"
-- for 1D data types:
- - **integer**: (:obj:`int`,) | (:data:`DataType.Integer <sardana.sardanadefs.DataType>`,) | ("int",) | ("integer",) | (:obj:`long`,) | ("long",) | [ "PyTango." ] "DevVarLongArray" | ([ "PyTango." ] "DevLong",)
- - **double**: (:obj:`float`,) | (:data:`DataType.Double <sardana.sardanadefs.DataType>`,) | ("double",) | ("float",) | [ "PyTango." ] "DevVarDoubleArray" | ([ "PyTango." ] "DevDouble",)
- - **string**: (:obj:`str`,) | (:data:`DataType.String <sardana.sardanadefs.DataType>`,) | ("str",) | ("string",) | [ "PyTango." ] "DevVarStringArray" | ([ "PyTango." ] "DevString",)
- - **boolean**: (:obj:`bool`,) | (:data:`DataType.Boolean <sardana.sardanadefs.DataType>`,) | ("bool",) | ("boolean",) | [ "PyTango." ] "DevVarBooleanArray" | ([ "PyTango." ] "DevBoolean",)
-
-.. deprecated:: 1.0
- [ "PyTango." ] "Dev"<concrete type string> types are considered deprecated.
-
-.. note:: when string, types are case insensitive. This means "long" is the same as "LONG"
-
-Here is an example on how to define extra attributes per axis:
-
- 1. EncoderSource: a scalar r/w string
- 2. ReflectionMatrix: a 2D readable float with customized getter method
-
-::
-
- from sardana import State, DataAccess
- from sardana.pool.controller import MotorController, \
- Type, Description, DefaultValue, Access, FGet, FSet
-
- class MyMotorCtrl(MotorController):
-
- axis_attributes = \
- {
- 'EncoderSource' : { Type : str,
- Description : 'motor encoder source', },
-
- 'ReflectionMatrix' : { Type : ( (float,), ),
- Access : DataAccess.ReadOnly,
- FGet : 'getReflectionMatrix', },
- }
-
- def getAxisExtraPar(self, axis, name):
- name = name.lower()
- if name == 'encodersource':
- return self._encodersource[axis]
-
- def setAxisPar(self, axis, name, value):
- name = name.lower()
- if name == 'encodersource':
- self._encodersource[axis] = value
-
- def getReflectionMatrix(self, axis):
- return ( (1.0, 0.0), (0.0, 1.0) )
diff --git a/doc/source/devel/api/api_countertimer.rst b/doc/source/devel/api/api_countertimer.rst
deleted file mode 100644
index 3d07a563..00000000
--- a/doc/source/devel/api/api_countertimer.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.poolcountertimer
-
-.. _sardana-countertimer-api:
-
-=============================
-Counter/Timer API reference
-=============================
-
-.. todo:: document Counter/Timer API reference
-
-.. seealso::
-
- :ref:`sardana-countertimer-overview`
- the counter/timer overview
-
- :class:`~sardana.tango.pool.CTExpChannel.CTExpChannel`
- the counter/timer tango device :term:`API`
-
-.. :class:`~sardana.pool.poolcountertimer.PoolCounterTimer`
-.. the counter/timer class :term:`API`
diff --git a/doc/source/devel/api/api_macro.rst b/doc/source/devel/api/api_macro.rst
deleted file mode 100644
index 7c0c4187..00000000
--- a/doc/source/devel/api/api_macro.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-
-.. currentmodule:: sardana.macroserver.macro
-
-.. _sardana-macro-api:
-
-===================
-Macro API reference
-===================
-
-Macro class
------------
-
-.. autoclass:: Macro
- :members:
- :undoc-members:
-
-iMacro class
-------------
-
-.. autoclass:: iMacro
- :members:
- :undoc-members:
-
-macro decorator
----------------
-
-.. autoclass:: macro
- :members:
- :undoc-members:
-
-imacro decorator
-----------------
-
-.. autoclass:: imacro
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/api_motor.rst b/doc/source/devel/api/api_motor.rst
deleted file mode 100644
index 25dbdc8f..00000000
--- a/doc/source/devel/api/api_motor.rst
+++ /dev/null
@@ -1,207 +0,0 @@
-.. currentmodule:: sardana.pool.poolmotor
-
-.. _sardana-motor-api:
-
-===================
-Motor API reference
-===================
-
-The motor is one of the most used elements in sardana. A motor represents
-anything that can be *changed* (and can potentially take some time to do it).
-
-This chapter explains the generic motor :term:`API` in the context of sardana.
-In sardana there are, in fact, two Motor :term:`API`\s. To better explain why,
-let's consider the case were sardana server is running as a Sardana Tango
-device server:
-
-.. image:: /_static/sardana_server_internal_motor.png
- :width: 680
- :align: center
-
-Every motor in sardana is represented in the sardana kernel as a
-:class:`PoolMotor`. The :class:`PoolMotor` :term:`API` is not directly
-accessible from outside the sardana server. This is a low level :term:`API`
-that is only accessbile to someone writing a server extension to sardana. At
-the time of writing, the only available sardana server extension is Tango.
-
-The second motor interface consists on the one provided by the server extension,
-which is in this case the one provided by the Tango motor device interface:
-:class:`~sardana.tango.pool.Motor.Motor`. The Tango motor interface tries to
-mimic the as closely as possible the :class:`PoolMotor` :term:`API`.
-
-.. seealso::
-
- :ref:`sardana-motor-overview`
- the motor overview
-
- :class:`~sardana.tango.pool.Motor.Motor`
- the motor tango device :term:`API`
-
-.. :class:`~sardana.pool.poolmotor.PoolMotor`
-.. the motor class :term:`API`
-
-A motor will have, at least, a ``state``, and a ``position``. The state
-indicates at any time if the motor is stopped, in alarm or moving. The
-position, indicates the current :term:`user position`. Unless a motor
-controller is specifically programmed not to, it's motors will also have:
-
-**limit switches**
- the three limit switches (home, upper and lower). Each switch is
- represented by a boolean value: False means inactive while True means
- active.
-
- low level :attr:`PoolMotor` API.
-
- high level Tango Motor API: limit_switches tango attribute
-
-**acceleration**
- motor acceleration (usually acceleration time in seconds, but it's up to
- the motor controller class to decide)
-
- :attr:`~PoolMotor.acceleration`
-
-**deceleration**
- motor deceleration (usually deceleration time in seconds, but it's up to
- the motor controller class to decide)
-
- :attr:`~PoolMotor.deceleration`
-
-**velocity**
- top velocity
-
- :attr:`~PoolMotor.velocity`
-
-**base rate**
- initial velocity
-
- :attr:`~PoolMotor.base_rate`
-
-**dial position**
- the :term:`dial position`
-
- :attr:`~PoolMotor.dial_position`
-
-**offset**
- the offset to be applied in the motor position computation [default: 0.0]
-
- :attr:`~PoolMotor.offset`
-
-**sign**
- the sign to be applied in the motor position computation [default: 1,
- possible values are (1, -1)]
-
- :attr:`~PoolMotor.sign`
-
-**Steps per unit**
- This is the number of motor steps per :term:`user position` [default:
- 1.0]
-
- :attr:`~PoolMotor.step_per_unit`
-
-**backlash**
- If this is defined to be something different than 0, the motor will
- always stop the motion coming from the same mechanical direction. This
- means that it could be possible to ask the motor to go a little bit after
- the desired position and then to return to the desired position. The value
- is the number of steps the motor will pass the desired position if it
- arrives from the "wrong" direction. This is a signed value. If the sign is
- positive, this means that the authorized direction to stop the motion is
- the increasing motor position direction. If the sign is negative, this
- means that the authorized direction to stop the motion is the decreasing
- motor position direction.
-
- :attr:`~PoolMotor.backlash`
-
-**instability_time**
- This property defines the time in milliseconds that the software
- managing a motor movement will wait between it detects the end of the
- motion and the last motor position reading. It is typically used for motors
- that move mechanics which have an instability time after each motion.
-
- :attr:`~PoolMotor.instability_time`
-
-The available operations are:
-
-start move absolute (:term:`user position`\)
- starts to move the motor to the given absolute user position
-
- :meth:`~PoolMotor.start_move`
-
-stop
- stops the motor in an orderly fashion
-
-abort
- stops the motor motion as fast as possible (possibly without
- deceleration time and loss of position)
-
-Motor state
------------
-
-On a sardana tango server, the motor state can be obtained by reading the state
-attribute or by executing the state command. The diagram shows the internal
-sequence of calls.
-
-.. image:: /_static/sardana_server_internal_motor_read_state_flow.png
- :width: 680
- :align: center
-
-Motor position
---------------
-
-The motor's current :term:`user position` can be obtained by reading the
-position attribute. The diagram shows the internal sequence of calls.
-
-.. image:: /_static/sardana_server_internal_motor_read_position_flow.png
- :width: 680
- :align: center
-
-Motion
-------
-
-The most useful thing to do with a motor is, of course, to move it. To move a
-motor to another absolute :term:`user position` you have to write the value
-into the position attribute.
-
-.. image:: /_static/sardana_server_internal_motor_write_position_flow.png
- :width: 680
- :align: center
-
-Before allowing a movement, some pre-conditions are automatically checked by
-tango (not represented in the diagram):
-
- - motor is in a proper state;
- - requested position is within the allowed motor boundaries (if
- defined)
-
-Then, the :term:`dial position` is calculated taking into account the *offset*,
-*signal* as well as a possible *backlash*.
-
-Afterward, and because the motor may be part of a pseudo motor system, other
-pre-conditions are checked:
-
- - is the final :term:`dial position` (including backlash) within the
- motor boundaries (if defined)
- - will the resulting motion end in an allowed position for all the
- pseudo motors that depend on this motor
-
-After all pre-conditions are checked, the motor will deploy a motion *job* into
-the sardana kernel engine which will trigger a series of calls to the
-underlying motor controller.
-
-The motor awaits for the :meth:`~sardana.pool.controller.Startable.PreStartOne`
-to signal that the motion will be possible to return successfully from the move
-request.
-
-The next diagram shows the state machine of a motor.
-
-.. graphviz:: motion.dot
- :alt: Basic motion diagram
- :caption:
- Basic motion diagram. The black state transitions are the ones which
- can be triggered by a *user*.
- For simplicity, only the most relevant states involved in a motor
- motion are shown. Error states are omited
-
-
-
-
diff --git a/doc/source/devel/api/api_pseudocounter.rst b/doc/source/devel/api/api_pseudocounter.rst
deleted file mode 100644
index 89ece409..00000000
--- a/doc/source/devel/api/api_pseudocounter.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.poolpseudocounter
-
-.. _sardana-pseudocounter-api:
-
-=============================
-Pseudo counter API reference
-=============================
-
-.. todo:: document pseudo-counter API reference
-
-.. seealso::
-
- :ref:`sardana-pseudocounter-overview`
- the pseudo-counter overview
-
- :class:`~sardana.tango.pool.PseudoCounter.PseudoCounter`
- the pseudo-counter tango device :term:`API`
-
-.. :class:`~sardana.pool.poolpseudocounter.PoolPseudoCounter`
-.. the pseudo-counter class :term:`API`
diff --git a/doc/source/devel/api/api_pseudomotor.rst b/doc/source/devel/api/api_pseudomotor.rst
deleted file mode 100644
index 57b054bb..00000000
--- a/doc/source/devel/api/api_pseudomotor.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. currentmodule:: sardana.pool.poolpseudomotor
-
-.. _sardana-pseudomotor-api:
-
-=============================
-Pseudo motor API reference
-=============================
-
-.. todo:: document pseudo-motor API reference
-
-.. seealso::
-
- :ref:`sardana-pseudomotor-overview`
- the pseudo-motor overview
-
- :class:`~sardana.tango.pool.PseudoMotor.PseudoMotor`
- the pseudo-motor tango device :term:`API`
-
-.. :class:`~sardana.pool.poolpseudomotor.PoolPseudoMotor`
-.. the pseudo-motor class :term:`API`
diff --git a/doc/source/devel/api/api_sardana.rst b/doc/source/devel/api/api_sardana.rst
deleted file mode 100644
index a4058a11..00000000
--- a/doc/source/devel/api/api_sardana.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-
-Sardana API
-===========
-
-.. rubric:: APIs
-
-.. toctree::
- :maxdepth: 1
-
- Macro API <api_macro>
- Controller API <api_controller>
- Motor API <api_motor>
- I/O register <api_IOR>
- Counter/timer API <api_countertimer>
- 0D experiment channel API <api_0D>
- 1D experiment channel API <api_1D>
- 2D experiment channel API <api_2D>
- Pseudo motor API <api_pseudomotor>
- Pseudo counter API <api_pseudocounter>
- Pool tango API <tango_device_pool>
- Macro server tango API <tango_macroserver>
- Library <sardana/sardana>
- Test API <api_test>
-
diff --git a/doc/source/devel/api/api_test.rst b/doc/source/devel/api/api_test.rst
deleted file mode 100644
index 9b6f677f..00000000
--- a/doc/source/devel/api/api_test.rst
+++ /dev/null
@@ -1,102 +0,0 @@
-.. currentmodule:: sardana.test
-.. _sardana-test-api:
-
-===================
-Sardana test API
-===================
-
-Macro test API
-----------------------
-
-.. automodule:: sardana.macroserver.macros.test
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`.BaseMacroExecutor`
- * :class:`.MacroExecutorFactory`
- * :class:`.BaseMacroTestCase`
- * :class:`.RunMacroTestCase`
- * :class:`.RunStopMacroTestCase`
- * :class:`.SarDemoEnv`
-
-Decorator
----------
-
-.. decorator:: macroTest
-
- .. autofunction:: macroTest
-
-
-
-BaseMacroExecutor
------------------
-
-.. inheritance-diagram:: BaseMacroExecutor
- :parts: 1
-
-.. autoclass:: BaseMacroExecutor
- :inherited-members:
- :members:
- :undoc-members:
-
-MacroExecutorFactory
---------------------
-
-.. inheritance-diagram:: MacroExecutorFactory
- :parts: 1
-
-.. autoclass:: MacroExecutorFactory
- :inherited-members:
- :members:
- :undoc-members:
-
-BaseMacroTestCase
------------------
-
-.. inheritance-diagram:: BaseMacroTestCase
- :parts: 1
-
-.. autoclass:: BaseMacroTestCase
- :inherited-members:
- :members:
- :undoc-members:
-
-RunMacroTestCase
------------------
-
-.. inheritance-diagram:: RunMacroTestCase
- :parts: 1
-
-.. autoclass:: RunMacroTestCase
- :inherited-members:
- :members:
- :undoc-members:
-
-RunStopMacroTestCase
----------------------
-
-.. inheritance-diagram:: RunStopMacroTestCase
- :parts: 1
-
-.. autoclass:: RunStopMacroTestCase
- :inherited-members:
- :members:
- :undoc-members:
-
-SarDemoEnv
-----------
-
-.. inheritance-diagram:: SarDemoEnv
- :parts: 1
-
-.. autoclass:: SarDemoEnv
- :inherited-members:
- :members:
- :undoc-members:
-
-
-
-
-
diff --git a/doc/source/devel/api/motion.dot b/doc/source/devel/api/motion.dot
deleted file mode 100644
index a69ed621..00000000
--- a/doc/source/devel/api/motion.dot
+++ /dev/null
@@ -1,102 +0,0 @@
-digraph "Motion" {
-fontsize="-"
-"On" [
-fixedsize="false"
-regular="false"
-];
-"Moving" [
-fixedsize="false"
-regular="false"
-];
-"On" -> "Moving" [
-constraint="true"
-decorate="false"
-label="start"
-labelfloat="false"
-];
-"Moving" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_backlash" [
-fixedsize="false"
-label="Moving\n(backlash)"
-regular="false"
-];
-"Moving" -> "Moving_backlash" [
-constraint="true"
-decorate="false"
-fontcolor="green"
-label="finished"
-labelfloat="false"
-];
-"Moving_Instability_time" [
-fixedsize="false"
-label="Moving\n(Instability time)"
-regular="false"
-];
-"Moving" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"Moving_backlash" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-fontcolor="green"
-label="finished"
-labelfloat="false"
-];
-"Moving_backlash" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"Moving_backlash" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_backlash" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_Instability_time" -> "On" [
-constraint="true"
-decorate="false"
-fontcolor="green"
-label="finished"
-labelfloat="false"
-];
-"Moving_Instability_time" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_Instability_time" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"On" -> "On" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"On" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-}
diff --git a/doc/source/devel/api/motion_complete.dot b/doc/source/devel/api/motion_complete.dot
deleted file mode 100644
index 7b6a69b2..00000000
--- a/doc/source/devel/api/motion_complete.dot
+++ /dev/null
@@ -1,151 +0,0 @@
-digraph "Motion" {
-fontsize="-"
-"On" [
-fixedsize="false"
-regular="false"
-];
-"Moving" [
-fixedsize="false"
-regular="false"
-];
-"On" -> "Moving" [
-constraint="true"
-decorate="false"
-label="start"
-labelfloat="false"
-];
-"Moving" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_backlash" [
-fixedsize="false"
-label="Moving\n(backlash)"
-regular="false"
-];
-"Moving" -> "Moving_backlash" [
-constraint="true"
-decorate="false"
-fontcolor="green"
-label="finished"
-labelfloat="false"
-];
-"Moving_Instability_time" [
-fixedsize="false"
-label="Moving\n(Instability time)"
-regular="false"
-];
-"Moving" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"Moving_backlash" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-fontcolor="green"
-label="finished"
-labelfloat="false"
-];
-"Moving_backlash" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"Moving_backlash" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_backlash" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_Instability_time" -> "On" [
-constraint="true"
-decorate="false"
-fontcolor="green"
-label="finished"
-labelfloat="false"
-];
-"Moving_Instability_time" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Moving_Instability_time" -> "Moving_Instability_time" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"On" -> "On" [
-constraint="true"
-decorate="false"
-label="stop"
-labelfloat="false"
-];
-"On" -> "On" [
-constraint="true"
-decorate="false"
-label="abort"
-labelfloat="false"
-];
-"Alarm" [
-fixedsize="false"
-regular="false"
-];
-"Fault" [
-fixedsize="false"
-regular="false"
-];
-"Moving" -> "Alarm" [
-constraint="true"
-decorate="false"
-label="*"
-labelfloat="false"
-];
-"Moving" -> "Fault" [
-constraint="true"
-decorate="false"
-label="*"
-labelfloat="false"
-];
-"Moving_backlash" -> "Alarm" [
-constraint="true"
-decorate="false"
-label="*"
-labelfloat="false"
-];
-"Moving_backlash" -> "Fault" [
-constraint="true"
-decorate="false"
-label="*"
-labelfloat="false"
-];
-"Alarm" -> "On" [
-constraint="true"
-decorate="false"
-label="*"
-labelfloat="false"
-];
-"Fault" -> "On" [
-constraint="true"
-decorate="false"
-labelfloat="false"
-];
-"Alarm" -> "Moving" [
-constraint="true"
-decorate="false"
-label="start"
-labelfloat="false"
-];
-}
diff --git a/doc/source/devel/api/sardana/macroserver.rst b/doc/source/devel/api/sardana/macroserver.rst
deleted file mode 100644
index bb7094e3..00000000
--- a/doc/source/devel/api/sardana/macroserver.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. currentmodule:: sardana.macroserver
-
-:mod:`~sardana.macroserver`
-============================
-
-.. automodule:: sardana.macroserver
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- macros <macroserver/macros>
- macroserver <macroserver/macroserver>
- msbase <macroserver/msbase>
- mscontainer <macroserver/mscontainer>
- msdoor <macroserver/msdoor>
- msenvmanager <macroserver/msenvmanager>
- msexception <macroserver/msexception>
- msmacromanager <macroserver/msmacromanager>
- msmanager <macroserver/msmanager>
- msmetamacro <macroserver/msmetamacro>
- msparameter <macroserver/msparameter>
- mstypemanager <macroserver/mstypemanager>
-
diff --git a/doc/source/devel/api/sardana/macroserver/macros.rst b/doc/source/devel/api/sardana/macroserver/macros.rst
deleted file mode 100644
index f28f96c3..00000000
--- a/doc/source/devel/api/sardana/macroserver/macros.rst
+++ /dev/null
@@ -1,602 +0,0 @@
-.. currentmodule:: sardana.macroserver.macros
-
-.. _macroserver-standard-macro-catalog:
-
-:mod:`~sardana.macroserver.macros`
-==================================
-
-
-.. class:: scan.a2scan
-
- two-motor scan.
- a2scan scans two motors, as specified by motor1 and motor2.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_pos1 and final_pos1, start_pos2 and final_pos2,
- respectively. The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.a2scanc
-
- two-motor continuous scan
-
-
-.. class:: scan.a3scan
-
- three-motor scan .
- a3scan scans three motors, as specified by motor1, motor2 and motor3.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_pos1 and final_pos1, start_pos2 and final_pos2,
- start_pos3 and final_pos3, respectively.
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.a3scanc
-
- three-motor continuous scan
-
-
-.. class:: scan.a4scan
-
- four-motor scan .
- a4scan scans four motors, as specified by motor1, motor2, motor3 and motor4.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_posN and final_posN (for N=1,2,3,4).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.a4scanc
-
- four-motor continuous scan
-
-
-.. class:: scan.amultiscan
-
- Multiple motor scan.
- amultiscan scans N motors, as specified by motor1, motor2,...,motorN.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_posN and final_posN (for N=1,2,...).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.ascan
-
- Do an absolute scan of the specified motor.
- ascan scans one motor, as specified by motor. The motor starts at the
- position given by start_pos and ends at the position given by final_pos.
- The step size is (start_pos-final_pos)/nr_interv. The number of data points collected
- will be nr_interv+1. Count time is given by time which if positive,
- specifies seconds and if negative, specifies monitor counts.
-
-
-.. class:: scan.ascanc
-
- Do an absolute continuous scan of the specified motor.
- ascanc scans one motor, as specified by motor.
-
-
-.. class:: scan.ascanh
-
- Do an absolute scan of the specified motor.
- ascan scans one motor, as specified by motor. The motor starts at the
- position given by start_pos and ends at the position given by final_pos.
- The step size is (start_pos-final_pos)/nr_interv. The number of data points collected
- will be nr_interv+1. Count time is given by time which if positive,
- specifies seconds and if negative, specifies monitor counts.
-
-.. class:: demo.clear_sar_demo
-
- Undoes changes done with sar_demo
-
-.. class:: expert.commit_ctrllib
-
- Puts the contents of the given data in a file inside the pool
-
-
-.. class:: standard.ct
-
- Count for the specified time on the active measurement group
-
-
-.. class:: scan.d2scan
-
- two-motor scan relative to the starting position.
- d2scan scans two motors, as specified by motor1 and motor2.
- Each motor moves the same number of intervals. If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.d2scanc
-
- continuous two-motor scan relative to the starting positions
-
-
-.. class:: scan.d3scan
-
- three-motor scan .
- d3scan scans three motors, as specified by motor1, motor2 and motor3.
- Each motor moves the same number of intervals. If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2,3)
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.d3scanc
-
- continuous three-motor scan
-
-
-.. class:: scan.d4scan
-
- four-motor scan relative to the starting positions
- a4scan scans four motors, as specified by motor1, motor2, motor3 and motor4.
- Each motor moves the same number of intervals. If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2,3,4).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
- Upon termination, the motors are returned to their starting positions.
-
-
-.. class:: scan.d4scanc
-
- continuous four-motor scan relative to the starting positions
-
-
-.. class:: expert.defctrl
-
- Creates a new controller
- 'role_prop' is a sequence of roles and/or properties.
- - A role is defined as <role name>=<role value> (only applicable to pseudo controllers)
- - A property is defined as <property name> <property value>
-
- If both roles and properties are supplied, all roles must come before properties.
- All controller properties that don't have default values must be given.
-
- Example of creating a motor controller (with a host and port properties):
-
- [1]: defctrl SuperMotorController myctrl host homer.springfield.com port 5000
-
- Example of creating a Slit pseudo motor (sl2t and sl2b motor roles, Gap and
- Offset pseudo motor roles):
-
- [1]: defctrl Slit myslit sl2t=mot01 sl2b=mot02 Gap=gap01 Offset=offset01
-
-
-.. class:: expert.defelem
-
- Creates an element on a controller with an axis
-
-
-.. class:: expert.defm
-
- Creates a new motor in the active pool
-
-
-.. class:: expert.defmeas
-
- Create a new measurement group. First channel in channel_list MUST
- be an internal sardana channel. At least one channel MUST be a
- Counter/Timer (by default, the first Counter/Timer in the list will
- become the master).
-
-
-.. class:: scan.dmultiscan
-
- Multiple motor scan relative to the starting positions.
- dmultiscan scans N motors, as specified by motor1, motor2,...,motorN.
- Each motor moves the same number of intervals If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2,...)
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
-
-
-.. class:: scan.dscan
-
- motor scan relative to the starting position.
- dscan scans one motor, as specified by motor. If motor motor is at a
- position X before the scan begins, it will be scanned from X+start_pos
- to X+final_pos. The step size is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1. Count time is
- given by time which if positive, specifies seconds and if negative,
- specifies monitor counts.
-
-
-.. class:: scan.dscanc
-
- continuous motor scan relative to the starting position.
-
-
-.. class:: env.dumpenv
-
- Dumps the complete environment
-
-
-.. class:: expert.edctrl
-
- Returns the contents of the library file which contains the given
- controller code.
-
-
-.. class:: expert.edctrllib
-
- Returns the contents of the given library file
-
-
-.. class:: scan.fscan
-
- N-dimensional scan along user defined paths.
- The motion path for each motor is defined through the evaluation of a
- user-supplied function that is evaluated as a function of the independent
- variables.
- -independent variables are supplied through the indepvar string.
- The syntax for indepvar is "x=expresion1,y=expresion2,..."
- -If no indep vars need to be defined, write "!" or "*" or "None"
- -motion path for motor is generated by evaluating the corresponding
- function 'func'
- -Count time is given by integ_time. If integ_time is a scalar, then
- the same integ_time is used for all points. If it evaluates as an array
- (with same length as the paths), fscan will assign a different integration
- time to each acquisition point.
- -If integ_time is positive, it specifies seconds and if negative, specifies
- monitor counts.
-
- IMPORTANT Notes:
- -no spaces are allowed in the indepvar string.
- -all funcs must evaluate to the same number of points
-
- EXAMPLE: fscan x=[1,3,5,7,9],y=arange(5) motor1 x**2 motor2 sqrt(y*x-3) 0.1
-
-
-.. class:: communication.get
-
- Reads and outputs the data from the communication channel
-
-
-.. class:: env.load_env
-
- Read environment variables from config_env.xml file
-
-
-.. class:: lists.ls0d
-
- Lists all 0D experiment channels
-
-
-.. class:: lists.ls1d
-
- Lists all 1D experiment channels
-
-
-.. class:: lists.ls2d
-
- Lists all 2D experiment channels
-
-
-.. class:: lists.lsa
-
- Lists all existing objects
-
-
-.. class:: lists.lscom
-
- Lists all communication channels
-
-
-.. class:: lists.lsct
-
- Lists all Counter/Timers
-
-
-.. class:: lists.lsctrl
-
- Lists all existing controllers
-
-
-.. class:: lists.lsctrllib
-
- Lists all existing controller classes
-
-
-.. class:: lists.lsdef
-
- List all macro definitions
-
-
-.. class:: env.lsenv
-
- Lists the environment
-
-
-.. class:: lists.lsexp
-
- Lists all experiment channels
-
-
-.. class:: lists.lsi
-
- Lists all existing instruments
-
-
-.. class:: lists.lsior
-
- Lists all IORegisters
-
-
-.. class:: lists.lsm
-
- Lists all motors
-
-
-.. class:: lists.lsmac
-
- Lists existing macros
-
-
-.. class:: lists.lsmaclib
-
- Lists existing macro libraries.
-
-
-.. class:: lists.lsmeas
-
- List existing measurement groups
-
-
-.. class:: lists.lspc
-
- Lists all pseudo counters
-
-
-.. class:: lists.lspm
-
- Lists all existing motors
-
-.. class:: env.lsvo
-
- Lists the view options
-
-.. class:: mca.mca_start
-
- Starts an mca
-
-
-.. class:: mca.mca_stop
-
- Stops an mca
-
-
-.. class:: scan.mesh
-
- 2d grid scan .
- The mesh scan traces out a grid using motor1 and motor2.
- The first motor scans from m1_start_pos to m1_final_pos using the specified
- number of intervals. The second motor similarly scans from m2_start_pos
- to m2_final_pos. Each point is counted for for integ_time seconds
- (or monitor counts, if integ_time is negative).
- The scan of motor1 is done at each point scanned by motor2. That is, the
- first motor scan is nested within the second motor scan.
-
-
-.. class:: scan.meshc
-
- 2d grid scan. scans continuous
-
-.. class:: standard.mstate
-
- Prints the state of a motor
-
-
-.. class:: standard.mv
-
- Move motor(s) to the specified position(s)
-
-
-.. class:: standard.mvr
-
- Move motor(s) relative to the current position(s)
-
-
-.. class:: expert.prdef
-
- Returns the the macro code for the given macro name.
-
-
-.. class:: communication.put
-
- Sends a string to the communication channel
-
-
-.. class:: standard.pwa
-
- Show all motor positions in a pretty table
-
-
-.. class:: standard.pwm
-
- Show the position of the specified motors in a pretty table
-
-
-.. class:: ioregister.read_ioreg
-
- Reads an output register
-
-
-.. class:: expert.rellib
-
- Reloads the given python library code from the macro server filesystem.
-
- .. warning:: use with extreme care! Accidentally reloading a system
- module or an installed python module may lead to unpredictable
- behavior
-
- .. note:: if python module is used by any macro, don't forget to reload
- the corresponding macros afterward so the changes take effect.
-
-
-.. class:: expert.relmac
-
- Reloads the given macro code from the macro server filesystem.
- Attention: All macros inside the same file will also be reloaded.
-
-
-.. class:: expert.relmaclib
-
- Reloads the given macro library code from the macro server filesystem.
-
-
-.. class:: standard.report
-
- Logs a new record into the message report system (if active)
-
-.. class:: demo.sar_demo
-
- Sets up a demo environment. It creates many elements for testing
-
-.. class:: expert.sar_info
-
- Prints details about the given sardana object
-
-
-.. class:: scan.scanhist
-
- Shows scan history information. Give optional parameter scan number to
- display details about a specific scan
-
-
-.. class:: expert.send2ctrl
-
- Sends the given data directly to the controller
-
-
-.. class:: env.senv
-
- Sets the given environment variable to the given value
-
-
-.. class:: sequence.sequence
-
- This macro executes a sequence of macros. As a parameter
- it receives a string which is a xml structure. These macros which allow
- hooks can nest another sequence (xml structure). In such a case,
- this macro is executed recursively.
-
-
-.. class:: standard.set_lim
-
- Sets the software limits on the specified motor hello
-
-
-.. class:: standard.set_lm
-
- Sets the dial limits on the specified motor
-
-
-.. class:: standard.set_pos
-
- Sets the position of the motor to the specified value
-
-
-.. class:: standard.set_user_pos
-
- Sets the USER position of the motor to the specified value (by changing OFFSET and keeping DIAL)
-
-
-.. class:: standard.settimer
-
- Defines the timer channel for the active measurement group
-
-
-.. class:: env.setvo
-
- Sets the given view option to the given value
-
-
-.. class:: standard.uct
-
- Count on the active measurement group and update
-
-
-.. class:: expert.udefctrl
-
- Deletes an existing controller
-
-
-.. class:: expert.udefelem
-
- Deletes an existing element
-
-
-.. class:: expert.udefmeas
-
- Deletes an existing measurement group
-
-
-.. class:: standard.umv
-
- Move motor(s) to the specified position(s) and update
-
-
-.. class:: standard.umvr
-
- Move motor(s) relative to the current position(s) and update
-
-
-.. class:: env.usenv
-
- Unsets the given environment variable
-
-
-.. class:: env.usetvo
-
- Resets the value of the given view option
-
-
-.. class:: standard.wa
-
- Show all motor positions
-
-
-.. class:: standard.wm
-
- Show the position of the specified motors.
-
-
-.. class:: ioregister.write_ioreg
-
- Writes a value to an input register
-
-
-.. class:: standard.wu
-
- Show all user motor positions
-
-
-.. class:: standard.wum
-
- Show the user position of the specified motors.
-
diff --git a/doc/source/devel/api/sardana/macroserver/macroserver.rst b/doc/source/devel/api/sardana/macroserver/macroserver.rst
deleted file mode 100644
index 2606e056..00000000
--- a/doc/source/devel/api/sardana/macroserver/macroserver.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.macroserver.macroserver
-
-:mod:`~sardana.macroserver.macroserver`
-=======================================
-
-.. automodule:: sardana.macroserver.macroserver
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MacroServer`
-
-MacroServer
-------------
-
-.. inheritance-diagram:: MacroServer
- :parts: 1
-
-.. autoclass:: MacroServer
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/msbase.rst b/doc/source/devel/api/sardana/macroserver/msbase.rst
deleted file mode 100644
index b6704476..00000000
--- a/doc/source/devel/api/sardana/macroserver/msbase.rst
+++ /dev/null
@@ -1,34 +0,0 @@
-.. currentmodule:: sardana.macroserver.msbase
-
-:mod:`~sardana.macroserver.msbase`
-=======================================
-
-.. automodule:: sardana.macroserver.msbase
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MSBaseObject`
- * :class:`MSObject`
-
-MSBaseObject
-------------
-
-.. inheritance-diagram:: MSBaseObject
- :parts: 1
-
-.. autoclass:: MSBaseObject
- :show-inheritance:
-
-MSObject
-------------
-
-.. inheritance-diagram:: MSObject
- :parts: 1
-
-.. autoclass:: MSObject
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/mscontainer.rst b/doc/source/devel/api/sardana/macroserver/mscontainer.rst
deleted file mode 100644
index 9ae7e47c..00000000
--- a/doc/source/devel/api/sardana/macroserver/mscontainer.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.macroserver.mscontainer
-
-:mod:`~sardana.macroserver.mscontainer`
-=======================================
-
-.. automodule:: sardana.macroserver.mscontainer
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MSContainer`
-
-MacroServer
-------------
-
-.. inheritance-diagram:: MSContainer
- :parts: 1
-
-.. autoclass:: MSContainer
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/msdoor.rst b/doc/source/devel/api/sardana/macroserver/msdoor.rst
deleted file mode 100644
index d60129e8..00000000
--- a/doc/source/devel/api/sardana/macroserver/msdoor.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.macroserver.msdoor
-
-:mod:`~sardana.macroserver.msdoor`
-=======================================
-
-.. automodule:: sardana.macroserver.msdoor
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MSDoor`
-
-MSDoor
-------------
-
-.. inheritance-diagram:: MSDoor
- :parts: 1
-
-.. autoclass:: MSDoor
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/msenvmanager.rst b/doc/source/devel/api/sardana/macroserver/msenvmanager.rst
deleted file mode 100644
index c758ea2d..00000000
--- a/doc/source/devel/api/sardana/macroserver/msenvmanager.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.macroserver.msenvmanager
-
-:mod:`~sardana.macroserver.msenvmanager`
-=========================================
-
-.. automodule:: sardana.macroserver.msenvmanager
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`EnvironmentManager`
-
-EnvironmentManager
---------------------
-
-.. inheritance-diagram:: EnvironmentManager
- :parts: 1
-
-.. autoclass:: EnvironmentManager
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/msexception.rst b/doc/source/devel/api/sardana/macroserver/msexception.rst
deleted file mode 100644
index f4244b42..00000000
--- a/doc/source/devel/api/sardana/macroserver/msexception.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-.. currentmodule:: sardana.macroserver.msexception
-
-:mod:`~sardana.macroserver.msexception`
-=========================================
-
-.. automodule:: sardana.macroserver.msexception
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MacroServerException`
-
-MacroServerException
---------------------
-
-.. autoclass:: MacroServerException
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/msmacromanager.rst b/doc/source/devel/api/sardana/macroserver/msmacromanager.rst
deleted file mode 100644
index 7e0c553c..00000000
--- a/doc/source/devel/api/sardana/macroserver/msmacromanager.rst
+++ /dev/null
@@ -1,28 +0,0 @@
-.. currentmodule:: sardana.macroserver.msmacromanager
-
-:mod:`~sardana.macroserver.msmacromanager`
-===========================================
-
-.. automodule:: sardana.macroserver.msmacromanager
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MacroManager`
- * :class:`MacroExecutor`
-
-MacroManager
---------------------
-
-.. autoclass:: MacroManager
- :show-inheritance:
-
-MacroExecutor
---------------------
-
-.. autoclass:: MacroExecutor
- :show-inheritance: \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/macroserver/msmanager.rst b/doc/source/devel/api/sardana/macroserver/msmanager.rst
deleted file mode 100644
index 8e8b36c5..00000000
--- a/doc/source/devel/api/sardana/macroserver/msmanager.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.macroserver.msmanager
-
-:mod:`~sardana.macroserver.msmanager`
-=======================================
-
-.. automodule:: sardana.macroserver.msmanager
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MacroServerManager`
-
-MacroServerManager
-------------------
-
-.. inheritance-diagram:: MacroServerManager
- :parts: 1
-
-.. autoclass:: MacroServerManager
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/msmetamacro.rst b/doc/source/devel/api/sardana/macroserver/msmetamacro.rst
deleted file mode 100644
index f625a3e1..00000000
--- a/doc/source/devel/api/sardana/macroserver/msmetamacro.rst
+++ /dev/null
@@ -1,45 +0,0 @@
-.. currentmodule:: sardana.macroserver.msmetamacro
-
-:mod:`~sardana.macroserver.msmetamacro`
-===========================================
-
-.. automodule:: sardana.macroserver.msmetamacro
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`MacroLibrary`
- * :class:`MacroClass`
- * :class:`MacroFunction`
-
-MacroLibrary
---------------------
-
-.. autoclass:: MacroLibrary
- :show-inheritance:
- :members:
-
-Parameterizable
---------------------
-
-.. autoclass:: Parameterizable
- :show-inheritance:
- :members:
-
-MacroClass
---------------------
-
-.. autoclass:: MacroClass
- :show-inheritance:
- :members:
-
-MacroFunction
---------------------
-
-.. autoclass:: MacroFunction
- :show-inheritance:
- :members:
diff --git a/doc/source/devel/api/sardana/macroserver/msparameter.rst b/doc/source/devel/api/sardana/macroserver/msparameter.rst
deleted file mode 100644
index 46ee76cf..00000000
--- a/doc/source/devel/api/sardana/macroserver/msparameter.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-.. currentmodule:: sardana.macroserver.msparameter
-
-:mod:`~sardana.macroserver.msparameter`
-===========================================
-
-.. automodule:: sardana.macroserver.msparameter
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`ParamType`
-
-ParamType
------------
-
-.. autoclass:: ParamType
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/macroserver/mstypemanager.rst b/doc/source/devel/api/sardana/macroserver/mstypemanager.rst
deleted file mode 100644
index a3b41421..00000000
--- a/doc/source/devel/api/sardana/macroserver/mstypemanager.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-.. currentmodule:: sardana.macroserver.mstypemanager
-
-:mod:`~sardana.macroserver.mstypemanager`
-===========================================
-
-.. automodule:: sardana.macroserver.mstypemanager
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`TypeManager`
-
-TypeManager
---------------------
-
-.. autoclass:: TypeManager
- :show-inheritance:
diff --git a/doc/source/devel/api/sardana/pool.rst b/doc/source/devel/api/sardana/pool.rst
deleted file mode 100644
index 6465378d..00000000
--- a/doc/source/devel/api/sardana/pool.rst
+++ /dev/null
@@ -1,62 +0,0 @@
-.. currentmodule:: sardana.pool
-
-:mod:`~sardana.pool`
-====================
-
-.. automodule:: sardana.pool
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- controller <pool/controller>
- pool <pool/pool>
- poolacquisition <pool/poolacquisition>
- poolaction <pool/poolaction>
- poolbasechannel <pool/poolbasechannel>
- poolbaseobject <pool/poolbaseobject>
- poolcontainer <pool/poolcontainer>
- poolcontroller <pool/poolcontroller>
- poolcontrollermanager <pool/poolcontrollermanager>
- poolcountertimer <pool/poolcountertimer>
- pooldefs <pool/pooldefs>
- poolelement <pool/poolelement>
- poolexception <pool/poolexception>
- poolexternal <pool/poolexternal>
- poolgroupelement <pool/poolgroupelement>
- poolinstrument <pool/poolinstrument>
- poolioregister <pool/poolioregister>
- poolmeasurementgroup <pool/poolmeasurementgroup>
- poolmetacontroller <pool/poolmetacontroller>
- poolmonitor <pool/poolmonitor>
- poolmotion <pool/poolmotion>
- poolmotor <pool/poolmotor>
- poolmotorgroup <pool/poolmotorgroup>
- poolmoveable <pool/poolmoveable>
- poolobject <pool/poolobject>
- poolonedexpchannel <pool/poolonedexpchannel>
- poolpseudocounter <pool/poolpseudocounter>
- poolpseudomotor <pool/poolpseudomotor>
- pooltwodexpchannel <pool/pooltwodexpchannel>
- poolutil <pool/poolutil>
- poolzerodexpchannel <pool/poolzerodexpchannel>
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :data:`~sardana.pool.controller.Controller`
- * :data:`~sardana.pool.controller.MotorController`
- * :data:`~sardana.pool.controller.CounterTimerController`
- * :data:`~sardana.pool.controller.PseudoMotorController`
-
-.. rubric:: Constants
-
-.. hlist::
- :columns: 3
-
- * :data:`~sardana.pool.pooldefs.ControllerAPI`
-
-
diff --git a/doc/source/devel/api/sardana/pool/controller.rst b/doc/source/devel/api/sardana/pool/controller.rst
deleted file mode 100644
index a5d1ead4..00000000
--- a/doc/source/devel/api/sardana/pool/controller.rst
+++ /dev/null
@@ -1,215 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-:mod:`~sardana.pool.controller`
-===============================
-
-.. automodule:: sardana.pool.controller
-
-.. rubric:: Constants
-
-.. autodata:: Type
-.. autodata:: Access
-.. autodata:: Description
-.. autodata:: DefaultValue
-.. autodata:: FGet
-.. autodata:: FSet
-.. autodata:: Memorize
-.. autodata:: Memorized
-.. autodata:: MemorizedNoInit
-.. autodata:: NotMemorized
-.. autodata:: MaxDimSize
-
-.. rubric:: Interfaces
-
-.. hlist::
- :columns: 3
-
- * :class:`Readable`
- * :class:`Startable`
- * :class:`Stopable`
- * :class:`Loadable`
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Controller`
- * :class:`PseudoController`
- * :class:`MotorController`
- * :class:`PseudoMotorController`
- * :class:`CounterTimerController`
- * :class:`ZeroDController`
- * :class:`OneDController`
- * :class:`TwoDController`
- * :class:`PseudoCounterController`
- * :class:`IORegisterController`
-
-
-Readable interface
-------------------
-
-.. inheritance-diagram:: Readable
- :parts: 1
-
-.. autoclass:: Readable
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Startable interface
--------------------
-
-.. inheritance-diagram:: Startable
- :parts: 1
-
-.. autoclass:: Startable
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Stopable interface
--------------------
-
-.. inheritance-diagram:: Stopable
- :parts: 1
-
-.. autoclass:: Stopable
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Loadable interface
--------------------
-
-.. inheritance-diagram:: Loadable
- :parts: 1
-
-.. autoclass:: Loadable
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Abstract Controller
---------------------
-
-.. inheritance-diagram:: Controller
- :parts: 1
-
-.. autoclass:: Controller
- :private-members: __init__
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Abstract Pseudo Controller
------------------------------
-
-.. inheritance-diagram:: PseudoController
- :parts: 1
-
-.. autoclass:: PseudoController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Motor Controller API
----------------------
-
-.. inheritance-diagram:: MotorController
- :parts: 1
-
-.. autoclass:: MotorController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Pseudo Motor Controller API
------------------------------
-
-.. inheritance-diagram:: PseudoMotorController
- :parts: 1
-
-.. autoclass:: PseudoMotorController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Counter Timer Controller API
-----------------------------
-
-.. inheritance-diagram:: CounterTimerController
- :parts: 1
-
-.. autoclass:: CounterTimerController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-0D Controller API
-----------------------------
-
-.. inheritance-diagram:: ZeroDController
- :parts: 1
-
-.. autoclass:: ZeroDController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-1D Controller API
-----------------------------
-
-.. inheritance-diagram:: OneDController
- :parts: 1
-
-.. autoclass:: OneDController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-2D Controller API
-----------------------------
-
-.. inheritance-diagram:: TwoDController
- :parts: 1
-
-.. autoclass:: TwoDController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-Pseudo Counter Controller API
------------------------------
-
-.. inheritance-diagram:: PseudoCounterController
- :parts: 1
-
-.. autoclass:: PseudoCounterController
- :show-inheritance:
- :members:
- :undoc-members:
-
-
-IO Register Controller API
-----------------------------
-
-.. inheritance-diagram:: IORegisterController
- :parts: 1
-
-.. autoclass:: IORegisterController
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/pool.rst b/doc/source/devel/api/sardana/pool/pool.rst
deleted file mode 100644
index 443ce5bf..00000000
--- a/doc/source/devel/api/sardana/pool/pool.rst
+++ /dev/null
@@ -1,31 +0,0 @@
-.. currentmodule:: sardana.pool.pool
-
-:mod:`~sardana.pool.pool`
-=========================
-
-.. automodule:: sardana.pool.pool
-
-.. rubric:: Functions
-
-.. hlist::
- :columns: 3
-
- * :func:`get_thread_pool`
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Pool`
-
-Pool
------
-
-.. inheritance-diagram:: Pool
- :parts: 1
-
-.. autoclass:: Pool
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolacquisition.rst b/doc/source/devel/api/sardana/pool/poolacquisition.rst
deleted file mode 100644
index ea717d25..00000000
--- a/doc/source/devel/api/sardana/pool/poolacquisition.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolacquisition
-
-:mod:`~sardana.pool.poolacquisition`
-======================================
-
-.. automodule:: sardana.pool.poolacquisition
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolCTAcquisition`
-
-PoolCTAcquisition
--------------------
-
-.. inheritance-diagram:: PoolCTAcquisition
- :parts: 1
-
-.. autoclass:: PoolCTAcquisition
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolaction.rst b/doc/source/devel/api/sardana/pool/poolaction.rst
deleted file mode 100644
index 593c6e44..00000000
--- a/doc/source/devel/api/sardana/pool/poolaction.rst
+++ /dev/null
@@ -1,69 +0,0 @@
-.. currentmodule:: sardana.pool.poolaction
-
-:mod:`~sardana.pool.poolaction`
-======================================
-
-.. automodule:: sardana.pool.poolaction
-
-.. rubric:: Functions
-
-.. hlist::
- :columns: 3
-
- * :func:`get_thread_pool`
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolAction`
- * :class:`OperationInfo`
- * :class:`PoolActionItem`
- * :class:`ActionContext`
-
-.. autofunction:: get_thread_pool
-
-PoolAction
--------------------
-
-.. inheritance-diagram:: PoolAction
- :parts: 1
-
-.. autoclass:: PoolAction
- :show-inheritance:
- :members:
- :undoc-members:
-
-OperationInfo
--------------------
-
-.. inheritance-diagram:: OperationInfo
- :parts: 1
-
-.. autoclass:: OperationInfo
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolActionItem
--------------------
-
-.. inheritance-diagram:: PoolActionItem
- :parts: 1
-
-.. autoclass:: PoolActionItem
- :show-inheritance:
- :members:
- :undoc-members:
-
-ActionContext
--------------------
-
-.. inheritance-diagram:: ActionContext
- :parts: 1
-
-.. autoclass:: ActionContext
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolbasechannel.rst b/doc/source/devel/api/sardana/pool/poolbasechannel.rst
deleted file mode 100644
index e8563fb4..00000000
--- a/doc/source/devel/api/sardana/pool/poolbasechannel.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolbasechannel
-
-:mod:`~sardana.pool.poolbasechannel`
-======================================
-
-.. automodule:: sardana.pool.poolbasechannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolBaseChannel`
-
-PoolBaseChannel
--------------------
-
-.. inheritance-diagram:: PoolBaseChannel
- :parts: 1
-
-.. autoclass:: PoolBaseChannel
- :show-inheritance:
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/pool/poolbaseobject.rst b/doc/source/devel/api/sardana/pool/poolbaseobject.rst
deleted file mode 100644
index 0400b014..00000000
--- a/doc/source/devel/api/sardana/pool/poolbaseobject.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolbaseobject
-
-:mod:`~sardana.pool.poolbaseobject`
-======================================
-
-.. automodule:: sardana.pool.poolbaseobject
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolBaseObject`
-
-PoolBaseObject
--------------------
-
-.. inheritance-diagram:: PoolBaseObject
- :parts: 1
-
-.. autoclass:: PoolBaseObject
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolcontainer.rst b/doc/source/devel/api/sardana/pool/poolcontainer.rst
deleted file mode 100644
index a438b249..00000000
--- a/doc/source/devel/api/sardana/pool/poolcontainer.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolcontainer
-
-:mod:`~sardana.pool.poolcontainer`
-======================================
-
-.. automodule:: sardana.pool.poolcontainer
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolContainer`
-
-PoolContainer
--------------------
-
-.. inheritance-diagram:: PoolContainer
- :parts: 1
-
-.. autoclass:: PoolContainer
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolcontroller.rst b/doc/source/devel/api/sardana/pool/poolcontroller.rst
deleted file mode 100644
index b19ad4e6..00000000
--- a/doc/source/devel/api/sardana/pool/poolcontroller.rst
+++ /dev/null
@@ -1,49 +0,0 @@
-.. currentmodule:: sardana.pool.poolcontroller
-
-:mod:`~sardana.pool.poolcontroller`
-======================================
-
-.. automodule:: sardana.pool.poolcontroller
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolController`
- * :class:`PoolPseudoMotorController`
- * :class:`PoolPseudoCounterController`
-
-PoolController
--------------------
-
-.. inheritance-diagram:: PoolController
- :parts: 1
-
-.. autoclass:: PoolController
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolPseudoMotorController
---------------------------
-
-.. inheritance-diagram:: PoolPseudoMotorController
- :parts: 1
-
-.. autoclass:: PoolPseudoMotorController
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolPseudoCounterController
-----------------------------
-
-.. inheritance-diagram:: PoolPseudoCounterController
- :parts: 1
-
-.. autoclass:: PoolPseudoCounterController
- :show-inheritance:
- :members:
- :undoc-members:
- \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/pool/poolcontrollermanager.rst b/doc/source/devel/api/sardana/pool/poolcontrollermanager.rst
deleted file mode 100644
index 89e8fa63..00000000
--- a/doc/source/devel/api/sardana/pool/poolcontrollermanager.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolcontrollermanager
-
-:mod:`~sardana.pool.poolcontrollermanager`
-==========================================
-
-.. automodule:: sardana.pool.poolcontrollermanager
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`ControllerManager`
-
-ControllerManager
--------------------
-
-.. inheritance-diagram:: ControllerManager
- :parts: 1
-
-.. autoclass:: ControllerManager
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolcountertimer.rst b/doc/source/devel/api/sardana/pool/poolcountertimer.rst
deleted file mode 100644
index 4d88135c..00000000
--- a/doc/source/devel/api/sardana/pool/poolcountertimer.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolcountertimer
-
-:mod:`~sardana.pool.poolcountertimer`
-==========================================
-
-.. automodule:: sardana.pool.poolcountertimer
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolCounterTimer`
-
-PoolCounterTimer
--------------------
-
-.. inheritance-diagram:: PoolCounterTimer
- :parts: 1
-
-.. autoclass:: PoolCounterTimer
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/pooldefs.rst b/doc/source/devel/api/sardana/pool/pooldefs.rst
deleted file mode 100644
index bb375019..00000000
--- a/doc/source/devel/api/sardana/pool/pooldefs.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-.. currentmodule:: sardana.pool.pooldefs
-
-:mod:`~sardana.pool.pooldefs`
-=============================
-
-.. automodule:: sardana.pool.pooldefs
-
-.. rubric:: Constants
-
-.. autodata:: sardana.pool.pooldefs.ControllerAPI
-
-
-
diff --git a/doc/source/devel/api/sardana/pool/poolelement.rst b/doc/source/devel/api/sardana/pool/poolelement.rst
deleted file mode 100644
index 84f88918..00000000
--- a/doc/source/devel/api/sardana/pool/poolelement.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-.. currentmodule:: sardana.pool.poolelement
-
-:mod:`~sardana.pool.poolelement`
-======================================
-
-.. automodule:: sardana.pool.poolelement
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolBaseElement`
- * :class:`PoolElement`
-
-PoolBaseElement
--------------------
-
-.. inheritance-diagram:: PoolBaseElement
- :parts: 1
-
-.. autoclass:: PoolBaseElement
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolElement
---------------------------
-
-.. inheritance-diagram:: PoolElement
- :parts: 1
-
-.. autoclass:: PoolElement
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolexception.rst b/doc/source/devel/api/sardana/pool/poolexception.rst
deleted file mode 100644
index d786d89a..00000000
--- a/doc/source/devel/api/sardana/pool/poolexception.rst
+++ /dev/null
@@ -1,50 +0,0 @@
-.. currentmodule:: sardana.pool.poolexception
-
-:mod:`~sardana.pool.poolexception`
-=======================================
-
-.. automodule:: sardana.pool.poolexception
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :exc:`PoolException`
- * :exc:`UnknownController`
- * :exc:`UnknownControllerLibrary`
-
-
-PoolException
----------------
-
-.. inheritance-diagram:: PoolException
- :parts: 1
-
-.. autoexception:: PoolException
- :inherited-members:
- :members:
- :undoc-members:
-
-UnknownController
---------------------
-
-.. inheritance-diagram:: UnknownController
- :parts: 1
-
-.. autoexception:: UnknownController
- :inherited-members:
- :members:
- :undoc-members:
-
-UnknownControllerLibrary
--------------------------
-
-.. inheritance-diagram:: UnknownControllerLibrary
- :parts: 1
-
-.. autoexception:: UnknownControllerLibrary
- :inherited-members:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolexternal.rst b/doc/source/devel/api/sardana/pool/poolexternal.rst
deleted file mode 100644
index c4e08df0..00000000
--- a/doc/source/devel/api/sardana/pool/poolexternal.rst
+++ /dev/null
@@ -1,45 +0,0 @@
-.. currentmodule:: sardana.pool.poolexternal
-
-:mod:`~sardana.pool.poolexternal`
-======================================
-
-.. automodule:: sardana.pool.poolexternal
-
-.. rubric:: Functions
-
-.. hlist::
- :columns: 3
-
- * :func:`PoolExternalObject`
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolBaseExternalObject`
- * :class:`PoolTangoObject`
-
-.. autofunction:: PoolExternalObject
-
-PoolBaseExternalObject
------------------------
-
-.. inheritance-diagram:: PoolBaseExternalObject
- :parts: 1
-
-.. autoclass:: PoolBaseExternalObject
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolTangoObject
---------------------------
-
-.. inheritance-diagram:: PoolTangoObject
- :parts: 1
-
-.. autoclass:: PoolTangoObject
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolgroupelement.rst b/doc/source/devel/api/sardana/pool/poolgroupelement.rst
deleted file mode 100644
index babdc24a..00000000
--- a/doc/source/devel/api/sardana/pool/poolgroupelement.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-.. currentmodule:: sardana.pool.poolgroupelement
-
-:mod:`~sardana.pool.poolgroupelement`
-======================================
-
-.. automodule:: sardana.pool.poolgroupelement
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolBaseGroup`
- * :class:`PoolGroupElement`
-
-PoolBaseGroup
--------------------
-
-.. inheritance-diagram:: PoolBaseGroup
- :parts: 1
-
-.. autoclass:: PoolBaseGroup
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolGroupElement
---------------------------
-
-.. inheritance-diagram:: PoolGroupElement
- :parts: 1
-
-.. autoclass:: PoolGroupElement
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolinstrument.rst b/doc/source/devel/api/sardana/pool/poolinstrument.rst
deleted file mode 100644
index c257fd6d..00000000
--- a/doc/source/devel/api/sardana/pool/poolinstrument.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolinstrument
-
-:mod:`~sardana.pool.poolinstrument`
-======================================
-
-.. automodule:: sardana.pool.poolinstrument
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolInstrument`
-
-
-PoolInstrument
--------------------
-
-.. inheritance-diagram:: PoolInstrument
- :parts: 1
-
-.. autoclass:: PoolInstrument
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolioregister.rst b/doc/source/devel/api/sardana/pool/poolioregister.rst
deleted file mode 100644
index 4010608e..00000000
--- a/doc/source/devel/api/sardana/pool/poolioregister.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolioregister
-
-:mod:`~sardana.pool.poolioregister`
-==========================================
-
-.. automodule:: sardana.pool.poolioregister
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolIORegister`
-
-PoolIORegister
--------------------
-
-.. inheritance-diagram:: PoolIORegister
- :parts: 1
-
-.. autoclass:: PoolIORegister
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolmeasurementgroup.rst b/doc/source/devel/api/sardana/pool/poolmeasurementgroup.rst
deleted file mode 100644
index 7f5c2ed0..00000000
--- a/doc/source/devel/api/sardana/pool/poolmeasurementgroup.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolmeasurementgroup
-
-:mod:`~sardana.pool.poolmeasurementgroup`
-=========================================
-
-.. automodule:: sardana.pool.poolmeasurementgroup
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolMeasurementGroup`
-
-
-PoolInstrument
---------------
-
-.. inheritance-diagram:: PoolMeasurementGroup
- :parts: 1
-
-.. autoclass:: PoolMeasurementGroup
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolmetacontroller.rst b/doc/source/devel/api/sardana/pool/poolmetacontroller.rst
deleted file mode 100644
index b3011ad5..00000000
--- a/doc/source/devel/api/sardana/pool/poolmetacontroller.rst
+++ /dev/null
@@ -1,71 +0,0 @@
-.. currentmodule:: sardana.pool.poolmetacontroller
-
-:mod:`~sardana.pool.poolmetacontroller`
-=======================================
-
-.. automodule:: sardana.pool.poolmetacontroller
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`DataInfo`
- * :class:`TypeData`
- * :class:`ControllerLibrary`
- * :class:`ControllerClass`
-
-DataInfo
--------------------
-
-.. inheritance-diagram:: DataInfo
- :parts: 1
-
-.. autoclass:: DataInfo
- :show-inheritance:
- :members:
- :undoc-members:
-
-TypeData
--------------------
-
-.. inheritance-diagram:: TypeData
- :parts: 1
-
-.. autoclass:: TypeData
- :show-inheritance:
- :members:
- :undoc-members:
-
-ControllerLib
--------------------
-
-.. inheritance-diagram:: ControllerLibrary
- :parts: 1
-
-.. autoclass:: ControllerLibrary
- :show-inheritance:
- :members:
- :undoc-members:
-
-ControllerClass
--------------------
-
-.. inheritance-diagram:: ControllerClass
- :parts: 1
-
-.. autoclass:: ControllerClass
- :show-inheritance:
- :members:
- :undoc-members:
-
-.. rubric:: Constants
-
-.. autodata:: CONTROLLER_TEMPLATE
-
-.. autodata:: CTRL_TYPE_MAP
-
-.. autodata:: TYPE_MAP
-
-.. autodata:: TYPE_MAP_OBJ
-
diff --git a/doc/source/devel/api/sardana/pool/poolmonitor.rst b/doc/source/devel/api/sardana/pool/poolmonitor.rst
deleted file mode 100644
index 7e83b4e9..00000000
--- a/doc/source/devel/api/sardana/pool/poolmonitor.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolmonitor
-
-:mod:`~sardana.pool.poolmonitor`
-=========================================
-
-.. automodule:: sardana.pool.poolmonitor
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolMonitor`
-
-
-PoolMonitor
--------------------
-
-.. inheritance-diagram:: PoolMonitor
- :parts: 1
-
-.. autoclass:: PoolMonitor
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolmotion.rst b/doc/source/devel/api/sardana/pool/poolmotion.rst
deleted file mode 100644
index 91702042..00000000
--- a/doc/source/devel/api/sardana/pool/poolmotion.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-.. currentmodule:: sardana.pool.poolmotion
-
-:mod:`~sardana.pool.poolmotion`
-=========================================
-
-.. automodule:: sardana.pool.poolmotion
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolMotionItem`
- * :class:`PoolMotion`
-
-
-PoolMotionItem
--------------------
-
-.. inheritance-diagram:: PoolMotionItem
- :parts: 1
-
-.. autoclass:: PoolMotionItem
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolMotion
--------------------
-
-.. inheritance-diagram:: PoolMotion
- :parts: 1
-
-.. autoclass:: PoolMotion
- :show-inheritance:
- :members:
- :undoc-members:
-
-.. rubric:: Enumerations
-
-.. autodata:: sardana.pool.poolmotion.MotionState \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/pool/poolmotor.rst b/doc/source/devel/api/sardana/pool/poolmotor.rst
deleted file mode 100644
index 71d616fe..00000000
--- a/doc/source/devel/api/sardana/pool/poolmotor.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolmotor
-
-:mod:`~sardana.pool.poolmotor`
-=========================================
-
-.. automodule:: sardana.pool.poolmotor
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolMotor`
-
-
-PoolMotor
--------------------
-
-.. inheritance-diagram:: PoolMotor
- :parts: 1
-
-.. autoclass:: PoolMotor
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolmotorgroup.rst b/doc/source/devel/api/sardana/pool/poolmotorgroup.rst
deleted file mode 100644
index 11859d73..00000000
--- a/doc/source/devel/api/sardana/pool/poolmotorgroup.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolmotorgroup
-
-:mod:`~sardana.pool.poolmotorgroup`
-=========================================
-
-.. automodule:: sardana.pool.poolmotorgroup
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolMotorGroup`
-
-
-PoolMotorGroup
--------------------
-
-.. inheritance-diagram:: PoolMotorGroup
- :parts: 1
-
-.. autoclass:: PoolMotorGroup
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolmoveable.rst b/doc/source/devel/api/sardana/pool/poolmoveable.rst
deleted file mode 100644
index 1883e881..00000000
--- a/doc/source/devel/api/sardana/pool/poolmoveable.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolmoveable
-
-:mod:`~sardana.pool.poolmoveable`
-=========================================
-
-.. automodule:: sardana.pool.poolmoveable
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolMoveable`
-
-
-PoolMoveable
--------------------
-
-.. inheritance-diagram:: PoolMoveable
- :parts: 1
-
-.. autoclass:: PoolMoveable
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolobject.rst b/doc/source/devel/api/sardana/pool/poolobject.rst
deleted file mode 100644
index 22194fd8..00000000
--- a/doc/source/devel/api/sardana/pool/poolobject.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.pool.poolobject
-
-:mod:`~sardana.pool.poolobject`
-======================================
-
-.. automodule:: sardana.pool.poolobject
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolObject`
-
-PoolObject
--------------------
-
-.. inheritance-diagram:: PoolObject
- :parts: 1
-
-.. autoclass:: PoolObject
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolonedexpchannel.rst b/doc/source/devel/api/sardana/pool/poolonedexpchannel.rst
deleted file mode 100644
index 6492edaa..00000000
--- a/doc/source/devel/api/sardana/pool/poolonedexpchannel.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolonedexpchannel
-
-:mod:`~sardana.pool.poolonedexpchannel`
-=========================================
-
-.. automodule:: sardana.pool.poolonedexpchannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Pool1DExpChannel`
-
-
-Pool1DExpChannel
--------------------
-
-.. inheritance-diagram:: Pool1DExpChannel
- :parts: 1
-
-.. autoclass:: Pool1DExpChannel
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolpseudocounter.rst b/doc/source/devel/api/sardana/pool/poolpseudocounter.rst
deleted file mode 100644
index 496e4248..00000000
--- a/doc/source/devel/api/sardana/pool/poolpseudocounter.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolpseudocounter
-
-:mod:`~sardana.pool.poolpseudocounter`
-=========================================
-
-.. automodule:: sardana.pool.poolpseudocounter
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolPseudoCounter`
-
-
-PoolPseudoCounter
--------------------
-
-.. inheritance-diagram:: PoolPseudoCounter
- :parts: 1
-
-.. autoclass:: PoolPseudoCounter
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/poolpseudomotor.rst b/doc/source/devel/api/sardana/pool/poolpseudomotor.rst
deleted file mode 100644
index e01aa83d..00000000
--- a/doc/source/devel/api/sardana/pool/poolpseudomotor.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.pool.poolpseudomotor
-
-:mod:`~sardana.pool.poolpseudomotor`
-======================================
-
-.. automodule:: sardana.pool.poolpseudomotor
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolPseudoMotor`
-
-
-PoolPseudoMotor
-----------------
-
-.. inheritance-diagram:: PoolPseudoMotor
- :parts: 1
-
-.. autoclass:: PoolPseudoMotor
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/pool/pooltwodexpchannel.rst b/doc/source/devel/api/sardana/pool/pooltwodexpchannel.rst
deleted file mode 100644
index 32b342db..00000000
--- a/doc/source/devel/api/sardana/pool/pooltwodexpchannel.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. currentmodule:: sardana.pool.pooltwodexpchannel
-
-:mod:`~sardana.pool.pooltwodexpchannel`
-=========================================
-
-.. automodule:: sardana.pool.pooltwodexpchannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Pool2DExpChannel`
-
-
-Pool2DExpChannel
--------------------
-
-.. inheritance-diagram:: Pool2DExpChannel
- :parts: 1
-
-.. autoclass:: Pool2DExpChannel
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/pool/poolutil.rst b/doc/source/devel/api/sardana/pool/poolutil.rst
deleted file mode 100644
index 8c9ddbd2..00000000
--- a/doc/source/devel/api/sardana/pool/poolutil.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-.. currentmodule:: sardana.pool.poolutil
-
-:mod:`~sardana.pool.poolutil`
-=========================================
-
-.. automodule:: sardana.pool.poolutil
-
-.. rubric:: Classes \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/pool/poolzerodexpchannel.rst b/doc/source/devel/api/sardana/pool/poolzerodexpchannel.rst
deleted file mode 100644
index 6883be5a..00000000
--- a/doc/source/devel/api/sardana/pool/poolzerodexpchannel.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. currentmodule:: sardana.pool.poolzerodexpchannel
-
-:mod:`~sardana.pool.poolzerodexpchannel`
-=========================================
-
-.. automodule:: sardana.pool.poolzerodexpchannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Pool0DExpChannel`
-
-
-Pool0DExpChannel
--------------------
-
-.. inheritance-diagram:: Pool0DExpChannel
- :parts: 1
-
-.. autoclass:: Pool0DExpChannel
- :show-inheritance:
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/sardana.rst b/doc/source/devel/api/sardana/sardana.rst
deleted file mode 100644
index a745f416..00000000
--- a/doc/source/devel/api/sardana/sardana.rst
+++ /dev/null
@@ -1,30 +0,0 @@
-.. currentmodule:: sardana
-
-:mod:`sardana`
-==============
-
-.. automodule:: sardana
-
-.. rubric:: Packages
-
-.. toctree::
- :maxdepth: 1
-
- pool <pool>
- macroserver <macroserver>
- tango <tango>
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- sardanadefs <sardanadefs>
- sardanabase <sardanabase>
- sardanacontainer <sardanacontainer>
- sardanaevent <sardanaevent>
- sardanamodulemanager <sardanamodulemanager>
- sardanameta <sardanameta>
- sardanamanager <sardanamanager>
- sardanaattribute <sardanaattribute>
- sardanavalue <sardanavalue>
diff --git a/doc/source/devel/api/sardana/sardanaattribute.rst b/doc/source/devel/api/sardana/sardanaattribute.rst
deleted file mode 100644
index f48aa5ea..00000000
--- a/doc/source/devel/api/sardana/sardanaattribute.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-.. currentmodule:: sardana.sardanaattribute
-
-:mod:`~sardana.pool.sardanaattribute`
-=====================================
-
-.. automodule:: sardana.sardanaattribute
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaAttribute`
- * :class:`SardanaSoftwareAttribute`
- * :class:`ScalarNumberAttribute`
- * :class:`SardanaAttributeConfiguration`
-
-SardanaAttribute
-----------------
-
-.. inheritance-diagram:: SardanaAttribute
- :parts: 1
-
-.. autoclass:: SardanaAttribute
- :inherited-members:
- :members:
- :undoc-members:
-
-SardanaSoftwareAttribute
-------------------------
-
-.. inheritance-diagram:: SardanaSoftwareAttribute
- :parts: 1
-
-.. autoclass:: SardanaSoftwareAttribute
- :inherited-members:
- :members:
- :undoc-members:
-
-ScalarNumberAttribute
----------------------
-
-.. inheritance-diagram:: ScalarNumberAttribute
- :parts: 1
-
-.. autoclass:: ScalarNumberAttribute
- :inherited-members:
- :members:
- :undoc-members:
-
-SardanaAttributeConfiguration
------------------------------
-
-.. inheritance-diagram:: SardanaAttributeConfiguration
- :parts: 1
-
-.. autoclass:: SardanaAttributeConfiguration
- :inherited-members:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/sardanabase.rst b/doc/source/devel/api/sardana/sardanabase.rst
deleted file mode 100644
index 3343441f..00000000
--- a/doc/source/devel/api/sardana/sardanabase.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-.. currentmodule:: sardana.sardanabase
-
-:mod:`~sardana.pool.sardanabase`
-=====================================
-
-.. automodule:: sardana.sardanabase
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaBaseObject`
- * :class:`SardanaObjectID`
-
-SardanaBaseObject
-------------------
-
-.. inheritance-diagram:: SardanaBaseObject
- :parts: 1
-
-.. autoclass:: SardanaBaseObject
- :inherited-members:
- :members:
- :undoc-members:
-
-SardanaObjectID
-------------------
-
-.. inheritance-diagram:: SardanaObjectID
- :parts: 1
-
-.. autoclass:: SardanaObjectID
- :inherited-members:
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/sardanacontainer.rst b/doc/source/devel/api/sardana/sardanacontainer.rst
deleted file mode 100644
index 73320a4b..00000000
--- a/doc/source/devel/api/sardana/sardanacontainer.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.sardanacontainer
-
-:mod:`~sardana.pool.sardanacontainer`
-=====================================
-
-.. automodule:: sardana.sardanacontainer
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaContainer`
-
-
-SardanaContainer
-----------------
-
-.. inheritance-diagram:: SardanaContainer
- :parts: 1
-
-.. autoclass:: SardanaContainer
- :inherited-members:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/sardanadefs.rst b/doc/source/devel/api/sardana/sardanadefs.rst
deleted file mode 100644
index c188c70a..00000000
--- a/doc/source/devel/api/sardana/sardanadefs.rst
+++ /dev/null
@@ -1,63 +0,0 @@
-.. currentmodule:: sardana.sardanadefs
-
-:mod:`~sardana.sardanadefs`
-=============================
-
-.. automodule:: sardana.sardanadefs
-
-.. rubric:: Constants
-
-.. autodata:: sardana.sardanadefs.EpsilonError
-
-.. autodata:: sardana.sardanadefs.InvalidId
-
-.. autodata:: sardana.sardanadefs.InvalidAxis
-
-.. autodata:: sardana.sardanadefs.TYPE_ELEMENTS
-
-.. autodata:: sardana.sardanadefs.TYPE_GROUP_ELEMENTS
-
-.. autodata:: sardana.sardanadefs.TYPE_MOVEABLE_ELEMENTS
-
-.. autodata:: sardana.sardanadefs.TYPE_PHYSICAL_ELEMENTS
-
-.. autodata:: sardana.sardanadefs.TYPE_ACQUIRABLE_ELEMENTS
-
-.. autodata:: sardana.sardanadefs.TYPE_PSEUDO_ELEMENTS
-
-.. autodata:: sardana.sardanadefs.SardanaServer
-
-.. rubric:: Enumerations
-
-.. autodata:: sardana.sardanadefs.ServerRunMode
-
-.. autodata:: sardana.sardanadefs.State
-
-.. autodata:: sardana.sardanadefs.DataType
-
-.. autodata:: sardana.sardanadefs.DataFormat
-
-.. autodata:: sardana.sardanadefs.DataAccess
-
-.. autodata:: sardana.sardanadefs.ElementType
-
-.. autodata:: sardana.sardanadefs.Interface
-
-.. autodata:: sardana.sardanadefs.Interfaces
-
-.. autodata:: sardana.sardanadefs.InterfacesExpanded
-
-.. autodata:: sardana.sardanadefs.INTERFACES
-
-.. autodata:: sardana.sardanadefs.INTERFACES_EXPANDED
-
-.. rubric:: Functions
-
-.. autofunction:: sardana.sardanadefs.from_dtype_str
-
-.. autofunction:: sardana.sardanadefs.from_access_str
-
-.. autofunction:: sardana.sardanadefs.to_dtype_dformat
-
-.. autofunction:: sardana.sardanadefs.to_daccess
-
diff --git a/doc/source/devel/api/sardana/sardanaevent.rst b/doc/source/devel/api/sardana/sardanaevent.rst
deleted file mode 100644
index 830a0397..00000000
--- a/doc/source/devel/api/sardana/sardanaevent.rst
+++ /dev/null
@@ -1,49 +0,0 @@
-.. currentmodule:: sardana.sardanaevent
-
-:mod:`~sardana.pool.sardanaevent`
-====================================
-
-.. automodule:: sardana.sardanaevent
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`EventGenerator`
- * :class:`EventReceiver`
- * :class:`EventType`
-
-
-EventGenerator
----------------
-
-.. inheritance-diagram:: EventGenerator
- :parts: 1
-
-.. autoclass:: EventGenerator
- :inherited-members:
- :members:
- :undoc-members:
-
-EventReceiver
----------------
-
-.. inheritance-diagram:: EventReceiver
- :parts: 1
-
-.. autoclass:: EventReceiver
- :inherited-members:
- :members:
- :undoc-members:
-
-EventType
----------------
-
-.. inheritance-diagram:: EventType
- :parts: 1
-
-.. autoclass:: EventType
- :inherited-members:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/sardanamanager.rst b/doc/source/devel/api/sardana/sardanamanager.rst
deleted file mode 100644
index 1bc4f4f5..00000000
--- a/doc/source/devel/api/sardana/sardanamanager.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.sardanamanager
-
-:mod:`~sardana.pool.sardanamanager`
-=====================================
-
-.. automodule:: sardana.sardanamanager
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaElementManager`
-
-SardanaElementManager
-----------------------
-
-.. inheritance-diagram:: SardanaElementManager
- :parts: 1
-
-.. autoclass:: SardanaElementManager
- :inherited-members:
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/doc/source/devel/api/sardana/sardanameta.rst b/doc/source/devel/api/sardana/sardanameta.rst
deleted file mode 100644
index 38f2cc64..00000000
--- a/doc/source/devel/api/sardana/sardanameta.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-.. currentmodule:: sardana.sardanameta
-
-:mod:`~sardana.pool.sardanameta`
-====================================
-
-.. automodule:: sardana.sardanameta
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaLibrary`
- * :class:`SardanaClass`
-
-SardanaLibrary
----------------
-
-.. inheritance-diagram:: SardanaLibrary
- :parts: 1
-
-.. autoclass:: SardanaLibrary
- :inherited-members:
- :members:
- :undoc-members:
-
-SardanaClass
--------------
-
-.. inheritance-diagram:: SardanaClass
- :parts: 1
-
-.. autoclass:: SardanaClass
- :inherited-members:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/sardanamodulemanager.rst b/doc/source/devel/api/sardana/sardanamodulemanager.rst
deleted file mode 100644
index ca5e7314..00000000
--- a/doc/source/devel/api/sardana/sardanamodulemanager.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. currentmodule:: sardana.sardanamodulemanager
-
-:mod:`~sardana.pool.sardanamodulemanager`
-==========================================
-
-.. automodule:: sardana.sardanamodulemanager
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`ModuleManager`
-
-
-ModuleManager
----------------
-
-.. inheritance-diagram:: ModuleManager
- :parts: 1
-
-.. autoclass:: ModuleManager
- :inherited-members:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/sardanavalue.rst b/doc/source/devel/api/sardana/sardanavalue.rst
deleted file mode 100644
index 67f78afc..00000000
--- a/doc/source/devel/api/sardana/sardanavalue.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. currentmodule:: sardana.sardanavalue
-
-:mod:`~sardana.pool.sardanavalue`
-=================================
-
-.. automodule:: sardana.sardanavalue
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaValue`
-
-SardanaValue
-------------
-
-.. inheritance-diagram:: SardanaValue
- :parts: 1
-
-.. autoclass:: SardanaValue
- :inherited-members:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/tango.rst b/doc/source/devel/api/sardana/tango.rst
deleted file mode 100644
index d438555a..00000000
--- a/doc/source/devel/api/sardana/tango.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-.. currentmodule:: sardana.tango
-
-:mod:`~sardana.tango`
-============================
-
-.. automodule:: sardana.tango
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- core <tango/core>
- pool <tango/pool>
- macroserver <tango/macroserver>
diff --git a/doc/source/devel/api/sardana/tango/core.rst b/doc/source/devel/api/sardana/tango/core.rst
deleted file mode 100644
index 17e9cad4..00000000
--- a/doc/source/devel/api/sardana/tango/core.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-.. currentmodule:: sardana.tango.core
-
-:mod:`~sardana.tango.core`
-============================
-
-.. automodule:: sardana.tango.core
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- SardanaDevice <core/SardanaDevice>
-
diff --git a/doc/source/devel/api/sardana/tango/core/SardanaDevice.rst b/doc/source/devel/api/sardana/tango/core/SardanaDevice.rst
deleted file mode 100644
index 2b3ca472..00000000
--- a/doc/source/devel/api/sardana/tango/core/SardanaDevice.rst
+++ /dev/null
@@ -1,38 +0,0 @@
-.. currentmodule:: sardana.tango.core.SardanaDevice
-
-:mod:`~sardana.tango.core.SardanaDevice`
-==============================================
-
-.. automodule:: sardana.tango.core.SardanaDevice
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaDevice`
- * :class:`SardanaDeviceClass`
-
-
-SardanaDevice
---------------
-
-.. inheritance-diagram:: SardanaDevice
- :parts: 1
-
-.. autoclass:: SardanaDevice
- :show-inheritance:
- :members:
- :undoc-members:
-
-SardanaDeviceClass
--------------------
-
-.. inheritance-diagram:: SardanaDeviceClass
- :parts: 1
-
-.. autoclass:: SardanaDeviceClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/macroserver.rst b/doc/source/devel/api/sardana/tango/macroserver.rst
deleted file mode 100644
index bfeac408..00000000
--- a/doc/source/devel/api/sardana/tango/macroserver.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-.. currentmodule:: sardana.tango.macroserver
-
-:mod:`~sardana.tango.macroserver`
-=================================
-
-.. automodule:: sardana.tango.macroserver
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- MacroExecutor <macroserver/test/macroexecutor>
diff --git a/doc/source/devel/api/sardana/tango/macroserver/test/macroexecutor.rst b/doc/source/devel/api/sardana/tango/macroserver/test/macroexecutor.rst
deleted file mode 100644
index 90a66527..00000000
--- a/doc/source/devel/api/sardana/tango/macroserver/test/macroexecutor.rst
+++ /dev/null
@@ -1,75 +0,0 @@
-.. currentmodule:: sardana.tango.macroserver.test.macroexecutor
-
-:mod:`~sardana.tango.macroserver.test.macroexecutor`
-====================================================
-
-.. automodule:: sardana.tango.macroserver.test.macroexecutor
-
-.. rubric:: Functions
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`BaseMacroExecutor`
- * :class:`MacroExecutorFactory`
-
-
-TangoAttrCb
------------
-
-.. inheritance-diagram:: TangoAttrCb
- :parts: 1
-
-.. autoclass:: TangoAttrCb
- :members:
- :undoc-members:
-
-
-TangoResultCb
--------------
-
-.. inheritance-diagram:: TangoResultCb
- :parts: 1
-
-.. autoclass:: TangoResultCb
- :inherited-members:
- :members:
- :undoc-members:
-
-
-TangoLogCb
-----------
-
-.. inheritance-diagram:: TangoLogCb
- :parts: 1
-
-.. autoclass:: TangoLogCb
- :inherited-members:
- :members:
- :undoc-members:
-
-
-TangoStatusCb
--------------
-
-.. inheritance-diagram:: TangoStatusCb
- :parts: 1
-
-.. autoclass:: TangoStatusCb
- :inherited-members:
- :members:
- :undoc-members:
-
-
-TangoMacroExecutor
-------------------
-
-.. inheritance-diagram:: TangoMacroExecutor
- :parts: 1
-
-.. autoclass:: TangoMacroExecutor
- :inherited-members:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/tango/pool.rst b/doc/source/devel/api/sardana/tango/pool.rst
deleted file mode 100644
index 7b63e7ac..00000000
--- a/doc/source/devel/api/sardana/tango/pool.rst
+++ /dev/null
@@ -1,23 +0,0 @@
-.. currentmodule:: sardana.tango.pool
-
-:mod:`~sardana.tango.pool`
-==========================
-
-.. automodule:: sardana.tango.pool
-
-.. rubric:: Modules
-
-.. toctree::
- :maxdepth: 1
-
- Pool <pool/Pool>
- PoolDevice <pool/PoolDevice>
- Controller <pool/Controller>
- Motor <pool/Motor>
- I/O register <pool/IORegister>
- Counter/Timer <pool/CTExpChannel>
- 0D experiment channel <pool/ZeroDExpChannel>
- 1D experiment channel <pool/OneDExpChannel>
- 2D experiment channel <pool/TwoDExpChannel>
- PseudoMotor <pool/PseudoMotor>
- PseudoCounter <pool/PseudoCounter>
diff --git a/doc/source/devel/api/sardana/tango/pool/CTExpChannel.rst b/doc/source/devel/api/sardana/tango/pool/CTExpChannel.rst
deleted file mode 100644
index 27d92860..00000000
--- a/doc/source/devel/api/sardana/tango/pool/CTExpChannel.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.CTExpChannel
-
-:mod:`~sardana.tango.pool.CTExpChannel`
-=========================================
-
-.. automodule:: sardana.tango.pool.CTExpChannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`CTExpChannel`
- * :class:`CTExpChannelClass`
-
-CTExpChannel
--------------
-
-.. inheritance-diagram:: CTExpChannel
- :parts: 1
-
-.. autoclass:: CTExpChannel
- :show-inheritance:
- :members:
- :undoc-members:
-
-CTExpChannelClass
-------------------
-
-.. inheritance-diagram:: CTExpChannelClass
- :parts: 1
-
-.. autoclass:: CTExpChannelClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/Controller.rst b/doc/source/devel/api/sardana/tango/pool/Controller.rst
deleted file mode 100644
index 801a33a8..00000000
--- a/doc/source/devel/api/sardana/tango/pool/Controller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.Controller
-
-:mod:`~sardana.tango.pool.Controller`
-=====================================
-
-.. automodule:: sardana.tango.pool.Controller
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Controller`
- * :class:`ControllerClass`
-
-Controller
-----------
-
-.. inheritance-diagram:: Controller
- :parts: 1
-
-.. autoclass:: Controller
- :show-inheritance:
- :members:
- :undoc-members:
-
-ControllerClass
----------------
-
-.. inheritance-diagram:: ControllerClass
- :parts: 1
-
-.. autoclass:: ControllerClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/IORegister.rst b/doc/source/devel/api/sardana/tango/pool/IORegister.rst
deleted file mode 100644
index 9617cf2d..00000000
--- a/doc/source/devel/api/sardana/tango/pool/IORegister.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.IORegister
-
-:mod:`~sardana.tango.pool.IORegister`
-=========================================
-
-.. automodule:: sardana.tango.pool.IORegister
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`IORegister`
- * :class:`IORegisterClass`
-
-IORegister
---------------
-
-.. inheritance-diagram:: IORegister
- :parts: 1
-
-.. autoclass:: IORegister
- :show-inheritance:
- :members:
- :undoc-members:
-
-IORegisterClass
--------------------
-
-.. inheritance-diagram:: IORegisterClass
- :parts: 1
-
-.. autoclass:: IORegisterClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/Motor.rst b/doc/source/devel/api/sardana/tango/pool/Motor.rst
deleted file mode 100644
index b46d7577..00000000
--- a/doc/source/devel/api/sardana/tango/pool/Motor.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.Motor
-
-:mod:`~sardana.tango.pool.Motor`
-=========================================
-
-.. automodule:: sardana.tango.pool.Motor
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Motor`
- * :class:`MotorClass`
-
-Motor
--------
-
-.. inheritance-diagram:: Motor
- :parts: 1
-
-.. autoclass:: Motor
- :show-inheritance:
- :members:
- :undoc-members:
-
-MotorClass
------------
-
-.. inheritance-diagram:: MotorClass
- :parts: 1
-
-.. autoclass:: MotorClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/OneDExpChannel.rst b/doc/source/devel/api/sardana/tango/pool/OneDExpChannel.rst
deleted file mode 100644
index 22312120..00000000
--- a/doc/source/devel/api/sardana/tango/pool/OneDExpChannel.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.OneDExpChannel
-
-:mod:`~sardana.tango.pool.OneDExpChannel`
-===========================================
-
-.. automodule:: sardana.tango.pool.OneDExpChannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`OneDExpChannel`
- * :class:`OneDExpChannelClass`
-
-OneDExpChannel
-------------------
-
-.. inheritance-diagram:: OneDExpChannel
- :parts: 1
-
-.. autoclass:: OneDExpChannel
- :show-inheritance:
- :members:
- :undoc-members:
-
-OneDExpChannelClass
-----------------------
-
-.. inheritance-diagram:: OneDExpChannelClass
- :parts: 1
-
-.. autoclass:: OneDExpChannelClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/Pool.rst b/doc/source/devel/api/sardana/tango/pool/Pool.rst
deleted file mode 100644
index b118e4e5..00000000
--- a/doc/source/devel/api/sardana/tango/pool/Pool.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-.. currentmodule:: sardana.tango.pool.Pool
-
-:mod:`~sardana.tango.pool.Pool`
-=========================================
-
-.. automodule:: sardana.tango.pool.Pool
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`Pool`
- * :class:`PoolClass`
-
-Pool
--------
-
-.. inheritance-diagram:: Pool
- :parts: 1
-
-.. autoclass:: Pool
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolClass
------------
-
-.. inheritance-diagram:: PoolClass
- :parts: 1
-
-.. autoclass:: PoolClass
- :show-inheritance:
- :members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/PoolDevice.rst b/doc/source/devel/api/sardana/tango/pool/PoolDevice.rst
deleted file mode 100644
index dd95c2ed..00000000
--- a/doc/source/devel/api/sardana/tango/pool/PoolDevice.rst
+++ /dev/null
@@ -1,84 +0,0 @@
-.. currentmodule:: sardana.tango.pool.PoolDevice
-
-:mod:`~sardana.tango.pool.PoolDevice`
-==============================================
-
-.. automodule:: sardana.tango.pool.PoolDevice
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PoolDevice`
- * :class:`PoolDeviceClass`
- * :class:`PoolElementDevice`
- * :class:`PoolElementDeviceClass`
- * :class:`PoolGroupDevice`
- * :class:`PoolGroupDeviceClass`
-
-PoolDevice
---------------
-
-.. inheritance-diagram:: PoolDevice
- :parts: 1
-
-.. autoclass:: PoolDevice
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolDeviceClass
--------------------
-
-.. inheritance-diagram:: PoolDeviceClass
- :parts: 1
-
-.. autoclass:: PoolDeviceClass
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolElementDevice
-------------------
-
-.. inheritance-diagram:: PoolElementDevice
- :parts: 1
-
-.. autoclass:: PoolElementDevice
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolElementDeviceClass
--------------------------
-
-.. inheritance-diagram:: PoolElementDeviceClass
- :parts: 1
-
-.. autoclass:: PoolElementDeviceClass
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolGroupDevice
------------------
-
-.. inheritance-diagram:: PoolGroupDevice
- :parts: 1
-
-.. autoclass:: PoolGroupDevice
- :show-inheritance:
- :members:
- :undoc-members:
-
-PoolGroupDeviceClass
----------------------
-
-.. inheritance-diagram:: PoolGroupDeviceClass
- :parts: 1
-
-.. autoclass:: PoolGroupDeviceClass
- :show-inheritance:
- :members:
- :undoc-members:
diff --git a/doc/source/devel/api/sardana/tango/pool/PseudoCounter.rst b/doc/source/devel/api/sardana/tango/pool/PseudoCounter.rst
deleted file mode 100644
index 76f3bec3..00000000
--- a/doc/source/devel/api/sardana/tango/pool/PseudoCounter.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.PseudoCounter
-
-:mod:`~sardana.tango.pool.PseudoCounter`
-=========================================
-
-.. automodule:: sardana.tango.pool.PseudoCounter
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PseudoCounter`
- * :class:`PseudoCounterClass`
-
-PseudoCounter
--------------
-
-.. inheritance-diagram:: PseudoCounter
- :parts: 1
-
-.. autoclass:: PseudoCounter
- :show-inheritance:
- :members:
- :undoc-members:
-
-PseudoCounterClass
--------------------
-
-.. inheritance-diagram:: PseudoCounterClass
- :parts: 1
-
-.. autoclass:: PseudoCounterClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/PseudoMotor.rst b/doc/source/devel/api/sardana/tango/pool/PseudoMotor.rst
deleted file mode 100644
index c23bda5c..00000000
--- a/doc/source/devel/api/sardana/tango/pool/PseudoMotor.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.PseudoMotor
-
-:mod:`~sardana.tango.pool.PseudoMotor`
-=========================================
-
-.. automodule:: sardana.tango.pool.PseudoMotor
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`PseudoMotor`
- * :class:`PseudoMotorClass`
-
-PseudoMotor
-------------
-
-.. inheritance-diagram:: PseudoMotor
- :parts: 1
-
-.. autoclass:: PseudoMotor
- :show-inheritance:
- :members:
- :undoc-members:
-
-PseudoMotorClass
-----------------
-
-.. inheritance-diagram:: PseudoMotorClass
- :parts: 1
-
-.. autoclass:: PseudoMotorClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/TwoDExpChannel.rst b/doc/source/devel/api/sardana/tango/pool/TwoDExpChannel.rst
deleted file mode 100644
index efb20389..00000000
--- a/doc/source/devel/api/sardana/tango/pool/TwoDExpChannel.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.TwoDExpChannel
-
-:mod:`~sardana.tango.pool.TwoDExpChannel`
-===========================================
-
-.. automodule:: sardana.tango.pool.TwoDExpChannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`TwoDExpChannel`
- * :class:`TwoDExpChannelClass`
-
-TwoDExpChannel
-------------------
-
-.. inheritance-diagram:: TwoDExpChannel
- :parts: 1
-
-.. autoclass:: TwoDExpChannel
- :show-inheritance:
- :members:
- :undoc-members:
-
-TwoDExpChannelClass
-----------------------
-
-.. inheritance-diagram:: TwoDExpChannelClass
- :parts: 1
-
-.. autoclass:: TwoDExpChannelClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/sardana/tango/pool/ZeroDExpChannel.rst b/doc/source/devel/api/sardana/tango/pool/ZeroDExpChannel.rst
deleted file mode 100644
index 43be7ca2..00000000
--- a/doc/source/devel/api/sardana/tango/pool/ZeroDExpChannel.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.tango.pool.ZeroDExpChannel
-
-:mod:`~sardana.tango.pool.ZeroDExpChannel`
-===========================================
-
-.. automodule:: sardana.tango.pool.ZeroDExpChannel
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`ZeroDExpChannel`
- * :class:`ZeroDExpChannelClass`
-
-ZeroDExpChannel
-------------------
-
-.. inheritance-diagram:: ZeroDExpChannel
- :parts: 1
-
-.. autoclass:: ZeroDExpChannel
- :show-inheritance:
- :members:
- :undoc-members:
-
-ZeroDExpChannelClass
-----------------------
-
-.. inheritance-diagram:: ZeroDExpChannelClass
- :parts: 1
-
-.. autoclass:: ZeroDExpChannelClass
- :show-inheritance:
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/api/tango_device_pool.rst b/doc/source/devel/api/tango_device_pool.rst
deleted file mode 100644
index 2b4a20b4..00000000
--- a/doc/source/devel/api/tango_device_pool.rst
+++ /dev/null
@@ -1,4660 +0,0 @@
-
-==========================================
-Device Pool Tango_ :term:`API`
-==========================================
-
-.. todo:: Device Pool chapter is out of date. Need to update it and distribute chapters logically around the sardana documentation
-
-Introduction
-============
-
-This paper describes what could be the implementation of the Sardana
-device pool. This work is based on Jorg's paper called "Reordered
-SPEC_". It is **not at all** a final version of this device pool. It is rather
-a first approach to define this pool more precisely and to help defining its
-features and the way it could be implemented.
-
-
-Overall pool design
-===================
-
-The pool could be seen as a kind of intelligent Tango_ device container
-to control the experiment hardware. In a first approach, it requires
-that the hardware to be controlled is connected to the control
-computer or to external crate(s) connected to the control computer
-using bus coupler. It has two basic features which are:
-
-1. Hardware access using dynamically created/deleted Tango_ devices
- according to the experiment needs
-
-2. Management of some very common and well defined action regularly done
- on a beam line (scanning, motor position archiving....)
-
-To achieve these two goals and to provide the user with a way to
-control its behavior, it is implemented as a Tango_ class with commands
-and attributes like any other Tango_ class.
-
-
-Hardware access
----------------
-
-
-Core hardware access
-^^^^^^^^^^^^^^^^^^^^
-
-Most of the times, it is possible to define a list of very common
-devices found in most of the experiments, a list of communication link
-used between the experiment hardware and the control computer(s) and
-some of the most commonly used protocol used on these communication
-links. Devices commonly used to drive an experiment are:
-
-- Motor
-
-- Group of motor
-
-- Pseudo motor
-
-- Counter/Timer
-
-- Multi Channel Analyzer
-
-- CCD cameras
-
-- And some other that I don't know
-
-Communication link used to drive experiment devices are:
-
-- Serial line
-
-- GPIB
-
-- Socket
-
-- And some other that I don't know (USB????)
-
-Protocol used on the communication links are:
-
-- Modbus
-
-- Ans some other that I don't know
-
-Each of the controlled hardware (one motor, one pseudo-motor, one
-serial line device,...) will be driven by independent Tango_ classes.
-The pool device server will embed all these Tango_ classes together
-(statically linked). The pool Tango_ device is the "container
-interface" and allows the user to create/delete classical Tango_
-devices which are instances of these embedded classes. This is
-summarized in the following drawing.
-
-.. image:: /_static/hard.png
-
-Therefore, the three main actions to control a new equipment using the
-pool will be (assuming the equipment is connected to the control
-computer via a serial line):
-
-1. Create the serial line Tango_ device with one of the Pool device
- command assigning it a name like "MyNewEquipment".
-
-2. Connect to this newly created Tango_ device using its assigned name
-
-3. Send order or write/read data to/from the new equipment using for
- instance the WriteRead command of the serial line Tango_ device
-
-When the experiment does not need this new equipment any more, the
-user can delete the serial line Tango_ device with another pool device
-command. Note that most of the time, creating Tango_ device means
-defining some device configuration parameters (Property in Tango_
-language). The Tango_ wizard will be used to retrieve which properties
-have to be defined and will allow the user to set them on the fly.
-This means that all the Tango_ classes embedded within the Pool must
-have their wizard initialized.
-
-
-Extending pool features
-^^^^^^^^^^^^^^^^^^^^^^^
-
-From time to time, it could be useful to extend the list of Tango_
-classes known by the device pool in case a new kind of equipment (not
-using the core hardware access) is added to the experiment. Starting
-with Tango_ 5.5 (and the associated Pogo), each Tango_ class has a
-method which allow the class to be dynamically loaded into a running
-process. This feature will be used to extend the pool feature. It has
-to be checked that it is possible for Tango_ Python class.
-
-.. image:: /_static/dyn.png
-
-To achieve this feature, the pool Tango_ device will have commands to
-
-- Load a Tango_ class. This command will dynamically add two other
- commands and one attribute to the pool device Tango_ interface. These
- commands and the attribute are:
-
- - Command: Create a device of the newly loaded class
-
- - Command: Delete a device of the newly loaded class
-
- - Attribute: Get the list of Tango_ devices instances of the newly
- created class
-
-
-- Unload a Tango_ class
-
-- Reload a Tango_ class
-
-
-Global actions
---------------
-
-The following common actions regularly done on a beam line experiment
-will be done by the pool device server:
-
-- Evaluating user constraint(s) before moving motor(s)
-
-- Scanning
-
-- Saving experiment data
-
-- Experiment management
-
-- Archiving motor positions
-
-
-Sardana core hardware access
-============================
-
-
-The Sardana Motor management
-----------------------------
-
-
-The user motor interface
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-The motor interface is a first approach of what could be a complete
-motor interface. It is statically linked with the Pool device server
-and supports several attributes and commands. It is implemented in C++
-and used a set of the so-called "controller" methods. The motor
-interface is always the same whatever the hardware is. This is the
-rule of the "controller" to access the hardware using the
-communication link supported by the motor controller hardware (network
-link, serial line...).
-
-.. image:: /_static/motor.png
-
-The controller code has a well-defined interface and can be written
-using Python or C++. In both cases, it will be dynamically loaded into
-the pool device server process.
-
-
-The states
-""""""""""
-
-The motor interface knows five states which are ON, MOVING, ALARM,
-FAULT and UNKNOWN. A motor device is in MOVING state when it is
-moving! It is in ALARM state when it has reached one of the limit
-switches and is in FAULT if its controller software is not available
-(impossible to load it) or if a fault is reported from the hardware
-controller. The motor is in the UNKNOWN state if an exception occurs
-during the communication between the pool and the hardware controller.
-When the motor is in ALARM state, its status will indicate which limit
-switches is active.
-
-
-The commands
-""""""""""""
-
-The motor interface supports 3 commands on top of the Tango_ classical
-Init, State and Status commands. These commands are summarized in the
-following table:
-
-============ ================ ================
-Command name Input data type Output data type
-============ ================ ================
-Abort void void
-SetPosition Tango::DevDouble void
-SaveConfig void void
-============ ================ ================
-
-- **Abort** : It aborts a running motion. This command does not have input or
- output argument.
-
-- **SetPosition** : Loads a position into controller. It has one input argument which is
- the new position value (a double). It is allowed only in the ON or
- ALARM states. The unit used for the command input value is the
- physical unit: millimeters or milli-radians. It is always an absolute
- position.
-
-- **SaveConfig** : Write some of the motor parameters in database. Today, it writes the
- motor acceleration, deceleration, base_rate and velocity into database
- as motor device properties. It is allowed only in the ON or ALARM
- states
-
-The classical Tango_ Init command destroys the motor and re-create it.
-
-
-The attributes
-""""""""""""""
-
-The motor interface supports several attributes which are summarized
-in the following table:
-
-============== ================= =========== ======== ========= ==========
-Name Data type Data format Writable Memorized Ope/Expert
-============== ================= =========== ======== ========= ==========
-Position Tango::DevDouble Scalar R/W No * Ope
-DialPosition Tango::DevDouble Scalar R No Exp
-Offset Tango::DevDouble Scalar R/W Yes Exp
-Acceleration Tango::DevDouble Scalar R/W No Exp
-Base_rate Tango::DevDouble Scalar R/W No Exp
-Deceleration Tango::DevDouble Scalar R/W No Exp
-Velocity Tango::DevDouble Scalar R/W No Exp
-Limit_Switches Tango::DevBoolean Spectrum R No Exp
-SimulationMode Tango::DevBoolean Scalar R No Exp
-Step_per_unit Tango::DevDouble Scalar R/W Yes Exp
-Backlash Tango::DevLong Scalar R/W Yes Exp
-============== ================= =========== ======== ========= ==========
-
-- **Position** : This is read-write scalar double attribute. With the classical Tango
- min and max_value attribute properties, it is easy to define
- authorized limit for this attribute. See the definition of the
- DialPosition and Offset attributes to get a precise definition of the
- meaning of this attribute. It is not allowed to read or write this
- attribute when the motor is in FAULT or UNKNOWN state. It is also not
- possible to write this attribute when the motor is already MOVING. **The unit used for this attribute is the physical unit: millimeters or
- milli-radian. It is always an** **absolute** **position.** The value of this attribute is memorized in the Tango_ database but not
- by the default Tango_ system memorization. See chapter
- XXX: Unknown inset LatexCommand \ref{sub:Archiving-motor-position}:
- for details about motor position archiving.
-
-- **DialPosition** : This attribute is the motor dial position. The following formula
- links together the Position, DialPosition, Sign and Offset attributes: ::
-
- Position = Sign * DialPosition + Offset
-
- This allows to have the motor position centered around any position
- defined by the Offset attribute (classically the X ray beam position).
- It is a read only attribute. To set the motor position, the user has
- to use the Position attribute. It is not allowed to read this
- attribute when the motor is in FAULT or UNKNOWN mode. The unit used
- for this attribute is the physical unit: millimeters or milli-radian.
- It is also always an **absolute** position.
-
-- **Offset** : The offset to be applied in the motor position computation. By
- default set to 0. It is a memorized attribute. It is not allowed to
- read or write this attribute when the motor is in FAULT, MOVING or
- UNKNOWN mode.
-
-- **Acceleration** : This is an expert read-write scalar double attribute. This parameter
- value is written in database when the SaveConfig command is executed.
- It is not allowed to read or write this attribute when the motor is in
- FAULT or UNKNOWN state.
-
-- **Deceleration** : This is an expert read-write scalar double attribute. This parameter
- value is written in database when the SaveConfig command is executed.
- It is not allowed to read or write this attribute when the motor is in
- FAULT or UNKNOWN state.
-
-- **Base_rate** : This is an expert read-write scalar double attribute. This parameter
- value is written in database when the SaveConfig command is executed.
- It is not allowed to read or write this attribute when the motor is in
- FAULT or UNKNOWN state.
-
-- **Velocity** : This is an expert read-write scalar double attribute. This parameter
- value is written in database when the SaveConfig command is executed.
- It is not allowed to read or write this attribute when the motor is in
- FAULT or UNKNOWN state.
-
-- **Limit_Switches** : Three limit switches are managed by this attribute. Each of the
- switch are represented by a boolean value: False means inactive while
- True means active. It is a read only attribute. It is not possible to
- read this attribute when the motor is in UNKNOWN mode. It is a
- spectrum attribute with 3 values which are:
-
- - Data[0] : The Home switch value
-
- - Data[1] : The Upper switch value
-
- - Data[2] : The Lower switch value
-
-
-- **SimulationMode** : This is a read only scalar boolean attribute. When set, all motion
- requests are not forwarded to the software controller and then to the
- hardware. When set, the motor position is simulated and is immediately
- set to the value written by the user. To set this attribute, the user
- has to used the pool device Tango_ interface. The value of the
- position, acceleration, deceleration, base_rate, velocity and offset
- attributes are memorized at the moment this attribute is set. When
- this mode is turned off, if the value of any of the previously
- memorized attributes has changed, it is reapplied to the memorized
- value. It is not allowed to read this attribute when the motor is in
- FAULT or UNKNOWN states.
-
-- **Step_per_unit** : This is the number of motor step per millimeter or per degree. It is
- a memorized attribute. It is not allowed to read or write this
- attribute when the motor is in FAULT or UNKNOWN mode. It is also not
- allowed to write this attribute when the motor is MOVING. The default
- value is 1.
-
-- **Backlash** : If this attribute is defined to something different than 0, the
- motor will always stop the motion coming from the same mechanical
- direction. This means that it could be possible to ask the motor to go
- a little bit after the desired position and then to return to the
- desired position. The attribute value is the number of steps the motor
- will pass the desired position if it arrives from the "wrong"
- direction. This is a signed value. If the sign is positive, this means
- that the authorized direction to stop the motion is the increasing
- motor position direction. If the sign is negative, this means that the
- authorized direction to stop the motion is the decreasing motor
- position direction. It is a memorized attribute. It is not allowed to
- read or write this attribute when the motor is in FAULT or UNKNOWN
- mode. It is also not allowed to write this attribute when the motor is
- MOVING. Some hardware motor controllers are able to manage this
- backlash feature. If it is not the case, the motor interface will
- implement this behavior.
-
-All the motor devices will have the already described attributes but
-some hardware motor controller supports other features which are not
-covered by this list of pre-defined attributes. Using Tango_ dynamic
-attribute creation, a motor device may have extra attributes used to
-get/set the motor hardware controller specific features. The main
-characteristics of these extra attributes are :
-
-- Name defined by the motor controller software (See next chapter)
-
-- Data type is BOOLEAN, LONG, DOUBLE or STRING defined by the motor
- controller software (See next chapter)
-
-- The data format is always Scalar
-
-- The write type is READ or READ_WRITE defined by the motor controller
- software (See next chapter). If the write type is READ_WRITE, the
- attribute is memorized by the Tango_ layer
-
-
-The motor properties
-""""""""""""""""""""
-
-Each motor device has a set of properties. Five of these properties
-are automatically managed by the pool software and must not be changed
-by the user. These properties are named Motor_id, _Acceleration,
-_Velocity, _Base_rate and _Deceleration. The user properties are:
-
-====================== =============
-Property name Default value
-====================== =============
-Sleep_before_last_read 0
-====================== =============
-
-This property defines the time in milli-second that the software
-managing a motor movement will wait between it detects the end of the
-motion and the last motor position reading.
-
-
-Getting motor state and limit switches using event
-""""""""""""""""""""""""""""""""""""""""""""""""""
-
-The simplest way to know if a motor is moving is to survey its state.
-If the motor is moving, its state will be MOVING. When the motion is
-over, its state will be back to ON (or ALARM if a limit switch has
-been reached). The pool motor interface allows client interested by
-motor state or motor limit switches value to use the Tango_ event
-system subscribing to motor state change event. As soon as a motor
-starts a motion, its state is changed to MOVING and an event is sent.
-As soon as the motion is over, the motor state is updated ans another
-event is sent. In the same way, as soon as a change in the limit
-switches value is detected, a change event is sent to client(s) which
-have subscribed to change event on the Limit_Switches attribute.
-
-
-Reading the motor position attribute
-""""""""""""""""""""""""""""""""""""
-
-For each motor, the key attribute is its position. Special care has
-been taken on this attribute management. When the motor is not moving,
-reading the Position attribute will generate calls to the controller
-and therefore hardware access. When the motor is moving, its position
-is automatically read every 100 milli-seconds and stored in the Tango
-polling buffer. This means that a client reading motor Position
-attribute while the motor is moving will get the position from the
-Tango_ polling buffer and will not generate extra controller calls. It
-is also possible to get a motor position using the Tango_ event system.
-When the motor is moving, an event is sent to the registered clients
-when the change event criterion is true. By default, this change event
-criterion is set to be a difference in position of 5. It is tunable on
-a motor basis using the classical motor Position attribute abs_change
-property or at the pool device basis using its DefaultMotPos_AbsChange
-property. Anyway, not more than 10 events could be sent by second.
-Once the motion is over, the motor position is made unavailable from
-the Tango_ polling buffer and is read a last time after a tunable
-waiting time (Sleep_bef_last_read property). A forced change event
-with this value is sent to clients using events.
-
-
-The Motor Controller
-^^^^^^^^^^^^^^^^^^^^
-
-XXX: Unknown inset LatexCommand \label{sub:The-Motor-Controller}:
-
-Each controller code is built as a shared library or as a Python
-module which is dynamically loaded by the pool device the first time
-one controller using the shared library (or the module) is created.
-Each controller is uniquely defined by its name following the syntax::
-
- <controller_file_name>.<controller_class_name>/<instance_name>
-
-At controller creation time, the pool checks the controller unicity on
-its control system (defined by the TANGO_HOST). It is possible to
-write controller using either C++ or Python language. Even if a Tango
-device server is a multi-threaded process, every access to the same
-controller will be serialized by a monitor managed by the Motor
-interface. This monitor is attached to the controller class and not to
-the controller instance to handle cases where several instances of the
-same controller class is used. For Python controller, this monitor
-will also take care of taking/releasing the Python Global Interpreter
-Lock (GIL) before any call to the Python controller is executed.
-
-
-The basic
-"""""""""
-
-For motor controller, a pre-defined set of methods has to be
-implemented in the class implementing the controller interface. These
-methods can be splitted in 6 different types which are:
-
-1. Methods to create/remove motor
-
-2. Methods to move motor(s)
-
-3. Methods to read motor(s) position
-
-4. Methods to get motor(s) state
-
-5. Methods to configure a motor
-
-6. Remaining methods.
-
-These methods, their rules and their execution sequencing is detailed
-in the following sub-chapters. The motor controller software layer is
-also used to inform the upper level of the features supported by the
-underlying hardware. This is called the controller **features** . It is detailed in a following sub-chapter. Some controller may need
-some configuration data. This will be supported using Tango
-properties. This is detailed in a dedicated sub-chapter.
-
-
-Specifying the motor controller features
-""""""""""""""""""""""""""""""""""""""""
-
-A controller feature is something that motor hardware controller is
-able to do or require on top of what has been qualified as the basic
-rules. Even if these features are common, not all the controllers
-implement them. Each of these common features are referenced by a pre-
-defined string. The controller code writer defined (from a pre-defined
-list) which of these features his hardware controller
-implements/requires. This list (a Python list or an array of C
-strings) has a well-defined name used by the upper layer software to
-retrieve it. The possible strings in this list are (case independent):
-
-- **CanDoBacklash** : The hardware controller manages the motor backlash if the user
- defines one
-
-- **WantRounding** : The hardware controller wants an integer number of step
-
-- **encoder** : The hardware knows how to deal with encoder
-
-- **home** : The hardware is able to manage home switch
-
-- **home_acceleration** : It is possible to set the acceleration for motor homing
-
-- **home_method** _ **xxx** : The hardware knows the home method called xxx
-
-- **home_method_yyy** : The hardware knows the home method called yyy
-
-The name of this list is simply: **ctrl_features** . If this list is not defined, this means that the hardware does not
-support/require any of the additional features. The Tango_ motor class
-will retrieve this list from the controller before the first motor
-belonging to this controller is created. As an example, we suppose
-that we have a pool with two classes of motor controller called Ctrl_A
-and Ctrl_B. The controllers features list are (in Python) ::
-
- Controller A : ctrl_features = ['CanDoBacklash','encoder']
- ControllerB : ctrl_features = ['WantRounding','home','home_method_xxx']
-
-All motors devices belonging to the controller A will have the Encoder
-and Backlash features. For these motors, the backlash will be done by
-the motor controller hardware. All the motors belonging to the
-controller B will have the rounding, home and home_method features.
-For these motors, the backlash will be done by the motor interface
-code.
-
-
-Specifying the motor controller extra attributes
-""""""""""""""""""""""""""""""""""""""""""""""""
-
-XXX: Unknown inset LatexCommand \label{par:Specifying-the-motor}:
-
-Some of the hardware motor controller will have features not defined
-in the features list or not accessible with a pre-defined feature. To
-provide an interface to these specific hardware features, the
-controller code can define extra attributes. Another list called : **ctrl_extra_attributes** is used to define them. This list (Python dictionary or an array of
-classical C strings) is used to define the name, data and read-write
-type of the Tango_ attribute which will be created to deal with these
-extra features. The attribute created for these controller extra
-features are all:
-
-- Boolean, Long, Double or String
-
-- Scalar
-
-- Read or Read/Write (and memorized if Read/Write).
-
-For Python classes (Python controller class), it is possible to define
-these extra attributes informations using a Python dictionary called **ctrl_extra** _ **attributes** . The extra attribute name is the dictionary element key. The
-dictionary element value is another dictionary with two members which
-are the extra attribute data type and the extra attribute read/write
-type. For instance, for our IcePap controller, this dictionary to
-defined one extra attribute called "SuperExtra" of data type Double
-which is also R/W will be::
-
- ctrl_extra_attributes = { "SuperExtra" : { "Type" : "DevDouble", "R/W Type", "READ_WRITE" } }
-
-For C++ controller class, the extra attributes are defined within an
-array of **Controller::ExtraAttrInfo** structures. The name of this array has to be
-<Ctrl_class_name>_ctrl_extra_attributes. Each
-Controller::ExtraAttrInfo structure has three elements which are all
-pointers to classical C string (const char \*). These elements are:
-
- 1. The extra attribute name
- 2. The extra attribute data type
- 3. The extra attribute R/W type
-
-A NULL pointer defined the last extra attribute. The following is an
-example of extra attribute definition for a controller class called
-"DummyController"::
-
- Controller::ExtraAttrInfo DummyController_ctrl_extra_attributes[] =
- { { "SuperExtra", "DevDouble", "Read_Write" }, NULL };
-
-The string describing the extra attribute data type may have the
-following value (case independent):
-
-- DevBoolean, DevLong, DevDouble or DevString (in Python, a preceding
- "PyTango." is allowed)
-
-The string describing the extra attribute R/W type may have the
-following value (case independent)
-
-- Read or Read_Write (in Python, a preceding "PyTango." is allowed)
-
-
-Methods to create/remove motor from controller
-""""""""""""""""""""""""""""""""""""""""""""""
-
-Two methods are called when creating or removing motor from a
-controller. These methods are called **AddDevice** and **DeleteDevice** . The AddDevice method is called when a new motor belonging to the
-controller is created within the pool. The DeleteDevice method is
-called when a motor belonging to the controller is removed from the
-pool.
-
-
-Methods to move motor(s)
-""""""""""""""""""""""""
-
-Four methods are used when a request to move motor(s) is executed.
-These methods are called **PreStartAll** , **PreStartOne** , **StartOne** and **StartAll** .
-The algorithm used to move one or several motors is the following::
-
- /FOR/ Each controller(s) implied in the motion
- - Call PreStartAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the motion
- - ret = PreStartOne(motor to move, new position)
- - /IF/ ret is true
- - Call StartOne(motor to move, new position)
- - /END IF/
- /END FOR/
-
- /FOR/ Each controller(s) implied in the motion
- - Call StartAll()
- /END FOR/
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ ================================= ======================================= =================================
- PresStartAll() PreStartOne() StartOne() StartAll()
-==================== ================================ ================================= ======================================= =================================
-Default action Does nothing Return true Does nothing Does nothing
-Externally called by Writing the Position attribute Writing the Position attribute Writing the Position attribute Writing the Position attribute
-Internally called Once for each implied controller For each implied motor For each implied motor Once for each implied controller
-Typical rule Init internal data for motion Check if motor motion is possible Set new motor position in internal data Send order to physical controller
-==================== ================================ ================================= ======================================= =================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to move several motors at the same time. For some
-simpler controller, it is possible to implement only the StartOne()
-method. The default implementation of the three remaining methods is
-defined in a way that the algorithm works even in such a case.
-
-
-Methods to read motor(s) position
-"""""""""""""""""""""""""""""""""
-
-Four methods are used when a request to read motor(s) position is
-received. These methods are called PreReadAll, PreReadOne, ReadAll and
-ReadOne. The algorithm used to read position of one or several motors
-is the following::
-
- /FOR/ Each controller(s) implied in the reading
- - Call PreReadAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the reading
- - PreReadOne(motor to read)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the reading
- - Call ReadAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the reading
- - Call ReadOne(motor to read)
- /END FOR/
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ =================================== ================================= =================================================================
- PreReadAll() PreReadOne() ReadAll() ReadOne()
-==================== ================================ =================================== ================================= =================================================================
-Default action Does nothing Does nothing Does nothing Print message on the screen and returns NaN. Mandatory for Python
-Externally called by Reading the Position attribute Reading the Position attribute Reading the Position attribute Reading the Position attribute
-Internally called Once for each implied controller For each implied motor For each implied controller Once for each implied motor
-Typical rule Init internal data for reading Memorize which motor has to be read Send order to physical controller Return motor position from internal data
-==================== ================================ =================================== ================================= =================================================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to read several motors positions at the same time.
-For some simpler controller, it is possible to implement only the
-ReadOne() method. The default implementation of the three remaining
-methods is defined in a way that the algorithm works even in such a
-case.
-
-
-Methods to get motor(s) state
-"""""""""""""""""""""""""""""
-
-XXX: Unknown inset LatexCommand \label{par:Methods-to-get-state}:
-
-Four methods are used when a request to get motor(s) state is
-received. These methods are called PreStateAll, PreStateOne, StateAll
-and StateOne. The algorithm used to get state of one or several motors
-is the following :
-
-
-
-::
-
- /FOR/ Each controller(s) implied in the state getting
- - Call PreStateAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the state getting
- - PreStateOne(motor to get state)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the state getting
- - Call StateAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the getting state
- - Call StateOne(motor to get state)
- /END FOR/
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ =================================== ================================= =====================================
- PreStateAll() PreStateOne() StateAll() StateOne()
-==================== ================================ =================================== ================================= =====================================
-Default action Does nothing Does nothing Does nothing Mandatory for Python
-Externally called by Reading the motor state Reading the motor state Reading the motor state Reading the motor state
-Internally called Once for each implied controller For each implied motor For each implied controller Once for each implied motor
-Typical rule Init internal data for reading Memorize which motor has to be read Send order to physical controller Return motor state from internal data
-==================== ================================ =================================== ================================= =====================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to read several motors state at the same time. For
-some simpler controller, it is possible to implement only the
-StateOne() method. The default implementation of the three remaining
-methods is defined in a way that the algorithm works even in such a
-case.
-
-
-Methods to configure a motor
-""""""""""""""""""""""""""""
-
-The rule of these methods is to
-
-- Get or Set motor parameter(s) with methods called GetPar() or SetPar()
-
-- Get or Set motor extra feature(s) parameter with methods called
- GetExtraAttributePar() or SetExtraAttributePar()
-
-The following table summarizes the usage of these methods:
-
-========= ============================================================================================== ============================================================================================================ ================================================= =====================================================
- GetPar() SetPar() GetExtraAttributePar() SetExtraAttributePar()
-========= ============================================================================================== ============================================================================================================ ================================================= =====================================================
-Called by Reading the Velocity, Acceleration, Base_rate, Deceleration and eventually Backlash attributes Writing the Velocity, Acceleration, Base_rate, Deceleration, Step_per_unit and eventually Backlash attribute Reading any of the extra attributes Writing any of the extra attributes
-Rule Get parameter from physical controller Set parameter in physical controller Get extra attribute value from the physical layer Set additional attribute value in physical controller
-========= ============================================================================================== ============================================================================================================ ================================================= =====================================================
-
-Please, note that the default implementation of the GetPar() prints a
-message on the screen and returns a NaN double value. The
-GetExtraAttributePar() default implementation also prints a message on
-the screen and returns a string set to "Pool_met_not_implemented".
-
-
-The remaining methods
-"""""""""""""""""""""
-
-The rule of the remaining methods are to
-
-- Load a new motor position in a controller with a method called
- DefinePosition()
-
-- Abort a running motion with a method called AbortOne()
-
-- Send a raw string to the controller with a method called SendToCtrl()
-
-The following table summarizes the usage of these methods:
-
-========= ======================================= ======================= =========================================================================
- DefinePosition() AbortOne() SendToCtrl()
-========= ======================================= ======================= =========================================================================
-Called by The motor SetPosition command The motor Abort command The Pool SendToController command
-Rule Load a new motor position in controller Abort a running motion Send the input string to the controller and returns the controller answer
-========= ======================================= ======================= =========================================================================
-
-Controller properties
-"""""""""""""""""""""
-
-XXX: Unknown inset LatexCommand \label{par:Controller-properties}:
-
-Each controller may have a set of **properties** to configure itself. Properties are defined at the controller class
-level but can be re-defined at the instance level. It is also possible
-to define a property default value. These default values are stored
-within the controller class code. If a default value is not adapted to
-specific object instance, it is possible to define a new property
-value which will be stored in the Tango_ database. Tango_ database
-allows storing data which are not Tango_ device property. This storage
-could be seen simply as a couple name/value. Naming convention for
-this kind of storage could be defined as:
-
- controller_class->prop: value or
- controller_class/instance->prop: value
-
-The calls necessary to retrieve/insert/update these values from/to the
-database already exist in the Tango_ core. The algorithm used to
-retrieve a property value is the following::
-
- - Property value = Not defined
-
- /IF/ Property has a default value
- - Property value = default value
- /ENDIF/
-
- /IF/ Property has a value defined in db at class level
- - Property value = class db value
- /ENDIF/
-
- /IF/ Property has a value defined in db at instance level
- - Property value = instance db value
- /ENDIF/
-
- /IF/ Property still not defined
- - Error
- /ENDIF/
-
-As an example, the following array summarizes the result of this
-algorithm. The example is for an IcePap controller and the property is
-the port number (called port_number):
-
-============== ====== ====== ====== ====== ======
- case 1 case 2 case 3 case 4 case 5
-============== ====== ====== ====== ====== ======
-default value 5000 5000 5000 5000
-class in DB 5150 5150
-inst. in DB 5200 5250
-Property value 5000 5200 5150 5250 Error
-============== ====== ====== ====== ====== ======
-
-
-- Case 1: The IcePap controller class defines one property called
- port_number and assigns it a default value of 5000
-- Case 2 : An IcePap controller is created with an instance name
- "My_IcePap". The property IcePap/My_IcePap->port_number has been set
- to 5200 in db
-- Case 3: The hard coded value of 5000 for port number does not fulfill
- the need. A property called IcePap->port_number set to 5150 is defined
- in db.
-- Case 4: We have one instance of IcePap called "My_IcePap" for which we
- have defined a property "IcePap/My_IcePap" set to 5250.
-- Case 5: The IcePap controller has not defined a default value for the
- property.
-
-In order to provide the user with a friendly interface, all the
-properties defined for a controller class have to have informations
-hard-coded into the controller class code. We need at least three
-informations and sometimes four for each property. They are:
-
-1. The property name (Mandatory)
-
-2. The property description (Mandatory)
-
-3. The property data type (Mandatory)
-
-4. The property default value (Optional)
-
-With these informations, a graphical user interface is able to build
-at controller creation time a panel with the list of all the needed
-properties, their descriptions and eventually their default value. The
-user then have the possibility to re-define property value if the
-default one is not valid for his usage. This is the rule of the
-graphical panel to store the new value into the Tango_ database. The
-supported data type for controller property are:
-
-================== ====================================
-Property data type String to use in property definition
-================== ====================================
-Boolean DevBoolean
-Long DevLong
-Double DevDouble
-String DevString
-Boolean array DevVarBooleanArray
-Long array DevVarLongArray
-Double array DevVarDoubleArray
-String array DevVarStringArray
-================== ====================================
-
-For Python classes (Python controller class), it is possible to define
-these properties informations using a Python dictionary called **class_prop** . The property name is the dictionary element key. The dictionary
-element value is another dictionary with two or three members which
-are the property data type, the property description and an optional
-default value. If the data type is an array, the default value has to
-be defined in a Python list or tuple. For instance, for our IcePap
-port number property, this dictionary will be ::
-
- class_prop = { "port_number" : { "Type" : "DevLong", "Description",
- "Port on which the IcePap software server is listening", "DefaultValue" : 5000 } }
-
-For C++ controller class, the properties are defined within an array
-of **Controller::PropInfo** structures. The name of this array has to be
-<Ctrl_class_name>_class_prop. Each Controller::PropInfo structure has
-four elements which are all pointers to classical C string (const char
-\*). These elements are:
-
- 1. The property name
- 2. The property description
- 3. The property data type
- 4. The property default value (NULL if not used)
-
-A NULL pointer defined the last property. The following is an example
-of property definition for a controller class called "DummyController"::
-
-
- Controller::PropInfo DummyController_class_prop[] =
- {{"The prop","The first CPP property","DevLong","12"},
- {"Another_Prop","The second CPP property","DevString",NULL},
- {"Third_Prop","The third CPP property","DevVarLongArray","11,22,33"},
- NULL};
-
-The value of these properties is passed to the controller at
-controller instance creation time using a constructor parameter. In
-Python, this parameter is a dictionnary and the base class of the
-controller class will create one object attribute for each property.
-In our Python example, the controller will have an attribute called
-"port_number" with its value set to 5000. In C++, the controller
-contructor receives a vector of **Controller::Properties** structure. Each Controller::Properties structure has two elements
-which are:
-
- 1. The property name as a C++ string
- 2. The property value in a **PropData** structure. This PropData structure has four elements which are
- 1. A C++ vector of C++ bool type
- 2. A C++ vector of C++ long type
- 3. A C++ vector of C++ double type
- 4. A C++ vector of C++ string.
-
-Only the vector corresponding to the property data type has a size
-different than 0. If the property is an array, the vector has as many
-elements as the property has.
-
-
-The MaxDevice property
-""""""""""""""""""""""
-
-Each controller has to have a property defining the maximum number of
-device it supports. This is a mandatory requirement. Therefore, in
-Python this property is simply defined by setting the value of a
-controller data member called **MaxDevice** which will be taken as the default value for the controller. In C++,
-you have to define a global variable called
-<Ctrl_class_name>_MaxDevice. The management of the number of devices created using a controller
-(limited by this property) will be completely done by the pool
-software. The information related to this property is automatically
-added as first element in the information passed to the controller at
-creation time. The following is an example of the definition of this
-MaxDevice property in C++ for a controller class called
-"DummyController"
-
-
-
-::
-
- long DummyController_MaxDevice = 16;
-
-
-C++ controller
-""""""""""""""
-
-For C++, the controller code is implemented as a set of classes: A
-base class called **Controller** and a class called **MotorController** which inherits from Controller. Finally, the user has to write its
-controller class which inherits from MotorController.
-
-
-XXX: Unknown layout Subparagraph: The Controller class
-XXX: XXX: Unknown inset LatexCommand \label{sub:The-Cpp-Controller-class}:
-This class defined two pure virtual methods, seven virtual methods and
-some data types. The methods defined in this class are:
-
-1. void **Controller::AddDevice** (long axe_number)
- Pure virtual
-
-2. void **Controller::DeleteDevice** (long axe_number)
- Pure virtual
-
-3. void **Controller::PreStateAll** ()
- The default implementation does nothing
-
-4. void **Controller::PreStateOne** (long idx_number)
- The default implementation does nothing. The parameter is the device
- index in the controller
-
-5. void **Controller::StateAll** ()
- The default implementation does nothing
-
-6. void **Controller::StateOne** (long idx_number,CtrlState \*ptr)
- Read a device state. The CtrlState data type is a structure with two
- elements which are:
-
- - A long dedicated to return device state (format ??)
-
- - A string used in case the motor is in FAULT and the controller is able
- to return a string describing the fault.
-
-
-7. string **Controller::SendToCtrl** (string in_string)
- Send the input string to the controller without interpreting it and
- returns the controller answer
-
-8. Controller::CtrlData **Controller::GetExtraAttributePar** (long idx_number,string &extra_attribute_name)
- Get device extra attribute value. The name of the extra attribute is
- passed as the second argument of the method. The default definition of
- this method prints a message on the screen and returns a string set to
- "Pool_meth_not_implemented". The CtrlData data type is a structure
- with the following elements
-
- 1. A data type enumeration called data_type describing which of the
- following element is valid (BOOLEAN, LONG, DOUBLE or STRING)
-
- 2. A boolean data called bo_data for boolean transfer
-
- 3. A long data called lo_data for long transfer
-
- 4. A double data called db_data for double transfer
-
- 5. A C++ string data called str_data for string transfer
-
-
-9. void **Controller::SetExtraAttributePar** (long idx_number, string &extra_attribute_name, Controller::CtrlData
- &extra_attribute_value)
- Set device extra attribute value.
-
-It also has one data member which is the controller instance name with
-one method to return it
-
-1. string & **Controller::get_name** (): Returns the controller instance name
-
-
-XXX: Unknown layout Subparagraph: The MotorController class
-This class defined twelve virtual methods with default implementation.
-The virtual methods declared in this class are:
-
-1. void **MotorController::PreStartAll** ()
- The default implementation does nothing.
-
-2. bool **MotorController::PreStartOne** (long axe_number, double wanted_position)
- The default implementation returns True.
-
-3. void **MotorController::StartOne** (long axe_number, double wanted_position)
- The default implementation does nothing.
-
-4. void **MotorController::StartAll** ()
- Start the motion. The default implementation does nothing.
-
-5. void **MotorController::PreReadAll** ()
- The default implementation does nothing.
-
-6. void **MotorController::PreReadOne** (long axe_number)
- The default implementation does nothing.
-
-7. void **MotorController::ReadAll** ()
- The default implementation does nothing.
-
-8. double **MotorController::ReadOne** (long axe_number)
- Read a position. The default implementation does nothing.
-
-9. void **MotorController::AbortOne** (long axe_number)
- Abort a motion. The default implementation does nothing.
-
-10. void **MotorController::DefinePosition** (long axe_number, double new_position)
- Load a new position. The default implementation does nothing.
-
-11. Controller::CtrlData **MotorController::GetPar** (long axe_number, string &par_name)
- Get motor parameter value. The CtrlData data type is a structure with
- the following elements
-
- 1. A data type enumeration called data_type describing which of the
- following element is valid (BOOLEAN, LONG, DOUBLE or STRING)
-
- 2. A boolean data called bo_data for boolean transfer
-
- 3. A long data called lo_data for long transfer
-
- 4. A double data called db_data for double transfer
-
- 5. A C++ string data called str_data for string transfer
-
- A motor controller has to handle four or five different possible
- values for the "par_name" parameter which are:
-
- - Acceleration
-
- - Deceleration
-
- - Velocity
-
- - Base_rate
-
- - Backlash which has to be handled only for controller which has the
- backlash feature
-
- The default definition of this method prints a message on the screen
- and returns a NaN double value.
-
-
-12. void **MotorController::SetPar** (long axe_number, string &par_name, Controller::CtrlData &par_value)
- Set motor parameter value. The default implementation does nothing. A
- motor controller has to handle five or six different value for the
- "par_name" parameter which are:
-
- - Acceleration
-
- - Deceleration
-
- - Velocity
-
- - Base_rate
-
- - Step_per_unit
-
- - Backlash which has to be handled only for controller which has the
- backlash feature
-
- The description of the CtrlData type is given in the documentation of
- the GetPar() method. The default definition of this method does
- nothing
-
-
-This class has only one constructor which is
-
-1. **MotorController::MotorController** (const char \*)
- Constructor of the MotorController class with the controller name as
- instance name
-
-Please, note that this class defines a structure called MotorState
-which inherits from the Controller::CtrlState and which has a data
-member:
-
-1. A long describing the motor limit switches state (bit 0 for the Home
- switch, bit 1 for Upper Limit switch and bit 2 for the Lower Limit
- switch)
-
-This structure is used in the StateOne() method.
-
-
-XXX: Unknown layout Subparagraph: The user controller class
-XXX: XXX: Unknown inset LatexCommand \label{par:The-user-controller}:
-The user has to implement the remaining pure virtual methods
-(AddDevice and DeleteDevice) and has to re-define virtual methods if
-the default implementation does not cover his needs. The controller
-code has to define two global variables which are:
-
-1. **Motor_Ctrl_class_name** (for Motor controller). This is an array of classical C strings
- terminated by a NULL pointer. Each array element is the name of a
- Motor controller class defined in this file.
-
-2. **<CtrlClassName>_MaxDevice** . This variable is a long defining the maximum number of device that
- the controller hardware can support.
-
-On top of that, a controller code has to define a C function (defined
-as "extern C") which is called by the pool to create instance(s) of
-the controller class. This function has the following definition::
-
- Controller * **_create_<Controller class name>** (const char \*ctrl_instance_name,vector<Controller::Properties> &props)
-
-For instance, for a controller class called DummyController, the name
-of this function has to be: _create_DummyController(). The parameters
-passed to this function are:
-
-1. The forth parameter given to the pool during the CreateController
- command (the instance name).
-
-2. A reference to a C++ vector with controller properties as defined in
- XXX: Unknown inset LatexCommand \ref{par:Controller-properties}:
-
-The rule of this C function is to create one instance of the user
-controller class passing it the arguments it has received. The
-following is an example of these definitions
-
-
-
-::
-
- //
- // Methods of the DummyController controller
- //
- ....
-
- const char *Motor_Ctrl_class_name[] = {"DummyController",NULL};
-
- long DummyController_MaxDevice = 16;
-
- extern "C" {
- Controller *_create_DummyController(const char *inst,vector<Controller::Properties> &prop)
- {
- return new DummyController(inst,prop);
- }
- }
-
-On top of these mandatory definitions, you can define a controller
-documentation string, controller properties, controller features and
-controller extra features. The documentation string is the first
-element of the array returned by the Pool device GetControllerInfo
-command as detailed in
-XXX: Unknown inset LatexCommand \ref{ite:GetControllerInfo:}:
-. It has to be defined as a classical C string (const char \*) with a
-name like <Ctrl_class_name>_doc. The following is an example of a
-controller C++ code defining all these elements.
-
-
-
-::
-
- //
- // Methods of the DummyController controller
- //
- ....
-
- const char *Motor_Ctrl_class_name[] = {"DummyController",NULL};
- const char *DummyController_doc = "This is the C++ controller for the DummyController class";
-
- long DummyController_MaxDevice = 16;
-
- char *DummyController_ctrl_extra_features_list[] = {{"Extra_1","DevLong","Read_Write"},
- {"Super_2","DevString","Read"},
- NULL};
- char *DummyController_ctrl_features[] = {"WantRounding","CanDoBacklash",NULL};
-
- Controller::PropInfo DummyController_class_prop[] =
- {{"The prop","The first CPP property","DevLong","12"},
- {"Another_Prop","The second CPP property","DevString",NULL},
- {"Third_Prop","The third CPP property","DevVarLongArray","11,22,33"},
- NULL};
-
- extern "C" {
- Controller *_create_DummyController(const char *inst,vector<Controller::Properties> &prop)
- {
- return new DummyController(inst,prop);
- }
- }
-
-
-Python controller
-"""""""""""""""""
-
-The principle is exactly the same than the one used for C++ controller
-but we don't have pure virtual methods with a compiler checking if
-they are defined at compile time. Therefore, it is the pool software
-which checks that the following methods are defined within the
-controller class when the controller module is loaded (imported):
-
-- AddDevice
-
-- DeleteDevice
-
-- StartOne or StartAll method
-
-- ReadOne method
-
-- StateOne method
-
-With Python controller, there is no need for function to create
-controller class instance. With the help of the Python C API, the pool
-device is able to create the needed instances. Note that the
-StateOne() method does not have the same signature for Python
-controller.
-
-1. tuple **Stat** e **One** (self,axe_number)
- Get a motor state. The method has to return a tuple with two or three
- elements which are:
-
- 1. The motor state (as defined by Tango)
-
- 2. The limit switch state (integer with bit 0 for Home switch, bit 1 for
- Upper switch and bit 2 for Lower switch)
-
- 3. A string describing the motor fault if the controller has this
- feature.
-
-
-A Python controller class has to inherit from a class called **MotorController** . This does not add any feature but allow the pool software to realize
-that this class is a motor controller.
-
-
-Python controller examples
-""""""""""""""""""""""""""
-
-
-XXX: Unknown layout Subparagraph: A minimum controller code
-The following is an example of the minimum code structure needed to
-write a Python controller :
-
-
-
-::
-
- 1 import socket
- 2 import PyTango
- 3 import MotorController
- 4
- 5 class MinController(MotorController.MotorController):
- 6
- 7 #
- 8 # Some controller definitions
- 9 #
- 10
- 11 MaxDevice = 1
- 12
- 13 #
- 14 # Controller methods
- 15 #
- 16
- 17 def __init__(self,inst,props):
- 18 MotorController.MotorController.__init__(self,inst,props)
- 19 self.inst_name = inst
- 20 self.socket_connected = False
- 21 self.host = "the_host"
- 22 self.port = 1111
- 23
- 24 #
- 25 # Connect to the icepap
- 26 #
- 27
- 28 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- 29 self.sock.connect(self.host, self.port)
- 30 self.socket_connected = True
- 31
- 32 print "PYTHON -> Connected to", self.host, " on port", self.port
- 33
- 34
- 35 def AddDevice(self,axis):
- 36 print "PYTHON -> MinController/",self.inst_name,": In AddDevice method for axis",axis
- 37
- 38 def DeleteDevice(self,axis):
- 39 print "PYTHON -> MinController/",self.inst_name,": In DeleteDevice method for axis",axis
- 40
- 41 def StateOne(self,axis):
- 42 print "PYTHON -> MinController/",self.inst_name,": In StateOne method for axis",axis
- 43 tup = (PyTango.DevState.ON,0)
- 44 return tup
- 45
- 46 def ReadOne(self,axis):
- 47 print "PYTHON -> MinController/",self.inst_name,": In ReadOne method for axis",axis
- 48 self.sock.send("Read motor position")
- 49 pos = self.sock.recv(1024)
- 50 return pos
- 51
- 52 def StartOne(self,axis,pos):
- 53 print "PYTHON -> MinController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
- 54 self.sock.send("Send motor to position pos")
-
-
-
-Line 11: Definition of the mandatory MaxDevice property set to 1 in
-this minimum code
-Line 17-32: The IcePapController constructor code
-Line 35-36: The AddDevice method
-Line 38-39: The DeleteDevice method
-Line 41-44: The StateOne method
-Line 46-50: The ReadOne method reading motor position from the
-hardware controller
-Line 52-54: The StartOne method writing motor position at position pos
-
-
-XXX: Unknown layout Subparagraph: A full features controller code
-The following is an example of the code structure needed to write a
-full features Python controller :
-
-
-
-::
-
- 1 import socket
- 2 import PyTango
- 3 import MotorController
- 4
- 5 class IcePapController(MotorController.MotorController)
- 6 "This is an example of a Python motor controller class"
- 7 #
- 8 # Some controller definitions
- 9 #
- 10
- 11 MaxDevice = 128
- 12 ctrl_features = ['CanDoBacklash']
- 13 ctrl_extra_attributes = {'IceAttribute':{'Type':'DevLong','R/W Type':'READ_WRITE'}}
- 14 class_prop = {'host':{'Type':'DevString','Description':"The IcePap controller
- 15 host name",'DefaultValue':"IcePapHost"},
- 16 'port':{'Type':'DevLong','Description':"The port on which the
- 17 IcePap software is listenning",'DefaultValue':5000}}
- 18
- 19 #
- 20 # Controller methods
- 21 #
- 22
- 23 def __init__(self,inst,props):
- 24 MotorController.MotorController.__init__(self,inst,props)
- 25 self.inst_name = inst
- 26 self.socket_connected = False
- 27
- 28 #
- 29 # Connect to the icepap
- 30 #
- 31
- 32 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- 33 self.sock.connect(self.host, self.port)
- 34 self.socket_connected = True
- 35
- 36 print "PYTHON -> Connected to", self.host, " on port", self.port
- 37
- 38
- 39 def AddDevice(self,axis):
- 40 print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
- 41
- 42 def DeleteDevice(self,axis):
- 43 print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
- 44
- 45 def PreReadAll(self):
- 46 print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
- 47 self.read_pos = []
- 48 self.motor_to_read = []
- 49
- 50 def PreReadOne(self,axis):
- 51 print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
- 52 self.motor_to_read.append(axis)
- 53
- 54 def ReadAll(self):
- 55 print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
- 56 self.sock.send("Read motors in the motor_to_read list")
- 57 self.read_pos = self.sock.recv(1024)
- 58
- 59 def ReadOne(self,axis):
- 60 print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- 61 return read_pos[axis]
- 62
- 63 def PreStartAll(self):
- 64 print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
- 65 self.write_pos = []
- 66 self.motor_to_write = []
- 67
- 68 def PreStartOne(self,axis,pos):
- 69 print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- 70 return True
- 71
- 72 def StartOne(self,axis,pos):
- 73 print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
- 74 self.write_pos.append(pos)
- 75 self.motor_to_write(axis)
- 76
- 77 def StartAll(self):
- 78 print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
- 79 self.sock.send("Write motors in the motor_to_write list at position in the write_pos list"
- 80
- 81 def PreStateAll(self):
- 82 print "PYTHON -> IcePapController/",self.inst_name,": In PreStateAll method"
- 83 self.read_state = []
- 84 self.motor_to_get_state = []
- 85
- 86 def PreStateOne(self,axis):
- 87 print "PYTHON -> IcePapController/",self.inst_name,": In PreStateOne method for axis",axis
- 88 self.motor_to_get_state.append(axis)
- 89
- 90 def StateAll(self):
- 91 print "PYTHON -> IcePapController/",self.inst_name,": In StateAll method"
- 92 self.sock.send("Read motors state for motor(s) in the motor_to_get_state list")
- 93 self.read_state = self.sock.recv(1024)
- 94
- 95 def StateOne(self,axis):
- 96 print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- 97 one_state = [read_state[axis]]
- 98 return one_state
- 99
- 100 def SetPar(self,axis,name,value):
- 101 if name == 'Acceleration'
- 102 print "Setting acceleration to",value
- 103 elif name == 'Deceleration'
- 104 print "Setting deceleartion to",value
- 105 elif name == 'Velocity'
- 106 print "Setting velocity to",value
- 107 elif name == 'Base_rate'
- 108 print "Setting base_rate to",value
- 109 elif name == 'Step_per_unit'
- 110 print "Setting step_per_unit to",value
- 111 elif name == 'Backlash'
- 112 print "Setting backlash to",value
- 113
- 114 def GetPar(self,axis,name):
- 115 ret_val = 0.0
- 116 if name == 'Acceleration'
- 117 print "Getting acceleration"
- 118 ret_val = 12.34
- 119 elif name == 'Deceleration'
- 120 print "Getting deceleration"
- 121 ret_val = 13.34
- 122 elif name == 'Velocity'
- 123 print "Getting velocity"
- 124 ret_val = 14.34
- 125 elif name == 'Base_rate'
- 126 print "Getting base_rate"
- 127 ret_val = 15.34
- 128 elif name == 'Backlash'
- 129 print "Getting backlash"
- 130 ret_val = 123
- 131 return ret_val
- 132
- 133 def SetExtraAttributePar(self,axis,name,value):
- 134 if name == 'IceAttribute'
- 135 print "Setting IceAttribute to",value
- 136
- 137 def GetExtraAttributePar(self,axis,name):
- 138 ret_val = 0.0
- 139 if name == 'IceAttribute'
- 140 print "Getting IceAttribute"
- 141 ret_val = 12.34
- 142 return ret_val
- 143
- 144 def AbortOne(self,axis):
- 145 print "PYTHON -> IcePapController/",self.inst_name,": Aborting motion for axis:",axis
- 146
- 147 def DefinePosition(self,axis,value):
- 148 print "PYTHON -> IcePapController/",self.inst_name,": Defining position for axis:",axis
- 149
- 150 def __del__(self):
- 151 print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
- 152
- 153 def SendToCtrl(self,in_str)
- 154 print "Python -> MinController/",self.inst_name,": In SendToCtrl method"
- 155 self.sock.send("The input string")
- 156 out_str = self.sock.recv(1024)
- 157 return out_str
-
-Line 6 : Definition of the Python DocString which will also be used
-for the first returned value of the Pool device GetControllerInfo
-command. See chapter
-XXX: Unknown inset LatexCommand \ref{ite:GetControllerInfo:}:
-to get all details about this command.
-Line 11: Definition of the mandatory MaxDevice property set to 128
-Line 12: Definition of the pre-defined feature supported by this
-controller. In this example, only the backlash
-Line 13: Definition of one controller extra feature called IceFeature
-Line 14-17: Definition of 2 properties called host and port
-Line 23-36: The IcePapController constructor code. Note that the
-object attribute host and port automatically created by the property
-management are used on line 32
-Line 39-40: The AddDevice method
-Line 42-43: The DeleteDevice method
-Line 45-48: The PreReadAll method which clears the 2 list read_pos and
-motor_to_read
-Line 50-52: The PreReadOne method. It stores which method has to be
-read in the motor_to_read list
-Line 54-57: The ReadAll method. It send the request to read motor
-positions to the controller and stores the result in the internal
-read_pos list
-Line 59-61: The ReadOne method returning motor position from the
-internal read_pos list
-Line 63-66: The PreStartAll method which clears 2 internal list called
-write_pos and motor_to_write
-Line 68-70: The PreStartOne method
-Line 72-75: The StartOne method which appends in the write_pos and
-motor_to_write list the new motor position and the motor number which
-has to be moved
-Line 77-79: The StartAll method sending the request to the controller
-Line 81-84: The PreStateAll method which clears 2 internal list called
-read_state and motor_to_get_state
-Line 86-88: The PreStateOne method
-Line 90-93: The StateAll method sending the request to the controller
-Line 95-98: The StateOne method returning motor state from the
-internal read_state list
-Line 100-112: The SetPar method managing the acceleration,
-deceleration, velocity, base_rate and backlash attributes (because
-defined in line 11)
-Line 114-131: The GetPar method managing the same 5 parameters plus
-the step_per_unit
-Line 133-135: The SetExtraAttributePar method for the controller extra
-feature defined at line 12
-Line 137-142: The GetExtraAttributePar method for controller extra
-feature
-Line 144-145: The AbortOne method
-Line 147-148: The DefinePosition method
-Line 153-157: The SendToCtrl method
-
-
-Defining available controller features
-""""""""""""""""""""""""""""""""""""""
-
-Four data types and two read_write modes are available for the
-attribute associated with controller features. The possible data type
-are:
-
-- BOOLEAN
-
-- LONG
-
-- DOUBLE
-
-- STRING
-
-The read_write modes are:
-
-- READ
-
-- READ_WRITE
-
-All the attributes created to deal with controller features and
-defined as READ_WRITE will be memorized attributes. This means that
-the attribute will be written with the memorized value just after the
-device creation by the Tango_ layer. The definition of a controller
-features means defining three elements which are the feature name, the
-feature data type and the feature read_write mode. It uses a C++
-structure called MotorFeature with three elements which are a C string
-(const char \*) for the feature name and two enumeration for the
-feature data type and feature read_write mode. All the available
-features are defined as an array of these structures in a file called **MotorFeatures.h**
-
-
-Controller access when creating a motor
-"""""""""""""""""""""""""""""""""""""""
-
-When you create a motor (a new one or at Pool startup time), the calls
-executed on the controller depend if a command "SaveConfig" has
-already been executed for this motor. If the motor is new and the
-command SaveConfig has never been executed for this motor, the
-following controller methods are called:
-
-1. The AddDevice() method
-
-2. The SetPar() method for the Step_per_unit parameter
-
-3. The GetPar() method for the Velocity parameter
-
-4. The GetPar() method for the Acceleration parameter
-
-5. The GetPar() method for the Deceleration parameter
-
-6. The GetPar() method for the Base_rate parameter
-
-If the motor is not new and if a SaveConfig command has been executed
-on this motor, during Pool startup sequence, the motor will be created
-and the following controller methods will be called:
-
-1. The AddDevice() method
-
-2. The SetPar() method for the Step_per_unit parameter
-
-3. The SetPar() method for the Velocity parameter
-
-4. The SetPar() method for the Acceleration parameter
-
-5. The SetPar() method for the Deceleration parameter
-
-6. The SetPar() method for the Base_rate parameter
-
-7. The SetExtraAttributePar() method for each of the memorized motor
- extra attributes
-
-
-The pool motor group interface
-------------------------------
-
-The motor group interface allows the user to move several motor(s) at
-the same time. It supports several attributes and commands. It is
-implemented in C++ and is mainly a set of controller methods call or
-individual motor call. The motor group interface is statically linked
-with the Pool device server. When creating a group, the user can
-define as group member three kinds of elements which are :
-
-1. A simple motor
-
-2. Another already created group
-
-3. A pseudo-motor
-
-Nevertheless, it is not possible to have several times the same
-physical motor within a group. Therefore, each group has a logical
-structure (the one defined by the user when the group is created) and
-a physical structure (the list of physical motors really used in the
-group).
-
-
-The states
-^^^^^^^^^^
-
-The motor group interface knows four states which are ON, MOVING,
-ALARM and FAULT. A motor group device is in MOVING state when one of
-the group element is in MOVING state. It is in ALARM state when one of
-the motor is in ALARM state (The underlying motor has reached one of
-the limit switches). A motor group device is in FAULT state as long as
-any one of the underlying motor is in FAULT state.
-
-
-The commands
-^^^^^^^^^^^^
-
-The motor interface supports 1 command on top of the Tango_ Init, State
-and Status command. This command is summarized in the following table:
-
-============ =============== ================
-Command name Input data type Output data type
-============ =============== ================
-Abort void void
-============ =============== ================
-
-- **Abort** : It aborts a running motion. This command does not have input or
- output argument. It aborts the motion of the motor(s) member of the
- group which are still moving while the command is received.
-
-
-The attributes
-^^^^^^^^^^^^^^
-
-The motor group supports the following attributes:
-
-======== ============================== =========== ========
-Name Data type Data format Writable
-======== ============================== =========== ========
-Position Tango::DevVarDoubleStringArray Spectrum R/W
-======== ============================== =========== ========
-
-- P **osition** : This is a read/write spectrum of double attribute. Each spectrum
- element is the position of one motor. The order of this array is the
- order used when the motor group has been created. The size of this
- spectrum has to be the size corresponding to the motor number when the
- group is created. For instance, for a group created with 2 motors,
- another group of 3 motors and one pseudo-motor, the size of this
- spectrum when written has to be 6 ( 2 + 3 + 1)
-
-
-The properties
-^^^^^^^^^^^^^^
-
-Each motor group has 6 properties. Five of them are automatically
-managed by the pool software and must not be changed by the user.
-These properties are called Motor_group_id, Pool_device, Motor_list,
-User_group_elt and Pos_spectrum_dim_x. The last property called
-Sleep_bef_last_read is a user property.This user property is:
-
-====================== =============
-Property name Default value
-====================== =============
-Sleep_before_last_read 0
-====================== =============
-
-It defines the time in milli-second that the software managing a motor
-group motion will wait between it detects the end of the motion of the
-last group element and the last group motors position reading.
-
-
-Getting motor group state using event
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The simplest way to know if a motor group is moving is to survey its
-state. If the group is moving, its state will be MOVING. When the
-motion is over, its state will be back to ON. The pool motor interface
-allows client interested by group state to use the Tango_ event system
-subscribing to motor group state change event. As soon as a group
-starts a motion, its state is changed to MOVING and an event is sent.
-As soon as the motion is over, the group state is updated ans another
-event is sent. Events will also be sent to each motor element of the
-group when they start moving and when they stop. These events could be
-sent before before the group state change event is sent in case of
-group motion with different motor motion for each group member.
-
-
-Reading the group position attribute
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-For each motor group, the key attribute is its position. Special care
-has been taken on this attribute management. When the motor group is
-not moving (None of the motor are moving), reading the Position
-attribute will generate calls to the controller(s) and therefore
-hardware access. When the motor group is moving (At least one of its
-motor is moving), its position is automatically read every 100 milli-
-seconds and stored in the Tango_ polling buffer. This means that a
-client reading motor group Position attribute while the group is
-moving will get the position from the Tango_ polling buffer and will
-not generate extra controller calls. It is also possible to get a
-group position using the Tango_ event system. When the group is moving,
-an event is sent to the registered clients when the change event
-criterion is true. By default, this change event criterion is set to
-be a difference in position of 5. It is tunable on a group basis using
-the classical group Position attribute "abs_change" property or at the
-pool device basis using its DefaultMotGrpPos_AbsChange property.
-Anyway, not more than 10 events could be sent by second. Once the
-motion is over (None of the motors within the group are moving), the
-group position is made unavailable from the Tango_ polling buffer and
-is read a last time after a tunable waiting time (Sleep_bef_last_read
-property). A forced change event with this value is sent to clients
-using events.
-
-
-The ghost motor group
-^^^^^^^^^^^^^^^^^^^^^
-
-In order to allow pool client software to be entirely event based,
-some kind of polling has to be done on each motor to inform them on
-state change which are not related to motor motion. To achieve this
-goal, one internally managed motor group is created. Each pool motor
-is a member of this group. The Tango_ polling thread polls the state
-command of this group (Polling period tunable with the pool
-Ghostgroup_PollingPeriod property). The code of this group state
-command detects change in every motor state and send a state change
-event on the corresponding motor. This motor group is not available to
-client and is even not defined in the Tango_ database. This is why it
-is called the ghost group.
-
-
-The pool pseudo motor interface
--------------------------------
-
-The pseudo motor interface acts like an abstraction layer for a motor
-or a set of motors allowing the user to control the experiment by
-means of an interface which is more meaningful to him(her).
-
-Each pseudo motor is represented by a C++ written tango device whose
-interface allows for the control of a single position (scalar value).
-
-In order to translate the motor positions into pseudo positions and
-vice versa, calculations have to be performed. The device pool
-provides a python API class that can be overwritten to provide new
-calculations.
-
-
-The states
-^^^^^^^^^^
-
-The pseudo motor interface knows four states which are ON, MOVING,
-ALARM and FAULT. A pseudo motor device is in MOVING state when at
-least one motor is in MOVING state. It is in ALARM state when one of
-the motor is in ALARM state (The underlying motor has reached one of
-the limit switches. A pseudo motor device is in FAULT state as long as
-any one of the underlying motor is in FAULT state).
-
-
-The commands
-^^^^^^^^^^^^
-
-The pseudo motor interface supports 1 command on top of the Tango
-Init, State and Status commands. This command is summarized in the
-following table:
-
-============ =============== ================
-Command name Input data type Output data type
-============ =============== ================
-Abort void void
-============ =============== ================
-
-- **Abort** : It aborts a running movement. This command does not have input or
- output argument. It aborts the movement of the motor(s) member of the
- pseudo motor which are still moving while the command is received.
-
-
-The attributes
-^^^^^^^^^^^^^^
-
-The pseudo motor supports the following attributes:
-
-======== ================ =========== ========
-Name Data type Data format Writable
-======== ================ =========== ========
-Position Tango::DevDouble Scalar R/W
-======== ================ =========== ========
-
-- **Position** : This is read-write scalar double attribute. With the classical Tango
- min and max_value, it is easy to define authorized limit for this
- attribute. It is not allowed to read or write this attribute when the
- pseudo motor is in FAULT or UNKNOWN state. It is also not possible to
- write this attribute when the motor is already MOVING.
-
-
-The PseudoMotor system class
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This chapter describes how to write a valid python pseudo motor system
-class.
-
-
-Prerequisites
-"""""""""""""
-
-Before writing the first python pseudo motor class for your device
-pool two checks must be performed:
-
-1. The device pool **PoolPath** property must exist and must point to the directory which will contain
- your python pseudo motor module. The syntax of this PseudoPath
- property is the same used in the PATH or PYTHONPATH environment
- variables. Please see
- XXX: Unknown inset LatexCommand \ref{sub:PoolPath}:
- for more information on setting this property
-
-2. A PseudoMotor.py file is part of the device pool distribution and is
- located in <device pool home dir>/py_pseudo. This directory must be in
- the PYTHONPATH environment variable or it must be part of the **PoolPath** device pool property metioned above
-
-
-Rules
-"""""
-
-A correct pseudo motor system class must obey the following rules:
-
-1. the python class PseudoMotor of the PseudoMotor module must be
- imported into the current namespace by using one of the python import
- statements:
-
-
-
- ::
-
- from PseudoMotor import *
- import PseudoMotor or
- from PseudoMotor import PseudoMotor or
-
-
-2. the pseudo motor system class being written must be a subclass of the
- PseudoMotor class (see example below)
-
-3. the class variable **motor_roles** must be set to be a tuple of text descriptions containing each motor
- role description. It is crucial that all necessary motors contain a
- textual description even if it is an empty one. This is because the
- number of elements in this tuple will determine the number of required
- motors for this pseudo motor class. The order in which the roles are
- defined is also important as it will determine the index of the motors
- in the pseudo motor system.
-
-4. the class variable **pseudo_motor_roles** must be set if the pseudo motor class being written represents more
- than one pseudo motor. The order in which the roles are defined will
- determine the index of the pseudo motors in the pseudo motor system.
- If the pseudo motor class represents only one pseudo motor then this
- operation is optional. If omitted the value will of pseudo_motor_roles
- will be set to:
-
-
-5. if the pseudo motor class needs some special parameters then the class
- variable parameters must be set to be a dictionary of <parameter name>
- : { <property> : <value> } values where:
-
- <parameter name> - is a string representing the name of the parameter
-
- <property> - is one of the following mandatory properties:
- 'Description', 'Type'. The 'Default Value' property is optional.
-
- <value> - is the corresponding value of the property. The
- 'Description' can contain any text value. The 'Type' must be one of
- available Tango_ property data types and 'Default Value' must be a
- string containning a valid value for the corresponding 'Type' value.
-
-
-6. the pseudo motor class must implement a **calc_pseudo** method with the following signature:
-
-
-
- ::
-
- number = calc_pseudo(index, physical_pos, params = None)
-
- The method will receive as argument the index of the pseudo motor for
- which the pseudo position calculation is requested. This number refers
- to the index in the pseudo_motor_roles class variable.
-
- The physical_pos is a tuple containing the motor positions.
-
- The params argument is optional and will contain a dictionary of
- <parameter name> : <value>.
-
- The method body should contain a code to translate the given motor
- positions into pseudo motor positions.
-
- The method will return a number representing the calculated pseudo
- motor position.
-
-
-7. the pseudo motor class must implement a **calc_physical** method with the following signature:
-
-
-
- ::
-
- number = calc_physical(index, pseudo_pos, params = None)
-
- The method will receive as argument the index of the motor for which
- the physical position calculation is requested. This number refers to
- the index in the motor_roles class variable.
-
- The pseudo_pos is a tuple containing the pseudo motor positions.
-
- The params argument is optional and will contain a dictionary of
- <parameter name> : <value>.
-
- The method body should contain a code to translate the given pseudo
- motor positions into motor positions.
-
- The method will return a number representing the calculated motor
- position.
-
-
-8. Optional implementation of **calc_all_pseudo** method with the following signature:
-
-
-
- ::
-
- ()/[]/number = calc_all_pseudo(physical_pos,params = None)
-
- The method will receive as argument a physical_pos which is a tuple of
- motor positions.
-
- The params argument is optional and will contain a dictionary of
- <parameter name> : <value>.
-
- The method will return a tuple or a list of calculated pseudo motor
- positions. If the pseudo motor class represents a single pseudo motor
- then the return value could be a single number.
-
-
-9. Optional implementation of **calc_all_physical** method with the following signature:
-
-
-
- ::
-
- ()/[]/number = calc_all_physical(pseudo_pos, params = None)
-
- The method will receive as argument a pseudo_pos which is a tuple of
- pseudo motor positions.
-
- The params argument is optional and will contain a dictionary of
- <parameter name> : <value>.
-
- The method will return a tuple or a list of calculated motor
- positions. If the pseudo motor class requires a single motor then the
- return value could be a single number.
-
-
-**Note:** The default implementation **calc_all_physical** and **calc_all_pseudo** methods will call calc_physical and calc_pseudo for each motor and
-physical motor respectively. Overwriting the default implementation
-should only be done if a gain in performance can be obtained.
-
-
-Example
-^^^^^^^
-
-One of the most basic examples is the control of a slit. The slit has
-two blades with one motor each. Usually the user doesn't want to
-control the experiment by directly handling these two motor positions
-since their have little meaning from the experiments perspective.
-
-
-.. image:: /_static/gap_offset.png
-
-
-
-Instead, it would be more useful for the user to control the
-experiment by means of changing the gap and offset values. Pseudo
-motors gap and offset will provide the necessary interface for
-controlling the experiments gap and offset values respectively.
-
-The calculations that need to be performed are:
-
-
-
-.. math::
- :nowrap:
-
- \[ \left\{ \begin{array}{l} gap=sl2t+sl2b\\ offset=\frac{sl2t-sl2b}{2}\end{array}\right.\]
-
-
-
-.. math::
- :nowrap:
-
- \[ \left\{ \begin{array}{l} sl2t=-offset+\frac{gap}{2}\\ sl2b=offset+\frac{gap}{2}\end{array}\right.\]
-
-
-
-The corresponding python code would be:
-
-
-
-::
-
-
- 01 class Slit(PseudoMotor):
- 02 """A Slit system for controlling gap and offset pseudo motors."""
- 04
- 05 pseudo_motor_roles = ("Gap", "Offset")
- 06 motor_roles = ("Motor on blade 1", "Motor on blade 2")
- 07
- 08 def calc_physical(self,index,pseudo_pos,params = None):
- 09 half_gap = pseudo_pos[0]/2.0
- 10 if index == 0:
- 11 return -pseudo_pos[1] + half_gap
- 12 else
- 13 return pseudo_pos[1] + half_gap
- 14
- 15 def calc_pseudo(self,index,physical_pos,params = None):
- 16 if index == 0:
- 17 return physical_pos[1] + physical_pos[0]
- 18 else:
- 19 return (physical_pos[1] - physical_pos[0])/2.0
-
-
-read gap position diagram
-"""""""""""""""""""""""""
-
-The following diagram shows the sequence of operations performed when
-the position is requested from the gap pseudo motor:
-
-
-.. image:: /_static/gap_read.png
-
-
-
-
-write gap position diagram
-""""""""""""""""""""""""""
-
-The following diagram shows the sequence of operations performed when
-a new position is written to the gap pseudo motor:
-
-
-.. image:: /_static/gap_write.png
-
-
-The Counter/Timer interface
----------------------------
-
-
-The Counter/Timer user interface
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The Counter/Timer interface is statically linked with the Pool device
-server and supports several attributes and commands. It is implemented
-in C++ and used a set of the so-called "controller" methods. The
-Counter/Timer interface is always the same whatever the hardware is.
-This is the rule of the "controller" to access the hardware using the
-communication link supported by the hardware (network link, Serial
-line...).
-
-The controller code has a well-defined interface and can be written
-using Python or C++. In both cases, it will be dynamically loaded into
-the pool device server process.
-
-
-The states
-""""""""""
-
-The Counter/Timer interface knows four states which are `ON`, *MOVING*,
-**FAULT** and UNKNOWN. A Counter/Timer device is in MOVING state when it
-is counting! It is in FAULT if its controller software is not
-available (impossible to load it), if a fault is reported from the
-hardware controller or if the controller software returns an
-unforeseen state. The device is in the UNKNOWN state if an exception
-occurs during the communication between the pool and the hardware
-controller.
-
-
-The commands
-""""""""""""
-
-The Counter/Timer interface supports 2 commands on top of the Tango
-classical Init, State and Status commands. These commands are
-summarized in the following table:
-
-============ =============== ================
-Command name Input data type Output data type
-============ =============== ================
-Start void void
-Stop void void
-============ =============== ================
-
-
-- **Start** : When the device is used as a counter, this commands allows the
- counter to start counting. When it is used as a timer, this command
- starts the timer. This command changes the device state from ON to
- MOVING. It is not allowed to execute this command if the device is
- already in the MOVING state.
-
-- **Stop** : When the device is used as a counter, this commands stops the
- counter. When it is used as a timer, this command stops the timer.
- This commands changes the device state from MOVING to ON. It is a no
- action command if this command is received and the device is not in
- the MOVING state.
-
-
-The attributes
-""""""""""""""
-
-The Counter/Timer interface supports several attributes which are
-summarized in the following table:
-
-============== ================= =========== ======== ========= ==========
-Name Data type Data format Writable Memorized Ope/Expert
-============== ================= =========== ======== ========= ==========
-Value Tango::DevDouble Scalar R/W No Ope
-SimulationMode Tango::DevBoolean Scalar R No Ope
-============== ================= =========== ======== ========= ==========
-
-- **Value** : This is read-write scalar double attribute. Writing the value is
- used to clear (or to preset) a counter or to set a timer time. For
- counter, reading the value allows the user to get the count number.
- For timer, the read value is the elapsed time since the timer has been
- started. After the acquisition, the value stays unchanged until a new
- count/time is started. For timer, the unit of this attribute is the
- second.
-
-- **SimulationMode** : This is a read only scalar boolean attribute. When set, all the
- counting/timing requests are not forwarded to the software controller
- and then to the hardware. When set, the device Value is always 0. To
- set this attribute, the user has to used the pool device Tango
- interface. It is not allowed to read this attribute when the device is
- in FAULT or UNKNOWN states.
-
-
-The properties
-""""""""""""""
-
-Each Counter/Timer device has one property which is automatically
-managed by the pool software and must not be changed by the user. This
-property is named Channel_id.
-
-
-The Counter/Timer controller
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The CounterTimer controller follows the same principles already
-explained for the Motor controller in chapter
-XXX: Unknown inset LatexCommand \ref{sub:The-Motor-Controller}:
-
-
-
-The basic
-"""""""""
-
-For Counter/Timer, the pre-defined set of methods which has to be
-implemented can be splitted in 7 different types which are:
-
-1. Methods to create/remove counter/timer experiment channel
-
-2. Methods to get channel(s) state
-
-3. Methods to read channel(s)
-
-4. Methods to load channel(s)
-
-5. Methods to start channel(s)
-
-6. Methods to configure a channel
-
-7. Remaining method
-
-
-The CounterTimer controller features
-""""""""""""""""""""""""""""""""""""
-
-Not defined yet
-
-
-The CounterTimer controller extra attributes
-""""""""""""""""""""""""""""""""""""""""""""
-
-The definition is the same than the one defined for Motor controller
-and explained in chapter
-XXX: Unknown inset LatexCommand \ref{par:Specifying-the-motor}:
-
-
-
-Methods to create/remove Counter Timer Channel
-""""""""""""""""""""""""""""""""""""""""""""""
-
-Two methods are called when creating or removing counter/timer channel
-from a controller. These methods are called **AddDevice** and **DeleteDevice** . The AddDevice method is called when a new channel belonging to the
-controller is created within the pool. The DeleteDevice method is
-called when a channel belonging to the controller is removed from the
-pool.
-
-
-Method(s) to get Counter Timer Channel state.
-"""""""""""""""""""""""""""""""""""""""""""""
-
-These methods follow the same definition than the one defined for
-Motor controller which are detailed in chapter
-XXX: Unknown inset LatexCommand \ref{par:Methods-to-get-state}:
-.
-
-
-Method(s) to read Counter Timer Experiment Channel
-""""""""""""""""""""""""""""""""""""""""""""""""""
-
-Four methods are used when a request to read channel(s) value is
-received. These methods are called PreReadAll, PreReadOne, ReadAll and
-ReadOne. The algorithm used to read value of one or several channels
-is the following :
-
-
-
-::
-
- /FOR/ Each controller(s) implied in the reading
- - Call PreReadAll()
- /END FOR/
-
- /FOR/ Each channel(s) implied in the reading
- - PreReadOne(channel to read)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the reading
- - Call ReadAll()
- /END FOR/
-
- /FOR/ Each channel(s) implied in the reading
- - Call ReadOne(channel to read)
- /END FOR/
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ ===================================== ================================= =================================================================
- PreReadAll() PreReadOne() ReadAll() ReadOne()
-==================== ================================ ===================================== ================================= =================================================================
-Default action Does nothing Does nothing Does nothing Print message on the screen and returns NaN. Mandatory for Python
-Externally called by Reading the Value attribute Reading the Value attribute Reading the Value attribute Reading the Value attribute
-Internally called Once for each implied controller For each implied channel For each implied controller Once for each implied channel
-Typical rule Init internal data for reading Memorize which channel has to be read Send order to physical controller Return channel value from internal data
-==================== ================================ ===================================== ================================= =================================================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to read several channels positions at the same
-time. For some simpler controller, it is possible to implement only
-the ReadOne() method. The default implementation of the three
-remaining methods is defined in a way that the algorithm works even in
-such a case.
-
-
-Method(s) to load Counter Timer Experiment Channel
-""""""""""""""""""""""""""""""""""""""""""""""""""
-
-Four methods are used when a request to load channel(s) value is
-received. These methods are called PreLoadAll, PreLoadOne, LoadAll and
-LoadOne. The algorithm used to load value in one or several channels
-is the following::
-
- /FOR/ Each controller(s) implied in the loading
- - Call PreLoadAll()
- /END FOR/
-
- /FOR/ Each channel(s) implied in the loading
- - ret = PreLoadOne(channel to load,new channel value)
- - /IF/ ret is true
- - Call LoadOne(channel to load, new channel value)
- - /END IF/
- /END FOR/
-
- /FOR/ Each controller(s) implied in the loading
- - Call LoadAll()
- /END FOR/
-
-
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ ============================= ====================================== =================================
- PreLoadAll() PreLoadOne() LoadOne() LoadAll()
-==================== ================================ ============================= ====================================== =================================
-Default action Does nothing Returns true Does nothing Does nothing
-Externally called by Writing the Value attribute Writing the Value attribute Writing the Value attribute Writing the Value attribute
-Internally called Once for each implied controller For each implied channel For each implied channel Once for each implied controller
-Typical rule Init internal data for loading Check if counting is possible Set new channel value in internal data Send order to physical controller
-==================== ================================ ============================= ====================================== =================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to write several channels positions at the same
-time. For some simpler controller, it is possible to implement only
-the LoadOne() method. The default implementation of the three
-remaining methods is defined in a way that the algorithm works even in
-such a case.
-
-
-Method(s) to start Counter Timer Experiment Channel
-"""""""""""""""""""""""""""""""""""""""""""""""""""
-
-Four methods are used when a request to start channel(s) is received.
-These methods are called PreStartAllCT, PreStartOneCT, StartAllCT and
-StartOneCT. The algorithm used to start one or several channels is the
-following::
-
- /FOR/ Each controller(s) implied in the starting
- - Call PreStartAllCT()
- /END FOR/
-
- /FOR/ Each channel(s) implied in the starting
- - ret = PreStartOneCT(channel to start)
- - /IF/ ret is true
- - Call StartOneCT(channel to start)
- - /END IF/
- /END FOR/
-
- /FOR/ Each controller(s) implied in the starting
- - Call StartAllCT()
- /END FOR/
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ ============================= ====================================== =================================
- PreStartAllCT() PreStartOneCT() StartOneCT() StartAllCT()
-==================== ================================ ============================= ====================================== =================================
-Default action Does nothing Returns true Does nothing Does nothing
-Externally called by The Start command The Start command The Start command The Start command
-Internally called Once for each implied controller For each implied channel For each implied channel Once for each implied controller
-Typical rule Init internal data for starting Check if starting is possible Set new channel value in internal data Send order to physical controller
-==================== ================================ ============================= ====================================== =================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to write several channels positions at the same
-time. For some simpler controller, it is possible to implement only
-the StartOneCT() method. The default implementation of the three
-remaining methods is defined in a way that the algorithm works even in
-such a case.
-
-
-Methods to configure Counter Timer Experiment Channel
-"""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-The rule of these methods is to
-
-- Get or Set channel extra attribute(s) parameter with methods called
- GetExtraAttributePar() or SetExtraAttributePar()
-
-The following table summarizes the usage of these methods:
-
-========= ================================================= =====================================================
- GetExtraAttributePar() SetExtraAttributePar()
-========= ================================================= =====================================================
-Called by Reading any of the extra attributes Writing any of the extra attributes
-Rule Get extra attribute value from the physical layer Set additional attribute value in physical controller
-========= ================================================= =====================================================
-
-
-The GetExtraAttributePar() default implementation returns a string set
-to "Pool_meth_not_implemented".
-
-
-Remaining methods
-"""""""""""""""""
-
-The rule of the remaining methods is to
-
-- Send a raw string to the controller with a method called SendToCtrl()
-
-- Abort a counting counter/timer with a method called AbortOne()
-
-The following table summarizes the usage of this method:
-
-========= ========================================================================= =============================
- SendToCtrl() AbortOne()
-========= ========================================================================= =============================
-Called by The Pool SendToController command The Stop CounterTimer command
-Rule Send the input string to the controller and returns the controller answer Abort a running count
-========= ========================================================================= =============================
-
-The Counter Timer controller properties (including the MaxDevice
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-property)
-
-The definition is the same than the one defined for Motor controller
-and explained in chapter
-XXX: Unknown inset LatexCommand \ref{par:Controller-properties}:
-
-
-
-C++ controller
-""""""""""""""
-
-For C++, the controller code is implemented as a set of classes: A
-base class called **Controller** and a class called **CoTiController** which inherits from Controller. Finally, the user has to write its
-controller class which inherits from CoTiController. The Controller
-class has already been detailed in
-XXX: Unknown inset LatexCommand \ref{sub:The-Cpp-Controller-class}:
-.
-
-
-XXX: Unknown layout Subparagraph: The CoTiController class
-The CoTiController class defines thirteen virtual methods which are:
-
-1. void **CoTiController::PreReadAll** ()
- The default implementation does nothing
-
-2. void **CoTiController::PreReadOne** (long idx_to_read)
- The default implementation does nothing
-
-3. void **CoTiController::ReadAll** ()
- The default implementation does nothing
-
-4. double **CoTiController::ReadOne** (long idx_to_read)
- The default implementation prints a message on the screen and return a
- NaN value
-
-5. void **CoTiController::PreLoadAll** ()
- The default implementation does nothing
-
-6. bool **CoTiController::PreLoadOne** (long idx_to_load,double new_value)
- The default implementation returns true
-
-7. void **CoTiController::LoadOne** (long idx_to_load,double new_value)
- The default implementation does nothing
-
-8. void **CoTiController::LoadAll** ()
- The default implementation does nothing
-
-9. void **CoTiController::PreStartAllCT** ()
- The default implementation does nothing
-
-10. bool **CoTiController::PreStartOneCT** (long idx_to_start)
- The default implementation returns true
-
-11. void **CoTiController::StartOneCT** (long idx_to_start)
- The default implementation does nothing
-
-12. void **CoTiController::StartAllCT** ()
- The default implementation does nothing
-
-13. void **CoTiController::AbortOne** (long idx_to_abort)
- The default implementation does nothing
-
-This class has one constructor which is
-
-1. **CoTiController::CoTiController** (const char \*)
- Constructor of the CoTiController class with the controller instance
- name as parameter
-
-
-XXX: Unknown layout Subparagraph: The user controller class
-The user has to implement the remaining pure virtual methods
-(AddDevice and DeleteDevice) and has to re-define virtual methods if
-the default implementation does not cover his needs. The controller
-code has to define two global variables which are:
-
-1. **CounterTimer_Ctrl_class_name** : This is an array of classical C strings terminated by a NULL
- pointer. Each array element is the name of a Counter Timer Channel
- controller defined in the file.
-
-2. **<CtrlClassName>_MaxDevice** : Idem motor controller definition
-
-On top of that, a controller code has to define a C function to create
-the controller object. This is similar to the Motor controller
-definition which is documented in
-XXX: Unknown inset LatexCommand \ref{par:The-user-controller}:
-
-
-
-Python controller
-"""""""""""""""""
-
-The principle is exactly the same than the one used for C++ controller
-but we don't have pure virtual methods with a compiler checking if
-they are defined at compile time. Therefore, it is the pool software
-which checks that the following methods are defined within the
-controller class when the controller module is loaded (imported):
-
-- AddDevice
-
-- DeleteDevice
-
-- ReadOne method
-
-- StateOne method
-
-- StartOneCT or StartAllCT method
-
-- LoadOne or LoadAll method
-
-With Python controller, there is no need for function to create
-controller class instance. With the help of the Python C API, the pool
-device is able to create the needed instances. Note that the
-StateOne() method does not have the same signature for Python
-controller.
-
-1. tuple **Stat** e **One** (self,idx_number)
- Get a channel state. The method has to return a tuple with one or two
- elements which are:
-
- 1. The channel state (as defined by Tango)
-
- 2. A string describing the motor fault if the controller has this
- feature.
-
-
-A Python controller class has to inherit from a class called
-**CounterTimerController** . This does not add any feature but allows the pool
-software to realize that this class is a Counter Timer Channel controller.
-
-
-The Unix Timer
---------------
-
-A timer using the Unix getitimer() and setitimer() system calls is
-provided. It is a Counter/Timer C++ controller following the
-definition of the previous chapter. Therefore, the device created
-using this controller will have the Tango_ interface as the one
-previously described.
-
-The Unix Timer controller shared library is called **UxTimer.so** and the
-Controlller class is called **UnixTimer** . This controller is foresee to
-have only one device (MaxDevice = 1)
-
-
-The ZeroDExpChannel interface
------------------------------
-
-The ZeroDExpChannel is used to access any kind of device which returns
-a scalar value and which are not counter or timer. Very often (but not
-always), this is a commercial measurement equipment connected to a
-GPIB bus. In order to have a precise as possible measurement, an
-acquisition loop is implemented for these ZeroDExpChannel device. This
-acquisition loop will simply read the data from the hardware as fast
-as it can (only "sleeping" 20 mS between each reading) and a
-computation is done on the resulting data set to return only one
-value. Three types of computation are foreseen. The user selects which
-one he needs with an attribute. The time during which this acquisition
-loop will get data is also defined by an attribute
-
-
-The ZeroDExpChannel user interface
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The ZeroDExpChannel interface is statically linked with the Pool
-device server and supports several attributes and commands. It is
-implemented in C++ and used a set of the so-called "controller"
-methods. The ZeroDExpChannel interface is always the same whatever the
-hardware is. This is the rule of the "controller" to access the
-hardware using the communication link supported by the hardware
-(network link, GPIB...).
-
-The controller code has a well-defined interface and can be written
-using Python or C++. In both cases, it will be dynamically loaded into
-the pool device server process.
-
-
-The states
-""""""""""
-
-The ZeroDExpChannel interface knows five states which are ON, MOVING,
-ALARM, FAULT and UNKNOWN. A ZeroDExpChannel device is in MOVING state
-when it is acquiring data! It is in ALARM state when at least one
-error has occured during the last acquisition. It is in FAULT if its
-controller software is not available (impossible to load it), if a
-fault is reported from the hardware controller or if the controller
-software returns an unforeseen state. The device is in the UNKNOWN
-state if an exception occurs during the communication between the pool
-and the hardware controller.
-
-
-The commands
-""""""""""""
-
-The ZeroDExpChannel interface supports 2 commands on top of the Tango
-classical Init, State and Status commands. These commands are
-summarized in the following table:
-
-============ =============== ================
-Command name Input data type Output data type
-============ =============== ================
-Start void void
-Stop void void
-============ =============== ================
-
-- **Start** : Start the acquisition for the time defined by the attribute
- CumulatedTime. If the CumulatedTime attribute value is 0, the
- acquisition will not automatically stop until a Stop command is
- received. This command changes the device state from ON to MOVING. It
- is not allowed to execute this command if the device is already in the
- MOVING state.
-
-- **Stop** : Stop the acquisition. This commands changes the device state from
- MOVING to ON. It is a no action command if this command is received
- and the device is not in the MOVING state.
-
-
-The attributes
-""""""""""""""
-
-The ZeroDExpChannel interface supports several attributes which are
-summarized in the following table:
-
-===================== ================= =========== ======== ========= ==========
-Name Data type Data format Writable Memorized Ope/Expert
-===================== ================= =========== ======== ========= ==========
-Value Tango::DevDouble Scalar R No Ope
-CumulatedValue Tango::DevDouble Scalar R No Ope
-CumulationTime Tango::DevDouble Scalar R/W Yes Ope
-CumulationType Tango::DevLong Scalar R/W Yes Ope
-CumulatedPointsNumber Tango::DevLong Scalar R No Ope
-CumulatedPointsError Tango::DevLong Scalar R No Ope
-SimulationMode Tango::DevBoolean Scalar R No Ope
-===================== ================= =========== ======== ========= ==========
-
-- **Value** : This is read scalar double attribute. This is the live value reads
- from the hardware through the controller
-
-- **CumulatedValue** : This is a read scalar double attribute. This is the result of the
- data acquisition after the computation defined by the CumulationType
- attribute has been applied. This value is 0 until an acquisition has
- been started. After an acquisition, the attribute value stays
- unchanged until the next acquisition is started. If during the
- acquisition some error(s) has been received while reading the data,
- the attribute quality factor will be set to ALARM
-
-- **CumulationTime** : This is a read-write scalar double and memorized attribute. This is
- the acquisition time in seconds. The acquisition will automatically
- stops after this CumulationTime. Very often, reading the hardware
- device to get one data is time-consuming and it is not possible to
- read the hardware a integer number of times within this
- CumulationTime. A device property called StopIfNoTime (see
- XXX: Unknown inset LatexCommand \ref{ite:StopIfNoTime:-A-boolean}:
- ) allows the user to tune the acquisition loop.
-
-- **CumulationType** : This a read-write scalar long and memorized attribute. Defines the
- computation type done of the values gathered during the acquisition.
- Three type of computation are supported:
-
- 1. Sum: The CumulatedValue attribute is the sum of all the data read
- during the acquisition. This is the default type.
-
- 2. Average: The CumulatedValue attribute is the average of all the data
- read during the acquisition
-
- 3. Integral: The CumulatedValue attribute is a type of the integral of
- all the data read during the acquisition
-
-
-- **CumulatedPointsNumber** : This is a read scalar long attribute. This is the number of data
- correctly read during the acquisition. The attribute value is 0 until
- an acquisition has been started and stay unchanged between the end of
- the acquisition and the start of the next one.
-
-- **CumulatedPointsError** : This is a read scalar long attribute. This is the number of times it
- was not possible to read the data from the hardware due to error(s).
- The property ContinueOnError allows the user to define what to do in
- case of error. The attribute value is 0 until an acquisition has been
- started and stay unchanged between the end of the acquisition and the
- start of the next one.
-
-- **SimulationMode** : This is a read only scalar boolean attribute. When set, all the
- acquisition requests are not forwarded to the software controller and
- then to the hardware. When set, the device Value, CumulatedValue,
- CumulatedPointsNumber and CumulatedPointsError are always 0. To set
- this attribute, the user has to used the pool device Tango_ interface.
- The value of the CumulationTime and CumulationType attributes are
- memorized at the moment this attribute is set. When this mode is
- turned off, if the value of any of the previously memorized attributes
- has changed, it is reapplied to the memorized value. It is not allowed
- to read this attribute when the device is in FAULT or UNKNOWN states.
-
-
-The properties
-""""""""""""""
-
-Each ZeroDExpChannel device has a set of properties. One of these
-properties is automatically managed by the pool software and must not
-be changed by the user. This property is named Channel_id. The user
-properties are:
-
-=============== =============
-Property name Default value
-=============== =============
-StopIfNoTime true
-ContinueOnError true
-=============== =============
-
-- XXX: Unknown inset LatexCommand \label{ite:StopIfNoTime:-A-boolean}:
- **StopIfNoTime** : A boolean property. If this property is set to true, the acquisition
- loop will check before acquiring a new data that it has enough time to
- do this. To achieve this, the acquisition loop measures the time
- needed by the previous data read and checks that the actual time plus
- the acquisition time is still less than the CumulationTime. If not,
- the acquisition stops. When this property is set to false, the
- acquisition stops when the acquisition time is greater or equal than
- the CumulationTime
-
-- **ContinueOnError** : A boolean property. If this property is set to true (the default),
- the acquisition loop continues reading the data even after an error
- has been received when trying to read data. If it is false, the
- acquisition stops as soon as an error is detected when trying to read
- data from the hardware.
-
-
-Getting ZeroDExpChannel state using event
-"""""""""""""""""""""""""""""""""""""""""
-
-The simplest way to know if a Zero D Experiment Channel is acquiring
-data is to survey its state. If the device is acquiring data, its
-state will be MOVING. When the acquisition is over, its state will be
-back to ON. The pool ZeroDExpChannel interface allows client
-interested by Experiment Channel state value to use the Tango_ event
-system subscribing to channel state change event. As soon as a channel
-starts an acquisition, its state is changed to MOVING and an event is
-sent. As soon as the acquisition is over (for one reason or another),
-the channel state is updated and another event is sent.
-
-
-XXX: Unknown inset LatexCommand \label{par:Reading-the-ZeroDExpChannel}:
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-Reading the ZeroDExpChannel CumulatedValue attribute
-
-During an acquisition, events with CumulatedValue attribute are sent
-from the device server to the interested clients. The acquisition loop
-will periodically read this event and fire an event. The first and the
-last events fired during the acquisition loop do not check the change
-event criteria. The other during the acquisition loop check the change
-event criteria
-
-
-The ZeroDExpChannel Controller
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The ZeroDExpChannel controller follows the same principles already
-explained for the Motor controller in chapter
-XXX: Unknown inset LatexCommand \ref{sub:The-Motor-Controller}:
-
-
-
-The basic
-"""""""""
-
-For Zero Dimension Experiment Channel, the pre-defined set of methods
-which has to be implemented can be splitted in 5 different types which
-are:
-
-1. Methods to create/remove zero dimension experiment channel
-
-2. Methods to get channel(s) state
-
-3. Methods to read channel(s)
-
-4. Methods to configure a channel
-
-5. Remaining method
-
-
-The ZeroDExpChannel controller features
-"""""""""""""""""""""""""""""""""""""""
-
-Not defined yet
-
-
-The ZeroDExpChannel controller extra attributes
-"""""""""""""""""""""""""""""""""""""""""""""""
-
-The definition is the same than the one defined for Motor controller
-and explained in chapter
-XXX: Unknown inset LatexCommand \ref{par:Specifying-the-motor}:
-
-
-
-Methods to create/remove Zero D Experiment Channel
-""""""""""""""""""""""""""""""""""""""""""""""""""
-
-Two methods are called when creating or removing experiment channel
-from a controller. These methods are called **AddDevice** and **DeleteDevice** . The AddDevice method is called when a new channel belonging to the
-controller is created within the pool. The DeleteDevice method is
-called when a channel belonging to the controller is removed from the
-pool.
-
-
-Method(s) to get Zero D Experiment Channel state.
-"""""""""""""""""""""""""""""""""""""""""""""""""
-
-These methods follow the same definition than the one defined for
-Motor controller which are detailed in chapter
-XXX: Unknown inset LatexCommand \ref{par:Methods-to-get-state}:
-.
-
-
-Method(s) to read Zero D Experiment Channel
-"""""""""""""""""""""""""""""""""""""""""""
-
-Four methods are used when a request to read channel(s) value is
-received. These methods are called PreReadAll, PreReadOne, ReadAll and
-ReadOne. The algorithm used to read value of one or several channels
-is the following::
-
- /FOR/ Each controller(s) implied in the reading
- - Call PreReadAll()
- /END FOR/
-
- /FOR/ Each channel(s) implied in the reading
- - PreReadOne(channel to read)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the reading
- - Call ReadAll()
- /END FOR/
-
- /FOR/ Each channel(s) implied in the reading
- - Call ReadOne(channel to read)
- /END FOR/
-
-The following array summarizes the rule of each of these methods:
-
-==================== ================================ ===================================== ================================= =================================================================
- PreReadAll() PreReadOne() ReadAll() ReadOne()
-==================== ================================ ===================================== ================================= =================================================================
-Default action Does nothing Does nothing Does nothing Print message on the screen and returns NaN. Mandatory for Python
-Externally called by Reading the Value attribute Reading the Value attribute Reading the Value attribute Reading the Value attribute
-Internally called Once for each implied controller For each implied channel For each implied controller Once for each implied channel
-Typical rule Init internal data for reading Memorize which channel has to be read Send order to physical controller Return channel value from internal data
-==================== ================================ ===================================== ================================= =================================================================
-
-This algorithm covers the sophisticated case where a physical
-controller is able to read several channels positions at the same
-time. For some simpler controller, it is possible to implement only
-the ReadOne() method. The default implementation of the three
-remaining methods is defined in a way that the algorithm works even in
-such a case.
-
-
-Methods to configure Zero D Experiment Channel
-""""""""""""""""""""""""""""""""""""""""""""""
-
-The rule of these methods is to
-
-- Get or Set channel extra attribute(s) parameter with methods called
- GetExtraAttributePar() or SetExtraAttributePar()
-
-The following table summarizes the usage of these methods:
-
-========= ================================================= =====================================================
- GetExtraAttributePar() SetExtraAttributePar()
-========= ================================================= =====================================================
-Called by Reading any of the extra attributes Writing any of the extra attributes
-Rule Get extra attribute value from the physical layer Set additional attribute value in physical controller
-========= ================================================= =====================================================
-
-
-The GetExtraAttributePar() default implementation returns a string set
-to "Pool_meth_not_implemented".
-
-
-Remaining method
-""""""""""""""""
-
-The rule of the remaining method is to
-
-- Send a raw string to the controller with a method called SendToCtrl()
-
-The following table summarizes the usage of this method:
-
-========= =========================================================================
- SendToCtrl()
-========= =========================================================================
-Called by The Pool SendToController command
-Rule Send the input string to the controller and returns the controller answer
-========= =========================================================================
-
-The ZeroDExpChannel controller properties (including the MaxDevice property)
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-
-
-The definition is the same than the one defined for Motor controller
-and explained in chapter
-XXX: Unknown inset LatexCommand \ref{par:Controller-properties}:
-
-
-
-C++ controller
-""""""""""""""
-
-For C++, the controller code is implemented as a set of classes: A
-base class called **Controller** and a class called **ZeroDController** which inherits from Controller. Finally, the user has to write its
-controller class which inherits from ZeroDController. The Controller
-class has already been detailed in
-XXX: Unknown inset LatexCommand \ref{sub:The-Cpp-Controller-class}:
-.
-
-
-XXX: Unknown layout Subparagraph: The ZeroDController class
-The ZeroDController class defines four virtual methods which are:
-
-1. void **ZeroDController::PreReadAll** ()
- The default implementation does nothing
-
-2. void **ZeroDController::PreReadOne** (long idx_to_read)
- The default implementation does nothing
-
-3. void **ZeroDController::ReadAll** ()
- The default implementation does nothing
-
-4. double **ZeroDController::ReadOne** (long idx_to_read)
- The default implementation prints a message on the screen and return a
- NaN value
-
-This class has one constructor which is
-
-1. **ZeroDController::ZeroDController** (const char \*)
- Constructor of the ZeroDController class with the controller instance
- name as parameter
-
-
-XXX: Unknown layout Subparagraph: The user controller class
-The user has to implement the remaining pure virtual methods
-(AddDevice and DeleteDevice) and has to re-define virtual methods if
-the default implementation does not cover his needs. The controller
-code has to define two global variables which are:
-
-1. **ZeroDExpChannel_Ctrl_class_name** : This is an array of classical C strings terminated by a NULL
- pointer. Each array element is the name of a ZeroDExpChannel
- controller defined in the file.
-
-2. **<CtrlClassName>_MaxDevice** : Idem motor controller definition
-
-On top of that, a controller code has to define a C function to create
-the controller object. This is similar to the Motor controller
-definition which is documented in
-XXX: Unknown inset LatexCommand \ref{par:The-user-controller}:
-
-
-
-Python controller
-"""""""""""""""""
-
-The principle is exactly the same than the one used for C++ controller
-but we don't have pure virtual methods with a compiler checking if
-they are defined at compile time. Therefore, it is the pool software
-which checks that the following methods are defined within the
-controller class when the controller module is loaded (imported):
-
-- AddDevice
-
-- DeleteDevice
-
-- ReadOne method
-
-- StateOne method
-
-With Python controller, there is no need for function to create
-controller class instance. With the help of the Python C API, the pool
-device is able to create the needed instances. Note that the
-StateOne() method does not have the same signature for Python
-controller.
-
-1. tuple **Stat** e **One** (self,idx_number)
- Get a channel state. The method has to return a tuple with one or two
- elements which are:
-
- 1. The channel state (as defined by Tango)
-
- 2. A string describing the motor fault if the controller has this
- feature.
-
-
-A Python controller class has to inherit from a class called **ZeroDController** . This does not add any feature but allows the pool software to
-realize that this class is a Zero D Experiment Channel controller.
-
-
-The OneDExpChannel interface
-----------------------------
-
-To be filled in
-
-
-The TwoDExpChannel interface
-----------------------------
-
-To be filled in
-
-
-The Measurement Group interface
--------------------------------
-
-The measurement group interface allows the user to access several data
-acquisition channels at the same time. It is implemented as a C++
-Tango_ device that is statically linked with the Pool device server. It
-supports several attributes and commands.
-
-The measurement group is the key interface to be used when getting
-data. The Pool can have several measurement groups but only one will
-be 'in use' at a time. When creating a measurement group, the user can
-define four kinds of channels which are:
-
-1. Counter/Timer
-
-2. ZeroDExpChannel
-
-3. OneDExpChannel
-
-4. TwoDExpChannel
-
-In order to properly use the measurement group, one of the channels
-has to be defined as the timer or the monitor. It is not possible to
-have several times the same channel in a measurement group. It is also
-not possible to create two measurement groups with exactly the same
-channels.
-
-
-The States
-^^^^^^^^^^
-
-The measurement group interface knows five states which are ON,
-MOVING, ALARM, FAULT. A group is in MOVING state when it is acquiring
-data (which means that the timer/monitor channel is in MOVING state).
-A STANDBY state means that the group is not the current active group
-of the Pool it belongs to. An ON state means that the group is ready
-to be used. ALARM means that no timer or monitor are defined for the
-group. If at least one of the channels reported a FAULT by the
-controller(s) of that(those) channel(s), the group will be in FAULT
-state.
-
-
-The commands
-^^^^^^^^^^^^
-
-The measurement group interface supports three commands on top of the
-Tango_ Init, State and Status commands. These commands are summarized
-in the following table:
-
-================ =============== ================
-Command name Input data type Output data type
-================ =============== ================
-Start void void
-Abort void void
-AddExpChannel String void
-RemoveExpChannel String void
-================ =============== ================
-
-- **Start** : When the device is in timer mode (Integration_time attribute > 0),
- it will start counting on all channels at the same time until the
- timer channel reaches a value of the Integration_time attribute. When
- the device in in monitor mode (Integration_count attribute > 0), it
- will start counting on all channels at the same time until de monitor
- channel reaches the value of the Integration_count attribute. For more
- details on setting the acquisition mode see
- XXX: Unknown inset LatexCommand \ref{Measurement Group: The attributes}:
- . This command will change the device state to MOVING. It will not be
- allowed to execute this command if the device is already in MOVING
- state. This command does not have any input or output arguments. The
- state will change from MOVING to ON only when the last channel reports
- that its acquisition has finished.
-
-- **Abort** : It aborts the running data acquisition. It will stop each channel
- member of the measurement group. This command does not have any input
- or output arguments.
-
-- **AddExpChannel** : adds a new experiment channel to the measurement group. The given
- string argument must be a valid experiment channel in the pool and
- must not be one of the channels of the measurement group. An event
- will be sent on the corresponding attribute representing the list of
- channels in the measurement group. For example, if the given channel
- is a Counter/Timer channel, then an event will be sent for the
- attribute "Counters "(See below for a list of attributes in the measurement group).
-
-- **RemoveExpChannel** : removes the given channel from the measurement group. The given
- string argument must be a valid experiment channel in the measurement
- group. If the channel to be deleted is the current Timer/Monitor then
- the value for the corresponding attribute will be set to "Not Initialized "and an event will be sent. An event will be sent on the corresponding
- attribute representing the list of channels in the measurement group.
-
-
-XXX: Unknown inset LatexCommand \label{Measurement Group: The attributes}:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The attributes
-
-A measurement group will support 8+n (n being the number of channels)
-attributes summarized in the following table:
-========================================= ================ ===================== ======== ========= ==========
-Name Data type Data format Writable Memorized Ope/Expert
-========================================= ================ ===================== ======== ========= ==========
-Integration_time Tango::DevDouble Scalar R/W Yes Ope
-Integration_count Tango::DevLong Scalar R/W Yes Ope
-Timer Tango::DevString Scalar R/W Yes Ope
-Monitor Tango::DevString Scalar R/W Yes Ope
-Counters Tango::DevString Spectrum R No Ope
-ZeroDExpChannels Tango::DevString Spectrum R No Ope
-OneDExpChannels Tango::DevString Spectrum R No Ope
-TwoDExpChannels Tango::DevString Spectrum R No Ope
-<channel_name :math:`_{\text{i}}` >_Value Tango::DevDouble Scalar/Spectrum/Image R No Ope
-========================================= ================ ===================== ======== ========= ==========
-
-- **Integration_time** : The group timer integration time. Setting this value to >0 will set
- the measurement group acquisition mode to timer. It will force
- Integration_count attribute to 0 (zero). It will also exclude the
- current Timer channel from the list of Counters. Units are in seconds.
-
-- **Integration_count** : The group monitor count value. Setting this value to >0 will set the
- measurement group acquisition mode change to monitor. It will force
- Integration_time attribute to 0 (zero).
-
-- **Timer** : The name of the channel used as a Timer. A "Not Initialized "value means no timer is defined
-
-- **Monitor** : The name of the channel used as a Monitor. A "Not Initialized "value means no timer is defined
-
-- **Counter** : The list of counter names in the group
-
-- **ZeroDExpChannels** : The list of 0D Experiment channel names in the group
-
-- **OneDExpChannels** : The list of 1D Experiment channel names in the group
-
-- **TwoDExpChannels** : The list of 2D Experiment channel names in the group
-
-- **<channel_name** :math:`_{\text{i}}` **>_Value** : (with :math:`0\leq i<n` ) attributes dynamically created (one for each channel) which will
- contain the corresponding channel Value(for Counter/Timer, 1D or
- 2DExpChannels), CumulatedValue(for 0DExpChannels). For Counter/Timers
- and 0DExpChannels the data format will be Scalar. For 1DExpChannels it
- will be Spectrum and for 2DExpChannels it will be Image.
-
-
-The properties
-^^^^^^^^^^^^^^
-
-
-Device properties
-^^^^^^^^^^^^^^^^^
-
-Each measurement group has five properties. All of them are managed
-automatically by the pool software and must not be changed by the
-user. These properties are called Measurement_group_id, Pool_device,
-CT_List, ZeroDExpChannel_List, OneDExpChannel_List,
-TwoDExpChannel_List.
-
-
-
-
-XXX: Unknown inset LatexCommand \label{measurement group:Checking-operation-modes}:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Checking operation mode
-
-Currently, the measurement group supports two operation modes. The
-table below shows how to determine the current mode for a measurement
-group.
-
-
-======= ================ =================
-mode Integration_time Integration_count
-======= ================ =================
-Timer >0.0 0
-Monitor 0.0 >0
-Undef 0.0 0
-======= ================ =================
-
-
-
-'Undef' means no valid values are defined in Integration_time and in
-Integration_count. You will not be able to execute the Start command
-in this mode.
-
-
-Getting measurement group state using event
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The simplest way to know if a measurement group is acquiring data is
-to survey its state. If a measurement group is acquiring data its
-state will be MOVING. When the data acquisition is over, its state
-will change back to ON. The data acquisition is over when the
-measurement group detects that all channels finished acquisition
-(their state changed from MOVING to ON).The pool group interface
-allows clients interested in group state to use the Tango_ event system
-subscribing to measurement group state change event. As soon as a
-group starts acquiring data, its state is changed to MOVING and an
-event is sent. A new event will be sent when the data acquisition
-ends. Events will also be sent to each channel of the group when they
-start acquiring data and when they stop.
-
-
-Reading the measurement group channel values
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-For each measurement group there is a set of key dynamic attributes
-representing the value of each channel in the group. They are named
-<channel_name :math:`_{\text{i}}` >_Value. Special care has been taken on the management of these
-attributes with distinct behavior depending on the type of channel the
-attribute represents (Counter/Timer, 0D, 1D or 2D channel).
-
-
-Counter/Timer channel values
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-A Counter/Timer Value is represented by a scalar read-only double
-attribute. When the measurement group is not taking data, reading the
-counter/timer value will generate calls to the controller and
-therefore hardware access. When the group is taking data (master
-channel is moving), the value of a counter/timer is read every 100
-miliseconds and stored in the Tango_ polling buffer. This means that a
-client reading the value of the channel while the group is moving will
-get the value from the Tango_ polling buffer and will not generate exra
-controller calls. It is also possible to get the value using the Tango
-event system. When the group is moving, an event is sent to the
-registered clients when the change event criteria is true. This is
-applicable for each Counter/Timer channel in the group. By default,
-this change event criterion is set to be an absolute difference in the
-value of 5.0. It is tunable by attribute using the classical "abs_change "property or the pool device basis using its defaultCtGrpVal_AbsChange
-property. Anyway, not more than 10 events could be sent by second.
-Once the data acquisition is over, the value is made unavailable from
-the Tango_ polling buffer and is read a last time. A forced change
-event is sent to clients using events.
-
-
-Zero D channel values
-^^^^^^^^^^^^^^^^^^^^^
-
-A ZeroDExpChannel CumulatedValue is represented by a scalar read-only
-double attribute. Usually a ZeroDChannel represents the value of a
-single device (ex.: multimeter). Therefore, has hardware access cannot
-be optimized for a group of devices, reading the value on the
-measurement group device attribute has exactly the same behavior as
-reading it directly on the CumulatedValue attribute of the
-ZeroDChannel device (see
-XXX: Unknown inset LatexCommand \ref{par:Reading-the-ZeroDExpChannel}:
-).
-
-
-One D channel values
-^^^^^^^^^^^^^^^^^^^^
-
-To be filled in
-
-
-Two D channel values
-^^^^^^^^^^^^^^^^^^^^
-
-To be filled in
-
-
-Performance
-^^^^^^^^^^^
-
-Measurement group devices can often contain many channels. Client
-applications often request channel values for the set (or subset) of
-channels in a group. Read requests for these channel values through
-the <channel_name :math:`_{\text{i}}` >_Value attributes of a measurement group should be done by clients in
-groups as often as possible. This can be achieved by using the client
-Tango_ API call read_attributes on a DeviceProxy object. This will
-ensure maximum performance by minimizing hardware access since the
-measurement group can order channel value requests per controller thus
-avoiding unecessary calls to the hardware.
-
-
-Measurement group configuration
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-
-Timer/Monitor
-^^^^^^^^^^^^^
-
-Measurement group operation mode can be checked/set through the
-Integration_time and Integration_count (see
-XXX: Unknown inset LatexCommand \ref{measurement group:Checking-operation-modes}:
-). Setting the Integration_time to >0.0 will make the data acquisition
-(initiated by the invoking the Start command) finish when the channel
-defined in the Timer attribute reaches the value of Integration_time.
-Setting the Integration_count to >0 will make the data acquisition
-(initiated by the invoking the Start command) finish when the channel
-defined in the Monitor attribute reaches the value of
-Integration_count.
-
-In either case, the measurement group will NOT assume that the master
-channel(timer/monitor) is able to stop all the other channels in the
-group, so it will force a Stop on these channels as soon as it detects
-that the master has finished. This is the case of the UnixTimer
-channel which itself has no knowledge of the channels involved and
-therefore is not able to stop them directly.
-
-Integration_time, Integration_count, timer and monitor are memorized
-attributes. This means that the configuration values of these
-attributes are stored in the database. The next time the Pool starts
-the values are restored. This is done in order to reduce Pool
-configuration at startup to the minimum.
-
-
-The ghost measurement group
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-In order to allow pool client software to be entirely event based,
-some kind of polling has to be done on each channel to inform them on
-state change which are not related to data acquisition. To achieve
-this goal, one internally managed measurement group is created. Each
-pool channel (counter/timer, 0D, 1D or 2D experiment channel) is a
-member of this group. The Tango_ polling thread polls the state command
-of this group (Polling period tunable with the pool
-Ghostgroup_PollingPeriod property). The code of this group state
-command detects change in every channel state and send a state change
-event on the corresponding channel. This measurment group is not
-available to client and is even not defined in the Tango_ database.
-This is why it is called the ghost measurement group.
-
-
-The pool serial line, GPIB, socket interfaces
----------------------------------------------
-
-To be filled in
-
-
-The pool Modbus interface
--------------------------
-
-To be filled in
-
-
-Extending pool features
-=======================
-
-To be filled in
-
-
-Common task handled by the pool
-===============================
-
-
-Constraint
-----------
-
-Two types of constraint are identified.
-
-1. Simple constraint: This type of constraint is valid only for motor
- motion. It limits motor motion. This in not the limit switches which
- are a hardware protection. It's a software limit. This type of
- constraint is managed by the min_value and max_value property of the
- motor Position Tango_ attribute. Tango_ core will refused to write the
- attribute (Position) if outside the limits set by these min_value and
- max_value attribute properties. These values are set on motor Position
- attribute in physical unit.
- **Warning** : The backlash has to be taken into account in the management of this
- limit. In order to finish the motion always coming from the same
- direction, sometimes the motor has to go a little bit after the wanted
- position and then returns to the desired position. The limit value has
- to take the backlash value into account. If the motor backlash
- attribute is modified, it will also change the Position limit value.
-
- .. image:: /_static/limit.png
-
-2. User constraint: This kind of constraint is given to the user to allow
- him to write constraint macros which will be executed to allow or
- disallow an action to be done on one object. In the pool case, the
- object is a writable attribute and the action is writing the
- attribute. Therefore, the following algorithm is used when writing an
- attribute with constraint:
-
-
-
-::
-
- /IF/ Simple constraint set
- /IF/ New value outside limits
- - Throw an exception
- /ENDIF/
- /ENDIF/
-
- /IF/ Some user constraint associated to this attribute
- /FOR/ All the user constraint
- - Evaluate the constraint
- /IF/ The constraint evaluates to False
- - Throw an exception
- /ENDIF/
- /ENDFOR/
- /ENDIF/
-
- - Write the attribute
-
-The first part of this algorithm is part of the Tango_ core. The second
-part will be coded in the Pool Tango_ classes and in a first phase will
-be available only for the Position attribute of the Motor class.
-
-
-User constraint implementation
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-When the user creates a constraint, he has to provide to the pool the
-following information:
-
-1. The name of the object to which the constraint belongs. It is the name
- of the writable Tango_ attribute (actually only a motor position
- attribute.
-
-A user constraint will be written using the Python language. It has to
-be a Python class with a constructor and a "Evaluate" method. This
-class has to inherit from a class called PoolConstraint. This will
-allow the pool software to dynamically discover that this class is a
-pool constraint. The class may define the depending
-attributes/devices. A depending attribute/device is an object used to
-evaluate if the constraint is true or false. The depending attributes
-have to be defined in a list called **depending_attr_list** . Each element in this list is a dictionnary with up to 2 elements
-which are the description of the depending attribute and eventually a
-default value. The depending devices have to be defined in a list
-called **depending_dev_list** which follow the same syntax than the depending_attr_list. A
-constraint may also have properties as defined in
-XXX: Unknown inset LatexCommand \ref{par:Controller-properties}:
-. The constructor will receive three input arguments which are:
-
-1. A list with the depending attribute name
-
-2. A list with the depending device name
-
-3. A dictionnary (name:value) with the properties definition
-
-One rule of the constructor is to build the connection with these
-Tango_ objects and to keep them in the instance. The Evaluate method
-will evaluate the constraint and will return true or false. It
-receives as input argument a list with the result of a read_attribute
-call executed on all the depending attributes.
-
-Five pool device commands and two attribute allow the management of
-these constraints. The commands are **CreateConstraint** , **DeleteConstraint** , **EvaluateContraint, GetConstraintClassInfo** and **GetConstraint** . The attributes are called **ConstraintList** and **ConstraintClassList** . They are all detailed in chapters
-XXX: Unknown inset LatexCommand \ref{sub:Device-pool-commands}:
-and
-XXX: Unknown inset LatexCommand \ref{sub:Device-pool-attributes}:
-. The following is an example of a user constraint
-
-
-
-
-::
-
- 1 import PyTango
- 2
- 3 class MyConstraint(PoolConstraint):
- 4
- 5 depending_attr_list = [{'DefaultValue':"first_mot/position",
- 6 'Description':"X position"},
- 7 {'DefaultValue':"second_mot/position",
- 8 'Description':"Z position"},
- 9 {'DefaultValue':"first_mot/velocity",
- 10 'Description':"X position speed"}]
- 11
- 11 depending_dev_list = [{'DefaultValue':"first_dev",
- 12 'Description':"Air pressure device"}]
- 13
- 14 inst_prop = {'MyProp':{'Type':PyTango.DevLong,'Description':'The psi constant',
- 15 'DefaultValue',1234}}
- 16
- 17 def __init__(self,attr_list,dev_list,prop_dict)
- 18 self.air_device = PyTango.DeviceProxy(dev_list[0])
- 19 self.const = prop_dict["MyProp"]
- 20
- 21 def Evaluate(self,att_value):
- 22 if att_value[0].value > (xxx * self.const)
- 23 return False
- 24 elif att_value[1].value > yyy
- 25 return False
- 26 elif att_value[2].value > zzz
- 27 return False
- 28 elif self.air_device.state() == PyTango.FAULT
- 29 return False
- 30 return True
-
-Line 3 : The class inherits from the PoolConstraint class
-Line 5-10: Definition of the depending attributes
-Line 11-12: Definition of the depending devices
-Line 14-15: Definition of a constraint property
-Line 17-19: The constructor
-Line 21-30: The Evaluate method
-
-
-
-Archiving motor position
-------------------------
-
-XXX: Unknown inset LatexCommand \label{sub:Archiving-motor-position}:
-
-It is not possible to archive motor position using the Tango_ memorized
-attribute feature because Tango_ writes the attribute value into the
-database just after it has been set by the user. In case of motors
-which need some time to go to the desired value and which from time to
-time do not go exactly to the desired value (for always possible to
-have position which is a integer number of motor steps), it is more
-suited to store the motor position at the end of the motion. To
-achieve this, the pool has a command (called **ArchieveMotorPosition** ) which will store new motor positions into the database. This command
-will be polled by the classical Tango_ polling thread in order to
-execute it regularly. The algorithm used by this command is the
-following:
-
-
-
-::
-
- - Read motors position for all motors which are not actually moving
-
- - /FOR/ all motors
- - /IF/ The new position just read is different than the old one
- - Mark the motor as storable
- - /ENDIF/
- - /ENDFOR/
-
- - Store in DB position of all storable motors
- - Memorize motors position
-
-In order to minimize the number of calls done on the Tango_ database,
-we need to add to the Tango_ database software the ability to store x
-properties of one attribute of y devices into the database in one call
-(or may be simply the same property of one attribute of several
-device).
-
-
-Scanning
---------
-
-To be filled in
-
-
-Experiment management
----------------------
-
-To be filled in
-
-
-The pool device Tango_ interface
-=================================
-
-The pool is implemented as a C++ Tango_ device server and therefore
-supports a set of commands/attributes. It has several attributes to
-get object (motor, pseudo-motor, controller) list. These lists are
-managed as attributes in order to have events on them when a new
-object (motor, controller...) is created/deleted.
-
-
-Device pool commands
---------------------
-
-XXX: Unknown inset LatexCommand \label{sub:Device-pool-commands}:
-
-On top of the three classical Tango_ commands (State, Status and Init),
-the pool device supports the commands summarized in the following
-table:
-
-================== ====================== ============================ ========================
-Device type Name Input data type Output data type
-================== ====================== ============================ ========================
- CreateController Tango::DevVarStringArray void
-related InitController Tango::DevString void
-commands ReloadControllerCode Tango::DevString void
- SendToController Tango::DevVarStringArray Tango::DevString
-Motor CreateMotor Tango::DevVarLongStringArray void
-related commands DeleteMotor Tango::DevString void
-Motor group CreateMotorGroup Tango::DevVarStringArray void
-related commands DeleteMotorGroup Tango::DevString void
- GetPseudoMotorInfo Tango::DevVarStringArray Tango::DevVarStringArray
-Pseudo motor CreatePseudoMotor Tango::DevVarStringArray void
-related commands DeletePseudoMotor Tango::DevString void
- ReloadPseudoMotorCode Tango::DevString void
- GetConstraintClassInfo Tango::DevString Tango::DevVarStringArray
- CreateConstraint Tango::DevVarStringArray void
-User Constraint DeleteConstraint Tango::DevString void
-related EvaluateConstraint Tango::DevString Tango::DevBoolean
-commands GetConstraint Tango::DevString Tango::DevVarLongArray
- ReloadConstraintCode Tango::DevString void
-Experiment Channel CreateExpChannel Tango::DevVarStringArray void
-related commands DeleteExpChannel Tango::DevString void
-Measurement group CreateMeasurementGroup Tango::DevVarStringArray void
-related commands DeleteMeasurementGroup Tango::DevString void
-Dyn loaded Tango LoadTangoClass
-class related UnloadTangoClass
-commands ReloadTangoClass
-Dyn. created CreateXXX
-commands DeleteXXX
-Miscellaneous ArchiveMotorPosition void void
-================== ====================== ============================ ========================
-
-- **CreateController** : This command creates a controller object. It has four arguments (all
- strings) which are:
-
- 1. The controller device type: Actually three types are supported as
- device type. They are:
-
- - "Motor" (case independent) for motor device
-
- - "CounterTimer" (case independent) for counter timer device
-
- - "ZeroDExpChannel" (case independent) for zero dimension experiment
- channel device
-
-
- 2. Controller code file name: For C++ controller, this is the name of the
- controller shared library file. For Python controller, this is the
- name of the controller module. This parameter is only a file name, not
- a path. The path is automatically taken from the pool device **PooPath** property. It is not necessary to change your LD_LIBRARY_PATH or
- PYTHONPATH environment variable. Everything is taken from the PoolPath
- property.
-
- 3. Controller class name: This is the name of the class implementing the
- controller. This class has to be implemented within the controller
- shared library or Python module passed as previous argument
-
- 4. Instance name: It is a string which allows the device pool to deal
- with several instance of the same controller class. The pool checks
- that this name is uniq within a control system.
-
-
-The list of created controllers is kept in one of the pool device
-property and at next startup time, all controllers will be
-automatically re-created. If you have several pool device within a
-control system (the same TANGO_HOST), it is not possible to have two
-times the same controller defines on different pool device. Even if
-the full controller name is <Controller file name>.<Controller class
-name>/<Instance name>, each created controller has an associated name
-which is:
-
- <Instance name>
-
-which has to be used when the controller name is requested. This name
-is case independent.
-
-- **DeleteController** : This command has only one input argument which is the controller
- name (as defined previously). It is not possible to delete a
- controller with attached device(s). You first have to delete
- controller's device(s).
-
-- **InitController** : This command is used to (re)-initialize a controller if the
- controller initialization done at pool startup time has failed. At
- startup time, the device pool creates controller devices even if the
- controller initialization has failed. All controller devices are set
- to the FAULT state. This command will try to re-create the controller
- object and if successful, send an "Init" command to every controller
- devices. Its input argument is the controller name.
-
-- **GetControllerInfo** : This command has three or four input parameters which are:
- XXX: Unknown inset LatexCommand \label{ite:GetControllerInfo:}:
-
- 1. The controller device type
-
- 2. The controller code file name: For C++ controller, this is the name of
- the controller shared library file. For Python controller, this is the
- name of the controller module. This parameter is only a file name, not
- a path. The path is automatically taken from the pool device **PooPath** property.
-
- 3. The controller class name: This is the name of the class implementing
- the controller. This class has to be implemented within the controller
- shared library or Python module passed as previous argument
-
- 4. The controller instance name: This parameter is optional. If you do
- not specify it, the command will return information concerning
- controller properties as defined at the class level. If you defined
- it, the command will return information concerning controller
- properties for this specific controller instance.
-
-
-It returns to the caller all the informations related to controller
-properties as defined in the controller code and/or in the Tango
-database. The following format is used to return these informations:
-
-1. The string describing the controller (or an empty string if not
- defined)
-
-2. Number of controller properties
-
-3. For each property:
-
- 1. The property name
-
- 2. The property data type
-
- 3. The property description
-
- 4. The property default value (Empty string if not defined)
-
-
-- **ReloadControllerCode** : The controller code is contains in a shared library dynamically
- loaded or in a Python module. The aim of this command is to unlink the
- pool to the shared library and to reload it (or Reload the Python
- module). The command argument is a string which is the controller file
- name as defined for the CreateController command. For motor
- controller, it is not possible to do this command if one of the motor
- attached to controller(s) using the code within the file is actually
- moving. All motor(s) attached to every controller(s) using this file
- is switched to FAULT state during this command execution. Once the
- code is reloaded, an "Init" command is sent to every controller
- devices.
-
-- **SendToController** : Send data to a controller. The first element of the input argument
- array is the controller name. The second one is the string to be sent
- to the controller. This command returns the controller answer or an
- empty string is the controller does not have answer.
-
-- **CreateMotor** : This command creates a new motor. It has three arguments which are:
-
- 1. The motor name (a string). This is a Tango_ device alias. It is not
- allowed to have '/' character within this name. It is a case
- independent name.
-
- 2. The motor controller name (a string)
-
- 3. The axe number within the controller
-
-
-The motor is created as a Tango_ device and automatically registered in
-the database. At next startup time, all motors will be automatically
-re-created. A Tango_ name is assigned to every motor. This name is a
-Tango_ device name (3 fields) and follow the syntax:
-
-
- motor/controller_instance_name/axe_number
-
-in lower case letters.
-
-- **DeleteMotor** : This command has only one argument which is the motor name as given
- in the first argument of the CreateMotor command. The device is
- automatically unregistered from the Tango_ database and is not
- accessible any more even for client already connected to it.
-
-- **CreateMotorGroup** : This command creates a new motor group. It has N arguments which
- are:
-
- 1. The motor group name (a string). This is a Tango_ device alias. It is
- not allowed to have '/' character within this name. It is a case
- independent name.
-
- 2. The list of motor element of the group (motor name or another group
- name or pseudo-motor name)
-
-
-The motor group is created as a Tango_ device and automatically
-registered in the database. At next startup time, all motor groups
-will be automatically re-created. A Tango_ name is assigned to every
-motor group. This name is a Tango_ device name (3 fields) and follow
-the syntax:
-
- mg/ds_instance_name/motor_group_name
-
-in lower case letters.
-
-- **DeleteMotorGroup** : This command has only one argument which is the motor group name as
- given in the first argument of the CreateMotorGroup command. The
- device is automatically unregistered from the Tango_ database and is
- not accessible any more even for client already connected to it. This
- command is not allowed if another motor group is using the motor group
- to be deleted.
-
-- **GetPseudoMotorInfo** :
- XXX: Unknown inset LatexCommand \label{sub:GetPseudoMotorClassInfo}:
- : This command has one input argument (a string):
-
- **<module_name>.<class_name>**
-
-
- The command returns a list of strings representing the pseudo motor
- system information with the following meaning:
-
- pseudo_info[0] - textual description of the pseudo motor class.
-
- pseudo_info[1] - (=M) the number of motors required by this pseudo
- motor class.
-
- pseudo_info[2] - (=N) the number of pseudo motors that the pseudo
- motor system aggregates.
-
- pseudo_info[3] - the number of parameters required by the pseudo motor
- system.
-
- pseudo_info[4..N+4] - the textual description of the roles of the N
- motors.
-
- pseudo_info[N+5..N+M+5] - the textual description of the roles of the
- M pseudo motors.
-
- pseudo_info[N+M+6..N+M+P+6] - the textual description of the P
- parameters.
-
-
-**example** :
-
-
-
-::
-
- GetPseudoMotorInfo('PseudoLib.Slit')
-
- could have as a return:
-
-
-
-
-::
-
- ["A Slit system for controlling gap and offset pseudo motors.",
- "2",
- "2",
- "0",
- "Motor on blade 1",
- "Motor on blade 2",
- "Gap",
- "Offset"]
-
-- **CreatePseudoMotor** :This command has a variable number of input arguments (all strings):
-
- 1. the python file which contains the pseudo motor python code.
-
- 2. the class name representing the pseudo motor system.
-
- 3. the N pseudo motor names. These will be the pseudo motor alias for the
- corresponding pseudo motor tango devices.
-
- 4. the M motor names. These names are the existing tango motor alias.
-
- N and M must conform to the class name information. See
- XXX: Unknown inset LatexCommand \ref{sub:GetPseudoMotorClassInfo}:
- to find how to get class information.
-
- For each given pseudo motor name a Tango_ pseudo motor device is
- created and automatically registered in the database. At next startup time, all pseudo motors will be automatically re-
- created. A Tango_ name is assigned to every pseudo motor. This name is
- a Tango_ device name (3 fields) and follow the syntax:
-
- pm/python_module_name.class_name/pseudo_motor_name
-
- For each Tango_ pseudo motor device the device pool will also create a
- corresponding alias named pseudo_motor_name.
-
- If a motor group Tango_ device with the given motor names doesn't exist
- then the device pool will also create a motor group with the following
- name:
-
- mg/tango_device_server_instance_name/_pm_<internal motor group number>
-
- This motor group is built for internal Pool usage. It is not intended
- that the pseudo motor is accessed directly through this motor group.
- However, if needed elsewhere, it can be accessed as the usual motor
- group without any special restrictions.
-
-
-**example:**
-
-CreatePseudoMotor('PseudoLib.py','Slit','gap01','offset01','blade01','
-blade02')
-
-- **DeletePseudoMotor** : This command has only one argument which is the pseudo motor
- identifier. The device is automatically unregistered from the Tango
- database and is not accessible any more even for client already
- connected to it. This command is not allowed if a motor group is using
- the pseudo motor to be deleted.
-
-- **ReloadPseudoMotorCode** :The calculation code is contains in a dynamically loaded Python
- module. The aim of this command is to reload the Python module. The
- command argument is a string which is the python module as defined for
- the CreatePseudoMotor and GetPseudoMotorInfo commands. It is not
- possible to do this command if one of the motor attached to pseudo
- motor system(s) using code within the file is actually moving. All
- pseudo motor(s) using this file are switched to FAULT state during
- this command execution.
-
-- **CreateExpChannel** : This command creates a new experiment channel. It has three
- arguments which are:
-
- 1. The experiment channel name (a string). This is a Tango_ device alias.
- It is not allowed to have '/' character within this name. It is a case
- independent name.
-
- 2. The experiment channel controller name (a string)
-
- 3. The index number within the controller
-
-
-The experiment channel is created as a Tango_ device and automatically
-registered in the database. At next startup time, all created
-experiment channels will be automatically re-created. A Tango_ name is
-assigned to every experiment channel. This name is a Tango_ device name
-(3 fields) and follow the syntax:
-
- expchan/controller_instance_name/index_number
-
-in lower case letters. The precise type of the experiment channel
-(Counter/Timer, ZeroD, OneD...) is retrieved by the pool device from
-the controller given as command second parameter.
-
-- **DeleteExpChannel** : This command has only one argument which is the experiment channel
- name as given in the first argument of the CreateExpChannel command.
- The device is automatically unregistered from the Tango_ database and
- is not accessible any more even for client already connected to it.
-
-- **GetConstraintClassInfo** : This command has one input parameter (a string) which is the
- constraint class name. It returns to the caller all the information
- related to constraint dependencies and to constraint properties as
- defined in the constraint code. The following format is used to return
- properties:
-
- - Depending attributes number
-
- - Depending attribute name
-
- - Depending attribute description
-
-
- - Depending devices number
-
- - Depending device name
-
- - Depending device description
-
-
- - Class property number
-
- - Class property name
-
- - Class property description
-
- - Class property default value (Set to "NotDef" if not defined)
-
-
- - Instance property number
-
- - Instance property name
-
- - Instance property description
-
- - Instance property default value (Set to "NotDef" if not defined)
-
-
-
-- **CreateMeasurementGroup** : This command creates a new measurement group. It has N arguments
- which are:
-
- 1. The measurement group name (a string). This is a Tango_ device alias.
- It is not allowed to have '/' character within this name. It is a case
- independent name.
-
- 2. The list of channel elements of the group (Counter/Timer, 0D, 1D or 2D
- experiment channel)
-
-
-The measurement group is created as a Tango_ device and automatically
-registered in the database. At next startup time, all measurement
-groups will be automatically re-created. A Tango_ name is assigned to
-every measurement group. This name is a Tango_ device name (3 fields)
-and follow the syntax:
-
- mntgrp/ds_instance_name/measurement_group_name
-
-in lower case letters.
-
-- **DeleteMeasurementGroup** : This command has only one argument which is the measurement group
- name as given in the first argument of the CreateMeasurementGroup
- command. The device is automatically unregistered from the Tango
- database and is not accessible any more even for client already
- connected to it.
-
-- **AddConstraint** : This command creates a user constraint object. It has several
- arguments (all strings) which are:
-
- 1. Constraint code file name: The name of the constraint module. This
- parameter is only a file name, not a path. The path is automatically
- taken from the pool PooPath property.
-
- 2. Constraint class name: This is the name of the class implementing the
- controller. This class has to be implemented within the controller
- shared library or Python module passed as previous argument
-
- 3. Instance name: It is a string which allows the device pool to deal
- with several instance of the same controller class.
-
- 4. The object to which the constraint belongs. It has to be a writable
- attribute name (actually only a motor position)
-
- 5. The list of depending objects. (Variable length list which may be
- empty)
-
-
-The list of created constraints is kept in one of the pool device
-property and at next startup time, all constraints will be
-automatically re-created. It is possible to create several constraint
-on the same object. They will be executed in the order of their
-creation. Each created constraint has a associated name which is:
-
- <Constraint class name>/<Instance name>
-
-- **DeleteConstraint** : This command has only one argument which is the constraint name as
- define previously.
-
-- **EvaluateConstraint** : This command has only one argument which is the constraint name. It
- runs the "evaluate" method of the constraint and sends the return
- value to the caller
-
-- **GetConstraint** : The input parameter of this command is the name of a Tango_ object.
- Actually, it has to be the name of one of the motor Position
- attribute. The command returns the list of Constraint ID attached to
- this object.
-
-- **ReloadConstraintCode** : The constraint code is contains in a Python module. The aim of this
- command is to reload the Python module. The command argument is a
- string which is the constraint file name as defined for
- theAddConstraint command. All object(s) using this constraint are
- switched to FAULT state during this command execution.
-
-- **LoadTangoClass** :
-
-- **UnloadTangoClass** :
-
-- **ReloadTangoClass** :
-
-- **CreateXXX** :
-
-- **DeleteXXX:**
-
-- **ArchiveMotorPosition** : Send new motor(s) position to the database. This command will be
- polled with a default polling period of 10 seconds.
-
-The classical Tango_ **Init** command destroys all constructed controller(s) and re-create them
-reloading their code. Then, it sends an "Init" command to every
-controlled objects (motor, pseudo-motor and motor group) belonging to
-the pool device. Motor(s) are switched to FAULT state when controller
-are destroyed.
-
-The pool device knows only two states which are ON and ALARM. The pool
-device is in ALARM state if one of its controller failed during its
-initialization phase. It is in ON state when all controllers are
-correctly constructed. In case the pool device in in ALARM state, its
-status indicates which controller is faulty.
-
-
-Device pool attributes
-----------------------
-
-XXX: Unknown inset LatexCommand \label{sub:Device-pool-attributes}:
-
-The device pool supports the following attributes:
-
-==================== ================= =========== ========
-Name Data type Data format Writable
-==================== ================= =========== ========
-ControllerList Tango::DevString Spectrum R
-ControllerClassList Tango::DevString Spectrum R
-MotorList Tango::DevString Spectrum R
-MotorGroupList Tango::DevString Spectrum R
-PseudoMotorList Tango::DevString Spectrum R
-PseudoMotorClassList Tango::DevString Spectrum R
-ExpChannelList Tango::DevString Spectrum R
-MeasurementGroupList Tango::DevString Spectrum R
-ConstraintList Tango::DevString Spectrum R
-ConstraintClassList Tango::DevString Spectrum R
-SimulationMode Tango::DevBoolean Scalar R/W
-XXXList Tango::DevString Spectrum R
-==================== ================= =========== ========
-
-- **ControllerList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one controller following the syntax:
-
- <instance_name> - <Ctrl file>.<controller_class_name/instance_name> -
- <Device type> <Controller language> Ctrl (<Ctrl file>)
-
-- **ControllerClassList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one of the available controller class that the user can
- create. To build this list, the pool device server is using a property
- called **PoolPath** which defines the path where all files containing controller code
- should be (Python and C++ controllers). The syntax used for this
- PoolPath property is similar to the syntax used for Unix PATH
- environment variable (list of absolute path separated by the ":"
- character). Each returned string has the following syntax:
-
- Type: <Ctrl dev type> - Class: <Ctrl class name> - File: <Abs ctrl
- file path>
-
-- **MotorList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one motor known by this pool. The syntax is:
-
- <Motor name> (<Motor tango name>)
-
-- **MotorGroupList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one motor group known by this pool. The syntax is:
-
- <Motor group name> (<Motor group tango name>) Motor list: <List of
- group members> (<List of physical motors in the group>)
-
- The last information is displayed only if the physical group structure
- differs from the logical one (pseudo-motor or other group used as
- group member)
-
-- **PseudoMotorList** :This is a read only spectrum string attribute. Each spectrum element
- is the name of one motor known by this pool. The syntax is:
-
- <pseudo motor name> (<pseudo motor tango name>) Motor List: <motor
- name>1,...,<motor name>M
-
-- **ExpChannelList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one experiment channel known by this pool. The syntax
- is:
-
- <Exp Channel name> (<Channel tango name>) <Experiment channel type>
-
- The string describing the experiment channel type may be:
-
- - Counter/Timer Experiment Channel
- - Zero D Experiment Channel
-
-- **MeasurementGroupList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one measurement group known by the pool. The syntax is:
-
- <Measurement group name> (<Measurement group tango name>) Experiment
- Channel list: <List of group members>
-
-- **PseudoMotorClassList** :This is a read only spectrum string attribute. Each spectrum element
- is the name of a valid Pseudo python system class. The syntax is:
-
- <python module name>.<python class name>
-
- . The python files to be found depend on the current value of the pool
- path. See
- XXX: Unknown inset LatexCommand \ref{sub:PoolPath}:
-
-- **ConstraintClassList** : This is a read only spectrum string attribute. Each spectrum element
- is the name of one of the available constraint class that the user can
- create. To build this list, the pool device server is using a property
- called **PoolPath** which defines the path where all files containing constraint code
- should be. The syntax used for this property is similar to the syntax
- used for Unix PATH environment variable (list of absolute path
- separated by the ":" character). To find constraint classes, the pool
- will look into all Python files (those with a .py suffix) for classes
- definition which inherit from a base class called **PoolConstraint** .
-
-- **ConstraintList** : This is a read only spectrum string attribute. each spectrum element
- is one of the constraint actually registered in the pool. The syntax
- of each string is:
-
- <Constraint class name/instance name> - <associated to> - <depending
- on attribute(s) - <depending on device(s)>
-
-- **SimulationMode** : This is a read-write scalar boolean attribute. If set to true, all
- the pool device(s) are switched to Simulation mode. This means that
- all commands received by pool device(s) will not be forwarded to the
- associated controllers.
-
-- **XXXList** :
-
-
-Device pool property
---------------------
-
-The pool device supports the following property:
-
-============================ ================== =============
-Property name Property data type Default value
-============================ ================== =============
-PoolPath String
-DefaultMotPos_AbsChange Double 5
-DefaultMotGrpPos_AbsChange Double 5
-DefaultCtVal_AbsChange Double 5
-DefaultZeroDVal_AbsChange Double 5
-DefaultCtGrpVal_AbsChange Double 5
-DefaultZeroDGrpVal_AbsChange Double 5
-GhostGroup_PollingPeriod String 5000
-MotThreadLoop_SleepTime Long 10
-NbStatePerRead Long 10
-ZeroDNbReadPerEvent Long 5
-============================ ================== =============
-
-- **PoolPath** :
- XXX: Unknown inset LatexCommand \label{sub:PoolPath}:
- The path (same syntax than the Unix PATH environment variable) where
- the pool software is able to locate Controller software, Pseudo-motor
- software or Constraint software for both Python or C++ languages
-
-- **DefaultMotPos_AbsChange** : The default value used to trigger change event when the position
- attribute is changing (the associated motor is moving). This property
- has a hard-coded default value set to 5
-
-- **DefaultMotGrpPos_AbsChange** : The default value used to trigger change event when the group device
- position attribute is changing. This property has a hard-coded default
- value set to 5
-
-- **DefaultCtVal_AbsChange** : The default value used to trigger change event when the
- counter/timer attribute is changing (the counter is counting or the
- timer is timing). This property has a hard-coded default value set to
- 5
-
-- **DefaultZeroDVal_AbsChange** : The default value used to trigger change event when the Zero
- Dimension Experiment Channel is acquiring data. This property has a
- hard-coded default value set to 5
-
-- **DefaultCtGrpVal_AbsChange** : The default value used to trigger change event when the
- counter/timer attribute(s) of a measurement group is(are) changing
- (the counter is counting or the timer is timing). This property has a
- hard-coded default value set to 5
-
-- **DefaultZeroDGrpVal_AbsChange** : The default value used to trigger change event when the Zero
- Dimension Experiment Channel(s) of a measurement group is(are)
- acquiring data. This property has a hard-coded default value set to 5
-
-- **GhostGroup_PollingPeriod** : The ghost motor/measurement group polling period in mS. This
- property has a default value of 5000 (5 sec)
-
-- **MotThreadLoop_SleepTime** : The time (in mS) during which the motion thread will sleep between
- two consecutive motor state request. The default value is 10
-
-- **NbStatePerRead** : The number of motor state request between each position attribute
- reading done by the motion thread. The default value is 10. This means
- that during a motion, the motor position is read by the thread every
- 100 mS (10 * 10)
-
-- **ZeroDNbReadPerEvent** : The number of times the Zero D Experiment Channel value is read by
- the acquisition thread between firing a change event. The event will
- be effectively fired to the interested clients according to the
- CumulatedValue attribute "Absolute Change" property value.
-
-- **Controller** : An internally managed property which allow the pool device to
- remember which controller has been created.
-
-
-Creating device
-===============
-
-This chapter gives details on what has to be done to create device
-using the device pool in order to check the work to be done by a
-Sardana configuration tool.
-
-
-Creating motor
---------------
-
-The following is the action list which has to be done when you want to
-create a new motor:
-
-1. Display the list of all the controller the pool already has.
-
-2. Select one of this controller
-
-3. If the user selects a new controller
-
- 1. Read the attribute ControllerClassList to get the list of Controller
- installed in your system
-
- 2. Select one of the controller class
-
- 3. With the GetControllerInfo command, get the list of controller
- properties
-
- 4. Give a controller instance name
-
- 5. Display and eventually change the controller properties (if any)
-
- 6. Create the controller object using the CreateController pool command
-
-
-4. Give a motor name and a motor axis number in the selected controller
-
-5. Create the motor with the CreateMotor pool command
-
-6. Read the attribute list of the newly created motor
-
-7. Display and eventually change the motor attributes related to motor
- features and eventually to extra-features
-
-
-Creating motor group
---------------------
-
-The following is the action list which has to be done when creating a
-motor group
-
-1. Give a name to the motor group
-
-2. Display the list of all registered motors (attribute MotorList), all
- registered motor groups (attribute MotorGroupList), all registered
- pseudo motors (attribute PseudoMotorList) and select those which have
- to be member of the group.
-
-3. Create the group (command CreateMotorGroup)
-
-
-Creating a pseudo motor system
-------------------------------
-
-The following is the action list which has to be done when you want to
-create a new pseudo motor:
-
-1. Display the list of all available pseudo motor system classes and
- select one of them
-
- 1. if there is no proper pseudo system class write one in Python
-
- 2. update the PoolPath Pool property if necessary
-
-
-2. Get the selected pseudo motor system class information
-
-3. Give names to the pseudo motors involved in the selected pseudo motor
- system
-
-4. Create the motor(s) which are involved (if they have are not created
- yet: See
- XXX: Unknown inset LatexCommand \ref{sub:Creating-motor}:
- ) and assign the coresponding roles
-
-5. Create the pseudo motor system (command CreatePseudoMotor)
-
-
-Creating a user constraint
---------------------------
-
-The following is the action list which has to be done when you want to
-create a new user constraint:
-
-1. Display the list of all the constraint the pool already has.
-
-2. Select one of this constraint
-
-3. If the user selects a new constraint
-
- 1. Read the attribute ConstraintClassList to get the list of Constraint
- installed in your system
-
- 2. Select one of the constraint class
-
- 3. With the GetConstraintClassInfo command, get the list of constraint
- dependencies and properties
-
- 4. Give a constraint instance name
-
- 5. If it is the first constraint of this class
-
- 1. Display and eventually change the constraint class properties (if any)
-
-
-
-4. Display and eventually change the constraint depending attribute (if
- any)
-
-5. Display and eventually change the constraint depending device (if any)
-
-6. Display and eventually change the constraint instance properties (if
- any)
-
-7. Create the constraint object using the CreateConstraint pool command
-
-
-Some words on internal implementation
-=====================================
-
-This chapter gives some details on some part of the pool
-implementation in order to clarify reader ideas
-
-
-Moving motor
-------------
-
-Moving a motor means writing its Position attribute. In Tango, it is
-already splitted in two actions which are:
-
-1. Call a Motor class method called "is_allowed"
-
-2. Call a Motor class method called "write_Position"
-
-The second method will be executed only if the first one returns true.
-The move order is sent to the motor (via the controller) in the code
-of the second method.
-
-
-The is_allowed method
-^^^^^^^^^^^^^^^^^^^^^
-
-The code implemented in this method follow the algorithm:
-
-
-
-::
-
- - /IF/ There are any Pseudo Motor using the motor
- - /FOR/ All these Pseudo Motors
- - /IF/ They have some limits defined
- - Compute new Pseudo Motor position if motor moved to the desired value
- - /IF/ The computed value is outside the authorized window
- - Return False
- - /ENDIF/
- - /ENDIF/
- - /ENDFOR/
- - /ENDIF/
-
- - /IF/ There are some user constraint attached to the motor
- - /FOR/ Each user constraint
- - /IF/ The constraint has some depending attribute(s)
- - Read these attributes
- - /ENDIF/
- - /IF/ If the execution of the contraint "Evaluate" method returns False
- - Return False
- - /ENDIF/
- - /ENDFOR/
- - /ENDIF/
-
- - Return True
-
-
-The write_Position method
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The code implemented in this method follows the algorithm:
-
-
-
-::
-
- - Compute the dial position from the user position
- - /IF/ A backlash is defined for this motor and the controller does not manage it
- - Update motor desired position according to motion direction and backlash value
- - /ENDIF/
- - Start a thread sending it which motor has to move to which position
- - Wait for thread acknowledge
- - Return to caller
-
-The motion thread will execute the following algorithm:
-
-
-
-::
-
- - /FOR/ Each controller(s) implied in the motion
- - Lock the controller object
- - Call PreStartAll()
- - /ENDFOR/
-
- - /FOR/ Each motor(s) implied in the motion
- - ret = PreStartOne(motor to move, new position)
- - /IF/ ret is true
- - Call StartOne(motor to move, new position)
- - /ELSE/
- - Inform write_Position that an error occurs
- - Send acknowledge to write_Position method
- - /ENDIF/
- - /ENDFOR/
-
- - /FOR/ Each motor(s) implied in the motion
- - Set motor state to MOVING and send a Tango_ event to the requesting client
- - /ENDFOR/
-
- - /FOR/ Each controller(s) implied in the motion
- - Call StartAll()
- - Unlock the controller object
- - /ENDFOR/
-
- - Send acknowledge to the write_Position method
-
- - /WHILE/ One of the motor state is MOVING (From controller)
- - Sleep for 10 mS
-
- - /IF/ One of the motor implied in the motion is not moving any more
- - /IF/ This motor has backlash and the motion is in the "wrong" direction
- - Ask for a backlash motion in the other direction
- (Easy to write, not as easy to do...)
- - /ENDIF/
- - Send a Tango_ event on the state attribute to the requesting client
- - Leave the loop
- - /ENDIF/
-
- - /IF/ it is time to read the motor position
- - Read the motor position
- - Send a change event on the Position attribute to the requested client if
- the change event criterion is true
- - /ENDIF/
- - /ENDWHILE/
-
- - Sleep for the time defined by the motor (group) Sleep_bef_last_read property
- - Read the motor position
- - Send a forced change event on the Position attribute to the requesting client
- with the value set to the one just read
-
-
-
-Data acquisition
-----------------
-
-Data aquisition is triggered by invoking a Start command on the
-measurement group. The code implemented implements the following
-algorithm.
-
-
-
-::
-
- /IF/ in timer mode
- - Write CumulationTime on all 0D channels with Integration_time value
- /ELIF/ in monitor mode
- - Write CumulationTime on all 0D channels with 0(zero) value
- /ENDIF/
-
- /FOR/ Each 0D channel implied in the data aquisition
- - Load configuration
- /END FOR/
-
- - Start a CounterTimer thread with channels involved, master channel and the proper value to be set on it
- - Wait for CounterTimer thread acknowledge
-
- /FOR/ Each 0D channel implied in the data aquisition
- - Send Start command
- /END FOR/
-
- - Return to caller
-
-The Counter/Timer thread will execute the following algorithm:
-
-
-
-::
-
- - Calculate the list of controllers involved and determine which controller has the master channel
- /FOR/ Each channel(s) implied in the data aquisition
- - Lock the channel object
- /END FOR/
-
- /FOR/ Each controller(s) implied in the data acquisition
- - Lock the controller object
- /END FOR/
-
- /FOR/ Each channel(s) implied in the data acquisition
- - Load configuration
- /END FOR/
-
- - Load the master channel - timer(monitor) - with the integration time(count)
-
- /FOR/ Each controller(s) implied in the data acquisition
- - Call PreStartAllCT()
- /END FOR/
-
- /FOR/ Each channel(s), except for the master channel, implied in the data acquisition,
- - Call PreStartOneCT(channel)
- - Call StartOneCT(channel)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the data aquisition
- - Call StartAllCT()
- /END FOR/
-
- - Call PreStartAllCT() on the controller which contains the master channel
- - Call PreStartOneCT(master channel)
- - Call StartOneCT(master channel)
- - Call StartAllCT() on the controller which contains the master channel
-
- /FOR/ Each controller(s) implied in the data aquisition
- - Unlock the controller object
- /END FOR/
-
- /FOR/ Each channel(s) implied in the data aquisition
- - Unlock the channel object
- /END FOR/
-
- - Send acknowledge to the Start method
-
- /WHILE/ master channel state is MOVING (From controller)
- - Sleep for 10 * sleepTime mS
-
- /IF/ If master channel is not moving any more
- - Stop all channels
- - Send a Tango event on the state attribute to the requesting client
- - Leave the loop
- /ENDIF/
-
- /IF/ it is time to read the channel values
- - Read the channel values
- - Send a change event on each value attribute to the requested client if
- the change event criterion is true
- /ENDIF/
- /ENDWHILE/
-
- - Read the channel values
- - Send a forced change event on each value attribute to the requesting client
- with the value set to the one just read
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.scipy.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
-
diff --git a/doc/source/devel/api/tango_macroserver.rst b/doc/source/devel/api/tango_macroserver.rst
deleted file mode 100644
index 93a2a001..00000000
--- a/doc/source/devel/api/tango_macroserver.rst
+++ /dev/null
@@ -1,38 +0,0 @@
-
-==============
-Macro Server
-==============
-
-.. todo:: document this chapter
-
-Introduction
-============
-
-This paper describes the macro server Tango_ :term:`API`.
-
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.scipy.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
-
diff --git a/taurus/doc/source/devel/coding_guide.rst b/doc/source/devel/coding_guide.rst
index 3ac9bbea..3ac9bbea 100644
--- a/taurus/doc/source/devel/coding_guide.rst
+++ b/doc/source/devel/coding_guide.rst
diff --git a/taurus/doc/source/devel/color_guide.rst b/doc/source/devel/color_guide.rst
index 061c7232..061c7232 100644
--- a/taurus/doc/source/devel/color_guide.rst
+++ b/doc/source/devel/color_guide.rst
diff --git a/taurus/doc/source/devel/core_tutorial.rst b/doc/source/devel/core_tutorial.rst
index f7c666ce..f7c666ce 100644
--- a/taurus/doc/source/devel/core_tutorial.rst
+++ b/doc/source/devel/core_tutorial.rst
diff --git a/taurus/doc/source/devel/designer_tutorial.rst b/doc/source/devel/designer_tutorial.rst
index 3c51760b..3c51760b 100644
--- a/taurus/doc/source/devel/designer_tutorial.rst
+++ b/doc/source/devel/designer_tutorial.rst
diff --git a/taurus/doc/source/devel/examples.rst b/doc/source/devel/examples.rst
index 23a4dca4..23a4dca4 100644
--- a/taurus/doc/source/devel/examples.rst
+++ b/doc/source/devel/examples.rst
diff --git a/doc/source/devel/examples/ControllerTemplate.py b/doc/source/devel/examples/ControllerTemplate.py
deleted file mode 100644
index bb072c0b..00000000
--- a/doc/source/devel/examples/ControllerTemplate.py
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/usr/bin/env python
-import sys
-
-"""
-ControllerTemplate.py: Create a basic controller's template.
-Its parameters are the file name plus .py,
- the class inherited if it had (optional)
- and "yes" if you want to use the obsolete convention.
-The necessary "defs" are marked as #TODO
-
-python ControllerTemplate.py ExampleClass.py InheritedClass NoCT
-"""
-__author__ = "Carlos Falcon - cfalcon@cells.es"
-
-class ControllerTemplate():
- def __init__(self,f, e=""):
- self.filename = f
- self.end = e
- self.ind = 'ind'
- # pass
- def addHead(self):
- f=open(self.filename,"w")
- f.write('##############################################################################\n'+\
- '##\n'+\
- '## This file is part of Sardana\n'+\
- '##\n'+\
- '## http://www.sardana-controls.org/\n'+\
- '##\n'+\
- '## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain\n'+\
- '##\n'+\
- '## Sardana is free software: you can redistribute it and/or modify\n'+\
- '## it under the terms of the GNU Lesser General Public License as published by\n'+\
- '## the Free Software Foundation, either version 3 of the License, or\n'+\
- '## (at your option) any later version.\n'+\
- '##\n'+\
- '## Sardana is distributed in the hope that it will be useful,\n'+\
- '## but WITHOUT ANY WARRANTY; without even the implied warranty of\n'+\
- '## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n'+\
- '## GNU Lesser General Public License for more details.\n'+\
- '##\n'+\
- '## You should have received a copy of the GNU Lesser General Public License\n'+\
- '## along with Sardana. If not, see <http://www.gnu.org/licenses/>.\n'+\
- '##\\n'+\
- '##############################################################################\n\n')\
-
- def addIncludes(self,inherit,others=None):
- f = open(self.filename,"a")
- text = "from sardana import State\n"
- if inherit!="":
- text = text+"from sardana.pool.controller import "+inherit+"\n"
- if inherit.find("Motor")>=0:
- self.ind = 'axis'
- if others is not None:
- text = text+others
- text = text+"#ADD others includes\n\n"
- f.write(text)
- #f.close()
-
- def createBasicClass(self):
- f = open(self.filename,"a")
- text = "#TODO - Delete it if you don't need\n"
- text = text +'class BasicClass():\n'+\
- '\tpass\n\n'
- f.write(text)
-
- def createMainClass(self,inherit):
- f = open(self.filename,"a")
- text = "class "+self.filename[0:len(self.filename)-3]+"("+inherit+"):\n"+\
- '\t"""Description""" #TODO\n'+\
- '\tgender = "Simulation"\n'+\
- '\tmodel = "Basic"\n'+\
- '\torganization = "CELLS - ALBA"\n'+\
- '\timage = "IMAGE.png"\n'+\
- '\tlogo = "ALBA_logo.png"\n\n'+\
- '\t#TODO - Delete it if you don\'t need\n'+\
- '\tctrl_properties= { \'AAA\' : { \'Type\' : \'DevString\', \'Description\' : \'AAA\' } }\n'+\
- '\taxis_attributes = { \'AAA\' : { \'type\' : str, \'Description\' : \'AAA\' }}\n\n'+\
- '\tMaxDevice = 1024 #TODO Standar value\n\n'
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# Init()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef __init__(self, inst, props, *args, **kwargs):\n'
- if inherit!="":
- fun = fun + '\t\t' + inherit + '.__init__(self, inst, props, *args, **kwargs)\n'
- fun = fun + '\t\t#TODO\n'
- text = text + fun
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# AddDevice/DelDevice()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef AddDevice(self,'+self.ind+'):\n'
- fun = fun + '\t\t#TODO\n'
- fun = fun + '\tdef DeleteDevice(self, '+self.ind+'):\n'
- fun = fun + '\t\t#TODO\n'
- text = text + fun
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# State()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef PreStateOne'+self.end+'(self, '+self.ind+'):\n'+'\t\tpass\n'
- fun = fun + '\tdef StateOne(self, '+self.ind+'):\n'
- fun = fun + '\t\tstate = State.On\n'
- fun = fun + '\t\tstatus = "Undefined"\n'
- if inherit.find("Motor")>=0:
- fun = fun + '\t\tswitchstate = 0"\n'
- fun = fun + '\t\t#TODO\n'
- fun = fun + '\t\treturn state, status, switchstate"\n'
- else:
- fun = fun + '\t\t#TODO\n'
- fun = fun + '\t\treturn state, status\n'
-
- fun = fun + '\tdef PreStateAll'+self.end+'(self):\n'
- fun = fun + '\t\tpass\n'
-
- fun = fun + '\tdef StateAll'+self.end+'(self):\n'
- fun = fun + '\t\tpass\n'
- text = text + fun
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# Read()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef PreReadOne'+self.end+'(self, '+self.ind+'):\n'+'\t\tpass\n'
- fun = fun + '\tdef ReadOne(self, '+self.ind+'):\n'
- fun = fun + '\t\t#TODO\n'
- fun = fun + '\tdef PreReadAll'+self.end+'(self):\n'
- fun = fun + '\t\tpass\n'
- fun = fun + '\tdef ReadAll'+self.end+'(self):\n'
- fun = fun + '\t\tpass\n'
-
- text = text + fun
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# Start/Stop()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef PreStartOne'+self.end
- if inherit.find("Motor")>=0:
- fun = fun + '(self, '+self.ind+', pos):\n'
- else:
- fun = fun + '(self, '+self.ind+'):\n'
- fun = fun + '\t\tpass\n'
- fun = fun + '\tdef StartOne'+self.end+'(self, '+self.ind+', pos):\n'
- fun = fun + '\t\t#TODO\n'
-
- fun = fun + '\tdef AbortOne(self, '+self.ind+'):\n'
- fun = fun + '\t\t#TODO\n'
-
- fun = fun + '\tdef StopOne(self, '+self.ind+'):\n'
- fun = fun + '\t\tself.AbortOne('+self.ind+')\n'
-
- fun = fun + '\tdef PreStartAll'+self.end+'(self):\n'
- fun = fun + '\t\tpass\n'
-
- fun = fun + '\tdef StartAll'+self.end+'(self):\n'
- fun = fun + '\t\tpass\n'
-
- fun = fun + '\tdef AbortAll(self):\n'
- fun = fun + '\t\tpass\n'
- text = text + fun
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# SetAxisPar/GetAxisPar()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef SetAxisPar(self, '+self.ind+', name, value):\n'
- fun = fun + '\t\t#TODO - Delete it if you don\'t need\n'
-
- fun = fun + '\tdef GetAxisPar(self, '+self.ind+', name):\n'
- fun = fun + '\t\t#TODO - Delete it if you don\'t need\n'
- text = text + fun
-
- fun = '# --------------------------------------------------------------------------\n'+\
- '# SetAxisExtraPar/GetAxisExtraPar()\n'+\
- '# --------------------------------------------------------------------------\n'+\
- '\tdef SetAxisExtraPar(self, '+self.ind+', name, value):\n'
- fun = fun + '\t\t#TODO - Delete it if you don\'t need\n'
-
- fun = fun + '\tdef GetAxisExtraPar(self, '+self.ind+', name):\n'
- fun = fun + '\t\t#TODO - Delete it if you don\'t need - \n'
- text = text + fun
- f.write(text)
-
-
-def main():
- #Add MACRO_PATH
- filename = ""
- end = ""
- inherit = ""
- if(len(sys.argv) > 1):
- print "Creating " + sys.argv[1]
- filename = sys.argv[1]
- if(len(sys.argv) > 2):
- inherit = sys.argv[2]
- if(len(sys.argv) > 3):
- end = "CT"
- s= ControllerTemplate(filename,end)
- s.addHead()
- s.addIncludes(inherit)
- s.createBasicClass()
- s.createMainClass(inherit)
- else:
- print "Please introduce filename"
-
-if __name__ == "__main__":
- main()
diff --git a/taurus/doc/source/devel/examples/TaurusTest.py b/doc/source/devel/examples/TaurusTest.py
index 246ae5d4..246ae5d4 100644
--- a/taurus/doc/source/devel/examples/TaurusTest.py
+++ b/doc/source/devel/examples/TaurusTest.py
diff --git a/doc/source/devel/examples/controller_examples.rst b/doc/source/devel/examples/controller_examples.rst
deleted file mode 100644
index e7aacb21..00000000
--- a/doc/source/devel/examples/controller_examples.rst
+++ /dev/null
@@ -1,16 +0,0 @@
-.. _sardana-devel-controller-examples:
-
-=========================
-Controller examples
-=========================
-
-
-This code let you create a basic template of a controller.
-
-(:download:`Source code <ControllerTemplate.py>`)
-
-.. literalinclude:: ControllerTemplate.py
- :language: python
- :linenos:
-
-
diff --git a/taurus/doc/source/devel/examples/dumpy-bakeout.jdw b/doc/source/devel/examples/dumpy-bakeout.jdw
index 64184e47..64184e47 100644
--- a/taurus/doc/source/devel/examples/dumpy-bakeout.jdw
+++ b/doc/source/devel/examples/dumpy-bakeout.jdw
diff --git a/taurus/doc/source/devel/examples/edit01.py b/doc/source/devel/examples/edit01.py
index 99b3c100..99b3c100 100644
--- a/taurus/doc/source/devel/examples/edit01.py
+++ b/doc/source/devel/examples/edit01.py
diff --git a/taurus/doc/source/devel/examples/edit02.py b/doc/source/devel/examples/edit02.py
index 956bb9e4..956bb9e4 100644
--- a/taurus/doc/source/devel/examples/edit02.py
+++ b/doc/source/devel/examples/edit02.py
diff --git a/taurus/doc/source/devel/examples/edit03.py b/doc/source/devel/examples/edit03.py
index d8c95361..d8c95361 100644
--- a/taurus/doc/source/devel/examples/edit03.py
+++ b/doc/source/devel/examples/edit03.py
diff --git a/doc/source/devel/examples/examples.rst b/doc/source/devel/examples/examples.rst
deleted file mode 100644
index d19bd62a..00000000
--- a/doc/source/devel/examples/examples.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-
-.. _sardana-devel-examples:
-
-=========
-Examples
-=========
-
-.. toctree::
- :maxdepth: 2
-
- Macro examples <macro_examples>
- Controller examples <controller_examples>
diff --git a/taurus/doc/source/devel/examples/forms01.py b/doc/source/devel/examples/forms01.py
index 220b8362..220b8362 100644
--- a/taurus/doc/source/devel/examples/forms01.py
+++ b/doc/source/devel/examples/forms01.py
diff --git a/taurus/doc/source/devel/examples/forms02.py b/doc/source/devel/examples/forms02.py
index 136a8264..136a8264 100644
--- a/taurus/doc/source/devel/examples/forms02.py
+++ b/doc/source/devel/examples/forms02.py
diff --git a/taurus/doc/source/devel/examples/label01.py b/doc/source/devel/examples/label01.py
index c42a2e24..c42a2e24 100644
--- a/taurus/doc/source/devel/examples/label01.py
+++ b/doc/source/devel/examples/label01.py
diff --git a/taurus/doc/source/devel/examples/label02.py b/doc/source/devel/examples/label02.py
index 0b7fce44..0b7fce44 100644
--- a/taurus/doc/source/devel/examples/label02.py
+++ b/doc/source/devel/examples/label02.py
diff --git a/taurus/doc/source/devel/examples/label03.py b/doc/source/devel/examples/label03.py
index d5a482a1..d5a482a1 100644
--- a/taurus/doc/source/devel/examples/label03.py
+++ b/doc/source/devel/examples/label03.py
diff --git a/taurus/doc/source/devel/examples/label04.py b/doc/source/devel/examples/label04.py
index 6f2f2905..6f2f2905 100644
--- a/taurus/doc/source/devel/examples/label04.py
+++ b/doc/source/devel/examples/label04.py
diff --git a/taurus/doc/source/devel/examples/label05.py b/doc/source/devel/examples/label05.py
index 861272f0..861272f0 100644
--- a/taurus/doc/source/devel/examples/label05.py
+++ b/doc/source/devel/examples/label05.py
diff --git a/taurus/doc/source/devel/examples/label06.py b/doc/source/devel/examples/label06.py
index 5820a0b5..5820a0b5 100644
--- a/taurus/doc/source/devel/examples/label06.py
+++ b/doc/source/devel/examples/label06.py
diff --git a/doc/source/devel/examples/macro_call_examples.rst b/doc/source/devel/examples/macro_call_examples.rst
deleted file mode 100644
index 2e9e41d2..00000000
--- a/doc/source/devel/examples/macro_call_examples.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-.. _sardana-devel-macro-call-examples:
-
-=========================
-Macro call examples
-=========================
-
-This chapter consists of a series of examples demonstrating how to call macros
-from inside a macro
-
-
-.. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/submacros.py
- :language: python
- :linenos:
diff --git a/doc/source/devel/examples/macro_examples.rst b/doc/source/devel/examples/macro_examples.rst
deleted file mode 100644
index 8094866d..00000000
--- a/doc/source/devel/examples/macro_examples.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-.. _sardana-devel-macro-examples:
-
-==============
-Macro examples
-==============
-
-.. toctree::
- :maxdepth: 2
-
- Specifying macro parameters <macro_parameter_examples>
- Calling sub-macros <macro_call_examples>
- Plotting <macro_plotting_examples>
- Asking user input <macro_input_examples>
diff --git a/doc/source/devel/examples/macro_input_examples.rst b/doc/source/devel/examples/macro_input_examples.rst
deleted file mode 100644
index 5c3224d3..00000000
--- a/doc/source/devel/examples/macro_input_examples.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.macroserver.macro
-
-.. _sardana-devel-macro-input-examples:
-
-====================
-Macro input examples
-====================
-
-This chapter consists of a series of examples demonstrating how to ask for user
-input inside macros.
-
-A tutorial on macro input parameter can be found :ref:`here <sardana-macro-input>`.
-The :term:`API` documentation: :meth:`~Macro.input`
-
-.. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/user_input.py
- :language: python
- :linenos:
diff --git a/doc/source/devel/examples/macro_parameter_examples.rst b/doc/source/devel/examples/macro_parameter_examples.rst
deleted file mode 100644
index 15ccb0a3..00000000
--- a/doc/source/devel/examples/macro_parameter_examples.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-
-.. _sardana-devel-macro-parameter-examples:
-
-=========================
-Macro parameter examples
-=========================
-
-This chapter consists of a series of examples demonstrating how to declare
-macros which receive parameter(s).
-
-
-.. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/parameters.py
- :language: python
- :linenos:
diff --git a/doc/source/devel/examples/macro_plotting_examples.rst b/doc/source/devel/examples/macro_plotting_examples.rst
deleted file mode 100644
index 7bc63e6f..00000000
--- a/doc/source/devel/examples/macro_plotting_examples.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-
-.. _sardana-devel-macro-plotting-examples:
-
-=========================
-Macro plotting examples
-=========================
-
-This chapter consists of a series of examples demonstrating how to plot graphics
-from inside a macro.
-
-The complete set of :mod:`~matplotlib.pyplot` examples can be found
-:ref:`here <examples-index>`
-
-
-.. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/plotting.py
- :language: python
- :linenos:
diff --git a/taurus/doc/source/devel/examples/parentmodel_issue_demo.py b/doc/source/devel/examples/parentmodel_issue_demo.py
index abf4aa78..abf4aa78 100644
--- a/taurus/doc/source/devel/examples/parentmodel_issue_demo.py
+++ b/doc/source/devel/examples/parentmodel_issue_demo.py
diff --git a/taurus/doc/source/devel/examples/pyqwt_issue_test.py b/doc/source/devel/examples/pyqwt_issue_test.py
index 3db0d41c..3db0d41c 100644
--- a/taurus/doc/source/devel/examples/pyqwt_issue_test.py
+++ b/doc/source/devel/examples/pyqwt_issue_test.py
diff --git a/taurus/doc/source/devel/examples/taurusplot01.py b/doc/source/devel/examples/taurusplot01.py
index 5b068333..5b068333 100644
--- a/taurus/doc/source/devel/examples/taurusplot01.py
+++ b/doc/source/devel/examples/taurusplot01.py
diff --git a/taurus/doc/source/devel/examples/taurusplot02.py b/doc/source/devel/examples/taurusplot02.py
index 6975d1c9..6975d1c9 100644
--- a/taurus/doc/source/devel/examples/taurusplot02.py
+++ b/doc/source/devel/examples/taurusplot02.py
diff --git a/taurus/doc/source/devel/examples/taurusplot03.py b/doc/source/devel/examples/taurusplot03.py
index 4e3948cf..4e3948cf 100644
--- a/taurus/doc/source/devel/examples/taurusplot03.py
+++ b/doc/source/devel/examples/taurusplot03.py
diff --git a/taurus/doc/source/devel/examples/taurustrend01.py b/doc/source/devel/examples/taurustrend01.py
index a0f06570..a0f06570 100644
--- a/taurus/doc/source/devel/examples/taurustrend01.py
+++ b/doc/source/devel/examples/taurustrend01.py
diff --git a/taurus/doc/source/devel/examples/taurusvalue01.py b/doc/source/devel/examples/taurusvalue01.py
index c2cbc9a4..c2cbc9a4 100644
--- a/taurus/doc/source/devel/examples/taurusvalue01.py
+++ b/doc/source/devel/examples/taurusvalue01.py
diff --git a/doc/source/devel/guide_coding.rst b/doc/source/devel/guide_coding.rst
deleted file mode 100644
index 68e169cd..00000000
--- a/doc/source/devel/guide_coding.rst
+++ /dev/null
@@ -1,137 +0,0 @@
-.. _sardana-coding-guide:
-
-==============================
-Sardana development guidelines
-==============================
-
-Overview
----------
-
-This document describes sardana from the perspective of developers. Most
-importantly, it gives information for people who want to contribute code to the
-development of sardana. So if you want to help out, read on!
-
-How to contribute to sardana
-----------------------------
-
-Sardana development is managed with the `Sardana sourceforge project
-<https://sourceforge.net/projects/sardana/>`_.
-
-Apart from directly contributing code, you can contribute to sardana in many
-ways, such as reporting bugs or proposing new features. In all cases you will
-probably need a sourceforge account and you are strongly encouragedto subscribe to the
-`sardana-devel and sardana-users mailing lists <https://sourceforge.net/p/sardana/mailman/>_`.
-
-The rest of this document will focus on how to contribute code.
-
-Cloning and forking sardana from Git
-------------------------------------
-
-You are welcome to clone the Sardana code from our main Git repository::
-
- git clone git://git.code.sf.net/p/sardana/sardana.git sardana
-
-Code contributions (bug patches, new features) are welcome,
-but the review process/workflow for accepting new code is yet to be discussed. For the
-moment, use the sardana-devel mailing list for proposing patches.
-
-Note that you can also `fork the git repository in sourceforge
-<https://sourceforge.net/p/sardana/sardana.git/fork>`_ to get your own
-sourceforge-hosted clone of the sardana repository to which you will have full
-access. This will create a new git repository associated to your personal account in
-sourceforge, so that your changes can be easily shared and eventually merged
-into the official repository.
-
-The old SVN code repository
----------------------------
-
-After the release of Sardana 1.2 the Sardana code was migrated from its previous
-host in a SVN server to its current Git repository
-
-The old SVN repository is still `accessible for reference
-<https://sourceforge.net/p/sardana/code/>`_, but writing has been disabled and
-its contents are frozen as of 2013-07-31. For development, see the instructions
-above on cloning from Git
-
-Documentation
--------------
-
-All standalone documentation should be written in plain text (``.rst``) files
-using reStructuredText_ for markup and formatting. All such
-documentation should be placed in directory :file:`docs/source` of the sardana
-source tree. The documentation in this location will serve as the main source
-for sardana documentation and all existing documentation should be converted
-to this format.
-
-Coding conventions
-------------------
-
-* In general, we try to follow the standard Python style conventions as
- described in
- `Style Guide for Python Code <http://www.python.org/peps/pep-0008.html>`_
-* Code **must** be python 2.6 compatible
-* Use 4 spaces for indentation
-* In the same file, different classes should be separated by 2 lines
-* use ``lowercase`` for module names. If possible prefix module names with the
- word ``sardana`` (like :file:`sardanautil.py`) to avoid import mistakes.
-* use ``CamelCase`` for class names
-* python module first line should be::
-
- #!/usr/bin/env python
-* python module should contain license information (see template below)
-* avoid poluting namespace by making private definitions private (``__`` prefix)
- or/and implementing ``__all__`` (see template below)
-* whenever a python module can be executed from the command line, it should
- contain a ``main`` function and a call to it in a ``if __name__ == "__main__"``
- like statement (see template below)
-* document all code using Sphinx_ extension to reStructuredText_
-
-The following code can serve as a template for writing new python modules to
-sardana::
-
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
-
- ##############################################################################
- ##
- ## This file is part of Sardana
- ##
- ## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
- ##
- ## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
- ##
- ## Sardana is free software: you can redistribute it and/or modify
- ## it under the terms of the GNU Lesser General Public License as published by
- ## the Free Software Foundation, either version 3 of the License, or
- ## (at your option) any later version.
- ##
- ## Sardana is distributed in the hope that it will be useful,
- ## but WITHOUT ANY WARRANTY; without even the implied warranty of
- ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ## GNU Lesser General Public License for more details.
- ##
- ## You should have received a copy of the GNU Lesser General Public License
- ## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
- ##
- ##############################################################################
-
- """A :mod:`sardana` module written for template purposes only"""
-
- __all__ = ["SardanaDemo"]
-
- __docformat__ = "restructuredtext"
-
- class SardanaDemo(object):
- """This class is written for template purposes only"""
-
- def main():
- print "SardanaDemo"s
-
- if __name__ == "__main__":
- main()
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _tango_cs: https://sourceforge.net/projects/tango-cs/
-.. _reStructuredText: http://docutils.sourceforge.net/rst.html
-.. _Sphinx: http://sphinx.pocoo.org/
diff --git a/doc/source/devel/guide_migration.rst b/doc/source/devel/guide_migration.rst
deleted file mode 100644
index e85bcbb5..00000000
--- a/doc/source/devel/guide_migration.rst
+++ /dev/null
@@ -1,212 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-migration-guide:
-
-
-===================================
-Sardana migration guide
-===================================
-
-This chapter describes how to migrate different sardana components between the
-different API versions.
-
-How to migrate your macro code
-===================================
-
-API v0 -> v1
--------------
-
-This chapter describes the necessary steps to fully migrate your macros
-from *API v0* ( sardana 0.x ) to *API v1* ( sardana 1.x )
-
-Mandatory changes
-"""""""""""""""""
-
-The following are the 2 necessary changes to make your macros work in
-sardana *API v1*:
-
-1. from::
-
- from macro import Macro, Type, Table, List
-
- to::
-
- from sardana.macroserver.macro import Macro, Type, Table, List
-
-2. Parameter type ``Type.Motor`` should be changed ``Type.Moveable``.
- In **v0** the `Motor` meant any motor (including physical motor, pseudo
- motor). In **v1**, for consistency, `Motor` means only physical motor
- and `Moveable` means all moveable elements (including physical motor, pseudo
- motor).
-
-New features in API v1
-"""""""""""""""""""""""
-
-This chapter is a summary of all new features in *API v1*.
-
-1. Macros can now be functions(see :ref:`sardana-macros-howto`).
-
-How to migrate your controller code
-===================================
-
-API v0 -> v1
--------------
-
-This chapter describes the necessary steps to fully migrate your controller
-from *API v0* ( sardana 0.x ) to *API v1* ( sardana 1.x )
-
-Mandatory changes
-"""""""""""""""""
-
-The following are the 2 necessary changes to make your controller work in
-sardana *API v1*:
-
-1. from::
-
- import pool
- from pool import <ControllerClass>/PoolUtil
-
- to::
-
- from sardana import pool
- from sardana.pool import PoolUtil
- from sardana.pool.controller import <ControllerClass>
-
-2. change contructor from::
-
- def __init__(self, inst, props):
- code
-
- to::
-
- def __init__(self, inst, props, *args, **kwargs):
- MotorController.__init__(self, inst, props, *args, **kwargs)
- code
-
- (and don't forget to call the super class constructor also with args
- and kwargs).
-
-The following change is not mandatory but is necessary in order for your
-controller to be recognized by the pool to be a *API v1* controller:
-
-3. _log member changed from :class:`logging.Logger` to
- :class:`taurus.core.util.Logger`. This means that you need to change code
- from::
-
- self._log.setLevel(logging.INFO)
-
- to::
-
- self._log.setLogLevel(logging.INFO)
-
- or::
-
- self._log.setLogLevel(taurus.Info)
-
- since taurus.Info == logging.INFO.
-
-
-Optional changes
-""""""""""""""""
-
-The following changes are not necessary to make your controller work. The
-*API v1* supports the *API v0* on these matters.
-
-1. **class members**:
-
- #. from: :attr:`~Controller.class_prop` to: :attr:`~Controller.ctrl_properties`
- #. from: :attr:`~Controller.ctrl_extra_attributes` to: :attr:`~Controller.axis_attributes`
- #. new feature in *API v1*: :attr:`~Controller.ctrl_attributes`
-
-3. **data types**:
-
- #. :meth:`~Controller.StateOne` **return type**: Previously
- :meth:`~Controller.StateOne` had to return a member of
- :class:`PyTango.DevState`. Now it **can** instead return a member of
- :class:`~sardana.sardanadefs.State`. This eliminates the need to import
- :mod:`PyTango`.
- #. In *API v0* class member (like :attr:`~Controller.ctrl_extra_attributes`)
- value for key *type* had to be a string (like 'PyTango.DevString' or
- 'PyTango.DevDouble'). Now they can be a python type (like str or float).
- Please check :ref:`sardana-controller-data-type` for more information.
-
-4. **generic controller method names**:
-
- #. from: :meth:`~Controller.GetPar` to: :meth:`~Controller.GetAxisPar`
- #. from: :meth:`~Controller.SetPar` to: :meth:`~Controller.SetAxisPar`
- #. from: :meth:`~Controller.GetExtraAttributePar` to: :meth:`~Controller.GetAxisExtraPar`
- #. from: :meth:`~Controller.SetExtraAttributePar` to: :meth:`~Controller.SetAxisExtraPar`
- #. new feature in *API v1*: :meth:`~Controller.GetCtrlPar`, :meth:`~Controller.SetCtrlPar`
- #. new feature in *API v1*: :meth:`~Stopable.AbortAll` (has default
- implementation which calls :meth:`~Stopable.AbortOne` for each axis)
-
-5. **pseudo motor controller method names**:
-
- #. from: :meth:`~PseudoMotorController.calc_pseudo` to: :meth:`~PseudoMotorController.CalcPseudo`
- #. from: :meth:`~PseudoMotorController.calc_physical` to: :meth:`~PseudoMotorController.CalcPhysical`
- #. from: :meth:`~PseudoMotorController.calc_all_pseudo` to: :meth:`~PseudoMotorController.CalcAllPseudo`
- #. from: :meth:`~PseudoMotorController.calc_all_physical` to: :meth:`~PseudoMotorController.CalcAllPhysical`
- #. new feature in *API v1*: :meth:`~PseudoMotorController.GetMotor`
- #. new feature in *API v1*: :meth:`~PseudoMotorController.GetPseudoMotor`
-
-New features in API v1
-"""""""""""""""""""""""
-
-This chapter is a summary of all new features in *API v1*.
-
-*New controller features:*
-
-1. All Controllers now have a :attr:`~Controller.ctrl_attributes` class member
- to define extra controller attributes (and new methods:
- :meth:`~Controller.GetCtrlPar`, :meth:`~Controller.SetCtrlPar`)
-2. For :attr:`~Controller.ctrl_properties`, :attr:`~Controller.axis_attributes`
- and :attr:`~Controller.ctrl_extra_attributes`:
-
- - new (more pythonic) syntax. Old syntax is still supported:
- - can replace data type strings for python type ('PyTango.DevDouble' -> float)
- - Default behavior. Example: before data access needed to be described explicitly.
- Now it is read-write by default.
- - support for 2D
- - new keys 'fget' and 'fset' override default method calls
-3. no need to import :mod:`PyTango` (:meth:`~Controller.StateOne` can return
- sardana.State.On instead of PyTango.DevState.ON)
-4. PseudoMotorController has new :meth:`~PseudoMotorController.GetMotor` and
- :meth:`~PseudoMotorController.GetPseudoMotor`
-5. new :meth:`~Stopable.AbortAll` (with default implementation which calls
- :meth:`~Stopable.AbortOne` for each axis)
-6. new :meth:`~Stopable.StopOne` (with default implementation which calls
- :meth:`~Stopable.AbortOne`)
-7. new :meth:`~Stopable.StopAll` (with default implementation which calls
- :meth:`~Stopable.StoptOne` for each axis)
-8. new :meth:`~Controller.GetAxisAttributes` allows features like:
- 1. per axis customized dynamic attributes
- 2. Basic interface (example: motor without velocity or acceleration)
- 3. Discrete motor (declare position has an integer instead of a float).
- No need for IORegisters anymore
-9. New :class:`~MotorController` constants:
- - :class:`~MotorController.HomeLimitSwitch`;
- - :class:`~MotorController.UpperLimitSwitch`;
- - :class:`~MotorController.LowerLimitSwitch`
-
-*New acquisition features:*
-
-1. Measurement group has a new *Configuration* attribute which contains the full
- description of the experiment in JSON format
-
-*New Tango API features:*
-
-1. Controllers are now Tango devices
-2. Pool has a default PoolPath (points to <pool install dir>/poolcontrollers)
-3. Create* commands can receive JSON object or an old style list of parameters
-4. new CreateElement command (can replace CreateMotor, CreateExpChannel, etc)
-5. Pool Abort command: aborts all elements (non pseudo elements)
-6. Pool Stop command: stops all elements (non pseudo elements)
-7. Controller Abort command: aborts all controller elements
-8. Controller Stop command: stops all controller elements
-9. Controllers have a LogLevel attribute which allows remote python logging
- management
-
-*Others:*
-
-1. Pool device is a python device :-)
-2. many command line parameters help logging, debugging
diff --git a/doc/source/devel/howto_controllers/howto_0dcontroller.rst b/doc/source/devel/howto_controllers/howto_0dcontroller.rst
deleted file mode 100644
index 23c5af66..00000000
--- a/doc/source/devel/howto_controllers/howto_0dcontroller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-0dcontroller-howto-basics:
-
-============================
-How to write a 0D controller
-============================
-
-The basics
-----------
-
-.. todo:: document 0D controller howto
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_1dcontroller.rst b/doc/source/devel/howto_controllers/howto_1dcontroller.rst
deleted file mode 100644
index 634654e7..00000000
--- a/doc/source/devel/howto_controllers/howto_1dcontroller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-1dcontroller-howto-basics:
-
-============================
-How to write a 1D controller
-============================
-
-The basics
-----------
-
-.. todo:: document 1D controller howto
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_2dcontroller.rst b/doc/source/devel/howto_controllers/howto_2dcontroller.rst
deleted file mode 100644
index bc73fceb..00000000
--- a/doc/source/devel/howto_controllers/howto_2dcontroller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-2dcontroller-howto-basics:
-
-============================
-How to write a 2D controller
-============================
-
-The basics
-----------
-
-.. todo:: document 2D controller howto
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_controller.rst b/doc/source/devel/howto_controllers/howto_controller.rst
deleted file mode 100644
index 508ca916..00000000
--- a/doc/source/devel/howto_controllers/howto_controller.rst
+++ /dev/null
@@ -1,533 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-controller-howto-whatis:
-
-====================
-What is a controller
-====================
-
-A controller in sardana is a piece of software capable of *translating*
-between the sardana :term:`API` and a specific hardware :term:`API`. Sardana
-expects a controller to obey a specific :term:`API` in order to be able to
-properly configure and operate with it. The hardware :term:`API` used by the
-controller could be anything, from a pure serial line to shared memory or a
-remote server written in Tango_, Taco_ or even EPICS_.
-
-Controllers can only be written in Python_ (in future also C++ will be
-possible). A controller **must** be a :term:`class` inheriting from one of the
-existing controller types:
-
-.. hlist::
- :columns: 3
-
- - :class:`MotorController`
- - :class:`CounterTimerController`
- - :class:`ZeroDController`
- - :class:`OneDController`
- - :class:`TwoDController`
- - :class:`IORegisterController`
-
- - :class:`PseudoMotorController`
- - :class:`PseudoCounterController`
-
-A controller is designed to incorporate a set of generic individual elements.
-Each element has a corresponding *axis*. For example, in a motor
-controller the elements will be motors, but in a counter/timer controller the
-elements will be experimental channels.
-
-Some controller classes are designed to target a specific type of hardware.
-Other classes of controllers, the *pseudo* classes, are designed to provide a
-high level view over a set of underlying lower level controller elements.
-
-We will focus first on writing low level hardware controllers since they
-share some of the :term:`API` and after on the *pseudo* controllers.
-
-.. _sardana-controller-howto-basics:
-
-Controller - The basics
------------------------
-
-The first thing to do is to import the necessary symbols from sardana library.
-As you will see, most symbols can be imported through the
-:mod:`sardana.pool.controller` module:
-
-.. code-block:: python
-
- import springfieldlib
-
- from sardana.pool.controller import MotorController
-
- class SpringfieldMotorController(MotorController):
- """A motor controller intended from demonstration purposes only"""
- pass
-
-The common :term:`API` to all low level controllers includes the set of methods
-to:
-
- #. construct the controller
- #. add/delete a controller element [#f1]_
- #. obtain the state of controller element(s) [#f2]_
- #. define, set and get extra axis attributes
- #. define, set and get extra controller attributes
- #. define, set and get extra controller properties
-
-In the following chapters the examples will be based on a motor controller
-scenario.
-
-The examples use a :mod:`springfieldlib` module which emulates a motor hardware
-access library.
-
-The :mod:`springfieldlib` can be downloaded from
-:download:`here <springfieldlib.py>`.
-
-The Springfield motor controller can be downloaded from
-:download:`here <sf_motor_ctrl.py>`.
-
-.. _sardana-controller-howto-constructor:
-
-Constructor
-~~~~~~~~~~~
-
-The constructor consists of the
-:meth:`~sardana.pool.controller.Controller.__init__` method. This method is
-called when you create a new controller of that type and every time the sardana
-server is started. It will also be called if the controller code has changed
-on the file and the new code is reloaded into sardana.
-
-It is **NOT** mandatory to override the :meth:`~sardana.pool.controller.Controller.__init__`
-from :class:`~sardana.pool.controller.MotorController` . Do it only
-if you need to add some initialization code. If you do it, it is **very important**
-to follow the two rules:
-
- #. use the method signature: ``__init__(self, inst, props, *args, **kwargs)``
- #. always call the super class constructor
-
-The example shows how to implement a constructor for a motor controller:
-
-.. code-block:: python
- :emphasize-lines: 3
-
- class SpringfieldMotorController(MotorController):
-
- def __init__(self, inst, props, *args, **kwargs):
- super(SpringfieldMotorController, self).__init__(inst, props, *args, **kwargs)
-
- # initialize hardware communication
- self.springfield = springfieldlib.SpringfieldMotorHW()
-
- # do some initialization
- self._motors = {}
-
-.. _sardana-controller-howto-add-delete:
-
-Add/Delete axis
-~~~~~~~~~~~~~~~
-
-Each individual element in a controller is called *axis*. An axis is represented
-by a number. A controller can support one or more axes. Axis numbers don't need
-to be sequencial. For example, at one time you may have created for your motor
-controller instance only axis 2 and 5.
-
-Two methods are called when creating or removing an element from a controller.
-These methods are :meth:`~sardana.pool.controller.Controller.AddDevice` and
-:meth:`~sardana.pool.controller.Controller.DeleteDevice`. The
-:meth:`~sardana.pool.controller.Controller.AddDevice` method is called when a
-new axis belonging to the controller is created in sardana. The
-:meth:`~sardana.pool.controller.Controller.DeleteDevice` method is
-called when an axis belonging to the controller is removed from sardana.
-The example shows an example how to implement these methods on a motor
-controller:
-
-.. code-block:: python
- :emphasize-lines: 3, 6
-
- class SpringfieldMotorController(MotorController):
-
- def AddDevice(self, axis):
- self._motors[axis] = True
-
- def DeleteDevice(self, axis):
- del self._motor[axis]
-
-.. _sardana-controller-howto-axis-state:
-
-Get axis state
-~~~~~~~~~~~~~~
-
-To get the state of an axis, sardana calls the
-:meth:`~sardana.pool.controller.Controller.StateOne` method. This method
-receives an axis as parameter and should return either:
-
- - state (:obj:`~sardana.sardanadefs.State`) or
- - a sequence of two elements:
- - state (:obj:`~sardana.sardanadefs.State`)
- - status (:obj:`str`)
-
-(For motor controller see :ref:`get motor state <sardana-motorcontroller-howto-axis-state>` ):
-
-The state should be a member of :obj:`~sardana.sardanadefs.State` (For backward
-compatibility reasons, it is also supported to return one of
-:class:`PyTango.DevState`). The status could be any string.
-
-If you return a :obj:`~sardana.sardanadefs.State` object, sardana will compose a
-status string with:
-
- <axis name> is in <state name>
-
-Here is an example of the possible implementation of
-:meth:`~sardana.pool.controller.Controller.StateOne` :
-
-.. code-block:: python
- :emphasize-lines: 11
-
- from sardana import State
-
- class SpringfieldMotorController(MotorController):
-
- StateMap = {
- 1 : State.On,
- 2 : State.Moving,
- 3 : State.Fault,
- }
-
- def StateOne(self, axis):
- springfield = self.springfield
- state = self.StateMap[ springfield.getState(axis) ]
- status = springfield.getStatus(axis)
- return state, status
-
-
-.. _sardana-controller-howto-axis-attributes:
-
-Extra axis attributes
-~~~~~~~~~~~~~~~~~~~~~
-
-Each axis is associated a set of standard attributes. These attributes depend
-on the type of controller (example, a motor will have velocity, acceleration but
-a counter won't).
-
-Additionally, you can specify an additional set of extra attributes on each axis.
-
-Lets suppose that a Springfield motor controller can do close loop on hardware.
-We could define an extra motor attribute on each axis that (de)actives close
-loop on demand.
-
-The first thing to do is to specify which are the extra attributes.
-This is done through the :attr:`~sardana.pool.controller.Controller.axis_attributes`.
-This is basically a dictionary were the keys are attribute names and the value
-is a dictionary describing the folowing properties for each attribute:
-
-===================== ========= ============================================ ======================================================= ===============================================
-config. parameter Mandatory Key Default value Example
-===================== ========= ============================================ ======================================================= ===============================================
-data type & format Yes :obj:`~sardana.pool.controller.Type` --- :obj:`int`
-data access No :obj:`~sardana.pool.controller.Access` :obj:`~sardana.pool.controller.Access.ReadWrite` :obj:`~sardana.pool.controller.Access.ReadOnly`
-description No :obj:`~sardana.pool.controller.Description` "" (empty string) "the motor encoder source"
-default value No :obj:`~sardana.pool.controller.DefaultValue` --- 12345
-getter method name No :obj:`~sardana.pool.controller.FGet` "get" + <name> "getEncoderSource"
-setter method name No :obj:`~sardana.pool.controller.FSet` "set" + <name> "setEncoderSource"
-memorize value No :obj:`~sardana.pool.controller.Memorize` :obj:`~sardana.pool.controller.Memorized` :obj:`~sardana.pool.controller.NotMemorized`
-max dimension size No :obj:`~sardana.pool.controller.MaxDimSize` Scalar: ``()``; 1D: ``(2048,)``; 2D: ``(2048, 2048)`` ``(2048,)``
-===================== ========= ============================================ ======================================================= ===============================================
-
-Here is an example of how to specify the scalar, boolean, read-write *CloseLoop*
-extra attribute in a Springfield motor controller:
-
-.. code-block:: python
- :emphasize-lines: 6, 14, 17
-
- from sardana import DataAccess
- from sardana.pool.controller import Type, Description, DefaultValue, Access, FGet, FSet
-
- class SpringfieldMotorController(MotorController):
-
- axis_attributes = {
- "CloseLoop" : {
- Type : bool,
- Description : "(de)activates the motor close loop algorithm",
- DefaultValue : False,
- },
- }
-
- def getCloseLoop(self, axis):
- return self.springfield.isCloseLoopActive(axis)
-
- def setCloseLoop(self, axis, value):
- self.springfield.setCloseLoop(axis, value)
-
-When sardana needs to read the close loop value, it will first check if the
-controller has the method specified by the :obj:`~sardana.pool.controller.FGet`
-keyword (we didn't specify it in
-:attr:`~sardana.pool.controller.Controller.axis_attributes` so it defaults to
-*getCloseLoop*). It will then call this controller method which
-should return a value compatible with the attribute data type.
-
-As an alternative, to avoid filling the controller code with pairs of get/set
-methods, you can choose not to write the getCloseLoop and setCloseLoop methods.
-This will trigger sardana to call the
-:meth:`~sardana.pool.controller.Controller.GetAxisExtraPar`
-/:meth:`~sardana.pool.controller.Controller.SetAxisExtraPar` pair of methods.
-The disadvantage is you will end up with a forest of :keyword:`if` ...
-:keyword:`elif` ... :keyword:`else` statements. Here is the alternative
-implementation:
-
-.. code-block:: python
- :emphasize-lines: 6, 14, 18
-
- from sardana import DataAccess
- from sardana.pool.controller import Type, Description, DefaultValue, Access, FGet, FSet
-
- class SpringfieldMotorController(MotorController):
-
- axis_attributes = {
- "CloseLoop" : {
- Type : bool,
- Description : "(de)activates the motor close loop algorithm",
- DefaultValue : False,
- },
- }
-
- def GetAxisExtraPar(self, axis, parameter):
- if parameter == 'CloseLoop':
- return self.springfield.isCloseLoopActive(axis)
-
- def SetAxisExtraPar(self, axis, parameter, value):
- if parameter == 'CloseLoop':
- self.springfield.setCloseLoop(axis, value)
-
-Sardana gives you the choice: we leave it up to you to decide which is the
-better option for your specific case.
-
-.. _sardana-controller-howto-controller-attributes:
-
-Extra controller attributes
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Besides extra attributes per axis, you can also define extra attributes at the
-controller level.
-In order to do that you have to specify the extra controller attribute(s) within
-the :attr:`~sardana.pool.controller.Controller.ctrl_attributes` member. The
-syntax for this dictionary is the same as the one used for
-:attr:`~sardana.pool.controller.Controller.axis_attributes`.
-
-Here is an example on how to specify a read-only float matrix attribute called
-*ReflectionMatrix* at the controller level:
-
-.. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- ctrl_attributes = {
- "ReflectionMatrix" : {
- Type : ( (float,), ),
- Description : "The reflection matrix",
- Access : DataAccess.ReadOnly,
- },
- }
-
- def getReflectionMatrix(self):
- return ( (1.0, 0.0), (0.0, 1.0) )
-
-Or, similar to what you can do with axis attributes:
-
-.. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- ctrl_attributes = \
- {
- "ReflectionMatrix" : {
- Type : ( (float,), ),
- Description : "The reflection matrix",
- Access : DataAccess.ReadOnly,
- },
- }
-
- def GetCtrlPar(self, name):
- if name == "ReflectionMatrix":
- return ( (1.0, 0.0), (0.0, 1.0) )
-
-.. _sardana-controller-howto-controller-properties:
-
-Extra controller properties
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-A more static form of attributes can be defined at the controller level.
-These *properties* are loaded into the controller at the time of object
-construction. They are accessible to your controller at any time but it is
-not possible for a user from outside to modify them.
-The way to define :attr:`~sardana.pool.controller.Controller.ctrl_properties` is
-very similar to the way you define extra axis attributes or extra controller
-attributes.
-
-Here is an example on how to specify a host and port properties:
-
-.. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- ctrl_properties = \
- {
- "host" : {
- Type : str,
- Description : "host name"
- },
- "port" : {
- Type : int,
- Description : "port number",
- DefaultValue: springfieldlib.SpringfieldMotorHW.DefaultPort
- },
- }
-
- def __init__(self, inst, props, *args, **kwargs):
- super(SpringfieldMotorController, self).__init__(inst, props, *args, **kwargs)
-
- host = self.host
- port = self.port
-
- # initialize hardware communication
- self.springfield = springfieldlib.SpringfieldMotorHW(host=host, port=port)
-
- # do some initialization
- self._motors = {}
-
-As you can see from lines 15 and 16, to access your controller properties
-simply use ``self.<property name>``. Sardana assures that every property has a
-value. In our case, when a SpringfieldMotorController is created, if port
-property is not specified by the user (example: using the ``defctrl`` macro in
-spock), sardana assignes the default value
-``springfieldlib.SpringfieldMotorHW.DefaultPort``. On the other hand, since host
-has no default value, if it is not specified by the user, sardana will complain
-and fail to create and instance of SpringfieldMotorController.
-
-.. _sardana-controller-howto-error-handling:
-
-Error handling
-~~~~~~~~~~~~~~
-
-When you write a controller it is important to properly handle errors
-(example: motor power overload, hit a limit switch, lost of communication with
-the hardware).
-
-These are the two basic sardana rules you should have in mind:
-
-#. The exceptions which are not handled by the controller are handled by sardana,
- usually by re-raising the exception (when sardana runs as a Tango_ DS a
- translation is done from the Python_ exception to a Tango_ exception).
- The :meth:`~sardana.pool.controller.Controller.StateOne` method is handled a
- little differently: the state is set to ``Fault`` and the status will contain
- the exception information.
-
-#. When the methods which are supposed to return a value (like
- :meth:`~sardana.pool.controller.Controller.GetAxisPar`) don't return a value
- compatible with the expected data type (including :obj:`None`) a
- :exc:`TypeError` exception is thrown.
-
-In every method you should carefully choose how to do handle the possible
-exceptions/errors.
-
-Usually, catch and handle is the best technique since it is the code of your
-controller which knows exactly the workings of the hardware. You can
-discriminate errors and decide a proper handle for each. Essencially, this
-technique consists of:
-
-#. catching the error (if an exception: with :keyword:`try` ... :keyword:`except`
- clause, if an expected return of a function: with a :keyword:`if` ...
- :keyword:`elif` ... :keyword:`else` statement, etc)
-
-#. raise a proper exception (could be the same exception that has been catched)
- or, if in :meth:`~sardana.pool.controller.Controller.StateOne`, return the
- apropriate error state (``Fault``, ``Alarm``) and a descriptive status.
-
-Here is an example: if the documentation of the underlying library says that:
-
- `reading the motor closeloop raises CommunicationFailed if it is not
- possible to communicate with the Springfield hardware`
-
- `reading the motor state raises MotorPowerOverload if the motors
- has a power overload or a MotorTempTooHigh when the motor
- temperature is too high`
-
-then you should handle the exception in the controller and return a proper
-state information::
-
- def getCloseLoop(self, axis):
- # Here the "proper exception" to raise in case of error is actually the
- # one that is raised from the springfield library so handling the
- # exception is transparent. Nice!
- return self.springfield.isCloseLoopActive(axis)
-
- def StateOne(self, axis):
- springfield = self.springfield
-
- try:
- state = self.StateMap[ springfield.getState(axis) ]
- status = springfield.getStatus(axis)
- except springfieldlib.MotorPowerOverload:
- state = State.Fault
- status = "Motor has a power overload"
- except springfieldlib.MotorTempTooHigh:
- temp = springfield.getTemperature(axis)
- state = State.Alarm
- status = "Motor temperature is too high (%f degrees)" % temp
-
- limit_switches = MotorController.NoLimitSwitch
- hw_limit_switches = springfield.getLimits(axis)
- if hw_limit_switches[0]:
- limit_switches |= MotorController.HomeLimitSwitch
- if hw_limit_switches[1]:
- limit_switches |= MotorController.UpperLimitSwitch
- if hw_limit_switches[2]:
- limit_switches |= MotorController.LowerLimitSwitch
- return state, status, limit_switches
-
-Hiding the exception is usually a **BAD** technique since it prevents the user
-from finding what was the cause of the problem. You should only use it in
-extreme cases (example: if there is a bug in sardana which crashes the server
-if you try to properly raise an exception, then you can **temporarely** use
-this technique until the bug is solved).
-
-Example::
-
- def getCloseLoop(self, axis):
- # BAD error handling technique
- try:
- return self.springfield.isCloseLoopActive(axis)
- except:
- pass
-
-.. rubric:: Footnotes
-
-.. [#f1] Pseudo controllers don't need to manage their individual axis. Therefore,
- for pseudos you will not implement these methods
-
-
-.. [#f2] For pseudo controllers, sardana will calculate the state of each pseudo
- axis based on the state of the elements that serve as input to the
- pseudo controller. Therefore, for pseudos you will not implement these
- methods
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_countertimercontroller.rst b/doc/source/devel/howto_controllers/howto_countertimercontroller.rst
deleted file mode 100644
index 22976064..00000000
--- a/doc/source/devel/howto_controllers/howto_countertimercontroller.rst
+++ /dev/null
@@ -1,105 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-countertimercontroller-howto-basics:
-
-=======================================
-How to write a counter/timer controller
-=======================================
-
-The basics
-----------
-
-An example of a hypothetical *Springfield* counter/timer controller will be build
-incrementally from scratch to aid in the explanation.
-
-By now you should have read the general controller basics chapter. You should
-be able to create a CounterTimerController with:
-
-- a proper constructor,
-- add and delete axis methods
-- get axis state
-
-
-.. code-block:: python
-
- import springfieldlib
-
- from sardana.pool.controller import CounterTimerController
-
- class SpringfieldCounterTimerController(CounterTimerController):
-
- def __init__(self, inst, props, *args, **kwargs):
- super(SpringfieldCounterTimerController, self).__init__(inst, props, *args, **kwargs)
-
- # initialize hardware communication
- self.springfield = springfieldlib.SpringfieldCounterHW()
-
- # do some initialization
- self._counters = {}
-
- def AddDevice(self, axis):
- self._counters[axis] = True
-
- def DeleteDevice(self, axis):
- del self._counters[axis]
-
- StateMap = {
- 1 : State.On,
- 2 : State.Moving,
- 3 : State.Fault,
- }
-
- def StateOne(self, axis):
- springfield = self.springfield
- state = self.StateMap[ springfield.getState(axis) ]
- status = springfield.getStatus(axis)
- return state, status
-
-The examples use a :mod:`springfieldlib` module which emulates a counter/timer
-hardware access library.
-
-The :mod:`springfieldlib` can be downloaded from
-:download:`here <springfieldlib.py>`.
-
-The Springfield counter/timer controller can be downloaded from
-:download:`here <sf_ct_ctrl.py>`.
-
-The following code describes a minimal *Springfield* base counter/timer controller
-which is able to return both the state and value of an individual counter as
-well as to start an acquisition:
-
-.. literalinclude:: sf_ct_ctrl.py
- :pyobject: SpringfieldBaseCounterTimerController
-
-This code is shown only to demonstrate the minimal controller :term:`API`.
-The advanced counter/timer controller chapters describe how to account for more
-complex behaviour like reducing the number of hardware accesses.
-
-.. todo:: finish counter/timer controller howto
-
-
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_ioregistercontroller.rst b/doc/source/devel/howto_controllers/howto_ioregistercontroller.rst
deleted file mode 100644
index ed669c03..00000000
--- a/doc/source/devel/howto_controllers/howto_ioregistercontroller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-ioregistercontroller-howto-basics:
-
-=======================================
-How to write an I/O register controller
-=======================================
-
-The basics
-----------
-
-.. todo:: document IORegister controller howto
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_motorcontroller.rst b/doc/source/devel/howto_controllers/howto_motorcontroller.rst
deleted file mode 100644
index bb2aa272..00000000
--- a/doc/source/devel/howto_controllers/howto_motorcontroller.rst
+++ /dev/null
@@ -1,694 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-motorcontroller-howto-basics:
-
-===============================
-How to write a motor controller
-===============================
-
-The basics
-----------
-
-An example of a hypothetical *Springfield* motor controller will be build
-incrementally from scratch to aid in the explanation.
-
-By now you should have read the general controller basics chapter. You should
-now have a MotorController with a proper constructor, add and delete axis methods:
-
-.. code-block:: python
-
- import springfieldlib
-
- from sardana.pool.controller import MotorController
-
- class SpringfieldMotorController(MotorController):
-
- def __init__(self, inst, props, *args, **kwargs):
- super(SpringfieldMotorController, self).__init__(inst, props, *args, **kwargs)
-
- # initialize hardware communication
- self.springfield = springfieldlib.SpringfieldMotorHW()
-
- # do some initialization
- self._motors = {}
-
- def AddDevice(self, axis):
- self._motors[axis] = True
-
- def DeleteDevice(self, axis):
- del self._motor[axis]
-
-The *get axis state* method has some details that will be explained below.
-
-The examples use a :mod:`springfieldlib` module which emulates a motor hardware
-access library.
-
-The :mod:`springfieldlib` can be downloaded from
-:download:`here <springfieldlib.py>`.
-
-The Springfield motor controller can be downloaded from
-:download:`here <sf_motor_ctrl.py>`.
-
-The following code describes a minimal *Springfield* base motor controller
-which is able to return both the state and position of a motor as well as move
-a motor to the desired position:
-
-.. literalinclude:: sf_motor_ctrl.py
- :pyobject: SpringfieldBaseMotorController
-
-This code is shown only to demonstrate the minimal controller :term:`API`.
-The advanced motor controller chapters describe how to account for more complex
-behaviour like reducing the number of hardware accesses or synchronize motion of
-multiple motors.
-
-.. _sardana-motorcontroller-howto-axis-state:
-
-Get motor state
-~~~~~~~~~~~~~~~
-
-To get the state of a motor, sardana calls the
-:meth:`~sardana.pool.controller.Controller.StateOne` method. This method
-receives an axis as parameter and should return a sequence of three values:
-
-To get the state of a motor, sardana calls the
-:meth:`~sardana.pool.controller.Controller.StateOne` method. This method
-receives an axis as parameter and should return either:
-
- - state (:obj:`~sardana.sardanadefs.State`) or
- - a sequence of two elements:
- - state (:obj:`~sardana.sardanadefs.State`)
- - status (:obj:`str`) *or* limit switches (:obj:`int`)
- - a sequence of three elements:
- - state (:obj:`~sardana.sardanadefs.State`)
- - status (:obj:`str`)
- - limit switches (:obj:`int`)
-
-The state should be a member of :obj:`~sardana.sardanadefs.State` (For backward
-compatibility reasons, it is also supported to return one of
-:class:`PyTango.DevState`). The status could be any string. The limit switches
-is a integer with bits representing the three possible limits: home, upper
-and lower. Sardana provides three constants which can be *or*\ed together to
-provide the desired limit switch:
-
-.. hlist::
- :columns: 4
-
- - :attr:`~MotorController.NoLimitSwitch`
- - :attr:`~MotorController.HomeLimitSwitch`
- - :attr:`~MotorController.UpperLimitSwitch`
- - :attr:`~MotorController.LowerLimitSwitch`
-
-To say both home and lower limit switches are active (rare!) you can do::
-
- limit_switches = MotorController.HomeLimitSwitch | MotorController.LowerLimitSwitch
-
-If you don't return a status, sardana will compose a status string with:
-
- <axis name> is in <state name>
-
-If you don't return limit switches, sardana will assume all limit switches are
-off.
-
-Here is an example of the possible implementation of
-:meth:`~sardana.pool.controller.Controller.StateOne`:
-
-.. code-block:: python
- :emphasize-lines: 11
-
- from sardana import State
-
- class SpringfieldMotorController(MotorController):
-
- StateMap = {
- 1 : State.On,
- 2 : State.Moving,
- 3 : State.Fault,
- }
-
- def StateOne(self, axis):
- springfield = self.springfield
- state = self.StateMap[ springfield.getState(axis) ]
- status = springfield.getStatus(axis)
-
- limit_switches = MotorController.NoLimitSwitch
- hw_limit_switches = springfield.getLimits(axis)
- if hw_limit_switches[0]:
- limit_switches |= MotorController.HomeLimitSwitch
- if hw_limit_switches[1]:
- limit_switches |= MotorController.UpperLimitSwitch
- if hw_limit_switches[2]:
- limit_switches |= MotorController.LowerLimitSwitch
- return state, status, limit_switches
-
-.. _sardana-motorcontroller-howto-value:
-
-Get motor position
-~~~~~~~~~~~~~~~~~~
-
-To get the motor position, sardana calls the
-:meth:`~sardana.pool.controller.Readable.ReadOne` method. This method
-receives an axis as parameter and should return a valid position. Sardana
-interprets the returned position as a :term:`dial position`.
-
-Here is an example of the possible implementation of
-:meth:`~sardana.pool.controller.Readable.ReadOne`:
-
-.. code-block:: python
- :emphasize-lines: 3
-
- class SpringfieldMotorController(MotorController):
-
- def ReadOne(self, axis):
- position = self.springfield.getPosition(axis)
- return position
-
-.. _sardana-motorcontroller-howto-move:
-
-Move a motor
-~~~~~~~~~~~~
-
-When an order comes for sardana to move a motor, sardana will call the
-:meth:`~sardana.pool.controller.Startable.StartOne` method. This method receives
-an axis and a position. The controller code should trigger the hardware motion.
-The given position is always the :term:`dial position`.
-
-Here is an example of the possible implementation of
-:meth:`~sardana.pool.controller.Startable.StartOne`:
-
-.. code-block:: python
- :emphasize-lines: 3
-
- class SpringfieldMotorController(MotorController):
-
- def StartOne(self, axis, position):
- self.springfield.move(axis, position)
-
-As soon as :meth:`~sardana.pool.controller.Startable.StartOne` is invoked,
-sardana expects the motor to be moving. It enters a high frequency motion
-loop which asks for the motor state through calls to
-:meth:`~sardana.pool.controller.Controller.StateOne`. It will keep the loop
-running as long as the controller responds with ``State.Moving``.
-If :meth:`~sardana.pool.controller.Controller.StateOne` raises an exception
-or returns something other than ``State.Moving``, sardana will assume the motor
-is stopped and exit the motion loop.
-
-For a motion to work properly, it is therefore, **very important** that
-:meth:`~sardana.pool.controller.Controller.StateOne` responds correctly.
-
-.. _sardana-motorcontroller-howto-stop:
-
-Stop a motor
-~~~~~~~~~~~~
-
-It is possible to stop a motor when it is moving. When sardana is ordered to
-stop a motor motion, it invokes the :meth:`~sardana.pool.controller.Stopable.StopOne`
-method. This method receives an axis parameter. The controller should make
-sure the desired motor is *gracefully* stopped, if possible, respecting the
-configured motion parameters (like deceleration and base_rate).
-
-Here is an example of the possible implementation of
-:meth:`~sardana.pool.controller.Stopable.StopOne`:
-
-.. code-block:: python
- :emphasize-lines: 3
-
- class SpringfieldMotorController(MotorController):
-
- def StopOne(self, axis):
- self.springfield.stop(axis)
-
-.. _sardana-motorcontroller-howto-abort:
-
-Abort a motor
-~~~~~~~~~~~~~
-
-In a danger situation (motor moving a table about to hit a wall), it is
-desirable to abort a motion *as fast as possible*. When sardana is ordered to
-abort a motor motion, it invokes the :meth:`~sardana.pool.controller.Stopable.AbortOne`
-method. This method receives an axis parameter. The controller should make
-sure the desired motor is stopped as fast as it can be done, possibly losing
-track of position.
-
-Here is an example of the possible implementation of
-:meth:`~sardana.pool.controller.Stopable.AbortOne`:
-
-.. code-block:: python
- :emphasize-lines: 3
-
- class SpringfieldMotorController(MotorController):
-
- def AbortOne(self, axis):
- self.springfield.abort(axis)
-
-.. note::
-
- The default implementation of :meth:`~sardana.pool.controller.Stopable.StopOne`
- calls :meth:`~sardana.pool.controller.Stopable.AbortOne` so, if your
- controller cannot distinguish stopping from aborting, it is sufficient
- to implement :meth:`~sardana.pool.controller.Stopable.AbortOne`.
-
-.. _sardana-motorcontroller-howto-standard-axis-attributes:
-
-Standard axis attributes
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-By default, sardana expects every axis to have a set of attributes:
-
-- acceleration
-- deceleration
-- velocity
-- base rate
-- steps per unit
-
-To set and retrieve the value of these attributes, sardana invokes pair of
-methods: :meth:`~sardana.pool.controller.Controller.GetAxisPar`
-/:meth:`~sardana.pool.controller.Controller.SetAxisPar`
-
-Here is an example of the possible implementation:
-
-.. code-block:: python
- :emphasize-lines: 3, 18
-
- class SpringfieldMotorController(MotorController):
-
- def GetAxisPar(self, axis, name):
- springfield = self.springfield
- name = name.lower()
- if name == "acceleration":
- v = springfield.getAccelerationTime(axis)
- elif name == "deceleration":
- v = springfield.getDecelerationTime(axis)
- elif name == "base_rate":
- v = springfield.getMinVelocity(axis)
- elif name == "velocity":
- v = springfield.getMaxVelocity(axis)
- elif name == "step_per_unit":
- v = springfield.getStepPerUnit(axis)
- return v
-
- def SetAxisPar(self, axis, name, value):
- springfield = self.springfield
- name = name.lower()
- if name == "acceleration":
- springfield.setAccelerationTime(axis, value)
- elif name == "deceleration":
- springfield.setDecelerationTime(axis, value)
- elif name == "base_rate":
- springfield.setMinVelocity(axis, value)
- elif name == "velocity":
- springfield.setMaxVelocity(axis, value)
- elif name == "step_per_unit":
- springfield.setStepPerUnit(axis, value)
-
-.. seealso::
-
- :ref:`sardana-motorcontroller-what-to-do`
- What to do when your hardware motor controller doesn't support
- steps per unit
-
-.. _sardana-motorcontroller-define-position:
-
-Define a position
-~~~~~~~~~~~~~~~~~
-
-Sometimes it is useful to reset the current position to a certain value.
-Imagine you are writing a controller for a hardware controller which handles
-stepper motors. When the hardware is asked for a motor position it will
-probably answer some value from an internal register which is
-incremented/decremented each time the motor goes up/down a step. Probably this
-value as physical meaning so the usual procedure is to move the motor to a known
-position (home switch, for example) and once there, set a meaningful position to
-the current position. Some motor controllers support reseting the internal
-register to the desired value. If your motor controller can do this the
-implementation is as easy as writing the
-:meth:`~sardana.pool.controller.MotorController.DefinePosition` and call the
-proper code of your hardware library to do it:
-
-.. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- def DefinePosition(self, axis, position):
- self.springfield.setCurrentPosition(axis, position)
-
-.. seealso::
-
- :ref:`sardana-motorcontroller-what-to-do`
-
- What to do when your hardware motor controller doesn't support
- defining the position
-
-.. _sardana-motorcontroller-what-to-do:
-
-What to do when...
-~~~~~~~~~~~~~~~~~~
-
-This chapter describes common difficult situations you may face when writing
-a motor controller in sardana, and possible solutions to solve them.
-
-*my controller doesn't support steps per unit*
- Many (probably, most) hardware motor controllers don't support steps per
- unit at the hardware level. This means that your sardana controller should
- be able to emulate steps per unit at the software level.
- This can be easily done, but it requires you to make some changes in your
- code.
-
- We will assume now that the Springfield motor controller doesn't support
- steps per unit feature. The first that needs to be done is to modify the
- :meth:`~sardana.pool.controller.Controller.AddDevice` method so it is able to
- to store the resulting conversion factor between the hardware read position
- and the position the should be returned (the *step_per_unit*).
- The :meth:`~sardana.pool.controller.Readable.ReadOne` also needs to be
- rewritten to make the proper calculation.
- Finally :meth:`~sardana.pool.controller.Controller.GetAxisPar` /
- :meth:`~sardana.pool.controller.Controller.SetAxisPar` methods need to
- be rewritten to properly get/set the step per unit value:
-
- .. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- def AddDevice(self, axis):
- self._motor[axis] = dict(step_per_unit=1.0)
-
- def ReadOne(self, axis):
- step_per_unit = self._motor[axis]["step_per_unit"]
- position = self.springfield.getPosition(axis)
- return position / step_per_unit
-
- def GetAxisPar(self, axis, name):
- springfield = self.springfield
- name = name.lower()
- if name == "acceleration":
- v = springfield.getAccelerationTime(axis)
- elif name == "deceleration":
- v = springfield.getDecelerationTime(axis)
- elif name == "base_rate":
- v = springfield.getMinVelocity(axis)
- elif name == "velocity":
- v = springfield.getMaxVelocity(axis)
- elif name == "step_per_unit":
- v = self._motor[axis]["step_per_unit"]
- return v
-
- def SetAxisPar(self, axis, name, value):
- springfield = self.springfield
- name = name.lower()
- if name == "acceleration":
- springfield.setAccelerationTime(axis, value)
- elif name == "deceleration":
- springfield.setDecelerationTime(axis, value)
- elif name == "base_rate":
- springfield.setMinVelocity(axis, value)
- elif name == "velocity":
- springfield.setMaxVelocity(axis, value)
- elif name == "step_per_unit":
- self._motor[axis]["step_per_unit"] = value
-
-*my controller doesn't support defining the position*
- Some controllers may not be able to reset the position to a different value.
- In these cases, your controller code should be able to emulate such a
- feature. This can be easily done, but it requires you to make some changes
- in your code.
-
- We will now assume that the Springfield motor controller doesn't support
- steps per unit feature. The first thing that needs to be done is to modify the
- :meth:`~sardana.pool.controller.Controller.AddDevice` method so it is able
- to store the resulting offset between the hardware read position and the
- position the should be returned (the *define_position_offset*).
- The :meth:`~sardana.pool.controller.Readable.ReadOne` also needs to be
- rewritten to take the *define_position_offset* into account.
- Finally :meth:`~sardana.pool.controller.MotorController.DefinePosition`
- needs to be written to update the *define_position_offset* to the desired
- value:
-
- .. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- def AddDevice(self, axis):
- self._motor[axis] = dict(define_position_offset=0.0)
-
- def ReadOne(self, axis):
- dp_offset = self._motor[axis]["define_position_offset"]
- position = self.springfield.getPosition(axis)
- return position + dp_offset
-
- def DefinePosition(self, axis, position):
- current_position = self.springfield.getPosition(axis)
- self._motor[axis]["define_position_offset"] = position - current_position
-
-
-Advanced topics
----------------
-
-.. _sardana-motorcontroller-howto-timestamp-position:
-
-Timestamp a motor position
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When you read the position of a motor from the hardware sometimes it is
-necessary to associate a timestamp with that position so you can track the
-position of a motor in time.
-
-If sardana is executed as a Tango device server, reading the position
-attribute from the motor device triggers the execution of your controller's
-:meth:`~sardana.pool.controller.Readable.ReadOne` method. Tango responds with
-the value your controller returns from the call to
-:meth:`~sardana.pool.controller.Readable.ReadOne` and automatically assigns
-a timestamp. However this timestamp has a certain delay since the time the
-value was actually read from hardware and the time Tango generates the timestamp.
-
-To avoid this, sardana supports returning in
-:meth:`~sardana.pool.controller.Readable.ReadOne` an object that contains both
-the value and the timestamp instead of the usual :class:`numbers.Number`.
-The object must be an instance of :class:`~sardana.sardanavalue.SardanaValue`.
-
-Here is an example of associating a timestamp in
-:meth:`~sardana.pool.controller.Readable.ReadOne`:
-
-.. code-block:: python
-
- import time
- from sardana.pool.controller import SardanaValue
-
- class SpringfieldMotorController(MotorController):
-
- def ReadOne(self, axis):
- return SardanaValue(value=self.springfield.getPosition(axis),
- timestamp=time.time())
-
-If your controller communicates with a Tango device, Sardana also supports
-returning a :class:`~PyTango.DeviceAttribute` object. Sardana will use this
-object's value and timestamp. Example:
-
-.. code-block:: python
-
- class TangoMotorController(MotorController):
-
- def ReadOne(self, axis):
- return self.device.read_attribute("position")
-
-.. _sardana-motorcontroller-howto-mutiple-motion:
-
-Multiple motion synchronization
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This chapter describes an extended :term:`API` that allows you to better
-synchronize motions involing more than one motor, as well as optimize
-hardware communication (in case the hardware interface also supports this).
-
-Often it is the case that the experiment/procedure the user runs requires to
-move more than one motor at the same time.
-Imagine that the user requires motor at axis 1 to be moved to 100mm and motor
-axis 2 to be moved to -20mm.
-Your controller will receive two consecutive calls to
-:meth:`~sardana.pool.controller.Startable.StartOne`:
-
-.. code-block:: python
-
- StartOne(1, 100)
- StartOne(2, -20)
-
-and each StartOne will probably connect to the hardware (through serial line,
-socket, Tango_ or EPICS_) and ask the motor to be moved.
-This will do the job but, there will be a slight desynchronization between the
-two motors because hardware call of motor 1 will be done before hardware call
-to motor 2.
-
-Sardana provides an extended *start motion* which gives you the possibility
-to improve the syncronization (and probably reduce communications) but your
-hardware controller must somehow support this feature as well.
-
-The complete start motion :term:`API` consists of four methods:
-
- - :meth:`~sardana.pool.controller.Startable.PreStartAll`
- - :meth:`~sardana.pool.controller.Startable.PreStartOne`
- - :meth:`~sardana.pool.controller.Startable.StartOne`
- - :meth:`~sardana.pool.controller.Startable.StartAll`
-
-Except for :meth:`~sardana.pool.controller.Startable.StartOne`, the
-implemenation of all other start methods is optional and their default
-implementation does nothing (:meth:`~sardana.pool.controller.Startable.PreStartOne`
-actually returns ``True``).
-
-So, actually, the complete algorithm for motor motion in sardana is::
-
- /FOR/ Each controller(s) implied in the motion
- - Call PreStartAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the motion
- - ret = PreStartOne(motor to move, new position)
- - /IF/ ret is not true
- /RAISE/ Cannot start. Motor PreStartOne returns False
- - /END IF/
- - Call StartOne(motor to move, new position)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the motion
- - Call StartAll()
- /END FOR/
-
-So, for the example above where we move two motors, the complete sequence of
-calls to the controller is:
-
-.. code-block:: python
-
- PreStartAll()
-
- if not PreStartOne(1, 100):
- raise Exception("Cannot start. Motor(1) PreStartOne returns False")
- if not PreStartOne(2, -20):
- raise Exception("Cannot start. Motor(2) PreStartOne returns False")
-
- StartOne(1, 100)
- StartOne(2, -20)
-
- StartAll()
-
-Sardana assures that the above sequence is never interrupted by other calls,
-like a call from a different user to get motor state.
-
-Suppose the springfield library tells us in the documentation that:
-
- ... to move multiple motors at the same time use::
-
- moveMultiple(seq<pair<axis, position>>)
-
- Example::
-
- moveMultiple([[1, 100], [2, -20]])
-
-We can modify our motor controller to take profit of this hardware feature:
-
-.. code-block:: python
-
- class SpringfieldMotorController(MotorController):
-
- def PreStartAll(self):
- # clear the local motion information dictionary
- self._moveable_info = []
-
- def StartOne(self, axis, position):
- # store information about this axis motion
- motion_info = axis, position
- self._moveable_info.append(motion_info)
-
- def StartAll(self):
- self.springfield.moveMultiple(self._moveable_info)
-
-A similar principle applies when sardana asks for the state and position of
-multiple axis. The two sets of methods are, in these cases:
-
-.. hlist::
- :columns: 2
-
- - :meth:`~sardana.pool.controller.Controller.PreStateAll`
- - :meth:`~sardana.pool.controller.Controller.PreStateOne`
- - :meth:`~sardana.pool.controller.Controller.StateAll`
- - :meth:`~sardana.pool.controller.Controller.StateOne`
- - :meth:`~sardana.pool.controller.Readable.PreReadAll`
- - :meth:`~sardana.pool.controller.Readable.PreReadOne`
- - :meth:`~sardana.pool.controller.Readable.ReadAll`
- - :meth:`~sardana.pool.controller.Readable.ReadOne`
-
-The main differences between these sets of methods and the ones from start motion
-is that :meth:`~sardana.pool.controller.Controller.StateOne` /
-:meth:`~sardana.pool.controller.Readable.ReadOne` methods are called **AFTER**
-the corresponding :meth:`~sardana.pool.controller.Controller.StateAll` /
-:meth:`~sardana.pool.controller.Readable.ReadAll` counterparts and they are
-expeced to return the state/position of the requested axis.
-
-The internal sardana algorithm to read position is::
-
- /FOR/ Each controller(s) implied in the reading
- - Call PreReadAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the reading
- - PreReadOne(motor to read)
- /END FOR/
-
- /FOR/ Each controller(s) implied in the reading
- - Call ReadAll()
- /END FOR/
-
- /FOR/ Each motor(s) implied in the reading
- - Call ReadOne(motor to read)
- /END FOR/
-
-Here is an example assuming the springfield library tells us in the
-documentation that:
-
- ... to read the position of multiple motors at the same time use::
-
- getMultiplePosition(seq<axis>) -> dict<axis, position>
-
- Example::
-
- positions = getMultiplePosition([1, 2])
-
-The new improved code could look like this::
-
- class SpringfieldMotorController(MotorController):
-
- def PreRealAll(self):
- # clear the local position information dictionary
- self._position_info = []
-
- def PreReadOne(self, axis):
- self._position_info.append(axis)
-
- def ReadAll(self):
- self._positions = self.springfield.getMultiplePosition(self._position_info)
-
- def ReadOne(self, axis):
- return self._positions[axis]
-
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
- \ No newline at end of file
diff --git a/doc/source/devel/howto_controllers/howto_pseudocountercontroller.rst b/doc/source/devel/howto_controllers/howto_pseudocountercontroller.rst
deleted file mode 100644
index 91ef8d7e..00000000
--- a/doc/source/devel/howto_controllers/howto_pseudocountercontroller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-pseudocountercontroller-howto-basics:
-
-========================================
-How to write a pseudo counter controller
-========================================
-
-The basics
-----------
-
-.. todo:: document pseudo counter controller howto
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/howto_pseudomotorcontroller.rst b/doc/source/devel/howto_controllers/howto_pseudomotorcontroller.rst
deleted file mode 100644
index b3a1a841..00000000
--- a/doc/source/devel/howto_controllers/howto_pseudomotorcontroller.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-pseudomotorcontroller-howto-basics:
-
-======================================
-How to write a pseudo motor controller
-======================================
-
-The basics
-----------
-
-.. todo:: document pseudo motor controller howto
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _Taco: http://www.esrf.eu/Infrastructure/Computing/TACO/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_controllers/index.rst b/doc/source/devel/howto_controllers/index.rst
deleted file mode 100644
index 964f332d..00000000
--- a/doc/source/devel/howto_controllers/index.rst
+++ /dev/null
@@ -1,32 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-controller-howto:
-
-===================
-Writing controllers
-===================
-
-This chapter provides the necessary information to write controllers in sardana.
-
-An overview of the pool controller concept can be found
-:ref:`here <sardana-controller-overview>`.
-
-The complete controller :term:`API` can be found
-:ref:`here <sardana-controller-api>`.
-
-First, the common interface to all controller types is explained. After, a
-detailed chapter will focus on each specific controller type:
-
-.. toctree::
- :maxdepth: 1
-
- howto_controller
- howto_motorcontroller
- howto_countertimercontroller
- howto_0dcontroller
- howto_1dcontroller
- howto_2dcontroller
- howto_ioregistercontroller
- howto_pseudomotorcontroller
- howto_pseudocountercontroller
-
diff --git a/doc/source/devel/howto_controllers/sf_ct_ctrl.py b/doc/source/devel/howto_controllers/sf_ct_ctrl.py
deleted file mode 100644
index 4da7c50a..00000000
--- a/doc/source/devel/howto_controllers/sf_ct_ctrl.py
+++ /dev/null
@@ -1,122 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This file contains the code for an hypothetical Springfield counter/timer
-controller used in documentation"""
-
-import time
-
-import springfieldlib
-
-from sardana import State
-from sardana.pool.controller import CounterTimerController
-
-class SpringfieldBaseCounterTimerController(CounterTimerController):
- """The most basic controller intended from demonstration purposes only.
- This is the absolute minimum you have to implement to set a proper counter
- controller able to get a counter value, get a counter state and do an
- acquisition.
-
- This example is so basic that it is not even directly described in the
- documentation"""
-
- def __init__(self, inst, props, *args, **kwargs):
- """Constructor"""
- super(SpringfieldBaseCounterTimerController, self).__init__(inst, props, *args, **kwargs)
- self.springfield = springfieldlib.SpringfieldCounterHW()
-
- def ReadOne(self, axis):
- """Get the specified counter value"""
- return self.springfield.getValue(axis)
-
- def StateOne(self, axis):
- """Get the specified counter state"""
- springfield = self.springfield
- state = springfield.getState(axis)
- if state == 1:
- return State.On, "Counter is stopped"
- elif state == 2:
- return State.Moving, "Counter is acquiring"
- elif state == 3:
- return State.Fault, "Counter has an error"
-
- def StartAll(self):
- self.springfield.start_count()
-
- def StartOne(self, axis, value=None):
- """acquire the specified counter"""
- self.springfield.activate_channel(axis)
-
- def LoadOne(self, axis, value):
- self.springfield.set_master(axis, value)
-
- def StopOne(self, axis):
- """Stop the specified counter"""
- self.springfield.stop(axis)
-
-
-from sardana import DataAccess
-from sardana.pool.controller import Type, Description, DefaultValue, Access, FGet, FSet
-
-class SpringfieldCounterTimerController(CounterTimerController):
-
- def __init__(self, inst, props, *args, **kwargs):
- super(SpringfieldCounterTimerController, self).__init__(inst, props, *args, **kwargs)
-
- # initialize hardware communication
- self.springfield = springfieldlib.SpringfieldCounterHW()
-
- # do some initialization
- self._counters = {}
-
- def AddDevice(self, axis):
- self._counters[axis] = True
-
- def DeleteDevice(self, axis):
- del self._counters[axis]
-
- StateMap = {
- 1 : State.On,
- 2 : State.Moving,
- 3 : State.Fault,
- }
-
- def StateOne(self, axis):
- springfield = self.springfield
- state = self.StateMap[ springfield.getState(axis) ]
- status = springfield.getStatus(axis)
- return state, status
-
- def ReadOne(self, axis):
- value = self.springfield.getValue(axis)
- return value
-
- def StartOne(self, axis, position):
- self.springfield.move(axis, position)
-
- def StopOne(self, axis):
- self.springfield.stop(axis)
-
- def AbortOne(self, axis):
- self.springfield.abort(axis)
- \ No newline at end of file
diff --git a/doc/source/devel/howto_controllers/sf_motor_ctrl.py b/doc/source/devel/howto_controllers/sf_motor_ctrl.py
deleted file mode 100644
index 80d938bb..00000000
--- a/doc/source/devel/howto_controllers/sf_motor_ctrl.py
+++ /dev/null
@@ -1,141 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This file contains the code for an hypothetical Springfield motor controller
-used in documentation"""
-
-import springfieldlib
-
-from sardana import State
-from sardana.pool.controller import MotorController
-
-class SpringfieldBaseMotorController(MotorController):
- """The most basic controller intended from demonstration purposes only.
- This is the absolute minimum you have to implement to set a proper motor
- controller able to get a motor position, get a motor state and move a
- motor.
-
- This example is so basic that it is not even directly described in the
- documentation"""
-
- MaxDevice = 128
-
- def __init__(self, inst, props, *args, **kwargs):
- """Constructor"""
- super(SpringfieldBaseMotorController, self).__init__(inst, props, *args, **kwargs)
- self.springfield = springfieldlib.SpringfieldMotorHW()
-
- def ReadOne(self, axis):
- """Get the specified motor position"""
- return self.springfield.getPosition(axis)
-
- def StateOne(self, axis):
- """Get the specified motor state"""
- springfield = self.springfield
- state = springfield.getState(axis)
- if state == 1:
- return State.On, "Motor is stopped"
- elif state == 2:
- return State.Moving, "Motor is moving"
- elif state == 3:
- return State.Fault, "Motor has an error"
-
- def StartOne(self, axis, position):
- """Move the specified motor to the specified position"""
- self.springfield.move(axis, position)
-
- def StopOne(self, axis):
- """Stop the specified motor"""
- self.springfield.stop(axis)
-
-
-from sardana import DataAccess
-from sardana.pool.controller import Type, Description, DefaultValue, Access, FGet, FSet
-
-class SpringfieldMotorController(MotorController):
-
- axis_attributes = {
- "CloseLoop" : {
- Type : bool,
- Description : "(de)activates the motor close loop algorithm",
- DefaultValue : False,
- },
- }
-
- def getCloseLoop(self, axis):
- return self.springfield.isCloseLoopActive(axis)
-
- def setCloseLoop(self, axis, value):
- self.springfield.setCloseLoop(axis, value)
-
- def __init__(self, inst, props, *args, **kwargs):
- super(SpringfieldMotorController, self).__init__(inst, props, *args, **kwargs)
-
- # initialize hardware communication
- self.springfield = springfieldlib.SpringfieldMotorHW()
-
- # do some initialization
- self._motors = {}
-
- def AddDevice(self, axis):
- self._motors[axis] = True
-
- def DeleteDevice(self, axis):
- del self._motors[axis]
-
- StateMap = {
- 1 : State.On,
- 2 : State.Moving,
- 3 : State.Fault,
- }
-
- def StateOne(self, axis):
- springfield = self.springfield
- state = self.StateMap[ springfield.getState(axis) ]
- status = springfield.getStatus(axis)
-
- limit_switches = MotorController.NoLimitSwitch
- hw_limit_switches = springfield.getLimits(axis)
- if hw_limit_switches[0]:
- limit_switches |= MotorController.HomeLimitSwitch
- if hw_limit_switches[1]:
- limit_switches |= MotorController.UpperLimitSwitch
- if hw_limit_switches[2]:
- limit_switches |= MotorController.LowerLimitSwitch
- return state, status, limit_switches
-
- def ReadOne(self, axis):
- position = self.springfield.getPosition(axis)
- return position
-
- def StartOne(self, axis, position):
- self.springfield.move(axis, position)
-
- def StopOne(self, axis):
- self.springfield.stop(axis)
-
- def AbortOne(self, axis):
- self.springfield.abort(axis)
-
- def DefinePosition(self, axis, position):
- self.springfield.setCurrentPosition(axis, position)
diff --git a/doc/source/devel/howto_controllers/springfieldlib.py b/doc/source/devel/howto_controllers/springfieldlib.py
deleted file mode 100644
index f141ffee..00000000
--- a/doc/source/devel/howto_controllers/springfieldlib.py
+++ /dev/null
@@ -1,653 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This file contains the code for an hypothetical Springfield motor hardware
-access library. It is intended to be used in the sardana documentation as
-an aid to writing a sardana motor controller library.
-
-If you intend to use this code please put it in a directory accessible to
-Python or in the same directory as sf_motor_ctrl.py"""
-
-__all__ = ["SpringfieldMotorHW", "SpringfieldCounterHW"]
-
-import time
-from math import pow, sqrt
-
-class BaseMotion(object):
-
- def __init__(self):
- self.min_vel = -1
- self.max_vel = -1
- self.accel_time = -1
- self.decel_time = -1
- self.accel = -1
- self.decel = -1
-
- self.init_pos = -1
- self.final_pos = -1
- self.curr_pos = -1
-
-
-class Motion(BaseMotion):
-
- def __init__(self):
- BaseMotion.__init__(self)
-
- self.close_loop = False
-
- self.dsplmnt_reach_max_vel = -1
- self.dsplmnt_reach_min_vel = -1
- self.dsplmnt = -1
-
- self.curr_instant = -1
- self.start_instant = -1
-
- self.positive_dsplmnt = True
- self.small_motion = False
-
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = -1
-
- # necessary displacement to reach maximum velocity
- self.curr_dsplmnt_reach_max_vel = -1
-
- # necessary diplacement to reach minimum velocity
- self.curr_dsplmnt_reach_min_vel = -1
-
- # maximum velocity possible
- self.curr_max_vel = -1
-
- # time at maximum velocity
- self.curr_at_max_vel_dsplmnt = -1
-
- # time to reach maximum velocity
- self.curr_max_vel_time = -1
-
- # time to reach minimum velocity
- self.curr_min_vel_time = -1
-
- # time at maximum velocity
- self.curr_at_max_vel_time = -1
-
- # instant when maximum velocity should be reached
- self.curr_max_vel_instant = -1
-
- # instant when should start decelerating
- self.curr_min_vel_instant = -1
-
- # time the motion will take
- self.duration = -1
-
- # instant the motion will end
- self.final_instant = -1
-
- # steps per unit
- self.step_per_unit = 1
-
- self.inMotion = False
-
- self.lower_ls = float('-inf')
- self.upper_ls = float('+inf')
-
- self.power = True
- self.enabled = True
-
- self.__recalculate_acc_constants()
-
- def isCloseLoopActive(self):
- return self.close_loop
-
- def setCloseLoop(self, v):
- self.close_loop = v
-
- def setMinVelocity(self,vi):
- """ Sets the minimum velocity in ms^-1. A.k.a. base rate"""
- vi = float(vi)
- if vi < 0:
- raise "Minimum velocity must be >= 0"
-
- self.min_vel = vi
-
- if self.max_vel < self.min_vel:
- self.max_vel = self.min_vel
-
- # force recalculation of accelerations
- if self.accel_time >= 0:
- self.setAccelerationTime(self.accel_time)
- if self.decel_time >= 0:
- self.setDecelerationTime(self.decel_time)
-
- def getMinVelocity(self):
- return self.min_vel
-
- def setMaxVelocity(self,vf):
- """ Sets the maximum velocity in ms^-1."""
- vf = float(vf)
- if vf <= 0:
- raise "Maximum velocity must be > 0"
-
- self.max_vel = vf
-
- if self.min_vel > self.max_vel:
- self.min_vel = self.max_vel
-
- # force recalculation of accelerations
- if self.accel_time >= 0:
- self.setAccelerationTime(self.accel_time)
- if self.decel_time >= 0:
- self.setDecelerationTime(self.decel_time)
-
- def getMaxVelocity(self):
- return self.max_vel
-
- def setAccelerationTime(self,at):
- """Sets the time to go from minimum velocity to maximum velocity in seconds"""
- at = float(at)
- if at <= 0:
- raise "Acceleration time must be > 0"
-
- self.accel_time = at
- self.accel = (self.max_vel - self.min_vel) / at
-
- self.__recalculate_acc_constants()
-
- def getAccelerationTime(self):
- return self.accel_time
-
- def setDecelerationTime(self,dt):
- """Sets the time to go from maximum velocity to minimum velocity in seconds"""
- dt = float(dt)
- if dt <= 0:
- raise "Deceleration time must be > 0"
-
- self.decel_time = dt
- self.decel = (self.min_vel - self.max_vel) / dt
-
- self.__recalculate_acc_constants()
-
- def getDecelerationTime(self):
- return self.decel_time
-
- def setAcceleration(self,a):
- """Sets the acceleration in ms^-2"""
- a = float(a)
- if a < 0:
- raise "Acceleration must be >= 0"
-
- self.accel = float(a)
-
- if a > 0:
- self.accel_time = (self.max_vel - self.min_vel) / a
- else:
- self.accel_time = float('INF')
-
- self.__recalculate_acc_constants()
-
- def setDeceleration(self,d):
- """Sets the deceleration in ms^-2"""
- d = float(d)
- if d > 0:
- raise "Deceleration must be <= 0"
-
- self.decel = d
-
- if d < 0:
- self.decel_time = (self.min_vel - self.max_vel) / d
- else:
- self.decel_time = float('INF')
-
- self.__recalculate_acc_constants()
-
- def getStepPerUnit(self):
- return self.step_per_unit
-
- def setStepPerUnit(self, spu):
- self.step_per_unit = spu
-
- def __recalculate_acc_constants(self):
- """precomputations assuming maximum speed can be reached in a motion"""
-
- self.dsplmnt_reach_max_vel = 0.5 * self.accel * pow(self.accel_time,2)
- self.dsplmnt_reach_max_vel += self.min_vel * self.accel_time
-
- self.dsplmnt_reach_min_vel = 0.5 * self.decel * pow(self.decel_time,2)
- self.dsplmnt_reach_min_vel += self.max_vel * self.decel_time
-
- def startMotion(self, initial_user_pos, final_user_pos, start_instant=None):
- """starts a new motion"""
-
- if not self.power:
- raise Exception("Motor is powered off")
-
- initial_pos = initial_user_pos * self.step_per_unit
- final_pos = final_user_pos * self.step_per_unit
-
- if self.inMotion:
- raise Exception("Already in motion")
-
- if initial_pos == final_pos:
- return
-
- self.init_pos = initial_pos
- self.final_pos = final_pos
- self.curr_pos = initial_pos
- self.dsplmnt = abs(final_pos - initial_pos)
-
- start_instant = start_instant or time.time()
- self.curr_instant = start_instant
- self.start_instant = start_instant
-
- self.positive_dsplmnt = final_pos >= initial_pos
-
- displmnt_not_cnst = self.dsplmnt_reach_max_vel + self.dsplmnt_reach_min_vel
- self.small_motion = self.dsplmnt < displmnt_not_cnst
-
- if self.positive_dsplmnt:
- self.curr_accel = self.accel
- self.curr_decel = self.decel
- else:
- self.curr_accel = -self.accel
- self.curr_decel = -self.decel
-
-
- if not self.small_motion:
-
- # necessary displacement to reach maximum velocity
- self.curr_dsplmnt_reach_max_vel = self.dsplmnt_reach_max_vel
- # necessary diplacement to reach minimum velocity
- self.curr_dsplmnt_reach_min_vel = self.dsplmnt_reach_min_vel
-
- if self.positive_dsplmnt:
- self.curr_max_vel = self.max_vel
- self.curr_min_vel = self.min_vel
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = self.init_pos + self.curr_dsplmnt_reach_max_vel
- else:
- self.curr_max_vel = -self.max_vel
- self.curr_min_vel = -self.min_vel
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = self.init_pos - self.curr_dsplmnt_reach_max_vel
-
- # displacement at maximum velocity
- self.curr_at_max_vel_dsplmnt = self.dsplmnt - (self.curr_dsplmnt_reach_max_vel + self.curr_dsplmnt_reach_min_vel)
-
- else: # Small movement
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = self.init_pos * self.curr_accel - self.final_pos * self.curr_decel
- self.curr_max_vel_pos /= self.curr_accel - self.curr_decel
-
- # necessary displacement to reach maximum velocity
- self.curr_dsplmnt_reach_max_vel = abs(self.curr_max_vel_pos - self.init_pos)
-
- # necessary diplacement to reach minimum velocity
- self.curr_dsplmnt_reach_min_vel = abs(self.final_pos - self.curr_max_vel_pos)
-
- # maximum velocity possible
- cnst = 2 * self.curr_accel * self.curr_decel * self.dsplmnt / (self.curr_decel - self.curr_accel)
- max_vel_2 = pow(self.min_vel, 2) + cnst
-
- self.curr_max_vel = sqrt(abs(max_vel_2))
-
- if self.positive_dsplmnt:
- self.curr_min_vel = self.min_vel
- else:
- self.curr_max_vel = -self.curr_max_vel
- self.curr_min_vel = -self.min_vel
-
- # displacement at maximum velocity
- self.curr_at_max_vel_dsplmnt = 0.0
-
- # time to reach maximum velocity
- self.curr_max_vel_time = abs((self.curr_max_vel - self.curr_min_vel) / self.curr_accel)
-
- # time to reach minimum velocity
- self.curr_min_vel_time = abs((self.curr_min_vel - self.curr_max_vel) / self.curr_decel)
-
- # time at maximum velocity
- self.curr_at_max_vel_time = abs(self.curr_at_max_vel_dsplmnt / self.curr_max_vel)
-
- # instant when maximum velocity should be reached
- self.curr_max_vel_instant = self.start_instant + self.curr_max_vel_time
-
- # instant when should start decelerating
- self.curr_min_vel_instant = self.curr_max_vel_instant + self.curr_at_max_vel_time
-
- # time the motion will take
- self.duration = self.curr_max_vel_time + self.curr_at_max_vel_time + self.curr_min_vel_time
-
- # instant the motion will end
- self.final_instant = self.start_instant + self.duration
-
- # uncomment following line if need output concerning the movement that
- # has just started
- # self.info()
-
- # ASSERTIONS
- if self.positive_dsplmnt:
- assert(self.curr_max_vel_pos >= self.init_pos)
- assert(self.curr_max_vel_pos <= self.final_pos)
- else:
- assert(self.curr_max_vel_pos <= self.init_pos)
- assert(self.curr_max_vel_pos >= self.final_pos)
-
- assert(self.curr_dsplmnt_reach_max_vel >= 0.0)
- assert(self.curr_dsplmnt_reach_min_vel >= 0.0)
-
- assert(self.final_instant >= self.start_instant)
- assert(self.curr_max_vel <= self.max_vel)
- assert(self.start_instant <= self.curr_max_vel_instant)
- assert(self.final_instant >= self.curr_min_vel_instant)
-
- assert(self.curr_max_vel_time > 0.0)
- assert(self.curr_min_vel_time > 0.0)
- assert(self.duration > 0.0)
-
- if self.small_motion:
- assert(self.curr_max_vel_instant == self.curr_min_vel_instant)
- assert(self.curr_at_max_vel_time == 0.0)
- else:
- assert(self.curr_max_vel_instant <= self.curr_min_vel_instant)
- assert(self.curr_at_max_vel_time >= 0.0)
-
- self.inMotion = True
-
- def abortMotion(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- if not self.inMotion:
- return self.curr_pos
-
- self.curr_pos = self.getCurrentPosition(curr_instant)
- self.inMotion = False
- return self.curr_pos
-
- def isInMotion(self,curr_instant=None):
- curr_instant = curr_instant or time.time()
- #we call getCurrentPosition because inside it updates the inMotion flag
- self.getCurrentPosition(curr_instant)
- return self.inMotion
-
- def setCurrentPosition(self, curr_pos):
- self.curr_pos = curr_pos
- self.init_pos = curr_pos
-
- def getCurrentPosition(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- self.curr_instant = curr_instant
- pos = None
- if self.inMotion:
- # if motion should be ended...
- if self.curr_instant >= self.final_instant:
- self.inMotion = False
- pos = self.final_pos
- else:
- pos = self.init_pos
- if curr_instant > self.curr_min_vel_instant:
- if self.positive_dsplmnt:
- pos += self.curr_dsplmnt_reach_max_vel
- pos += self.curr_at_max_vel_dsplmnt
- else:
- pos -= self.curr_dsplmnt_reach_max_vel
- pos -= self.curr_at_max_vel_dsplmnt
- dt = curr_instant - self.curr_min_vel_instant
- pos += self.curr_max_vel * dt + 0.5 * self.curr_decel * pow(dt,2)
- elif curr_instant > self.curr_max_vel_instant:
- if self.positive_dsplmnt:
- pos += self.curr_dsplmnt_reach_max_vel
- else:
- pos -= self.curr_dsplmnt_reach_max_vel
- dt = curr_instant - self.curr_max_vel_instant
- pos += self.curr_max_vel * dt
- else:
- dt = curr_instant - self.start_instant
- pos += self.curr_min_vel * dt + 0.5 * self.curr_accel * pow(dt,2)
- else:
- pos = self.curr_pos
- if pos <= self.lower_ls:
- pos = self.lower_ls
- self.inMotion = False
- elif pos >= self.upper_ls:
- pos = self.upper_ls
- self.inMotion = False
- self.curr_pos = pos
- return pos
-
- def setCurrentUserPosition(self, user_pos):
- self.setCurrentPosition(user_pos*self.step_per_unit)
-
- def getCurrentUserPosition(self, curr_instant=None):
- return self.getCurrentPosition(curr_instant=curr_instant) / self.step_per_unit
-
- def hitLowerLimit(self):
- user_pos = self.curr_pos / self.step_per_unit
- return user_pos <= self.lower_ls
-
- def hitUpperLimit(self):
- user_pos = self.curr_pos / self.step_per_unit
- return user_pos >= self.upper_ls
-
- def getLowerLimitSwitch(self):
- return self.lower_ls
-
- def setLowerLimitSwitch(self, user_lower_ls):
- self.lower_ls = user_lower_ls
-
- def getUpperLimitSwitch(self):
- return self.upper_ls
-
- def setUpperLimitSwitch(self, user_upper_ls):
- self.upper_ls = user_upper_ls
-
- def turnOn(self):
- self.power = True
-
- def turnOff(self):
- self.power = False
-
- def isTurnedOn(self):
- return self.power
-
- def hasPower(self):
- return self.power
-
- def setPower(self, power):
- self.power = power
-
- def info(self):
- print "Small movement =",self.small_motion
- print "length =",self.dsplmnt
- print "position where maximum velocity will be reached =",self.curr_max_vel_pos
- print "necessary displacement to reach maximum velocity =",self.curr_dsplmnt_reach_max_vel
- print "necessary displacement to stop from maximum velocity =",self.curr_dsplmnt_reach_min_vel
- print "maximum velocity possible =",self.curr_max_vel
- print "time at top velocity =",self.curr_at_max_vel_time
- print "displacement at top velocity =",self.curr_at_max_vel_dsplmnt
- print "time to reach maximum velocity =",self.curr_max_vel_time
- print "time to reach minimum velocity =",self.curr_min_vel_time
- print "time the motion will take =",self.duration
- print "instant when maximum velocity should be reached =",self.curr_max_vel_instant
- print "instant when should start decelerating =",self.curr_min_vel_instant
- print "instant the motion will end",self.final_instant
- print ""
- print "For long movements (where top vel is possible), necessary displacement to reach maximum velocity =",self.dsplmnt_reach_max_vel
- print "For long movements (where top vel is possible), necessary displacement to stop from maximum velocity =",self.dsplmnt_reach_min_vel
-
-
-class SpringfieldMotorHW(object):
-
- DefaultHost = "localhost"
- DefaultPort = 10123
-
- def __init__(self, host=DefaultHost, port=DefaultPort):
- self.host = host
- self.port = port
- self._motions = {}
-
- def getMotion(self, axis):
- motion = self._motions.get(axis)
- if motion is None:
- self._motions[axis] = motion = Motion()
- return motion
-
- def getState(self, axis):
- motion = self.getMotion(axis)
- motion.getCurrentUserPosition()
- if motion.isInMotion():
- return 2
- if motion.hitLowerLimit():
- return 3
- if motion.hitUpperLimit():
- return 3
- if not motion.hasPower():
- return 4
- return 1
-
- def getStatus(self, axis):
- motion = self.getMotion(axis)
- motion.getCurrentUserPosition()
- status = "Motor HW is ON"
- if motion.isInMotion():
- status = "Motor HW is MOVING"
- if motion.hitLowerLimit():
- status = "Motor HW is in ALARM. Hit hardware lower limit switch"
- if motion.hitUpperLimit():
- status = "Motor HW is in ALARM. Hit hardware upper limit switch"
- if not motion.hasPower():
- status = "Motor is powered off"
- return status
-
- def getLimits(self, axis):
- motion = self.getMotion(axis)
- m.getCurrentUserPosition()
- switchstate = 3*[False,]
- if m.hitLowerLimit():
- switchstate[2] = True
- if m.hitUpperLimit():
- switchstate[1] = True
- return switchstate
-
- def getPosition(self, axis):
- motion = self.getMotion(axis)
- return motion.getCurrentUserPosition()
-
- def getAccelerationTime(self, axis):
- return self.getMotion(axis).getAccelerationTime()
-
- def getDecelerationTime(self, axis):
- return self.getMotion(axis).getDecelerationTime()
-
- def getMinVelocity(self, axis):
- return self.getMotion(axis).getMinVelocity()
-
- def getMaxVelocity(self, axis):
- return self.getMotion(axis).getMaxVelocity()
-
- def getStepPerUnit(self, axis):
- return self.getMotion(axis).getStepPerUnit()
-
- def setAccelerationTime(self, axis, v):
- self.getMotion(axis).setAccelerationTime(v)
-
- def setDecelerationTime(self, axis, v):
- self.getMotion(axis).setDecelerationTime(v)
-
- def setMinVelocity(self, axis, v):
- self.getMotion(axis).setMinVelocity(v)
-
- def setMaxVelocity(self, axis, v):
- self.getMotion(axis).setMaxVelocity(v)
-
- def setStepPerUnit(self, axis, v):
- self.getMotion(axis).setStepPerUnit(v)
-
- def isCloseLoopActive(self, axis):
- return self.getMotion(axis).isCloseLoopActive()
-
- def setCloseLoop(self, axis, v):
- self.getMotion(axis).setCloseLoop(v)
-
- def setCurrentPosition(self, axis, position):
- motion = self.getMotion(axis)
- motion.offset = position - motion.getCurrentUserPosition()
- motion.setCurrentUserPosition(position)
-
- def move(self, axis, position):
- t = time.time()
- motion = self.getMotion(axis)
- motion.startMotion(motion.getCurrentUserPosition(t), position, t)
-
- def stop(self, axis):
- motion = self.getMotion(axis)
- motion.abortMotion()
-
- def abort(self, axis):
- motion = self.getMotion(axis)
- motion.abortMotion()
-
-
-class Channel:
-
- def __init__(self,idx):
- self.idx = idx # 1 based index
- self.value = 0.0
- self.is_counting = False
- self.active = True
-
-
-class SpringfieldCounterHW(object):
-
- DefaultHost = "localhost"
- DefaultPort = 10124
-
- def __init__(self, host=DefaultHost, port=DefaultPort):
- self.host = host
- self.port = port
- self._channels = {}
-
- def getChannel(self, axis):
- channel = self._channels.get(axis)
- if channel is None:
- self._channels[axis] = channel = Channel(axis)
- return channel
-
- def getState(self, axis):
- channel = self.getChannel(axis)
- channel.getCurrentUserValue()
- if channel.isAcquiring():
- return 2
- if not channel.hasPower():
- return 3
- return 1
-
- def getStatus(self, axis):
- channel = self.getChannel(axis)
- channel.getCurrentUserValue()
- status = "Counter HW is ON"
- if channel.isAcquiring():
- status = "Counter HW is ACQUIRING"
- if not channel.hasPower():
- status = "Counter is powered OFF"
- return status
-
- def getValue(self, axis):
- motion = self.getMotion(axis)
- return motion.getCurrentUserPosition() \ No newline at end of file
diff --git a/doc/source/devel/howto_macros/index.rst b/doc/source/devel/howto_macros/index.rst
deleted file mode 100644
index fb2ff068..00000000
--- a/doc/source/devel/howto_macros/index.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-.. currentmodule:: sardana.macroserver.macro
-
-.. _sardana-macro-howto:
-
-================
-Writing macros
-================
-
-
-.. toctree::
- :maxdepth: 2
-
- General macro development <macros_general>
- Scan macro development <scan_framework>
-
diff --git a/doc/source/devel/howto_macros/macros_general.rst b/doc/source/devel/howto_macros/macros_general.rst
deleted file mode 100644
index 83a3dc83..00000000
--- a/doc/source/devel/howto_macros/macros_general.rst
+++ /dev/null
@@ -1,1190 +0,0 @@
-.. highlight:: python
- :linenothreshold: 5
-
-.. currentmodule:: sardana.macroserver.macro
-
-
-.. _sardana-macros-howto:
-
-===============
-Writing macros
-===============
-
-This chapter provides the necessary information to write macros in sardana. The
-complete macro :term:`API` can be found :ref:`here <sardana-macro-api>`.
-
-What is a macro
----------------
-
-A macro in sardana describes a specific procedure that can be executed at any
-time. Macros run inside the *sardana sandbox*. This simply means that each time
-you run a macro, the system makes sure the necessary environment for it to run
-safely is ready.
-
-Macros can only be written in Python_. A macro can be a :term:`function` or a
-:term:`class`. In order for a :term:`function` to be recognized as a macro, it
-**must** be properly *labeled* as a macro (this is done with a special
-:class:`macro` *decorator*. Details are explaind below). In the same way, for a
-:term:`class` to be recognized as a macro, it must inherit from a
-:class:`Macro` super-class. Macros are case sensitive. This means that
-*helloworld* is a different macro than *HelloWorld*.
-
-The choice between writing a macro :term:`function` or a macro :term:`class`
-depends not only on the type of procedure you want to write, but also (and
-probably, most importantly) on the type of programming you are most confortable
-with.
-
-If you are a scientist, and you have a programming background on a functional
-language (like fortran, matlab, SPEC_), then you might prefer to write macro
-functions. Computer scientists (young ones, specially), on the other hand,
-often have a background on object oriented languages (Java, C++, C#) and feel
-more confortable writing macro classes.
-
-Classes tend to scale better with the size of a program or library. By writing
-a macro class you can benefit from all advantages of object-oriented
-programming. This means that, in theory:
-
- - it would reduce the amount of code you need to write
- - reduce the complexity of your code y by dividing it into small,
- reasonably independent and re-usable components, that talk to each other
- using only well-defined interfaces
- - Improvement of productivity by using easily adaptable pre-defined
- software components
-
-In practice, however, and specially if you don't come from a programming
-background, writing classes requires a different way of thinking. It will also
-require you to extend your knowledge in terms of syntax of a programming
-language.
-
-Furthermore, most tasks you will probably need to execute as macros, often don't
-fit the class paradigm that object-oriented languages offer. If you are
-writing a sequencial procedure to run an experiment then you are probably
-better of writing a python function which does the job plain and simple.
-
-One reason to write a macro as a class is if, for example, you want to extend
-the behaviour of the :class:`~sardana.macroserver.macros.standard.mv` macro. In
-this case, probably you would want to *extend* the existing macro by writing
-your own macro class which *inherits* from the original macro and this way
-benefit from most of the functionallity already existing in the original macro.
-
-What should and should not be a macro
--------------------------------------
-
-The idea of a macro is simply a piece of Python_ code that can be executed from
-control system interface (:term:`GUI`\/:term:`CLI`). Therefore, anything that
-you don't need to be executed by the interface should **NOT** be a macro.
-
-When you have a big library of functions and classes, the approach to expose
-them to sardana should be to first carefully decide which procedures should be
-invoked by a :term:`GUI`\/:term:`CLI` (namely the name of the procedure, which
-parameters it should receive and if it returns any value). Then write the
-macro(s) which invoke the code of the original library. Avoid the temptation to
-convert the functions/classes of the original library into macros because:
-
- - This will most certainly break your code (any code that calls a function
- or class that has been converted to a macro will fail)
- - It will excessively polute the macro list (imagine a :term:`GUI` with a
- combo box to select which macro to execute. If you have hundreds of macros
- it will take forever to find the one to execute even if they are in
- alphabetical order)
-
-
-How to start writing a macro
------------------------------
-
-Since macros are essencially Python_ code, they reside inside a Python_ file. In
-sardana, we call a Python_ file which contains macros a *macro library*.
-
-At the time of writing, the easiest way to create a new macro is from spock (we
-are currently working on a macro editor :term:`GUI`).
-
-Preparing your text editor
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Before launching spock it is important to decide which text editor you will use
-to write your macros. Unless configured otherwise, spock will use the editor
-specified by the system environment variable :envvar:`EDITOR`. If this variable
-is not set, it will default to vi under Linux/Unix and to notepad under
-Windows. The following line explains how to set the :envvar:`EDITOR`
-environment variable to gedit under linux using bash shell::
-
- $ export EDITOR=gedit
-
-If you choose *gedit* it is important to properly configure it to write Python_
-code:
-
- Go to :menuselection:`Edit --> Preferences --> Editor` and select:
-
- - *Tab width* : 4
- - *Insert spaces instead of tabs*
-
- .. image:: ../../_static/gedit_config.png
-
-If you choose *kwrite* it is important to properly configure it to write Python_
-code:
-
- Go to :menuselection:`Settings --> Configure editor...` and choose
- *Editing*:
-
- - In *General* tab:
- - *Tab width* : 4
- - *Insert spaces instead of tabulators*
- - In *Indentation* tab:
- - *Default indentation mode* : Python
- - *Indentation width* : 4
-
- .. image:: ../../_static/kwrite_config.png
-
-Now you are ready to start writing your macro! Type *spock* on the command
-line. Once you are in spock, you can use the
-:class:`~sardana.macroserver.macros.expert.edmac` to create/edit macros. Let's
-say you want to create a new macro called *hello_world* in a new macro library
-called *salute*. Just type in:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: edmac hello_world salute
- Opening salute.hello_world...
- Editing...
-
-This will bring your favorite editor to life with a macro function template
-code for the macro *hello_world*.
-
- .. image:: ../../_static/macro_edit.png
-
-The next chapter will explain how to fill this template with useful code. After
-you finish editing the macro, save the file, exit the editor and go back to
-spock. You'll be asked if you want the new code to be load on the server. Just
-answer 'y'.
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: edmac hello_world salute
- Openning salute.hello_world...
- Editing...
- Do you want to apply the new code on the server? [y] y
-
-.. _macro_function_writing:
-
-
-Writing a macro function
-------------------------
-
-As mentioned before, macros are just simple Python_ functions which have been
-*labeled* as macros. In Python_, these labels are called *decorators*. Here is
-the macro function version of *Hello, World!*::
-
- from sardana.macroserver.macro import macro
-
- @macro()
- def hello_world(self):
- """This is a hello world macro"""
- self.output("Hello, World!")
-
-**line 1**
- imports the *macro* symbol from the sardana macro package.
- :mod:`sardana.macroserver.macro` is the package which contains most symbols
- you will require from sardana to write your macros.
-
-**line 3**
- this line *decorates* de following function as a macro. It is
- **crucial** to use this decorator in order for your :term:`function` to be
- recognized by sardana as a valid macro.
-
-**line 4**
- this line contains the hello_world :term:`function` definition. Every
- macro needs **at least** one parameter. The first parameter is the macro
- execution context. It is usually called ``self`` but you can name it
- anything. This parameter gives you access to the entire context where the
- macro is being run. Through it, you'll be able to do all sorts of things,
- from sending text to the output to ask for motors or even execute other
- macros.
-
-**line 5**
- Documentation for this macro. You should **always** document your macro!
-
-**line 6**
- this line will print *Hello, World!* on your screen.
-
-.. note::
- If you already know a little about Python_ your are probably wondering why
- not use ``print "Hello, World!"``?
-
- Remember that your macro will be executed by a Sardana server which may be
- running in a different computer than the computer you are working on.
- Executing a *normal print* would just print the text in the server.
- Therefore you need to explicitly say you want the text on the computer you
- are working and not the server. The way to do it is using
- :meth:`~sardana.macroserver.macro.Macro.output` instead of print.
-
- If you prefer, you can use the context version of Python_ :func:`print`
- function (it is a bit more powerful than
- :meth:`~sardana.macroserver.macro.Macro.output`\, and has a slightly
- different syntax) ::
-
- # mandatory first line in your code if you use Python < 3.0
- from __future__ import print_function
-
- from sardana.macroserver.macro import macro
-
- @macro()
- def hello_world(self):
- """This is an hello world macro"""
- self.print("Hello, World!")
-
- The following footnote describes how to discover your Python_
- version [#f2]_.
-
-Remeber that a macro is, for all purposes, a normal Python_ :term:`function`.
-This means you **CAN** inside a macro write **ANY** valid Python_ code. This
-includes :keyword:`for` and :keyword:`while` loops, :keyword:`if` ...
-:keyword:`elif` ... :keyword:`else` conditional execution, etc... ::
-
- import numpy.fft
-
- @macro()
- def fft_my_wave(self):
- wave_device = self.getDevice("sys/tg_test/1")
- wave = wave_device.wave
- wave_fft = numpy.fft.fft(wave)
-
-
-Adding parameters to your macro
--------------------------------
-
-Standard Python_ allows you to specify parameters to a function by placing comma
-separated parameter names between the ``()`` in the function definition. The
-macro :term:`API`, in adition, enforces you to specify some extra parameter
-information. At first, this may look like a useless complication, but you will
-apreciate clear benefits soon enough. Here are some of them:
-
- - error prevention: a macro will not be allowed to run if the given
- parameter if of a wrong type
- - :term:`CLI`\s like Spock will be able to offer autocomplete
- facilities (press <tab> and list of allowed parameters show up)
- - :term:`GUI`\s can display list of allowed parameter values in combo
- boxes which gives increased usability and prevents errors
- - Documentation can be generated automatically
-
-So, here is an example on how to define a macro that needs one parameter::
-
- @macro([["moveable", Type.Moveable, None, "moveable to get position"]])
- def where_moveable(self, moveable):
- """This macro prints the current moveable position"""
- self.output("%s is now at %s", moveable.getName(), moveable.getPosition())
-
-Here is another example on how to define a macro that needs two parameters:
-
- - Moveable (motor, pseudo motor)
- - Float (motor absolute position to go to)
-
-::
-
- from sardana.macroserver.macro import macro, Type
-
- @macro([ ["moveable", Type.Moveable, None, "moveable to move"],
- ["position", Type.Float, None, "absolute position"] ])
- def move(self, moveable, position):
- """This macro moves a moveable to the specified position"""
- moveable.move(position)
- self.output("%s is now at %s", moveable.getName(), moveable.getPosition())
-
-The parameter information is a :obj:`list` of :obj:`list`\s. Each :obj:`list`
-being a composed of four elements:
-
- - parameter name
- - parameter type
- - parameter default value (None means no default value)
- - parameter description
-
-Here is a list of the most common allowed parameter types:
-
- - ``Integer``: an integer number
- - ``Float``: a real number
- - ``Boolean``: a boolean True or False
- - ``String``: a string
- - ``Moveable``: a moveable element (motor, pseudo-motor)
- - ``Motor``: a pure motor
- - ``ExpChannel``: an experimental channel (counter/timer, 0D,
- pseudo-counter, ...)
- - ``Controller``: a controller
- - ``ControllerClass``: an existing controller class plugin
- - ``MacroCode``: a macro
- - ``MeasurementGroup``: a measurement group
- - ``Any``: anything, really
-
-The complete list of types distributed with sardana is made up by these five
-simple types: ``Integer``, ``Float``, ``Boolean``, ``String``, ``Any``, plus
-all available sardana interfaces (:obj:`~sardana.sardanadefs.Interface`)
-
-.. _sardana-macro-context:
-
-Macro context
--------------
-
-One of the most powerfull features of macros is that the entire context of
-sardana is at your disposal. Simply put, it means you have access to all
-sardana elements by means of the first parameter on your macro (you can give
-this parameter any name but usually, by convention it is called ``self``).
-
-``self`` provides access to an extensive catalog of functions you can use in
-your macro to do all kinds of things. The complete catalog of functions can be
-found :ref:`here <sardana-macro-api>`.
-
-Let's say you want to write a macro that explicitly moves a known *theta* motor
-to a certain position. You could write a macro which receives the motor as
-parameter but that would be a little silly since you already know beforehand
-which motor you will move. Instead, a better solution would be to *ask* sardana
-for a motor named "theta" and use it directly. Here is how you can acomplish
-that::
-
- @macro([["position", Type.Float, None, "absolute position"]])
- def move_theta(self, position):
- """This macro moves theta to the specified position"""
- th = self.getMotor("th")
- th.move(position)
- self.output("Motor ended at %s", moveable.getPosition())
-
-.. _sardana-macro-calling:
-
-Calling other macros from inside your macro
--------------------------------------------
-
-One of the functions of the macro decorator is to pass the *knowledge* of all
-existing macros to your macro. This way, without any special imports, your
-macro will *know* about all other macros on the system even if they have been
-written in other files.
-
-Lets recreate the two previous macros (*where_moveable* and *move*) to execute
-two of the macros that exist in the standard macro catalog
-(:class:`~sardana.macroserver.macros.standard.wm` and
-:class:`~sardana.macroserver.macros.standard.mv`)
-
-Here is the new version of *where_moveable* ::
-
- @macro([["moveable", Type.Moveable, None, "moveable to get position"]])
- def where_moveable(self, moveable):
- """This macro prints the current moveable position"""
- self.wm(moveable)
-
-... and the new version of *move* ::
-
- @macro([ ["moveable", Type.Moveable, None, "moveable to move"],
- ["position", Type.Float, None, "absolute position"] ])
- def move(self, moveable, position):
- """This macro moves a moveable to the specified position"""
- self.mv(moveable, position)
- self.output("%s is now at %s", moveable.getName(), moveable.getPosition())
-
-.. _sardana-macro-environment:
-
-Accessing environment
----------------------
-
-The sardana server provides a global space to store variables, called
-*environment*. The *environment* is a :term:`dictionary` storing a value for
-each variable. This *environment* is stored persistently so if the sardana
-server is restarted the environment is properly restored.
-
-Variables are case sensitive.
-
-The value of an existing environment variable can be accessed using
-:meth:`~Macro.getEnv`. Setting the value of an environment variable is done
-with :meth:`~Macro.setEnv`.
-
-For example, we know the ascan macro increments a ``ScanID`` environment
-variable each time it is executed. The following example executes a scan and
-outputs the new ``ScanID`` value:
-
-.. code-block:: python
- :emphasize-lines: 7
-
- @macro([["moveable", Type.Moveable, None, "moveable to get position"]])
- def fixed_ascan(self, moveable):
- """This does an ascan starting at 0 ending at 100, in 10 intervals
- with integration time of 0.1s"""
-
- self.ascan(moveable, 0, 100, 10, 0.1)
- scan_id = self.getEnv('ScanID')
- self.output("ScanID is now %d", scan_id)
-
-.. _sardana-macro-logging:
-
-Logging
--------
-
-The Macro :term:`API` includes a set of methods that allow you to write log
-messages with different levels:
-
-.. hlist::
- :columns: 4
-
- * :meth:`~Macro.debug`
- * :meth:`~Macro.info`
- * :meth:`~Macro.warning`
- * :meth:`~Macro.error`
- * :meth:`~Macro.critical`
- * :meth:`~Macro.log`
- * :meth:`~Macro.output`
-
-As you've seen, the special :meth:`~Macro.output` function has the same effect
-as a print statement (with slightly different arguments).
-
-Log messages may have several destinations depending on how your sardana server
-is configured. At least, one destination of each log message is the client(s)
-(spock, GUI, other) which are connected to the server. Spock, for example,
-handles the log messages by printing to the console with different colours. By
-default, spock prints all log messages with level bigger than
-:meth:`~Macro.debug` (You can change this behaviour by typing ``debug on`` in
-spock). Another typical destination for log messages is a log file.
-
-Here is an example on how to write a logging information message::
-
- @macro()
- def lets_log(self):
- self.info("Starting to execute %s", self.getName())
- self.output("Hello, World!")
- self.info("Finished to executing %s", self.getName())
-
-.. KEEP COMMENTED WHILE CHAPTER IS NOT WRITTEN
-.. .. seealso::
-
-.. :ref:`log configuration <sardana-macroserver-configuration-log>`
-.. The sardana log configuration.
-..
-
-.. _sardana-macro-reporting:
-
-Reports
--------
-
-Once the report facility has been properly configured, report messages can be
-sent to the previously configured report file.
-
-There are several differences between :ref:`reporting <sardana-macro-reporting>` and
-:ref:`logging <sardana-macro-logging>`. The first difference is that log messages may
-or may not be recorded, depending on the configured filters on the target
-(example: log file). A report will always be recorded.
-
-Another difference is that report messages are not sent to the clients. The idea
-of a report is to silently record in a file that something as happened.
-
-A third difference is that unlike logs, reports have no message level associated
-to them (actually since internally the log library is used to report messages,
-every report record as the predefined level *INFO* but this is just an
-implementation detail).
-
-A report message can be emited at any time in the macro using the
-:meth:`~Macro.report` method:
-
-.. code-block:: python
- :emphasize-lines: 3
-
- @macro()
- def lets_report(self):
- self.report("this is an official report of macro '%s'", self.getName())
-
-This would generate the following report message in the report file:
-
- INFO 2012-07-18 09:39:34,943: this is an official report of macro 'lets_report'
-
-.. KEEP COMMENTED WHILE CHAPTER IS NOT WRITTEN
-.. .. seealso::
-
-.. :ref:`Report configuration <sardana-macroserver-configuration-report>`
-.. The sardana report configuration.
-
-.. _sardana-advanced-macro-calling:
-
-Advanced macro calls
---------------------
-
-As previously explained (see :ref:`calling macros <sardana-macro-calling>`), you can use
-the Macro :term:`API` to call other macros from inside your own macro:
-
-.. code-block:: python
- :emphasize-lines: 5
-
- @macro([["moveable", Type.Moveable, None, "moveable to get position"]])
- def fixed_ascan(self, moveable):
- """This does an ascan starting at 0 ending at 100, in 10 intervals
- with integration time of 0.1s"""
- self.ascan(moveable, 0, 100, 10, 0.1)
-
-An explicit call to :meth:`~Macro.execMacro` would have the same effect:
-
-.. code-block:: python
- :emphasize-lines: 5
-
- @macro([["moveable", Type.Moveable, None, "moveable to get position"]])
- def fixed_ascan(self, moveable):
- """This does an ascan starting at 0 ending at 100, in 10 intervals
- with integration time of 0.1s"""
- self.execMacro('ascan', moveable, '0', '100', '10', '0.2')
-
-The advantage of using :meth:`~Macro.execMacro` is that it supports passing
-parameters with different *flavors*:
-
- * parameters as strings::
-
- self.execMacro('ascan', motor.getName(), '0', '100', '10', '0.2')
-
- * parameters as space separated string::
-
- self.execMacro('ascan %s 0 100 10 0.2' % motor.getName())
-
- * parameters as concrete types::
-
- self.execMacro(['ascan', motor, 0, 100, 10, 0.2])
-
-Sometimes it is desirable to access data generated by the macro we just called.
-For these cases, the Macro :term:`API` provides a pair of low level methods
-:meth:`~Macro.createMacro` and :meth:`~Macro.runMacro` together with
-:meth:`~Macro.data`.
-
-Let's say that you need access to the data generated by an ascan. First you call
-:meth:`~Macro.createMacro` with the same parameter you would give to
-:meth:`~Macro.execMacro`. This will return a tuple composed from a macro object
-and the result of the :meth:`~Macro.prepare` method. Afterward you call :meth:`~Macro.runMacro` giving
-as parameter the macro object returned by :meth:`~Macro.createMacro`.
-In the end, you can access the data generated by the macro
-using :meth:`~Macro.data`:
-
-.. code-block:: python
- :emphasize-lines: 6,7,8
-
- @macro([["moveable", Type.Moveable, None, "moveable to get position"]])
- def fixed_ascan(self, moveable):
- """This does an ascan starting at 0 ending at 100, in 10 intervals
- with integration time of 0.1s"""
-
- ret = self.createMacro('ascan', moveable, '0', '100', '10', '0.2')
- # createMacro returns a tuple composed from a macro object
- # and the result of the Macro.prepare method
- my_scan, _ = ret
- self.runMacro(my_scan)
- print len(my_scan.data)
-
-A set of macro call examples can be found
-:ref:`here <sardana-devel-macro-call-examples>`.
-
-.. _sardana-macro-class-writing:
-
-Writing a macro class
-----------------------
-
-This chapter describes an advanced alternative to writing macros as Python_
-classes. If words like *inheritance*, *polimorphism* sound like a lawyer's
-horror movie then you probably should only read this if someone expert in
-sardana already told you that the task you intend to do cannot be accomplished
-by writing macro functions.
-
-The simplest macro class that you can write **MUST** obey the following rules:
-
- * Inherit from :class:`Macro`
- * Implement the :meth:`~Macro.run` method
-
-The :meth:`~Macro.run` method is the place where you write the code of your
-macro. So, without further delay, here is the *Hello, World!* example::
-
- from sardana.macroserver.macro import Macro
-
- class HelloWorld(Macro):
- """Hello, World! macro"""
-
- def run(self):
- print "Hello, World!"
-
-.. _sardana-macro-add-parameters:
-
-Let's say you want to pass an integer parameter to your macro. All you have to
-do is declare the parameter by using the :attr:`~Macro.param_def` Macro member::
-
- from sardana.macroserver.macro import Macro, Type
-
- class twice(Macro):
- """Macro twice. Prints the double of the given value"""
-
- param_def = [ [ "value", Type.Float, None, "value to be doubled" ] ]
-
- def run(self, value):
- self.output(2*value)
-
-.. note::
- As soon as you add a :attr:`~Macro.param_def` you also need to
- modify the :meth:`~Macro.run` method to support the new paramter(s).
-
-A set of macro parameter examples can be found
-:ref:`here <sardana-devel-macro-parameter-examples>`.
-
-.. _sardana-macro-preparing:
-
-Preparing your macro for execution
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Additionaly to the :meth:`~Macro.run` method, you may write a
-:meth:`~Macro.prepare` method where you may put code to prepare the macro for
-execution (for example, checking pre-conditions for running the macro). By
-default, the prepare method is an empty method. Here is an example on how to
-prepare HelloWorld to run only after year 1989:
-
-.. code-block:: python
- :emphasize-lines: 7
-
- import datetime
- from sardana.macroserver.macro import Macro
-
- class HelloWorld(Macro):
- """Hello, World! macro"""
-
- def prepare(self):
- if datetime.datetime.now() < datetime.datetime(1990,01,01):
- raise Exception("HelloWorld can only run after year 1989")
-
- def run(self):
- print "Hello, World!"
-
-.. _sardana-macro-plotting:
-
-Plotting
---------
-
-Remember that your macro will be executed by a Sardana server which may be
-running in a different computer than the computer you are working on. Executing
-a normal plot (from :mod:`matplotlib` or :mod:`guiqwt`) would just try to show
-a plot in the server machine. The macro :term:`API` provides a way to plot
-graphics from inside your macro whenver the client that runs the macro
-*understands* the plot request (don't worry, spock does understand!)
-
-The plotting :term:`API` is the same used by :mod:`~matplotlib.pyplot`. The
-:term:`API` is accessible through the macro context (``self``). Here is an
-example::
-
- import math
- from numpy import linspace
- from scipy.integrate import quad
- from scipy.special import j0
-
- from sardana.macroserver.macro import macro
-
- def j0i(x):
- """Integral form of J_0(x)"""
- def integrand(phi):
- return math.cos(x * math.sin(phi))
- return (1.0/math.pi) * quad(integrand, 0, math.pi)[0]
-
- @macro()
- def J0_plot(self):
- """Sample J0 at linspace(0, 20, 200)"""
- x = linspace(0, 20, 200)
- y = j0(x)
- x1 = x[::10]
- y1 = map(j0i, x1)
- self.pyplot.plot(x, y, label=r'$J_0(x)$') #
- self.pyplot.plot(x1, y1, 'ro', label=r'$J_0^{integ}(x)$')
- self.pyplot.title(r'Verify $J_0(x)=\frac{1}{\pi}\int_0^{\pi}\cos(x \sin\phi)\,d\phi$')
- self.pyplot.xlabel('$x$')
- self.pyplot.legend()
-
-Running this macro from spock will result in something like:
-
- .. image:: ../../_static/macro_plotting1.png
-
-Just for fun, the following macro computes a fractal and plots it as an image::
-
- import numpy
-
- @macro([["interactions", Type.Integer, None, ""],
- ["density", Type.Integer, None, ""]])
- def mandelbrot(self, interactions, density):
-
- x_min, x_max = -2, 1
- y_min, y_max = -1.5, 1.5
-
- x, y = numpy.meshgrid(numpy.linspace(x_min, x_max, density),
- numpy.linspace(y_min, y_max, density))
-
- c = x + 1j * y
- z = c.copy()
-
- fractal = numpy.zeros(z.shape, dtype=numpy.uint8) + 255
-
- finteractions = float(interactions)
- for n in range(interactions):
- z *= z
- z += c
- mask = (fractal == 255) & (abs(z) > 10)
- fractal[mask] = 254 * n / finteractions
- self.pyplot.imshow(fractal)
-
-And the resulting image (interactions=20, density=512):
-
-.. figure:: ../../_static/macro_fractal.png
-
-
-A set of macro plotting examples can be found
-:ref:`here <sardana-devel-macro-plotting-examples>`.
-
-Known plotting limitations
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When you plot from inside a macro with ``self.pyplot.plot``, the sardana server
-will "ask" spock to execute the desired function with the given parameters.
-This means that the result of plotting (a sequence of
-:class:`~matplotlib.line.Line2D`) is not available in the sardana server (since
-the actual line is in spock). The result of any function call in
-``self.pyplot`` will always be None!
-
-This means that the following code which works in a normal IPython_ console will
-**NOT** work inside a macro:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: line = plot(range(10))[0]
-
- LAB-01-D01 [2]: line.set_linewidth(5)
-
-Also consider that each time you plot the complete data to be plotted is sent
-from the server to the client... so please avoid plotting arrays of 10,000,000
-points!
-
-.. _sardana-macro-input:
-
-Asking for user input
----------------------
-
-It is possible to ask for user input inside a macro.
-
-.. hint::
- Asking for input in the middle of long macros will cause the macro to
- stop and wait for user input. If you write a long macro that might be
- executed *in the middle of the night* please take the appropriate steps
- to make sure you don't arrive in the morning and you are faced with
- a message box waiting for you to answer a question that could be avoided
- with a proper *default value*. To make sure your macro can run in
- *unattended* mode make sure that:
-
- - it implements the interactive *interface*
- - every :meth:`~Macro.input` gives a *default_value*
- :term:`keyword argument <keyword argument>`
-
- (read on to see how to meet these requirements)
-
-In pure Python_, to ask for user input you can use the :func:`raw_input` (Python
-2) / :func:`input` (Python 3) ::
-
- >>> answer = raw_input('--> ')
- --> Monty Python's Flying Circus
- >>> answer
- "Monty Python's Flying Circus"
-
-The Macro :term:`API` provides a much more powerful version of
-:meth:`~Macro.input` since it can accept a wide variaty of options.
-
-Similar to what happens with :ref:`sardana-macro-plotting`, when input is requested from
-inside a macro, the question will be sent to the client (example: spock) which
-ordered the macro to be executed. At this time the macro is stopped waiting for
-the client to answer. The client must "ask" the user for a proper value and the
-answer is sent back to the server which then resumes the macro execution.
-
-Asking for user input is straightforward:
-
-.. code-block:: python
- :emphasize-lines: 5
-
- @macro()
- def ask_name(self):
- """Macro function version to ask for user name"""
-
- answer = self.input("What's your name?")
- self.output("So, your name is '%s'", answer)
-
-Executing this macro will make spock popup an Input Dialog Box like this one:
-
- .. image:: ../../_static/macro_input.png
-
-When you type your name and press :guilabel:`&OK` the macro finishes printing
-the output:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: ask_name
- <warning>Non interactive macro 'ask_name' is asking for input (please set this macro interactive to True)
- So, your name is 'Homer Simpson'
-
-The macro prints a warning message saying that the macro was not declared as
-*interactive*. All macros that request user input **should** be declared as
-interactive. This is because the sardana server can run a macro in *unattended*
-mode. When an interactive macro is run in *unattended* mode, all
-:meth:`~Macro.input` instructions that have a default value will return
-automatically the default value without asking the user for input.
-
-To declare a macro as interactive set the ``interactive``
-:term:`keyword argument <keyword argument>` in the macro decorator to ``True``
-(default value for ``interactive`` is ``False``), like this:
-
-.. code-block:: python
- :emphasize-lines: 1
-
- @macro(interactive=True)
- def ask_name(self):
- """Macro function version to ask for user name"""
-
- answer = self.input("What's your name?")
- self.output("So, your name is '%s'", answer)
-
-To declare a macro class as interactive set the ``interactive`` member to
-``True`` (default value for ``interactive`` is ``False``), like this:
-
-.. code-block:: python
- :emphasize-lines: 4
-
- class ask_name(Macro):
- """Macro class version to ask for user name"""
-
- interactive = True
-
- def run(self):
- answer = self.input("What's your name?")
- self.output("So, your name is '%s'", answer)
-
-a helper :class:`~imacro` decorator and a :class:`iMacro` class exist which can
-be used instead of the :class:`macro` decorator and :class:`Macro` class to
-transparently declare your macro as interactive:
-
-.. code-block:: python
- :emphasize-lines: 1,5,14
-
- from sardana.macroserver.macro import imacro, iMacro
-
- # interactive macro function version
-
- @imacro()
- def ask_name(self):
- """Macro function version to ask for user name"""
-
- answer = self.input("What's your name?")
- self.output("So, your name is '%s'", answer)
-
- # interactive macro class version
-
- class ask_name(iMacro):
- """Macro class version to ask for user name"""
-
- def run(self):
- answer = self.input("What's your name?")
- self.output("So, your name is '%s'", answer)
-
-The following sub-chapters explain the different options available for macro
-user input.
-
-Specifying input data type
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The default return type of :class:`~Macro.input` is :obj:`str` which mimics the
-pure Python_ input function. However, often you want to restrict the user input
-to a specific data type like ``Integer``, ``Float`` or even complex object like
-``Moveable`` or to a list of possible options.
-
-The macro :class:`~Macro.input` :term:`API` provides an easy way to do this by
-specifying the concrete data type in the
-:term:`keyword argument <keyword argument>` *data_type*. The following examples
-shows how to ask for an ``Integer``, a ``Moveable``, and single/multiple
-selection from a list of options::
-
- from sardana.macroserver.macro import imacro, Type
-
- @imacro()
- def ask_number_of_points(self):
- """asks user for the number of points"""
-
- nb_points = self.input("How many points?", data_type=Type.Integer)
- self.output("You selected %d points", nb_points)
-
- @imacro()
- def ask_for_moveable(self):
- """asks user for a motor"""
-
- moveable = self.input("Which moveable?", data_type=Type.Moveable)
- self.output("You selected %s which is at %f", moveable, moveable.getPosition())
-
- @imacro()
- def ask_for_car_brand(self):
- """asks user for a car brand"""
-
- car_brands = "Mazda", "Citroen", "Renault"
- car_brand = self.input("Which car brand?", data_type=car_brands)
- self.output("You selected %s", car_brand)
-
- @imacro()
- def ask_for_multiple_car_brands(self):
- """asks user for several car brands"""
-
- car_brands = "Mazda", "Citroen", "Renault", "Ferrari", "Porche", "Skoda"
- car_brands = self.input("Which car brand(s)?", data_type=car_brands,
- allow_multiple=True)
- self.output("You selected %s", ", ".join(car_brands))
-
-... and these are the corresponding dialogs that will popup in spock:
-
- |input_integer| |input_moveable| |input_select_radio|
- |input_select_multiple|
-
-
-Providing a default value
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Providing a default value is **very important** since it will allow your macro
-to run in *unattended* mode. When given, the *default_value*
-:term:`keyword argument <keyword argument>` value type must be compatible with
-the *data_type* :term:`keyword argument <keyword argument>`. Providing a
-default value is easy. The following examples repeat the previous data type
-examples giving compatible default values::
-
- from sardana.macroserver.macro import imacro, Type
-
- @imacro()
- def ask_number_of_points(self):
- """asks user for the number of points"""
-
- nb_points = self.input("How many points?", data_type=Type.Integer,
- default_value=100)
- self.output("You selected %d points", nb_points)
-
- @imacro()
- def ask_for_moveable(self):
- """asks user for a motor"""
-
- moveable = self.input("Which moveable?", data_type=Type.Moveable,
- default_value="gap01")
- self.output("You selected %s which is at %f", moveable, moveable.getPosition())
-
- @imacro()
- def ask_for_car_brand(self):
- """asks user for a car brand"""
-
- car_brands = "Mazda", "Citroen", "Renault"
- car_brand = self.input("Which car brand?", data_type=car_brands,
- default_value=car_brands[1])
- self.output("You selected %s", car_brand)
-
- @imacro()
- def ask_for_multiple_car_brands(self):
- """asks user for several car brands. Default is every other car brand
- in the list"""
-
- car_brands = "Mazda", "Citroen", "Renault", "Ferrari", "Porche", "Skoda"
- car_brands = self.input("Which car brand(s)?", data_type=car_brands,
- allow_multiple=True,
- default_value=car_brands[::2])
- self.output("You selected %s", ", ".join(car_brands))
-
-Giving a title
-~~~~~~~~~~~~~~
-
-By default, the Dialog window title will contain the name of the macro which
-triggered user input. You can override the default behaviour with the
-:term:`keyword argument <keyword argument>` *title*::
-
- @imacro()
- def ask_peak(self):
- """asks use for peak current of points with a custom title"""
-
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection")
- self.output("You selected a peak of %f A", peak)
-
-... and this is the corresponding dialog:
-
- |input_float_title|
-
-Specifying label and unit
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The *key* and *unit* :term:`keyword arguments <keyword argument>` can be used to
-provide additional label and unit information respectively and prevent user
-mistakes::
-
- @imacro()
- def ask_peak_v2(self):
- """asks use for peak current of points with a custom title,
- default value, label and units"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-... and this is the corresponding dialog:
-
- |input_float_title_label_unit|
-
-Limiting ranges, setting decimal places and step size
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When numeric input is requested, it might be useful to prevent user input
-outside a certain range. This can be achieved with the *minimum* and *maximum*
-:term:`keyword arguments <keyword argument>`::
-
- @imacro()
- def ask_peak_v3(self):
- """asks use for peak current of points with a custom title,
- default value, label, units and ranges"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4, minimum=0.0, maximum=200.0)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-An additional *step* :term:`keyword argument <keyword argument>` may help
-increase usability by setting the step size in a input spin box::
-
- @imacro()
- def ask_peak_v4(self):
- """asks use for peak current of points with a custom title,
- default value, label, units, ranges and step size"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4, minimum=0.0, maximum=200.0,
- step=5)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-When asking for a decimal number, it might be useful to use the *decimals*
-:term:`keyword argument <keyword argument>` to indicate how many decimal places
-to show in a input spin box::
-
- @imacro()
- def ask_peak_v5(self):
- """asks use for peak current of points with a custom title,
- default value, label, units, ranges, step size and decimal places"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4, minimum=0.0, maximum=200.0,
- step=5, decimals=2)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-A set of macro input examples can be found
-:ref:`here <sardana-devel-macro-input-examples>`.
-
-Showing progress in long macros
--------------------------------
-
-Some of the macros you write may take a long time to execute. It could be useful
-to provide frequent feedback on the current progress of your macro to prevent
-users from thinking the system is blocked. The way to do this is by
-:keyword:`yield`\ing a new progress number in the ode everytime you want to
-send a progress.
-
-The following code shows an example:
-
-.. code-block:: python
- :emphasize-lines: 9
-
- import time
-
- @macro([["duration", Type.Integer, 1, "time to sleep (s)"]])
- def nap(self, duration):
-
- fduration = float(duration)
- for i in range(duration):
- time.sleep(1)
- yield (i+1) / fduration * 100
-
-The important code here is line 9. Everytime the macro execution reaches this
-line of code, basically it tells sardana to send a progress with the desired
-value. By default, the value is interpreted has a percentage and should have
-the range between 0.0 and 100.0.
-
-Actually, even if your macro doesn't explicitly send macro progress reports,
-sardana always generates a 0.0 progress at the beginning of the macro and a
-last 100.0 progress at the end so for example, in a :term:`GUI`, the progress
-bar showing the macro progress will always reach the end (unless an error
-occurs) no matter how you program the progress.
-
-|macro_progress|
-
-It is possible to generate a progress that doesn't fit the 0 - 100.0 range. The
-above macro has been modified to send a progress with a customized range:
-
-.. code-block:: python
- :emphasize-lines: 6, 11, 12
-
- import time
-
- @macro([["duration", Type.Integer, 1, "time to sleep (s)"]])
- def nap(self, duration):
-
- status = { 'range' : [0, duration] }
-
- fduration = float(duration)
- for i in range(duration):
- time.sleep(1)
- status['step'] = i+1
- yield status
-
-You may notice that this way, the range can be changed dynamically. A progress
-bar in a :term:`GUI` is programmed to adjust not only the current progress
-value but also the ranges so it is safe to change them if necessary.
-
-
-
-
-
-.. rubric:: Footnotes
-
-.. [#f1] To find the absolute path for sardana's source code type on the
- command line ``python -c "import sys, sardana; sys.stdout.write(str(sardana.__path__))"``
-
-.. [#f2] To check which version of Python_ you are using type on the command
- line ``python -c "import sys; sys.stdout.write(sys.version)"``
-
-.. |input_integer| image:: ../../_static/macro_input_integer.png
- :align: middle
-
-.. |input_moveable| image:: ../../_static/macro_input_moveable.png
- :align: middle
-
-.. |input_select_radio| image:: ../../_static/macro_input_select_radio.png
- :align: middle
-
-.. |input_select_multiple| image:: ../../_static/macro_input_select_multiple.png
- :align: middle
-
-.. |input_float_title| image:: ../../_static/macro_input_float_title.png
- :align: middle
-
-.. |input_float_title_label_unit| image:: ../../_static/macro_input_float_title_label_unit.png
- :align: middle
-
-.. |macro_progress| image:: ../../_static/macro_progress.png
- :align: middle
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/howto_macros/scan_framework.rst b/doc/source/devel/howto_macros/scan_framework.rst
deleted file mode 100644
index ae2c9b24..00000000
--- a/doc/source/devel/howto_macros/scan_framework.rst
+++ /dev/null
@@ -1,255 +0,0 @@
-
-.. currentmodule:: sardana.macroserver.macro
-
-.. _sardana-macros-scanframework:
-
-==============
-Scan Framework
-==============
-
-In general terms, we call *scan* to a macro that moves one or more motors and
-acquires data along the path of the motor(s). See the
-:ref:`introduction to the concept of scan in Sardana <sardana-users-scan>`.
-
-While a scan macro could be written from scratch, Sardana provides a higher-
-level API (the *scan framework*) that greatly simplifies the development of
-scan macros by taking care of the details about synchronization of motors and
-of acquisitions.
-
-The scan framework is implemented in the :mod:`~sardana.macroserver.scan`
-module, which provides the :class:`~sardana.macroserver.scan.GScan` base class
-and its specialized derived classes :class:`~sardana.macroserver.scan.SScan`
-and :class:`~sardana.macroserver.scan.CScan` for step and continuous scans,
-respectively.
-
-Creating a scan macro consists in writing a generic macro (see
-:ref:`the generic macro writing instructions <sardana-macros-howto>`) in
-which an instance of :class:`~sardana.macroserver.scan.GScan` is created
-(typically in the :meth:`~Macro.prepare` method) which is then invoked in the
-:meth:`~Macro.run` method.
-
-Central to the scan framework is the
-:meth:`~sardana.macroserver.macro.scan.gscan.GScan.generator` function, which
-must be passed to the GScan constructor. This generator is a function that
-allows to construct the path of the scan (see
-:class:`~sardana.macroserver.scan.GScan` for detailed information on the
-generator).
-
-
-A basic example on writing a step scan
---------------------------------------
-
-Step scans are built using an instance of the
-:class:`~sardana.macroserver.scan.SScan` class, which requires a step generator
-that defines the path for the motion. Since in a step scan the data is acquired
-at each step, the generator controls both the motion and the acquisition.
-
-Note that in general, the generator does not need to generate a determinate (or
-even finite) number of steps. Also note that it is possible to write generators
-that vary their current step based on the acquired values (e.g., changing step
-sizes as a function of some counter reading).
-
-The :class:`~sardana.macroserver.macros.examples.ascan_demo` macro illustrates
-the most basic features of a step scan::
-
- class ascan_demo(Macro):
- """
- This is a basic reimplementation of the ascan` macro for demonstration
- purposes of the Generic Scan framework. The "real" implementation of
- :class:`sardana.macroserver.macros.ascan` derives from
- :class:`sardana.macroserver.macros.aNscan` and provides some extra features.
- """
-
- hints = { 'scan' : 'ascan_demo'} #this is used to indicate other codes that the macro is a scan
- env = ('ActiveMntGrp',) #this hints that the macro requires the ActiveMntGrp environment variable to be set
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time, **opts):
- #parse the user parameters
- self.start = numpy.array([start_pos], dtype='d')
- self.final = numpy.array([final_pos], dtype='d')
- self.integ_time = integ_time
-
- self.nr_points = nr_interv+1
- self.interv_size = ( self.final - self.start) / nr_interv
- self.name='ascan_demo'
- env = opts.get('env',{}) #the "env" dictionary may be passed as an option
-
- #create an instance of GScan (in this case, of its child, SScan
- self._gScan=SScan(self, generator=self._generator, moveables=[motor], env=env)
-
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time #integ_time is the same for all steps
- for point_no in xrange(self.nr_points):
- step["positions"] = self.start + point_no * self.interv_size #note that this is a numpy array
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan(): #just go through the steps
- yield step
-
- @property
- def data(self):
- return self._gScan.data #the GScan provides scan data
-
-
-The :class:`~sardana.macroserver.macros.examples.ascan_demo` shows only basic
-features of the scan framework, but it already shows that writing a step scan
-macro is mostly just a matter of writing a generator function.
-
-It also shows that the :meth:`scan.gscan.GScan.data` method can be used to
-provide the needed return value of :meth:`~Macro.data`
-
-
-
-A basic example on writing a continuous scans
----------------------------------------------
-
-Continuous scans are built using an instance of the
-:class:`~sardana.macroserver.scan.CScan` class. Since in the continuous scans
-the acquisition and motion are decoupled, CScan requires two independent
-generators:
-
-* a *waypoint generator*: which defines the path for the motion in a very
- similar way as the step generator does for a continuous scan. The steps
- generated by this generator are also called "waypoints".
-
-* a *period generator* which controls the data acquisition steps.
-
-
-Essentially, :class:`~sardana.macroserver.scan.CScan` implements the continuous
-scan as an acquisition loop (controlled by the period generator) nested within
-a motion loop (controlled by the waypoint generator). Note that each loop is
-run on an independent thread, and only limited communication occurs between the
-two (basically the acquisition starts at the beginning of each movement and
-ends when a waypoint is reached).
-
-The :class:`~sardana.macroserver.macros.examples.ascanc_demo` macro illustrates
-the most basic features of a continuous scan:: ::
-
- class ascanc_demo(Macro):
- """
- This is a basic reimplementation of the ascanc` macro for demonstration
- purposes of the Generic Scan framework. The "real" implementation of
- :class:`sardana.macroserver.macros.ascanc` derives from
- :class:`sardana.macroserver.macros.aNscan` and provides some extra features.
- """
-
- hints = { 'scan' : 'ascanc_demo'} #this is used to indicate other codes that the macro is a scan
- env = ('ActiveMntGrp',) #this hints that the macro requires the ActiveMntGrp environment variable to be set
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, integ_time, **opts):
- self.name='ascanc_demo'
- #parse the user parameters
- self.start = numpy.array([start_pos], dtype='d')
- self.final = numpy.array([final_pos], dtype='d')
- self.integ_time = integ_time
- env = opts.get('env',{}) #the "env" dictionary may be passed as an option
-
- #create an instance of GScan (in this case, of its child, CScan
- self._gScan = CScan(self,
- waypointGenerator=self._waypoint_generator,
- periodGenerator=self._period_generator,
- moveables=[motor],
- env=env)
-
- def _waypoint_generator(self):
- #a very simple waypoint generator! only start and stop points!
- yield {"positions":self.start, "waypoint_id": 0}
- yield {"positions":self.final, "waypoint_id": 1}
-
-
- def _period_generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- point_no = 0
- while(True): #infinite generator. The acquisition loop is started/stopped at begin and end of each waypoint
- point_no += 1
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
-
-.. seealso:: for another example of a continuous scan implementation
- (with more elaborated waypoint generator), see the code of
- :class:`~sardana.macroserver.macros.scan.meshc`
-
-
-
-Hooks support in scans
-----------------------
-
-In general, the Hooks API provided by the
-:class:`~sardana.macroserver.macro.Hookable` base class allows a macro to run
-other code (the hook callable) at certain points of its execution. The hooks
-use a "hints" mechanism to pass the receiving macro some extra information on
-how/when they should be executed. The hints are strings, and its content is not
-fixed by the API, being up to each macro to identify, use and/or ignore them.
-
-You can find some examples of the use of hooks in the
-:mod:`~sardana.macroserver.macros.examples.hooks` module.
-
-In the case of the scan macros, the hooks can be either registered directly via
-the Hooks API or passed as key:values of the "step" dictionary returned by the
-scan :meth:`~sardana.macroserver.macro.scan.gscan.GScan.generator` (see
-:class:`~sardana.macroserver.macro.scan.gscan.GScan` for more details).
-
-The hints for a given hook are used by the scan framework to select the moment
-of the scan execution that the given hook is run. The following is a list of
-hint strings that scan macros support (other hints are ignored):
-
-- 'pre-scan-hooks' : before starting the scan.
-- 'pre-move-hooks' : for steps: before starting to move.
-- 'post-move-hooks': for steps: after finishing the move.
-- 'pre-acq-hooks' : for steps: before starting to acquire.
-- 'post-acq-hooks' : for steps: after finishing acquisition but before
- recording the step.
-- 'post-step-hooks' : for steps: after finishing recording the step.
-- 'post-scan-hooks' : after finishing the scan
-
-See the code of :class:`~sardana.macroserver.macros.examples.hooks.hooked_scan`
-for a macro that demonstrates the use of the hook points of a scan.
-
-Other examples of the :mod:`~sardana.macroserver.macros.examples.hooks` module
-can be illustrative.
-
-Also, note that the Taurus MacroExecutor widget allows the user to dynamically
-add hooks to existing macros before execution.
-
-
-More examples
--------------
-
-Other macros in the :mod:`~sardana.macroserver.macros.examples` module
-illustrate more features of the scan framework.
-
-See also the code of the standard scan macros in the
-:mod:`~sardana.macroserver.macros.scan` module.
-
-Finally, the documentation and code of :class:`~sardana.macroserver.scan.GScan`,
-:class:`~sardana.macroserver.scan.SScan` and
-:class:`~sardana.macroserver.scan.CScan` may be helpful.
-
-
-
-
diff --git a/doc/source/devel/howto_test/index.rst b/doc/source/devel/howto_test/index.rst
deleted file mode 100644
index ae48ac1f..00000000
--- a/doc/source/devel/howto_test/index.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-
-.. currentmodule:: sardana.macroserver.macros.test
-
-.. _sardana-test-howto:
-
-===============
-Sardana Testing
-===============
-
-
-.. toctree::
- :maxdepth: 2
-
- General test documentation <test_general>
- Run Sardana tests from command line <test_run_commands>
- Test-driven development example <test_example>
- Sardana Unit Test examples <tests/index>
diff --git a/doc/source/devel/howto_test/test_example.rst b/doc/source/devel/howto_test/test_example.rst
deleted file mode 100644
index aace2450..00000000
--- a/doc/source/devel/howto_test/test_example.rst
+++ /dev/null
@@ -1,323 +0,0 @@
-
-.. currentmodule:: sardana.test.
-
-.. _sardana-test-driven-devel-example:
-
-
-
-===============================
-Test-driven development example
-===============================
-
-
-In this section it is presented a practical example of how to code a macro
-by doing test-driven development thanks to the tools provided by the Sardana
-Test Framework.
-
-Consider that we want to write a new macro named "sqrtmac" for calculating the
-square root of an input number. The "sqrtmac" specifications are:
-
-1. Its data must be given in the form {'in':x,'out':s}
-2. Its output ('out') must be the square root of the input data ('in').
-3. Macro must raise an Exception of type ValueError if negative numbers are given as input.
-
-
-Test development
-----------------
-
-First we design the tests according to the specifications considering the
-features that are required for the macro. For doing so we will need some
-imports in order to be able to use the base classes and decorators.
-In this case the important base class is RunMacroTestCase, and
-we import testRun and testFail to be used as decorators::
-
- """Tests for sqrt macro"""
- import numpy as np
- import unittest
- from sardana.macroserver.macros.test import RunMacroTestCase, testRun, testFail
-
-
-Now we will write a basic test, that will check the execution of the sqrtmac for
-a given input x = 12345.678. For doing so, we inherit from unittest and
-from RunMacroTestCase. In this implementation we will calculate in the test the
-sqrt of the input parameter and then, using assertEqual, we will verify that
-this value is equal to the output of the macro. The helper method macro_runs is
-used for executing the macro::
-
- """Tests for a macro calculating the sqrt of an input number"""
- import numpy as np
- import unittest
- from sardana.macroserver.macros.test import RunMacroTestCase, testRun, testFail
-
-
- class sqrtmacTest(RunMacroTestCase, unittest.TestCase):
- """Test of sqrt macro. It verifies that macro sqrt can be executed.
- """
- macro_name = "sqrtmac"
-
- def test_sqrtmac(self):
-
- macro_params = [str(x)]
- self.macro_runs(macro_params)
-
- data=self.macro_executor.getData()
- expected_output = 49
-
- msg = 'Macro output does not equals the expected output'
- self.assertEqual(data['in'] ,float(macro_params[0]), msg)
- self.assertEqual(data['out'] ,expected_output, msg)
-
-
-Now, two new tests are added thanks to the decorator and the helper functions.
-In this case we will use the decorator @testRun. The same test case can be
-launched with different sets of parameters. One decorator is used for each set
-of parameters.
-
-One of the tests will run the sqrtmac macro for an input value of 9 and
-verify that the macro has been executed without problems.
-
-Another test added will run the sqrt for an input of 2.25 and will verify
-its input and output values against the expected values which we pass to the
-decorator. A wait_timeout of 5s will be given; this means, that if the test
-does not finish within 5 seconds, the current test will give an error and
-the following test will be executed::
-
-
- """Tests for a macro calculating the sqrt of an input number"""
- import numpy as np
- import unittest
- from sardana.macroserver.macros.test import RunMacroTestCase, testRun, testFail
-
-
- @testRun(macro_params=['9'])
- @testRun(macro_params=['2.25'], data={'in':2.25,'out':1.5}, wait_timeout=5)
- class sqrtmacTest(RunMacroTestCase, unittest.TestCase):
- """Test of sqrt macro. It verifies that macro sqrt can be executed.
- """
- macro_name = "sqrtmac"
-
- def test_sqrtmac(self):
-
- macro_params = [str(x)]
- self.macro_runs(macro_params)
-
- data=self.macro_executor.getData()
- expected_output = 49
-
- msg = 'Macro output does not equals the expected output'
- self.assertEqual(data['in'] ,float(macro_params[0]), msg)
- self.assertEqual(data['out'] ,expected_output, msg)
-
-
-
-The following test implemented must check that the macro is raising an Exception
-if negative numbers are passed as input. The type of exception raised must be a
-ValueError. For developing this test we will use the decorator testFail which
-allows to test if a macro is raising an Exception before finishing its
-execution. The final implementation of our test file test_sqrt.py is as
-follows::
-
-
- """Tests for a macro calculating the sqrt of an input number"""
- import numpy as np
- import unittest
- from sardana.macroserver.macros.test import RunMacroTestCase, testRun, testFail
-
- @testRun(macro_params=['9'])
- @testRun(macro_params=['2.25'], data={'in':2.25,'out':1.5}, wait_timeout=5)
- @testFail(macro_params=['-3.0'], exception=ValueError, wait_timeout=5)
- class sqrtmacTest(RunMacroTestCase, unittest.TestCase):
- """Test of sqrt macro. It verifies that macro sqrt can be executed.
- """
- macro_name = "sqrtmac"
-
- def test_sqrtmac(self):
-
- macro_params = [str(x)]
- self.macro_runs(macro_params)
-
- data=self.macro_executor.getData()
- expected_output = 49
-
- msg = 'Macro output does not equals the expected output'
- self.assertEqual(data['in'] ,float(macro_params[0]), msg)
- self.assertEqual(data['out'] ,expected_output, msg)
-
-
-
-Macro development
------------------
-
-Thanks to the test that we have designed precedently we can now implement
-the macro and check if it is developed according to the specifications.
-
-We do a first implementation of the macro by calculating the square root
-of an input number. Then we will execute the test and analyze the results. The
-first implementation looks like this::
-
- import numpy as np
- from sardana.macroserver.macro import Macro, Type
-
- class sqrtmac(Macro):
- """Macro sqrtmac"""
-
- param_def = [ [ "value", Type.Float, 9,
- "input value for which we want the square root"] ]
- result_def = [ [ "result", Type.Float, None,
- "square root of the input value"] ]
-
- def run (self, n):
- ret = np.sqrt(n)
- return ret
-
-
-
-An its ouput on the screen::
-
- sardana/src/sardana/macroserver/macros/test> python -m unittest -v test_sqrtmac
- test_sqrtmac (test_sqrtmac.sqrtmacTest) ... ERROR
- test_sqrtmac_macro_fails (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_fails(macro_params=['-3.0'], exception=<type 'exceptions.ValueError'>, wait_timeout=5) ... FAIL
- test_sqrtmac_macro_runs (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['2.25'], wait_timeout=5, data={'out': 1.5, 'in': 2.25}) ... ERROR
- test_sqrtmac_macro_runs_2 (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['9']) ... ok
-
- ======================================================================
- ERROR: test_sqrtmac (test_sqrtmac.sqrtmacTest)
- ----------------------------------------------------------------------
- Traceback (most recent call last):
- .
- .
- .
- desc = Exception: Macro 'sqrtmac' does not produce any data
-
-
- ======================================================================
- ERROR: test_sqrtmac_macro_runs (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['2.25'], wait_timeout=5, data={'out': 1.5, 'in': 2.25})
- ----------------------------------------------------------------------
- Traceback (most recent call last):
- .
- .
- .
- desc = Exception: Macro 'sqrtmac' does not produce any data
-
-
- ======================================================================
- FAIL: test_sqrtmac_macro_fails (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_fails(macro_params=['-3.0'], exception=<type 'exceptions.ValueError'>, wait_timeout=5)
- ----------------------------------------------------------------------
- Traceback (most recent call last):
- File "/siciliarep/tmp/mrosanes/workspace/GIT/projects/sardana/src/sardana/macroserver/macros/test/base.py", line 144, in newTest
- return helper(**helper_kwargs)
- File "/siciliarep/tmp/mrosanes/workspace/GIT/projects/sardana/src/sardana/macroserver/macros/test/base.py", line 271, in macro_fails
- self.assertEqual(state, 'exception', msg)
- AssertionError: Post-execution state should be "exception" (got "finish")
-
- ----------------------------------------------------------------------
- Ran 4 tests in 0.977s
-
- FAILED (failures=1, errors=2)
-
-
-At this moment two tests are giving an error because 'sqrtmac' does not produce
-data, and one test is failing because the exception is not treat.
-The test that is giving 'Ok' is only testing that the macro can be
-executed.
-
-The second step will be to set the input and output data of the macro and
-execute the test again::
-
- import numpy as np
- from sardana.macroserver.macro import Macro, Type
-
- class sqrtmac(Macro):
- """Macro sqrtmac"""
-
- param_def = [ [ "value", Type.Float, 9,
- "input value for which we want the square root"] ]
- result_def = [ [ "result", Type.Float, None,
- "square root of the input value"] ]
-
- def run (self, n):
- ret = np.sqrt(n)
- self.setData({'in':n,'out':ret})
- return ret
-
-
-An its ouput on the screen::
-
- sardana/macroserver/macros/test> python -m unittest -v test_sqrtmac
- test_sqrtmac (test_sqrtmac.sqrtmacTest) ... ok
- test_sqrtmac_macro_fails (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_fails(macro_params=['-3.0'], exception=<type 'exceptions.ValueError'>, wait_timeout=5) ... FAIL
- test_sqrtmac_macro_runs (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['2.25'], wait_timeout=5, data={'out': 1.5, 'in': 2.25}) ... ok
- test_sqrtmac_macro_runs_2 (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['9']) ... ok
-
- ======================================================================
- FAIL: test_sqrtmac_macro_fails (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_fails(macro_params=['-3.0'], exception=<type 'exceptions.ValueError'>, wait_timeout=5)
- ----------------------------------------------------------------------
- Traceback (most recent call last):
- File "/siciliarep/tmp/mrosanes/workspace/GIT/projects/sardana/src/sardana/macroserver/macros/test/base.py", line 142, in newTest
- return helper(**helper_kwargs)
- File "/siciliarep/tmp/mrosanes/workspace/GIT/projects/sardana/src/sardana/macroserver/macros/test/base.py", line 267, in macro_fails
- self.assertEqual(state, 'exception', msg)
- AssertionError: Post-execution state should be "exception" (got "finish")
-
- ----------------------------------------------------------------------
- Ran 4 tests in 0.932s
-
- FAILED (failures=1)
-
-As we can see, the test_sqrtmac_macro_fails is Failing, because the case of
-negative numbers is still not suppported. The rest of tests that are testing the
-execution and the expected output values are OK.
-
-
-
-Finally we arrive to the complete implementation of the macro taking into
-account the Exception that should be raised if we enter a negative number
-as input parameter. For coding this macro test-driven development has been
-used::
-
- import numpy as np
- from sardana.macroserver.macro import Macro, Type
-
- class sqrtmac(Macro):
- """Macro sqrtmac"""
-
- param_def = [ [ "value", Type.Float, 9,
- "input value for which we want the square root"] ]
- result_def = [ [ "result", Type.Float, None,
- "square root of the input value"] ]
-
- def run (self, n):
- if (n<0):
- raise ValueError("Negative numbers are not accepted.")
-
- ret = np.sqrt(n)
- self.setData({'in':n,'out':ret})
- return ret
-
-
-An the output on the console after executing the test looks like this::
-
- sardana/macroserver/macros/test> python -m unittest -v test_sqrtmac
- test_sqrtmac (test_sqrtmac.sqrtmacTest) ... ok
- test_sqrtmac_macro_fails (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_fails(macro_params=['-3.0'], exception=<type 'exceptions.ValueError'>, wait_timeout=5) ... ok
- test_sqrtmac_macro_runs (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['2.25'], wait_timeout=5, data={'out': 1.5, 'in': 2.25}) ... ok
- test_sqrtmac_macro_runs_2 (test_sqrtmac.sqrtmacTest)
- Testing sqrtmac with macro_runs(macro_params=['9']) ... ok
-
- ----------------------------------------------------------------------
- Ran 4 tests in 0.928s
-
- OK
-
-
diff --git a/doc/source/devel/howto_test/test_general.rst b/doc/source/devel/howto_test/test_general.rst
deleted file mode 100644
index 2d4f54f7..00000000
--- a/doc/source/devel/howto_test/test_general.rst
+++ /dev/null
@@ -1,109 +0,0 @@
-.. highlight:: python
- :linenothreshold: 5
-
-.. currentmodule:: sardana.macroserver.macros.test
-
-
-.. _sardana-test-general-howto:
-
-
-===============
-Sardana Testing
-===============
-
-Sardana Test Framework
-----------------------------
-
-
-A testing framework allowing to test the Sardana features is included with the
-Sardana distribution. It is useful for test-driven development and it allows
-to find bugs in the code.
-
-The first implementation of the Framework is an outcome of the `Sardana
-Enhancement Proposal 5 (SEP5)`_.
-
-Ideally, whenever possible, bug reports should be accompanied by a test
-revealing the bug.
-
-
-The first tests implemented are focused on Unit Tests, but the same framework
-should be used for integration and system tests as well.
-
-The sardana.test module includes testsuite.py. This file provides an
-auto-discovering suite for all tests implemented in Sardana.
-
-The following are some key points to keep in mind when using this framework:
-
-- The Sardana Test Framework is based on :mod:`unittest` which should be
- imported from :mod:`taurus.external` in order to be compatible with all
- versions of python supported by Taurus.
-
-- all test-related code is contained in submodules named `test` which appear
- in any module of Sardana.
-
-- test-related code falls in one of these three categories:
- * Actual test code (classes that derive from unittest.TestCase)
- * Utility classes/functions (code to simplify development of test code)
- * Resources (accessory files required by some test). They are located in
- subdirectories named `res` situated inside the folders named `test`.
-
-For a more complete description of the conventions on how to write tests with
-the Sardana Testing Framework, please refer to the
-[SEP5](http://sourceforge.net/p/sardana/wiki/SEP5/).
-
-
-
-Sardana Test Framework for testing macros
------------------------------------------
-
-Sardana Test Framework provides tools for testing macros. These tools come
-from sardana.macroserver.macros.test module
-
-Tests meant to be incorporated in the Sardana distribution must be portable.
-For this reason it is strongly encouraged to use only elements created
-by the sar_demo macro. Only in the case where this is not possible, one may
-create specific elements for a test; these elements must be removed at the
-end of the test execution (e.g. using the tearDown method).
-
-The module :mod:`sardana.macroserver.macros.test` provides utilities to simplify
-the tests for macro execution and macro stop. Macro test classes can inherit
-from :class:`.RunMacroTestCase`,
-:class:`.RunStopMacroTestCase` or
-:class:`.BaseMacroTestCase`.
-
-Another utility provided is the option to execute the same test with
-many different macro input parameters. This is done by decorating the test
-class with any of the decorators of the the macro tests family.
-
-This decorator is provided by :mod:`sardana.macroserver.macros.test`.
-
-
-**Specificities:**
-
-* Macros such as 'lsm' inherit from RunMacroTestCase as it is interesting to
- test if the macros can be executed. Helper methods
- ( such as :meth:`.RunMacroTestCase.macro_runs` ) can be overriden when
- programming new test cases. New helpers can be created as well.
-
-* Scan macros inherits from RunStopMacroTestCase as it is interesting to test
- both: if the macros can be executed and if they can be aborted.
-
-
-
-
-Links
------
-
-For a more complete description of the conventions used when writing tests, see:
-http://sourceforge.net/p/sardana/wiki/SEP5/
-
-For more information about unittest framework:
-http://docs.python.org/2/library/unittest.html
-
-
-.. _Sardana Enhancement Proposal 5 (SEP5): http://sourceforge.net/p/sardana/wiki/SEP5/
-
-
-
-
-
diff --git a/doc/source/devel/howto_test/test_run_commands.rst b/doc/source/devel/howto_test/test_run_commands.rst
deleted file mode 100644
index aca30009..00000000
--- a/doc/source/devel/howto_test/test_run_commands.rst
+++ /dev/null
@@ -1,35 +0,0 @@
-
-.. currentmodule:: sardana.test.
-
-.. _sardana-test-run-commands:
-
-
-===========================
-Run tests from command line
-===========================
-
-
-Run the whole Sardana test suite
---------------------------------
-
-Running the whole Sardana test suite from command line can be done by going
-to the Sardana directory:
-<sardana_root>/sardana/test/.
-
-And executing:
-python testsuite.py
-
-
-
-Run a single test
------------------
-
-Executing a single test from command line is done by doing:
- python -m unittest test_name
-
-Where test_name is the test module that has to be run.
-
-That can be done with more verbosity by indicating the option -v.
- python -m unittest -v test_name
-
-
diff --git a/doc/source/devel/howto_test/tests/index.rst b/doc/source/devel/howto_test/tests/index.rst
deleted file mode 100644
index dd5bfa4d..00000000
--- a/doc/source/devel/howto_test/tests/index.rst
+++ /dev/null
@@ -1,19 +0,0 @@
-
-.. currentmodule:: sardana.test
-
-.. _sardana_list_test:
-
-==========================
-Sardana Unit Test Examples
-==========================
-
-
-.. toctree::
- :maxdepth: 2
-
- test ct <test_ct>
- test list <test_list>
- test scan <test_scan>
- test wm <test_wm>
- sardanavalue <test_sardanavalue>
- parameter <test_parameter>
diff --git a/doc/source/devel/howto_test/tests/test_ct.rst b/doc/source/devel/howto_test/tests/test_ct.rst
deleted file mode 100644
index d5e27e73..00000000
--- a/doc/source/devel/howto_test/tests/test_ct.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. currentmodule:: sardana.macroserver.macros.test.test_ct
-.. _test_ct:
-
-:mod:`~sardana.macroserver.macros.test.test_ct`
-===============================================
-
-.. automodule:: sardana.macroserver.macros.test.test_ct
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`CtTest`
-
-
-CtTest
-------
-
-.. inheritance-diagram:: CtTest
- :parts: 1
-
-.. autoclass:: CtTest
- :members:
- :undoc-members:
-
diff --git a/doc/source/devel/howto_test/tests/test_list.rst b/doc/source/devel/howto_test/tests/test_list.rst
deleted file mode 100644
index d51a8cac..00000000
--- a/doc/source/devel/howto_test/tests/test_list.rst
+++ /dev/null
@@ -1,114 +0,0 @@
-.. currentmodule:: sardana.macroserver.macros.test.test_list
-.. _test_list:
-
-:mod:`~sardana.macroserver.macros.test.test_list`
-=================================================
-
-.. automodule:: sardana.macroserver.macros.test.test_list
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`LsTest`
- * :class:`LsmTest`
- * :class:`LspmTest`
- * :class:`LsctrlTest`
- * :class:`LsctTest`
- * :class:`Ls0dTest`
- * :class:`Ls1dTest`
- * :class:`Ls2dTest`
-
-
-
-LsTest
-------
-
-.. inheritance-diagram:: LsTest
- :parts: 1
-
-.. autoclass:: LsTest
- :inherited-members:
- :members:
- :undoc-members:
-
-
-LsmTest
--------
-
-.. inheritance-diagram:: LsmTest
- :parts: 1
-
-.. autoclass:: LsmTest
- :members:
- :undoc-members:
-
-
-LspmTest
---------
-
-.. inheritance-diagram:: LspmTest
- :parts: 1
-
-.. autoclass:: LspmTest
- :members:
- :undoc-members:
-
-
-LsctrlTest
-----------
-
-.. inheritance-diagram:: LsctrlTest
- :parts: 1
-
-.. autoclass:: LsctrlTest
- :members:
- :undoc-members:
-
-
-LsctTest
---------
-
-.. inheritance-diagram:: LsctTest
- :parts: 1
-
-.. autoclass:: LsctTest
- :members:
- :undoc-members:
-
-
-Ls0dTest
---------
-
-.. inheritance-diagram:: Ls0dTest
- :parts: 1
-
-.. autoclass:: Ls0dTest
- :members:
- :undoc-members:
-
-
-Ls1dTest
---------
-
-.. inheritance-diagram:: Ls1dTest
- :parts: 1
-
-.. autoclass:: Ls1dTest
- :members:
- :undoc-members:
-
-
-Ls2dTest
---------
-
-.. inheritance-diagram:: Ls2dTest
- :parts: 1
-
-.. autoclass:: Ls2dTest
- :members:
- :undoc-members:
-
-
-
diff --git a/doc/source/devel/howto_test/tests/test_parameter.rst b/doc/source/devel/howto_test/tests/test_parameter.rst
deleted file mode 100644
index 53b42e6a..00000000
--- a/doc/source/devel/howto_test/tests/test_parameter.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. currentmodule:: sardana.spock.test.test_parameter
-.. _test_parameter:
-
-:mod:`~sardana.spock.test.test_parameter`
-=========================================
-
-.. automodule:: sardana.spock.test.test_parameter
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`ParamTestCase`
-
-
-ParamTestCase
--------------
-
-.. inheritance-diagram:: ParamTestCase
- :parts: 1
-
-.. autoclass:: ParamTestCase
- :members:
- :undoc-members:
diff --git a/doc/source/devel/howto_test/tests/test_sardanavalue.rst b/doc/source/devel/howto_test/tests/test_sardanavalue.rst
deleted file mode 100644
index b4f28dff..00000000
--- a/doc/source/devel/howto_test/tests/test_sardanavalue.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. currentmodule:: sardana.test.test_sardanavalue
-.. _test_sardanavalue:
-
-:mod:`~sardana.test.test_sardanavalue`
-======================================
-
-.. automodule:: sardana.test.test_sardanavalue
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`SardanaValueTestCase`
-
-
-SardanaValueTestCase
---------------------
-
-.. inheritance-diagram:: SardanaValueTestCase
- :parts: 1
-
-.. autoclass:: SardanaValueTestCase
- :members:
- :undoc-members:
diff --git a/doc/source/devel/howto_test/tests/test_scan.rst b/doc/source/devel/howto_test/tests/test_scan.rst
deleted file mode 100644
index caa5b985..00000000
--- a/doc/source/devel/howto_test/tests/test_scan.rst
+++ /dev/null
@@ -1,96 +0,0 @@
-.. currentmodule:: sardana.macroserver.macros.test.test_scan
-.. _test_scan:
-
-:mod:`~sardana.macroserver.macros.test.test_scan`
-=================================================
-
-.. automodule:: sardana.macroserver.macros.test.test_scan
-
-.. rubric:: Functions
-.. autofunction:: parsing_log_output
-
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`ANscanTest`
- * :class:`DNscanTest`
- * :class:`DNscancTest`
- * :class:`AscanTest`
- * :class:`DscanTest`
- * :class:`MeshTest`
-
-
-
-ANscanTest
-----------
-
-.. inheritance-diagram:: ANscanTest
- :parts: 1
-
-.. autoclass:: ANscanTest
- :members:
- :undoc-members:
-
-
-DNscanTest
-----------
-
-.. inheritance-diagram:: DNscanTest
- :parts: 1
-
-.. autoclass:: DNscanTest
- :members:
- :undoc-members:
-
-
-DNscancTest
------------
-
-.. inheritance-diagram:: DNscancTest
- :parts: 1
-
-.. autoclass:: DNscancTest
- :members:
- :undoc-members:
-
-
-AscanTest
----------
-
-.. inheritance-diagram:: AscanTest
- :parts: 1
-
-.. autoclass:: AscanTest
- :members:
- :undoc-members:
-
-
-DscanTest
----------
-
-.. inheritance-diagram:: DscanTest
- :parts: 1
-
-.. autoclass:: DscanTest
- :members:
- :undoc-members:
-
-
-MeshTest
---------
-
-.. inheritance-diagram:: MeshTest
- :parts: 1
-
-.. autoclass:: MeshTest
- :members:
- :undoc-members:
-
-
-
-
-
-
diff --git a/doc/source/devel/howto_test/tests/test_wm.rst b/doc/source/devel/howto_test/tests/test_wm.rst
deleted file mode 100644
index c134c09d..00000000
--- a/doc/source/devel/howto_test/tests/test_wm.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. currentmodule:: sardana.macroserver.macros.test.test_wm
-.. _test_wm:
-
-:mod:`~sardana.macroserver.macros.test.test_wm`
-===============================================
-
-.. automodule:: sardana.macroserver.macros.test.test_wm
-
-.. rubric:: Classes
-
-.. hlist::
- :columns: 3
-
- * :class:`WBase`
- * :class:`WmTest`
-
-
-
-WBase
------
-
-.. inheritance-diagram:: WBase
- :parts: 1
-
-.. autoclass:: WBase
- :members:
- :undoc-members:
-
-WmTest
-------
-
-.. inheritance-diagram:: WmTest
- :parts: 1
-
-.. autoclass:: WmTest
- :members:
- :undoc-members:
diff --git a/taurus/doc/source/devel/icon_example.py b/doc/source/devel/icon_example.py
index 2ee250fc..2ee250fc 100644
--- a/taurus/doc/source/devel/icon_example.py
+++ b/doc/source/devel/icon_example.py
diff --git a/taurus/doc/source/devel/icon_guide.rst b/doc/source/devel/icon_guide.rst
index ba40179a..ba40179a 100644
--- a/taurus/doc/source/devel/icon_guide.rst
+++ b/doc/source/devel/icon_guide.rst
diff --git a/doc/source/devel/index.rst b/doc/source/devel/index.rst
index 107d7076..e22109f1 100644
--- a/doc/source/devel/index.rst
+++ b/doc/source/devel/index.rst
@@ -1,4 +1,4 @@
-.. _sardana-developers-guide-index:
+.. _developers-guide-index:
=================
Developer's Guide
@@ -7,11 +7,15 @@ Developer's Guide
.. toctree::
:maxdepth: 2
- Overview <overview/index>
- howto_macros/index
- howto_controllers/index
- howto_test/index
- API <api/api_sardana>
- Migration guide <guide_migration>
- Examples <examples/examples>
- Development guidelines <guide_coding>
+ tau to taurus migration guide <tau2taurus_migration_guide>
+ Development guidelines <coding_guide>
+ Color guide <color_guide>
+ Icon guide <icon_guide>
+ Designer tutorial <designer_tutorial>
+ Core tutorial <core_tutorial>
+ Widget tutorial <widget_tutorial>
+ Popup menu tutorial <popupmenu_tutorial>
+ API <api/taurus>
+ All Classes <api/taurus_AllClasses.rst>
+ Examples <examples>
+ \ No newline at end of file
diff --git a/doc/source/devel/overview/index.rst b/doc/source/devel/overview/index.rst
deleted file mode 100644
index 7b0c46be..00000000
--- a/doc/source/devel/overview/index.rst
+++ /dev/null
@@ -1,23 +0,0 @@
-.. _sardana-devel-overview:
-
-========
-Overview
-========
-
-
-.. toctree::
- :maxdepth: 2
-
- Global overview <overview>
- Macro Server <overview_macroserver>
- Pool <overview_pool>
- Controller <overview_controller>
- Motor <overview_motor>
- Pseudo motor <overview_pseudomotor>
- IO register <overview_IOR>
- Counter/timer <overview_countertimer>
- 0D experiment channel <overview_0D>
- 1D experiment channel <overview_1D>
- 2D experiment channel <overview_2D>
- Pseudo counter <overview_pseudocounter>
-
diff --git a/doc/source/devel/overview/overview.rst b/doc/source/devel/overview/overview.rst
deleted file mode 100644
index f0bad07f..00000000
--- a/doc/source/devel/overview/overview.rst
+++ /dev/null
@@ -1,122 +0,0 @@
-.. _sardana-devel-global-overview:
-
-================
-Global overview
-================
-
-This chapter gives an overview of the sardana architecture and describes each of
-the different components in some detail.
-If you find this document to be to technical please consider reading the
-:ref:`sardana-overview` guide first.
-
-The following chapters assume a that you have a minimum knowledge of the Tango_
-system and basic computer science.
-
-Architecture
--------------
-
-Sardana consists of a software library which contains sardana kernel engine, a
-server and a client library which allow sardana to run as a
-:term:`client-server <client-server model>` based distributed control system.
-The communication protocols between servers and clients are
-:term:`plug-ins <plug-in>` in sardana. At this time, the only
-implemented protocol is Tango_. In earlier versions, sardana was tightly
-connected to Tango_. This documentation, is therefore centered in the
-Tango_ server implementation. When other comunication protocols become
-available, the documentation will be revised.
-
-Client applications (both :term:`GUI` and :term:`CLI`) can connect to the
-sardana server through the high level sardana client :term:`API` or through the
-low level pure Tango_ channels.
-Client applications can be build with the purpose of *operating* an existing
-sardana server or of *configuring* it.
-
-Sardana server (:term:`SDS`)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The sardana server consists of a sardana tango device server (:term:`SDS`)
-running a sardana kernel engine.
-This server runs as an :term:`OS` :term:`daemon`. Once configured, this server
-acts as a container of device objects which can be accessed by the outside
-world as *tango device objects*.
-Typically, a sardana server will consist of:
-
- - a low level **Pool** object which manages all the server objects related
- to motion control and data acquisition (controllers, motors, counters,
- experiment channels, etc).
- - a **Macro Server** object which manages the execution of macros
- (procedures) and client connection points (called doors).
- - a set of low level objects (controllers, motors, counters, experiment
- channels, etc) controlled by the Pool object
- - a set of **Door** objects managed by the macro server. A Door is the
- preferred access point from a client application to the to the sardana
- server
-
-.. figure:: /_static/sardana_server.png
- :width: 400
- :align: center
-
- A diagram representing a sardana server with its objects
-
-A sardana server may contain only a Pool object or a Macro Server object or both.
-It may **NOT** contain more than one Pool object or more than one Macro Server object.
-
-If necessary, your sardana system may be splitted into two (or more) sardana servers.
-A common configuration is to have a sardana server with a Pool (in this case we call
-the server a *Device Pool* server) and a second server with a Macro Server (this server
-is called *MacroServer* server).
-
-The following figures show some of the possible alternative configurations
-
-.. figure:: /_static/pool_server.png
- :width: 256
- :align: center
-
- 1 - Sardana configured to be a single Pool DS (no MacroServer present)
-
-.. figure:: /_static/macroserver_server.png
- :width: 256
- :align: center
-
- 2 - Sardana configured to be a single MacroServer DS (no Pool present)
-
-.. figure:: /_static/macroserver_pool_server.png
- :width: 256
- :align: center
-
- 3 - Sardana configured with a MacroServer DS connecting to an underlying
- Pool DS
-
-.. figure:: /_static/sardana_pool_server.png
- :width: 512
- :align: center
-
- 4 - Sardana configured with a Sardna DS connecting to another underlying
- Pool DS
-
-The following chapters describe each of the Sardana objects in more detail.
-
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/overview/overview_0D.rst b/doc/source/devel/overview/overview_0D.rst
deleted file mode 100644
index e3d65535..00000000
--- a/doc/source/devel/overview/overview_0D.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-0d-overview:
-
-=======================
-0D channel overview
-=======================
-
-.. todo:: document 0D experiment channel overview
-
-.. seealso::
-
- :ref:`sardana-0d-api`
- the 0D experiment channel :term:`API`
-
- :class:`~sardana.tango.pool.ZeroDExpChannel.ZeroDExpChannel`
- the 0D experiment channel tango device :term:`API`
diff --git a/doc/source/devel/overview/overview_1D.rst b/doc/source/devel/overview/overview_1D.rst
deleted file mode 100644
index f5bb6281..00000000
--- a/doc/source/devel/overview/overview_1D.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-1d-overview:
-
-=======================
-1D channel overview
-=======================
-
-.. todo:: document 1D experiment channel overview
-
-.. seealso::
-
- :ref:`sardana-1d-api`
- the 1D experiment channel :term:`API`
-
- :class:`~sardana.tango.pool.OneDExpChannel.OneDExpChannel`
- the 1D experiment channel tango device :term:`API`
diff --git a/doc/source/devel/overview/overview_2D.rst b/doc/source/devel/overview/overview_2D.rst
deleted file mode 100644
index c1fa37a7..00000000
--- a/doc/source/devel/overview/overview_2D.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-2d-overview:
-
-=======================
-2D channel overview
-=======================
-
-.. todo:: document 2D experiment channel overview
-
-.. seealso::
-
- :ref:`sardana-2d-api`
- the 2D experiment channel :term:`API`
-
- :class:`~sardana.tango.pool.TwoDExpChannel.TwoDExpChannel`
- the 2D experiment channel tango device :term:`API`
diff --git a/doc/source/devel/overview/overview_IOR.rst b/doc/source/devel/overview/overview_IOR.rst
deleted file mode 100644
index 1b5b0805..00000000
--- a/doc/source/devel/overview/overview_IOR.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-ior-overview:
-
-=======================
-I/O register overview
-=======================
-
-.. todo:: document I/O register overview
-
-.. seealso::
-
- :ref:`sardana-ior-api`
- the I/O register :term:`API`
-
- :class:`~sardana.tango.pool.IORegister.IORegister`
- the I/O register tango device :term:`API`
diff --git a/doc/source/devel/overview/overview_controller.rst b/doc/source/devel/overview/overview_controller.rst
deleted file mode 100644
index 3062457d..00000000
--- a/doc/source/devel/overview/overview_controller.rst
+++ /dev/null
@@ -1,232 +0,0 @@
-.. currentmodule:: sardana.pool.controller
-
-.. _sardana-controller-overview:
-
-===================
-Controller overview
-===================
-
-Each different hardware object is directly controlled by a software object
-called *controller*. This object is responsible for mapping the communication
-between a set of hardware objects (example motors) and the underlying hardware
-(example: a motor controller crate). The *controller* object is also exposed as
-a Tango_ device.
-
-Usually a controller is capable of handling several hardware objects.
-For example, a motor controller crate is capable of controlling several motors
-(generally called *axis* [#]_).
-
-The controller objects can be created/deleted/renamed dynamically in a running
-pool.
-
-A specific type of controller needs to be created to handle each specific type
-of hardware. Therefore, to each type of hardware controller there must be
-associated a specific controller software component. You can write a
-specific controller software component (:term:`plug-in`) that is able to
-communicate with the specific hardware. You can this way extend the initial
-pool capabilities to talk to all kinds of different hardware.
-
-.. figure:: /_static/sardana_server_np200.png
- :width: 500
- :align: center
-
- A diagram representing a sardana server with a controller class
- *NSC200Controller*, an instance of that controller *np200ctrl_1* "connected"
- to a real hardware and a single motor *npm_1*.
-
-A sardana controller is responsible for it's sardana element(s). Example: an
-Icepap hardware motor controller can *control* up to 128 individual motor axis.
-In the same way, the coresponding software motor controller *IcepapController*
-will *own* the individual motor axises.
-
-.. figure:: /_static/sardana_server_icepap.png
- :width: 500
- :align: center
-
- A diagram representing a sardana server with a controller class
- *IcepapController*, an instance of that controller *icectrl_1* "connected"
- to a real hardware and motors *icem_[1..5]*.
-
-
-These are the different types of controllers recognized by sardana:
-
-:class:`MotorController`
- You should use/write a :class:`MotorController` sardana :term:`plug-in` if
- the the device you want to control has a *moveable* interface.
- The :class:`MotorController` actually fullfils a *changeable* interface.
- This means that, for example, a power supply that has a current which you
- want to *ramp* could also be implemented as a :class:`MotorController`.
-
- Example: the Newport NSC200 motor controller
-
-:class:`CounterTimerController`
- This controller type is designed to control a device capable of counting
- scalar values (and, optionaly have a timer).
-
- Example: The National Instruments 6602 8-Channel Counter/Timer
-
-:class:`ZeroDController`
- This controller type is designed to control a device capable of supplying
- scalar values. The :term:`API` provides a way to obtain a value over a
- certain acquisition time through different algorithms (average, maximum,
- integration).
-
- Example: an electrometer
-
-:class:`OneDController`
- This controller type is designed to control a device capable of supplying
- 1D values. It has a very similar :term:`API` to :class:`CounterTimerController`
-
- Example: an :term:`MCA`
-
-:class:`TwoDController`
- This controller type is designed to control a device capable of supplying
- 2D values. It has a very similar :term:`API` to :class:`CounterTimerController`
-
- Example: a :term:`CCD`
-
-:class:`PseudoMotorController`
- A controller designed to export *virtual motors* that represent a new view
- over the actual physical motors.
-
- Example: A slit pseudo motor controller provides *gap* and *offset* virtual
- motors over the physical blades
-
-:class:`PseudoCounterController`
- A controller designed to export *virtual counters* that represent a new view
- over the actual physical counters/0Ds.
-
-:class:`IORegisterController`
- A controller designed to control hardware registers.
-
-Controller plug-ins can be written in Python_ (and in the future in C++).
-Each controller code is basically a Python_ class that needs to obey a
-specific :term:`API`.
-
-Here is an a extract of the pertinent part of a Python_ motor controller code
-that is able to talk to a Newport motor controller::
-
- from sardana.pool.controller import MotorController, \
- Type, Description, DefaultValue
-
- class NSC200Controller(MotorController):
- """This class is the Tango Sardana motor controller for the Newport NewStep
- handheld motion controller NSC200.
- This controller communicates through a Device Pool serial communication
- channel."""
-
- ctrl_properties = \
- { 'SerialCh' : { Type : str,
- Description : 'Communication channel name for the serial line' },
- 'SwitchBox': { Type : bool,
- Description : 'Using SwitchBox',
- DefaultValue : False},
- 'ControllerNumber' : { Type : int,
- Description : 'Controller number',
- DefaultValue : 1 } }
-
- def __init__(self, inst, props, *args, **kwargs):
- MotorController.__init__(self, inst, props, *args, **kwargs)
-
- self.serial = None
- self.serial_state_event_id = -1
-
- if self.SwitchBox:
- self.MaxDevice = 8
-
- def AddDevice(self, axis):
- if axis > 1 and not self.SwitchBox:
- raise Exception("Without using a Switchbox only axis 1 is allowed")
-
- if self.SwitchBox:
- self._setCommand("MX", axis)
-
- def DeleteDevice(self, axis):
- pass
-
- _STATE_MAP = { NSC200.MOTOR_OFF : State.Off, NSC200.MOTOR_ON : State.On,
- NSC200.MOTOR_MOVING : State.Moving }
-
- def StateOne(self, axis):
- if self.SwitchBox:
- self._setCommand("MX", axis)
-
- status = int(self._queryCommand("TS"))
- status = self._STATE_MAP.get(status, State.Unknown)
- register = int(self._queryCommand("PH"))
- lower = int(NSC200.getLimitNegative(register))
- upper = int(NSC200.getLimitPositive(register))
-
- switchstate = 0
- if lower == 1 and upper == 1: switchstate = 6
- elif lower == 1: switchstate = 4
- elif upper == 1: switchstate = 2
- return status, "OK", switchstate
-
- def ReadOne(self, axis):
- try:
- if self.SwitchBox:
- self._setCommand("MX", axis)
- return float(self._queryCommand("TP"))
- except:
- raise Exception("Error reading position, axis not available")
-
- def PreStartOne(self, axis, pos):
- return True
-
- def StartOne(self, axis, pos):
- if self.SwitchBox:
- self._setCommand("MX", axis)
- status = int(self._queryCommand("TS"))
- if status == NSC200.MOTOR_OFF:
- self._setCommand("MO","")
- self._setCommand("PA", pos)
- self._log.debug("[DONE] sending position")
-
- def StartAll(self):
- pass
-
- def AbortOne(self, axis):
- if self.SwitchBox:
- self._setCommand("MX", axis)
- self._setCommand("ST", "")
-
-.. seealso::
-
- :ref:`sardana-controller-howto`
- How to write controller :term:`plug-in`\s in sardana
-
- :ref:`sardana-controller-api`
- the controller :term:`API`
-
- :class:`~sardana.tango.pool.Controller.Controller`
- the controller tango device :term:`API`
-
-.. rubric:: Footnotes
-
-.. [#] The term *axis* will be used from here on to refer to the ID of
- a specific hardware object (like a motor) with respect to its *controller*.
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/overview/overview_countertimer.rst b/doc/source/devel/overview/overview_countertimer.rst
deleted file mode 100644
index be4c8d69..00000000
--- a/doc/source/devel/overview/overview_countertimer.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-countertimer-overview:
-
-=======================
-Counter/timer overview
-=======================
-
-.. todo:: document counter/timer overview
-
-.. seealso::
-
- :ref:`sardana-countertimer-api`
- the counter/timer :term:`API`
-
- :class:`~sardana.tango.pool.CTExpChannel.CTExpChannel`
- the counter/timer tango device :term:`API`
diff --git a/doc/source/devel/overview/overview_macroserver.rst b/doc/source/devel/overview/overview_macroserver.rst
deleted file mode 100644
index 5a3dc80e..00000000
--- a/doc/source/devel/overview/overview_macroserver.rst
+++ /dev/null
@@ -1,82 +0,0 @@
-.. _sardana-macroserver-overview:
-
-=====================
-Macro Server overview
-=====================
-
-The Macro Server object is the sardana server object which manages all high
-level sardana objects related to macro execution, namely doors, macro libraries
-and macros themselves.
-
-The main purpose of the Macro Server is to run *macros*. Macros are just pieces
-of Python_ code (functions or classes) which reside in a macro library (Python_
-file). Macros can be written by anyone with knowledge of Python_.
-
-The Macro Server is exposed on the sardana server as a Tango_ device.
-Through configuration, the Macro Server can be told to connect to a
-Pool device. This is the most common configuration.
-You can, however, tell the Macro Server to connect to more than one Pool device
-or to no Pool devices at all.
-
-When connected to a Pool device(s), the Macro Server uses the Pool device
-introspection :term:`API` to discover which elements are available. The existing
-macros will be able to access these elements (through parameters passed to the
-macro or using the macro :term:`API`) and act on them.
-
-In order to be able to run macros, you must first connect to the Macro Server
-entry point object called *Door*. A single Macro Server can have many active
-Doors at the same time but a Door can only run one macro at a time.
-Each Door is exposed on the sardana server as a Tango_ device.
-
-You are not in any way restricted to the standard macros provided by the sardana
-system. You can write as many macros as you need. Writing your own macros is
-easy. The macro equivalent of Python_\'s *Hello, World!* example::
-
- from sardana.macroserver.macro import macro
-
- @macro()
- def hello_world(self):
- self.output("Hello, World!")
-
-
-Here is a simple example of a macro to move any moveable element to a certain
-value::
-
- from sardana.macroserver.macro import macro, Type
-
- @macro([ ["moveable", Type.Moveable, None, "moveable to move"],
- ["position", Type.Float, None, "absolute position"] ])
- def my_move(self, moveable, position):
- """This macro moves a moveable to the specified position"""
-
- moveable.move(position)
- self.output("%s is now at %s", moveable, moveable.getPosition())
-
-Information on how to write your own sardana macros can be found
-:ref:`here <sardana-macros-howto>`.
-
-The complete macro :term:`API` can be found :ref:`here <sardana-macro-api>`.
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/overview/overview_motor.rst b/doc/source/devel/overview/overview_motor.rst
deleted file mode 100644
index 0f5dd812..00000000
--- a/doc/source/devel/overview/overview_motor.rst
+++ /dev/null
@@ -1,62 +0,0 @@
-.. _sardana-motor-overview:
-
-.. currentmodule:: sardana.pool
-
-==================
-Motor overview
-==================
-
-The motor is one of the most used elements in sardana. A motor represents
-anything that can be *changed* (and can potentially take some time to do it),
-so, not only physical motors (like a stepper motors) fit into this category but
-also, for example, a power supply for which the electrical current can be
-modified.
-As it happens with the motor controller hardware and its physical motor(s),
-a sardana motor is always associated with it's sardana motor controller.
-
-.. figure:: /_static/sardana_server_icepap_np200.png
- :width: 680
- :align: center
-
- A diagram representing a sardana server with a several motor controllers
- and their respective motors.
-
-The *motor* object is also exposed as a Tango_ device.
-
-.. seealso::
-
- :ref:`sardana-motor-api`
- the motor :term:`API`
-
- :class:`~sardana.tango.pool.Motor.Motor`
- the motor tango device :term:`API`
-
-.. :class:`~sardana.pool.poolmotor.PoolMotor`
-.. the motor class :term:`API`
-
-
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/overview/overview_pool.rst b/doc/source/devel/overview/overview_pool.rst
deleted file mode 100644
index 93736eda..00000000
--- a/doc/source/devel/overview/overview_pool.rst
+++ /dev/null
@@ -1,77 +0,0 @@
-
-.. _sardana-pool-overview:
-
-==============
-Pool overview
-==============
-
-The Pool object is the sardana server object which manages all other hardware level
-sardana objects related with motion control and data acquisition. This object is
-exposed to the world as a Tango_ device. It's :term:`API` consists of a series
-of methods (Tango_ commands) and members (Tango_ attributes) which allow
-external applications to create/remove/rename and monitor the different hardware
-level sardana objects.
-
-The Pool could be seen as a kind of intelligent device container to
-control the experiment hardware. It has two basic features which are:
-
-1. Hardware access using dynamically created/deleted devices
- according to the experiment needs
-
-2. Management of some very common and well defined actions regularly done
- on a laboratory/factory (motion control, data acquisition, etc.)
-
-
-Hardware access
----------------
-
-Core hardware access
-~~~~~~~~~~~~~~~~~~~~
-
-Most of the times, it is possible to define a list of very common objects found
-in most of the experiments. Objects commonly used to drive an experiment
-usually fit in one of the following categories:
-
-- *Moveables*
- - Motor
- - Pseudo motor
- - Group of moveables
- - IORegister (a.k.a. discrete motor)
-- *Experimental channels*
- - Counter/Timer
- - 0D (Multimeter like)
- - 1D (:term:`MCA` like)
- - 2D (:term:`CCD` like)
- - Pseudo Counter
-- *Communication channels*
-
-Each different controlled hardware object will also be exposed as an independent
-Tango_ class. The sardana device server will embed all these Tango_ classes
-together. The pool Tango_ device is the "container interface" and allows the
-user to create/delete classical Tango_ devices which are instances of these
-embedded classes.
-
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/devel/overview/overview_pseudocounter.rst b/doc/source/devel/overview/overview_pseudocounter.rst
deleted file mode 100644
index c628ac50..00000000
--- a/doc/source/devel/overview/overview_pseudocounter.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-pseudocounter-overview:
-
-=======================
-Pseudo counter overview
-=======================
-
-.. todo:: document pseudo counter overview
-
-.. seealso::
-
- :ref:`sardana-pseudocounter-api`
- the pseudo counter :term:`API`
-
- :class:`~sardana.tango.pool.PseudoCounter.PseudoCounter`
- the pseudo counter tango device :term:`API`
diff --git a/doc/source/devel/overview/overview_pseudomotor.rst b/doc/source/devel/overview/overview_pseudomotor.rst
deleted file mode 100644
index 500e8aea..00000000
--- a/doc/source/devel/overview/overview_pseudomotor.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-.. currentmodule:: sardana.pool
-
-.. _sardana-pseudomotor-overview:
-
-=======================
-Pseudo motor overview
-=======================
-
-.. todo:: document pseudo motor overview
-
-.. seealso::
-
- :ref:`sardana-pseudomotor-api`
- the pseudo motor :term:`API`
-
- :class:`~sardana.tango.pool.PseudoMotor.PseudoMotor`
- the pseudo motor tango device :term:`API`
diff --git a/taurus/doc/source/devel/popupmenu_tutorial.rst b/doc/source/devel/popupmenu_tutorial.rst
index 9b09aa8a..9b09aa8a 100644
--- a/taurus/doc/source/devel/popupmenu_tutorial.rst
+++ b/doc/source/devel/popupmenu_tutorial.rst
diff --git a/taurus/doc/source/devel/tau2taurus_migration_guide.rst b/doc/source/devel/tau2taurus_migration_guide.rst
index 2085c5de..2085c5de 100644
--- a/taurus/doc/source/devel/tau2taurus_migration_guide.rst
+++ b/doc/source/devel/tau2taurus_migration_guide.rst
diff --git a/taurus/doc/source/devel/widget_tutorial.rst b/doc/source/devel/widget_tutorial.rst
index e29c285d..e29c285d 100644
--- a/taurus/doc/source/devel/widget_tutorial.rst
+++ b/doc/source/devel/widget_tutorial.rst
diff --git a/doc/source/docs.rst b/doc/source/docs.rst
index e3fadd58..ad00e5b2 100644
--- a/doc/source/docs.rst
+++ b/doc/source/docs.rst
@@ -1,26 +1,22 @@
-.. currentmodule:: sardana
+.. currentmodule:: taurus
.. _docs:
-=====================
-Sardana Documentation
-=====================
-
-Sardana is a software suite for Supervision, Control and Data Acquisition in
-scientific installations.
-
+====================
+Taurus documentation
+====================
+Taurus is a free, open source, multi-platform pure Python module for creating
+and supporting Graphical User Interfaces for experiment control and data
+acquisition.
.. toctree::
:maxdepth: 2
- users/index
- devel/index
- Glossary <glossary>
- To do <todo>
- History of changes <revision>
-
+ users/index.rst
+ devel/index.rst
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
+
diff --git a/doc/source/glossary.rst b/doc/source/glossary.rst
deleted file mode 100644
index 5b037767..00000000
--- a/doc/source/glossary.rst
+++ /dev/null
@@ -1,430 +0,0 @@
-
-.. _sardana-glossary:
-
-===========
-Glossary
-===========
-
-.. glossary::
- :sorted:
-
- ``>>>``
- The default Python prompt of the interactive shell. Often seen for code
- examples which can be executed interactively in the interpreter.
-
- ``...``
- The default Python prompt of the interactive shell when entering code for
- an indented code block or within a pair of matching left and right
- delimiters (parentheses, square brackets or curly braces).
-
- argument
- A value passed to a function or method, assigned to a named local
- variable in the function body. A function or method may have both
- positional arguments and keyword arguments in its definition.
- Positional and keyword arguments may be variable-length: ``*`` accepts
- or passes (if in the function definition or call) several positional
- arguments in a list, while ``**`` does the same for keyword arguments
- in a dictionary.
-
- Any expression may be used within the argument list, and the evaluated
- value is passed to the local variable.
-
- attribute
- A value associated with an object which is referenced by name using
- dotted expressions. For example, if an object *o* has an attribute
- *a* it would be referenced as *o.a*.
-
- dictionary
- An associative array, where arbitrary keys are mapped to values. The
- keys can be any object with :meth:`__hash__` and :meth:`__eq__` methods.
- Called a hash in Perl.
-
- class
- A template for creating user-defined objects. Class definitions
- normally contain method definitions which operate on instances of the
- class.
-
- expression
- A piece of syntax which can be evaluated to some value. In other words,
- an expression is an accumulation of expression elements like literals,
- names, attribute access, operators or function calls which all return a
- value. In contrast to many other languages, not all language constructs
- are expressions. There are also :term:`statement`\s which cannot be used
- as expressions, such as :func:`print` or :keyword:`if`. Assignments
- are also statements, not expressions.
-
- function
- A series of statements which returns some value to a caller. It can also
- be passed zero or more arguments which may be used in the execution of
- the body. See also :term:`argument` and :term:`method`.
-
- generator
- A function which returns an iterator. It looks like a normal function
- except that it contains :keyword:`yield` statements for producing a series
- a values usable in a for-loop or that can be retrieved one at a time with
- the :func:`next` function. Each :keyword:`yield` temporarily suspends
- processing, remembering the location execution state (including local
- variables and pending try-statements). When the generator resumes, it
- picks-up where it left-off (in contrast to functions which start fresh on
- every invocation).
-
- .. index:: single: generator expression
-
- generator expression
- An expression that returns an iterator. It looks like a normal expression
- followed by a :keyword:`for` expression defining a loop variable, range,
- and an optional :keyword:`if` expression. The combined expression
- generates values for an enclosing function::
-
- >>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81
- 285
-
- interactive
- Python has an interactive interpreter which means you can enter
- statements and expressions at the interpreter prompt, immediately
- execute them and see their results. Just launch ``python`` with no
- arguments (possibly by selecting it from your computer's main
- menu). It is a very powerful way to test out new ideas or inspect
- modules and packages (remember ``help(x)``).
-
- interpreted
- Python is an interpreted language, as opposed to a compiled one,
- though the distinction can be blurry because of the presence of the
- bytecode compiler. This means that source files can be run directly
- without explicitly creating an executable which is then run.
- Interpreted languages typically have a shorter development/debug cycle
- than compiled ones, though their programs generally also run more
- slowly. See also :term:`interactive`.
-
- iterable
- An object capable of returning its members one at a
- time. Examples of iterables include all sequence types (such as
- :class:`list`, :class:`str`, and :class:`tuple`) and some non-sequence
- types like :class:`dict` and :class:`file` and objects of any classes you
- define with an :meth:`__iter__` or :meth:`__getitem__` method. Iterables
- can be used in a :keyword:`for` loop and in many other places where a
- sequence is needed (:func:`zip`, :func:`map`, ...). When an iterable
- object is passed as an argument to the built-in function :func:`iter`, it
- returns an iterator for the object. This iterator is good for one pass
- over the set of values. When using iterables, it is usually not necessary
- to call :func:`iter` or deal with iterator objects yourself. The ``for``
- statement does that automatically for you, creating a temporary unnamed
- variable to hold the iterator for the duration of the loop. See also
- :term:`iterator`, :term:`sequence`, and :term:`generator`.
-
- iterator
- An object representing a stream of data. Repeated calls to the iterator's
- :meth:`next` method return successive items in the stream. When no more
- data are available a :exc:`StopIteration` exception is raised instead. At
- this point, the iterator object is exhausted and any further calls to its
- :meth:`next` method just raise :exc:`StopIteration` again. Iterators are
- required to have an :meth:`__iter__` method that returns the iterator
- object itself so every iterator is also iterable and may be used in most
- places where other iterables are accepted. One notable exception is code
- which attempts multiple iteration passes. A container object (such as a
- :class:`list`) produces a fresh new iterator each time you pass it to the
- :func:`iter` function or use it in a :keyword:`for` loop. Attempting this
- with an iterator will just return the same exhausted iterator object used
- in the previous iteration pass, making it appear like an empty container.
-
- More information can be found in :ref:`typeiter`.
-
- key function
- A key function or collation function is a callable that returns a value
- used for sorting or ordering. For example, :func:`locale.strxfrm` is
- used to produce a sort key that is aware of locale specific sort
- conventions.
-
- A number of tools in Python accept key functions to control how elements
- are ordered or grouped. They include :func:`min`, :func:`max`,
- :func:`sorted`, :meth:`list.sort`, :func:`heapq.nsmallest`,
- :func:`heapq.nlargest`, and :func:`itertools.groupby`.
-
- There are several ways to create a key function. For example. the
- :meth:`str.lower` method can serve as a key function for case insensitive
- sorts. Alternatively, an ad-hoc key function can be built from a
- :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. Also,
- the :mod:`operator` module provides three key function constructors:
- :func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
- :func:`~operator.methodcaller`. See the :ref:`Sorting HOW TO
- <sortinghowto>` for examples of how to create and use key functions.
-
- keyword argument
- Arguments which are preceded with a ``variable_name=`` in the call.
- The variable name designates the local name in the function to which the
- value is assigned. ``**`` is used to accept or pass a dictionary of
- keyword arguments. See :term:`argument`.
-
- lambda
- An anonymous inline function consisting of a single :term:`expression`
- which is evaluated when the function is called. The syntax to create
- a lambda function is ``lambda [arguments]: expression``
-
- list
- A built-in Python :term:`sequence`. Despite its name it is more akin
- to an array in other languages than to a linked list since access to
- elements are O(1).
-
- list comprehension
- A compact way to process all or part of the elements in a sequence and
- return a list with the results. ``result = ["0x%02x" % x for x in
- range(256) if x % 2 == 0]`` generates a list of strings containing
- even hex numbers (0x..) in the range from 0 to 255. The :keyword:`if`
- clause is optional. If omitted, all elements in ``range(256)`` are
- processed.
-
- method
- A function which is defined inside a class body. If called as an attribute
- of an instance of that class, the method will get the instance object as
- its first :term:`argument` (which is usually called ``self``).
- See :term:`function` and :term:`nested scope`.
-
- namespace
- The place where a variable is stored. Namespaces are implemented as
- dictionaries. There are the local, global and built-in namespaces as well
- as nested namespaces in objects (in methods). Namespaces support
- modularity by preventing naming conflicts. For instance, the functions
- :func:`__builtin__.open` and :func:`os.open` are distinguished by their
- namespaces. Namespaces also aid readability and maintainability by making
- it clear which module implements a function. For instance, writing
- :func:`random.seed` or :func:`itertools.izip` makes it clear that those
- functions are implemented by the :mod:`random` and :mod:`itertools`
- modules, respectively.
-
- nested scope
- The ability to refer to a variable in an enclosing definition. For
- instance, a function defined inside another function can refer to
- variables in the outer function. Note that nested scopes work only for
- reference and not for assignment which will always write to the innermost
- scope. In contrast, local variables both read and write in the innermost
- scope. Likewise, global variables read and write to the global namespace.
-
- new-style class
- Any class which inherits from :class:`object`. This includes all built-in
- types like :class:`list` and :class:`dict`. Only new-style classes can
- use Python's newer, versatile features like :attr:`__slots__`,
- descriptors, properties, and :meth:`__getattribute__`.
-
- object
- Any data with state (attributes or value) and defined behavior
- (methods). Also the ultimate base class of any :term:`new-style
- class`.
-
- positional argument
- The arguments assigned to local names inside a function or method,
- determined by the order in which they were given in the call. ``*`` is
- used to either accept multiple positional arguments (when in the
- definition), or pass several arguments as a list to a function. See
- :term:`argument`.
-
- Python 3000
- Nickname for the Python 3.x release line (coined long ago when the release
- of version 3 was something in the distant future.) This is also
- abbreviated "Py3k".
-
- Pythonic
- An idea or piece of code which closely follows the most common idioms
- of the Python language, rather than implementing code using concepts
- common to other languages. For example, a common idiom in Python is
- to loop over all elements of an iterable using a :keyword:`for`
- statement. Many other languages don't have this type of construct, so
- people unfamiliar with Python sometimes use a numerical counter instead::
-
- for i in range(len(food)):
- print food[i]
-
- As opposed to the cleaner, Pythonic method::
-
- for piece in food:
- print piece
-
- sequence
- An :term:`iterable` which supports efficient element access using integer
- indices via the :meth:`__getitem__` special method and defines a
- :meth:`len` method that returns the length of the sequence.
- Some built-in sequence types are :class:`list`, :class:`str`,
- :class:`tuple`, and :class:`unicode`. Note that :class:`dict` also
- supports :meth:`__getitem__` and :meth:`__len__`, but is considered a
- mapping rather than a sequence because the lookups use arbitrary
- :term:`immutable` keys rather than integers.
-
- slice
- An object usually containing a portion of a :term:`sequence`. A slice is
- created using the subscript notation, ``[]`` with colons between numbers
- when several are given, such as in ``variable_name[1:3:5]``. The bracket
- (subscript) notation uses :class:`slice` objects internally (or in older
- versions, :meth:`__getslice__` and :meth:`__setslice__`).
-
- statement
- A statement is part of a suite (a "block" of code). A statement is either
- an :term:`expression` or a one of several constructs with a keyword, such
- as :keyword:`if`, :keyword:`while` or :keyword:`for`.
-
- triple-quoted string
- A string which is bound by three instances of either a quotation mark
- (") or an apostrophe ('). While they don't provide any functionality
- not available with single-quoted strings, they are useful for a number
- of reasons. They allow you to include unescaped single and double
- quotes within a string and they can span multiple lines without the
- use of the continuation character, making them especially useful when
- writing docstrings.
-
- type
- The type of a Python object determines what kind of object it is; every
- object has a type. An object's type is accessible as its
- :attr:`__class__` attribute or can be retrieved with ``type(obj)``.
-
- plugin
- See :term:`plug-in`.
-
- plug-in
- a plug-in (or plugin) is a set of software components that adds
- specific abilities to a larger software application. If supported,
- plug-ins enable customizing the functionality of an application. For
- example, plug-ins are commonly used in web browsers to play video,
- scan for viruses, and display new file types.
-
- MCA
- Multichannel Analyzer (MCA) is a device for ...
-
- CCD
- A charge-coupled device (CCD) is a device for the movement of electrical
- charge, usually from within the device to an area where the charge can
- be manipulated, for example conversion into a digital value. This is
- achieved by "shifting" the signals between stages within the device one
- at a time. CCDs move charge between capacitive bins in the device, with
- the shift allowing for the transfer of charge between bins.
-
- API
- An application programming interface (API) is a particular set of rules
- and specifications that software programs can follow to communicate with
- each other. It serves as an interface between different software
- programs and facilitates their interaction, similar to the way the user
- interface facilitates interaction between humans and computers.
- An API can be created for applications, libraries, operating systems,
- etc., as a way of defining their "vocabularies" and resources request
- conventions (e.g. function-calling conventions). It may include
- specifications for routines, data structures, object classes, and
- protocols used to communicate between the consumer program and the
- implementer program of the API.
-
- CLI
- A command-line interface (CLI) is a mechanism for interacting with a
- computer operating system or software by typing commands to perform
- specific tasks. This text-only interface contrasts with the use of a
- mouse pointer with a graphical user interface (:term:`GUI`) to click on
- options, or menus on a text user interface (TUI) to select options.
- This method of instructing a computer to perform a given task is
- referred to as "entering" a command: the system waits for the user
- to conclude the submitting of the text command by pressing the "Enter"
- key (a descendant of the "carriage return" key of a typewriter keyboard).
- A command-line interpreter then receives, parses, and executes the
- requested user command. The command-line interpreter may be run in a
- text terminal or in a terminal emulator window as a remote shell client
- such as PuTTY. Upon completion, the command usually returns output to
- the user in the form of text lines on the CLI. This output may be an
- answer if the command was a question, or otherwise a summary of the
- operation.
-
- GUI
- A graphical user interface (GUI) is a type of user interface that
- allows users to interact with electronic devices with images rather
- than text commands. GUIs can be used in computers, hand-held devices
- such as MP3 players, portable media players or gaming devices,
- household appliances and office equipment. A GUI represents the
- information and actions available to a user through graphical icons and
- visual indicators such as secondary notation, as opposed to text-based
- interfaces (:term:`CLI`), typed command labels or text navigation.
- The actions are usually performed through direct manipulation of the
- graphical elements.
-
- SDS
- Sardana Device server (SDS) is the sardana tango device server
- :term:`daemon`.
-
- OS
- An operating system (OS) is software, consisting of programs and data,
- that runs on computers, manages computer hardware resources, and
- provides common services for execution of various application software.
- Operating system is the most important type of system software in a
- computer system. Without an operating system, a user cannot run an
- application program on their computer, unless the application program
- is self booting.
-
- daemon
- In Unix and other computer multitasking operating systems, a daemon is a
- computer program that runs in the background, rather than under the
- direct control of a user. They are usually initiated as background
- processes. Typically daemons have names that end with the letter "d": for
- example, *syslogd*, the daemon that handles the system log, or *sshd*,
- which handles incoming SSH connections.
-
- SCADA
- supervisory control and data acquisition (SCADA) generally refers to
- industrial control systems: computer systems that monitor and control
- industrial, infrastructure, or facility-based processes.
-
- client-server model
- The client-server model of computing is a distributed application
- structure that partitions tasks or workloads between the providers of a
- resource or service, called servers, and service requesters, called
- clients. Often clients and servers communicate over a computer network
- on separate hardware, but both client and server may reside in the same
- system. A server machine is a host that is running one or more server
- programs which share their resources with clients. A client does not
- share any of its resources, but requests a server's content or service
- function. Clients therefore initiate communication sessions with servers
- which await incoming requests.
-
- user position
- Moveable position in user units (See also :term:`dial position`).
- Dial and user units are related by the following expressions:
-
- user = sign x dial + offset
- dial = controller_position / steps_per_unit
-
- where *sign* is -1 or 1. *offset* can be any number and *steps_per_unit*
- must be non zero.
-
- user
- See :term:`user position`
-
- dial position
- Position in controller units (See also :term:`user position`).
-
- dial
- See :term:`dial position`
-
-.. _plug-in: http://en.wikipedia.org/wiki/Plug-in_(computing)
-.. _CCD: http://en.wikipedia.org/wiki/Charge-coupled_device
-.. _API: http://en.wikipedia.org/wiki/API
-.. _CLI: http://en.wikipedia.org/wiki/Command-line_interface
-.. _GUI: http://en.wikipedia.org/wiki/Graphical_user_interface
-.. _OS: http://en.wikipedia.org/wiki/Operating_system
-.. _daemon: http://en.wikipedia.org/wiki/Daemon_(computing)
-.. _SCADA: http://en.wikipedia.org/wiki/SCADA
-.. _client-server model: http://en.wikipedia.org/wiki/Client%E2%80%93server_model
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.scipy.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 07d0e351..3621b97a 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -1,56 +1,68 @@
-Sardana Home Page
-=================
+Welcome to Taurus's Home Page!
+=============================================
- |image1| |image2|
+ |image1| |image2| |image3|
-Sardana is a software suite for Supervision, Control and Data Acquisition
-in scientific installations. It aims to reduce cost and time of design,
-development and support of the control and data acquisition systems.
-Sardana development was started at the ALBA_ synchrotron and today is
-supported by a larger community which includes several other laboratories
-and individuals (ALBA_, DESY_, MaxIV_, Solaris_, ESRF_).
-You can download Sardana from PyPi_, check its Documentation_ or get support
-from its community and the latest code from the
-`project page <http://sourceforge.net/projects/sardana>`_.
+Taurus is a python framework for control and data acquisition CLIs and GUIs
+in scientific/industrial environments.
+It supports multiple control systems or data sources: Tango_, EPICS_, spec...
+New control system libraries can be integrated through plugins.
-Projects related to Sardana
+For non-programmers: Taurus allows the creation of fully-featured GUI (with
+forms, plots, synoptics, etc) from scratch in a few minutes using a "wizard",
+which can also be customized and expanded by drag-and-dropping elements
+around at execution time.
+
+For programmers: Taurus gives full control to more advanced users to create
+and customize CLIs and GUIs programmatically using Python and a very simple
+and economical API which abstracts data sources as "models".
+
+Of course, Taurus is Free Software (under LGPL). You can download it from PyPi_,
+access its Documentation_ or get support from its community and the latest code
+from the `project page <http://sourceforge.net/projects/sardana>`_.
+
+Projects related to Taurus
---------------------------
-- Sardana uses Taurus_ for control system access and user interfaces
-- Sardana is based on Tango_
-- The command line interface for Sardana (Spock) is based on IPython_
+- Taurus uses PyQt_ for the GUIs (Pyside_ support planned)
+- Tango_ is supported vis PyTango_
+- Taurus is part of the Sardana_ suite
-.. |image1| image:: _static/gallery/gallery01.png
+.. |image1| image:: _static/taurusform_example02.png
:align: middle
- :height: 380
+ :height: 180
-.. |image2| image:: _static/gallery/gallery02.png
+.. |image2| image:: _static/taurusplot03.png
:align: middle
- :height: 380
+ :height: 180
+
+.. |image3| image:: _static/taurus_tree01.png
+ :align: middle
+ :height: 180
.. toctree::
:hidden:
- Home Page <http://sardana-controls.org>
+ Home Page <http://taurus-scada.org>
Project Page <http://sourceforge.net/projects/sardana>
- Download from PyPI <http://pypi.python.org/pypi/sardana>
+ Download from PyPI <http://pypi.python.org/pypi/taurus>
docs
-.. _ALBA: http://www.albasynchrotron.es
-.. _DESY: http://www.desy.de
-.. _MaxIV: http://www.maxiv.se/
-.. _Solaris: http://www.synchrotron.uj.edu.pl/en_GB/
-.. _ESRF: http://esrf.eu
-.. _LGPL: http://www.gnu.org/licenses/lgpl.html
-.. _PyPi: http://pypi.python.org/pypi/sardana
-.. _Documentation: http://sardana.readthedocs.org
+:Last Update: |today|
+
+
.. _Tango: http://www.tango-controls.org/
-.. _Taurus: http://taurus-scada.org/
-.. _IPython: http://ipython.org/
+.. _PyTango: http://packages.python.org/PyTango/
+.. _EPICS: http://www.aps.anl.gov/epics/
+.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
+.. _Sardana: http://sardana-controls.org
+.. _PySide: http://pyside.org
+.. _LGPL: http://www.gnu.org/licenses/lgpl.html
+.. _PyPi: http://pypi.python.org/pypi/taurus
+.. _Documentation: http://taurus.readthedocs.org
-:Last Update: |today|
diff --git a/doc/source/revision.rst b/doc/source/revision.rst
deleted file mode 100644
index 90363c52..00000000
--- a/doc/source/revision.rst
+++ /dev/null
@@ -1,30 +0,0 @@
-.. _revision:
-
-Revision
-========
-
-:Contributers: T\. Coutinho
-
-:Last Update: |today|
-
-.. _history-modifications:
-
-History of modifications
-------------------------
-
-+----------+----------+----------------------------------------------------+-------------------------+
-| Date | Revision | Description | Author |
-+==========+==========+====================================================+=========================+
-| 17/06/11 | 1.0 | Initial Version | T\. Coutinho |
-+----------+----------+----------------------------------------------------+-------------------------+
-
-.. _version-history:
-
-Version history
----------------
-
-+------------+---------------------------------------------------------------------------------+
-| version | Changes |
-+============+=================================================================================+
-| 1.0 | First official release |
-+------------+---------------------------------------------------------------------------------+
diff --git a/doc/source/sphinxext/ipython_console_highlighting.py b/doc/source/sphinxext/ipython_console_highlighting.py
deleted file mode 100644
index 063468cd..00000000
--- a/doc/source/sphinxext/ipython_console_highlighting.py
+++ /dev/null
@@ -1,137 +0,0 @@
-################################################################################
-##
-## This file is part of PyTango, a python binding for Tango
-##
-## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## PyTango is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## PyTango is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with PyTango. If not, see <http://www.gnu.org/licenses/>.
-##
-################################################################################
-
-"""reST directive for syntax-highlighting ipython interactive sessions.
-
-XXX - See what improvements can be made based on the new (as of Sept 2009)
-'pycon' lexer for the python console. At the very least it will give better
-highlighted tracebacks.
-"""
-
-#-----------------------------------------------------------------------------
-# Needed modules
-
-# Standard library
-import re
-
-# Third party
-from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
- PythonTracebackLexer)
-from pygments.token import Comment, Generic
-
-from sphinx import highlighting
-
-#-----------------------------------------------------------------------------
-# Global constants
-line_re = re.compile('.*?\n')
-
-#-----------------------------------------------------------------------------
-# Code begins - classes and functions
-
-class IPythonConsoleLexer(Lexer):
- """
- For IPython console output or doctests, such as:
-
- .. sourcecode:: ipython
-
- In [1]: a = 'foo'
-
- In [2]: a
- Out[2]: 'foo'
-
- In [3]: print a
- foo
-
- In [4]: 1 / 0
-
- Notes:
-
- - Tracebacks are not currently supported.
-
- - It assumes the default IPython prompts, not customized ones.
- """
-
- name = 'IPython console session'
- aliases = ['ipython']
- mimetypes = ['text/x-ipython-console']
- input_prompt = re.compile("(In \[(?P<N>[0-9]+)\]: )|( \.\.\.+:)")
- output_prompt = re.compile("(Out\[(?P<N>[0-9]+)\]: )|( \.\.\.+:)")
- continue_prompt = re.compile(" \.\.\.+:")
- tb_start = re.compile("\-+")
-
- def get_tokens_unprocessed(self, text):
- pylexer = PythonLexer(**self.options)
- tblexer = PythonTracebackLexer(**self.options)
-
- curcode = ''
- insertions = []
- for match in line_re.finditer(text):
- line = match.group()
- input_prompt = self.input_prompt.match(line)
- continue_prompt = self.continue_prompt.match(line.rstrip())
- output_prompt = self.output_prompt.match(line)
- if line.startswith("#"):
- insertions.append((len(curcode),
- [(0, Comment, line)]))
- elif input_prompt is not None:
- insertions.append((len(curcode),
- [(0, Generic.Prompt, input_prompt.group())]))
- curcode += line[input_prompt.end():]
- elif continue_prompt is not None:
- insertions.append((len(curcode),
- [(0, Generic.Prompt, continue_prompt.group())]))
- curcode += line[continue_prompt.end():]
- elif output_prompt is not None:
- # Use the 'error' token for output. We should probably make
- # our own token, but error is typicaly in a bright color like
- # red, so it works fine for our output prompts.
- insertions.append((len(curcode),
- [(0, Generic.Error, output_prompt.group())]))
- curcode += line[output_prompt.end():]
- else:
- if curcode:
- for item in do_insertions(insertions,
- pylexer.get_tokens_unprocessed(curcode)):
- yield item
- curcode = ''
- insertions = []
- yield match.start(), Generic.Output, line
- if curcode:
- for item in do_insertions(insertions,
- pylexer.get_tokens_unprocessed(curcode)):
- yield item
-
-
-def setup(app):
- """Setup as a sphinx extension."""
-
- # This is only a lexer, so adding it below to pygments appears sufficient.
- # But if somebody knows that the right API usage should be to do that via
- # sphinx, by all means fix it here. At least having this setup.py
- # suppresses the sphinx warning we'd get without it.
- pass
-
-#-----------------------------------------------------------------------------
-# Register the extension as a valid pygments lexer
-highlighting.lexers['ipython'] = IPythonConsoleLexer() \ No newline at end of file
diff --git a/doc/source/sphinxext/sardanaextension.py b/doc/source/sphinxext/sardanaextension.py
deleted file mode 100644
index 43996a4a..00000000
--- a/doc/source/sphinxext/sardanaextension.py
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""helper methods for sardana sphinx documentation"""
-
-__expr = ('or',)
-
-def process_type(t, obj_type='class'):
- t = t.strip()
- if not t: return ''
- if t in __expr: return t
- if t.count(' or '):
- i = t.index(' or ')
- return ' '.join(map(process_type, (t[:i],'or', t[i+4:])))
- if not t.count('<') or not t.count('>'): return ':%s:`%s`' % (obj_type, t)
-
- #process a container template
- start, stop = t.index('<'), t.index('>')
- main_type = t[:start]
- main_type = process_type(main_type)
- types = t[start+1:stop].split(',')
- types = ', '.join(map(process_type, types))
- return "%s <%s>" % (main_type, types)
-
-def process_param(line):
- new_lines = []
- try:
- prefix, param, desc = line.split(':', 2)
- p, param_name = param.split()
- desc = desc.strip()
- if desc[0] == '(' :
- pos = desc.find(')')
- if pos != -1:
- elem_type = desc[1:pos]
- klass = process_type(elem_type)
- desc = desc[pos+1:]
- new_lines.append('%s:type %s: %s' % (prefix, param_name, klass))
- new_lines.append('%s:param %s: %s' % (prefix, param_name, desc))
- except Exception, e:
- print "Sardana sphinx extension: Not able to process param: '%s'" % line
- print " Reason:",str(e)
- new_lines.append(line)
- return new_lines
-
-def process_return(line):
- new_lines = []
- try:
- prefix, param, desc = line.split(':', 2)
- desc = desc.strip()
- if desc[0] == '(' :
- pos = desc.find(')')
- if pos != -1:
- elem_type = desc[1:pos]
- klass = process_type(elem_type)
- desc = desc[pos+1:]
- new_lines.append('%s:rtype: %s' % (prefix, klass))
- new_lines.append('%s:return: %s' % (prefix, desc))
- except Exception, e:
- print "Sardana sphinx extension: Not able to process 'return': '%s'" % line
- print " Reason:",str(e)
- new_lines.append(line)
- return new_lines
-
-def process_raise(line):
- new_lines = []
- try:
- prefix, param, desc = line.split(':', 2)
- desc = desc.strip()
- klass = ''
- if desc[0] == '(' :
- pos = desc.find(')')
- if pos != -1:
- elem_type = desc[1:pos]
- klass = "(" + process_type(elem_type, obj_type='exc') + ")"
- desc = desc[pos+1:]
- new_lines.append('%s:raise: %s %s' % (prefix, klass, desc))
- except Exception, e:
- print "Sardana sphinx extension: Not able to process 'raise': '%s'" % line
- print " Reason:", str(e)
- new_lines.append(line)
- return new_lines
-
-def _is_return(line):
- ret = line.startswith(':return')
- ret |= line.startswith(':returns')
- return ret
-
-def _is_param(line):
- ret = line.startswith(':param')
- ret |= line.startswith(':parameter')
- ret |= line.startswith(':arg')
- ret |= line.startswith(':argument')
- ret |= line.startswith(':key')
- ret |= line.startswith(':keyword')
- return ret
-
-def _is_raise(line):
- ret = line.startswith(':raise')
- ret |= line.startswith(':except')
- return ret
-
-def process_docstring(app, what, name, obj, options, lines):
- ret = []
- for nb, line in enumerate(lines):
- line_strip = line.strip()
- if _is_param(line_strip):
- ret.extend(process_param(line))
- elif _is_return(line_strip):
- ret.extend(process_return(line))
- elif _is_raise(line_strip):
- ret.extend(process_raise(line))
- else:
- ret.append(line)
-
- del lines[:]
- lines.extend(ret)
-
-import inspect
-from sphinx.util.inspect import getargspec
-
-def _format_method_args(obj):
- if inspect.isbuiltin(obj) or \
- inspect.ismethoddescriptor(obj):
- # can never get arguments of a C function or method
- return None
- argspec = getargspec(obj)
- if argspec[0] and argspec[0][0] in ('cls', 'self'):
- del argspec[0][0]
- return inspect.formatargspec(*argspec)
-
-def _format_function_args(obj):
- if inspect.isbuiltin(obj) or \
- inspect.ismethoddescriptor(obj):
- # cannot introspect arguments of a C function or method
- return None
- try:
- argspec = getargspec(obj)
- except TypeError:
- # if a class should be documented as function (yay duck
- # typing) we try to use the constructor signature as function
- # signature without the first argument.
- try:
- argspec = getargspec(obj.__new__)
- except TypeError:
- argspec = getargspec(obj.__init__)
- if argspec[0]:
- del argspec[0][0]
- args = inspect.formatargspec(*argspec)
- # escape backslashes for reST
- args = args.replace('\\', '\\\\')
- return args
-
-def process_signature(app, what, name, obj, options, signature, return_annotation):
- if hasattr(obj, "__wrapped__"):
- if what == "method":
- from taurus.core.util.wrap import wrapped
- obj = wrapped(obj)
- signature = _format_method_args(obj)
- return signature, return_annotation
-
-
-def setup(app):
- #app.connect('autodoc-process-docstring', process_docstring)
- app.connect('autodoc-process-signature', process_signature)
diff --git a/doc/source/sphinxext/spock_console_highlighting.py b/doc/source/sphinxext/spock_console_highlighting.py
deleted file mode 100644
index 86716a7f..00000000
--- a/doc/source/sphinxext/spock_console_highlighting.py
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""reST directive for syntax-highlighting spock interactive sessions.
-"""
-
-#-----------------------------------------------------------------------------
-# Needed modules
-
-# Standard library
-import re
-import copy
-
-# Third party
-from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
- PythonTracebackLexer)
-from pygments.token import Token, Comment, Generic
-from pygments.style import Style
-import pygments.styles
-from sphinx import highlighting
-
-#-----------------------------------------------------------------------------
-# Global constants
-line_re = re.compile('.*?\n')
-
-DftStyle = pygments.styles.get_style_by_name("default")
-
-class SpockStyle(DftStyle):
-
- styles = copy.copy(DftStyle.styles)
- styles[Generic.Prompt] = 'bold #00AA00'
-
-class SpockConsoleLexer(Lexer):
- """
- For spock console output or doctests, such as:
-
- .. sourcecode:: spock
-
- LAB-01 [1]: a = 'foo'
-
- LAB-01 [2]: a
- Result [2]: 'foo'
-
- LAB-01 [3]: print a
- foo
-
- LAB-01 [4]: 1 / 0
-
- Notes:
-
- - Tracebacks are not currently supported.
-
- - It assumes the default spock prompts, not customized ones.
- """
-
- name = 'Spock console session'
- aliases = ['spock']
- mimetypes = ['text/x-spock-console']
- input_prompt = re.compile("([a-zA-Z0-9_\-]+ \[(?P<N>[0-9]+)\]: )|( \.\.\.+:)")
- output_prompt = re.compile("(\s*Result \[(?P<N>[0-9]+)\]: )|( \.\.\.+:)")
- continue_prompt = re.compile(" \.\.\.+:")
- tb_start = re.compile("\-+")
-
- def get_tokens_unprocessed(self, text):
- pylexer = PythonLexer(**self.options)
- tblexer = PythonTracebackLexer(**self.options)
-
- curcode = ''
- insertions = []
- for match in line_re.finditer(text):
- line = match.group()
- input_prompt = self.input_prompt.match(line)
- continue_prompt = self.continue_prompt.match(line.rstrip())
- output_prompt = self.output_prompt.match(line)
- if line.startswith("#"):
- insertions.append((len(curcode),
- [(0, Comment, line)]))
- elif line.startswith("<warning>"):
- insertions.append((len(curcode),
- [(0, Generic.Error, line[9:])]))
- elif input_prompt is not None:
- insertions.append((len(curcode),
- [(0, Generic.Prompt, input_prompt.group())]))
- curcode += line[input_prompt.end():]
- elif continue_prompt is not None:
- insertions.append((len(curcode),
- [(0, Generic.Prompt, continue_prompt.group())]))
- curcode += line[continue_prompt.end():]
- elif output_prompt is not None:
- # Use the 'error' token for output. We should probably make
- # our own token, but error is typicaly in a bright color like
- # red, so it works fine for our output prompts.
- insertions.append((len(curcode),
- [(0, Generic.Error, output_prompt.group())]))
- curcode += line[output_prompt.end():]
- else:
- if curcode:
- for item in do_insertions(insertions,
- pylexer.get_tokens_unprocessed(curcode)):
- yield item
- curcode = ''
- insertions = []
- yield match.start(), Generic.Output, line
- if curcode:
- for item in do_insertions(insertions,
- pylexer.get_tokens_unprocessed(curcode)):
- yield item
-
-
-def setup(app):
- """Setup as a sphinx extension."""
-
- # This is only a lexer, so adding it below to pygments appears sufficient.
- # But if somebody knows that the right API usage should be to do that via
- # sphinx, by all means fix it here. At least having this setup.py
- # suppresses the sphinx warning we'd get without it.
- pass
-
-#-----------------------------------------------------------------------------
-# Register the extension as a valid pygments lexer
-highlighting.lexers['spock'] = SpockConsoleLexer()
diff --git a/taurus/doc/source/sphinxext/taurusextension.py b/doc/source/sphinxext/taurusextension.py
index 4fe97aa7..4fe97aa7 100644
--- a/taurus/doc/source/sphinxext/taurusextension.py
+++ b/doc/source/sphinxext/taurusextension.py
diff --git a/doc/source/todo.rst b/doc/source/todo.rst
deleted file mode 100644
index e18ba455..00000000
--- a/doc/source/todo.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-
-==========================
-Documentation to be done
-==========================
-
-.. todolist:: \ No newline at end of file
diff --git a/doc/source/users/faq.rst b/doc/source/users/faq.rst
deleted file mode 100644
index ac8c1ee7..00000000
--- a/doc/source/users/faq.rst
+++ /dev/null
@@ -1,193 +0,0 @@
-
-.. _sardana-faq:
-
-
-.. todo:: The FAQ is work-in-progress. Many answers need polishing and mostly
- links need to be added
-
-
-===
-FAQ
-===
-
-What is the Sardana SCADA_ and how do I get an overview over the different components?
----------------------------------------------------------------------------------------
-An overview over the different Sardana components is shown in the following figure:
-
-.. image:: /_static/sardana_sketch.png
- :align: center
- :width: 500
-
-The basic Sardana SCADA_ philosophy can be found :ref:`here <sardana-overview>`.
-
-How do I install Sardana?
--------------------------
-The Sardana SCADA_ system consists of different components which have to be
-installed:
-
- * Tango_: The control system middleware and tools
- * PyTango_: The Python_ language binding for Tango_
- * Taurus_: The GUI toolkit which is part of Sardana SCADA_
- * The Sardana device pool, macro server and tools
-
-The complete sardana installation instructions can be found
-:ref:`here <sardana-getting-started>`.
-
-How to work with Taurus_ :term:`GUI`?
--------------------------------------
-A user documentation for the Taurus_ :term:`GUI` application can be found
-`here <http://packages.python.org/taurus/>`__.
-
-How to produce your own Taurus_ :term:`GUI` panel?
---------------------------------------------------
-
-The basic philosophy of Taurus_ :term:`GUI` is to provide automatic
-:term:`GUI` s which are automatically replaced by more and more specific
-:term:`GUI` s if these are found.
-
-Refer to the `user documentation on TaurusGUI <http://www.tango-
-controls.org/static/taurus/latest/doc/html/users/ui/taurusgui.html>`_ for more
-details on how to work with panels
-
-How to call procedures?
------------------------
-The central idea of the Sardana SCADA_ system is to execute procedures centrally.
-The execution can be started from either:
-
- * *spock* offers a command line interface with commands very similar to SPEC_.
- It is documented :ref:`here <sardana-spock>`.
- * Procedures can also be executed with from a :term:`GUI`. Taurus provides
- `generic widgets for macro execution <http://www.tango-
- controls.org/static/taurus/latest/doc/html/users/ui/macros/>`__.
- * Procedures can also be executed in specific :term:`GUI` s and specific Taurus_
- widgets. The :term:`API` to execute macros from python code is documented
- here **<LINK>**.
-
-How to write procedures?
-------------------------
-User written procedures are central to the Sardana SCADA_ system.
-Documentation how to write macros can be found :ref:`here <sardana-macros-howto>`.
-Macro writers might also find the following documentation interesting:
-
- * Documentation on how to debug macros can be found here **<LINK>**
- * In addition of the strength of the python language macro writers can
- interface with common elements (motors, counters) , call other macros
- and use many utilities provided. The macro :term:`API` can be found
- :ref:`here <sardana-macro-api>`.
- * Documentation how to document your macros can be found
- :ref:`here <sardana-macros-howto>`
-
-How to write scan procedures?
------------------------------
-A very common type of procedure is the *scan* where some quantity is
-varied while recording some other quantities. See the documentation on the
-:ref:`Sardana Scan API <sardana-macros-scanframework>`
-
-How to adapt SARDANA to your own hardware?
-------------------------------------------
-Sardana is meant to be interfaced to all types of different hardware with all
-types of control systems. For every new hardware item the specific behavior
-has to be programmed by writing a controller code. The documentation how to
-write Sardana controllers and pseudo controllers can be found
-:ref:`here <sardana-controller-howto>`.
-This documentation also includes the :term:`API` which can be used to interface
-to the specific hardware item.
-
-How to add your own file format?
---------------------------------
-Documentation how to add your own file format can be found here **<LINK>**.
-
-How to use the standard macros?
--------------------------------
-The list of all standard macros and their usage can be found here **<LINK>**.
-
-How to add conditions in macros?
---------------------------------
-Executing macros and moving elements can be subject to external conditions
-(for example an interlock). New types of software interlocks can be easily
-added to the system and are documented here **<LINK>**.
-
-How to write your own Taurus application?
------------------------------------------
-You have basically two possibilities to write your own Taurus_ application
-Start from get General TaurusGUI and create a configuration file. This approach
-is documented here **<LINK>**.
-Start to write your own Qt application in python starting from the Taurus_ main
-window. This approach is documented here **<LINK>**.
-
-Which are the standard Taurus graphical GUI components?
--------------------------------------------------------
-A list of all standard Taurus GUI components together with screen shots
-and example code can be found here **<LINK>**
-
-How to write your own Taurus widget?
-------------------------------------
-A tutorial of how to write your own Taurus widget can be found
-:ref:`here <sardana-screenshots>`.
-
-How to work with the graphical GUI editor?
-------------------------------------------
-Taurus_ uses the QtDesigner/QtCreator as a graphical editor. Documentation
-about `QtDesigner/QtCreator <http://qt.nokia.com/products/developer-tools/>`_.
-The Taurus_ specific parts :ref:`here <taurusqtdesigner-tutorial>`.
-
-What are the minimum software requirements for sardana?
--------------------------------------------------------
-Sardana is developed under GNU/Linux, but should run also on Windows and OS-X.
-The dependencies for installing Sardana can be found here **<LINK>**.
-
-How to configure the system?
-----------------------------
-Adding and configuring hardware items on an installation is described
-here **<LINK>**.
-
-How to write your own Taurus schema?
-------------------------------------
-Taurus is not dependent on Tango. Other control systems or just python modules
-can be interfaced to it by writing a schema. This approach is documented
-here **<LINK>** and a tutorial can be found here **<LINK>**
-
-What are the interfaces to the macro server and the pool?
----------------------------------------------------------
-The low level interfaces to the Sardana Device Pool and the Macro server can
-be found here **<LINK>**.
-
-What are the data file formats used in the system and how can I read them?
---------------------------------------------------------------------------
-It is easily possible to add your own file format but the standard file formats are documented here:
-
- * The SPEC_ file format is documented here **<LINK>** and here is a list
- of tools to read it **<LINK>**
- * The EDF file format is documented here **<LINK>** and here is a list
- of tools to read it **<LINK>**
- * The NEXUS file format is documented here **<LINK>** and here is a list
- of tools to read it **<LINK>**
-
-What is the file format of the configuration files?
----------------------------------------------------
-The configuration files for the Taurus_ GUI are defined here **<LINK>**.
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-.. _SCADA: http://en.wikipedia.org/wiki/SCADA
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/taurus/doc/source/users/getting_started.rst b/doc/source/users/getting_started.rst
index ca155925..ca155925 100644
--- a/taurus/doc/source/users/getting_started.rst
+++ b/doc/source/users/getting_started.rst
diff --git a/doc/source/users/getting_started/index.rst b/doc/source/users/getting_started/index.rst
deleted file mode 100644
index 0d839d13..00000000
--- a/doc/source/users/getting_started/index.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-
-.. _sardana-getting-started:
-
-===============
-Getting started
-===============
-
-The next chapters describe the necessary steps to get started with sardana,
-from installation to having a running system on your machine.
-
-.. toctree::
- :maxdepth: 1
-
- Obtaining and installing <installing>
- Running the server <running_server>
- Running the client <running_cli>
-
diff --git a/doc/source/users/getting_started/installing.rst b/doc/source/users/getting_started/installing.rst
deleted file mode 100644
index a903cafb..00000000
--- a/doc/source/users/getting_started/installing.rst
+++ /dev/null
@@ -1,113 +0,0 @@
-
-.. _sardana-installing:
-
-==========
-Installing
-==========
-
-#. Install sardana:
- #. From easy_install [1]_ ::
-
- easy_install -U sardana
-
- #. From source code:
-
- #. Download the sardana source code:
- #. from latest stable version of `sardana <http://pypi.python.org/pypi/sardana>`_ (|version|)
- #. from `SVN snapshot <https://sourceforge.net/p/sardana/code/HEAD/tarball?path=/trunk>`_
-
- #. Extract the downloaded tar.gz into a temporary directory
-
- #. type [2]_ ::
-
- python setup.py build
- python setup.py install
-
-#. test the installation::
-
- python -c "import sardana; print sardana.Release.version"
-
-You can also work from SVN trunk checkout
-(please look :ref:`here <sardana-working-from-svn>` for instructions).
-
-
-Windows installation shortcut
------------------------------
-
-This chapter provides a quick shortcut to all windows packages which are
-necessary to run sardana on your windows machine
-
-#. Install all dependencies:
-
- #. from `Python(x,y)`_ (by far the easiest choise)
- #. Download and install a python 2.6/2.7 compatible version of python(x,y)
- from `here <http://code.google.com/p/pythonxy>`_
-
- #. from scratch:
- #. Download and install `PyQwt`_ < 6.0 from `PyQwt downdoad page <http://pyqwt.sourceforge.net/download.html>`_
- #. Download and install compatible python from link in the same `PyQwt`_ page
- #. Download and install compatible `numpy`_ from link in the same `PyQwt`_ page.
- #. Download and install compatible `PyQt`_ from link in the same `PyQwt`_ page.
-
-#. Download and install latest `PyTango`_ from `PyTango downdoad page <http://pypi.python.org/pypi/PyTango>`_
-#. Download and install latest `taurus`_ from `Taurus downdoad page <http://pypi.python.org/pypi/taurus>`_
-#. Finally download and install latest sardana from `Sardana downdoad page <http://pypi.python.org/pypi/sardana>`_
-
-.. _sardana-working-from-svn:
-
-Working directly from Git
--------------------------
-
-Sometimes it is convenient to work directly from the git source without installing. To do so,
-you can clone sardana from our main git repository::
-
- git clone git://git.code.sf.net/p/sardana/sardana.git sardana
-
-And then you can directly execute sardana binaries (Pool, MacroServer, Sardana or spock
-from the command line)::
-
- homer@pc001:~/workspace$ cd sardana
- homer@pc001:~/workspace/sardana$ scripts/Sardana
-
-.. tip:: If you plan to work normally from git without installing, you may want
- to add the `sardana/scripts` directory to your `PATH` variable and
- `sardana/src` to your `PYTHONPATH` variable.
-
-
-.. rubric:: Footnotes
-
-.. [1] This command requires super user previledges on linux systems. If your
- user has them you can usually prefix the command with *sudo*:
- ``sudo easy_install -U sardana``. Alternatively, if you don't have
- administrator previledges, you can install locally in your user
- directory with: ``easy_install --user sardana``
- In this case the executables are located at <HOME_DIR>/.local/bin. Make
- sure the PATH is pointing there or you execute from there.
-
-.. [2] *setup.py install* requires user previledges on linux systems. If your
- user has them you can usually prefix the command with *sudo*:
- ``sudo python setup.py install``. Alternatively, if you don't have
- administrator previledges, you can install locally in your user directory
- with: ``python setup.py install --user``
- In this case the executables are located at <HOME_DIR>/.local/bin. Make
- sure the PATH is pointing there or you execute from there.
-
-.. _numpy: http://numpy.scipy.org/
-.. _PLY: http://www.dabeaz.com/ply/
-.. _Python(x,y): http://code.google.com/p/pythonxy/
-.. _Python: http://www.python.org/
-
-.. _SardanaPypi: http://pypi.python.org/pypi/sardana/
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _taurus: http://packages.python.org/taurus/
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _ESRF: http://www.esrf.eu/
-
diff --git a/doc/source/users/getting_started/running_cli.rst b/doc/source/users/getting_started/running_cli.rst
deleted file mode 100644
index d21e2f7a..00000000
--- a/doc/source/users/getting_started/running_cli.rst
+++ /dev/null
@@ -1,101 +0,0 @@
-.. _sardana-getting-started-running-cli:
-
-Running the client
-----------------------------
-
-After the server has been started, you can start one or more client applications
-(:term:`CLI`\s and/or :term:`GUI`\s) that connect to the server. Each client
-connects to a specific *door* on the server. A single sardana can be configured
-with many *doors* allowing multiple clients to be connected at the same time.
-
-When the sardana server was first executed, part of the registration process
-created one *door* for you so now you just have to start the client application
-from the command line::
-
- homer@pc001:~$ spock
-
-Spock is an `IPython`_ based :term:`CLI`. When you start spock without arguments
-it will assume a default profile called *spockdoor*. The first time spock is
-executed, it will inform you that profile *spockdoor* doesn't exist and it will
-offer to create one. Just answer 'y'. After, it will ask you to which *door*
-should the default *spockdoor* profile connect to. Select the door name
-corresponding to your sardana server (*Door_lab-01_1*) and press return. By now
-you should get an output like this::
-
- homer@pc001:~$ spock
- Profile 'spockdoor' does not exist. Do you want to create one now ([y]/n)? y
- Available Door devices from sardanamachine:10000 :
- Door_lab-01_1 (a.k.a. Door/lab-01/1)
- Door name from the list? Door_lab-01_1
-
- Storing ipython_config.py in /home/homer/.config/ipython/profile_spockdoor... [DONE]
- Spock 1.0.0 -- An interactive laboratory application.
-
- help -> Spock's help system.
- object? -> Details about 'object'. ?object also works, ?? prints more.
-
- IPython profile: spockdoor
-
- Connected to Door_lab-01_1
-
- Door_lab-01_1 [1]:
-
-That's it! You now have a running sardana client. Still not impressed, I see!
-The next chapter describes how to start adding new elements to your sardana
-environment.
-
-Populating your sardana with items
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-One of sardana's goals is to allow you to execute *procedures* (what we call in
-sardana *macros*, hence from here on we will use the term *macro*). A *macro*
-is basically a piece of code. You can write macros using the `Python`_ language
-to do all sorts of things. The sky is the limit here!
-
-Sardana comes with a :ref:`catalog of macros<sardana-standard-macro-catalog>` that help
-users in a laboratory to run their experiments. Most of these *macros*
-involve interaction with sardana elements like motors and experimental channels.
-Therefore, the first step in a new sardana demo is to populate your system with
-some elements. Fortunately, sardana comes with a *macro* called *sar_demo* that
-does just that. To execute this *macro* just type on the command line
-:class:`~sardana.macroserver.macros.demo.sar_demo`.
-You should get an output like this:
-
-.. sourcecode:: spock
-
- Door_lab-01_1 [1]: sar_demo
-
- Creating controllers motctrl01, ctctrl01... [DONE]
- Creating motors mot01, mot02, mot03, mot04... [DONE]
- Creating measurement group mntgrp01... [DONE]
-
-You should now have in your sardana system a set of simulated motors and
-counters with which you can play.
-
-.. hint::
-
- for clearing sardana from the elements created by the demo, execute
- :class:`~sardana.macroserver.macros.demo.clear_sar_demo`
-
-The next chapter (:ref:`spock <sardana-spock>`) will give you a complete overview
-of spock's interface.
-
-
-.. _numpy: http://numpy.scipy.org/
-.. _PLY: http://www.dabeaz.com/ply/
-.. _Python(x,y): http://code.google.com/p/pythonxy/
-.. _Python: http://www.python.org/
-
-.. _SardanaPypi: http://pypi.python.org/pypi/sardana/
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _taurus: http://packages.python.org/taurus/
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _ESRF: http://www.esrf.eu/
diff --git a/doc/source/users/getting_started/running_server.rst b/doc/source/users/getting_started/running_server.rst
deleted file mode 100644
index e1b4ffcd..00000000
--- a/doc/source/users/getting_started/running_server.rst
+++ /dev/null
@@ -1,111 +0,0 @@
-.. _sardana-getting-started-running-server:
-
-Running Sardana as a tango server
----------------------------------
-
-.. note::
-
- if you have Tango <= 7.2.6 without all patches applied, Sardana server
- will not work due to a known bug. Please follow the instructions from
- :ref:`sardana-getting-started-running-servers-separately` instead.
-
-Sardana is based on a client-server architecture. On the server part, sardana
-can be setup with many different configurations. Advanced details on sardana
-server configuration can be found here **<LINK>**.
-
-This chapter describes how to run sardana server with it's simplest
-configuration. The only decision you have to make is which name you will give
-to your system. From here on *lab-01* will be used as the system name. Please
-replace this name with your own system name whenever apropriate.
-
-The sardana server is called (guess what) *Sardana*. To start the server just
-type in the command line::
-
- homer@pc001:~$ Sardana lab-01
-
-The first time the server is executed, it will inform you that server *lab-01*
-is not registered and it will offer to register it. Just answer 'y'. This will
-register a new instance of Sardana called *lab-01* and the server will be
-started. You should get an output like this::
-
- homer@pc001:~$ Sardana lab-01
- lab-01 does not exist. Do you wish create a new one (Y/n) ? y
- DServer/Sardana/Lab-01 has no event channel defined in the database - creating it
-
-That't it! You now have a running sardana server. Not very impressive, is it?
-The :ref:`sardana-getting-started-running-cli` chapter describes how to start up a
-:term:`CLI` application called *spock* which connects to the sardana server you
-have just started through an object of type *Door* called *Door_lab-01_1*.
-
-You can therefore skip the next chapter and go directly to
-:ref:`sardana-getting-started-running-cli`.
-
-.. _sardana-getting-started-running-servers-separately:
-
-Running Pool and MacroServer tango servers separately
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. note::
-
- You should only read this chapter if you have Tango <= 7.2.6
- without all patches applied. If you do, please follow in instructions from
- :ref:`sardana-getting-started-running-server` instead.
-
-It is possible to separate sardana server into two different servers (in the
-first sardana versions, this was actually the only way start the sardana
-system). These servers are called *Pool* and *MacroServer*. The *Pool* server
-takes care of hardware communication and *MacroServer* executes procedures
-(macros) using a connection to Pool(s) server(s).
-
-To start the Pool server just type in the command line::
-
- homer@pc001:~$ Pool lab-01
-
-The first time the server is executed, it will inform you that server *lab-01*
-is not registered and it will offer to register it. Just answer 'y'. This will
-register a new instance of Pool called *lab-01* and the server will be
-started. You should get an output like this::
-
- homer@pc001:~$ Pool lab-01
- lab-01 does not exist. Do you wish create a new one (Y/n) ? y
- DServer/Pool/Lab-01 has no event channel defined in the database - creating it
-
-Next, start the MacroServer server in the command line::
-
- homer@pc001:~$ MacroServer lab-01
-
-The first time the server is executed, it will inform you that server *lab-01*
-is not registered and it will offer to register it. Just answer 'y'. Next, it
-will ask you to which Pool(s) you want your MacroServer to communicate with.
-Select the previously created Pool from the list, press :kbd:`Return` once and
-:kbd:`Return` again to finish with Pool selection. This will register a new
-instance of MacroServer called *lab-01* and the server will be started.
-You should get an output like this::
-
- homer@pc001:~$ MacroServer lab-01
- lab-01 does not exist. Do you wish create a new one (Y/n) ?
- Pool_lab-01_1 (a.k.a. Pool/lab-01/1) (running)
- Please select pool to connect to (return to finish): Pool_lab-01_1
- Please select pool to connect to (return to finish):
- DServer/MacroServer/lab-01 has no event channel defined in the database - creating it
-
-
-.. _numpy: http://numpy.scipy.org/
-.. _PLY: http://www.dabeaz.com/ply/
-.. _Python(x,y): http://code.google.com/p/pythonxy/
-.. _Python: http://www.python.org/
-
-.. _SardanaPypi: http://pypi.python.org/pypi/sardana/
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _taurus: http://packages.python.org/taurus/
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _ESRF: http://www.esrf.eu/
-
diff --git a/doc/source/users/index.rst b/doc/source/users/index.rst
index a137e8a0..ada2cee2 100644
--- a/doc/source/users/index.rst
+++ b/doc/source/users/index.rst
@@ -1,17 +1,14 @@
-.. _sardana-users-guide-index:
+.. _users-guide-index:
============
User's Guide
============
.. toctree::
- :maxdepth: 2
+ :maxdepth: 3
- Overview <overview>
- Getting started <getting_started/index>
- Spock <spock>
- Scans <scan>
- Standard macro catalog <standard_macro_catalog>
+ Introduction <introduction>
+ Getting started <getting_started>
+ User's Interface <ui/index>
Screenshots <screenshots>
- FAQ <faq>
-
+
diff --git a/taurus/doc/source/users/introduction.rst b/doc/source/users/introduction.rst
index ea2c1132..ea2c1132 100644
--- a/taurus/doc/source/users/introduction.rst
+++ b/doc/source/users/introduction.rst
diff --git a/doc/source/users/overview.rst b/doc/source/users/overview.rst
deleted file mode 100644
index 7f31ed76..00000000
--- a/doc/source/users/overview.rst
+++ /dev/null
@@ -1,243 +0,0 @@
-.. _sardana-overview:
-
-========
-Overview
-========
-
-Sardana is the control program initially developed at ALBA_. Our mission
-statement:
-
- `Produce a modular, high performance, robust, and generic user environment for control applications in large and small installations. Make Sardana the generic user environment distributed in the Tango project and the standard basis of collaborations in control.`
-
-Up to now, control applications in large installations have been notoriously
-difficult to share. Inspired by the success of the Tango_ collaboration, ALBA_
-decided to start the creation of a generic tool to enlarge the scope of the
-Tango_ project to include a standard client program - or better a standard
-generic user environment. From the beginning our aim has been to involve others
-in this process. At this moment in time the user environment consists of a
-highly configurable standard graphical user interface, a standard command line
-interface understanding SPEC_ commands, and a standard way to compose new
-applications either by programming or with a graphical tool. It further
-consists of a standard macro executer, standard set of macros, a standard range
-of common hardware types (like motors, counters, cameras and so on) and a
-configuration editor to set all this up. The origin of the Sardana name comes
-from a Catalan dance to honor the region where the ALBA_ synchrotron is build.
-The toolkit to build Sardana has been C++, Python_, Qt_ and Tango_. If you like
-the tools you will love Sardana.
-
-What do we "sell" to our users
-==============================
-
-Let’s start our excursion into the Sardana world by a word of caution. We will
-talk a lot about technical possibilities and implementation details. Our users
-will judge us on the ease of use of the final GUI, its robustness and the
-features it offers. There are millions of ways to arrive at this end result.
-Our claim is however that by doing it the *Sardana way* and developing the
-application out of *lego* components in a collaborative environment we will
-arrive at higher quality software with much higher efficiency.
-
-The following screen shot of an early prototype of a specific beamline
-application should serve as a reminder of this final goal.
-
-.. image:: /_static/snapshot01.png
- :align: center
- :width: 500
-
-Inside this application we have many features common to other beamline control
-applications or w some accelerator applications. The following screen shot
-shows such a standard application which has been done without programming -
-just by configuring the application. This illustrates one of the design
-guidelines in Sardana: Always provide a generic interface which can be
-specialized for an application.
-
-.. image:: /_static/snapshot02.png
- :align: center
- :width: 500
-
-Starting a procedure
-====================
-
-At the heart of the Sardana system are standard reusable procedures. From past
-experiences, the importance of standard procedures has been realized and has
-influenced most of the major design decisions. To illustrate this point, please
-let me walk you through different ways how to start such a procedure without
-going into too many details. You might want to think of a *scan* as an example.
-One way of starting a procedure is with a command line interface. Users
-familiar with SPEC_ will immediately recognize this way. In effect, inside
-Sardana most of the standard SPEC_ commands (including many diffractometer
-geometries thanks to Frédéric Picca from the SOLEIL_ synchrotron) are provided
-as standard procedures and can be invoked in the same way.
-
-.. image:: /_static/snapshot03.png
- :align: center
- :width: 500
-
-Every procedure can also be started from a GUI. This does not need any
-programming or configuration from the user of the system. When a new procedure
-is created, it is automatically visible inside the GUI and command line tools.
-
-.. image:: /_static/snapshot04.png
- :align: center
- :width: 500
-
-This GUI interface will mainly be used for procedures which are rarely used and
-where a specialized interface has not yet been developed. An example of how to
-use the same procedure in order to carry out energy spread and emittance
-measurements is presented in the following picture.
-
-.. image:: /_static/snapshot05.png
- :align: center
- :width: 500
-
-The standard Qt_ designer can be used to create new graphical elements (widgets)
-and connect them to the system for even greater flexibility. The following
-screen shot shows the standard qt designer with some fancy widgets developed in
-house.
-
-.. image:: /_static/snapshot06.png
- :align: center
- :width: 500
-
-Taurus as a toolkit for applications
-====================================
-
-The GUI toolkit for Sardana is called Taurus_. The graphical user interfaces in
-this paper have been created with this toolkit. It can be used in conjunction
-or independent from the rest of the system. It can be used to create custom
-panels inside the generic GUI or to create stand alone applications. Again,
-this approach of *take what you need* has been implemented to foster the widest
-range of collaborations. Almost all applications in the ALBA_ machine control
-system have been created with this toolkit. Creating the applications out of
-standard components has been proven to be extremely powerful. In the
-:ref:`sardana-screenshots-guis` chapter you can see some of the graphical user
-interfaces used.
-
-Configure – don’t program
-=========================
-
-The Sardana system comes with a configuration editor to allow non-experts to add
-and configure components. The editor adapts dynamically to the hardware
-controllers present. New hardware controller can be easily written and
-integrated into the system without restarting it.
-
-.. image:: /_static/snapshot07.png
- :align: center
- :width: 500
-
-This configuration editor is currently being rewritten to be more wizard based
-and provide better guidance for the end user.
-
-How to write your own procedure
-===============================
-
-Another example I would like to look into is how to write your own procedure.
-The simplest possible way is to use an editor to assemble commands and execute
-them. This batch files type of procedures are useful to automatically run
-procedures over night and for similar simple applications. The following screen
-shots show the procedure executer with this feature enabled.
-
-.. image:: /_static/snapshot08.png
- :align: center
- :width: 500
-
-To go further I would like to explain some internal details. All procedures are
-executed in a central place (called the macro server). There can be more than
-one macro server per system but for the following I assume the common case of a
-unique macro server. This macro server holds all the general procedures
-centrally. It provides a controlled environment for these procedures. They can
-be edited, run, debugged under its supervision. This allows for example to
-automatically roll back changes made in case of problems, log access and grant
-permissions. The procedures executed in the macro server provided by the
-current Sardana system are Python_ classes. A class is a way to group the
-different methods which concerns this procedure. As an example, in some
-procedures it could be possible to do very specific things in case the user
-orders an emergency abort of the procedure. The following example shows the
-procedure to move a motor.
-
-As you can see in the example, the procedure must be documented and the input
-parameters described. From this information, the graphical user interface is
-constructed. It is also possible now to start the procedure from the command
-line interface and use the tab key to automatically complete the input. The
-actual action is actually carried out in the run method. The motor movement is
-started and the procedure waits until it arrives at its destiny. The Python_
-classes should stay small and very simple. All complicated code can be put into
-modules and tested separately from the system.
-
-How to adapt it to your own hardware
-====================================
-
-As the system has been thought from the beginning to be used at different
-institutes, no assumptions of the hardware used could be made. There exists
-therefore a mechanism to adapt the Sardana system to your own hardware. This
-adaptor also has another very important role to play. This is best explained
-with the motor as example. We consider more or less everything which can be
-changed in the system a motor. The term which should have better been used to
-describe this thing should have been therefore *movable*. A motor can be a
-temperature of a temperature controller which can be changed, a motor from an
-insertion device which needs a highly complicated protocol to be moved, or just
-about anything. Sometimes we also consider calculated value like H,K,L, the
-height of a table, and the gap of a slit to be a motor. All these different
-*motors* can be scanned with the same generic procedures without having to
-worry about on which elements it is working on. You can add one of these pseudo
-motors with the configuration editor. It is easily possible to add new types of
-pseudo motors. This has only to be done once and the Sardana system already
-provides a large variety of these types.
-
-.. image:: /_static/snapshot09.png
- :align: center
- :width: 500
-
-Please find in the following an example for adding a completely new type in the
-case of a *slit*.
-
-The actual information how to create a motor of type *slit* is kept in the two
-methods calc_physical and calc_pseudo which can be used to do the
-transformation between the different coordinate systems. Or to say it in the
-language of Sardana between the pseudo motors gap and offset and the real
-motors left blade and right blade.
-
-.. image:: /_static/snapshot10.png
- :align: center
- :width: 500
-
-Once again the information in the beginning allows the graphical user interface
-to be created automatically once it is loaded into the system.
-
-Symbolic Sketch
-===============
-
-I would like to end this summary with a symbolic sketch of the different
-subsystems in Sardana.
-
-.. image:: /_static/sardana_sketch.png
- :align: center
- :width: 500
-
-The user will normally not be concerned with these implementation details. It is
-presented here to allow appreciating the modularity of the system.
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _`PyTango installation steps`: http://packages.python.org/PyTango/start.html#getting-started
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
diff --git a/doc/source/users/scan.rst b/doc/source/users/scan.rst
deleted file mode 100644
index 3996ac03..00000000
--- a/doc/source/users/scan.rst
+++ /dev/null
@@ -1,155 +0,0 @@
-
-.. currentmodule:: sardana.macroserver.macros.scan
-
-.. _sardana-users-scan:
-
-=====
-Scans
-=====
-
-Perhaps the most used type of macro is the scan macros. In general terms, we
-call *scan* to a macro that moves one or more :ref:`motors <sardana-motor-api>`
-and acquires data along the path of the motor(s).
-
-.. note:: Sardana provides a :ref:`Scan Framework <sardana-macros-scanframework>`
- for developing scan macros so that the scan macros behave in a consistent way.
- Unless otherwise specified, the following discussion applies to scan macros
- based on such framework.
-
-The various scan macros mostly differ in how many motors are moved and the
-definition of their paths.
-
-Typically, the selection of which data is going to be acquired depends on the
-active *measurement group* and is *not* fixed by the macro itself (although
-there is no limitation in this sense).
-
-Depending on whether the motors are stopped before acquiring the data or not, we
-can classify the scan macros in *step* scans or *continuous* scans,
-respectively.
-
-
-.. figure:: /_static/trend_ascanVSascanc.png
- :width: 100%
- :figwidth: 80%
- :align: center
-
- Trend plot showing a step scan (:class:`ascan` *m_cp1_1 0 1000 8 .5*)
- followed by a continuous scan (:class:`ascanc` *m_cp1_1 0 1000 .5*).
- The line corresponds to the motor position and the blue shaded areas
- correspond to the intervals in which the data acquisition took place.
-
-
-
-Step scans
-----------
-
-In a step scan, the motors are moved to given points, and once they reach each
-point they stop. Then, one or more channels are acquired for a certain amount
-of time, and only when the data acquisition is finished, the motors proceed to
-the next point.
-
-In this way, the position associated to a data readout is well known and does
-not change during the acquisition time.
-
-Some examples of step scan macros are:
-:class:`ascan`,
-:class:`a2scan`, ...
-:class:`dscan`,
-:class:`d2scan`, ...
-:class:`mesh`.
-
-Continuous scans
-----------------
-
-In a continuous scan, the motors are not stopped for acquisition, which
-therefore takes place while the motors are moving. The most common reason for
-using this type of scan is optimizing the acquisition time by not having to
-wait for motors to accelerate and decelerate between acquisitions.
-
-.. note:: The synchronization of movement and acquisition can be done via
- hardware or via software. Currently Sardana only provides an interface for
- software-synchronized continuous scans. An API abstracting the specificities
- of hardware-synchronized systems is being implemented too but it is not yet
- available for production.
-
-The (software-synchronized) continuous scans introduce some constraints and
-issues that should be considered.
-
-#. If a continuous scan involves moving more than one motor simultaneously
- (as it is done, e.g. in :class:`~sardana.macroserver.macros.scan.a2scan`),
- then the movements of the motors should be synchronized so that they all
- start their path at the same time and finish it at the same time.
-#. If motors do not maintain a constant velocity along the path of their
- movement, the trajectories followed when using more than one motor may not
- be linear.
-#. While in step scans it is possible to scan two pseudo-motors that access
- the same physical motors (e.g. the *gap* and *offset* of a slit, being both
- pseudo-motors accessing the same physical motors attached to each blade of
- the slit), in a continuous scan the motions cannot be decoupled in a
- synchronized way.
-#. In order to optimize the acquisition time, Sardana attempts to perform as
- many acquisitions as allowed during the scan time. Due to the uncertainty in
- the delay times involved, it is not possible to know beforehand how many
- acquisitions will be completed. In other words, the number of acquired
- points along a continuous scan is not fixed (but it is guaranteed to be as
- large as possible).
-#. Backslash correction is incompatible with continuous scans, so you should
- keep in mind that continuous scans should only be done in the backslash-free
- direction of the motor (typically, by convention the positive one for a
- physical motor).
-
-
-
-In order to address the first two issues, the
-:ref:`scan framework <sardana-macros-scanframework>` attempts the following:
-
-* If the motors support changing their velocity, Sardana will adjust the
- velocities of the motors so that they all start and finish the required path
- simultaneously. For motors that specify a range of allowed velocities, this
- range will be used (for motors that do not specify a maximum allowed
- velocity, the current "top velocity" will be assumed to be the maximum)
-* For motors that can maintain a constant velocity after an acceleration phase
- (this is the case for most physical motors), Sardana will transparently
- extend the user-given path both at the beginning and the end in order to
- allow for the motors to move at constant velocity along all the user defined
- path (i.e., the motors are allowed time and room to accelerate before
- reaching the start of the path and to decelerate after the end of the nominal
- path selected by the user)
-
-These two actions can be seen in the following plot of the positions of the two
-motors involved in a :class:`~sardana.macroserver.macros.scan.a2scanc`.
-
-.. figure:: /_static/trend_a2scanc.png
- :width: 100%
- :figwidth: 80%
- :align: center
-
- Trend plot showing a two-motor continuous scan
- (:class:`a2scanc` *m_cp1_1 100 200 m_cp1_2 0 500 .1*).
- The lines correspond to the motor positions and the blue shaded areas correspond to the intervals in
- which the data acquisition took place.
-
-
-Both motors are capable of same velocity and acceleration, but since the
-required scan path for m_cp1_1 is shorter than that for m_cp1_2, its top
-velocity has been adjusted (gentler slope for m_cp1_1) so that both motors go
-through the user-requested start and stop positions simultaneously.
-
-The same figure also shows how the paths for both motors have been automatically
-(and transparently, for the user) extended to guarantee that the user defined
-path is followed at constant velocity and that the data acquisition takes place
-also while the motors are running at constant velocity.
-
-
-
-Some examples of continuous scan macros are:
-:class:`ascanc`,
-:class:`a2scanc`, ...
-:class:`dscanc`,
-:class:`d2scanc`, ...
-:class:`meshc`.
-
-.. seealso:: For more information about the implementation details of the scan
- macros in Sardana, see
- :ref:`scan framework <sardana-macros-scanframework>`
-
diff --git a/doc/source/users/screenshots.rst b/doc/source/users/screenshots.rst
index ef10d8a4..f0291f44 100644
--- a/doc/source/users/screenshots.rst
+++ b/doc/source/users/screenshots.rst
@@ -2,127 +2,55 @@
.. highlight:: python
:linenothreshold: 4
-.. _sardana-screenshots:
+.. _screenshots:
-============
+===========
Screenshots
-============
+===========
Here you will find a host of example figures.
-Sardana oriented graphical user interfaces
-------------------------------------------
-
-.. figure:: /_static/snapshot01.png
- :alt: TaurusGUI at work
- :width: 600
-
- TaurusGUI at work.
-
-.. figure:: /_static/snapshot02.png
- :alt: TaurusGUI with synoptic and macro widget
- :width: 600
-
- TaurusGUI with synoptic and macro widget
+.. figure:: /_static/label01.png
+ :align: center
-.. figure:: /_static/snapshot03.png
- :alt: Spock console
- :width: 600
-
- Spock console
-
-.. figure:: /_static/snapshot04.png
- :alt: TaurusGUI with synoptic and macro panel
- :width: 600
-
- TaurusGUI with synoptic and macro panel
-
-.. _sardana-screenshots-guis:
+ Display attribute value
-Graphical user interface screen shots
--------------------------------------
-
-.. figure:: /_static/gui_snapshot01.png
- :alt: ALBA_'s Storage ring GUI
- :width: 600
-
- ALBA_'s Storage ring GUI
-
-.. figure:: /_static/gui_snapshot02.png
- :width: 600
- :alt: ALBA_'s LINAC to booster beam charge monitor GUI
-
- ALBA_'s LINAC to booster beam charge monitor GUI
+.. figure:: /_static/label02.png
+ :align: center
-.. figure:: /_static/gui_snapshot03.png
- :width: 600
- :alt: ALBA_'s beam position monitor GUI
-
- ALBA_'s beam position monitor GUI
+ Display attribute value with label
+
+.. figure:: /_static/label03.png
+ :align: center
-.. figure:: /_static/gui_snapshot04.png
- :width: 600
- :alt: ALBA_'s Radio frequency plant GUI
+ Display attribute value with label & unit
- ALBA_'s Radio frequency plant GUI
+.. figure:: /_static/edit01.png
+ :align: center
-.. figure:: /_static/gui_snapshot05.png
- :width: 600
- :alt: ALBA_'s tune excitation panel
-
- ALBA_'s tune excitation panel
+ Interactively display attribute
-.. figure:: /_static/gui_snapshot06.png
- :width: 600
- :alt: ALBA_'s fluorescent screen main panel
-
- ALBA_'s fluorescent screen main panel
+.. figure:: /_static/edit02.png
+ :align: center
-.. figure:: /_static/gui_snapshot07.png
- :width: 600
- :alt: ALBA_'s front end GUI
-
- ALBA_'s front end GUI
+ Interactively display attribute with spinbox
-.. figure:: /_static/gui_snapshot08.png
- :width: 600
- :alt: ALBA_'s digital low level radio frequency GUI
-
- ALBA_'s digital low level radio frequency GUI
+.. figure:: /_static/edit03.png
+ :align: center
-.. figure:: /_static/gui_snapshot09.png
- :width: 600
- :alt: ALBA_'s vaccum GUI
-
- ALBA_'s vaccum GUI
+ Interactively display attribute with wheel
-.. figure:: /_static/gui_snapshot10.png
- :width: 600
- :alt: Sardana configuration GUI
-
- Sardana configuration GUI
+.. figure:: /_static/taurusvalue01.png
+ :align: center
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
+ The standard attribute display widget
+
+.. figure:: /_static/forms01.png
+ :align: center
+
+ Using forms
+.. figure:: /_static/forms02.png
+ :align: center
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
+ Customized form \ No newline at end of file
diff --git a/doc/source/users/spock.rst b/doc/source/users/spock.rst
deleted file mode 100644
index dfd56b10..00000000
--- a/doc/source/users/spock.rst
+++ /dev/null
@@ -1,471 +0,0 @@
-
-.. _sardana-spock:
-
-=====
-Spock
-=====
-
-*Spock* is the prefered :term:`CLI` for sardana. It is based on IPython_. Spock
-automatically loads other IPython_ extensions like the ones for PyTango_ and
-*pylab*. It as been extended in sardana to provide a customized interface for
-executing macros and automatic access to sardana elements.
-
-Spock tries to mimic SPEC_'s command line interface. Most SPEC_ commands are
-available from spock console.
-
-.. figure:: /_static/spock_snapshot01.png
- :height: 600
- :align: center
-
- Spock :term:`CLI` in action
-
-Starting spock from the command line
-------------------------------------
-
-To start spock just type in the command line::
-
- marge@machine02:~$ spock
-
-This will start spock with a "default profile" for the user your are logged
-with. There may be many sardana servers running on your system so the first
-time you start spock, it will ask you to which sardana system you want to
-connect to by asking to which of the existing doors you want to use::
-
- marge@machine02:~$ spock
- Profile 'spockdoor' does not exist. Do you want to create one now ([y]/n)?
- Available Door devices from homer:10000 :
- On Sardana LAB-01:
- LAB-01-D01 (running)
- LAB-01-D02 (running)
- On Sardana LAB-02:
- LAB-02-D01
- Please select a Door from the list? LAB-01-D01
- Storing ipy_profile_spockdoor.py in /home/marge/.ipython... [DONE]
-
-.. note::
- If only one Door exists in the entire system, spock will automatically
- connect to that door thus avoiding the previous questions.
-
-Afterward, spock :term:`CLI` will start normally:
-
-.. sourcecode:: spock
-
- Spock 7.2.1 -- An interactive sardana client.
-
- help -> Spock's help system.
- object? -> Details about 'object'. ?object also works, ?? prints more.
-
- Spock's sardana extension 1.0 loaded with profile: spockdoor (linked to door 'LAB-01-D01')
-
- LAB-01-D01 [1]:
-
-Starting spock with a custom profile
-------------------------------------
-
-spock allows each user to start a spock session with different configurations
-(known in spock as *profiles*). All you have to do is start spock with
-the profile name as an option.
-
-If you use ipython version > 0.10 you can do it using **--profile** option::
-
- spock --profile=<profile name>
-
-Example::
-
- marge@machine02:~$ spock --profile=D1
-
-
-Otherwise (ipython version 0.10) you can do it using **-p** option::
-
- spock -p <profile name>
-
-Example::
-
- marge@machine02:~$ spock -p D1
-
-The first time a certain profile is used you will be asked to which door you
-want to connect to (see previous chapter).
-
-Spock IPython_ Primer
----------------------
-
-As mentioned before, spock console is based on IPython_. Everything you can do
-in IPython is available in spock. The IPython_ documentation provides excelent
-tutorials, tips & tricks, cookbooks, videos, presentations and reference guide.
-For comodity we summarize some of the most interesting IPython_ chapters here:
-
-.. hlist::
- :columns: 2
-
- * `IPython web page <http://ipython.org/>`_
- * :ref:`tutorial`
- * :ref:`tips`
- * :ref:`command_line_options`
-
-Executing macros
-----------------
-
-Executing sardana macros in spock is the most useful feature of spock. It is
-very simple to execute a macro: just type the macro name followed by a space
-separated list of parameters (if the macro has any parameters). For example,
-one of the most used macros is the
-:class:`~sardana.macroserver.macros.standard.wa` (stands for "where all") that
-shows all current motor positions. To execute it just type:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: wa
-
- Current Positions (user, dial)
-
- Energy Gap Offset
- 100.0000 43.0000 100.0000
- 100.0000 43.0000 100.0000
-
-(:term:`user` for :term:`user position` (number above); :term:`dial` for
-:term:`dial position` (number below).)
-
-A similar macro exists that only shows the desired motor positions
-(:class:`~sardana.macroserver.macros.standard.wm`):
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: wm gap offset
- Gap Offset
- User
- High 500.0 100.0
- Current 100.0 43.0
- Low 5.0 -100.0
- Dial
- High 500.0 100.0
- Current 100.0 43.0
- Low 5.0 -100.0
-
-To get the list of all existing macros use
-:class:`~sardana.macroserver.macros.expert.lsmac`:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: lsdef
- Name Module Brief Description
- ------------------- ------------- ------------------------------------------------------------
- a2scan scans two-motor scan. a2scan scans two motors, as specifi[...]
- a2scan scans three-motor scan . a3scan scans three motors, as sp[...]
- ascan scans Do an absolute scan of the specified motor. ascan s[...]
- defmeas expert Create a new measurement group
- fscan scans N-dimensional scan along user defined paths. The mo[...]
- lsa lists Lists all existing objects
- lsm lists Lists all motors
- lsmac expert Lists all macros.
- mv standard Move motor(s) to the specified position(s)
- mvr standard Move motor(s) relative to the current position(s)
- wa standard Show all motor position.
- wm standard Show the position of the specified motors.
- <...>
-
-Miscellaneous
-~~~~~~~~~~~~~
-
- - :class:`~sardana.macroserver.macros.lists.lsm` shows the list of
- motors.
- - :class:`~sardana.macroserver.macros.lists.lsct` shows the list of
- counters.
- - :class:`~sardana.macroserver.macros.lists.lsmeas` shows the list of
- measurement groups
- - :class:`~sardana.macroserver.macros.lists.lsctrl` shows the list of
- controllers
- - :class:`~sardana.macroserver.macros.expert.sar_info` *object*
- displays detailed information about an element
-
-Stopping macros
----------------
-
-Some macros may take a long time to execute. To stop a macro in the middle of
-its execution type :kbd:`Control+c`.
-
-Macros that move motors or acquire data from sensors will automatically stop all
-motion and/or all acquisition.
-
-Exiting spock
--------------
-
-To exit spock type :kbd:`Control+d` or :samp:`exit()` inside a spock console.
-
-Getting help
-------------
-
-spock not only knows all the macros the sardana server can run but it also
-information about each macro parameters, result and documentation. Therefore it
-can give you precise help on each macro. To get help about a certain macro just
-type the macro name directly followed by a question mark('?'):
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: ascan?
-
- Syntax:
- ascan <motor> <start_pos> <final_pos> <nr_interv> <integ_time>
-
- Do an absolute scan of the specified motor.
- ascan scans one motor, as specified by motor. The motor starts at the
- position given by start_pos and ends at the position given by final_pos.
- The step size is (start_pos-final_pos)/nr_interv. The number of data points collected
- will be nr_interv+1. Count time is given by time which if positive,
- specifies seconds and if negative, specifies monitor counts.
-
- Parameters:
- motor : (Motor) Motor to move
- start_pos : (Float) Scan start position
- final_pos : (Float) Scan final position
- nr_interv : (Integer) Number of scan intervals
- integ_time : (Float) Integration time
-
-Moving motors
--------------
-
-A single motor may be moved using the
-:class:`~sardana.macroserver.macros.standard.mv` *motor* *position* macro.
-Example:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: mv gap 50
-
-will move the *gap* motor to 50. The prompt only comes back after the motion as
-finished.
-
-Alternatively, you can have the motor position displayed on the screen as it is
-moving by using the :class:`~sardana.macroserver.macros.standard.umv` macro
-instead. To stop the motor(s) before they have finished moving, type
-:kbd:`Control+c`.
-
-You can use the :class:`~sardana.macroserver.macros.standard.mvr` *motor*
-*relative_position* macro to move a motor relative to its current position:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: mvr gap 2
-
-will move *gap* by two user units.
-
-Counting
---------
-
-You can count using the :class:`~sardana.macroserver.macros.standard.ct` *value*
-macro. Without arguments, this macro counts for one second using the active
-measurement group set by the environment variable *ActiveMntGrp*.
-
-
-.. sourcecode:: spock
-
- Door_lab-01_1 [1]: ct 1.6
-
- Wed Jul 11 11:47:55 2012
-
- ct01 = 1.6
- ct02 = 3.2
- ct03 = 4.8
- ct04 = 6.4
-
-To see the list of available measurement groups type
-:class:`~sardana.macroserver.macros.lists.lsmeas`. The active measuremnt group
-is marked with an asterisk (*):
-
-.. sourcecode:: spock
-
- Door_lab-01_1 [1]: lsmeas
-
- Active Name Timer Experim. channels
- -------- ---------- ------- -----------------------------------------------------------
- * mntgrp01 ct01 ct01, ct02, ct03, ct04
- mntgrp21 ct04 ct04, pcII0, pcII02
- mntgrp24 ct04 ct04, pcII0
-
-to switch active measurement groups type
-:class:`~sardana.macroserver.macros.env.senv` **ActiveMntGrp** *mg_name*.
-
-You can also create, modify and select measurement groups using the
-:class:`~sardana.spock.magic.expconf` command
-
-Scanning
---------
-
-Sardana provides a catalog of different standard scan macros. Absolute-position
-motor scans such as :class:`~sardana.macroserver.macros.scan.ascan`,
-:class:`~sardana.macroserver.macros.scan.a2scan` and
-:class:`~sardana.macroserver.macros.scan.a3scan` move one, two or three motors
-at a time. Relative-position motor scans are
-:class:`~sardana.macroserver.macros.scan.dscan`,
-:class:`~sardana.macroserver.macros.scan.d2scan` and
-:class:`~sardana.macroserver.macros.scan.d3scan`. The relative-position scans
-all return the motors to their starting positions after the last point. Two
-motors can be scanned over a grid of points using the
-:class:`~sardana.macroserver.macros.scan.mesh` scan.
-
-*Continuous* versions exist of many of the standard scan macros (e.g.
-:class:`~sardana.macroserver.macros.scan.ascanc`,
-:class:`~sardana.macroserver.macros.scan.d3scanc`,
-:class:`~sardana.macroserver.macros.scan.meshc`,...). The continuous scans
-differ from their standard counterparts (also known as *step* scans) in that
-the data acquisition is done without stopping the motors. Continuous scans are
-generally faster but less precise than step scans, and some details must be
-considered (see :ref:`sardana-users-scan`).
-
-As it happens with :class:`~sardana.macroserver.macros.standard.ct`, the scan
-macros will also use the active measurement group to decide which experiment
-channels will be involved in the operation.
-
-Here is the output of performing an
-:class:`~sardana.macroserver.macros.scan.ascan` of the gap in a slit:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: ascan gap 0.9 1.1 20 1
- ScanDir is not defined. This operation will not be stored persistently. Use "senv ScanDir <abs directory>" to enable it
- Scan #4 started at Wed Jul 11 12:56:47 2012. It will take at least 0:00:21
- #Pt No gap ct01 ct02 ct03
- 0 0.9 1 4604 8939
- 1 0.91 1 5822 8820
- 2 0.92 1 7254 9544
- 3 0.93 1 9254 8789
- 4 0.94 1 11265 8804
- 5 0.95 1 13583 8909
- 6 0.96 1 15938 8821
- 7 0.97 1 18076 9110
- 8 0.98 1 19638 8839
- 9 0.99 1 20825 8950
- 10 1 1 21135 8917
- 11 1.01 1 20765 9013
- 12 1.02 1 19687 9135
- 13 1.03 1 18034 8836
- 14 1.04 1 15876 8901
- 15 1.05 1 13576 8933
- 16 1.06 1 11328 9022
- 17 1.07 1 9244 9205
- 18 1.08 1 7348 8957
- 19 1.09 1 5738 8801
- 20 1.1 1 4575 8975
- Scan #4 ended at Wed Jul 11 12:57:18 2012, taking 0:00:31.656980 (dead time was 33.7%)
-
-
-
-Scan storage
-~~~~~~~~~~~~
-
-As you can see, by default, the scan is not recorded into any file. To store
-your scans in a file, you must set the environment variables **ScanDir** and
-**ScanFile**:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: senv ScanDir /tmp
- ScanDir = /tmp
-
- LAB-01-D01 [2]: senv ScanFile scans.h5
- ScanFile = scans.h5
-
-Sardana will activate a proper recorder to store the scans persistently
-(currently, *.h5* will store in `NeXus`_ format. All other extensions are
-interpreted as `SPEC`_ format).
-
-You can also store in multiples files by assigning the **ScanFile** with a list
-of files:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [2]: senv ScanFile "['scans.h5', 'scans.dat']"
- ScanFile = ['scans.h5', 'scans.dat']
-
-Viewing scan data
-~~~~~~~~~~~~~~~~~
-
-Sardana provides a scan data viewer for scans which were stored in a `NeXus`_
-file. Without arguments, :class:`~sardana.macroserver.macros.scan.showscan`
-will show you the result of the last scan in a :term:`GUI`:
-
-.. figure:: /_static/spock_snapshot02.png
- :height: 600
-
- Scan data viewer in action
-
-:class:`~sardana.macroserver.macros.scan.showscan` *scan_number* will display
-data for the given scan number.
-
-The history of scans is available through the
-:class:`~sardana.macroserver.macros.scan.scanhist` macro:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: scanhist
- # Title Start time End time Stored
- --- ------------------------------- --------------------- --------------------- -------------
- 1 dscan mot01 20.0 30.0 10 0.1 2012-07-03 10:35:30 2012-07-03 10:35:30 Not stored!
- 3 dscan mot01 20.0 30.0 10 0.1 2012-07-03 10:36:38 2012-07-03 10:36:43 Not stored!
- 4 ascan gap01 10.0 100.0 20 1.0 12:56:47 12:57:18 Not stored!
- 5 ascan gap01 1.0 10.0 20 0.1 13:19:05 13:19:13 scans.h5
-
-
-Using spock as a Python_ console
---------------------------------
-
-You can write any Python_ code inside a spock console since spock uses IPython_
-as a command line interpreter. For example, the following will work inside a
-spock console:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: def f():
- ...: print("Hello, World!")
- ...:
- ...:
-
- LAB-01-D01 [2]: f()
- Hello, World!
-
-
-Using spock as a Tango_ console
--------------------------------
-
-As metioned in the beggining of this chapter, the sardana spock automatically
-activates the PyTango_ 's ipython console extension. Therefore all Tango_
-features are automatically available on the sardana spock console. For example,
-creating a :class:`~PyTango.DeviceProxy` will work inside the sardana spock
-console:
-
-.. sourcecode:: spock
-
- LAB-01-D01 [1]: tgtest = PyTango.DeviceProxy("sys/tg_test/1")
-
- LAB-01-D01 [2]: print( tgtest.state() )
- RUNNING
-
-.. rubric:: Footnotes
-
-.. [#] The PyTango_ ipython documentation can be found :ref:`here <itango>`
-
-.. _ALBA: http://www.cells.es/
-.. _ANKA: http://http://ankaweb.fzk.de/
-.. _ELETTRA: http://http://www.elettra.trieste.it/
-.. _ESRF: http://www.esrf.eu/
-.. _FRMII: http://www.frm2.tum.de/en/index.html
-.. _HASYLAB: http://hasylab.desy.de/
-.. _MAX-lab: http://www.maxlab.lu.se/maxlab/max4/index.html
-.. _SOLEIL: http://www.synchrotron-soleil.fr/
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _Taurus: http://packages.python.org/taurus/
-.. _QTango: http://www.tango-controls.org/download/index_html#qtango3
-.. _`PyTango installation steps`: http://packages.python.org/PyTango/start.html#getting-started
-.. _Qt: http://qt.nokia.com/products/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _PyQwt: http://pyqwt.sourceforge.net/
-.. _Python: http://www.python.org/
-.. _IPython: http://ipython.org/
-.. _ATK: http://www.tango-controls.org/Documents/gui/atk/tango-application-toolkit
-.. _Qub: http://www.blissgarden.org/projects/qub/
-.. _numpy: http://numpy.scipy.org/
-.. _SPEC: http://www.certif.com/
-.. _EPICS: http://www.aps.anl.gov/epics/
-.. _NeXus: http://www.nexusformat.org/
diff --git a/doc/source/users/standard_macro_catalog.rst b/doc/source/users/standard_macro_catalog.rst
deleted file mode 100644
index 33aac15c..00000000
--- a/doc/source/users/standard_macro_catalog.rst
+++ /dev/null
@@ -1,140 +0,0 @@
-
-.. _sardana-standard-macro-catalog:
-
-======================
-Standard macro catalog
-======================
-
-motion related macros
----------------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.standard.wa`
- * :class:`~sardana.macroserver.macros.standard.wm`
- * :class:`~sardana.macroserver.macros.standard.pwa`
- * :class:`~sardana.macroserver.macros.standard.pwm`
- * :class:`~sardana.macroserver.macros.standard.set_lim`
- * :class:`~sardana.macroserver.macros.standard.set_lm`
- * :class:`~sardana.macroserver.macros.standard.set_pos`
- * :class:`~sardana.macroserver.macros.standard.mv`
- * :class:`~sardana.macroserver.macros.standard.umv`
- * :class:`~sardana.macroserver.macros.standard.mvr`
- * :class:`~sardana.macroserver.macros.standard.umvr`
- * :class:`~sardana.macroserver.macros.lists.lsm`
- * :class:`~sardana.macroserver.macros.lists.lspm`
-
-counting macros
----------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.standard.ct`
- * :class:`~sardana.macroserver.macros.standard.uct`
- * :class:`~sardana.macroserver.macros.standard.settimer`
- * :class:`~sardana.macroserver.macros.lists.lsexp`
- * :class:`~sardana.macroserver.macros.lists.lsmeas`
- * :class:`~sardana.macroserver.macros.lists.lsct`
- * :class:`~sardana.macroserver.macros.lists.ls0d`
- * :class:`~sardana.macroserver.macros.lists.ls1d`
- * :class:`~sardana.macroserver.macros.lists.ls2d`
- * :class:`~sardana.macroserver.macros.lists.lspc`
-
-environment related macros
---------------------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.env.lsenv`
- * :class:`~sardana.macroserver.macros.env.senv`
- * :class:`~sardana.macroserver.macros.env.usenv`
- * :class:`~sardana.macroserver.macros.env.dumpenv`
-
-list related macros
--------------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.env.lsenv`
- * :class:`~sardana.macroserver.macros.lists.lsa`
- * :class:`~sardana.macroserver.macros.lists.lsm`
- * :class:`~sardana.macroserver.macros.lists.lspm`
- * :class:`~sardana.macroserver.macros.lists.lsexp`
- * :class:`~sardana.macroserver.macros.lists.lsior`
- * :class:`~sardana.macroserver.macros.lists.lsmeas`
- * :class:`~sardana.macroserver.macros.lists.lsct`
- * :class:`~sardana.macroserver.macros.lists.ls0d`
- * :class:`~sardana.macroserver.macros.lists.ls1d`
- * :class:`~sardana.macroserver.macros.lists.ls2d`
- * :class:`~sardana.macroserver.macros.lists.lspc`
- * :class:`~sardana.macroserver.macros.lists.lsctrl`
- * :class:`~sardana.macroserver.macros.lists.lsi`
- * :class:`~sardana.macroserver.macros.lists.lsctrllib`
- * :class:`~sardana.macroserver.macros.lists.lsa`
- * :class:`~sardana.macroserver.macros.lists.lsmac`
- * :class:`~sardana.macroserver.macros.lists.lsmaclib`
-
-measurement configuration macros
---------------------------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.expert.defmeas`
- * :class:`~sardana.macroserver.macros.expert.udefmeas`
-
-advanced element manipulation macros
-------------------------------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.expert.defelem`
- * :class:`~sardana.macroserver.macros.expert.udefelem`
- * :class:`~sardana.macroserver.macros.expert.defctrl`
- * :class:`~sardana.macroserver.macros.expert.udefctrl`
- * :class:`~sardana.macroserver.macros.expert.prdef`
-
-reload code macros
-------------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.expert.relmac`
- * :class:`~sardana.macroserver.macros.expert.relmaclib`
- * :class:`~sardana.macroserver.macros.expert.rellib`
-
-scan macros
------------
-
-.. hlist::
- :columns: 5
-
- * :class:`~sardana.macroserver.macros.scan.ascan`
- * :class:`~sardana.macroserver.macros.scan.a2scan`
- * :class:`~sardana.macroserver.macros.scan.a3scan`
- * :class:`~sardana.macroserver.macros.scan.a4scan`
- * :class:`~sardana.macroserver.macros.scan.amultiscan`
- * :class:`~sardana.macroserver.macros.scan.dscan`
- * :class:`~sardana.macroserver.macros.scan.d2scan`
- * :class:`~sardana.macroserver.macros.scan.d3scan`
- * :class:`~sardana.macroserver.macros.scan.d4scan`
- * :class:`~sardana.macroserver.macros.scan.dmultiscan`
- * :class:`~sardana.macroserver.macros.scan.mesh`
- * :class:`~sardana.macroserver.macros.scan.fscan`
- * :class:`~sardana.macroserver.macros.scan.scanhist`
-
- * :class:`~sardana.macroserver.macros.scan.ascanc`
- * :class:`~sardana.macroserver.macros.scan.a2scanc`
- * :class:`~sardana.macroserver.macros.scan.a3scanc`
- * :class:`~sardana.macroserver.macros.scan.a4scanc`
- * :class:`~sardana.macroserver.macros.scan.dscanc`
- * :class:`~sardana.macroserver.macros.scan.d2scanc`
- * :class:`~sardana.macroserver.macros.scan.d3scanc`
- * :class:`~sardana.macroserver.macros.scan.d4scanc`
- * :class:`~sardana.macroserver.macros.scan.meshc`
diff --git a/taurus/doc/source/users/ui/arrayeditor.rst b/doc/source/users/ui/arrayeditor.rst
index 0bd3c5ce..0bd3c5ce 100644
--- a/taurus/doc/source/users/ui/arrayeditor.rst
+++ b/doc/source/users/ui/arrayeditor.rst
diff --git a/taurus/doc/source/users/ui/attributechooser.rst b/doc/source/users/ui/attributechooser.rst
index 33e6e9bb..33e6e9bb 100644
--- a/taurus/doc/source/users/ui/attributechooser.rst
+++ b/doc/source/users/ui/attributechooser.rst
diff --git a/taurus/doc/source/users/ui/experimentconfiguration.rst b/doc/source/users/ui/experimentconfiguration.rst
index d6bcd3e7..d6bcd3e7 100644
--- a/taurus/doc/source/users/ui/experimentconfiguration.rst
+++ b/doc/source/users/ui/experimentconfiguration.rst
diff --git a/taurus/doc/source/users/ui/forms.rst b/doc/source/users/ui/forms.rst
index 49cbb1e4..49cbb1e4 100644
--- a/taurus/doc/source/users/ui/forms.rst
+++ b/doc/source/users/ui/forms.rst
diff --git a/taurus/doc/source/users/ui/index.rst b/doc/source/users/ui/index.rst
index 44b91119..44b91119 100644
--- a/taurus/doc/source/users/ui/index.rst
+++ b/doc/source/users/ui/index.rst
diff --git a/taurus/doc/source/users/ui/macros/index.rst b/doc/source/users/ui/macros/index.rst
index 78305ec1..78305ec1 100644
--- a/taurus/doc/source/users/ui/macros/index.rst
+++ b/doc/source/users/ui/macros/index.rst
diff --git a/taurus/doc/source/users/ui/macros/macroexecutor.rst b/doc/source/users/ui/macros/macroexecutor.rst
index 57a60677..57a60677 100644
--- a/taurus/doc/source/users/ui/macros/macroexecutor.rst
+++ b/doc/source/users/ui/macros/macroexecutor.rst
diff --git a/taurus/doc/source/users/ui/macros/sequencer.rst b/doc/source/users/ui/macros/sequencer.rst
index 6eca58d2..6eca58d2 100644
--- a/taurus/doc/source/users/ui/macros/sequencer.rst
+++ b/doc/source/users/ui/macros/sequencer.rst
diff --git a/taurus/doc/source/users/ui/modelchooser.rst b/doc/source/users/ui/modelchooser.rst
index 90c7c2dd..90c7c2dd 100644
--- a/taurus/doc/source/users/ui/modelchooser.rst
+++ b/doc/source/users/ui/modelchooser.rst
diff --git a/taurus/doc/source/users/ui/plot.rst b/doc/source/users/ui/plot.rst
index 84292ecf..84292ecf 100644
--- a/taurus/doc/source/users/ui/plot.rst
+++ b/doc/source/users/ui/plot.rst
diff --git a/taurus/doc/source/users/ui/sardanaeditor.rst b/doc/source/users/ui/sardanaeditor.rst
index fe2e89ad..fe2e89ad 100644
--- a/taurus/doc/source/users/ui/sardanaeditor.rst
+++ b/doc/source/users/ui/sardanaeditor.rst
diff --git a/taurus/doc/source/users/ui/synoptics.rst b/doc/source/users/ui/synoptics.rst
index 91a6fe5f..91a6fe5f 100644
--- a/taurus/doc/source/users/ui/synoptics.rst
+++ b/doc/source/users/ui/synoptics.rst
diff --git a/taurus/doc/source/users/ui/taurusgui.rst b/doc/source/users/ui/taurusgui.rst
index 4bc6332d..4bc6332d 100644
--- a/taurus/doc/source/users/ui/taurusgui.rst
+++ b/doc/source/users/ui/taurusgui.rst
diff --git a/taurus/doc/source/users/ui/taurusimage.rst b/doc/source/users/ui/taurusimage.rst
index 3bf5715b..3bf5715b 100644
--- a/taurus/doc/source/users/ui/taurusimage.rst
+++ b/doc/source/users/ui/taurusimage.rst
diff --git a/taurus/doc/source/users/ui/trend.rst b/doc/source/users/ui/trend.rst
index 4d42f04e..4d42f04e 100644
--- a/taurus/doc/source/users/ui/trend.rst
+++ b/doc/source/users/ui/trend.rst
diff --git a/taurus/doc/source/users/ui/ui_colors.rst b/doc/source/users/ui/ui_colors.rst
index a98f0493..a98f0493 100644
--- a/taurus/doc/source/users/ui/ui_colors.rst
+++ b/doc/source/users/ui/ui_colors.rst
diff --git a/taurus/doc/thumbnails.zip b/doc/thumbnails.zip
index 0cf0971f..0cf0971f 100644
--- a/taurus/doc/thumbnails.zip
+++ b/doc/thumbnails.zip
Binary files differ
diff --git a/taurus/lib/taurus/__init__.py b/lib/taurus/__init__.py
index 0c1a58de..0c1a58de 100644
--- a/taurus/lib/taurus/__init__.py
+++ b/lib/taurus/__init__.py
diff --git a/taurus/lib/taurus/console/__init__.py b/lib/taurus/console/__init__.py
index ca260838..ca260838 100644
--- a/taurus/lib/taurus/console/__init__.py
+++ b/lib/taurus/console/__init__.py
diff --git a/taurus/lib/taurus/console/enums.py b/lib/taurus/console/enums.py
index d12aae3f..d12aae3f 100644
--- a/taurus/lib/taurus/console/enums.py
+++ b/lib/taurus/console/enums.py
diff --git a/taurus/lib/taurus/console/list.py b/lib/taurus/console/list.py
index 80b82085..80b82085 100644
--- a/taurus/lib/taurus/console/list.py
+++ b/lib/taurus/console/list.py
diff --git a/taurus/lib/taurus/console/table.py b/lib/taurus/console/table.py
index 238d12d6..238d12d6 100644
--- a/taurus/lib/taurus/console/table.py
+++ b/lib/taurus/console/table.py
diff --git a/taurus/lib/taurus/console/util/__init__.py b/lib/taurus/console/util/__init__.py
index 9a620ef2..9a620ef2 100644
--- a/taurus/lib/taurus/console/util/__init__.py
+++ b/lib/taurus/console/util/__init__.py
diff --git a/taurus/lib/taurus/core/__init__.py b/lib/taurus/core/__init__.py
index 0295f9be..0295f9be 100644
--- a/taurus/lib/taurus/core/__init__.py
+++ b/lib/taurus/core/__init__.py
diff --git a/taurus/lib/taurus/core/epics/__init__.py b/lib/taurus/core/epics/__init__.py
index 5ae00d2a..5ae00d2a 100644
--- a/taurus/lib/taurus/core/epics/__init__.py
+++ b/lib/taurus/core/epics/__init__.py
diff --git a/taurus/lib/taurus/core/epics/__taurus_plugin__ b/lib/taurus/core/epics/__taurus_plugin__
index e69de29b..e69de29b 100644
--- a/taurus/lib/taurus/core/epics/__taurus_plugin__
+++ b/lib/taurus/core/epics/__taurus_plugin__
diff --git a/taurus/lib/taurus/core/epics/epicsfactory.py b/lib/taurus/core/epics/epicsfactory.py
index d214c934..d214c934 100644
--- a/taurus/lib/taurus/core/epics/epicsfactory.py
+++ b/lib/taurus/core/epics/epicsfactory.py
diff --git a/taurus/lib/taurus/core/evaluation/__init__.py b/lib/taurus/core/evaluation/__init__.py
index bb2ee60d..bb2ee60d 100644
--- a/taurus/lib/taurus/core/evaluation/__init__.py
+++ b/lib/taurus/core/evaluation/__init__.py
diff --git a/taurus/lib/taurus/core/evaluation/__taurus_plugin__ b/lib/taurus/core/evaluation/__taurus_plugin__
index e69de29b..e69de29b 100644
--- a/taurus/lib/taurus/core/evaluation/__taurus_plugin__
+++ b/lib/taurus/core/evaluation/__taurus_plugin__
diff --git a/taurus/lib/taurus/core/evaluation/dev_example.py b/lib/taurus/core/evaluation/dev_example.py
index 811cdc71..811cdc71 100644
--- a/taurus/lib/taurus/core/evaluation/dev_example.py
+++ b/lib/taurus/core/evaluation/dev_example.py
diff --git a/taurus/lib/taurus/core/evaluation/evalfactory.py b/lib/taurus/core/evaluation/evalfactory.py
index 65210570..65210570 100644
--- a/taurus/lib/taurus/core/evaluation/evalfactory.py
+++ b/lib/taurus/core/evaluation/evalfactory.py
diff --git a/taurus/lib/taurus/core/evaluation/ipap_example.py b/lib/taurus/core/evaluation/ipap_example.py
index 12f29d08..12f29d08 100644
--- a/taurus/lib/taurus/core/evaluation/ipap_example.py
+++ b/lib/taurus/core/evaluation/ipap_example.py
diff --git a/taurus/lib/taurus/core/init_bkcomp.py b/lib/taurus/core/init_bkcomp.py
index 97003c3b..97003c3b 100644
--- a/taurus/lib/taurus/core/init_bkcomp.py
+++ b/lib/taurus/core/init_bkcomp.py
diff --git a/taurus/lib/taurus/core/init_lightweight.py b/lib/taurus/core/init_lightweight.py
index 5f58b673..5f58b673 100644
--- a/taurus/lib/taurus/core/init_lightweight.py
+++ b/lib/taurus/core/init_lightweight.py
diff --git a/taurus/lib/taurus/core/release.py b/lib/taurus/core/release.py
index de66fa23..de66fa23 100644
--- a/taurus/lib/taurus/core/release.py
+++ b/lib/taurus/core/release.py
diff --git a/taurus/lib/taurus/core/resource/__init__.py b/lib/taurus/core/resource/__init__.py
index 795eb7ec..795eb7ec 100644
--- a/taurus/lib/taurus/core/resource/__init__.py
+++ b/lib/taurus/core/resource/__init__.py
diff --git a/taurus/lib/taurus/core/resource/__taurus_plugin__ b/lib/taurus/core/resource/__taurus_plugin__
index e69de29b..e69de29b 100644
--- a/taurus/lib/taurus/core/resource/__taurus_plugin__
+++ b/lib/taurus/core/resource/__taurus_plugin__
diff --git a/taurus/lib/taurus/core/resource/resfactory.py b/lib/taurus/core/resource/resfactory.py
index c2806443..c2806443 100644
--- a/taurus/lib/taurus/core/resource/resfactory.py
+++ b/lib/taurus/core/resource/resfactory.py
diff --git a/taurus/lib/taurus/core/simulation/__init__.py b/lib/taurus/core/simulation/__init__.py
index cc53e92b..cc53e92b 100644
--- a/taurus/lib/taurus/core/simulation/__init__.py
+++ b/lib/taurus/core/simulation/__init__.py
diff --git a/taurus/lib/taurus/core/simulation/__taurus_plugin__ b/lib/taurus/core/simulation/__taurus_plugin__
index e69de29b..e69de29b 100644
--- a/taurus/lib/taurus/core/simulation/__taurus_plugin__
+++ b/lib/taurus/core/simulation/__taurus_plugin__
diff --git a/taurus/lib/taurus/core/simulation/simfactory.py b/lib/taurus/core/simulation/simfactory.py
index 25ab7f67..25ab7f67 100644
--- a/taurus/lib/taurus/core/simulation/simfactory.py
+++ b/lib/taurus/core/simulation/simfactory.py
diff --git a/taurus/lib/taurus/core/tango/__init__.py b/lib/taurus/core/tango/__init__.py
index 1b350514..1b350514 100644
--- a/taurus/lib/taurus/core/tango/__init__.py
+++ b/lib/taurus/core/tango/__init__.py
diff --git a/taurus/lib/taurus/core/tango/__taurus_plugin__ b/lib/taurus/core/tango/__taurus_plugin__
index e69de29b..e69de29b 100644
--- a/taurus/lib/taurus/core/tango/__taurus_plugin__
+++ b/lib/taurus/core/tango/__taurus_plugin__
diff --git a/taurus/lib/taurus/core/tango/enums.py b/lib/taurus/core/tango/enums.py
index 08fc9c8f..08fc9c8f 100644
--- a/taurus/lib/taurus/core/tango/enums.py
+++ b/lib/taurus/core/tango/enums.py
diff --git a/taurus/lib/taurus/core/tango/img/__init__.py b/lib/taurus/core/tango/img/__init__.py
index eb95ef43..eb95ef43 100644
--- a/taurus/lib/taurus/core/tango/img/__init__.py
+++ b/lib/taurus/core/tango/img/__init__.py
diff --git a/taurus/lib/taurus/core/tango/img/img.py b/lib/taurus/core/tango/img/img.py
index da2df08a..da2df08a 100644
--- a/taurus/lib/taurus/core/tango/img/img.py
+++ b/lib/taurus/core/tango/img/img.py
diff --git a/taurus/lib/taurus/core/tango/search.py b/lib/taurus/core/tango/search.py
index 0cc84286..0cc84286 100644
--- a/taurus/lib/taurus/core/tango/search.py
+++ b/lib/taurus/core/tango/search.py
diff --git a/taurus/lib/taurus/core/tango/starter.py b/lib/taurus/core/tango/starter.py
index 65b129e9..65b129e9 100644
--- a/taurus/lib/taurus/core/tango/starter.py
+++ b/lib/taurus/core/tango/starter.py
diff --git a/taurus/lib/taurus/core/tango/tangoattribute.py b/lib/taurus/core/tango/tangoattribute.py
index db53e0bc..db53e0bc 100755
--- a/taurus/lib/taurus/core/tango/tangoattribute.py
+++ b/lib/taurus/core/tango/tangoattribute.py
diff --git a/taurus/lib/taurus/core/tango/tangoconfiguration.py b/lib/taurus/core/tango/tangoconfiguration.py
index 23808929..23808929 100644
--- a/taurus/lib/taurus/core/tango/tangoconfiguration.py
+++ b/lib/taurus/core/tango/tangoconfiguration.py
diff --git a/taurus/lib/taurus/core/tango/tangodatabase.py b/lib/taurus/core/tango/tangodatabase.py
index f6c501b7..f6c501b7 100644
--- a/taurus/lib/taurus/core/tango/tangodatabase.py
+++ b/lib/taurus/core/tango/tangodatabase.py
diff --git a/taurus/lib/taurus/core/tango/tangodevice.py b/lib/taurus/core/tango/tangodevice.py
index 2a7114c2..2a7114c2 100644
--- a/taurus/lib/taurus/core/tango/tangodevice.py
+++ b/lib/taurus/core/tango/tangodevice.py
diff --git a/taurus/lib/taurus/core/tango/tangofactory.py b/lib/taurus/core/tango/tangofactory.py
index a9ada49e..a9ada49e 100644
--- a/taurus/lib/taurus/core/tango/tangofactory.py
+++ b/lib/taurus/core/tango/tangofactory.py
diff --git a/taurus/lib/taurus/core/taurusattribute.py b/lib/taurus/core/taurusattribute.py
index 1f66be50..1f66be50 100644
--- a/taurus/lib/taurus/core/taurusattribute.py
+++ b/lib/taurus/core/taurusattribute.py
diff --git a/taurus/lib/taurus/core/taurusbasetypes.py b/lib/taurus/core/taurusbasetypes.py
index f336ee39..f336ee39 100644
--- a/taurus/lib/taurus/core/taurusbasetypes.py
+++ b/lib/taurus/core/taurusbasetypes.py
diff --git a/taurus/lib/taurus/core/taurusconfiguration.py b/lib/taurus/core/taurusconfiguration.py
index 70dfba9f..70dfba9f 100644
--- a/taurus/lib/taurus/core/taurusconfiguration.py
+++ b/lib/taurus/core/taurusconfiguration.py
diff --git a/taurus/lib/taurus/core/taurusdatabase.py b/lib/taurus/core/taurusdatabase.py
index 79f579e4..79f579e4 100644
--- a/taurus/lib/taurus/core/taurusdatabase.py
+++ b/lib/taurus/core/taurusdatabase.py
diff --git a/taurus/lib/taurus/core/taurusdevice.py b/lib/taurus/core/taurusdevice.py
index dabb69b9..dabb69b9 100644
--- a/taurus/lib/taurus/core/taurusdevice.py
+++ b/lib/taurus/core/taurusdevice.py
diff --git a/taurus/lib/taurus/core/taurusexception.py b/lib/taurus/core/taurusexception.py
index 46da9ec4..46da9ec4 100644
--- a/taurus/lib/taurus/core/taurusexception.py
+++ b/lib/taurus/core/taurusexception.py
diff --git a/taurus/lib/taurus/core/taurusfactory.py b/lib/taurus/core/taurusfactory.py
index 29ca8ea2..29ca8ea2 100644
--- a/taurus/lib/taurus/core/taurusfactory.py
+++ b/lib/taurus/core/taurusfactory.py
diff --git a/taurus/lib/taurus/core/taurushelper.py b/lib/taurus/core/taurushelper.py
index dae7c934..dae7c934 100644
--- a/taurus/lib/taurus/core/taurushelper.py
+++ b/lib/taurus/core/taurushelper.py
diff --git a/taurus/lib/taurus/core/tauruslistener.py b/lib/taurus/core/tauruslistener.py
index 3455d176..3455d176 100644
--- a/taurus/lib/taurus/core/tauruslistener.py
+++ b/lib/taurus/core/tauruslistener.py
diff --git a/taurus/lib/taurus/core/taurusmanager.py b/lib/taurus/core/taurusmanager.py
index d140b269..d140b269 100644
--- a/taurus/lib/taurus/core/taurusmanager.py
+++ b/lib/taurus/core/taurusmanager.py
diff --git a/taurus/lib/taurus/core/taurusmodel.py b/lib/taurus/core/taurusmodel.py
index 4f11b9d8..4f11b9d8 100644
--- a/taurus/lib/taurus/core/taurusmodel.py
+++ b/lib/taurus/core/taurusmodel.py
diff --git a/taurus/lib/taurus/core/taurusoperation.py b/lib/taurus/core/taurusoperation.py
index 25117aff..25117aff 100644
--- a/taurus/lib/taurus/core/taurusoperation.py
+++ b/lib/taurus/core/taurusoperation.py
diff --git a/taurus/lib/taurus/core/tauruspollingtimer.py b/lib/taurus/core/tauruspollingtimer.py
index e8eb563b..e8eb563b 100644
--- a/taurus/lib/taurus/core/tauruspollingtimer.py
+++ b/lib/taurus/core/tauruspollingtimer.py
diff --git a/taurus/lib/taurus/core/taurusvalidator.py b/lib/taurus/core/taurusvalidator.py
index 33df99f8..33df99f8 100644
--- a/taurus/lib/taurus/core/taurusvalidator.py
+++ b/lib/taurus/core/taurusvalidator.py
diff --git a/taurus/lib/taurus/core/util/__init__.py b/lib/taurus/core/util/__init__.py
index fa13d8b9..fa13d8b9 100644
--- a/taurus/lib/taurus/core/util/__init__.py
+++ b/lib/taurus/core/util/__init__.py
diff --git a/taurus/lib/taurus/core/util/argparse/__init__.py b/lib/taurus/core/util/argparse/__init__.py
index 3e8e7de1..3e8e7de1 100644
--- a/taurus/lib/taurus/core/util/argparse/__init__.py
+++ b/lib/taurus/core/util/argparse/__init__.py
diff --git a/taurus/lib/taurus/core/util/argparse/taurusargparse.py b/lib/taurus/core/util/argparse/taurusargparse.py
index d8eda877..d8eda877 100644
--- a/taurus/lib/taurus/core/util/argparse/taurusargparse.py
+++ b/lib/taurus/core/util/argparse/taurusargparse.py
diff --git a/taurus/lib/taurus/core/util/codecs.py b/lib/taurus/core/util/codecs.py
index e6899e2a..e6899e2a 100644
--- a/taurus/lib/taurus/core/util/codecs.py
+++ b/lib/taurus/core/util/codecs.py
diff --git a/taurus/lib/taurus/core/util/colors.py b/lib/taurus/core/util/colors.py
index 94c754be..94c754be 100644
--- a/taurus/lib/taurus/core/util/colors.py
+++ b/lib/taurus/core/util/colors.py
diff --git a/taurus/lib/taurus/core/util/console.py b/lib/taurus/core/util/console.py
index 1679b997..1679b997 100644
--- a/taurus/lib/taurus/core/util/console.py
+++ b/lib/taurus/core/util/console.py
diff --git a/taurus/lib/taurus/core/util/constant.py b/lib/taurus/core/util/constant.py
index 37c5aca3..37c5aca3 100644
--- a/taurus/lib/taurus/core/util/constant.py
+++ b/lib/taurus/core/util/constant.py
diff --git a/taurus/lib/taurus/core/util/containers.py b/lib/taurus/core/util/containers.py
index f0b8f327..f0b8f327 100644
--- a/taurus/lib/taurus/core/util/containers.py
+++ b/lib/taurus/core/util/containers.py
diff --git a/taurus/lib/taurus/core/util/decorator/__init__.py b/lib/taurus/core/util/decorator/__init__.py
index e69de29b..e69de29b 100644
--- a/taurus/lib/taurus/core/util/decorator/__init__.py
+++ b/lib/taurus/core/util/decorator/__init__.py
diff --git a/taurus/lib/taurus/core/util/decorator/decorator.py b/lib/taurus/core/util/decorator/decorator.py
index df109a2e..df109a2e 100644
--- a/taurus/lib/taurus/core/util/decorator/decorator.py
+++ b/lib/taurus/core/util/decorator/decorator.py
diff --git a/taurus/lib/taurus/core/util/decorator/deprecated.py b/lib/taurus/core/util/decorator/deprecated.py
index 3e4393d7..3e4393d7 100644
--- a/taurus/lib/taurus/core/util/decorator/deprecated.py
+++ b/lib/taurus/core/util/decorator/deprecated.py
diff --git a/taurus/lib/taurus/core/util/decorator/memoize.py b/lib/taurus/core/util/decorator/memoize.py
index 4dbb1d2e..4dbb1d2e 100644
--- a/taurus/lib/taurus/core/util/decorator/memoize.py
+++ b/lib/taurus/core/util/decorator/memoize.py
diff --git a/taurus/lib/taurus/core/util/decorator/typecheck.py b/lib/taurus/core/util/decorator/typecheck.py
index 932008ce..932008ce 100644
--- a/taurus/lib/taurus/core/util/decorator/typecheck.py
+++ b/lib/taurus/core/util/decorator/typecheck.py
diff --git a/taurus/lib/taurus/core/util/enumeration.py b/lib/taurus/core/util/enumeration.py
index d0adc7aa..d0adc7aa 100644
--- a/taurus/lib/taurus/core/util/enumeration.py
+++ b/lib/taurus/core/util/enumeration.py
diff --git a/taurus/lib/taurus/core/util/event.py b/lib/taurus/core/util/event.py
index 77482252..77482252 100644
--- a/taurus/lib/taurus/core/util/event.py
+++ b/lib/taurus/core/util/event.py
diff --git a/taurus/lib/taurus/core/util/eventfilters.py b/lib/taurus/core/util/eventfilters.py
index 8dc52a1d..8dc52a1d 100644
--- a/taurus/lib/taurus/core/util/eventfilters.py
+++ b/lib/taurus/core/util/eventfilters.py
diff --git a/taurus/lib/taurus/core/util/excepthook.py b/lib/taurus/core/util/excepthook.py
index 1cbb6268..1cbb6268 100644
--- a/taurus/lib/taurus/core/util/excepthook.py
+++ b/lib/taurus/core/util/excepthook.py
diff --git a/taurus/lib/taurus/core/util/init_bkcomp.py b/lib/taurus/core/util/init_bkcomp.py
index 2dedc28b..2dedc28b 100644
--- a/taurus/lib/taurus/core/util/init_bkcomp.py
+++ b/lib/taurus/core/util/init_bkcomp.py
diff --git a/taurus/lib/taurus/core/util/init_lightweight.py b/lib/taurus/core/util/init_lightweight.py
index a52b2501..a52b2501 100644
--- a/taurus/lib/taurus/core/util/init_lightweight.py
+++ b/lib/taurus/core/util/init_lightweight.py
diff --git a/taurus/lib/taurus/core/util/lock.py b/lib/taurus/core/util/lock.py
index ed547a86..ed547a86 100644
--- a/taurus/lib/taurus/core/util/lock.py
+++ b/lib/taurus/core/util/lock.py
diff --git a/taurus/lib/taurus/core/util/log.py b/lib/taurus/core/util/log.py
index aa98e871..aa98e871 100644
--- a/taurus/lib/taurus/core/util/log.py
+++ b/lib/taurus/core/util/log.py
diff --git a/taurus/lib/taurus/core/util/object.py b/lib/taurus/core/util/object.py
index d61bb2d1..d61bb2d1 100644
--- a/taurus/lib/taurus/core/util/object.py
+++ b/lib/taurus/core/util/object.py
diff --git a/taurus/lib/taurus/core/util/prop.py b/lib/taurus/core/util/prop.py
index 647c4284..647c4284 100644
--- a/taurus/lib/taurus/core/util/prop.py
+++ b/lib/taurus/core/util/prop.py
diff --git a/taurus/lib/taurus/core/util/property_parser.py b/lib/taurus/core/util/property_parser.py
index b5e4fc60..b5e4fc60 100644
--- a/taurus/lib/taurus/core/util/property_parser.py
+++ b/lib/taurus/core/util/property_parser.py
diff --git a/taurus/lib/taurus/core/util/propertyfile.py b/lib/taurus/core/util/propertyfile.py
index 14082b95..14082b95 100644
--- a/taurus/lib/taurus/core/util/propertyfile.py
+++ b/lib/taurus/core/util/propertyfile.py
diff --git a/taurus/lib/taurus/core/util/remotelogmonitor.py b/lib/taurus/core/util/remotelogmonitor.py
index 87940b52..87940b52 100644
--- a/taurus/lib/taurus/core/util/remotelogmonitor.py
+++ b/lib/taurus/core/util/remotelogmonitor.py
diff --git a/taurus/lib/taurus/core/util/report/__init__.py b/lib/taurus/core/util/report/__init__.py
index b0f01bfa..b0f01bfa 100644
--- a/taurus/lib/taurus/core/util/report/__init__.py
+++ b/lib/taurus/core/util/report/__init__.py
diff --git a/taurus/lib/taurus/core/util/report/report.py b/lib/taurus/core/util/report/report.py
index 229fdde8..229fdde8 100644
--- a/taurus/lib/taurus/core/util/report/report.py
+++ b/lib/taurus/core/util/report/report.py
diff --git a/taurus/lib/taurus/core/util/safeeval.py b/lib/taurus/core/util/safeeval.py
index 77cd312b..77cd312b 100644
--- a/taurus/lib/taurus/core/util/safeeval.py
+++ b/lib/taurus/core/util/safeeval.py
diff --git a/taurus/lib/taurus/core/util/singleton.py b/lib/taurus/core/util/singleton.py
index ba8edc13..ba8edc13 100644
--- a/taurus/lib/taurus/core/util/singleton.py
+++ b/lib/taurus/core/util/singleton.py
diff --git a/taurus/lib/taurus/core/util/sourcecode.py b/lib/taurus/core/util/sourcecode.py
index ef260400..ef260400 100644
--- a/taurus/lib/taurus/core/util/sourcecode.py
+++ b/lib/taurus/core/util/sourcecode.py
diff --git a/taurus/lib/taurus/core/util/tablepprint.py b/lib/taurus/core/util/tablepprint.py
index 0e166efa..0e166efa 100644
--- a/taurus/lib/taurus/core/util/tablepprint.py
+++ b/lib/taurus/core/util/tablepprint.py
diff --git a/taurus/lib/taurus/core/util/tb.py b/lib/taurus/core/util/tb.py
index ff11cc16..ff11cc16 100644
--- a/taurus/lib/taurus/core/util/tb.py
+++ b/lib/taurus/core/util/tb.py
diff --git a/taurus/lib/taurus/core/util/test/__init__.py b/lib/taurus/core/util/test/__init__.py
index 55515271..55515271 100644
--- a/taurus/lib/taurus/core/util/test/__init__.py
+++ b/lib/taurus/core/util/test/__init__.py
diff --git a/taurus/lib/taurus/core/util/test/test_codecs.py b/lib/taurus/core/util/test/test_codecs.py
index 71f1fbbd..71f1fbbd 100644
--- a/taurus/lib/taurus/core/util/test/test_codecs.py
+++ b/lib/taurus/core/util/test/test_codecs.py
diff --git a/taurus/lib/taurus/core/util/test/test_timer.py b/lib/taurus/core/util/test/test_timer.py
index 9ae18983..9ae18983 100644
--- a/taurus/lib/taurus/core/util/test/test_timer.py
+++ b/lib/taurus/core/util/test/test_timer.py
diff --git a/taurus/lib/taurus/core/util/threadpool.py b/lib/taurus/core/util/threadpool.py
index 445e4ff0..445e4ff0 100644
--- a/taurus/lib/taurus/core/util/threadpool.py
+++ b/lib/taurus/core/util/threadpool.py
diff --git a/taurus/lib/taurus/core/util/timer.py b/lib/taurus/core/util/timer.py
index fd87aa0d..fd87aa0d 100644
--- a/taurus/lib/taurus/core/util/timer.py
+++ b/lib/taurus/core/util/timer.py
diff --git a/taurus/lib/taurus/core/util/user.py b/lib/taurus/core/util/user.py
index fe55d3e5..fe55d3e5 100644
--- a/taurus/lib/taurus/core/util/user.py
+++ b/lib/taurus/core/util/user.py
diff --git a/taurus/lib/taurus/core/util/whichexecutable.py b/lib/taurus/core/util/whichexecutable.py
index 63994814..63994814 100644
--- a/taurus/lib/taurus/core/util/whichexecutable.py
+++ b/lib/taurus/core/util/whichexecutable.py
diff --git a/taurus/lib/taurus/core/util/wrap.py b/lib/taurus/core/util/wrap.py
index bf82c22e..bf82c22e 100644
--- a/taurus/lib/taurus/core/util/wrap.py
+++ b/lib/taurus/core/util/wrap.py
diff --git a/taurus/lib/taurus/core/utils/__init__.py b/lib/taurus/core/utils/__init__.py
index 9ec35d75..9ec35d75 100644
--- a/taurus/lib/taurus/core/utils/__init__.py
+++ b/lib/taurus/core/utils/__init__.py
diff --git a/taurus/lib/taurus/external/__init__.py b/lib/taurus/external/__init__.py
index f36e7b8d..f36e7b8d 100644
--- a/taurus/lib/taurus/external/__init__.py
+++ b/lib/taurus/external/__init__.py
diff --git a/taurus/lib/taurus/external/argparse/LICENSE.txt b/lib/taurus/external/argparse/LICENSE.txt
index 640bc780..640bc780 100644
--- a/taurus/lib/taurus/external/argparse/LICENSE.txt
+++ b/lib/taurus/external/argparse/LICENSE.txt
diff --git a/taurus/lib/taurus/external/argparse/__init__.py b/lib/taurus/external/argparse/__init__.py
index 85129e61..85129e61 100644
--- a/taurus/lib/taurus/external/argparse/__init__.py
+++ b/lib/taurus/external/argparse/__init__.py
diff --git a/taurus/lib/taurus/external/argparse/argparse_local.py b/lib/taurus/external/argparse/argparse_local.py
index 32d948c0..32d948c0 100644
--- a/taurus/lib/taurus/external/argparse/argparse_local.py
+++ b/lib/taurus/external/argparse/argparse_local.py
diff --git a/taurus/lib/taurus/external/enum/__init__.py b/lib/taurus/external/enum/__init__.py
index 827e9c0d..827e9c0d 100644
--- a/taurus/lib/taurus/external/enum/__init__.py
+++ b/lib/taurus/external/enum/__init__.py
diff --git a/taurus/lib/taurus/external/enum/enum/__init__.py b/lib/taurus/external/enum/enum/__init__.py
index ff3d5fc3..ff3d5fc3 100644
--- a/taurus/lib/taurus/external/enum/enum/__init__.py
+++ b/lib/taurus/external/enum/enum/__init__.py
diff --git a/taurus/lib/taurus/external/ordereddict/__init__.py b/lib/taurus/external/ordereddict/__init__.py
index caf0c371..caf0c371 100644
--- a/taurus/lib/taurus/external/ordereddict/__init__.py
+++ b/lib/taurus/external/ordereddict/__init__.py
diff --git a/taurus/lib/taurus/external/ordereddict/ordereddict.py b/lib/taurus/external/ordereddict/ordereddict.py
index f09d2617..f09d2617 100644
--- a/taurus/lib/taurus/external/ordereddict/ordereddict.py
+++ b/lib/taurus/external/ordereddict/ordereddict.py
diff --git a/taurus/lib/taurus/external/pint/__init__.py b/lib/taurus/external/pint/__init__.py
index 5bebb89e..5bebb89e 100644
--- a/taurus/lib/taurus/external/pint/__init__.py
+++ b/lib/taurus/external/pint/__init__.py
diff --git a/taurus/lib/taurus/external/pint/pint/__init__.py b/lib/taurus/external/pint/pint/__init__.py
index 468c3859..468c3859 100644
--- a/taurus/lib/taurus/external/pint/pint/__init__.py
+++ b/lib/taurus/external/pint/pint/__init__.py
diff --git a/taurus/lib/taurus/external/pint/pint/compat.py b/lib/taurus/external/pint/pint/compat.py
index 7752d59a..7752d59a 100644
--- a/taurus/lib/taurus/external/pint/pint/compat.py
+++ b/lib/taurus/external/pint/pint/compat.py
diff --git a/taurus/lib/taurus/external/pint/pint/constants_en.txt b/lib/taurus/external/pint/pint/constants_en.txt
index b628d418..b628d418 100644
--- a/taurus/lib/taurus/external/pint/pint/constants_en.txt
+++ b/lib/taurus/external/pint/pint/constants_en.txt
diff --git a/taurus/lib/taurus/external/pint/pint/context.py b/lib/taurus/external/pint/pint/context.py
index 08829444..08829444 100644
--- a/taurus/lib/taurus/external/pint/pint/context.py
+++ b/lib/taurus/external/pint/pint/context.py
diff --git a/taurus/lib/taurus/external/pint/pint/default_en.txt b/lib/taurus/external/pint/pint/default_en.txt
index 637a71c8..637a71c8 100644
--- a/taurus/lib/taurus/external/pint/pint/default_en.txt
+++ b/lib/taurus/external/pint/pint/default_en.txt
diff --git a/taurus/lib/taurus/external/pint/pint/measurement.py b/lib/taurus/external/pint/pint/measurement.py
index 346ce0c6..346ce0c6 100644
--- a/taurus/lib/taurus/external/pint/pint/measurement.py
+++ b/lib/taurus/external/pint/pint/measurement.py
diff --git a/taurus/lib/taurus/external/pint/pint/quantity.py b/lib/taurus/external/pint/pint/quantity.py
index dcdf25e6..dcdf25e6 100644
--- a/taurus/lib/taurus/external/pint/pint/quantity.py
+++ b/lib/taurus/external/pint/pint/quantity.py
diff --git a/taurus/lib/taurus/external/pint/pint/unit.py b/lib/taurus/external/pint/pint/unit.py
index ea77c791..ea77c791 100644
--- a/taurus/lib/taurus/external/pint/pint/unit.py
+++ b/lib/taurus/external/pint/pint/unit.py
diff --git a/taurus/lib/taurus/external/pint/pint/util.py b/lib/taurus/external/pint/pint/util.py
index 9a81ae14..9a81ae14 100644
--- a/taurus/lib/taurus/external/pint/pint/util.py
+++ b/lib/taurus/external/pint/pint/util.py
diff --git a/taurus/lib/taurus/external/qt/Qt.py b/lib/taurus/external/qt/Qt.py
index c6dfebbf..c6dfebbf 100644
--- a/taurus/lib/taurus/external/qt/Qt.py
+++ b/lib/taurus/external/qt/Qt.py
diff --git a/taurus/lib/taurus/external/qt/QtCore.py b/lib/taurus/external/qt/QtCore.py
index c276dfd0..c276dfd0 100644
--- a/taurus/lib/taurus/external/qt/QtCore.py
+++ b/lib/taurus/external/qt/QtCore.py
diff --git a/taurus/lib/taurus/external/qt/QtDesigner.py b/lib/taurus/external/qt/QtDesigner.py
index e38e3e03..e38e3e03 100644
--- a/taurus/lib/taurus/external/qt/QtDesigner.py
+++ b/lib/taurus/external/qt/QtDesigner.py
diff --git a/taurus/lib/taurus/external/qt/QtGui.py b/lib/taurus/external/qt/QtGui.py
index bbbf0232..bbbf0232 100644
--- a/taurus/lib/taurus/external/qt/QtGui.py
+++ b/lib/taurus/external/qt/QtGui.py
diff --git a/taurus/lib/taurus/external/qt/QtHelp.py b/lib/taurus/external/qt/QtHelp.py
index ce467bf4..ce467bf4 100644
--- a/taurus/lib/taurus/external/qt/QtHelp.py
+++ b/lib/taurus/external/qt/QtHelp.py
diff --git a/taurus/lib/taurus/external/qt/QtNetwork.py b/lib/taurus/external/qt/QtNetwork.py
index f807a320..f807a320 100644
--- a/taurus/lib/taurus/external/qt/QtNetwork.py
+++ b/lib/taurus/external/qt/QtNetwork.py
diff --git a/taurus/lib/taurus/external/qt/QtSvg.py b/lib/taurus/external/qt/QtSvg.py
index a806a57b..a806a57b 100644
--- a/taurus/lib/taurus/external/qt/QtSvg.py
+++ b/lib/taurus/external/qt/QtSvg.py
diff --git a/taurus/lib/taurus/external/qt/QtUiTools.py b/lib/taurus/external/qt/QtUiTools.py
index 4360ca35..4360ca35 100644
--- a/taurus/lib/taurus/external/qt/QtUiTools.py
+++ b/lib/taurus/external/qt/QtUiTools.py
diff --git a/taurus/lib/taurus/external/qt/QtWebKit.py b/lib/taurus/external/qt/QtWebKit.py
index 2135721a..2135721a 100644
--- a/taurus/lib/taurus/external/qt/QtWebKit.py
+++ b/lib/taurus/external/qt/QtWebKit.py
diff --git a/taurus/lib/taurus/external/qt/Qwt5.py b/lib/taurus/external/qt/Qwt5.py
index aba6c690..aba6c690 100644
--- a/taurus/lib/taurus/external/qt/Qwt5.py
+++ b/lib/taurus/external/qt/Qwt5.py
diff --git a/taurus/lib/taurus/external/qt/__init__.py b/lib/taurus/external/qt/__init__.py
index d7ddbd9e..d7ddbd9e 100644
--- a/taurus/lib/taurus/external/qt/__init__.py
+++ b/lib/taurus/external/qt/__init__.py
diff --git a/taurus/lib/taurus/external/qt/uic.py b/lib/taurus/external/qt/uic.py
index 2f37e800..2f37e800 100644
--- a/taurus/lib/taurus/external/qt/uic.py
+++ b/lib/taurus/external/qt/uic.py
diff --git a/taurus/lib/taurus/external/test/__init__.py b/lib/taurus/external/test/__init__.py
index f36e7b8d..f36e7b8d 100644
--- a/taurus/lib/taurus/external/test/__init__.py
+++ b/lib/taurus/external/test/__init__.py
diff --git a/taurus/lib/taurus/external/test/test_qt.py b/lib/taurus/external/test/test_qt.py
index 00935b71..00935b71 100644
--- a/taurus/lib/taurus/external/test/test_qt.py
+++ b/lib/taurus/external/test/test_qt.py
diff --git a/taurus/lib/taurus/external/unittest/__init__.py b/lib/taurus/external/unittest/__init__.py
index c03c3547..c03c3547 100644
--- a/taurus/lib/taurus/external/unittest/__init__.py
+++ b/lib/taurus/external/unittest/__init__.py
diff --git a/taurus/lib/taurus/qt/Qt.py b/lib/taurus/qt/Qt.py
index fe51e012..fe51e012 100644
--- a/taurus/lib/taurus/qt/Qt.py
+++ b/lib/taurus/qt/Qt.py
diff --git a/taurus/lib/taurus/qt/QtCore.py b/lib/taurus/qt/QtCore.py
index e495d963..e495d963 100644
--- a/taurus/lib/taurus/qt/QtCore.py
+++ b/lib/taurus/qt/QtCore.py
diff --git a/taurus/lib/taurus/qt/QtDesigner.py b/lib/taurus/qt/QtDesigner.py
index 5a12bcc3..5a12bcc3 100644
--- a/taurus/lib/taurus/qt/QtDesigner.py
+++ b/lib/taurus/qt/QtDesigner.py
diff --git a/taurus/lib/taurus/qt/QtGui.py b/lib/taurus/qt/QtGui.py
index 3173fa89..3173fa89 100644
--- a/taurus/lib/taurus/qt/QtGui.py
+++ b/lib/taurus/qt/QtGui.py
diff --git a/taurus/lib/taurus/qt/QtNetwork.py b/lib/taurus/qt/QtNetwork.py
index 8c320560..8c320560 100644
--- a/taurus/lib/taurus/qt/QtNetwork.py
+++ b/lib/taurus/qt/QtNetwork.py
diff --git a/taurus/lib/taurus/qt/QtSvg.py b/lib/taurus/qt/QtSvg.py
index 6cd41d28..6cd41d28 100644
--- a/taurus/lib/taurus/qt/QtSvg.py
+++ b/lib/taurus/qt/QtSvg.py
diff --git a/taurus/lib/taurus/qt/QtUiTools.py b/lib/taurus/qt/QtUiTools.py
index 33060e7d..33060e7d 100644
--- a/taurus/lib/taurus/qt/QtUiTools.py
+++ b/lib/taurus/qt/QtUiTools.py
diff --git a/taurus/lib/taurus/qt/QtWebKit.py b/lib/taurus/qt/QtWebKit.py
index a6746c82..a6746c82 100644
--- a/taurus/lib/taurus/qt/QtWebKit.py
+++ b/lib/taurus/qt/QtWebKit.py
diff --git a/taurus/lib/taurus/qt/Qwt5.py b/lib/taurus/qt/Qwt5.py
index d88d9e3c..d88d9e3c 100644
--- a/taurus/lib/taurus/qt/Qwt5.py
+++ b/lib/taurus/qt/Qwt5.py
diff --git a/taurus/lib/taurus/qt/__init__.py b/lib/taurus/qt/__init__.py
index c8595b55..c8595b55 100644
--- a/taurus/lib/taurus/qt/__init__.py
+++ b/lib/taurus/qt/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/__init__.py b/lib/taurus/qt/qtcore/__init__.py
index 39c21a44..39c21a44 100644
--- a/taurus/lib/taurus/qt/qtcore/__init__.py
+++ b/lib/taurus/qt/qtcore/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/communication/__init__.py b/lib/taurus/qt/qtcore/communication/__init__.py
index eb8be41b..eb8be41b 100644
--- a/taurus/lib/taurus/qt/qtcore/communication/__init__.py
+++ b/lib/taurus/qt/qtcore/communication/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/communication/communication.py b/lib/taurus/qt/qtcore/communication/communication.py
index 13746f5b..13746f5b 100644
--- a/taurus/lib/taurus/qt/qtcore/communication/communication.py
+++ b/lib/taurus/qt/qtcore/communication/communication.py
diff --git a/taurus/lib/taurus/qt/qtcore/configuration/__init__.py b/lib/taurus/qt/qtcore/configuration/__init__.py
index 155bd621..155bd621 100644
--- a/taurus/lib/taurus/qt/qtcore/configuration/__init__.py
+++ b/lib/taurus/qt/qtcore/configuration/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/configuration/configuration.py b/lib/taurus/qt/qtcore/configuration/configuration.py
index 0227f35b..0227f35b 100644
--- a/taurus/lib/taurus/qt/qtcore/configuration/configuration.py
+++ b/lib/taurus/qt/qtcore/configuration/configuration.py
diff --git a/taurus/lib/taurus/qt/qtcore/mimetypes/__init__.py b/lib/taurus/qt/qtcore/mimetypes/__init__.py
index 0f907020..0f907020 100644
--- a/taurus/lib/taurus/qt/qtcore/mimetypes/__init__.py
+++ b/lib/taurus/qt/qtcore/mimetypes/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/mimetypes/mimetypes.py b/lib/taurus/qt/qtcore/mimetypes/mimetypes.py
index b937054f..b937054f 100644
--- a/taurus/lib/taurus/qt/qtcore/mimetypes/mimetypes.py
+++ b/lib/taurus/qt/qtcore/mimetypes/mimetypes.py
diff --git a/taurus/lib/taurus/qt/qtcore/model/__init__.py b/lib/taurus/qt/qtcore/model/__init__.py
index a6964577..a6964577 100644
--- a/taurus/lib/taurus/qt/qtcore/model/__init__.py
+++ b/lib/taurus/qt/qtcore/model/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/model/taurusdatabasemodel.py b/lib/taurus/qt/qtcore/model/taurusdatabasemodel.py
index 25e9ef8b..25e9ef8b 100644
--- a/taurus/lib/taurus/qt/qtcore/model/taurusdatabasemodel.py
+++ b/lib/taurus/qt/qtcore/model/taurusdatabasemodel.py
diff --git a/taurus/lib/taurus/qt/qtcore/model/taurusmodel.py b/lib/taurus/qt/qtcore/model/taurusmodel.py
index 5e2efc81..5e2efc81 100644
--- a/taurus/lib/taurus/qt/qtcore/model/taurusmodel.py
+++ b/lib/taurus/qt/qtcore/model/taurusmodel.py
diff --git a/taurus/lib/taurus/qt/qtcore/tango/__init__.py b/lib/taurus/qt/qtcore/tango/__init__.py
index c4dcead7..c4dcead7 100644
--- a/taurus/lib/taurus/qt/qtcore/tango/__init__.py
+++ b/lib/taurus/qt/qtcore/tango/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/taurusqlistener.py b/lib/taurus/qt/qtcore/taurusqlistener.py
index a674286a..a674286a 100644
--- a/taurus/lib/taurus/qt/qtcore/taurusqlistener.py
+++ b/lib/taurus/qt/qtcore/taurusqlistener.py
diff --git a/taurus/lib/taurus/qt/qtcore/util/__init__.py b/lib/taurus/qt/qtcore/util/__init__.py
index 09b8922e..09b8922e 100644
--- a/taurus/lib/taurus/qt/qtcore/util/__init__.py
+++ b/lib/taurus/qt/qtcore/util/__init__.py
diff --git a/taurus/lib/taurus/qt/qtcore/util/emitter.py b/lib/taurus/qt/qtcore/util/emitter.py
index 8298a619..8298a619 100644
--- a/taurus/lib/taurus/qt/qtcore/util/emitter.py
+++ b/lib/taurus/qt/qtcore/util/emitter.py
diff --git a/taurus/lib/taurus/qt/qtcore/util/properties.py b/lib/taurus/qt/qtcore/util/properties.py
index 843804b5..843804b5 100644
--- a/taurus/lib/taurus/qt/qtcore/util/properties.py
+++ b/lib/taurus/qt/qtcore/util/properties.py
diff --git a/taurus/lib/taurus/qt/qtcore/util/tauruslog.py b/lib/taurus/qt/qtcore/util/tauruslog.py
index 69cf4410..69cf4410 100644
--- a/taurus/lib/taurus/qt/qtcore/util/tauruslog.py
+++ b/lib/taurus/qt/qtcore/util/tauruslog.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/__init__.py b/lib/taurus/qt/qtdesigner/__init__.py
index fff65191..fff65191 100644
--- a/taurus/lib/taurus/qt/qtdesigner/__init__.py
+++ b/lib/taurus/qt/qtdesigner/__init__.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/containerplugin.py b/lib/taurus/qt/qtdesigner/containerplugin.py
index 2b75647e..2b75647e 100644
--- a/taurus/lib/taurus/qt/qtdesigner/containerplugin.py
+++ b/lib/taurus/qt/qtdesigner/containerplugin.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/extraguiqwtplugin.py b/lib/taurus/qt/qtdesigner/extraguiqwtplugin.py
index e32da5d6..e32da5d6 100644
--- a/taurus/lib/taurus/qt/qtdesigner/extraguiqwtplugin.py
+++ b/lib/taurus/qt/qtdesigner/extraguiqwtplugin.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/taurusdesigner.py b/lib/taurus/qt/qtdesigner/taurusdesigner.py
index 3e7f1271..3e7f1271 100644
--- a/taurus/lib/taurus/qt/qtdesigner/taurusdesigner.py
+++ b/lib/taurus/qt/qtdesigner/taurusdesigner.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/taurusplugin/__init__.py b/lib/taurus/qt/qtdesigner/taurusplugin/__init__.py
index 2121a3d6..2121a3d6 100644
--- a/taurus/lib/taurus/qt/qtdesigner/taurusplugin/__init__.py
+++ b/lib/taurus/qt/qtdesigner/taurusplugin/__init__.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/taurusplugin/taurusplugin.py b/lib/taurus/qt/qtdesigner/taurusplugin/taurusplugin.py
index 09d6d006..09d6d006 100644
--- a/taurus/lib/taurus/qt/qtdesigner/taurusplugin/taurusplugin.py
+++ b/lib/taurus/qt/qtdesigner/taurusplugin/taurusplugin.py
diff --git a/taurus/lib/taurus/qt/qtdesigner/tauruspluginplugin.py b/lib/taurus/qt/qtdesigner/tauruspluginplugin.py
index 82c0928e..82c0928e 100644
--- a/taurus/lib/taurus/qt/qtdesigner/tauruspluginplugin.py
+++ b/lib/taurus/qt/qtdesigner/tauruspluginplugin.py
diff --git a/taurus/lib/taurus/qt/qtgui/__init__.py b/lib/taurus/qt/qtgui/__init__.py
index e8a8ebcf..e8a8ebcf 100644
--- a/taurus/lib/taurus/qt/qtgui/__init__.py
+++ b/lib/taurus/qt/qtgui/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/application/__init__.py b/lib/taurus/qt/qtgui/application/__init__.py
index ad39dcd8..ad39dcd8 100644
--- a/taurus/lib/taurus/qt/qtgui/application/__init__.py
+++ b/lib/taurus/qt/qtgui/application/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/application/taurusapplication.py b/lib/taurus/qt/qtgui/application/taurusapplication.py
index b123bd75..b123bd75 100644
--- a/taurus/lib/taurus/qt/qtgui/application/taurusapplication.py
+++ b/lib/taurus/qt/qtgui/application/taurusapplication.py
diff --git a/taurus/lib/taurus/qt/qtgui/base/__init__.py b/lib/taurus/qt/qtgui/base/__init__.py
index 6caebb38..6caebb38 100644
--- a/taurus/lib/taurus/qt/qtgui/base/__init__.py
+++ b/lib/taurus/qt/qtgui/base/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/base/taurusbase.py b/lib/taurus/qt/qtgui/base/taurusbase.py
index 3ee23e58..3ee23e58 100644
--- a/taurus/lib/taurus/qt/qtgui/base/taurusbase.py
+++ b/lib/taurus/qt/qtgui/base/taurusbase.py
diff --git a/taurus/lib/taurus/qt/qtgui/base/tauruscontroller.py b/lib/taurus/qt/qtgui/base/tauruscontroller.py
index e0342aa7..e0342aa7 100644
--- a/taurus/lib/taurus/qt/qtgui/base/tauruscontroller.py
+++ b/lib/taurus/qt/qtgui/base/tauruscontroller.py
diff --git a/taurus/lib/taurus/qt/qtgui/base/taurusqattribute.py b/lib/taurus/qt/qtgui/base/taurusqattribute.py
index 382addef..382addef 100644
--- a/taurus/lib/taurus/qt/qtgui/base/taurusqattribute.py
+++ b/lib/taurus/qt/qtgui/base/taurusqattribute.py
diff --git a/taurus/lib/taurus/qt/qtgui/button/__init__.py b/lib/taurus/qt/qtgui/button/__init__.py
index 69bbade8..69bbade8 100644
--- a/taurus/lib/taurus/qt/qtgui/button/__init__.py
+++ b/lib/taurus/qt/qtgui/button/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/button/qbuttonbox.py b/lib/taurus/qt/qtgui/button/qbuttonbox.py
index 7a89fcb7..7a89fcb7 100644
--- a/taurus/lib/taurus/qt/qtgui/button/qbuttonbox.py
+++ b/lib/taurus/qt/qtgui/button/qbuttonbox.py
diff --git a/taurus/lib/taurus/qt/qtgui/button/taurusbutton.py b/lib/taurus/qt/qtgui/button/taurusbutton.py
index 9e049d14..9e049d14 100644
--- a/taurus/lib/taurus/qt/qtgui/button/taurusbutton.py
+++ b/lib/taurus/qt/qtgui/button/taurusbutton.py
diff --git a/taurus/lib/taurus/qt/qtgui/button/test/__init__.py b/lib/taurus/qt/qtgui/button/test/__init__.py
index e0970321..e0970321 100644
--- a/taurus/lib/taurus/qt/qtgui/button/test/__init__.py
+++ b/lib/taurus/qt/qtgui/button/test/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/button/test/res/Timeout b/lib/taurus/qt/qtgui/button/test/res/Timeout
index ac71f62f..ac71f62f 100755
--- a/taurus/lib/taurus/qt/qtgui/button/test/res/Timeout
+++ b/lib/taurus/qt/qtgui/button/test/res/Timeout
diff --git a/taurus/lib/taurus/qt/qtgui/button/test/res/__init__.py b/lib/taurus/qt/qtgui/button/test/res/__init__.py
index 9503bcab..9503bcab 100644
--- a/taurus/lib/taurus/qt/qtgui/button/test/res/__init__.py
+++ b/lib/taurus/qt/qtgui/button/test/res/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/button/test/test_taurusbutton.py b/lib/taurus/qt/qtgui/button/test/test_taurusbutton.py
index b40e5d09..b40e5d09 100644
--- a/taurus/lib/taurus/qt/qtgui/button/test/test_taurusbutton.py
+++ b/lib/taurus/qt/qtgui/button/test/test_taurusbutton.py
diff --git a/taurus/lib/taurus/qt/qtgui/compact/__init__.py b/lib/taurus/qt/qtgui/compact/__init__.py
index 3e453f46..3e453f46 100644
--- a/taurus/lib/taurus/qt/qtgui/compact/__init__.py
+++ b/lib/taurus/qt/qtgui/compact/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/compact/abstractswitcher.py b/lib/taurus/qt/qtgui/compact/abstractswitcher.py
index 2a890af4..2a890af4 100644
--- a/taurus/lib/taurus/qt/qtgui/compact/abstractswitcher.py
+++ b/lib/taurus/qt/qtgui/compact/abstractswitcher.py
diff --git a/taurus/lib/taurus/qt/qtgui/compact/basicswitcher.py b/lib/taurus/qt/qtgui/compact/basicswitcher.py
index 27535411..27535411 100644
--- a/taurus/lib/taurus/qt/qtgui/compact/basicswitcher.py
+++ b/lib/taurus/qt/qtgui/compact/basicswitcher.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/__init__.py b/lib/taurus/qt/qtgui/console/__init__.py
index dd60b84c..dd60b84c 100644
--- a/taurus/lib/taurus/qt/qtgui/console/__init__.py
+++ b/lib/taurus/qt/qtgui/console/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/taurusconsole.py b/lib/taurus/qt/qtgui/console/taurusconsole.py
index f87cb37e..f87cb37e 100644
--- a/taurus/lib/taurus/qt/qtgui/console/taurusconsole.py
+++ b/lib/taurus/qt/qtgui/console/taurusconsole.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/taurusconsoleapplication.py b/lib/taurus/qt/qtgui/console/taurusconsoleapplication.py
index f69e02a1..f69e02a1 100644
--- a/taurus/lib/taurus/qt/qtgui/console/taurusconsoleapplication.py
+++ b/lib/taurus/qt/qtgui/console/taurusconsoleapplication.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/taurusconsoleextensions.py b/lib/taurus/qt/qtgui/console/taurusconsoleextensions.py
index cdbe0f10..cdbe0f10 100644
--- a/taurus/lib/taurus/qt/qtgui/console/taurusconsoleextensions.py
+++ b/lib/taurus/qt/qtgui/console/taurusconsoleextensions.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/taurusconsolefactory.py b/lib/taurus/qt/qtgui/console/taurusconsolefactory.py
index 6ca57cdf..6ca57cdf 100644
--- a/taurus/lib/taurus/qt/qtgui/console/taurusconsolefactory.py
+++ b/lib/taurus/qt/qtgui/console/taurusconsolefactory.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/taurusconsolewidget.py b/lib/taurus/qt/qtgui/console/taurusconsolewidget.py
index 1276aa44..1276aa44 100644
--- a/taurus/lib/taurus/qt/qtgui/console/taurusconsolewidget.py
+++ b/lib/taurus/qt/qtgui/console/taurusconsolewidget.py
diff --git a/taurus/lib/taurus/qt/qtgui/console/taurusconsolewindow.py b/lib/taurus/qt/qtgui/console/taurusconsolewindow.py
index aa14233f..aa14233f 100644
--- a/taurus/lib/taurus/qt/qtgui/console/taurusconsolewindow.py
+++ b/lib/taurus/qt/qtgui/console/taurusconsolewindow.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/__init__.py b/lib/taurus/qt/qtgui/container/__init__.py
index bf7bad06..bf7bad06 100644
--- a/taurus/lib/taurus/qt/qtgui/container/__init__.py
+++ b/lib/taurus/qt/qtgui/container/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/qcontainer.py b/lib/taurus/qt/qtgui/container/qcontainer.py
index 7c3faf89..7c3faf89 100644
--- a/taurus/lib/taurus/qt/qtgui/container/qcontainer.py
+++ b/lib/taurus/qt/qtgui/container/qcontainer.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/taurusbasecontainer.py b/lib/taurus/qt/qtgui/container/taurusbasecontainer.py
index 7f73194e..7f73194e 100644
--- a/taurus/lib/taurus/qt/qtgui/container/taurusbasecontainer.py
+++ b/lib/taurus/qt/qtgui/container/taurusbasecontainer.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/taurusframe.py b/lib/taurus/qt/qtgui/container/taurusframe.py
index cb76e792..cb76e792 100644
--- a/taurus/lib/taurus/qt/qtgui/container/taurusframe.py
+++ b/lib/taurus/qt/qtgui/container/taurusframe.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/taurusgroupbox.py b/lib/taurus/qt/qtgui/container/taurusgroupbox.py
index d8ce215b..d8ce215b 100644
--- a/taurus/lib/taurus/qt/qtgui/container/taurusgroupbox.py
+++ b/lib/taurus/qt/qtgui/container/taurusgroupbox.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/taurusgroupwidget.py b/lib/taurus/qt/qtgui/container/taurusgroupwidget.py
index ef9bcde2..ef9bcde2 100644
--- a/taurus/lib/taurus/qt/qtgui/container/taurusgroupwidget.py
+++ b/lib/taurus/qt/qtgui/container/taurusgroupwidget.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/taurusmainwindow.py b/lib/taurus/qt/qtgui/container/taurusmainwindow.py
index fc7b141e..fc7b141e 100644
--- a/taurus/lib/taurus/qt/qtgui/container/taurusmainwindow.py
+++ b/lib/taurus/qt/qtgui/container/taurusmainwindow.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/taurusscrollarea.py b/lib/taurus/qt/qtgui/container/taurusscrollarea.py
index 37b34705..37b34705 100644
--- a/taurus/lib/taurus/qt/qtgui/container/taurusscrollarea.py
+++ b/lib/taurus/qt/qtgui/container/taurusscrollarea.py
diff --git a/taurus/lib/taurus/qt/qtgui/container/tauruswidget.py b/lib/taurus/qt/qtgui/container/tauruswidget.py
index 4d182e66..4d182e66 100644
--- a/taurus/lib/taurus/qt/qtgui/container/tauruswidget.py
+++ b/lib/taurus/qt/qtgui/container/tauruswidget.py
diff --git a/taurus/lib/taurus/qt/qtgui/dialog/__init__.py b/lib/taurus/qt/qtgui/dialog/__init__.py
index 39f09612..39f09612 100644
--- a/taurus/lib/taurus/qt/qtgui/dialog/__init__.py
+++ b/lib/taurus/qt/qtgui/dialog/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/dialog/taurusconfigurationdialog.py b/lib/taurus/qt/qtgui/dialog/taurusconfigurationdialog.py
index e339e006..e339e006 100644
--- a/taurus/lib/taurus/qt/qtgui/dialog/taurusconfigurationdialog.py
+++ b/lib/taurus/qt/qtgui/dialog/taurusconfigurationdialog.py
diff --git a/taurus/lib/taurus/qt/qtgui/dialog/taurusinputdialog.py b/lib/taurus/qt/qtgui/dialog/taurusinputdialog.py
index 001a4862..001a4862 100644
--- a/taurus/lib/taurus/qt/qtgui/dialog/taurusinputdialog.py
+++ b/lib/taurus/qt/qtgui/dialog/taurusinputdialog.py
diff --git a/taurus/lib/taurus/qt/qtgui/dialog/taurusmessagebox.py b/lib/taurus/qt/qtgui/dialog/taurusmessagebox.py
index 08f3e3d9..08f3e3d9 100644
--- a/taurus/lib/taurus/qt/qtgui/dialog/taurusmessagebox.py
+++ b/lib/taurus/qt/qtgui/dialog/taurusmessagebox.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/__init__.py b/lib/taurus/qt/qtgui/display/__init__.py
index b796efde..b796efde 100644
--- a/taurus/lib/taurus/qt/qtgui/display/__init__.py
+++ b/lib/taurus/qt/qtgui/display/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/demo/__init__.py b/lib/taurus/qt/qtgui/display/demo/__init__.py
index c0f5fce2..c0f5fce2 100644
--- a/taurus/lib/taurus/qt/qtgui/display/demo/__init__.py
+++ b/lib/taurus/qt/qtgui/display/demo/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/demo/qpixmapwidgetdemo.py b/lib/taurus/qt/qtgui/display/demo/qpixmapwidgetdemo.py
index 463c3cf7..463c3cf7 100644
--- a/taurus/lib/taurus/qt/qtgui/display/demo/qpixmapwidgetdemo.py
+++ b/lib/taurus/qt/qtgui/display/demo/qpixmapwidgetdemo.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/demo/tauruslabeldemo.py b/lib/taurus/qt/qtgui/display/demo/tauruslabeldemo.py
index 02b67c9a..02b67c9a 100644
--- a/taurus/lib/taurus/qt/qtgui/display/demo/tauruslabeldemo.py
+++ b/lib/taurus/qt/qtgui/display/demo/tauruslabeldemo.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/demo/tauruslcddemo.py b/lib/taurus/qt/qtgui/display/demo/tauruslcddemo.py
index fe230979..fe230979 100644
--- a/taurus/lib/taurus/qt/qtgui/display/demo/tauruslcddemo.py
+++ b/lib/taurus/qt/qtgui/display/demo/tauruslcddemo.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/demo/taurusleddemo.py b/lib/taurus/qt/qtgui/display/demo/taurusleddemo.py
index 6af4e662..6af4e662 100644
--- a/taurus/lib/taurus/qt/qtgui/display/demo/taurusleddemo.py
+++ b/lib/taurus/qt/qtgui/display/demo/taurusleddemo.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/qfallback.py b/lib/taurus/qt/qtgui/display/qfallback.py
index 103eea92..103eea92 100644
--- a/taurus/lib/taurus/qt/qtgui/display/qfallback.py
+++ b/lib/taurus/qt/qtgui/display/qfallback.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/qled.py b/lib/taurus/qt/qtgui/display/qled.py
index d783ff10..d783ff10 100644
--- a/taurus/lib/taurus/qt/qtgui/display/qled.py
+++ b/lib/taurus/qt/qtgui/display/qled.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/qlogo.py b/lib/taurus/qt/qtgui/display/qlogo.py
index 981f9236..981f9236 100644
--- a/taurus/lib/taurus/qt/qtgui/display/qlogo.py
+++ b/lib/taurus/qt/qtgui/display/qlogo.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/qpixmapwidget.py b/lib/taurus/qt/qtgui/display/qpixmapwidget.py
index fcad541d..fcad541d 100644
--- a/taurus/lib/taurus/qt/qtgui/display/qpixmapwidget.py
+++ b/lib/taurus/qt/qtgui/display/qpixmapwidget.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/qsevensegment.py b/lib/taurus/qt/qtgui/display/qsevensegment.py
index c2bac781..c2bac781 100644
--- a/taurus/lib/taurus/qt/qtgui/display/qsevensegment.py
+++ b/lib/taurus/qt/qtgui/display/qsevensegment.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/taurusboolled.py b/lib/taurus/qt/qtgui/display/taurusboolled.py
index a0af5379..a0af5379 100644
--- a/taurus/lib/taurus/qt/qtgui/display/taurusboolled.py
+++ b/lib/taurus/qt/qtgui/display/taurusboolled.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/taurusconfiglabel.py b/lib/taurus/qt/qtgui/display/taurusconfiglabel.py
index 59fdceaa..59fdceaa 100644
--- a/taurus/lib/taurus/qt/qtgui/display/taurusconfiglabel.py
+++ b/lib/taurus/qt/qtgui/display/taurusconfiglabel.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/tauruslabel.py b/lib/taurus/qt/qtgui/display/tauruslabel.py
index ebd96c5b..ebd96c5b 100644
--- a/taurus/lib/taurus/qt/qtgui/display/tauruslabel.py
+++ b/lib/taurus/qt/qtgui/display/tauruslabel.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/tauruslcd.py b/lib/taurus/qt/qtgui/display/tauruslcd.py
index 4c2a3b90..4c2a3b90 100644
--- a/taurus/lib/taurus/qt/qtgui/display/tauruslcd.py
+++ b/lib/taurus/qt/qtgui/display/tauruslcd.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/tauruslcdvalue.py b/lib/taurus/qt/qtgui/display/tauruslcdvalue.py
index 3661740b..3661740b 100644
--- a/taurus/lib/taurus/qt/qtgui/display/tauruslcdvalue.py
+++ b/lib/taurus/qt/qtgui/display/tauruslcdvalue.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/taurusled.py b/lib/taurus/qt/qtgui/display/taurusled.py
index 1d8ceac2..1d8ceac2 100644
--- a/taurus/lib/taurus/qt/qtgui/display/taurusled.py
+++ b/lib/taurus/qt/qtgui/display/taurusled.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/taurusstateled.py b/lib/taurus/qt/qtgui/display/taurusstateled.py
index d978ec23..d978ec23 100644
--- a/taurus/lib/taurus/qt/qtgui/display/taurusstateled.py
+++ b/lib/taurus/qt/qtgui/display/taurusstateled.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/taurusvaluelabel.py b/lib/taurus/qt/qtgui/display/taurusvaluelabel.py
index 325d6210..325d6210 100644
--- a/taurus/lib/taurus/qt/qtgui/display/taurusvaluelabel.py
+++ b/lib/taurus/qt/qtgui/display/taurusvaluelabel.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/test/__init__.py b/lib/taurus/qt/qtgui/display/test/__init__.py
index 9503bcab..9503bcab 100644
--- a/taurus/lib/taurus/qt/qtgui/display/test/__init__.py
+++ b/lib/taurus/qt/qtgui/display/test/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/display/test/test_tauruslabel.py b/lib/taurus/qt/qtgui/display/test/test_tauruslabel.py
index 92cfc442..92cfc442 100644
--- a/taurus/lib/taurus/qt/qtgui/display/test/test_tauruslabel.py
+++ b/lib/taurus/qt/qtgui/display/test/test_tauruslabel.py
diff --git a/taurus/lib/taurus/qt/qtgui/editor/__init__.py b/lib/taurus/qt/qtgui/editor/__init__.py
index c2e37c46..c2e37c46 100644
--- a/taurus/lib/taurus/qt/qtgui/editor/__init__.py
+++ b/lib/taurus/qt/qtgui/editor/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/editor/tauruseditor.py b/lib/taurus/qt/qtgui/editor/tauruseditor.py
index a7127332..a7127332 100644
--- a/taurus/lib/taurus/qt/qtgui/editor/tauruseditor.py
+++ b/lib/taurus/qt/qtgui/editor/tauruseditor.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/__init__.py b/lib/taurus/qt/qtgui/extra_guiqwt/__init__.py
index 6bc4c9cb..6bc4c9cb 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/__init__.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/builder.py b/lib/taurus/qt/qtgui/extra_guiqwt/builder.py
index 1685ecdc..1685ecdc 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/builder.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/builder.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/curve.py b/lib/taurus/qt/qtgui/extra_guiqwt/curve.py
index d78b6461..d78b6461 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/curve.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/curve.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/curvesmodel.py b/lib/taurus/qt/qtgui/extra_guiqwt/curvesmodel.py
index a205f412..a205f412 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/curvesmodel.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/curvesmodel.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/image.py b/lib/taurus/qt/qtgui/extra_guiqwt/image.py
index b540cdf6..b540cdf6 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/image.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/image.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/plot.py b/lib/taurus/qt/qtgui/extra_guiqwt/plot.py
index c2fc04c2..c2fc04c2 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/plot.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/plot.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/styles.py b/lib/taurus/qt/qtgui/extra_guiqwt/styles.py
index 26183f62..26183f62 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/styles.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/styles.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/taurustrend2d.py b/lib/taurus/qt/qtgui/extra_guiqwt/taurustrend2d.py
index 6f36f35b..6f36f35b 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/taurustrend2d.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/taurustrend2d.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/tools.py b/lib/taurus/qt/qtgui/extra_guiqwt/tools.py
index 5ecd2bd0..5ecd2bd0 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/tools.py
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/tools.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/ui/CurveItemConfDlg.ui b/lib/taurus/qt/qtgui/extra_guiqwt/ui/CurveItemConfDlg.ui
index 59ad5c19..59ad5c19 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_guiqwt/ui/CurveItemConfDlg.ui
+++ b/lib/taurus/qt/qtgui/extra_guiqwt/ui/CurveItemConfDlg.ui
diff --git a/taurus/lib/taurus/qt/qtgui/extra_macroexecutor/__init__.py b/lib/taurus/qt/qtgui/extra_macroexecutor/__init__.py
index ecba5e50..ecba5e50 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_macroexecutor/__init__.py
+++ b/lib/taurus/qt/qtgui/extra_macroexecutor/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_nexus/__init__.py b/lib/taurus/qt/qtgui/extra_nexus/__init__.py
index 9657ed74..9657ed74 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_nexus/__init__.py
+++ b/lib/taurus/qt/qtgui/extra_nexus/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_nexus/taurusnexuswidget.py b/lib/taurus/qt/qtgui/extra_nexus/taurusnexuswidget.py
index 8143ed4c..8143ed4c 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_nexus/taurusnexuswidget.py
+++ b/lib/taurus/qt/qtgui/extra_nexus/taurusnexuswidget.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_pool/__init__.py b/lib/taurus/qt/qtgui/extra_pool/__init__.py
index be1ace38..be1ace38 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_pool/__init__.py
+++ b/lib/taurus/qt/qtgui/extra_pool/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_sardana/__init__.py b/lib/taurus/qt/qtgui/extra_sardana/__init__.py
index 3e35df3d..3e35df3d 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_sardana/__init__.py
+++ b/lib/taurus/qt/qtgui/extra_sardana/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_xterm/__init__.py b/lib/taurus/qt/qtgui/extra_xterm/__init__.py
index 1fcf5d03..1fcf5d03 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_xterm/__init__.py
+++ b/lib/taurus/qt/qtgui/extra_xterm/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/extra_xterm/qxtermwidget.py b/lib/taurus/qt/qtgui/extra_xterm/qxtermwidget.py
index c8b255d8..c8b255d8 100644
--- a/taurus/lib/taurus/qt/qtgui/extra_xterm/qxtermwidget.py
+++ b/lib/taurus/qt/qtgui/extra_xterm/qxtermwidget.py
diff --git a/taurus/lib/taurus/qt/qtgui/gauge/__init__.py b/lib/taurus/qt/qtgui/gauge/__init__.py
index 31968cb3..31968cb3 100644
--- a/taurus/lib/taurus/qt/qtgui/gauge/__init__.py
+++ b/lib/taurus/qt/qtgui/gauge/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/gauge/demo/__init__.py b/lib/taurus/qt/qtgui/gauge/demo/__init__.py
index ae329fb1..ae329fb1 100644
--- a/taurus/lib/taurus/qt/qtgui/gauge/demo/__init__.py
+++ b/lib/taurus/qt/qtgui/gauge/demo/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/gauge/demo/qmeterdemo.py b/lib/taurus/qt/qtgui/gauge/demo/qmeterdemo.py
index 5005dc90..5005dc90 100644
--- a/taurus/lib/taurus/qt/qtgui/gauge/demo/qmeterdemo.py
+++ b/lib/taurus/qt/qtgui/gauge/demo/qmeterdemo.py
diff --git a/taurus/lib/taurus/qt/qtgui/gauge/qmeter.py b/lib/taurus/qt/qtgui/gauge/qmeter.py
index 78800f97..78800f97 100644
--- a/taurus/lib/taurus/qt/qtgui/gauge/qmeter.py
+++ b/lib/taurus/qt/qtgui/gauge/qmeter.py
diff --git a/taurus/lib/taurus/qt/qtgui/gauge/taurusgauge.py b/lib/taurus/qt/qtgui/gauge/taurusgauge.py
index 174c9385..174c9385 100644
--- a/taurus/lib/taurus/qt/qtgui/gauge/taurusgauge.py
+++ b/lib/taurus/qt/qtgui/gauge/taurusgauge.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/__init__.py b/lib/taurus/qt/qtgui/graphic/__init__.py
index 68229bff..68229bff 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/__init__.py
+++ b/lib/taurus/qt/qtgui/graphic/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/__init__.py b/lib/taurus/qt/qtgui/graphic/jdraw/__init__.py
index c17174a3..c17174a3 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/__init__.py
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py b/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py
index 1e0e4c10..1e0e4c10 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_parser.py b/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_parser.py
index 84c6156a..84c6156a 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_parser.py
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_parser.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py b/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py
index 5497e1b3..5497e1b3 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/__init__.py b/lib/taurus/qt/qtgui/graphic/jdraw/test/__init__.py
index b5472aac..b5472aac 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/__init__.py
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/test/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/SimpleScalarViewer.jdw b/lib/taurus/qt/qtgui/graphic/jdraw/test/res/SimpleScalarViewer.jdw
index cc2c2936..cc2c2936 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/SimpleScalarViewer.jdw
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/test/res/SimpleScalarViewer.jdw
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/__init__.py b/lib/taurus/qt/qtgui/graphic/jdraw/test/res/__init__.py
index fdef7756..fdef7756 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/__init__.py
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/test/res/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/styles.jdw b/lib/taurus/qt/qtgui/graphic/jdraw/test/res/styles.jdw
index 72c6f965..72c6f965 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/jdraw/test/res/styles.jdw
+++ b/lib/taurus/qt/qtgui/graphic/jdraw/test/res/styles.jdw
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/taurusgraphic.py b/lib/taurus/qt/qtgui/graphic/taurusgraphic.py
index e69c8ef5..e69c8ef5 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/taurusgraphic.py
+++ b/lib/taurus/qt/qtgui/graphic/taurusgraphic.py
diff --git a/taurus/lib/taurus/qt/qtgui/graphic/taurusgraphicview.py b/lib/taurus/qt/qtgui/graphic/taurusgraphicview.py
index 4d624140..4d624140 100644
--- a/taurus/lib/taurus/qt/qtgui/graphic/taurusgraphicview.py
+++ b/lib/taurus/qt/qtgui/graphic/taurusgraphicview.py
diff --git a/taurus/lib/taurus/qt/qtgui/help/__init__.py b/lib/taurus/qt/qtgui/help/__init__.py
index e9cf2e40..e9cf2e40 100644
--- a/taurus/lib/taurus/qt/qtgui/help/__init__.py
+++ b/lib/taurus/qt/qtgui/help/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/help/aboutdialog.py b/lib/taurus/qt/qtgui/help/aboutdialog.py
index 5dfff2ef..5dfff2ef 100644
--- a/taurus/lib/taurus/qt/qtgui/help/aboutdialog.py
+++ b/lib/taurus/qt/qtgui/help/aboutdialog.py
diff --git a/taurus/lib/taurus/qt/qtgui/help/assistant.py b/lib/taurus/qt/qtgui/help/assistant.py
index 30b1455b..30b1455b 100644
--- a/taurus/lib/taurus/qt/qtgui/help/assistant.py
+++ b/lib/taurus/qt/qtgui/help/assistant.py
diff --git a/taurus/lib/taurus/qt/qtgui/help/helppanel.py b/lib/taurus/qt/qtgui/help/helppanel.py
index 701f9c2b..701f9c2b 100644
--- a/taurus/lib/taurus/qt/qtgui/help/helppanel.py
+++ b/lib/taurus/qt/qtgui/help/helppanel.py
diff --git a/taurus/lib/taurus/qt/qtgui/help/ui/AboutDialog.ui b/lib/taurus/qt/qtgui/help/ui/AboutDialog.ui
index 333fbbce..333fbbce 100644
--- a/taurus/lib/taurus/qt/qtgui/help/ui/AboutDialog.ui
+++ b/lib/taurus/qt/qtgui/help/ui/AboutDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/image/__init__.py b/lib/taurus/qt/qtgui/image/__init__.py
index 994241a6..994241a6 100644
--- a/taurus/lib/taurus/qt/qtgui/image/__init__.py
+++ b/lib/taurus/qt/qtgui/image/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/image/taurusqub.py b/lib/taurus/qt/qtgui/image/taurusqub.py
index 22d8b7a6..22d8b7a6 100644
--- a/taurus/lib/taurus/qt/qtgui/image/taurusqub.py
+++ b/lib/taurus/qt/qtgui/image/taurusqub.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/__init__.py b/lib/taurus/qt/qtgui/input/__init__.py
index cc5c7b0b..cc5c7b0b 100644
--- a/taurus/lib/taurus/qt/qtgui/input/__init__.py
+++ b/lib/taurus/qt/qtgui/input/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/choicedlg.py b/lib/taurus/qt/qtgui/input/choicedlg.py
index e72ebb69..e72ebb69 100644
--- a/taurus/lib/taurus/qt/qtgui/input/choicedlg.py
+++ b/lib/taurus/qt/qtgui/input/choicedlg.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/qwheel.py b/lib/taurus/qt/qtgui/input/qwheel.py
index 41a68524..41a68524 100644
--- a/taurus/lib/taurus/qt/qtgui/input/qwheel.py
+++ b/lib/taurus/qt/qtgui/input/qwheel.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/tauruscheckbox.py b/lib/taurus/qt/qtgui/input/tauruscheckbox.py
index ba7c3e16..ba7c3e16 100644
--- a/taurus/lib/taurus/qt/qtgui/input/tauruscheckbox.py
+++ b/lib/taurus/qt/qtgui/input/tauruscheckbox.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/tauruscombobox.py b/lib/taurus/qt/qtgui/input/tauruscombobox.py
index efe5810d..efe5810d 100644
--- a/taurus/lib/taurus/qt/qtgui/input/tauruscombobox.py
+++ b/lib/taurus/qt/qtgui/input/tauruscombobox.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/tauruslineedit.py b/lib/taurus/qt/qtgui/input/tauruslineedit.py
index b677776e..b677776e 100644
--- a/taurus/lib/taurus/qt/qtgui/input/tauruslineedit.py
+++ b/lib/taurus/qt/qtgui/input/tauruslineedit.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/taurusspinbox.py b/lib/taurus/qt/qtgui/input/taurusspinbox.py
index 15c509be..15c509be 100644
--- a/taurus/lib/taurus/qt/qtgui/input/taurusspinbox.py
+++ b/lib/taurus/qt/qtgui/input/taurusspinbox.py
diff --git a/taurus/lib/taurus/qt/qtgui/input/tauruswheel.py b/lib/taurus/qt/qtgui/input/tauruswheel.py
index a9ad0710..a9ad0710 100644
--- a/taurus/lib/taurus/qt/qtgui/input/tauruswheel.py
+++ b/lib/taurus/qt/qtgui/input/tauruswheel.py
diff --git a/taurus/lib/taurus/qt/qtgui/model/__init__.py b/lib/taurus/qt/qtgui/model/__init__.py
index 19f1b59a..19f1b59a 100644
--- a/taurus/lib/taurus/qt/qtgui/model/__init__.py
+++ b/lib/taurus/qt/qtgui/model/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/model/qbasemodel.py b/lib/taurus/qt/qtgui/model/qbasemodel.py
index 38120093..38120093 100644
--- a/taurus/lib/taurus/qt/qtgui/model/qbasemodel.py
+++ b/lib/taurus/qt/qtgui/model/qbasemodel.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/__init__.py b/lib/taurus/qt/qtgui/panel/__init__.py
index 4d326b26..4d326b26 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/__init__.py
+++ b/lib/taurus/qt/qtgui/panel/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/qdataexportdialog.py b/lib/taurus/qt/qtgui/panel/qdataexportdialog.py
index 7dfaaaf5..7dfaaaf5 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/qdataexportdialog.py
+++ b/lib/taurus/qt/qtgui/panel/qdataexportdialog.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/qdoublelist.py b/lib/taurus/qt/qtgui/panel/qdoublelist.py
index be50e7a1..be50e7a1 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/qdoublelist.py
+++ b/lib/taurus/qt/qtgui/panel/qdoublelist.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/qrawdatachooser.py b/lib/taurus/qt/qtgui/panel/qrawdatachooser.py
index 5d8d15d2..5d8d15d2 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/qrawdatachooser.py
+++ b/lib/taurus/qt/qtgui/panel/qrawdatachooser.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/report/__init__.py b/lib/taurus/qt/qtgui/panel/report/__init__.py
index 369b6eb0..369b6eb0 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/report/__init__.py
+++ b/lib/taurus/qt/qtgui/panel/report/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/report/albareport.py b/lib/taurus/qt/qtgui/panel/report/albareport.py
index ef0fe121..ef0fe121 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/report/albareport.py
+++ b/lib/taurus/qt/qtgui/panel/report/albareport.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/report/basicreport.py b/lib/taurus/qt/qtgui/panel/report/basicreport.py
index 43d06655..43d06655 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/report/basicreport.py
+++ b/lib/taurus/qt/qtgui/panel/report/basicreport.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/report/ui/SendMailForm.ui b/lib/taurus/qt/qtgui/panel/report/ui/SendMailForm.ui
index db149027..db149027 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/report/ui/SendMailForm.ui
+++ b/lib/taurus/qt/qtgui/panel/report/ui/SendMailForm.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusattributechooser.py b/lib/taurus/qt/qtgui/panel/taurusattributechooser.py
index 3fdcdeb6..3fdcdeb6 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusattributechooser.py
+++ b/lib/taurus/qt/qtgui/panel/taurusattributechooser.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusconfigbrowser.py b/lib/taurus/qt/qtgui/panel/taurusconfigbrowser.py
index 521d7500..521d7500 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusconfigbrowser.py
+++ b/lib/taurus/qt/qtgui/panel/taurusconfigbrowser.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusconfigeditor.py b/lib/taurus/qt/qtgui/panel/taurusconfigeditor.py
index 3e442d4a..3e442d4a 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusconfigeditor.py
+++ b/lib/taurus/qt/qtgui/panel/taurusconfigeditor.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusconfigurationpanel.py b/lib/taurus/qt/qtgui/panel/taurusconfigurationpanel.py
index 6c600283..6c600283 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusconfigurationpanel.py
+++ b/lib/taurus/qt/qtgui/panel/taurusconfigurationpanel.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusdevicepanel.py b/lib/taurus/qt/qtgui/panel/taurusdevicepanel.py
index 73df63f8..73df63f8 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusdevicepanel.py
+++ b/lib/taurus/qt/qtgui/panel/taurusdevicepanel.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusfilterpanel.py b/lib/taurus/qt/qtgui/panel/taurusfilterpanel.py
index 70275cee..70275cee 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusfilterpanel.py
+++ b/lib/taurus/qt/qtgui/panel/taurusfilterpanel.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusform.py b/lib/taurus/qt/qtgui/panel/taurusform.py
index 99c2ec52..99c2ec52 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusform.py
+++ b/lib/taurus/qt/qtgui/panel/taurusform.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusinputpanel.py b/lib/taurus/qt/qtgui/panel/taurusinputpanel.py
index e975240a..e975240a 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusinputpanel.py
+++ b/lib/taurus/qt/qtgui/panel/taurusinputpanel.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusmessagepanel.py b/lib/taurus/qt/qtgui/panel/taurusmessagepanel.py
index 1826d563..1826d563 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusmessagepanel.py
+++ b/lib/taurus/qt/qtgui/panel/taurusmessagepanel.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusmodelchooser.py b/lib/taurus/qt/qtgui/panel/taurusmodelchooser.py
index d96264dc..d96264dc 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusmodelchooser.py
+++ b/lib/taurus/qt/qtgui/panel/taurusmodelchooser.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusmodellist.py b/lib/taurus/qt/qtgui/panel/taurusmodellist.py
index d8c0dda2..d8c0dda2 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusmodellist.py
+++ b/lib/taurus/qt/qtgui/panel/taurusmodellist.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/taurusvalue.py b/lib/taurus/qt/qtgui/panel/taurusvalue.py
index 702d0550..702d0550 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/taurusvalue.py
+++ b/lib/taurus/qt/qtgui/panel/taurusvalue.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/test/__init__.py b/lib/taurus/qt/qtgui/panel/test/__init__.py
index 9503bcab..9503bcab 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/test/__init__.py
+++ b/lib/taurus/qt/qtgui/panel/test/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/test/test_taurusform.py b/lib/taurus/qt/qtgui/panel/test/test_taurusform.py
index 641d037b..641d037b 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/test/test_taurusform.py
+++ b/lib/taurus/qt/qtgui/panel/test/test_taurusform.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/test/test_taurusvalue.py b/lib/taurus/qt/qtgui/panel/test/test_taurusvalue.py
index 8a93bccd..8a93bccd 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/test/test_taurusvalue.py
+++ b/lib/taurus/qt/qtgui/panel/test/test_taurusvalue.py
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/QDataExportDialog.ui b/lib/taurus/qt/qtgui/panel/ui/QDataExportDialog.ui
index 625bf77b..625bf77b 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/QDataExportDialog.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/QDataExportDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/QDoubleListDlg.ui b/lib/taurus/qt/qtgui/panel/ui/QDoubleListDlg.ui
index af99ac38..af99ac38 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/QDoubleListDlg.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/QDoubleListDlg.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/QRawDataWidget.ui b/lib/taurus/qt/qtgui/panel/ui/QRawDataWidget.ui
index 34579eba..34579eba 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/QRawDataWidget.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/QRawDataWidget.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusAttributeChooser.ui b/lib/taurus/qt/qtgui/panel/ui/TaurusAttributeChooser.ui
index 4298c203..4298c203 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusAttributeChooser.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/TaurusAttributeChooser.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusConfigurationPanel.ui b/lib/taurus/qt/qtgui/panel/ui/TaurusConfigurationPanel.ui
index e10f8a44..e10f8a44 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusConfigurationPanel.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/TaurusConfigurationPanel.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusDevPanel.ui b/lib/taurus/qt/qtgui/panel/ui/TaurusDevPanel.ui
index f4eaf77f..f4eaf77f 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusDevPanel.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/TaurusDevPanel.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusFilterPanel.ui b/lib/taurus/qt/qtgui/panel/ui/TaurusFilterPanel.ui
index 44920434..44920434 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusFilterPanel.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/TaurusFilterPanel.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusInputPanel.ui b/lib/taurus/qt/qtgui/panel/ui/TaurusInputPanel.ui
index 34ede809..34ede809 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusInputPanel.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/TaurusInputPanel.ui
diff --git a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusMessagePanel.ui b/lib/taurus/qt/qtgui/panel/ui/TaurusMessagePanel.ui
index 28ebbeb9..28ebbeb9 100644
--- a/taurus/lib/taurus/qt/qtgui/panel/ui/TaurusMessagePanel.ui
+++ b/lib/taurus/qt/qtgui/panel/ui/TaurusMessagePanel.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/__init__.py b/lib/taurus/qt/qtgui/plot/__init__.py
index f7b47958..f7b47958 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/__init__.py
+++ b/lib/taurus/qt/qtgui/plot/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/arrayedit.py b/lib/taurus/qt/qtgui/plot/arrayedit.py
index 016d138a..016d138a 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/arrayedit.py
+++ b/lib/taurus/qt/qtgui/plot/arrayedit.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/curveStatsDlg.py b/lib/taurus/qt/qtgui/plot/curveStatsDlg.py
index 997a7f07..997a7f07 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/curveStatsDlg.py
+++ b/lib/taurus/qt/qtgui/plot/curveStatsDlg.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/curveprops.py b/lib/taurus/qt/qtgui/plot/curveprops.py
index 91345bab..91345bab 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/curveprops.py
+++ b/lib/taurus/qt/qtgui/plot/curveprops.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/curvesAppearanceChooserDlg.py b/lib/taurus/qt/qtgui/plot/curvesAppearanceChooserDlg.py
index ebb043ee..ebb043ee 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/curvesAppearanceChooserDlg.py
+++ b/lib/taurus/qt/qtgui/plot/curvesAppearanceChooserDlg.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/monitor.py b/lib/taurus/qt/qtgui/plot/monitor.py
index 343e8a97..343e8a97 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/monitor.py
+++ b/lib/taurus/qt/qtgui/plot/monitor.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/qwtdialog.py b/lib/taurus/qt/qtgui/plot/qwtdialog.py
index 65fac896..65fac896 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/qwtdialog.py
+++ b/lib/taurus/qt/qtgui/plot/qwtdialog.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/qwtplot.py b/lib/taurus/qt/qtgui/plot/qwtplot.py
index e7c4b7d2..e7c4b7d2 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/qwtplot.py
+++ b/lib/taurus/qt/qtgui/plot/qwtplot.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/scales.py b/lib/taurus/qt/qtgui/plot/scales.py
index 36d085c7..36d085c7 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/scales.py
+++ b/lib/taurus/qt/qtgui/plot/scales.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/taurusarrayedit.py b/lib/taurus/qt/qtgui/plot/taurusarrayedit.py
index cbc9c20a..cbc9c20a 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/taurusarrayedit.py
+++ b/lib/taurus/qt/qtgui/plot/taurusarrayedit.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/taurusplot.py b/lib/taurus/qt/qtgui/plot/taurusplot.py
index d67f8265..d67f8265 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/taurusplot.py
+++ b/lib/taurus/qt/qtgui/plot/taurusplot.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/taurusplotconf.py b/lib/taurus/qt/qtgui/plot/taurusplotconf.py
index f032c577..f032c577 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/taurusplotconf.py
+++ b/lib/taurus/qt/qtgui/plot/taurusplotconf.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/taurustrend.py b/lib/taurus/qt/qtgui/plot/taurustrend.py
index c1fae421..c1fae421 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/taurustrend.py
+++ b/lib/taurus/qt/qtgui/plot/taurustrend.py
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/AddCPointsDialog.ui b/lib/taurus/qt/qtgui/plot/ui/AddCPointsDialog.ui
index e62f4652..e62f4652 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/AddCPointsDialog.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/AddCPointsDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/ArrayEditor.ui b/lib/taurus/qt/qtgui/plot/ui/ArrayEditor.ui
index c527d96d..c527d96d 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/ArrayEditor.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/ArrayEditor.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/ControllerBox.ui b/lib/taurus/qt/qtgui/plot/ui/ControllerBox.ui
index 9b97da8e..9b97da8e 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/ControllerBox.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/ControllerBox.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/CurvePropertiesView.ui b/lib/taurus/qt/qtgui/plot/ui/CurvePropertiesView.ui
index a908f1ad..a908f1ad 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/CurvePropertiesView.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/CurvePropertiesView.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/CurveStatsDialog.ui b/lib/taurus/qt/qtgui/plot/ui/CurveStatsDialog.ui
index bfa3719f..bfa3719f 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/CurveStatsDialog.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/CurveStatsDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/CurvesAppearanceChooser.ui b/lib/taurus/qt/qtgui/plot/ui/CurvesAppearanceChooser.ui
index 2615cff0..2615cff0 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/CurvesAppearanceChooser.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/CurvesAppearanceChooser.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/EditCPointsDialog.ui b/lib/taurus/qt/qtgui/plot/ui/EditCPointsDialog.ui
index b302bed2..b302bed2 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/EditCPointsDialog.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/EditCPointsDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfDlg.ui b/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfDlg.ui
index 508c4110..508c4110 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfDlg.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfDlg.ui
diff --git a/taurus/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfigDialog.ui b/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfigDialog.ui
index 9de94a84..9de94a84 100644
--- a/taurus/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfigDialog.ui
+++ b/lib/taurus/qt/qtgui/plot/ui/TaurusPlotConfigDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/resource/__init__.py b/lib/taurus/qt/qtgui/resource/__init__.py
index 707b30d9..707b30d9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/__init__.py
+++ b/lib/taurus/qt/qtgui/resource/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/class.png b/lib/taurus/qt/qtgui/resource/external/class.png
index ed506e8b..ed506e8b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/class.png
+++ b/lib/taurus/qt/qtgui/resource/external/class.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/function.png b/lib/taurus/qt/qtgui/resource/external/function.png
index 662c40f2..662c40f2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/function.png
+++ b/lib/taurus/qt/qtgui/resource/external/function.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/ipython.png b/lib/taurus/qt/qtgui/resource/external/ipython.png
index 72ca8fad..72ca8fad 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/ipython.png
+++ b/lib/taurus/qt/qtgui/resource/external/ipython.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/jive/class.png b/lib/taurus/qt/qtgui/resource/external/jive/class.png
index f3f5810b..f3f5810b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/jive/class.png
+++ b/lib/taurus/qt/qtgui/resource/external/jive/class.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/jive/device.png b/lib/taurus/qt/qtgui/resource/external/jive/device.png
index b5dba3b5..b5dba3b5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/jive/device.png
+++ b/lib/taurus/qt/qtgui/resource/external/jive/device.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/jive/server.png b/lib/taurus/qt/qtgui/resource/external/jive/server.png
index ea242428..ea242428 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/jive/server.png
+++ b/lib/taurus/qt/qtgui/resource/external/jive/server.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/python-console.png b/lib/taurus/qt/qtgui/resource/external/python-console.png
index 428b323a..428b323a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/python-console.png
+++ b/lib/taurus/qt/qtgui/resource/external/python-console.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/python-file.png b/lib/taurus/qt/qtgui/resource/external/python-file.png
index 12a5abf7..12a5abf7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/python-file.png
+++ b/lib/taurus/qt/qtgui/resource/external/python-file.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/python-module.png b/lib/taurus/qt/qtgui/resource/external/python-module.png
index 4cb02948..4cb02948 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/python-module.png
+++ b/lib/taurus/qt/qtgui/resource/external/python-module.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/python-package.png b/lib/taurus/qt/qtgui/resource/external/python-package.png
index 12a5abf7..12a5abf7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/python-package.png
+++ b/lib/taurus/qt/qtgui/resource/external/python-package.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/python.png b/lib/taurus/qt/qtgui/resource/external/python.png
index 5c923d40..5c923d40 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/python.png
+++ b/lib/taurus/qt/qtgui/resource/external/python.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/pythonw-console.png b/lib/taurus/qt/qtgui/resource/external/pythonw-console.png
index 56de412e..56de412e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/pythonw-console.png
+++ b/lib/taurus/qt/qtgui/resource/external/pythonw-console.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/external/tango.png b/lib/taurus/qt/qtgui/resource/external/tango.png
index e02a2708..e02a2708 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/external/tango.png
+++ b/lib/taurus/qt/qtgui/resource/external/tango.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-all.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-all.svg
index 6587ae3c..6587ae3c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-all.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-all.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-selection.png b/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-selection.png
index 1f18dad8..1f18dad8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-selection.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse-selection.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse.png b/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse.png
index 559855e4..559855e4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/collapse.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-all.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-all.svg
index 7cac226c..7cac226c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-all.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-all.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-selection.png b/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-selection.png
index 4e7b1cb1..4e7b1cb1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-selection.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand-selection.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand.png b/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand.png
index 9455dbba..9455dbba 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/expand.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-backward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-backward.svg
index 7ed547a8..7ed547a8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-backward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-backward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-forward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-forward.svg
index 2514a313..2514a313 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-forward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/go-forward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-backward-green.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-backward-green.svg
index 57f50d62..57f50d62 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-backward-green.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-backward-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-forward-green.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-forward-green.svg
index 51809da1..51809da1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-forward-green.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media-seek-forward-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_backward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_backward.svg
index b63d7346..b63d7346 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_backward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_backward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_pause.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_pause.svg
index 1a0a2ede..1a0a2ede 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_pause.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_pause.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_start.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_start.svg
index 77df51ef..77df51ef 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_start.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_start.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop.svg
index 76bb5ecb..76bb5ecb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop_green.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop_green.svg
index 6bababd2..6bababd2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop_green.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_playback_stop_green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_backward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_backward.svg
index 7ca86139..7ca86139 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_backward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_backward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_forward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_forward.svg
index f473de8c..f473de8c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_forward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_seek_forward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_backward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_backward.svg
index 9412d0f1..9412d0f1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_backward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_backward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_forward.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_forward.svg
index d6cbcfa2..d6cbcfa2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_forward.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/media_skip_forward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/stop.svg b/lib/taurus/qt/qtgui/resource/extra-icons/actions/stop.svg
index bf578758..bf578758 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/actions/stop.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/actions/stop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/arrow01.svg b/lib/taurus/qt/qtgui/resource/extra-icons/arrow01.svg
index 1ada8548..1ada8548 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/arrow01.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/arrow01.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/color-fill.svg b/lib/taurus/qt/qtgui/resource/extra-icons/color-fill.svg
index 6bc2e7fc..6bc2e7fc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/color-fill.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/color-fill.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/arrayedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/arrayedit.png
index 35c3d35d..35c3d35d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/arrayedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/arrayedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/back.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/back.png
index e58177f4..e58177f4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/back.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/back.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/calendarwidget.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/calendarwidget.png
index 26737b88..26737b88 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/calendarwidget.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/calendarwidget.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/checkbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/checkbox.png
index ab6f53e0..ab6f53e0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/checkbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/checkbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/circular_gauge.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/circular_gauge.png
index 3dcfe3d1..3dcfe3d1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/circular_gauge.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/circular_gauge.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/columnview.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/columnview.png
index 4132ee6b..4132ee6b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/columnview.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/columnview.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/combobox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/combobox.png
index bf3ed79f..bf3ed79f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/combobox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/combobox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/commandlinkbutton.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/commandlinkbutton.png
index 6bbd84a9..6bbd84a9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/commandlinkbutton.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/commandlinkbutton.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/compression.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/compression.png
index 5de113bf..5de113bf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/compression.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/compression.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dateedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dateedit.png
index 6827fa74..6827fa74 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dateedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dateedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/datetimeedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/datetimeedit.png
index 7d8e6fe6..7d8e6fe6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/datetimeedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/datetimeedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_table.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_table.png
index c835c581..c835c581 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_table.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_table.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_tree.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_tree.png
index a470319d..a470319d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_tree.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/devs_tree.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dial.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dial.png
index 050d1dbd..050d1dbd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dial.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dial.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dialogbuttonbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dialogbuttonbox.png
index b1f89fbb..b1f89fbb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dialogbuttonbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dialogbuttonbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dockwidget.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dockwidget.png
index 9eee04f7..9eee04f7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/dockwidget.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/dockwidget.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/doublespinbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/doublespinbox.png
index 5686ac89..5686ac89 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/doublespinbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/doublespinbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/down.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/down.png
index 29d1d443..29d1d443 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/down.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/down.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/editdelete.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/editdelete.png
index df2a147d..df2a147d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/editdelete.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/editdelete.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/extra_motor.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/extra_motor.png
index 83fde10a..83fde10a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/extra_motor.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/extra_motor.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/filereader.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/filereader.png
index c9abb660..c9abb660 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/filereader.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/filereader.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/fontcombobox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/fontcombobox.png
index 6848f15c..6848f15c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/fontcombobox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/fontcombobox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/forward.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/forward.png
index 34b91f09..34b91f09 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/forward.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/forward.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/frame.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/frame.png
index 68f5da0a..68f5da0a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/frame.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/frame.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/graphicsview.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/graphicsview.png
index 93fe7603..93fe7603 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/graphicsview.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/graphicsview.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/grid.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/grid.png
index 0afb8d77..0afb8d77 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/grid.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/grid.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupbox.png
index 4025b4dc..4025b4dc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupboxcollapsible.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupboxcollapsible.png
index 62fd1ad5..62fd1ad5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupboxcollapsible.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupboxcollapsible.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupwidget.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupwidget.png
index ebafae0f..ebafae0f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupwidget.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/groupwidget.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/horizontal_linear_gauge.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/horizontal_linear_gauge.png
index 50a43173..50a43173 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/horizontal_linear_gauge.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/horizontal_linear_gauge.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hscrollbar.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/hscrollbar.png
index 466c58de..466c58de 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hscrollbar.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/hscrollbar.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hslider.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/hslider.png
index 525bd1ca..525bd1ca 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hslider.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/hslider.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hsplit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/hsplit.png
index 1ea8f2ac..1ea8f2ac 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/hsplit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/hsplit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/label.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/label.png
index 5d7d7b4c..5d7d7b4c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/label.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/label.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/lcdnumber.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/lcdnumber.png
index c3cac182..c3cac182 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/lcdnumber.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/lcdnumber.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledgreen.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledgreen.png
index 85297eb5..85297eb5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledgreen.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledgreen.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledred.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledred.png
index 24b2f848..24b2f848 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledred.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/ledred.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/line.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/line.png
index 5c64dfb5..5c64dfb5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/line.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/line.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/lineedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/lineedit.png
index 75fc890f..75fc890f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/lineedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/lineedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/listbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/listbox.png
index 367e67ff..367e67ff 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/listbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/listbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/listview.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/listview.png
index d1308d57..d1308d57 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/listview.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/listview.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/macroserver.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/macroserver.png
index fd49c9ec..fd49c9ec 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/macroserver.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/macroserver.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/mdiarea.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/mdiarea.png
index 7783dd52..7783dd52 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/mdiarea.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/mdiarea.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/minus.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/minus.png
index d6f233d7..d6f233d7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/minus.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/minus.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/plaintextedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/plaintextedit.png
index 077bf16c..077bf16c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/plaintextedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/plaintextedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/plus.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/plus.png
index 40df1134..40df1134 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/plus.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/plus.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/progress.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/progress.png
index 44ae094e..44ae094e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/progress.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/progress.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/props_table.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/props_table.png
index c835c581..c835c581 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/props_table.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/props_table.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/pushbutton.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/pushbutton.png
index 61f779ce..61f779ce 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/pushbutton.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/pushbutton.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/qwtplot.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/qwtplot.png
index 8e1ca4ed..8e1ca4ed 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/qwtplot.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/qwtplot.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/radiobutton.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/radiobutton.png
index 10c1d8c3..10c1d8c3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/radiobutton.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/radiobutton.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/scheduler.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/scheduler.png
index 5f6c70e8..5f6c70e8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/scheduler.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/scheduler.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/scrollarea.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/scrollarea.png
index 651ea24c..651ea24c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/scrollarea.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/scrollarea.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/spacer.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/spacer.png
index 8a0931bf..8a0931bf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/spacer.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/spacer.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/spinbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/spinbox.png
index cdd9fe14..cdd9fe14 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/spinbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/spinbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/state.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/state.png
index 3e15e765..3e15e765 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/state.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/state.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabbar.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabbar.png
index d5d37836..d5d37836 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabbar.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabbar.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/table.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/table.png
index 4bbd9c2d..4bbd9c2d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/table.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/table.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabwidget.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabwidget.png
index 1254bb63..1254bb63 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabwidget.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/tabwidget.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tau.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/tau.png
index f61e000e..f61e000e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/tau.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/tau.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/taurus.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/taurus.png
index 5da3a7de..5da3a7de 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/taurus.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/taurus.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/textedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/textedit.png
index 32e897d9..32e897d9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/textedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/textedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/timeedit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/timeedit.png
index c66d91b2..c66d91b2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/timeedit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/timeedit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbox.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbox.png
index 2ab71dc7..2ab71dc7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbox.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbox.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbutton.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbutton.png
index 0bff069a..0bff069a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbutton.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/toolbutton.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/up.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/up.png
index e4373122..e4373122 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/up.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/up.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vertical_linear_gauge.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vertical_linear_gauge.png
index d1762280..d1762280 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vertical_linear_gauge.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vertical_linear_gauge.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vline.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vline.png
index 35a7300a..35a7300a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vline.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vline.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vscrollbar.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vscrollbar.png
index 28b7c40c..28b7c40c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vscrollbar.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vscrollbar.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vslider.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vslider.png
index 59f06bae..59f06bae 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vslider.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vslider.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vspacer.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vspacer.png
index ce5e8bd7..ce5e8bd7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/vspacer.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/vspacer.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/wheeledit.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/wheeledit.png
index 993dc1fe..993dc1fe 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/wheeledit.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/wheeledit.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/widget.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/widget.png
index 1cf960e6..1cf960e6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/widget.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/widget.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/widgetstack.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/widgetstack.png
index 2c6964e3..2c6964e3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/widgetstack.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/widgetstack.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/wizard.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/wizard.png
index 7c0e107a..7c0e107a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/wizard.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/wizard.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomin.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomin.png
index 2e586fc7..2e586fc7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomin.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomin.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomout.png b/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomout.png
index a736d393..a736d393 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomout.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/designer/zoomout.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblue.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblue.png
index f08c559b..f08c559b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblue.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblue.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblueoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblueoff.png
index 3d23a5d1..3d23a5d1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblueoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledblueoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreen.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreen.png
index f89f5f7d..f89f5f7d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreen.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreen.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreenoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreenoff.png
index 0d52936e..0d52936e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreenoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledgreenoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorange.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorange.png
index e455de96..e455de96 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorange.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorange.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorangeoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorangeoff.png
index bf4d7e76..bf4d7e76 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorangeoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledorangeoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledred.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledred.png
index 46dd165e..46dd165e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledred.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledred.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledredoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledredoff.png
index 86631ed9..86631ed9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledredoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledredoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellow.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellow.png
index b520b928..b520b928 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellow.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellow.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellowoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellowoff.png
index 5756b569..5756b569 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellowoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images24/ledyellowoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_off.png
index 1b7f04b0..1b7f04b0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_on.png
index 1b7f04b0..1b7f04b0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_black_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_off.png
index ab5ae4e3..ab5ae4e3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_on.png
index 0998be6f..0998be6f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_blue_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_off.png
index a6d4ffac..a6d4ffac 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_on.png
index 24e738f5..24e738f5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_green_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_off.png
index 5991ccd2..5991ccd2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_on.png
index 61116762..61116762 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_grenoble_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_off.png
index df2628ed..df2628ed 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_on.png
index f13784b7..f13784b7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_magenta_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_off.png
index 1b7f04b0..1b7f04b0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_off.png
index e6ef7f64..e6ef7f64 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_on.png
index 6109294b..6109294b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_orange_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_off.png
index 33eecf62..33eecf62 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_on.png
index 71471e35..71471e35 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_red_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_off.png
index c702c33d..c702c33d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_on.png
index efbc5d39..efbc5d39 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_white_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_off.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_off.png
index 0d27b936..0d27b936 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_off.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_off.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_on.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_on.png
index ebb67f3e..ebb67f3e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_on.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images256/led_yellow_on.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblue.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblue.png
index 131587e8..131587e8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblue.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblue.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblueoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblueoff.png
index 43e940df..43e940df 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblueoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledblueoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreen.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreen.png
index d7887acc..d7887acc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreen.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreen.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreenoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreenoff.png
index c5fbaab8..c5fbaab8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreenoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledgreenoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorange.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorange.png
index 2ef2dbef..2ef2dbef 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorange.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorange.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorangeoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorangeoff.png
index 2e57ed95..2e57ed95 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorangeoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledorangeoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledred.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledred.png
index a7fd0aa4..a7fd0aa4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledred.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledred.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledredoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledredoff.png
index 715fed21..715fed21 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledredoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledredoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellow.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellow.png
index 419feb68..419feb68 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellow.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellow.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellowoff.png b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellowoff.png
index a1d67277..a1d67277 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellowoff.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/leds/images48/ledyellowoff.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked.svg b/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked.svg
index 03dae40c..03dae40c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked_unpreviledged.svg b/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked_unpreviledged.svg
index 43e1b603..43e1b603 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked_unpreviledged.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/lock_locked_unpreviledged.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_unknown.svg b/lib/taurus/qt/qtgui/resource/extra-icons/lock_unknown.svg
index 992eeaa5..992eeaa5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_unknown.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/lock_unknown.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_unlocked.svg b/lib/taurus/qt/qtgui/resource/extra-icons/lock_unlocked.svg
index 1c75000c..1c75000c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/lock_unlocked.svg
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/lock_unlocked.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close.png
index 6e3cdac7..6e3cdac7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_black.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_black.png
index 0aa35b78..0aa35b78 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_black.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_black.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_gray.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_gray.png
index c59e8b3c..c59e8b3c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_gray.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_gray.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_white.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_white.png
index 7386675c..7386675c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_white.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_close_white.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock.png
index 7190f28d..7190f28d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_black.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_black.png
index 4a327357..4a327357 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_black.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_black.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_gray.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_gray.png
index 6ed20be7..6ed20be7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_gray.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_gray.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_white.png b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_white.png
index f6fd9fa6..f6fd9fa6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_white.png
+++ b/lib/taurus/qt/qtgui/resource/extra-icons/titlebar_undock_white.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/TaurusSplash.png b/lib/taurus/qt/qtgui/resource/large/TaurusSplash.png
index e39062b4..e39062b4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/TaurusSplash.png
+++ b/lib/taurus/qt/qtgui/resource/large/TaurusSplash.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/SardanaEditor.png b/lib/taurus/qt/qtgui/resource/large/snapshot/SardanaEditor.png
index ad5af3e0..ad5af3e0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/SardanaEditor.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/SardanaEditor.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusArrayEditor.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusArrayEditor.png
index d4a4b7b6..d4a4b7b6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusArrayEditor.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusArrayEditor.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDbTreeWidget.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDbTreeWidget.png
index 048eeeb0..048eeeb0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDbTreeWidget.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDbTreeWidget.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDevicePanel.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDevicePanel.png
index b9691686..b9691686 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDevicePanel.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusDevicePanel.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusForm.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusForm.png
index e497a6e0..e497a6e0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusForm.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusForm.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusImageDialog.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusImageDialog.png
index 0aa1efb1..0aa1efb1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusImageDialog.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusImageDialog.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusJDrawSynopticsView.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusJDrawSynopticsView.png
index 97119d5c..97119d5c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusJDrawSynopticsView.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusJDrawSynopticsView.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusNeXusBrowser.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusNeXusBrowser.png
index 8f03adf1..8f03adf1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusNeXusBrowser.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusNeXusBrowser.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusPlot.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusPlot.png
index 9b0b30a3..9b0b30a3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusPlot.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusPlot.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusQubDataImageDisplay.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusQubDataImageDisplay.png
index d3189b5b..d3189b5b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusQubDataImageDisplay.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusQubDataImageDisplay.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusShell.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusShell.png
index 1b4b90bc..1b4b90bc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusShell.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusShell.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend.png
index f0c63da8..f0c63da8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend2DDialog.png b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend2DDialog.png
index f2d344de..f2d344de 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend2DDialog.png
+++ b/lib/taurus/qt/qtgui/resource/large/snapshot/TaurusTrend2DDialog.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/action-undo.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/action-undo.svg
index 62bdadc7..62bdadc7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/action-undo.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/action-undo.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add-participant.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add-participant.svg
index 7e1acf56..7e1acf56 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add-participant.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add-participant.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add.svg
index 610f0155..610f0155 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/add.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/approval.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/approval.svg
index f11bea86..f11bea86 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/approval.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/approval.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/arrange-boxes.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/arrange-boxes.svg
index b1dc53da..b1dc53da 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/arrange-boxes.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/arrange-boxes.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/back-to-ou.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/back-to-ou.svg
index ab350f75..ab350f75 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/back-to-ou.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/back-to-ou.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/data-transfer.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/data-transfer.svg
index 42bb5685..42bb5685 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/data-transfer.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/data-transfer.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/delete-all-participants.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/delete-all-participants.svg
index 7226e409..7226e409 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/delete-all-participants.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/delete-all-participants.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dial-in.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dial-in.svg
index 51374c1b..51374c1b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dial-in.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dial-in.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down-grey.svg
index bc8a88fb..bc8a88fb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down.svg
index 0e5baa39..0e5baa39 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/down.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/download.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/download.svg
index 021f6614..021f6614 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/download.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/download.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-down.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-down.svg
index 3960a9a9..3960a9a9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-down.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-down.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-left.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-left.svg
index 3ad55ba6..3ad55ba6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-left.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-left.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-right.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-right.svg
index b390a9ef..b390a9ef 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-right.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-right.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-up.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-up.svg
index 64c6cef3..64c6cef3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-up.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/dynamic-blue-up.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/email-not-available.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/email-not-available.svg
index c1cac54d..c1cac54d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/email-not-available.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/email-not-available.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/filter.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/filter.svg
index a8cc142a..a8cc142a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/filter.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/filter.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-bottom.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-bottom.svg
index 35b2324d..35b2324d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-bottom.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-bottom.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-top.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-top.svg
index bb00a3e3..bb00a3e3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-top.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/go-top.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/hide.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/hide.svg
index 70465cf6..70465cf6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/hide.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/hide.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left-grey.svg
index 04bf4612..04bf4612 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left.svg
index 928960c3..928960c3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/left.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/list-all-participants.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/list-all-participants.svg
index 4cf73c8d..4cf73c8d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/list-all-participants.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/list-all-participants.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/load-settings.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/load-settings.svg
index 8cff8266..8cff8266 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/load-settings.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/load-settings.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-in.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-in.svg
index ff29c3a8..ff29c3a8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-in.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-in.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-out.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-out.svg
index da60c167..da60c167 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-out.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/log-out.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/manage-settings.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/manage-settings.svg
index ea442085..ea442085 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/manage-settings.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/manage-settings.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/merge-affiliation.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/merge-affiliation.svg
index df38fde7..df38fde7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/merge-affiliation.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/merge-affiliation.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/monitoring.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/monitoring.svg
index 61bd2a7d..61bd2a7d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/monitoring.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/monitoring.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red-grey.svg
index 8cbe5cd1..8cbe5cd1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red.svg
index efcf2fc2..efcf2fc2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-participant-to-waiting-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down-grey.svg
index 7f62f1ee..7f62f1ee 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down.svg
index 7ec976aa..7ec976aa 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-down.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-to-participant-green-arrow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-to-participant-green-arrow.svg
index f61e60c2..f61e60c2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-to-participant-green-arrow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-to-participant-green-arrow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up-grey.svg
index 52767aee..52767aee 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up.svg
index f312d8ca..f312d8ca 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/move-waiting-up.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/print.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/print.svg
index e9cfa0b3..e9cfa0b3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/print.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/print.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/refuse.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/refuse.svg
index a8e14f7f..a8e14f7f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/refuse.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/refuse.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right-grey.svg
index d4f6df7b..d4f6df7b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right.svg
index a3bdfcd7..a3bdfcd7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/right.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/run.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/run.svg
index 78fd6edf..78fd6edf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/run.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/run.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-group.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-group.svg
index ef79895e..ef79895e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-group.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-group.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user-other.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user-other.svg
index b99448aa..b99448aa 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user-other.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user-other.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user.svg
index 50fe5aa7..50fe5aa7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email-user.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email.svg
index e1e6b7a7..e1e6b7a7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/send-email.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/show.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/show.svg
index 96362e7d..96362e7d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/show.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/show.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-green.svg
index 8c255560..8c255560 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-red.svg
index 45ef47d1..45ef47d1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down.svg
index 4feabee9..4feabee9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-down.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-green.svg
index 403e9a49..403e9a49 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-red.svg
index b9690221..b9690221 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral.svg
index 3ce7065f..3ce7065f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-neutral.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-green.svg
index 9b57d140..9b57d140 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-red.svg
index b4248213..b4248213 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up.svg
index 74b98bfd..74b98bfd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/sort-up.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/split-affiliation.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/split-affiliation.svg
index cea637b4..cea637b4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/split-affiliation.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/split-affiliation.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book-grey.svg
index 3158e8a8..3158e8a8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book.svg
index 39b84f77..39b84f77 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-book.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-grey.svg
index 822feeec..822feeec 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course.svg
index 98cb33cb..98cb33cb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/switch-course.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-down_up.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-down_up.svg
index 38c779e6..38c779e6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-down_up.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-down_up.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-left_right.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-left_right.svg
index 3a3f2624..3a3f2624 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-left_right.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-left_right.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-right_left.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-right_left.svg
index 5604807c..5604807c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-right_left.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-right_left.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-up_down.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-up_down.svg
index bf483f31..bf483f31 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-up_down.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/transfer-up_down.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up-grey.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up-grey.svg
index fb4fcbd1..fb4fcbd1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up-grey.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up-grey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up.svg
index 492471c0..492471c0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/up.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/upload.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/upload.svg
index 9718b8d1..9718b8d1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/upload.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/upload.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/view.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/view.svg
index 69a65b0b..69a65b0b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/view.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/view.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/workflow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/workflow.svg
index 462660b6..462660b6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/actions/workflow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/actions/workflow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-employee.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-employee.svg
index f06d92e7..f06d92e7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-employee.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-employee.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-guest.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-guest.svg
index 6dff7e38..6dff7e38 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-guest.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-guest.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-student.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-student.svg
index af62857d..af62857d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-student.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/affiliation-student.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/alumni-group.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/alumni-group.svg
index accef2f0..accef2f0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/alumni-group.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/alumni-group.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book-marks.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book-marks.svg
index 57d4f88f..57d4f88f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book-marks.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book-marks.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book.svg
index c2ec9696..c2ec9696 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/book.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/bookmark.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/bookmark.svg
index 62e57618..62e57618 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/bookmark.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/bookmark.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/icon-inspector.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/icon-inspector.svg
index 8914208f..8914208f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/icon-inspector.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/icon-inspector.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/magnifying-glass.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/magnifying-glass.svg
index dac98feb..dac98feb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/magnifying-glass.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/magnifying-glass.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-green.svg
index dedfada2..dedfada2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-red.svg
index cb81f442..cb81f442 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-yellow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-yellow.svg
index fbc1b7be..fbc1b7be 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-yellow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/mood-level-yellow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin-gear.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin-gear.svg
index ffc2042a..ffc2042a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin-gear.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin-gear.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin.svg
index 289727c9..289727c9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-admin.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-business.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-business.svg
index 1bb3d8f7..1bb3d8f7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-business.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-business.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-customer.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-customer.svg
index 972344fa..972344fa 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-customer.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-customer.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-digital-person.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-digital-person.svg
index ed4c395c..ed4c395c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-digital-person.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-digital-person.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-disabled.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-disabled.svg
index 3673f465..3673f465 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-disabled.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-disabled.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-employee.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-employee.svg
index f6acce39..f6acce39 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-employee.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-employee.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-endcustomer.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-endcustomer.svg
index 857906e7..857906e7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-endcustomer.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-endcustomer.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-enrolee.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-enrolee.svg
index c594d549..c594d549 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-enrolee.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-enrolee.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner-group.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner-group.svg
index a96a738a..a96a738a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner-group.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner-group.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner.svg
index 3f46bb23..3f46bb23 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-examiner.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-expert.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-expert.svg
index f7dcbccb..f7dcbccb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-expert.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-expert.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-group.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-group.svg
index 0cb5214b..0cb5214b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-group.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-group.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk-faq.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk-faq.svg
index e36b2e8e..e36b2e8e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk-faq.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk-faq.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk.svg
index 473617fb..473617fb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-helpdesk.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-library.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-library.svg
index 54a5c356..54a5c356 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-library.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-library.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-manager.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-manager.svg
index fe6cbf77..fe6cbf77 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-manager.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-manager.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-business.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-business.svg
index 79f51691..79f51691 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-business.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-business.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-female.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-female.svg
index 75632151..75632151 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-female.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-female.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-new.svg
index 37faed24..37faed24 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other.svg
index 6e9f4dde..6e9f4dde 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-other.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-partner.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-partner.svg
index 0737ad6f..0737ad6f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-partner.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-partner.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd-group.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd-group.svg
index 7e409625..7e409625 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd-group.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd-group.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd.svg
index 0fbe0c3f..0fbe0c3f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-phd.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-real-person.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-real-person.svg
index 06b9ca03..06b9ca03 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-real-person.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-real-person.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student-assistant.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student-assistant.svg
index d8d5982e..d8d5982e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student-assistant.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student-assistant.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student.svg
index 1cae1b7d..1cae1b7d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-student.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-unknown.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-unknown.svg
index d3e3064d..d3e3064d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-unknown.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/categories/user-unknown.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/database-locked.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/database-locked.svg
index 4b914770..4b914770 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/database-locked.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/database-locked.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/modem.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/modem.svg
index d512e3a7..d512e3a7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/modem.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/modem.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/router.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/router.svg
index 750a65d3..750a65d3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/router.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/router.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-access.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-access.svg
index e14b1319..e14b1319 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-access.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-access.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-accounting.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-accounting.svg
index 55cb1692..55cb1692 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-accounting.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-accounting.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-blades.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-blades.svg
index 0f043949..0f043949 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-blades.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-blades.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-book.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-book.svg
index 06b350fd..06b350fd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-book.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-book.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-firebird.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-firebird.svg
index 9d3fdabc..9d3fdabc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-firebird.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-firebird.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-green.svg
index 80e849e9..80e849e9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-mysql.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-mysql.svg
index d3e6fb6b..d3e6fb6b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-mysql.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-mysql.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-otrs.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-otrs.svg
index 2b2d679d..2b2d679d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-otrs.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-otrs.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-postgres.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-postgres.svg
index bca4bbf5..bca4bbf5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-postgres.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-postgres.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-yellow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-yellow.svg
index f6812bab..f6812bab 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-yellow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database-yellow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database.svg
index b64a4c9d..b64a4c9d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-database.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-green.svg
index 23489e8c..23489e8c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-yellow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-yellow.svg
index e64daa2c..e64daa2c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-yellow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory-yellow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory.svg
index cc2e3e9e..cc2e3e9e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-directory.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email-relay.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email-relay.svg
index d9f06307..d9f06307 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email-relay.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email-relay.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email.svg
index 0bd21e5b..0bd21e5b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-email.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-file.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-file.svg
index 1d58542e..1d58542e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-file.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-file.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-firewall.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-firewall.svg
index b9100732..b9100732 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-firewall.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-firewall.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-green.svg
index 132f799a..132f799a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-monitoring.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-monitoring.svg
index 2400e66f..2400e66f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-monitoring.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-monitoring.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-multiple.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-multiple.svg
index 2a4d4851..2a4d4851 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-multiple.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-multiple.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-print.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-print.svg
index 9d3d9e13..9d3d9e13 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-print.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-print.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-radius.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-radius.svg
index 3ba72d4f..3ba72d4f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-radius.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-radius.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-red.svg
index d84c1fec..d84c1fec 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-subversion.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-subversion.svg
index 966dcadf..966dcadf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-subversion.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-subversion.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-user.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-user.svg
index 7a54ca41..7a54ca41 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-user.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-user.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-vpn.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-vpn.svg
index 0491e8be..0491e8be 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-vpn.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-vpn.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-green.svg
index ea895652..ea895652 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-secure.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-secure.svg
index 91e3be01..91e3be01 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-secure.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-secure.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-yellow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-yellow.svg
index 15613110..15613110 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-yellow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web-yellow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web.svg
index 0e1764fb..0e1764fb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-web.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-yellow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-yellow.svg
index db4bc709..db4bc709 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-yellow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server-yellow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server.svg
index 46c67665..46c67665 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/server.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/switch.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/switch.svg
index e0b9e33e..e0b9e33e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/switch.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/switch.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-access-point.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-access-point.svg
index 02b724fc..02b724fc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-access-point.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-access-point.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-controller.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-controller.svg
index 08ee10d4..08ee10d4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-controller.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/wlan-controller.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/workstation.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/workstation.svg
index 28e7c0e0..28e7c0e0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/devices/workstation.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/devices/workstation.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-delete.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-delete.svg
index 24555631..24555631 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-delete.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-delete.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-edit.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-edit.svg
index 3bacacf6..3bacacf6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-edit.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-edit.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-new.svg
index de31adca..de31adca 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/account-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation-abstract.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation-abstract.svg
index 04c8363f..04c8363f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation-abstract.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation-abstract.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation.svg
index 78a93ebe..78a93ebe 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affiliation.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affirmation.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affirmation.svg
index 3afb26fe..3afb26fe 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affirmation.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/affirmation.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/all-per-page.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/all-per-page.svg
index 32bf9fa2..32bf9fa2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/all-per-page.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/all-per-page.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/at.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/at.svg
index 89457dc7..89457dc7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/at.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/at.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes-u.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes-u.svg
index 74e4ad52..74e4ad52 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes-u.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes-u.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes.svg
index 877f1d61..877f1d61 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-itunes.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-visual-slide.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-visual-slide.svg
index 908df2a2..908df2a2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-visual-slide.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/audio-visual-slide.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-delete.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-delete.svg
index c820313b..c820313b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-delete.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-delete.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-new.svg
index 814539d4..814539d4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone.svg
index baaf5177..baaf5177 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/bridge-stone.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-firebird.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-firebird.svg
index 71a28df0..71a28df0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-firebird.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-firebird.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-mysql.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-mysql.svg
index 73489477..73489477 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-mysql.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-mysql.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-openldap.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-openldap.svg
index 8dbb967f..8dbb967f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-openldap.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-openldap.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-otrs.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-otrs.svg
index 91d2bb3a..91d2bb3a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-otrs.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-otrs.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-postgres.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-postgres.svg
index d141fe57..d141fe57 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-postgres.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-postgres.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-vcs-subversion.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-vcs-subversion.svg
index c2d26e1d..c2d26e1d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-vcs-subversion.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database-vcs-subversion.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database.svg
index ef052045..ef052045 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/database.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-attribute.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-attribute.svg
index 42bbb439..42bbb439 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-attribute.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-attribute.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object-class.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object-class.svg
index 9ef74bf3..9ef74bf3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object-class.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object-class.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object.svg
index f2fca7ff..f2fca7ff 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-object.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-schema.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-schema.svg
index 0f42f982..0f42f982 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-schema.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-schema.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-syntax.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-syntax.svg
index c12d55ed..c12d55ed 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-syntax.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory-syntax.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory.svg
index e67c7260..e67c7260 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/directory.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/doctoral-cap.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/doctoral-cap.svg
index cdbcbed1..cdbcbed1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/doctoral-cap.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/doctoral-cap.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/email.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/email.svg
index 757314fe..757314fe 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/email.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/email.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/entitlement.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/entitlement.svg
index f7aa746f..f7aa746f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/entitlement.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/entitlement.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/export.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/export.svg
index 690389f0..690389f0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/export.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/export.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/fifty-per-page.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/fifty-per-page.svg
index adf03777..adf03777 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/fifty-per-page.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/fifty-per-page.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/firewall.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/firewall.svg
index 4b1c5dbd..4b1c5dbd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/firewall.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/firewall.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/floppy-disc-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/floppy-disc-green.svg
index fe1b3777..fe1b3777 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/floppy-disc-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/floppy-disc-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/folder.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/folder.svg
index 2b6473a3..2b6473a3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/folder.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/folder.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-delete.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-delete.svg
index 52375be9..52375be9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-delete.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-delete.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-edit.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-edit.svg
index 2fdd1add..2fdd1add 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-edit.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-edit.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-new.svg
index 8652b700..8652b700 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote.svg
index 543d5f55..543d5f55 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/footnote.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/for-free.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/for-free.svg
index 03a3b259..03a3b259 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/for-free.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/for-free.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/geo-id.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/geo-id.svg
index bb1993b2..bb1993b2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/geo-id.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/geo-id.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/globe.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/globe.svg
index ecb8b884..ecb8b884 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/globe.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/globe.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/id.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/id.svg
index 663fbfbb..663fbfbb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/id.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/id.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/index.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/index.svg
index fc696a4f..fc696a4f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/index.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/index.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/information.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/information.svg
index db670b1e..db670b1e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/information.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/information.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/inspector-hat.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/inspector-hat.svg
index c5117fe9..c5117fe9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/inspector-hat.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/inspector-hat.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/lock.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/lock.svg
index 48b499e6..48b499e6 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/lock.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/lock.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/mailbox.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/mailbox.svg
index 71b37480..71b37480 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/mailbox.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/mailbox.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-film.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-film.svg
index 98e45405..98e45405 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-film.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-film.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-floppy-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-floppy-green.svg
index 84de0e71..84de0e71 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-floppy-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/media-floppy-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/message-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/message-new.svg
index 16ca6b26..16ca6b26 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/message-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/message-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/money.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/money.svg
index 23ea7808..23ea7808 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/money.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/money.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/movie-audio.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/movie-audio.svg
index 0c9c52da..0c9c52da 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/movie-audio.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/movie-audio.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/network-cloud.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/network-cloud.svg
index 3200c21a..3200c21a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/network-cloud.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/network-cloud.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/note.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/note.svg
index 16fa9eb1..16fa9eb1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/note.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/note.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-excel.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-excel.svg
index 4ca58141..4ca58141 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-excel.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-excel.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-word.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-word.svg
index 8a4ea011..8a4ea011 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-word.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/office-word.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organisational-unit-tree.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organisational-unit-tree.svg
index e69de7b1..e69de7b1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organisational-unit-tree.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organisational-unit-tree.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organizational-unit.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organizational-unit.svg
index 3799c030..3799c030 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organizational-unit.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/organizational-unit.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-25.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-25.svg
index cf3b365b..cf3b365b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-25.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-25.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-50.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-50.svg
index 11a975dd..11a975dd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-50.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-50.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-all.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-all.svg
index df82c881..df82c881 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-all.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/page-all.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/peace-sign.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/peace-sign.svg
index a37f45f3..a37f45f3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/peace-sign.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/peace-sign.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/pen.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/pen.svg
index 5781a50d..5781a50d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/pen.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/pen.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/phone.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/phone.svg
index d42bef6b..d42bef6b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/phone.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/phone.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/promotion-data.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/promotion-data.svg
index 8ca6a584..8ca6a584 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/promotion-data.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/promotion-data.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/relay.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/relay.svg
index 6dd272d7..6dd272d7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/relay.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/relay.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-delete.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-delete.svg
index 2baaca9b..2baaca9b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-delete.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-delete.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-edit.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-edit.svg
index 2e3bf3e2..2e3bf3e2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-edit.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-edit.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-new.svg
index 5b83275b..5b83275b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-run.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-run.svg
index 9882aace..9882aace 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-run.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-run.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-upload.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-upload.svg
index 6b300af0..6b300af0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-upload.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report-upload.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report.svg
index 8b34be57..8b34be57 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/report.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/rss-feed.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/rss-feed.svg
index 3246ea8a..3246ea8a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/rss-feed.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/rss-feed.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/single-sign-on.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/single-sign-on.svg
index ee45c169..ee45c169 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/single-sign-on.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/single-sign-on.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide-audio.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide-audio.svg
index 5a9be13c..5a9be13c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide-audio.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide-audio.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide.svg
index 375fac27..375fac27 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/slide.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/statistic.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/statistic.svg
index ee73b78f..ee73b78f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/statistic.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/statistic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/structured-program-stay-abroad.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/structured-program-stay-abroad.svg
index 3597381f..3597381f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/structured-program-stay-abroad.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/structured-program-stay-abroad.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo
index 7ac72f7d..7ac72f7d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo.svg
index b4069220..b4069220 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion-logo.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion.svg
index 2f9e5464..2f9e5464 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/subversion.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/table.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/table.svg
index 80bc9f35..80bc9f35 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/table.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/table.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/task.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/task.svg
index a3c1a783..a3c1a783 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/task.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/task.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/template.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/template.svg
index 8fdfaf39..8fdfaf39 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/template.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/template.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/ten-per-page.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/ten-per-page.svg
index 8a6ebf2c..8a6ebf2c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/ten-per-page.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/ten-per-page.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tomcat.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tomcat.svg
index 75d1873f..75d1873f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tomcat.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tomcat.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-delete.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-delete.svg
index 9b24c1d4..9b24c1d4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-delete.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-delete.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-move.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-move.svg
index d1dd4371..d1dd4371 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-move.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-move.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-new.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-new.svg
index 88be2511..88be2511 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-new.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm.svg
index 94a7c9ea..94a7c9ea 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/tree-diagramm.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/twenty-five-per-page.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/twenty-five-per-page.svg
index 1276c42c..1276c42c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/twenty-five-per-page.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/twenty-five-per-page.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/unix.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/unix.svg
index 393ccd6f..393ccd6f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/unix.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/unix.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/video-film.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/video-film.svg
index 34e7af7b..34e7af7b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/video-film.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/video-film.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/webview.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/webview.svg
index 10d9fd3f..10d9fd3f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/webview.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/webview.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-connection.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-connection.svg
index 0a068909..0a068909 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-connection.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-connection.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-link.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-link.svg
index 9b14b205..9b14b205 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-link.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wide-area-network-link.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wifi.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wifi.svg
index 0ce60b16..0ce60b16 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wifi.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/wifi.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/zipper.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/zipper.svg
index 5eb7507d..5eb7507d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/zipper.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/emblems/zipper.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp3.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp3.svg
index 0974ece5..0974ece5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp3.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp3.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp4.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp4.svg
index 733675bf..733675bf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp4.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/audio-mp4.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/document-pdf.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/document-pdf.svg
index 9f5b299c..9f5b299c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/document-pdf.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/document-pdf.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes-u.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes-u.svg
index 0fe1357a..0fe1357a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes-u.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes-u.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes.svg
index ea32a03b..ea32a03b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-itunes.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-visual-slide.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-visual-slide.svg
index 20fce459..20fce459 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-visual-slide.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-audio-visual-slide.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie-audio.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie-audio.svg
index c9855615..c9855615 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie-audio.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie-audio.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie.svg
index 65db95a0..65db95a0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-movie.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-slide-audio.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-slide-audio.svg
index d7e7dae5..d7e7dae5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-slide-audio.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-slide-audio.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-video-film.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-video-film.svg
index add518e5..add518e5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-video-film.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/media-video-film.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-excel.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-excel.svg
index 6e2618ed..6e2618ed 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-excel.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-excel.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-word.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-word.svg
index 13792241..13792241 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-word.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/office-ms-word.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/text-csv-text.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/text-csv-text.svg
index 27f4fc55..27f4fc55 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/text-csv-text.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/text-csv-text.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-m4v.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-m4v.svg
index f0b48ea0..f0b48ea0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-m4v.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-m4v.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-mov.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-mov.svg
index a02893cf..a02893cf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-mov.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/mime-types/video-mov.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/available.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/available.svg
index cfe03528..cfe03528 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/available.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/available.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting-plus.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting-plus.svg
index 3f727adc..3f727adc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting-plus.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting-plus.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting.svg
index faebc08a..faebc08a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/awaiting.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/binational.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/binational.svg
index ca9d32f3..ca9d32f3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/binational.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/binational.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/error.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/error.svg
index 65b532aa..65b532aa 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/error.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/error.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/exclamation-mark.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/exclamation-mark.svg
index ccd9dcee..ccd9dcee 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/exclamation-mark.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/exclamation-mark.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/expired.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/expired.svg
index 0c88ca79..0c88ca79 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/expired.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/expired.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/false.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/false.svg
index c69135fc..c69135fc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/false.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/false.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/female.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/female.svg
index e6d19091..e6d19091 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/female.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/female.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-clock.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-clock.svg
index cef87900..cef87900 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-clock.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-clock.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-mail.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-mail.svg
index d6f83fd4..d6f83fd4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-mail.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green-mail.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green.svg
index c8997b0e..c8997b0e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-green.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-clock.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-clock.svg
index 21b024bf..21b024bf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-clock.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-clock.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-mail.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-mail.svg
index 1d1262c3..1d1262c3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-mail.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red-mail.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red.svg
index 1187d6eb..1187d6eb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-red.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-clock.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-clock.svg
index 8cd9a6c5..8cd9a6c5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-clock.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-clock.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-mail.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-mail.svg
index bf8a5f73..bf8a5f73 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-mail.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow-mail.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow.svg
index 9aa23f5c..9aa23f5c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/flag-yellow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/hourglass.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/hourglass.svg
index 6a090fc3..6a090fc3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/hourglass.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/hourglass.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/important.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/important.svg
index f857508c..f857508c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/important.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/important.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/maintenance-time.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/maintenance-time.svg
index d52afa92..d52afa92 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/maintenance-time.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/maintenance-time.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/male.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/male.svg
index d85aa46a..d85aa46a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/male.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/male.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-available.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-available.svg
index 6252b31c..6252b31c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-available.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-available.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-known.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-known.svg
index e43a4160..e43a4160 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-known.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-known.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-specified.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-specified.svg
index 2dc23ad5..2dc23ad5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-specified.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-specified.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-synchronized.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-synchronized.svg
index 27767257..27767257 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-synchronized.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/not-synchronized.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/synchronized.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/synchronized.svg
index 06b49813..06b49813 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/synchronized.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/synchronized.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available-clock.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available-clock.svg
index 45926e4e..45926e4e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available-clock.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available-clock.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available.svg
index 5b60cda7..5b60cda7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/temporarily-not-available.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/true-orange.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/true-orange.svg
index f8bdcc90..f8bdcc90 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/true-orange.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/true-orange.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/true.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/true.svg
index 3be66029..3be66029 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/true.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/true.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/unlocked.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/unlocked.svg
index 7227cb2a..7227cb2a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/unlocked.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/unlocked.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/warning.svg b/lib/taurus/qt/qtgui/resource/rrze-icons/status/warning.svg
index 9f5878a2..9f5878a2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/rrze-icons/status/warning.svg
+++ b/lib/taurus/qt/qtgui/resource/rrze-icons/status/warning.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/address-book-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/address-book-new.svg
index 600a82c1..600a82c1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/address-book-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/address-book-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/appointment-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/appointment-new.svg
index 4cb14f82..4cb14f82 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/appointment-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/appointment-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/bookmark-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/bookmark-new.svg
index d6d095b7..d6d095b7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/bookmark-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/bookmark-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/contact-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/contact-new.svg
index 1efb8954..1efb8954 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/contact-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/contact-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-new.svg
index 1bfdb164..1bfdb164 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-open.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-open.svg
index 55e6177d..55e6177d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-open.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-open.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print-preview.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print-preview.svg
index d3501ac1..d3501ac1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print-preview.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print-preview.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print.svg
index 0b8837ba..0b8837ba 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-print.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-properties.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-properties.svg
index c57f96d2..c57f96d2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-properties.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-properties.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save-as.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save-as.svg
index 01e2fb7a..01e2fb7a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save-as.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save-as.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save.svg
index 2922c433..2922c433 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/document-save.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-clear.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-clear.svg
index b2f20d44..b2f20d44 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-clear.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-clear.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-copy.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-copy.svg
index f4d9e977..f4d9e977 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-copy.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-copy.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-cut.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-cut.svg
index b9ac930c..b9ac930c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-cut.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-cut.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-delete.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-delete.svg
index 5da694f0..5da694f0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-delete.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-delete.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find-replace.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find-replace.svg
index 1f443ff7..1f443ff7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find-replace.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find-replace.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find.svg
index a499b486..a499b486 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-find.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-paste.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-paste.svg
index 39150d71..39150d71 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-paste.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-paste.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-redo.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-redo.svg
index bc4d52af..bc4d52af 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-redo.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-redo.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-select-all.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-select-all.svg
index dd525075..dd525075 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-select-all.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-select-all.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-undo.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-undo.svg
index d3cce96f..d3cce96f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-undo.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/edit-undo.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/folder-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/folder-new.svg
index 0791887a..0791887a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/folder-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/folder-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-less.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-less.svg
index 00be1f3a..00be1f3a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-less.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-less.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-more.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-more.svg
index 2047b623..2047b623 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-more.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-indent-more.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-center.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-center.svg
index d1564f33..d1564f33 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-center.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-center.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-fill.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-fill.svg
index 1ec09496..1ec09496 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-fill.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-fill.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-left.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-left.svg
index c2501950..c2501950 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-left.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-left.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-right.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-right.svg
index f6f2205e..f6f2205e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-right.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-justify-right.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-bold.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-bold.svg
index 9268d4ea..9268d4ea 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-bold.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-bold.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-italic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-italic.svg
index 3a4bc363..3a4bc363 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-italic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-italic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-strikethrough.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-strikethrough.svg
index 5e87b5ed..5e87b5ed 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-strikethrough.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-strikethrough.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-underline.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-underline.svg
index 22131f6c..22131f6c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-underline.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/format-text-underline.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-bottom.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-bottom.svg
index 6cd7c7c7..6cd7c7c7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-bottom.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-bottom.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-down.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-down.svg
index 95b82afd..95b82afd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-down.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-down.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-first.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-first.svg
index 4e0b668f..4e0b668f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-first.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-first.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-home.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-home.svg
index 4f169588..4f169588 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-home.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-home.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-jump.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-jump.svg
index 4832fe94..4832fe94 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-jump.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-jump.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-last.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-last.svg
index 00af499d..00af499d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-last.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-last.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-next.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-next.svg
index 41e5990b..41e5990b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-next.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-next.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-previous.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-previous.svg
index d5381de3..d5381de3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-previous.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-previous.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-top.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-top.svg
index 4ee94d3c..4ee94d3c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-top.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-top.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-up.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-up.svg
index 54263df3..54263df3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-up.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/go-up.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-add.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-add.svg
index 6eaed448..6eaed448 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-add.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-add.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-remove.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-remove.svg
index 5f109a05..5f109a05 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-remove.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/list-remove.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-forward.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-forward.svg
index b159ed53..b159ed53 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-forward.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-forward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-junk.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-junk.svg
index 01631751..01631751 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-junk.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-junk.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-not-junk.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-not-junk.svg
index f0b0560e..f0b0560e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-not-junk.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-mark-not-junk.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-message-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-message-new.svg
index 9f685877..9f685877 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-message-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-message-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-all.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-all.svg
index f1ee15f4..f1ee15f4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-all.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-all.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-sender.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-sender.svg
index ad1cab43..ad1cab43 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-sender.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-reply-sender.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-send-receive.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-send-receive.svg
index ef715777..ef715777 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-send-receive.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/mail-send-receive.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-eject.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-eject.svg
index d22eae1a..d22eae1a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-eject.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-eject.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-pause.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-pause.svg
index 8a434cab..8a434cab 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-pause.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-pause.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-start.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-start.svg
index 75616de4..75616de4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-start.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-start.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-stop.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-stop.svg
index 24bbfb52..24bbfb52 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-stop.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-playback-stop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-record.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-record.svg
index 85bbb98f..85bbb98f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-record.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-record.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-backward.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-backward.svg
index 75f49f1a..75f49f1a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-backward.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-backward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-forward.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-forward.svg
index b1b9fe95..b1b9fe95 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-forward.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-seek-forward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-backward.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-backward.svg
index fccd7762..fccd7762 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-backward.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-backward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-forward.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-forward.svg
index 7c4d4005..7c4d4005 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-forward.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/media-skip-forward.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/process-stop.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/process-stop.svg
index 04ce3a79..04ce3a79 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/process-stop.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/process-stop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-lock-screen.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-lock-screen.svg
index e7d9f1b7..e7d9f1b7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-lock-screen.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-lock-screen.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-log-out.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-log-out.svg
index adb95213..adb95213 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-log-out.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-log-out.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-search.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-search.svg
index 1a4c1cd7..1a4c1cd7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-search.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-search.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-shutdown.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-shutdown.svg
index 9b0b3271..9b0b3271 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-shutdown.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/system-shutdown.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/tab-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/tab-new.svg
index f3c0a14d..f3c0a14d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/tab-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/tab-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-fullscreen.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-fullscreen.svg
index d410654b..d410654b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-fullscreen.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-fullscreen.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-refresh.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-refresh.svg
index 565f6dad..565f6dad 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-refresh.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/view-refresh.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/window-new.svg b/lib/taurus/qt/qtgui/resource/tango-icons/actions/window-new.svg
index 60d33cfb..60d33cfb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/actions/window-new.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/actions/window-new.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-calculator.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-calculator.svg
index 88cf76a9..88cf76a9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-calculator.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-calculator.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-character-map.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-character-map.svg
index 8bb8dcfe..8bb8dcfe 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-character-map.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-character-map.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-text-editor.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-text-editor.svg
index 70621f01..70621f01 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-text-editor.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/accessories-text-editor.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/help-browser.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/help-browser.svg
index 851327f7..851327f7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/help-browser.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/help-browser.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-group-chat.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-group-chat.svg
index 8e8945ec..8e8945ec 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-group-chat.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-group-chat.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-mail.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-mail.svg
index 8d5ea8cd..8d5ea8cd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-mail.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-mail.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-news-reader.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-news-reader.svg
index b86f419e..b86f419e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-news-reader.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-news-reader.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-web-browser.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-web-browser.svg
index d2366a9d..d2366a9d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-web-browser.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/internet-web-browser.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/office-calendar.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/office-calendar.svg
index d9f9281d..d9f9281d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/office-calendar.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/office-calendar.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-accessibility.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-accessibility.svg
index 9977314b..9977314b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-accessibility.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-accessibility.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-assistive-technology.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-assistive-technology.svg
index 39a46686..39a46686 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-assistive-technology.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-assistive-technology.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-font.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-font.svg
index 07939802..07939802 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-font.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-font.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-keyboard-shortcuts.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-keyboard-shortcuts.svg
index 6caf205d..6caf205d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-keyboard-shortcuts.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-keyboard-shortcuts.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-locale.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-locale.svg
index 2e71f18a..2e71f18a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-locale.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-locale.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-multimedia.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-multimedia.svg
index 9ddee90a..9ddee90a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-multimedia.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-multimedia.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-remote-desktop.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-remote-desktop.svg
index 848e8922..848e8922 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-remote-desktop.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-remote-desktop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-screensaver.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-screensaver.svg
index 0db41767..0db41767 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-screensaver.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-screensaver.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-theme.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-theme.svg
index 45ed886e..45ed886e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-theme.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-theme.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-wallpaper.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-wallpaper.svg
index 0f94fbd1..0f94fbd1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-wallpaper.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-desktop-wallpaper.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-network-proxy.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-network-proxy.svg
index efb2653f..efb2653f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-network-proxy.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-network-proxy.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-session.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-session.svg
index 27954bce..27954bce 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-session.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-session.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-windows.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-windows.svg
index dc344f71..dc344f71 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-windows.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/preferences-system-windows.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-file-manager.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-file-manager.svg
index 99ad454a..99ad454a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-file-manager.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-file-manager.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-installer.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-installer.svg
index 32007409..32007409 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-installer.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-installer.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-software-update.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-software-update.svg
index 66eb747c..66eb747c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-software-update.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-software-update.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-users.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-users.svg
index 7d628b86..7d628b86 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-users.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/system-users.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-system-monitor.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-system-monitor.svg
index 8f4b9462..8f4b9462 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-system-monitor.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-system-monitor.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-terminal.svg b/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-terminal.svg
index 995fb90b..995fb90b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-terminal.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/apps/utilities-terminal.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-accessories.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-accessories.svg
index 35527cb7..35527cb7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-accessories.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-accessories.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-development.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-development.svg
index f5755289..f5755289 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-development.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-development.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-games.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-games.svg
index 1d89e485..1d89e485 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-games.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-games.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-graphics.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-graphics.svg
index ec544d5a..ec544d5a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-graphics.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-graphics.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-internet.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-internet.svg
index ebe3c60b..ebe3c60b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-internet.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-internet.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-multimedia.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-multimedia.svg
index 6844e8db..6844e8db 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-multimedia.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-multimedia.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-office.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-office.svg
index e1b60b47..e1b60b47 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-office.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-office.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-other.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-other.svg
index 5e30c277..5e30c277 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-other.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-other.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-system.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-system.svg
index 9d767742..9d767742 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-system.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/applications-system.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop-peripherals.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop-peripherals.svg
index 1e1663ab..1e1663ab 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop-peripherals.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop-peripherals.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop.svg
index a0fd1449..a0fd1449 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-desktop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-system.svg b/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-system.svg
index d41028fc..d41028fc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-system.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/categories/preferences-system.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-card.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-card.svg
index d7816a85..d7816a85 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-card.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-card.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-input-microphone.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-input-microphone.svg
index d31409c4..d31409c4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-input-microphone.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/audio-input-microphone.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/battery.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/battery.svg
index 30695dda..30695dda 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/battery.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/battery.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-photo.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-photo.svg
index 49114101..49114101 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-photo.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-photo.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-video.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-video.svg
index e2471345..e2471345 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-video.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/camera-video.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/computer.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/computer.svg
index 4a63d5d7..4a63d5d7 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/computer.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/computer.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-harddisk.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-harddisk.svg
index 2d38ac6b..2d38ac6b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-harddisk.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-harddisk.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-optical.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-optical.svg
index 644ef8ae..644ef8ae 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-optical.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-optical.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-removable-media.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-removable-media.svg
index 2b198741..2b198741 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-removable-media.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/drive-removable-media.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-gaming.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-gaming.svg
index 5909a53e..5909a53e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-gaming.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-gaming.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-keyboard.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-keyboard.svg
index 534dd384..534dd384 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-keyboard.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-keyboard.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-mouse.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-mouse.svg
index 2fda0182..2fda0182 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-mouse.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/input-mouse.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-flash.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-flash.svg
index 13f910fd..13f910fd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-flash.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-flash.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-floppy.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-floppy.svg
index 6700163d..6700163d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-floppy.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-floppy.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-optical.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-optical.svg
index 34aa13f5..34aa13f5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-optical.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/media-optical.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/multimedia-player.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/multimedia-player.svg
index 01bf244e..01bf244e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/multimedia-player.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/multimedia-player.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wired.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wired.svg
index bfa56d58..bfa56d58 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wired.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wired.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wireless.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wireless.svg
index e52d2bbc..e52d2bbc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wireless.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/network-wireless.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/printer.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/printer.svg
index 4c702dc4..4c702dc4 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/printer.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/printer.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/video-display.svg b/lib/taurus/qt/qtgui/resource/tango-icons/devices/video-display.svg
index 26fe3a9e..26fe3a9e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/devices/video-display.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/devices/video-display.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-favorite.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-favorite.svg
index f3fcbc2e..f3fcbc2e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-favorite.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-favorite.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-important.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-important.svg
index 75bec8c2..75bec8c2 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-important.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-important.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-photos.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-photos.svg
index 3129efb9..3129efb9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-photos.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-photos.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-readonly.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-readonly.svg
index 6a3e477d..6a3e477d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-readonly.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-readonly.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-symbolic-link.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-symbolic-link.svg
index 45e040bf..45e040bf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-symbolic-link.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-symbolic-link.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-system.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-system.svg
index 8bfdf70f..8bfdf70f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-system.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-system.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-unreadable.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-unreadable.svg
index 282f64ec..282f64ec 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-unreadable.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emblems/emblem-unreadable.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-angel.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-angel.svg
index 84ac5439..84ac5439 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-angel.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-angel.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-cool.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-cool.svg
index f47d9815..f47d9815 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-cool.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-cool.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-crying.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-crying.svg
index 16118d87..16118d87 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-crying.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-crying.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-devilish.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-devilish.svg
index e4846a3b..e4846a3b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-devilish.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-devilish.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-glasses.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-glasses.svg
index dc8641cc..dc8641cc 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-glasses.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-glasses.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-grin.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-grin.svg
index 26046e3b..26046e3b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-grin.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-grin.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-kiss.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-kiss.svg
index 9f4318af..9f4318af 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-kiss.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-kiss.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-monkey.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-monkey.svg
index 8412f308..8412f308 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-monkey.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-monkey.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-plain.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-plain.svg
index 5860974d..5860974d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-plain.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-plain.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-sad.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-sad.svg
index fdfa02d0..fdfa02d0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-sad.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-sad.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile-big.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile-big.svg
index e0fbd57a..e0fbd57a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile-big.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile-big.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile.svg
index 4528ba09..4528ba09 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-smile.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-surprise.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-surprise.svg
index b40a3013..b40a3013 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-surprise.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-surprise.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-wink.svg b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-wink.svg
index 54ac00bd..54ac00bd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-wink.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/emotes/face-wink.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-certificate.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-certificate.svg
index 077f741d..077f741d 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-certificate.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-certificate.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-x-executable.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-x-executable.svg
index 38088df8..38088df8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-x-executable.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/application-x-executable.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/audio-x-generic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/audio-x-generic.svg
index be2d18ad..be2d18ad 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/audio-x-generic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/audio-x-generic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/font-x-generic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/font-x-generic.svg
index b4897750..b4897750 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/font-x-generic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/font-x-generic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/image-x-generic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/image-x-generic.svg
index 45dd641a..45dd641a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/image-x-generic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/image-x-generic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/package-x-generic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/package-x-generic.svg
index 47beed79..47beed79 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/package-x-generic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/package-x-generic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-html.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-html.svg
index 330c3906..330c3906 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-html.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-html.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic-template.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic-template.svg
index f70eda46..f70eda46 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic-template.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic-template.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic.svg
index 532f98bb..532f98bb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-generic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-script.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-script.svg
index 65db6c59..65db6c59 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-script.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/text-x-script.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/video-x-generic.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/video-x-generic.svg
index 1f3a8b95..1f3a8b95 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/video-x-generic.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/video-x-generic.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-address-book.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-address-book.svg
index 55ddaa3b..55ddaa3b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-address-book.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-address-book.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-calendar.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-calendar.svg
index 5f1159b9..5f1159b9 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-calendar.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-calendar.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document-template.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document-template.svg
index 421c16b0..421c16b0 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document-template.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document-template.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document.svg
index b3c5d966..b3c5d966 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-document.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing-template.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing-template.svg
index 5a484283..5a484283 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing-template.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing-template.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing.svg
index 5fd08040..5fd08040 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-drawing.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation-template.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation-template.svg
index 8e0bff47..8e0bff47 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation-template.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation-template.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation.svg
index 179e0e41..179e0e41 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-presentation.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet-template.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet-template.svg
index 0c3ca9b1..0c3ca9b1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet-template.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet-template.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet.svg b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet.svg
index cbc4df2e..cbc4df2e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/mimetypes/x-office-spreadsheet.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-remote.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-remote.svg
index dc7d3a37..dc7d3a37 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-remote.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-remote.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-saved-search.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-saved-search.svg
index 58e1f881..58e1f881 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-saved-search.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder-saved-search.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.icon b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.icon
index 704e5587..704e5587 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.icon
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.icon
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.svg
index 79b25c30..79b25c30 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/folder.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/network-server.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/network-server.svg
index 3587d2b8..3587d2b8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/network-server.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/network-server.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/network-workgroup.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/network-workgroup.svg
index 52f62054..52f62054 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/network-workgroup.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/network-workgroup.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/start-here.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/start-here.svg
index 3f531305..3f531305 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/start-here.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/start-here.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-desktop.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/user-desktop.svg
index 75749a00..75749a00 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-desktop.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/user-desktop.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-home.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/user-home.svg
index b2c83d1c..b2c83d1c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-home.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/user-home.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-trash.svg b/lib/taurus/qt/qtgui/resource/tango-icons/places/user-trash.svg
index c2d6f25a..c2d6f25a 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/places/user-trash.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/places/user-trash.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-high.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-high.svg
index 0d8e47a5..0d8e47a5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-high.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-high.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-low.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-low.svg
index 208b1bbb..208b1bbb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-low.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-low.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-medium.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-medium.svg
index e3c0bb9e..e3c0bb9e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-medium.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-medium.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-muted.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-muted.svg
index 976fd5eb..976fd5eb 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-muted.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/audio-volume-muted.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/battery-caution.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/battery-caution.svg
index 2581963e..2581963e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/battery-caution.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/battery-caution.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-error.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-error.svg
index 6dfc2dea..6dfc2dea 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-error.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-error.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-information.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-information.svg
index 922b316f..922b316f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-information.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-information.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-warning.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-warning.svg
index e09eccaf..e09eccaf 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-warning.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/dialog-warning.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.icon b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.icon
index 3bcd9b98..3bcd9b98 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.icon
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.icon
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.svg
index 734feb20..734feb20 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-drag-accept.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-open.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-open.svg
index 237f6f25..237f6f25 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-open.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-open.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.icon b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.icon
index 3bcd9b98..3bcd9b98 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.icon
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.icon
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.svg
index f8bac9d3..f8bac9d3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/folder-visiting.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/image-loading.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/image-loading.svg
index 0fdf252b..0fdf252b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/image-loading.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/image-loading.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/image-missing.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/image-missing.svg
index 8b7f4910..8b7f4910 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/image-missing.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/image-missing.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/mail-attachment.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/mail-attachment.svg
index 4c7f5f64..4c7f5f64 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/mail-attachment.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/mail-attachment.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-error.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-error.svg
index 9ec7ca56..9ec7ca56 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-error.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-error.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-idle.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-idle.svg
index 8201ad25..8201ad25 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-idle.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-idle.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-offline.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-offline.svg
index d34ba271..d34ba271 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-offline.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-offline.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-receive.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-receive.svg
index 01ed0fa3..01ed0fa3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-receive.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-receive.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit-receive.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit-receive.svg
index 504e07bd..504e07bd 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit-receive.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit-receive.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit.svg
index a984f216..a984f216 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-transmit.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-wireless-encrypted.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-wireless-encrypted.svg
index 623a0a68..623a0a68 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/network-wireless-encrypted.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/network-wireless-encrypted.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/printer-error.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/printer-error.svg
index 14209f78..14209f78 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/printer-error.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/printer-error.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-available.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-available.svg
index 9a5a688b..9a5a688b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-available.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-available.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-urgent.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-urgent.svg
index 168a67c1..168a67c1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-urgent.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/software-update-urgent.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/user-trash-full.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/user-trash-full.svg
index 393285f5..393285f5 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/user-trash-full.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/user-trash-full.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear-night.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear-night.svg
index 5737f251..5737f251 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear-night.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear-night.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear.svg
index 6a74ec85..6a74ec85 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-clear.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds-night.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds-night.svg
index 52a0aab1..52a0aab1 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds-night.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds-night.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds.svg
index 57d45e93..57d45e93 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-few-clouds.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-overcast.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-overcast.svg
index 35fb4a4b..35fb4a4b 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-overcast.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-overcast.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-severe-alert.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-severe-alert.svg
index bdae6783..bdae6783 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-severe-alert.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-severe-alert.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers-scattered.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers-scattered.svg
index 5a3ae325..5a3ae325 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers-scattered.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers-scattered.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers.svg
index c814571c..c814571c 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-showers.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-snow.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-snow.svg
index 6c7b4ad8..6c7b4ad8 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-snow.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-snow.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-storm.svg b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-storm.svg
index 4d8bfec3..4d8bfec3 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-storm.svg
+++ b/lib/taurus/qt/qtgui/resource/tango-icons/status/weather-storm.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/tau.png b/lib/taurus/qt/qtgui/resource/tau.png
index 8c1ac6ff..8c1ac6ff 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/tau.png
+++ b/lib/taurus/qt/qtgui/resource/tau.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/taurus.png b/lib/taurus/qt/qtgui/resource/taurus.png
index 026c4f0f..026c4f0f 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/taurus.png
+++ b/lib/taurus/qt/qtgui/resource/taurus.png
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/resource/taurus.svg b/lib/taurus/qt/qtgui/resource/taurus.svg
index 937c3d1e..937c3d1e 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/taurus.svg
+++ b/lib/taurus/qt/qtgui/resource/taurus.svg
diff --git a/taurus/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py b/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py
index 9f7df3af..9f7df3af 100644
--- a/taurus/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py
+++ b/lib/taurus/qt/qtgui/resource/taurus_resource_utils.py
diff --git a/taurus/lib/taurus/qt/qtgui/style/__init__.py b/lib/taurus/qt/qtgui/style/__init__.py
index 6467301e..6467301e 100644
--- a/taurus/lib/taurus/qt/qtgui/style/__init__.py
+++ b/lib/taurus/qt/qtgui/style/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/style/nebula.py b/lib/taurus/qt/qtgui/style/nebula.py
index c1516753..c1516753 100644
--- a/taurus/lib/taurus/qt/qtgui/style/nebula.py
+++ b/lib/taurus/qt/qtgui/style/nebula.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/__init__.py b/lib/taurus/qt/qtgui/table/__init__.py
index c9ef11e0..c9ef11e0 100644
--- a/taurus/lib/taurus/qt/qtgui/table/__init__.py
+++ b/lib/taurus/qt/qtgui/table/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/qdictionary.py b/lib/taurus/qt/qtgui/table/qdictionary.py
index ccf3c86e..ccf3c86e 100644
--- a/taurus/lib/taurus/qt/qtgui/table/qdictionary.py
+++ b/lib/taurus/qt/qtgui/table/qdictionary.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/qlogtable.py b/lib/taurus/qt/qtgui/table/qlogtable.py
index 56e4d2ce..56e4d2ce 100644
--- a/taurus/lib/taurus/qt/qtgui/table/qlogtable.py
+++ b/lib/taurus/qt/qtgui/table/qlogtable.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/qtable.py b/lib/taurus/qt/qtgui/table/qtable.py
index 2e7437df..2e7437df 100644
--- a/taurus/lib/taurus/qt/qtgui/table/qtable.py
+++ b/lib/taurus/qt/qtgui/table/qtable.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/taurusdbtable.py b/lib/taurus/qt/qtgui/table/taurusdbtable.py
index 6bf8e3ff..6bf8e3ff 100644
--- a/taurus/lib/taurus/qt/qtgui/table/taurusdbtable.py
+++ b/lib/taurus/qt/qtgui/table/taurusdbtable.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/taurusdevicepropertytable.py b/lib/taurus/qt/qtgui/table/taurusdevicepropertytable.py
index 9901ec3b..9901ec3b 100644
--- a/taurus/lib/taurus/qt/qtgui/table/taurusdevicepropertytable.py
+++ b/lib/taurus/qt/qtgui/table/taurusdevicepropertytable.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/taurusgrid.py b/lib/taurus/qt/qtgui/table/taurusgrid.py
index 5048dfab..5048dfab 100644
--- a/taurus/lib/taurus/qt/qtgui/table/taurusgrid.py
+++ b/lib/taurus/qt/qtgui/table/taurusgrid.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/taurustable.py b/lib/taurus/qt/qtgui/table/taurustable.py
index 185b1dbc..185b1dbc 100644
--- a/taurus/lib/taurus/qt/qtgui/table/taurustable.py
+++ b/lib/taurus/qt/qtgui/table/taurustable.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/taurusvaluestable.py b/lib/taurus/qt/qtgui/table/taurusvaluestable.py
index ffcea9bd..ffcea9bd 100644
--- a/taurus/lib/taurus/qt/qtgui/table/taurusvaluestable.py
+++ b/lib/taurus/qt/qtgui/table/taurusvaluestable.py
diff --git a/taurus/lib/taurus/qt/qtgui/table/taurusvaluestable_ro.py b/lib/taurus/qt/qtgui/table/taurusvaluestable_ro.py
index 82a9d640..82a9d640 100644
--- a/taurus/lib/taurus/qt/qtgui/table/taurusvaluestable_ro.py
+++ b/lib/taurus/qt/qtgui/table/taurusvaluestable_ro.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/PermanentCustomPanelsDlg.py b/lib/taurus/qt/qtgui/taurusgui/PermanentCustomPanelsDlg.py
index 9eb692d7..9eb692d7 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/PermanentCustomPanelsDlg.py
+++ b/lib/taurus/qt/qtgui/taurusgui/PermanentCustomPanelsDlg.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/__init__.py b/lib/taurus/qt/qtgui/taurusgui/__init__.py
index bf1f5fbd..bf1f5fbd 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/__init__.py
+++ b/lib/taurus/qt/qtgui/taurusgui/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/appsettingswizard.py b/lib/taurus/qt/qtgui/taurusgui/appsettingswizard.py
index d97f36a3..d97f36a3 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/appsettingswizard.py
+++ b/lib/taurus/qt/qtgui/taurusgui/appsettingswizard.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/__init__.py b/lib/taurus/qt/qtgui/taurusgui/conf/__init__.py
index d833fbc4..d833fbc4 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/__init__.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_noconf.py b/lib/taurus/qt/qtgui/taurusgui/conf/gui_noconf.py
index 65af63b0..65af63b0 100755
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_noconf.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/gui_noconf.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_pureconf.py b/lib/taurus/qt/qtgui/taurusgui/conf/gui_pureconf.py
index 7d0e2c3c..7d0e2c3c 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_pureconf.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/gui_pureconf.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_selfconf.py b/lib/taurus/qt/qtgui/taurusgui/conf/gui_selfconf.py
index 8e32451b..8e32451b 100755
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/gui_selfconf.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/gui_selfconf.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/__init__.py b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/__init__.py
index 729d964b..729d964b 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/__init__.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/config.py b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/config.py
index e03d005c..e03d005c 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/config.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/config.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jdw b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jdw
index ce584b3b..ce584b3b 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jdw
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jdw
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jpg b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jpg
index 2b4f3715..2b4f3715 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jpg
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/example01.jpg
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jdw b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jdw
index b5a6e301..b5a6e301 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jdw
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jdw
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jpg b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jpg
index 964e50ab..964e50ab 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jpg
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_example01/images/syn2.jpg
Binary files differ
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/__init__.py b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/__init__.py
index 729d964b..729d964b 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/__init__.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/config.py b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/config.py
index e7dee2b7..e7dee2b7 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/config.py
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/config.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/tgconf_macrogui.ini b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/tgconf_macrogui.ini
index 44905da4..44905da4 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/tgconf_macrogui.ini
+++ b/lib/taurus/qt/qtgui/taurusgui/conf/tgconf_macrogui/tgconf_macrogui.ini
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/macrolistener.py b/lib/taurus/qt/qtgui/taurusgui/macrolistener.py
index b4bcb096..b4bcb096 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/macrolistener.py
+++ b/lib/taurus/qt/qtgui/taurusgui/macrolistener.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/paneldescriptionwizard.py b/lib/taurus/qt/qtgui/taurusgui/paneldescriptionwizard.py
index 607b5c15..607b5c15 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/paneldescriptionwizard.py
+++ b/lib/taurus/qt/qtgui/taurusgui/paneldescriptionwizard.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/taurusgui.py b/lib/taurus/qt/qtgui/taurusgui/taurusgui.py
index 29e6e0c6..29e6e0c6 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/taurusgui.py
+++ b/lib/taurus/qt/qtgui/taurusgui/taurusgui.py
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/ui/AssociationDialog.ui b/lib/taurus/qt/qtgui/taurusgui/ui/AssociationDialog.ui
index 80f45919..80f45919 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/ui/AssociationDialog.ui
+++ b/lib/taurus/qt/qtgui/taurusgui/ui/AssociationDialog.ui
diff --git a/taurus/lib/taurus/qt/qtgui/taurusgui/utils.py b/lib/taurus/qt/qtgui/taurusgui/utils.py
index 44464a7d..44464a7d 100644
--- a/taurus/lib/taurus/qt/qtgui/taurusgui/utils.py
+++ b/lib/taurus/qt/qtgui/taurusgui/utils.py
diff --git a/taurus/lib/taurus/qt/qtgui/test/__init__.py b/lib/taurus/qt/qtgui/test/__init__.py
index a50aaedc..a50aaedc 100644
--- a/taurus/lib/taurus/qt/qtgui/test/__init__.py
+++ b/lib/taurus/qt/qtgui/test/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/test/base.py b/lib/taurus/qt/qtgui/test/base.py
index 06c45f50..06c45f50 100644
--- a/taurus/lib/taurus/qt/qtgui/test/base.py
+++ b/lib/taurus/qt/qtgui/test/base.py
diff --git a/taurus/lib/taurus/qt/qtgui/tree/__init__.py b/lib/taurus/qt/qtgui/tree/__init__.py
index 93576b1e..93576b1e 100644
--- a/taurus/lib/taurus/qt/qtgui/tree/__init__.py
+++ b/lib/taurus/qt/qtgui/tree/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/tree/qtree.py b/lib/taurus/qt/qtgui/tree/qtree.py
index 603d04d2..603d04d2 100644
--- a/taurus/lib/taurus/qt/qtgui/tree/qtree.py
+++ b/lib/taurus/qt/qtgui/tree/qtree.py
diff --git a/taurus/lib/taurus/qt/qtgui/tree/taurusdbtree.py b/lib/taurus/qt/qtgui/tree/taurusdbtree.py
index eb903de6..eb903de6 100644
--- a/taurus/lib/taurus/qt/qtgui/tree/taurusdbtree.py
+++ b/lib/taurus/qt/qtgui/tree/taurusdbtree.py
diff --git a/taurus/lib/taurus/qt/qtgui/tree/taurusdevicetree.py b/lib/taurus/qt/qtgui/tree/taurusdevicetree.py
index 7f181308..7f181308 100644
--- a/taurus/lib/taurus/qt/qtgui/tree/taurusdevicetree.py
+++ b/lib/taurus/qt/qtgui/tree/taurusdevicetree.py
diff --git a/taurus/lib/taurus/qt/qtgui/tree/taurustree.py b/lib/taurus/qt/qtgui/tree/taurustree.py
index 8697233d..8697233d 100644
--- a/taurus/lib/taurus/qt/qtgui/tree/taurustree.py
+++ b/lib/taurus/qt/qtgui/tree/taurustree.py
diff --git a/taurus/lib/taurus/qt/qtgui/ui/DevMainVariable.ui b/lib/taurus/qt/qtgui/ui/DevMainVariable.ui
index 38ee0450..38ee0450 100644
--- a/taurus/lib/taurus/qt/qtgui/ui/DevMainVariable.ui
+++ b/lib/taurus/qt/qtgui/ui/DevMainVariable.ui
diff --git a/taurus/lib/taurus/qt/qtgui/ui/SaveDataDir.ui b/lib/taurus/qt/qtgui/ui/SaveDataDir.ui
index 7d35ea96..7d35ea96 100644
--- a/taurus/lib/taurus/qt/qtgui/ui/SaveDataDir.ui
+++ b/lib/taurus/qt/qtgui/ui/SaveDataDir.ui
diff --git a/taurus/lib/taurus/qt/qtgui/util/__init__.py b/lib/taurus/qt/qtgui/util/__init__.py
index 44c8730f..44c8730f 100644
--- a/taurus/lib/taurus/qt/qtgui/util/__init__.py
+++ b/lib/taurus/qt/qtgui/util/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/qdraganddropdebug.py b/lib/taurus/qt/qtgui/util/qdraganddropdebug.py
index c767e011..c767e011 100644
--- a/taurus/lib/taurus/qt/qtgui/util/qdraganddropdebug.py
+++ b/lib/taurus/qt/qtgui/util/qdraganddropdebug.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/taurusaction.py b/lib/taurus/qt/qtgui/util/taurusaction.py
index a53767dc..a53767dc 100644
--- a/taurus/lib/taurus/qt/qtgui/util/taurusaction.py
+++ b/lib/taurus/qt/qtgui/util/taurusaction.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/taurusactionfactory.py b/lib/taurus/qt/qtgui/util/taurusactionfactory.py
index 53ced986..53ced986 100644
--- a/taurus/lib/taurus/qt/qtgui/util/taurusactionfactory.py
+++ b/lib/taurus/qt/qtgui/util/taurusactionfactory.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/tauruscolor.py b/lib/taurus/qt/qtgui/util/tauruscolor.py
index eb450efe..eb450efe 100644
--- a/taurus/lib/taurus/qt/qtgui/util/tauruscolor.py
+++ b/lib/taurus/qt/qtgui/util/tauruscolor.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/taurusropepatch.py b/lib/taurus/qt/qtgui/util/taurusropepatch.py
index 4c7a4291..4c7a4291 100644
--- a/taurus/lib/taurus/qt/qtgui/util/taurusropepatch.py
+++ b/lib/taurus/qt/qtgui/util/taurusropepatch.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/taurusscreenshot.py b/lib/taurus/qt/qtgui/util/taurusscreenshot.py
index 8dea6e6d..8dea6e6d 100644
--- a/taurus/lib/taurus/qt/qtgui/util/taurusscreenshot.py
+++ b/lib/taurus/qt/qtgui/util/taurusscreenshot.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/tauruswidget_qtdesignerplugin_template b/lib/taurus/qt/qtgui/util/tauruswidget_qtdesignerplugin_template
index d76bfef9..d76bfef9 100644
--- a/taurus/lib/taurus/qt/qtgui/util/tauruswidget_qtdesignerplugin_template
+++ b/lib/taurus/qt/qtgui/util/tauruswidget_qtdesignerplugin_template
diff --git a/taurus/lib/taurus/qt/qtgui/util/tauruswidget_template b/lib/taurus/qt/qtgui/util/tauruswidget_template
index 3cab2f00..3cab2f00 100644
--- a/taurus/lib/taurus/qt/qtgui/util/tauruswidget_template
+++ b/lib/taurus/qt/qtgui/util/tauruswidget_template
diff --git a/taurus/lib/taurus/qt/qtgui/util/tauruswidgetfactory.py b/lib/taurus/qt/qtgui/util/tauruswidgetfactory.py
index 8a45c5f2..8a45c5f2 100644
--- a/taurus/lib/taurus/qt/qtgui/util/tauruswidgetfactory.py
+++ b/lib/taurus/qt/qtgui/util/tauruswidgetfactory.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/tauruswidgettree.py b/lib/taurus/qt/qtgui/util/tauruswidgettree.py
index dbaecc47..dbaecc47 100644
--- a/taurus/lib/taurus/qt/qtgui/util/tauruswidgettree.py
+++ b/lib/taurus/qt/qtgui/util/tauruswidgettree.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/__init__.py b/lib/taurus/qt/qtgui/util/test/__init__.py
index bfa1d383..bfa1d383 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/__init__.py
+++ b/lib/taurus/qt/qtgui/util/test/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/__init__.py b/lib/taurus/qt/qtgui/util/test/test_ui/__init__.py
index c8c1e555..c8c1e555 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/__init__.py
+++ b/lib/taurus/qt/qtgui/util/test/test_ui/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/__init__.py b/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/__init__.py
index 9ffe6b53..9ffe6b53 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/__init__.py
+++ b/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/__init__.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/ui/MyWidget3.ui b/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/ui/MyWidget3.ui
index 7dcbbfa0..7dcbbfa0 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/ui/MyWidget3.ui
+++ b/lib/taurus/qt/qtgui/util/test/test_ui/mywidget3/ui/MyWidget3.ui
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/test_ui.py b/lib/taurus/qt/qtgui/util/test/test_ui/test_ui.py
index 3673099c..3673099c 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/test_ui.py
+++ b/lib/taurus/qt/qtgui/util/test/test_ui/test_ui.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/ui/MyWidget1.ui b/lib/taurus/qt/qtgui/util/test/test_ui/ui/MyWidget1.ui
index 7dcbbfa0..7dcbbfa0 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/ui/MyWidget1.ui
+++ b/lib/taurus/qt/qtgui/util/test/test_ui/ui/MyWidget1.ui
diff --git a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/ui/mywidget2/mywidget2_custom.ui b/lib/taurus/qt/qtgui/util/test/test_ui/ui/mywidget2/mywidget2_custom.ui
index 7dcbbfa0..7dcbbfa0 100644
--- a/taurus/lib/taurus/qt/qtgui/util/test/test_ui/ui/mywidget2/mywidget2_custom.ui
+++ b/lib/taurus/qt/qtgui/util/test/test_ui/ui/mywidget2/mywidget2_custom.ui
diff --git a/taurus/lib/taurus/qt/qtgui/util/ui.py b/lib/taurus/qt/qtgui/util/ui.py
index 0c939738..0c939738 100644
--- a/taurus/lib/taurus/qt/qtgui/util/ui.py
+++ b/lib/taurus/qt/qtgui/util/ui.py
diff --git a/taurus/lib/taurus/qt/qtgui/util/widgetgen.py b/lib/taurus/qt/qtgui/util/widgetgen.py
index 757950aa..757950aa 100644
--- a/taurus/lib/taurus/qt/qtgui/util/widgetgen.py
+++ b/lib/taurus/qt/qtgui/util/widgetgen.py
diff --git a/taurus/lib/taurus/qt/qtopengl/__init__.py b/lib/taurus/qt/qtopengl/__init__.py
index 9afdcc03..9afdcc03 100644
--- a/taurus/lib/taurus/qt/qtopengl/__init__.py
+++ b/lib/taurus/qt/qtopengl/__init__.py
diff --git a/taurus/lib/taurus/qt/uic/__init__.py b/lib/taurus/qt/uic/__init__.py
index 1130eca6..1130eca6 100644
--- a/taurus/lib/taurus/qt/uic/__init__.py
+++ b/lib/taurus/qt/uic/__init__.py
diff --git a/taurus/lib/taurus/qt/uic/pyuic4/taurus.py b/lib/taurus/qt/uic/pyuic4/taurus.py
index 9c616e67..9c616e67 100644
--- a/taurus/lib/taurus/qt/uic/pyuic4/taurus.py
+++ b/lib/taurus/qt/uic/pyuic4/taurus.py
diff --git a/taurus/lib/taurus/qt/uic/tau2taurus_map.py b/lib/taurus/qt/uic/tau2taurus_map.py
index ae082d10..ae082d10 100644
--- a/taurus/lib/taurus/qt/uic/tau2taurus_map.py
+++ b/lib/taurus/qt/uic/tau2taurus_map.py
diff --git a/taurus/lib/taurus/tauruscustomsettings.py b/lib/taurus/tauruscustomsettings.py
index 971e9c22..971e9c22 100644
--- a/taurus/lib/taurus/tauruscustomsettings.py
+++ b/lib/taurus/tauruscustomsettings.py
diff --git a/taurus/lib/taurus/test/__init__.py b/lib/taurus/test/__init__.py
index 5418d265..5418d265 100644
--- a/taurus/lib/taurus/test/__init__.py
+++ b/lib/taurus/test/__init__.py
diff --git a/taurus/lib/taurus/test/base.py b/lib/taurus/test/base.py
index 31a5c611..31a5c611 100644
--- a/taurus/lib/taurus/test/base.py
+++ b/lib/taurus/test/base.py
diff --git a/taurus/lib/taurus/test/fuzzytest.py b/lib/taurus/test/fuzzytest.py
index 95625dac..95625dac 100644
--- a/taurus/lib/taurus/test/fuzzytest.py
+++ b/lib/taurus/test/fuzzytest.py
diff --git a/taurus/lib/taurus/test/moduleexplorer.py b/lib/taurus/test/moduleexplorer.py
index f1d18d8f..f1d18d8f 100644
--- a/taurus/lib/taurus/test/moduleexplorer.py
+++ b/lib/taurus/test/moduleexplorer.py
diff --git a/taurus/lib/taurus/test/resource.py b/lib/taurus/test/resource.py
index bcd18427..bcd18427 100644
--- a/taurus/lib/taurus/test/resource.py
+++ b/lib/taurus/test/resource.py
diff --git a/taurus/lib/taurus/test/skip.py b/lib/taurus/test/skip.py
index ed52c1e5..ed52c1e5 100644
--- a/taurus/lib/taurus/test/skip.py
+++ b/lib/taurus/test/skip.py
diff --git a/taurus/lib/taurus/test/test_import.py b/lib/taurus/test/test_import.py
index a1f98f32..a1f98f32 100644
--- a/taurus/lib/taurus/test/test_import.py
+++ b/lib/taurus/test/test_import.py
diff --git a/taurus/lib/taurus/test/testsuite.py b/lib/taurus/test/testsuite.py
index 0cdcdef3..0cdcdef3 100644
--- a/taurus/lib/taurus/test/testsuite.py
+++ b/lib/taurus/test/testsuite.py
diff --git a/taurus/lib/taurus/web/__init__.py b/lib/taurus/web/__init__.py
index b8e01ed4..b8e01ed4 100644
--- a/taurus/lib/taurus/web/__init__.py
+++ b/lib/taurus/web/__init__.py
diff --git a/taurus/lib/taurus/web/examples/tornado/countclient.html b/lib/taurus/web/examples/tornado/countclient.html
index ecccf2f4..ecccf2f4 100644
--- a/taurus/lib/taurus/web/examples/tornado/countclient.html
+++ b/lib/taurus/web/examples/tornado/countclient.html
diff --git a/taurus/lib/taurus/web/examples/tornado/countserver.py b/lib/taurus/web/examples/tornado/countserver.py
index 0058bd3f..0058bd3f 100644
--- a/taurus/lib/taurus/web/examples/tornado/countserver.py
+++ b/lib/taurus/web/examples/tornado/countserver.py
diff --git a/taurus/lib/taurus/web/examples/tornado/demo.html b/lib/taurus/web/examples/tornado/demo.html
index a2c5cde9..a2c5cde9 100644
--- a/taurus/lib/taurus/web/examples/tornado/demo.html
+++ b/lib/taurus/web/examples/tornado/demo.html
diff --git a/taurus/lib/taurus/web/examples/tornado/demo.py b/lib/taurus/web/examples/tornado/demo.py
index 7fac5c55..7fac5c55 100644
--- a/taurus/lib/taurus/web/examples/tornado/demo.py
+++ b/lib/taurus/web/examples/tornado/demo.py
diff --git a/taurus/lib/taurus/web/examples/tornado/demo1.html b/lib/taurus/web/examples/tornado/demo1.html
index 5c1edf8b..5c1edf8b 100644
--- a/taurus/lib/taurus/web/examples/tornado/demo1.html
+++ b/lib/taurus/web/examples/tornado/demo1.html
diff --git a/taurus/lib/taurus/web/examples/tornado/demo2.html b/lib/taurus/web/examples/tornado/demo2.html
index 277ae890..277ae890 100644
--- a/taurus/lib/taurus/web/examples/tornado/demo2.html
+++ b/lib/taurus/web/examples/tornado/demo2.html
diff --git a/taurus/lib/taurus/web/examples/tornado/demo3.html b/lib/taurus/web/examples/tornado/demo3.html
index c6e5339e..c6e5339e 100644
--- a/taurus/lib/taurus/web/examples/tornado/demo3.html
+++ b/lib/taurus/web/examples/tornado/demo3.html
diff --git a/taurus/lib/taurus/web/examples/tornado/demo4.html b/lib/taurus/web/examples/tornado/demo4.html
index 4b55b248..4b55b248 100644
--- a/taurus/lib/taurus/web/examples/tornado/demo4.html
+++ b/lib/taurus/web/examples/tornado/demo4.html
diff --git a/taurus/lib/taurus/web/examples/tornado/machinestatus.html b/lib/taurus/web/examples/tornado/machinestatus.html
index 03201dff..03201dff 100644
--- a/taurus/lib/taurus/web/examples/tornado/machinestatus.html
+++ b/lib/taurus/web/examples/tornado/machinestatus.html
diff --git a/taurus/lib/taurus/web/examples/tornado/machinestatus.py b/lib/taurus/web/examples/tornado/machinestatus.py
index 059ee2a3..059ee2a3 100644
--- a/taurus/lib/taurus/web/examples/tornado/machinestatus.py
+++ b/lib/taurus/web/examples/tornado/machinestatus.py
diff --git a/taurus/lib/taurus/web/examples/tornado/static/css/demo.css b/lib/taurus/web/examples/tornado/static/css/demo.css
index a0056bf8..a0056bf8 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/css/demo.css
+++ b/lib/taurus/web/examples/tornado/static/css/demo.css
diff --git a/taurus/lib/taurus/web/examples/tornado/static/css/machinestatus.css b/lib/taurus/web/examples/tornado/static/css/machinestatus.css
index 1a91ea55..1a91ea55 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/css/machinestatus.css
+++ b/lib/taurus/web/examples/tornado/static/css/machinestatus.css
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/countclient.coffee b/lib/taurus/web/examples/tornado/static/js/countclient.coffee
index bb11f5c4..bb11f5c4 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/countclient.coffee
+++ b/lib/taurus/web/examples/tornado/static/js/countclient.coffee
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/countclient.js b/lib/taurus/web/examples/tornado/static/js/countclient.js
index 106978d8..106978d8 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/countclient.js
+++ b/lib/taurus/web/examples/tornado/static/js/countclient.js
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/demo.js b/lib/taurus/web/examples/tornado/static/js/demo.js
index a1ed2b69..a1ed2b69 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/demo.js
+++ b/lib/taurus/web/examples/tornado/static/js/demo.js
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/demo1.js b/lib/taurus/web/examples/tornado/static/js/demo1.js
index ebca6a19..ebca6a19 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/demo1.js
+++ b/lib/taurus/web/examples/tornado/static/js/demo1.js
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/demo2.js b/lib/taurus/web/examples/tornado/static/js/demo2.js
index 9f8fa5aa..9f8fa5aa 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/demo2.js
+++ b/lib/taurus/web/examples/tornado/static/js/demo2.js
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/demo3.js b/lib/taurus/web/examples/tornado/static/js/demo3.js
index 0bc6e8e5..0bc6e8e5 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/demo3.js
+++ b/lib/taurus/web/examples/tornado/static/js/demo3.js
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/demo4.js b/lib/taurus/web/examples/tornado/static/js/demo4.js
index 4a35cf6d..4a35cf6d 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/demo4.js
+++ b/lib/taurus/web/examples/tornado/static/js/demo4.js
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee b/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee
index 41640933..41640933 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee
+++ b/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee
diff --git a/taurus/lib/taurus/web/examples/tornado/static/js/machinestatus.js b/lib/taurus/web/examples/tornado/static/js/machinestatus.js
index 95dca018..95dca018 100644
--- a/taurus/lib/taurus/web/examples/tornado/static/js/machinestatus.js
+++ b/lib/taurus/web/examples/tornado/static/js/machinestatus.js
diff --git a/taurus/lib/taurus/web/static/css/digital.ttf b/lib/taurus/web/static/css/digital.ttf
index 16b2f6c2..16b2f6c2 100644
--- a/taurus/lib/taurus/web/static/css/digital.ttf
+++ b/lib/taurus/web/static/css/digital.ttf
Binary files differ
diff --git a/taurus/lib/taurus/web/static/css/taurus.css b/lib/taurus/web/static/css/taurus.css
index 93d94567..93d94567 100644
--- a/taurus/lib/taurus/web/static/css/taurus.css
+++ b/lib/taurus/web/static/css/taurus.css
diff --git a/taurus/lib/taurus/web/static/favicon.ico b/lib/taurus/web/static/favicon.ico
index 77932941..77932941 100644
--- a/taurus/lib/taurus/web/static/favicon.ico
+++ b/lib/taurus/web/static/favicon.ico
Binary files differ
diff --git a/taurus/lib/taurus/web/static/js/taurus.coffee b/lib/taurus/web/static/js/taurus.coffee
index 0cb0a969..0cb0a969 100644
--- a/taurus/lib/taurus/web/static/js/taurus.coffee
+++ b/lib/taurus/web/static/js/taurus.coffee
diff --git a/taurus/lib/taurus/web/static/js/taurus.js b/lib/taurus/web/static/js/taurus.js
index 32d134ff..32d134ff 100644
--- a/taurus/lib/taurus/web/static/js/taurus.js
+++ b/lib/taurus/web/static/js/taurus.js
diff --git a/taurus/lib/taurus/web/taurustornado.py b/lib/taurus/web/taurustornado.py
index 54abfadb..54abfadb 100644
--- a/taurus/lib/taurus/web/taurustornado.py
+++ b/lib/taurus/web/taurustornado.py
diff --git a/taurus/lib/taurus/web/template/index.html b/lib/taurus/web/template/index.html
index 63cf1847..63cf1847 100644
--- a/taurus/lib/taurus/web/template/index.html
+++ b/lib/taurus/web/template/index.html
diff --git a/makedist.sh b/makedist.sh
index 0799b68d..df4f9615 100755
--- a/makedist.sh
+++ b/makedist.sh
@@ -26,11 +26,10 @@
# It is meant for internal taurus distribution managers use so do not expect
# in an arbitrary system (i.e. do not cry about bugs in this script)
-
#Create distribution packages
rm -rf build
#create windows installable
-python setup.py bdist_wininst --plat-name win install_scripts --wrappers --ignore-shebang
+python setup.py bdist_wininst --plat-name win install --no-doc install_scripts --wrappers --ignore-shebang build --no-doc
#create source tarball (without docs)
rm -rf build
python setup.py sdist
diff --git a/sandbox/mntgrp_gui b/sandbox/mntgrp_gui
deleted file mode 100755
index 2ea97c12..00000000
--- a/sandbox/mntgrp_gui
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import mntgrp_gui
-
-from PyQt4 import Qt
-from taurus.qt.qtgui.application import TaurusApplication
-from taurus.qt.qtgui.extra_sardana.measurementgroup import MntGrpChannelPanel
-from functools import partial
-
-def openCfgMg(mg):
- d = Qt.QDialog(panel)
- l = Qt.QVBoxLayout()
- d.setLayout(l)
- w = MntGrpChannelPanel(d)
- l.addWidget(w)
- w.setModel(mg)
- d.show()
-
-app = TaurusApplication()
-
-panel = Qt.QMainWindow()
-w = Qt.QWidget()
-panel.setCentralWidget(w)
-ui = mntgrp_gui.Ui_Form()
-ui.setupUi(w)
-
-
-Qt.QObject.connect(ui.cfgMg1, Qt.SIGNAL("clicked()"), partial(openCfgMg, "mg1"))
-Qt.QObject.connect(ui.cfgMg2, Qt.SIGNAL("clicked()"), partial(openCfgMg, "mg2"))
-
-
-panel.show()
-sys.exit(app.exec_())
diff --git a/sandbox/mntgrp_gui.py b/sandbox/mntgrp_gui.py
deleted file mode 100644
index 25fd395d..00000000
--- a/sandbox/mntgrp_gui.py
+++ /dev/null
@@ -1,343 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'mg_gui.ui'
-#
-# Created: Fri Jul 29 15:42:51 2011
-# by: PyQt4 UI code generator 4.8.3
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-try:
- _fromUtf8 = QtCore.QString.fromUtf8
-except AttributeError:
- _fromUtf8 = lambda s: s
-
-class Ui_Form(object):
- def setupUi(self, Form):
- Form.setObjectName(_fromUtf8("Form"))
- Form.resize(501, 414)
- self.gridLayout_2 = QtGui.QGridLayout(Form)
- self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
- self.groupBox = QtGui.QGroupBox(Form)
- self.groupBox.setObjectName(_fromUtf8("groupBox"))
- self.gridLayout = QtGui.QGridLayout(self.groupBox)
- self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
- self.taurusLabel = TaurusLabel(self.groupBox)
- self.taurusLabel.setObjectName(_fromUtf8("taurusLabel"))
- self.gridLayout.addWidget(self.taurusLabel, 0, 0, 1, 1)
- self.taurusLabel_2 = TaurusLabel(self.groupBox)
- self.taurusLabel_2.setObjectName(_fromUtf8("taurusLabel_2"))
- self.gridLayout.addWidget(self.taurusLabel_2, 0, 2, 1, 1)
- self.taurusLed_2 = TaurusLed(self.groupBox)
- self.taurusLed_2.setObjectName(_fromUtf8("taurusLed_2"))
- self.gridLayout.addWidget(self.taurusLed_2, 0, 3, 1, 1)
- self.taurusLabel_3 = TaurusLabel(self.groupBox)
- self.taurusLabel_3.setObjectName(_fromUtf8("taurusLabel_3"))
- self.gridLayout.addWidget(self.taurusLabel_3, 1, 0, 1, 1)
- self.taurusLabel_4 = TaurusLabel(self.groupBox)
- self.taurusLabel_4.setObjectName(_fromUtf8("taurusLabel_4"))
- self.gridLayout.addWidget(self.taurusLabel_4, 1, 2, 1, 1)
- self.taurusLed_3 = TaurusLed(self.groupBox)
- self.taurusLed_3.setObjectName(_fromUtf8("taurusLed_3"))
- self.gridLayout.addWidget(self.taurusLed_3, 1, 3, 1, 1)
- self.taurusLabel_5 = TaurusLabel(self.groupBox)
- self.taurusLabel_5.setObjectName(_fromUtf8("taurusLabel_5"))
- self.gridLayout.addWidget(self.taurusLabel_5, 2, 0, 1, 1)
- self.taurusLabel_6 = TaurusLabel(self.groupBox)
- self.taurusLabel_6.setObjectName(_fromUtf8("taurusLabel_6"))
- self.gridLayout.addWidget(self.taurusLabel_6, 2, 2, 1, 1)
- self.taurusLed_4 = TaurusLed(self.groupBox)
- self.taurusLed_4.setObjectName(_fromUtf8("taurusLed_4"))
- self.gridLayout.addWidget(self.taurusLed_4, 2, 3, 1, 1)
- self.taurusLabel_7 = TaurusLabel(self.groupBox)
- self.taurusLabel_7.setObjectName(_fromUtf8("taurusLabel_7"))
- self.gridLayout.addWidget(self.taurusLabel_7, 3, 0, 1, 1)
- self.taurusLabel_8 = TaurusLabel(self.groupBox)
- self.taurusLabel_8.setObjectName(_fromUtf8("taurusLabel_8"))
- self.gridLayout.addWidget(self.taurusLabel_8, 3, 2, 1, 1)
- self.taurusLed_5 = TaurusLed(self.groupBox)
- self.taurusLed_5.setObjectName(_fromUtf8("taurusLed_5"))
- self.gridLayout.addWidget(self.taurusLed_5, 3, 3, 1, 1)
- self.taurusLabel_9 = TaurusLabel(self.groupBox)
- self.taurusLabel_9.setObjectName(_fromUtf8("taurusLabel_9"))
- self.gridLayout.addWidget(self.taurusLabel_9, 4, 0, 1, 1)
- self.taurusLabel_10 = TaurusLabel(self.groupBox)
- self.taurusLabel_10.setObjectName(_fromUtf8("taurusLabel_10"))
- self.gridLayout.addWidget(self.taurusLabel_10, 4, 2, 1, 1)
- self.taurusLed_6 = TaurusLed(self.groupBox)
- self.taurusLed_6.setObjectName(_fromUtf8("taurusLed_6"))
- self.gridLayout.addWidget(self.taurusLed_6, 4, 3, 1, 1)
- self.taurusLabel_11 = TaurusLabel(self.groupBox)
- self.taurusLabel_11.setObjectName(_fromUtf8("taurusLabel_11"))
- self.gridLayout.addWidget(self.taurusLabel_11, 5, 0, 1, 1)
- self.taurusLabel_12 = TaurusLabel(self.groupBox)
- self.taurusLabel_12.setObjectName(_fromUtf8("taurusLabel_12"))
- self.gridLayout.addWidget(self.taurusLabel_12, 5, 2, 1, 1)
- self.taurusLed_7 = TaurusLed(self.groupBox)
- self.taurusLed_7.setObjectName(_fromUtf8("taurusLed_7"))
- self.gridLayout.addWidget(self.taurusLed_7, 5, 3, 1, 1)
- self.gridLayout_2.addWidget(self.groupBox, 0, 2, 1, 1)
- self.groupBox_2 = QtGui.QGroupBox(Form)
- self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
- self.gridLayout_3 = QtGui.QGridLayout(self.groupBox_2)
- self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
- self.taurusLabel_13 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_13.setObjectName(_fromUtf8("taurusLabel_13"))
- self.gridLayout_3.addWidget(self.taurusLabel_13, 0, 0, 1, 1)
- self.taurusLabel_14 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_14.setObjectName(_fromUtf8("taurusLabel_14"))
- self.gridLayout_3.addWidget(self.taurusLabel_14, 0, 2, 1, 1)
- self.taurusLed_8 = TaurusLed(self.groupBox_2)
- self.taurusLed_8.setObjectName(_fromUtf8("taurusLed_8"))
- self.gridLayout_3.addWidget(self.taurusLed_8, 0, 3, 1, 1)
- self.taurusLabel_15 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_15.setObjectName(_fromUtf8("taurusLabel_15"))
- self.gridLayout_3.addWidget(self.taurusLabel_15, 1, 0, 1, 1)
- self.taurusLabel_16 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_16.setObjectName(_fromUtf8("taurusLabel_16"))
- self.gridLayout_3.addWidget(self.taurusLabel_16, 1, 2, 1, 1)
- self.taurusLed_9 = TaurusLed(self.groupBox_2)
- self.taurusLed_9.setObjectName(_fromUtf8("taurusLed_9"))
- self.gridLayout_3.addWidget(self.taurusLed_9, 1, 3, 1, 1)
- self.taurusLabel_17 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_17.setObjectName(_fromUtf8("taurusLabel_17"))
- self.gridLayout_3.addWidget(self.taurusLabel_17, 2, 0, 1, 1)
- self.taurusLabel_18 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_18.setObjectName(_fromUtf8("taurusLabel_18"))
- self.gridLayout_3.addWidget(self.taurusLabel_18, 2, 2, 1, 1)
- self.taurusLed_10 = TaurusLed(self.groupBox_2)
- self.taurusLed_10.setObjectName(_fromUtf8("taurusLed_10"))
- self.gridLayout_3.addWidget(self.taurusLed_10, 2, 3, 1, 1)
- self.taurusLabel_19 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_19.setObjectName(_fromUtf8("taurusLabel_19"))
- self.gridLayout_3.addWidget(self.taurusLabel_19, 3, 0, 1, 1)
- self.taurusLabel_20 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_20.setObjectName(_fromUtf8("taurusLabel_20"))
- self.gridLayout_3.addWidget(self.taurusLabel_20, 3, 2, 1, 1)
- self.taurusLed_11 = TaurusLed(self.groupBox_2)
- self.taurusLed_11.setObjectName(_fromUtf8("taurusLed_11"))
- self.gridLayout_3.addWidget(self.taurusLed_11, 3, 3, 1, 1)
- self.taurusLabel_21 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_21.setObjectName(_fromUtf8("taurusLabel_21"))
- self.gridLayout_3.addWidget(self.taurusLabel_21, 4, 0, 1, 1)
- self.taurusLabel_22 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_22.setObjectName(_fromUtf8("taurusLabel_22"))
- self.gridLayout_3.addWidget(self.taurusLabel_22, 4, 2, 1, 1)
- self.taurusLed_12 = TaurusLed(self.groupBox_2)
- self.taurusLed_12.setObjectName(_fromUtf8("taurusLed_12"))
- self.gridLayout_3.addWidget(self.taurusLed_12, 4, 3, 1, 1)
- self.taurusLabel_23 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_23.setObjectName(_fromUtf8("taurusLabel_23"))
- self.gridLayout_3.addWidget(self.taurusLabel_23, 5, 0, 1, 1)
- self.taurusLabel_24 = TaurusLabel(self.groupBox_2)
- self.taurusLabel_24.setObjectName(_fromUtf8("taurusLabel_24"))
- self.gridLayout_3.addWidget(self.taurusLabel_24, 5, 2, 1, 1)
- self.taurusLed_13 = TaurusLed(self.groupBox_2)
- self.taurusLed_13.setObjectName(_fromUtf8("taurusLed_13"))
- self.gridLayout_3.addWidget(self.taurusLed_13, 5, 3, 1, 1)
- self.gridLayout_2.addWidget(self.groupBox_2, 0, 3, 1, 1)
- self.groupBox_4 = QtGui.QGroupBox(Form)
- self.groupBox_4.setObjectName(_fromUtf8("groupBox_4"))
- self.gridLayout_5 = QtGui.QGridLayout(self.groupBox_4)
- self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
- self.taurusLabel_26 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_26.setObjectName(_fromUtf8("taurusLabel_26"))
- self.gridLayout_5.addWidget(self.taurusLabel_26, 0, 0, 1, 3)
- self.taurusLed_14 = TaurusLed(self.groupBox_4)
- self.taurusLed_14.setObjectName(_fromUtf8("taurusLed_14"))
- self.gridLayout_5.addWidget(self.taurusLed_14, 1, 0, 1, 1)
- self.taurusLabel_29 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_29.setObjectName(_fromUtf8("taurusLabel_29"))
- self.gridLayout_5.addWidget(self.taurusLabel_29, 2, 0, 1, 1)
- self.taurusLabel_30 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_30.setObjectName(_fromUtf8("taurusLabel_30"))
- self.gridLayout_5.addWidget(self.taurusLabel_30, 2, 1, 1, 1)
- self.taurusValueLineEdit_2 = TaurusValueLineEdit(self.groupBox_4)
- self.taurusValueLineEdit_2.setObjectName(_fromUtf8("taurusValueLineEdit_2"))
- self.gridLayout_5.addWidget(self.taurusValueLineEdit_2, 2, 2, 1, 1)
- self.taurusLabel_33 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_33.setObjectName(_fromUtf8("taurusLabel_33"))
- self.gridLayout_5.addWidget(self.taurusLabel_33, 3, 0, 1, 1)
- self.taurusLabel_34 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_34.setObjectName(_fromUtf8("taurusLabel_34"))
- self.gridLayout_5.addWidget(self.taurusLabel_34, 3, 1, 1, 1)
- self.taurusValueLineEdit_4 = TaurusValueLineEdit(self.groupBox_4)
- self.taurusValueLineEdit_4.setObjectName(_fromUtf8("taurusValueLineEdit_4"))
- self.gridLayout_5.addWidget(self.taurusValueLineEdit_4, 3, 2, 1, 1)
- self.taurusLabel_37 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_37.setObjectName(_fromUtf8("taurusLabel_37"))
- self.gridLayout_5.addWidget(self.taurusLabel_37, 4, 0, 1, 1)
- self.taurusLabel_38 = TaurusLabel(self.groupBox_4)
- self.taurusLabel_38.setObjectName(_fromUtf8("taurusLabel_38"))
- self.gridLayout_5.addWidget(self.taurusLabel_38, 4, 1, 1, 1)
- self.taurusValueLineEdit_6 = TaurusValueLineEdit(self.groupBox_4)
- self.taurusValueLineEdit_6.setObjectName(_fromUtf8("taurusValueLineEdit_6"))
- self.gridLayout_5.addWidget(self.taurusValueLineEdit_6, 4, 2, 1, 1)
- self.horizontalLayout_2 = QtGui.QHBoxLayout()
- self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
- self.taurusCommandButton_2 = TaurusCommandButton(self.groupBox_4)
- self.taurusCommandButton_2.setObjectName(_fromUtf8("taurusCommandButton_2"))
- self.horizontalLayout_2.addWidget(self.taurusCommandButton_2)
- self.cfgMg2 = QtGui.QToolButton(self.groupBox_4)
- self.cfgMg2.setObjectName(_fromUtf8("cfgMg2"))
- self.horizontalLayout_2.addWidget(self.cfgMg2)
- self.horizontalLayout_2.setStretch(0, 1)
- self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 1, 1, 2)
- self.gridLayout_2.addWidget(self.groupBox_4, 1, 3, 1, 1)
- self.groupBox_3 = QtGui.QGroupBox(Form)
- self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
- self.gridLayout_4 = QtGui.QGridLayout(self.groupBox_3)
- self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
- self.taurusLabel_25 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_25.setObjectName(_fromUtf8("taurusLabel_25"))
- self.gridLayout_4.addWidget(self.taurusLabel_25, 0, 0, 1, 3)
- self.taurusLabel_27 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_27.setObjectName(_fromUtf8("taurusLabel_27"))
- self.gridLayout_4.addWidget(self.taurusLabel_27, 2, 1, 1, 1)
- self.taurusLabel_28 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_28.setObjectName(_fromUtf8("taurusLabel_28"))
- self.gridLayout_4.addWidget(self.taurusLabel_28, 2, 0, 1, 1)
- self.taurusValueLineEdit = TaurusValueLineEdit(self.groupBox_3)
- self.taurusValueLineEdit.setObjectName(_fromUtf8("taurusValueLineEdit"))
- self.gridLayout_4.addWidget(self.taurusValueLineEdit, 2, 2, 1, 1)
- self.taurusLed = TaurusLed(self.groupBox_3)
- self.taurusLed.setObjectName(_fromUtf8("taurusLed"))
- self.gridLayout_4.addWidget(self.taurusLed, 1, 0, 1, 1)
- self.taurusLabel_31 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_31.setObjectName(_fromUtf8("taurusLabel_31"))
- self.gridLayout_4.addWidget(self.taurusLabel_31, 3, 0, 1, 1)
- self.taurusLabel_32 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_32.setObjectName(_fromUtf8("taurusLabel_32"))
- self.gridLayout_4.addWidget(self.taurusLabel_32, 3, 1, 1, 1)
- self.taurusValueLineEdit_3 = TaurusValueLineEdit(self.groupBox_3)
- self.taurusValueLineEdit_3.setObjectName(_fromUtf8("taurusValueLineEdit_3"))
- self.gridLayout_4.addWidget(self.taurusValueLineEdit_3, 3, 2, 1, 1)
- self.taurusLabel_35 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_35.setObjectName(_fromUtf8("taurusLabel_35"))
- self.gridLayout_4.addWidget(self.taurusLabel_35, 4, 0, 1, 1)
- self.taurusLabel_36 = TaurusLabel(self.groupBox_3)
- self.taurusLabel_36.setObjectName(_fromUtf8("taurusLabel_36"))
- self.gridLayout_4.addWidget(self.taurusLabel_36, 4, 1, 1, 1)
- self.taurusValueLineEdit_5 = TaurusValueLineEdit(self.groupBox_3)
- self.taurusValueLineEdit_5.setObjectName(_fromUtf8("taurusValueLineEdit_5"))
- self.gridLayout_4.addWidget(self.taurusValueLineEdit_5, 4, 2, 1, 1)
- self.horizontalLayout_3 = QtGui.QHBoxLayout()
- self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
- self.taurusCommandButton = TaurusCommandButton(self.groupBox_3)
- self.taurusCommandButton.setObjectName(_fromUtf8("taurusCommandButton"))
- self.horizontalLayout_3.addWidget(self.taurusCommandButton)
- self.cfgMg1 = QtGui.QToolButton(self.groupBox_3)
- self.cfgMg1.setObjectName(_fromUtf8("cfgMg1"))
- self.horizontalLayout_3.addWidget(self.cfgMg1)
- self.gridLayout_4.addLayout(self.horizontalLayout_3, 1, 1, 1, 2)
- self.gridLayout_2.addWidget(self.groupBox_3, 1, 2, 1, 1)
-
- self.retranslateUi(Form)
- QtCore.QMetaObject.connectSlotsByName(Form)
-
- def retranslateUi(self, Form):
- Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
- self.groupBox.setTitle(QtGui.QApplication.translate("Form", "CTs of CTRL1", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/1/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_2.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/1/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_2.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/1/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_3.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/2/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_3.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_4.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/2/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_3.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/2/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_5.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/3/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_5.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_6.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/3/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_4.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/3/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_7.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/4/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_7.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_8.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/4/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_5.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/4/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_9.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/5/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_9.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_10.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/5/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_6.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/5/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_11.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/6/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_11.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_12.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/6/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_7.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl1/6/state", None, QtGui.QApplication.UnicodeUTF8))
- self.groupBox_2.setTitle(QtGui.QApplication.translate("Form", "CTs of CTRL2", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_13.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/1/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_13.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_14.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/1/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_8.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/1/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_15.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/2/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_15.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_16.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/2/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_9.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/2/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_17.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/3/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_17.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_18.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/3/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_10.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/3/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_19.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/4/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_19.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_20.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/4/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_11.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/4/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_21.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/5/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_21.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_22.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/5/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_12.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/5/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_23.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/6/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_23.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_24.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/6/value", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_13.setModel(QtGui.QApplication.translate("Form", "expchan/dummyctctrl2/6/state", None, QtGui.QApplication.UnicodeUTF8))
- self.groupBox_4.setTitle(QtGui.QApplication.translate("Form", "MG2", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_26.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/elementlist", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_26.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed_14.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_29.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/integrationtime?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_29.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_30.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusValueLineEdit_2.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_33.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/monitorcount?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_33.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_34.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusValueLineEdit_4.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_37.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/acquisitionmode?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_37.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_38.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusValueLineEdit_6.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusCommandButton_2.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg2", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusCommandButton_2.setCommand(QtGui.QApplication.translate("Form", "start", None, QtGui.QApplication.UnicodeUTF8))
- self.cfgMg2.setText(QtGui.QApplication.translate("Form", "...", None, QtGui.QApplication.UnicodeUTF8))
- self.groupBox_3.setTitle(QtGui.QApplication.translate("Form", "MG1", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_25.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/elementlist", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_25.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_27.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_28.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/integrationtime?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_28.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusValueLineEdit.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLed.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/state", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_31.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/monitorcount?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_31.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_32.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusValueLineEdit_3.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_35.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/acquisitionmode?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_35.setBgRole(QtGui.QApplication.translate("Form", "none", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusLabel_36.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusValueLineEdit_5.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusCommandButton.setModel(QtGui.QApplication.translate("Form", "mntgrp/v3/mg1", None, QtGui.QApplication.UnicodeUTF8))
- self.taurusCommandButton.setCommand(QtGui.QApplication.translate("Form", "start", None, QtGui.QApplication.UnicodeUTF8))
- self.cfgMg1.setText(QtGui.QApplication.translate("Form", "...", None, QtGui.QApplication.UnicodeUTF8))
-
-from taurus.qt.qtgui.display import TaurusLabel, TaurusLed
-from taurus.qt.qtgui.input import TaurusValueLineEdit
-from taurus.qt.qtgui.button import TaurusCommandButton
-
-if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- Form = QtGui.QWidget()
- ui = Ui_Form()
- ui.setupUi(Form)
- Form.show()
- sys.exit(app.exec_())
-
diff --git a/sandbox/mntgrp_gui.ui b/sandbox/mntgrp_gui.ui
deleted file mode 100644
index c67bfd7d..00000000
--- a/sandbox/mntgrp_gui.ui
+++ /dev/null
@@ -1,597 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>501</width>
- <height>414</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="2">
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>CTs of CTRL1</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="TaurusLabel" name="taurusLabel">
- <property name="model">
- <string>expchan/dummyctctrl1/1/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="TaurusLabel" name="taurusLabel_2">
- <property name="model">
- <string>expchan/dummyctctrl1/1/value</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="TaurusLed" name="taurusLed_2">
- <property name="model">
- <string>expchan/dummyctctrl1/1/state</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="TaurusLabel" name="taurusLabel_3">
- <property name="model">
- <string>expchan/dummyctctrl1/2/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="TaurusLabel" name="taurusLabel_4">
- <property name="model">
- <string>expchan/dummyctctrl1/2/value</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="TaurusLed" name="taurusLed_3">
- <property name="model">
- <string>expchan/dummyctctrl1/2/state</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="TaurusLabel" name="taurusLabel_5">
- <property name="model">
- <string>expchan/dummyctctrl1/3/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="TaurusLabel" name="taurusLabel_6">
- <property name="model">
- <string>expchan/dummyctctrl1/3/value</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="TaurusLed" name="taurusLed_4">
- <property name="model">
- <string>expchan/dummyctctrl1/3/state</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="TaurusLabel" name="taurusLabel_7">
- <property name="model">
- <string>expchan/dummyctctrl1/4/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="TaurusLabel" name="taurusLabel_8">
- <property name="model">
- <string>expchan/dummyctctrl1/4/value</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="TaurusLed" name="taurusLed_5">
- <property name="model">
- <string>expchan/dummyctctrl1/4/state</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="TaurusLabel" name="taurusLabel_9">
- <property name="model">
- <string>expchan/dummyctctrl1/5/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="TaurusLabel" name="taurusLabel_10">
- <property name="model">
- <string>expchan/dummyctctrl1/5/value</string>
- </property>
- </widget>
- </item>
- <item row="4" column="3">
- <widget class="TaurusLed" name="taurusLed_6">
- <property name="model">
- <string>expchan/dummyctctrl1/5/state</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="TaurusLabel" name="taurusLabel_11">
- <property name="model">
- <string>expchan/dummyctctrl1/6/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="TaurusLabel" name="taurusLabel_12">
- <property name="model">
- <string>expchan/dummyctctrl1/6/value</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="TaurusLed" name="taurusLed_7">
- <property name="model">
- <string>expchan/dummyctctrl1/6/state</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>CTs of CTRL2</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0,0,0">
- <item row="0" column="0">
- <widget class="TaurusLabel" name="taurusLabel_13">
- <property name="model">
- <string>expchan/dummyctctrl2/1/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="TaurusLabel" name="taurusLabel_14">
- <property name="model">
- <string>expchan/dummyctctrl2/1/value</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="TaurusLed" name="taurusLed_8">
- <property name="model">
- <string>expchan/dummyctctrl2/1/state</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="TaurusLabel" name="taurusLabel_15">
- <property name="model">
- <string>expchan/dummyctctrl2/2/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="TaurusLabel" name="taurusLabel_16">
- <property name="model">
- <string>expchan/dummyctctrl2/2/value</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="TaurusLed" name="taurusLed_9">
- <property name="model">
- <string>expchan/dummyctctrl2/2/state</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="TaurusLabel" name="taurusLabel_17">
- <property name="model">
- <string>expchan/dummyctctrl2/3/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="TaurusLabel" name="taurusLabel_18">
- <property name="model">
- <string>expchan/dummyctctrl2/3/value</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="TaurusLed" name="taurusLed_10">
- <property name="model">
- <string>expchan/dummyctctrl2/3/state</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="TaurusLabel" name="taurusLabel_19">
- <property name="model">
- <string>expchan/dummyctctrl2/4/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="TaurusLabel" name="taurusLabel_20">
- <property name="model">
- <string>expchan/dummyctctrl2/4/value</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="TaurusLed" name="taurusLed_11">
- <property name="model">
- <string>expchan/dummyctctrl2/4/state</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="TaurusLabel" name="taurusLabel_21">
- <property name="model">
- <string>expchan/dummyctctrl2/5/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="TaurusLabel" name="taurusLabel_22">
- <property name="model">
- <string>expchan/dummyctctrl2/5/value</string>
- </property>
- </widget>
- </item>
- <item row="4" column="3">
- <widget class="TaurusLed" name="taurusLed_12">
- <property name="model">
- <string>expchan/dummyctctrl2/5/state</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="TaurusLabel" name="taurusLabel_23">
- <property name="model">
- <string>expchan/dummyctctrl2/6/value?configuration=dev_alias</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="TaurusLabel" name="taurusLabel_24">
- <property name="model">
- <string>expchan/dummyctctrl2/6/value</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="TaurusLed" name="taurusLed_13">
- <property name="model">
- <string>expchan/dummyctctrl2/6/state</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>MG2</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0" colspan="3">
- <widget class="TaurusLabel" name="taurusLabel_26">
- <property name="model">
- <string>mntgrp/v3/mg2/elementlist</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="TaurusLed" name="taurusLed_14">
- <property name="model">
- <string>mntgrp/v3/mg2/state</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="TaurusLabel" name="taurusLabel_29">
- <property name="model">
- <string>mntgrp/v3/mg2/integrationtime?configuration=label</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="TaurusLabel" name="taurusLabel_30">
- <property name="model">
- <string>mntgrp/v3/mg2/integrationtime</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="TaurusValueLineEdit" name="taurusValueLineEdit_2">
- <property name="model">
- <string>mntgrp/v3/mg2/integrationtime</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="TaurusLabel" name="taurusLabel_33">
- <property name="model">
- <string>mntgrp/v3/mg2/monitorcount?configuration=label</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="TaurusLabel" name="taurusLabel_34">
- <property name="model">
- <string>mntgrp/v3/mg2/monitorcount</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="TaurusValueLineEdit" name="taurusValueLineEdit_4">
- <property name="model">
- <string>mntgrp/v3/mg2/monitorcount</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="TaurusLabel" name="taurusLabel_37">
- <property name="model">
- <string>mntgrp/v3/mg2/acquisitionmode?configuration=label</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="TaurusLabel" name="taurusLabel_38">
- <property name="model">
- <string>mntgrp/v3/mg2/acquisitionmode</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="TaurusValueLineEdit" name="taurusValueLineEdit_6">
- <property name="model">
- <string>mntgrp/v3/mg2/acquisitionmode</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0">
- <item>
- <widget class="TaurusCommandButton" name="taurusCommandButton_2">
- <property name="Model">
- <string>mntgrp/v3/mg2</string>
- </property>
- <property name="Command">
- <string>start</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="cfgMg2">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>MG1</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0" colspan="3">
- <widget class="TaurusLabel" name="taurusLabel_25">
- <property name="model">
- <string>mntgrp/v3/mg1/elementlist</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="TaurusLabel" name="taurusLabel_27">
- <property name="model">
- <string>mntgrp/v3/mg1/integrationtime</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="TaurusLabel" name="taurusLabel_28">
- <property name="model">
- <string>mntgrp/v3/mg1/integrationtime?configuration=label</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="TaurusValueLineEdit" name="taurusValueLineEdit">
- <property name="model">
- <string>mntgrp/v3/mg1/integrationtime</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="TaurusLed" name="taurusLed">
- <property name="model">
- <string>mntgrp/v3/mg1/state</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="TaurusLabel" name="taurusLabel_31">
- <property name="model">
- <string>mntgrp/v3/mg1/monitorcount?configuration=label</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="TaurusLabel" name="taurusLabel_32">
- <property name="model">
- <string>mntgrp/v3/mg1/monitorcount</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="TaurusValueLineEdit" name="taurusValueLineEdit_3">
- <property name="model">
- <string>mntgrp/v3/mg1/monitorcount</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="TaurusLabel" name="taurusLabel_35">
- <property name="model">
- <string>mntgrp/v3/mg1/acquisitionmode?configuration=label</string>
- </property>
- <property name="bgRole">
- <string>none</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="TaurusLabel" name="taurusLabel_36">
- <property name="model">
- <string>mntgrp/v3/mg1/acquisitionmode</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="TaurusValueLineEdit" name="taurusValueLineEdit_5">
- <property name="model">
- <string>mntgrp/v3/mg1/acquisitionmode</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="TaurusCommandButton" name="taurusCommandButton">
- <property name="Model">
- <string>mntgrp/v3/mg1</string>
- </property>
- <property name="Command">
- <string>start</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="cfgMg1">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLineEdit</class>
- <extends>QLineEdit</extends>
- <header>taurus.qt.qtgui.input</header>
- </customwidget>
- <customwidget>
- <class>TaurusCommandButton</class>
- <extends>QPushButton</extends>
- <header>taurus.qt.qtgui.button</header>
- </customwidget>
- <customwidget>
- <class>TaurusLed</class>
- <extends>QLed</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>QLed</class>
- <extends>QPixmapWidget</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>QPixmapWidget</class>
- <extends>QWidget</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/sandbox/motgrp_gui b/sandbox/motgrp_gui
deleted file mode 100755
index 8fe6364c..00000000
--- a/sandbox/motgrp_gui
+++ /dev/null
@@ -1,302 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import traceback
-
-import taurus
-from taurus.qt import Qt
-from taurus.qt.qtgui.application import TaurusApplication
-from taurus.qt.qtgui.container import QGroupWidget
-from taurus.qt.qtgui.display import TaurusLabel, TaurusLed
-from taurus.qt.qtgui.input import TaurusValueSpinBox, TaurusValueSpinBoxEx
-from taurus.qt.qtgui.resource import getIcon, getThemeIcon
-from taurus.qt.qtgui.console import TaurusConsole
-from taurus.qt.qtgui.panel import TaurusAttrForm
-from taurus.qt.qtgui.button import TaurusCommandButton, TaurusLockButton, \
- TaurusLauncherButton
-
-Spin = TaurusValueSpinBox
-
-class CmdButton(TaurusCommandButton):
-
- def getDisplayValue(self):
- return ""
-
-class CfgButton(TaurusLauncherButton):
-
- def getDisplayValue(self):
- return ""
-
-DFT_STATE_ICON_SIZE = Qt.QSize(24, 24)
-DFT_BTN_ICON_SIZE = Qt.QSize(20, 20)
-LS_ICON_SIZE = Qt.QSize(16,16)
-DFT_BTN_STYLE = "QPushButton {margin: 0px; padding: 0px;}"
-
-def createPoolPanel(name):
- panel = QGroupWidget()
- panel.titleIcon = getIcon(":/applications-system.svg")
- content = panel.content()
- panel_l = Qt.QGridLayout()
- content.setLayout(panel_l)
-
- stop = TaurusCommandButton(parent=content, command='Stop')
- stop.setIcon(getIcon(":/stop_sign.svg"))
- stop.setIconSize(Qt.QSize(48, 48))
- #stop.setStyleSheet(DFT_BTN_STYLE)
- #stop.setFlat(True)
- stop.Model = name
- panel_l.addWidget(stop, 0, 0)
-
- abort = TaurusCommandButton(parent=content, command='Abort')
- abort.setIcon(getIcon(":/panic_button.png"))
- abort.setIconSize(Qt.QSize(48, 48))
- #abort.setStyleSheet(DFT_BTN_STYLE)
- #abort.setFlat(True)
- abort.Model = name
- panel_l.addWidget(abort, 0, 1)
-
- return panel
-
-
-def createMotorPanel(*names):
- m_panel = QGroupWidget()
- m_panel.titleIcon = getIcon(":/designer/extra_motor.png")
- content = m_panel.content()
- m_panel_l = createMotorLayout(content, *names)
- content.setLayout(m_panel_l)
- return m_panel
-
-def createMotorLayout(content, *names):
- m_panel_l = Qt.QGridLayout()
- m_panel_l.setMargin(4)
- m_panel_l.setHorizontalSpacing(2)
- m_panel_l.setVerticalSpacing(2)
- monospace = Qt.QFont("Monospace",10)
- monospace_small = Qt.QFont("Monospace",8)
- for i, name in enumerate(names):
- row = i*2
- motor = taurus.Device(name)
- motor_attrs = [ attr.lower() for attr in motor.get_attribute_list() ]
-
- state = TaurusLed(content)
- state.setMinimumSize(DFT_STATE_ICON_SIZE)
- state.setMaximumSize(DFT_STATE_ICON_SIZE)
- state.model = motor.getNormalName() + "/state"
- m_panel_l.addWidget( state, row, 0)
-
- label = TaurusLabel(content)
- label.model = name + "/position?configuration=dev_alias"
- label.bgRole = None
- m_panel_l.addWidget( label, row, 1)
-
- r_value = TaurusLabel(content)
- r_value.setMinimumWidth(80)
- r_value.model = name + "/position"
- m_panel_l.addWidget(r_value, row, 2)
-
- w_value = Spin(content)
- w_value.setMinimumWidth(100)
- w_value.model = name + "/position"
- m_panel_l.addWidget(w_value, row, 3)
-
- unit = TaurusLabel(content)
- unit.model = name + "/position?configuration=unit"
- unit.bgRole = None
- m_panel_l.addWidget(unit, row, 4)
-
- stop = CmdButton(parent=content, command='stop')
- stop.setIcon(getIcon(":/stop_sign.svg"))
- stop.setIconSize(DFT_BTN_ICON_SIZE)
- stop.setStyleSheet(DFT_BTN_STYLE)
- stop.setFlat(True)
- stop.Model = name
- m_panel_l.addWidget(stop, row, 5)
-
- abort = CmdButton(parent=content, command='abort')
- abort.setIcon(getIcon(":/panic_button.png"))
- abort.setIconSize(DFT_BTN_ICON_SIZE)
- abort.setStyleSheet(DFT_BTN_STYLE)
- abort.setFlat(True)
- abort.Model = name
- m_panel_l.addWidget(abort, row, 6)
-
- lock = TaurusLockButton(content)
- lock.setIconSize(DFT_BTN_ICON_SIZE)
- lock.setStyleSheet(DFT_BTN_STYLE)
- lock.setFlat(True)
- lock.model = name
- m_panel_l.addWidget(lock, row, 7)
-
- w = TaurusAttrForm()
- w.setMinimumSize(Qt.QSize(500,700))
- cfg = CfgButton(widget=w, icon=":/categories/preferences-system.svg")
- cfg.setIconSize(DFT_BTN_ICON_SIZE)
- cfg.setStyleSheet(DFT_BTN_STYLE)
- cfg.setModel(name)
- m_panel_l.addWidget(cfg, row, 8)
-
- status = TaurusLabel(content)
- font = Qt.QFont(status.font())
- font.setPointSize(8)
- status.setFont(font)
- status.model = name + "/status"
- status.bgRole = None
- m_panel_l.addWidget(status, row+1, 3, 1, 6)
-
- if "dialposition" in motor_attrs:
- dial = TaurusLabel(content)
- dial.model = name + "/dialposition"
- m_panel_l.addWidget(dial, row+1, 2)
-
- if "limit_switches" in motor_attrs:
- limitswitches = TaurusLed(content), TaurusLed(content), TaurusLed(content)
- lmswtch_l = Qt.QVBoxLayout()
- for n, lm_swtch_w in enumerate(limitswitches):
- lm_swtch_w.setMinimumSize(LS_ICON_SIZE)
- lm_swtch_w.setMaximumSize(LS_ICON_SIZE)
- lmswtch_l.addWidget(lm_swtch_w)
- lm_swtch_w.model = name + "/limit_switches"
- lm_swtch_w.modelIndex = n
- lm_swtch_w.onColor = "red"
- m_panel_l.addItem(lmswtch_l, row, 9, 2, 1)
-
- m_panel_l.setRowStretch(row, 0)
- m_panel_l.setRowStretch(row+1, 0)
-
- m_panel_l.setRowStretch(row+2, 1)
- m_panel_l.setColumnStretch(0, 0)
- m_panel_l.setColumnStretch(1, 0)
- m_panel_l.setColumnStretch(2, 1)
- m_panel_l.setColumnStretch(3, 1)
- m_panel_l.setColumnStretch(4, 0)
- m_panel_l.setColumnStretch(5, 0)
- m_panel_l.setColumnStretch(6, 0)
- return m_panel_l
-
-def createMotorGroupPanel(*names):
- m_panel = QGroupWidget()
- m_panel.titleIcon = getIcon(":/designer/extra_motor.png")
- m_panel_l = Qt.QGridLayout()
- content = m_panel.content()
- content.setLayout(m_panel_l)
-
- name = names[0]
- mg = taurus.Device(name)
- elements = mg.elementlist
- state = TaurusLed(content)
- state.setMinimumSize(24,24)
- label = TaurusLabel(content)
- m_panel_l.addWidget(state, 0, 0)
- m_panel_l.addWidget(label, 0, 1)
- go = Qt.QPushButton("Go")
- m_panel_l.addWidget(go, 0, 2)
- m_panel_l.setRowStretch(0, 0)
- w_pos_widgets=[]
- for i, element in enumerate(elements):
- row = i+1
- m_label = Qt.QLabel(element, content)
- m_panel_l.addWidget(m_label, row, 0)
- r_value = TaurusLabel(content)
- r_value.model = name + "/position"
- r_value.modelIndex = str(i)
- m_panel_l.addWidget(r_value, row, 1)
- w_value = Qt.QDoubleSpinBox()
- w_value.setMinimum(float("-inf"))
- w_value.setMaximum(float("+inf"))
- m_panel_l.addWidget(w_value, row, 2)
- m_panel_l.setRowStretch(row, 0)
- w_pos_widgets.append(w_value)
- state.model = name + "/state"
- label.model = name + "/position?configuration=dev_alias"
- label.bgRole = None
-
- go._mg = state.getModelObj().getParentObj()
- go._positions = w_pos_widgets
- class MoveIt(Qt.QObject):
- def move(self):
- try:
- button = self.sender()
- positions = [ w.value() for w in button._positions ]
- button._mg.write_attribute("position", positions)
- except:
- traceback.print_exc()
- go._move = MoveIt()
- Qt.QObject.connect(go, Qt.SIGNAL("clicked()"), go._move.move)
- m_panel_l.setRowStretch(i+2, 1)
- m_panel_l.setColumnStretch(0, 0)
- m_panel_l.setColumnStretch(1, 0)
- m_panel_l.setColumnStretch(2, 1)
- m_panel_l.setColumnStretch(3, 1)
- return m_panel
-
-app = TaurusApplication()
-app.setTaurusStyle("nebula")
-panel = Qt.QMainWindow()
-panel.setWindowTitle("Pool Motor Test GUI")
-
-dock1 = Qt.QDockWidget("Motors Panel")
-panel.addDockWidget(Qt.Qt.LeftDockWidgetArea, dock1)
-dock1_w = Qt.QWidget()
-dock1.setWidget(dock1_w)
-
-dock2 = Qt.QDockWidget("Motor Groups Panel")
-panel.addDockWidget(Qt.Qt.LeftDockWidgetArea, dock2)
-dock2_w = Qt.QWidget()
-dock2.setWidget(dock2_w)
-
-# MOTOR PANEL ------------------------------------------------------------------
-
-panel1_l = Qt.QGridLayout()
-panel1_l.setContentsMargins(4,4,4,4)
-panel1_l.setSpacing(4)
-dock1_w.setLayout(panel1_l)
-
-pool_panel = createPoolPanel("Pool_V3_1")
-pool_panel.title = "Main Control Panel"
-panel1_l.addWidget(pool_panel, 0, 0)
-
-motors = ["motor%02d" % i for i in range(1,5)]
-m1_panel = createMotorPanel(*motors)
-m1_panel.title = "Motors on motorctrl01"
-panel1_l.addWidget(m1_panel, 1, 0)
-
-pm1_panel = createMotorPanel("GAP01", "OFFSET01")
-pm1_panel.title = "Pseudo motors"
-panel1_l.addWidget(pm1_panel, 2, 0, 1, 1)
-
-panel1_l.setRowStretch(0, 0)
-panel1_l.setRowStretch(1, 1)
-
-# MOTOR GROUP PANEL ------------------------------------------------------------
-
-mg_panel_style = {
- 'start_color' : 'rgb(255, 60, 60)',
- 'stop_color' : 'rgb(200, 0, 0)',
- 'font_color' : 'rgb(0, 0, 0)',
- #'border_radius': '10px',
-}
-
-panel2_l = Qt.QGridLayout()
-panel2_l.setContentsMargins(4,4,4,4)
-panel2_l.setSpacing(4)
-dock2_w.setLayout(panel2_l)
-
-mg1_panel = createMotorGroupPanel("motgrp01")
-mg1_panel.title = "Motor Group 1"
-mg1_panel.setTitleStyle(mg_panel_style)
-panel2_l.addWidget(mg1_panel, 0, 0)
-
-mg2_panel = createMotorGroupPanel("motgrp02")
-mg2_panel.title = "Motor Group 2"
-mg2_panel.setTitleStyle(mg_panel_style)
-panel2_l.addWidget(mg2_panel, 0, 1)
-
-panel2_l.setRowStretch(0, 0)
-panel2_l.setRowStretch(1, 1)
-
-# MAIN -------------------------------------------------------------------------
-
-panel.show()
-sys.exit(app.exec_())
-
-
diff --git a/sandbox/pool_gui b/sandbox/pool_gui
deleted file mode 100644
index d55a2157..00000000
--- a/sandbox/pool_gui
+++ /dev/null
@@ -1,281 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import datetime
-
-import taurus
-from taurus.core.util.argparse import get_taurus_parser
-from taurus.core.util import CodecFactory
-from taurus.qt import Qt
-from taurus.qt.qtgui.application import TaurusApplication
-from taurus.qt.qtgui.container import QGroupWidget
-from taurus.qt.qtgui.display import TaurusLabel, TaurusLed
-from taurus.qt.qtgui.input import TaurusValueSpinBox, TaurusValueSpinBoxEx
-from taurus.qt.qtgui.resource import getIcon, getThemeIcon
-from taurus.qt.qtgui.console import TaurusConsole
-from taurus.qt.qtgui.panel import TaurusAttrForm
-from taurus.qt.qtgui.button import TaurusCommandButton, TaurusLockButton, \
- TaurusLauncherButton
-
-Spin = TaurusValueSpinBox
-
-class CmdButton(TaurusCommandButton):
-
- def getDisplayValue(self):
- return ""
-
-class CfgButton(TaurusLauncherButton):
-
- def getDisplayValue(self):
- return ""
-
-DFT_STATE_ICON_SIZE = Qt.QSize(24, 24)
-DFT_BTN_ICON_SIZE = Qt.QSize(20, 20)
-LS_ICON_SIZE = Qt.QSize(16,16)
-DFT_BTN_STYLE = "QPushButton {margin: 0px; padding: 0px;}"
-
-def create_main_panel(tab, pool):
- name = pool.getNormalName()
- main_panel = Qt.QWidget(tab)
- main_panel_l = Qt.QGridLayout()
- main_panel.setLayout(main_panel_l)
-
- panel = QGroupWidget()
- panel.title = "Emergency panel"
- panel.titleIcon = getIcon(":/applications-system.svg")
- content = panel.content()
- panel_l = Qt.QGridLayout()
- content.setLayout(panel_l)
-
- stop = TaurusCommandButton(parent=content, command='Stop')
- stop.setIcon(getIcon(":/stop_sign.svg"))
- stop.setIconSize(Qt.QSize(48, 48))
- #stop.setStyleSheet(DFT_BTN_STYLE)
- #stop.setFlat(True)
- stop.Model = name
- panel_l.addWidget(stop, 0, 0)
-
- abort = TaurusCommandButton(parent=content, command='Abort')
- abort.setIcon(getIcon(":/panic_button.png"))
- abort.setIconSize(Qt.QSize(48, 48))
- #abort.setStyleSheet(DFT_BTN_STYLE)
- #abort.setFlat(True)
- abort.Model = name
- panel_l.addWidget(abort, 0, 1)
-
- main_panel_l.addWidget(panel, 0, 0)
-
- return main_panel
-
-MOTION_TYPES = "Motor", "PseudoMotor"
-
-def get_elements(elements, e_type):
- ret = [ data for data in elements if data['type'] == e_type ]
- ret.sort(cmp = lambda a,b : cmp(a['name'], b['name']))
- return ret
-
-def get_motor_elements(elements):
- return get_elements(elements, "Motor")
-
-def get_pseudo_motor_elements(elements):
- return get_elements(elements, "PseudoMotor")
-
-def get_elements_by_controller(elements):
- ret = {}
- for elem in elements:
- ctrl = elem['controller']
- ctrl_elems = ret.get(ctrl)
- if ctrl_elems is None:
- ret[ctrl] = ctrl_elems = []
- ctrl_elems.append(elem)
- return ret
-
-def create_motor_panel(elements):
- m_panel = QGroupWidget()
- m_panel.title = "Motors"
- m_panel.titleIcon = getIcon(":/designer/extra_motor.png")
- content = m_panel.content()
- ctrl_elements = get_elements_by_controller(elements)
- m_panel_l = create_motor_layout(content, ctrl_elements)
- content.setLayout(m_panel_l)
- return m_panel
-
-def create_motor_layout(content, ctrl_elements):
- m_panel_l = Qt.QGridLayout()
- m_panel_l.setMargin(4)
- m_panel_l.setHorizontalSpacing(2)
- m_panel_l.setVerticalSpacing(2)
-
- monospace = Qt.QFont("Monospace",10)
- monospace_small = Qt.QFont("Monospace",8)
- ctrl_element_names = ctrl_elements.keys()
- ctrl_element_names.sort(cmp=lambda a,b : cmp(len(ctrl_elements[a]), len(ctrl_elements[b])),
- reverse=True)
-
- j = 0
- for j, ctrl_name in enumerate(ctrl_element_names):
- motors = ctrl_elements[ctrl_name]
- motor_names = [ motor['name'] for motor in motors ]
-
- ctrl_panel = QGroupWidget(content)
- m_panel_l.addWidget(ctrl_panel, j/2, j %2)
-
- ctrl_panel.title = "Motors in %s" % ctrl_name
- ctrl_panel.titleIcon = getIcon(":/designer/extra_motor.png")
- ctrl_content = ctrl_panel.content()
- ctrl_panel_l = Qt.QGridLayout()
- ctrl_content.setLayout(ctrl_panel_l)
- ctrl_panel_l.setMargin(4)
- ctrl_panel_l.setHorizontalSpacing(2)
- ctrl_panel_l.setVerticalSpacing(2)
-
- i = 0
- for i, name in enumerate(motor_names):
- t = datetime.datetime.now()
- row = i*2
- motor = taurus.Device(name)
- motor_attrs = [ attr.lower() for attr in motor.get_attribute_list() ]
-
- state = TaurusLed(ctrl_content)
- state.setMinimumSize(DFT_STATE_ICON_SIZE)
- state.setMaximumSize(DFT_STATE_ICON_SIZE)
- state.model = motor.getNormalName() + "/state"
- ctrl_panel_l.addWidget( state, row, 0)
-
- label = TaurusLabel(ctrl_content)
- label.model = name + "/position?configuration=dev_alias"
- label.bgRole = None
- ctrl_panel_l.addWidget( label, row, 1)
-
- r_value = TaurusLabel(ctrl_content)
- r_value.setMinimumWidth(80)
- r_value.model = name + "/position"
- ctrl_panel_l.addWidget(r_value, row, 2)
-
- w_value = Spin(ctrl_content)
- w_value.setMinimumWidth(100)
- w_value.model = name + "/position"
- ctrl_panel_l.addWidget(w_value, row, 3)
-
- unit = TaurusLabel(ctrl_content)
- unit.model = name + "/position?configuration=unit"
- unit.bgRole = None
- ctrl_panel_l.addWidget(unit, row, 4)
-
- stop = CmdButton(parent=ctrl_content, command='stop')
- stop.setIcon(getIcon(":/stop_sign.svg"))
- stop.setIconSize(DFT_BTN_ICON_SIZE)
- stop.setStyleSheet(DFT_BTN_STYLE)
- stop.setFlat(True)
- stop.Model = name
- ctrl_panel_l.addWidget(stop, row, 5)
-
- abort = CmdButton(parent=ctrl_content, command='abort')
- abort.setIcon(getIcon(":/panic_button.png"))
- abort.setIconSize(DFT_BTN_ICON_SIZE)
- abort.setStyleSheet(DFT_BTN_STYLE)
- abort.setFlat(True)
- abort.Model = name
- ctrl_panel_l.addWidget(abort, row, 6)
-
-# lock = TaurusLockButton(ctrl_content)
-# lock.setIconSize(DFT_BTN_ICON_SIZE)
-# lock.setStyleSheet(DFT_BTN_STYLE)
-# lock.setFlat(True)
-# lock.model = name
-# ctrl_panel_l.addWidget(lock, row, 7)
-
-# w = TaurusAttrForm()
-# w.setMinimumSize(Qt.QSize(500,700))
-# cfg = CfgButton(widget=w, icon=":/categories/preferences-system.svg")
-# cfg.setIconSize(DFT_BTN_ICON_SIZE)
-# cfg.setStyleSheet(DFT_BTN_STYLE)
-# cfg.setModel(name)
-# ctrl_panel_l.addWidget(cfg, row, 8)
-
- status = TaurusLabel(ctrl_content)
- font = Qt.QFont(status.font())
- font.setPointSize(8)
- status.setFont(font)
- status.model = name + "/status"
- status.bgRole = None
- ctrl_panel_l.addWidget(status, row+1, 3, 1, 6)
-
- if "dialposition" in motor_attrs:
- dial = TaurusLabel(ctrl_content)
- dial.model = name + "/dialposition"
- ctrl_panel_l.addWidget(dial, row+1, 2)
-
- if "limit_switches" in motor_attrs:
- limitswitches = TaurusLed(ctrl_content), TaurusLed(ctrl_content), TaurusLed(ctrl_content)
- lmswtch_l = Qt.QVBoxLayout()
- for n, lm_swtch_w in enumerate(limitswitches):
- lm_swtch_w.setMinimumSize(LS_ICON_SIZE)
- lm_swtch_w.setMaximumSize(LS_ICON_SIZE)
- lmswtch_l.addWidget(lm_swtch_w)
- lm_swtch_w.model = name + "/limit_switches"
- lm_swtch_w.modelIndex = n
- lm_swtch_w.onColor = "red"
- ctrl_panel_l.addItem(lmswtch_l, row, 9, 2, 1)
-
- ctrl_panel_l.setRowStretch(row, 0)
- ctrl_panel_l.setRowStretch(row+1, 0)
-
- print "Created", name,"took", datetime.datetime.now()-t
-
- ctrl_panel_l.setRowStretch(row+2, 1)
- ctrl_panel_l.setColumnStretch(0, 0)
- ctrl_panel_l.setColumnStretch(1, 0)
- ctrl_panel_l.setColumnStretch(2, 1)
- ctrl_panel_l.setColumnStretch(3, 1)
- ctrl_panel_l.setColumnStretch(4, 0)
- ctrl_panel_l.setColumnStretch(5, 0)
- ctrl_panel_l.setColumnStretch(6, 0)
-
- m_panel_l.setRowStretch(j, 0)
-
- m_panel_l.setRowStretch(j+1, 1)
- return m_panel_l
-
-def create_motion_panel(tab, pool, elements):
- motion_panel = Qt.QWidget(tab)
- motion_panel_l = Qt.QGridLayout()
- motion_panel.setLayout(motion_panel_l)
- motors = get_motor_elements(elements)
- motor_panel = create_motor_panel(motors)
- motion_panel_l.addWidget(motor_panel)
- return motion_panel
-
-def gui(model):
- pool = taurus.Device(model)
- elements = CodecFactory().decode(pool.elements, ensure_ascii=True)['new']
- window = Qt.QMainWindow()
- window.setWindowTitle("Pool %s test" % pool.getSimpleName())
-
- tab = Qt.QTabWidget(window)
- window.setCentralWidget(tab)
-
- main_panel = create_main_panel(tab, pool)
- tab.addTab(main_panel, "Main")
-
- motion_panel = create_motion_panel(tab, pool, elements)
- tab.addTab(motion_panel, "Motion")
-
- return window
-
-def main():
- parser = get_taurus_parser()
- parser.usage = "%prog [options] <pool device name>"
-
- app = TaurusApplication(cmd_line_parser=parser)
- app.setTaurusStyle("nebula")
- args = app.get_command_line_args()
- if len(args) < 1:
- sys.stderr.write("Need to supply model attribute")
- sys.exit(1)
- window = gui(args[0])
- window.show()
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- main()
diff --git a/sardanaConfig/doc/Makefile b/sardanaConfig/doc/Makefile
deleted file mode 100644
index d2d13387..00000000
--- a/sardanaConfig/doc/Makefile
+++ /dev/null
@@ -1,130 +0,0 @@
-# Makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
-BUILDDIR = build
-
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
-
-help:
- @echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
- @echo " dirhtml to make HTML files named index.html in directories"
- @echo " singlehtml to make a single large HTML file"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " qthelp to make HTML files and a qthelp project"
- @echo " devhelp to make HTML files and a Devhelp project"
- @echo " epub to make an epub"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " text to make text files"
- @echo " man to make manual pages"
- @echo " changes to make an overview of all changed/added/deprecated items"
- @echo " linkcheck to check all external links for integrity"
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
-
-clean:
- -rm -rf $(BUILDDIR)/*
-
-html:
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-dirhtml:
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-singlehtml:
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
- @echo
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-pickle:
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
-
-json:
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
- @echo
- @echo "Build finished; now you can process the JSON files."
-
-htmlhelp:
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-qthelp:
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
- @echo
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/sardanaConfig.qhcp"
- @echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/sardanaConfig.qhc"
-
-devhelp:
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
- @echo
- @echo "Build finished."
- @echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/sardanaConfig"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/sardanaConfig"
- @echo "# devhelp"
-
-epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
- @echo
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-latex:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
- "(use \`make latexpdf' here to do that automatically)."
-
-latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through pdflatex..."
- make -C $(BUILDDIR)/latex all-pdf
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-text:
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
- @echo
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
- @echo
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-changes:
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
- @echo
- @echo "The overview file is in $(BUILDDIR)/changes."
-
-linkcheck:
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in $(BUILDDIR)/linkcheck/output.txt."
-
-doctest:
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
- @echo "Testing of doctests in the sources finished, look at the " \
- "results in $(BUILDDIR)/doctest/output.txt."
diff --git a/sardanaConfig/doc/source/add_device_wizard.rst b/sardanaConfig/doc/source/add_device_wizard.rst
deleted file mode 100644
index 79b30b53..00000000
--- a/sardanaConfig/doc/source/add_device_wizard.rst
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-.. currentmodule:: new_device_wizard
-
-Add Device Wizard
-======================
-
-This chapter describes the API for adding a device through a wizard.
-
-
-Example::
-
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(get_resources())
- Pages = Enumeration('Pages', ('SelectSardanaPool', 'NewDevice','CommitPage','OutroPage'))
- w = wiz.SardanaBaseWizard()
- w.setWindowTitle("Add New Hardware Wizard")
- selectPool = SelectSardanaPoolBasePage(Sardana,Pool)
- w.setPage(Pages.SelectSardanaPool, selectPool)
- selectPool.setNextPageId(Pages.NewDevice)
- newDevice = NewDeviceBasePage()
- w.setPage(Pages.NewDevice, newDevice)
- newDevice.setNextPageId(Pages.CommitPage)
- commit_page = NewDeviceCommitBasePage()
- w.setPage(Pages.CommitPage, commit_page)
- commit_page.setNextPageId(Pages.OutroPage)
- w.show()
- sys.exit(app.exec_())
-
-
-.. automodule:: add_device_wizard
- :members:
- :undoc-members:
-
- \ No newline at end of file
diff --git a/sardanaConfig/doc/source/conf.py b/sardanaConfig/doc/source/conf.py
deleted file mode 100644
index 08528949..00000000
--- a/sardanaConfig/doc/source/conf.py
+++ /dev/null
@@ -1,224 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# sardanaConfig documentation build configuration file, created by
-# sphinx-quickstart on Wed Mar 16 15:18:01 2011.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys, os
-
-local_dir = os.path.dirname(os.path.abspath(__file__))
-d = os.path.join(local_dir, "..", "..", "src", "wizards")
-sys.path.insert(0, d)
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
-
-# -- General configuration -----------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8-sig'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'sardanaConfig'
-copyright = u'2011, Marek'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '1.0'
-# The full version, including alpha/beta/rc tags.
-release = '1.0'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-exclude_patterns = []
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-html_theme = 'default'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_domain_indices = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'sardanaConfigdoc'
-
-
-# -- Options for LaTeX output --------------------------------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
- ('index', 'sardanaConfig.tex', u'sardanaConfig Documentation',
- u'Marek', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# If true, show page references after internal links.
-#latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#latex_show_urls = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_domain_indices = True
-
-
-# -- Options for manual page output --------------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- ('index', 'sardanaconfig', u'sardanaConfig Documentation',
- [u'Marek'], 1)
-]
-
-
-# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/sardanaConfig/doc/source/index.rst b/sardanaConfig/doc/source/index.rst
deleted file mode 100644
index e5fcf904..00000000
--- a/sardanaConfig/doc/source/index.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-.. sardanaConfig documentation master file, created by
- sphinx-quickstart on Wed Mar 16 15:18:01 2011.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-Welcome to sardanaConfig's documentation!
-=========================================
-
-Contents:
-
-.. toctree::
- :maxdepth: 2
-
- new_sardana_wizard
- add_device_wizard
- settings_widget
- simple_tree_model
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
diff --git a/sardanaConfig/doc/source/new_sardana_wizard.rst b/sardanaConfig/doc/source/new_sardana_wizard.rst
deleted file mode 100644
index 04db36f1..00000000
--- a/sardanaConfig/doc/source/new_sardana_wizard.rst
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-.. currentmodule:: new_sardana_wizard
-
-Add Sardana Wizard
-======================
-
-This chapter describes the API for creating a instance of new Sardana through a wizard.
-
-Example::
-
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(wiz.get_resources())
-
- Pages = Enumeration('Pages', ('IntroPage', 'TangoPage', 'SardanaPage', 'PoolPage', 'MSPage','CommitPage','OutroPage'))
- w = wiz.SardanaBaseWizard()
-
- intro = NewSardanaIntroPage()
- w.setPage(Pages.IntroPage, intro)
- intro.setNextPageId(Pages.TangoPage)
-
- tg_host_page = SelectTangoHostPage()
- w.setPage(Pages.TangoPage, tg_host_page)
- tg_host_page.checkData()
- tg_host_page.setNextPageId(Pages.SardanaPage)
-
- sardana_page = AddSardanaBasePage()
- w.setPage(Pages.SardanaPage, sardana_page)
- sardana_page.setNextPageId(Pages.PoolPage)
-
- pool_page = AddPoolBasePage()
- w.setPage(Pages.PoolPage, pool_page)
- pool_page.setNextPageId(Pages.MSPage)
-
- ms_page = AddMSBasePage()
- w.setPage(Pages.MSPage, ms_page)
- ms_page.setNextPageId(Pages.CommitPage)
-
- commit_page = SardanaCommitBasePage()
- w.setPage(Pages.CommitPage, commit_page)
- commit_page.setNextPageId(Pages.OutroPage)
-
- outro_page = SardanaOutroBasePage()
- w.setPage(Pages.OutroPage, outro_page)
- w.setOption (QtGui.QWizard.CancelButtonOnLeft , True)
-
-
- #Qt.QObject.connect(w, Qt.SIGNAL("done()"), done)
- w.show()
- sys.exit(app.exec_())
-
-
-
-.. automodule:: new_sardana_wizard
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/sardanaConfig/doc/source/settings_widget.rst b/sardanaConfig/doc/source/settings_widget.rst
deleted file mode 100644
index 1aa21b53..00000000
--- a/sardanaConfig/doc/source/settings_widget.rst
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-.. currentmodule:: settings_widget
-
-Settings Widget
-======================
-
-Settings Widget - the widget to setting up the different types of properties.
-The user variable modifications are stored inside the internal stack and can be cancelled.
-(undo()/redo()).
-
-The Settings Widget returns: (properties, name, values)
-
-types:
-
-- string
-- integer
-- boolean
-- float
-
-dimensions:
-
-- 0D
-- 1D
-- 2D
-
-Example::
-
- app = QtGui.QApplication(sys.argv)
- properties = []
- properties.append(PropertyInfo("name", "string", "0D", "deviceName"))
- properties.append(PropertyInfo("number0", "integer", "0D", 5))
- properties.append(PropertyInfo("boollll0", "boolean", "0D", False))
- properties.append(PropertyInfo("number1", "float", "0D", 3.5))
- properties.append(PropertyInfo("string2", "string", "0D", "hehe"))
- properties.append(PropertyInfo("table0", "integer", "1D", [1,2,3]))
- properties.append(PropertyInfo("tablestringD1", "float", "1D", [1.5]))
- properties.append(PropertyInfo("tablestringD1", "string", "1D", ["aaaa","bbb","ccc"]))
- properties.append(PropertyInfo("tablefloatD1", "float", "1D", [1.0,2.5,3.6]))
- properties.append(PropertyInfo("tablebooleanD1", "boolean", "1D", [True,False,True]))
- properties.append(PropertyInfo("tableboointD1", "integer", "1D", [1,2,3]))
- properties.append(PropertyInfo("tablestringD2", "string", "2D",[ ["aaaa","bbb","ccc"],["aaaa2","bbb2","ccc2"],["aaaa3","bbb3","ccc3"] ]))
-
-
- nds=SettingsWidget()
- nds.setProperties(properties)
- nds.show()
- sys.exit(app.exec_())
-
-
-
-
-.. automodule:: settings_widget
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/sardanaConfig/doc/source/simple_tree_model.rst b/sardanaConfig/doc/source/simple_tree_model.rst
deleted file mode 100644
index 8385af3e..00000000
--- a/sardanaConfig/doc/source/simple_tree_model.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-.. currentmodule:: simple_tree_model
-
-Simple Tree Model
-======================
-
-Simple tree model
-
-
-.. automodule:: simple_tree_model
- :members:
- :undoc-members: \ No newline at end of file
diff --git a/sardanaConfig/src/wizards/add_device_wizard.py b/sardanaConfig/src/wizards/add_device_wizard.py
deleted file mode 100644
index 34f3eadf..00000000
--- a/sardanaConfig/src/wizards/add_device_wizard.py
+++ /dev/null
@@ -1,912 +0,0 @@
-import os, sys, wx, copy, taurus, settings_widget, simple_tree_model, wiz
-import taurus.qt.qtgui.resource
-from PyQt4 import QtGui, QtCore, Qt
-from types import *
-from taurus.core.util.enumeration import Enumeration
-from sardana.taurus.core.tango.sardana import SardanaManager
-from sardana.taurus.core.tango.sardana import PoolElementType
-
-"""This wizard is created for adding new devices. At the moment it has 4 pages:
-
-- SelectSardanaPool
-- NewDevice
-- CommitPage
-- OutroPage
-"""
-
-class SelectSardanaPoolBasePage(wiz.SardanaBasePage):
- """Page for selecting Sardana and Pool
-
- Selected values are saved in
-
- self['sardana']
- self['pool']
-
- """
-
- def __init__(self, sardana=None, pool=None, parent=None):
- wiz.SardanaBasePage.__init__(self, parent)
- self._sardana = sardana
- self._pool = pool
-
- self.setSubTitle('Please select the Pool from existing Sardana')
- self._valid = True
- self._panel = self.getPanelWidget()
- layout = QtGui.QGridLayout()
- self._sardanaNameCB = QtGui.QComboBox()
- self._poolNameCB = QtGui.QComboBox()
- layout.addItem(QtGui.QSpacerItem(60, 60, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum), 0, 0)
- layout.addWidget(QtGui.QLabel("Sardana"), 0, 1)
- layout.addItem(QtGui.QSpacerItem(60, 60, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum), 0, 3)
- layout.addWidget(self._sardanaNameCB, 0, 2)
- layout.addWidget(QtGui.QLabel("Pool"), 1, 1)
- layout.addWidget(self._poolNameCB, 1, 2)
- layout.addItem(QtGui.QSpacerItem(200, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum), 2, 2)
- self._panel.setLayout(layout)
- self.setStatus("Select the instances of Sardana and Pool, and click Next to continue")
-
- self['sardana'] = self._getSardana
- self['pool'] = self._getPool
- self.connect(self._sardanaNameCB, QtCore.SIGNAL('currentIndexChanged(int)'), self._fillPoolNameCB)
-
- def initializePage(self):
- wiz.SardanaBasePage.initializePage(self)
- self._isSardanaProper = False
- if (self._sardana) and (self._sardana in self._getSardanas()):
- self._sardanaNameCB.addItem(self._sardana)
- self._sardanaNameCB.setEnabled(False)
- self._isSardanaProper = True
- else:
- self._fillSardanaNameCB()
-
- self._isPoolProper = False
- if (self._pool) and (self._isSardanaProper):
- for pool in self._getSardana().get_pools():
- if self._pool == pool.get_name():
- self._isPoolProper = True
-
- if self._isPoolProper:
- self._poolNameCB.addItem(self._pool)
- self._poolNameCB.setEnabled(False)
- else:
- self._fillPoolNameCB()
-
- def isComplete(self):
- return self._valid
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- def _fillSardanaNameCB(self):
- self._sardanaNameCB.clear()
- for item in self._getSardanas():
- self._sardanaNameCB.addItem(item)
-
- def _fillPoolNameCB(self, int=None):
- sardana = self._getSardana()
- self._poolNameCB.clear()
- for item in sardana.get_pools():
- self._poolNameCB.addItem(item.get_name())
-
- def _getSardanas(self):
- return SardanaManager().get_sardanas()
-
- def _getSardana(self):
- return self._getSardanas()[str(self._sardanaNameCB.currentText())]
-
- def _getPool(self):
- for pool in self._getSardana().get_pools():
- if str(self._poolNameCB.currentText()) == pool.get_name():
- return pool
- return None
-
-
-class SimpleTreeView(QtGui.QTreeView):
- """
- extended version of QTreeView that is emitting signals of activation and expansion
- """
-
- def __init__(self, parent=None):
- super(SimpleTreeView, self).__init__(parent)
- self.setSelectionBehavior(QtGui.QTreeView.SelectItems)
- self.setUniformRowHeights(True)
-#
- self.connect(self, QtCore.SIGNAL("activated(QModelIndex)"),
- self.activated)
- self.connect(self, QtCore.SIGNAL("expanded(QModelIndex)"),
- self.expanded)
- self.expanded()
-
- def currentFields(self):
- return self.model().asData(self.currentIndex())
-
- def activated(self, index):
- self.emit(QtCore.SIGNAL("activated"), self.model().asRecord(index))
-
-
- def expanded(self):
- if not self.model() == None:
- for column in range(self.model().columnCount(
- QtCore.QModelIndex())):
- self.resizeColumnToContents(column)
-
-class AxisSteper(Qt.QSpinBox):
- """ Object of this class is a Spin box that can jumps from 1 to the total number
- of axis while skipping busy values
- """
- def __init__(self, controllerInfo=None, busyValues=[], parent=None):
- Qt.QSpinBox.__init__(self, parent)
- self._busyValues = busyValues
- self._controllerInfo = controllerInfo
- self.setControllerInfo(controllerInfo)
- QtCore.QObject.connect(self.lineEdit(), QtCore.SIGNAL("editingFinished()"), self._textEdited)
-
- def _textEdited(self):
- axis = int(self.value())
- if not self._controllerInfo.is_axis_free(axis):
- self._findFreeAxis()
-
- def getValue(self):
- return self.value()
-
- def setControllerInfo(self, controllerInfo):
- self._controllerInfo = controllerInfo
- if self._controllerInfo:
- self.setMaximum(self._controllerInfo.get_max_elements() - 1)
- self._findFreeAxis()
-
- def _findFreeAxis(self):
- for axis in range(self._controllerInfo.get_max_elements()):
- if self.is_axis_free(axis):
- self.setValue(axis)
- break
-
- def is_axis_free(self, axis):
- if self._controllerInfo.is_axis_free(axis):
- for busyAxis in self._busyValues:
- if axis == busyAxis:
- return False
- return True
- else:
- return False
-
- def stepBy(self, step):
- i = 1
- while True:
- axis = self.value() + i * step
- if self.is_axis_free(self.value() + i * step):
- break
- i += 1
- if axis >= 0 and axis < self._controllerInfo.get_max_elements():
- self.setValue(axis)
-
-
-class SingleAxisWidget(Qt.QWidget):
- """
- Widget for selecting name and axis for the device
- """
- def __init__(self, parent=None):
- Qt.QWidget.__init__(self, parent)
- self._layout = QtGui.QGridLayout(self)
- self.setLayout(self._layout)
- self.setupUi()
- self._controllerInfo = None
- self._edited = False
-
- def setupUi(self):
- self._nameLabel = Qt.QLabel("Name:")
- self._nameLineEdit = Qt.QLineEdit()
- self._nameLineEdit.setMinimumSize(200, 25)
- self._layout.addWidget(self._nameLabel, 0, 0, 1, 1)
- self._layout.addWidget(self._nameLineEdit, 0, 1, 1, 1)
- self._monitorLabel = Qt.QLabel("Monitor List:")
- self._axisLabel = Qt.QLabel("Axis:")
- self._axisSpinBox = AxisSteper()
- self._layout.addWidget(self._axisLabel, 1, 0, 1, 1)
- self._layout.addWidget(self._axisSpinBox, 1, 1, 1, 1)
- QtCore.QObject.connect(self._axisSpinBox.lineEdit(), QtCore.SIGNAL("textEdited(QString)"), self._textEdited)
- QtCore.QObject.connect(self._nameLineEdit, QtCore.SIGNAL("textEdited(QString)"), self._textEdited)
-
- def _textEdited(self, str):
- self._edited = True
-
- def setControllerInfo(self, controllerInfo):
- self._nameLineEdit.setText("")
- self._edited = False
- self._controllerInfo = controllerInfo
- self._axisSpinBox.setControllerInfo(self._controllerInfo)
-
- def isEdited(self):
- return self._edited
-
- def getValue(self):
- return None
-
-
-class NameEditorWidget(QtGui.QLineEdit):
- """
- for editing the name, it has to check the name if it exist in the sardana .. but it does
- """
-
- def __init__(self, parent=None):
- QtGui.QLineEdit.__init__(self, parent)
- self.setValue(self.getDefaultValue())
-
- def setValue(self, value):
- if value is None:
- value = self.getDefaultValue()
- self.setText(str(value))
- self._actualValue = self.getValue()
-
- def getValue(self):
- return str(self.text())
-
- def textChanged(self, string):
- QtGui.QLineEdit.textChanged(self, string)
-
- def focusOutEvent (self, event): #QFocusEvent
- QtGui.QLineEdit.focusOutEvent(self, event)
- self.valueChanged()
-
- def valueChanged(self):
- if not (self.getValue() == self._actualValue):
- self.emit(QtCore.SIGNAL("valueChanged"), self._actualValue, self.getValue())
- self._actualValue = self.getValue()
- self.setValue(self.getValue()) # if value is not valid
-
- @classmethod
- def getDefaultValue(self):
- return ""
-
-class TableAxisDelegate(QtGui.QItemDelegate):
- """
- Item delegate for Table Axis Widget
- """
-
- def __init__(self, parent=None):
- QtGui.QItemDelegate.__init__(self, parent)
-
- def setControllerInfo(self, controllerInfo):
- self._controllerInfo = controllerInfo
-
- def createEditor(self, parent, option, index):
- if index.column() == 0:
- editor = NameEditorWidget(parent)
- editor.installEventFilter(self)
- if index.column() == 1:
- editor = AxisSteper(self._controllerInfo, self.parent().parent().getAxisList(), parent=parent)
- editor.installEventFilter(self)
-
- return editor
-
- def setEditorData(self, editor, index):
- if index.column() == 0:
- value = index.model().data(index, QtCore.Qt.DisplayRole)
- editor.setValue(value.toString())
- if index.column() == 1:
- value = index.model().data(index, QtCore.Qt.DisplayRole)
- int , bool = value.toInt()
- editor.setValue(int)
-
- def setModelData(self, editor, model, index):
- self.emit(QtCore.SIGNAL("editorValueChanged"), editor.getValue(), index.row(), index.column())
- value = editor.getValue()
- if index.column() == 0: #name
- model.setData(index
- , QtCore.QVariant(value))
- if index.column() == 1: #axis
- if editor.is_axis_free(int(value)):
- model.setData(index , QtCore.QVariant(value))
-
- def updateEditorGeometry(self, editor, option, index):
- editor.setGeometry(option.rect)
-
-
-class TableAxisWidget (QtGui.QWidget):
- """
- Table for selecting multiple axis
- """
- def __init__(self, value=None, parent=None):
- QtGui.QWidget.__init__(self, parent)
- self._controllerInfo = None
- self._layout = QtGui.QHBoxLayout(self)
- self.setLayout(self._layout)
- self._tableView = QtGui.QTableView()
- self._tableView.mousePressEvent = self.mousePressEvent
- self._tableView.setSelectionMode(QtGui.QTableView.SingleSelection)
- self._layout.addWidget(self._tableView)
- self._verticalLayout = QtGui.QVBoxLayout()
- self._addRowButton = QtGui.QPushButton(self)
- self._addRowButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-add"))
- self._addRowButton.setText("Add Device ")
- self._verticalLayout.addWidget(self._addRowButton)
- self._removeRowButton = QtGui.QPushButton(self)
- self._removeRowButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
- self._removeRowButton.setText("Remove Device ")
- self._verticalLayout.addWidget(self._removeRowButton)
- self._upButton = QtGui.QPushButton(self)
- self._upButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-up"))
- self._upButton.setText("Move Up ")
- self._verticalLayout.addWidget(self._upButton)
- self._downButton = QtGui.QPushButton(self)
- self._downButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-down"))
- self._downButton.setText("Move Down")
- self._verticalLayout.addWidget(self._downButton)
- spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self._verticalLayout.addItem(spacerItem)
- QtCore.QObject.connect(self._addRowButton, QtCore.SIGNAL("clicked()"), self._addRow)
- QtCore.QObject.connect(self._removeRowButton, QtCore.SIGNAL("clicked()"), self._removeRow)
- QtCore.QObject.connect(self._upButton, QtCore.SIGNAL("clicked()"), self._moveUp)
- QtCore.QObject.connect(self._downButton, QtCore.SIGNAL("clicked()"), self._moveDown)
- self._layout.addLayout(self._verticalLayout)
- self._delegate = TableAxisDelegate(self._tableView)
- #QtCore.QObject.connect(self._delegate, QtCore.SIGNAL("editorValueChanged"), self._valueChanged)
- self._tableView.setItemDelegate(self._delegate)
- QtCore.QObject.connect(self._delegate, QtCore.SIGNAL("editorValueChanged"), self._textEdited)
- #self._tableView.setItemDelegate(self._delegate)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding)
- self._tableView.setSizePolicy(sizePolicy)
- self._tableView.horizontalHeader().setDefaultSectionSize(80)
- self._tableView.horizontalHeader().setVisible(True)
- self._tableView.horizontalHeader().setStretchLastSection(True)
- self._tableView.setMinimumSize(QtCore.QSize(150, 150))
- self._edited = False
-
- def _textEdited(self, str=None):
- self._edited = True
-
- def isEdited(self):
- return self._edited
-
- def getAxisList(self):
- list = []
- for row in self.getValue():
- list.append(row[1])
- return list
-
- def _findFreeAxis(self):
- for axis in range(self._controllerInfo.get_max_elements()):
- if self.is_axis_free(axis):
- return axis
-
- return None
-
- def is_axis_free(self, axis):
- if self._controllerInfo.is_axis_free(axis):
- for busyAxis in self.getAxisList():
- if axis == busyAxis:
- return False
- return True
- else:
- return False
-
- def setControllerInfo(self, controllerInfo):
- self.setValue([])
- self._controllerInfo = controllerInfo
- self._delegate.setControllerInfo(self._controllerInfo)
- self._edited = False
-
- def _getSelectedIndex(self):
- if len (self._tableView.selectedIndexes()):
- row = self._tableView.selectedIndexes()[0].row()
- column = self._tableView.selectedIndexes()[0].column()
- else:
- row = None
- column = None
- return [row, column]
-
- def _addRow(self):
- value = self.getValue() # stored table
- rows = len(value)
-
- if rows < self._controllerInfo.get_max_elements():
- rowIndex = self._getSelectedIndex()[0]
- if rowIndex is None:
- rowIndex = rows
- value.insert(rowIndex, ["", self._findFreeAxis()])
- self.setValue(value)
- self._textEdited()
-
- if self._findFreeAxis() is None:
- self._addRowButton.setEnabled(False)
-
- def _removeRow(self):
- rowIndex = self._getSelectedIndex()[0]
- if rowIndex is not None:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Confirmation ")
- msgBox.setStandardButtons(QtGui.QMessageBox().No | QtGui.QMessageBox().Yes)
- msgBox.setInformativeText("Remove device {%i} ?" % (rowIndex + 1))
- msgBox.setIcon(QtGui.QMessageBox.Question)
- ret = msgBox.exec_()
- if ret == QtGui.QMessageBox().Yes:
- value = self.getValue()
- self.setValue(value[:rowIndex] + value[rowIndex + 1:])
- self._textEdited()
- self._addRowButton.setEnabled(True)
-
- def _moveUp(self):
- value = self.getValue() # stored table
- rows = len(value)
- rowIndex = self._getSelectedIndex()[0]
- if (rows > 1) and (rowIndex is not None) and (rowIndex > 0) :
- x = value.pop(rowIndex)
- value.insert(rowIndex - 1, x)
- self.setValue(value)
- self._tableView.setCurrentIndex(self._tableView.model().index(rowIndex - 1, 0))
- self._textEdited()
-
- def _moveDown(self):
- value = self.getValue() # stored table
- rows = len(value)
- rowIndex = self._getSelectedIndex()[0]
- if (rows > 1) and (rowIndex is not None) and (rowIndex < rows - 1) :
- x = value.pop(rowIndex)
- value.insert(rowIndex + 1, x)
- self.setValue(value)
- self._tableView.setCurrentIndex(self._tableView.model().index(rowIndex + 1, 0))
- self._textEdited()
-
- def setValue(self, value):
- rows = len(value)
- columns = 2
- self._model = QtGui.QStandardItemModel(rows, columns)
- for row in range(rows):
- for column in range(columns):
- index = self._model.index(row, column, QtCore.QModelIndex())
- self._model.setData(index, QtCore.QVariant(value[row][column]))
- self._model.setHeaderData(0, Qt.Qt.Horizontal, Qt.QVariant("Name"))
- self._model.setHeaderData(1, Qt.Qt.Horizontal, Qt.QVariant("Axis"))
- self._tableView.setModel(self._model)
- self._tableView.horizontalHeader().setVisible(True)
- self._tableView.horizontalHeader().setStretchLastSection(True)
-
- def getValue(self):
- rows = self._model.rowCount()
- result = []
- for row in range(rows):
- records = []
- index = self._model.index(row, 0)
- name = self._model.data(index).toString()
- index = self._model.index(row, 1)
- axis, bool = self._model.data(index).toInt()
- result.append([name, axis])
-
- return copy.deepcopy(result)
-
-
-class MultipleAxisWidget(Qt.QWidget):
- """
- Wizard for selecting multiple axis
- Method getValue() returns two dimensional array
- where the first column is name and the second is axis
- """
-
- def __init__(self, parent=None):
- Qt.QWidget.__init__(self, parent)
- self._layout = QtGui.QGridLayout(self)
- self.setLayout(self._layout)
- self.setupUi()
- self._controllerInfo = None
- self._edited = False
-
- def setupUi(self):
- self._tableAxisWidget = TableAxisWidget()
- self._layout.addWidget(self._tableAxisWidget, 0, 0, 1, 1)
-
- def setControllerInfo(self, controllerInfo):
- self._edited = False
- self._controllerInfo = controllerInfo
- self._tableAxisWidget.setControllerInfo(self._controllerInfo)
-
- def isEdited(self):
- return self._tableAxisWidget.isEdited()
-
- def getValue(self):
- return self._tableAxisWidget.getValue()
-
-
-class HardwareSettings(Qt.QWidget):
- """
- Page for editing single or multiple axis devices
- """
-
- def __init__(self, parent=None):
- Qt.QWidget.__init__(self, parent)
- self._layout = QtGui.QGridLayout(self)
- self.setLayout(self._layout)
- self.setupUi()
- self._controllerInfo = None
- self._edited = False
- self._changeView()
-
- def setupUi(self):
- self.setVisible(False)
- self._singleButton = QtGui.QRadioButton(self)
- self._singleButton.setText("Single")
- self._singleButton.setChecked(True)
- self._layout.addWidget(self._singleButton, 0, 0)
- self._multipleButton = QtGui.QRadioButton(self)
- self._multipleButton.setText("Multiple")
- self._layout.addWidget(self._multipleButton, 0, 1)
- self._singleAxisWidget = SingleAxisWidget()
- self._layout.addWidget(self._singleAxisWidget, 1, 0, 1, 2)
- self._multipleAxisWidget = MultipleAxisWidget()
- self._layout.addWidget(self._multipleAxisWidget, 2, 0, 1, 2)
-
- QtCore.QObject.connect(self._singleButton, QtCore.SIGNAL("clicked()"), self._changeView)
- QtCore.QObject.connect(self._multipleButton, QtCore.SIGNAL("clicked()"), self._changeView)
- self._spacerItem1 = Qt.QSpacerItem(10, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
- self._layout.addItem(self._spacerItem1, 4, 0, 1, 1, Qt.Qt.AlignCenter)
-
- def _changeView(self):
- if self._singleButton.isChecked():
- self._singleAxisWidget.setVisible(True)
- self._multipleAxisWidget.setVisible(False)
- else:
- self._singleAxisWidget.setVisible(False)
- self._multipleAxisWidget.setVisible(True)
-
- def setControllerInfo(self, controllerInfo):
- self._controllerInfo = controllerInfo
- self._singleAxisWidget.setControllerInfo(self._controllerInfo)
- self._multipleAxisWidget.setControllerInfo(self._controllerInfo)
-
- def isEdited(self):
- return self._singleAxisWidget.isEdited() or self._multipleAxisWidget.isEdited()
-
-
-class NewDeviceBasePage(wiz.SardanaBasePage):
- """
- Base Page for selecting and editing Devices
- """
-
- def __init__(self, parent=None):
- wiz.SardanaBasePage.__init__(self, parent)
- self._valid = False
- QtGui.QWizardPage.__init__(self, parent)
- self._layout = QtGui.QGridLayout(self)
- self.setupUi()
- self.setLayout(self._layout)
- self.setTitle('Selecting device')
- self.connect(self._treeView, QtCore.SIGNAL("activated"),
- self.activated)
- self._currentItem = None
- self._currentItemIndex = None
-
- def getProperties(self):
- if self._settings is not None:
- return self._settings.getProperties()
- else:
- return None
-
- def checkData(self):
- if self.picked():
- properties, name, values = self.getProperties()
- if len(name):
- self.setStatus("Editing: " + self.picked().get_name())
- self._valid = True
- else:
- self.setStatus('The name is invalid')
- self._valid = False
- else:
- self.setStatus('Please select a device')
- self._valid = False
-
- self.emit(QtCore.SIGNAL('completeChanged()'))
-
- def keyPressEvent(self, event):
- wiz.SardanaBasePage.keyPressEvent(self, event)
- if self._tabWidget.currentIndex() == 0:
- undo = (event.modifiers() == QtCore.Qt.ControlModifier and event.key() == QtCore.Qt.Key_Z)
- redo = (event.modifiers() == QtCore.Qt.ControlModifier and event.key() == QtCore.Qt.Key_Y)
- if (undo):
- self._settings.undo()
- if (redo):
- self._settings.redo()
-
- def initializePage(self):
- wiz.SardanaIntroBasePage.initializePage(self)
- self.wizard().__setitem__("properties", self.getProperties)
- # resizing application
- self._previousPageSize = copy.deepcopy([self.wizard().size().width(), self.wizard().size().height()])
- preferedSize = [800, 600]
- desktopRect = QtGui.QApplication.desktop().availableGeometry(self)
- center = desktopRect.center()
- if (not self.wizard().isMaximized()) and (self.wizard().size().height () < preferedSize[1]) and (self.wizard().size().width() < preferedSize[0]):
- self.wizard().resize(preferedSize[0], preferedSize[1])
- self.wizard().move(center.x() - self.wizard().width() * 0.5, center.y() - self.wizard().height() * 0.5)
- self._pool = self.wizard()["pool"]
- self._loadTreeModel()
- self.checkData()
-
- def cleanupPage(self):
- wiz.SardanaIntroBasePage.cleanupPage(self)
- preferedSize = copy.deepcopy(self._previousPageSize) # setUp size for previous page
- desktopRect = QtGui.QApplication.desktop().availableGeometry(self)
- center = desktopRect.center()
-
- if (not self.wizard().isMaximized()) and (self.wizard().size().height () > preferedSize[1]) and (self.wizard().size().width() > preferedSize[0]):
- self.wizard().resize(preferedSize[0], preferedSize[1])
- self.wizard().move(center.x() - self.wizard().width() * 0.5, center.y() - self.wizard().height() * 0.5)
-
- def _loadTreeModel(self):
-
- self.model = simple_tree_model.SimpleTreeModel(self)
- controllerinfos = self._pool.get_controller_class_infos()
- controllers = self._pool.get_controller_infos()
- self.model.sort(-1)
-
- for item in controllerinfos:
- self.model.addRecord(["Controller", PoolElementType[item.get_controller_type()] , item.get_name()], item , False)
-
- elementTypeList = PoolElementType.keys()
- elementTypeList.sort()
- for type in elementTypeList:
- self.model.addNodes([type], False)
- for item in controllers:
- self.model.addRecord([PoolElementType[item.get_controller_type()], item.get_name() ], item , False)
-
- self._treeView.setModel(self.model)
-
- def setupUi(self):
- self._treeView = SimpleTreeView(self)
- self._treeView.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
- self._layout.addWidget(self._treeView, 0, 0, 1, 1)
- self._tabWidget = QtGui.QTabWidget(self)
- self._settingsTab = QtGui.QWidget(self)
- self._horizontalLayout_2 = QtGui.QHBoxLayout(self._settingsTab)
- self._scrollArea = QtGui.QScrollArea(self._settingsTab)
- self._scrollArea.setFrameShape(QtGui.QFrame.NoFrame)
- self._scrollArea.setWidgetResizable(True)
- self._scrollAreaWidgetContents = QtGui.QWidget(self._scrollArea)
- self._scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 263, 316))
- self._gridLayout_2 = QtGui.QGridLayout(self._scrollAreaWidgetContents)
- self._settings = settings_widget.SettingsWidget()
- self._hardwareSettings = HardwareSettings()
- self._gridLayout_2.addWidget(self._settings)
- self._scrollArea.setWidget(self._scrollAreaWidgetContents)
- self._horizontalLayout_2.addWidget(self._scrollArea)
- self._tabWidget.addTab(self._settingsTab, "Settings")
- self._descriptionTab = QtGui.QWidget()
- self._horizontalLayout = QtGui.QHBoxLayout(self._descriptionTab)
- self._scrollArea_2 = QtGui.QScrollArea(self._descriptionTab)
- self._scrollArea_2.setFrameShape(QtGui.QFrame.NoFrame)
- self._scrollArea_2.setWidgetResizable(True)
- self._scrollAreaWidgetContents_2 = QtGui.QWidget(self._scrollArea_2)
- self._gridLayout_3 = QtGui.QGridLayout(self._scrollAreaWidgetContents_2)
- self._description = DescriptionWidget()
- self._gridLayout_3.addWidget(self._description)
- self._scrollArea_2.setWidget(self._scrollAreaWidgetContents_2)
- self._horizontalLayout.addWidget(self._scrollArea_2)
- self._tabWidget.addTab(self._descriptionTab, "Description")
- self._tabWidget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
-
- self._layout.addWidget(self._tabWidget, 0, 1, 1, 2)
- self._tabWidget.setCurrentIndex(0)
- self._status_label = QtGui.QLabel()
- self._status_label.setAutoFillBackground(True)
- palette = self._status_label.palette()
- gradient = QtGui.QLinearGradient(0, 0, 0, 15)
- gradient.setColorAt(0.0, Qt.QColor.fromRgb(60, 150, 255))
- gradient.setColorAt(0.5, Qt.QColor.fromRgb(0, 85, 227))
- gradient.setColorAt(1.0, Qt.QColor.fromRgb(60, 150, 255))
- gradient.setSpread(QtGui.QGradient.RepeatSpread)
- palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(gradient))
- palette.setBrush(QtGui.QPalette.WindowText, Qt.Qt.white)
- self._layout.addWidget(self._status_label, 1, 0, 1, 3)
- self._description.setVisible(False)
- self._settings.setVisible(False)
-
- def setStatus(self, text):
- self._status_label.setText(text)
-
- def picked(self):
- return self._treeView.currentFields()
-
- def activated(self, name):
-
- if (self.picked() is not None) and (self.picked() != self._currentItem):
- ret = QtGui.QMessageBox().Yes
- if self._settings.isEdited() or self._hardwareSettings.isEdited():
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Confirmation ")
- msgBox.setStandardButtons(QtGui.QMessageBox().No | QtGui.QMessageBox().Yes)
- msgBox.setInformativeText("Do you want to leave the editor of %s without saving the changes?" % self._currentItem.get_name())
- msgBox.setIcon(QtGui.QMessageBox.Question)
- ret = msgBox.exec_()
-
- if ret == QtGui.QMessageBox().Yes:
- self._settings.setEdited(False)
- self._hardwareSettings.setControllerInfo(None)
- self._currentItem = self.picked()
- self._currentItemIndex = self._treeView.currentIndex()
-
- if type(self._currentItem) == taurus.core.tango.sardana.sardana.ControllerClassInfo:
-
- self._gridLayout_2.addWidget(self._settings)
- self._settings.setVisible(True)
- self._gridLayout_2.removeWidget(self._hardwareSettings)
- self._hardwareSettings.setVisible(False)
- self._description.setVisible(True)
- self._tabWidget.setTabEnabled(1, True)
- self.setStatus("Editing: " + self.picked().get_name())
-
-
- self._settings.setProperties(self.picked().get_properties())
- QtCore.QObject.connect(self._settings, QtCore.SIGNAL("propertyValueChanged()"), self.checkData)
- self._description.setOrganization(self.picked().get_organization())
- self._description.setFamily(self.picked().get_family())
- self._description.setModel(self.picked().get_model())
- self._description.setDescription(self.picked().get_description())
- self._description.setImage(None)
-
- if type(self._currentItem) == taurus.core.tango.sardana.sardana.ControllerInfo:
-
- self._gridLayout_2.removeWidget(self._settings)
- self._settings.setVisible(False)
- self._gridLayout_2.addWidget(self._hardwareSettings)
- self._hardwareSettings.setVisible(True)
- self._hardwareSettings.setControllerInfo(self._currentItem)
- self._tabWidget.setTabEnabled(1, False)
- self.setStatus("Editing: " + self.picked().get_name())
- else:
- self._treeView.selectionModel().setCurrentIndex(self._currentItemIndex, QtGui.QItemSelectionModel.SelectCurrent)
-
-
- self.checkData()
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def isComplete(self):
- return self._valid
-
-
-class NewDeviceCommitBasePage(wiz.SardanaIntroBasePage):
- """
- The last commiting page on the wizard, doesn't work at the moment
- """
-
- def __init__(self, parent=None):
- QtGui.QWizardPage.__init__(self, parent)
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
- self._layout = QtGui.QFormLayout()
- self.setCommitPage(True)
- self.setTitle('Confirmation')
-
- def next(self):
- QWizard.next(self)
-
- def _set_style(self, w):
- f = w.font()
- f.setBold(True)
- w.setFont(f)
- return w
-
- def initializePage(self):
- wiz.SardanaIntroBasePage.initializePage(self)
- self._previousPageSize = copy.deepcopy([self.wizard().size().width(), self.wizard().size().height()])
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
- self._spacerItem1 = QtGui.QSpacerItem(800, 600, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
- self._layout.addItem(self._spacerItem1)
- preferedSize = [600, 600] # prefered size for this page
- desktopRect = QtGui.QApplication.desktop().availableGeometry(self)
- center = desktopRect.center()
- if (not self.wizard().isMaximized()):
- self.wizard().resize(preferedSize[0], preferedSize[1])
- self.wizard().move(center.x() - self.wizard().width() * 0.5, center.y() - self.wizard().height() * 0.5)
- # and (self.wizard().size().height () > preferedSize[1]) and (self.wizard().size().width() > preferedSize[0]):
-
- def cleanupPage(self):
- wiz.SardanaIntroBasePage.cleanupPage(self)
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap())
- preferedSize = copy.deepcopy(self._previousPageSize) # setUp size for previous page
- desktopRect = QtGui.QApplication.desktop().availableGeometry(self)
- center = desktopRect.center()
- if (not self.wizard().isMaximized()) and (self.wizard().size().height () < preferedSize[1]) and (self.wizard().size().width() < preferedSize[0]):
- self.wizard().move(center.x() - preferedSize[0] * 0.5, center.y() - preferedSize[1] * 0.5)
- self.wizard().resize(preferedSize[0], preferedSize[1])
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
-
-class DescriptionWidget(QtGui.QWidget):
- """
- The part of the wizard that shows the object description (text + picture)
- """
-
- def __init__(self, parent=None):
- QtGui.QWidget.__init__(self, parent)
- self.setupUi()
-
- def setupUi(self):
- self._imageSize = [100, 100]
- self._formLayout = QtGui.QFormLayout(self)
- self._organizationLabel = QtGui.QLabel("Organization:")
- self._formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self._organizationLabel)
- self._organizationLabelText = QtGui.QLabel(self)
- self._organizationLabelText.setFrameShape(QtGui.QFrame.Panel)
- self._organizationLabelText.setFrameShadow(QtGui.QFrame.Sunken)
- self._organizationLabelText.setWordWrap(False)
- self._formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self._organizationLabelText)
- self._familyLabel = QtGui.QLabel("Family:")
- self._formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self._familyLabel)
- self._familyLabelText = QtGui.QLabel(self)
- self._familyLabelText.setFrameShape(QtGui.QFrame.Panel)
- self._familyLabelText.setFrameShadow(QtGui.QFrame.Sunken)
- self._familyLabelText.setWordWrap(False)
- self._formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self._familyLabelText)
- self._modelLabel = QtGui.QLabel("Model:")
- self._formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self._modelLabel)
- self._modelLabelText = QtGui.QLabel(self)
- self._modelLabelText.setFrameShape(QtGui.QFrame.Panel)
- self._modelLabelText.setFrameShadow(QtGui.QFrame.Sunken)
- self._modelLabelText.setWordWrap(False)
- self._formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self._modelLabelText)
- self._descriptionLabel = QtGui.QLabel("Description:")
- self._formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self._descriptionLabel)
- self._descriptionLabelText = QtGui.QLabel(self)
- self._descriptionLabelText.setFrameShape(QtGui.QFrame.Panel)
- self._descriptionLabelText.setFrameShadow(QtGui.QFrame.Sunken)
- self._descriptionLabelText.setWordWrap(True)
- self._descriptionLabelText.setAlignment(QtCore.Qt.AlignTop)
- self._formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self._descriptionLabelText)
- self._imageLabel = QtGui.QLabel("Image:")
- self._formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self._imageLabel)
- self._deviceLogo = QtGui.QLabel(self)
- self._deviceLogo.setPixmap(taurus.qt.qtgui.resource.getThemePixmap("image-missing").scaled(*self._imageSize))
- self._deviceLogo.pixmap()
- self._deviceLogo.setAlignment(QtCore.Qt.AlignHCenter)
- self._formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self._deviceLogo)
-
- def setOrganization(self, name):
- self._organizationLabelText.setText(name)
-
- def setFamily(self, name):
- self._familyLabelText.setText(name)
-
- def setModel(self, name):
- self._modelLabelText.setText(name)
-
- def setDescription(self, text):
- self._descriptionLabelText.setText(text)
-
- def setImage(self, image):
- if type(image) == QtGui.QPixmap:
- self._deviceLogo.setPixmap(image.scaled(*self._imageSize))
- elif type(image) == QtGui.QImage:
- self._deviceLogo.setPixmap(QtGui.QPixmap().fromImage(image).scaled(*self._imageSize))
- else:
- self._deviceLogo.setPixmap(taurus.qt.qtgui.resource.getThemePixmap("image-missing").scaled(50, 50))
-
-
-def addDevice(Sardana=None, Pool=None):
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(get_resources())
- Pages = Enumeration('Pages', ('SelectSardanaPool', 'NewDevice', 'CommitPage', 'OutroPage'))
- w = wiz.SardanaBaseWizard()
- w.setWindowTitle("Add New Hardware Wizard")
- selectPool = SelectSardanaPoolBasePage(Sardana, Pool)
- w.setPage(Pages.SelectSardanaPool, selectPool)
- selectPool.setNextPageId(Pages.NewDevice)
- newDevice = NewDeviceBasePage()
- w.setPage(Pages.NewDevice, newDevice)
- newDevice.setNextPageId(Pages.CommitPage)
- commit_page = NewDeviceCommitBasePage()
- w.setPage(Pages.CommitPage, commit_page)
- commit_page.setNextPageId(Pages.OutroPage)
- w.show()
- sys.exit(app.exec_())
-
-def get_resources():
- res_fname = os.path.abspath(__file__)
- res_fname = os.path.splitext(res_fname)[0] + '.rcc'
- return res_fname
-
-if __name__ == "__main__":
- addDevice()
diff --git a/sardanaConfig/src/wizards/add_new_hw.py b/sardanaConfig/src/wizards/add_new_hw.py
deleted file mode 100644
index 7feb4961..00000000
--- a/sardanaConfig/src/wizards/add_new_hw.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import os, sys
-from PyQt4 import QtGui, QtCore, Qt
-
-import wiz
-
-from tango_host_page import SelectTangoHostBasePage
-from sardana_page import SelectSardanaBasePage
-from pool_page import SelectPoolBasePage
-
-
-
-def main():
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(wiz.get_resources())
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- main()
diff --git a/sardanaConfig/src/wizards/ms_editor_UI.py b/sardanaConfig/src/wizards/ms_editor_UI.py
deleted file mode 100644
index 8b7ba364..00000000
--- a/sardanaConfig/src/wizards/ms_editor_UI.py
+++ /dev/null
@@ -1,152 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'MSEditor.ui'
-#
-# Created: Fri Nov 19 12:49:34 2010
-# by: PyQt4 UI code generator 4.4.3
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-class Ui_MSEditor(object):
- def setupUi(self, MSEditor):
- MSEditor.setObjectName("MSEditor")
- MSEditor.resize(400, 429)
- self.gridLayout = QtGui.QGridLayout(MSEditor)
- self.gridLayout.setObjectName("gridLayout")
- self.gridLayout_2 = QtGui.QGridLayout()
- self.gridLayout_2.setObjectName("gridLayout_2")
- self.instanceNameLineEdit = QtGui.QLineEdit(MSEditor)
- self.instanceNameLineEdit.setObjectName("instanceNameLineEdit")
- self.gridLayout_2.addWidget(self.instanceNameLineEdit, 0, 1, 1, 1)
- self.instanceNameLabel = QtGui.QLabel(MSEditor)
- self.instanceNameLabel.setObjectName("instanceNameLabel")
- self.gridLayout_2.addWidget(self.instanceNameLabel, 0, 0, 1, 1)
- self.msDeviceNameLineEdit = QtGui.QLineEdit(MSEditor)
- self.msDeviceNameLineEdit.setObjectName("msDeviceNameLineEdit")
- self.gridLayout_2.addWidget(self.msDeviceNameLineEdit, 2, 1, 1, 1)
- self.msAliasLineEdit = QtGui.QLineEdit(MSEditor)
- self.msAliasLineEdit.setObjectName("msAliasLineEdit")
- self.gridLayout_2.addWidget(self.msAliasLineEdit, 3, 1, 1, 1)
- self.msVersionLineEdit = QtGui.QLineEdit(MSEditor)
- self.msVersionLineEdit.setObjectName("msVersionLineEdit")
- self.gridLayout_2.addWidget(self.msVersionLineEdit, 4, 1, 1, 1)
- self.msDeviceNameLabel = QtGui.QLabel(MSEditor)
- self.msDeviceNameLabel.setObjectName("msDeviceNameLabel")
- self.gridLayout_2.addWidget(self.msDeviceNameLabel, 2, 0, 1, 1)
- self.msAliasLabel = QtGui.QLabel(MSEditor)
- self.msAliasLabel.setObjectName("msAliasLabel")
- self.gridLayout_2.addWidget(self.msAliasLabel, 3, 0, 1, 1)
- self.msVersionLabel = QtGui.QLabel(MSEditor)
- self.msVersionLabel.setObjectName("msVersionLabel")
- self.gridLayout_2.addWidget(self.msVersionLabel, 4, 0, 1, 1)
- self.msDeviceNameCheckBox = QtGui.QCheckBox(MSEditor)
- self.msDeviceNameCheckBox.setObjectName("msDeviceNameCheckBox")
- self.gridLayout_2.addWidget(self.msDeviceNameCheckBox, 2, 2, 1, 1)
- self.msAliasCheckBox = QtGui.QCheckBox(MSEditor)
- self.msAliasCheckBox.setObjectName("msAliasCheckBox")
- self.gridLayout_2.addWidget(self.msAliasCheckBox, 3, 2, 1, 1)
- self.msVersionCheckBox = QtGui.QCheckBox(MSEditor)
- self.msVersionCheckBox.setObjectName("msVersionCheckBox")
- self.gridLayout_2.addWidget(self.msVersionCheckBox, 4, 2, 1, 1)
- self.poolNameComboBox = QtGui.QComboBox(MSEditor)
- self.poolNameComboBox.setObjectName("poolNameComboBox")
- self.gridLayout_2.addWidget(self.poolNameComboBox, 1, 1, 1, 1)
- self.poolNameLabel = QtGui.QLabel(MSEditor)
- self.poolNameLabel.setObjectName("poolNameLabel")
- self.gridLayout_2.addWidget(self.poolNameLabel, 1, 0, 1, 1)
- self.doorNameLabel = QtGui.QLabel(MSEditor)
- self.doorNameLabel.setObjectName("doorNameLabel")
- self.gridLayout_2.addWidget(self.doorNameLabel, 5, 0, 1, 1)
- self.doorAliasLabel = QtGui.QLabel(MSEditor)
- self.doorAliasLabel.setObjectName("doorAliasLabel")
- self.gridLayout_2.addWidget(self.doorAliasLabel, 6, 0, 1, 1)
- self.doorNameCheckBox = QtGui.QCheckBox(MSEditor)
- self.doorNameCheckBox.setObjectName("doorNameCheckBox")
- self.gridLayout_2.addWidget(self.doorNameCheckBox, 5, 2, 1, 1)
- self.doorAliasCheckBox = QtGui.QCheckBox(MSEditor)
- self.doorAliasCheckBox.setObjectName("doorAliasCheckBox")
- self.gridLayout_2.addWidget(self.doorAliasCheckBox, 6, 2, 1, 1)
- self.doorNameLineEdit = QtGui.QLineEdit(MSEditor)
- self.doorNameLineEdit.setObjectName("doorNameLineEdit")
- self.gridLayout_2.addWidget(self.doorNameLineEdit, 5, 1, 1, 1)
- self.doorAliasLineEdit = QtGui.QLineEdit(MSEditor)
- self.doorAliasLineEdit.setObjectName("doorAliasLineEdit")
- self.gridLayout_2.addWidget(self.doorAliasLineEdit, 6, 1, 1, 1)
- self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)
- self.groupBox = QtGui.QGroupBox(MSEditor)
- self.groupBox.setObjectName("groupBox")
- self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox)
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.msPathList = QtGui.QListWidget(self.groupBox)
- self.msPathList.setMouseTracking(True)
- self.msPathList.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
- self.msPathList.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)
- self.msPathList.setObjectName("msPathList")
- self.horizontalLayout.addWidget(self.msPathList)
- self.verticalLayout = QtGui.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
- self.addButton = QtGui.QToolButton(self.groupBox)
- self.addButton.setObjectName("addButton")
- self.verticalLayout.addWidget(self.addButton)
- self.removeButton = QtGui.QToolButton(self.groupBox)
- self.removeButton.setObjectName("removeButton")
- self.verticalLayout.addWidget(self.removeButton)
- self.upButton = QtGui.QToolButton(self.groupBox)
- self.upButton.setObjectName("upButton")
- self.verticalLayout.addWidget(self.upButton)
- self.downButton = QtGui.QToolButton(self.groupBox)
- self.downButton.setObjectName("downButton")
- self.verticalLayout.addWidget(self.downButton)
- self.horizontalLayout.addLayout(self.verticalLayout)
- self.gridLayout.addWidget(self.groupBox, 1, 0, 1, 1)
- self.horizontalLayout_2 = QtGui.QHBoxLayout()
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout_2.addItem(spacerItem)
- self.createButton = QtGui.QPushButton(MSEditor)
- self.createButton.setObjectName("createButton")
- self.horizontalLayout_2.addWidget(self.createButton)
- self.closeButton = QtGui.QPushButton(MSEditor)
- self.closeButton.setObjectName("closeButton")
- self.horizontalLayout_2.addWidget(self.closeButton)
- self.gridLayout.addLayout(self.horizontalLayout_2, 2, 0, 1, 1)
-
- self.retranslateUi(MSEditor)
- QtCore.QObject.connect(self.msDeviceNameCheckBox, QtCore.SIGNAL("toggled(bool)"), self.msDeviceNameLineEdit.setDisabled)
- QtCore.QObject.connect(self.msAliasCheckBox, QtCore.SIGNAL("toggled(bool)"), self.msAliasLineEdit.setDisabled)
- QtCore.QObject.connect(self.msVersionCheckBox, QtCore.SIGNAL("toggled(bool)"), self.msVersionLineEdit.setDisabled)
- QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), MSEditor.close)
- QtCore.QObject.connect(self.doorNameCheckBox, QtCore.SIGNAL("toggled(bool)"), self.doorNameLineEdit.setDisabled)
- QtCore.QObject.connect(self.doorAliasCheckBox, QtCore.SIGNAL("toggled(bool)"), self.doorAliasLineEdit.setDisabled)
- QtCore.QMetaObject.connectSlotsByName(MSEditor)
-
- def retranslateUi(self, MSEditor):
- MSEditor.setWindowTitle(QtGui.QApplication.translate("MSEditor", "Create Pool", None, QtGui.QApplication.UnicodeUTF8))
- self.instanceNameLabel.setText(QtGui.QApplication.translate("MSEditor", "Instance name", None, QtGui.QApplication.UnicodeUTF8))
- self.msDeviceNameLabel.setText(QtGui.QApplication.translate("MSEditor", "MS device name", None, QtGui.QApplication.UnicodeUTF8))
- self.msAliasLabel.setText(QtGui.QApplication.translate("MSEditor", "MS alias (optional)", None, QtGui.QApplication.UnicodeUTF8))
- self.msVersionLabel.setText(QtGui.QApplication.translate("MSEditor", "MS version", None, QtGui.QApplication.UnicodeUTF8))
- self.msDeviceNameCheckBox.setText(QtGui.QApplication.translate("MSEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.msAliasCheckBox.setText(QtGui.QApplication.translate("MSEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.msVersionCheckBox.setText(QtGui.QApplication.translate("MSEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.poolNameLabel.setText(QtGui.QApplication.translate("MSEditor", "Pool name", None, QtGui.QApplication.UnicodeUTF8))
- self.doorNameLabel.setText(QtGui.QApplication.translate("MSEditor", "Door name", None, QtGui.QApplication.UnicodeUTF8))
- self.doorAliasLabel.setText(QtGui.QApplication.translate("MSEditor", "Door alias (optional)", None, QtGui.QApplication.UnicodeUTF8))
- self.doorNameCheckBox.setText(QtGui.QApplication.translate("MSEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.doorAliasCheckBox.setText(QtGui.QApplication.translate("MSEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.groupBox.setTitle(QtGui.QApplication.translate("MSEditor", "MacroPath", None, QtGui.QApplication.UnicodeUTF8))
- self.createButton.setText(QtGui.QApplication.translate("MSEditor", "Create", None, QtGui.QApplication.UnicodeUTF8))
- self.closeButton.setText(QtGui.QApplication.translate("MSEditor", "Close", None, QtGui.QApplication.UnicodeUTF8))
-
-
-if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- MSEditor = QtGui.QDialog()
- ui = Ui_MSEditor()
- ui.setupUi(MSEditor)
- MSEditor.show()
- sys.exit(app.exec_())
-
diff --git a/sardanaConfig/src/wizards/new_sardana_wizard.py b/sardanaConfig/src/wizards/new_sardana_wizard.py
deleted file mode 100644
index a96d6879..00000000
--- a/sardanaConfig/src/wizards/new_sardana_wizard.py
+++ /dev/null
@@ -1,1450 +0,0 @@
-import os, sys, wiz, re, traceback, time
-import taurus.qt.qtgui.resource, pool_editor_UI
-import pool_editor_UI, ms_editor_UI
-from PyQt4 import QtGui, QtCore, Qt
-from taurus.core.util.enumeration import Enumeration
-from sardana.taurus.core.tango.sardana import SardanaManager
-
-"""This wizard is designed for creating new Sardana.
-
-The wizard consist:
-
-- TangoPage
-- SardanaPage
-- PoolPage
-- MSPage
-- CommitPage
-- OutroPage
-
-"""
-class NewSardanaIntroPage(wiz.SardanaIntroBasePage):
- """
- Introduction page
- """
-
- def __init__(self, parent=None):
- wiz.SardanaIntroBasePage.__init__(self, parent)
- self.sardana_name = None
-
- def getIntroText(self):
- return """This wizard will guide you through the creation of the new instance of Sardana"""
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
-
-class SelectTangoHostPage(wiz.SardanaBasePage):
- """
- Page for selecting tango host
- """
- def __init__(self, parent=None):
- wiz.SardanaBasePage.__init__(self, parent)
-
- self.setSubTitle('Please select the Tango Host')
- self._valid = False
-
- self._regExp0 = QtCore.QRegExp("^[0-9a-zA-Z]{,50}")
- self._regValid0 = QtGui.QRegExpValidator(self._regExp0, self)
-
- self._regExp1 = QtCore.QRegExp("^[0-9]{,50}")
- self._regValid1 = QtGui.QRegExpValidator(self._regExp1, self)
-
- self._panel = self.getPanelWidget()
-
- layout = QtGui.QFormLayout()
- self.hostEdit = QtGui.QLineEdit()
- self.hostEdit.setValidator(self._regValid0)
-
- self.portEdit = QtGui.QLineEdit()
- self.portEdit.setValidator(self._regValid1)
- self.checkButton = QtGui.QPushButton("Check")
-
- layout.addRow("&Host", self.hostEdit)
- layout.addRow("&Port", self.portEdit)
- layout.addRow("", self.checkButton)
- self.checkButton.hide()
- host, port = self.get_default_tango_host()
-
- self.hostEdit.setText(host)
- self.portEdit.setText(port)
-
- self._panel.setLayout(layout)
-
- self['db'] = self._getDatabase
- self['port'] = self._getPort
- self['host'] = self._getHost
-
- self.connect(self.hostEdit, QtCore.SIGNAL('textEdited(const QString &)'), self._letterChanged)
- self.connect(self.portEdit, QtCore.SIGNAL('textEdited(const QString &)'), self._letterChanged)
- self.connect(self.checkButton, QtCore.SIGNAL('clicked()'), self.checkData)
-
- self.checkData()
-
- def get_default_tango_host(self):
- tg = os.environ.get('TANGO_HOST', '')
- if not tg or tg.count(':') != 1: return '', ''
- return tg.split(':')
-
- def _letterChanged(self):
- self._valid = False
- self.setStatus('please click the ''Check'' button')
- self.emit(QtCore.SIGNAL('completeChanged()'))
- self.checkButton.show()
-
- def checkData(self):
- try:
- db = self.db()
- if not db is None:
- self.setStatus('please click the ''Next'' button')
- self._valid = True
- self.emit(QtCore.SIGNAL('completeChanged()'))
- except Exception, e:
- self.setStatus('Invalid database')
- self._valid = False
- self.checkButton.hide()
-
- def _getPort(self):
- return str(self.portEdit.text()).lower()
-
- def _getHost(self):
- return str(self.hostEdit.text()).lower()
-
- def _getDatabase(self):
- host = str(self.hostEdit.text()).lower()
- port = str(self.portEdit.text())
-
- return taurus.Database("%s:%s" % (host, port))
-
- def host(self):
- return self.wizard()['host']
-
- def port(self):
- return self.wizard()['port']
-
- def db(self):
- return self.wizard()['db']
-
- def isComplete(self):
- return self._valid
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- def initializePage(self):
- wiz.SardanaBasePage.initializePage(self)
- self.checkData()
-
-
-class AddSardanaBasePage(wiz.SardanaBasePage):
- """
- Page for setting Sardana name
- """
-
- def __init__(self, parent=None):
- wiz.SardanaBasePage.__init__(self, parent)
- self.setSubTitle('Please type the name for the new Sardana instance')
- self._valid = False
-
- panel = self.getPanelWidget()
-
- layout = QtGui.QFormLayout()
-
- self.nameEdit = QtGui.QLineEdit()
- self.nameEdit.setText("MySardana")
-
- self._regExp = QtCore.QRegExp("^[0-9a-zA-Z]{,50}")
- self._regValid = QtGui.QRegExpValidator(self._regExp, self)
-
- self.nameEdit.setValidator(self._regValid)
-
- self.checkButton = QtGui.QPushButton("Check")
- self.checkButton.hide()
-
- layout.addRow("&Name", self.nameEdit)
- layout.addRow("", self.checkButton)
-
- panel.setLayout(layout)
-
- self.connect(self.nameEdit, QtCore.SIGNAL('textEdited(const QString &)'), self._letterChanged)
- self.connect(self.checkButton, QtCore.SIGNAL('clicked()'), self.checkData)
-
- def _getSardana(self):
- sardana = str(self.nameEdit.text())
- return sardana
-
- def _letterChanged(self):
- self._valid = False
- self.emit(QtCore.SIGNAL('completeChanged()'))
- self.setStatus('please click the ''Check'' button')
- self.checkButton.show()
-
- def sardana(self):
- return self.wizard()['sardana']
-
- def db(self):
- return self.wizard()['db']
-
- def checkData(self):
- if self.nameEdit.text() == "":
- self.setStatus('Please type the name')
- self._valid = False
- else:
- if self.nameEdit.text() not in self._getSardanas():
- self.setStatus('please click the ''Next'' button')
- self._valid = True
- self.emit(QtCore.SIGNAL('completeChanged()'))
- else:
- self.setStatus('The name already exists in the database')
- self._valid = False
- self.checkButton.hide()
-
- def isComplete(self):
- return self._valid
-
- def _getSardanas(self):
- db = self.db()
- services = db.get_service_list('Sardana.*')
- service_instances = []
- for service in services:
- service_instances.append(service.split('/', 1)[1])
- return service_instances
-
- def initializePage(self):
- wiz.SardanaBasePage.initializePage(self)
- self.wizard().__setitem__("sardana", self._getSardana)
- self.checkData()
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
-
-class Item(object):
- """
- SuperClass of Pool and Macroservers items
- """
- def __init__(self, instanceName="", hostName="", level=None):
- self._instanceName = str(instanceName)
- self._hostName = str(hostName)
- self._level = level
- def setInstanceName(self, name):
- self._instanceName = str(name)
- def getInstanceName(self):
- return self._instanceName
- def setHostName(self, name):
- self._hostName = str(name)
- def getHostName(self):
- return self._hostName
- def setLevel(self, level):
- self._level = level
- def getLevel(self):
- return self._level
-
-class SimpleEditorBasePage(wiz.SardanaBasePage):
- """
- Superclass of Pool and Macroserver editor
- """
- def __init__(self, parent=None):
- wiz.SardanaBasePage.__init__(self, parent)
- self.setSubTitle('SubTitle')
- panel = self.getPanelWidget()
- self._valid = True
- self.horizontalLayout = QtGui.QHBoxLayout(panel)
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.tableWidget = QtGui.QTableWidget(self)
- self.tableWidget.setObjectName("tableWidget")
- self.tableWidget.setColumnCount(3)
- self.tableWidget.setRowCount(0)
- self.tableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
- self.tableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
- self.horizontalLayout.addWidget(self.tableWidget)
- self._setTableHeaders()
- self.tableWidget.horizontalHeader().resizeSection(0, 125)
- self.tableWidget.horizontalHeader().resizeSection(1, 120)
- self.tableWidget.horizontalHeader().resizeSection(2, 55)
- self.tableWidget.verticalHeader().setVisible(False)
-
- self.verticalLayout = QtGui.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
-
- self.addButton = QtGui.QPushButton(self)
- self.addButton.setText(QtGui.QApplication.translate("Form", "Add", None, QtGui.QApplication.UnicodeUTF8))
- self.addButton.setObjectName("addButton")
- self.addButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-add"))
- self.verticalLayout.addWidget(self.addButton)
-
- self.editButton = QtGui.QPushButton(self)
- self.editButton.setText(QtGui.QApplication.translate("Form", "Edit", None, QtGui.QApplication.UnicodeUTF8))
- self.editButton.setObjectName("editButton")
- self.editButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("preferences-system"))
- self.verticalLayout.addWidget(self.editButton)
-
- self.removeButton = QtGui.QPushButton(self)
- self.removeButton.setText(QtGui.QApplication.translate("Form", "Remove", None, QtGui.QApplication.UnicodeUTF8))
- self.removeButton.setObjectName("removeButton")
- self.removeButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
- self.verticalLayout.addWidget(self.removeButton)
-
- spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.verticalLayout.addItem(spacerItem)
- self.horizontalLayout.addLayout(self.verticalLayout)
- #spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- #self.horizontalLayout.addItem(spacerItem1)
- self.listOfItems = []
- self._comboList = []
- self._spinList = []
-
- def _setTableHeaders(self):
- self.tableWidget.setColumnCount(3)
- self.tableWidget.setHorizontalHeaderItem(0, QtGui.QTableWidgetItem("name"))
- self.tableWidget.setHorizontalHeaderItem(1, QtGui.QTableWidgetItem("host"))
- self.tableWidget.setHorizontalHeaderItem(2, QtGui.QTableWidgetItem("level"))
-
- def openEditor (self, item=None):
- pass
-
- def checkName(self, name, id=None):
- i = 0
- for item in self.listOfItems:
- if i != id:
- if name == item.getInstanceName():
- return False
- i += 1
- return True
-
- def addItem (self, item):
- if item.getLevel() == None:
- item.setLevel("1")
- item.setHostName(self._getHostList()[0])
- self.listOfItems.append(item)
- self._fillList()
- self.checkData()
- return True
-
- def editItem (self, item, id):
- if item.getLevel() == None:
- item.setLevel("1")
- self.listOfItems[id] = item
- self._fillList()
-
- def removeItem(self, id):
- self.listOfItems.remove(self.listOfItems[id])
- self._fillList()
- self.checkData()
- return True
-
- def hostChanged(self, hostId=None):
- name = str(self.sender().objectName())
- id = int(name[name.index('_') + 1:])
- if self.sender().currentText() == "None":
- self.listOfItems[id].setHostName("")
- else:
- self.listOfItems[id].setHostName(self.sender().currentText())
- self._fillList()
-
- def levelChanged(self, id=None):
- name = str(self.sender().objectName())
- id = int(name[name.index('_') + 1:])
- self.listOfItems[id].setLevel(str(self.sender().value()))
-
- def checkData(self):
- self._valid = True
-
- def _getItemList(self):
- return self.listOfItems[:]
-
- def isComplete(self):
- return self._valid
-
- def _fillList(self):
- self._comboList = []
- self._spinList = []
- self.tableWidget.clear()
- self._setTableHeaders()
-
- self.tableWidget.setRowCount(len(self.listOfItems))
- self.tableWidget.clearSelection()
- #self.tableWidget.setItemSelected(None)
-
- #self.tableWidget.selectRow(-1)
-
- self.editButton.setObjectName("editButton")
- i = 0
- for item in self.listOfItems:
- self.tableWidget.setCellWidget(i, 0, QtGui.QLabel(item.text()))
- self._comboList.append(QtGui.QComboBox())
- self._comboList[i].setObjectName("hostComboBox_%d" % i)
- if item.getHostName() == "":
- self._comboList[i].addItem("None")
- else:
- self._comboList[i].addItem(item.getHostName())
- self._comboList[i].addItems(self._hostList)
- self._comboList[i].addItem("None")
- self._comboList[i].insertSeparator(len(self._hostList) + 1)
- QtCore.QObject.connect(self._comboList[i], QtCore.SIGNAL("currentIndexChanged(int)"), self.hostChanged)
- self.tableWidget.setCellWidget(i, 1, self._comboList[i])
- self._spinList.append(QtGui.QSpinBox())
- self._spinList[i].setRange(*SardanaManager().get_level_range())
- self._spinList[i].setObjectName("levelSpinBox_%d" % i)
- QtCore.QObject.connect(self._spinList[i], QtCore.SIGNAL("valueChanged(int)"), self.levelChanged)
- self.tableWidget.setCellWidget(i, 2, self._spinList[i])
-
- if (item.getHostName() == "") or (item.getHostName() == None):
- self._spinList[i].setDisabled(True)
- self._spinList[i].setValue(0)
- else:
- self._spinList[i].setValue(int(item.getLevel()))
- i += 1
-
- def initializePage(self):
- wiz.SardanaBasePage.initializePage(self)
- self._hostList = self._getHostList()
- self._fillList()
- self.checkData()
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def db(self):
- return self.wizard()['db']
-
- def _getHostList(self):
- return SardanaManager().get_hosts()
-
- def getPoolServerList(self):
- return [ s[s.index('/') + 1:] for s in self.db().get_server_list() if s.startswith('Pool/') ]
-
-
-class Pool(Item):
- """
- Represents a Pool
- """
-
- def __init__(self, instanceName="", hostName="", level=None, poolDeviceName="", alias="", poolVersion="", poolPath=[]):
-
- Item.__init__(self, instanceName, hostName, level)
- self._poolDeviceName = str(poolDeviceName)
- self._alias = str(alias)
- self._poolVersion = str(poolVersion)
- self._poolPath = map(str, poolPath)
-
- def setPoolDeviceName(self, name):
- self._poolDeviceName = str(name)
- def getPoolDeviceName(self):
- return str(self._poolDeviceName)
- def setAlias(self, alias):
- self._alias = str(alias)
- def getAlias(self):
- return self._alias
- def setPoolVersion(self, poolVersion):
- self._poolVersion = str(poolVersion)
- def getPoolVersion(self):
- return self._poolVersion
- def setPoolPath(self, path):
- self._poolPath = map(str, path)
- def getPoolPath(self):
- return self._poolPath
- def text(self):
- return str(self._instanceName)
- def copy(self):
- return Pool(self._instanceName, self._hostName, self._level, self._poolDeviceName, self._alias, self._poolVersion, self._poolPath[:])
-
-
-
-class AddPoolBasePage(SimpleEditorBasePage):
- """
- Page for editing the list of Pools
- """
- def __init__(self, parent=None):
- self._editor = None
- SimpleEditorBasePage.__init__(self, parent)
- self._editor = PoolEditor(parent=self)
- self.selectedItem = None
- self.item_id = None
- self.setSubTitle('You can use this manager if you would like to Add, Edit or Delete Pool entries in the database.')
- self.addButton.setText(QtGui.QApplication.translate("Form", "Add Pool", None, QtGui.QApplication.UnicodeUTF8))
- self.editButton.setText(QtGui.QApplication.translate("Form", "Edit Pool", None, QtGui.QApplication.UnicodeUTF8))
- self.removeButton.setText(QtGui.QApplication.translate("Form", "Remove Pool", None, QtGui.QApplication.UnicodeUTF8))
- QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.openAddEditor)
- QtCore.QObject.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.openItemEditor)
- QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL("clicked()"), self.delete)
- QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL("cellDoubleClicked(int,int)"), self.openItemEditor)
-
- def delete (self):
- if len(self.tableWidget.selectedIndexes()) > 0:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("The list of Pools has been modified.")
- self.item_id = self.tableWidget.selectedIndexes()[0].row()
- self.selectedItem = self.listOfItems[self.item_id]
- msgBox.setInformativeText("Do you want to delete Pool?:\n" + self.selectedItem.text())
- msgBox.setStandardButtons(QtGui.QMessageBox().Ok | QtGui.QMessageBox().Cancel)
- msgBox.setDefaultButton(QtGui.QMessageBox().Cancel);
- msgBox.setIcon(QtGui.QMessageBox.Question)
- ret = msgBox.exec_()
- if ret == QtGui.QMessageBox().Ok:
- self.removeItem(self.item_id)
- if ret == QtGui.QMessageBox().Cancel:
- pass
-
- def openAddEditor (self):
- self.item_id = None
- self.selectedItem = None
- SimpleEditorBasePage.openEditor(self)
- self._editor.showEditor(item=None, item_id=None)
-
- def openItemEditor (self):
- if len(self.tableWidget.selectedIndexes()) > 0:
- self.item_id = self.tableWidget.selectedIndexes()[0].row()
- self.selectedItem = self.listOfItems[self.item_id]
- SimpleEditorBasePage.openEditor(self)
- self._editor.showEditor(item=self.selectedItem, item_id=self.item_id)
-
- def checkData(self):
- if len(self.listOfItems) > 0:
- self._valid = True
- self.emit(QtCore.SIGNAL('completeChanged()'))
- else:
- self._valid = False
- self.emit(QtCore.SIGNAL('completeChanged()'))
-
- def isComplete(self):
- return self._valid
-
- def initializePage(self):
- SimpleEditorBasePage.initializePage(self)
- self.wizard().__setitem__("poolList", self._getItemList)
- if len(self.listOfItems) == 0:
- sardana = self.wizard()["sardana"]
- _pool = Pool()
- _pool.setInstanceName(sardana)
- _pool.setLevel("1")
- _pool.setPoolDeviceName("pool/" + sardana + "/1")
- _pool.setAlias("Pool_" + sardana)
- _pool.setPoolVersion("1.2.0")
- #_pool.setPoolPath(SardanaManager.get_default_pool_path()) ###
- self.addItem(_pool.copy())
-
-
-class PoolEditor(object):
- """
- Pool editor
- """
- def __init__(self, parent=None):
-
- self._parent = parent
- self._isEditorOpened = False
- self._pool = Pool()
- self.poolEditor = QtGui.QDialog()
- self.ui = pool_editor_UI.Ui_PoolEditor()
- self.poolEditor.setModal(True)
- self.ui.setupUi(self.poolEditor)
- self._regExp = QtCore.QRegExp("^[0-9a-zA-Z_/]{,50}")
- self._regValid = QtGui.QRegExpValidator(self._regExp, self.poolEditor)
- self._regExp2 = QtCore.QRegExp("^[0-9.]{,50}")
- self._versionValid = QtGui.QRegExpValidator(self._regExp2, self.poolEditor)
- self._regExp3 = QtCore.QRegExp("^[0-9a-zA-Z_/]{,100}")
- self._deviceNameValid = QtGui.QRegExpValidator(self._regExp3, self.poolEditor)
- self.ui.instanceNameLineEdit.setValidator(self._regValid)
- self.ui.poolDeviceNameLineEdit.setValidator(self._deviceNameValid)
- self.ui.aliasLineEdit.setValidator(self._regValid)
- self.ui.poolVersionLineEdit.setValidator(self._versionValid)
- self._item_id = None
- self._path_id = None
- self.ui.addButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-add"))
- self.ui.removeButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
- self.ui.upButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-up"))
- self.ui.downButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-down"))
- #connections
- QtCore.QObject.connect(self.ui.createButton, QtCore.SIGNAL("clicked()"), self._createPool)
- QtCore.QObject.connect(self.ui.addButton, QtCore.SIGNAL("clicked()"), self._addPath)
- QtCore.QObject.connect(self.ui.removeButton, QtCore.SIGNAL("clicked()"), self._removePath)
- QtCore.QObject.connect(self.ui.upButton, QtCore.SIGNAL("clicked()"), self._moveUp)
- QtCore.QObject.connect(self.ui.downButton, QtCore.SIGNAL("clicked()"), self._moveDown)
- QtCore.QObject.connect(self.ui.instanceNameLineEdit, QtCore.SIGNAL('textEdited(const QString &)'), self._letterChanged)
- QtCore.QObject.connect(self.ui.poolDeviceNameCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.aliasCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.poolVersionCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.poolPathList, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self._editPath)
-
- def _letterChanged(self):
- if self.ui.poolDeviceNameCheckBox.isChecked():
- self.ui.poolDeviceNameLineEdit.setText("pool/" + self.ui.instanceNameLineEdit.text() + "/1")
- if self.ui.aliasCheckBox.isChecked():
- self.ui.aliasLineEdit.setText("Pool_" + self.ui.instanceNameLineEdit.text())
- if self.ui.poolVersionCheckBox.isChecked():
- self.ui.poolVersionLineEdit.setText("0.3.0")
-
- def _addPath (self):
- text, ok = QtGui.QInputDialog.getText(self.poolEditor, 'Input Dialog', 'Type directory to be added:')
- if (ok and len(text) > 0):
- self._pool.getPoolPath().append(str(text))
- self._refreshPathList()
-
- def _editPath (self):
- if len(self.ui.poolPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.poolPathList.selectedIndexes()[0].row()
- text, ok = QtGui.QInputDialog.getText(self.poolEditor, 'Input Dialog', 'Edit selected directory:', QtGui.QLineEdit.Normal, self._pool.getPoolPath()[self._path_id])
- if (ok and len(text) > 0):
- self._pool.getPoolPath()[self._path_id] = text
- self._refreshPathList()
-
- def _removePath(self):
- if len(self.ui.poolPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.poolPathList.selectedIndexes()[0].row()
- self._pool.getPoolPath().remove(self._pool.getPoolPath()[self._path_id])
- self._refreshPathList()
-
- def _moveUp(self):
- if len(self.ui.poolPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.poolPathList.selectedIndexes()[0].row()
- if self._path_id > 0:
- tmp = self._pool.getPoolPath()[self._path_id]
- self._pool.getPoolPath()[self._path_id] = self._pool.getPoolPath()[self._path_id - 1]
- self._pool.getPoolPath()[self._path_id - 1] = tmp
- self._refreshPathList()
- self.ui.poolPathList.setCurrentIndex(self.ui.poolPathList.indexFromItem(self.ui.poolPathList.item(self._path_id - 1)))
-
- def _moveDown(self):
- if len(self.ui.poolPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.poolPathList.selectedIndexes()[0].row()
- if self._path_id < self.ui.poolPathList.count() - 1:
- tmp = self._pool.getPoolPath()[self._path_id]
- self._pool.getPoolPath()[self._path_id] = self._pool.getPoolPath()[self._path_id + 1]
- self._pool.getPoolPath()[self._path_id + 1] = tmp
- self._refreshPathList()
- self.ui.poolPathList.setCurrentIndex(self.ui.poolPathList.indexFromItem(self.ui.poolPathList.item(self._path_id + 1)))
-
- def _refreshPathList(self):
- self.ui.poolPathList.clear()
- for path in self._pool.getPoolPath():
- self.ui.poolPathList.addItem(path)
-
- def _validate(self):
- err = 0
- warnMess = ""
-
- if self.ui.instanceNameLineEdit.text() == "":
- err = 1
- warnMess += "Please type the Instance Name\n"
- else:
- if self._parent.checkName(self.ui.instanceNameLineEdit.text(), id=self._item_id):
- pass
- else:
- err = 1
- warnMess += "The Instance Name already exist in the DataBase\n"
-
- pdn = str(self.ui.poolDeviceNameLineEdit.text())
- allowed = re.compile("^.{1,}/.{1,}/.{1,}$")
- if not ((len(pdn) > 0) and (allowed.match(pdn)) and (pdn.count("/") == 2)):
- err = 1
- warnMess += "The Pool Device Name is not valid\n"
-
- #if self.ui.aliasLineEdit.text() == "":
- # err=1
- # warnMess+="Please type the Alias\n"
-
- if self.ui.poolVersionLineEdit.text() == "":
- err = 1
- warnMess += "Please type the Pool Version\n"
-
- if err == 1:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Warning !!!")
- msgBox.setStandardButtons(QtGui.QMessageBox().Ok)
- msgBox.setInformativeText(warnMess)
- msgBox.setIcon(QtGui.QMessageBox.Warning)
- ret = msgBox.exec_()
- return False
- else:
- self._pool.setInstanceName(self.ui.instanceNameLineEdit.text())
- self._pool.setPoolDeviceName(self.ui.poolDeviceNameLineEdit.text())
- self._pool.setAlias(self.ui.aliasLineEdit.text())
- self._pool.setPoolVersion(self.ui.poolVersionLineEdit.text())
- return True
-
- def _createPool(self):
- if self._item_id == None:
- if self._validate():
- self._parent.addItem(self._pool.copy())
- else:
- if self._validate():
- self._parent.editItem(item=self._pool.copy(), id=self._item_id)
-
- def showEditor(self, item=None, item_id=None):
- self._pool = Pool()
- if item == None:
- self._pool.setPoolPath(SardanaManager.get_default_pool_path())
- self._refreshPathList()
- self.poolEditor.setWindowTitle("Create New Pool")
- self.ui.instanceNameLineEdit.setText("")
- self.ui.poolDeviceNameLineEdit.setText("")
- self.ui.poolDeviceNameLineEdit.setEnabled(False)
- self.ui.poolDeviceNameCheckBox.setChecked(True)
- self.ui.aliasLineEdit.setText("")
- self.ui.aliasLineEdit.setEnabled(False)
- self.ui.aliasCheckBox.setChecked(True)
- self.ui.poolVersionLineEdit.setText("")
- self.ui.poolVersionLineEdit.setEnabled(False)
- self.ui.poolVersionCheckBox.setChecked(True)
- self.ui.createButton.setText("Create")
- self._item_id = None
- self.poolEditor.setModal(True)
- self.poolEditor.exec_()
- else:
- self._pool.setPoolPath(item.getPoolPath()[:])
- self._pool.setHostName(item.getHostName())
- self._pool.setLevel(item.getLevel())
- self._refreshPathList()
- self.poolEditor.setWindowTitle("Edit Pool")
- self.ui.instanceNameLineEdit.setText(item.getInstanceName())
- self.ui.poolDeviceNameLineEdit.setText(item.getPoolDeviceName())
- self.ui.poolDeviceNameLineEdit.setEnabled(True)
- self.ui.poolDeviceNameCheckBox.setChecked(False)
- self.ui.aliasLineEdit.setText(item.getAlias())
- self.ui.aliasLineEdit.setEnabled(True)
- self.ui.aliasCheckBox.setChecked(False)
- self.ui.poolVersionLineEdit.setText(item.getPoolVersion())
- self.ui.poolVersionLineEdit.setEnabled(True)
- self.ui.poolVersionCheckBox.setChecked(True) ###
- self.ui.createButton.setText("Edit")
- self._item_id = item_id
- self.poolEditor.setModal(True)
- self.poolEditor.exec_()
-
-
-class MS(Item):
- """
- Represents a Macroserver
- """
- def __init__(self, instanceName="", hostName="", level=None, poolName="", msDeviceName="", msAlias="", msVersion="", msPath=[], doorName="", doorAlias=""):
- Item.__init__(self, instanceName, hostName, level)
- self._msDeviceName = str(msDeviceName)
- self._msAlias = str(msAlias)
- self._msVersion = str(msVersion)
- self._msPath = map(str, msPath)
- self._doorName = str(doorName)
- self._doorAlias = str(doorAlias)
- self._poolName = str(poolName)
-
- def setPoolName(self, name):
- self._poolName = str(name)
- def getPoolName(self):
- return self._poolName
- def setMSDeviceName(self, name):
- self._msDeviceName = str(name)
- def getMSDeviceName(self):
- return self._msDeviceName
- def setMSAlias(self, alias):
- self._msAlias = str(alias)
- def getMSAlias(self):
- return self._msAlias
- def setMSVersion(self, msVersion):
- self._msVersion = str(msVersion)
- def getMSVersion(self):
- return self._msVersion
- def setMSPath(self, path):
- self._msPath = map(str, path)
- def getMSPath(self):
- return self._msPath
- def setDoorName(self, doorName):
- self._doorName = str(doorName)
- def getDoorName(self):
- return self._doorName
- def setDoorAlias(self, doorAlias):
- self._doorAlias = str(doorAlias)
- def getDoorAlias(self):
- return self._doorAlias
- def text(self):
- return str(self._instanceName)
- def copy(self):
- return MS(self._instanceName, self._hostName, self._level, self._poolName, self._msDeviceName, self._msAlias, self._msVersion, self._msPath[:], self._doorName, self._doorAlias)
-
-
-class MSEditor(object):
- """
- Macroserver editor
- """
- def __init__(self, parent=None):
- self._parent = parent
- #self._parent = weakref.ref(parent)
- self._isEditorOpened = False
- self._ms = MS()
- self.msEditor = QtGui.QDialog()
- self.ui = ms_editor_UI.Ui_MSEditor()
- self.msEditor.setModal(True)
- self.ui.setupUi(self.msEditor)
- self._regExp = QtCore.QRegExp("^[0-9a-zA-Z]{,50}")
- self._regValid = QtGui.QRegExpValidator(self._regExp, self.msEditor)
- self._regExp2 = QtCore.QRegExp("^[0-9.]{,50}")
- self._versionValid = QtGui.QRegExpValidator(self._regExp2, self.msEditor)
- self._regExp3 = QtCore.QRegExp("^[0-9a-zA-Z_/]{,100}")
- self._deviceNameValid = QtGui.QRegExpValidator(self._regExp3, self.msEditor)
- self.ui.instanceNameLineEdit.setValidator(self._regValid)
- self.ui.msDeviceNameLineEdit.setValidator(self._deviceNameValid)
- self.ui.msAliasLineEdit.setValidator(self._regValid)
- self.ui.msVersionLineEdit.setValidator(self._versionValid)
- self.ui.doorNameLineEdit.setValidator(self._regValid)
- self.ui.doorAliasLineEdit.setValidator(self._regValid)
- self._item_id = None
- self._path_id = None
- self.ui.addButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-add"))
- self.ui.removeButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
- self.ui.upButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-up"))
- self.ui.downButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-down"))
- #connections
- QtCore.QObject.connect(self.ui.createButton, QtCore.SIGNAL("clicked()"), self._createMS)
- QtCore.QObject.connect(self.ui.addButton, QtCore.SIGNAL("clicked()"), self._addPath)
- QtCore.QObject.connect(self.ui.removeButton, QtCore.SIGNAL("clicked()"), self._removePath)
- QtCore.QObject.connect(self.ui.upButton, QtCore.SIGNAL("clicked()"), self._moveUp)
- QtCore.QObject.connect(self.ui.downButton, QtCore.SIGNAL("clicked()"), self._moveDown)
- QtCore.QObject.connect(self.ui.instanceNameLineEdit, QtCore.SIGNAL('textEdited(const QString &)'), self._letterChanged)
- QtCore.QObject.connect(self.ui.msDeviceNameCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.msAliasCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.msVersionCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.doorNameCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.doorAliasCheckBox, QtCore.SIGNAL("toggled(bool)"), self._letterChanged)
- QtCore.QObject.connect(self.ui.msPathList, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self._editPath)
-
- def _letterChanged(self):
- if self.ui.msDeviceNameCheckBox.isChecked():
- self.ui.msDeviceNameLineEdit.setText("macroserver/" + self.ui.instanceNameLineEdit.text() + "/1")
- if self.ui.msAliasCheckBox.isChecked():
- self.ui.msAliasLineEdit.setText("MS_" + self.ui.instanceNameLineEdit.text())
- if self.ui.msVersionCheckBox.isChecked():
- self.ui.msVersionLineEdit.setText("0.3.0")
- if self.ui.doorNameCheckBox.isChecked():
- self.ui.doorNameLineEdit.setText("door/" + self.ui.instanceNameLineEdit.text() + "/1")
- if self.ui.doorAliasCheckBox.isChecked():
- self.ui.doorAliasLineEdit.setText("Door_" + self.ui.instanceNameLineEdit.text())
-
- def getPoolServerList(self):
- return self._parent.getPoolServerList()
-
- def fillPoolNameCB(self, selected=None):
- self.ui.poolNameComboBox.clear()
- i = 0
- if selected != None:
- if selected == "":
- selected = "None"
- self.ui.poolNameComboBox.addItem(selected)
- i += 1
- for item in self._parent.wizard()["poolList"]:
- self.ui.poolNameComboBox.addItem(item.text())
- i += 1
- self.ui.poolNameComboBox.insertSeparator(i)
- i += 1
- for item in self.getPoolServerList():
- self.ui.poolNameComboBox.addItem(item)
- i += 1
- self.ui.poolNameComboBox.insertSeparator(i)
- self.ui.poolNameComboBox.addItem("None")
-
- def db(self):
- return self._parent.wizard()['db']
-
- def _editPath (self):
- if len(self.ui.msPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.msPathList.selectedIndexes()[0].row()
- text, ok = QtGui.QInputDialog.getText(self.msEditor, 'Input Dialog', 'Edit selected directory:', QtGui.QLineEdit.Normal, self._ms.getMSPath()[self._path_id])
- if (ok and len(text) > 0):
- self._ms.getMSPath()[self._path_id] = text
- self._refreshPathList()
-
- def _addPath (self):
- text, ok = QtGui.QInputDialog.getText(self.msEditor, 'Input Dialog', 'Type directory to be added:')
- if (ok and len(text) > 0):
- self._ms.getMSPath().append(str(text))
- self._refreshPathList()
-
- def _removePath(self):
- if len(self.ui.msPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.msPathList.selectedIndexes()[0].row()
- self._ms.getMSPath().remove(self._ms.getMSPath()[self._path_id])
- self._refreshPathList()
-
- def _moveUp(self):
- if len(self.ui.msPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.msPathList.selectedIndexes()[0].row()
- if self._path_id > 0:
- tmp = self._ms.getMSPath()[self._path_id]
- self._ms.getMSPath()[self._path_id] = self._ms.getMSPath()[self._path_id - 1]
- self._ms.getMSPath()[self._path_id - 1] = tmp
- self._refreshPathList()
- self.ui.msPathList.setCurrentIndex(self.ui.msPathList.indexFromItem(self.ui.msPathList.item(self._path_id - 1)))
-
- def _moveDown(self):
- if len(self.ui.msPathList.selectedIndexes()) > 0:
- self._path_id = self.ui.msPathList.selectedIndexes()[0].row()
- if self._path_id < self.ui.msPathList.count() - 1:
- tmp = self._ms.getMSPath()[self._path_id]
- self._ms.getMSPath()[self._path_id] = self._ms.getMSPath()[self._path_id + 1]
- self._ms.getMSPath()[self._path_id + 1] = tmp
- self._refreshPathList()
- self.ui.msPathList.setCurrentIndex(self.ui.msPathList.indexFromItem(self.ui.msPathList.item(self._path_id + 1)))
-
- def _refreshPathList(self):
- self.ui.msPathList.clear()
- for path in self._ms.getMSPath():
- self.ui.msPathList.addItem(path)
-
- def _validate(self):
- err = 0
- warnMess = ""
-
- if self.ui.instanceNameLineEdit.text() == "":
- err = 1
- warnMess += "Please type the Instance Name\n"
- else:
- if self._parent.checkName(name=self.ui.instanceNameLineEdit.text(), id=self._item_id):
- pass
- else:
- err = 1
- warnMess += "The Instance Name already exist in the DataBase\n"
-
- if self.ui.msDeviceNameLineEdit.text() == "":
- err = 1
- warnMess += "Please type the Macro Server Device Name\n"
-
- mdn = str(self.ui.msDeviceNameLineEdit.text())
- allowed = re.compile("^.{1,}/.{1,}/.{1,}$")
- if not ((len(mdn) > 0) and (allowed.match(mdn)) and (mdn.count("/") == 2)):
- err = 1
- warnMess += "The Macro Server Device Name is not valid\n"
-
- #if self.ui.msAliasLineEdit.text() == "":
- # err=1
- # warnMess+="Please type the Macro Server Alias\n"
-
- if self.ui.msVersionLineEdit.text() == "":
- err = 1
- warnMess += "Please type the Macro Server Version\n"
-
- dn = str(self.ui.doorNameLineEdit.text())
- allowed = re.compile("^.{1,}/.{1,}/.{1,}$")
- if not ((len(dn) > 0) and (allowed.match(dn)) and (dn.count("/") == 2)):
- err = 1
- warnMess += "The Door Name is not valid\n"
-
- #if self.ui.doorAliasLineEdit.text() == "":
- # err=1
- # warnMess+="Please type the Door Alias\n"
-
- if err == 1:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Warning !!!")
- msgBox.setStandardButtons(QtGui.QMessageBox().Ok)
- msgBox.setInformativeText(warnMess)
- msgBox.setIcon(QtGui.QMessageBox.Warning)
- ret = msgBox.exec_()
- return False
- else:
- self._ms.setInstanceName(self.ui.instanceNameLineEdit.text())
- self._ms.setMSDeviceName(self.ui.msDeviceNameLineEdit.text())
- self._ms.setMSAlias(self.ui.msAliasLineEdit.text())
- self._ms.setMSVersion(self.ui.msVersionLineEdit.text())
- self._ms.setDoorName(self.ui.doorNameLineEdit.text())
- self._ms.setDoorAlias(self.ui.doorAliasLineEdit.text())
- if self.ui.poolNameComboBox.currentText() == "None":
- self._ms.setPoolName("")
- else:
- self._ms.setPoolName(self.ui.poolNameComboBox.currentText())
-
- return True
-
- def _createMS(self):
- if self._item_id == None:
- if self._validate():
- self._parent.addItem(self._ms.copy())
- else:
- if self._validate():
- self._parent.editItem(item=self._ms.copy(), id=self._item_id)
-
- def showEditor(self, item=None, item_id=None):
- self._ms = MS()
- if item == None:
- self._ms.setMSPath(SardanaManager.get_default_ms_path())
- self._refreshPathList()
- self.msEditor.setWindowTitle("Create New Macro Server")
- self.ui.instanceNameLineEdit.setText("")
- self.fillPoolNameCB()
- self.ui.msDeviceNameLineEdit.setText("")
- self.ui.msDeviceNameLineEdit.setEnabled(False)
- self.ui.msDeviceNameCheckBox.setChecked(True)
- self.ui.msAliasLineEdit.setText("")
- self.ui.msAliasLineEdit.setEnabled(False)
- self.ui.msAliasCheckBox.setChecked(True)
- self.ui.msVersionLineEdit.setText("")
- self.ui.msVersionLineEdit.setEnabled(False)
- self.ui.msVersionCheckBox.setChecked(True)
- self.ui.doorNameLineEdit.setText("")
- self.ui.doorNameLineEdit.setEnabled(False)
- self.ui.doorNameCheckBox.setChecked(True)
- self.ui.doorAliasLineEdit.setText("")
- self.ui.doorAliasLineEdit.setEnabled(False)
- self.ui.doorAliasCheckBox.setChecked(True)
- self.ui.createButton.setText("Create")
- self._item_id = None
- self.msEditor.setModal(True)
- self.msEditor.exec_()
- else:
- self._ms.setMSPath(item.getMSPath()[:])
- self._ms.setHostName(item.getHostName())
- self._ms.setLevel(item.getLevel())
- self._refreshPathList()
- self.msEditor.setWindowTitle("Edit Macro Server")
- self.ui.instanceNameLineEdit.setText(item.getInstanceName())
- self.fillPoolNameCB(selected=item.getPoolName())
- self.ui.msDeviceNameLineEdit.setText(item.getMSDeviceName())
- self.ui.msDeviceNameLineEdit.setEnabled(True)
- self.ui.msDeviceNameCheckBox.setChecked(False)
- self.ui.msAliasLineEdit.setText(item.getMSAlias())
- self.ui.msAliasLineEdit.setEnabled(True)
- self.ui.msAliasCheckBox.setChecked(False)
- self.ui.msVersionLineEdit.setText(item.getMSVersion())
- self.ui.msVersionLineEdit.setEnabled(True)
- self.ui.msVersionCheckBox.setChecked(True) ###
- self.ui.doorNameLineEdit.setText(item.getDoorName())
- self.ui.doorNameLineEdit.setEnabled(True)
- self.ui.doorNameCheckBox.setChecked(False)
- self.ui.doorAliasLineEdit.setText(item.getDoorAlias())
- self.ui.doorAliasLineEdit.setEnabled(True)
- self.ui.doorAliasCheckBox.setChecked(False)
- self.ui.createButton.setText("Edit")
- self._item_id = item_id
- self.msEditor.setModal(True)
- self.msEditor.exec_()
-
-
-class AddMSBasePage(SimpleEditorBasePage):
- """
- Page for editing the list of Macroservers
- """
-
- def __init__(self, parent=None):
- self._editor = None
- SimpleEditorBasePage.__init__(self, parent)
- self._editor = MSEditor(parent=self)
- self.selectedItem = None
- self.item_id = None
- self.setSubTitle('You can use this manager if you would like to Add, Edit or Delete Macro Server entries in the database.')
- self.addButton.setText(QtGui.QApplication.translate("Form", "Add MS", None, QtGui.QApplication.UnicodeUTF8))
- self.editButton.setText(QtGui.QApplication.translate("Form", "Edit MS", None, QtGui.QApplication.UnicodeUTF8))
- self.removeButton.setText(QtGui.QApplication.translate("Form", "Remove MS", None, QtGui.QApplication.UnicodeUTF8))
- #connections
- QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.openAddEditor)
- QtCore.QObject.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.openItemEditor)
- QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL("clicked()"), self.delete)
- QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL("cellDoubleClicked(int,int)"), self.openItemEditor)
-
- def delete (self):
- if len(self.tableWidget.selectedIndexes()) > 0:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("The list of Macro Servers has been modified.")
- self.item_id = self.tableWidget.selectedIndexes()[0].row()
- self.selectedItem = self.listOfItems[self.item_id]
- msgBox.setInformativeText("Do you want to delete Macro Server?:\n" + self.selectedItem.text())
- msgBox.setStandardButtons(QtGui.QMessageBox().Ok | QtGui.QMessageBox().Cancel)
- msgBox.setDefaultButton(QtGui.QMessageBox().Cancel);
- msgBox.setIcon(QtGui.QMessageBox.Question)
- ret = msgBox.exec_()
- if ret == QtGui.QMessageBox().Ok:
- self.removeItem(self.item_id)
- if ret == QtGui.QMessageBox().Cancel:
- pass
-
- def openAddEditor (self):
- self.item_id = None
- self.selectedItem = None
- SimpleEditorBasePage.openEditor(self)
- self._editor.showEditor(item=None, item_id=None)
-
-
- def openItemEditor (self):
- if len(self.tableWidget.selectedIndexes()) > 0:
- self.item_id = self.tableWidget.selectedIndexes()[0].row()
- self.selectedItem = self.listOfItems[self.item_id]
- SimpleEditorBasePage.openEditor(self)
- self._editor.showEditor(item=self.selectedItem, item_id=self.item_id)
-
- def checkData(self):
- pass
-
- def isComplete(self):
- return self._valid
-
- def _fillList(self):
- warnMess = ""
- err = False
-
- for item in self.listOfItems:
- if len(item.getPoolName()) > 0:
- poolExist = False
- for sv_item in self.getPoolServerList():
- if item.getPoolName() == sv_item:
- poolExist = True
- break
- if not poolExist:
- for cr_item in self.wizard()["poolList"]:
- if item.getPoolName() == cr_item.getInstanceName():
- poolExist = True
- break
- if not poolExist:
- warnMess += "Pool: '" + item.getPoolName() + "' does not exist \n"
- item.setPoolName("")
- err = True
-
- if err:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Warning !!!")
- msgBox.setStandardButtons(QtGui.QMessageBox().Ok)
- msgBox.setInformativeText(warnMess)
- msgBox.setIcon(QtGui.QMessageBox.Warning)
- ret = msgBox.exec_()
-
- SimpleEditorBasePage._fillList(self)
-
- def initializePage(self):
- SimpleEditorBasePage.initializePage(self)
- self.wizard().__setitem__("msList", self._getItemList)
- if len(self.listOfItems) == 0:
- sardana = self.wizard()["sardana"]
- _ms = MS()
- _ms.setInstanceName(sardana)
- _ms.setPoolName(self.wizard()["poolList"][0].getInstanceName())
- _ms.setLevel("1")
- _ms.setMSDeviceName("macroserver/" + sardana + "/1")
- _ms.setMSAlias("MS_" + sardana)
- _ms.setMSVersion("0.3.0")
- _ms.setDoorName("door/" + sardana + "/1")
- _ms.setDoorAlias("Door_" + sardana)
- #_ms.setMSPath(SardanaManager.get_default_ms_path()) ###
-
- self.addItem(_ms.copy())
- self._editor.fillPoolNameCB()
-
-
-class SardanaCommitBasePage(wiz.SardanaIntroBasePage):
- """
- Commiting page
- """
- def __init__(self, parent=None):
- QtGui.QWizardPage.__init__(self, parent)
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
- self._layout = QtGui.QFormLayout()
- self._sardanaNameLabel = QtGui.QLabel()
- self._hostNameLabel = QtGui.QLabel()
- self._portLabel = QtGui.QLabel()
- self._poollsLabel = QtGui.QLabel()
- self._mssLabel = QtGui.QLabel()
- self._layout.addRow(self._set_style(QtGui.QLabel("Sardana:")), self._sardanaNameLabel)
- self._layout.addRow(self._set_style(QtGui.QLabel("Host:")), self._hostNameLabel)
- self._layout.addRow(self._set_style(QtGui.QLabel("Port:")), self._portLabel)
- self._layout.addRow(self._set_style(QtGui.QLabel("")), QtGui.QLabel(""))
- self._layout.addRow(self._set_style(QtGui.QLabel("Pools:")), self._poollsLabel)
- self._layout.addRow(self._set_style(QtGui.QLabel("MacroServers:")), self._mssLabel)
- self._checkBox = QtGui.QCheckBox("Start local server automatically\neven if no starter is present")
- self._checkBox.setChecked(True)
- self._layout.addRow(self._checkBox)
- self._poolListText = ""
- self._msListText = ""
- self.setLayout(self._layout)
- #self.setCommitPage(True)
- self.setTitle('Confirmation.')
-
- def next(self):
- QWizard.next(self)
-
- def _set_style(self, w):
- f = w.font()
- f.setBold(True)
- w.setFont(f)
- return w
-
- def _getAutoStart(self):
- return self._checkBox.checkState()
-
- def initializePage(self):
- wiz.SardanaIntroBasePage.initializePage(self)
- self.wizard().__setitem__("autoStart", self._getAutoStart)
- self._checkBox.setVisible(False)
-
- for item in self.wizard()["poolList"] + self.wizard()["msList"]:
- if item.getHostName() == "localhost":
- if SardanaManager().has_localhost_starter() == True:
- self._checkBox.setVisible(True)
- break
-
- self._sardanaNameLabel.setText(self.wizard()["sardana"])
- self._hostNameLabel.setText(self.wizard()["host"])
- self._portLabel.setText(self.wizard()["port"])
- self._poolListText = ""
- # limit the length of the list
- if len(self.wizard()["poolList"]) + len(self.wizard()["msList"]) > 14:
- limited = True
- else:
- limited = False
- i = 0
- for pool in self.wizard()["poolList"]:
- if (limited) and (i > 6):
- self._poolListText += "...\n"
- break
- self._poolListText += pool.getInstanceName() + "\n"
- i += 1
-
- self._poollsLabel.setText(self._poolListText)
- self._msListText = ""
- i = 0
- for ms in self.wizard()["msList"]:
- if (limited) and (i > 6):
- self._msListText += "...\n"
- break
- self._msListText += ms.getInstanceName() + "\n"
- i += 1
-
- self._mssLabel.setText(self._msListText)
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
-
-class SardanaOutroBasePage(wiz.SardanaBasePage):
- """
- The last page in the wizard for creation sardana and all of the pools and macroservers that it consist
- """
- def __init__(self, parent=None):
- QtGui.QWizardPage.__init__(self, parent)
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
- self._valid = True
- self._layout = QtGui.QVBoxLayout()
- self._spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self._layout.addItem(self._spacerItem)
- self._horizontalLayout_1 = QtGui.QHBoxLayout()
- self._label = QtGui.QLabel("\nInitializing...")
- self._label.setWordWrap(True)
- self._horizontalLayout_1.addWidget(self._label)
- self._layout.addLayout(self._horizontalLayout_1)
- self._pbar = QtGui.QProgressBar(self)
- self._layout.addWidget(self._pbar)
- self._horizontalLayout_2 = QtGui.QHBoxLayout()
- self._spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self._horizontalLayout_2.addItem(self._spacerItem1)
- self._cancelButton = QtGui.QPushButton("Cancel")
- self._horizontalLayout_2.addWidget(self._cancelButton)
- self._spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self._horizontalLayout_2.addItem(self._spacerItem2)
- self._layout.addLayout(self._horizontalLayout_2)
- self._spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self._layout.addItem(self._spacerItem3)
- self.setLayout(self._layout)
-# self.setTitle('The new instance of Sardana has been successfully created.')
-
- def initializePage(self):
- self.wizard().setOption(QtGui.QWizard.NoCancelButton, True)
- self.wizard().setOption (QtGui.QWizard.NoBackButtonOnLastPage , True)
- self.progress = Progress(self.wizard()["db"], self.wizard()["sardana"], self.wizard()["poolList"][:], self.wizard()["msList"][:], self.wizard()["autoStart"])
- Qt.QObject.connect(self.progress, Qt.SIGNAL("valueUpdated"), self.setProgress)
- QtCore.QObject.connect(self._cancelButton, QtCore.SIGNAL("clicked()"), self.progress.cancel)
- self.progress.start()
- self._valid = False
- self._cancelButton.show()
-
- def isComplete(self):
- return self._valid
-
- def setProgress(self, message, value, status):
- #status
- # 0 - normal
- # 1 - finished
- # -1 - interrupted
- if status == 0:
- self.setTitle('The Wizard is creating the new instance of Sardana.')
- if status == 1:
- self.setTitle('The new instance of Sardana has been successfully created.')
- self._cancelButton.hide()
- self._valid = True
- self.emit(QtCore.SIGNAL('completeChanged()'))
- if status == -1:
- self.setTitle('The new instance of Sardana has NOT been created.')
- self.wizard().setOption (QtGui.QWizard.NoBackButtonOnLastPage , False)
- self.wizard().setOption(QtGui.QWizard.NoCancelButton, False)
- self._cancelButton.hide()
- self._valid = False
- self.emit(QtCore.SIGNAL('completeChanged()'))
-
- self._label.setText(message)
- self._pbar.setValue(value)
-
-
-class Progress (Qt.QThread):
- """
- Indicate the percent of sardana creation process
- """
- def __init__(self, db, sardana, poolList, msList, autoStart):
- Qt.QThread.__init__(self)
- self._sardana = sardana
- self._poolList = poolList
- self._poolNames = [x.getPoolDeviceName() for x in poolList]
- self._msList = msList
- self._cancelled = False
- self._autoStart = autoStart
- self._db = db
-
- def cancel(self):
- self._cancelled = True
-
- def run(self):
- #status
- # 0 - normal
- # 1 - finished
- # -1 - interrupted
- for msg, percentage, status in self._createSardana():
- self.emit(Qt.SIGNAL("valueUpdated"), msg, percentage, status)
-
- def _createSardana(self):
- err = False
- mess = "Click the Finish button to exit this wizard."
- sardanaManager = SardanaManager()
- self._newSardana = None
-
- percent = 0
- step = 100 / (len(self._poolList) + len(self._msList) + 1)
-
- if len (self._msList) > 0:
- try:
- self._sardana_device_name = str(self._msList[0].getMSDeviceName())
- self._newSardana = sardanaManager.create_sardana(str(self._sardana), self._sardana_device_name, db=self._db)
- except Exception, e:
- err = True
- mess = str(e)
- traceback.print_exc()
- else:
- try:
- self._sardana_device_name = str(self._poolList[0].getPoolDeviceName())
- self._newSardana = sardanaManager.create_sardana(str(self._sardana), self._sardana_device_name, db=self._db)
- except Exception, e:
- err = True
- mess = str(e)
-
- if err:
- #msgbox = TaurusMessageBox(*sys.exc_info())
- #msgbox.exec_()
-
- yield "\nCancelled...", 100, 1
-
- else: # Sardana has been created
- percent += step
- yield "\nProcessing the list of Pools", int(percent), 0
- time.sleep(0.5)
-
- try:
-
- for pool in self._poolList:
- if self._cancelled:
- raise Exception("Canceled by user")
-
- yield "Adding Pool:\n %s" % pool.getInstanceName(), int(percent), 0
-
- if pool.getPoolDeviceName() == "":
- pool.setPoolDeviceName(None)
- if pool.getAlias() == "":
- pool.setAlias(None)
- newPool = self._newSardana.create_pool(pool.getInstanceName(), pool.getPoolPath(), pool.getPoolVersion(), alias=pool.getAlias() , device_name=pool.getPoolDeviceName())
- if pool.getHostName() not in (None, '', 'None'):
- if pool.getHostName() == "localhost":
- if self._autoStart:
- yield "Starting Pool:\n %s" % pool.getInstanceName(), int(percent), 0
- newPool.local_run()
- else:
- yield "Starting Pool:\n %s" % pool.getInstanceName(), int(percent), 0
- newPool.starter_run(pool.getHostName(), pool.getLevel())
- percent += step
-
- yield "\nProcessing the list of MacroServers", int(percent), 0
- time.sleep(0.5)
-
- for ms in self._msList:
- if self._cancelled:
- raise Exception("Canceled by user")
-
- yield "Adding MacroServer:\n %s" % ms.getInstanceName(), int(percent), 0
-
- if ms.getMSDeviceName() == "":
- ms.setMSDeviceName(None)
- if ms.getMSAlias() == "":
- ms.setMSAlias(None)
- newMS = self._newSardana.create_macroserver(ms.getInstanceName(), ms.getMSPath(), self._poolNames, ms.getMSVersion(), alias=ms.getMSAlias() , device_name=ms.getMSDeviceName())
- newMS.create_door(ms.getDoorAlias(), ms.getDoorName())
- if ms.getHostName() not in (None, '', 'None'):
- if ms.getHostName() == "localhost":
- if self._autoStart:
- yield "Starting MacroServer:\n %s" % ms.getInstanceName(), int(percent), 0
- newMS.local_run()
- else:
- yield "Starting MacroServer:\n %s" % ms.getInstanceName(), int(percent), 0
- newMS.starter_run(ms.getHostName(), ms.getLevel())
-
- percent += step
-
- self._newSardana.set_device_name(self._sardana_device_name)
- yield "\nDone...", 100, 1
-
- except Exception, e:
- err = True
- mess = str(e)
- traceback.print_exc()
- sardanaManager.remove_sardana(str(self._sardana)) # remove Sardana if something goes wrong
- yield "\nCanceled by user", 0, -1
-
-
-def addSardana():
-
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(wiz.get_resources())
-
- Pages = Enumeration('Pages', ('IntroPage', 'TangoPage', 'SardanaPage', 'PoolPage', 'MSPage', 'CommitPage', 'OutroPage'))
- w = wiz.SardanaBaseWizard()
-
- intro = NewSardanaIntroPage()
- w.setPage(Pages.IntroPage, intro)
- intro.setNextPageId(Pages.TangoPage)
-
- tg_host_page = SelectTangoHostPage()
- w.setPage(Pages.TangoPage, tg_host_page)
- tg_host_page.checkData()
- tg_host_page.setNextPageId(Pages.SardanaPage)
-
- sardana_page = AddSardanaBasePage()
- w.setPage(Pages.SardanaPage, sardana_page)
- sardana_page.setNextPageId(Pages.PoolPage)
-
- pool_page = AddPoolBasePage()
- w.setPage(Pages.PoolPage, pool_page)
- pool_page.setNextPageId(Pages.MSPage)
-
- ms_page = AddMSBasePage()
- w.setPage(Pages.MSPage, ms_page)
- ms_page.setNextPageId(Pages.CommitPage)
-
- commit_page = SardanaCommitBasePage()
- w.setPage(Pages.CommitPage, commit_page)
- commit_page.setNextPageId(Pages.OutroPage)
-
- outro_page = SardanaOutroBasePage()
- w.setPage(Pages.OutroPage, outro_page)
- w.setOption (QtGui.QWizard.CancelButtonOnLeft , True)
-
-
- #Qt.QObject.connect(w, Qt.SIGNAL("done()"), done)
- w.show()
- sys.exit(app.exec_())
-
-
-
-
-if __name__ == "__main__":
- addSardana()
diff --git a/sardanaConfig/src/wizards/pool_editor_UI.py b/sardanaConfig/src/wizards/pool_editor_UI.py
deleted file mode 100644
index eeec023d..00000000
--- a/sardanaConfig/src/wizards/pool_editor_UI.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'poolEditor.ui'
-#
-# Created: Wed Nov 10 10:49:04 2010
-# by: PyQt4 UI code generator 4.4.3
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-class Ui_PoolEditor(object):
- def setupUi(self, PoolEditor):
- PoolEditor.setObjectName("PoolEditor")
- PoolEditor.resize(400, 333)
- self.gridLayout = QtGui.QGridLayout(PoolEditor)
- self.gridLayout.setObjectName("gridLayout")
- self.gridLayout_2 = QtGui.QGridLayout()
- self.gridLayout_2.setObjectName("gridLayout_2")
- self.instanceNameLineEdit = QtGui.QLineEdit(PoolEditor)
- self.instanceNameLineEdit.setObjectName("instanceNameLineEdit")
- self.gridLayout_2.addWidget(self.instanceNameLineEdit, 0, 1, 1, 1)
- self.instanceNameLabel = QtGui.QLabel(PoolEditor)
- self.instanceNameLabel.setObjectName("instanceNameLabel")
- self.gridLayout_2.addWidget(self.instanceNameLabel, 0, 0, 1, 1)
- self.poolDeviceNameLineEdit = QtGui.QLineEdit(PoolEditor)
- self.poolDeviceNameLineEdit.setObjectName("poolDeviceNameLineEdit")
- self.gridLayout_2.addWidget(self.poolDeviceNameLineEdit, 1, 1, 1, 1)
- self.aliasLineEdit = QtGui.QLineEdit(PoolEditor)
- self.aliasLineEdit.setObjectName("aliasLineEdit")
- self.gridLayout_2.addWidget(self.aliasLineEdit, 2, 1, 1, 1)
- self.poolVersionLineEdit = QtGui.QLineEdit(PoolEditor)
- self.poolVersionLineEdit.setObjectName("poolVersionLineEdit")
- self.gridLayout_2.addWidget(self.poolVersionLineEdit, 3, 1, 1, 1)
- self.poolDeviceNameLabel = QtGui.QLabel(PoolEditor)
- self.poolDeviceNameLabel.setObjectName("poolDeviceNameLabel")
- self.gridLayout_2.addWidget(self.poolDeviceNameLabel, 1, 0, 1, 1)
- self.aliasLabel = QtGui.QLabel(PoolEditor)
- self.aliasLabel.setObjectName("aliasLabel")
- self.gridLayout_2.addWidget(self.aliasLabel, 2, 0, 1, 1)
- self.poolVersionLabel = QtGui.QLabel(PoolEditor)
- self.poolVersionLabel.setObjectName("poolVersionLabel")
- self.gridLayout_2.addWidget(self.poolVersionLabel, 3, 0, 1, 1)
- self.poolDeviceNameCheckBox = QtGui.QCheckBox(PoolEditor)
- self.poolDeviceNameCheckBox.setObjectName("poolDeviceNameCheckBox")
- self.gridLayout_2.addWidget(self.poolDeviceNameCheckBox, 1, 2, 1, 1)
- self.aliasCheckBox = QtGui.QCheckBox(PoolEditor)
- self.aliasCheckBox.setObjectName("aliasCheckBox")
- self.gridLayout_2.addWidget(self.aliasCheckBox, 2, 2, 1, 1)
- self.poolVersionCheckBox = QtGui.QCheckBox(PoolEditor)
- self.poolVersionCheckBox.setObjectName("poolVersionCheckBox")
- self.gridLayout_2.addWidget(self.poolVersionCheckBox, 3, 2, 1, 1)
- self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)
- self.groupBox = QtGui.QGroupBox(PoolEditor)
- self.groupBox.setObjectName("groupBox")
- self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox)
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.poolPathList = QtGui.QListWidget(self.groupBox)
- self.poolPathList.setObjectName("poolPathList")
- self.horizontalLayout.addWidget(self.poolPathList)
- self.verticalLayout = QtGui.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
- self.addButton = QtGui.QToolButton(self.groupBox)
- self.addButton.setObjectName("addButton")
- self.verticalLayout.addWidget(self.addButton)
- self.removeButton = QtGui.QToolButton(self.groupBox)
- self.removeButton.setObjectName("removeButton")
- self.verticalLayout.addWidget(self.removeButton)
- self.upButton = QtGui.QToolButton(self.groupBox)
- self.upButton.setArrowType(QtCore.Qt.NoArrow)
- self.upButton.setObjectName("upButton")
- self.verticalLayout.addWidget(self.upButton)
- self.downButton = QtGui.QToolButton(self.groupBox)
- self.downButton.setObjectName("downButton")
- self.verticalLayout.addWidget(self.downButton)
- self.horizontalLayout.addLayout(self.verticalLayout)
- self.gridLayout.addWidget(self.groupBox, 1, 0, 1, 1)
- self.horizontalLayout_2 = QtGui.QHBoxLayout()
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout_2.addItem(spacerItem)
- self.createButton = QtGui.QPushButton(PoolEditor)
- self.createButton.setObjectName("createButton")
- self.horizontalLayout_2.addWidget(self.createButton)
- self.closeButton = QtGui.QPushButton(PoolEditor)
- self.closeButton.setObjectName("closeButton")
- self.horizontalLayout_2.addWidget(self.closeButton)
- self.gridLayout.addLayout(self.horizontalLayout_2, 2, 0, 1, 1)
-
- self.retranslateUi(PoolEditor)
- QtCore.QObject.connect(self.poolDeviceNameCheckBox, QtCore.SIGNAL("toggled(bool)"), self.poolDeviceNameLineEdit.setDisabled)
- QtCore.QObject.connect(self.aliasCheckBox, QtCore.SIGNAL("toggled(bool)"), self.aliasLineEdit.setDisabled)
- QtCore.QObject.connect(self.poolVersionCheckBox, QtCore.SIGNAL("toggled(bool)"), self.poolVersionLineEdit.setDisabled)
- QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), PoolEditor.close)
- QtCore.QMetaObject.connectSlotsByName(PoolEditor)
-
- def retranslateUi(self, PoolEditor):
- PoolEditor.setWindowTitle(QtGui.QApplication.translate("PoolEditor", "Create Pool", None, QtGui.QApplication.UnicodeUTF8))
- self.instanceNameLabel.setText(QtGui.QApplication.translate("PoolEditor", "Instance name", None, QtGui.QApplication.UnicodeUTF8))
- self.poolDeviceNameLabel.setText(QtGui.QApplication.translate("PoolEditor", "Pool device name", None, QtGui.QApplication.UnicodeUTF8))
- self.aliasLabel.setText(QtGui.QApplication.translate("PoolEditor", "Alias (optional)", None, QtGui.QApplication.UnicodeUTF8))
- self.poolVersionLabel.setText(QtGui.QApplication.translate("PoolEditor", "Pool version", None, QtGui.QApplication.UnicodeUTF8))
- self.poolDeviceNameCheckBox.setText(QtGui.QApplication.translate("PoolEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.aliasCheckBox.setText(QtGui.QApplication.translate("PoolEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.poolVersionCheckBox.setText(QtGui.QApplication.translate("PoolEditor", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
- self.groupBox.setTitle(QtGui.QApplication.translate("PoolEditor", "PoolPath", None, QtGui.QApplication.UnicodeUTF8))
- self.createButton.setText(QtGui.QApplication.translate("PoolEditor", "Create", None, QtGui.QApplication.UnicodeUTF8))
- self.closeButton.setText(QtGui.QApplication.translate("PoolEditor", "Close", None, QtGui.QApplication.UnicodeUTF8))
-
-
-if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- PoolEditor = QtGui.QDialog()
- ui = Ui_PoolEditor()
- ui.setupUi(PoolEditor)
- PoolEditor.show()
- sys.exit(app.exec_())
-
diff --git a/sardanaConfig/src/wizards/pool_page.py b/sardanaConfig/src/wizards/pool_page.py
deleted file mode 100644
index 3092b21d..00000000
--- a/sardanaConfig/src/wizards/pool_page.py
+++ /dev/null
@@ -1,156 +0,0 @@
-import sys, os
-
-from PyQt4 import QtGui, QtCore, Qt
-
-import taurus
-import wiz
-
-from taurus.core.utils import Enumeration
-
-PoolSelectionMode = Enumeration('PoolSelectionMode', ('FromSardana', 'FromDatabase'))
-
-class SelectPoolBasePage(wiz.SardanaBasePage):
-
- def __init__(self, parent = None, selectionMode=PoolSelectionMode.FromDatabase):
- wiz.SardanaBasePage.__init__(self, parent)
- self.setSelectionMode(selectionMode)
-
- self['pool'] = self._getPool
-
- self.setSubTitle('Please select the Pool instance')
-
- panel = self.getPanelWidget()
-
- layout = QtGui.QFormLayout()
-
- self.poolCB = QtGui.QComboBox(panel)
- self.poolCB.setDuplicatesEnabled(False)
- self.poolCB.setEditable(False)
-
- layout.addRow("&Pool instance", self.poolCB)
-
- panel.setLayout(layout)
-
- self.connect(self.poolCB,
- QtCore.SIGNAL('currentIndexChanged(int)'),
- QtCore.SIGNAL('completeChanged()'))
-
- def getSelectionMode(self):
- return self._selectionMode
-
- def setSelectionMode(self, selectionMode):
- self._selectionMode = selectionMode
-
- def _getPool(self):
- pool_server = str(self.poolCB.currentText())
- return pool_server
-
- def pool(self):
- return self.wizard()['pool']
-
- def db(self):
- return self.wizard()['db']
-
- def isComplete(self):
- idx = self.poolCB.currentIndex()
- if idx >= 0:
- self.setStatus('')
- return True
- self.setStatus('No instance selected')
- return False
-
- def getPoolServerList(self):
- return [ s[s.index('/')+1:] for s in self.db().get_server_list() if s.startswith('Pool/') ]
-
- def _fillCB(self):
- self.poolCB.clear()
- mode = self.getSelectionMode()
- if mode == PoolSelectionMode.FromDatabase:
- self.poolCB.addItems(self.getPoolServerList())
- else:
- #TODO
- pass
-
- def initializePage(self):
- wiz.SardanaBasePage.initializePage(self)
- self._fillCB()
-
-def t1(tg_host=None, sardana=None):
-
- PoolExamplePages = Enumeration('PoolExamplePages',
- ('IntroPage', 'TangoPage', 'SardanaPage', 'PoolPage'))
-
- class PoolExampleIntroPage(wiz.SardanaIntroBasePage):
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- from tango_host_page import SelectTangoHostBasePage
-
- class SelectTangoHostExamplePage(SelectTangoHostBasePage):
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- from sardana_page import SelectSardanaBasePage
-
- class SelectSardanaExamplePage(SelectSardanaBasePage):
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(wiz.get_resources())
-
- w = wiz.SardanaBaseWizard()
-
- intro = PoolExampleIntroPage()
- w.setPage(PoolExamplePages.IntroPage, intro)
-
- curr_page = intro
- if tg_host is None:
- curr_page.setNextPageId(PoolExamplePages.TangoPage)
- tg_host_page = SelectTangoHostExamplePage()
- w.setPage(PoolExamplePages.TangoPage, tg_host_page)
- curr_page = tg_host_page
- else:
- w['db'] = lambda : tau.Database(tg_host)
-
- if sardana is None:
- curr_page.setNextPageId(PoolExamplePages.SardanaPage)
- sardana_page = SelectSardanaExamplePage()
- w.setPage(PoolExamplePages.SardanaPage, sardana_page)
- curr_page = sardana_page
- else:
- w['sardana'] = lambda : sardana
-
- curr_page.setNextPageId(PoolExamplePages.PoolPage)
-
- pool_page = SelectPoolBasePage(selectionMode=PoolSelectionMode.FromSardana)
-
- w.setPage(PoolExamplePages.PoolPage, pool_page)
-
- w.show()
- sys.exit(app.exec_())
-
-def main():
- tg_host, sardana = None, None
- if len(sys.argv) >1:
- tg_host = sys.argv[1]
- if len(sys.argv) >2:
- sardana = sys.argv[2]
- t1(tg_host=tg_host,sardana=sardana)
-
-if __name__ == '__main__':
- main()
-
-
diff --git a/sardanaConfig/src/wizards/res/logo.jpg b/sardanaConfig/src/wizards/res/logo.jpg
deleted file mode 100644
index df24a112..00000000
--- a/sardanaConfig/src/wizards/res/logo.jpg
+++ /dev/null
Binary files differ
diff --git a/sardanaConfig/src/wizards/res/watermark.jpg b/sardanaConfig/src/wizards/res/watermark.jpg
deleted file mode 100644
index c44f1b02..00000000
--- a/sardanaConfig/src/wizards/res/watermark.jpg
+++ /dev/null
Binary files differ
diff --git a/sardanaConfig/src/wizards/sardana_page.py b/sardanaConfig/src/wizards/sardana_page.py
deleted file mode 100644
index a9566d44..00000000
--- a/sardanaConfig/src/wizards/sardana_page.py
+++ /dev/null
@@ -1,124 +0,0 @@
-import sys, os
-
-from PyQt4 import QtGui, QtCore, Qt
-
-import taurus
-import wiz
-
-from taurus.core.utils import Enumeration
-
-class SelectSardanaBasePage(wiz.SardanaBasePage):
-
- def __init__(self, parent = None):
- wiz.SardanaBasePage.__init__(self, parent)
-
- self['sardana'] = self._getSardana
-
- self.setSubTitle('Please select the Sardana instance')
-
- panel = self.getPanelWidget()
-
- layout = QtGui.QFormLayout()
-
- self.sardanaCB = QtGui.QComboBox(panel)
- self.sardanaCB.setDuplicatesEnabled(False)
- self.sardanaCB.setEditable(False)
-
- layout.addRow("&Sardana instance", self.sardanaCB)
-
- panel.setLayout(layout)
-
- self.connect(self.sardanaCB,
- QtCore.SIGNAL('currentIndexChanged(int)'),
- QtCore.SIGNAL('completeChanged()'))
-
- def _getSardana(self):
- sardana = str(self.sardanaCB.currentText())
- return sardana
-
- def sardana(self):
- return self.wizard()['sardana']
-
- def db(self):
- return self.wizard()['db']
-
- def isComplete(self):
- idx = self.sardanaCB.currentIndex()
- if idx >= 0:
- self.setStatus('')
- return True
- self.setStatus('No instance selected')
- return False
-
- def _fillCB(self):
- self.sardanaCB.clear()
- db = self.db()
- services = db.get_service_list('Sardana.*')
- service_instances = []
- for service in services:
- service_instances.append(service.split('/', 1)[1])
- self.sardanaCB.addItems(service_instances)
-
- def initializePage(self):
- wiz.SardanaBasePage.initializePage(self)
- self._fillCB()
-
-def t1(tg_host=None):
-
- SardanaExamplePages = Enumeration('SardanaExamplePages', ('IntroPage', 'TangoPage', 'SardanaPage'))
-
- class SardanaExampleIntroPage(wiz.SardanaIntroBasePage):
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- from tango_host_page import SelectTangoHostBasePage
-
- class SelectTangoHostExamplePage(SelectTangoHostBasePage):
-
- def setNextPageId(self, id):
- self._nextPageId = id
-
- def nextId(self):
- return self._nextPageId
-
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(wiz.get_resources())
-
- w = wiz.SardanaBaseWizard()
-
- intro = SardanaExampleIntroPage()
- w.setPage(SardanaExamplePages.IntroPage, intro)
-
- curr_page = intro
- if tg_host is None:
- curr_page.setNextPageId(SardanaExamplePages.TangoPage)
- from tango_host_page import SelectTangoHostBasePage
- tg_host_page = SelectTangoHostBasePage()
- w.setPage(SardanaExamplePages.TangoPage, tg_host_page)
- curr_page = tg_host_page
- else:
- w['db'] = lambda : taurus.Database(tg_host)
-
- curr_page.setNextPageId(SardanaExamplePages.SardanaPage)
- sardana_page = SelectSardanaBasePage()
- w.setPage(SardanaExamplePages.SardanaPage, sardana_page)
-
- w.show()
- sys.exit(app.exec_())
-
-def main():
- import taurus
- taurus.setLogLevel(taurus.Warning)
- tg_host=None
- if len(sys.argv) >1:
- tg_host = sys.argv[1]
- t1(tg_host=tg_host)
-
-if __name__ == '__main__':
- main()
-
-
diff --git a/sardanaConfig/src/wizards/settings_widget.py b/sardanaConfig/src/wizards/settings_widget.py
deleted file mode 100644
index 329e1783..00000000
--- a/sardanaConfig/src/wizards/settings_widget.py
+++ /dev/null
@@ -1,780 +0,0 @@
-from PyQt4 import QtCore, QtGui, Qt
-import sys
-from types import *
-import taurus.qt.qtgui.resource
-from abc import abstractmethod
-import copy
-
-############## FAKE ######################################
-
-class PropertyInfo(object):
- def __init__(self, name, type, format, default_value=None):
- self._name = name
- self._type = type
- self._format = format
- self._default_value=default_value
-
- def get_name(self):
- return self._name
-
- def get_type(self):
- return self._type
-
- def get_format(self):
- return self._format
-
- def get_default_value(self):
- return self._default_value
-
-#######################################################
-
-
-
-########################## BASIC INPUT WIDGETS #################
-
-class InputWidget (object):
-
- @abstractmethod
- def setValue(self, value, undo=False):
- pass
-
- @abstractmethod
- def getValue(self):
- return None
-
- @abstractmethod
- def valueChanged(self):
- pass
-
- def deselectWidget(self):
- pass
-
-
-
-class BooleanWidget(QtGui.QWidget, InputWidget):
-
- def __init__(self, parent=None):
- QtGui.QWidget.__init__(self,parent)
- self._formLayout = QtGui.QHBoxLayout(self)
- self.trueButton = QtGui.QRadioButton(self)
- self._formLayout.addWidget(self.trueButton)
- self.falseButton = QtGui.QRadioButton(self)
- self._formLayout.addWidget(self.falseButton)
- self.trueButton.setText("True")
- self.falseButton.setText("False")
- QtCore.QObject.connect(self.trueButton, QtCore.SIGNAL("clicked()"), self.valueChanged)
- QtCore.QObject.connect(self.falseButton, QtCore.SIGNAL("clicked()"), self.valueChanged)
- self.setValue(self.getDefaultValue(), undo=False)
-
- def valueChanged(self):
- if not (self.trueButton.isChecked() == self._actualValue):
- self.emit(QtCore.SIGNAL("valueChanged"),self._actualValue,not self._actualValue)
- self._actualValue = self.trueButton.isChecked()
-
- def setValue(self, value, undo=False):
- if value is None:
- value = self.getDefaultValue()
- self.trueButton.setChecked(value)
- self.falseButton.setChecked(not value)
- self._actualValue = value
-
- def getValue(self):
- return self.trueButton.isChecked()
-
- @classmethod
- def getDefaultValue(self):
- return True
-
-
-class BooleanComboWidget(QtGui.QComboBox, InputWidget):
-
- def __init__(self, parent=None):
- QtGui.QComboBox.__init__(self,parent)
- self.addItems(["True","False"])
- self.setValue(self.getDefaultValue(), undo=False)
-
- def setValue(self, value, undo=False):
- if value is None:
- value = self.getDefaultValue()
-
- if value is True:
- self.setCurrentIndex(0)
- else:
- self.setCurrentIndex(1)
-
- def getValue(self):
- return not self.currentIndex()
-
- def valueChanged(self):
- pass
-
- @classmethod
- def getDefaultValue(self):
- return True
-
-
-class IntegerWidget(QtGui.QLineEdit, InputWidget):
-
- def __init__(self, parent=None):
- QtGui.QLineEdit.__init__(self,parent)
- self.setValidator(QtGui.QIntValidator(self))
- self.setValue(self.getDefaultValue(), undo=False)
-
- def setValue(self, value, undo=False):
- if value is None:
- value = self.getDefaultValue()
- self.setText(str(value))
- self._actualValue = value
-
- def getValue(self):
- try:
- return int(self.text())
- except:
- return self.getDefaultValue()
-
- def focusOutEvent (self, event): #QFocusEvent
- QtGui.QLineEdit.focusOutEvent(self,event)
- self.valueChanged()
-
- def valueChanged(self):
- if not (self.getValue() == self._actualValue):
- self.emit(QtCore.SIGNAL("valueChanged"),self._actualValue, self.getValue() )
- self._actualValue = self.getValue()
- self.setValue(self.getValue(), undo=False) # if value is not valid
-
- @classmethod
- def getDefaultValue(self):
- return 0
-
-
-
-class FloatWidget(QtGui.QLineEdit, InputWidget):
-
- def __init__(self, parent=None):
- QtGui.QLineEdit.__init__(self,parent)
- self.setValidator(QtGui.QDoubleValidator(self))
- self.setValue(self.getDefaultValue(), undo=False)
-
- def setValue(self, value, undo=False):
- if (value is None):
- value = self.getDefaultValue()
- self.setText(str(value))
- self._actualValue = value
-
- def getValue(self):
- try:
- return float(self.text())
- except:
- return self.getDefaultValue()
-
- def focusOutEvent (self, event): #QFocusEvent
- QtGui.QLineEdit.focusOutEvent(self,event)
- self.valueChanged()
-
- def valueChanged(self):
- if not (self.getValue() == self._actualValue):
- self.emit(QtCore.SIGNAL("valueChanged"),self._actualValue, self.getValue() )
- self._actualValue = self.getValue()
- self.setValue(self.getValue(), undo=False) # if value is not valid
-
- @classmethod
- def getDefaultValue(self):
- return 0.0
-
-
-class StringWidget(QtGui.QLineEdit, InputWidget):
-
- def __init__(self, parent=None):
- QtGui.QLineEdit.__init__(self,parent)
- self.setValue(self.getDefaultValue(), undo=False)
-
- def setValue(self, value, undo=False):
- if value is None:
- value = self.getDefaultValue()
- self.setText(str(value))
- self._actualValue = value
-
- def getValue(self):
- return str(self.text())
-
- def textChanged(self, string):
- QtGui.QLineEdit.textChanged(self, string)
-
- def focusOutEvent (self, event): #QFocusEvent
- QtGui.QLineEdit.focusOutEvent(self,event)
- self.valueChanged()
-
- def valueChanged(self):
- if not (self.getValue() == self._actualValue):
- self.emit(QtCore.SIGNAL("valueChanged"),self._actualValue, self.getValue() )
- self._actualValue = self.getValue()
- self.setValue(self.getValue(), undo=False) # if value is not valid
-
- @classmethod
- def getDefaultValue(self):
- return ""
-
-############################## TABLE WIDGET ############################
-
-
-class TableWidget (QtGui.QWidget):
-
- def __init__(self, value, format, type, parent=None):
- QtGui.QWidget.__init__(self, parent)
- self._actualValue =self.getDefaultValue()
- self._layout = QtGui.QHBoxLayout(self)
- self.setLayout(self._layout)
- self._tableView = QtGui.QTableView()
- self._tableView.mousePressEvent = self.mousePressEvent
- self._tableView.setSelectionMode(QtGui.QTableView.SingleSelection)
- self._layout.addWidget(self._tableView)
- self._format = format
- self._type = type
- self._verticalLayout = QtGui.QVBoxLayout()
- self._addRowButton = QtGui.QPushButton(self)
- self._addRowButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-add"))
- self._addRowButton.setText("Add Row ")
- self._verticalLayout.addWidget(self._addRowButton)
- self._removeRowButton = QtGui.QPushButton(self)
- self._removeRowButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
- self._removeRowButton.setText("Remove Row ")
- self._verticalLayout.addWidget(self._removeRowButton)
- self._addColumnButton = QtGui.QPushButton(self)
- self._addColumnButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-add"))
- self._addColumnButton.setText("Add Column")
- self._verticalLayout.addWidget(self._addColumnButton)
- self._removeColumnButton = QtGui.QPushButton(self)
- self._removeColumnButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
- self._removeColumnButton.setText("Remove Column")
- self._verticalLayout.addWidget(self._removeColumnButton)
- self._upButton = QtGui.QPushButton(self)
- self._upButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-up"))
- self._upButton.setText("Move Up ")
- self._verticalLayout.addWidget(self._upButton)
- self._downButton = QtGui.QPushButton(self)
- self._downButton.setIcon(taurus.qt.qtgui.resource.getThemeIcon("go-down"))
- self._downButton.setText("Move Down")
- self._verticalLayout.addWidget(self._downButton)
- spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self._verticalLayout.addItem(spacerItem)
-
- QtCore.QObject.connect(self._addRowButton, QtCore.SIGNAL("clicked()"), self._addRow)
- QtCore.QObject.connect(self._addColumnButton, QtCore.SIGNAL("clicked()"), self._addColumn)
- QtCore.QObject.connect(self._removeRowButton, QtCore.SIGNAL("clicked()"), self._removeRow)
- QtCore.QObject.connect(self._removeColumnButton, QtCore.SIGNAL("clicked()"), self._removeColumn)
- QtCore.QObject.connect(self._upButton, QtCore.SIGNAL("clicked()"), self._moveUp)
- QtCore.QObject.connect(self._downButton, QtCore.SIGNAL("clicked()"), self._moveDown)
- self._layout.addLayout(self._verticalLayout)
-
- if self._type == "boolean":
- self._delegate = BooleanTableDelegate(self._tableView)
- elif self._type == "integer":
- self._delegate = IntegerTableDelegate(self._tableView)
- elif self._type == "float":
- self._delegate = FloatTableDelegate(self._tableView)
- else:
- self._delegate = StringTableDelegate(self._tableView)
-
- QtCore.QObject.connect(self._delegate, QtCore.SIGNAL("editorValueChanged"), self._valueChanged)
- self._tableView.setItemDelegate(self._delegate)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding)
- self._tableView.setSizePolicy(sizePolicy)
- self._tableView.horizontalHeader().setDefaultSectionSize(80)
- if self._format == "1D":
- self._tableView.horizontalHeader().setVisible(False)
- self._tableView.horizontalHeader().setStretchLastSection(True)
- self._tableView.setMinimumSize(QtCore.QSize(150, 150))
- self._addColumnButton.hide()
- self._removeColumnButton.hide()
- elif self._format == "2D":
- self._tableView.setMinimumSize(QtCore.QSize(150, 250))
- self._upButton.hide()
- self._downButton.hide()
-
-
- def mousePressEvent(self, event):
- if (event.button() == QtCore.Qt.LeftButton):
- index = self._tableView.indexAt(event.pos())
- if (index.isValid()):
- if index in self._tableView.selectedIndexes():
- QtGui.QTableView.mousePressEvent(self._tableView, event)
- self._tableView.clearSelection()
- else:
- self.emit(Qt.SIGNAL("selected"))
- QtGui.QTableView.mousePressEvent(self._tableView, event)
- else:
- self._tableView.clearSelection()
- else:
- QtGui.QTableView.mousePressEvent(self._tableView, event)
-
- def deselectWidget(self):
- self._tableView.clearSelection()
-
-
- def _addRow(self):
- value = self.getValue() # stored table
- defaultCellsValue = self._delegate.getDefaultValue() # default value for every new item in the table
-
- rows = len(value)
- if (self._format == "2D"):
- if (rows>0):
- columns = len(value[0])
- else:
- columns=1
-
- rowIndex = self._getSelectedIndex()[0]
-
- if rowIndex is None:
- rowIndex = rows
-
- if (self._format == "1D"):
- value.insert(rowIndex, defaultCellsValue)
-
- if (self._format == "2D"):
- row = []
- for i in range(columns):
- row.append(defaultCellsValue)
- value.insert(rowIndex, row)
-
- self.setValue(value, undo=True)
-
-
- def _getSelectedIndex(self):
- if len (self._tableView.selectedIndexes()):
- row = self._tableView.selectedIndexes()[0].row()
- column = self._tableView.selectedIndexes()[0].column()
- else:
- row = None
- column = None
-
- return [row,column]
-
-
- def _removeRow(self):
- rowIndex = self._getSelectedIndex()[0]
- if rowIndex is not None:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Confirmation ")
- msgBox.setStandardButtons(QtGui.QMessageBox().No | QtGui.QMessageBox().Yes )
- msgBox.setInformativeText("Remove row {%i} ?" % (rowIndex+1) )
- msgBox.setIcon(QtGui.QMessageBox.Question)
- ret = msgBox.exec_()
- if ret == QtGui.QMessageBox().Yes:
- value = self.getValue()
- self.setValue(value[:rowIndex] + value[rowIndex+1:], undo=True)
-
-
- def _addColumn(self):
- value = self.getValue() # stored table
- defaultCellsValue = self._delegate.getDefaultValue() # default value for every new item in the table
- rows = len(value)
-
- if (rows>0):
-
- columns = len(value[0])
- columnIndex = self._getSelectedIndex()[1]
- if columnIndex is None:
- columnIndex = columns
- for row in value:
- row.insert(columnIndex, defaultCellsValue)
- self.setValue(value, undo=True)
- else:
- self._addRow()
-
-
- def _removeColumn(self):
- value = self.getValue() # stored table
- rows = len(value)
- columnIndex = self._getSelectedIndex()[1]
-
- if columnIndex is not None:
- msgBox = QtGui.QMessageBox()
- msgBox.setText("Confirmation ")
- msgBox.setStandardButtons(QtGui.QMessageBox().No | QtGui.QMessageBox().Yes )
- msgBox.setInformativeText("Remove column {%i} ?" % (columnIndex+1) )
- msgBox.setIcon(QtGui.QMessageBox.Question)
- ret = msgBox.exec_()
-
- if (rows>0) and (columnIndex is not None) and (ret ==QtGui.QMessageBox().Yes):
- columns = len(value[0])
- if columns == 1:
- self.setValue([], undo=False)
- else:
- for i in range(len(value)):
- value[i] = value[i][:columnIndex] + value[i][columnIndex+1:]
-
- self.setValue(value, undo=True)
-
-
- def _moveUp(self):
- value = self.getValue() # stored table
- rows = len(value)
- rowIndex = self._getSelectedIndex()[0]
-
- if (rows>1) and (rowIndex is not None) and (rowIndex>0) :
- x = value.pop(rowIndex)
- value.insert(rowIndex-1,x)
- self.setValue(value, undo=True)
- self._tableView.setCurrentIndex(self._tableView.model().index(rowIndex-1, 0 ))
-
-
- def _moveDown(self):
- value = self.getValue() # stored table
- rows = len(value)
- rowIndex = self._getSelectedIndex()[0]
-
- if (rows>1) and (rowIndex is not None) and (rowIndex<rows-1) :
- x = value.pop(rowIndex)
- value.insert(rowIndex+1,x)
- self.setValue(value, undo=True)
- self._tableView.setCurrentIndex(self._tableView.model().index(rowIndex+1, 0 ))
-
-
- def setValue(self, value, undo=False):
- if not self._actualValue == value:
- if undo:
- self.emit(QtCore.SIGNAL("valueChanged"),copy.deepcopy(self._actualValue), copy.deepcopy(value) )
- self._actualValue = copy.deepcopy(value)
-
- rows = len(value)
- if (self._format == "2D") and (rows>0):
- columns = len(value[0])
- else:
- columns = 1
-
- self._model = QtGui.QStandardItemModel(rows, columns)
- for row in range(rows):
- for column in range(columns):
-
- index = self._model.index(row, column, QtCore.QModelIndex())
- if (self._format == "1D"):
- self._model.setData(index, QtCore.QVariant(value[row]))
- if (self._format == "2D"):
- self._model.setData(index, QtCore.QVariant(value[row][column]))
- self._tableView.setModel(self._model)
-
-
- def getValue(self):
- rows = self._model.rowCount()
- columns = self._model.columnCount()
- result = []
- for row in range(rows):
- records = []
- for column in range(columns):
- index = self._model.index(row, column)
- if self._type == "integer":
- val, bool = self._model.data(index).toInt()
- records.append( val )
- elif self._type == "float":
- val, bool =self._model.data(index).toDouble()
- records.append(val )
- elif self._type == "boolean":
- records.append( self._model.data(index).toBool() )
- else:
- records.append( str(self._model.data(index).toString()) )
-
- if (self._format == "1D"):
- result.append(records[0])
- if (self._format == "2D"):
- result.append(records)
-
- return copy.deepcopy(result)
-
-
- def _valueChanged(self, value, row, column):
- if (self._format == "1D"):
- if not (value == self._actualValue[row]):
- self._actualValue[row] = value
- self.emit(QtCore.SIGNAL("valueChanged"),self.getValue()[:], self._actualValue[:] )
-
-
- if (self._format == "2D"):
- if not (value == self._actualValue[row][column]):
- self._actualValue[row][column] = value
- self.emit(QtCore.SIGNAL("valueChanged"),self.getValue()[:], self._actualValue[:] )
-
-
- @classmethod
- def getDefaultValue(self):
- return []
-
-########### DELGATES ##################
-
-class TableDelegate(QtGui.QItemDelegate):
-
- def __init__(self, parent = None):
- QtGui.QItemDelegate.__init__(self, parent)
-
- @abstractmethod
- def createEditor(self, parent, option, index):
- return None
-
- @abstractmethod
- def setEditorData( self, editor, index ):
- pass
-
- @abstractmethod
- def getDefaultValue(self):
- return None
-
- def setModelData(self, editor, model, index):
- self.emit(QtCore.SIGNAL("editorValueChanged"),editor.getValue(),index.row(),index.column())
- value = editor.getValue()
- model.setData( index
- , QtCore.QVariant( value ) )
-
- def updateEditorGeometry( self, editor, option, index ):
- editor.setGeometry(option.rect)
-
-
-class BooleanTableDelegate(TableDelegate):
-
- def createEditor(self, parent, option, index):
- editor = BooleanComboWidget( parent )
- Qt.QObject.connect(editor, Qt.SIGNAL("currentIndexChanged(int)"), self.updateValue)
- editor.installEventFilter(self)
- return editor
-
- def updateValue(self, int):
- self.emit(QtCore.SIGNAL("closeEditor()") )
-
- def setEditorData( self, editor, index ):
- value = index.model().data(index, QtCore.Qt.DisplayRole)
- editor.setValue(value.toBool(), undo=True)
-
- def getDefaultValue(self):
- return BooleanComboWidget.getDefaultValue()
-
-class IntegerTableDelegate(TableDelegate):
-
- def createEditor(self, parent, option, index):
- editor = IntegerWidget( parent )
- editor.installEventFilter(self)
- return editor
-
- def setEditorData( self, editor, index ):
- value, ok = index.model().data(index, QtCore.Qt.DisplayRole).toInt()
- editor.setValue(value, undo=True)
-
- def getDefaultValue(self):
- return IntegerWidget.getDefaultValue()
-
-class FloatTableDelegate(TableDelegate):
-
- def createEditor(self, parent, option, index):
- editor = FloatWidget( parent )
- editor.installEventFilter(self)
- return editor
-
- def setEditorData( self, editor, index ):
- value,ok = index.model().data(index, QtCore.Qt.DisplayRole).toDouble()
- editor.setValue(value, undo=True)
-
- def getDefaultValue(self):
- return FloatWidget.getDefaultValue()
-
-class StringTableDelegate(TableDelegate):
-
- def createEditor(self, parent, option, index):
- editor = StringWidget( parent )
- editor.installEventFilter(self)
- return editor
-
- def setEditorData( self, editor, index ):
- value = index.model().data(index, QtCore.Qt.DisplayRole)
- editor.setValue(value.toString(), undo=True)
-
- def getDefaultValue(self):
- return StringWidget.getDefaultValue()
-
-
-################## MAIN CLASS ####################
-class Save (object):
- def __init__ (self, object = None,prevValue = None, nextValue = None):
- self._object = object
- self._prevValue = prevValue
- self._nextValue = nextValue
-
- def getObject(self):
- return self._object
-
- def getPrevValue(self):
- return self._prevValue
-
- def getNextValue(self):
- return self._nextValue
-
-
-class SettingsWidget(QtGui.QWidget):
-
- def __init__(self, parent=None):
- QtGui.QWidget.__init__(self,parent)
- self._formLayout = QtGui.QGridLayout(self)
- self.setUndoHistoryStack(20)
- self._inputWidgts=[]
- self._edited = False
- self._properties = None
-
- def clearLayout(self, layout):
- while layout.count() > 0:
- item = layout.takeAt(0)
- if not item:
- continue
- w = item.widget()
- if w:
- w.deleteLater()
-
- def _valueChanged(self,value1,value2):
- self._edited = True
- self._undoHistoryStack.append( Save( self.sender(), copy.deepcopy(value1), copy.deepcopy(value2) ) )
- if len(self._undoHistoryStack)> self._historySize:
- self._undoHistoryStack.pop(0)
- item , position =self._historyStackPointer
- if len(self._undoHistoryStack)-1 >=0:
- for i in range (item+1, len(self._undoHistoryStack)-1):
- self._undoHistoryStack.pop(item+1)
- self._historyStackPointer = ( len(self._undoHistoryStack)-1 , 1 )
-
- self.emit(Qt.SIGNAL("propertyValueChanged()"))
-
- def setUndoHistoryStack(self, size):
- self._undoHistoryStack = []
- self._historySize = size
- self._historyStackPointer = (-1,1) # item, position
-
- def undo(self):
- item , position =self._historyStackPointer
- if position ==1:
- item = item
- position = 0
- else:
- if item > 0:
- item = item -1
- position =0
-
- self._historyStackPointer = (item,position)
- if (item >=0) and(item < len(self._undoHistoryStack)):
- self._undoHistoryStack[item].getObject().setValue(self._undoHistoryStack[item].getPrevValue(), undo=False)
-
- def redo(self):
- item , position =self._historyStackPointer
- if position ==0:
- item = item
- position = 1
- else:
- if item < len(self._undoHistoryStack)-1:
- item = item +1
- position =1
-
- self._historyStackPointer = (item,position)
-
- if (item >=0) and(item < len(self._undoHistoryStack)):
- self._undoHistoryStack[item].getObject().setValue(self._undoHistoryStack[item].getNextValue(), undo=False)
-
-# def keyPressEvent(self, event):
-# QtGui.QWidget.keyPressEvent(self, event)
-# undo = (event.modifiers() == QtCore.Qt.ControlModifier and event.key() == QtCore.Qt.Key_Z)
-# redo = (event.modifiers() == QtCore.Qt.ControlModifier and event.key() == QtCore.Qt.Key_Y)
-# if (undo):
-# self.undo()
-# if (redo):
-# self.redo()
-
- def setEdited(self, value):
- self._edited=value
-
- def isEdited(self):
- return self._edited
-
- def deselect(self):
- for widget in self._inputWidgts:
- if widget != self.sender():
- widget.deselectWidget()
-
- def getProperties(self):
- values=[]
- name = "noName"
- properties = self._properties
- if len(self._inputWidgts)>=1:
- for inputWidget in self._inputWidgts:
- values.append(inputWidget.getValue())
- name = values.pop(0)
-
- return (properties, name, values)
-
- def _nameChanged(self):
- self.emit(Qt.SIGNAL("propertyValueChanged()"))
-
- def setProperties(self, properties):
-
- # clean memory
- for item in self._inputWidgts:
- QtCore.QObject.disconnect(item, QtCore.SIGNAL("valueChanged"), self._valueChanged)
- self._inputWidgts=[]
- self.clearLayout(self._formLayout)
- self.setUndoHistoryStack(self._historySize)
- self._edited = False
-
- # create new set of properties
-
- self._properties = properties
-
- if properties is not None:
- self._inputWidgts = []
- i=0
- for property in properties:
- self._nameLabel = QtGui.QLabel(property.get_name())
- #self._formLayout.setWidget(i, QtGui.QFormLayout.LabelRole, self._nameLabel)
- self._formLayout.addWidget(self._nameLabel,i,0)
-
- if property.get_format() == "0D":
- if property.get_type() == "boolean":
- self._inputWidgts.append( BooleanWidget() )
- elif property.get_type() == "integer":
- self._inputWidgts.append( IntegerWidget() )
- elif property.get_type() == "float":
- self._inputWidgts.append( FloatWidget() )
- else:
- self._inputWidgts.append( StringWidget() )
-
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self._formLayout.addWidget(self._inputWidgts[i], i,1)
- self._formLayout.addItem(spacerItem,i,2)
-
- elif (property.get_format() == "1D") or (property.get_format() == "2D"):
- self._inputWidgts.append( TableWidget(property.get_default_value(), property.get_format() ,property.get_type() ) )
- self._formLayout.addWidget(self._inputWidgts[i], i,1,1,10)
- Qt.QObject.connect(self._inputWidgts[i], Qt.SIGNAL("selected"), self.deselect)
-
- self._inputWidgts[i].setValue(property.get_default_value())
- QtCore.QObject.connect(self._inputWidgts[i], QtCore.SIGNAL("valueChanged"), self._valueChanged)
- i=i+1
-
- QtCore.QObject.connect(self._inputWidgts[0], QtCore.SIGNAL("textChanged(QString)"), self._nameChanged)
-
-
-
-if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- properties = []
- properties.append(PropertyInfo("name", "string", "0D", "deviceName"))
- properties.append(PropertyInfo("number0", "integer", "0D", 5))
- properties.append(PropertyInfo("boollll0", "boolean", "0D", False))
- properties.append(PropertyInfo("number1", "float", "0D", 3.5))
- properties.append(PropertyInfo("string2", "string", "0D", "hehe"))
- properties.append(PropertyInfo("table0", "integer", "1D", [1,2,3]))
- properties.append(PropertyInfo("tablestringD1", "float", "1D", [1.5]))
- properties.append(PropertyInfo("tablestringD1", "string", "1D", ["aaaa","bbb","ccc"]))
- properties.append(PropertyInfo("tablefloatD1", "float", "1D", [1.0,2.5,3.6]))
- properties.append(PropertyInfo("tablebooleanD1", "boolean", "1D", [True,False,True]))
- properties.append(PropertyInfo("tableboointD1", "integer", "1D", [1,2,3]))
- properties.append(PropertyInfo("tablestringD2", "string", "2D",[ ["aaaa","bbb","ccc"],["aaaa2","bbb2","ccc2"],["aaaa3","bbb3","ccc3"] ]))
-
-
- nds=SettingsWidget()
- nds.setProperties(properties)
- nds.show()
- sys.exit(app.exec_())
-
- \ No newline at end of file
diff --git a/sardanaConfig/src/wizards/simple_tree_model.py b/sardanaConfig/src/wizards/simple_tree_model.py
deleted file mode 100644
index 6e38a9e2..00000000
--- a/sardanaConfig/src/wizards/simple_tree_model.py
+++ /dev/null
@@ -1,247 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2008 Qtrac Ltd. All rights reserved.
-# This program or module is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as published
-# by the Free Software Foundation, either version 2 of the License, or
-# version 3 of the License, or (at your option) any later version. It is
-# provided for educational purposes and is distributed in the hope that
-# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-
-from __future__ import division
-from __future__ import print_function
-from __future__ import unicode_literals
-from future_builtins import *
-import sys, os
-import bisect
-import codecs
-import taurus.qt.qtgui.resource
-import PyQt4.QtGui
-from PyQt4.QtCore import (QAbstractItemModel, QModelIndex, QString,
- QVariant, Qt, SIGNAL)
-
-KEY, NODE = range(2)
-
-
-class BranchNode(object):
-
- def __init__(self, name, parent=None):
- super(BranchNode, self).__init__()
- self.name = name
- self.parent = parent
- self.children = []
-
- def orderKey(self):
- return self.name.lower()
-
- def toString(self):
- return self.name
-
- def __len__(self):
- return len(self.children)
-
- def childAtRow(self, row):
- assert 0 <= row < len(self.children)
- return self.children[row][NODE]
-
- def rowOfChild(self, child):
- for i, item in enumerate(self.children):
- if item[NODE] == child:
- return i
- return -1
-
-# with sorting
-# def childWithKey(self, key):
-# if not self.children:
-# return None
-# # Causes a -3 deprecation warning. Solution will be to
-# # reimplement bisect_left and provide a key function.
-# i = bisect.bisect_left(self.children, (key, None))
-# if i < 0 or i >= len(self.children):
-# return None
-# if self.children[i][KEY] == key:
-# return self.children[i][NODE]
-# return None
-
- # without sorting
- def childWithKey(self, key):
- if not self.children:
- return None
- for i in range(len(self.children)):
- if self.children[i][KEY] == key:
- return self.children[i][NODE]
- return None
-
- def insertChild(self, child):
- child.parent = self
- # sorted
- #bisect.insort(self.children, (child.orderKey(), child))
- # unsorted
- self.children.append((child.orderKey(), child))
-
- def hasLeaves(self):
- if not self.children:
- return False
- return isinstance(self.children[0], LeafNode)
-
-
-class LeafNode(object):
-
- def __init__(self, name, data, parent=None):
- super(LeafNode, self).__init__()
- self.parent = parent
- self.name = name
- self.data = data
-
- def orderKey(self):
- return "\t"+self.name.lower()
-
- def getName(self):
- return self.name
-
- def asRecord(self):
- return self.getName()
-
- def asData(self):
- return self.data
-
-
-class SimpleTreeModel(QAbstractItemModel):
-
- def __init__(self, parent=None):
- super(SimpleTreeModel, self).__init__(parent)
- self.columns = 1
- self.root = BranchNode("")
- self.headers = ["Type"]
-
- def setHeaders(self, headers):
- self.headers = headers
-
- def getHeaders(self):
- return self.headers
-
- def addNodes(self, fields, callReset=True):
- root = self.root
- branch = None
- for i in range(len(fields)):
- key = fields[i].lower()
- branch = root.childWithKey(key)
- if branch is not None:
- root = branch
- else:
- branch = BranchNode(fields[i])
- root.insertChild(branch)
- root = branch
- if callReset:
- self.reset()
- self.headers = ["Type"]
-
- def addRecord(self, fields, data, callReset=True):
- root = self.root
- branch = None
- for i in range(len(fields)-1):
- key = fields[i].lower()
- branch = root.childWithKey(key)
- if branch is not None:
- root = branch
- else:
- branch = BranchNode(fields[i])
- root.insertChild(branch)
- root = branch
- assert branch is not None
- item = fields[len(fields)-1]
- branch.insertChild(LeafNode(item, data, branch))
- if callReset:
- self.reset()
- self.headers = ["Type"]
-
- def asRecord(self, index):
- leaf = self.nodeFromIndex(index)
- if leaf is not None and isinstance(leaf, LeafNode):
- return leaf.asRecord()
- return "None"
-
- def asData(self, index):
- leaf = self.nodeFromIndex(index)
- if leaf is not None and isinstance(leaf, LeafNode):
- return leaf.asData()
- else:
- return None
-
- def rowCount(self, parent):
- node = self.nodeFromIndex(parent)
- if node is None or isinstance(node, LeafNode):
- return 0
- return len(node)
-
- def columnCount(self, parent):
- return self.columns
-
- def data(self, index, role):
- if role == Qt.TextAlignmentRole:
- return QVariant(int(Qt.AlignTop|Qt.AlignLeft))
-
- if role == Qt.DecorationRole:
- node = self.nodeFromIndex(index)
- assert node is not None
- if isinstance(node, LeafNode):
- return QVariant(node.asData().get_icon())
- else:
- return QVariant()
-
- if role != Qt.DisplayRole:
- return QVariant()
-
- node = self.nodeFromIndex(index)
- assert node is not None
-
- if isinstance(node, BranchNode):
- if index.column() == 0:
- return QVariant(node.toString())
- else:
- return QVariant(QString(""))
-
- if isinstance(node, LeafNode):
- return QVariant(QString(node.getName()))
-
- def headerData(self, section, orientation, role):
- if (orientation == Qt.Horizontal and
- role == Qt.DisplayRole):
- #assert 0 <= section <= len(self.headers)
- return QVariant(self.headers[section])
- return QVariant()
-
-
- def index(self, row, column, parent):
- assert self.root
- branch = self.nodeFromIndex(parent)
- assert branch is not None
- return self.createIndex(row, column,
- branch.childAtRow(row))
-
- def parent(self, child):
- node = self.nodeFromIndex(child)
- if node is None:
- return QModelIndex()
- parent = node.parent
- if parent is None:
- return QModelIndex()
- grandparent = parent.parent
- if grandparent is None:
- return QModelIndex()
- row = grandparent.rowOfChild(parent)
- assert row != -1
- return self.createIndex(row, 0, parent)
-
-
- def nodeFromIndex(self, index):
- if index.isValid():
- return index.internalPointer()
- else:
- return self.root
-
- #return (index.internalPointer()
- # if index.isValid() else self.root)######################
-
-
diff --git a/sardanaConfig/src/wizards/tango_host_page.py b/sardanaConfig/src/wizards/tango_host_page.py
deleted file mode 100644
index 6fd4b4ef..00000000
--- a/sardanaConfig/src/wizards/tango_host_page.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import sys, os
-
-from PyQt4 import QtGui, QtCore, Qt
-
-import taurus
-import wiz
-
-def get_default_tango_host():
- tg = os.environ.get('TANGO_HOST','')
- if not tg or tg.count(':') != 1: return '',''
- return tg.split(':')
-
-class SelectTangoHostBasePage(wiz.SardanaBasePage):
-
- def __init__(self, parent = None):
- wiz.SardanaBasePage.__init__(self, parent)
-
- self.setSubTitle('Please select the Tango Host')
-
- panel = self.getPanelWidget()
- layout = QtGui.QFormLayout()
- self.hostEdit = QtGui.QLineEdit()
- self.portEdit = QtGui.QLineEdit()
-
- layout.addRow("&Host", self.hostEdit)
- layout.addRow("&Port", self.portEdit)
-
- host, port = get_default_tango_host()
-
- self.hostEdit.setText(host)
- self.portEdit.setText(port)
-
- panel.setLayout(layout)
-
- self['db'] = self._getDatabase
-
- self.connect(self.hostEdit,
- QtCore.SIGNAL('textEdited(const QString &)'),
- QtCore.SIGNAL('completeChanged()'))
- self.connect(self.portEdit,
- QtCore.SIGNAL('textEdited(const QString &)'),
- QtCore.SIGNAL('completeChanged()'))
-
- def _getDatabase(self):
- host = str(self.hostEdit.text()).lower()
- port = str(self.portEdit.text())
- return taurus.Database("%s:%s" % (host, port))
-
- def db(self):
- return self.wizard()['db']
-
- def isComplete(self):
- try:
- db = self.db()
- if not db is None:
- self.setStatus('')
- return True
- except Exception, e:
- pass
- self.setStatus('Invalid database')
- return False
-
-def t1():
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(wiz.get_resources())
- w = wiz.SardanaBaseWizard()
- intro = wiz.SardanaIntroBasePage()
- tg_host_page = SelectTangoHostBasePage()
- w.addPage(intro)
- w.addPage(tg_host_page)
- w.show()
- sys.exit(app.exec_())
-
-def main():
- t1()
-
-if __name__ == '__main__':
- main()
-
-
diff --git a/sardanaConfig/src/wizards/wiz.py b/sardanaConfig/src/wizards/wiz.py
deleted file mode 100644
index fe4bc00a..00000000
--- a/sardanaConfig/src/wizards/wiz.py
+++ /dev/null
@@ -1,117 +0,0 @@
-import os, sys
-from PyQt4 import QtGui, QtCore, Qt
-
-class SardanaBasePage(QtGui.QWizardPage):
-
- def __init__(self, parent = None):
- QtGui.QWizardPage.__init__(self, parent)
- self._item_funcs = {}
-
- self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/logo.jpg"))
-
- layout = QtGui.QVBoxLayout()
-
- self._panel = QtGui.QWidget()
-
- self._status_label = QtGui.QLabel()
- self._status_label.setAutoFillBackground(True)
- palette = self._status_label.palette()
- gradient = QtGui.QLinearGradient(0, 0, 0, 15)
- gradient.setColorAt(0.0, Qt.QColor.fromRgb( 60, 150, 255))
- gradient.setColorAt(0.5, Qt.QColor.fromRgb( 0, 85, 227))
- gradient.setColorAt(1.0, Qt.QColor.fromRgb( 60, 150, 255))
- gradient.setSpread(QtGui.QGradient.RepeatSpread)
- palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(gradient))
- palette.setBrush(QtGui.QPalette.WindowText, Qt.Qt.white)
-
- layout.addWidget(self._panel)
- layout.addStretch()
- layout.addWidget(self._status_label)
- self.setLayout(layout)
-
- def __setitem__(self, name, value):
- self._item_funcs[name] = value
-
- def __getitem__(self, name):
- return self._item_funcs[name]
-
- def setStatus(self, text):
- self._status_label.setText(text)
-
- def getPanelWidget(self):
- return self._panel
-
-
-class SardanaIntroBasePage(QtGui.QWizardPage):
-
- def __init__(self, parent = None):
- QtGui.QWizardPage.__init__(self, parent)
-
- self.setTitle('Introduction')
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
-
- label = QtGui.QLabel(self.getIntroText())
- label.setWordWrap(True)
- layout = QtGui.QVBoxLayout()
- layout.addWidget(label)
- self.setLayout(layout)
-
- def getIntroText(self):
- return """This wizard will guide you through the Sardana configuration"""
-
-class SardanaBaseWizard(QtGui.QWizard):
-
- def __init__(self, parent=None):
- QtGui.QWizard.__init__(self, parent)
- self._item_funcs = {}
- self._pages = {}
-
- def __setitem__(self, name, value):
- self._item_funcs[name] = value
-
- def __getitem__(self, name):
- for id in self.getPages():
- p = self.page(id)
- if isinstance(p, SardanaBasePage):
- try:
- return p[name]()
- except Exception,e:
- pass
- return self._item_funcs[name]()
- return None
-
- def addPage(self, page):
- id = QtGui.QWizard.addPage(self, page)
- self._pages[id] = page
-
- def setPage(self, id, page):
- QtGui.QWizard.setPage(self, id, page)
- self._pages[id] = page
-
- def getPages(self):
- return self._pages
-
-def get_resources():
- res_fname = os.path.abspath(__file__)
- res_fname = os.path.splitext(res_fname)[0] + '.rcc'
- return res_fname
-
-def t1():
- app = QtGui.QApplication([])
- QtCore.QResource.registerResource(get_resources())
- w = QtGui.QWizard()
- intro = SardanaBaseIntroPage()
- base1 = SardanaBasePage()
- base1.setTitle('Empty title')
- base1.setSubTitle('Empty sub-title')
- base1.setStatus("The status bar")
- w.addPage(intro)
- w.addPage(base1)
- w.show()
- sys.exit(app.exec_())
-
-def main():
- t1()
-
-if __name__ == "__main__":
- main()
diff --git a/sardanaConfig/src/wizards/wiz.qrc b/sardanaConfig/src/wizards/wiz.qrc
deleted file mode 100644
index b0e09050..00000000
--- a/sardanaConfig/src/wizards/wiz.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
- <!DOCTYPE RCC><RCC version="1.0">
- <qresource>
- <file alias="logo.jpg">res/logo.jpg</file>
- <file alias="watermark.jpg">res/watermark.jpg</file>
- </qresource>
- </RCC>
diff --git a/sardanaConfig/src/wizards/wiz.rcc b/sardanaConfig/src/wizards/wiz.rcc
deleted file mode 100644
index bb682d0c..00000000
--- a/sardanaConfig/src/wizards/wiz.rcc
+++ /dev/null
Binary files differ
diff --git a/scripts/MacroServer b/scripts/MacroServer
deleted file mode 100755
index 4cfef739..00000000
--- a/scripts/MacroServer
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["main"]
-
-__docformat__ = 'restructuredtext'
-
-import datetime
-__START_TIME = datetime.datetime.now()
-
-def set_src():
- import sys
- import os.path as osp
- sar_dir = osp.join(osp.dirname(osp.abspath(__file__)), osp.pardir, 'src')
- sys.path.append(osp.abspath(sar_dir))
-
-try:
- import sardana
-except ImportError:
- # try to use code from src distribution
- set_src()
- import sardana
-
-def run():
- import sardana.tango.macroserver
- sardana.tango.macroserver.run(start_time=__START_TIME)
-
-def main():
- run()
-
-if __name__ == '__main__':
- main()
diff --git a/scripts/Pool b/scripts/Pool
deleted file mode 100755
index 97b06eb4..00000000
--- a/scripts/Pool
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["main"]
-
-__docformat__ = 'restructuredtext'
-
-import datetime
-__START_TIME = datetime.datetime.now()
-
-def set_src():
- import sys
- import os.path as osp
- sar_dir = osp.join(osp.dirname(osp.abspath(__file__)), osp.pardir, 'src')
- sys.path.insert(0,osp.abspath(sar_dir))
-
-try:
- import sardana
-except ImportError:
- # try to use code from src distribution
- set_src()
- import sardana
-
-def run():
- import sardana.tango.pool
- sardana.tango.pool.run(start_time=__START_TIME)
-
-def main():
- run()
-
-if __name__ == '__main__':
- main()
diff --git a/scripts/Sardana b/scripts/Sardana
deleted file mode 100755
index cc3cf021..00000000
--- a/scripts/Sardana
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["main"]
-
-__docformat__ = 'restructuredtext'
-
-import datetime
-__START_TIME = datetime.datetime.now()
-
-def set_src():
- import sys
- import os.path as osp
- sar_dir = osp.join(osp.dirname(osp.abspath(__file__)), osp.pardir, 'src')
- sys.path.append(osp.abspath(sar_dir))
-
-try:
- import sardana
-except ImportError:
- # try to use code from src distribution
- set_src()
- import sardana
-
-def run():
- import sardana.tango
- sardana.tango.run(start_time=__START_TIME)
-
-def main():
- run()
-
-if __name__ == '__main__':
- main() \ No newline at end of file
diff --git a/scripts/h5toascii b/scripts/h5toascii
deleted file mode 100755
index 4a42be14..00000000
--- a/scripts/h5toascii
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-'''
-Script for extracting "scan tables" from Sardana NeXus files into an tab-separated ASCII tables.
-When data from multiple entries are extracted from a file, each table is stored in a different file.
-The output files for a given input file are stored in a directory whose name matches the input file name (minus extension)
-
-Usage:
-python h52ascii.py <nexusfilename> [<entryname1> [<entryname2>] ...]
-
-If no entry names are provided, all entries from the given nexus file name will be extracted.
-
-Note: only scalar values are extracted
-'''
-
-import nxs
-import sys,os
-import numpy
-
-
-def measurement2ascii(fd, entryname, ofname):
- #check if there is a measurement datagroup
- tmp = "/%s/measurement"%entryname
- try:
- fd.openpath(tmp)
- except:
- print 'Cannot open hdf5 path "%s". Skipping.'%tmp
- return False
-
- #read the point number data
- ptnb_names = ('Pt_No','point_nb','#Pt No') #possible ways of storing the point number (along different versions)
- for i,ptnb_name in enumerate(ptnb_names):
- try:
- fd.opendata(ptnb_name)
- break
- except:
- print 'cannot open %s'%ptnb_name
- if i == len(ptnb_names)-1: #if this was not the last choice
- print 'I give up!'
- return False
- ptnb = fd.getdata()
- fd.closedata()
- #prepare a list with column names and a table made of data "columns"
- namelist=[ptnb_name]
- table = [ptnb.copy().flatten()]
- for name,nxclass in fd.entries():
- if name == ptnb_name: continue
- if nxclass != 'SDS': continue #not a dataset
- dshape,dtype = fd.getinfo()
- if tuple(dshape) != ptnb.shape: continue #not a scalar (incompatible shape)
- table.append(fd.getdata().flatten())
- namelist.append(name)
- #write the table to a file
- try:
- datfile = open(ofname,'w')
- except:
- print 'Cannot create file "%s". Skipping.'%ofname
- return False
- datfile.write("\t".join(namelist)) #write a header of column names
- datfile.write("\n")
- numpy.savetxt(datfile, numpy.vstack(table).transpose(), delimiter='\t') #write the data table
- datfile.close()
- return True
-
-
-def main():
- if len(sys.argv) > 1:
- fname = sys.argv[1]
- else:
- print "Usage:\nh5toascii <nexusfilename> [<entryname1> [<entryname2>] ...] "
- sys.exit(1)
-
- entrynames = sys.argv[2:]
-
- fd = nxs.open(fname,'r')
-
- if len(entrynames)==0:
- entrynames = [n for n,c in fd.entries() if c=='NXentry']
-
- dirname,ext = os.path.splitext(fname)
- try:
- os.makedirs(dirname)
- except:
- print 'Cannot create dir "%s". Skipping.'%dirname
-
- for ename in entrynames:
- ofname = os.path.join(dirname,"%s.dat"%ename)
- print "Extracting %s:%s to %s"%(fname,ename,ofname)
- measurement2ascii(fd, ename, ofname)
-
- fd.close()
-
-
-if __name__ == "__main__":
- main() \ No newline at end of file
diff --git a/scripts/h5tospec b/scripts/h5tospec
deleted file mode 100755
index 724ada01..00000000
--- a/scripts/h5tospec
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-'''
-Script for extracting "scans" from Sardana NeXus files into Sardana Spec Files.
-
-Usage:
-h5spec <nexusfilename> [> <your_spec_file_name>] [2><your error/log file]
-
-Note: only scalar values are extracted, Images and 1D (MCA..) are ignored (notified to stderr)
-'''
-
-import nxs
-import sys,os,re,time
-
-
-def h52spectime(mydate):
- '''
- this function returns the time in format SPEC (from a hdf5 recorded by the sardanan recorder)
- '''
- #equivalent to ascii time
- #return time.strftime("%a %b %d %H:%M:%S %Y",_d)
- _a = time.asctime(time.strptime(mydate.split('.')[0],"%Y-%m-%dT%H:%M:%S"))
- return _a
-
-def _getMovables(mystr):
- '''
- this internal function gets the movables from the "scan/mesh" command.
- Movables should go first in SPEC columns
- '''
- #gets the movables from the command line (starting not with a number)
- _m = []
- _a = mystr.split(' ')
- _a.pop(0)
- for i in _a:
- if re.match('[^-_0-9\.\+\\n]',i):
- _m.append(i)
- return _m
-
-def getMetadata(fd, entry):
- '''
- This gets the metatdata from the Sardana h5 file. Format is kind of free,
- but nevertheless is very convenient the user/scientist makes sure all motors
- (and motor positions) are there
- '''
- _mdata = {}
- try:
- fd.openpath("/%s/measurement/pre_scan_snapshot" % entry)
- _mdata = fd.getentries()
- for i in _mdata.keys():
- fd.openpath("/%s/measurement/pre_scan_snapshot/%s" % (entry, i))
- _mdata[i] = fd.getdata()
- #print >> sys.stderr, entry
- except:
- print >> sys.stderr, 'Cannot open hdf5 path "%s/pre_scan_snapshot". Skipping.'%entry
- return _mdata
-
-def processEntry(fd, entry):
-
- '''
- process one entry from a hdf5 file
- it creates a string with all the data and prints it to the stdout in the end.
- It could be evenually easily modified to return the values and to be introduced
- in a class (to get it out from this simple script)
-
- '''
-
- #_myMovables = [] # This gets the motors in order to write them in the first columns
- mystring = "" # the string will construct the scan (and printed at the end)
-
- try:
- fd.openpath("/%s/entry_identifier" % entry)
- mystring = "#S %s " % str(fd.getdata())
- fd.openpath("/%s/title" % entry)
- _mycmd = str(fd.getdata())
- mystring += " %s \n" % _mycmd
- _myMovables= _getMovables(_mycmd)
- fd.openpath("/%s/start_time" % entry)
- mystring += "#D %s \n" % h52spectime(fd.getdata())
- # need to know here the timer for the counting time. In the mean time
- # I use the last value of the cmd line (usually the ct time!!, not always ojo).
- mystring += "#T %s (seconds)\n" % _mycmd.split(' ').pop()
- #print mytime
- except:
- print >> sys.stderr, 'Error opening/processing hdf5 path "%s/...". Skipping.'% entry
-
- mystring += "#P0 "
- _metadata = getMetadata(fd, entry)
- for i in _metadata.values():
- mystring += ' ' + str(i)
- mystring += '\n'
-
- tmp = "/%s/measurement/point_nb" % entry
- tmp2= "/%s/measurement/Pt_No" % entry
-
- try:
- fd.openpath(tmp)
- except:
- #print 'Cannot open hdf5 path "%s". Skipping.'%tmp
- try:
- fd.openpath(tmp2)
- except:
- #print 'Cannot open hdf5 path "%s". Skipping.'%tmp
- return False
- ptnb = fd.getdata()
- fd.closedata()
-
- headers = []
- data = {}
-
- for name,nxclass in fd.entries():
- if name == 'point_nb' or name == "#Pt No": continue
- if name == 'pre_scan_snapshot' : continue
- dshape,dtype = fd.getinfo()
-
- if tuple(dshape) != ptnb.shape:
- print >> sys.stderr, "Skipping (no data or not a scalar ???) %s in %s" % (name, entry),
- print >> sys.stderr, ptnb.shape
- continue #not a scalar (incompatible shape)
-
- #insert data and headers in the rigth order (movables first)
- mydata = fd.getdata().flatten()
- if name in _myMovables:
- headers.insert(_myMovables.index(name), name)
- else:
- headers.append(name)
- data[name] = mydata
-
- mystring += "#N %d \n" % len(headers)
- mystring += "#L "
- for i in headers:
- mystring += ' ' + i
- mystring += "\n"
-
- #print >>sys.stderr, headers
- #print >>sys.stderr, _myMovables
- #print >>sys.stderr, ptnb.size
- #print >>sys.stderr, data
- #print >>sys.stderr, ptnb
-
- for i in range(ptnb.size):
- # Movables (motors) come first. Then the other columns (exp channels)
- for n in [channel for channel in _myMovables if channel in headers]:
- mystring += ' ' + str(data[n][i])
- for n in [channel for channel in headers if channel not in _myMovables]:
- mystring += ' ' + str(data[n][i])
- mystring += '\n'
-
- try:
- fd.openpath("/%s/end_time" % entry)
- mystring += "#C Scan ended at %s \n" % h52spectime(fd.getdata())
- except:
- print >> sys.stderr, 'Cannot open hdf5 path "%s/end_time". Skipping.'% entry
-
- print mystring
-
-
-def measurement2spec(fd):
- """
- Takes a file (hdf5) as an inputProcess a hdf5 file and outputs the result to the stdout.
- One can redirect the output to create the file.
- Information and error messages are output to stderr, in order not to pollute the file
-
- """
-
- mystring = ""
- mystring += "#F %s\n" % fd.filename
- outFileAttrs = "#CCC original Nexus hdf5 file: %s\n" % fd.getattrs()
- outCurrentDate = "#C conversion date: %s\n" % time.asctime()
-
- entrynames = [name for name,c in fd.entries() if c=='NXentry']
-
- mystring += "#E %s\n" % fd.getattrs()['epoch']
- mystring += "#D %s\n" % time.asctime(time.localtime(fd.getattrs()['epoch']))
- mystring += "#C User \n"
-
- # Gets metadata headers (motor names usually) from the first entry (asuming all the same!)
- _metadata = getMetadata(fd,entrynames[0])
- mystring += "#O0"
- for i in _metadata.keys():
- mystring += ' ' + i
-
- mystring += '\n' + outFileAttrs
- mystring += outCurrentDate
- print mystring
-
- #Sort entry2 before entry10 (otherwhise, it was strictly alphabetic)
- for entry in sorted(entrynames, key = len):
- processEntry(fd, entry)
-
-def main():
- '''
- process the entire file (todo: many things. Do only the selected entries, convert it to a class)
- '''
- if len(sys.argv) > 1:
- fname = sys.argv[1]
- else:
- print "Usage:\npython h5tospec <nexusfilename> [> <your_spec_file_(or_to_console)> ] [2> log/error file]"
- sys.exit(1)
-
- fd = nxs.open(fname,'r')
-
- measurement2spec(fd)
-
- fd.close()
-
-if __name__ == "__main__":
- main()
diff --git a/scripts/macroexecutor b/scripts/macroexecutor
deleted file mode 100755
index 58ef4104..00000000
--- a/scripts/macroexecutor
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroexecutor import main
-main()
diff --git a/scripts/sequencer b/scripts/sequencer
deleted file mode 100755
index f5e6f1af..00000000
--- a/scripts/sequencer
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from sardana.taurus.qt.qtgui.extra_macroexecutor.sequenceeditor import main
-main()
diff --git a/scripts/spectoascii b/scripts/spectoascii
deleted file mode 100755
index 875a4939..00000000
--- a/scripts/spectoascii
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-'''
-Script for extracting "scan tables" from Sardana Spec files into single-scan tab-separated ASCII tables.
-When data from multiple scans are extracted from a file, each table is stored in a different file.
-The output files for a given input file are stored in a directory whose name matches the input scan ID
-
-Usage:
-python spectoascii.py <specfile> [<scan_ID_1> [<scan_ID_2>] ...]
-
-If no scan IDs are provided, all scans from the given Spec file will be extracted.
-
-Note that this is not a generic Spec conversor. Spec files created by means other than the Sardana
-SPEC_FileRecorder may not be converted properly.
-
-'''
-
-
-import sys,os
-
-def main():
- if len(sys.argv) > 1:
- fname = sys.argv[1]
- else:
- print "Usage:\nspectoascii <specfile> [<scan_ID_1> [<scan_ID_2>] ...] "
- sys.exit(1)
-
- scanids = sys.argv[2:] or None
-
- f = open(fname,'r')
- s = f.read()
- f.close()
-
- dirname,ext = os.path.splitext(fname)
- try:
- os.makedirs(dirname)
- except:
- print 'Cannot create dir "%s". Skipping.'%dirname
-
- for scan in s.split('\n\n'):
- lines = scan.split('\n')
- if not lines[0].startswith('#S '):
- continue
- scan_name = lines[0].split()[1]
- if scanids is None or scan_name in scanids: #extract only selected ids
- ofname = os.path.join(dirname,"%s.dat"%scan_name)
- print "Extracting %s:%s to %s"%(fname,scan_name,ofname)
- try:
- ofile = open(ofname,'w')
- except:
- print 'Cannot create file "%s". Skipping.'%ofname
- continue
- for line in lines[1:]:
- if line.startswith('#L '):
- ofile.write('\t'.join(line[3:].split(' '))+'\n')
- elif line.startswith('#'):
- continue
- else:
- ofile.write('\t'.join(line.split())+'\n')
- ofile.close()
-
-
-if __name__ == "__main__":
- main() \ No newline at end of file
diff --git a/scripts/spock b/scripts/spock
deleted file mode 100755
index 6e4b573e..00000000
--- a/scripts/spock
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The Spock startup file. This executable is actually an extension of the
- ipython file that can be found in <prefix>/ipython (prefix usually being in
- linux '/usr/bin'"""
-
-__all__ = [ "main" ]
-
-__docformat__ = 'restructuredtext'
-
-def set_src():
- import sys
- import os.path as osp
- sar_dir = osp.join(osp.dirname(osp.abspath(__file__)), osp.pardir, 'src')
- sys.path.append(osp.abspath(sar_dir))
-
-try:
- from sardana.spock import genutils
-except ImportError:
- # try to use code from src distribution
- set_src()
- from sardana.spock import genutils
-
-def main():
- genutils.run()
-
-if __name__ == '__main__':
- main()
diff --git a/taurus/scripts/tau2taurus b/scripts/tau2taurus
index 5d53432c..5d53432c 100755
--- a/taurus/scripts/tau2taurus
+++ b/scripts/tau2taurus
diff --git a/taurus/scripts/taurusconfigbrowser b/scripts/taurusconfigbrowser
index 77990e06..77990e06 100755
--- a/taurus/scripts/taurusconfigbrowser
+++ b/scripts/taurusconfigbrowser
diff --git a/taurus/scripts/tauruscurve b/scripts/tauruscurve
index 515bd936..515bd936 100755
--- a/taurus/scripts/tauruscurve
+++ b/scripts/tauruscurve
diff --git a/taurus/scripts/taurusdemo b/scripts/taurusdemo
index 27f0be1e..27f0be1e 100755
--- a/taurus/scripts/taurusdemo
+++ b/scripts/taurusdemo
diff --git a/taurus/scripts/taurusdesigner b/scripts/taurusdesigner
index 54a7ec6f..54a7ec6f 100755
--- a/taurus/scripts/taurusdesigner
+++ b/scripts/taurusdesigner
diff --git a/taurus/scripts/taurusdevicepanel b/scripts/taurusdevicepanel
index 6749732f..6749732f 100755
--- a/taurus/scripts/taurusdevicepanel
+++ b/scripts/taurusdevicepanel
diff --git a/taurus/scripts/taurusdoc b/scripts/taurusdoc
index 707cb107..707cb107 100755
--- a/taurus/scripts/taurusdoc
+++ b/scripts/taurusdoc
diff --git a/taurus/scripts/taurusform b/scripts/taurusform
index 4400211c..4400211c 100755
--- a/taurus/scripts/taurusform
+++ b/scripts/taurusform
diff --git a/taurus/scripts/taurusgui b/scripts/taurusgui
index 22ba33f0..22ba33f0 100755
--- a/taurus/scripts/taurusgui
+++ b/scripts/taurusgui
diff --git a/taurus/scripts/taurusimage b/scripts/taurusimage
index ab60a161..ab60a161 100755
--- a/taurus/scripts/taurusimage
+++ b/scripts/taurusimage
diff --git a/taurus/scripts/tauruspanel b/scripts/tauruspanel
index bf950f09..bf950f09 100755
--- a/taurus/scripts/tauruspanel
+++ b/scripts/tauruspanel
diff --git a/taurus/scripts/taurusplot b/scripts/taurusplot
index 1697e187..1697e187 100755
--- a/taurus/scripts/taurusplot
+++ b/scripts/taurusplot
diff --git a/taurus/scripts/taurusremotelogmonitor b/scripts/taurusremotelogmonitor
index ff02f463..ff02f463 100755
--- a/taurus/scripts/taurusremotelogmonitor
+++ b/scripts/taurusremotelogmonitor
diff --git a/taurus/scripts/taurustrend b/scripts/taurustrend
index c2de247d..c2de247d 100755
--- a/taurus/scripts/taurustrend
+++ b/scripts/taurustrend
diff --git a/taurus/scripts/taurustrend1d b/scripts/taurustrend1d
index 37b6b293..37b6b293 100755
--- a/taurus/scripts/taurustrend1d
+++ b/scripts/taurustrend1d
diff --git a/taurus/scripts/taurustrend2d b/scripts/taurustrend2d
index 3ff9a643..3ff9a643 100755
--- a/taurus/scripts/taurustrend2d
+++ b/scripts/taurustrend2d
diff --git a/taurus/scripts/taurusui b/scripts/taurusui
index 8e9039ab..8e9039ab 100755
--- a/taurus/scripts/taurusui
+++ b/scripts/taurusui
diff --git a/taurus/scripts/taurusuic4 b/scripts/taurusuic4
index ba630a53..ba630a53 100755
--- a/taurus/scripts/taurusuic4
+++ b/scripts/taurusuic4
diff --git a/scripts/upgrade/from_01_to_02.py b/scripts/upgrade/from_01_to_02.py
deleted file mode 100644
index d3690286..00000000
--- a/scripts/upgrade/from_01_to_02.py
+++ /dev/null
@@ -1,530 +0,0 @@
-#!/usr/bin/env python
-
-from upgrade_utils import *
-
-class Controller:
- def __init__(self, type, file, kcls, name, id):
- self.type = type
- self.file = file
- self.kcls = kcls
- self.name = name
- self.id = id
-
- def __str__(self):
- return "%s %s %s %s %s" % (self.type, self.file, self.kcls, self.name, self.id)
-
- def get_controller_prop(self):
- return [self.type, self.file, self.kcls, self.name, self.id]
-
-
-class Up01To02(Upgrade):
-
- def get_pool_controllers(self, db, serv):
- """Gets the list of Pool controllers from pool version 0.1.x"""
- pool_serv_name = "Pool/%s" % serv
- pool_dev_name = get_pool_device_from_server(serv,db=db)
- ctrls = db.get_device_property(pool_dev_name, ["Controller"])["Controller"]
- i = 0
- ret = []
- while i < len(ctrls):
- type = ctrls[i]
- file = ctrls[i+1]
- kcls = ctrls[i+2]
- name = ctrls[i+3]
- id = ctrls[i+4]
- i += 5
- ret.append(Controller(type, file, kcls, name, id))
- return ret
-
- @classmethod
- def fromTo(cls):
- return ("0.1.x", "0.2.0")
-
- @classmethod
- def supports(cls, old_vers, new_vers):
- return old_vers.startswith('0.1') and new_vers.startswith('0.2')
-
- @classmethod
- def supports_old(cls, old_vers):
- return old_vers.startswith('0.1')
-
- @classmethod
- def supports_new(cls, new_vers):
- return new_vers.startswith('0.2')
-
-
- def upgrade(self, db, serv, old_vers, new_vers):
-
- if not Up01To02.supports(old_vers, new_vers):
- raise Exception("Unsupported upgrade")
-
- yield "Upgrading %s from %s to %s... " % (serv, old_vers, new_vers), 1
-
- id = 1
-
- pending_put_properties = {}
-
- # map used to store <id, name (alias)>
- elem_map, reverse_elem_map = {}, {}
-
- pool_serv_name = "Pool/%s" % serv
- pool_dev_name = get_pool_device_from_server(serv,db=db)
-
- # 1 - Update the controller property with unique id
- yield "Updating the controller property with unique id...", 5
- controllers = self.get_pool_controllers(db, serv)
-
- ctrl_prop_value = []
- for c in controllers:
- c.id = str(id)
- ctrl_prop_value.extend(c.get_controller_prop())
- elem_map[c.id] = c.name.lower()
- reverse_elem_map[c.name.lower()] = c.id
- id += 1
-
- db.put_device_property(pool_dev_name, { "Controller" : ctrl_prop_value })
-
- # 2 - Update PoolPath: replace ':' by '\n'
- yield "Updating PoolPath: replace ':' by '%sn'..." % '\\', 10
- pool_path = db.get_device_property(pool_dev_name, ["PoolPath"])["PoolPath"]
-
- pool_path_prop_value = []
- for p in pool_path:
- pool_path_prop_value.extend(p.split(":"))
- db.put_device_property(pool_dev_name, { "PoolPath" : pool_path_prop_value })
-
- # 3 - Update the properties of all elements
- elems = db.get_device_class_list(pool_serv_name)
-
- i = 0
- elems_dict = {}
- while i < len(elems):
- dev, kcls = elems[i], elems[i+1]
- if not elems_dict.has_key(kcls): elems_dict[kcls] = []
- elems_dict[kcls].append(dev)
- i += 2
-
- # 3.1 - For motor remove 'motor_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating motors...", 15
- for m_dev_name in elems_dict.get("Motor", []):
- m, ctrl, axis = m_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(m_dev_name, props)
- db.delete_device_property(m_dev_name, ["motor_id"])
-
- m_alias = db.get_alias(m_dev_name)
- elem_map[id] = m_alias.lower()
- reverse_elem_map[m_alias.lower()] = id
-
- id += 1
-
- # 3.2 - For Counter remove 'channel_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating counters...", 20
- for expch_dev_name in elems_dict.get("CTExpChannel", []):
- exp, ctrl, axis = expch_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(expch_dev_name, props)
- db.delete_device_property(expch_dev_name, ["channel_id"])
-
- expch_alias = db.get_alias(expch_dev_name)
- elem_map[id] = expch_alias.lower()
- reverse_elem_map[expch_alias.lower()] = id
-
- id += 1
-
- # 3.3 - For 0D remove 'channel_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating 0Ds...", 25
- for expch_dev_name in elems_dict.get("ZeroDExpChannel", []):
- exp, ctrl, axis = expch_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(expch_dev_name, props)
- db.delete_device_property(expch_dev_name, ["channel_id"])
-
- expch_alias = db.get_alias(expch_dev_name)
- elem_map[id] = expch_alias.lower()
- reverse_elem_map[expch_alias.lower()] = id
-
- id += 1
-
- # 3.4 - For 1D remove 'channel_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating 1Ds...", 30
- for expch_dev_name in elems_dict.get("OneDExpChannel", []):
- exp, ctrl, axis = expch_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(expch_dev_name, props)
- db.delete_device_property(expch_dev_name, ["channel_id"])
-
- expch_alias = db.get_alias(expch_dev_name)
- elem_map[id] = expch_alias.lower()
- reverse_elem_map[expch_alias.lower()] = id
-
- id += 1
-
- # 3.5 - For 2D remove 'channel_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating 2Ds...", 35
- for expch_dev_name in elems_dict.get("TwoDExpChannel", []):
- exp, ctrl, axis = expch_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(expch_dev_name, props)
- db.delete_device_property(expch_dev_name, ["channel_id"])
-
- expch_alias = db.get_alias(expch_dev_name)
- elem_map[id] = expch_alias.lower()
- reverse_elem_map[expch_alias.lower()] = id
-
- id += 1
-
- # 3.6 - For CommunicationChannel remove 'channel_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating Communication channels...", 40
- for comch_dev_name in elems_dict.get("CommunicationChannel", []):
- com, ctrl, axis = comch_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(comch_dev_name, props)
- db.delete_device_property(comch_dev_name, ["channel_id"])
-
- comch_alias = db.get_alias(comch_dev_name)
- elem_map[id] = comch_alias.lower()
- reverse_elem_map[comch_alias.lower()] = id
-
- id += 1
-
- # 3.7 - For IORegister remove 'channel_id' and add 'id', 'ctrl_id' and 'axis'
- yield "Updating IORegisters...", 45
- for ior_dev_name in elems_dict.get("IORegister", []):
- ior, ctrl, axis = ior_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)], "ctrl_id" : [str(ctrl)], "axis" : [str(axis)] }
-
- db.put_device_property(ior_dev_name, props)
- db.delete_device_property(ior_dev_name, ["channel_id"])
-
- ior_alias = db.get_alias(ior_dev_name)
- elem_map[id] = ior_alias.lower()
- reverse_elem_map[ior_alias.lower()] = id
-
- id += 1
-
- # 3.8 - For MotorGroup remove 'motor_group_id' and add 'id'
- yield "Updating MotorGroups...", 50
- for mg_dev_name in elems_dict.get("MotorGroup", []):
- mg, inst, name = mg_dev_name.split("/")
-
- props = { "id" : [str(id)] }
-
- db.put_device_property(mg_dev_name, props)
- db.delete_device_property(mg_dev_name, ["motor_group_id", "pool_device"])
-
- mg_alias = db.get_alias(mg_dev_name)
- elem_map[id] = mg_alias.lower()
- reverse_elem_map[mg_alias.lower()] = id
-
- # change the format of some properties from list of names to list of IDs
- props = ('motor_list', 'motor_group_list', 'pseudo_motor_list', 'phys_group_elt', 'user_group_elt')
- props = db.get_device_property(mg_dev_name, props)
-
- pending_put_properties[mg_dev_name.lower()] = {}
-
- new_motor_list = []
- skip = True
- for name in props['motor_list']:
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_motor_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'motor_list': new_motor_list})
-
- new_motor_group_list = []
- skip = True
- for name in props['motor_group_list']:
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_motor_group_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'motor_group_list': new_motor_group_list})
-
- new_pseudo_motor_list = []
- skip = True
- for name in props['pseudo_motor_list']:
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_pseudo_motor_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'pseudo_motor_list': new_pseudo_motor_list})
-
- new_phys_group_elt = []
- skip = True
- for name in props['phys_group_elt']:
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_phys_group_elt.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'phys_group_elt': new_phys_group_elt})
-
- new_user_group_elt = []
- skip = True
- for name in props['user_group_elt']:
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_user_group_elt.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'user_group_elt': new_user_group_elt})
-
- id += 1
-
- # 3.9 - For MeasurementGroup remove 'measurement_group_id' and add 'id'
- yield "Updating MeasurementGroups...", 55
- for mg_dev_name in elems_dict.get("MeasurementGroup", []):
- mg, inst, name = mg_dev_name.split("/")
-
- props = { "id" : [str(id)] }
-
- db.put_device_property(mg_dev_name, props)
- db.delete_device_property(mg_dev_name, ["measurement_group_id", "pool_device"])
-
- mg_alias = db.get_alias(mg_dev_name)
- elem_map[id] = mg_alias.lower()
- reverse_elem_map[mg_alias.lower()] = id
-
- props = ('ct_list', 'zerodexpchannel_list', 'onedexpchannel_list',
- 'twodexpchannel_list', 'pseudocounter_list', 'motor_list',
- 'phys_group_elt', 'user_group_elt')
- props = db.get_device_property(mg_dev_name, props)
-
- pending_put_properties[mg_dev_name.lower()] = {}
-
- new_ct_list = []
- skip = True
- for name in props['ct_list']:
- try: int(name)
- except Exception, e:
- skip = False
- new_ct_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'ct_list': new_ct_list})
-
- new_zerodexpchannel_list = []
- skip = True
- for name in props['zerodexpchannel_list']:
- try: int(name)
- except Exception, e:
- skip = False
- new_zerodexpchannel_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'zerodexpchannel_list': new_zerodexpchannel_list})
-
- new_onedexpchannel_list = []
- skip = True
- for name in props['onedexpchannel_list']:
- try: int(name)
- except Exception, e:
- skip = False
- new_onedexpchannel_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'onedexpchannel_list': new_onedexpchannel_list})
-
- new_twodexpchannel_list = []
- skip = True
- for name in props['twodexpchannel_list']:
- try: int(name)
- except Exception, e:
- skip = False
- new_twodexpchannel_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'twodexpchannel_list': new_twodexpchannel_list})
-
- new_pseudocounter_list = []
- skip = True
- for name in props['pseudocounter_list']:
- try: int(name)
- except Exception, e:
- skip = False
- new_pseudocounter_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'pseudocounter_list': new_pseudocounter_list})
-
- new_motor_list = []
- skip = True
- for name in props['motor_list']:
- try: int(name)
- except Exception, e:
- skip = False
- new_motor_list.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'motor_list': new_motor_list})
-
- new_phys_group_elt = []
- skip = True
- for name in props['phys_group_elt']:
- try: int(name)
- except Exception, e:
- skip = False
- new_phys_group_elt.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'phys_group_elt': new_phys_group_elt})
-
- new_user_group_elt = []
- skip = True
- for name in props['user_group_elt']:
- try: int(name)
- except Exception, e:
- skip = False
- new_user_group_elt.append(reverse_elem_map.get(name.lower(), name.lower()))
- if not skip:
- pending_put_properties[mg_dev_name.lower()].update({'user_group_elt': new_user_group_elt})
-
- id += 1
-
- # 3.10 - For PseudoMotor remove 'pseudo_motor_id', 'motor_group', 'role'
- # and 'role_idx' and add 'id', 'ctrl_id', 'axis', 'motor_group_id'
- # Replace motor_list from a list of names to a list of IDs
- yield "Updating PseudoMotors...", 60
- for pm_dev_name in elems_dict.get("PseudoMotor", []):
- pm, ctrl, axis = pm_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)],
- "ctrl_id" : [str(ctrl)],
- "axis" : [str(axis)] }
-
- prop_values = db.get_device_property(pm_dev_name, ["motor_group", "motor_group_id", "motor_list"])
- motor_group = prop_values["motor_group"]
-
- if not motor_group:
- motor_group_id = motor_group = prop_values["motor_group_id"]
- if not motor_group_id:
- print "WARNING: neither motor_group nor motor_group_id property is defined for %s." % pm_dev_name
- else:
- motor_group = motor_group[0]
- motor_group_dev_name = db.get_device_alias(motor_group)
- motor_group_id = db.get_device_property(motor_group_dev_name,["id"])["id"][0]
- props["motor_group_id"] = [str(motor_group_id)]
-
- db.put_device_property(pm_dev_name, props)
- db.delete_device_property(pm_dev_name, ["pseudo_motor_id", "motor_group", "role", "role_idx"])
-
- skip = True
- motor_ids = []
- for name in prop_values["motor_list"]:
- try: int(name)
- except Exception,e:
- skip = False
- motor_ids.append(reverse_elem_map[name.lower()])
- if not skip:
- db.put_device_property(pm_dev_name, { "motor_list" : motor_ids })
-
- pm_alias = db.get_alias(pm_dev_name)
- elem_map[id] = pm_alias.lower()
- reverse_elem_map[pm_alias.lower()] = id
-
- id += 1
-
- # 3.11 - For PseudoCounter remove 'pseudo_counter_id', 'role' and
- # 'role_idx' and add 'id', 'ctrl_id', 'axis'
- # Replace channel_list from a list of names to a list of IDs
- yield "Updating PseudoCounters...", 65
- for pc_dev_name in elems_dict.get("PseudoCounter", []):
- pc, ctrl, axis = pc_dev_name.split("/")
-
- for c in controllers:
- if c.name.lower() == ctrl.lower():
- ctrl = c.id
-
- props = { "id" : [str(id)],
- "ctrl_id" : [str(ctrl)],
- "axis" : [str(axis)] }
-
- db.put_device_property(pc_dev_name, props)
- db.delete_device_property(pc_dev_name, ["pseudo_counter_id", "role", "role_idx"])
-
- channel_list = db.get_device_property(pc_dev_name, "channel_list")["channel_list"]
-
- skip = True
- channel_ids = []
- for name in channel_list:
- try: int(name)
- except Exception,e:
- skip = False
- channel_ids.append(reverse_elem_map[name.lower()])
- if not skip:
- db.put_device_property(pm_dev_name, { "channel_list" : channel_ids })
-
- pc_alias = db.get_alias(pc_dev_name)
- elem_map[id] = pc_alias.lower()
- reverse_elem_map[pc_alias.lower()] = id
-
- id += 1
-
- # 4. - Apply pending properties
- yield "Applying pending properties...", 75
- for dev, props in pending_put_properties.iteritems():
- for name, val in props.iteritems():
- for i, elem in enumerate(val):
- if isinstance(elem, str):
- val[i] = reverse_elem_map[elem]
- db.put_device_property(dev, props)
-
- # 5. - Finally update the version property in the database
- yield "Updating the version property in the database...", 85
- db.put_device_property(pool_dev_name, { "Version" : [new_vers] })
-
- # 6. - Check if the service is already registered
- yield "Checking if the service is already registered...", 95
- services = db.get_services("Sardana", serv)
- if len(services) == 0:
- db.register_service("Sardana", serv, pool_dev_name)
-
- yield "Finished", 100
-
diff --git a/scripts/upgrade/from_02_to_03.py b/scripts/upgrade/from_02_to_03.py
deleted file mode 100644
index f54a1721..00000000
--- a/scripts/upgrade/from_02_to_03.py
+++ /dev/null
@@ -1,437 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import PyTango
-from upgrade_utils import *
-
-class Controller:
- def __init__(self, type, file, kcls, name, id):
- self.type = type
- self.file = file
- self.kcls = kcls
- self.name = name
- self.id = id
-
- def __str__(self):
- return "%s %s %s %s %s" % (self.type, self.file, self.kcls, self.name, self.id)
-
- def get_controller_prop(self):
- return [self.type, self.file, self.kcls, self.name, self.id]
-
-
-class Up02To03(Upgrade):
-
- def get_pool_controllers(self, serv, db=None):
- """Gets the list of Pool controllers from pool version 0.1.x"""
- pool_serv_name = "Pool/%s" % serv
- pool_dev_name = get_pool_device_from_server(serv)
- db = db or get_db()
- ctrls = db.get_device_property(pool_dev_name, ["Controller"])["Controller"]
- i = 0
- ret = []
- while i < len(ctrls):
- type = ctrls[i]
- file = ctrls[i+1]
- kcls = ctrls[i+2]
- name = ctrls[i+3]
- id = ctrls[i+4]
- i += 5
- ret.append(Controller(type, file, kcls, name, id))
- return ret
-
- @classmethod
- def fromTo(cls):
- return ("0.2.x", "0.3.0")
-
- @classmethod
- def supports(cls, old_vers, new_vers):
- return old_vers.startswith('0.2') and new_vers.startswith('0.3')
-
- @classmethod
- def supports_old(cls, old_vers):
- return old_vers.startswith('0.2')
-
- @classmethod
- def supports_new(cls, new_vers):
- return new_vers.startswith('0.3')
-
- def upgrade(self, db, serv, old_vers, new_vers):
-
- if not Up02To03.supports(old_vers, new_vers):
- raise Exception("Unsupported upgrade")
-
- yield "Upgrading %s from %s to %s... " % (serv, old_vers, new_vers), 1
-
- id = 1
-
- pending_put_properties = {}
-
- # map used to store <id, name (alias)>
- elem_map, reverse_elem_map = {}, {}
-
- pool_serv_name = "Pool/%s" % serv
- pool_dev_name = get_pool_device_from_server(serv,db=db)
-
- # 1 - get controllers
-
- # 2 - get elements
- elems = db.get_device_class_list(pool_serv_name)
-
- i = 0
- elems_dict = {}
- while i < len(elems):
- dev, kcls = elems[i], elems[i+1]
- if not elems_dict.has_key(kcls): elems_dict[kcls] = []
- elems_dict[kcls].append(dev)
- i += 2
-
- # 3.1 - store motors
- yield "Storing motor information...", 5
- for m_dev_name in elems_dict.get("Motor", []):
- props = db.get_device_property(m_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- m_alias = db.get_alias(m_dev_name).lower()
- elem_map[id] = m_alias
- reverse_elem_map[m_alias] = id
-
- # 3.2 - store counter timers
- yield "Storing counter information...", 10
- for expch_dev_name in elems_dict.get("CTExpChannel", []):
- props = db.get_device_property(expch_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- expch_alias = db.get_alias(expch_dev_name).lower()
- elem_map[id] = expch_alias
- reverse_elem_map[expch_alias] = id
-
- # 3.3 - store 0D
- yield "Storing 0D information...", 15
- for expch_dev_name in elems_dict.get("ZeroDExpChannel", []):
- props = db.get_device_property(expch_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- expch_alias = db.get_alias(expch_dev_name).lower()
- elem_map[id] = expch_alias
- reverse_elem_map[expch_alias] = id
-
- # 3.4 - store 1D
- yield "Storing 1D information...", 20
- for expch_dev_name in elems_dict.get("OneDExpChannel", []):
- props = db.get_device_property(expch_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- expch_alias = db.get_alias(expch_dev_name).lower()
- elem_map[id] = expch_alias
- reverse_elem_map[expch_alias] = id
-
- # 3.5 - store 2D
- yield "Storing 2D information...", 25
- for expch_dev_name in elems_dict.get("TwoDExpChannel", []):
- props = db.get_device_property(expch_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- expch_alias = db.get_alias(expch_dev_name).lower()
- elem_map[id] = expch_alias
- reverse_elem_map[expch_alias] = id
-
- # 3.6 - store communication channels
- yield "Storing communication channel information...", 30
- for comch_dev_name in elems_dict.get("CommunicationChannel", []):
- props = db.get_device_property(comch_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- comch_alias = db.get_alias(comch_dev_name).lower()
- elem_map[id] = comch_alias
- reverse_elem_map[comch_alias] = id
-
- # 3.7 - store IO register
- yield "Storing ioregister information...", 35
- for ior_dev_name in elems_dict.get("IORegister", []):
- props = db.get_device_property(ior_dev_name, ("id", "ctrl_id", "axis"))
- id = int(props["id"][0])
- ior_alias = db.get_alias(ior_dev_name).lower()
- elem_map[id] = ior_alias
- reverse_elem_map[ior_alias] = id
-
- # 3.8 - For MotorGroup remove 'motor_group_id' and add 'id'
- yield "Storing MotorGroup information...", 40
- for mg_dev_name in elems_dict.get("MotorGroup", []):
- mg_dev_name = mg_dev_name.lower()
- props = ('id', 'motor_list', 'motor_group_list', 'pseudo_motor_list', 'phys_group_elt', 'user_group_elt')
- props = db.get_device_property(mg_dev_name, props)
- id = int(props["id"][0])
- mg_alias = db.get_alias(mg_dev_name).lower()
- elem_map[id] = mg_alias
- reverse_elem_map[mg_alias] = id
-
- pending_put_properties[mg_dev_name] = {}
-
- new_motor_list = []
- skip = True
- for name in props['motor_list']:
- name = name.lower()
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_motor_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'motor_list': new_motor_list})
-
- new_motor_group_list = []
- skip = True
- for name in props['motor_group_list']:
- name = name.lower()
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_motor_group_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'motor_group_list': new_motor_group_list})
-
- new_pseudo_motor_list = []
- skip = True
- for name in props['pseudo_motor_list']:
- name = name.lower()
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_pseudo_motor_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'pseudo_motor_list': new_pseudo_motor_list})
-
- new_phys_group_elt = []
- skip = True
- for name in props['phys_group_elt']:
- name = name.lower()
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_phys_group_elt.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'phys_group_elt': new_phys_group_elt})
-
- new_user_group_elt = []
- skip = True
- for name in props['user_group_elt']:
- name = name.lower()
- # if all are already IDs, skip the property
- try: int(name)
- except Exception, e:
- skip = False
- new_user_group_elt.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'user_group_elt': new_user_group_elt})
-
- # 3.9 - For MeasurementGroup remove 'measurement_group_id' and add 'id'
- yield "Storing MeasurementGroup information...", 45
- for mg_dev_name in elems_dict.get("MeasurementGroup", []):
- mg_dev_name = mg_dev_name.lower()
- props = ('id', 'ct_list', 'zerodexpchannel_list', 'onedexpchannel_list',
- 'twodexpchannel_list', 'pseudocounter_list', 'motor_list',
- 'phys_group_elt', 'user_group_elt')
- props = db.get_device_property(mg_dev_name, props)
- id = int(props["id"][0])
- mg_alias = db.get_alias(mg_dev_name).lower()
- elem_map[id] = mg_alias
- reverse_elem_map[mg_alias] = id
-
- pending_put_properties[mg_dev_name] = {}
-
- new_ct_list = []
- skip = True
- for name in props['ct_list']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_ct_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'ct_list': new_ct_list})
-
- new_zerodexpchannel_list = []
- skip = True
- for name in props['zerodexpchannel_list']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_zerodexpchannel_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'zerodexpchannel_list': new_zerodexpchannel_list})
-
- new_onedexpchannel_list = []
- skip = True
- for name in props['onedexpchannel_list']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_onedexpchannel_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'onedexpchannel_list': new_onedexpchannel_list})
-
- new_twodexpchannel_list = []
- skip = True
- for name in props['twodexpchannel_list']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_twodexpchannel_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'twodexpchannel_list': new_twodexpchannel_list})
-
- new_pseudocounter_list = []
- skip = True
- for name in props['pseudocounter_list']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_pseudocounter_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'pseudocounter_list': new_pseudocounter_list})
-
- new_motor_list = []
- skip = True
- for name in props['motor_list']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_motor_list.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'motor_list': new_motor_list})
-
- new_phys_group_elt = []
- skip = True
- for name in props['phys_group_elt']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_phys_group_elt.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'phys_group_elt': new_phys_group_elt})
-
- new_user_group_elt = []
- skip = True
- for name in props['user_group_elt']:
- name = name.lower()
- try: int(name)
- except Exception, e:
- skip = False
- new_user_group_elt.append(reverse_elem_map.get(name, name))
- if not skip:
- pending_put_properties[mg_dev_name].update({'user_group_elt': new_user_group_elt})
-
- # 3.10 - For PseudoMotor replace motor_list from a list of names to a list of IDs
- yield "Storing PseudoMotor information...", 50
- for pm_dev_name in elems_dict.get("PseudoMotor", []):
- pm_dev_name = pm_dev_name.lower()
- props = db.get_device_property(pm_dev_name, ("id", "ctrl_id", "axis",
- "motor_group", "motor_group_id", "motor_list"))
- id = int(props["id"][0])
- pm_alias = db.get_alias(pm_dev_name).lower()
- elem_map[id] = pm_alias
- reverse_elem_map[pm_alias] = id
-
- motor_group = props["motor_group"]
- if not motor_group:
- motor_group_id = motor_group = props["motor_group_id"]
- if not motor_group_id:
- print "WARNING: neither motor_group nor motor_group_id property is defined for %s." % pm_dev_name
- else:
- motor_group = motor_group[0].lower()
- motor_group_id = reverse_elem_map[motor_group]
- props["motor_group_id"] = [str(motor_group_id)]
- db.put_device_property(pm_dev_name, props)
-
- db.delete_device_property(pm_dev_name, ["pseudo_motor_id", "motor_group", "role", "role_idx"])
-
- skip = True
- motor_ids = []
- for name in props["motor_list"]:
- name = name.lower()
- try: int(name)
- except Exception,e:
- skip = False
- motor_ids.append(reverse_elem_map[name])
- if not skip:
- db.put_device_property(pm_dev_name, { "motor_list" : motor_ids })
-
- # 3.11 - For PseudoCounter replace channel_list from a list of names to a list of IDs
- yield "Storing PseudoCounter information...", 60
- for pc_dev_name in elems_dict.get("PseudoCounter", []):
- pc_dev_name = pc_dev_name.lower()
- props = db.get_device_property(pc_dev_name, ("id", "ctrl_id", "axis",
- "channel_list"))
- id = int(props["id"][0])
- pc_alias = db.get_alias(pc_dev_name).lower()
- elem_map[id] = pc_alias
- reverse_elem_map[pc_alias] = id
-
- db.delete_device_property(pc_dev_name, ["pseudo_counter_id", "role", "role_idx"])
-
- skip = True
- channel_ids = []
- for name in props["channel_list"]:
- name = name.lower()
- try: int(name)
- except Exception,e:
- skip = False
- channel_ids.append(reverse_elem_map[name])
- if not skip:
- db.put_device_property(pc_dev_name, { "channel_list" : channel_ids })
-
- # 4. - Apply pending properties
- yield "Applying pending properties...", 75
- for dev, props in pending_put_properties.iteritems():
- for name, val in props.iteritems():
- for i, elem in enumerate(val):
- if isinstance(elem, str):
- val[i] = reverse_elem_map[elem]
- db.put_device_property(dev, props)
-
- # 5. - Finally update the version property in the database
- yield "Updating the version property in the database...", 85
- db.put_device_property(pool_dev_name, { "Version" : [new_vers] })
-
- # 6. - Check if the service is already registered
- yield "Checking if the service is already registered...", 95
- services = db.get_services("Sardana", serv)
- if len(services) == 0:
- db.register_service("Sardana", serv, pool_dev_name)
-
- yield "Finished", 100
-
-class Up01To03(Upgrade):
-
- @classmethod
- def fromTo(cls):
- return ("0.1.x", "0.3.0")
-
- @classmethod
- def supports(cls, old_vers, new_vers):
- return old_vers.startswith('0.1') and new_vers.startswith('0.3')
-
- @classmethod
- def supports_old(cls, old_vers):
- return old_vers.startswith('0.1')
-
- @classmethod
- def supports_new(cls, new_vers):
- return new_vers.startswith('0.3')
-
- def upgrade(self, db, serv, old_vers, new_vers):
-
- if not Up01To03.supports(old_vers, new_vers):
- raise Exception("Unsupported upgrade")
-
- from from_01_to_02 import Up01To02
- up = Up01To02()
- for msg, perc in up.upgrade(db, serv, old_vers, '0.2.0'):
- yield msg, perc / 2
- up = Up02To03()
-
- for msg, perc in up.upgrade(db, serv, '0.2.0', new_vers):
- yield msg, (perc/2) + 50
diff --git a/scripts/upgrade/res/logo.jpg b/scripts/upgrade/res/logo.jpg
deleted file mode 100644
index df24a112..00000000
--- a/scripts/upgrade/res/logo.jpg
+++ /dev/null
Binary files differ
diff --git a/scripts/upgrade/res/watermark.jpg b/scripts/upgrade/res/watermark.jpg
deleted file mode 100644
index c44f1b02..00000000
--- a/scripts/upgrade/res/watermark.jpg
+++ /dev/null
Binary files differ
diff --git a/scripts/upgrade/upgradeCLI.py b/scripts/upgrade/upgradeCLI.py
deleted file mode 100644
index 207a9138..00000000
--- a/scripts/upgrade/upgradeCLI.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-
-import sys, time
-import PyTango
-
-from upgrade_utils import *
-
-def upgrade(serv, old_vers, new_vers):
- u_kcls = get_suitable_upgrade(old_vers, new_vers)
- u_obj = u_kcls()
- db = PyTango.Database()
- print
- for msg, perc in u_obj.upgrade(db, serv, old_vers, new_vers):
- msg = "\033[1F\033[2K%-70s" % msg
- msg = "%s [ %03d%s ]" % (msg, perc, '%')
- print msg
- time.sleep(0.1)
-
-def main():
-
- serv = ""
- vers = "0.0.0"
-
- if len(sys.argv) > 1: serv = sys.argv[1]
- if len(sys.argv) > 2: vers = sys.argv[2]
-
- pool_serv_list = get_server_list()
-
- while not serv in pool_serv_list:
- print_list(pool_serv_list)
- serv = raw_input("Which instance you want to upgrade? ")
-
- old_vers = get_pool_server_version(serv)
-
- print "Current version of %s is %s" % (serv, old_vers)
-
- possible_upgrades = get_possible_upgrades(serv)
-
- if not possible_upgrades:
- print "Could not find a suitable upgrade plugin for version %s.\nUpgrade FAILED" % old_vers
- return
-
- while not get_suitable_upgrade(old_vers, vers):
- print_list(possible_upgrades)
- vers = raw_input("To which version you want to upgrade %s (bigger than %s)? " % (serv, old_vers))
-
- upgrade(serv, old_vers, vers)
-
-if __name__ == "__main__":
- main() \ No newline at end of file
diff --git a/scripts/upgrade/upgradeGUI.py b/scripts/upgrade/upgradeGUI.py
deleted file mode 100644
index 5407ec04..00000000
--- a/scripts/upgrade/upgradeGUI.py
+++ /dev/null
@@ -1,333 +0,0 @@
-#!/usr/bin/env python
-
-import sys, os
-import PyTango
-
-from PyQt4 import QtGui, QtCore, Qt
-
-import upgrade_utils
-
-def get_default_tango_host():
- tg = os.environ.get('TANGO_HOST')
- if tg is None: return '', ''
- return tg.split(':')
-
-class BaseUpgradePage(QtGui.QWizardPage):
-
- host_key = 'tango_host'
- port_key = 'tango_port'
- p_instance_key = 'pool_instance'
- p_version_key = 'pool_version'
-
- def __init__(self, parent = None):
- QtGui.QWizardPage.__init__(self, parent)
- self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/logo.jpg"))
-
- def db(self):
- return self.wizard().db()
-
- def pool(self):
- return self.wizard().pool()
-
- def version(self):
- return self.wizard().version()
-
-
-class IntroPage(QtGui.QWizardPage):
-
- def __init__(self, parent = None):
- QtGui.QWizardPage.__init__(self, parent)
-
- self.setTitle('Introduction')
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
-
- label = QtGui.QLabel('This wizard will upgrade your device pool to ' \
- 'the desired version. You simply need to specify ' \
- 'the tango host, the pool instance and the new ' \
- 'version you which to upgrade to')
- label.setWordWrap(True)
- layout = QtGui.QVBoxLayout()
- layout.addWidget(label)
- self.setLayout(layout)
-
-
-class SelectTangoHostPage(BaseUpgradePage):
-
- def __init__(self, parent = None):
- BaseUpgradePage.__init__(self, parent)
- self.setTitle('Tango Host')
- self.setSubTitle('Please select the Tango Host')
-
- #panel = QtGui.QWidget(self)
- panel = self
- layout = QtGui.QGridLayout(panel)
-
- hostEdit = QtGui.QLineEdit(panel)
- portEdit = QtGui.QLineEdit(panel)
-
- self.registerField(self.host_key, hostEdit)
- self.registerField(self.port_key, portEdit)
-
- host, port = get_default_tango_host()
-
- hostEdit.setText(host)
- portEdit.setText(port)
-
- self.connect(hostEdit,
- QtCore.SIGNAL('textEdited(const QString &)'),
- QtCore.SIGNAL('completeChanged()'))
- self.connect(portEdit,
- QtCore.SIGNAL('textEdited(const QString &)'),
- QtCore.SIGNAL('completeChanged()'))
-
- hostLabel = QtGui.QLabel('&Host:', panel)
- portLabel = QtGui.QLabel('&Port:', panel)
- spacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.statusLabel = QtGui.QLabel(panel)
-
- self.statusLabel.setAutoFillBackground(True)
- palette = self.statusLabel.palette()
- palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(Qt.QColor.fromRgb(200,200,200)))
-
- hostLabel.setBuddy(hostEdit)
- portLabel.setBuddy(portEdit)
-
- layout.addWidget(hostLabel, 0, 0, Qt.Qt.AlignRight)
- layout.addWidget(portLabel, 1, 0, Qt.Qt.AlignRight)
- layout.addWidget(hostEdit, 0, 1, Qt.Qt.AlignLeft)
- layout.addWidget(portEdit, 1, 1, Qt.Qt.AlignLeft)
- layout.addWidget(portEdit, 1, 1, Qt.Qt.AlignLeft)
- layout.addItem(spacer, 2, 0, 1, 2)
- layout.addWidget(self.statusLabel, 3, 0, 1, 2)
-
- layout.setColumnStretch(0, 0)
- layout.setColumnStretch(1, 1)
-
- def initializePage(self):
- BaseUpgradePage.initializePage(self)
-
- def isComplete(self):
- try:
- db = self.db()
- self.statusLabel.setText('')
- return True
- except PyTango.DevFailed, df:
- txt = str(df.args[-1].desc)
- self.statusLabel.setText(txt)
- return False
-
-class SelectInstancePage(BaseUpgradePage):
-
- def __init__(self, parent = None):
- BaseUpgradePage.__init__(self, parent)
- self.setTitle('Pool Instance')
- self.setSubTitle('Please select the Pool Server instance')
-
- #panel = QtGui.QWidget(self)
- panel = self
-
- self.instanceCB = QtGui.QComboBox(panel)
- self.instanceCB.setDuplicatesEnabled(False)
- self.instanceCB.setEditable(False)
- self.registerField(self.p_instance_key, self.instanceCB)
-
- layout = QtGui.QGridLayout(panel)
- instanceLabel = QtGui.QLabel('instance:', panel)
- spacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.statusLabel = QtGui.QLabel(panel)
-
- self.statusLabel.setAutoFillBackground(True)
- palette = self.statusLabel.palette()
- palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(Qt.QColor.fromRgb(200,200,200)))
-
- layout.setColumnStretch(0, 0)
- layout.setColumnStretch(1, 1)
- layout.addWidget(instanceLabel, 0, 0, Qt.Qt.AlignRight)
- layout.addWidget(self.instanceCB, 0, 1, Qt.Qt.AlignLeft)
- layout.addItem(spacer, 1, 0, 1, 2)
-
- layout.addWidget(self.statusLabel, 2, 0, 1, 2)
-
- self.connect(self.instanceCB,
- QtCore.SIGNAL('currentIndexChanged(int)'),
- QtCore.SIGNAL('completeChanged()'))
-
- def isComplete(self):
- idx = self.instanceCB.currentIndex()
- if idx >= 0:
- db = self.db()
- serv = str(self.instanceCB.currentText())
- curr_vers = upgrade_utils.get_pool_server_version(serv, db=db)
- txt = 'Current version is %s' % curr_vers
- possible_upgrades = upgrade_utils.get_possible_upgrades(serv, db=db)
- if not possible_upgrades:
- txt += ". There are no possible upgrades for this version"
- self.statusLabel.setText(txt)
- return len(possible_upgrades)
- else:
- self.statusLabel.setText('No instance selected')
- return False
-
- def initializePage(self):
- BaseUpgradePage.initializePage(self)
- db = self.db()
- self.instanceCB.clear()
- self.instanceCB.addItems(upgrade_utils.get_server_list(db=db))
-
-class SelectVersionPage(BaseUpgradePage):
-
- def __init__(self, parent = None):
- BaseUpgradePage.__init__(self, parent)
- self.setTitle('Version')
- self.setSubTitle('Please select the version to upgrade to')
-
- panel = self
-
- self.versionCB = QtGui.QComboBox(panel)
- self.versionCB.setDuplicatesEnabled(False)
- self.versionCB.setEditable(False)
- self.registerField(self.p_version_key, self.versionCB)
-
- layout = QtGui.QGridLayout(panel)
- versionLabel = QtGui.QLabel('version:', panel)
- spacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.statusLabel = QtGui.QLabel(panel)
-
- self.statusLabel.setAutoFillBackground(True)
- palette = self.statusLabel.palette()
- palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(Qt.QColor.fromRgb(200,200,200)))
-
- layout.setColumnStretch(0, 0)
- layout.setColumnStretch(1, 1)
- layout.addWidget(versionLabel, 0, 0, Qt.Qt.AlignRight)
- layout.addWidget(self.versionCB, 0, 1, Qt.Qt.AlignLeft)
- layout.addItem(spacer, 1, 0, 1, 2)
-
- layout.addWidget(self.statusLabel, 2, 0, 1, 2)
-
- def initializePage(self):
- serv = self.pool()
- db = self.db()
- self.setSubTitle('Please select to which version you want to upgrade %s to' % serv)
- self.versionCB.clear()
- curr_vers = upgrade_utils.get_pool_server_version(serv, db=db)
- possible_new_vers = upgrade_utils.get_possible_upgrades(serv, db=db)
-
- if not possible_new_vers:
- self.statusLabel.setText('There are no suitable upgrades for version %s' % curr_vers)
- else:
- self.versionCB.addItems(possible_new_vers)
-
-class ConclusionPage(BaseUpgradePage):
-
- def __init__(self, parent = None):
- BaseUpgradePage.__init__(self, parent)
- self.setTitle('Upgrade')
- self.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(":/watermark.jpg"))
- layout = QtGui.QVBoxLayout(self)
- self.label = QtGui.QLabel(self)
- self.label.setWordWrap(True)
- layout.addWidget(self.label)
-
- def initializePage(self):
- finishText = self.wizard().buttonText(QtGui.QWizard.FinishButton)
- finishText.remove('&')
- txt = "You are now ready to upgrade '%s' to version '%s'. Click on " \
- "'%s' to proceed with the upgrade" % (self.pool(), self.version(), finishText)
- self.label.setText(txt)
-
-class SardanaUpgradeWizard(QtGui.QWizard):
-
- host_key = 'tango_host'
- port_key = 'tango_port'
- p_instance_key = 'pool_instance'
- p_version_key = 'pool_version'
-
-
- def __init__(self, parent = None):
- QtGui.QWizard.__init__(self, parent)
- self._db = None
- self.setWindowTitle("Sardana Upgrade Tool")
- self.setWizardStyle(QtGui.QWizard.ModernStyle)
- self.addPage(IntroPage())
- self.addPage(SelectTangoHostPage())
- self.pool_page_idx = self.addPage(SelectInstancePage())
- self.version_page_idx = self.addPage(SelectVersionPage())
- self.addPage(ConclusionPage())
-
- def pool(self):
- pool_instance_idx = int(self.pool_index())
- p = self.page(self.pool_page_idx).instanceCB.itemText(pool_instance_idx)
- return str(p)
-
- def pool_index(self):
- return str(self.field(self.p_instance_key).toString())
-
- def version(self):
- pool_version_idx = int(self.pool_version_index())
- v = self.page(self.version_page_idx).versionCB.itemText(pool_version_idx)
- return str(v)
-
- def pool_version_index(self):
- return str(self.field(self.p_version_key).toString())
-
- def db(self):
- host = str(self.field(self.host_key).toString()).lower()
- port = str(self.field(self.port_key).toString()).lower()
- if not self._db or self._db.get_db_host().lower() != host or \
- self._db.get_db_port().lower() != port:
- try:
- self._db = PyTango.Database(host, port)
- except PyTango.DevFailed, df:
- self._db = None
- raise df
- return self._db
-
- def accept(self):
- pool = self.pool()
- new_version = self.version()
- res = self.upgrade(pool, new_version)
- if res:
- self.setStartId(1)
- self.restart()
- else:
- QtGui.QWizard.accept(self)
-
-
- def upgrade(self, serv, new_vers):
- db = self.db()
- old_vers = upgrade_utils.get_pool_server_version(serv, db=db)
- u_kcls = upgrade_utils.get_suitable_upgrade(old_vers, new_vers)
- u_obj = u_kcls()
-
- dialog = QtGui.QProgressDialog("Upgrading %s to %s..." % (serv, new_vers), "Abort", 0, 100, self)
- dialog.setAutoClose(True)
- dialog.setMinimumDuration(0)
-
- import time
- for msg, percentage in u_obj.upgrade(db, serv, old_vers, new_vers):
- dialog.setLabelText(msg)
- dialog.setValue(percentage)
- time.sleep(0.1)
-
- dialog = QtGui.QMessageBox()
- dialog.setWindowTitle("Success!!!")
- dialog.setText("Do you wish to upgrade another Sardana?")
- dialog.setInformativeText("Selecting No will exit this wizard")
- dialog.setIcon(QtGui.QMessageBox.Question)
- dialog.addButton(QtGui.QMessageBox.Yes)
- dialog.addButton(QtGui.QMessageBox.No)
- dialog.setDefaultButton(QtGui.QMessageBox.Yes)
- return dialog.exec_() == QtGui.QMessageBox.Yes
-
-def main():
- app = QtGui.QApplication([])
- res_fname = os.path.abspath(__file__)
- res_fname = res_fname[:res_fname.rfind('.')] + '.rcc'
- QtCore.QResource.registerResource(res_fname)
- wizard = SardanaUpgradeWizard()
- wizard.show()
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- main() \ No newline at end of file
diff --git a/scripts/upgrade/upgradeGUI.qrc b/scripts/upgrade/upgradeGUI.qrc
deleted file mode 100644
index b0e09050..00000000
--- a/scripts/upgrade/upgradeGUI.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
- <!DOCTYPE RCC><RCC version="1.0">
- <qresource>
- <file alias="logo.jpg">res/logo.jpg</file>
- <file alias="watermark.jpg">res/watermark.jpg</file>
- </qresource>
- </RCC>
diff --git a/scripts/upgrade/upgradeGUI.rcc b/scripts/upgrade/upgradeGUI.rcc
deleted file mode 100644
index bb682d0c..00000000
--- a/scripts/upgrade/upgradeGUI.rcc
+++ /dev/null
Binary files differ
diff --git a/scripts/upgrade/upgrade_sardana.py b/scripts/upgrade/upgrade_sardana.py
deleted file mode 100644
index 254b0bb3..00000000
--- a/scripts/upgrade/upgrade_sardana.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env python
-
-import sys, time
-import PyTango
-
-from upgrade_utils import *
-
-if __name__ == "__main__":
- try:
- import PyQt4
- import upgradeGUI
- upgradeGUI.main()
- except Exception, e:
- import upgradeCLI
- upgradeCLI.main()
-
diff --git a/scripts/upgrade/upgrade_utils.py b/scripts/upgrade/upgrade_utils.py
deleted file mode 100644
index 6a318667..00000000
--- a/scripts/upgrade/upgrade_utils.py
+++ /dev/null
@@ -1,94 +0,0 @@
-import sys, os, imp
-import PyTango
-
-class Upgrade:
-
- def upgrade(self, db, serv, old, new):
- raise RuntimeError("Invalid Upgrade class. Must define a upgrade method")
-
- @classmethod
- def fromTo(cls):
- raise RuntimeError("Invalid Upgrade class. Must define a fromTo method")
-
- @classmethod
- def supports(cls, old, new):
- raise RuntimeError("Invalid Upgrade class. Must define a supports method")
-
- @classmethod
- def supports_old(cls, old):
- raise RuntimeError("Invalid Upgrade class. Must define a supports_old method")
-
- @classmethod
- def supports_new(cls, new):
- raise RuntimeError("Invalid Upgrade class. Must define a supports_new method")
-
-def print_list(l):
- for i in l: print i
-
-def get_db(host = None, port = None):
- if host is None or port is None:
- return PyTango.Database()
- return PyTango.Database(host, port)
-
-def get_server_list(type = "Pool", host = None, port = None, db = None):
- type += '/'
- db = db or get_db(host, port)
- return [ s[s.index('/')+1:] for s in db.get_server_list() if s.startswith(type) ]
-
-def print_server_list():
- for s in get_server_list():
- print s
-
-def get_pool_device_from_server(serv, host = None, port = None, db = None):
- db = db or get_db(host, port)
- return db.get_device_name("Pool/%s" % serv, "Pool")[0]
-
-def get_pool_server_version(serv, host = None, port = None, db = None):
- db = db or get_db(host, port)
- pool_dev_name = get_pool_device_from_server(serv, db=db)
- if not len(db.get_device_property_list(pool_dev_name,"Version")):
- # if not in database it means it is version 0.1.0
- return "0.1.0"
- else:
- return db.get_device_property(pool_dev_name, ["Version"])["Version"][0]
-
-def to_version_nb(v_str):
- m,n,r = v_str.split('.')
- return int(m)*10000 + int(n)*100 + int(r)
-
-def strip_old_versions(v_list, thresold):
- thresold = to_version_nb(thresold)
- return [ v for v in v_list if to_version_nb(v) > thresold ]
-
-def get_suitable_upgrade(old_vers, new_vers):
- upgrades = get_supported_upgrades()
- for u_kcls in upgrades:
- if u_kcls.supports(old_vers, new_vers):
- return u_kcls
- return None
-
-def get_supported_upgrades():
- upgrade_classes = []
- curr_dir = os.path.abspath(os.path.dirname(__file__))
- for mod_name in os.listdir(curr_dir):
- if not mod_name.endswith(".py"): continue
- mod_name = mod_name[:mod_name.rindex(".py")]
- if mod_name == __name__: continue
- if mod_name.startswith("upgrade_"): continue
- m = imp.load_module(mod_name, *imp.find_module(mod_name))
- for s in m.__dict__.values():
- if type(s) == type(Upgrade):
- if s == Upgrade: continue
- if issubclass(s, Upgrade):
- upgrade_classes.append(s)
-
- return upgrade_classes
-
-def get_possible_upgrades(serv, host = None, port = None, db = None):
- curr_vers = get_pool_server_version(serv, host = host, port = port, db = db)
- upgrades = get_supported_upgrades()
- possible_upgrades = []
- for u_kcls in upgrades:
- if u_kcls.supports_old(curr_vers):
- possible_upgrades.append(u_kcls.fromTo()[1])
- return possible_upgrades
diff --git a/setup.py b/setup.py
index 9276c569..fd6958bd 100644
--- a/setup.py
+++ b/setup.py
@@ -2,83 +2,482 @@
##############################################################################
##
-## This file is part of Sardana
+## This file is part of Taurus
##
-## http://www.sardana-controls.org/
+## http://taurus-scada.org
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
-## Sardana is free software: you can redistribute it and/or modify
+## Taurus is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
-## Sardana is distributed in the hope that it will be useful,
+## Taurus is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
+## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################
from __future__ import print_function
import os
+import sys
+import copy
+import shutil
import imp
+import StringIO
+from distutils import log
from distutils.core import setup, Command
from distutils.command.build import build as dftbuild
from distutils.command.install import install as dftinstall
+from distutils.command.install_lib import install_lib as dftinstall_lib
from distutils.command.install_scripts import install_scripts as dftinstall_scripts
-from distutils.version import StrictVersion as V
try:
import sphinx
import sphinx.util.console
- sphinx.util.console.color_terminal = lambda: False
- if V(sphinx.__version__) < V("1.0.0") \
- or V(sphinx.__version__) == V("1.2.0"):
- print("Sphinx documentation can not be compiled"
- " with sphinx < 1.0.0 or the 1.2.0 version")
- sphinx = None
-except ImportError:
+ sphinx.util.console.color_terminal = lambda : False
+except:
sphinx = None
-
def abspath(*path):
"""A method to determine absolute path for a given relative path to the
directory where this setup.py script is located"""
setup_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.join(setup_dir, *path)
-
def get_release_info():
name = "release"
- release_dir = abspath('src', 'sardana')
+ release_dir = abspath('lib', 'taurus', 'core')
data = imp.find_module(name, [release_dir])
release = imp.load_module(name, *data)
return release
+Release = get_release_info()
+
+author = Release.authors['Tiago']
+maintainer = Release.authors['Pascual-Izarra']
+
+package_dir = { 'taurus' : abspath('lib', 'taurus') }
+
+packages = [
+ 'taurus',
+ 'taurus.test',
+
+ 'taurus.external',
+ 'taurus.external.argparse',
+ 'taurus.external.enum',
+ 'taurus.external.ordereddict',
+ 'taurus.external.pint',
+ 'taurus.external.qt',
+ 'taurus.external.unittest',
+ 'taurus.external.test',
+
+ 'taurus.core',
+ 'taurus.core.util',
+ 'taurus.core.util.argparse',
+ 'taurus.core.util.decorator',
+ 'taurus.core.util.report',
+ 'taurus.core.utils', # old, deprecated: maintain for compatibility
+
+ 'taurus.core.resource',
+
+ 'taurus.core.simulation',
+
+ 'taurus.core.evaluation',
+
+ 'taurus.core.tango',
+ 'taurus.core.tango.img',
+
+ 'taurus.console',
+ 'taurus.console.util',
+
+ 'taurus.qt',
+
+ 'taurus.qt.qtcore',
+ 'taurus.qt.qtcore.communication',
+ 'taurus.qt.qtcore.configuration',
+ 'taurus.qt.qtcore.mimetypes',
+ 'taurus.qt.qtcore.model',
+ 'taurus.qt.qtcore.tango',
+
+ 'taurus.qt.qtcore.util',
+
+ 'taurus.qt.qtdesigner',
+ 'taurus.qt.qtdesigner.taurusplugin',
+
+ 'taurus.qt.qtgui',
+ 'taurus.qt.qtgui.test',
+ 'taurus.qt.qtgui.application',
+ 'taurus.qt.qtgui.base',
+ 'taurus.qt.qtgui.button',
+ 'taurus.qt.qtgui.button.test',
+ 'taurus.qt.qtgui.button.test.res',
+ 'taurus.qt.qtgui.compact',
+# 'taurus.qt.qtgui.console',
+ 'taurus.qt.qtgui.container',
+ 'taurus.qt.qtgui.dialog',
+ 'taurus.qt.qtgui.display',
+ 'taurus.qt.qtgui.display.test',
+ 'taurus.qt.qtgui.display.demo',
+ 'taurus.qt.qtgui.editor',
+ 'taurus.qt.qtgui.gauge',
+ 'taurus.qt.qtgui.gauge.demo',
+ 'taurus.qt.qtgui.graphic',
+ 'taurus.qt.qtgui.graphic.jdraw',
+ 'taurus.qt.qtgui.graphic.jdraw.test.res',
+ 'taurus.qt.qtgui.help',
+ 'taurus.qt.qtgui.image',
+ 'taurus.qt.qtgui.input',
+ 'taurus.qt.qtgui.model',
+ 'taurus.qt.qtgui.panel',
+ 'taurus.qt.qtgui.panel.test',
+ 'taurus.qt.qtgui.panel.report',
+ 'taurus.qt.qtgui.plot',
+ 'taurus.qt.qtgui.resource',
+# 'taurus.qt.qtgui.shell',
+ 'taurus.qt.qtgui.style',
+ 'taurus.qt.qtgui.table',
+ 'taurus.qt.qtgui.taurusgui',
+ 'taurus.qt.qtgui.taurusgui.conf',
+ 'taurus.qt.qtgui.tree',
+ 'taurus.qt.qtgui.ui',
+ 'taurus.qt.qtgui.util',
+ 'taurus.qt.qtgui.util.test',
+ 'taurus.qt.qtgui.util.test.test_ui',
+ 'taurus.qt.uic',
+]
+
+extra_packages = [
+ 'taurus.qt.qtgui.extra_nexus',
+ 'taurus.qt.qtgui.extra_xterm',
+ 'taurus.qt.qtgui.extra_guiqwt',
+
+ 'taurus.qt.qtgui.taurusgui.conf.tgconf_example01',
+ 'taurus.qt.qtgui.taurusgui.conf.tgconf_macrogui',
+
+ #For backwards compat. They may be removed later on:
+ 'taurus.qt.qtgui.extra_macroexecutor',
+ 'taurus.qt.qtgui.extra_sardana',
+ 'taurus.qt.qtgui.extra_pool',
+]
+
+provides = [
+ 'taurus',
+ 'taurus.core',
+ 'taurus.qt',
+]
+
+requires = [
+ 'numpy (>=1.1)',
+ 'PyTango (>=7.1)',
+ 'PyQt4 (>=4.4)',
+ 'PyQt4.Qwt5 (>=5.2.0)', # plotting
+ 'ply (>=2.3)', # jdraw parser
+ 'lxml (>=2.1)', # tau2taurus, taurusuic4
+ 'spyder (>=2.2)', # shell, editor
+]
+
+package_data = {
+ 'taurus.core.epics' : ['__taurus_plugin__'],
+ 'taurus.core.evaluation' : ['__taurus_plugin__'],
+ 'taurus.core.resource' : ['__taurus_plugin__'],
+ 'taurus.core.simulation' : ['__taurus_plugin__'],
+ 'taurus.core.tango' : ['__taurus_plugin__'],
+
+ 'taurus.qt.qtgui.resource' : ['*.rcc'],
+ 'taurus.qt.qtgui.util' : ['tauruswidget_template',
+ 'tauruswidget_qtdesignerplugin_template'],
+ 'taurus.qt.uic' : ['pyuic4/*'],
+ 'taurus.qt.qtgui.taurusgui.conf.tgconf_example01' : ['images/*'],
+ 'taurus.qt.qtgui.button.test' : ['res/*'],
+ 'taurus.qt.qtgui.graphic.jdraw.test' : ['res/*'],
+
+ 'taurus.qt.qtgui.help': ['ui/*.ui'],
+ 'taurus.qt.qtgui.panel.report': ['ui/*.ui'],
+ 'taurus.qt.qtgui.panel': ['ui/*.ui'],
+ 'taurus.qt.qtgui.plot': ['ui/*.ui'],
+ 'taurus.qt.qtgui.taurusgui': ['ui/*.ui'],
+ 'taurus.qt.qtgui.extra_guiqwt': ['ui/*.ui'],
+ 'taurus.qt.qtgui.util.test.test_ui' : ['ui/*.ui', 'ui/mywidget2/*.ui'],
+}
+
+
+# The files listed here will be made executable when installed.
+# The file names are relative to the dir containing setup.py
+# Note: They must also be listed in packages or package_data
+executable_data = [
+ 'taurus/qt/qtgui/button/test/res/Timeout',
+]
+
+# check if local implementations of enum and pint are here (debian removes them
+# before running setup to avoid license issues)
+if os.path.isdir(abspath('lib', 'taurus', 'external', 'enum', 'enum')):
+ packages.append('taurus.external.enum.enum')
+if os.path.isdir(abspath('lib', 'taurus', 'external', 'pint', 'pint')):
+ packages.append('taurus.external.pint.pint')
+ package_data['taurus.external.pint.pint'] = ['*.txt']
+
+
+def get_script_files():
+ scripts_dir = abspath('scripts')
+ scripts = []
+ for item in os.listdir(scripts_dir):
+ # avoid hidden files
+ if item.startswith("."):
+ continue
+ abs_item = os.path.join(scripts_dir, item)
+ # avoid non files
+ if not os.path.isfile(abs_item):
+ continue
+ # avoid files that have any extension
+ if len(os.path.splitext(abs_item)[1]) > 0:
+ continue
+ scripts.append('scripts/' + item)
+ return scripts
+
+scripts = get_script_files()
+
+data_files = [
+]
+
+classifiers = [
+ 'Development Status :: 3 - Alpha',
+ 'Environment :: Console',
+ 'Environment :: X11 Applications :: Qt',
+ 'Environment :: Win32 (MS Windows)',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Science/Research',
+ 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX',
+ 'Operating System :: POSIX :: Linux',
+ 'Operating System :: Unix',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Scientific/Engineering',
+ 'Topic :: Software Development :: Libraries',
+ 'Topic :: Software Development :: User Interfaces',
+ 'Topic :: Software Development :: Widget Sets',
+]
+
+
+class build_resources(Command):
+
+ description = "\"build\" Qt resource files"
+ user_options = [('logo=', None, "alternative logo file (default is taurus.png)")]
+ AllowedExt = ('svg', 'png', 'jpg', 'jpeg', 'gif')
+
+ def initialize_options (self):
+ self.resource_dir = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource')
+ self.taurus = os.path.join(self.resource_dir, 'taurus.png')
+ self.logo = None #os.path.join(self.resource_dir,'taurus.png')
+ if self.distribution.verbose:
+ self.out = sys.stdout
+ else:
+ self.out = StringIO.StringIO()
+
+ def finalize_options (self):
+ if self.logo is None:
+ build = self.get_finalized_command('build')
+ if build:
+ self.logo = build.logo
+ if self.logo is None:
+ self.logo = self.taurus
+ if not os.path.isabs(self.logo):
+ self.logo = os.path.abspath(self.logo)
+ self.logo = os.path.realpath(self.logo)
+
+ if os.name == 'nt':
+ try:
+ self.QTDIR = os.environ["QTDIR"]
+ self.rcc_exec = self.rcc_exec = os.path.join(self.QTDIR, 'bin', 'rcc')
+ except KeyError:
+ msg = "Cannot find QT installation. " \
+ "You should set the env. variable QTDIR " \
+ "pointing to the Qt C++ installation directory"
+ if build.with_tango_icons:
+ msg += ". Skipping creation of rcc files"
+ print (msg, file=self.out, end='')
+ self.rcc_exec = None
+ else:
+ msg += " or allow skipping creation of the rcc files by " \
+ "passing --with-tango-icons parameter to the build command"
+ raise Exception(msg)
+ else:
+ self.rcc_exec = 'rcc'
+
+ def run(self):
+ orig_dir = os.path.abspath(os.curdir)
+ os.chdir(self.resource_dir)
+ try:
+ cur_dir = os.path.abspath(os.curdir)
+
+ result = self._build_general_res()
+ result2 = self._build_res(cur_dir)
+
+ result[0].extend(result2[0])
+ result[1].extend(result2[1])
+ finally:
+ os.chdir(orig_dir)
+
+ def _build_general_res(self):
+ qrc_filename = 'general.qrc'
+ rcc_filename = 'qrc_general.rcc'
+ out = self.out
+ print("Generating %s... " % qrc_filename, file=out, end='')
+ out.flush()
+ f = file(qrc_filename, 'w')
+ try:
+ logo_relpath = os.path.relpath(self.logo)
+ taurus_relpath = os.path.relpath(self.taurus)
+ f.write('<RCC>\n <qresource>\n')
+ f.write(' <file alias="logo.png">%s</file>\n' % logo_relpath)
+ f.write(' <file alias="taurus.png">%s</file>\n' % taurus_relpath)
+ f.write(' </qresource>\n')
+ f.write('</RCC>\n')
+ except Exception, e:
+ print("[FAILED]\nDescription:\n%s" % str(e), file=out)
+ raise e
+ finally:
+ f.close()
+ print("[DONE]", file=out)
+
+ # Generate binary rcc file
+
+ if self.rcc_exec:
+ print("Generating %s... " % rcc_filename, file=out, end='')
+ out.flush()
+ cmd = '%s -binary %s -o %s' % (self.rcc_exec, qrc_filename, rcc_filename)
+ if os.system(cmd):
+ print("[FAILED]", file=out)
+ else:
+ print("[DONE]", file=out)
+
+ return [ [qrc_filename], [rcc_filename]]
+
+ def _build_res(self, abs_dir, bases=list()):
+ """Builds the resources in the abs_dir recursively.
+ The result is a list of 2 items:
+ - a list of generated qrc files
+ - a list of generated rcc files
+ """
+ result = [[], []]
+ res_name = os.path.basename(abs_dir)
+ local_elems, local_bases = [], copy.copy(bases)
+ local_bases.append(res_name)
+ out = self.out
+ for elem in os.listdir(abs_dir):
+ if elem.startswith('.'): continue
+ abs_elem = os.path.abspath(os.path.join(abs_dir, elem))
+ if os.path.isdir(abs_elem):
+ ret = self._build_res(abs_elem, local_bases)
+ result[0].extend(ret[0])
+ result[1].extend(ret[1])
+ elif os.path.splitext(abs_elem)[1][1:].lower() in build_resources.AllowedExt:
+ local_elems.append(elem)
+
+ if local_elems and local_bases[1:]:
+ base_dir = os.path.join(*local_bases[1:])
+ base_filename = "_".join(local_bases[1:])
+ base_filename = base_filename.replace('-', '_')
+ qrc_filename = base_filename + ".qrc"
+ rcc_filename = 'qrc_' + base_filename + ".rcc"
+
+ # Generate qrc file
+ print("Generating %s... " % qrc_filename, file=out, end='')
+ out.flush()
+ f = file(qrc_filename, 'w')
+ try:
+ qres_prefix = ""
+ if len(local_bases) > 2:
+ qres_prefix = "/" + "/".join(local_bases[2:])
+ f.write('<RCC>\n <qresource prefix="%s">\n' % qres_prefix)
+ else:
+ f.write('<RCC>\n <qresource>\n')
+ qres_prefix = ":" + qres_prefix
+ qres_prefix += "/"
+ for elem in local_elems:
+ rel_elem = os.path.join(base_dir, elem)
+ f.write(' <file alias="%s">%s</file>\n' % (elem, rel_elem))
+ f.write(' </qresource>\n</RCC>')
+ except Exception, e:
+ print("[FAILED]\nDescription:\n%s" % str(e), file=out)
+ raise e
+ finally:
+ f.close()
+ result[0].append(qrc_filename)
+ print("[DONE]", file=out)
+
+ # Generate binary rcc file
+ if self.rcc_exec:
+ print("Generating %s... " % rcc_filename, file=out, end='')
+ out.flush()
+ cmd = '%s -binary %s -o %s' % (self.rcc_exec, qrc_filename, rcc_filename)
+ if os.system(cmd):
+ print("[FAILED]", file=out)
+ else:
+ result[1].append(rcc_filename)
+ print("[DONE]", file=out)
+
+ return result
+
class build(dftbuild):
user_options = dftbuild.user_options + \
- [('no-doc', None, "do not build documentation")]
+ [('logo=', None, "alternative logo file (default is taurus.png)"),
+ ('with-extra-widgets', None, "distribute extra widgets"),
+ ('no-doc', None, "do not build documentation"),
+ ('with-tango-icons', None, "add Tango icons too (not just *.rcc files)")]
- boolean_options = dftbuild.boolean_options + ['no-doc']
+ boolean_options = dftbuild.boolean_options + ['with-extra-widgets', 'no-doc']
- def initialize_options(self):
+ def initialize_options (self):
dftbuild.initialize_options(self)
+ self.logo = None
+ self.doc_fmt = None
self.no_doc = None
+ self.with_tango_icons = None
+ self.with_extra_widgets = True
- def finalize_options(self):
+ def finalize_options (self):
dftbuild.finalize_options(self)
+ if self.logo is None:
+ self.logo = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource', 'taurus.png')
def run(self):
+ self.build_package_data()
+ self.build_jdraw()
dftbuild.run(self)
+ def build_package_data(self):
+ packages = self.distribution.packages
+ package_data = self.distribution.package_data
+ if self.with_extra_widgets:
+ packages.extend(extra_packages)
+ resource_package_data = self.get_extra_resource_package_data()
+ package_data['taurus.qt.qtgui.resource'].extend(resource_package_data)
+
+ def build_jdraw(self):
+ print("Building jdraw grammar...", end='')
+ taurus_dir = abspath('lib')
+ sys.path.insert(0, taurus_dir)
+ try:
+ from taurus.qt.qtgui.graphic.jdraw import jdraw_parser
+ jdraw_parser.new_parser()
+ print(" [DONE]")
+ except:
+ print("[ERROR]")
+ finally:
+ sys.path.pop(0)
+
def has_doc(self):
if self.no_doc:
return False
@@ -87,7 +486,27 @@ class build(dftbuild):
return False
return os.path.isdir(abspath('doc'))
- sub_commands = dftbuild.sub_commands + [('build_doc', has_doc)]
+ def has_resources(self):
+ return os.path.isdir(abspath('lib', 'taurus', 'qt', 'qtgui', 'resource'))
+
+ def get_extra_resource_package_data(self):
+ data = []
+ import PyQt4.Qt
+ if self.with_tango_icons or not hasattr(PyQt4.Qt.QIcon, "fromTheme"):
+ tango_icons_dir = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource',
+ 'tango-icons')
+ for tango_icon_item in os.listdir(tango_icons_dir):
+ if tango_icon_item.startswith("."):
+ continue
+ abs_item = os.path.join(tango_icons_dir, tango_icon_item)
+ if not os.path.isdir(abs_item):
+ continue
+ data.append('tango-icons/%s/*' % tango_icon_item)
+ return data
+
+ sub_commands = [('build_resources', has_resources)] + \
+ dftbuild.sub_commands + \
+ [('build_doc', has_doc)]
class install_man(Command):
@@ -108,10 +527,8 @@ class install_man(Command):
man_pages = []
for f in man_elems:
f = os.path.join(src_man_dir, f)
- if not os.path.isfile(f):
- continue
- if not f.endswith(".1"):
- continue
+ if not os.path.isfile(f): continue
+ if not f.endswith(".1"): continue
man_pages.append(f)
install_dir = os.path.join(self.install_dir, 'man1')
@@ -126,8 +543,7 @@ class install_man(Command):
class install_html(Command):
user_options = [
- ('install-dir=', 'd',
- 'base directory for installing HTML documentation files')]
+ ('install-dir=', 'd', 'base directory for installing HTML documentation files')]
def initialize_options(self):
self.install_dir = None
@@ -145,7 +561,7 @@ class install_html(Command):
class install_scripts(dftinstall_scripts):
'''Customization to create .bat wrappers for the scripts
when installing on windows.
- Adapted from a recipe by Matthew Brett (who licensed it under CC0):
+ Adapted from a recipe by Matthew Brett (who licensed it under CC0):
https://github.com/matthew-brett/myscripter/blob/master/setup.py
See rationale in:
http://matthew-brett.github.io/pydagogue/installing_scripts.html
@@ -213,43 +629,62 @@ call %py_exe% %pyscript% %*
fobj.write(bat_contents)
+class install_lib(dftinstall_lib):
+ def run(self):
+ dftinstall_lib.run(self)
+ # Set the executable bits (owner, group, and world) on
+ # all executable_data
+ exe_ouput = [os.path.join(self.install_dir,f) for f in executable_data]
+ if os.name == 'posix':
+ for fn in self.get_outputs():
+ if fn in exe_ouput:
+ if self.dry_run:
+ log.info("changing mode of %s", fn)
+ else:
+ mode = ((os.stat(fn).st_mode) | 0555) & 07777
+ log.info("changing mode of %s to %o", fn, mode)
+ os.chmod(fn, mode)
+
+
class install(dftinstall):
user_options = list(dftinstall.user_options)
user_options.extend([
- ('install-man=', None, 'install directory for Unix man pages'),
- ('install-html=', None, "install directory for HTML documentation")])
+ ('install-man=', None, 'installation directory for Unix man pages'),
+ ('install-html=', None, "installation directory for HTML documentation"),
+ ('no-doc', None, "do not install HTML documentation")])
def initialize_options(self):
self.install_man = None
self.install_html = None
+ self.no_doc = None
dftinstall.initialize_options(self)
def finalize_options(self):
- # We do a hack here. We cannot trust the 'install_base' value
- # because it is not always the final target. For example, in
- # unix, the install_base is '/usr' and all other install_* are
- # directly relative to it. However, in unix-local (like
- # ubuntu) install_base is still '/usr' but, for example,
- # install_data, is '$install_base/local' which breaks
- # everything.
+ # We do a hack here. We cannot trust the 'install_base' value because it
+ # is not always the final target. For example, in unix, the install_base
+ # is '/usr' and all other install_* are directly relative to it. However,
+ # in unix-local (like ubuntu) install_base is still '/usr' but, for
+ # example, install_data, is '$install_base/local' which breaks everything.
#
- # The hack consists in using install_data instead of
- # install_base since install_data seems to be, in practice,
- # the proper install_base on all different systems.
+ # The hack consists in using install_data instead of install_base since
+ # install_data seems to be, in practice, the proper install_base on all
+ # different systems.
dftinstall.finalize_options(self)
if os.name != "posix":
if self.install_man is not None:
self.warn("install-man option ignored on this platform")
self.install_man = None
- elif self.install_man is None:
- self.install_man = os.path.join(self.install_data,
- 'share', 'man')
+ else:
+ if self.install_man is None:
+ self.install_man = os.path.join(self.install_data, 'share', 'man')
if self.install_html is None:
- self.install_html = os.path.join(self.install_data,
- 'share', 'doc', 'sardana', 'html')
+ self.install_html = os.path.join(self.install_data, 'share', 'doc', 'taurus', 'html')
+ if self.no_doc is None:
+ self.no_doc = False
+ self.dump_dirs("Installation directories")
def expand_dirs(self):
dftinstall.expand_dirs(self)
@@ -259,6 +694,8 @@ class install(dftinstall):
return os.name == "posix"
def has_html(self):
+ if self.no_doc:
+ return False
return sphinx is not None
sub_commands = list(dftinstall.sub_commands)
@@ -266,19 +703,275 @@ class install(dftinstall):
sub_commands.append(('install_html', has_html))
-cmdclass = {'build': build,
- 'install': install,
- 'install_man': install_man,
- 'install_html': install_html,
- 'install_scripts' : install_scripts}
+cmdclass = { 'build' : build,
+ 'build_resources' : build_resources,
+ 'install' : install,
+ 'install_lib': install_lib,
+ 'install_man' : install_man,
+ 'install_html' : install_html,
+ 'install_scripts' : install_scripts}
if sphinx:
from sphinx.setup_command import BuildDoc
- class build_doc(BuildDoc):
+ class build_catalog(object):
+ '''builds an html catalog of icons. It links to png thumbnails that are
+ created in the _static dir
+ '''
+
+ AllowedExt = build_resources.AllowedExt
+
+ HTML_IL = '<tr height="30">' \
+ '<td width="30" align="center">' \
+ '<img width="24" src="{thumbnail}"' \
+ ' alt="{res_relpath}"/></td>' \
+ '<td width="400">{qres_prefix}{icon_name}</td>' \
+ '<td width="400">{res_relpath}</td>' \
+ '<td width="200">{theme}</td></tr>\n'
+ HTML_T = '<table border="1" cellspacing="0" cellpadding="2">\n' \
+ '<th colspan="4">Resource: "%s" Directory: "%s"</th>\n' \
+ '<tr><th>Preview</th><th>Resouce</th><th>File name</th>' \
+ '<th>Theme</th></tr>\n'
- def has_doc_api(self):
- return True
+ def run(self):
+ self.resource_dir = abspath('lib', 'taurus', 'qt', 'qtgui',
+ 'resource')
+ pngs_dir = os.path.abspath(os.path.join(self.builder_target_dir,
+ '_static',
+ 'icon_thumbnails') )
+ devel_dir = os.path.abspath(os.path.join(self.builder_target_dir,
+ 'devel') )
+ self.thumbnails_relpath = os.path.relpath(pngs_dir, devel_dir)
+
+ orig_dir = os.path.abspath(os.curdir)
+ os.chdir(self.resource_dir)
+
+ # create temporary catalog file (to be removed at end of build_doc)
+ catalog = file(self.fname, 'w')
+ catalog.write("<html><head>\n<title>taurus Icon Catalog</title>\n" \
+ "<style>table { border-collapse: collapse; }</style>\n</head>\n<body>\n")
+
+ try:
+ cur_dir = os.path.abspath(os.curdir)
+
+ result = self._build_general_res()
+ result2 = self._build_res(cur_dir)
+
+ result[0].extend(result2[0])
+ result[1].extend(result2[1])
+
+ catalog.write("<h1>Index</h1>\n<ul>")
+ for anchor in result[1]:
+ catalog.write("<li>%s</li>\n" % anchor)
+ catalog.write("</ul>\n")
+ catalog.writelines(result[0])
+ finally:
+ catalog.write("""</body></html>""")
+ catalog.close()
+ os.chdir(orig_dir)
+
+ #make thumbnails
+ try:
+ if self.thumbnails_source == 'wand':
+ from wand.image import Image
+ def transform(ifname, ofname):
+ with Image(filename=ifname) as img:
+ img.transform(resize='24x')
+ img.save(filename=ofname)
+ return True
+ return False
+ elif self.thumbnails_source == 'qt':
+ import PyQt4.Qt
+ if PyQt4.Qt.qApp.instance() is None:
+ self.app = PyQt4.Qt.QApplication([])
+ from PyQt4 import Qt
+ def transform(ifname, ofname):
+ pixmap = Qt.QPixmap(ifname)
+ p = pixmap.scaledToWidth(24, Qt.Qt.SmoothTransformation)
+ return p.save(ofname)
+ else:
+ if not os.path.isabs(self.thumbnails_source):
+ m = 'Absolute path required for Thumbnails dir or zip'
+ raise ValueError(m)
+ shutil.rmtree(pngs_dir, ignore_errors=True)
+ if self.thumbnails_source.lower().endswith('.zip'):
+ from zipfile import ZipFile
+ zfile = ZipFile(self.thumbnails_source)
+ zfile.extractall(pngs_dir)
+ else:
+ shutil.copytree(self.thumbnails_source, pngs_dir)
+ def transform(ifname, ofname):
+ #just check if the required thumbnail exists
+ return os.path.isfile(ofname)
+
+ print("\tCreating PNG thumbnails for icon catalog")
+ os.path.walk(self.resource_dir, self._make_thumbnails,
+ (self.resource_dir, pngs_dir, transform) )
+ # create a zipped file for the thumbnails
+ fname = abspath('doc', '~thumbnails.zip')
+ if os.path.isfile(fname):
+ os.remove(fname)
+ self._zipdir(pngs_dir, fname)
+
+ except ImportError, e:
+ print("\tCannot create PNG thumbnails for icon catalog: %s" %
+ repr(e))
+
+ @staticmethod
+ def _make_thumbnails(arg, dirname, fnames):
+ '''create thumbnails. To be called by a walker'''
+ resource, target, transform = arg
+ relpath = os.path.relpath(dirname, start=resource)
+ path = os.path.join(target, relpath)
+ if not os.path.isdir(path):
+ os.makedirs(path)
+ for fname in fnames:
+ fbase, f_ext = os.path.splitext(fname)
+ if f_ext[1:] in build_catalog.AllowedExt:
+ full_source_fname = os.path.join(dirname, fname)
+ target_fname = fbase + ".png"
+ full_target_fname = os.path.join(path, target_fname)
+ if not os.path.isfile(full_target_fname):
+ ok = transform(full_source_fname, full_target_fname)
+ print(ok and "[OK]" or "[FAIL]", full_source_fname,
+ '->', full_target_fname)
+
+ @staticmethod
+ def _zipdir(basedir, archivename):
+ '''function to zip the contents of basedir into archivename.
+ Adapted from: http://stackoverflow.com/questions/296499
+ '''
+ from zipfile import ZipFile, ZIP_DEFLATED
+ from contextlib import closing
+ assert os.path.isdir(basedir)
+ with closing(ZipFile(archivename, "w", ZIP_DEFLATED)) as z:
+ for root, dirs, files in os.walk(basedir):
+ #NOTE: ignore empty directories
+ for fn in files:
+ absfn = os.path.join(root, fn)
+ zfn = absfn[len(basedir)+len(os.sep):]
+ z.write(absfn, zfn)
+
+ def getThemeIcon(self, resource):
+ try:
+ import PyQt4.Qt
+ if not hasattr(PyQt4.Qt.QIcon, "hasThemeIcon"):
+ return "Unknown"
+ i = resource.rfind("/")
+ if i >= 0: resource = resource[i + 1:]
+ i = resource.rfind(".")
+ if i >= 0: resource = resource[:i]
+ if PyQt4.Qt.QIcon.hasThemeIcon(resource):
+ return resource
+ return "No"
+ except:
+ return "Unknown"
+
+ def _build_general_res(self):
+ out = self.out
+ html = '<h2><a name="_base">Base icons</a></h2>\n'
+ html += self.HTML_T % (':/', '')
+ anchor = '<a href="#_base">Base icons</a>'
+ try:
+ taurus_relpath = 'taurus.png'
+ png_relpath = os.path.join(self.thumbnails_relpath,
+ taurus_relpath)
+ html += self.HTML_IL.format(thumbnail=png_relpath,
+ res_relpath=taurus_relpath,
+ qres_prefix=":/",
+ icon_name=taurus_relpath,
+ theme=self.getThemeIcon("taurus.png")
+ )
+ except Exception, e:
+ print("[FAILED]\nDescription:\n%s" % str(e), file=out)
+ import traceback
+ traceback.print_exc()
+ raise e
+ finally:
+ html += '</table>\n'
+
+ return [ [html], [anchor] ]
+
+ def _build_res(self, abs_dir, bases=list()):
+ """Builds the resources in the abs_dir recursively.
+ The result is a list of 5 items:
+ - a list of HTML strings
+ - a list of HTML anchors
+ """
+ result = [[], []]
+ res_name = os.path.basename(abs_dir)
+ local_elems, local_bases = [], copy.copy(bases)
+ local_bases.append(res_name)
+ out = self.out
+ for elem in os.listdir(abs_dir):
+ if elem.startswith('.'): continue
+ abs_elem = os.path.abspath(os.path.join(abs_dir, elem))
+ if os.path.isdir(abs_elem):
+ ret = self._build_res(abs_elem, local_bases)
+ result[0].extend(ret[0])
+ result[1].extend(ret[1])
+ elif os.path.splitext(abs_elem)[1][1:].lower() in build_resources.AllowedExt:
+ local_elems.append(elem)
+
+ if local_elems and local_bases[1:]:
+ base_dir = os.path.join(*local_bases[1:])
+ base_filename = "_".join(local_bases[1:])
+ base_filename = base_filename.replace('-', '_')
+
+ html = ''
+ anchor = ''
+ try:
+ qres_prefix = ""
+ if len(local_bases) > 2:
+ qres_prefix = "/" + "/".join(local_bases[2:])
+ qres_prefix = ":" + qres_prefix
+ qres_prefix += "/"
+
+ html += '<h2><a name="%s">%s (%s)</a></h2>\n' % (base_dir, qres_prefix, base_dir)
+ html += self.HTML_T % (qres_prefix , base_dir)
+ anchor = '<a href="#%s">%s (%s)</a>' % (base_dir, base_dir, qres_prefix)
+ for elem in local_elems:
+ rel_elem = os.path.join(base_dir, elem)
+ base_elem, _ = os.path.splitext(rel_elem)
+ png_relpath = os.path.join(self.thumbnails_relpath,
+ base_elem + ".png")
+ html += self.HTML_IL.format(thumbnail=png_relpath,
+ res_relpath=rel_elem,
+ qres_prefix=qres_prefix,
+ icon_name=rel_elem,
+ theme=self.getThemeIcon(elem)
+ )
+ except Exception, e:
+ print("[FAILED]\nDescription:\n%s" % str(e), file=out)
+ raise e
+ finally:
+ html += '</table>\n'
+ result[0].append(html)
+ result[1].append(anchor)
+ return result
+
+
+ class build_doc(BuildDoc):
+ user_options = BuildDoc.user_options + \
+ [('thumbnails-source=', None,
+ ('Source for catalog thumbnails. Use "qt" for ' +
+ 'transforming the icons in the resource dir using ' +
+ 'QPixmap (this is the default). Use "wand" to ' +
+ 'transform using the wand module. Or provide an ' +
+ 'absolute path to either a dir or a zipfile ' +
+ 'containing a tree of pre-transformed thumbnails') ),
+ ('skip-api', None, 'skip api doc creation'),
+ ('skip-catalog', None, 'skip icon catalog creation')
+ ]
+ boolean_options = BuildDoc.boolean_options + ['skip-api',
+ 'skip-catalog'
+ ]
+
+ def initialize_options (self):
+ BuildDoc.initialize_options(self)
+ self.thumbnails_source = 'qt'
+ self.skip_api = False
+ self.skip_catalog = False
def run(self):
try:
@@ -286,121 +979,87 @@ if sphinx:
except Exception, e:
self.warn("Failed to build doc. Reason: %s" % str(e))
+ def _build_doc_api(self, api_dir, doc_dir):
+ if self.skip_api:
+ return
+
+ #import auto_rst4api from the doc dir
+ name = 'auto_rst4api'
+ data = imp.find_module(name, [doc_dir])
+ auto_rst4api = imp.load_module(name, *data)
+ API_Creator = auto_rst4api.Auto_rst4API_Creator
+
+ # prepare api creator
+ excl = ['_[^\.]*[^_]', '.*.extra_sardana', '.*.extra_pool',
+ '.*.extra_macroexecutor', 'taurus.external']
+ rstCreator = API_Creator(exclude_patterns=excl,
+ templatespath=doc_dir,
+ overwrite_old=True,
+ verbose=self.distribution.verbose)
+ # clean previously existing rst files
+ rstCreator.cleanAutogenerated(api_dir)
+
+ # generate api
+ # IMPORTANT: 'taurus' here is already the one from source, since we went
+ # through doc/conf.py already and inserted the lib dir in the
+ # path
+ import taurus
+ r = rstCreator.documentModule('taurus', api_dir)
+
+ # report
+ print("Auto Creation of API docs Finished with %i warnings:" % len(r))
+ for i in r:
+ print(i)
+
+ def _build_catalog(self, fname):
+ if self.skip_catalog:
+ return
+ catalog = build_catalog()
+ catalog.fname = fname
+ catalog.builder_target_dir = self.builder_target_dir
+ catalog.thumbnails_source = self.thumbnails_source
+ catalog.verbose = self.distribution.verbose
+ catalog.out = self.out
+ catalog.run()
+
def doit(self):
- BuildDoc.run(self)
+ if self.distribution.verbose:
+ self.out = sys.stdout
+ else:
+ self.out = StringIO.StringIO()
+
+ _catalog_file = abspath('doc', 'source', 'devel', 'catalog.html')
+ _api_dir = abspath('doc', 'source', 'devel', 'api')
+ _lib_dir = abspath('lib')
+ _doc_dir = abspath('doc')
+ _mock_path = os.path.join(_doc_dir, 'mock.zip')
+ # append mock dir to the sys path (mocks will be used if needed)
+ sys.path.append(_mock_path)
+ # Import taurus from src distribution
+ sys.path.insert(0, os.path.abspath(_lib_dir))
+
+ try:
+ for cmd_name in self.get_sub_commands():
+ self.run_command(cmd_name)
+ self._build_doc_api(_api_dir, _doc_dir)
+ self._build_catalog(_catalog_file)
+ BuildDoc.run(self)
+ finally:
+ sys.path.pop(0)
+ print('Removing temporary api dir: ', _api_dir)
+ shutil.rmtree(_api_dir, ignore_errors=True)
+ print('Removing temporary catalog file', _catalog_file)
+ try:
+ os.remove(_catalog_file)
+ except:
+ pass
cmdclass['build_doc'] = build_doc
+
def main():
- Release = get_release_info()
-
- author = Release.authors['Tiago']
- maintainer = Release.authors['Reszela']
-
- package_dir = {'sardana': abspath('src', 'sardana')}
-
- packages = [
- 'sardana',
- 'sardana.test',
-
- 'sardana.util',
- 'sardana.util.motion',
-
- 'sardana.pool',
- 'sardana.pool.test',
- 'sardana.pool.poolcontrollers',
-
- 'sardana.macroserver',
- 'sardana.macroserver.macros',
- 'sardana.macroserver.macros.test',
- 'sardana.macroserver.macros.examples',
- 'sardana.macroserver.scan',
- 'sardana.macroserver.scan.recorder',
-
- 'sardana.tango',
- 'sardana.tango.core',
- 'sardana.tango.pool',
- 'sardana.tango.pool.test',
- 'sardana.tango.macroserver',
- 'sardana.tango.macroserver.test',
-
- 'sardana.spock',
- 'sardana.spock.test',
- 'sardana.spock.ipython_00_10',
- 'sardana.spock.ipython_00_11',
- 'sardana.spock.ipython_01_00',
-
- 'sardana.taurus',
- 'sardana.taurus.core',
- 'sardana.taurus.core.tango',
- 'sardana.taurus.core.tango.sardana',
- 'sardana.taurus.qt',
- 'sardana.taurus.qt.qtcore',
- 'sardana.taurus.qt.qtcore.tango',
- 'sardana.taurus.qt.qtcore.tango.sardana',
- 'sardana.taurus.qt.qtgui',
- 'sardana.taurus.qt.qtgui.extra_macroexecutor',
- 'sardana.taurus.qt.qtgui.extra_macroexecutor.favouriteseditor',
- 'sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor',
- 'sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.customeditors',
- 'sardana.taurus.qt.qtgui.extra_macroexecutor.sequenceeditor',
- 'sardana.taurus.qt.qtgui.extra_sardana',
- 'sardana.taurus.qt.qtgui.extra_sardana.ui',
- 'sardana.taurus.qt.qtgui.extra_pool',
- ]
-
- package_data = {'sardana.taurus.qt.qtgui.extra_macroexecutor': ['ui/*.ui'],
- 'sardana.taurus.qt.qtgui.extra_pool': ['ui/*.ui'],
- 'sardana.taurus.qt.qtgui.extra_sardana': ['ui/*.ui']
- }
-
- provides = [
- 'sardana',
- 'sardana.pool',
- 'sardana.macroserver',
- 'sardana.spock',
- 'sardana.tango',
- ]
-
- requires = [
- 'PyTango (>=7.2.3)',
- 'taurus (>= 3.4.0)',
- 'lxml (>=2.1)',
- 'ipython (>=0.10, !=0.11)'
- ]
-
- scripts = [
- "scripts/h5toascii",
- "scripts/h5tospec",
- "scripts/MacroServer",
- "scripts/Pool",
- "scripts/Sardana",
- "scripts/spectoascii",
- "scripts/spock",
- "scripts/macroexecutor",
- "scripts/sequencer"
- ]
-
- classifiers = [
- 'Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Environment :: No Input/Output (Daemon)',
- 'Environment :: Win32 (MS Windows)',
- 'Intended Audience :: Developers',
- 'Intended Audience :: Science/Research',
- 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
- 'Operating System :: Microsoft :: Windows',
- 'Operating System :: POSIX',
- 'Operating System :: POSIX :: Linux',
- 'Operating System :: Unix',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Topic :: Scientific/Engineering',
- 'Topic :: Software Development :: Libraries',
- ]
-
- setup(name='sardana',
+ setup(name='taurus',
version=Release.version,
description=Release.description,
long_description=Release.long_description,
@@ -414,8 +1073,9 @@ def main():
license=Release.license,
packages=packages,
package_dir=package_dir,
- package_data=package_data,
classifiers=classifiers,
+ package_data=package_data,
+ data_files=data_files,
scripts=scripts,
provides=provides,
keywords=Release.keywords,
@@ -423,4 +1083,8 @@ def main():
cmdclass=cmdclass)
if __name__ == "__main__":
- main()
+ try:
+ main()
+ print("Setup finished")
+ except Exception as e:
+ print("A error occured: %s\n\nSetup aborted" % str(e))
diff --git a/src/sardana/__init__.py b/src/sardana/__init__.py
deleted file mode 100644
index 0a81cd24..00000000
--- a/src/sardana/__init__.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the sardana library"""
-
-import release as __release
-import requirements as __requirements
-
-__requirements.check_requirements()
-
-class Release:
- pass
-
-Release.__dict__.update(__release.__dict__)
-Release.__doc__ = __release.__doc__
-
-from .sardanadefs import *
-from .sardanavalue import SardanaValue \ No newline at end of file
diff --git a/src/sardana/macroserver/__init__.py b/src/sardana/macroserver/__init__.py
deleted file mode 100644
index dfea2d0b..00000000
--- a/src/sardana/macroserver/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the main macro server module"""
-
-__docformat__ = 'restructuredtext'
-
-
diff --git a/src/sardana/macroserver/basetypes.py b/src/sardana/macroserver/basetypes.py
deleted file mode 100644
index 78bbc6bd..00000000
--- a/src/sardana/macroserver/basetypes.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of the macroserver base types for
-macros"""
-
-__all__ = ["Integer", "Float", "Boolean", "String", "User", "Filename",
- "File", "Macro", "MacroLibrary", "Env", "Motor", "MotorParam",
- "MotorGroup", "ExpChannel", "MeasurementGroup", "ComChannel",
- "IORegister", "Controller", "Instrument", "ControllerClass" ]
-
-__docformat__ = 'restructuredtext'
-
-from sardana import INTERFACES
-from sardana.macroserver.msparameter import ParamType, AttrParamType, \
- ElementParamInterface
-
-# Basic types
-class Any(ParamType):
- type_class = lambda p : p
-
-class Integer(ParamType):
- type_class = int
-
-class Float(ParamType):
- type_class = float
-
-class Boolean(ParamType):
- type_class = bool
-
- def getObj(self, str_repr):
- return str_repr.lower() == "true"
-
-class String(ParamType):
- type_class = str
-
-class User(ParamType):
- type_class = str
-
-class Filename(ParamType):
- type_class = str
-
-class File(ParamType):
- type_class = str
-
- def __init__(self, macro_server, name):
- ParamType.__init__(self, macro_server, name)
- self.filename = None
- #self.data is supposed to be an array.array object
- self.data = None
-
- def set(self, filename, data):
- self.filename = filename
- self.data = data
-
-class JSON(ParamType):
-
- def getObj(self, str_repr):
- import json
- return json.loads(str_repr)
-
-class Env(ParamType):
- type_class = str
-
-class TangoDevice(ParamType):
-
- def getObj(self, str_repr):
- import PyTango
- return PyTango.DeviceProxy(str_repr)
-
-class Device(ParamType):
-
- def getObj(self, str_repr):
- import taurus
- return taurus.Device(str_repr)
-
-# Hardware types
-
-class MotorParam(AttrParamType):
- """Class designed to represent a motor parameter name. Usual values
- are acceleration,deceleration,velocity,backlash,steps_per_unit,etc"""
-
- def __init__(self, macro_server, name):
- AttrParamType.__init__(self, macro_server, name)
- self.attr_item_list = ["Acceleration","Backlash","Base_rate","Step_per_unit",
- "Deceleration","Velocity","Offset"]
- self.non_attr_item_list = ["Controller"]
-
- def getItemList(self):
- return self.non_attr_item_list + self.attr_item_list
-
- def getAttrItemList(self):
- return self.attr_item_list
-
- def getNonAttrItemList(self):
- return self.non_attr_item_list
-
-
-def __build_base_types():
- for sardana_type, info in INTERFACES.items():
- _, doc = info
- class _I(ElementParamInterface):
- __doc__ = doc
- __name__ = sardana_type
- globals()[sardana_type] = _I
-
-__build_base_types()
diff --git a/src/sardana/macroserver/macro.py b/src/sardana/macroserver/macro.py
deleted file mode 100644
index 40687d25..00000000
--- a/src/sardana/macroserver/macro.py
+++ /dev/null
@@ -1,2324 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer generic
-scan"""
-
-from __future__ import with_statement
-from __future__ import print_function
-
-__all__ = ["OverloadPrint", "PauseEvent", "Hookable", "ExecMacroHook",
- "MacroFinder", "Macro", "macro", "iMacro", "imacro",
- "MacroFunc", "Type", "ParamRepeat", "Table", "List", "ViewOption",
- "LibraryError"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-import types
-import ctypes
-import weakref
-import operator
-import StringIO
-import threading
-import traceback
-
-from taurus.core.util.log import Logger
-from taurus.core.util.prop import propertx
-from taurus.console.table import Table
-from taurus.console.list import List
-
-from sardana.sardanadefs import State
-from sardana.util.wrap import wraps
-
-from sardana.macroserver.msparameter import Type, ParamType, ParamRepeat
-from sardana.macroserver.msexception import StopException, AbortException, \
- MacroWrongParameterType, UnknownEnv, UnknownMacro, LibraryError
-from sardana.macroserver.msoptions import ViewOption
-
-from sardana.taurus.core.tango.sardana.pool import PoolElement
-
-asyncexc = ctypes.pythonapi.PyThreadState_SetAsyncExc
-# first define the async exception function args. This is
-# absolutely necessary for 64 bits machines.
-asyncexc.argtypes = (ctypes.c_long, ctypes.py_object)
-
-
-class OverloadPrint(object):
-
- def __init__(self, m):
- self._macro = m
- self._accum = ""
-
- def __enter__(self):
- self.stdout = sys.stdout
- sys.stdout = self
-
- def __exit__(self, exc_type, exc_value, traceback):
- self.flush()
- sys.stdout = self.stdout
-
- def write(self, s):
- self._accum += s
- # while there is no new line, just accumulate the buffer
- try:
- if s[-1] == '\n' or s.index('\n') >= 0:
- self.flush()
- except ValueError:
- pass
-
- def flush(self):
- b = self._accum
- if b is None or len(b) == 0:
- return
- #take the '\n' because the output is a list of strings, each to be
- #interpreted as a separate line in the client
- if b[-1] == '\n': b = b[:-1]
- self._macro.output(b)
- self._accum = ""
-
-
-class PauseEvent(Logger):
-
- def __init__(self, macro_obj, abort_timeout=0.2):
- self._name = self.__class__.__name__
- self._pause_cb = None
- self._resume_cb = None
- self._macro_obj_wr = weakref.ref(macro_obj)
- self._macro_name = macro_obj._getName()
- self._wait_for_abort_exception = False
- self._wait_for_abort_timeout = abort_timeout
- Logger.__init__(self, "Macro_%s %s" % (self._macro_name, self._name))
- # we create an event object that is automatically set
- self._event = threading.Event()
- self._event.set()
-
- @property
- def macro_obj(self):
- return self._macro_obj_wr()
-
- def pause(self, cb=None):
- self.debug("[START] Pause")
- self._pause_cb = cb
- self._event.clear()
- self.debug("[ END ] Pause")
-
- def resume(self, cb=None):
- if self.isPaused():
- self.debug("[START] Resume")
- self._resume_cb = cb
- self._event.set()
- self.debug("[ END ] Resume")
-
- def resumeForAbort(self):
- if self.isPaused():
- self.debug("[RESUME] (Abort)")
- self._wait_for_abort_exception = True
- self._event.set()
-
- def wait(self,timeout=None):
- pauseit = not self._event.isSet()
- if pauseit and self._pause_cb is not None:
- self._pause_cb(self.macro_obj)
- self._event.wait(timeout)
- # if an event is set because an abort has been issued during a paused
- # macro wait for the ashyncronous AbortException to arrive at this thread
- if self._wait_for_abort_exception:
- self._wait_for_abort_exception = False
- time.sleep(self._wait_for_abort_timeout)
- self.debug('Abort exception did not occured in pause for %ss.' \
- 'Performing a Forced Abort.' % self._wait_for_abort_timeout)
- raise AbortException("Forced")
- if pauseit and self._resume_cb is not None:
- self._resume_cb(self.macro_obj)
-
- def isPaused(self):
- return not self._event.isSet()
-
-
-class Hookable(Logger):
-
- # avoid creating an __init__
-
- def _getHooks(self):
- try:
- return self._hooks
- except:
- self._hooks = []
- return self._hooks
-
- def _getHookHintsDict(self):
- try:
- return self._hookHintsDict
- except:
- self._hookHintsDict = {'_ALL_':[], '_NOHINTS_':[]}
- return self._hookHintsDict
-
- def getAllowedHookHints(self):
- return self.__class__.hints.get('allowsHooks')
-
- def getHints(self):
- return self._getHookHintsDict().keys()
-
- def getHooks(self, hint=None):
- '''This will return a list of hooks that have the given hint. Two reserved
- hints are always valid:
- - "_ALL_": which contains all the hooks
- - "_NOHINTS_": which contains the hooks that don't provide any hint
-
- :param hint: (str) a hint. If None is passed, it returns a list of
- (hook,hints) tuples
-
- :return: (list) an ordered list of hooks that have the given hint
- '''
- if hint is None:
- return self._getHooks()
- else:
- return self._getHookHintsDict().get(hint, [])
-
- @propertx
- def hooks():
- def get(self):
- return self._getHooks()
-
- def set(self, hooks):
- '''hooks must be list<callable,list<str>>. Exceptionally, for
- backwards compatibility, list<callable> is also admitted, but may
- not be supported in the future.
- "two variables are created:
- - self._hooks (list<callable,list<str>>) (will be a tuple
- regardless of what was passed)
- - self._hookHintsDict (dict<str,list>) a dict of key=hint and
- value=list of hooks with that hint.
- self._hookHintsDict also stores two
- special keys: "_ALL_": which contains all
- the hooks "_NOHINTS_": which contains the
- hooks that don't provide hints
- '''
- if not isinstance(hooks, list):
- self.error('the hooks must be passed as a list<callable,list<str>>')
- return
-
- #store self._hooks, making sure it is of type: list<callable,list<str>>
- self._hooks = []
- for h in hooks:
- if isinstance(h, (tuple, list)) and len(h) == 2:
- self._hooks.append(h)
- else: #we assume that hooks is a list<callable>
- self._hooks.append((h, []))
- self.info('Deprecation warning: hooks should be set with a list of hints. See Hookable API docs')
-
- #create _hookHintsDict
- self._getHookHintsDict()['_ALL_'] = zip(*self._hooks)[0]
- nohints = self._hookHintsDict['_NOHINTS_']
- for hook, hints in self._hooks:
- if len(hints) == 0:
- nohints.append(hook)
- else:
- for hint in hints:
- try:
- self._hookHintsDict[hint].append(hook)
- except KeyError:
- self._hookHintsDict[hint] = [hook]
- return get,set
-
-
-class ExecMacroHook(object):
- """A speciallized callable hook for executing a sub macro inside another
- macro as a hook"""
-
- def __init__(self, parent_macro, *pars, **kwargs):
- self._macro_obj_wr = weakref.ref(parent_macro)
- self._pars = pars
- self._opts = kwargs
-
- @property
- def macro_obj(self):
- return self._macro_obj_wr()
-
- def __call__(self):
- self.macro_obj.execMacro(*self._pars, **self._opts)
-
-
-class MacroFinder:
-
- def __init__(self, macro_obj):
- self._macro_obj_wr = weakref.ref(macro_obj)
-
- @property
- def macro_obj(self):
- return self._macro_obj_wr()
-
- def __getattr__(self, name):
-
- def f(*args, **kwargs):
- p_m = self.macro_obj
- p_m.syncLog()
- opts = { 'parent_macro' : p_m,
- 'executor' : p_m.executor }
- kwargs.update(opts)
- eargs = [name]
- eargs.extend(args)
- return p_m.execMacro(*eargs, **kwargs)
-
- setattr(self, name, f)
-
- return f
-
-def mAPI(fn):
- """Wraps the given Macro method as being protected by the stop procedure.
- To be used by the :class:`Macro` as a decorator for all methods.
- :param: macro method
- :return: wrapped macro method"""
- @wraps(fn)
- def new_fn(*args, **kwargs):
- self = args[0]
- if not self.isProcessingStop():
- is_macro_th = self._macro_thread == threading.current_thread()
- if self._shouldRaiseStopException():
- if is_macro_th:
- self.setProcessingStop(True)
- raise StopException("stopped before calling %s" % fn.__name__)
- ret = fn(*args, **kwargs)
- if not self.isProcessingStop():
- if self._shouldRaiseStopException():
- if is_macro_th:
- self.setProcessingStop(True)
- raise StopException("stopped after calling %s" % fn.__name__)
- return ret
- return new_fn
-
-
-class macro(object):
- """Class designed to decorate a python function to transform it into a
- macro. Examples::
-
- @macro()
- def my_macro1(self):
- self.output("Executing %s", self.getName())
-
- @macro([ ["moveable", Type.Moveable, None, "motor to watch"] ])
- def where_moveable(self, moveable):
- self.output("Moveable %s is at %s", moveable.getName(), moveable.getPosition())"""
-
- def __init__(self, param_def=None, result_def=None, env=None, hints=None,
- interactive=None):
- self.param_def = param_def
- self.result_def = result_def
- self.env = env
- self.hints = hints
- self.interactive = interactive
-
- def __call__(self, fn):
- fn.macro_data = {}
- fn.param_def = self.param_def
- fn.result_def = self.result_def
- fn.hints = self.env
- fn.env = self.hints
- fn.interactive = self.interactive
- return fn
-
-
-from functools import partial
-imacro = partial(macro, interactive=True)
-
-
-class Macro(Logger):
- """ The Macro base class. All macros should inherit directly or indirectly
- from this class."""
-
- #: internal variable
- Init = State.Init
-
- #: internal variable
- Running = State.Running
-
- #: internal variable
- Pause = State.Standby
-
- #: internal variable
- Stop = State.Standby
-
- #: internal variable
- Fault = State.Fault
-
- #: internal variable
- Finished = State.On
-
- #: internal variable
- Ready = State.On
-
- #: internal variable
- Abort = State.Alarm
-
- #: Constant used to specify all elements in a parameter
- All = ParamType.All
-
- #: internal variable
- BlockStart = '<BLOCK>'
-
- #: internal variable
- BlockFinish = '</BLOCK>'
-
- #: This property holds the macro parameter description.
- #: It consists of a sequence of parameter information objects.
- #: A parameter information object is either:
- #:
- #: #. a simple parameter object
- #: #. a parameter repetition object
- #:
- #: A simple parameter object is a sequence of:
- #:
- #: #. a string representing the parameter name
- #: #. a member of :obj:`Macro.Type` representing the parameter data type
- #: #. a default value for the parameter or None if there is no default value
- #: #. a string with the parameter description
- #:
- #: Example::
- #:
- #: param_def = ( ('value', Type.Float, None, 'a float parameter' ) )
- #:
- #: A parameter repetition object is a sequence of:
- #:
- #: #. a string representing the parameter repetition name
- #: #. a sequence of parameter information objects
- #: #. a dictionary representing the parameter repetition semantics or None
- #: to use the default parameter repetition semantics. Dictionary keys are:
- #:
- #: * *min* - integer representing minimum number of repetitions or None
- #: for no minimum.
- #: * *max* - integer representing maximum number of repetitions or None
- #: for no maximum.
- #:
- #: Default parameter repetition semantics is ``{ 'min': 1, 'max' : None }``
- #: (in other words, "at least one repetition" semantics)
- #:
- #: Example::
- #:
- #: param_def = (
- #: ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
- #: )
- param_def = []
-
- #: This property holds the macro result description.
- #: It a single parameter information object.
- #:
- #: .. seealso:: :obj:`~sardana.macroserver.macro.Macro.param_def`
- result_def = []
-
- #: Hints to give a client to perform special tasks.
- #: Example: scan macros give hints on the types of hooks they support. A
- #: :term:`GUI` can use this information to allow a scan to have sub-macros
- #: executed as hooks.
- hints = {}
-
- #: a set of mandatory environment variable names without which your macro
- #: cannot run
- env = ()
-
- #: decide if the macro should be able to receive input from the user
- #: [default: False]. A macro which asks input but has this flag set to False
- #: will print a warning message each time it is executed
- interactive = False
-
- def __init__(self, *args, **kwargs):
- """Constructor"""
- self._name = kwargs.get('as', self.__class__.__name__)
- self._in_pars = args
- self._out_pars = None
- self._aborted = False
- self._stopped = False
- self._processingStop = False
- self._parent_macro = kwargs.get('parent_macro')
- self._executor = kwargs.get('executor')
- self._macro_line = kwargs.get('macro_line')
- self._interactive_mode = kwargs.get('interactive', True)
- self._macro_thread = None
- self._id = kwargs.get('id')
- self._desc = "Macro '%s'" % self._macro_line
- self._macro_status = { 'id' : self._id,
- 'range' : (0.0, 100.0),
- 'state' : 'start',
- 'step' : 0.0 }
- self._pause_event = PauseEvent(self)
- log_parent = self.parent_macro or self.door
- Logger.__init__(self, "Macro[%s]" % self._name, log_parent)
- self._reserveObjs(args)
-
- ## @name Official Macro API
- # This list contains the set of methods that are part of the official macro
- # API. This means that they can be safely used inside any macro.
- #@{
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Methods to be implemented by the actual macros
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def run(self, *args):
- """**Macro API**. Runs the macro. **Overwrite MANDATORY!** Default implementation
- raises RuntimeError.
-
- :raises: RuntimeError"""
- raise RuntimeError("Macro %s does not implement run method" % self.getName())
-
- def prepare(self, *args, **kwargs):
- """**Macro API**. Prepare phase. Overwrite as necessary.
- Default implementation does nothing"""
- pass
-
- def on_abort(self):
- """**Macro API**. Hook executed when an abort occurs.
- Overwrite as necessary. Default implementation does nothing"""
- pass
-
- def on_pause(self):
- """**Macro API**. Hook executed when a pause occurs.
- Overwrite as necessary. Default implementation does nothing"""
- pass
-
- def on_stop(self):
- """**Macro API**. Hook executed when a stop occurs.
- Overwrite as necessary. Default implementation calls
- :meth:`~Macro.on_abort`"""
- return self.on_abort()
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # API
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def checkPoint(self):
- """**Macro API**.
- Empty method that just performs a checkpoint. This can be used
- to check for the stop. Usually you won't need to call this method"""
- pass
-
- @mAPI
- def pausePoint(self, timeout=None):
- """**Macro API**.
- Will establish a pause point where called. If an external source as
- invoked a pause then, when this this method is called, it will be block
- until the external source calls resume.
- You may want to call this method if your macro takes a considerable time
- to execute and you may whish to pause it at some time. Example::
-
- for i in range(10000):
- time.sleep(0.1)
- self.output("At step %d/10000", i)
- self.pausePoint()
-
- :param timeout:
- timeout in seconds [default: None, meaning wait forever]
- :type timeout: :obj:`float`"""
- return self._pausePoint(timeout=timeout)
-
- @property
- def macros(self):
- """**Macro API**.
- An object that contains all macro classes as members. With
- the returning object you can invoke other macros. Example::
-
- m = self.macros.ascan('th', '0', '90', '10', '2')
- scan_data = m.data"""
- self.checkPoint()
- if not hasattr(self, '_macros'):
- self._macros = MacroFinder(self)
- return self._macros
-
- @mAPI
- def getMacroStatus(self):
- """**Macro API**.
- Returns the current macro status. Macro status is a :obj:`dict` where
- keys are the strings:
-
- * *id* - macro ID (internal usage only)
- * *range* - the full progress range of a macro (usually a
- :obj:`tuple` of two numbers (0, 100))
- * *state* - the current macro state, a string which can have values
- *start*, *step*, *stop* and *abort*
- * *step* - the current step in macro. Should be a value inside the
- allowed macro range
-
- :return: the macro status
- :rtype: :obj:`dict`"""
- return self._macro_status
-
- @mAPI
- def getName(self):
- """**Macro API**.
- Returns this macro name
-
- :return: the macro name
- :rtype: :obj:`str`"""
- return self._name
-
- @mAPI
- def getID(self):
- """**Macro API**.
- Returns this macro id
-
- :return: the macro id
- :rtype: :obj:`str`"""
- return self._id
-
- @mAPI
- def getParentMacro(self):
- """**Macro API**.
- Returns the parent macro reference.
-
- :return: the parent macro reference or None if there is no parent macro
- :rtype: :class:`~sardana.macroserver.macro.Macro`"""
- return self._parent_macro
-
- @mAPI
- def getDescription(self):
- """**Macro API**.
- Returns a string description of the macro.
-
- :return: the string description of the macro
- :rtype: :obj:`str`"""
- return self._desc
-
- @mAPI
- def getParameters(self):
- """**Macro API**.
- Returns a the macro parameters. It returns a list containning the
- parameters with which the macro was executed
-
- :return: the macro parameters
- :rtype: :obj:`list`"""
- return self._in_pars
-
- @mAPI
- def getExecutor(self):
- """**Macro API**.
- Returns the reference to the object that invoked this macro. Usually
- is a MacroExecutor object.
-
- :return: the reference to the object that invoked this macro
- :rtype: :class:`~sardana.macroserver.macromanager.MacroExecutor`"""
- return self._executor
-
- @mAPI
- def getDoorObj(self):
- """**Macro API**.
- Returns the reference to the Door that invoked this macro.
-
- :return: the reference to the Door that invoked this macro.
- :rype: :class:`~sardana.macroserver.door.Door`"""
- return self.executor.getDoor()
-
- @mAPI
- def getManager(self):
- """**Macro API**.
- Returns the manager for this macro (usually a MacroServer)
-
- :return: the MacroServer
- :rtype: :class:`~sardana.macroserver.macroserver.MacroServer`"""
- return self.door.manager
-
- manager = property(getManager)
-
- @mAPI
- def getMacroServer(self):
- """**Macro API**.
- Returns the MacroServer for this macro
-
- :return: the MacroServer
- :rtype: :class:`~sardana.macroserver.macroserver.MacroServer`"""
- return self.door.macro_server
-
- macro_server = property(getMacroServer)
-
- @mAPI
- def getDoorName(self):
- """**Macro API**.
- Returns the string with the name of the Door that invoked this macro.
-
- :return: the string with the name of the Door that invoked this macro.
- :rtype: :obj:`str`"""
- return self.door.name
-
- @mAPI
- def getCommand(self):
- """**Macro API**.
- Returns the string used to execute the macro.
- Ex.: 'ascan M1 0 1000 100 0.8'
-
- :return: the macro command.
- :rtype: :obj:`str`"""
- return '%s %s' % (self.getName(), ' '.join([str(p) for p in self._in_pars]))
-
- @mAPI
- def getDateString(self, time_format='%a %b %d %H:%M:%S %Y'):
- """**Macro API**.
- Helper method. Returns the current date in a string.
-
- :param time_format: the format in which the date should be
- returned (optional, default value is
- '%a %b %d %H:%M:%S %Y'
- :type time_format: :obj:`str`
- :return: the current date
- :rtype: :obj:`str`"""
- return time.strftime(time_format)
-
- @mAPI
- def outputDate(self, time_format='%a %b %d %H:%M:%S %Y'):
- """**Macro API**.
- Helper method. Outputs the current date into the output buffer
-
- :param time_format: (str) the format in which the date should be
- returned (optional, default value is
- '%a %b %d %H:%M:%S %Y'
- :type time_format: :obj:`str`"""
- self.output(self.getDateString(time_format=time_format))
-
- @mAPI
- def sendRecordData(self, data, codec=None):
- """**Macro API**.
- Sends the given data to the RecordData attribute of the Door
-
- :param data: (sequence) the data to be sent"""
- self.executor.sendRecordData(data, codec=codec)
-
- @mAPI
- def plot(self, *args, **kwargs):
- """**Macro API**.
- Sends the plot command to the client using the 'RecordData' DevEncoded
- attribute. The data is encoded using the pickle -> BZ2 codec.
-
- :param args: the plotting args
- :param kwargs: the plotting keyword args"""
- self.pyplot.plot(*args, **kwargs)
-# data = dict(args=args, kwargs=kwargs)
-# self.sendRecordData(data, codec='bz2_pickle_plot')
-
- @property
- @mAPI
- def pylab(self):
- try:
- pylab = self._pylab
- except AttributeError:
- self._pylab = pylab = self.door.pylab
- return pylab
-
- @property
- @mAPI
- def pyplot(self):
- try:
- pyplot = self._pyplot
- except AttributeError:
- self._pyplot = pyplot = self.door.pyplot
- return pyplot
-
- @mAPI
- def getData(self):
- """**Macro API**.
- Returns the data produced by the macro.
-
- :raises: Exception if no data has been set before on this macro
-
- :return: the data produced by the macro
- :rtype: object"""
- if not hasattr(self, "_data"):
- raise Exception("Macro '%s' does not produce any data" % self.getName())
- return self._data
-
- @mAPI
- def setData(self, data):
- """**Macro API**. Sets the data for this macro
-
- :param object data: new data to be associated with this macro"""
- self._data = data
-
- data = property(getData, setData, doc="macro data")
-
- @mAPI
- def print(self, *args, **kwargs):
- """**Macro API**.
- Prints a message. Accepted *args* and
- *kwargs* are the same as :func:`print`. Example::
-
- self.print("this is a print for macro", self.getName())
-
- .. note::
- you will need python >= 3.0. If you have python 2.x then you must
- include at the top of your file the statement::
-
- from __future__ import print_function
- """
- fd = kwargs.get('file', sys.stdout)
- if fd in (sys.stdout, sys.stderr):
- out = StringIO.StringIO()
- kwargs['file'] = out
- end = kwargs.get('end', '\n')
- if end == '\n':
- kwargs['end'] = ''
- ret = print(*args, **kwargs)
- self.output(out.getvalue())
- else:
- ret = print(*args, **kwargs)
- return ret
-
- @mAPI
- def input(self, msg, *args, **kwargs):
- """**Macro API**.
- If args is present, it is written to standard output without a trailing
- newline. The function then reads a line from input, converts it to a
- string (stripping a trailing newline), and returns that.
-
- Depending on which type of application you are running, some of the
- keywords may have no effect (ex.: spock ignores decimals when a number
- is asked).
-
- Recognized kwargs:
-
- - data_type : [default: Type.String] specific input type. Can also
- specify a sequence of strings with possible values (use
- allow_multiple=True to say multiple values can be selected)
- - key : [default: no default] variable/label to assign to this input
- - unit: [default: no default] units (useful for GUIs)
- - timeout : [default: None, meaning wait forever for input]
- - default_value : [default: None, meaning no default value]
- When given, it must be compatible with data_type
- - allow_multiple : [default: False] in case data_type is a
- sequence of values, allow multiple selection
- - minimum : [default: None] When given, must be compatible with data_type (useful for GUIs)
- - maximum : [default: None] When given, must be compatible with data_type (useful for GUIs)
- - step : [default: None] When given, must be compatible with data_type (useful for GUIs)
- - decimals : [default: None] When given, must be compatible with data_type (useful for GUIs)
-
- Examples::
-
- device_name = self.input("Which device name (%s)?", "tab separated")
-
- point_nb = self.input("How many points?", data_type=Type.Integer)
-
- calc_mode = self.input("Which algorithm?", data_type=["Average", "Integral", "Sum"],
- default_value="Average", allow_multiple=False)"""
- if not self.interactive:
- self.warning("Non interactive macro '%s' is asking for input "
- "(please set this macro interactive to True)",
- self.getName())
- if self._interactive_mode:
- kwargs['data_type'] = kwargs.get('data_type', Type.String)
- kwargs['allow_multiple'] = kwargs.get('allow_multiple', False)
- kwargs['macro_id'] = self.getID()
- kwargs['macro_name'] = self.getName()
- kwargs['macro'] = self
- return self.getDoorObj().input(msg, *args, **kwargs)
- else:
- if 'default_value' not in kwargs:
- if 'key' not in kwargs:
- self.warning("%s running in non attended mode was asked "
- "for input without default value or key. "
- "Returning None")
- return None
- else:
- return self.getEnv(kwargs['key'])
- return kwargs['default_value']
-
- @mAPI
- def output(self, msg, *args, **kwargs):
- """**Macro API**.
- Record a log message in this object's output. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.log`.
- Example::
-
- self.output("this is a print for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.output(self, msg, *args, **kwargs)
-
- @mAPI
- def log(self, level, msg, *args, **kwargs):
- """**Macro API**.
- Record a log message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.log`.
- Example::
-
- self.debug(logging.INFO, "this is a info log message for macro %s", self.getName())
-
- :param level: the record level
- :type level: :obj:`int`
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.log(self, level, msg, *args, **kwargs)
-
- @mAPI
- def debug(self, msg, *args, **kwargs):
- """**Macro API**.
- Record a debug message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.debug`.
- Example::
-
- self.debug("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kw: list of keyword arguments"""
- return Logger.debug(self, msg, *args, **kwargs)
-
- @mAPI
- def info(self, msg, *args, **kwargs):
- """**Macro API**.
- Record an info message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.info`.
- Example::
-
- self.info("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.info(self, msg, *args, **kwargs)
-
- @mAPI
- def warning(self, msg, *args, **kwargs):
- """**Macro API**.
- Record a warning message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.warning`.
- Example::
-
- self.warning("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.warning(self, msg, *args, **kwargs)
-
- @mAPI
- def error(self, msg, *args, **kwargs):
- """**Macro API**.
- Record an error message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.error`.
- Example::
-
- self.error("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments
- """
- return Logger.error(self, msg, *args, **kwargs)
-
- @mAPI
- def critical(self, msg, *args, **kwargs):
- """**Macro API**.
- Record a critical message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.critical`.
- Example::
-
- self.critical("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.critical(self, msg, *args, **kwargs)
-
- @mAPI
- def trace(self, msg, *args, **kwargs):
- """**Macro API**. Record a trace message in this object's logger.
-
- :param msg: (str) the message to be recorded
- :param args: list of arguments
- :param kw: list of keyword arguments"""
- return Logger.trace(self, msg, *args, **kwargs)
-
- @mAPI
- def traceback(self, *args, **kwargs):
- """**Macro API**.
- Logs the traceback with level TRACE on the macro logger."""
- return Logger.traceback(self, *args, **kwargs)
-
- @mAPI
- def stack(self, *args, **kwargs):
- """**Macro API**.
- Logs the stack with level TRACE on the macro logger."""
- return Logger.stack(self, *args, **kwargs)
-
- @mAPI
- def report(self, msg, *args, **kwargs):
- """**Macro API**.
- Record a log message in the sardana report (if enabled) with default
- level **INFO**. The msg is the message format string, and the args are
- the arguments which are merged into msg using the string formatting
- operator. (Note that this means that you can use keywords in the
- format string, together with a single dictionary argument.)
-
- *kwargs* are the same as :meth:`logging.Logger.debug` plus an optional
- level kwargs which has default value **INFO**
-
- Example::
-
- self.report("this is an official report of macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return self.getDoorObj().report(msg, *args, **kwargs)
-
- @mAPI
- def flushOutput(self):
- """**Macro API**.
- Flushes the output buffer."""
- return Logger.flushOutput(self)
-
- @mAPI
- def getMacroThread(self):
- """**Macro API**.
- Returns the python thread where this macro is running
-
- :return: the python thread where this macro is running
- :rtype: threading.Thread"""
- return self._macro_thread
-
- @mAPI
- def getMacroThreadID(self):
- """**Macro API**.
- Returns the python thread id where this macro is running
-
- :return: the python thread id where this macro is running
- :rtype: :obj:`int`"""
- return self.getMacroThread().ident
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Hook helper API
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def createExecMacroHook(self, par_str_sequence, parent_macro=None):
- """**Macro API**.
- Creates a hook that executes the macro given as a sequence of strings
- where the first string is macro name and the following strings the
- macro parameters
-
- :param par_str_sequence: the macro parameters
- :param parent_macro:
- the parent macro object. If None is given (default) then the
- parent macro is this macro
-
- :return: a ExecMacroHook object (which is a callable object)"""
- return ExecMacroHook(parent_macro or self, par_str_sequence)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Handle child macro execution
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def createMacro(self, *pars):
- """**Macro API**. Create a new macro and prepare it for execution
- Several different parameter formats are supported::
-
- # several parameters:
- self.createMacro('ascan', 'th', '0', '100', '10', '1.0')
- self.createMacro('ascan', 'th', 0, 100, 10, 1.0)
- th = self.getObj('th')
- self.createMacro('ascan', th, 0, 100, 10, 1.0)
-
- # a sequence of parameters:
- self.createMacro(['ascan', 'th', '0', '100', '10', '1.0')
- self.createMacro(('ascan', 'th', 0, 100, 10, 1.0))
- th = self.getObj('th')
- self.createMacro(['ascan', th, 0, 100, 10, 1.0])
-
- # a space separated string of parameters:
- self.createMacro('ascan th 0 100 10 1.0')
-
- :param pars: the command parameters as explained above
- :return:
- a sequence of two elements: the macro object and the result of
- preparing the macro
- :rtype: :obj:`tuple`\<:class:`~sardana.macroserver.macro.Macro`\, seq<obj>>
- """
- return self.prepareMacro(*pars)
-
- @mAPI
- def prepareMacroObj(self, macro_name_or_klass, *args, **kwargs):
- """**Macro API**. Prepare a new macro for execution
-
- :param macro_name_or_klass name: name of the macro to be prepared or
- the macro class itself
- :param pars: list of parameter objects
- :param init_opts: keyword parameters for the macro constructor
- :param prepare_opts: keyword parameters for the macro prepare
-
- :return:
- a sequence of two elements: the macro object and the result of
- preparing the macro"""
- # sync our log before calling the child macro prepare in order to avoid
- # mixed outputs between this macro and the child macro
- self.syncLog()
- init_opts = { 'parent_macro' : self }
- return self.executor.prepareMacroObj(macro_name_or_klass, args,
- init_opts, kwargs)
-
- @mAPI
- def prepareMacro(self, *args, **kwargs):
- """**Macro API**. Prepare a new macro for execution
- Several different parameter formats are supported::
-
- # several parameters:
- executor.prepareMacro('ascan', 'th', '0', '100', '10', '1.0')
- executor.prepareMacro('ascan', 'th', 0, 100, 10, 1.0)
- th = self.getObj('th')
- executor.prepareMacro('ascan', th, 0, 100, 10, 1.0)
-
- # a sequence of parameters:
- executor.prepareMacro(['ascan', 'th', '0', '100', '10', '1.0')
- executor.prepareMacro(('ascan', 'th', 0, 100, 10, 1.0))
- th = self.getObj('th')
- executor.prepareMacro(['ascan', th, 0, 100, 10, 1.0])
-
- # a space separated string of parameters:
- executor._prepareMacro('ascan th 0 100 10 1.0')
-
- :param args: the command parameters as explained above
- :param kwargs: keyword optional parameters for prepare
- :return:
- a sequence of two elements: the macro object and the result of
- preparing the macro"""
- # sync our log before calling the child macro prepare in order to avoid
- # mixed outputs between this macro and the child macro
- self.syncLog()
- init_opts = { 'parent_macro' : self }
- return self.executor.prepareMacro(args, init_opts, kwargs)
-
- @mAPI
- def runMacro(self, macro_obj):
- """**Macro API**. Runs the macro. This the lower level version of
- :meth:`~sardana.macroserver.macro.Macro.execMacro`. The method only
- returns after the macro is completed or an exception is thrown.
- It should be used instead of execMacro when some operation needs to
- be done between the macro preparation and the macro execution.
- Example::
-
- macro = self.prepareMacro("mymacro", "myparam")
- self.do_my_stuff_with_macro(macro)
- self.runMacro(macro)
-
- :param macro_obj: macro object
- :return: macro result"""
- # sync our log before calling the child macro prepare in order to avoid
- # mixed outputs between this macro and the child macro
- self.syncLog()
- return self.executor.runMacro(macro_obj)
-
- @mAPI
- def execMacroObj(self, name, *args, **kwargs):
- """**Macro API**. Execute a macro in this macro. The method only returns
- after the macro is completed or an exception is thrown. This is a
- higher level version of runMacro method. It is the same as::
-
- macro = self.prepareMacroObjs(name, *args, **kwargs)
- self.runMacro(macro)
- return macro
-
- :param name: name of the macro to be prepared
- :type name: str
- :param args: list of parameter objects
- :param kwargs: list of keyword parameters
-
- :return: a macro object"""
- self.debug("Executing macro: %s" % name)
- macro_obj, prepare_result = self.prepareMacroObj(name, *args, **kwargs)
- self.runMacro(macro_obj)
- return macro_obj
-
- @mAPI
- def execMacro(self, *args, **kwargs):
- """**Macro API**. Execute a macro in this macro. The method only
- returns after the macro is completed or an exception is thrown. Several
- different parameter formats are supported::
-
- # several parameters:
- self.execMacro('ascan', 'th', '0', '100', '10', '1.0')
- self.execMacro('ascan', 'th', 0, 100, 10, 1.0)
- th = self.getObj('th')
- self.execMacro('ascan', th, 0, 100, 10, 1.0)
-
- # a sequence of parameters:
- self.execMacro(['ascan', 'th', '0', '100', '10', '1.0')
- self.execMacro(('ascan', 'th', 0, 100, 10, 1.0))
- th = self.getObj('th')
- self.execMacro(['ascan', th, 0, 100, 10, 1.0])
-
- # a space separated string of parameters:
- self.execMacro('ascan th 0 100 10 1.0')
-
- :param pars: the command parameters as explained above
-
- :return: a macro object"""
- par0 = args[0]
- if len(args) == 1:
- if type(par0) in types.StringTypes :
- args = par0.split()
-
- elif operator.isSequenceType(par0):
- args = par0
- args = map(str, args)
-
- self.debug("Executing macro: %s" % args[0])
- macro_obj, prepare_result = self.prepareMacro(*args, **kwargs)
- self.runMacro(macro_obj)
- return macro_obj
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # taurus helpers
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def getTangoFactory(self):
- """**Macro API**. Helper method that returns the tango factory.
-
- :return: the tango factory singleton
- :rtype: :class:`~taurus.core.tango.TangoFactory`"""
- import taurus
- return taurus.Factory()
-
- @mAPI
- def getDevice(self, dev_name):
- """**Macro API**. Helper method that returns the device for the given
- device name
-
- :return: the taurus device for the given device name
- :rtype: :class:`~taurus.core.TaurusDevice`"""
- import taurus
- return taurus.Device(dev_name)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Handle parameter objects
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def setLogBlockStart(self):
- """**Macro API**. Specifies the begining of a block of data. Basically
- it outputs the 'BLOCK' tag"""
- self.output(Macro.BlockStart)
-
- @mAPI
- def setLogBlockFinish(self):
- """**Macro API**. Specifies the end of a block of data. Basically it
- outputs the '/BLOCK' tag"""
- self.output(Macro.BlockFinish)
-
- @mAPI
- def outputBlock(self, line):
- """**Macro API**. Sends an line tagged as a block to the output
-
- :param str line: line to be sent"""
- if isinstance(line, (str, unicode)):
- o = line
- elif operator.isSequenceType(line):
- o = "\n".join(line)
- else:
- o = str(line)
- self.output("%s\n%s\n%s" % (Macro.BlockStart, o, Macro.BlockFinish))
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Handle parameter objects
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- @mAPI
- def getPools(self):
- """**Macro API**. Returns the list of known device pools.
-
- :return: the list of known device pools
- :rtype: seq<Pool>"""
- return self.door.get_pools()
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Handle parameter objects
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def addObj(self, obj, priority=0):
- """**Macro API**. Adds the given object to the list of controlled
- objects of this macro. In practice it means that if a stop is
- executed the stop method of the given object will be called.
-
- :param obj: the object to be controlled
- :type obj: object
- :param priority:
- wheater or not reserve with priority [default: 0 meaning no
- priority ]
- :type priority: :obj:`int`"""
- self.executor.reserveObj(obj, self, priority=priority)
-
- @mAPI
- def addObjs(self, obj_list):
- """**Macro API**. Adds the given objects to the list of controlled
- objects of this macro. In practice it means that if a stop is
- executed the stop method of the given object will be called.
-
- :param obj_list: list of objects to be controlled
- :type obj_list: sequence"""
- for o in obj_list:
- self.addObj(o)
-
- def returnObj(self, obj):
- """Removes the given objects to the list of controlled objects of this
- macro.
-
- :param obj: object to be released from the control
- :rtype: object"""
- self.executor.returnObj(obj)
-
- @mAPI
- def getObj(self, name, type_class=All, subtype=All, pool=All, reserve=True):
- """**Macro API**. Gets the object of the given type belonging to the
- given pool with the given name. The object (if found) will automatically
- become controlled by the macro.
-
- :raises: MacroWrongParameterType if name is not a string
- :raises: AttributeError if more than one matching object is found
-
- :param name:
- string representing the name of the object. Can be a regular
- expression
- :type name: :obj:`str`
- :param type_class:
- the type of object [default: All]
- :param subtype:
- a string representing the subtype [default: All]
- Ex.: if type_class is Type.ExpChannel, subtype could be
- 'CTExpChannel'
- :param pool:
- the pool to which the object should belong [default: All]
- :param reserve:
- automatically reserve the object for this macro [default: True]
-
- :return: the object or None if no compatible object is found"""
- if not isinstance(name, (str, unicode)):
- raise self._buildWrongParamExp("getObj", "name", "string",
- str(type(name)))
-
- obj = self.door.get_object(name, type_class=type_class,
- subtype=subtype, pool=pool)
- if obj and reserve:
- self.addObj(obj)
- return obj
-
- @mAPI
- def getObjs(self, names, type_class=All, subtype=All, pool=All, reserve=True):
- """**Macro API**. Gets the objects of the given type belonging to the
- given pool with the given names. The objects (if found) will
- automatically become controlled by the macro.
-
- :param names: a string or a sequence of strings representing the
- names of the objects. Each string can be a regular
- expression
- :param type_class: the type of object (optional, default is All).
- Example: Type.Motor, Type.ExpChannel
- :param subtype: a string representing the subtype (optional,
- default is All)
- Ex.: if type_class is Type.ExpChannel, subtype could
- be 'CTExpChannel'
- :param pool: the pool to which the object should belong (optional,
- default is All)
- :param reserve: automatically reserve the object for this macro
- (optional, default is True)
-
- :return: a list of objects or empty list if no compatible object is
- found"""
- obj_list = self.door.get_objects(names, type_class=type_class,
- subtype=subtype, pool=pool)
- if reserve:
- self.addObjs(obj_list)
- return obj_list or []
-
- @mAPI
- def findObjs(self, names, type_class=All, subtype=All, pool=All,
- reserve=True):
- """**Macro API**. Gets the objects of the given type belonging to the
- given pool with the given names. The objects (if found) will
- automatically become controlled by the macro.
-
- :param names:
- a string or a sequence of strings representing the names of the
- objects. Each string can be a regular expression
- :param type_class: the type of object (optional, default is All)
- :param subtype:
- a string representing the subtype [default: All]
- Ex.: if type_class is Type.ExpChannel, subtype could be
- 'CTExpChannel'
- :param pool:
- the pool to which the object should belong [default: All]
- :param reserve:
- automatically reserve the object for this macro [default: True]
-
- :return:
- a list of objects or empty list if no compatible object is found"""
- obj_list = self.door.find_objects(names, type_class=type_class,
- subtype=subtype, pool=pool)
- if reserve:
- self.addObjs(obj_list)
- return obj_list
-
- @mAPI
- def getMacroNames(self):
- """**Macro API**. Returns a list of strings containing the names of all
- known macros
-
- :return: a sequence of macro names
- :rtype: seq<:obj:`str`\>"""
- return self.door.get_macro_names()
-
- @mAPI
- def getMacros(self, filter=None):
- """**Macro API**. Returns a sequence of
- :class:`~sardana.macroserver.msmetamacro.MacroClass`
- /:class:`~sardana.macroserver.msmetamacro.MacroFunction` objects for all
- known macros that obey the filter expression.
-
- :param filter:
- a regular expression for the macro name (optional, default is None
- meaning match all macros)
- :return:
- a sequence of :class:`~sardana.macroserver.msmetamacro.MacroClass`
- /:class:`~sardana.macroserver.msmetamacro.MacroFunction`
- objects
- :rtype: seq<:class:`~sardana.macroserver.msmetamacro.MacroClass`
- /:class:`~sardana.macroserver.msmetamacro.MacroFunction`\>"""
- ret = self.door.get_macros(filter=filter).values()
- ret.sort()
- return ret
-
- @mAPI
- def getMacroLibraries(self, filter=None):
- """**Macro API**. Returns a sequence of
- :class:`~sardana.macroserver.msmetamacro.MacroLibrary` objects for all
- known macros that obey the filter expression.
-
- :param filter:
- a regular expression for the macro library [default: None meaning
- match all macro libraries)
- :return:
- a sequence of :class:`~sardana.macroserver.msmetamacro.MacroLibrary`
- objects
- :rtype: seq<:class:`~sardana.macroserver.msmetamacro.MacroLibrary`\>"""
- ret = self.door.get_macro_libs(filter=filter).values()
- ret.sort()
- return ret
-
- @mAPI
- def getMacroLibrary(self, lib_name):
- """**Macro API**. Returns a
- :class:`~sardana.macroserver.msmetamacro.MacroLibrary` object for the
- given library name.
-
- :param lib_name:
- library name
- :type lib_name: str
- :return:
- a macro library :class:`~sardana.macroserver.msmetamacro.MacroLibrary`
- :rtype: :class:`~sardana.macroserver.msmetamacro.MacroLibrary`"""
- ret = self.door.get_macro_lib(lib_name)
- return ret
-
- getMacroLib = getMacroLibrary
- getMacroLibs = getMacroLibraries
-
- @mAPI
- def getMacroInfo(self, macro_name):
- """**Macro API**. Returns the corresponding
- :class:`~sardana.macroserver.msmetamacro.MacroClass`
- /:class:`~sardana.macroserver.msmetamacro.MacroFunction` object.
-
- :param macro_name: a string with the desired macro name.
- :type macro_name: :obj:`str`
- :return:
- a :class:`~sardana.macroserver.msmetamacro.MacroClass`
- /:class:`~sardana.macroserver.msmetamacro.MacroFunction` object or
- None if the macro with the given name was not found
- :rtype: :class:`~sardana.macroserver.msmetamacro.MacroClass`
- /:class:`~sardana.macroserver.msmetamacro.MacroFunction`"""
- return self.door.get_macro(macro_name)
-
- @mAPI
- def getMotion(self, elems, motion_source=None, read_only=False, cache=True):
- """**Macro API**. Returns a new Motion object containing the given
- elements.
-
- :raises:
- Exception if no elements are defined or the elems is not recognized
- as valid, or an element is not found or an element appears more
- than once
-
- :param elems: list of moveable object names
- :param motion_source:
- obj or list of objects containing moveable elements. Usually this
- is a Pool object or a list of Pool objects (optional, default is
- None, meaning all known pools will be searched for the given
- moveable items
- :param read_only: not used. Reserved for future use
- :param cache: not used. Reserved for future use
-
- :return: a Motion object """
-
- decoupled=False
- try:
- decoupled = self.getEnv("MotionDecoupled")
- except UnknownEnv:
- pass
-
- motion = self.door.get_motion(elems, motion_source=motion_source,
- read_only=read_only, cache=cache,
- decoupled=decoupled)
- if motion is not None:
- self.addObj(motion, priority=1)
- return motion
-
- @mAPI
- def getElementsWithInterface(self, interface):
- return self.door.get_elements_with_interface(interface)
-
- @mAPI
- def getControllers(self):
- return self.door.get_controllers()
-
- @mAPI
- def getMoveables(self):
- return self.door.get_moveables()
-
- @mAPI
- def getMotors(self):
- return self.door.get_motors()
-
- @mAPI
- def getPseudoMotors(self):
- return self.door.get_pseudo_motors()
-
- @mAPI
- def getIORegisters(self):
- return self.door.get_io_registers()
-
- @mAPI
- def getMeasurementGroups(self):
- return self.door.get_measurement_groups()
-
- @mAPI
- def getExpChannels(self):
- return self.door.get_exp_channels()
-
- @mAPI
- def getCounterTimers(self):
- return self.door.get_counter_timers()
-
- @mAPI
- def get0DExpChannels(self):
- return self.door.get_0d_exp_channels()
-
- @mAPI
- def get1DExpChannels(self):
- return self.door.get_1d_exp_channels()
-
- @mAPI
- def get2DExpChannels(self):
- return self.door.get_2d_exp_channels()
-
- @mAPI
- def getPseudoCounters(self):
- return self.door.get_pseudo_counters()
-
- @mAPI
- def getInstruments(self):
- return self.door.get_instruments()
-
- @mAPI
- def getElementWithInterface(self, interface, name):
- return self.door.get_element_with_interface(interface, name)
-
- @mAPI
- def getController(self, name):
- return self.door.get_controller(name)
-
- @mAPI
- def getMoveable(self, name):
- return self.door.get_moveable(name)
-
- @mAPI
- def getMotor(self, name):
- return self.door.get_motor(name)
-
- @mAPI
- def getPseudoMotor(self, name):
- return self.door.get_pseudo_motor(name)
-
- @mAPI
- def getIORegister(self, name):
- return self.door.get_io_register(name)
-
- @mAPI
- def getMeasurementGroup(self, name):
- return self.door.get_measurement_group(name)
-
- @mAPI
- def getExpChannel(self, name):
- return self.door.get_exp_channel(name)
-
- @mAPI
- def getCounterTimer(self, name):
- return self.door.get_counter_timer(name)
-
- @mAPI
- def get0DExpChannel(self, name):
- return self.door.get_0d_exp_channel(name)
-
- @mAPI
- def get1DExpChannel(self, name):
- return self.door.get_1d_exp_channel(name)
-
- @mAPI
- def get2DExpChannel(self, name):
- return self.door.get_2d_exp_channel(name)
-
- @mAPI
- def getPseudoCounter(self, name):
- return self.door.get_pseudo_counter(name)
-
- @mAPI
- def getInstrument(self, name):
- return self.door.get_instrument(name)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Handle macro environment
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def getEnv(self, key=None, macro_name=None, door_name=None):
- """**Macro API**. Gets the local environment matching the given
- parameters:
-
- - door_name and macro_name define the context where to look for
- the environment. If both are None, the global environment is
- used. If door name is None but macro name not, the given macro
- environment is used and so on...
- - If key is None it returns the complete environment, otherwise
- key must be a string containing the environment variable name.
-
- :raises: UnknownEnv
-
- :param key:
- environment variable name [default: None, meaning all environment]
- :type key: str
- :param door_name:
- local context for a given door [default: None, meaning no door
- context is used]
- :type door_name: str
- :param macro_name:
- local context for a given macro [default: None, meaning no macro
- context is used]
- :type macro_name: str
-
- :return: a :obj:`dict` containing the environment
- :rtype: :obj:`dict`"""
- door_name = door_name or self.getDoorName()
- macro_name = macro_name or self._name
-
- return self.macro_server.get_env(key=key, macro_name=macro_name,
- door_name=door_name)
-
- @mAPI
- def getGlobalEnv(self):
- """**Macro API**. Returns the global environment.
-
- :return: a :obj:`dict` containing the global environment
- :rtype: :obj:`dict`"""
- return self.macro_server.get_env()
-
- @mAPI
- def getAllEnv(self):
- """**Macro API**. Returns the enviroment for the macro.
-
- :return: a :obj:`dict` containing the environment for the macro
- :rtype: :obj:`dict`"""
- return self.getEnv(None)
-
- @mAPI
- def getAllDoorEnv(self):
- """**Macro API**. Returns the enviroment for the door where the macro
- is running.
-
- :return: a :obj:`dict` containing the environment
- :rtype: :obj:`dict`"""
- return self.door.get_env()
-
- @mAPI
- def setEnv(self, key, value):
- """**Macro API**. Sets the environment key to the new value and
- stores it persistently.
-
- :return: a :obj:`tuple` with the key and value objects stored
- :rtype: :obj:`tuple`\<:obj:`str`\, object>"""
- return self.door.set_env(key, value)
-
- @mAPI
- def unsetEnv(self, key):
- """**Macro API**. Unsets the given environment variable.
-
- :param key: the environment variable name
- :type key: :obj:`str`"""
- return self.macro_server.unset_env(key)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Reload API
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- @mAPI
- def reloadLibrary(self, lib_name):
- """**Macro API**. Reloads the given library(=module) names
-
- :raises: ImportError in case the reload process is not
- successfull
-
- :param lib_name: library(=module) name
- :type lib_name: :obj:`str`
-
- :return:
- the reloaded python module object"""
- return self.door.reload_lib(lib_name)
-
- @mAPI
- def reloadMacro(self, macro_name):
- """**Macro API**. Reloads the module corresponding to the given macro
- name
-
- :raises: MacroServerExceptionList in case the macro is unknown or the
- reload process is not successfull
-
- :param macro_name: macro name
- :type macro_name: :obj:`str`"""
- return self.door.reload_macro(macro_name)
-
- @mAPI
- def reloadMacros(self, macro_names):
- """**Macro API**. Reloads the modules corresponding to the given macro
- names.
-
- :raises: MacroServerExceptionList in case the macro(s) are unknown or
- the reload process is not successfull
-
- :param macro_names: a list of macro names
- :type macro_names: sequence<:obj:`str`\>"""
- return self.reload_macros(macro_names)
-
- @mAPI
- def reloadMacroLibrary(self, lib_name):
- """**Macro API**. Reloads the given library(=module) names
-
- :raises: MacroServerExceptionList in case the reload process is not
- successfull
-
- :param lib_name: library(=module) name
- :type lib_name: :obj:`str`
-
- :return:
- the :class:`~sardana.macroserver.metamacro.MacroLibrary` for the
- reloaded library
- :rtype: :class:`~sardana.macroserver.metamacro.MacroLibrary`"""
- return self.door.reload_macro_lib(lib_name)
-
- @mAPI
- def reloadMacroLibraries(self, lib_names):
- """**Macro API**. Reloads the given library(=module) names
-
- :raises: MacroServerExceptionList in case the reload process is not
- successfull for at least one lib
-
- param lib_names: a list of library(=module) names
- :type lib_name: seq<:obj:`str`\>
-
- :return:
- a sequence of :class:`~sardana.macroserver.metamacro.MacroLibrary`
- objects for the reloaded libraries
- :rtype: seq<:class:`~sardana.macroserver.metamacro.MacroLibrary`\>"""
- return self.door.reload_macro_libs(lib_names)
-
- reloadMacroLib = reloadMacroLibrary
- reloadMacroLibs = reloadMacroLibraries
-
- @mAPI
- def getViewOption(self, name):
- return self._getViewOption(name)
-
- @mAPI
- def getViewOptions(self):
- return self._getViewOptions()
-
- @mAPI
- def setViewOption(self, name, value):
- vo = self._getViewOptions()
- vo[name] = value
- self.setEnv('_ViewOptions', vo)
-
- @mAPI
- def resetViewOption(self, name):
- vo = self._getViewOptions()
- ViewOption.reset_option(vo, name)
- self.setEnv('_ViewOptions', vo)
- return vo.get(name)
-
- #@}
-
- ## @name Unofficial Macro API
- # This list contains the set of methods that are <b>NOT</b> part of the
- # the macro developer knows what he is doing.
- # Please check before is there is an official API that does the samething
- # before executing any of these methods.
- # If you see that your macro needs to execute any of these methods please
- # consider informing the MacroServer developer so he may expose this in a
- # safe way.
- #@{
-
- def _getViewOptions(self):
- '''Gets _ViewOption dictionary. If it is not defined in the environment,
- sets it with the default values dictionary and returns it.
- '''
- try:
- vo = self.getEnv('_ViewOptions')
- except UnknownEnv:
- vo = ViewOption.init_options(dict())
- self.setEnv('_ViewOptions', vo)
- return vo
-
- def _getViewOption(self, name):
- '''Gets _ViewOption of a given name. If it is not defined in
- the environment, sets it to a default value and returns it.
- '''
- view_options = self._getViewOptions()
- if not view_options.has_key(name):
- ViewOption.reset_option(view_options, name)
- self.setEnv('_ViewOptions', view_options)
- return view_options[name]
-
- def _input(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- If args is present, it is written to standard output without a trailing
- newline. The function then reads a line from input, converts it to a
- string (stripping a trailing newline), and returns that.
-
- Depending on which type of application you are running, some of the
- keywords may have no effect (ex.: spock ignores decimals when a number
- is asked).
-
- Recognized kwargs:
-
- - data_type : [default: Type.String] specific input type. Can also
- specify a sequence of strings with possible values (use
- allow_multiple=True to say multiple values can be selected)
- - key : [default: no default] variable/label to assign to this input
- - unit: [default: no default] units (useful for GUIs)
- - timeout : [default: None, meaning wait forever for input]
- - default_value : [default: None, meaning no default value]
- When given, it must be compatible with data_type
- - allow_multiple : [default: False] in case data_type is a
- sequence of values, allow multiple selection
- - minimum : [default: None] When given, must be compatible with data_type (useful for GUIs)
- - maximum : [default: None] When given, must be compatible with data_type (useful for GUIs)
- - step : [default: None] When given, must be compatible with data_type (useful for GUIs)
- - decimals : [default: None] When given, must be compatible with data_type (useful for GUIs)
-
- Examples::
-
- device_name = self.input("Which device name (%s)?", "tab separated")
-
- point_nb = self.input("How many points?", data_type=Type.Integer)
-
- calc_mode = self.input("Which algorithm?", data_type=["Average", "Integral", "Sum"],
- default_value="Average", allow_multiple=False)"""
- if not self.interactive:
- self.warning("Non interactive macro '%s' is asking for input "
- "(please set this macro interactive to True)",
- self.getName())
- if self._interactive_mode:
- kwargs['data_type'] = kwargs.get('data_type', Type.String)
- kwargs['allow_multiple'] = kwargs.get('allow_multiple', False)
- kwargs['macro_id'] = self.getID()
- kwargs['macro_name'] = self.getName()
- kwargs['macro'] = self
- return self.getDoorObj().input(msg, *args, **kwargs)
- else:
- if 'default_value' not in kwargs:
- if 'key' not in kwargs:
- self.warning("%s running in non attended mode was asked "
- "for input without default value or key. "
- "Returning None")
- return None
- else:
- return self.getEnv(kwargs['key'])
- return kwargs['default_value']
-
- def _output(self, msg, *args, **kwargs):
- """**Macro API**.
- Record a log message in this object's output. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.log`.
- Example::
-
- self.output("this is a print for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.output(self, msg, *args, **kwargs)
-
- def _log(self, level, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record a log message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.log`.
- Example::
-
- self.debug(logging.INFO, "this is a info log message for macro %s", self.getName())
-
- :param level: the record level
- :type level: :obj:`int`
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.log(self, level, msg, *args, **kwargs)
-
- def _debug(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record a debug message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.debug`.
- Example::
-
- self.debug("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kw: list of keyword arguments"""
- return Logger.debug(self, msg, *args, **kwargs)
-
- def _info(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record an info message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.info`.
- Example::
-
- self.info("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.info(self, msg, *args, **kwargs)
-
- @mAPI
- def _warning(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record a warning message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.warning`.
- Example::
-
- self.warning("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.warning(self, msg, *args, **kwargs)
-
- def _error(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record an error message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.error`.
- Example::
-
- self.error("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments
- """
- return Logger.error(self, msg, *args, **kwargs)
-
- def _critical(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record a critical message in this object's logger. Accepted *args* and
- *kwargs* are the same as :meth:`logging.Logger.critical`.
- Example::
-
- self.critical("this is a log message for macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return Logger.critical(self, msg, *args, **kwargs)
-
- def _trace(self, msg, *args, **kwargs):
- """**Unofficial Macro API**. Record a trace message in this object's logger.
-
- :param msg: (str) the message to be recorded
- :param args: list of arguments
- :param kw: list of keyword arguments"""
- return Logger.trace(self, msg, *args, **kwargs)
-
- def _traceback(self, *args, **kwargs):
- """**Unofficial Macro API**.
- Logs the traceback with level TRACE on the macro logger."""
- return Logger.traceback(self, *args, **kwargs)
-
- def _stack(self, *args, **kwargs):
- """**Unofficial Macro API**.
- Logs the stack with level TRACE on the macro logger."""
- return Logger.stack(self, *args, **kwargs)
-
- def _report(self, msg, *args, **kwargs):
- """**Unofficial Macro API**.
- Record a log message in the sardana report (if enabled) with default
- level **INFO**. The msg is the message format string, and the args are
- the arguments which are merged into msg using the string formatting
- operator. (Note that this means that you can use keywords in the
- format string, together with a single dictionary argument.)
-
- *kwargs* are the same as :meth:`logging.Logger.debug` plus an optional
- level kwargs which has default value **INFO**
-
- Example::
-
- self.report("this is an official report of macro %s", self.getName())
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return self.door.report(msg, *args, **kwargs)
-
- @property
- def executor(self):
- """**Unofficial Macro API**. Alternative to :meth:`getExecutor` that
- does not throw StopException in case of a Stop. This should be
- called only internally"""
- return self._executor
-
- @property
- def door(self):
- """**Unofficial Macro API**. Alternative to :meth:`getDoorObj` that
- does not throw StopException in case of a Stop. This should be
- called only internally"""
- return self.executor.getDoor()
-
- @property
- def parent_macro(self):
- """**Unofficial Macro API**. Alternative to getParentMacro that does not
- throw StopException in case of a Stop. This should be called only
- internally by the *Executor*"""
- return self._parent_macro
-
- @property
- def description(self):
- """**Unofficial Macro API**. Alternative to :meth:`getDescription` that
- does not throw StopException in case of a Stop. This should be
- called only internally by the *Executor*"""
- return self._desc
-
- def isAborted(self):
- """**Unofficial Macro API**."""
- return self._aborted
-
- def isStopped(self):
- """**Unofficial Macro API**."""
- return self._stopped
-
- def isPaused(self):
- """**Unofficial Macro API**."""
- return self._pause_event.isPaused()
-
- @classmethod
- def hasResult(cls):
- """**Unofficial Macro API**. Returns True if the macro should return
- a result or False otherwise
-
- :return: True if the macro should return a result or False otherwise
- :rtype: bool
- """
- return len(cls.result_def) > 0
-
- def getResult(self):
- """**Unofficial Macro API**. Returns the macro result object (if any)
-
- :return: the macro result object or None"""
- return self._out_pars
-
- def setResult(self, result):
- """**Unofficial Macro API**. Sets the result of this macro
-
- :param result: (object) the result for this macro"""
- self._out_pars = result
-
- ## @name Internal methods
- # This list contains the set of methods that are for INTERNAL macro usage.
- # Macro developers should never call any of these methods
- #@{
-
- @staticmethod
- def _buildWrongParamExp(method_name, param_name, expected, found):
- """**Internal method**. """
- s = "Macro.%s called with wrong parameter type in '%s'. " \
- "Expected %s got %s" % (method_name, param_name, expected, found)
- return MacroWrongParameterType(s)
-
- def _getName(self):
- """**Internal method**. """
- return self._name
-
- def _getDescription(self):
- """**Internal method**. """
- return self._desc
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Macro execution methods
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def _getMacroStatus(self):
- """**Internal method**.
- Returns the current macro status. Macro status is a :obj:`dict` where
- keys are the strings:
-
- * *id* - macro ID (internal usage only)
- * *range* - the full progress range of a macro (usually a
- :obj:`tuple` of two numbers (0, 100))
- * *state* - the current macro state, a string which can have values
- *start*, *step*, *stop* and *abort*
- * *step* - the current step in macro. Should be a value inside the
- allowed macro range
-
- :return: the macro status
- :rtype: :obj:`dict`"""
- return self._macro_status
-
- def _shouldRaiseStopException(self):
- return self.isStopped() and not self.isProcessingStop()
-
- def _reserveObjs(self, args):
- """**Internal method**. Used to reserve a set of objects for this
- macro"""
- for obj in args:
- # isiterable
- if not type(obj) in map(type,([],())):
- #if not operator.isSequenceType(obj) or type(obj) in types.StringTypes:
- obj = (obj,)
- for sub_obj in obj:
- if isinstance(sub_obj, PoolElement):
- self.addObj(sub_obj)
-
- def exec_(self):
- """**Internal method**. Execute macro as an iterator"""
- self._macro_thread = threading.current_thread()
- macro_status = self.getMacroStatus()
-
- # make sure a 0.0 progress is sent
- yield macro_status
-
- # allow any macro to be paused at the beginning of its execution
- self.pausePoint()
-
- # Run the macro or obtain a generator
- res = self.run(*self._in_pars)
-
- # If macro returns a generator then running the macro means go through
- # the generator steps, otherwise the macro has already ran
- if type(res) == types.GeneratorType:
- it = iter(res)
- for i in it:
- if operator.isMappingType(i):
- new_range = i.get('range')
- if new_range is not None:
- macro_status['range'] = new_range
- new_step = i.get('step')
- if new_step is not None:
- macro_status['step'] = new_step
- elif operator.isNumberType(i):
- macro_status['step'] = i
- macro_status['state'] = 'step'
- yield macro_status
- # make sure a 'stop' progress is sent in case an exception occurs
- macro_status['state'] = 'stop'
- else:
- self._out_pars = res
- macro_status['step'] = 100.0
- macro_status['state'] = 'finish'
- yield macro_status
-
- def __prepareResult(self,out):
- """**Internal method**. Decodes the given output in order to be able to
- send to the result channel
-
- :param out: output value
-
- :return: the output as a sequence of strings
- """
- if out is None:
- out = ()
- if operator.isSequenceType(out) and not type(out) in types.StringTypes:
- out = map(str,out)
- else:
- out = (str(out),)
- return out
-
- def _stopOnError(self):
- """**Internal method**. The stop procedure. Calls the user 'on_abort'
- protecting it against exceptions"""
- try:
- self.on_stop()
- except Exception:
- Logger.error(self, "Error in on_stop(): %s", traceback.format_exc())
- Logger.debug(self, "Details: ", exc_info=1)
-
- def _abortOnError(self):
- """**Internal method**. The stop procedure. Calls the user 'on_abort'
- protecting it against exceptions"""
- try:
- self.on_abort()
- except Exception:
- Logger.error(self, "Error in on_abort(): %s", traceback.format_exc())
- Logger.debug(self, "Details: ", exc_info=1)
-
- def _pausePoint(self, timeout=None):
- """**Internal method**."""
- if self._pause_event.isPaused():
- self.on_pause()
- self._pause_event.wait(timeout)
-
- def stop(self):
- """**Internal method**. Activates the stop flag on this macro."""
- self._stopped = True
-
- def abort(self):
- """**Internal method**. Aborts the macro abruptly."""
- # carefull: Inside this method never call a method that has the
- # mAPI decorator
- Logger.debug(self, "Aborting...")
- self._aborted = True
- ret, i = 0, 0
- while ret != 1:
- self.__resumeForAbort()
- th = self._macro_thread
- th_id = ctypes.c_long(th.ident)
- Logger.debug(self, "Sending AbortException to %s", th.name)
- ret = asyncexc(th_id, ctypes.py_object(AbortException))
- i += 1
- if ret == 0:
- # try again
- if i > 2:
- self.error("Failed to abort after three tries!")
- break
- time.sleep(0.1)
- if ret > 1:
- # if it returns a number greater than one, you're in trouble,
- # and you should call it again with exc=NULL to revert the effect
- asyncexc(th_id, None)
- Logger.error(self, "Failed to abort (unknown error code %d)" % ret)
- break
-
- def setProcessingStop(self, yesno):
- """**Internal method**. Activates the processing stop flag on this
- macro"""
- self._processingStop = yesno
-
- def isProcessingStop(self):
- """**Internal method**. Checks if this macro is processing stop"""
- return self._processingStop
-
- def pause(self, cb=None):
- """**Internal method**. Pauses the macro execution. To be called by the
- Door running the macro to pause the current macro"""
- self._pause_event.pause(cb=cb)
-
- def resume(self, cb=None):
- """**Internal method**. Resumes the macro execution. To be called by
- the Door running the macro to resume the current macro"""
- self._pause_event.resume(cb=cb)
-
- def __resumeForAbort(self):
- """Called internally to resume the macro execution in case of an abort.
- The macro is resumed but instead of allowing the next user instruction
- to proceed it just waits for an ashyncronous AbortException to be
- thrown"""
- self._pause_event.resumeForAbort()
-
- #@}
-
- def __getattr__(self, name):
- try:
- self.door.get_macro(name)
- except UnknownMacro:
- raise AttributeError("%r object has no attribute %r" %
- (type(self).__name__, name))
- def f(*args, **kwargs):
- self.syncLog()
- opts = dict(parent_macro=self, executor=self.executor)
- kwargs.update(opts)
- eargs = [name]
- eargs.extend(args)
- return self.execMacro(*eargs, **kwargs)
-
- setattr(self, name, f)
- return f
-
-
-class iMacro(Macro):
-
- interactive = True
-
-
-class MacroFunc(Macro):
-
- def __init__(self, *args, **kwargs):
- function = kwargs['function']
- self._function = function
- kwargs['as'] = self._function.func_name
- if function.param_def is not None:
- self.param_def = function.param_def
- if function.result_def is not None:
- self.result_def = function.result_def
- if function.env is not None:
- self.env = function.env
- if function.hints is not None:
- self.hints = function.hints
- if function.interactive is not None:
- self.interactive = function.interactive
- Macro.__init__(self, *args, **kwargs)
-
- def run(self, *args):
- return self._function(self, *args)
-
diff --git a/src/sardana/macroserver/macro_template.txt b/src/sardana/macroserver/macro_template.txt
deleted file mode 100644
index 0aa45ce9..00000000
--- a/src/sardana/macroserver/macro_template.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-@macro()
-def @macro_name@(self):
- """Macro @macro_name@"""
- self.output("Running @macro_name@...")
-
-
diff --git a/src/sardana/macroserver/macros/__init__.py b/src/sardana/macroserver/macros/__init__.py
deleted file mode 100644
index e5599a8d..00000000
--- a/src/sardana/macroserver/macros/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package contains the standard macroserver macros"""
-
-__docformat__ = 'restructuredtext'
-
-
diff --git a/src/sardana/macroserver/macros/communication.py b/src/sardana/macroserver/macros/communication.py
deleted file mode 100644
index cac68e74..00000000
--- a/src/sardana/macroserver/macros/communication.py
+++ /dev/null
@@ -1,62 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the standard macro module"""
-
-__docformat__ = 'restructuredtext'
-
-__all__ = ["get", "put"]
-
-from sardana.macroserver.macro import *
-
-import array
-
-class put(Macro):
- """Sends a string to the communication channel"""
- param_def = [
- ['communication channel', Type.ComChannel, None, 'the communication channel'],
- ['data', Type.String, None, 'data to be sent']
- ]
-
- def run(self, comch, data):
- name = comch.getName()
- nb = comch.write(data)
- o = str(nb) + " bytes sent to " + name
- self.output(o)
-
-
-class get(Macro):
- """Reads and outputs the data from the communication channel"""
-
- param_def = [
- ['communication channel', Type.ComChannel, None, 'the communication channel'],
- ['maximum length', Type.String, -1, 'maximum number of bytes to read']
- ]
-
- def run(self, comch, maxlen):
- name = comch.getName()
- data = comch.command_inout("read",maxlen)
-
- datastr = array.array('B',data).tostring()
- self.output("'" + datastr + "'")
- self.output(data) \ No newline at end of file
diff --git a/src/sardana/macroserver/macros/demo.py b/src/sardana/macroserver/macros/demo.py
deleted file mode 100644
index 038c1ce8..00000000
--- a/src/sardana/macroserver/macros/demo.py
+++ /dev/null
@@ -1,171 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the standard macro module"""
-
-from __future__ import print_function
-
-__all__ = ["sar_demo"]
-
-import PyTango
-
-from sardana.macroserver.macro import macro, Type
-
-_ENV = "_SAR_DEMO"
-
-def get_free_names(db, prefix, nb, start_at=1):
- ret = []
- i = start_at
- failed = 96
- while len(ret) < nb and failed > 0:
- name = "%s%02d" % (prefix, i)
- try:
- db.get_device_alias(name)
- failed -= 1
- except:
- ret.append(name)
- i += 1
- if len(ret) < nb or failed == 0:
- raise Exception("Too many sardana demos registered on this system.\n"
- "Please try using a different tango system")
- return ret
-
-@macro()
-def clear_sar_demo(self):
- """Undoes changes done with sar_demo"""
- try:
- SAR_DEMO = self.getEnv(_ENV)
- except:
- self.error("No demo has been prepared yet on this sardana!")
- return
-
- self.print("Removing measurement groups...")
- for mg in SAR_DEMO.get("measurement_groups", ()):
- self.udefmeas(mg)
-
- self.print("Removing elements...")
- for elem in SAR_DEMO.get("elements", ()):
- self.udefelem(elem)
-
- self.print("Removing controllers...")
- for ctrl in SAR_DEMO.get("controllers", ()):
- self.udefctrl(ctrl)
-
- self.unsetEnv(_ENV)
-
- self.print("DONE!")
-
-@macro()
-def sar_demo(self):
- """Sets up a demo environment. It creates many elements for testing"""
-
- try:
- SAR_DEMO = self.getEnv(_ENV)
- self.error("A demo has already been prepared on this sardana")
- return
- except:
- pass
-
- db = PyTango.Database()
-
- mot_ctrl_name = get_free_names(db, "motctrl", 1)[0]
- ct_ctrl_name = get_free_names(db, "ctctrl", 1)[0]
- zerod_ctrl_name = get_free_names(db, "zerodctrl", 1)[0]
- oned_ctrl_name = get_free_names(db, "onedctrl", 1)[0]
- twod_ctrl_name = get_free_names(db, "twodctrl", 1)[0]
- pm_ctrl_name = get_free_names(db, "slitctrl", 1)[0]
-
- motor_names = get_free_names(db, "mot", 4)
- ct_names = get_free_names(db, "ct", 4)
- zerod_names = get_free_names(db, "zerod", 4)
- oned_names = get_free_names(db, "oned", 1)
- twod_names = get_free_names(db, "twod", 1)
- gap, offset = get_free_names(db, "gap", 1) + get_free_names(db, "offset", 1)
-
- mg_name = get_free_names(db, "mntgrp", 1)[0]
-
- pools = self.getPools()
- if not len(pools):
- self.error('This is not a valid sardana demonstration system.\n'
- 'Sardana demonstration systems must be connect to at least '
- 'one Pool')
- return
- pool = pools[0]
-
- self.print("Creating motor controller", mot_ctrl_name, "...")
- self.defctrl("DummyMotorController", mot_ctrl_name)
- for axis, motor_name in enumerate(motor_names, 1):
- self.print("Creating motor", motor_name, "...")
- self.defelem(motor_name , mot_ctrl_name, axis)
-
- self.print("Creating counter controller", ct_ctrl_name, "...")
- self.defctrl("DummyCounterTimerController", ct_ctrl_name)
- for axis, ct_name in enumerate(ct_names, 1):
- self.print("Creating counter channel", ct_name, "...")
- self.defelem(ct_name , ct_ctrl_name, axis)
-
- self.print("Creating 0D controller", zerod_ctrl_name, "...")
- self.defctrl("DummyZeroDController", zerod_ctrl_name)
- for axis, zerod_name in enumerate(zerod_names, 1):
- self.print("Creating 0D channel", zerod_name, "...")
- self.defelem(zerod_name , zerod_ctrl_name, axis)
-
- self.print("Creating 1D controller", oned_ctrl_name, "...")
- self.defctrl("DummyOneDController", oned_ctrl_name)
- for axis, oned_name in enumerate(oned_names, 1):
- self.print("Creating 1D channel", oned_name, "...")
- self.defelem(oned_name , oned_ctrl_name, axis)
-
- self.print("Creating 2D controller", twod_ctrl_name, "...")
- self.defctrl("DummyTwoDController", twod_ctrl_name)
- for axis, twod_name in enumerate(twod_names, 1):
- self.print("Creating 2D channel", twod_name, "...")
- self.defelem(twod_name , twod_ctrl_name, axis)
-
- self.print("Creating Slit", pm_ctrl_name, "with", gap, ",", offset, "...")
- sl2t, sl2b = motor_names[:2]
- self.defctrl("Slit", pm_ctrl_name, "sl2t="+sl2t, "sl2b="+sl2b,
- "Gap="+gap, "Offset="+offset)
-
- self.print("Creating measurement group", mg_name, "...")
- self.defmeas(mg_name, *ct_names)
-
- controllers = pm_ctrl_name, mot_ctrl_name, ct_ctrl_name, \
- zerod_ctrl_name, oned_ctrl_name, twod_ctrl_name
- elements = [gap, offset] + motor_names + ct_names + \
- zerod_names + oned_names + twod_names
- d = dict(controllers=controllers, elements=elements,
- measurement_groups=[mg_name])
-
- self.setEnv(_ENV, d)
-
- self.print("DONE!")
-
-@macro([["motor", Type.Moveable, None, '']])
-def mym2(self, pm):
- self.output(pm.getMotorNames())
- elements = map(self.getMoveable, pm.elements)
- self.output(elements)
- self.output(type(pm))
- self.output(type(elements[0]))
-
diff --git a/src/sardana/macroserver/macros/env.py b/src/sardana/macroserver/macros/env.py
deleted file mode 100644
index 9ba1dfe6..00000000
--- a/src/sardana/macroserver/macros/env.py
+++ /dev/null
@@ -1,288 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Environment related macros"""
-
-__all__ = ["dumpenv", "load_env", "lsenv", "senv", "usenv"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.console.list import List
-from sardana.macroserver.macro import *
-
-################################################################################
-#
-# Environment related macros
-#
-################################################################################
-
-from lxml import etree
-
-def reprValue(v, max=74):
- # cut long strings
- v = str(v)
- if len(v) > max:
- v = v[:max] + ' [...]'
- return v
-
-
-class dumpenv(Macro):
- """Dumps the complete environment"""
-
- def run(self):
- env = self.getGlobalEnv()
- out = List(['Name','Value','Type'])
- for k,v in env.iteritems():
- str_v = reprValue(v)
- type_v = type(v).__name__
- out.appendRow([str(k), str_v, type_v])
-
- for line in out.genOutput():
- self.output(line)
-
-
-class lsvo(Macro):
- """Lists the view options"""
- def run(self):
- vo = self.getViewOptions()
- out = List(['View option', 'Value'])
- for key, value in vo.items():
- out.appendRow([key, str(value)])
-
- for line in out.genOutput():
- self.output(line)
-
-
-class setvo(Macro):
- """Sets the given view option to the given value"""
-
- param_def = [['name', Type.String, None, 'View option name'],
- ['value', Type.String, None, 'View option value']]
-
- def run(self, name, value):
- try:
- value = eval(value)
- except:
- pass
- self.setViewOption(name, value)
-
-
-class usetvo(Macro):
- """Resets the value of the given view option"""
-
- param_def = [['name', Type.String, None, 'View option name']]
-
- def run(self, name):
- self.resetViewOption(name)
-
-
-class lsenv(Macro):
- """Lists the environment in alphabetical order"""
-
- param_def = [
- ['macro_list',
- ParamRepeat(['macro', Type.MacroClass, None, 'macro name'], min=0),
- None, 'List of macros to show environment'],
- ]
-
- def prepare(self, *macro_list, **opts):
- self.table_opts = opts
-
- def run(self, *macro_list):
- # list the environment for the current door
- if len(macro_list) == 0:
- # list All the environment for the current door
- out = List(['Name', 'Value', 'Type'])
- env = self.getAllDoorEnv()
- names_list = list(env.keys())
- names_list.sort(key=str.lower)
- for k in names_list:
- str_val = self.reprValue(env[k])
- type_name = type(env[k]).__name__
- out.appendRow([k, str_val, type_name])
- # list the environment for the current door for the given macros
- else:
- out = List(['Macro', 'Name', 'Value', 'Type'])
- for macro in macro_list:
- env = self.getEnv(key=None, macro_name=macro.name)
- names_list = list(env.keys())
- names_list.sort(key=str.lower)
- for k in names_list:
- str_val = self.reprValue(env[k])
- type_name = type(env[k]).__name__
- out.appendRow([macro.name, k, str_val, type_name])
-
- for line in out.genOutput():
- self.output(line)
-
- def reprValue(self, v, max=54):
- # cut long strings
- v = str(v)
- if len(v) > max: v = '%s [...]' % v[:max]
- return v
-
-class senv(Macro):
- """Sets the given environment variable to the given value"""
-
- param_def = [['name', Type.Env, None,
- 'Environment variable name. Can be one of the following:\n' \
- ' - <name> - global variable\n' \
- ' - <full door name>.<name> - variable value for a specific door\n' \
- ' - <macro name>.<name> - variable value for a specific macro\n' \
- ' - <full door name>.<macro name>.<name> - variable value for a specific macro running on a specific door'],
- ['value_list',
- ParamRepeat(['value', Type.String, None, 'environment value item'], min=1),
- None, 'value(s). one item will eval to a single element. More than one item will eval to a tuple of elements'],
- ]
-
- def run(self, env, *value):
- if len(value) == 1:
- value = value[0]
- else:
- value = '(%s)' % ', '.join(value)
- k,v = self.setEnv(env, value)
- line = '%s = %s' % (k, str(v))
- self.output(line)
-
-class usenv(Macro):
- """Unsets the given environment variable"""
- param_def = [
- ['environment_list',
- ParamRepeat(['env', Type.Env, None, 'Environment variable name'], min=1),
- None, 'List of environment items to be removed'],
- ]
-
- def run(self, *env):
- self.unsetEnv(env)
- self.output("Success!")
-
-class load_env(Macro):
- """ Read environment variables from config_env.xml file"""
-
- def run(self):
- doc = etree.parse("config_env.xml")
- root = doc.getroot()
- for element in root:
- if element.find("./name").text == "auto_filter":
- self.output("Loading auto_filter variables:")
- filter_max_elem = element.find(".//FilterMax")
- if filter_max_elem is not None:
- filter_max = filter_max_elem.text
- self.setEnv("FilterMax", filter_max)
- self.output("FilterMax loaded")
- else:
- self.output("FilterMax not found")
- filter_min_elem = element.find(".//FilterMin")
- if filter_min_elem is not None:
- filter_min = filter_max_elem.text
- self.setEnv("FilterMin", filter_min)
- self.output("FilterMin loaded")
- else:
- self.output("FilterMin not found")
- filter_delta_elem = element.find(".//FilterDelta")
- if filter_delta_elem is not None:
- filter_delta = filter_delta_elem.text
- self.setEnv("FilterDelta", filter_delta)
- self.output("FilterDelta loaded")
- else:
- self.output("FilterDelta not found")
- filter_signal_elem = element.find(".//FilterSignal")
- if filter_signal_elem is not None:
- filter_signal = filter_signal_elem.text
- self.setEnv("FilterSignal", filter_signal)
- self.output("FilterSignal loaded")
- else:
- self.output("FilterSignal not found")
- filter_absorber_elem = element.find(".//FilterAbsorber")
- if filter_absorber_elem is not None:
- filter_absorber = filter_absorber_elem.text
- self.setEnv("FilterAbsorber", filter_absorber)
- self.output("FilterAbsorber loaded")
- else:
- self.output("FilterAbsorber not found")
- auto_filter_elem = element.find(".//AutoFilter")
- if auto_filter_elem is not None:
- auto_filter = auto_filter_elem.text
- self.setEnv("AutoFilter", auto_filter)
- self.output("AutoFilter loaded")
- else:
- self.output("AutoFilter not found")
- if element.find("./name").text == "auto_beamshutter":
- self.output("Loading auto_beamshutter variables:")
- auto_beamshutter_elem = element.find(".//AutoBeamshutter")
- if auto_beamshutter_elem is not None:
- auto_beamshutter = auto_beamshutter_elem.text
- self.setEnv("AutoBeamshutter", auto_beamshutter)
- self.output("AutoBeamshutter loaded")
- else:
- self.output("AutoBeamshutter not found")
- beamshutter_limit_elem = element.find(".//BeamshutterLimit")
- if beamshutter_limit_elem is not None:
- beamshutter_limit = beamshutter_limit_elem.text
- self.setEnv("BeamshutterLimit", beamshutter_limit)
- self.output("BeamshutterLimit loaded")
- else:
- self.output("BeamshutterLimit not found")
- beamshutter_signal_elem = element.find(".//BeamshutterSignal")
- if beamshutter_signal_elem is not None:
- beamshutter_signal = beamshutter_signal_elem.text
- self.setEnv("BeamshutterSignal", beamshutter_signal)
- self.output("BeamshutterSignal loaded")
- else:
- self.output("BeamshutterSignal not found")
- beamshutter_time_elem = element.find(".//BeamshutterTime")
- if beamshutter_time_elem is not None:
- beamshutter_time = beamshutter_time_elem.text
- self.setEnv("BeamshutterTime", beamshutter_time)
- self.output("BeamshutterTime loaded")
- else:
- self.output("BeamshutterTime not found")
- if element.find("./name").text == "exafs":
- self.output("Loading exafs variables:")
- exafs_int_times_elem = element.find(".//ExafsIntTimes")
- if exafs_int_times_elem is not None:
- exafs_int_times = exafs_int_times_elem.text
- self.setEnv("ExafsIntTimes", exafs_int_times)
- self.output("ExafsIntTimes loaded")
- else:
- self.output("ExafsIntTimes not found")
- exafs_nb_intervals_elem = element.find(".//ExafsNbIntervals")
- if exafs_nb_intervals_elem is not None:
- exafs_nb_intervals = exafs_nb_intervals_elem.text
- self.setEnv("ExafsNbIntervals", exafs_nb_intervals)
- self.output("ExafsNbIntervals loaded")
- else:
- self.output("ExafsNbIntervals not found")
- exafs_regions_elem = element.find(".//ExafsRegions")
- if exafs_regions_elem is not None:
- exafs_regions = exafs_regions_elem.text
- self.setEnv("ExafsRegions", exafs_regions)
- self.output("ExafsRegions loaded")
- else:
- self.output("ExafsRegions not found")
- misc_tree = root.find("./miscellaneous")
- if misc_tree is not None:
- for parameter in misc_tree:
- if parameter.tag != "name":
- self.setEnv(parameter.tag, parameter.text)
-
diff --git a/src/sardana/macroserver/macros/examples/__init__.py b/src/sardana/macroserver/macros/examples/__init__.py
deleted file mode 100644
index 37cca569..00000000
--- a/src/sardana/macroserver/macros/examples/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package contains the macroserver example macros"""
-
-__docformat__ = 'restructuredtext'
-
diff --git a/src/sardana/macroserver/macros/examples/debug.py b/src/sardana/macroserver/macros/examples/debug.py
deleted file mode 100644
index e2c26a6e..00000000
--- a/src/sardana/macroserver/macros/examples/debug.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-#############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-#############################################################################
-
-"""This module provides ..."""
-
-#__all__ = []
-
-__docformat__ = 'restructuredtext'
-
-from sardana.macroserver.macro import Type, macro
-
-
-@macro()
-def raise_exception(self):
- '''A macro that raises an exception (useful for debugging)'''
- raise Exception('here is your exception!')
diff --git a/src/sardana/macroserver/macros/examples/funcs.py b/src/sardana/macroserver/macros/examples/funcs.py
deleted file mode 100644
index 4751f669..00000000
--- a/src/sardana/macroserver/macros/examples/funcs.py
+++ /dev/null
@@ -1,69 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Examples of macro functions"""
-
-from __future__ import print_function
-
-__all__ = ["mfunc1", "mfunc2", "mfunc3", "mfunc4", "mfunc5"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.macroserver.macro import Type, Macro, macro
-
-
-@macro()
-def mfunc1(self):
- """First macro function. No parameters whatsoever"""
- self.output("Executing %s", self.getName())
- self.print("Hello",1)
- self.wa()
-
-@macro()
-def mfunc2(self, p1):
- """Second macro function. One parameter of unknown type"""
- self.output("parameter: %s", p1)
-
-@macro([ ["moveable", Type.Moveable, None, "motor to watch"] ])
-def mfunc3(self, moveable):
- """Third macro function. A proper moveable parameter"""
- self.output("Moveable %s is at %s", moveable.getName(), moveable.getPosition())
- self.ascan(moveable, 0, 10, 10, 0.1)
- self.mfunc1()
-
-@macro()
-def mfunc4(self, *args):
- """Fourth macro function. A list of parameters of unknown type"""
- self.output("parameters %s", args)
-
-@macro()
-def mfunc5(self, *args):
- """Fifth macro function. A list of parameters of unknown type"""
- self.output("parameters %s", args)
-
-@macro([ ["moveable", Type.Moveable, None, "moveable to move"],
- ["position", Type.Float, None, "absolute position"] ])
-def move(self, moveable, position):
- """This macro moves a motor to the specified position"""
- moveable.move(position)
- self.print("Motor ended at ", moveable.getPosition())
diff --git a/src/sardana/macroserver/macros/examples/hooks.py b/src/sardana/macroserver/macros/examples/hooks.py
deleted file mode 100644
index 707f74e5..00000000
--- a/src/sardana/macroserver/macros/examples/hooks.py
+++ /dev/null
@@ -1,161 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains macros that demonstrate the usage of hooks"""
-
-__all__ = ["captain_hook", "captain_hook2", "loop", "hooked_scan",
- "hooked_dummyscan"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.macroserver.macro import *
-
-class loop(Macro, Hookable):
- """A macro that executes a for loop. It accepts hooks.
- This macro is part of the examples package. It was written for
- demonstration purposes"""
-
- hints = { 'allowsHooks':('pre-move', 'post-move', 'pre-acq', 'post-acq') }
-
- param_def = [['start', Type.Integer, None, 'start point'],
- ['stop', Type.Integer, None, 'end point'],
- ['step', Type.Integer, 1, 'step']]
-
- def hook1(self):
- self.output("En hook 1")
-
- def run(self, start, stop, step):
- self.info("Starting loop")
- self.hooks = [ (self.hook1, ["pre-acq"])]
- for i in xrange(start, stop, step):
- self.output("At step %d" % i)
- self.flushOutput()
-
- for hook,hints in self.hooks:
- self.info("running hook with hints="+repr(hints))
- hook()
- self.info("Finished loop")
-
-class captain_hook(Macro):
- """A macro that executes a loop macro. A hook was attached so that in each
- step of the loop this hook is executed.
- This macro is part of the examples package. It was written for
- demonstration purposes"""
-
- param_def = [['start', Type.Integer, None, 'start point'],
- ['stop', Type.Integer, None, 'end point'],
- ['step', Type.Integer, 1, 'step']]
-
- def hook(self):
- self.info("\thook execution")
-
- def run(self, start, stop, step):
- loop_macro = self.createMacro("loop",start,stop,step)
- loop_macro.hooks = [ self.hook ]
- self.runMacro(loop_macro)
-
-class captain_hook2(Macro):
- """A macro that executes a loop macro. A hook was attached so that in each
- step of the loop this hook is executed.
- This macro is part of the examples package. It was written for
- demonstration purposes"""
-
- param_def = [['start', Type.Integer, None, 'start point'],
- ['stop', Type.Integer, None, 'end point'],
- ['step', Type.Integer, 1, 'step']]
-
- def hook(self):
- self.execMacroStr(["lsm"])
-
- def run(self, start, stop, step):
- loop_macro = self.createMacro("loop",start,stop,step)
- #h = self.createExecMacroHook(["lsm"])
- loop_macro.hooks = [ self.hook ] #it gives the "pre-acq" hint to the hook
- self.runMacro(loop_macro)
-
-class hooked_scan(Macro):
- """An example on how to attach hooks to the various hook points of a scan.
- This macro is part of the examples package. It was written for
- demonstration purposes"""
-
- param_def = [
- ['motor', Type.Moveable,None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
- def hook1(self):
- self.info("\thook1 execution")
-
- def hook2(self):
- self.info("\thook2 execution")
-
- def hook3(self):
- self.info("\thook3 execution")
-
- def hook4(self):
- self.info("\thook4 execution")
-
- def hook5(self):
- self.info("\thook5 execution")
-
- def hook6(self):
- self.info("\thook6 execution")
-
- def run(self, motor, start_pos, final_pos, nr_interv, integ_time):
- ascan, pars = self.createMacro("ascan",motor, start_pos, final_pos, nr_interv, integ_time)
- ascan.hooks = [ (self.hook1, ["pre-acq"]),
- (self.hook2, ["pre-acq","post-acq","pre-move", "post-move","aaaa"]),
- self.hook3,
- (self.hook4, ["pre-scan"]),
- (self.hook5, ["pre-scan", "post-scan"]),
- (self.hook6, ["post-step"])]
- self.runMacro(ascan)
-
-
-class hooked_dummyscan(Macro):
- """An example on how to attach hooks to the various hook points of a scan.
- This macro is part of the examples package. It was written for
- demonstration purposes"""
-
- param_def = [
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
- def hook1(self):
- self.info("\thook1 execution")
-
- def hook2(self):
- self.info("\thook2 execution")
-
- def hook3(self):
- self.info("\thook3 execution")
-
- def run(self, start_pos, final_pos, nr_interv, integ_time):
- dummyscan,pars = self.createMacro("dummyscan",start_pos, final_pos, nr_interv, integ_time)
- dummyscan.hooks = [ (self.hook1, ["pre-scan"]), (self.hook2, ["pre-acq","post-acq","pre-move", "post-move","aaaa"]),(self.hook3, ["post-scan"])]
- self.runMacro(dummyscan)
-
diff --git a/src/sardana/macroserver/macros/examples/parameters.py b/src/sardana/macroserver/macros/examples/parameters.py
deleted file mode 100644
index bfd46ae6..00000000
--- a/src/sardana/macroserver/macros/examples/parameters.py
+++ /dev/null
@@ -1,168 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains macros that demonstrate the usage of macro parameters"""
-
-from sardana.macroserver.macro import *
-
-__all__ = ["pt0", "pt1", "pt2", "pt3", "pt4", "pt5", "pt6", "pt7", "pt8",
- "pt9"]
-
-class pt0(Macro):
- """Macro without parameters. Pretty dull"""
-
- param_def = []
-
- def run(self):
- pass
-
-class pt1(Macro):
- """Macro with one float parameter: Each parameter is described in the
- param_def sequence as being a sequence of for elements: name, type,
- default value and description"""
-
- param_def = [ [ 'value', Type.Float, None, 'some bloody float'] ]
-
- def run(self, f):
- pass
-
-class pt2(Macro):
- """Macro with one Motor parameter: Each parameter is described in the
- param_def sequence as being a sequence of for elements: name, type,
- default value and description"""
-
- param_def = [ [ 'motor', Type.Motor, None, 'some bloody motor'] ]
-
- def run(self, m):
- pass
-
-class pt3(Macro):
- """Macro with a list of numbers as parameter: the type is a sequence of
- parameter types which is repeated. In this case it is a repetition of a
- float so only one parameter is defined.
- By default the repetition as a semantics of 'at least one'"""
-
- param_def = [
- [ 'numb_list', [ [ 'pos', Type.Float, None, 'value'] ], None, 'List of values'],
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class pt4(Macro):
- """Macro with a list of motors as parameter: the type is a sequence of
- parameter types which is repeated. In this case it is a repetition of a
- motor so only one parameter is defined.
- By default the repetition as a semantics of 'at least one'"""
-
- param_def = [
- [ 'motor_list', [ [ 'motor', Type.Motor, None, 'motor name'] ], None, 'List of motors'],
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class pt5(Macro):
- """Macro with a motor parameter followed by a list of numbers"""
-
- param_def = [
- [ 'motor', Type.Motor, None, 'Motor to move'],
- [ 'numb_list', [ [ 'pos', Type.Float, None, 'value'] ], None, 'List of values'],
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class pt6(Macro):
- """Macro with a motor parameter followed by a list of numbers. The list as
- explicitly stated an optional last element which is a dictionary that defines the
- min and max values for repetitions"""
-
- param_def = [
- [ 'motor', Type.Motor, None, 'Motor to move'],
- [ 'numb_list', [ [ 'pos', Type.Float, None, 'value'], { 'min' : 1, 'max' : None } ], None, 'List of values'],
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class pt7(Macro):
- """Macro with a list of pair Motor,Float"""
-
- param_def = [
- [ 'm_p_pair', [ [ 'motor', Type.Motor, None, 'Motor to move'],
- [ 'pos', Type.Float, None, 'Position to move to'] ],
- None, 'List of motor/position pairs']
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class pt8(Macro):
- """Macro with a list of pair Motor,Float. The min and max elements have been
- explicitly stated"""
-
- param_def = [
- [ 'm_p_pair', [ [ 'motor', Type.Motor, None, 'Motor to move'],
- [ 'pos', Type.Float, None, 'Position to move to'],
- { 'min' : 1, 'max' : 2 } ],
- None, 'List of motor/position pairs']
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class pt9(Macro):
- """Same as macro pt7 but witb old style ParamRepeat. If you are writing
- a macro with variable number of parameters for the first time don't even
- bother to look at this example since it is DEPRECATED."""
-
- param_def = [
- ['m_p_pair',
- ParamRepeat(['motor', Type.Motor, None, 'Motor to move'],
- ['pos', Type.Float, None, 'Position to move to'], min=1, max= 2),
- None, 'List of motor/position pairs'],
- ]
-
- def run(self, *args, **kwargs):
- pass
-
-class twice(Macro):
- """A macro that returns a float that is twice its input. It also sets its
- data to be a dictionary with 'in','out' as keys and value,result
- as values, respectively"""
-
- # uncomment the following lines as necessary. Otherwise you may delete them
- param_def = [ [ "value", Type.Float, 23, "value to be doubled" ] ]
- result_def = [ [ "result", Type.Float, 23, "the double of the given value" ] ]
- #hints = {}
- #env = (,)
-
- # uncomment the following lines if need prepare. Otherwise you may delete them
- #def prepare(self):
- # pass
-
- def run(self, n):
- ret = 2*n
- self.setData({'in':n, 'out':ret})
- return ret \ No newline at end of file
diff --git a/src/sardana/macroserver/macros/examples/plotting.py b/src/sardana/macroserver/macros/examples/plotting.py
deleted file mode 100644
index 71fa3df1..00000000
--- a/src/sardana/macroserver/macros/examples/plotting.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import math
-from numpy import linspace
-from scipy.integrate import quad
-from scipy.special import j0
-
-from sardana.macroserver.macro import macro, Type
-
-def j0i(x):
- """Integral form of J_0(x)"""
- def integrand(phi):
- return math.cos(x * math.sin(phi))
- return (1.0/math.pi) * quad(integrand, 0, math.pi)[0]
-
-@macro()
-def J0_plot(self):
- """Sample J0 at linspace(0, 20, 200)"""
- x = linspace(0, 20, 200)
- y = j0(x)
- x1 = x[::10]
- y1 = map(j0i, x1)
- self.pyplot.plot(x, y, label=r'$J_0(x)$') #
- self.pyplot.plot(x1, y1, 'ro', label=r'$J_0^{integ}(x)$')
- self.pyplot.title(r'Verify $J_0(x)=\frac{1}{\pi}\int_0^{\pi}\cos(x \sin\phi)\,d\phi$')
- self.pyplot.xlabel('$x$')
- self.pyplot.legend()
-
-
-from numpy import random
-
-@macro()
-def random_image(self):
- """Shows a random image 32x32"""
- img = random.random((32, 32))
- self.pyplot.matshow(img)
-
-import numpy
-
-@macro([["interactions", Type.Integer, None, ""],
- ["density", Type.Integer, None, ""]])
-def mandelbrot(self, interactions, density):
-
- x_min, x_max = -2, 1
- y_min, y_max = -1.5, 1.5
-
- x, y = numpy.meshgrid(numpy.linspace(x_min, x_max, density),
- numpy.linspace(y_min, y_max, density))
-
- c = x + 1j * y
- z = c.copy()
-
- fractal = numpy.zeros(z.shape, dtype=numpy.uint8) + 255
-
- finteractions = float(interactions)
- for n in range(interactions):
- z *= z
- z += c
- mask = (fractal == 255) & (abs(z) > 10)
- fractal[mask] = 254 * n / finteractions
- self.pyplot.imshow(fractal)
diff --git a/src/sardana/macroserver/macros/examples/scans.py b/src/sardana/macroserver/macros/examples/scans.py
deleted file mode 100644
index c83acf2c..00000000
--- a/src/sardana/macroserver/macros/examples/scans.py
+++ /dev/null
@@ -1,611 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
- Macro library containning examples demonstrating specific features or tricks
- for programming macros for Sardana.
-
- Available Macros are:
- ascanr
- toothedtriangle
-
-"""
-
-__all__ = ["ascan_demo", "ascanr", "toothedtriangle", "regscan", "reg2scan", "reg3scan", "a2scan_mod"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import numpy
-
-from sardana.macroserver.macro import *
-from sardana.macroserver.scan import *
-
-class ascan_demo(Macro):
- """
- This is a basic reimplementation of the ascan` macro for demonstration
- purposes of the Generic Scan framework. The "real" implementation of
- :class:`sardana.macroserver.macros.ascan` derives from
- :class:`sardana.macroserver.macros.aNscan` and provides some extra features.
- """
-
- hints = { 'scan' : 'ascan_demo'} #this is used to indicate other codes that the macro is a scan
- env = ('ActiveMntGrp',) #this hints that the macro requires the ActiveMntGrp environment variable to be set
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time, **opts):
- #parse the user parameters
- self.start = numpy.array([start_pos], dtype='d')
- self.final = numpy.array([final_pos], dtype='d')
- self.integ_time = integ_time
-
- self.nr_points = nr_interv+1
- self.interv_size = ( self.final - self.start) / nr_interv
- self.name='ascan_demo'
- env = opts.get('env',{}) #the "env" dictionary may be passed as an option
-
- #create an instance of GScan (in this case, of its child, SScan
- self._gScan=SScan(self, generator=self._generator, moveables=[motor], env=env)
-
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time #integ_time is the same for all steps
- for point_no in xrange(self.nr_points):
- step["positions"] = self.start + point_no * self.interv_size #note that this is a numpy array
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan(): #just go through the steps
- yield step
-
- @property
- def data(self):
- return self._gScan.data #the GScan provides scan data
-
-
-class ascanr(Macro, Hookable):
- """This is an example of how to handle adding extra info columns in a scan.
- Does the same than ascan but repeats the acquisitions "repeat" times for each step.
- It could be implemented deriving from aNscan, but I do it like this for clarity.
- Look for the comments with "!!!" for tips specific to the extra info columns
- I do not support constrains in this one for simplicity (see ascan for that)
-
- Do an absolute scan of the specified motor, repeating measurements in each step.
- ascanr scans one motor, as specified by motor. The motor starts at the
- position given by start_pos and ends at the position given by final_pos.
- At each step, the acquisition will be repeated "repeat" times
- The step size is (start_pos-final_pos)/nr_interv. The number of data points collected
- will be (nr_interv+1)*repeat. Count time for each acquisition is given by time which if positive,
- specifies seconds and if negative, specifies monitor counts. """
-
- hints = { 'scan' : 'ascanr', 'allowsHooks':('pre-move', 'post-move', 'pre-acq', 'post-acq', 'post-step') }
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['repeat', Type.Integer, None, 'Number of Repetitions']
- ]
-
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time, repeat,
- **opts):
-
- self.starts = numpy.array([start_pos], dtype='d')
- self.finals = numpy.array([final_pos], dtype='d')
- self.nr_interv = nr_interv
- self.integ_time = integ_time
- self.repeat=repeat
- self.opts = opts
-
- self.nr_points = nr_interv+1
- self.interv_sizes = ( self.finals - self.starts) / nr_interv
- self.name='ascanr'
-
- generator=self._generator
- moveables=[motor]
- env=opts.get('env',{})
- constrains=[]
- extrainfodesc=[ColumnDesc(name='repetition',
- dtype='int64', shape=(1,))] #!!!
-
- self._gScan=SScan(self, generator, moveables, env, constrains, extrainfodesc) #!!!
-
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["post-acq-hooks"] = self.getHooks('post-acq') + self.getHooks('_NOHINT_')
- step["post-step-hooks"] = self.getHooks('post-step')
- step["check_func"] = []
- extrainfo = {"repetition":0} #!!!
- step['extrainfo'] = extrainfo #!!!
- for point_no in xrange(self.nr_points):
- step["positions"] = self.starts + point_no * self.interv_sizes
- step["point_id"] = point_no
- for i in xrange(self.repeat):
- extrainfo["repetition"] = i #!!!
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
- @property
- def data(self):
- return self._gScan.data
-
-
-class toothedtriangle(Macro, Hookable):
- """toothedtriangle macro implemented with the gscan framework.
- It performs nr_cycles cycles, each consisting of two stages: the first half
- of the cycle it behaves like the ascan macro (from start_pos to stop_pos in
- nr_interv+1 steps).For the second half of the cycle it steps back until
- it undoes the first half and is ready for the next cycle.
- At each step, nr_samples acquisitions are performed.
- The total number of points in the scan is nr_interv*2*nr_cycles*nr_samples+1"""
-
- hints = { 'scan' : 'toothedtriangle',
- 'allowsHooks':('pre-scan', 'pre-move', 'post-move', 'pre-acq',
- 'post-acq', 'post-step', 'post-scan')
- }
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'start position'],
- ['final_pos', Type.Float, None, 'position after half cycle'],
- ['nr_interv', Type.Integer, None, 'Number of intervals in half cycle'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['nr_cycles', Type.Integer, None, 'Number of cycles'],
- ['nr_samples', Type.Integer, 1 , 'Number of samples at each point']
- ]
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time,
- nr_cycles, nr_samples, **opts):
-
- self.start_pos = start_pos
- self.final_pos = final_pos
- self.nr_interv = nr_interv
- self.integ_time = integ_time
- self.nr_cycles = nr_cycles
- self.nr_samples = nr_samples
- self.opts = opts
- cycle_nr_points = self.nr_interv+1 + (self.nr_interv+1)-2
- self.nr_points = cycle_nr_points*nr_samples*nr_cycles+nr_samples
-
- self.interv_size = ( self.final_pos - self.start_pos) / nr_interv
- self.name='toothedtriangle'
-
- generator=self._generator
- moveables = []
- moveable = MoveableDesc(moveable=motor, is_reference=True,
- min_value=min(start_pos,final_pos),
- max_value=max(start_pos,final_pos))
- moveables=[moveable]
- env=opts.get('env',{})
- constrains=[]
- extrainfodesc=[ColumnDesc(name='cycle', dtype='int64', shape=(1,)),
- ColumnDesc(name='interval', dtype='int64', shape=(1,)),
- ColumnDesc(name='sample', dtype='int64', shape=(1,))] #!!!
-
- self._gScan=SScan(self, generator, moveables, env, constrains, extrainfodesc) #!!!
-
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["pre-acq-hooks"] = self.getHooks('pre-acq')
- step["post-acq-hooks"] = self.getHooks('post-acq') + self.getHooks('_NOHINT_')
- step["post-step-hooks"] = self.getHooks('post-step')
- step["check_func"] = []
- extrainfo = {"cycle":None, "interval":None, "sample":None, }
- step['extrainfo'] = extrainfo
- halfcycle1=range(self.nr_interv+1)
- halfcycle2=halfcycle1[1:-1]
- halfcycle2.reverse()
- intervallist=halfcycle1+halfcycle2
- point_no=0
- for cycle in xrange(self.nr_cycles):
- extrainfo["cycle"] = cycle
- for interval in intervallist:
- extrainfo["interval"] = interval
- step["positions"] = numpy.array([self.start_pos + (interval) * self.interv_size] ,dtype='d')
- for sample in xrange(self.nr_samples):
- extrainfo["sample"] = sample
- step["point_id"] = point_no
- yield step
- point_no+=1
-
- #last step for closing the loop
- extrainfo["interval"] = 0
- step["positions"] = numpy.array([self.start_pos] ,dtype='d')
- for sample in xrange(self.nr_samples):
- extrainfo["sample"] = sample
- step["point_id"] = point_no
- yield step
- point_no+=1
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
- @property
- def data(self):
- return self._gScan.data
-
-
-class regscan(Macro):
- """regscan.
- Do an absolute scan of the specified motor with different number of intervals for each region.
- It uses the gscan framework.
-
- NOTE: Due to a ParamRepeat limitation, integration time has to be
- specified before the regions.
- """
-
- hints = {'scan' : 'regscan'}
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['start_pos', Type.Float, None, 'Start position'],
- ['step_region',
- ParamRepeat(['next_pos', Type.Float, None, 'next position'],
- ['region_nr_intervals', Type.Float, None, 'Region number of intervals']),
- None, 'List of tuples: (next_pos, region_nr_intervals']
- ]
-
- def prepare(self, motor, integ_time, start_pos, *regions, **opts):
- self.name='regscan'
- self.integ_time = integ_time
- self.start_pos = start_pos
- self.regions = regions
- self.regions_count = len(self.regions)/2
-
- generator=self._generator
- moveables=[motor]
- env=opts.get('env',{})
- constrains=[]
- self._gScan=SScan(self, generator, moveables, env, constrains)
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
-
- point_id = 0
- region_start = self.start_pos
- for r in range(len(self.regions)):
- region_stop, region_nr_intervals = self.regions[r][0], self.regions[r][1]
- positions = numpy.linspace(region_start, region_stop, region_nr_intervals+1)
- if region_start != self.start_pos:
- # positions must be calculated from the start to the end of the region
- # but after the first region, the 'start' point must not be repeated
- positions = positions[1:]
- for p in positions:
- step['positions'] = [p]
- step['point_id'] = point_id
- point_id += 1
- yield step
- region_start = region_stop
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
-
-class reg2scan(Macro):
- """reg2scan.
- Do an absolute scan of the specified motors with different number of intervals for each region.
- It uses the gscan framework. All the motors will be drived to the same position in each step
-
- NOTE: Due to a ParamRepeat limitation, integration time has to be
- specified before the regions.
- """
-
- hints = {'scan' : 'reg2scan'}
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor1', Type.Moveable, None, 'Motor to move'],
- ['motor2', Type.Moveable, None, 'Motor to move'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['start_pos', Type.Float, None, 'Start position'],
- ['step_region',
- ParamRepeat(['next_pos', Type.Float, None, 'next position'],
- ['region_nr_intervals', Type.Float, None, 'Region number of intervals']),
- None, 'List of tuples: (next_pos, region_nr_intervals']
- ]
-
- def prepare(self, motor1, motor2, integ_time, start_pos, *regions, **opts):
- self.name='reg2scan'
- self.integ_time = integ_time
- self.start_pos = start_pos
- self.regions = regions
- self.regions_count = len(self.regions)/2
-
- generator=self._generator
- moveables=[motor1, motor2]
- env=opts.get('env',{})
- constrains=[]
- self._gScan=SScan(self, generator, moveables, env, constrains)
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
-
- point_id = 0
- region_start = self.start_pos
- for r in range(len(self.regions)):
- region_stop, region_nr_intervals = self.regions[r][0], self.regions[r][1]
- positions = numpy.linspace(region_start, region_stop, region_nr_intervals+1)
- if region_start != self.start_pos:
- # positions must be calculated from the start to the end of the region
- # but after the first region, the 'start' point must not be repeated
- positions = positions[1:]
- for p in positions:
- step['positions'] = [p, p]
- step['point_id'] = point_id
- point_id += 1
- yield step
- region_start = region_stop
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
-
-class reg3scan(Macro):
- """reg3scan.
- Do an absolute scan of the specified motors with different number of intervals for each region.
- It uses the gscan framework. All the motors will be drived to the same position in each step
-
- NOTE: Due to a ParamRepeat limitation, integration time has to be
- specified before the regions.
- """
-
- hints = {'scan' : 'reg3scan'}
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor1', Type.Moveable, None, 'Motor to move'],
- ['motor2', Type.Moveable, None, 'Motor to move'],
- ['motor3', Type.Moveable, None, 'Motor to move'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['start_pos', Type.Float, None, 'Start position'],
- ['step_region',
- ParamRepeat(['next_pos', Type.Float, None, 'next position'],
- ['region_nr_intervals', Type.Float, None, 'Region number of intervals']),
- None, 'List of tuples: (next_pos, region_nr_intervals']
- ]
-
- def prepare(self, motor1, motor2, motor3, integ_time, start_pos, *regions, **opts):
- self.name='reg3scan'
- self.integ_time = integ_time
- self.start_pos = start_pos
- self.regions = regions
- self.regions_count = len(self.regions)/2
-
- generator=self._generator
- moveables=[motor1, motor2, motor3]
- env=opts.get('env',{})
- constrains=[]
- self._gScan=SScan(self, generator, moveables, env, constrains)
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
-
- point_id = 0
- region_start = self.start_pos
- for r in range(len(self.regions)):
- region_stop, region_nr_intervals = self.regions[r][0], self.regions[r][1]
- positions = numpy.linspace(region_start, region_stop, region_nr_intervals+1)
- if region_start != self.start_pos:
- # positions must be calculated from the start to the end of the region
- # but after the first region, the 'start' point must not be repeated
- positions = positions[1:]
- for p in positions:
- step['positions'] = [p, p, p]
- step['point_id'] = point_id
- point_id += 1
- yield step
- region_start = region_stop
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
-
-class a2scan_mod(Macro):
- """a2scan_mod.
- Do an a2scan with the particularity of different intervals per motor: int_mot1, int_mot2.
- If int_mot2 < int_mot1, mot2 will change position every int(int_mot1/int_mot2) steps of mot1.
- It uses the gscan framework.
- """
-
- hints = {'scan' : 'a2scan_mod'}
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor1', Type.Moveable, None, 'Motor 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['nr_interv1', Type.Integer, None, 'Number of scan intervals of Motor 1'],
- ['motor2', Type.Moveable, None, 'Motor 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['nr_interv2', Type.Integer, None, 'Number of scan intervals of Motor 2'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor1, start_pos1, final_pos1, nr_interv1, motor2, start_pos2, final_pos2, nr_interv2, integ_time,
- **opts):
- self.name='a2scan_mod'
- self.integ_time = integ_time
- self.start_pos1 = start_pos1
- self.final_pos1 = final_pos1
- self.nr_interv1 = nr_interv1
- self.start_pos2 = start_pos2
- self.final_pos2 = final_pos2
- self.nr_interv2 = nr_interv2
-
- generator = self._generator
- moveables = [motor1, motor2]
- env = opts.get('env',{})
- constraints = []
- self._gScan=SScan(self, generator, moveables, env, constraints)
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
-
- start1, end1, interv1 = self.start_pos1, self.final_pos1, self.nr_interv1
- start2, end2, interv2 = self.start_pos2, self.final_pos2, self.nr_interv2
-
- # Prepare the positions
- positions_m1 = numpy.linspace(start1, end1, interv1+1)
- positions_m2 = numpy.linspace(start2, end2, interv2+1)
-
- if interv1 > interv2:
- positions_m2 = start2+(float(end2-start2)/interv2)*(numpy.arange(interv1+1)//(float(interv1)/float(interv2)))
- elif interv2 > interv1:
- positions_m1 = start1+(float(end1-start1)/interv1)*(numpy.arange(interv2+1)//(float(interv2)/float(interv1)))
-
- point_id = 0
- for pos1,pos2 in zip(positions_m1,positions_m2):
- step['point_id'] = point_id
- step['positions'] = [pos1, pos2]
- yield step
- point_id += 1
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
-
-class ascanc_demo(Macro):
- """
- This is a basic reimplementation of the ascanc` macro for demonstration
- purposes of the Generic Scan framework. The "real" implementation of
- :class:`sardana.macroserver.macros.ascanc` derives from
- :class:`sardana.macroserver.macros.aNscan` and provides some extra features.
- """
-
- hints = { 'scan' : 'ascanc_demo'} #this is used to indicate other codes that the macro is a scan
- env = ('ActiveMntGrp',) #this hints that the macro requires the ActiveMntGrp environment variable to be set
-
- param_def = [
- ['motor', Type.Moveable, None, 'Motor to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, integ_time, **opts):
- self.name='ascanc_demo'
- #parse the user parameters
- self.start = numpy.array([start_pos], dtype='d')
- self.final = numpy.array([final_pos], dtype='d')
- self.integ_time = integ_time
- env = opts.get('env',{}) #the "env" dictionary may be passed as an option
-
- #create an instance of GScan (in this case, of its child, CScan
- self._gScan = CScan(self,
- waypointGenerator=self._waypoint_generator,
- periodGenerator=self._period_generator,
- moveables=[motor],
- env=env)
-
- def _waypoint_generator(self):
- #a very simple waypoint generator! only start and stop points!
- yield {"positions":self.start, "waypoint_id": 0}
- yield {"positions":self.final, "waypoint_id": 1}
-
-
- def _period_generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- point_no = 0
- while(True): #infinite generator. The acquisition loop is started/stopped at begin and end of each waypoint
- point_no += 1
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
-
-
-class ascan_with_addcustomdata(ascan_demo):
- '''
- example of an ascan-like macro where we demonstrate how to pass custom data to the data handler.
- This is an extension of the ascan_demo macro. Wemake several calls to `:meth:DataHandler.addCustomData`
- exemplifying different features.
- At least the following recorders will act on custom data:
- - OutputRecorder (this will ignore array data)
- - NXscan_FileRecorder
- - SPEC_FileRecorder (this will ignore array data)
- '''
- def run(self, motor, start_pos, final_pos, nr_interv, integ_time, **opts):
- #we get the datahandler
- dh = self._gScan._data_handler
- #at this point the entry name is not yet set, so we give it explicitly (otherwise it would default to "entry")
- dh.addCustomData('Hello world1', 'dummyChar1', nxpath='/custom_entry:NXentry/customdata:NXcollection')
- #this is the normal scan loop
- for step in self._gScan.step_scan():
- yield step
- #the entry number is known and the default nxpath is used "/<currententry>/custom_data") if none given
- dh.addCustomData('Hello world1', 'dummyChar1')
- #you can pass arrays (but not all recorders will handle them)
- dh.addCustomData(range(10), 'dummyArray1')
- #you can pass a custom nxpath *relative* to the current entry
- dh.addCustomData('Hello world2', 'dummyChar2', nxpath='sample:NXsample')
-
- #calculate a linear fit to the timestamps VS motor positions and store it
- x = [r.data [motor.getName()] for r in self.data.records]
- y = [r.data['timestamp'] for r in self.data.records]
- fitted_y = numpy.polyval(numpy.polyfit(x,y,1), x)
- dh.addCustomData(fitted_y, 'fittedtime', nxpath='measurement:NXcollection')
-
- #as a bonus, plot the fit
- self.pyplot.plot(x, y, 'ro')
- self.pyplot.plot(x, fitted_y, 'b-')
-
- \ No newline at end of file
diff --git a/src/sardana/macroserver/macros/examples/specific_experiments.py b/src/sardana/macroserver/macros/examples/specific_experiments.py
deleted file mode 100644
index 5650376b..00000000
--- a/src/sardana/macroserver/macros/examples/specific_experiments.py
+++ /dev/null
@@ -1,113 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Library of specific macros for performing specific experimental techniques
-
-"""
-
-__all__ = ["xas_acq"]
-
-__docformat__ = 'restructuredtext'
-
-import numpy
-
-from sardana.macroserver.macro import *
-from sardana.macroserver.scan import *
-
-class xas_acq(Macro, Hookable):
- """
- .. warning:: This macro is still under development. It may change.
-
- Perform an X-ray absorption scan experiment. Data is stored in a NXxas-compliant file.
- """
- hints = { 'FileRecorder':'NXxas_FileRecorder', 'scan' : 'xas_acq', 'allowsHooks':('pre-move', 'post-move', 'pre-acq', 'post-acq', 'post-step') }
- #env = ('MonochromatorEnergy', )#'AbsorbedBeam', 'IncomingBeam', 'Monitor') #this hints that the macro requires the ActiveMntGrp environment variable to be set
-
- param_def = [
- ['start', Type.Float, None, 'start energy in keV'],
- ['final', Type.Float, None, 'final energy in keV'],
- ['nr_interv', Type.Integer, None, 'Number of energy intervals'],
- ['integ_time', Type.Float, None, 'Integration time in s']
- ]
-
- def prepare(self, start, final, nr_interv, integ_time, **opts):
- #parse the user parameters
- self.starts = numpy.array([start], dtype='d')
- self.finals = numpy.array([final], dtype='d')
- self.integ_time = integ_time
-
- self.nr_points = nr_interv+1
- self.interv_sizes = ( self.finals - self.starts) / nr_interv
- self.name='xas_acq'
- env = opts.get('env',{}) #the "env" dictionary may be passed as an option
- env['integ_time'] = integ_time
-
- #print "!!!!!", type(self.getInstrument('/instrument/monochromator')), self.getEnv('MonochromatorEnergy', macro_name=self.name)
- #ElementWithInterface('Instrument','monochromator')
- for n,e in self.getElementsWithInterface('Instrument').iteritems():
- inst=e.getObj()
- print n, e.name, inst.getFullName(), type(e), type(inst), type(inst.getPoolObj())#,inst.getElements()
-
- #maybe I should use the instrument interface to obtain the right counters
-
- env['monochromator'] = monochromator = self.getEnv('MonochromatorEnergy', macro_name=self.name)
- energymotor = self.getMoveable(monochromator)
- xasMntGrp = self.getMeasurementGroup(self.getEnv('xasMntGrp', macro_name=self.name))
-
- xasMntGrp=xasMntGrp.getObj()
- monitor,incbeam,absbeam = xasMntGrp.getChannelNames()[:3]
- env['monitor'] = monitor
- env['absbeam'] = absbeam
- env['incbeam'] = incbeam
-
-# print "!!!!!!!!",xasMntGrp.getObj().getElements()
-
-
-# absbeam = self.getExpChannel(self.getEnv('AbsorbedBeam')) #this should be get measurement group (e.g., second channel?)
-# incbeam = self.getExpChannel(self.getEnv('IncomingBeam')) #this should be get measurement group (e.g., first channel?)
-# monitor = self.getExpChannel(self.getEnv('Monitor')) #this should be get from the monitor of the measurement group
-
-
- #create an instance of GScan (in this case, of its child, SScan
- self._gScan=SScan(self, generator=self._generator, moveables=[energymotor], env=env)
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["post-acq-hooks"] = self.getHooks('post-acq') + self.getHooks('_NOHINT_')
- step["post-step-hooks"] = self.getHooks('post-step')
- step["check_func"] = []
- for point_no in xrange(self.nr_points):
- step["positions"] = self.starts + point_no * self.interv_sizes
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan(): #just go through the steps
- yield step
-
- @property
- def data(self):
- return self._gScan.data #the GScan provides scan data
-
- \ No newline at end of file
diff --git a/src/sardana/macroserver/macros/examples/submacros.py b/src/sardana/macroserver/macros/examples/submacros.py
deleted file mode 100644
index cb47894f..00000000
--- a/src/sardana/macroserver/macros/examples/submacros.py
+++ /dev/null
@@ -1,156 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-A macro package to show examples on how to run a macro from inside another macro
-"""
-
-__all__ = ["call_wa", "call_wm", "subsubm", "subm", "mainmacro", "runsubs"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.macroserver.macro import Macro, Type, ParamRepeat
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# First example:
-# A 'mainmacro' that executes a 'subm' that in turn executes a 'subsubm'.
-# The 'subsubm' macro itself calls a short ascan macro
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-
-
-class call_wa(Macro):
-
- def run(self):
- self.macros.wa()
-
-class call_wm(Macro):
-
- param_def = [
- ['motor_list',
- ParamRepeat(['motor', Type.Motor, None, 'Motor to move']),
- None, 'List of motor to show'],
- ]
-
- def run(self, *m):
- self.macros.wm(*m)
-
-class subsubm(Macro):
- """this macro just calls the 'subm' macro
- This macro is part of the examples package. It was written for demonstration purposes"""
- def run(self):
- self.output("Starting %s" % self.getName())
- m = self.macros
- motors = self.getObjs('.*', type_class=Type.Motor)
- m.ascan(motors[0], 0, 100, 10, 0.2)
- self.output("Finished %s" % self.getName())
-
-class subm(Macro):
- """this macro just calls the 'subsubm' macro
- This macro is part of the examples package. It was written for demonstration purposes"""
-
- def run(self):
- self.output("Starting %s" % self.getName())
- self.macros.subsubm()
- self.output("Finished %s" % self.getName())
-
-class mainmacro(Macro):
- """this macro just calls the 'subm' macro
- This macro is part of the examples package. It was written for demonstration purposes"""
-
- def run(self):
- self.output("Starting %s" % self.getName())
- self.macros.subm()
- self.output("Finished %s" % self.getName())
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Second example:
-# a 'runsubs' macro that shows the different ways to call a macro from inside
-# another macro
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-
-
-class runsubs(Macro):
- """ A macro that calls a ascan macro using the motor given as first parameter.
-
- This macro is part of the examples package. It was written for demonstration purposes
-
- Call type will allow to choose to format in which the ascan macro is called
- from this macro:
- 1 - m.ascan(motor.getName(), '0', '10', '4', '0.2')
- 2 - m.ascan(motor, 0, 10, 4, 0.2)
- 3 - self.execMacro('ascan', motor.getName(), '0', '10', '4', '0.2')
- 4 - self.execMacro(['ascan', motor, 0, 10, 4, 0.2])
- 5 - params = 'ascan', motor, 0, 10, 4, 0.2
- self.execMacro(params)
- 6 - self.execMacro("ascan %s 0 10 4 0.2" % motor.getName())
- 7 - macro, prep = self.createMacro("ascan %s 0 10 4 0.2" % motor.getName())
- macro.hooks = [ self.hook ]
- self.runMacro(macro)
- 8 - macro, prep = self.createMacro('ascan', motor, 0, 10, 4, 0.2)
- macro.hooks = [ self.hook ]
- self.runMacro(macro)
- 9 - params = 'ascan', motor, 0, 10, 4, 0.2
- macro, prep = self.createMacro(params)
- macro.hooks = [ self.hook ]
- self.runMacro(macro)
-
- Options 7,8 and 9 use the lower level macro API in order to be able to
- attach hooks to the ascan macro."""
- param_def = [
- ['motor', Type.Motor, None, 'Motor to move'],
- ['call_type', Type.Integer, 2, 'type of run to execute internally'],
- ]
-
- def hook(self):
- self.info("executing hook in a step of a scan...")
-
- def run(self, motor, call_type):
- m = self.macros
- self.output("Using type %d" % call_type)
- if call_type == 1:
- m.ascan(motor.getName(), '0', '10', '4', '0.2')
- elif call_type == 2:
- m.ascan(motor, 0, 10, 4, 0.2)
- elif call_type == 3:
- self.execMacro('ascan', motor.getName(), '0', '10', '4', '0.2')
- elif call_type == 4:
- self.execMacro('ascan', motor, 0, 10, 4, 0.2)
- elif call_type == 5:
- params = 'ascan', motor, 0, 10, 4, 0.2
- self.execMacro(params)
- elif call_type == 6:
- self.execMacro("ascan %s 0 10 4 0.2" % motor.getName())
- elif call_type == 7:
- macro, prep = self.createMacro("ascan %s 0 10 4 0.2" % \
- motor.getName())
- macro.hooks = [ self.hook ]
- self.runMacro(macro)
- elif call_type == 8:
- macro, prep = self.createMacro('ascan', motor, 0, 10, 4, 0.2)
- macro.hooks = [ self.hook ]
- self.runMacro(macro)
- elif call_type == 9:
- params = 'ascan', motor, 0, 10, 4, 0.2
- macro, prep = self.createMacro(params)
- macro.hooks = [ self.hook ]
- self.runMacro(macro)
-
-
diff --git a/src/sardana/macroserver/macros/examples/user_input.py b/src/sardana/macroserver/macros/examples/user_input.py
deleted file mode 100644
index 26467a2c..00000000
--- a/src/sardana/macroserver/macros/examples/user_input.py
+++ /dev/null
@@ -1,87 +0,0 @@
-
-from sardana.macroserver.macro import imacro, Type
-
-@imacro()
-def ask_number_of_points(self):
- """asks user for the number of points"""
-
- nb_points = self.input("How many points?", data_type=Type.Integer)
-
-
-@imacro()
-def ask_for_moveable(self):
- """asks user for a motor"""
-
- moveable = self.input("Which moveable?", data_type=Type.Moveable)
- self.output("You selected %s which is at %f", moveable, moveable.getPosition())
-
-@imacro()
-def ask_for_car_brand(self):
- """asks user for a car brand"""
-
- car_brands = "Mazda", "Citroen", "Renault"
- car_brand = self.input("Which car brand?", data_type=car_brands)
- self.output("You selected %s", car_brand)
-
-@imacro()
-def ask_for_multiple_car_brands(self):
- """asks user for several car brands"""
-
- car_brands = "Mazda", "Citroen", "Renault", "Ferrari", "Porche", "Skoda"
- car_brands = self.input("Which car brand(s)?", data_type=car_brands,
- allow_multiple=True, title="Favorites")
- self.output("You selected %s", ", ".join(car_brands))
-
-@imacro()
-def ask_peak(self):
- """asks user for peak current of points with a custom title"""
-
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection")
- self.output("You selected a peak of %f A", peak)
-
-@imacro()
-def ask_peak_v2(self):
- """asks user for peak current of points with a custom title,
- default value, label and units"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-@imacro()
-def ask_peak_v3(self):
- """asks user for peak current of points with a custom title,
- default value, label, units and ranges"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4, minimum=0.0, maximum=200.0)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-@imacro()
-def ask_peak_v4(self):
- """asks user for peak current of points with a custom title,
- default value, label, units, ranges and step size"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4, minimum=0.0, maximum=200.0,
- step=5)
- self.output("You selected a %s of %f %s", label, peak, unit)
-
-@imacro()
-def ask_peak_v5(self):
- """asks user for peak current of points with a custom title,
- default value, label, units, ranges, step size and decimal places"""
-
- label, unit = "peak", "mA"
- peak = self.input("What is the peak current?", data_type=Type.Float,
- title="Peak selection", key=label, unit=unit,
- default_value=123.4, minimum=0.0, maximum=200.0,
- step=5, decimals=2)
- self.output("You selected a %s of %f %s", label, peak, unit)
diff --git a/src/sardana/macroserver/macros/expert.py b/src/sardana/macroserver/macros/expert.py
deleted file mode 100644
index edad405b..00000000
--- a/src/sardana/macroserver/macros/expert.py
+++ /dev/null
@@ -1,433 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Expert macros"""
-
-from __future__ import print_function
-
-__docformat__ = 'restructuredtext'
-
-__all__ = ["commit_ctrllib", "defctrl", "defelem", "defm", "defmeas", "edctrl",
- "edctrllib", "prdef", "rellib", "relmac", "relmaclib", "addmaclib",
- "send2ctrl", "udefctrl", "udefelem", "udefmeas", "sar_info"]
-
-import sys
-import traceback
-import array
-
-from sardana.macroserver.msexception import UnknownMacroLibrary
-from sardana.macroserver.msparameter import WrongParam
-from sardana.macroserver.macro import Macro, Type, ParamRepeat, Table, LibraryError
-
-################################################################################
-#
-# Configuration related macros
-#
-################################################################################
-
-
-class defm(Macro):
- """Creates a new motor in the active pool"""
-
- param_def = [['motor name', Type.String, None, 'motor name'],
- ['controller', Type.Controller, None, 'Controller name'],
- ['axis', Type.Integer, None, 'motor axis'],]
-
- def run(self, name, controller, axis):
- pool = controller.getPoolObj()
- if axis == -1:
- axis = None
- elem = pool.createElement(name, controller, axis)
- self.print("Created %s" % str(elem))
-
-class defmeas(Macro):
- """Create a new measurement group. First channel in channel_list MUST
- be an internal sardana channel. At least one channel MUST be a
- Counter/Timer (by default, the first Counter/Timer in the list will
- become the master)."""
-
- param_def = [
- ['name', Type.String, None, 'Measurement group name'],
- ['channel_list',
- ParamRepeat(['channel', Type.String, None, 'Measurement Channel'],),
- None, 'List of measurement channels'],
- ]
-
- def prepare(self, name, *channel_list, **opts):
-
- mntgrp_list = self.findObjs(name, type_class=Type.MeasurementGroup)
-
- if len(mntgrp_list) != 0:
- raise Exception('A measurement group with that name already exists')
-
- def run(self, name, *channel_list):
- channel0 = self.getObj(channel_list[0])
- pool = channel0.getPoolObj()
- mg = pool.createMeasurementGroup(name, channel_list)
- self.print("Created %s" % str(mg))
-
-
-class udefmeas(Macro):
- """Deletes an existing measurement group"""
-
- param_def = [ ['name', Type.MeasurementGroup, None, 'Measurement group name'],]
-
- def run(self, mntgrp):
- pool = mntgrp.getPoolObj()
- pool.deleteMeasurementGroup(mntgrp.getName())
-
-
-class defelem(Macro):
- """Creates an element on a controller with an axis"""
-
- param_def = [ ['name', Type.String, None, 'new element name'],
- ['ctrl', Type.Controller, None, 'existing controller'],
- ['axis', Type.Integer, -1, 'axis in the controller (default is -1, meaning add to the end)'],]
-
- def run(self, name, ctrl, axis):
- pool = ctrl.getPoolObj()
- if axis == -1:
- axis = None
- elem = pool.createElement(name, ctrl, axis)
- self.print("Created %s" % str(elem))
-
-
-class udefelem(Macro):
- """Deletes an existing element"""
-
- param_def = [ ['element', Type.Element, None, 'element name'],]
-
- def run(self, element):
- pool = element.getPoolObj()
- pool.deleteElement(element.getName())
-
-
-class defctrl(Macro):
- """Creates a new controller
- 'role_prop' is a sequence of roles and/or properties.
- - A role is defined as <role name>=<role value> (only applicable to pseudo controllers)
- - A property is defined as <property name> <property value>
-
- If both roles and properties are supplied, all roles must come before properties.
- All controller properties that don't have default values must be given.
-
- Example of creating a motor controller (with a host and port properties):
-
- [1]: defctrl SuperMotorController myctrl host homer.springfield.com port 5000
-
- Example of creating a Slit pseudo motor (sl2t and sl2b motor roles, Gap and
- Offset pseudo motor roles):
-
- [1]: defctrl Slit myslit sl2t=mot01 sl2b=mot02 Gap=gap01 Offset=offset01"""
-
- param_def = [ ['class', Type.ControllerClass, None, 'controller class'],
- ['name', Type.String, None, 'new controller name'],
- ['roles_props',
- ParamRepeat(['role_prop', Type.String, None,
- 'a role or property item'],min=0),
- None, 'roles and/or properties'] ]
-
- def run(self, ctrl_class, name, *props):
- pool = ctrl_class.getPoolObj()
- elem = pool.createController(ctrl_class.name, name, *props)
- self.print("Created %s" % str(elem))
-
-
-class udefctrl(Macro):
- """Deletes an existing controller"""
-
- param_def = [ ['controller', Type.Controller, None, 'existing controller'],]
-
- def run(self, controller):
- pool = controller.getPoolObj()
- pool.deleteController(controller.getName())
-
-################################################################################
-#
-# Controller related macros
-#
-################################################################################
-
-
-class send2ctrl(Macro):
- """Sends the given data directly to the controller"""
-
- param_def = [['controller', Type.Controller, None, 'Controller name'],
- ['data',
- ParamRepeat(['string item', Type.String, None, 'a string item'],),
- None, 'data to be sent']]
-
- def run(self, controller, *data):
- name = controller.getName()
- pool = controller.getPoolObj()
- str_data = " ".join(data)
- res = pool.SendToController([name,str_data])
- self.output(res)
-
-################################################################################
-#
-# Library handling related macros
-#
-################################################################################
-
-class edctrl(Macro):
- """Returns the contents of the library file which contains the given
- controller code."""
-
- param_def = [
- ['ctrlclass', Type.ControllerClass, None, 'Controller class name']
- ]
-
- result_def = [
- ['filedata', Type.File, None, 'The file data object.']
- ]
-
- hints = { 'commit_cmd' : 'commit_ctrllib' }
-
- def run(self,ctrlclass):
- f_name = ctrlclass.file
- pool = ctrlclass.getPool()
- data = pool.GetFile(f_name)
- data = array.array('B',data).tostring()
- line_nb = 1
- for line in data.splitlines():
- line = line.strip(' \t')
- if line.startswith('class') and line.find(ctrlclass.name)>0 and \
- line.endswith(":"):
- break
- line_nb = line_nb + 1
- return [f_name,data,line_nb]
-
-class edctrllib(Macro):
- """Returns the contents of the given library file"""
-
- param_def = [
- ['filename', Type.Filename, None, 'Absolute path and file name or '\
- 'simple filename. Relative paths are not allowed.']
- ]
-
- result_def = [
- ['filedata', Type.File, None, 'The file data object']
- ]
-
- hints = { 'commit_cmd' : 'commit_ctrllib' }
-
- def run(self,filename):
- pool = self.getManager().getPool()
- data = pool.GetFile(filename)
- return [filename,array.array('B',data).tostring(),0]
-
-class commit_ctrllib(Macro):
- """Puts the contents of the given data in a file inside the pool"""
-
- param_def = [
- ['filename', Type.Filename, None, 'Absolute path and file name'],
- ['username', Type.User, None, 'The user name'],
- ['comment', Type.String, None, 'A description of the changes made to '\
- 'the file'],
- ['filedata', Type.File, None, 'The file data object']
- ]
-
- def run(self,filename,username,comment,filedata):
- pool = self.getManager().getPool()
- meta = filename + '\0' + username + '\0' + comment + '\0'
- data = array.array('B',meta)
- data.extend(array.array('B',filedata))
- pool.PutFile(data.tolist())
-
-################################################################################
-#
-# Macro handling related macros
-#
-################################################################################
-
-
-class prdef(Macro):
- """Returns the the macro code for the given macro name."""
-
- param_def = [
- ['macro_name', Type.MacroCode, None, 'macro name']
- ]
-
- def run(self,macro_data):
- code_lines, first_line = macro_data.code
- for code_line in code_lines:
- self.output(code_line.strip('\n'))
-
-
-class rellib(Macro):
-
- """Reloads the given python library code from the macro server filesystem.
-
- .. warning:: use with extreme care! Accidentally reloading a system
- module or an installed python module may lead to unpredictable
- behavior
-
- .. note:: if python module is used by any macro, don't forget to reload
- the corresponding macros afterward so the changes take effect."""
-
- param_def = [
- ['module_name', Type.String, None,
- 'The module name to be reloaded (without extension)']
- ]
-
- def run(self, module_name):
- try:
- self.reloadLibrary(module_name)
- self.output("%s successfully (re)loaded", module_name)
- except LibraryError:
- self.error("Cannot use rellib to reload a macro library. " \
- "Use 'relmaclib' instead")
- except ImportError:
- msg = "".join(traceback.format_exception_only(*sys.exc_info()[:2]))
- self.error(msg)
-
-
-class relmaclib(Macro):
- """Reloads the given macro library code from the macro server filesystem."""
-
- param_def = [
- ['macro_library', Type.MacroLibrary, None,
- 'The module name to be reloaded (without extension)']
- ]
-
- def run(self, macro_library):
- name = macro_library.name
- new_macro_library = self.reloadMacroLibrary(name)
- if new_macro_library.has_errors():
- exc_info = new_macro_library.get_error()
- #msg = "".join(traceback.format_exception(*exc_info))
- msg = "".join(traceback.format_exception_only(*exc_info[:2]))
- self.error(msg)
- else:
- macros = new_macro_library.get_macros()
- self.output("%s successfully (re)loaded (found %d macros)", name, len(macros))
-
-class addmaclib(Macro):
- """Loads a new macro library. Keep in mind that macros from the new library
- can override macros already present in the system."""
-
- param_def = [
- ['macro_library_name', Type.String, None,
- 'The module name to be loaded (without extension)']
- ]
-
- def prepare(self, macro_library_name):
- try:
- _ = self.getMacroLib(macro_library_name)
- except UnknownMacroLibrary:
- pass
- else:
- raise WrongParam('%s macro library is already loaded' %
- macro_library_name)
-
- def run(self, macro_library_name):
- old_macros = self.getMacroNames()
- new_macro_library = self.reloadMacroLibrary(macro_library_name)
- if new_macro_library.has_errors():
- exc_info = new_macro_library.get_error()
- msg = "".join(traceback.format_exception_only(*exc_info[:2]))
- self.error(msg)
- else:
- new_metamacros = new_macro_library.get_macros()
- # retrieving the macro names from the metamacros
- new_macros = [metamacro.name for metamacro in new_metamacros]
- self.output("%s successfully loaded (found %d macros)",
- macro_library_name, len(new_macros))
- # intersection between old and new indicates the overridden macros
- overridden_macros = list(set(old_macros) & set(new_macros))
- if len(overridden_macros) > 0:
- msg = ('%s macro library has overridden the following ' +
- 'macros: %s' ) % (macro_library_name, overridden_macros)
- self.warning(msg)
-
-
-class relmac(Macro):
- """Reloads the given macro code from the macro server filesystem.
- Attention: All macros inside the same file will also be reloaded."""
-
- param_def = [
- ['macro_code', Type.MacroCode, None, 'macro name to be reloaded']
- ]
-
- def run(self, macro_code):
- name = macro_code.name
- macro_library_name = macro_code.lib.name
- self.reloadMacro(name)
- macro_library = self.getMacroLibrary(macro_library_name)
- if macro_library.has_errors():
- exc_info = macro_library.get_error()
- #msg = "".join(traceback.format_exception(*exc_info))
- msg = "".join(traceback.format_exception_only(*exc_info[:2]))
- self.error(msg)
- else:
- self.output("%s successfully (re)loaded", name)
-
-
-class sar_info(Macro):
- """Prints details about the given sardana object"""
-
- param_def = [
- ['obj', Type.Object, None, 'obj']
- ]
-
- def run(self, obj):
- self.dump_properties(obj)
- #self.output("")
- #self.dump_attributes(obj)
-
- def dump_properties(self, obj):
- data = obj.serialize()
-
- table = Table([data.values()], row_head_str=data.keys(),
- row_head_fmt='%*s', col_sep=' = ')
- self.output("Properties:")
- self.output("-----------")
- for line in table.genOutput():
- self.output(line)
-
- def dump_attributes(self, obj):
- try:
- dev_attrs = obj.dump_attributes()
- except AttributeError:
- return
-
- row_head, values = [], []
- for dev_attr in dev_attrs:
- row_head.append(dev_attr.name)
- if dev_attr.has_failed:
- err = dev_attr.get_err_stack()
- if len(err):
- value = err[0].desc
- else:
- value = "Unknown error!"
- else:
- value = str(dev_attr.value)
- values.append(value)
- table = Table([values], row_head_str=row_head,
- row_head_fmt='%*s', col_sep=' = ')
- self.output("Attributes:")
- self.output("-----------")
- for line in table.genOutput():
- self.output(line)
-
diff --git a/src/sardana/macroserver/macros/ioregister.py b/src/sardana/macroserver/macros/ioregister.py
deleted file mode 100644
index 2d0fa1c2..00000000
--- a/src/sardana/macroserver/macros/ioregister.py
+++ /dev/null
@@ -1,68 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""IORegister related macros"""
-
-__docformat__ = 'restructuredtext'
-
-__all__ = ["write_ioreg", "read_ioreg"]
-
-from sardana.macroserver.macro import *
-
-import array
-
-
-class write_ioreg(Macro):
- """Writes a value to an input register"""
-
- param_def = [
- ['input/output register', Type.IORegister, None, 'input/output register'],
- ['data', Type.Integer, None, 'value to be send']
- ]
-
- def run(self, ioreg, data):
- name = ioreg.getName()
- o = "Writing " + str(data) + " to " + name + " register "
- self.debug(o)
- data = ioreg.writeIORegister(data)
-
-
-
-class read_ioreg(Macro):
- """Reads an output register"""
-
- param_def = [
- ['input/output register', Type.IORegister, None, 'input/output register']
- ]
-
- result_def = [
- ['input/output register value', Type.Integer, None, 'value read from ' +
- 'the input/output register']
- ]
-
- def run(self, ioreg):
- name = ioreg.getName()
- data = ioreg.readIORegister(force=True)
- o = "Reading " + name + " register "
- self.debug(o)
- return data
diff --git a/src/sardana/macroserver/macros/lists.py b/src/sardana/macroserver/macros/lists.py
deleted file mode 100644
index cb05700e..00000000
--- a/src/sardana/macroserver/macros/lists.py
+++ /dev/null
@@ -1,239 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer generic
-scan"""
-
-
-__all__ = ["ls0d", "ls1d", "ls2d", "lsa", "lscom", "lsct", "lsctrl",
- "lsctrllib", "lsdef", "lsexp", "lsi", "lsior", "lsm", "lsmeas",
- "lspc", "lspm", "lsmac", "lsmaclib"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.console import Alignment
-from taurus.console.list import List
-from sardana.macroserver.macro import *
-
-Left, Right, HCenter = Alignment.Left, Alignment.Right, Alignment.HCenter
-
-#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# List of elements related macros
-#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-class _ls(Macro):
- param_def = [
- ['filter',
- ParamRepeat(['filter', Type.String, '.*', 'a regular expression filter'], min=0, max=1),
- '.*', 'a regular expression filter'],
- ]
-
- def get_column_names(self):
- cols = []
- for col in self.cols:
- if isinstance(col, tuple):
- col = col[0]
- cols.append(col)
- return cols
-
- def get_column_members(self):
- cols = []
- for col in self.cols:
- if isinstance(col, tuple):
- col = col[1]
- cols.append(col.lower())
- return cols
-
- def run(self, *filter):
- self.warning('This macro is not intended to be executed directly by ' \
- 'the user')
- return
-
-class lsdef(_ls):
- """List all macro definitions"""
-
- cols = 'Name', 'Module', 'Brief Description'
- width = -1, -1, -1
- align = Right, Right, Left
-
- def run(self, filter):
-
- cols = self.get_column_names()
- out = List(cols, text_alignment=self.align,
- max_col_width=self.width)
-
- for m in self.getMacros(filter):
- if m.name.startswith("_"):
- continue
- out.appendRow([m.name, m.module_name, m.get_brief_description()])
-
- for line in out.genOutput():
- self.output(line)
-
-
-class _lsobj(_ls):
-
- subtype = Macro.All
-
- cols = 'Name', 'Type', 'Controller', 'Axis'#, 'State'
- width = -1, -1, -1, -1#, -1
- align = Right, Right, Right, Right#, Right
-
- def objs(self, filter):
- return self.findObjs(filter, type_class=self.type, subtype=self.subtype,
- reserve=False)
-
- def obj2Row(self, o, cols=None):
- cols = cols or self.get_column_members()
- ret = []
- for col in cols:
- if col == 'controller':
- value = self.getController(o.controller).name
- else:
- value = getattr(o, col)
- if value is None:
- value = '-----'
- ret.append(value)
- return ret
-
- def run(self, filter):
- objs = self.objs(filter)
- nb = len(objs)
- if nb is 0:
- if self.subtype is Macro.All:
- if isinstance(self.type, (str, unicode)):
- t = self.type.lower()
- else:
- t = ", ".join(self.type).lower()
- else:
- t = self.subtype.lower()
- self.output('No %ss defined' % t)
- return
-
- cols = self.get_column_names()
- out = List(cols, text_alignment=self.align,
- max_col_width=self.width)
- objs.sort()
- for obj in objs:
- try:
- out.appendRow( self.obj2Row(obj) )
- except:
- pass
- for line in out.genOutput():
- self.output(line)
-
-
-class lsm(_lsobj):
- """Lists all motors"""
- type = Type.Moveable
-
-class lspm(lsm):
- """Lists all existing motors"""
- subtype = 'PseudoMotor'
-
-class lscom(_lsobj):
- """Lists all communication channels"""
- type = Type.ComChannel
-
-class lsior(_lsobj):
- """Lists all IORegisters"""
- type = Type.IORegister
-
-class lsexp(_lsobj):
- """Lists all experiment channels"""
- type = Type.ExpChannel
-
-class lsct(lsexp):
- """Lists all Counter/Timers"""
- subtype = 'CTExpChannel'
-
-class ls0d(lsexp):
- """Lists all 0D experiment channels"""
- subtype = 'ZeroDExpChannel'
-
-class ls1d(lsexp):
- """Lists all 1D experiment channels"""
- subtype = 'OneDExpChannel'
-
-class ls2d(lsexp):
- """Lists all 2D experiment channels"""
- subtype = 'TwoDExpChannel'
-
-class lspc(lsexp):
- """Lists all pseudo counters"""
- subtype = 'PseudoCounter'
-
-class lsctrllib(_lsobj):
- """Lists all existing controller classes"""
- type = Type.ControllerClass
- cols = 'Name', ('Type', 'main_type'), ('Library', 'module'), ('Family','gender')
-
-class lsctrl(_lsobj):
- """Lists all existing controllers"""
- type = Type.Controller
- cols = 'Name', ('Type', 'main_type'), ('Class', 'klass'), 'Module'
-
-class lsi(_lsobj):
- """Lists all existing instruments"""
- type = Type.Instrument
- cols = 'Name', 'Type', ('Parent', 'parent_instrument')
-
-class lsa(_lsobj):
- """Lists all existing objects"""
- type = Type.Moveable, Type.ComChannel, Type.ExpChannel, Type.IORegister
-
-class lsmeas(_lsobj):
- """List existing measurement groups"""
-
- type = Type.MeasurementGroup
-
- cols = 'Active', 'Name', 'Timer', 'Experim. channels'
- width = -1, -1, -1, 60
- align = HCenter, Right, Right, Left
-
- def prepare(self, filter, **opts):
- try:
- self.mnt_grp = self.getEnv('ActiveMntGrp').lower() or None
- except:
- self.mnt_grp = None
-
- def obj2Row(self, o):
- if self.mnt_grp and (o.getName().lower() == self.mnt_grp):
- active = '*'
- else:
- active = ' '
- return active, o.name, o.getTimerName(), ", ".join(o.getChannelLabels())
-
-class lsmac(_lsobj):
- """Lists existing macros"""
-
- type = Type.MacroCode
- cols = 'Name', ('Location', 'file_path')
-
-class lsmaclib(_lsobj):
- """Lists existing macro libraries."""
-
- type = Type.MacroLibrary
- cols = 'Name', ('Location', 'file_path')
diff --git a/src/sardana/macroserver/macros/mca.py b/src/sardana/macroserver/macros/mca.py
deleted file mode 100644
index 9fa506af..00000000
--- a/src/sardana/macroserver/macros/mca.py
+++ /dev/null
@@ -1,58 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""MCA related macros"""
-
-__docformat__ = 'restructuredtext'
-
-__all__ = ["mca_start", "mca_stop"]
-
-from sardana.macroserver.macro import *
-
-import array
-
-class mca_start(Macro):
- """Starts an mca"""
-
- param_def = [
- ['mca', Type.ExpChannel, None, 'mca']
- ]
-
- def run(self, mca):
- name = mca.getName()
- mca.Start()
- o = "Starting " + name
- self.output(o)
-
-class mca_stop(Macro):
- """Stops an mca"""
-
- param_def = [
- ['mca', Type.ExpChannel, None, 'mca']
- ]
-
- def run(self, mca):
- name = mca.getName()
- mca.Abort()
- o = "Stopping " + name
- self.output(o)
diff --git a/src/sardana/macroserver/macros/scan.py b/src/sardana/macroserver/macros/scan.py
deleted file mode 100644
index 0fbc3326..00000000
--- a/src/sardana/macroserver/macros/scan.py
+++ /dev/null
@@ -1,1363 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
- Macro library containning scan macros for the macros server Tango device
- server as part of the Sardana project.
-
- Available Macros are:
- ascan family: ascan, a2scan, a3scan, a4scan and amultiscan
- dscan family: dscan, d2scan, d3scan, d4scan and dmultiscan
- mesh
- fscan
- scanhist
-"""
-
-__all__ = ["a2scan", "a3scan", "a4scan", "amultiscan", "aNscan", "ascan",
- "d2scan", "d3scan", "d4scan", "dmultiscan", "dNscan", "dscan",
- "fscan", "mesh",
- "a2scanc", "a3scanc", "a4scanc", "ascanc",
- "d2scanc", "d3scanc", "d4scanc", "dNScanc", "dscanc",
- "meshc",
- "a2scanct", "a3scanct", "a4scanct", "ascanct",
- "scanhist", "getCallable", "UNCONSTRAINED"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import copy
-import datetime
-
-import numpy
-
-from taurus.console import Alignment
-from taurus.console.list import List
-from taurus.console.table import Table
-
-from sardana.macroserver.msexception import UnknownEnv
-from sardana.macroserver.macro import *
-from sardana.macroserver.scan import *
-from sardana.util.motion import Motor, MotionPath
-from sardana.util.tree import BranchNode, LeafNode, Tree
-
-UNCONSTRAINED="unconstrained"
-
-StepMode = 's'
-ContinuousMode = 'c' #TODO: change it to be more verbose e.g. ContinuousSwMode
-ContinuousHwTimeMode = 'ct'
-HybridMode = 'h'
-
-def getCallable(repr):
- '''returns a function .
- Ideas: repr could be an URL for a file where the function is contained,
- or be evaluable code, or a pickled function object,...
-
- In any case, the return from it should be a callable of the form:
- f(x1,x2) where x1, x2 are points in the moveable space and the return value
- of f is True if the movement from x1 to x2 is allowed. False otherwise'''
- if repr==UNCONSTRAINED:
- return lambda x1,x2:True
- else:
- return lambda: None
-
-class aNscan(Hookable):
-
- hints = { 'scan' : 'aNscan', 'allowsHooks': ('pre-scan', 'pre-move', 'post-move', 'pre-acq', 'post-acq', 'post-step', 'post-scan') }
- #env = ('ActiveMntGrp',)
-
- """N-dimensional scan. This is **not** meant to be called by the user,
- but as a generic base to construct ascan, a2scan, a3scan,..."""
- def _prepare(self, motorlist, startlist, endlist, scan_length, integ_time, mode=StepMode, **opts):
-
- self.motors = motorlist
- self.starts = numpy.array(startlist,dtype='d')
- self.finals = numpy.array(endlist,dtype='d')
- self.mode = mode
- self.integ_time = integ_time
- self.opts = opts
- if len(self.motors) == self.starts.size == self.finals.size:
- self.N = self.finals.size
- else:
- raise ValueError('Moveablelist, startlist and endlist must all be same length')
-
- moveables = []
- for m, start, final in zip(self.motors, self.starts, self.finals):
- moveables.append(MoveableDesc(moveable=m, min_value=min(start,final), max_value=max(start,final)))
- moveables[0].is_reference = True
-
- env = opts.get('env',{})
- constrains = [getCallable(cns) for cns in opts.get('constrains',[UNCONSTRAINED])]
- extrainfodesc = opts.get('extrainfodesc',[])
-
- #Hooks are not always set at this point. We will call getHooks later on in the scan_loop
- #self.pre_scan_hooks = self.getHooks('pre-scan')
- #self.post_scan_hooks = self.getHooks('post-scan'
-
- if mode == StepMode:
- self.nr_interv = scan_length
- self.nr_points = self.nr_interv+1
- self.interv_sizes = ( self.finals - self.starts) / self.nr_interv
- self.name = opts.get('name','a%iscan'%self.N)
- self._gScan = SScan(self, self._stepGenerator, moveables, env, constrains, extrainfodesc)
- elif mode in [ContinuousMode, ContinuousHwTimeMode]:
- #TODO: probably not 100% correct,
- # the idea is to allow passing a list of waypoints
- if isinstance(endlist[0],list):
- self.waypoints = self.finals
- else:
- self.waypoints = [self.finals]
- self.nr_waypoints = len(self.waypoints)
- if mode == ContinuousMode:
- self.slow_down = scan_length
- self.nr_waypoints = 2 #aNscans will only have two waypoints (the start and the final positions)
- self.way_lengths = ( self.finals - self.starts) / (self.nr_waypoints -1)
- self.name = opts.get('name','a%iscanc'%self.N)
- self._gScan = CSScan(self, self._waypoint_generator, self._period_generator, moveables, env, constrains, extrainfodesc)
- elif mode == ContinuousHwTimeMode:
- self.nr_of_points = scan_length
- self.name = opts.get('name','a%iscanct'%self.N)
- self._gScan = CTScan(self, self._waypoint_generator_hwtime,
- moveables,
- env,
- constrains,
- extrainfodesc)
- elif mode == HybridMode:
- self.nr_interv = scan_length
- self.nr_points = self.nr_interv+1
- self.interv_sizes = ( self.finals - self.starts) / self.nr_interv
- self.name = opts.get('name','a%iscanh'%self.N)
- self._gScan = HScan(self, self._stepGenerator, moveables, env, constrains, extrainfodesc)
- else:
- raise ValueError('invalid value for mode %s' % mode)
-
- def _stepGenerator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["pre-acq-hooks"] = self.getHooks('pre-acq')
- step["post-acq-hooks"] = self.getHooks('post-acq') + self.getHooks('_NOHINTS_')
- step["post-step-hooks"] = self.getHooks('post-step')
-
- step["check_func"] = []
- for point_no in xrange(self.nr_points):
- step["positions"] = self.starts + point_no * self.interv_sizes
- step["point_id"] = point_no
- yield step
-
- def _waypoint_generator(self):
- step = {}
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["check_func"] = []
- step["slow_down"] = self.slow_down
- for point_no in xrange(self.nr_waypoints):
- step["positions"] = self.starts + point_no * self.way_lengths
- step["waypoint_id"] = point_no
- yield step
-
- def _waypoint_generator_hwtime(self):
- #TODO: remove starts
- def calculate_positions(moveable_node, start, end):
- '''Function to calculate starting and ending positions on the physical
- motors level.
- :param moveable_node: (BaseNode) node representing a moveable.
- Can be a BranchNode representing a PseudoMotor,
- or a LeafNode representing a PhysicalMotor).
- :param start: (float) starting position of the moveable
- :param end: (float) ending position of the moveable
-
- :return: (list<(float,float)>) a list of tuples comprising starting
- and ending positions. List order is important and preserved.'''
- start_positions = []
- end_positions = []
- if isinstance(moveable_node, BranchNode):
- pseudo_node = moveable_node
- moveable = pseudo_node.data
- moveable_nodes = moveable_node.children
- starts = moveable.calcPhysical(start)
- ends = moveable.calcPhysical(end)
- for moveable_node, start, end in zip(moveable_nodes, starts,
- ends):
- _start_positions, _end_positions = calculate_positions(
- moveable_node,
- start, end)
- start_positions += _start_positions
- end_positions += _end_positions
- else:
- start_positions = [start]
- end_positions = [end]
-
- return start_positions, end_positions
-
- #CScan in its constructor populates a list of data structures - trees.
- #Each tree represent one Moveables with its hierarchy of inferior moveables.
- moveables_trees = self._gScan.get_moveables_trees()
- step = {}
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["check_func"] = []
- step["active_time"] = self.nr_of_points * self.integ_time
- step["positions"] = []
- step["start_positions"] = []
- starts = self.starts
- for point_no, waypoint in enumerate(self.waypoints):
- for start, end, moveable_tree in zip(starts, waypoint,
- moveables_trees):
- moveable_root = moveable_tree.root()
- start_positions, end_positions = calculate_positions(moveable_root, start, end)
- step["start_positions"] += start_positions
- step["positions"] += end_positions
- step["waypoint_id"] = point_no
- starts = waypoint
- yield step
-
- def _period_generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["pre-acq-hooks"] = self.getHooks('pre-acq')
- step["post-acq-hooks"] = self.getHooks('post-acq')+self.getHooks('_NOHINTS_')
- step["post-step-hooks"] = self.getHooks('post-step')
- step["check_func"] = []
- step['extrainfo'] = {}
- point_no = 0
- while(True):
- point_no += 1
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
- @property
- def data(self):
- return self._gScan.data
-
- def getTimeEstimation(self):
- gScan = self._gScan
- mode = self.mode
- it = gScan.generator()
- v_motors = gScan.get_virtual_motors()
- curr_pos = gScan.motion.readPosition()
- total_time = 0.0
- if mode == StepMode:
- # calculate motion time
- max_step0_time, max_step_time = 0.0, 0.0
- # first motion takes longer, all others should be "equal"
- step0 = it.next()
- for v_motor, start, stop, length in zip(v_motors, curr_pos, step0['positions'], self.interv_sizes):
- path0 = MotionPath(v_motor, start, stop)
- path = MotionPath(v_motor, 0, length)
- max_step0_time = max(max_step0_time, path0.duration)
- max_step_time = max(max_step_time, path.duration)
- motion_time = max_step0_time + self.nr_interv * max_step_time
- # calculate acquisition time
- acq_time = self.nr_points * self.integ_time
- total_time = motion_time + acq_time
-
- elif mode == ContinuousMode:
- total_time = gScan.waypoint_estimation()
- #TODO: add time estimation for ContinuousHwTimeMode
- return total_time
-
- def getIntervalEstimation(self):
- mode = self.mode
- if mode == StepMode:
- return self.nr_interv
- elif mode == ContinuousMode:
- return self.nr_waypoints
-
-class dNscan(aNscan):
- '''same as aNscan but it interprets the positions as being relative to the
- current positions and upon completion, it returns the motors to their
- original positions'''
-
- hints = copy.deepcopy(aNscan.hints)
- hints['scan'] = 'dNscan'
-
- def _prepare(self, motorlist, startlist, endlist, scan_length, integ_time, mode=StepMode, **opts):
- self._motion=self.getMotion( [ m.getName() for m in motorlist] )
- self.originalPositions = numpy.array(self._motion.readPosition())
- starts = numpy.array(startlist, dtype='d') + self.originalPositions
- finals = numpy.array(endlist, dtype='d') + self.originalPositions
- aNscan._prepare(self, motorlist, starts, finals, scan_length, integ_time, mode=mode, **opts)
-
- def do_restore(self):
- self.info("Returning to start positions...")
- self._motion.move(self.originalPositions)
-
-
-class ascan(aNscan, Macro):
- """Do an absolute scan of the specified motor.
- ascan scans one motor, as specified by motor. The motor starts at the
- position given by start_pos and ends at the position given by final_pos.
- The step size is (start_pos-final_pos)/nr_interv. The number of data points collected
- will be nr_interv+1. Count time is given by time which if positive,
- specifies seconds and if negative, specifies monitor counts. """
-
- param_def = [
- ['motor', Type.Moveable, None, 'Moveable to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time,
- **opts):
- self._prepare([motor], [start_pos], [final_pos], nr_interv, integ_time, **opts)
-
-
-class a2scan(aNscan, Macro):
- """two-motor scan.
- a2scan scans two motors, as specified by motor1 and motor2.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_pos1 and final_pos1, start_pos2 and final_pos2,
- respectively. The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor1, start_pos1, final_pos1, motor2, start_pos2, final_pos2, nr_interv, integ_time,
- **opts):
- self._prepare([motor1,motor2], [start_pos1,start_pos2], [final_pos1,final_pos2], nr_interv, integ_time, **opts)
-
-
-class a3scan(aNscan, Macro):
- """three-motor scan .
- a3scan scans three motors, as specified by motor1, motor2 and motor3.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_pos1 and final_pos1, start_pos2 and final_pos2,
- start_pos3 and final_pos3, respectively.
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, nr_interv, integ_time,
- **opts):
- self._prepare([m1,m2,m3], [s1,s2,s3], [f1,f2,f3], nr_interv, integ_time, **opts)
-
-
-class a4scan(aNscan, Macro):
- """four-motor scan .
- a4scan scans four motors, as specified by motor1, motor2, motor3 and motor4.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_posN and final_posN (for N=1,2,3,4).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['motor4', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos4', Type.Float, None, 'Scan start position 3'],
- ['final_pos4', Type.Float, None, 'Scan final position 3'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, m4, s4, f4, nr_interv,
- integ_time, **opts):
- self._prepare([m1,m2,m3,m4], [s1,s2,s3,s4], [f1,f2,f3,f4], nr_interv, integ_time, **opts)
-
-
-class amultiscan(aNscan, Macro):
- '''Multiple motor scan.
- amultiscan scans N motors, as specified by motor1, motor2,...,motorN.
- Each motor moves the same number of intervals with starting and ending
- positions given by start_posN and final_posN (for N=1,2,...).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- '''
-
- param_def = [
- ['motor_start_end_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Moveable to move'],
- ['start', Type.Float, None, 'Starting position'],
- ['end', Type.Float, None, 'Final position']),
- None, 'List of motor, start and end positions'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, *args, **opts):
- motors = args[0:-2:3]
- starts = args[1:-2:3]
- ends = args[2:-2:3]
- nr_interv = args[-2]
- integ_time = args[-1]
-
- self._prepare(motors, starts, ends, nr_interv, integ_time, **opts)
-
-class dmultiscan(dNscan, Macro):
- '''Multiple motor scan relative to the starting positions.
- dmultiscan scans N motors, as specified by motor1, motor2,...,motorN.
- Each motor moves the same number of intervals If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2,...)
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- '''
- param_def = [
- ['motor_start_end_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Moveable to move'],
- ['start', Type.Float, None, 'Starting position'],
- ['end', Type.Float, None, 'Final position']),
- None, 'List of motor, start and end positions'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, *args, **opts):
- motors = args[0:-2:3]
- starts = args[1:-2:3]
- ends = args[2:-2:3]
- nr_interv = args[-2]
- integ_time = args[-1]
-
- self._prepare(motors, starts, ends, nr_interv, integ_time, **opts)
-
-
-class dscan(dNscan, Macro):
- """motor scan relative to the starting position.
- dscan scans one motor, as specified by motor. If motor motor is at a
- position X before the scan begins, it will be scanned from X+start_pos
- to X+final_pos. The step size is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1. Count time is
- given by time which if positive, specifies seconds and if negative,
- specifies monitor counts. """
-
- param_def = [
- ['motor', Type.Moveable, None, 'Moveable to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time,
- **opts):
- self._prepare([motor], [start_pos], [final_pos], nr_interv, integ_time, **opts)
-
-
-class d2scan(dNscan,Macro):
- """two-motor scan relative to the starting position.
- d2scan scans two motors, as specified by motor1 and motor2.
- Each motor moves the same number of intervals. If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor1, start_pos1, final_pos1, motor2, start_pos2, final_pos2, nr_interv, integ_time,
- **opts):
- self._prepare([motor1,motor2], [start_pos1,start_pos2], [final_pos1,final_pos2], nr_interv, integ_time, **opts)
-
-
-class d3scan(dNscan, Macro):
- """three-motor scan .
- d3scan scans three motors, as specified by motor1, motor2 and motor3.
- Each motor moves the same number of intervals. If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2,3)
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts."""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, nr_interv, integ_time,
- **opts):
- self._prepare([m1,m2,m3], [s1,s2,s3], [f1,f2,f3], nr_interv, integ_time, **opts)
-
-
-class d4scan(dNscan, Macro):
- """four-motor scan relative to the starting positions
- a4scan scans four motors, as specified by motor1, motor2, motor3 and motor4.
- Each motor moves the same number of intervals. If each motor is at a
- position X before the scan begins, it will be scanned from X+start_posN
- to X+final_posN (where N is one of 1,2,3,4).
- The step size for each motor is (start_pos-final_pos)/nr_interv.
- The number of data points collected will be nr_interv+1.
- Count time is given by time which if positive, specifies seconds and
- if negative, specifies monitor counts.
- Upon termination, the motors are returned to their starting positions.
- """
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['motor4', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos4', Type.Float, None, 'Scan start position 3'],
- ['final_pos4', Type.Float, None, 'Scan final position 3'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, m4, s4, f4, nr_interv,
- integ_time, **opts):
- self._prepare([m1,m2,m3,m4], [s1,s2,s3,s4], [f1,f2,f3,f4], nr_interv, integ_time, **opts)
-
-
-class mesh(Macro,Hookable):
- """2d grid scan .
- The mesh scan traces out a grid using motor1 and motor2.
- The first motor scans from m1_start_pos to m1_final_pos using the specified
- number of intervals. The second motor similarly scans from m2_start_pos
- to m2_final_pos. Each point is counted for for integ_time seconds
- (or monitor counts, if integ_time is negative).
- The scan of motor1 is done at each point scanned by motor2. That is, the
- first motor scan is nested within the second motor scan.
- """
-
- hints = { 'scan' : 'mesh', 'allowsHooks': ('pre-scan', 'pre-move', 'post-move', 'pre-acq', 'post-acq', 'post-step', 'post-scan') }
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor1', Type.Moveable, None, 'First motor to move'],
- ['m1_start_pos',Type.Float, None, 'Scan start position for first motor'],
- ['m1_final_pos',Type.Float, None, 'Scan final position for first motor'],
- ['m1_nr_interv',Type.Integer, None, 'Number of scan intervals'],
- ['motor2', Type.Moveable, None, 'Second motor to move'],
- ['m2_start_pos',Type.Float, None, 'Scan start position for second motor'],
- ['m2_final_pos',Type.Float, None, 'Scan final position for second motor'],
- ['m2_nr_interv',Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['bidirectional', Type.Boolean, False, 'Save time by scanning s-shaped']
- ]
-
- def prepare(self, m1, m1_start_pos, m1_final_pos, m1_nr_interv,
- m2, m2_start_pos, m2_final_pos, m2_nr_interv, integ_time,
- bidirectional, **opts):
- self.motors=[m1,m2]
- self.starts = numpy.array([m1_start_pos,m2_start_pos],dtype='d')
- self.finals = numpy.array([m1_final_pos,m2_final_pos],dtype='d')
- self.nr_intervs= numpy.array([m1_nr_interv, m2_nr_interv],dtype='i')
- self.integ_time = integ_time
- self.bidirectional_mode = bidirectional
-
- self.name=opts.get('name','mesh')
-
- generator=self._generator
- moveables=self.motors
- env=opts.get('env',{})
- constrains=[getCallable(cns) for cns in opts.get('constrains',[UNCONSTRAINED])]
-
- #Hooks are not always set at this point. We will call getHooks later on in the scan_loop
- #self.pre_scan_hooks = self.getHooks('pre-scan')
- #self.post_scan_hooks = self.getHooks('post-scan')
-
- self._gScan=SScan(self, generator, moveables, env, constrains)
-
- def _generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["pre-acq-hooks"] = self.getHooks('pre-acq')
- step["post-acq-hooks"] = self.getHooks('post-acq') + self.getHooks('_NOHINTS_')
- step["post-step-hooks"] = self.getHooks('post-step')
- step["check_func"] = []
- m1start,m2start=self.starts
- m1end,m2end=self.finals
- points1,points2=self.nr_intervs+1
- point_no=1
- m1_space = numpy.linspace(m1start,m1end,points1)
- m1_space_inv = numpy.linspace(m1end,m1start,points1)
-
- for i, m2pos in enumerate(numpy.linspace(m2start,m2end,points2)):
- space = m1_space
- if i % 2 != 0 and self.bidirectional_mode:
- space = m1_space_inv
- for m1pos in space:
- step["positions"] = numpy.array([m1pos,m2pos])
- step["point_id"]= point_no #TODO: maybe another ID would be better? (e.g. "(A,B)")
- point_no+=1
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
- @property
- def data(self):
- return self._gScan.data
-
-class fscan(Macro,Hookable):
- '''N-dimensional scan along user defined paths.
- The motion path for each motor is defined through the evaluation of a
- user-supplied function that is evaluated as a function of the independent
- variables.
- -independent variables are supplied through the indepvar string.
- The syntax for indepvar is "x=expresion1,y=expresion2,..."
- -If no indep vars need to be defined, write "!" or "*" or "None"
- -motion path for motor is generated by evaluating the corresponding
- function 'func'
- -Count time is given by integ_time. If integ_time is a scalar, then
- the same integ_time is used for all points. If it evaluates as an array
- (with same length as the paths), fscan will assign a different integration
- time to each acquisition point.
- -If integ_time is positive, it specifies seconds and if negative, specifies
- monitor counts.
-
- IMPORTANT Notes:
- -no spaces are allowed in the indepvar string.
- -all funcs must evaluate to the same number of points
-
- EXAMPLE: fscan x=[1,3,5,7,9],y=arange(5) motor1 x**2 motor2 sqrt(y*x-3) 0.1
- '''
-
- hints = { 'scan' : 'fscan', 'allowsHooks': ('pre-scan', 'pre-move', 'post-move', 'pre-acq', 'post-acq', 'post-step', 'post-scan') }
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['indepvars', Type.String, None, 'Independent Variables'],
- ['motor_funcs',
- ParamRepeat(['motor', Type.Moveable, None, 'motor'],
- ['func', Type.String, None, 'curve defining path']),
- None, 'List of motor and path curves'],
- ['integ_time', Type.String, None, 'Integration time']
- ]
-
- def prepare(self, *args, **opts):
- if args[0].lower() in ["!", "*", "none", None]: indepvars={}
- else: indepvars=SafeEvaluator({'dict':dict}).eval('dict(%s)'%args[0]) #create a dict containing the indepvars
- self.motors=args[1:-1:2] #get motors
- sev=SafeEvaluator(indepvars) #create a safe evaluator whitelisting the indepvars
- self.funcstrings=args[2:-1:2]
- self.paths = map(sev.eval,self.funcstrings) #evaluate the functions
- self.integ_time=numpy.array(sev.eval(args[-1]), dtype='d')
- self.opts = opts
- if len(self.motors)==len(self.paths)>0:
- self.N=len(self.motors)
- else:
- raise ValueError('Moveable and func lists must be non-empty and same length')
- npoints=len(self.paths[0])
- try:
- #if everything is OK, the following lines should return a 2D array
- # n which each motor path is a row.
- #Typical failure is due to shape mismatch due to inconsistent input
- self.paths=numpy.array(self.paths,dtype='d')
- self.paths.reshape((self.N, npoints))
- except: #shape mismatch?
- #try to give a meaningful description of the error
- for p,fs in zip(self.paths,self.funcstrings):
- if len(p)!=npoints:
- raise ValueError(
- '"%s" and "%s" yield different number of points (%i vs %i)'
- %(self.funcstrings[0],fs,npoints,len(p)))
- raise #the problem wasn't a shape mismatch
- self.nr_points=npoints
-
- if self.integ_time.size==1:
- self.integ_time=self.integ_time*numpy.ones(self.nr_points) #extend integ_time
- elif self.integ_time.size!=self.nr_points:
- raise ValueError('time_integ must either be a scalar or length=npoints (%i)'%self.nr_points)
-
- self.name=opts.get('name','fscan')
-
- generator=self._generator
- moveables=self.motors
- env=opts.get('env',{})
- constrains=[getCallable(cns) for cns in opts.get('constrains',[UNCONSTRAINED])]
-
- #Hooks are not always set at this point. We will call getHooks later on in the scan_loop
- #self.pre_scan_hooks = self.getHooks('pre-scan')
- #self.post_scan_hooks = self.getHooks('post-scan'
-
- self._gScan=SScan(self, generator, moveables, env, constrains)
-
- def _generator(self):
- step = {}
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["pre-acq-hooks"] = self.getHooks('pre-acq')
- step["post-acq-hooks"] = self.getHooks('post-acq') + self.getHooks('_NOHINTS_')
- step["post-step-hooks"] = self.getHooks('post-step')
-
- step["check_func"] = []
- for i in xrange(self.nr_points):
- step["positions"] = self.paths[:,i]
- step["integ_time"] = self.integ_time[i]
- step["point_id"]= i
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
- @property
- def data(self):
- return self._gScan.data
-
-
-class ascanh(aNscan, Macro):
- """Do an absolute scan of the specified motor.
- ascan scans one motor, as specified by motor. The motor starts at the
- position given by start_pos and ends at the position given by final_pos.
- The step size is (start_pos-final_pos)/nr_interv. The number of data points collected
- will be nr_interv+1. Count time is given by time which if positive,
- specifies seconds and if negative, specifies monitor counts. """
-
- param_def = [
- ['motor', Type.Moveable, None, 'Moveable to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time']
- ]
-
- def prepare(self, motor, start_pos, final_pos, nr_interv, integ_time,
- **opts):
- self._prepare([motor], [start_pos], [final_pos], nr_interv, integ_time,
- mode=HybridMode, **opts)
-
-
-class scanhist(Macro):
- """Shows scan history information. Give optional parameter scan number to
- display details about a specific scan"""
-
- param_def = [
- ['scan number', Type.Integer, -1,
- 'scan number. [default=-1 meaning show all scans]'],
- ]
-
- def run(self, scan_number):
- try:
- hist = self.getEnv("ScanHistory")
- except UnknownEnv:
- print "No scan recorded in history"
- return
- if scan_number < 0:
- self.show_all(hist)
- else:
- self.show_one(hist, scan_number)
-
- def show_one(self, hist, scan_number):
- item = None
- for h in hist:
- if h['serialno'] == scan_number:
- item = h
- break
- if item is None:
- self.warning("Could not find scan number %s", scan_number)
- return
-
- serialno, title = h['serialno'], h['title']
- start = datetime.datetime.fromtimestamp(h['startts'])
- end = datetime.datetime.fromtimestamp(h['endts'])
- total_time = end - start
- start, end, total_time = start.ctime(), end.ctime(), str(total_time)
- scan_dir, scan_file = h['ScanDir'], h['ScanFile']
- deadtime = '%.1f%%' % h['deadtime']
-
- user = h['user']
- store = "Not stored!"
- if scan_dir is not None and scan_file is not None:
- if type(scan_file) is str:
- store = os.path.join(scan_dir, scan_file)
- else:
- store = scan_dir + os.path.sep + str(scan_file)
-
- channels = ", ".join(h['channels'])
- cols = ["#", "Title", "Start time", "End time", "Took", "Dead time",
- "User", "Stored", "Channels" ]
- data = [serialno, title, start, end, total_time, deadtime, user, store,
- channels]
-
- table = Table([data], row_head_str=cols, row_head_fmt='%*s',
- elem_fmt=['%-*s'],
- col_sep=' : ')
- for line in table.genOutput():
- self.output(line)
-
- def show_all(self, hist):
-
- cols = "#", "Title", "Start time", "End time", "Stored"
- width = -1, -1, -1, -1, -1
- out = List(cols, max_col_width=width)
- today = datetime.datetime.today().date()
- for h in hist:
- start = datetime.datetime.fromtimestamp(h['startts'])
- if start.date() == today:
- start = start.time().strftime("%H:%M:%S")
- else:
- start = start.strftime("%Y-%m-%d %H:%M:%S")
- end = datetime.datetime.fromtimestamp(h['endts'])
- if end.date() == today:
- end = end.time().strftime("%H:%M:%S")
- else:
- end = end.strftime("%Y-%m-%d %H:%M:%S")
- scan_file = h['ScanFile']
- store = "Not stored!"
- if scan_file is not None:
- store = ", ".join(scan_file)
- row = h['serialno'], h['title'], start, end, store
- out.appendRow(row)
- for line in out.genOutput():
- self.output(line)
-
-
-class ascanc(aNscan, Macro):
- """Do an absolute continuous scan of the specified motor.
- ascanc scans one motor, as specified by motor."""
-
- param_def = [
- ['motor', Type.Moveable, None, 'Moveable to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, motor, start_pos, final_pos, integ_time, slow_down,
- **opts):
- self._prepare([motor], [start_pos], [final_pos], slow_down,
- integ_time, mode=ContinuousMode, **opts)
-
-
-class a2scanc(aNscan, Macro):
- """two-motor continuous scan"""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, motor1, start_pos1, final_pos1, motor2, start_pos2,
- final_pos2, integ_time, slow_down, **opts):
- self._prepare([motor1, motor2], [start_pos1, start_pos2],
- [final_pos1, final_pos2], slow_down, integ_time,
- mode=ContinuousMode, **opts)
-
-
-class a3scanc(aNscan, Macro):
- """three-motor continuous scan"""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, integ_time,
- slow_down, **opts):
- self._prepare([m1,m2,m3], [s1,s2,s3], [f1,f2,f3], slow_down,
- integ_time, mode=ContinuousMode, **opts)
-
-class a4scanc(aNscan, Macro):
- """four-motor continuous scan"""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['motor4', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos4', Type.Float, None, 'Scan start position 3'],
- ['final_pos4', Type.Float, None, 'Scan final position 3'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, m4, s4, f4,
- integ_time, slow_down, **opts):
- self._prepare([m1,m2,m3,m4], [s1,s2,s3,s4], [f1,f2,f3,f4], slow_down,
- integ_time, mode=ContinuousMode, **opts)
-
-
-class dNscanc(dNscan):
-
- def do_restore(self):
- # set velocities to maximum and then move to initial positions
- for moveable in self.motors:
- self._gScan.set_max_top_velocity(moveable)
- dNscan.do_restore(self)
-
-
-class dscanc(dNscanc, Macro):
- """continuous motor scan relative to the starting position."""
-
- param_def = [
- ['motor', Type.Moveable, None, 'Moveable to move'],
- ['start_pos', Type.Float, None, 'Scan start position'],
- ['final_pos', Type.Float, None, 'Scan final position'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, motor, start_pos, final_pos, integ_time, slow_down,
- **opts):
- self._prepare([motor], [start_pos], [final_pos], slow_down, integ_time,
- mode=ContinuousMode, **opts)
-
-
-class d2scanc(dNscanc,Macro):
- """continuous two-motor scan relative to the starting positions"""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, motor1, start_pos1, final_pos1, motor2, start_pos2,
- final_pos2, integ_time, slow_down, **opts):
- self._prepare([motor1,motor2], [start_pos1,start_pos2],
- [final_pos1,final_pos2], slow_down, integ_time,
- mode=ContinuousMode, **opts)
-
-
-class d3scanc(dNscanc, Macro):
- """continuous three-motor scan"""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, integ_time, slow_down,
- **opts):
- self._prepare([m1,m2,m3], [s1,s2,s3], [f1,f2,f3], slow_down, integ_time,
- mode=ContinuousMode, **opts)
-
-
-class d4scanc(dNscanc, Macro):
- """continuous four-motor scan relative to the starting positions"""
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['motor4', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos4', Type.Float, None, 'Scan start position 3'],
- ['final_pos4', Type.Float, None, 'Scan final position 3'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['slow_down', Type.Float, 1, 'global scan slow down factor (0, 1]'],
- ]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, m4, s4, f4, integ_time,
- slow_down, **opts):
- self._prepare([m1,m2,m3,m4], [s1,s2,s3,s4], [f1,f2,f3,f4], slow_down,
- integ_time, mode=ContinuousMode, **opts)
-
-
-class meshc(Macro,Hookable):
- """2d grid scan. scans continuous"""
-
- hints = { 'scan' : 'mesh', 'allowsHooks': ('pre-scan', 'pre-move', 'post-move', 'pre-acq', 'post-acq', 'post-step', 'post-scan') }
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['motor1', Type.Moveable, None, 'First motor to move'],
- ['m1_start_pos', Type.Float, None, 'Scan start position for first motor'],
- ['m1_final_pos', Type.Float, None, 'Scan final position for first motor'],
- ['slow_down', Type.Float, None, 'global scan slow down factor (0, 1]'],
- ['motor2', Type.Moveable, None, 'Second motor to move'],
- ['m2_start_pos', Type.Float, None, 'Scan start position for second motor'],
- ['m2_final_pos', Type.Float, None, 'Scan final position for second motor'],
- ['m2_nr_interv', Type.Integer, None, 'Number of scan intervals'],
- ['integ_time', Type.Float, None, 'Integration time'],
- ['bidirectional', Type.Boolean, False, 'Save time by scanning s-shaped']
- ]
-
- def prepare(self, m1, m1_start_pos, m1_final_pos, slow_down,
- m2, m2_start_pos, m2_final_pos, m2_nr_interv, integ_time,
- bidirectional, **opts):
- self.motors=[m1,m2]
- self.slow_down = slow_down
- self.starts = numpy.array([m1_start_pos,m2_start_pos],dtype='d')
- self.finals = numpy.array([m1_final_pos,m2_final_pos],dtype='d')
- self.m2_nr_interv = m2_nr_interv
- self.integ_time = integ_time
- self.bidirectional_mode = bidirectional
- self.nr_waypoints = m2_nr_interv + 1
-
- self.name=opts.get('name','meshc')
-
- moveables=self.motors
- env=opts.get('env',{})
- constrains=[getCallable(cns) for cns in opts.get('constrains',[UNCONSTRAINED])]
- extrainfodesc = opts.get('extrainfodesc',[])
-
- #Hooks are not always set at this point. We will call getHooks later on in the scan_loop
- #self.pre_scan_hooks = self.getHooks('pre-scan')
- #self.post_scan_hooks = self.getHooks('post-scan'
-
- self._gScan = CScan(self, self._waypoint_generator, self._period_generator, moveables, env, constrains, extrainfodesc)
- self._gScan.frozen_motors = [m2]
-
- def _waypoint_generator(self):
- step = {}
- step["pre-move-hooks"] = self.getHooks('pre-move')
- step["post-move-hooks"] = self.getHooks('post-move')
- step["check_func"] = []
- step["slow_down"] = self.slow_down
- points2=self.m2_nr_interv+1
- m1start,m2start=self.starts
- m1end,m2end=self.finals
- point_no=1
- for i, m2pos in enumerate(numpy.linspace(m2start,m2end,points2)):
- start, end = m1start, m1end
- if i % 2 != 0 and self.bidirectional_mode:
- start, end = m1end, m1start
- step["start_positions"] = numpy.array([start, m2pos])
- step["positions"] = numpy.array([end, m2pos])
- step["point_id"]= point_no
- point_no+=1
- yield step
-
- def _period_generator(self):
- step = {}
- step["integ_time"] = self.integ_time
- step["pre-acq-hooks"] = self.getHooks('pre-acq')
- step["post-acq-hooks"] = self.getHooks('post-acq')+self.getHooks('_NOHINTS_')
- step["post-step-hooks"] = self.getHooks('post-step')
- step["check_func"] = []
- step['extrainfo'] = {}
- point_no = 0
- while(True):
- point_no += 1
- step["point_id"] = point_no
- yield step
-
- def run(self,*args):
- for step in self._gScan.step_scan():
- yield step
-
- def getTimeEstimation(self):
- return self._gScan.waypoint_estimation()
-
- def getIntervalEstimation(self):
- return self.nr_waypoints
-
- @property
- def data(self):
- return self._gScan.data
-
-class ascanct(aNscan, Macro):
- '''Continuous scan controlled by hardware trigger signals. A sequence of
- trigger pulses is programmed by time. The scan active time is calculated from
- nr_of_points * point time. It corresponds to the time while all the involved
- in the scan moveables are at the constant velocity. Experimental channels are
- configured to acquire during acquistion time calculated from acq_time [%] of
- the point_time.
- Temporary solution used to configure trigger device (pulse train generator):
- "TriggerDevices" evironment variable must be set to Ni660X device name
- or any other Tango device name implementing:
- +) following attributes:
- - InitialDelayTime [s] - delay time from calling Start to generating first pulse
- - HighTime [s] - time interval while signal will maintain its high state
- - LowTime [s] - time interval while signal will maintain its low state
- - SampPerChan - nr of pulses to be generated
- - IdleState - state (high or low) which signal will take after the Start command
- and which will maintain during the InitialDelayTime.
- +) following commands:
- - Start
- - Stop)'''
-
- hints = {'scan' : 'ascanct', 'allowsHooks': ('pre-configuration',
- 'post-configuration',
- 'pre-start',
- 'pre-cleanup',
- 'post-cleanup') }
-
- param_def = [['motor', Type.Moveable, None, 'Moveable name'],
- ['start_pos', Type.Float, None, 'Starting position'],
- ['end_pos', Type.Float, None, 'Ending pos value'],
- ['nr_of_points', Type.Integer, None, 'Nr of scan points'],
- ['point_time', Type.Float, None, 'Time interval reserved for ' +
- 'each scan point [s].'],
- ['acq_time', Type.Float, 99, 'Acquisition time per scan point. ' +
- 'Expressed in percentage of point_time. Default: 99 [%]'],
- ['samp_freq', Type.Float, -1, 'Sampling frequency. ' +
- 'Default: -1 (means maximum possible)']]
-
-
- def prepare(self, motor, start_pos, end_pos, nr_of_points,
- point_time, acq_time, samp_freq, **opts):
- self._prepare([motor], [start_pos], [end_pos], nr_of_points,
- point_time, mode=ContinuousHwTimeMode, **opts)
- self.acq_time = acq_time
- self.samp_freq = samp_freq
-
-
-class a2scanct(aNscan, Macro):
- '''Continuous scan controlled by hardware trigger signals. A sequence of
- trigger pulses is programmed by time. The scan active time is calculated from
- nr_of_points * point time. It corresponds to the time while all the involved
- in the scan moveables are at the constant velocity. Experimental channels are
- configured to acquire during acquistion time calculated from acq_time [%] of
- the point_time.
- Temporary solution used to configure trigger device (pulse train generator):
- "TriggerDevices" evironment variable must be set to Ni660X device name
- or any other Tango device name implementing:
- +) following attributes:
- - InitialDelayTime [s] - delay time from calling Start to generating first pulse
- - HighTime [s] - time interval while signal will maintain its high state
- - LowTime [s] - time interval while signal will maintain its low state
- - SampPerChan - nr of pulses to be generated
- - IdleState - state (high or low) which signal will take after the Start command
- and which will maintain during the InitialDelayTime.
- +) following commands:
- - Start
- - Stop)'''
-
- hints = {'scan' : 'a2scanct', 'allowsHooks': ('pre-configuration',
- 'post-configuration',
- 'pre-start',
- 'pre-cleanup',
- 'post-cleanup') }
-
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ["nr_of_points", Type.Integer, None, "Nr of scan points"],
- ['point_time', Type.Float, None, 'Time interval reserved for ' +
- 'each scan point [s].'],
- ["acq_time", Type.Float, 99, 'Acquisition time per scan point. ' +
- 'Expressed in percentage of point_time. Default: 99 [%]'],
- ["samp_freq", Type.Float, -1, 'Sampling frequency. ' +
- 'Default: -1 (means maximum possible)']]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, nr_of_points,
- point_time, acq_time, samp_freq, **opts):
- self._prepare([m1, m2], [s1, s2], [f1, f2], nr_of_points,
- point_time, mode=ContinuousHwTimeMode, **opts)
- self.acq_time = acq_time
- self.samp_freq = samp_freq
-
-
-
-class a3scanct(aNscan, Macro):
- '''Continuous scan controlled by hardware trigger signals. A sequence of
- trigger pulses is programmed by time. The scan active time is calculated from
- nr_of_points * point time. It corresponds to the time while all the involved
- in the scan moveables are at the constant velocity. Experimental channels are
- configured to acquire during acquistion time calculated from acq_time [%] of
- the point_time.
- Temporary solution used to configure trigger device (pulse train generator):
- "TriggerDevices" evironment variable must be set to Ni660X device name
- or any other Tango device name implementing:
- +) following attributes:
- - InitialDelayTime [s] - delay time from calling Start to generating first pulse
- - HighTime [s] - time interval while signal will maintain its high state
- - LowTime [s] - time interval while signal will maintain its low state
- - SampPerChan - nr of pulses to be generated
- - IdleState - state (high or low) which signal will take after the Start command
- and which will maintain during the InitialDelayTime.
- +) following commands:
- - Start
- - Stop)'''
- hints = {'scan' : 'a2scanct', 'allowsHooks': ('pre-configuration',
- 'post-configuration',
- 'pre-start',
- 'pre-cleanup',
- 'post-cleanup') }
-
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ["nr_of_points", Type.Integer, None, "Nr of scan points"],
- ['point_time', Type.Float, None, 'Time interval reserved for ' +
- 'each scan point [s].'],
- ["acq_time", Type.Float, 99, 'Acquisition time per scan point. ' +
- 'Expressed in percentage of point_time. Default: 99 [%]'],
- ["samp_freq", Type.Float, -1, 'Sampling frequency. ' +
- 'Default: -1 (means maximum possible)']]
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, nr_of_points,
- point_time, acq_time, samp_freq, **opts):
- self._prepare([m1, m2, m3], [s1, s2, s3], [f1, f2, f3], nr_of_points,
- point_time, mode=ContinuousHwTimeMode, **opts)
- self.acq_time = acq_time
- self.samp_freq = samp_freq
-
-class a4scanct(aNscan, Macro):
- '''Continuous scan controlled by hardware trigger signals. A sequence of
- trigger pulses is programmed by time. The scan active time is calculated from
- nr_of_points * point time. It corresponds to the time while all the involved
- in the scan moveables are at the constant velocity. Experimental channels are
- configured to acquire during acquistion time calculated from acq_time [%] of
- the point_time.
- Temporary solution used to configure trigger device (pulse train generator):
- "TriggerDevices" evironment variable must be set to Ni660X device name
- or any other Tango device name implementing:
- +) following attributes:
- - InitialDelayTime [s] - delay time from calling Start to generating first pulse
- - HighTime [s] - time interval while signal will maintain its high state
- - LowTime [s] - time interval while signal will maintain its low state
- - SampPerChan - nr of pulses to be generated
- - IdleState - state (high or low) which signal will take after the Start command
- and which will maintain during the InitialDelayTime.
- +) following commands:
- - Start
- - Stop)'''
-
- hints = {'scan' : 'a2scanct', 'allowsHooks': ('pre-configuration',
- 'post-configuration',
- 'pre-start',
- 'pre-cleanup',
- 'post-cleanup') }
-
- param_def = [
- ['motor1', Type.Moveable, None, 'Moveable 1 to move'],
- ['start_pos1', Type.Float, None, 'Scan start position 1'],
- ['final_pos1', Type.Float, None, 'Scan final position 1'],
- ['motor2', Type.Moveable, None, 'Moveable 2 to move'],
- ['start_pos2', Type.Float, None, 'Scan start position 2'],
- ['final_pos2', Type.Float, None, 'Scan final position 2'],
- ['motor3', Type.Moveable, None, 'Moveable 3 to move'],
- ['start_pos3', Type.Float, None, 'Scan start position 3'],
- ['final_pos3', Type.Float, None, 'Scan final position 3'],
- ['motor4', Type.Moveable, None, 'Moveable 4 to move'],
- ['start_pos4', Type.Float, None, 'Scan start position 4'],
- ['final_pos4', Type.Float, None, 'Scan final position 4'],
- ["nr_of_points", Type.Integer, None, "Nr of scan points"],
- ['point_time', Type.Float, None, 'Time interval reserved for ' +
- 'each scan point [s].'],
- ["acq_time", Type.Float, 99, 'Acquisition time per scan point. ' +
- 'Expressed in percentage of point_time. Default: 99 [%]'],
- ["samp_freq", Type.Float, -1, 'Sampling frequency. ' +
- 'Default: -1 (means maximum possible)']]
-
-
- def prepare(self, m1, s1, f1, m2, s2, f2, m3, s3, f3, m4, s4, f4,
- nr_of_points, point_time, acq_time, samp_freq, **opts):
- self._prepare([m1, m2, m3, m4], [s1, s2, s3, s4], [f1, f2, f3, f4],
- nr_of_points, point_time, mode=ContinuousHwTimeMode,
- **opts)
- self.acq_time = acq_time
- self.samp_freq = samp_freq
-
diff --git a/src/sardana/macroserver/macros/sequence.py b/src/sardana/macroserver/macros/sequence.py
deleted file mode 100644
index d44e2660..00000000
--- a/src/sardana/macroserver/macros/sequence.py
+++ /dev/null
@@ -1,92 +0,0 @@
-import os
-import xml.dom.minidom
-
-from sardana.macroserver.macro import *
-
-TAG_MACRO = 'macro'
-TAG_PARAM = 'param'
-TAG_PARAMREPEAT = 'paramrepeat'
-TAG_REPEAT = 'repeat'
-TAG_PARAMS = 'params'
-TAG_SEQUENCE = 'sequence'
-
-ATTRIBUTE_NAME = 'name'
-ATTRIBUTE_VALUE = 'value'
-ATTRIBUTE_INDEX = 'nr'
-ATTRIBUTE_DESCRIPTION = 'description'
-ATTRIBUTE_DEFVALUE = 'defvalue'
-ATTRIBUTE_TYPE = 'type'
-ATTRIBUTE_ALLOWEDHOOKS = 'allowedHooks'
-ATTRIBUTE_HASPARAMS = 'hasParams'
-ATTRIBUTE_MIN = 'min'
-
-class sequence(Macro):
- """This macro executes a sequence of macros. As a parameter
- it receives a string which is a xml structure. These macros which allow
- hooks can nest another sequence (xml structure). In such a case,
- this macro is executed recursively."""
-
- param_def = [
- ['xml', Type.String, None, 'Xml string representing a sequence']
- ]
-
- def run(self, *pars):
- xmlDoc = xml.dom.minidom.parseString(pars[0])
- macros = self.parseXml(xmlDoc)
- for macro in macros:
- self.runMacro(macro)
-# self.pausePoint()
-
- def parseXml(self, xmlDoc):
- macros = []
- sequenceElement = xmlDoc.getElementsByTagName(TAG_SEQUENCE)[0]
- childElement = sequenceElement.firstChild
- while childElement:
- if childElement.localName == TAG_MACRO:
- params, hookElement = self.parseMacro(childElement)
- macro = self.createMacro(params)
- if hookElement is not None:
- hook = self.createExecMacroHook([self.__class__.__name__,
- hookElement.toxml()])
- macro.hooks = [hook]
- macros.append(macro)
- childElement = childElement.nextSibling
- return macros
-
- def parseMacro(self, xmlElement):
- name = str(xmlElement.getAttribute(ATTRIBUTE_NAME))
- params = (name,)
- hookElement = None
- childElement = xmlElement.firstChild
- while childElement:
- if childElement.localName == TAG_PARAM:
- params += self.parseParam(childElement)
- elif childElement.localName == TAG_PARAMREPEAT:
- params += self.parseParamRepeat(childElement)
- elif childElement.localName == TAG_SEQUENCE:
- hookElement = childElement
- childElement = childElement.nextSibling
- return (params,hookElement)
-
- def parseParam(self, xmlElement):
- return (str(xmlElement.getAttribute(ATTRIBUTE_VALUE)),)
-
- def parseParamRepeat(self, xmlElement):
- params = ()
- childElement = xmlElement.firstChild
- while childElement:
- if childElement.localName == TAG_REPEAT:
- params += self.parseRepeat(childElement)
- childElement = childElement.nextSibling
- return params
-
- def parseRepeat(self, xmlElement):
- params = ()
- childElement = xmlElement.firstChild
- while childElement:
- if childElement.localName == TAG_PARAM:
- params += self.parseParam(childElement)
- elif childElement.localName == TAG_PARAMREPEAT:
- params += self.parseParamRepeat(childElement)
- childElement = childElement.nextSibling
- return params
diff --git a/src/sardana/macroserver/macros/standard.py b/src/sardana/macroserver/macros/standard.py
deleted file mode 100644
index 8ca13981..00000000
--- a/src/sardana/macroserver/macros/standard.py
+++ /dev/null
@@ -1,675 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the standard macro module"""
-
-__all__ = ["ct", "mstate", "mv", "mvr", "pwa", "pwm", "set_lim", "set_lm",
- "set_pos", "settimer", "uct", "umv", "umvr", "wa", "wm"]
-
-__docformat__ = 'restructuredtext'
-
-import datetime
-from taurus.console.table import Table
-
-from PyTango import DevState
-from sardana.macroserver.macro import Macro, macro, Type, ParamRepeat, ViewOption
-
-################################################################################
-#
-# Motion related macros
-#
-################################################################################
-
-class _wm(Macro):
- """Show motor positions"""
-
- param_def = [
- ['motor_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to move']),
- None, 'List of motor to show'],
- ]
-
- def prepare(self, *motor_list, **opts):
- self.table_opts = {}
-
- def run(self, *motor_list):
- show_dial = self.getViewOption(ViewOption.ShowDial)
- show_ctrlaxis = self.getViewOption(ViewOption.ShowCtrlAxis)
- pos_format = self.getViewOption(ViewOption.PosFormat)
-
- motor_width = 9
- motor_names = []
- motor_pos = []
- motor_list = list(motor_list)
- motor_list.sort()
- for motor in motor_list:
-
- name = motor.getName()
- motor_names.append([name])
-
- pos = motor.getPosition(force=True)
- if pos is None:
- pos = float('NAN')
-
- # TODO: refactor this code, so the info tuple is progressively
- # expanded depending on the _ViewOptions, instead of repeating the
- # code in the if/else statements
- if show_dial:
- dial_pos = motor.getDialPosition(force=True)
- if dial_pos is None:
- dial_pos = float('NAN')
- if show_ctrlaxis:
- ctrl_name = self.getController(motor.controller).name
- axis_nb = getattr(motor, "axis")
- motor_pos.append((ctrl_name, str(axis_nb), pos, dial_pos))
- else:
- motor_pos.append((pos,dial_pos))
- else:
- if show_ctrlaxis:
- ctrl_name = self.getController(motor.controller).name
- axis_nb = getattr(motor, "axis")
- motor_pos.append((ctrl_name, str(axis_nb), pos))
- else:
- motor_pos.append((pos,))
-
- motor_width = max(motor_width,len(name))
-
- if show_ctrlaxis:
- motor_width = max(motor_width, len(ctrl_name), len(str(axis_nb)))
-
- fmt = '%c*.%df' % ('%',motor_width - 5)
-
- if pos_format > -1:
- fmt = '%c*.%df' % ('%',int(pos_format))
-
- row_head_str = []
- if show_ctrlaxis:
- row_head_str += ['Ctrl', 'Axis']
- if show_dial:
- t_format = ['%*s','%*s',fmt,fmt]
- row_head_str += ['User', 'Dial']
- else:
- t_format = ['%*s','%*s',fmt]
- row_head_str += ['User']
- else:
- if show_dial:
- t_format = [fmt, fmt]
- else:
- t_format = [fmt]
-
- row_head_str = row_head_str if len(row_head_str) else None
- table = Table(motor_pos, elem_fmt=t_format,
- col_head_str=motor_names, col_head_width=motor_width,
- row_head_str=row_head_str, **self.table_opts)
- for line in table.genOutput():
- self.output(line)
-
-class _wum(Macro):
- """Show user motor positions"""
-
- param_def = [
- ['motor_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to move']),
- None, 'List of motor to show'],
- ]
-
- def prepare(self, *motor_list, **opts):
- self.table_opts = {}
-
- def run(self, *motor_list):
- show_dial = self.getViewOption(ViewOption.ShowDial)
- motor_width = 9
- motor_names = []
- motor_pos = []
- motor_list = list(motor_list)
- motor_list.sort()
- for motor in motor_list:
- name = motor.getName()
- motor_names.append([name])
- pos = motor.getPosition(force=True)
- if pos is None:
- pos = float('NAN')
- motor_pos.append((pos,))
- motor_width = max(motor_width,len(name))
-
- fmt = '%c*.%df' % ('%',motor_width - 5)
-
- table = Table(motor_pos, elem_fmt=[fmt],
- col_head_str=motor_names, col_head_width=motor_width,
- **self.table_opts)
- for line in table.genOutput():
- self.output(line)
-
-class wu(Macro):
- """Show all user motor positions"""
-
- def prepare(self, **opts):
- self.all_motors = self.findObjs('.*', type_class=Type.Moveable)
- self.table_opts = {}
-
- def run(self):
- nr_motors = len(self.all_motors)
- if nr_motors == 0:
- self.output('No motor defined')
- return
-
- self.output('Current positions (user) on %s'%datetime.datetime.now().isoformat(' '))
- self.output('')
-
- self.execMacro('_wum',*self.all_motors, **self.table_opts)
-
-class wa(Macro):
- """Show all motor positions"""
-
- param_def = [
- ['filter',
- ParamRepeat(['filter', Type.String, '.*', 'a regular expression filter'], min=0, max=1),
- '.*', 'a regular expression filter'],
- ]
-
- def prepare(self, *filter, **opts):
- self.all_motors = self.findObjs(filter, type_class=Type.Moveable)
- self.table_opts = {}
-
- def run(self, *filter):
- nr_motors = len(self.all_motors)
- if nr_motors == 0:
- self.output('No motor defined')
- return
-
- show_dial = self.getViewOption(ViewOption.ShowDial)
- if show_dial:
- self.output('Current positions (user, dial) on %s'%datetime.datetime.now().isoformat(' '))
- else:
- self.output('Current positions (user) on %s'%datetime.datetime.now().isoformat(' '))
- self.output('')
-
- self.execMacro('_wm',*self.all_motors, **self.table_opts)
-
-
-class pwa(Macro):
- """Show all motor positions in a pretty table"""
-
- param_def = [
- ['filter',
- ParamRepeat(['filter', Type.String, '.*', 'a regular expression filter'], min=0, max=1),
- '.*', 'a regular expression filter'],
- ]
-
- def run(self, *filter):
- self.execMacro('wa', *filter, **Table.PrettyOpts)
-
-class set_lim(Macro):
- """Sets the software limits on the specified motor hello"""
- param_def = [
- ['motor', Type.Moveable, None, 'Motor name'],
- ['low', Type.Float, None, 'lower limit'],
- ['high', Type.Float, None, 'upper limit']
- ]
-
- def run(self, motor, low, high):
- name = motor.getName()
- self.debug("Setting user limits for %s" % name)
- motor.getPositionObj().setLimits(low,high)
- self.output("%s limits set to %.4f %.4f (user units)" % (name, low, high))
-
-class set_lm(Macro):
- """Sets the dial limits on the specified motor"""
- param_def = [
- ['motor', Type.Motor, None, 'Motor name'],
- ['low', Type.Float, None, 'lower limit'],
- ['high', Type.Float, None, 'upper limit']
- ]
-
- def run(self, motor, low, high):
- name = motor.getName()
- self.debug("Setting dial limits for %s" % name)
- motor.getDialPositionObj().setLimits(low,high)
- self.output("%s limits set to %.4f %.4f (dial units)" % (name, low, high))
-
-class set_pos(Macro):
- """Sets the position of the motor to the specified value"""
-
- param_def = [
- ['motor', Type.Motor, None, 'Motor name'],
- ['pos', Type.Float, None, 'Position to move to']
- ]
-
- def run(self, motor, pos):
- name = motor.getName()
- old_pos = motor.getPosition(force=True)
- motor.definePosition(pos)
- self.output("%s reset from %.4f to %.4f" % (name, old_pos, pos))
-
-class set_user_pos(Macro):
- """Sets the USER position of the motor to the specified value (by changing OFFSET and keeping DIAL)"""
-
- param_def = [
- ['motor', Type.Motor, None, 'Motor name'],
- ['pos', Type.Float, None, 'Position to move to']
- ]
-
- def run(self, motor, pos):
- name = motor.getName()
- old_pos = motor.getPosition(force=True)
- offset_attr = motor.getAttribute('Offset')
- old_offset = offset_attr.read().value
- new_offset = pos - (old_pos - old_offset)
- offset_attr.write(new_offset)
- self.output("%s reset from %.4f (offset %.4f) to %.4f (offset %.4f)" % (name, old_pos, old_offset, pos, new_offset))
-
-class wm(Macro):
- """Show the position of the specified motors."""
-
- param_def = [
- ['motor_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to see where it is']),
- None, 'List of motor to show'],
- ]
-
- def prepare(self, *motor_list, **opts):
- self.table_opts = {}
-
- def run(self, *motor_list):
- motor_width = 10
- motor_names = []
- motor_pos = []
-
- show_dial = self.getViewOption(ViewOption.ShowDial)
- show_ctrlaxis = self.getViewOption(ViewOption.ShowCtrlAxis)
- pos_format = self.getViewOption(ViewOption.PosFormat)
-
- for motor in motor_list:
-
- max_len = 0
- if show_ctrlaxis:
- axis_nb = getattr(motor, "axis")
- ctrl_name = self.getController(motor.controller).name
- max_len = max(max_len, len(ctrl_name), len(str(axis_nb)))
- name = motor.getName()
- max_len = max(max_len, len(name))
-
- max_len = max_len + 5
- if max_len < 14:
- max_len = 14 # Length of 'Not specified'
-
- str_fmt = "%c%ds" % ('%', int(max_len))
-
- name = str_fmt % name
-
- motor_names.append([name])
- posObj = motor.getPositionObj()
- if pos_format > -1:
- fmt = '%c.%df' % ('%', int(pos_format))
-
- try:
- val1 = fmt % motor.getPosition(force=True)
- val1 = str_fmt % val1
- except:
- val1 = str_fmt % motor.getPosition(force=True)
-
-
- val2 = str_fmt % posObj.getMaxValue()
- val3 = str_fmt % posObj.getMinValue()
-
- if show_ctrlaxis:
- valctrl = str_fmt % (ctrl_name)
- valaxis = str_fmt % str(axis_nb)
- upos = map(str, [valctrl, valaxis, ' ', val2, val1, val3])
- else:
- upos = map(str, ['', val2, val1, val3])
- pos_data = upos
- if show_dial:
- try:
- val1 = fmt % motor.getDialPosition(force=True)
- val1 = str_fmt % val1
- except:
- val1 = str_fmt % motor.getDialPosition(force=True)
-
- dPosObj = motor.getDialPositionObj()
- val2 = str_fmt % dPosObj.getMaxValue()
- val3 = str_fmt % dPosObj.getMinValue()
-
- dpos = map(str, [val2, val1, val3])
- pos_data += [''] + dpos
-
- motor_pos.append(pos_data)
-
- elem_fmt = (['%*s'] + ['%*s'] * 5) * 2
- row_head_str = []
- if show_ctrlaxis:
- row_head_str += ['Ctrl', 'Axis']
- row_head_str += ['User', ' High', ' Current', ' Low']
- if show_dial:
- row_head_str += ['Dial', ' High', ' Current', ' Low']
- table = Table(motor_pos, elem_fmt=elem_fmt, row_head_str=row_head_str,
- col_head_str=motor_names, col_head_width=motor_width,
- **self.table_opts)
- for line in table.genOutput():
- self.output(line)
-
-class wum(Macro):
- """Show the user position of the specified motors."""
-
- param_def = [
- ['motor_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to see where it is']),
- None, 'List of motor to show'],
- ]
-
- def prepare(self, *motor_list, **opts):
- self.table_opts = {}
-
- def run(self, *motor_list):
- motor_width = 10
- motor_names = []
- motor_pos = []
-
- for motor in motor_list:
- name = motor.getName()
- motor_names.append([name])
- posObj = motor.getPositionObj()
- upos = map(str, [posObj.getMaxValue(), motor.getPosition(force=True), posObj.getMinValue()])
- pos_data = [''] + upos
-
- motor_pos.append(pos_data)
-
- elem_fmt = (['%*s'] + ['%*s'] * 3) * 2
- row_head_str = ['User', ' High', ' Current', ' Low',]
- table = Table(motor_pos, elem_fmt=elem_fmt, row_head_str=row_head_str,
- col_head_str=motor_names, col_head_width=motor_width,
- **self.table_opts)
- for line in table.genOutput():
- self.output(line)
-
-class pwm(Macro):
- """Show the position of the specified motors in a pretty table"""
-
- param_def = [
- ['motor_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to move']),
- None, 'List of motor to show'],
- ]
-
- def run(self, *motor_list):
- self.execMacro('wm', *motor_list, **Table.PrettyOpts)
-
-class mv(Macro):
- """Move motor(s) to the specified position(s)"""
-
- param_def = [
- ['motor_pos_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to move'],
- ['pos', Type.Float, None, 'Position to move to']),
- None, 'List of motor/position pairs'],
- ]
-
- def run(self, *motor_pos_list):
- motors, positions = [], []
- for motor, pos in motor_pos_list:
- motors.append(motor)
- positions.append(pos)
- self.debug("Starting %s movement to %s", motor.getName(), pos)
- motion = self.getMotion(motors)
- state, pos = motion.move(positions)
- if state != DevState.ON:
- self.warning("Motion ended in %s", state)
- msg = []
- for motor in motors:
- msg.append(motor.information())
- self.info("\n".join(msg))
-
-class mstate(Macro):
- """Prints the state of a motor"""
-
- param_def = [['motor', Type.Moveable, None, 'Motor to check state']]
-
- def run(self, motor):
- self.info("Motor %s" % str(motor.getState()))
-
-class umv(Macro):
- """Move motor(s) to the specified position(s) and update"""
-
- param_def = mv.param_def
-
- def prepare(self, *motor_pos_list, **opts):
- self.all_names = []
- self.all_pos = []
- self.print_pos = False
- for motor, pos in motor_pos_list:
- self.all_names.append([motor.getName()])
- pos, posObj = motor.getPosition(force=True), motor.getPositionObj()
- self.all_pos.append([pos])
- posObj.subscribeEvent(self.positionChanged, motor)
-
- def run(self, *motor_pos_list):
- self.print_pos = True
- pars = []
- for motor, pos in motor_pos_list:
- pars.append(motor)
- pars.append(pos)
-
- self.execMacro('mv', *pars)
- self.finish()
-
- def finish(self):
- self._clean()
- self.printAllPos()
-
- def on_abort(self):
- self.finish()
-
- def _clean(self):
- for motor, pos in self.getParameters():
- posObj = motor.getPositionObj()
- try:
- posObj.unsubscribeEvent(self.positionChanged, motor)
- except Exception, e:
- print str(e)
- raise e
-
- def positionChanged(self, motor, position):
- idx = self.all_names.index([motor.getName()])
- self.all_pos[idx] = [position]
- if self.print_pos:
- self.printAllPos()
-
- def printAllPos(self):
- motor_width = 10
- table = Table(self.all_pos, elem_fmt=['%*.4f'],
- col_head_str=self.all_names, col_head_width=motor_width)
- self.outputBlock(table.genOutput())
- self.flushOutput()
-
-class mvr(Macro):
- """Move motor(s) relative to the current position(s)"""
-
- param_def = [
- ['motor_disp_list',
- ParamRepeat(['motor', Type.Moveable, None, 'Motor to move'],
- ['disp', Type.Float, None, 'Relative displacement']),
- None, 'List of motor/displacement pairs'],
- ]
-
- def run(self, *motor_disp_list):
- motor_pos_list = []
- for motor, disp in motor_disp_list:
- pos = motor.getPosition(force=True)
- if pos is None:
- self.error("Cannot get %s position" % motor.getName())
- return
- else:
- pos += disp
- motor_pos_list.extend([motor, pos])
- self.execMacro('mv', *motor_pos_list)
-
-class umvr(Macro):
- """Move motor(s) relative to the current position(s) and update"""
-
- param_def = mvr.param_def
-
- def run(self, *motor_disp_list):
- motor_pos_list = []
- for motor, disp in motor_disp_list:
- pos = motor.getPosition(force=True)
- if pos is None:
- self.error("Cannot get %s position" % motor.getName())
- return
- else:
- pos += disp
- motor_pos_list.extend([motor, pos])
- self.execMacro('umv', *motor_pos_list)
-
-
-################################################################################
-#
-# Data acquisition related macros
-#
-################################################################################
-
-
-class ct(Macro):
- """Count for the specified time on the active measurement group"""
-
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['integ_time', Type.Float, 1.0, 'Integration time']
- ]
-
- def prepare(self, integ_time, **opts):
- mnt_grp_name = self.getEnv('ActiveMntGrp')
- self.mnt_grp = self.getObj(mnt_grp_name, type_class=Type.MeasurementGroup)
-
- def run(self, integ_time):
- if self.mnt_grp is None:
- self.error('ActiveMntGrp is not defined or has invalid value')
- return
-
- self.debug("Counting for %s sec", integ_time)
- self.outputDate()
- self.output('')
- self.flushOutput()
-
- state, data = self.mnt_grp.count(integ_time)
-
- names, counts = [], []
- for ch_info in self.mnt_grp.getChannelsInfo():
- names.append(' %s' % ch_info.label)
- ch_data = data.get(ch_info.full_name)
- if ch_info.shape > [1]:
- counts.append(list(ch_data.shape))
- else:
- counts.append(ch_data)
-
- table = Table([counts], row_head_str=names, row_head_fmt='%*s',
- col_sep=' = ')
- for line in table.genOutput():
- self.output(line)
-
-
-class uct(Macro):
- """Count on the active measurement group and update"""
-
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['integ_time', Type.Float, 1.0, 'Integration time']
- ]
-
- def prepare(self, integ_time, **opts):
-
- self.print_value = False
-
- mnt_grp_name = self.getEnv('ActiveMntGrp')
- self.mnt_grp = self.getObj(mnt_grp_name, type_class=Type.MeasurementGroup)
-
- if self.mnt_grp is None:
- return
-
- names, nan = self.mnt_grp.getChannelLabels(), float('nan')
- self.names = [ [n] for n in names ]
-
- self.values = len(names)*[ [nan] ]
- self.channels = self.mnt_grp.getChannelAttrExs()
-
- for ch_attr_ex in self.channels:
- ch_attr_ex.subscribeEvent(self.counterChanged, ch_attr_ex)
-
- def printAllValues(self):
- ch_width = 10
- table = Table(self.values, elem_fmt=['%*.4f'], col_head_str=self.names,
- col_head_width=ch_width)
- self.outputBlock(table.genOutput())
- self.flushOutput()
-
- def counterChanged(self, ch_attr, value):
- idx = self.channels.index(ch_attr)
- self.values[idx] = [value]
- if self.print_value:
- self.printAllValues()
-
- def run(self, integ_time):
- if self.mnt_grp is None:
- self.error('ActiveMntGrp is not defined or has invalid value')
- return
-
- self.print_value = True
-
- state, data = self.mnt_grp.count(integ_time)
-
- for ch_attr_ex in self.mnt_grp.getChannelAttrExs():
- ch_attr_ex.unsubscribeEvent(self.counterChanged, ch_attr_ex)
- self.printAllValues()
-
-
-class settimer(Macro):
- """Defines the timer channel for the active measurement group"""
-
- env = ('ActiveMntGrp',)
-
- param_def = [
- ['timer', Type.ExpChannel, None, 'Timer'],
- ]
-
- def run(self,timer):
- mnt_grp_name = self.getEnv('ActiveMntGrp')
- mnt_grp = self.getObj(mnt_grp_name, type_class=Type.MeasurementGroup)
-
- if mnt_grp is None:
- self.error('ActiveMntGrp is not defined or has invalid value.\n' \
- 'please define a valid active measurement group ' \
- 'before setting a timer')
- return
-
- try:
- mnt_grp.setTimer(timer.getName())
- except Exception,e:
- self.output(str(e))
- self.output("%s is not a valid channel in the active measurement group" % timer)
-
-@macro([['message', ParamRepeat(['message_item', Type.String, None, 'message item to be reported']), None, 'message to be reported']])
-def report(self, *message):
- """Logs a new record into the message report system (if active)"""
- self.report(' '.join(message))
-
diff --git a/src/sardana/macroserver/macros/test/__init__.py b/src/sardana/macroserver/macros/test/__init__.py
deleted file mode 100644
index 701d235f..00000000
--- a/src/sardana/macroserver/macros/test/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from macroexecutor import BaseMacroExecutor, MacroExecutorFactory
-from base import (macroTest, BaseMacroTestCase, RunMacroTestCase,
- RunStopMacroTestCase, testRun, testFail, testStop)
-from sardemoenv import SarDemoEnv
diff --git a/src/sardana/macroserver/macros/test/base.py b/src/sardana/macroserver/macros/test/base.py
deleted file mode 100644
index 46d4a7ef..00000000
--- a/src/sardana/macroserver/macros/test/base.py
+++ /dev/null
@@ -1,322 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""System tests for Macros"""
-
-__all__ = ['macroTest', 'BaseMacroTestCase', 'RunMacroTestCase',
- 'RunStopMacroTestCase', 'testRun', 'testFail', 'testStop']
-import time
-import functools
-from sardana import sardanacustomsettings
-from sardana.macroserver.macros.test import MacroExecutorFactory
-from taurus.test import insertTest
-
-#Define a "_NOT_PASSED" object to mark a keyword arg which is not passed
-# Note that we do not want to use None because one may want to pass None
-class __NotPassedType(int):
- pass
-_NOT_PASSED = __NotPassedType()
-
-
-def macroTest(klass=None, helper_name=None, test_method_name=None,
- test_method_doc=None, **helper_kwargs):
- """This decorator is an specialization of :function::`taurus.test.insertTest`
- for macro testing. It inserts test methods from a helper method that may
- accept arguments.
-
- macroTest provides a very economic API for creating new tests for a given
- macro based on a helper method.
-
- macroTest accepts the following arguments:
-
- - helper_name (str): the name of the helper method. macroTest will
- insert a test method which calls the helper with
- any the helper_kwargs (see below).
- - test_method_name (str): Optional. Name of the test method to be used.
- If None given, one will be generated from the
- macro and helper names.
- - test_method_doc (str): The docstring for the inserted test method
- (this shows in the unit test output). If None
- given, a default one is generated which
- includes the input parameters and the helper
- name.
- - \*\*helper_kwargs: All remaining keyword arguments are passed to the
- helper.
-
- `macroTest` assumes that the decorated class has a `macro_name`
- class member.
-
- This decorator can be considered a "base" decorator. It is often used to
- create other decorators in which the helper method is pre-set. Some
- of them are already provided in this module:
-
- - :meth:`testRun` is equivalent to macroTest with helper_name='macro_runs'
- - :meth:`testStop` is equivalent to macroTest with helper_name='macro_stops'
- - :meth:`testFail` is equivalent to macroTest with helper_name='macro_fails'
-
- The advantage of using the decorators compared to writing the test methods
- directly is that the helper method can get keyword arguments and therefore
- avoid duplication of code for very similar tests (think, e.g. on writing
- similar tests for various sets of macro input parameters):
-
- Consider the following code written using the
- :meth:`RunMacroTestCase.macro_runs` helper::
-
- class FooTest(RunMacroTestCase, unittest.TestCase)
- macro_name = twice
-
- def test_foo_runs_with_input_2(self):
- '''test that twice(2) runs'''
- self.macro_runs(macro_params=['2'])
-
- def test_foo_runs_with_input_minus_1(self):
- '''test that twice(2) runs'''
- self.macro_runs(macro_params=['-1'])
-
- The equivalent code could be written as::
-
- @macroTest(helper_name='macro_runs', macro_params=['2'])
- @macroTest(helper_name='macro_runs', macro_params=['-1'])
- class FooTest(RunMacroTestCase, unittest.TestCase):
- macro_name = 'twice'
-
- Or, even better, using the specialized testRun decorator::
-
- @testRun(macro_params=['2'])
- @testRun(macro_params=['-1'])
- class FooTest(RunMacroTestCase, unittest.TestCase):
- macro_name = 'twice'
-
- .. seealso:: :function::`taurus.test.insertTest`
-
- """
- #recipe to allow decorating with and without arguments
- if klass is None:
- return functools.partial(macroTest, helper_name=helper_name,
- test_method_name=test_method_name,
- test_method_doc=test_method_doc,
- **helper_kwargs)
-
- return insertTest(klass=klass, helper_name=helper_name,
- test_method_name=test_method_name,
- test_method_doc=test_method_doc,
- tested_name = klass.macro_name,
- **helper_kwargs)
-
-
-#Definition of specializations of the macroTest decorator:
-testRun = functools.partial(macroTest, helper_name='macro_runs')
-testStop = functools.partial(macroTest, helper_name='macro_stops')
-testFail = functools.partial(macroTest, helper_name='macro_fails')
-
-
-class BaseMacroTestCase(object):
-
- """An abstract class for macro testing.
- BaseMacroTestCase will provide a `macro_executor` member which is an
- instance of BaseMacroExecutor and which can be used to run a macro.
-
- To use it, simply inherit from BaseMacroTestCase *and* unittest.TestCase
- and provide the following class members:
-
- - macro_name (string) name of the macro to be tested (mandatory)
- - door_name (string) name of the door where the macro will be executed.
- This is optional. If not set,
- `sardanacustomsettings.UNITTEST_DOOR_NAME` is used
-
- Then you may define test methods.
- """
- macro_name = None
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME')
-
- def setUp(self):
- """ A macro_executor instance must be created
- """
- if self.macro_name is None:
- msg = '%s does not define macro_name' % self.__class__.__name__
- raise NotImplementedError(msg)
-
- mefact = MacroExecutorFactory()
- self.macro_executor = mefact.getMacroExecutor(self.door_name)
-
- def tearDown(self):
- """The macro_executor instance must be removed
- """
- self.macro_executor.unregisterAll()
- self.macro_executor = None
-
-
-class RunMacroTestCase(BaseMacroTestCase):
-
- """A base class for testing execution of arbitrary Sardana macros.
- See :class:`BaseMacroTestCase` for requirements.
-
- It provides the following helper methods:
- - :meth:`macro_runs`
- - :meth:`macro_fails`
- """
-
- def assertFinished(self, msg):
- """Asserts that macro has finished.
- """
- finishStates = [u'finish']
- state = self.macro_executor.getState()
- #TODO buffer is just for debugging, attach only the last state
- state_buffer = self.macro_executor.getStateBuffer()
- msg = msg + '; State history=%s' % state_buffer
- self.assertIn(state, finishStates, msg)
-
- def setUp(self):
- """Preconditions:
- - Those from :class:`BaseMacroTestCase`
- - the macro executor registers to all the log levels
- """
- BaseMacroTestCase.setUp(self)
- self.macro_executor.registerAll()
-
- def macro_runs(self, macro_params=None, wait_timeout=float("inf"),
- data=_NOT_PASSED):
- """A helper method to create tests that check if the macro can be
- successfully executed for the given input parameters. It may also
- optionally perform checks on the outputs from the execution.
-
- :param macro_params: (seq<str>): parameters for running the macro.
- If passed, they must be given as a sequence of
- their string representations.
- :param wait_timeout: (float) maximum allowed time (in s) for the macro
- to finish. By default infinite timeout is used.
- :param data: (obj) Optional. If passed, the macro data after the
- execution is tested to be equal to this.
- """
- self.macro_executor.run(macro_name=self.macro_name,
- macro_params=macro_params,
- sync=True, timeout=wait_timeout)
- self.assertFinished('Macro %s did not finish' % self.macro_name)
-
- #check if the data of the macro is the expected one
- if data is not _NOT_PASSED:
- actual_data = self.macro_executor.getData()
- msg = 'Macro data does not match expected data:\n' + \
- 'obtained=%s\nexpected=%s' % (actual_data, data)
- self.assertEqual(actual_data, data, msg)
-
- #TODO: implement generic asserts for macro result and macro output, etc
- # in a similar way to what is done for macro data
-
- def macro_fails(self, macro_params=None, wait_timeout=float("inf"),
- exception=None):
- """Check that the macro fails to run for the given input parameters
-
- :param macro_params: (seq<str>) input parameters for the macro
- :param wait_timeout: maximum allowed time for the macro to fail. By
- default infinite timeout is used.
- :param exception: (str or Exception) if given, an additional check of
- the type of the exception is done.
- (IMPORTANT: this is just a comparison of str
- representations of exception objects)
- """
- self.macro_executor.run(macro_name=self.macro_name,
- macro_params=macro_params,
- sync=True, timeout=wait_timeout)
- state = self.macro_executor.getState()
- actual_exc_str = self.macro_executor.getExceptionStr()
- msg = 'Post-execution state should be "exception" (got "%s")' % state
- self.assertEqual(state, 'exception', msg)
-
- if exception is not None:
- msg = 'Raised exception does not match expected exception:\n' + \
- 'raised=%s\nexpected=%s' % (actual_exc_str, exception)
- self.assertEqual(actual_exc_str, str(exception), msg)
-
-
-class RunStopMacroTestCase(RunMacroTestCase):
-
- """This is an extension of :class:`RunMacroTestCase` to include helpers for
- testing the abort process of a macro. Useful for Runnable and Stopable
- macros.
-
- It provides the :meth:`macro_stops` helper
- """
-
- def assertStopped(self, msg):
- """Asserts that macro was stopped
- """
- stoppedStates = [u'stop']
- state = self.macro_executor.getState()
- #TODO buffer is just for debugging, attach only the last state
- state_buffer = self.macro_executor.getStateBuffer()
- msg = msg + '; State buffer was %s' % state_buffer
- self.assertIn(state, stoppedStates, msg)
-
- def macro_stops(self, macro_params=None, stop_delay=0.1,
- wait_timeout=float("inf")):
- """A helper method to create tests that check if the macro can be
- successfully stoped (a.k.a. aborted) after it has been launched.
-
- :param macro_params: (seq<str>): parameters for running the macro.
- If passed, they must be given as a sequence of
- their string representations.
- :param stop_delay: (float) Time (in s) to wait between launching the
- macro and sending the stop command. default=0.1
- :param wait_timeout: (float) maximum allowed time (in s) for the macro
- to finish. By default infinite timeout is used.
- """
- self.macro_executor.run(macro_name=self.macro_name,
- macro_params=macro_params,
- sync=False)
-
- if stop_delay is not None:
- time.sleep(stop_delay)
- self.macro_executor.stop()
- self.macro_executor.wait(timeout=wait_timeout)
- self.assertStopped('Macro %s did not stop' % self.macro_name)
-
-
-if __name__ == '__main__':
- from taurus.external import unittest
- from sardana.macroserver.macros.test import SarDemoEnv
-
- _m1 = SarDemoEnv().getMotors()[0]
-
- #@testRun(macro_params=[_m1, '0', '100', '4', '.1'])
- @testRun(macro_params=[_m1, '1', '0', '2', '.1'])
- @testRun(macro_params=[_m1, '0', '1', '4', '.1'])
- class dummyAscanTest(RunStopMacroTestCase, unittest.TestCase):
- macro_name = 'ascan'
-
- @testRun(macro_params=['1'], data={'in': 1, 'out': 2})
- @testRun(macro_params=['5'])
- @testRun
- class dummyTwiceTest(RunStopMacroTestCase, unittest.TestCase):
- macro_name = 'twice'
-
- @testFail
- @testFail(exception=Exception)
- class dummyRaiseException(RunStopMacroTestCase, unittest.TestCase):
- macro_name = 'raise_exception'
-
- suite = unittest.defaultTestLoader.loadTestsFromTestCase(
- dummyRaiseException)
- unittest.TextTestRunner(descriptions=True, verbosity=2).run(suite)
diff --git a/src/sardana/macroserver/macros/test/macroexecutor.py b/src/sardana/macroserver/macros/test/macroexecutor.py
deleted file mode 100644
index bf01c5bf..00000000
--- a/src/sardana/macroserver/macros/test/macroexecutor.py
+++ /dev/null
@@ -1,315 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from taurus.core.util.singleton import Singleton
-
-
-class BaseMacroExecutor(object):
-
- """Abstract MacroExecutor class. Inherit from it if you want to create your
- own macro executor.
- """
-
- log_levels = ['debug', 'output', 'info', 'warning', 'critical', 'error']
-
- def __init__(self):
- # macro result
- self._result = None
- #macro exception status
- self._exception = None
- # buffer for state history
- self._state_buffer = []
- # log buffers, one for each level
- for level in self.log_levels:
- setattr(self, '_%s' % level, None)
- # common buffer, any registered log level will be appended here
- self._common = None
-
- def _clean(self):
- """In case of reuse of the macro executor object this method executes
- the necessary cleanups. Extend if you need to clean your particular
- setups.
- """
- for level in self.log_levels:
- log_buffer = getattr(self, '_%s' % level)
- if not log_buffer is None:
- log_buffer.__init__()
-
- if self._common:
- self._common.__init__()
-
- def run(self, macro_name, macro_params=None, sync=True,
- timeout=float("inf")):
- """Execute macro.
-
- :param macro_name: (string) name of macro to be executed
- :param macro_params: (list<string>) macro parameters
- (default is macro_params=None for macros without
- parameters or with the default values)
- :param sync: (bool) whether synchronous or asynchronous call
- (default is sync=True)
- :param timeout: (float) timeout (in s) that will be passed to the wait
- method, in case of synchronous execution
-
- In asyncrhonous execution method :meth:`~wait` has to be explicitly
- called.
- """
- if macro_params == None:
- macro_params = []
-
- self._clean()
- self._run(macro_name, macro_params)
-
- if sync:
- self.wait(timeout)
-
- def _run(self, macro_name, macro_params):
- """Method responsible for triggering the macro execution. Must be
- implemented in your macro executor.
-
- :param macro_name: (string) name of macro to be executed
- :param macro_params: (list<string>) macro parameters
- (default is macro_params=None for macros without
- parameters or with the default values)
- """
- raise NotImplementedError('Method _run not implemented in class %s' %
- self.__class__.__name__)
-
- def wait(self, timeout=float("inf")):
- """
- Wait until macro is done. Use it in asynchronous executions.
-
- :param timeout: (float) waiting timeout (in s)
- """
- if timeout <= 0:
- timeout = float("inf")
-
- self._wait(timeout)
-
- def _wait(self, timeout):
- """Method responsible for waiting until macro is done. Must be
- implemented in your macro executor.
-
- :param timeout: (float) waiting timeout (in s)
- """
- raise NotImplementedError('Method _wait not implemented in class %s' %
- self.__class__.__name__)
-
- def stop(self, started_event_timeout=3.0):
- """Stop macro execution. Execute macro in synchronous way before using
- this method.
-
- :param started_event_timeout: (float) waiting timeout for started event
- """
- self._stop(started_event_timeout)
-
- def _stop(self, started_event_timeout=3.0):
- """
- Method responsible for stopping the macro execution. Must be
- implemented in your macro executor.
-
- :param started_event_timeout: (float) waiting timeout for started event
- """
- raise NotImplementedError('Method _stop not implemented in class %s' %
- self.__class__.__name__)
-
- def registerLog(self, log_level):
- """Start registering log messages.
-
- :param log_level: (str) string indicating the log level
- """
- log_buffer_name = '_%s' % log_level
- setattr(self, log_buffer_name, [])
- self._registerLog(log_level)
-
- def _registerLog(self, log_level):
- """
- Method responsible for starting log registration. Must be
- implemented in your macro executor.
-
- :param log_level: (str) string indicating the log level
- """
- raise NotImplementedError('Method _registerLog not implemented in '
- 'class %s' % self.__class__.__name__)
-
- def unregisterLog(self, log_level):
- """Stop registering log messages.
-
- :param log_level: (str) string indicating the log level
- """
- self._unregisterLog(log_level)
-
- def _unregisterLog(self, log_level):
- """Method responsible for stopping log registration. Must be
- implemented in your macro executor.
-
- :param log_level: (str) string indicating the log level
- """
- raise NotImplementedError('Method _unregisterLog not implemented in '
- 'class %s' % self.__class__.__name__)
-
- def getLog(self, log_level):
- """Get log messages.
-
- :param log_level: (str) string indicating the log level
-
- :return: (seq<str>) list of strings with log messages
- """
- log_buffer_name = '_%s' % log_level
- log = getattr(self, log_buffer_name)
- return log
-
- def registerAll(self):
- """Register for macro result, all log levels and common buffer.
- """
- for log_level in self.log_levels:
- self.registerLog(log_level)
- self.registerResult()
- self.createCommonBuffer()
-
- def unregisterAll(self):
- """Unregister macro result, all log levels and common buffer.
- """
- for log_level in self.log_levels:
- self.unregisterLog(log_level)
- self.unregisterResult()
-
- def registerResult(self):
- """Register for macro result
- """
- self._registerResult()
-
- def _registerResult(self):
- """Method responsible for registering for macro result. Must be
- implemented in your macro executor.
- """
- raise NotImplementedError('Method _registerResult not implemented in '
- 'class %s' % self.__class__.__name__)
-
- def unregisterResult(self):
- """Unregister macro result.
- """
- self._unregisterResult()
-
- def _unregisterResult(self):
- """Method responsible for unregistering for macro result. Must be
- implemented in your macro executor.
- """
- raise NotImplementedError('Method _unregisterResult not implemented in'
- ' class %s' % self.__class__.__name__)
-
- def getResult(self):
- """Get macro result.
-
- :return: (seq<str>) list of strings with Result messages
- """
- return self._result
-
- def createCommonBuffer(self):
- """Create a common buffer, where all the registered logs will be stored.
- """
- self._common = []
-
- def getCommonBuffer(self):
- """Get common buffer.
- Method getCommonBuffer can only be used if at least one buffer exists.
-
- :return: (seq<str>) list of strings with messages from all log levels
-
- .. seealso:: :meth:`~createCommonBuffer`
- """
- return self._common
-
- def getState(self):
- """Get macro execution state.
-
- :return: (str)
- """
- state = None
- if len(self._state_buffer) > 0:
- state = self._state_buffer[-1]
- return state
-
- def getStateBuffer(self):
- """Get buffer (history) of macro execution states.
-
- :return: (seq<str>)
- """
- return self._state_buffer
-
- def getExceptionStr(self):
- """Get macro exception type representation (None if the macro state
- is not exception).
-
- :return: (str)
- """
- return self._exception
-
-
-class MacroExecutorFactory(Singleton):
-
- """A scheme-agnostic factory for MacroExecutor instances
-
- Example::
-
- f = MacroExecutorFactory()
- f.getMacroExecutor('tango://my/door/name') #returns a TangoMacroExecutor
-
- Note: For the moment, only TangoMacroExecutor is supported
- """
-
- def getMacroExecutor(self, door_name=None):
- """
- Returns a macro executor instance (a subclass of
- :class:`BaseMacroExecutor`) depending on the door being used.
- """
- if door_name == None:
- from sardana import sardanacustomsettings
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME')
-
- #=======================================================================
- # TODO: Once SEP3 is done, it will define a better way to get the scheme
- # from a model name (including customized default schemes)
- # For the moment I implement it by calling an internal member of
- # TaurusManager
- from taurus.core import TaurusManager
- scheme = TaurusManager()._get_scheme(door_name)
- #======================================================================
-
- if scheme == 'tango':
- return self._getTangoMacroExecutor(door_name)
- else:
- raise ValueError('No MacroExecutor supported for scheme %s' %
- scheme)
-
- def _getTangoMacroExecutor(self, door_name):
- from sardana.tango.macroserver.test import TangoMacroExecutor
- return TangoMacroExecutor(door_name=door_name)
-
-
-if __name__ == '__main__':
- from sardana import sardanacustomsettings
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME')
- print MacroExecutorFactory().getMacroExecutor(door_name)
diff --git a/src/sardana/macroserver/macros/test/sardemoenv.py b/src/sardana/macroserver/macros/test/sardemoenv.py
deleted file mode 100644
index 56d69c4a..00000000
--- a/src/sardana/macroserver/macros/test/sardemoenv.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/env python
-
-#############################################################################
-##
-## This file is part of Sardana, a Tango User Interface Library
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-#############################################################################
-
-from taurus import Device
-from sardana.taurus.core.tango.sardana import registerExtensions
-from taurus.core.util.singleton import Singleton
-from sardana import sardanacustomsettings
-
-
-class SarDemoEnv(Singleton):
-
- """Class to get _SAR_DEMO environment variable with cross checking with
- the MacroServer (given by :attr:`UNITTEST_DOOR_NAME`)
- """
-
- def __init__(self, door_name=None):
- if door_name is None:
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME')
- registerExtensions()
- try:
- self.door = Device(door_name)
- self.ms = self.door.macro_server
- except ValueError:
- raise ValueError('The door %s does not exist' % (door_name))
-
- self.controllers = None
- self.cts = None
- self.motors = None
- self.pseudos = None
- self.zerods = None
- self.oneds = None
- self.twods = None
-
- try:
- self.env = self.ms.getEnvironment()['_SAR_DEMO']['elements'] + \
- list(self.ms.getEnvironment()['_SAR_DEMO']['controllers'])
- except KeyError:
- err = 'sar_demo has not been executed (or door %s not ready)' % \
- door_name
- raise RuntimeError(err)
-
- def getElements(self, elem_type='all'):
- """Return the name of sardemo element(s) of given elem type
-
- :param elem_type: (str) type of elemnts to return (all by default)
-
- :return: (list<str>)
- """
- if elem_type.lower() == 'all':
- return self.env
- if elem_type.lower() == 'moveable':
- return self.getElements('motor') + self.getElements('pseudomotor')
- ms_elems = self.ms.getElementNamesOfType(elem_type)
- elems = [e for e in ms_elems if e is not None and e in self.env]
- return elems
-
- def getMoveables(self):
- """Return the name of moveable(s) defined by SarDemo
-
- :return: (list<str>)
- """
- return self.getMotors() + self.getPseudoMotors()
-
- def getControllers(self):
- """Return the name of controllers(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.controllers:
- self.controllers = self.getElements('controller')
- return self.controllers
-
- def getCTs(self):
- """Return the name of counter timer exp channel(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.cts:
- self.cts = self.getElements('ctexpchannel')
- return self.cts
-
- def getMotors(self):
- """Return the name of motor(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.motors:
- self.motors = self.getElements('motor')
- return self.motors
-
- def getPseudoMotors(self):
- """Return the name of pseudomotor(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.pseudos:
- self.pseudos = self.getElements('pseudomotor')
- return self.pseudos
-
- def getZerods(self):
- """Return the name of zerod exp channel(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.zerods:
- self.zerods = self.getElements('zerodexpchannel')
- return self.zerods
-
- def getOneds(self):
- """Return the name of one exp channel(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.oneds:
- self.oneds = self.getElements('onedexpchannel')
- return self.oneds
-
- def getTwods(self):
- """Return the name of two exp channel(s) defined by SarDemo
-
- :return: (list<str>)
- """
- if not self.twods:
- self.twods = self.getElements('twodexpchannel')
- return self.twods
-
- def changeDoor(self, door_name):
- """Change the door name and reset all lists
- """
- self.__init__(door_name)
-
-
-if __name__ == '__main__':
- s = SarDemoEnv()
- print s.env
- print s.getControllers()
- print s.getCTs()
- print s.getMotors()
- print s.getPseudoMotors()
- print s.getZerods()
- print s.getOneds()
- print s.getTwods()
- print s.getElements('Moveable')
- print s.getMoveables()
- print s.getElements()
diff --git a/src/sardana/macroserver/macros/test/test_ct.py b/src/sardana/macroserver/macros/test/test_ct.py
deleted file mode 100644
index c1a1311a..00000000
--- a/src/sardana/macroserver/macros/test/test_ct.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Tests for ct macros"""
-
-from taurus.external import unittest
-from sardana.macroserver.macros.test import RunStopMacroTestCase
-from sardana.macroserver.macros.test import testRun
-from sardana.macroserver.macros.test import testStop
-
-
-@testRun(macro_params=['.1'], wait_timeout=.5)
-@testRun(macro_params=['.3'], wait_timeout=.5)
-@testStop(macro_params=['1'], stop_delay=.1, wait_timeout=2)
-class CtTest(RunStopMacroTestCase, unittest.TestCase):
-
- """Test of ct macro. It verifies that macro ct can be executed.
- It inherits from RunStopMacroTestCase and from unittest.TestCase.
- It tests two executions of the ct macro with two different input
- parameters.
- Then it does another execution and it tests if the execution can be
- aborted.
- """
- macro_name = "ct"
diff --git a/src/sardana/macroserver/macros/test/test_list.py b/src/sardana/macroserver/macros/test/test_list.py
deleted file mode 100644
index cae0f7fa..00000000
--- a/src/sardana/macroserver/macros/test/test_list.py
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Tests for list macros"""
-
-import time
-from taurus.external import unittest
-from sardana.macroserver.macros.test import (RunMacroTestCase, testRun,
- SarDemoEnv)
-
-
-class LsTest(RunMacroTestCase):
-
- """Base class for testing macros used to list elements.
- See :class:`.RunMacroTestCase` for requirements.
- LsTest use the lists of elem_type generated by :class:`.SarDemoEnv` as
- reference for compare with the output of the tested ls macro.
-
- LsTest provide the class member:
- - elem_type (str): Type of the element to validate (mandatory).
- Must be a valid type for :class:`.SarDemoEnv` class.
-
- It provides the helper method:
- - :meth:`check_elements`
- """
-
- elem_type = None
-
- def check_elements(self, list1, list2):
- """ A helper method to evaluate if all elements of list1 are in list2.
- :params list1: (seq<str>) List of elements to evaluate.
- :params list2: (seq<str>) List of elements for validate.
- """
- for elem in list1:
- msg = "{0} does not contain {1}".format(self.macro_name, elem)
- self.assertTrue(elem in list2, msg)
-
- def macro_runs(self, **kwargs):
- """ Reimplementation of macro_runs method for ls macros.
- It verifies that elements (elem_type) gotten by parsing the
- macro executor log output are in the correspondent
- list (elem_type) of SardanaEnv.
- """
- RunMacroTestCase.macro_runs(self, **kwargs)
- self.log_output = self.macro_executor.getLog("output")
- msg = "generic ls macro does not contain elements"
- self.assertTrue(len(self.log_output) > 0, msg)
-
- if (self.elem_type is not None):
- list_sardemo = SarDemoEnv().getElements(self.elem_type)
- else:
- raise Exception("element_type cannot be None")
-
- #parsing log output to get all elements
- header_rows = 2
- names_column_index = 0
- macro_output = []
- for row, in self.log_output[header_rows:]:
- macro_output.append(row.split()[names_column_index])
- # Evaluate if element of A are in B
- if len(macro_output) >= len(list_sardemo):
- self.check_elements(list_sardemo, macro_output)
- else:
- self.check_elements(macro_output, list_sardemo)
-
-
-@testRun(macro_params=['l.*'])
-@testRun
-class LsmTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'lsm' macro.
- It verifies that all motors created by sar_demo are listed after
- execution of the macro 'lsm'.
- """
- macro_name = "lsm"
- elem_type = "moveable"
-
-
-@testRun
-class LspmTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'lspm' macro.
- It verifies that all pseudomotors created by sar_demo are listed after
- execution of the macro 'lspm'.
- """
- macro_name = "lspm"
- elem_type = "pseudomotor"
-
-
-@testRun
-class LsctrlTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'lsctrl' macro.
- It verifies that all controllers created by sar_demo are listed after
- execution of the macro 'lsctrl'.
- """
- macro_name = "lsctrl"
- elem_type = "controller"
-
-
-@testRun
-class LsctTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'lsct' macro.
- It verifies that all ct created by sar_demo are listed after
- execution of the macro 'lsct'.
- """
- macro_name = "lsct"
- elem_type = "ctexpchannel"
-
-
-@testRun
-class Ls0dTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'ls0d' macro.
- It verifies that all 0d created by sar_demo are listed after
- execution of the macro 'ls0d'.
- """
- macro_name = "ls0d"
- elem_type = "zerodexpchannel"
-
-
-@testRun
-class Ls1dTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'ls1d' macro.
- It verifies that all 1d created by sar_demo are listed after
- execution of the macro 'ls1d'.
- """
- macro_name = "ls1d"
- elem_type = "onedexpchannel"
-
-
-@testRun
-class Ls2dTest(LsTest, unittest.TestCase):
-
- """Class used for testing the 'ls2d' macro.
- It verifies that all 2d created by sar_demo are listed after
- execution of the macro 'ls2d'.
- """
- macro_name = "ls2d"
- elem_type = "twodexpchannel"
diff --git a/src/sardana/macroserver/macros/test/test_scan.py b/src/sardana/macroserver/macros/test/test_scan.py
deleted file mode 100644
index 95261d6f..00000000
--- a/src/sardana/macroserver/macros/test/test_scan.py
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Tests for scan macros"""
-
-from taurus.external import unittest
-from sardana.macroserver.macros.test import (RunStopMacroTestCase,
- testRun, testStop, SarDemoEnv)
-
-#get handy motor names from sardemo
-try:
- _MOTORS = SarDemoEnv().getMotors()
- _m1, _m2 = _MOTORS[:2]
-except RuntimeError:
- import taurus
- from sardana import sardanacustomsettings
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME',
- 'UNDEFINED')
- taurus.warning("The door %s is not running. " % (door_name) +
- "Ignore this message if you are building the documentation")
- _m1 = _m2 = 'motor_not_defined'
-except Exception, e:
- import taurus
- taurus.debug(e)
- taurus.warning("It was not possible to retrieve the motor names. " +
- "Ignore this message if you are building the documentation.")
- _m1 = _m2 = 'motor_not_defined'
-
-
-def parsing_log_output(log_output):
- """A helper method to parse log output of an executed scan macro.
- :params log_output: (seq<str>) Result of macro_executor.getLog('output')
- (see description in :class:`.BaseMacroExecutor`).
-
- :return: (seq<number>) The numeric data of a scan.
- """
- first_data_line = 1
- scan_index = 0
- data = []
- for line, in log_output[first_data_line:]:
- # Get a list of elements without white spaces between them
- l = line.split()
- # Cast all elements of the scan line (l) to float
- l = [float(scan_elem) for scan_elem in l]
- # Cast index of scan to int (the first element of the list)
- l[scan_index] = int(l[scan_index])
- data.append(l)
- return data
-
-
-class ANscanTest(RunStopMacroTestCase):
-
- """Not yet implemented. Once implemented it will test anscan.
- See :class:`.RunStopMacroTestCase` for requirements.
- """
- pass
-
-
-class DNscanTest(ANscanTest):
-
- """Not yet implemented. Once implemented it will test the macro dnscanc.
- See :class:`ANscanTest` for requirements.
- """
- pass
-
-
-class DNscancTest(DNscanTest):
-
- """Not yet implemented. Once implemented it will test the macro dnscanc.
- See :class:`DNscanTest` for requirements.
- """
- pass
-
-
-@testRun(macro_params=[_m1, '0', '5', '4', '.1'], wait_timeout=float("inf"))
-@testStop(macro_params=[_m1, '0', '5', '3', '.1'])
-class AscanTest(ANscanTest, unittest.TestCase):
-
- """Test of ascan macro. See :class:`ANscanTest` for requirements.
- It verifies that macro ascan can be executed and stoped and tests
- the output of the ascan using data from log system and macro data.
- """
- macro_name = 'ascan'
-
- def macro_runs(self, macro_params=None, wait_timeout=float("inf")):
- """Reimplementation of macro_runs method for ascan macro.
- It verifies using double checking, with log output and data from
- the macro:
-
- - The motor initial and final positions of the scan are the
- ones given as input.
-
- - Intervals in terms of motor position between one point and
- the next one are equidistant.
- """
- #call the parent class implementation
- ANscanTest.macro_runs(self, macro_params=macro_params,
- wait_timeout=wait_timeout)
-
- mot_name = macro_params[0]
- expected_init_pos = float(macro_params[1])
- expected_final_pos = float(macro_params[2])
- self.steps = int(macro_params[-2])
- interval = abs(expected_final_pos - expected_init_pos) / self.steps
-
- # Test data from macro (macro_executor.getData())
- data = self.macro_executor.getData()
- mot_init_pos = data[min(data.keys())].data[mot_name]
- mot_final_pos = data[max(data.keys())].data[mot_name]
- pre = mot_init_pos
-
- for step in range(1, max(data.keys()) + 1):
- self.assertAlmostEqual(abs(pre - data[step].data[mot_name]),
- interval, 7,
- "Step interval differs for more than expected (using getData)")
- pre = data[step].data[mot_name]
-
- self.assertAlmostEqual(mot_init_pos, expected_init_pos, 7,
- "Initial possition differs from set value (using getData)")
- self.assertAlmostEqual(mot_final_pos, expected_final_pos, 7,
- "Final possition differs from set value (using getData)")
-
- # Test data from log_output (macro_executor.getLog('output'))
- log_output = self.macro_executor.getLog('output')
- data = parsing_log_output(log_output)
- init_pos = 0
- last_pos = -1
- value = 1
- pre = data[init_pos]
- for step in data[1:]:
- self.assertAlmostEqual(abs(pre[value] - step[value]),
- interval, 7,
- "Step interval differs for more than expected (using getData)")
- pre = step
-
- self.assertAlmostEqual(data[init_pos][value], expected_init_pos, 7,
- "Initial possition differs from set value (using getLog)")
- self.assertAlmostEqual(data[last_pos][value], expected_final_pos, 7,
- "Final possition differs from set value (using getLog)")
-
-
-@testRun(macro_params=[_m1, '-1', '1', '2', '.1'])
-@testStop(macro_params=[_m1, '1', '-1', '3', '.1'])
-class DscanTest(DNscanTest, unittest.TestCase):
-
- """Test of dscan macro. It verifies that macro dscan can be executed and
- stoped. See :class:`DNscanTest` for requirements.
- """
- macro_name = 'dscan'
-
-
-@testRun(macro_params=[_m1, '-1', '1', '3', _m2, '-1', '0', '2', '.1'])
-@testRun(macro_params=[_m1, '-2', '2', '3', _m2, '-2', '-1', '2', '.1'])
-@testStop(macro_params=[_m1, '-3', '0', '3', _m2, '-3', '0', '2', '.1'])
-class MeshTest(RunStopMacroTestCase, unittest.TestCase):
-
- """Test of mesh macro. It verifies that macro mesh can be executed and
- stoped. See :class:`.RunStopMacroTestCase` for requirements.
- """
- macro_name = 'mesh'
diff --git a/src/sardana/macroserver/macros/test/test_wm.py b/src/sardana/macroserver/macros/test/test_wm.py
deleted file mode 100644
index f6db3607..00000000
--- a/src/sardana/macroserver/macros/test/test_wm.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Tests for wm macros"""
-
-from taurus.external import unittest
-from sardana.macroserver.macros.test import (RunMacroTestCase, testRun,
- SarDemoEnv)
-
-try:
- _MOTORS = SarDemoEnv().getMotors()
- _m1, _m2 = _MOTORS[:2]
-except RuntimeError:
- import taurus
- from sardana import sardanacustomsettings
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME',
- 'UNDEFINED')
- taurus.warning("The door %s is not running. " % (door_name) +
- "Ignore this message if you are building the documentation.")
- _m1 = _m2 = 'motor_not_defined'
-except Exception, e:
- import taurus
- taurus.debug(e)
- taurus.warning("It was not possible to retrieve the motor names. " +
- "Ignore this message if you are building the documentation.")
- _m1 = _m2 = 'motor_not_defined'
-
-
-class WBase(RunMacroTestCase):
-
- """Base class for testing macros used to read position.
- """
-
- def macro_runs(self, **kw):
- """Testing the execution of the 'wm' macro and verify that the log
- 'output' exists.
- """
- RunMacroTestCase.macro_runs(self, **kw)
- self.logOutput = self.macro_executor.getLog("output")
- msg = "wm macro did not return any data."
- self.assertTrue(len(self.logOutput) > 0, msg)
-
-
-@testRun(macro_params=[_m1], wait_timeout=5.0)
-class WmTest(WBase, unittest.TestCase):
-
- """Test of wm macro. It verifies that the macro 'wm' can be executed.
- It inherits from WmBase and from unittest.TestCase.
- It tests the execution of the 'wm' macro and verifies that the log 'output'
- exists.
- """
- macro_name = "wm"
diff --git a/src/sardana/macroserver/macroserver.py b/src/sardana/macroserver/macroserver.py
deleted file mode 100644
index 0fab6bb1..00000000
--- a/src/sardana/macroserver/macroserver.py
+++ /dev/null
@@ -1,862 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from __future__ import with_statement
-
-import os
-import re
-import codecs
-import logging.handlers
-import time
-
-from taurus import Device
-from taurus.core import TaurusEventType
-from taurus.core.util.log import Logger
-from taurus.core.util.containers import CaselessDict
-
-from sardana import InvalidId, ElementType, Interface
-from sardana.sardanaevent import EventType
-from sardana.sardanamodulemanager import ModuleManager
-from sardana.sardanamanager import SardanaElementManager, SardanaIDManager
-from sardana.sardanathreadpool import get_thread_pool
-from sardana.sardanautils import is_pure_str
-from sardana.taurus.core.tango.sardana.motion import Motion, MotionGroup
-from sardana.taurus.core.tango.sardana.pool import registerExtensions
-
-from sardana.macroserver.msbase import MSObject
-from sardana.macroserver.mscontainer import MSContainer
-from sardana.macroserver.msdoor import MSDoor
-from sardana.macroserver.msmacromanager import MacroManager
-from sardana.macroserver.mstypemanager import TypeManager
-from sardana.macroserver.msenvmanager import EnvironmentManager
-from sardana.macroserver.msparameter import ParamType
-from sardana.macroserver.msexception import UnknownMacroLibrary
-
-CHANGE_EVT_TYPES = TaurusEventType.Change, TaurusEventType.Periodic
-
-ET = ElementType
-#: dictionary dict<:data:`~sardana.ElementType`, :class:`tuple`>
-#: where tuple is a sequence:
-#:
-#: #. type string representation
-#: #. family
-#: #. internal macro server class
-#: #. automatic full name
-TYPE_MAP = {
- ET.Door : ("Door", "Door", MSDoor, "door/{macro_server.name}/{name}"),
-}
-
-class TypeData(object):
- """Information for a specific Element type"""
-
- def __init__(self, **kwargs):
- self.__dict__.update(kwargs)
-
-#: dictionary
-#: dict<:data:`~sardana.ElementType`, :class:`~sardana.macroserver.macroserver.TypeData`>
-TYPE_MAP_OBJ = {}
-for t, d in TYPE_MAP.items():
- o = TypeData(type=t, name=d[0], family=d[1], klass=d[2] ,
- auto_full_name=d[3])
- TYPE_MAP_OBJ[t] = o
-
-
-class NonOverlappingTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
-
- def getNewFileName(self):
- currentTime = int(time.time())
- dstNow = time.localtime(currentTime)[-1]
- t = self.rolloverAt - self.interval
- if self.utc:
- timeTuple = time.gmtime(t)
- else:
- timeTuple = time.localtime(t)
- dstThen = timeTuple[-1]
- if dstNow != dstThen:
- if dstNow:
- addend = 3600
- else:
- addend = -3600
- timeTuple = time.localtime(t + addend)
-
- dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple)
- # PY3K
- if hasattr(self, 'rotation_filename'):
- dfn = self.rotation_filename(dfn)
- return dfn
-
- def doRollover(self):
- dfn = self.getNewFileName()
- do_backup = os.path.isfile(dfn) and self.backupCount > 0
- if do_backup:
- dfn_backup = dfn + os.path.extsep + "backup"
- os.rename(dfn, dfn_backup)
- try:
- super(NonOverlappingTimedRotatingFileHandler, self).doRollover()
- finally:
- if do_backup:
- mode = self.mode
- if 'a' not in mode:
- mode = 'a' + mode
- with codecs.open(dfn_backup, mode, self.encoding) as dest:
- with codecs.open(dfn, 'r', self.encoding) as src:
- dest.write(src.read())
- os.remove(dfn)
- os.rename(dfn_backup, dfn)
-
-
-class MacroServer(MSContainer, MSObject, SardanaElementManager, SardanaIDManager):
-
- All = "All"
-
- MaxParalellMacros = 5
-
- logReportParams = dict(when='midnight', interval=1, backupCount=365)
- logReportKlass = NonOverlappingTimedRotatingFileHandler
-
- def __init__(self, full_name, name=None, macro_path=None,
- environment_db=None):
- # dict<str, Pool>
- # key - device name (case insensitive)
- # value - Pool object representing the device name
- self._pools = CaselessDict()
- self._max_parallel_macros = self.MaxParalellMacros
- self._path_id = None
-
- MSContainer.__init__(self)
- MSObject.__init__(self, full_name=full_name, name=name, id=InvalidId,
- macro_server=self, elem_type=ElementType.MacroServer)
-
- registerExtensions()
-
- self._type_manager = TypeManager(self)
- self._environment_manager = EnvironmentManager(self,
- environment_db=environment_db)
- self._macro_manager = MacroManager(self, macro_path=macro_path)
-
- def serialize(self, *args, **kwargs):
- kwargs = MSObject.serialize(self, *args, **kwargs)
- kwargs['type'] = self.__class__.__name__
- kwargs['id'] = InvalidId
- kwargs['parent'] = None
- return kwargs
-
- def add_job(self, job, callback=None, *args, **kw):
- th_pool = get_thread_pool()
- th_pool.add(job, callback, *args, **kw)
-
- # --------------------------------------------------------------------------
- # Environment DB related methods
- # --------------------------------------------------------------------------
-
- def set_environment_db(self, environment_db):
- """Sets the environment database.
-
- :param env_db:
- environment database name
- :type env_db:
- str
- """
- self.environment_manager.setEnvironmentDb(environment_db)
-
- # --------------------------------------------------------------------------
- # Python related methods
- # --------------------------------------------------------------------------
-
- def set_python_path(self, path):
- mod_man = ModuleManager()
- if self._path_id is not None:
- mod_man.remove_python_path(self._path_id)
- self._path_id = mod_man.add_python_path(path)
-
- # --------------------------------------------------------------------------
- # Macro path related methods
- # --------------------------------------------------------------------------
-
- def set_macro_path(self, macro_path):
- """Sets the macro path.
-
- :param macro_path:
- macro path
- :type macro_path:
- seq<str>
- """
- self.macro_manager.setMacroPath(macro_path)
-
- # --------------------------------------------------------------------------
- # Report related methods
- # --------------------------------------------------------------------------
-
- def set_log_report(self, filename=None, format=None):
- log = self.get_report_logger()
-
- # first check that the handler has not been initialized yet. If it has
- # we remove previous handlers. We only allow one timed rotating file
- # handler at a time
- to_remove = []
- for handler in log.handlers:
- if isinstance(handler, logging.handlers.TimedRotatingFileHandler):
- to_remove.append(handler)
-
- for handler in to_remove:
- handler.close()
- log.removeHandler(handler)
-
- if filename is None:
- return
-
- if format is None:
- format = Logger.DftLogMessageFormat
- formatter = logging.Formatter(format)
-
- self.info("Reports are being stored in %s", filename)
- klass = self.logReportKlass
- handler = klass(filename, **self.logReportParams)
- handler.setFormatter(formatter)
- log.addHandler(handler)
-
- def clear_log_report(self):
- self.set_log_report()
-
- def get_report_logger(self):
- return logging.getLogger("Sardana.Report")
-
- report_logger = property(get_report_logger)
-
- def report(self, msg, *args, **kwargs):
- """
- Record a log message in the sardana report (if enabled) with default
- level **INFO**. The msg is the message format string, and the args are
- the arguments which are merged into msg using the string formatting
- operator. (Note that this means that you can use keywords in the
- format string, together with a single dictionary argument.)
-
- *kwargs* are the same as :meth:`logging.Logger.debug` plus an optional
- level kwargs which has default value **INFO**
-
- Example::
-
- self.report("this is an official report!")
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- level = kwargs.pop('level', logging.INFO)
- return self.report_logger.log(level, msg, *args, **kwargs)
-
- # --------------------------------------------------------------------------
- # Pool related methods
- # --------------------------------------------------------------------------
-
- def set_pool_names(self, pool_names):
- """Registers a new list of device pools in this manager
-
- :param pool_names: sequence of pool names
- :type pool_names: seq<str>"""
- for pool in self._pools.values():
- elements_attr = pool.getAttribute("Elements")
- elements_attr.removeListener(self.on_pool_elements_changed)
-
- for name in pool_names:
- self.debug("Creating pool %s", name)
- pool = Device(name)
- if pool is None:
- self.error('Could not create Pool object for %s' % name)
- continue
- self._pools[name] = pool
- elements_attr = pool.getAttribute("Elements")
- elements_attr.addListener(self.on_pool_elements_changed)
-
- def get_pool_names(self):
- """Returns the list of names of the pools this macro server is connected
- to.
-
- :return:
- the list of names of the pools this macro server is connected to
- :rtype:
- seq<str>"""
- return self._pools.keys()
-
- def get_pool(self, pool_name):
- """Returns the device pool object corresponding to the given device name
- or None if no match is found.
-
- :param pool_name: device pool name
- :type pool_name: str
- :return: Pool object or None if no match is found"""
- return self._pools.get(pool_name)
-
- def get_pools(self):
- """Returns the list of pools this macro server is connected to.
-
- :return: the list of pools this macro server is connected to
- :rtype: seq<Pool>"""
- return self._pools.values()
-
- def on_pool_elements_changed(self, evt_src, evt_type, evt_value):
- if evt_type not in CHANGE_EVT_TYPES:
- return
- self.fire_event(EventType("PoolElementsChanged"), evt_value)
-
- # --------------------------------------------------------------------------
- # Door related methods
- # --------------------------------------------------------------------------
-
- def create_element(self, **kwargs):
- type = kwargs['type']
- elem_type = ElementType[type]
- name = kwargs['name']
-
- kwargs['macro_server'] = self
-
- td = TYPE_MAP_OBJ[elem_type]
- klass = td.klass
- auto_full_name = td.auto_full_name
-
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
-
- self.check_element(name, full_name)
-
- id = kwargs.get('id')
- if id is None:
- kwargs['id'] = id = self.get_new_id()
- else:
- self.reserve_id(id)
- elem = klass(**kwargs)
- ret = self.add_element(elem)
- self.fire_event(EventType("ElementCreated"), elem)
- return ret
-
- def create_door(self, **kwargs):
- return self.create_element(type="Door", **kwargs)
-
- # --------------------------------------------------------------------------
- # General access to elements
- # --------------------------------------------------------------------------
-
- def get_elements_info(self):
- return self.get_remote_elements_info() + self.get_local_elements_info()
-
- def get_remote_elements_info(self):
- return [ elem.serialize()
- for pool in self.get_pools()
- for elem in pool.getElements() ]
-
- def get_local_elements_info(self):
- # fill macro library info
- ret = [ macrolib.serialize()
- for macrolib in self.get_macro_libs().values() ]
- # fill macro info
- ret += [ macro.serialize()
- for macro in self.get_macros().values() ]
- # fill parameter type info
- ret += [ paramtype.serialize()
- for paramtype in self.get_data_types().values() ]
-
- return ret
-
- # --------------------------------------------------------------------------
- # macro execution
- # --------------------------------------------------------------------------
-
- def set_max_parallel_macros(self, nb):
- assert nb > 0, "max parallel macros number must be > 0"
- th_pool = get_thread_pool()
- if th_pool.size + 5 < nb:
- th_pool.size = nb
- self._max_parallel_macros = nb
-
- def get_max_parallel_macros(self):
- return self._max_parallel_macros
-
- max_parallel_macros = property(get_max_parallel_macros,
- set_max_parallel_macros, doc="maximum number of macros which can "
- "execute at the same time")
-
- @property
- def macro_manager(self):
- return self._macro_manager
-
- @property
- def environment_manager(self):
- return self._environment_manager
-
- @property
- def type_manager(self):
- return self._type_manager
-
- # --------------------------------------------------------------------------
- # (Re)load code
- # --------------------------------------------------------------------------
-
- def reload_lib(self, lib_name):
- return self.macro_manager.reloadLib(lib_name)
-
- def reload_macro_lib(self, lib_name):
- manager = self.macro_manager
-
- try:
- old_lib = manager.getMacroLib(lib_name)
- except UnknownMacroLibrary:
- old_lib = None
-
- new_elements, changed_elements, deleted_elements = [], [], []
-
- new_lib = manager.reloadMacroLib(lib_name)
-
- if old_lib is None:
- new_elements.extend(new_lib.get_macros())
- new_elements.append(new_lib)
- else:
- changed_elements.append(new_lib)
- new_names = set([ macro.name for macro in new_lib.get_macros() ])
- old_names = set([ macro.name for macro in old_lib.get_macros() ])
- changed_names = set.intersection(new_names, old_names)
- deleted_names = old_names.difference(new_names)
- new_names = new_names.difference(old_names)
-
- for new_name in new_names:
- new_elements.append(new_lib.get_macro(new_name))
- for changed_name in changed_names:
- changed_elements.append(new_lib.get_macro(changed_name))
- for deleted_name in deleted_names:
- deleted_elements.append(old_lib.get_macro(deleted_name))
-
- evt = { "new" : new_elements, "change" : changed_elements,
- "del" : deleted_elements }
- self.fire_event(EventType("ElementsChanged"), evt)
- return new_lib
-
- reload_macro_lib.__doc__ = MacroManager.reloadMacroLib.__doc__
-
- def reload_macro_libs(self, lib_names):
- for lib_name in lib_names:
- self.reload_macro_lib(lib_name)
-
- def reload_macro(self, macro_name):
- macro_info = self.macro_manager.getMacro(macro_name)
- lib_name = macro_info.module_name
- self.reload_macro_lib(lib_name)
-
- def reload_macros(self, macro_names):
- lib_names = set()
- for macro_name in macro_names:
- macro_info = self.macro_manager.getMacro(macro_name)
- lib_names.add(macro_info.module_name)
- self.reload_macro_libs(lib_names)
-
- def get_macro_lib(self, lib_name):
- return self.macro_manager.getMacroLib(lib_name)
- get_macro_lib.__doc__ = MacroManager.getMacroLib.__doc__
-
- def get_macro_libs(self, filter=None):
- return self.macro_manager.getMacroLibs(filter=filter)
- get_macro_libs.__doc__ = MacroManager.getMacroLibs.__doc__
-
- def get_macro_lib_names(self):
- return self.macro_manager.getMacroLibNames()
- get_macro_lib_names.__doc__ = MacroManager.getMacroLibNames.__doc__
-
- def get_macro(self, name):
- return self.macro_manager.getMacro(name)
- get_macro.__doc__ = MacroManager.getMacro.__doc__
-
- def get_macros(self, filter=None):
- return self.macro_manager.getMacros(filter=filter)
- get_macros.__doc__ = MacroManager.getMacros.__doc__
-
- def get_macro_names(self):
- return self.macro_manager.getMacroNames()
- get_macro_names.__doc__ = MacroManager.getMacroNames.__doc__
-
- def get_macro_classes(self):
- return self.macro_manager.getMacroClasses()
- get_macro_classes.__doc__ = MacroManager.getMacroClasses.__doc__
-
- def get_macro_functions(self):
- return self.macro_manager.getMacroFunctions()
- get_macro_functions.__doc__ = MacroManager.getMacroFunctions.__doc__
-
- def get_macro_libs_summary_info(self):
- libs = self.get_macro_libs()
- ret = []
- for module_name, macro_lib_info in libs.items():
- elem = "%s (%s)" % (macro_lib_info.name, macro_lib_info.file_path)
- ret.append(elem)
- return ret
-
- def get_macro_classes_summary_info(self):
- macros = self.get_macros()
- ret = []
- for macro_info in macros:
- elem = "%s (%s)" % (macro_info.name, macro_info.file_path)
- ret.append(elem)
- return ret
-
- def get_or_create_macro_lib(self, lib_name, macro_name=None):
- """Gets the exiting macro lib or creates a new macro lib file. If
- name is not None, a macro template code for the given macro name is
- appended to the end of the file.
-
- :param lib_name:
- module name, python file name, or full file name (with path)
- :type lib_name: str
- :param macro_name:
- an optional macro name. If given a macro template code is appended
- to the end of the file (default is None meaning no macro code is
- added)
- :type macro_name: str
-
- :return:
- a sequence with three items: full_filename, code, line number is 0
- if no macro is created or n representing the first line of code for
- the given macro name.
- :rtype: seq<str, str, int>"""
- return self.macro_manager.getOrCreateMacroLib(lib_name,
- macro_name=macro_name)
- get_or_create_macro_lib.__doc__ = MacroManager.getOrCreateMacroLib.__doc__
-
- def set_macro_lib(self, lib_name, code, auto_reload=True):
- module_name = self.macro_manager.setMacroLib(lib_name, code,
- auto_reload=False)
- if auto_reload:
- self.reload_macro_lib(module_name)
-
- set_macro_lib.__doc__ = MacroManager.setMacroLib.__doc__
-
- # --------------------------------------------------------------------------
- # Data types
- # --------------------------------------------------------------------------
-
- def get_data_types(self):
- return self.type_manager.getTypes()
- get_data_types.__doc__ = TypeManager.getTypes.__doc__
-
- def get_data_type(self, type_name):
- return self.type_manager.getTypeObj(type_name)
- get_data_type.__doc__ = TypeManager.getTypeObj.__doc__
-
- def get_data_type_names(self):
- return self.type_manager.getTypeNames()
- get_data_type_names.__doc__ = TypeManager.getTypeNames.__doc__
-
- def get_data_type_names_with_asterisc(self):
- return self.type_manager.getTypeListStr()
- get_data_type_names_with_asterisc.__doc__ = TypeManager.getTypeListStr.__doc__
-
- # --------------------------------------------------------------------------
- # Doors
- # --------------------------------------------------------------------------
-
- def get_doors(self):
- return self.get_elements_by_type(ElementType.Door)
-
- def get_door_names(self):
- return [ door.full_name for door in self.get_doors() ]
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Environment access methods
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def get_env(self, key=None, door_name=None, macro_name=None):
- """Gets the environment matching the given parameters:
-
- - door_name and macro_name define the context where to look for
- the environment. If both are None, the global environment is
- used. If door name is None but macro name not, the given macro
- environment is used and so on...
- - If key is None it returns the complete environment, otherwise
- key must be a string containing the environment variable name.
-
- :param key:
- environment variable name [default: None, meaning all environment]
- :type key: str
- :param door_name:
- local context for a given door [default: None, meaning no door
- context is used]
- :type door_name: str
- :param macro_name:
- local context for a given macro [default: None, meaning no macro
- context is used]
- :type macro_name: str
-
- :return: a :obj:`dict` containing the environment
- :rtype: :obj:`dict`
-
- :raises: UnknownEnv"""
- return self.environment_manager.getEnv(key=key, macro_name=macro_name,
- door_name=door_name)
-
- def set_env(self, key, value):
- """Sets the environment key to the new value and stores it persistently.
-
- :param key: the key for the environment
- :param value: the value for the environment
-
- :return: a tuple with the key and value objects stored"""
- env_man = self.environment_manager
- if env_man.hasEnv(key):
- evt_type = "change"
- else:
- evt_type = "new"
-
- k,v = self.environment_manager.setEnv(key, value)
-
- evt = { evt_type : { k : v } }
- self.fire_event(EventType("EnvironmentChanged"), evt)
- return k,v
-
- def set_env_obj(self, data):
- """Sets the environment key to the new value and stores it persistently.
-
- :param key: the key for the environment
- :param value: the value for the environment
-
- :return: a tuple with the key and value objects stored"""
- env_man = self.environment_manager
-
- new, change = {}, {}
- for key, value in data.items():
- d = new
- if env_man.hasEnv(key):
- d = change
- d[key] = value
-
- ret = env_man.setEnvObj(data)
-
- evt = dict(new=new, change=change)
- self.fire_event(EventType("EnvironmentChanged"), evt)
- return ret
-
- def change_env(self, data):
- env_man = self.environment_manager
- new_change_env = data.get('new', {})
- new_change_env.update(data.get('change', {}))
- del_env = data.get('del', [])
-
- new, change = {}, {}
- for key, value in new_change_env.items():
- d = new
- if env_man.hasEnv(key):
- d = change
- d[key] = value
-
- del_keys = env_man.unsetEnv(del_env)
- env_man.setEnvObj(new_change_env)
-
- evt = dict(new=new, change=change)
- evt['del'] = del_keys
- self.fire_event(EventType("EnvironmentChanged"), evt)
-
- def unset_env(self, key):
- """Unsets the environment for the given key.
-
- :param key: the key for the environment to be unset"""
- ret = self.environment_manager.unsetEnv(key)
- evt = { 'del' : { key : None } }
- self.fire_event(EventType("EnvironmentChanged"), evt)
- return ret
-
- def has_env(self, key, macro_name=None, door_name=None):
- return self.environment_manager.hasEnv(key,
- macro_name=macro_name, door_name=door_name)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # General object access methods
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def get_object(self, name, type_class=All, subtype=All, pool=All):
- objs = self.find_objects(name, type_class, subtype, pool)
- if len(objs) == 0:
- return None
- if len(objs) > 1:
- raise AttributeError('More than one object named "%s" found' % name)
- return objs[0]
-
- def get_objects(self, names, type_class=All, subtype=All, pool=All):
- return self.find_objects(names, type_class=type_class, subtype=subtype,
- pool=pool)
-
- def find_objects(self, param, type_class=All, subtype=All, pool=All):
- if is_pure_str(param):
- param = param,
-
- if type_class == MacroServer.All:
- type_name_list = self.get_data_type_names()
- else:
- if is_pure_str(type_class):
- type_name_list = type_class,
- else:
- type_name_list = type_class
- obj_set = set()
- param = [ '^%s$' % x for x in param ]
- re_objs = map(re.compile, param, len(param) * (re.IGNORECASE,))
- re_subtype = re.compile(subtype, re.IGNORECASE)
- for type_name in type_name_list:
- type_class_name = type_name
- if type_class_name.endswith('*'):
- type_class_name = type_class_name[:-1]
- type_inst = self.get_data_type(type_class_name)
- if not type_inst.hasCapability(ParamType.ItemList):
- continue
- if self.is_macroserver_interface(type_class_name):
- for name, obj in type_inst.getObjDict(pool=pool).items():
- for re_obj in re_objs:
- if re_obj.match(name) is not None:
- obj_type = ElementType[obj.get_type()]
- if subtype is MacroServer.All or re_subtype.match(obj_type):
- obj_set.add(obj)
- else:
- for name, obj in type_inst.getObjDict(pool=pool).items():
- for re_obj in re_objs:
- if re_obj.match(name) is not None:
- obj_type = obj.getType()
- if (subtype is MacroServer.All or \
- re_subtype.match(obj.getType())) and \
- obj_type != "MotorGroup":
- obj_set.add(obj)
- return list(obj_set)
-
- def get_motion(self, elems, motion_source=None, read_only=False, cache=True,
- decoupled=False):
- if motion_source is None:
- motion_source = self.get_pools()
-
- motion_klass = Motion
- if decoupled: # and len(elems)>1:
- motion_klass = MotionGroup
- return motion_klass(elems, motion_source)
-
- _LOCAL_INTERFACES = {
- Interface.MacroLibrary : get_macro_libs,
- Interface.MacroCode : get_macros,
- Interface.MacroClass: get_macro_classes,
- Interface.MacroFunction: get_macro_functions,
- }
-
- def is_macroserver_interface(self, interface):
- if is_pure_str(interface):
- interface = Interface[interface]
- return interface in self._LOCAL_INTERFACES
-
- def get_elements_with_interface(self, interface):
- ret = CaselessDict()
- if is_pure_str(interface):
- interface_str = interface
- interface = Interface[interface_str]
- else:
- interface_str = Interface[interface]
-
- if self.is_macroserver_interface(interface):
- ret.update(self._LOCAL_INTERFACES.get(interface)(self))
- else:
- for pool in self.get_pools():
- ret.update(pool.getElementsWithInterface(interface_str))
- return ret
-
- def get_element_with_interface(self, name, interface):
- for pool in self.get_pools():
- element = pool.getElementWithInterface(name, interface)
- if element is not None:
- return element
-
- def get_controllers(self):
- return self.get_elements_with_interface("Controller")
-
- def get_moveables(self):
- return self.get_elements_with_interface("Moveable")
-
- def get_motors(self):
- return self.get_elements_with_interface("Motor")
-
- def get_pseudo_motors(self):
- return self.get_elements_with_interface("PseudoMotor")
-
- def get_io_registers(self):
- return self.get_elements_with_interface("IORegister")
-
- def get_measurement_groups(self):
- return self.get_elements_with_interface("MeasurementGroup")
-
- def get_exp_channels(self):
- return self.get_elements_with_interface("ExpChannel")
-
- def get_counter_timers(self):
- return self.get_elements_with_interface("CTExpChannel")
-
- def get_0d_exp_channels(self):
- return self.get_elements_with_interface("ZeroDExpChannel")
-
- def get_1d_exp_channels(self):
- return self.get_elements_with_interface("OneDExpChannel")
-
- def get_2d_exp_channels(self):
- return self.get_elements_with_interface("TwoDExpChannel")
-
- def get_pseudo_counters(self):
- return self.get_elements_with_interface("PseudoCounter")
-
- def get_instruments(self):
- return self.get_elements_with_interface("Instrument")
-
- def get_controller(self, name):
- return self.get_element_with_interface(name, "Controller")
-
- def get_moveable(self, name):
- return self.get_element_with_interface(name, "Moveable")
-
- def get_motor(self, name):
- return self.get_element_with_interface(name, "Motor")
-
- def get_pseudo_motor(self, name):
- return self.get_element_with_interface(name, "PseudoMotor")
-
- def get_io_register(self, name):
- return self.get_element_with_interface(name, "IORegister")
-
- def get_measurement_group(self, name):
- return self.get_element_with_interface(name, "MeasurementGroup")
-
- def get_exp_channel(self, name):
- return self.get_element_with_interface(name, "ExpChannel")
-
- def get_counter_timer(self, name):
- return self.get_element_with_interface(name, "CTExpChannel")
-
- def get_0d_exp_channel(self, name):
- return self.get_element_with_interface(name, "ZeroDExpChannel")
-
- def get_1d_exp_channel(self, name):
- return self.get_element_with_interface(name, "OneDExpChannel")
-
- def get_2d_exp_channel(self, name):
- return self.get_element_with_interface(name, "TwoDExpChannel")
-
- def get_pseudo_counter(self, name):
- return self.get_element_with_interface(name, "PseudoCounter")
-
- def get_instrument(self, name):
- return self.get_element_with_interface(name, "Instrument")
diff --git a/src/sardana/macroserver/msbase.py b/src/sardana/macroserver/msbase.py
deleted file mode 100644
index 726259ba..00000000
--- a/src/sardana/macroserver/msbase.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python MacroServer libray. It defines the base
-classes for MacroServer object"""
-
-__all__ = [",MSBaseObject", "MSObject", ]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanabase import SardanaBaseObject, SardanaObjectID
-
-
-class MSBaseObject(SardanaBaseObject):
- """The MacroServer most abstract object."""
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('macro_server')
- SardanaBaseObject.__init__(self, **kwargs)
-
- def get_macro_server(self):
- """Return the :class:`sardana.macroserver.macroserver.MacroServer`
- which *owns* this macro server object.
-
- :return: the macro server which *owns* this macro server object.
- :rtype: :class:`sardana.macroserver.macroserver.MacroServer`"""
- return self.get_manager()
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaBaseObject.serialize(self, *args, **kwargs)
- kwargs['macro_server'] = self.macro_server.name
- return kwargs
-
- macro_server = property(get_macro_server,
- doc="reference to the :class:`sardana.macroserver.macroserver.MacroServer`")
-
-
-class MSObject(SardanaObjectID, MSBaseObject):
- """A macro server object that besides the name and reference to the
- macro server base object has:
-
- - _id : the internal identifier"""
-
- def __init__(self, **kwargs):
- SardanaObjectID.__init__(self, id=kwargs.pop('id'))
- MSBaseObject.__init__(self, **kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = MSBaseObject.serialize(self, *args, **kwargs)
- kwargs = SardanaObjectID.serialize(self, *args, **kwargs)
- return kwargs
diff --git a/src/sardana/macroserver/mscontainer.py b/src/sardana/macroserver/mscontainer.py
deleted file mode 100644
index 58ca2090..00000000
--- a/src/sardana/macroserver/mscontainer.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Macro Server libray. It defines the base
-classes for a macro server container element"""
-
-__all__ = ["MSContainer"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanacontainer import SardanaContainer
-
-
-class MSContainer(SardanaContainer):
- pass
diff --git a/src/sardana/macroserver/msdoor.py b/src/sardana/macroserver/msdoor.py
deleted file mode 100644
index fa734aa7..00000000
--- a/src/sardana/macroserver/msdoor.py
+++ /dev/null
@@ -1,390 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the macro server door"""
-
-__all__ = ["MacroProxy", "BaseInputHandler", "MSDoor"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-import collections
-
-from taurus.core.util.log import Logger
-
-from sardana import ElementType
-from sardana.sardanaevent import EventType
-
-from sardana.macroserver.msbase import MSObject
-from sardana.macroserver.msparameter import Type
-from sardana.macroserver.msexception import MacroServerException
-
-
-class MacroProxy(object):
-
- def __init__(self, door, macro_meta):
- self._door = weakref.ref(door)
- self._macro_meta = weakref.ref(macro_meta)
-
- @property
- def door(self):
- return self._door()
-
- @property
- def macro_info(self):
- return self._macro_meta()
-
- def __call__(self, *args, **kwargs):
- door = self.door
- parent_macro = door.get_running_macro()
- parent_macro.syncLog()
- executor = parent_macro.executor
- opts = dict(parent_macro=parent_macro, executor=executor)
- kwargs.update(opts)
- eargs = [self.macro_info.name]
- eargs.extend(args)
- return parent_macro.execMacro(*eargs, **kwargs)
-
-
-class MacroProxyCache(dict):
-
- def __init__(self, door):
- self._door = weakref.ref(door)
- self.rebuild()
-
- @property
- def door(self):
- return self._door()
-
- def rebuild(self):
- self.clear()
- door = self.door
- macros = self.door.get_macros()
- for macro_name, macro_meta in macros.items():
- self[macro_name] = MacroProxy(door, macro_meta)
-
-
-class BaseInputHandler(object):
-
- def __init__(self):
- try:
- self._input = raw_input
- except NameError:
- self._input = input
-
- def input(self, input_data=None):
- if input_data is None:
- input_data = {}
- prompt = input_data.get('prompt')
- if prompt is None:
- return self._input()
- else:
- return self._input(prompt)
-
-
-class MSDoor(MSObject):
- """Sardana door object"""
-
- def __init__(self, **kwargs):
- self._state = None
- self._status = None
- self._result = None
- self._macro_status = None
- self._record_data = None
- self._macro_proxy_cache = None
- self._input_handler = BaseInputHandler()
- self._pylab_handler = None
- kwargs['elem_type'] = ElementType.Door
- MSObject.__init__(self, **kwargs)
-
- def get_macro_executor(self):
- return self.macro_server.macro_manager.getMacroExecutor(self)
-
- macro_executor = property(get_macro_executor)
-
- def get_running_macro(self):
- return self.macro_executor.getRunningMacro()
-
- running_macro = property(get_running_macro)
-
- def get_macro_data(self):
- macro = self.running_macro
- if macro is None:
- raise MacroServerException("No macro has run so far " + \
- "or the macro data was not preserved.")
- data = macro.data
- return data
-
- def set_pylab_handler(self, ph):
- self._pylab_handler = ph
-
- def get_pylab_handler(self):
- return self._pylab_handler
-
- pylab_handler = property(get_pylab_handler, set_pylab_handler)
-
- def get_pylab(self):
- ph = self.pylab_handler
- if ph is None:
- import matplotlib.pylab
- ph = matplotlib.pylab
- return ph
-
- pylab = property(get_pylab)
-
- def set_pyplot_handler(self, ph):
- self._pyplot_handler = ph
-
- def get_pyplot_handler(self):
- return self._pyplot_handler
-
- pyplot_handler = property(get_pyplot_handler, set_pyplot_handler)
-
- def get_pyplot(self):
- ph = self.pyplot_handler
- if ph is None:
- import matplotlib.pyplot
- ph = matplotlib.pyplot
- return ph
-
- pyplot = property(get_pyplot)
-
- def set_input_handler(self, ih):
- self._input_handler = ih
-
- def get_input_handler(self):
- return self._input_handler
-
- input_handler = property(get_input_handler, set_input_handler)
-
- def append_prompt(self, prompt, msg):
- if '?' in prompt:
- prefix, suffix = prompt.rsplit('?', 1)
- if not prefix.endswith(' '):
- prefix += ' '
- prompt = prefix + msg + '?' + suffix
- else:
- prompt += msg + ' '
- return prompt
-
- def input(self, msg, *args, **kwargs):
- kwargs['data_type'] = kwargs.get('data_type', Type.String)
- kwargs['allow_multiple'] = kwargs.get('allow_multiple', False)
-
- if args:
- msg = msg % args
- if not msg.endswith(' '):
- msg += ' '
- dv = kwargs.get('default_value')
- if dv is not None:
- dv = '[' + str(dv) + ']'
- msg = self.append_prompt(msg, dv)
-
- macro = kwargs.pop('macro', self.macro_executor.getRunningMacro())
- if macro is None:
- macro = self
-
- input_data = dict(prompt=msg, type='input')
- input_data.update(kwargs)
- data_type = kwargs['data_type']
- is_seq = not isinstance(data_type, (str, unicode)) and \
- isinstance(data_type, collections.Sequence)
- if is_seq:
- handle = self._handle_seq_input
- else:
- handle = self._handle_type_input
-
- return handle(macro, input_data, data_type)
-
- def _handle_seq_input(self, obj, input_data, data_type):
- valid = False
- allow_multiple = input_data['allow_multiple']
- while not valid:
- result = self.input_handler.input(input_data)
- if allow_multiple:
- r, dt = set(result), set(data_type)
- if r.issubset(dt):
- break
- else:
- if result in data_type:
- break
- obj.warning("Please give a valid option")
- return result
-
- def _handle_type_input(self, obj, input_data, data_type):
- type_obj = self.type_manager.getTypeObj(data_type)
-
- valid = False
- while not valid:
- result = self.input_handler.input(input_data)
- try:
- result_type = type_obj.getObj(result)
- if result_type is None:
- raise Exception("Must give a value")
- valid = True
- return result_type
- except:
- dtype = str(data_type).lower()
- obj.warning("Please give a valid %s.", dtype)
-
- def get_report_logger(self):
- return self.macro_server.report_logger
-
- report_logger = property(get_report_logger)
-
- def report(self, msg, *args, **kwargs):
- """
- Record a log message in the sardana report (if enabled) with default
- level **INFO**. The msg is the message format string, and the args are
- the arguments which are merged into msg using the string formatting
- operator. (Note that this means that you can use keywords in the
- format string, together with a single dictionary argument.)
-
- *kwargs* are the same as :meth:`logging.Logger.debug` plus an optional
- level kwargs which has default value **INFO**
-
- Example::
-
- self.report("this is an official report!")
-
- :param msg: the message to be recorded
- :type msg: :obj:`str`
- :param args: list of arguments
- :param kwargs: list of keyword arguments"""
- return self.macro_server.report(msg, *args, **kwargs)
-
- def get_state(self):
- return self._state
-
- def set_state(self, state, propagate=1):
- self._state = state
- self.fire_event(EventType("state", priority=propagate), state)
-
- state = property(get_state, set_state)
-
- def get_status(self):
- return self._status
-
- def set_status(self, status, propagate=1):
- self._status = status
- self.fire_event(EventType("status", priority=propagate), status)
-
- status = property(get_status, set_status)
-
- def get_result(self):
- return self._result
-
- def set_result(self, result, propagate=1):
- self._result = result
- self.fire_event(EventType("result", priority=propagate), result)
-
- result = property(get_result, set_result)
-
- def get_macro_status(self):
- return self._macro_status
-
- def set_macro_status(self, macro_status, propagate=1):
- self._macro_status = macro_status
- self.fire_event(EventType("macrostatus", priority=propagate),
- macro_status)
-
- result = property(get_result, set_result)
-
- def get_record_data(self):
- return self._record_data
-
- def set_record_data(self, record_data, codec=None, propagate=1):
- self._record_data = record_data
- self.fire_event(EventType("recorddata", priority=propagate),
- (codec, record_data))
-
- record_data = property(get_record_data, set_record_data)
-
- def get_env(self, key=None, macro_name=None):
- """Gets the environment with the context for this door matching the
- given parameters:
-
- - macro_name defines the context where to look for the environment. If
- None, the global environment is used. If macro name is given the
- environment in the context of that macro is given
- - If key is None it returns the complete environment, otherwise
- key must be a string containing the environment variable name.
-
- :param key:
- environment variable name [default: None, meaning all environment]
- :type key: str
- :param macro_name:
- local context for a given macro [default: None, meaning no macro
- context is used]
- :type macro_name: str
-
- :raises: UnknownEnv"""
- return self.macro_server.environment_manager.getAllDoorEnv(self.name)
-
- def set_env(self, key, value):
- return self.macro_server.set_env(key, value)
-
- def _build_macro_proxy_cache(self):
- self._macro_proxy_cache = MacroProxyCache(self)
-
- def get_macro_proxies(self):
- if self._macro_proxy_cache is None:
- self._macro_proxy_cache = MacroProxyCache(self)
- return self._macro_proxy_cache
-
- def run_macro(self, par_str_list, asynch=False):
- if isinstance(par_str_list, (str, unicode)):
- par_str_list = par_str_list,
-
- if not hasattr(self, "Output"):
- import sys
- import logging
- Logger.addLevelName(15, "OUTPUT")
-
- def output(loggable, msg, *args, **kw):
- loggable.getLogObj().log(Logger.Output, msg, *args, **kw)
- Logger.output = output
-
- Logger.disableLogOutput()
- Logger.setLogLevel(Logger.Output)
- #filter = taurus.core.util.LogFilter(level=Logger.Output)
- formatter = logging.Formatter(fmt="%(message)s")
- Logger.setLogFormat("%(message)s")
- handler = logging.StreamHandler(stream=sys.stdout)
- #handler.addFilter(filter)
- Logger.addRootLogHandler(handler)
- #handler.setFormatter(formatter)
- #logger.addHandler(handler)
- #logger.addFilter(filter)
- self.__logging_info = handler, filter, formatter
-
- # result of a macro
- #Logger.addLevelName(18, "RESULT")
-
- return self.macro_executor.run(par_str_list, asynch=asynch)
-
- def __getattr__(self, name):
- """Get methods from macro server"""
- return getattr(self.macro_server, name)
diff --git a/src/sardana/macroserver/msenvmanager.py b/src/sardana/macroserver/msenvmanager.py
deleted file mode 100644
index 9ebbe41f..00000000
--- a/src/sardana/macroserver/msenvmanager.py
+++ /dev/null
@@ -1,486 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer environment
-manager"""
-
-__all__ = ["EnvironmentManager"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import shelve
-import operator
-
-from taurus.core.util.containers import CaselessDict
-
-from sardana.macroserver.msmanager import MacroServerManager
-from sardana.macroserver.msexception import UnknownEnv
-
-
-class EnvironmentManager(MacroServerManager):
- """The MacroServer environment manager class. It is designed to be a
- singleton for the entire application.
- """
-
- def __init__(self, macro_server, environment_db=None):
- MacroServerManager.__init__(self, macro_server)
- if environment_db is not None:
- self.setEnvironmentDb(environment_db)
-
- def reInit(self):
- """(Re)initializes the manager"""
- if self.is_initialized():
- return
-
- # a string containing the absolute filename containing the environment
- self._env_name = None
-
- # the full enviroment (a shelf for now - can be accessed as a dict)
- self._env = None
-
- # cache environment for keys that start with door name
- # dict<string, dict<string, value> > where:
- # - key: door name
- # - value: dict where:
- # - key: environment name
- # - value: environment value
- self._door_env = None
-
- # cache environment for keys that start with macro name
- # dict<string, dict<string, value> > where:
- # - key: macro name
- # - value: dict where:
- # - key: environment name
- # - value: environment value
- self._macro_env = None
-
- # cache environment for global keys
- # dict<string, value> where:
- # - key: environment name
- # - value: environment value
- self._global_env = None
-
- self._initEnv()
-
- MacroServerManager.reInit(self)
-
- def cleanUp(self):
- if self.is_cleaned():
- return
-
- self._clearEnv()
-
- MacroServerManager.cleanUp(self)
-
- def _initEnv(self):
- self._macro_env, self._global_env = {}, {}
- self._door_env = CaselessDict()
-
- def _clearEnv(self):
- self._env = self._macro_env = self._global_env = self._door_env = None
-
- def setEnvironmentDb(self, f_name):
- """Sets up a new environment from a file"""
- self._initEnv()
- f_name = os.path.abspath(f_name)
- self._env_name = f_name
- dir_name = os.path.dirname(f_name)
- if not os.path.isdir(dir_name):
- try:
- self.info("Creating environment directory: %s" % dir_name)
- os.makedirs(dir_name)
- except OSError, ose:
- self.error("Creating environment: %s" % ose.strerror)
- self.debug("Details:", exc_info=1)
- raise ose
- try:
- self._env = shelve.open(f_name, flag='c', protocol=0,
- writeback=False)
- except:
- self.error("Failed to create/access environment in %s", f_name)
- self.debug("Details:", exc_info=1)
- raise
-
- self.info("Environment is being stored in %s", f_name)
-
- # fill the three environment caches
- try:
- self._fillEnvironmentCaches(self._env)
- except:
- self.error("Failed to fill local enviroment cache")
- self.debug("Details:", exc_info=1)
-
- def _fillEnvironmentCaches(self, env):
- # fill the three environment caches
- env_dict = self._global_env
- for k, v in env.items():
- k_parts = k.split('.', 1)
- key = k_parts[0]
-
- # door or macro property
- if len(k_parts) == 2:
- obj_name, simple_key_name = k_parts
- if obj_name.count('/') == 2:
- class_dict = self._door_env
- else:
- class_dict = self._macro_env
- obj_dict = class_dict.get(obj_name, None)
- if obj_dict is None:
- class_dict[obj_name] = obj_dict = {}
- obj_dict[simple_key_name] = v
- else:
- env_dict[key] = v
-
- def hasEnv(self, key, macro_name=None, door_name=None):
- #<door>.<macro>.<property name> (highest priority)
- if macro_name and door_name:
- has = self._hasDoorMacroPropertyEnv((door_name, macro_name, key))
- if has:
- return True
-
- # <macro>.<property name>
- if macro_name:
- has = self._hasMacroPropertyEnv((macro_name, key))
- if has:
- return True
-
- # <door>.<property name>
- if door_name:
- has = self._hasDoorPropertyEnv((door_name, key))
- if has:
- return True
-
- # <property name> (less priority)
- return self._hasEnv(key)
-
- def _getDoorMacroPropertyEnv(self, prop):
- """Returns the property value for a property which must have the
- format <door name>.<macro name>.<property name>"""
- if isinstance(prop, str):
- door_name, macro_name_key = prop.split('.', 1)
- else:
- door_name, macro_name_key = prop[0], '.'.join(prop[1:])
- door_props = self._door_env.get(door_name)
- if door_props is None:
- return None
- return door_props.get(macro_name_key)
-
- def _hasDoorMacroPropertyEnv(self, prop):
- """Determines if the environment contains a property with the format
- <door name>.<macro name>.<property name>"""
- return not self._getDoorMacroPropertyEnv() is None
-
- def _getMacroPropertyEnv(self, prop):
- """Returns the property value for a property which must have the
- format <macro name>.<property name>"""
- if isinstance(prop, str):
- macro_name, key = prop.split('.')
- else:
- macro_name, key = prop
- macro_props = self._macro_env.get(macro_name)
- if macro_props is None:
- return None
- return macro_props.get(key)
-
- def _hasMacroPropertyEnv(self, prop):
- """Determines if the environment contains a property with the format
- <macro name>.<property name>"""
- return not self._getMacroPropertyEnv() is None
-
- def _getDoorPropertyEnv(self, prop):
- """Returns the property value for a property which must have the
- format <door name>.<property name>"""
- if isinstance(prop, str):
- door_name, key = prop.split('.')
- else:
- door_name, key = prop
- door_props = self._door_env.get(door_name)
- if door_props is None:
- return None
- return door_props.get(key)
-
- def _hasDoorPropertyEnv(self, prop):
- """Determines if the environment contains a property with the format
- <door name>.<property name>"""
- return not self._getDoorPropertyEnv() is None
-
- def _getEnv(self, prop):
- """Returns the property value for a property which must have the
- format <property name>"""
- return self._global_env.get(prop)
-
- def _hasEnv(self, prop):
- """Determines if the environment contains a property with the format
- <property name>"""
- return not self._getEnv(prop) is None
-
- def getEnv(self, key=None, door_name=None, macro_name=None):
- """Gets the environment matching the given parameters:
- - If key is None it returns the complete environment for the given
- macro and/or door. If both are None the the complete environment is
- returned
- @param[in]"""
- if key is None:
- return self._getAllEnv(door_name=door_name, macro_name=macro_name)
-
- #<door>.<macro>.<property name> (highest priority)
- if macro_name and door_name:
- v = self._getDoorMacroPropertyEnv((door_name, macro_name, key))
- if not v is None:
- return v
-
- # <macro>.<property name>
- if macro_name:
- v = self._getMacroPropertyEnv((macro_name, key))
- if not v is None:
- return v
-
- # <door>.<property name>
- if door_name:
- v = self._getDoorPropertyEnv((door_name, key))
- if not v is None:
- return v
-
- # <property name> (less priority)
- v = self._getEnv(key)
- if v is None:
- raise UnknownEnv("Unknown environment %s" % key)
- return v
-
- def _getAllEnv(self, door_name=None, macro_name=None):
- """Gets the complete environment for the given macro and/or door. If
- both are None the the complete environment is returned"""
- if macro_name is None and door_name is None:
- return dict(self._env)
- elif not door_name is None and macro_name is None:
- return self.getDoorEnv(door_name)
- elif door_name and macro_name:
- return self.getAllDoorMacroEnv(door_name, macro_name)
- elif not macro_name is None and door_name is None:
- return self._macro_env.get(macro_name, {})
-
- def getAllDoorEnv(self, door_name):
- """Gets the complete environment for the given door."""
- door_name = door_name.lower()
-
- # first go through the global environment
- ret = self._global_env.copy()
-
- # Then go through the door specific environment
- ret.update(self._door_env.get(door_name, {}))
- return ret
-
- def getAllDoorMacroEnv(self, door_name, macro_name):
- """Gets the complete environment for the given macro in a specific
- door.
-
- :param door_name: the door name (case insensitive)
- :type door_name: str
- :param macro_name: the macro name
- :type macro_name: str
-
- :return: a dictionary with the resulting environment"""
- door_name = door_name.lower()
-
- # first go through the global environment
- ret = self._global_env.copy()
-
- # get the specific door environment
- d_env = self._door_env.get(door_name, {})
-
- # get the specific macro environment
- m_env = self._macro_env.get(macro_name, {})
-
- # put the doors global environment
- for k, v in d_env.iteritems():
- if k.count('.') == 0:
- ret[k] = v
-
- # put the macro environment
- ret.update(m_env)
-
- # put the door and macro specific environment
- for k, v in d_env.iteritems():
- if k.count('.') > 0:
- m_name, key = k.split('.', 1)
- if m_name is macro_name:
- ret[key] = v
-
- return ret
-
- def getDoorMacroEnv(self, door_name, macro_name, keys=None):
- """Gets the environment for the given macro in a specific door for the
- given key(s)
-
- :param door_name: the door name (case insensitive)
- :param macro_name: the macro name (case sensitive)
- :param key: the keys to be retrieved. If None (default) the complete
- environment is returned (same as getAllDoorMacroEnv)
- key can be a string or a sequence<string>.
- keys must NOT contain '.' characters
-
- :return: a dictionary with the resulting environment"""
- if keys is None:
- return self.getAllDoorMacroEnv(door_name, macro_name)
-
- if isinstance(keys, (str, unicode)):
- keys = (keys,)
-
- door_name = door_name.lower()
-
- g_env = self._global_env
- # get the specific door environment
- d_env = self._door_env.get(door_name, {})
- # get the specific macro environment
- m_env = self._macro_env.get(macro_name, {})
-
- # first go through the global environment
- ret = {}
- for k in keys:
- comp_key = '%s.%s' % (macro_name, k)
- if comp_key in d_env:
- ret[k] = d_env[comp_key]
- elif k in m_env:
- ret[k] = m_env[k]
- elif k in d_env:
- ret[k] = d_env[k]
- elif k in g_env:
- ret[k] = g_env[k]
-
- return ret
-
- def _pairwise(self, iterable):
- itnext = iter(iterable).next
- while True:
- yield itnext(), itnext()
-
- def _dictFromSequence(self, seq):
- return dict(self._pairwise(seq))
-
- def _encode(self, d):
- ret = {}
- for k, v in d.iteritems():
- if isinstance(v, (str, unicode)):
- try:
- v = eval(v)
- except:
- v_lower = v.lower()
- try:
- v = eval(v_lower.capitalize())
- except:
- pass
- ret[k] = v
- return ret
-
- def _getCacheForKey(self, key):
- """Returns the cache dictionary object for the given key
-
- :param key: a string representing the key
- :return: a tuple pair. The first element is the dictionary and the
- second is the modified key that is applicable to the
- dictionary"""
- d = None
- key_parts = key.split('.')
- # global property
- if len(key_parts) == 1:
- d = self._global_env
- # macro property
- elif len(key_parts) == 2 and key_parts[0].count('/') != 2:
- macro_name, key = key_parts
- d = self._macro_env.get(macro_name)
- if d is None:
- self._macro_env[macro_name] = d = {}
- # door property
- else:
- door_name, key = key.split('.', 1)
- d = self._door_env.get(door_name)
- if d is None:
- self._door_env[door_name] = d = {}
- return d, key
-
- def _setOneEnv(self, key, value):
- self._env[key] = value
- self._env.sync()
- d, key = self._getCacheForKey(key)
- d[key] = value
-
- def _unsetOneEnv(self, key):
- if not key in self._env:
- raise UnknownEnv("Unknown environment %s" % key)
- del self._env[key]
- self._env.sync()
- d, key = self._getCacheForKey(key)
- if key in d:
- del d[key]
-
- def _unsetEnv(self, env_names):
- for key in env_names:
- self._unsetOneEnv(key)
-
- def setEnvObj(self, obj):
- """Sets the environment for the given object. If object is a sequence
- then each pair of elements k, v is added as env[k] = v.
- If object is a map then the environmnent is updated.
- Other object types are not supported
- The elements which are strings are 'python evaluated'
-
- @throws TypeError is obj is not a sequence or a map
-
- @param[in] obj object to be added to the environment
-
- @return a dict representing the added environment"""
-
- if operator.isSequenceType(obj) and \
- not isinstance(obj, (str, unicode)):
- obj = self._dictFromSequence(obj)
- elif not operator.isMappingType(obj):
- raise TypeError("obj parameter must be a sequence or a map")
-
- obj = self._encode(obj)
- for k, v in obj.iteritems():
- self._setOneEnv(k, v)
- return obj
-
- def setEnv(self, key, value):
- """Sets the environment key to the new value and stores it
- persistently.
-
- :param key: the key for the environment
- :param value: the value for the environment
-
- :return: a tuple with the key and value objects stored"""
- ret = self.setEnvObj((key, value))
- return key, ret[key]
-
- def unsetEnv(self, key):
- """Unsets the environment for the given key.
-
- :param key: the key for the environment to be unset
- :return: the sequence of keys which have been removed"""
- if isinstance(key, (str, unicode)):
- key = (key,)
- self._unsetEnv(key)
- return key
diff --git a/src/sardana/macroserver/msexception.py b/src/sardana/macroserver/msexception.py
deleted file mode 100644
index 1eca2109..00000000
--- a/src/sardana/macroserver/msexception.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer environment
-manager"""
-
-__all__ = ["MacroServerException", "MacroServerExceptionList", "MissingEnv",
- "UnknownEnv", "UnknownMacro", "UnknownMacroLibrary",
- "MacroWrongParameterType", "LibraryError",
- "InterruptException", "StopException", "AbortException",
- "InputCancelled"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.taurus.core.tango.sardana.pool import InterruptException, \
- StopException, AbortException
-
-from sardana.sardanaexception import SardanaException, SardanaExceptionList, \
- UnknownCode, UnknownLibrary, LibraryError
-
-
-class MacroServerException(SardanaException):
- pass
-
-
-class MacroServerExceptionList(SardanaExceptionList):
- pass
-
-
-class MissingEnv(MacroServerException):
- pass
-
-
-class UnknownEnv(MacroServerException):
- pass
-
-
-class UnknownMacro(UnknownCode):
- pass
-
-
-class UnknownMacroLibrary(UnknownLibrary):
- pass
-
-
-class MacroWrongParameterType(MacroServerException):
- pass
-
-
-class InputCancelled(MacroServerException):
- pass
diff --git a/src/sardana/macroserver/msmacromanager.py b/src/sardana/macroserver/msmacromanager.py
deleted file mode 100644
index 677fb80e..00000000
--- a/src/sardana/macroserver/msmacromanager.py
+++ /dev/null
@@ -1,1328 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer macro
-manager"""
-
-__all__ = ["MacroManager", "MacroExecutor", "is_macro"]
-
-__docformat__ = 'restructuredtext'
-
-import re
-import os
-import sys
-import copy
-import inspect
-import functools
-import traceback
-
-from lxml import etree
-
-from PyTango import DevFailed
-
-from taurus.core.util.log import Logger
-from taurus.core.util.codecs import CodecFactory
-
-from sardana.sardanadefs import ElementType
-from sardana.sardanamodulemanager import ModuleManager
-from sardana.sardanaexception import format_exception_only_str
-from sardana.sardanautils import is_pure_str, is_non_str_seq
-
-from sardana.macroserver.msmanager import MacroServerManager
-from sardana.macroserver.msmetamacro import MACRO_TEMPLATE, MacroLibrary, \
- MacroClass, MacroFunction
-from sardana.macroserver.msparameter import ParamDecoder
-from sardana.macroserver.macro import Macro, MacroFunc
-from sardana.macroserver.msexception import UnknownMacroLibrary, \
- LibraryError, UnknownMacro, MissingEnv, AbortException, StopException, \
- MacroServerException, UnknownEnv
-
-_BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-
-
-def islambda(f):
- """inspect doesn't come with islambda so I create one :-P"""
- return inspect.isfunction(f) and \
- f.__name__ == (lambda: True).__name__
-
-def is_macro(macro, abs_file=None, logger=None):
- """Helper function to determine if a certain python object is a valid
- macro"""
- if inspect.isclass(macro):
- if not issubclass(macro, Macro):
- return False
- # if it is a class defined in some other module forget it to
- # avoid replicating the same macro in different macro files
- try:
- if inspect.getabsfile(macro) != abs_file:
- return False
- except TypeError:
- return False
- elif callable(macro) and not islambda(macro):
- # if it is a function defined in some other module forget it to
- # avoid replicating the same macro in different macro files
- try:
- if inspect.getabsfile(macro) != abs_file:
- return False
- except TypeError:
- return False
-
- if not hasattr(macro, 'macro_data'):
- return False
-
- args, varargs, keywords, _ = inspect.getargspec(macro)
- if len(args) == 0:
- if logger:
- logger.debug("Could not add macro %s: Needs at least one "
- "parameter (usually called 'self')",
- macro.func_name)
- return False
- if keywords is not None:
- if logger:
- logger.debug("Could not add macro %s: Unsupported keyword "
- "parameters '%s'", macro.func_name, keywords)
- return False
- if varargs and len(args) > 1:
- if logger:
- logger.debug("Could not add macro %s: Unsupported giving "
- "named parameters '%s' and varargs '%s'",
- macro.func_name, args, varargs)
- return False
- else:
- return False
- return True
-
-
-class MacroManager(MacroServerManager):
-
- DEFAULT_MACRO_DIRECTORIES = os.path.join(_BASE_DIR, 'macros'),
-
- def __init__(self, macro_server, macro_path=None):
- MacroServerManager.__init__(self, macro_server)
- if macro_path is not None:
- self.setMacroPath(macro_path)
-
- def reInit(self):
- if self.is_initialized():
- return
-
- # dict<str, MacroLibrary>
- # key - module name (without path and without extension)
- # value - MacroLibrary object representing the module
- self._modules = {}
-
- # dict<str, <MacroClass>
- # key - macro name
- # value - MacroClass object representing the macro
- self._macro_dict = {}
-
- # list<str>
- # elements are absolute paths
- self._macro_path = []
-
- # dict<Door, <MacroExecutor>
- # key - door
- # value - MacroExecutor object for the door
- self._macro_executors = {}
-
- MacroServerManager.reInit(self)
-
- def cleanUp(self):
- if self.is_cleaned():
- return
-
- #if self._modules:
- # ModuleManager().unloadModules(self._modules.keys())
-
- self._macro_path = None
- self._macro_dict = None
- self._modules = None
-
- MacroServerManager.cleanUp(self)
-
- def setMacroPath(self, macro_path):
- """Registers a new list of macro directories in this manager.
- Warning: as a consequence all the macro modules will be reloaded.
- This means that if any reference to an old macro object was kept it will
- refer to an old module (which could possibly generate problems of type
- class A != class A)."""
- p = []
- for item in macro_path:
- p.extend(item.split(":"))
-
- # filter empty and commented paths
- p = [ i for i in p if i and not i.startswith("#") ]
-
- # add basic macro directories
- for macro_dir in self.DEFAULT_MACRO_DIRECTORIES:
- if not macro_dir in p:
- p.append(macro_dir)
-
- self._macro_path = p
-
- macro_file_names = self._findMacroLibNames()
- for mod_name in macro_file_names:
- try:
- self.reloadMacroLib(mod_name)
- except:
- pass
-
- def getMacroPath(self):
- return self._macro_path
-
- def _findMacroLibName(self, lib_name, path=None):
- path = path or self.getMacroPath()
- f_name = lib_name
- if not f_name.endswith('.py'):
- f_name += '.py'
- for p in path:
- try:
- elems = os.listdir(p)
- if f_name in elems:
- return os.path.abspath(os.path.join(p, f_name))
- except:
- self.debug("'%s' is not a valid path" % p)
- return None
-
- def _findMacroLibNames(self, path=None):
- path = path or self.getMacroPath()
- ret = {}
- for p in reversed(path):
- try:
- for f in os.listdir(p):
- name, ext = os.path.splitext(f)
- if name.startswith("_"):
- continue
- if ext.endswith('py'):
- ret[name] = os.path.abspath(os.path.join(p, f))
- except:
- self.debug("'%s' is not a valid path" % p)
- return ret
-
- def _fromNameToFileName(self, lib_name, path=None):
- path = path or self.getMacroPath()[0]
- f_name = lib_name
- if not f_name.endswith('.py'):
- f_name += '.py'
-
- if os.path.isabs(f_name):
- path, _ = os.path.split(f_name)
- if not path in self.getMacroPath():
- raise Exception("'%s' is not part of the MacroPath" % path)
- else:
- f_name = os.path.join(path, f_name)
- return f_name
-
- def getOrCreateMacroLib(self, lib_name, macro_name=None):
- """Gets the exiting macro lib or creates a new macro lib file. If
- name is not None, a macro template code for the given macro name is
- appended to the end of the file.
-
- :param lib_name:
- module name, python file name, or full file name (with path)
- :type lib_name: str
- :param macro_name:
- an optional macro name. If given a macro template code is appended
- to the end of the file (default is None meaning no macro code is
- added)
- :type macro_name: str
-
- :return:
- a sequence with three items: full_filename, code, line number is 0
- if no macro is created or n representing the first line of code for
- the given macro name.
- :rtype: seq<str, str, int>"""
- # if only given the module name
- try:
- macro_lib = self.getMacroLib(lib_name)
- except UnknownMacroLibrary:
- macro_lib = None
-
- if macro_name is None:
- line_nb = 0
- if macro_lib is None:
- f_name, code = self.createMacroLib(lib_name), ''
- else:
- f_name = macro_lib.file_path
- f = file(f_name)
- code = f.read()
- f.close()
- else:
- # if given macro name
- if macro_lib is None:
- f_name, code, line_nb = self.createMacro(lib_name, macro_name)
- else:
- macro = macro_lib.get_macro(macro_name)
- if macro is None:
- f_name, code, line_nb = self.createMacro(lib_name, macro_name)
- else:
- _, line_nb = macro.code
- f_name = macro.file_path
- f = file(f_name)
- code = f.read()
- f.close()
-
- return [ f_name, code, line_nb ]
-
- def setMacroLib(self, lib_name, code, auto_reload=True):
- f_name = self._fromNameToFileName(lib_name)
- f = open(f_name, 'w')
- f.write(code)
- f.flush()
- f.close()
- _, name = os.path.split(f_name)
- mod, _ = os.path.splitext(name)
- if auto_reload:
- self.reloadMacroLib(mod)
- return mod
-
- def createMacroLib(self, lib_name, path=None):
- """Creates a new empty macro library (python module)"""
- f_name = self._fromNameToFileName(lib_name, path)
-
- if os.path.exists(f_name):
- raise Exception("Unable to create macro lib: '%s' already exists" % f_name)
-
- f = open(f_name, 'w')
- f.close()
- return f_name
-
- def createMacro(self, lib_name, macro_name):
- f_name = self._fromNameToFileName(lib_name)
-
- create = not os.path.exists(f_name)
-
- template = ''
- if create:
- template += 'from sardana.macroserver.macro import Macro, macro, Type\n\n'
- line_nb = 4
- else:
- template += '\n'
- t = open(f_name, 'rU')
- line_nb = -1
- for line_nb, _ in enumerate(t): pass
- line_nb += 3
- t.close()
-
- f = open(f_name, 'a+')
- f_templ = None
- try:
- dir_name = os.path.realpath(__file__)
- dir_name = os.path.dirname(dir_name)
- template_fname = 'macro_template.txt'
- template_fname = os.path.join(dir_name, template_fname)
- f_templ = open(template_fname, 'r')
- template += f_templ.read()
- f_templ.close()
- except:
- self.debug("Failed to open template macro file. Using simplified template")
- template += MACRO_TEMPLATE
- if f_templ:
- f_templ.close()
-
- template = template.replace('@macro_name@', macro_name)
- try:
- f.write(template)
- f.flush()
- f.seek(0)
- code = f.read()
- finally:
- f.close()
- return f_name, code, line_nb
-
- def reloadMacro(self, macro_name, path=None):
- """Reloads the module corresponding to the given macro name
-
- :raises: MacroServerExceptionList in case the macro is unknown or the
- reload process is not successful
-
- :param macro_name: macro name
- :param path: a list of absolute path to search for libraries
- (optional, default=None, means the current MacroPath
- will be used)"""
- self.reloadMacros([macro_name], path=path)
-
- def reloadMacros(self, macro_names, path=None):
- """Reloads the modules corresponding to the given macro names
-
- :raises: MacroServerExceptionList in case the macro(s) are unknown or the
- reload process is not successful
-
- :param macro_names: a list of macro names
- :param path: a list of absolute path to search for libraries (optional,
- default=None, means the current MacroPath will be used)"""
- module_names = []
- for macro_name in macro_names:
- module_name = self.getMacro(macro_name).module_name
- module_names.append(module_name)
- self.reloadMacroLibs(module_names, path=path)
-
- def reloadMacroLibs(self, module_names, path=None):
- """Reloads the given lib(=module) names
-
- :raises: MacroServerExceptionList in case the reload process is not
- successful for at least one library
-
- :param module_names: a list of module names
- :param path: a list of absolute path to search for libraries
- (optional, default=None, means the current MacroPath
- will be used)"""
- ret = []
- for module_name in module_names:
- m = self.reloadMacroLib(module_name, path=path)
- if m: ret.append(m)
- return ret
-
- def reloadLib(self, module_name, path=None):
- """Reloads the given library(=module) names.
-
- :raises:
- ImportError in case the reload process is not successful
- LibraryError if trying to reload a macro library
-
- :param module_name: module name
- :param path:
- a list of absolute path to search for libraries [default: None,
- meaning search in MacroPath. If not found, search for a built-in,
- frozen or special module and continue search in sys.path. ]
- :return: the reloaded python module object"""
-
- if module_name in self._modules:
- raise LibraryError("Cannot use simple reload to reload a Macro Library")
-
- mod_manager = ModuleManager()
- retry = path is None
- try:
- if retry:
- path = self.getMacroPath()
- if path:
- path = copy.copy(path)
- path.reverse()
- return mod_manager.reloadModule(module_name, path)
- except ImportError:
- if retry:
- return mod_manager.reloadModule(module_name, path=None)
- else:
- raise
-
- def reloadMacroLib(self, module_name, path=None):
- """Reloads the given library(=module) names.
-
- :raises:
- LibraryError in case the reload process is not successful
-
- :param module_name: macro library name (=python module name)
- :param path:
- a list of absolute path to search for libraries [default: None,
- means the current MacroPath will be used]
- :return: the MacroLibrary object for the reloaded macro library"""
- path = path or self.getMacroPath()
- # reverse the path order:
- # more priority elements last. This way if there are repeated elements
- # they first ones (lower priority) will be overwritten by the last ones
- if path:
- path = copy.copy(path)
- path.reverse()
-
- # if there was previous Macro Library info remove it
- old_macro_lib = self._modules.pop(module_name, None)
- if old_macro_lib is not None:
- for macro in old_macro_lib.get_macros():
- self._macro_dict.pop(macro.name)
-
- mod_manager = ModuleManager()
- m, exc_info = None, None
- try:
- m = mod_manager.reloadModule(module_name, path)
- except:
- exc_info = sys.exc_info()
- macro_lib = None
-
- params = dict(module=m, name=module_name,
- macro_server=self.macro_server, exc_info=exc_info)
- if m is None:
- file_name = self._findMacroLibName(module_name)
- if file_name is None:
- if exc_info:
- msg = format_exception_only_str(*exc_info[:2])
- else:
- msg = "Error (re)loading macro library '%s'" % module_name
- raise LibraryError(msg, exc_info=exc_info)
- params['file_path'] = file_name
- macro_lib = MacroLibrary(**params)
- else:
- macro_lib = MacroLibrary(**params)
- abs_file = macro_lib.file_path
- _is_macro = functools.partial(is_macro, abs_file=abs_file,
- logger=self)
- for _, macro in inspect.getmembers(m, _is_macro):
- try:
- self.addMacro(macro_lib, macro)
- except:
- self.error("Error adding macro %s", macro.__name__)
- self.debug("Details:", exc_info=1)
- self._modules[module_name] = macro_lib
- return macro_lib
-
- def addMacro(self, macro_lib, macro):
- add = self.addMacroFunction
- if inspect.isclass(macro):
- add = self.addMacroClass
- return add(macro_lib, macro)
-
- def addMacroClass(self, macro_lib, klass):
- macro_name = klass.__name__
- action = (macro_lib.has_macro(macro_name) and "Updating") or "Adding"
- self.debug("%s macro class %s" % (action, macro_name))
-
- params = dict(macro_server=self.macro_server, lib=macro_lib,
- klass=klass)
- macro_class = MacroClass(**params)
- macro_lib.add_macro_class(macro_class)
- self._macro_dict[macro_name] = macro_class
-
- def addMacroFunction(self, macro_lib, func):
- macro_name = func.func_name
- action = (macro_lib.has_macro(macro_name) and "Updating") or "Adding"
- self.debug("%s macro function %s" % (action, macro_name))
-
- params = dict(macro_server=self.macro_server, lib=macro_lib,
- function=func)
- macro_function = MacroFunction(**params)
- macro_lib.add_macro_function(macro_function)
- self._macro_dict[macro_name] = macro_function
-
- def getMacroLibNames(self):
- return sorted(self._modules.keys())
-
- def getMacroLibs(self, filter=None):
- if filter is None:
- return self._modules
- expr = re.compile(filter, re.IGNORECASE)
- ret = {}
- for name, macro_lib in self._modules.iteritems():
- if expr.match(name) is None:
- continue
- ret[name] = macro_lib
- return ret
-
- def getMacros(self, filter=None):
- """Returns a :obj:`dict` containing information about macros.
-
- :param filter:
- a regular expression for macro names [default: None, meaning all
- macros]
- :type filter: str
- :return: a :obj:`dict` containing information about macros
- :rtype:
- :obj:`dict`\<:obj:`str`\, :class:`~sardana.macroserver.msmetamacro.MacroCode`\>"""
- if filter is None:
- return self._macro_dict
- expr = re.compile(filter, re.IGNORECASE)
-
- ret = {}
- for name, macro in self._macro_dict.iteritems():
- if expr.match(name) is None:
- continue
- ret[name] = macro
- return ret
-
- def getMacroClasses(self, filter=None):
- """Returns a :obj:`dict` containing information about macro classes.
-
- :param filter:
- a regular expression for macro names [default: None, meaning all
- macros]
- :type filter: str
- :return: a :obj:`dict` containing information about macro classes
- :rtype:
- :obj:`dict`\<:obj:`str`\, :class:`~sardana.macroserver.msmetamacro.MacroClass`\>"""
- macros = self.getMacros(filter=filter)
- macro_classes = {}
- for name, macro in macros.items():
- if macro.get_type() == ElementType.MacroClass:
- macro_classes[name] = macro
- return macro_classes
-
- def getMacroFunctions(self, filter=None):
- """Returns a :obj:`dict` containing information about macro functions.
-
- :param filter:
- a regular expression for macro names [default: None, meaning all
- macros]
- :type filter: str
- :return: a :obj:`dict` containing information about macro functions
- :rtype:
- :obj:`dict`\<:obj:`str`\, :class:`~sardana.macroserver.msmetamacro.MacroFunction`\>"""
- macros = self.getMacros(filter=filter)
- macro_classes = {}
- for name, macro in macros.items():
- if macro.get_type() == ElementType.MacroFunction:
- macro_classes[name] = macro
- return macro_classes
-
- def getMacroNames(self):
- return sorted(self._macro_dict.keys())
-
- def getMacro(self, macro_name):
- ret = self._macro_dict.get(macro_name)
- if ret is None:
- raise UnknownMacro("Unknown macro %s" % macro_name)
- return ret
-
- def getMacroClass(self, macro_name):
- return self.getMacro(macro_name)
-
- def getMacroFunction(self, macro_name):
- return self.getMacro(macro_name)
-
- def removeMacro(self, macro_name):
- self._macro_dict.pop(macro_name)
-
- def getMacroLib(self, name):
- if os.path.isabs(name):
- abs_file_name = name
- for lib in self._modules.values():
- if lib.file_path == abs_file_name:
- return lib
- elif name.count(os.path.extsep):
- file_name = name
- for lib in self._modules.values():
- if lib.file_name == file_name:
- return lib
- module_name = name
- ret = self._modules.get(module_name)
- if ret is None:
- raise UnknownMacroLibrary("Unknown macro library %s" % module_name)
- return ret
-
- def getMacroCode(self, macro_name):
- return self.getMacro(macro_name).code_object
-
- def getMacroClassCode(self, macro_name):
- return self.getMacroClass(macro_name).klass
-
- def getMacroFunctionCode(self, macro_name):
- return self.getMacroFunction(macro_name).function
-
- def getMacroInfo(self, macro_names, format='json'):
- if isinstance(macro_names, (str, unicode)):
- macro_names = [macro_names]
- ret = []
- json_codec = CodecFactory().getCodec(format)
- for macro_name in macro_names:
- macro_meta = self.getMacro(macro_name)
- ret.append(json_codec.encode(('', macro_meta.serialize()))[1])
- return ret
-
- def decodeMacroParameters(self, door, in_par_list):
- if len(in_par_list) == 0:
- raise RuntimeError('Macro name not specified')
- macro_name = in_par_list[0]
- macro_meta = self.getMacro(macro_name)
- out_par_list = ParamDecoder(door, macro_meta, in_par_list)
- return macro_meta, in_par_list, out_par_list
-
- def strMacroParamValues(self, par_list):
- """strMacroParamValues(list<string> par_list) -> list<string>
-
- Creates a short string representantion of the parameter values list.
- Params:
- - par_list: list of strings representing the parameter values.
- Return:
- a list containning an abreviated version of the par_list argument.
- """
- ret = []
- for p in par_list:
- param_str = str(p)
- if len(param_str) > 9:
- param_str = param_str[:9] + "..."
- ret.append(param_str)
- return ret
-
- def prepareMacro(self, macro_class, par_list, init_opts={}, prepare_opts={}):
- """Creates the macro object and calls its prepare method.
- The return value is a tuple (MacroObject, return value of prepare)
- """
- macro = self.createMacroObj(macro_class, par_list, init_opts=init_opts)
- prepare_result = self.prepareMacroObj(macro, par_list, prepare_opts=prepare_opts)
- return macro, prepare_result
-
- def createMacroObj(self, macro_class, par_list, init_opts={}):
- macro_env = macro_class.env
- macro_name = macro_class.__name__
-
- environment = init_opts.get('environment')
-
- r = []
- for env in macro_env:
- if not environment.has_env(env):
- r.append(env)
- if r:
- raise MissingEnv("The macro %s requires the following missing " \
- "environment to be defined: %s"
- % (macro_name, str(r)))
-
- macro_opts = {
- 'no_exec': True,
- 'create_thread' : True,
- 'external_prepare' : True
- }
-
- macro_opts.update(init_opts)
- macroObj = macro_class(*par_list, **macro_opts)
- return macroObj
-
- def prepareMacroObj(self, macro, par_list, prepare_opts={}):
- return macro.prepare(*par_list, **prepare_opts)
-
- def createMacroObjFromMeta(self, meta, par_list, init_opts={}):
- code = meta.code_object
- macro_env = code.env or ()
-
- environment = init_opts.get('environment')
-
- r = []
- for env in macro_env:
- if not environment.has_env(env):
- r.append(env)
- if r:
- macro_name = meta.name
- raise MissingEnv("The macro %s requires the following missing " \
- "environment to be defined: %s"
- % (macro_name, str(r)))
-
- macro_opts = dict(no_exec=True, create_thread=True,
- external_prepare=True)
-
- macro_opts.update(init_opts)
- if meta.get_type() == ElementType.MacroClass:
- macroObj = meta.macro_class(*par_list, **macro_opts)
- else:
- macro_opts['function'] = code
- macroObj = MacroFunc(*par_list, **macro_opts)
- return macroObj
-
- def getMacroExecutor(self, door):
- me = self._macro_executors.get(door)
- if me is None:
- self._macro_executors[door] = me = MacroExecutor(door)
- return me
-
-
-class MacroExecutor(Logger):
- """ """
-
- class RunSubXMLHook:
- def __init__(self, me, xml):
- self._me = me
- self._xml = xml
-
- def __call__(self):
- self._me._runXMLMacro(xml=self._xml)
-
- def __init__(self, door):
- self._door = door
- self._macro_counter = 0
-
- # dict<PoolElement, set<Macro>>
- # key PoolElement - reserved object
- # value set<Macro> macros that reserved the object
- self._reserved_objs = {}
-
- # dict<Macro, seq<PoolElement>>
- # key Macro - macro object
- # value - sequence of reserverd objects by the macro
- self._reserved_macro_objs = {}
-
- # reset the stacks
-# self._macro_stack = None
-# self._xml_stack = None
- self._macro_stack = []
- self._xml_stack = []
- self._macro_pointer = None
- self._aborted = False
- self._stopped = False
- self._paused = False
- self._last_macro_status = None
-
- name = "%s.%s" % (str(door), self.__class__.__name__)
- self._macro_status_codec = CodecFactory().getCodec('json')
- self.call__init__(Logger, name)
-
- def getDoor(self):
- return self._door
-
- door = property(getDoor)
-
- def getMacroServer(self):
- return self.door.macro_server
-
- macro_server = property(getMacroServer)
-
- @property
- def macro_manager(self):
- return self.macro_server.macro_manager
-
- def getNewMacroID(self):
- self._macro_counter -= 1
- return self._macro_counter
-
- def _preprocessParameters(self, par_str_list):
- if not par_str_list[0].lstrip().startswith('<'):
- xml_root = xml_seq = etree.Element('sequence')
- xml_macro = etree.SubElement(xml_seq, 'macro', name=par_str_list[0])
- for p in par_str_list[1:]:
- etree.SubElement(xml_macro, 'param', value=p)
- else:
- xml_root = etree.fromstring(par_str_list[0])
-
- macro_nodes = xml_root.findall('.//macro')
-
- # make sure macros exist
- self.__checkXMLSequence(macro_nodes)
-
- # fill the xml with macro id macro_line
- self.__fillXMLSequence(macro_nodes)
-
- return xml_root
-
- def __checkXMLSequence(self, macros):
- for macro in macros:
- name = macro.get('name')
- self.macro_manager.getMacro(name)
-
- def __fillXMLSequence(self, macros):
- for macro in macros:
- eid = macro.get('id')
- if eid is None:
- eid = str(self.getNewMacroID())
- macro.set('id', eid)
- name = macro.get('name')
- params = []
-
- # SEEMS THERE IS A MEMORY LEAK IN lxml.etree Element.xpath :
- # https://bugs.launchpad.net/lxml/+bug/397933
- # https://mailman-mail5.webfaction.com/pipermail/lxml/2011-October/006205.html
- # We work around it using findall:
-
- #for p in macro.xpath('param|paramrepeat'):
- # if p.tag == 'param':
- # params.append(p.get('value'))
- # else:
- # params.extend([ p2.get('value') for p2 in p.findall(".//param")])
- for p in macro.findall('*'):
- if p.tag == 'param':
- params.append(p.get('value'))
- elif p.tag == 'paramrepeat':
- params.extend([ p2.get('value') for p2 in p.findall(".//param")])
- macro.set('macro_line', "%s(%s)" % (name, ", ".join(params)))
-
- def __preprocessResult(self, result):
- """decodes the given output from a macro in order to be able to send to
- the result channel as a sequence<str>
-
- :param out: output value
-
- :return: the output as a sequence of strings
- """
- if result is None:
- return ()
- if is_non_str_seq(result):
- result = map(str, result)
- else:
- result = (str(result),)
- return result
-
- def _decodeXMLMacroParameters(self, xml_macro):
- str_params = [xml_macro.get('name')]
- for param in xml_macro.findall('.//param'):
- str_params.append(param.get('value'))
- return self._decodeMacroParameters(str_params)
-
- def _decodeMacroParameters(self, params):
- return self.macro_manager.decodeMacroParameters(self.door, params)
-
- def _prepareXMLMacro(self, xml_macro, parent_macro=None):
- macro_meta, _, params = self._decodeXMLMacroParameters(xml_macro)
- init_opts = {
- 'id' : xml_macro.get('id'),
- 'macro_line' : xml_macro.get('macro_line'),
- 'parent_macro' : parent_macro,
- }
-
- macro_obj = self._createMacroObj(macro_meta, params, init_opts)
- for macro in xml_macro.findall('macro'):
- hook = MacroExecutor.RunSubXMLHook(self, macro)
- hook_hints = macro.findall('hookPlace')
- if hook_hints is None:
- macro_obj.hooks = [ hook ]
- else:
- hook_places = [ h.text for h in hook_hints ]
- macro_obj.hooks = [ (hook, hook_places) ]
- prepare_result = self._prepareMacroObj(macro_obj, params)
- return macro_obj, prepare_result
-
- def _createMacroObj(self, macro_name_or_meta, pars, init_opts={}):
- macro_meta = macro_name_or_meta
- if isinstance(macro_meta, (str, unicode)):
- macro_meta = self.macro_manager.getMacro(macro_meta)
-
- macro_opts = {
- 'executor' : self,
- 'environment' : self.macro_server
- }
- macro_opts.update(init_opts)
- if not macro_opts.has_key('id'):
- macro_opts['id'] = str(self.getNewMacroID())
-
- macroObj = self.macro_manager.createMacroObjFromMeta(macro_meta, pars,
- init_opts=macro_opts)
-
- return macroObj
-
- def _prepareMacroObj(self, macro_obj, pars, prepare_opts={}):
- return self.macro_manager.prepareMacroObj(macro_obj, pars,
- prepare_opts=prepare_opts)
-
- def prepareMacroObj(self, macro_name_or_meta, pars, init_opts={},
- prepare_opts={}):
- """Prepare a new macro for execution
-
- :param macro_name_or_meta name: name of the macro to be prepared or
- the macro meta itself
- :param pars: list of parameter objects
- :param init_opts: keyword parameters for the macro constructor
- :param prepare_opts: keyword parameters for the macro prepare
-
- :return: a tuple of two elements: macro object, the result of preparing the macro"""
- macroObj = self._createMacroObj(macro_name_or_meta, pars, init_opts=init_opts)
- prepare_result = self._prepareMacroObj(macroObj, pars, prepare_opts=prepare_opts)
- return macroObj, prepare_result
-
- def prepareMacro(self, pars, init_opts={}, prepare_opts={}):
- """Prepare a new macro for execution
- Several different parameter formats are supported:
- 1. several parameters:
- 1.1 executor.prepareMacro('ascan', 'th', '0', '100', '10', '1.0')
- 1.2 executor.prepareMacro('ascan', 'th', 0, 100, 10, 1.0)
- 1.3 th = self.getObj('th');
- executor.prepareMacro('ascan', th, 0, 100, 10, 1.0)
- 2. a sequence of parameters:
- 2.1 executor.prepareMacro(['ascan', 'th', '0', '100', '10', '1.0')
- 2.2 executor.prepareMacro(('ascan', 'th', 0, 100, 10, 1.0))
- 2.3 th = self.getObj('th');
- executor.prepareMacro(['ascan', th, 0, 100, 10, 1.0])
- 3. a space separated string of parameters:
- executor.prepareMacro('ascan th 0 100 10 1.0')
-
- :param pars: the command parameters as explained above
- :param opts: keyword optional parameters for prepare
- :return: a tuple of two elements: macro object, the result of preparing the macro
- """
- par0 = pars[0]
- if len(pars) == 1:
- if is_pure_str(par0):
- pars = par0.split(' ')
- elif is_non_str_seq(par0):
- pars = par0
- pars = map(str, pars)
-
- macro_klass, str_pars, pars = self._decodeMacroParameters(pars)
-
- init_opts['macro_line'] = "%s(%s) -> [%s]" % (str_pars[0], ", ".join(str_pars[1:]), id)
- if not init_opts.has_key('id'):
- init_opts['id'] = str(self.getNewMacroID())
- return self.prepareMacroObj(macro_klass, pars, init_opts, prepare_opts)
-
- def getRunningMacro(self):
- return self._macro_pointer
-
- def __stopObjects(self):
- """Stops all the reserved objects in the executor"""
- for _, objs in self._reserved_macro_objs.items():
- for obj in objs:
- try:
- obj.stop()
- except AttributeError:
- pass
- except:
- self.warning("Unable to stop %s" % obj)
- self.debug("Details:", exc_info=1)
-
- def __abortObjects(self):
- """Aborts all the reserved objects in the executor"""
- for _, objs in self._reserved_macro_objs.items():
- for obj in objs:
- try:
- obj.abort()
- except AttributeError:
- pass
- except:
- self.warning("Unable to abort %s" % obj)
- self.debug("Details:", exc_info=1)
-
- def abort(self):
- self.macro_server.add_job(self._abort, None)
-
- def stop(self):
- self.macro_server.add_job(self._stop, None)
-
- def _abort(self):
- m = self.getRunningMacro()
- if m is not None:
- self._aborted = True
- m.abort()
- self.__abortObjects()
-
- def _stop(self):
- m = self.getRunningMacro()
- if m is not None:
- self._stopped = True
- m.stop()
- if m.isPaused():
- m.resume(cb=self._macroResumed)
- self.__stopObjects()
-
- def pause(self):
- self._paused = True
- m = self.getRunningMacro()
- if m is not None:
- m.pause(cb=self._macroPaused)
-
- def _macroPaused(self, m):
- """Calback that is executed when the macro has efectively paused"""
- self.sendMacroStatusPause()
- self.sendState(Macro.Pause)
-
- def resume(self):
- if not self._paused:
- return
- self._paused = False
- m = self.getRunningMacro()
- if m is not None:
- m.resume(cb=self._macroResumed)
-
- def _macroResumed(self, m):
- """Callback that is executed when the macro has effectively resumed
- execution after being paused"""
- self.sendMacroStatusResume()
- self.sendState(Macro.Running)
-
- def run(self, params, asynch=True):
- """Runs the given macro(s)
-
- :param params: (sequence<str>) can be either a sequence of <macro name> [, <macro_parameter> ]
- or a sequence with a single element which represents the xml string for a
- macro script
- :return: (lxml.etree.Element) the xml representation of the running macro
- """
- # dict<PoolElement, set<Macro>>
- # key PoolElement - reserved object
- # value set<Macro> macros that reserved the object
- self._reserved_objs = {}
-
- # dict<Macro, seq<PoolElement>>
- # key Macro - macro object
- # value - sequence of reserved objects by the macro
- self._reserved_macro_objs = {}
-
- # reset the stacks
- self._macro_stack = []
- self._xml_stack = []
- self._macro_pointer = None
- self._aborted = False
- self._stopped = False
- self._paused = False
- self._last_macro_status = None
-
- # convert given parameters into an xml
- self._xml = self._preprocessParameters(params)
-
- if asynch:
- # start the job of actually running the macro
- self.macro_server.add_job(self.__runXML, self._jobEnded)
- #return the proper xml
- return self._xml
- else:
- self.__runXML()
- #return self._macro_pointer.getResult()
-
- def _jobEnded(self, *args, **kw):
- self.debug("Job ended (stopped=%s, aborted=%s)",
- self._stopped, self._aborted)
-
- def __runXML(self):
- self.sendState(Macro.Running)
- try:
- self.__runStatelessXML()
- self.sendState(Macro.Finished)
- except AbortException:
- self.sendState(Macro.Abort)
- except Exception:
- self.sendState(Macro.Abort)
- finally:
- self._macro_stack = None
- self._xml_stack = None
-
- def __runStatelessXML(self, xml=None):
- if xml is None:
- xml = self._xml
- node = xml.tag
- if node == 'sequence':
- for xml_macro in xml.findall('macro'):
- self.__runXMLMacro(xml_macro)
- elif node == 'macro':
- self.__runXMLMacro(xml)
-
- def __runXMLMacro(self, xml):
- assert xml.tag == 'macro'
- try:
- macro_obj, _ = self._prepareXMLMacro(xml)
- except AbortException as ae:
- raise ae
- except Exception as e:
- door = self.door
- door.error("Error: %s", str(e))
- door.debug("Error details:", exc_info=1)
- raise e
-
- self._xml_stack.append(xml)
- try:
- self.runMacro(macro_obj)
- finally:
- self._xml_stack.pop()
-
- _runXMLMacro = __runXMLMacro
-
- def runMacro(self, macro_obj):
- name = macro_obj._getName()
- desc = macro_obj._getDescription()
- door = self.door
- if self._aborted:
- self.sendMacroStatusAbort()
- raise AbortException("aborted between macros (before %s)" % name)
- elif self._stopped:
- self.sendMacroStatusStop()
- raise StopException("stopped between macros (before %s)" % name)
- macro_exp, tb, result = None, None, None
- try:
- self.debug("[START] runMacro %s" % desc)
- self._macro_pointer = macro_obj
- self._macro_stack.append(macro_obj)
- for step in macro_obj.exec_():
- self.sendMacroStatus((step,))
- result = macro_obj.getResult()
- # sending result only if we are the top most macro
- if macro_obj.hasResult() and macro_obj.getParentMacro() is None:
- result_repr = self.__preprocessResult(result)
- door.debug("sending result %s", result_repr)
- self.sendResult(result_repr)
- except AbortException as ae:
- macro_exp = ae
- except StopException as se:
- macro_exp = se
- except MacroServerException as mse:
- exc_info = sys.exc_info()
- macro_exp = mse
- if not mse.traceback:
- mse.traceback = traceback.format_exc()
- except DevFailed as df:
- exc_info = sys.exc_info()
- exp_pars = {'type' : df[0].reason,
- 'msg' : df[0].desc,
- 'args' : df.args,
- 'traceback' : traceback.format_exc() }
- macro_exp = MacroServerException(exp_pars)
- except Exception, err:
- exc_info = sys.exc_info()
- exp_pars = {'type' : err.__class__.__name__,
- 'msg' : err.args[0],
- 'args' : err.args,
- 'traceback' : traceback.format_exc() }
- macro_exp = MacroServerException(exp_pars)
- finally:
- self.returnObjs(self._macro_pointer)
-
- # make sure the macro's on_abort is called and that a proper macro
- # status is sent
- if self._stopped:
- macro_obj._stopOnError()
- self.sendMacroStatusStop()
- elif self._aborted:
- macro_obj._abortOnError()
- self.sendMacroStatusAbort()
-
- # From this point on don't call any method of macro_obj which is part
- # of the mAPI (methods decorated with @mAPI) to avoid throwing an
- # AbortException if an Abort has been performed.
- if macro_exp is not None:
- if not self._stopped and not self._aborted:
- self.sendMacroStatusException(exc_info)
- self.debug("[ENDEX] (%s) runMacro %s" % (macro_exp.__class__.__name__, name))
- if isinstance(macro_exp, MacroServerException) and macro_obj.parent_macro is None:
- door.debug(macro_exp.traceback)
- door.error("An error occurred while running %s:\n%s" % (macro_obj.description, macro_exp.msg))
- self._popMacro()
- raise macro_exp
- self.debug("[ END ] runMacro %s" % desc)
- self._popMacro()
-
- # decide whether to preserve the macro data
- env_var_name = 'PreserveMacroData'
- try:
- preserve_macro_data = macro_obj.getEnv(env_var_name)
- except UnknownEnv:
- preserve_macro_data = True
- if not preserve_macro_data:
- self.debug('Macro data will not be preserved. ' + \
- 'Set "%s" environment variable ' % env_var_name + \
- 'to True in order to change it.')
- self._macro_pointer = None
-
- return result
-
- def _popMacro(self):
- self._macro_stack.pop()
- length = len(self._macro_stack)
- if length > 0:
- self._macro_pointer = self._macro_stack[-1]
-
- def sendState(self, state):
- return self.door.set_state(state)
-
- def sendStatus(self, status):
- return self.door.set_status(status)
-
- def sendResult(self, result):
- return self.door.set_result(result)
-
- def getLastMacroStatus(self):
- return self._macro_pointer._getMacroStatus()
-
- def sendMacroStatusFinish(self):
- ms = self.getLastMacroStatus()
- if ms is not None:
- ms['state'] = 'finish'
-
- self.debug("Sending finish event")
- self.sendMacroStatus((ms,))
-
- def sendMacroStatusStop(self):
- ms = self.getLastMacroStatus()
- if ms is not None:
- ms['state'] = 'stop'
-
- self.debug("Sending stop event")
- self.sendMacroStatus((ms,))
-
- def sendMacroStatusAbort(self):
- ms = self.getLastMacroStatus()
- if ms is not None:
- ms['state'] = 'abort'
-
- self.debug("Sending abort event")
- self.sendMacroStatus((ms,))
-
- def sendMacroStatusException(self, exc_info):
- ms = self.getLastMacroStatus()
- if ms is not None:
- ms['state'] = 'exception'
- ms['exc_type'] = str(exc_info[0])
- ms['exc_value'] = str(exc_info[1])
- ms['exc_stack'] = traceback.format_exception(*exc_info)
- self.debug("Sending exception event")
- self.sendMacroStatus((ms,))
-
- def sendMacroStatusPause(self):
- ms = self.getLastMacroStatus()
- if ms is not None and len(ms) > 0:
- ms['state'] = 'pause'
- self.debug("Sending pause event")
- self.sendMacroStatus((ms,))
-
- def sendMacroStatusResume(self):
- ms = self.getLastMacroStatus()
- if ms is not None and len(ms) > 0:
- ms['state'] = 'resume'
- self.debug("Sending resume event")
- self.sendMacroStatus((ms,))
-
- def sendMacroStatus(self, data):
- self._last_macro_status = data
- #data = self._macro_status_codec.encode(('', data))
- return self.door.set_macro_status(data)
-
- def sendRecordData(self, data, codec=None):
- return self.door.set_record_data(data, codec=codec)
-
- def reserveObj(self, obj, macro_obj, priority=0):
- if obj is None or macro_obj is None: return
-
- # Fill _reserved_macro_objs
- objs = self._reserved_macro_objs[macro_obj] = \
- self._reserved_macro_objs.get(macro_obj, list())
- if not obj in objs:
- if priority:
- objs.insert(0, obj)
- else:
- objs.append(obj)
-
- # Fill _reserved_objs
- macros = self._reserved_objs[obj] = self._reserved_objs.get(obj, set())
- macros.add(macro_obj)
-
- # Tell the object that it is reserved by a new macro
- if hasattr(obj, 'reserve'): obj.reserve(macro_obj)
-
- def returnObjs(self, macro_obj):
- """Free the macro reserved objects"""
- if macro_obj is None: return
- objs = self._reserved_macro_objs.get(macro_obj)
- if objs is None: return
-
- # inside returnObj we change the list so we have to iterate with a copy
- for obj in copy.copy(objs):
- self.returnObj(obj, macro_obj)
-
- def returnObj(self, obj, macro_obj):
- """Free an object reserved by a macro"""
- if obj is None or macro_obj is None: return
-
- if hasattr(obj, 'unreserve'): obj.unreserve()
- objs = self._reserved_macro_objs.get(macro_obj)
- if objs is None:
- return
- objs.remove(obj)
- if len(objs) == 0:
- del self._reserved_macro_objs[macro_obj]
-
- try:
- macros = self._reserved_objs[obj]
- macros.remove(macro_obj)
- if not len(macros):
- del self._reserved_objs[obj]
- except KeyError:
- self.debug("Unexpected KeyError trying to remove reserved object")
diff --git a/src/sardana/macroserver/msmanager.py b/src/sardana/macroserver/msmanager.py
deleted file mode 100644
index f31fdf82..00000000
--- a/src/sardana/macroserver/msmanager.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-
-__all__ = ["MacroServerManager"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-
-from taurus.core import ManagerState
-from taurus.core.util.log import Logger
-
-
-class MacroServerManager(Logger):
- """Base Class for macro server managers"""
-
- def __init__(self, macro_server):
- name = macro_server.name + "." + self.__class__.__name__
- self._state = ManagerState.UNINITIALIZED
- self._macro_server = weakref.ref(macro_server)
- self.call__init__(Logger, name)
- self.reInit()
-
- def reInit(self):
- self._state = ManagerState.INITED
-
- def cleanUp(self):
- self._state = ManagerState.CLEANED
-
- @property
- def macro_server(self):
- return self._macro_server()
-
- def is_initialized(self):
- return self._state == ManagerState.INITED
-
- def is_cleaned(self):
- return self._state == ManagerState.CLEANED
diff --git a/src/sardana/macroserver/msmetamacro.py b/src/sardana/macroserver/msmetamacro.py
deleted file mode 100644
index 0fe4931e..00000000
--- a/src/sardana/macroserver/msmetamacro.py
+++ /dev/null
@@ -1,301 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer meta macro
-information"""
-
-__all__ = ["MACRO_TEMPLATE", "MacroLibrary", "MacroClass", "MacroFunction"]
-
-__docformat__ = 'restructuredtext'
-
-import inspect
-import operator
-
-from sardana import InvalidId, ElementType
-from sardana.sardanameta import SardanaLibrary, SardanaClass, SardanaFunction
-from sardana.macroserver.msparameter import Type, ParamRepeat
-
-MACRO_TEMPLATE = """class @macro_name@(Macro):
- \"\"\"@macro_name@ description.\"\"\"
-
- # uncomment the following lines as necessary. Otherwise you may delete them
- #param_def = []
- #result_def = []
- #hints = {}
- #env = (,)
-
- # uncomment the following lines if need prepare. Otherwise you may delete them
- #def prepare(self):
- # pass
-
- def run(self):
- pass
-
-"""
-
-MACRO_TEMPLATE = """\
-@macro()
-def @macro_name@(self):
- self.output("Running @macro_name@...")
-
-"""
-
-class MacroLibrary(SardanaLibrary):
- """Object representing a python module containing macro classes and/or
- macro functions. Public members:
-
- - module - reference to python module
- - file_path - complete (absolute) path (with file name at the end)
- - file_name - file name (including file extension)
- - path - complete (absolute) path
- - name - (=module name) module name (without file extension)
- - macros - dict<str, MacroClass>
- - exc_info - exception information if an error occurred when loading
- the module"""
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('macro_server')
- kwargs['elem_type'] = ElementType.MacroLibrary
- SardanaLibrary.__init__(self, **kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaLibrary.serialize(self, *args, **kwargs)
- kwargs['macro_server'] = self.get_manager().name
- kwargs['id'] = InvalidId
- return kwargs
-
- get_macro = SardanaLibrary.get_meta
- get_macros = SardanaLibrary.get_metas
- has_macro = SardanaLibrary.has_meta
-
- add_macro_class = SardanaLibrary.add_meta_class
- get_macro_class = SardanaLibrary.get_meta_class
- get_macro_classes = SardanaLibrary.get_meta_classes
- has_macro_class = SardanaLibrary.has_meta_class
-
- add_macro_function = SardanaLibrary.add_meta_function
- get_macro_function = SardanaLibrary.get_meta_function
- get_macro_functions = SardanaLibrary.get_meta_functions
- has_macro_function = SardanaLibrary.has_meta_function
-
- @property
- def macros(self):
- ret = {}
- ret.update(self.meta_classes)
- ret.update(self.meta_functions)
- return ret
-
-
-class Parameterizable(object):
- """Helper class to handle parameter and result definition for a
- :class:`~sardana.macroserver.msmetamacro.MacroClass` or a
- :class:`~sardana.macroserver.msmetamacro.MacroFunction`"""
-
- def __init__(self):
- self._parameter = self.build_parameter()
- self._result = self.build_result()
-
- def get_parameter_definition(self):
- raise NotImplementedError
-
- def get_result_definition(self):
- raise NotImplementedError
-
- def get_hints_definition(self):
- raise NotImplementedError
-
- def get_parameter(self):
- return self._parameter
-
- def get_result(self):
- return self._result
-
- def build_parameter(self):
- return self._build_parameter(self.get_parameter_definition())
-
- def build_result(self):
- return self._build_parameter(self.get_result_definition())
-
- def _build_parameter(self, param_def):
- ret = []
- param_def = param_def or ()
- for p in param_def:
- t = p[1]
- ret_p = {'min': 1, 'max': None}
- # take care of old ParamRepeat
- if isinstance(t, ParamRepeat):
- t = t.obj()
-
- if operator.isSequenceType(t) and not isinstance(t, (str, unicode)):
- if operator.isMappingType(t[-1]):
- ret_p.update(t[-1])
- t = self._build_parameter(t[:-1])
- else:
- t = self._build_parameter(t)
-
- ret_p['name'] = p[0]
- ret_p['type'] = t
- ret_p['default_value'] = p[2]
- ret_p['description'] = p[3]
- ret.append(ret_p)
- return ret
-
- def build_parameter_info(self, param_def=None):
- param_def = param_def or self.get_parameter_definition()
-
- info = [str(len(param_def))]
- for name, type_class, def_val, desc in param_def:
- repeat = isinstance(type_class, ParamRepeat)
- info.append(name)
- type_name = (repeat and 'ParamRepeat') or type_class
- info.append(type_name)
- info.append(desc)
- if repeat:
- rep = type_class
- opts = sep = ''
- for opt, val in rep.items():
- opts += '%s%s=%s' % (sep, opt, val)
- sep = ', '
- info.append(opts)
- info += self.get_parameter_info(rep.param_def)
- else:
- info.append(str(def_val))
- return info
-
- def build_result_info(self, result_def=None):
- result_def = result_def or self.get_result_definition()
-
- info = [str(len(result_def))]
- for name, type_class, def_val, desc in result_def:
- repeat = isinstance(type_class, ParamRepeat)
- info.append(name)
- type_name = (repeat and 'ParamRepeat') or type_class
- info.append(type_name)
- info.append(desc)
- if repeat:
- rep = type_class
- opts = sep = ''
- for opt, val in rep.items():
- opts += '%s%s=%s' % (sep, opt, val)
- sep = ', '
- info.append(opts)
- info += self.get_parameter_info(rep.param_def)
- else:
- info.append(str(def_val))
- return info
-
- def get_info(self):
- info = [self.full_name, self.description, str(self.code_object.hints)]
- info += self.get_parameter_info()
- info += self.get_result_info()
- return info
-
- def serialize(self, *args, **kwargs):
- kwargs['macro_server'] = self.get_manager().name
- kwargs['id'] = InvalidId
- kwargs['hints'] = self.code_object.hints
- param, result = self.get_parameter(), self.get_result()
- kwargs['parameters'] = param
- kwargs['result'] = result
- return kwargs
-
-
-class MacroClass(SardanaClass, Parameterizable):
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('macro_server')
- kwargs['elem_type'] = ElementType.MacroClass
- SardanaClass.__init__(self, **kwargs)
- Parameterizable.__init__(self)
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaClass.serialize(self, *args, **kwargs)
- kwargs = Parameterizable.serialize(self, *args, **kwargs)
- return kwargs
-
- @property
- def macro_class(self):
- return self.klass
-
- def get_parameter_definition(self):
- return self.klass.param_def
-
- def get_result_definition(self):
- return self.klass.result_def
-
- def get_hints_definition(self):
- return self.klass.hints
-
-
-class MacroFunction(SardanaFunction, Parameterizable):
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('macro_server')
- kwargs['elem_type'] = ElementType.MacroFunction
- SardanaFunction.__init__(self, **kwargs)
- Parameterizable.__init__(self)
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaFunction.serialize(self, *args, **kwargs)
- kwargs = Parameterizable.serialize(self, *args, **kwargs)
- return kwargs
-
- @property
- def macro_function(self):
- return self.function
-
- def to_parameter_definition(self):
- param_def = []
- args, varargs, keywords, defaults = inspect.getargspec(self.function)
- assert keywords is None
- assert len(args) > 0
-
- if varargs is None:
- for arg in args[1:]:
- param_def.append((arg, Type.Any, None, arg + " parameter"))
- i = len(param_def) - 1
- if defaults is not None:
- for default in reversed(defaults):
- param_def[i][2] = default
- i -= 1
- else:
- param_def.append(
- (varargs , [[ varargs, Type.Any, None, varargs + " parameter"]],
- None, "list of " + varargs))
- return param_def
-
- def get_parameter_definition(self):
- param_def = self.function.param_def
- if param_def is None:
- param_def = self.to_parameter_definition()
- return param_def
-
- def get_result_definition(self):
- result_def = self.function.result_def
- return result_def
-
- def get_hints_definition(self):
- return self.function.hints or ()
-
diff --git a/src/sardana/macroserver/msoptions.py b/src/sardana/macroserver/msoptions.py
deleted file mode 100644
index a29352eb..00000000
--- a/src/sardana/macroserver/msoptions.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a definition for ViewOptions"""
-
-from __future__ import with_statement
-from __future__ import print_function
-
-__all__ = ['ViewOption']
-
-
-def ViewOptionMeta(name, bases, attrs):
- for k in attrs['_DEFAULT_VIEW_OPTIONS']:
- attrs[k] = k
- return type(name, bases, attrs)
-
-
-class ViewOption(object):
- __metaclass__ = ViewOptionMeta
-
- _DEFAULT_VIEW_OPTIONS = {
- 'ShowDial' : True,
- 'ShowCtrlAxis' : False,
- 'PosFormat': -1,
- }
-
- @classmethod
- def init_options(cls, d):
- d.update(cls._DEFAULT_VIEW_OPTIONS)
- return d
-
- @classmethod
- def reset_option(cls, d, name):
- if name in cls._DEFAULT_VIEW_OPTIONS:
- d[name] = cls._DEFAULT_VIEW_OPTIONS[name]
- else:
- del d[name]
-
-
diff --git a/src/sardana/macroserver/msparameter.py b/src/sardana/macroserver/msparameter.py
deleted file mode 100644
index dab81db2..00000000
--- a/src/sardana/macroserver/msparameter.py
+++ /dev/null
@@ -1,398 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of the macroserver parameters for
-macros"""
-
-__all__ = ["WrongParam", "MissingParam", "UnknownParamObj", "WrongParamType",
- "TypeNames", "Type", "ParamType", "ParamRepeat", "ElementParamType",
- "ElementParamInterface", "AttrParamType", "AbstractParamTypes",
- "ParamDecoder"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.util.containers import CaselessDict
-
-from sardana import ElementType, INTERFACES_EXPANDED
-from sardana.macroserver.msbase import MSBaseObject
-from sardana.macroserver.msexception import MacroServerException, \
- UnknownMacro, UnknownMacroLibrary
-
-
-class WrongParam(MacroServerException):
-
- def __init__(self, *args):
- MacroServerException.__init__(self, *args)
- self.type = 'Wrong parameter'
-
-
-class MissingParam(WrongParam):
-
- def __init__(self, *args):
- WrongParam.__init__(self, *args)
- self.type = 'Missing parameter'
-
-
-class UnknownParamObj(WrongParam):
-
- def __init__(self, *args):
- WrongParam.__init__(self, *args)
- self.type = 'Unknown parameter'
-
-
-class WrongParamType(WrongParam):
-
- def __init__(self, *args):
- WrongParam.__init__(self, *args)
- self.type = 'Unknown parameter type'
-
-
-class TypeNames:
- """Class that holds the list of registered macro parameter types"""
-
- def __init__(self):
- self._type_names = {}
- self._pending_type_names = {}
-
- def addType(self, name):
- """Register a new macro parameter type"""
- setattr(self, name, name)
- self._type_names[name] = name
- if name in self._pending_type_names:
- del self._pending_type_names[name]
-
- def removeType(self, name):
- """remove a macro parameter type"""
- delattr(self, name)
- try:
- del self._type_names[name]
- except ValueError:
- pass
-
- def __str__(self):
- return str(self._type_names.keys())
-
-# def __getattr__(self, name):
-# if name not in self._pending_type_names:
-# self._pending_type_names[name] = name
-# return self._pending_type_names[name]
-
-
-# This instance of TypeNames is intended to provide access to types to the
-# Macros in a "Type.Motor" fashion
-Type = TypeNames()
-
-
-class ParamType(MSBaseObject):
-
- All = 'All'
-
- # Capabilities
- ItemList = 'ItemList'
- ItemListEvents = 'ItemListEvents'
-
- capabilities = []
-
- type_class = str
-
- def __init__(self, macro_server, name):
- MSBaseObject.__init__(self, name=name, full_name=name,
- macro_server=macro_server,
- elem_type=ElementType.ParameterType)
-
- def getName(self):
- return self.name
-
- def getObj(self, str_repr):
- return self.type_class(str_repr)
-
- @classmethod
- def hasCapability(cls, cap):
- return cap in cls.capabilities
-
- def serialize(self, *args, **kwargs):
- kwargs = MSBaseObject.serialize(self, *args, **kwargs)
- kwargs['composed'] = False
- return kwargs
-
-
-class ParamRepeat(object):
- # opts: min, max
- def __init__(self, *param_def, **opts):
- self.param_def = param_def
- self.opts = {'min': 1, 'max': None}
- self.opts.update(opts)
- self._obj = list(param_def)
- self._obj.append(self.opts)
-
- def items(self):
- return self.opts.items()
-
- def __getattr__(self, name):
- return self.opts[name]
-
- def obj(self):
- return self._obj
-
-
-class ElementParamType(ParamType):
-
- capabilities = ParamType.ItemList, ParamType.ItemListEvents
-
- def __init__(self, macro_server, name):
- ParamType.__init__(self, macro_server, name)
-
- def accepts(self, elem):
- return elem.getType() == self._name
-
- def getObj(self, name, pool=ParamType.All, cache=False):
- macro_server = self.macro_server
- if pool == ParamType.All:
- pools = macro_server.get_pools()
- else:
- pools = macro_server.get_pool(pool),
- for pool in pools:
- elem_info = pool.getObj(name, elem_type=self._name)
- if elem_info is not None and self.accepts(elem_info):
- return elem_info
- # not a pool object, maybe it is a macro server object (perhaps a macro
- # code or a macro library
- try:
- return macro_server.get_macro(name)
- except UnknownMacro:
- pass
-
- try:
- return macro_server.get_macro_lib(name)
- except UnknownMacroLibrary:
- pass
- # neither pool nor macroserver contains any element with this name
- raise UnknownParamObj('%s with name %s does not exist' % \
- (self._name, name))
-
- def getObjDict(self, pool=ParamType.All, cache=False):
- macro_server = self.macro_server
- objs = CaselessDict()
- if pool == ParamType.All:
- pools = macro_server.get_pools()
- else:
- pools = macro_server.get_pool(pool),
- for pool in pools:
- for elem_info in pool.getElements():
- if self.accepts(elem_info):
- objs[elem_info.name] = elem_info
- for macro_lib_name, macro_lib in macro_server.get_macros().items():
- if self.accepts(macro_lib):
- objs[macro_lib_name] = macro_lib
- for macro_name, macro in macro_server.get_macros().items():
- if self.accepts(macro):
- objs[macro_name] = macro
-
- return objs
-
- def getObjListStr(self, pool=ParamType.All, cache=False):
- obj_dict = self.getObjDict(pool=pool, cache=cache)
- return obj_dict.keys()
-
- def getObjList(self, pool=ParamType.All, cache=False):
- obj_dict = self.getObjDict(pool=pool, cache=cache)
- return obj_dict.values()
-
- def serialize(self, *args, **kwargs):
- kwargs = ParamType.serialize(self, *args, **kwargs)
- kwargs['composed'] = True
- return kwargs
-
-
-class ElementParamInterface(ElementParamType):
-
- def __init__(self, macro_server, name):
- ElementParamType.__init__(self, macro_server, name)
- bases, doc = INTERFACES_EXPANDED.get(name)
- self._interfaces = bases
-
- def accepts(self, elem):
- elem_type = elem.getType()
- elem_interfaces = INTERFACES_EXPANDED.get(elem_type)[0]
- if elem_interfaces is None:
- return ElementParamType.accepts(self, elem)
- return self._name in elem_interfaces
-
- def getObj(self, name, pool=ParamType.All, cache=False):
- macro_server = self.macro_server
- if pool == ParamType.All:
- pools = macro_server.get_pools()
- else:
- pools = macro_server.get_pool(pool),
- for pool in pools:
- elem_info = pool.getElementWithInterface(name, self._name)
- if elem_info is not None and self.accepts(elem_info):
- return elem_info
- # not a pool object, maybe it is a macro server object (perhaps a macro
- # class or a macro library
- try:
- return macro_server.get_macro(name)
- except UnknownMacro:
- pass
-
- try:
- return macro_server.get_macro_lib(name)
- except UnknownMacroLibrary:
- pass
- # neither pool nor macroserver contains any element with this name
- raise UnknownParamObj('%s with name %s does not exist' % \
- (self._name, name))
-
- def getObjDict(self, pool=ParamType.All, cache=False):
- macro_server = self.macro_server
- objs = CaselessDict()
- if macro_server.is_macroserver_interface(self._name):
- return macro_server.get_elements_with_interface(self._name)
-
- if pool == ParamType.All:
- pools = macro_server.get_pools()
- else:
- pools = macro_server.get_pool(pool),
- for pool in pools:
- for elem_info in pool.getElementsWithInterface(self._name).values():
- if self.accepts(elem_info):
- objs[elem_info.name] = elem_info
- return objs
-
- def getObjListStr(self, pool=ParamType.All, cache=False):
- obj_dict = self.getObjDict(pool=pool, cache=cache)
- return obj_dict.keys()
-
- def getObjList(self, pool=ParamType.All, cache=False):
- obj_dict = self.getObjDict(pool=pool, cache=cache)
- return obj_dict.values()
-
-
-class AttrParamType(ParamType):
- pass
-
-
-AbstractParamTypes = ParamType, ElementParamType, ElementParamInterface, AttrParamType
-
-
-class ParamDecoder:
-
- def __init__(self, door, macro_meta, param_str_list):
- self.door = door
- self.macro_meta = macro_meta
- self.param_str_list = param_str_list
- self.param_list = None
- self.decode()
-
- @property
- def type_manager(self):
- return self.door.type_manager
-
- def decode(self):
- macro_meta = self.macro_meta
- macro_type = macro_meta.get_type()
- pars_str = self.param_str_list[1:]
- pars_def = macro_meta.get_parameter_definition()
- if macro_type == ElementType.MacroClass:
- _, self.param_list = self.decodeNormal(pars_str, pars_def)
- elif macro_type == ElementType.MacroFunction:
- if macro_meta.function.param_def is None:
- self.param_list = self.param_str_list[1:]
- else:
- _, self.param_list = self.decodeNormal(pars_str, pars_def)
- return self.param_list
-
- def decodeNormal(self, str_list, def_list):
- str_len = len(str_list)
- par_len = len(def_list)
- obj_list = []
- str_idx = 0
- for i, par_def in enumerate(def_list):
- name, type_class, def_val, desc = par_def
- if str_idx == str_len:
- if def_val is None:
- if not isinstance(type_class, ParamRepeat):
- raise MissingParam, "'%s' not specified" % name
- elif isinstance(type_class, ParamRepeat):
- min = par_def[1].opts['min']
- if min > 0:
- raise WrongParam, "'%s' demands at least %d values" % (name, min)
- new_obj_list = []
- if not def_val is None:
- new_obj_list.append(def_val)
- else:
- if isinstance(type_class, ParamRepeat):
- data = self.decodeRepeat(str_list[str_idx:], par_def)
- dec_token, new_obj_list = data
- else:
- type_manager = self.type_manager
- type_name = type_class
- type_class = type_manager.getTypeClass(type_name)
- par_type = type_manager.getTypeObj(type_name)
- par_str = str_list[str_idx]
- try:
- val = par_type.getObj(par_str)
- except ValueError, e:
- raise WrongParamType, e.message
- except UnknownParamObj, e:
- raise WrongParam, e.message
- if val is None:
- msg = 'Could not create %s parameter "%s" for "%s"' % \
- (par_type.getName(), name, par_str)
- raise WrongParam, msg
- dec_token = 1
- new_obj_list = [val]
- str_idx += dec_token
- obj_list += new_obj_list
- return str_idx, obj_list
-
- def decodeRepeat(self, str_list, par_def):
- name, rep_data, def_val, desc = par_def
- min_rep = rep_data.min
- max_rep = rep_data.max
- dec_token = 0
- obj_list = []
- rep_nr = 0
- while dec_token < len(str_list):
- if max_rep is not None and rep_nr == max_rep:
- break
- new_token, new_obj_list = self.decodeNormal(str_list[dec_token:],
- rep_data.param_def)
- dec_token += new_token
- if len(new_obj_list) == 1:
- new_obj_list = new_obj_list[0]
- obj_list.append(new_obj_list)
- rep_nr += 1
- if rep_nr < min_rep:
- msg = 'Found %d repetitions of param %s, min is %d' % \
- (rep_nr, name, min_rep)
- raise RuntimeError, msg
- return dec_token, obj_list
-
- def getParamList(self):
- return self.param_list
-
- def __getattr__(self, name):
- return getattr(self.param_list, name)
diff --git a/src/sardana/macroserver/mstypemanager.py b/src/sardana/macroserver/mstypemanager.py
deleted file mode 100644
index e3364273..00000000
--- a/src/sardana/macroserver/mstypemanager.py
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of the macroserver data type manager"""
-
-__all__ = ["TypeManager"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import inspect
-
-from sardana.sardanamodulemanager import ModuleManager
-
-from sardana.macroserver.msparameter import Type, ParamType, AbstractParamTypes
-from sardana.macroserver.msmanager import MacroServerManager
-
-_BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-
-
-class TypeManager(MacroServerManager):
-
- DEFAULT_TYPE_DIR = _BASE_DIR
- DEFAULT_TYPE_MODULES = 'basetypes',
-
- def reInit(self):
- if self.is_initialized():
- return
-
- # dict<str, dict<str,class<ParamType>>
- # key - module name (without path and without extension)
- # value - a dict where:
- # key - type name
- # value - class object implementing the Type
- self._modules = {}
-
- # dict<str, ParamType>
- # key - type name
- # value - object which inherits from ParamType
- self._inst_dict = {}
-
- path = [self.DEFAULT_TYPE_DIR]
- for type_module in self.DEFAULT_TYPE_MODULES:
- self.reloadTypeModule(type_module, path=path)
-
- MacroServerManager.reInit(self)
-
- def cleanUp(self):
- if self.is_cleaned():
- return
-
- if self._modules:
- for _, types_dict in self._modules.items():
- for type_name in types_dict:
- Type.removeType(type_name)
-
- self._modules = None
- self._inst_dict = None
-
- MacroServerManager.cleanUp(self)
-
- def getTypeListObj(self):
- return self._type_list_obj
-
- def reloadTypeModule(self, module_name, path=None):
- """Loads/reloads the given module name"""
- #path = path or [ os.path.dirname(__file__) ]
- m = None
- try:
- m = ModuleManager().reloadModule(module_name, path)
- except:
- pass
-
- if m is None:
- if module_name in self._modules:
- self._modules.pop(module_name)
- return
-
- self._modules[module_name] = {}
-
- abs_file = inspect.getabsfile(m)
- ms = self.macro_server
- for name in dir(m):
- if name.startswith("_"):
- continue
- klass = getattr(m, name)
- try:
- if not issubclass(klass, ParamType):
- continue
- except:
- continue
- if klass in AbstractParamTypes:
- continue
- if inspect.getabsfile(klass) != abs_file:
- continue
-
- t = klass(ms, name)
- self.addType(t)
-
- def addType(self, type_obj):
- type_name = type_obj.getName()
- type_class = type_obj.__class__
- module_name = type_obj.__module__
-
- mod_types = self._modules[module_name]
-
- #action = (((type_name in mod_types) and "Updating") \
- # or "Adding")
- action = "Updating"
- self.debug("%s type %s", action, type_name)
- mod_types[type_name] = type_class
- self._inst_dict[type_name] = type_obj
-
- Type.addType(type_name)
-
- def getTypeListStr(self):
- type_list_basic, type_list_obj = [], []
-
- for _, type_class_dict in self._modules.items():
- for tname, tklass in type_class_dict.items():
- if tklass.hasCapability(ParamType.ItemList):
- type_list_obj.append("%s*" % tname)
- else:
- type_list_basic.append(tname)
- type_list = sorted(type_list_basic) + sorted(type_list_obj)
-
- return type_list
-
- def getTypeClass(self, type_name):
- for _, type_class_dict in self._modules.items():
- tklass = type_class_dict.get(type_name)
- if tklass is None:
- continue
- return tklass
- return None
-
- def getTypeObj(self, type_name):
- return self._inst_dict.get(type_name)
-
- def getTypes(self):
- return self._inst_dict
-
- def getTypeNames(self):
- return self._inst_dict.keys()
diff --git a/src/sardana/macroserver/scan/__init__.py b/src/sardana/macroserver/scan/__init__.py
deleted file mode 100644
index 3cfc7000..00000000
--- a/src/sardana/macroserver/scan/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan module"""
-
-__docformat__ = 'restructuredtext'
-
-from scandata import *
-from gscan import * \ No newline at end of file
diff --git a/src/sardana/macroserver/scan/gscan.py b/src/sardana/macroserver/scan/gscan.py
deleted file mode 100644
index 2001af9c..00000000
--- a/src/sardana/macroserver/scan/gscan.py
+++ /dev/null
@@ -1,2220 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the class definition for the MacroServer generic
-scan"""
-
-__all__ = ["ScanSetupError", "ScanException", "ExtraData", "TangoExtraData",
- "GScan", "SScan", "CScan", "CSScan", "CTScan", "HScan"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import datetime
-import operator
-import time
-import threading
-import numpy as np
-
-import PyTango
-import taurus
-from taurus.core.util.log import Logger
-from taurus.core.util.user import USER_NAME
-from taurus.core.tango import FROM_TANGO_TO_STR_TYPE
-
-from sardana.util.tree import BranchNode, LeafNode, Tree
-from sardana.util.motion import Motor as VMotor
-from sardana.util.motion import MotionPath
-from sardana.macroserver.msexception import MacroServerException, UnknownEnv, \
- InterruptException
-from sardana.macroserver.msparameter import Type
-from sardana.macroserver.scan.scandata import ColumnDesc, MoveableDesc, \
- ScanFactory, ScanDataEnvironment
-from sardana.macroserver.scan.recorder import OutputRecorder, JsonRecorder, \
- SharedMemoryRecorder, FileRecorder
-from sardana.taurus.core.tango.sardana.pool import Ready
-
-
-class ScanSetupError(Exception):
- pass
-
-
-class ScanException(MacroServerException):
- pass
-
-
-class ExtraData(object):
-
- def __init__(self, **kwargs):
- """Expected keywords are:
- - model (str, mandatory): represents data source (ex.: a/b/c/d)
- - label (str, mandatory): column label
- - name (str, optional): unique name (defaults to model)
- - shape (seq, optional): data shape
- - dtype (numpy.dtype, optional): data type
- - instrument (str, optional): full instrument name"""
- self._label = kwargs['label']
- self._model = kwargs['model']
- if not kwargs.has_key('dtype'):
- kwargs['dtype'] = self.getType()
- if not kwargs.has_key('shape'):
- kwargs['shape'] = self.getShape()
- if not kwargs.has_key('name'):
- kwargs['name'] = self._model
- self._column = ColumnDesc(**kwargs)
-
- def getLabel(self):
- return self._label
-
- def getName(self):
- return self._label
-
- def getColumnDesc(self):
- return self._column
-
- def getType(self):
- raise Exception("Must be implemented in subclass")
-
- def getShape(self):
- raise Exception("Must be implemented in subclass")
-
- def read(self):
- raise Exception("Must be implemented in subclass")
-
-
-class TangoExtraData(ExtraData):
-
- def __init__(self, **kwargs):
- self._attribute = None
- ExtraData.__init__(self, **kwargs)
-
- @property
- def attribute(self):
- if self._attribute is None:
- self._attribute = taurus.Attribute(self._model)
- return self._attribute
-
- def getType(self):
- t = self.attribute.getType()
- if t is None:
- raise Exception("Could not determine type for unknown attribute '%s'" % self._model)
- return FROM_TANGO_TO_STR_TYPE[t]
-
- def getShape(self):
- s = self.attribute.getShape()
- if s is None:
- raise Exception("Could not determine type for unknown attribute '%s'" % self._model)
- return s
-
- def read(self):
- try:
- return self.attribute.read(cache=False).value
- except InterruptException:
- raise
- except Exception:
- return None
-
-
-class GScan(Logger):
- """Generic Scan object.
- The idea is that the scan macros create an instance of this Generic Scan,
- supplying in the constructor a reference to the macro that created the scan,
- a generator function pointer, a list of moveable items, an extra
- environment and a sequence of constrains.
-
- If the referenced macro is hookable, 'pre-scan' and 'post-scan' hook hints
- will be used to execute callables before the start and after the end of the
- scan, respectively
-
- The generator must be a function yielding a dictionary with the following
- content (minimum) at each step of the scan:
- - 'positions' : In a step scan, the position where the moveables should go
- - 'integ_time' : In a step scan, a number representing the integration time for the step
- (in seconds)
- - 'integ_time' : In a continuous scan, the time between acquisitions
- - 'pre-move-hooks' : (optional) a sequence of callables to be called in strict order before starting to move.
- - 'post-move-hooks': (optional) a sequence of callables to be called in strict order after finishing the move.
- - 'pre-acq-hooks' : (optional) a sequence of callables to be called in strict order before starting to acquire.
- - 'post-acq-hooks' : (optional) a sequence of callables to be called in strict order after finishing acquisition but before recording the step.
- - 'post-step-hooks' : (optional) a sequence of callables to be called in strict order after finishing recording the step.
- - 'hooks' : (deprecated, use post-acq-hooks instead)
- - 'point_id' : a hashable identifing the scan point.
- - 'check_func' : (optional) a list of callable objects. callable(moveables, counters)
- - 'extravalues': (optional) a dictionary containing the values for each extra info
- field. The extra information fields must be described in
- extradesc (passed in the constructor of the Gscan)
-
-
- The moveables must be a sequence Motion or MoveableDesc objects.
-
- The environment is a dictionary of extra environment to be added specific
- to the macro in question.
-
- Each constrain must be a callable which must receive a two parameters: the
- current point and the next point. It should return True or False
-
- The extradesc optional argument consists of a list of ColumnDesc objects
- which describe the data fields that will be filled using step['extravalues'],
- where step is what the generator yields.
-
- The Generic Scan will create:
- - a ScanData
- - DataHandler with the following recorders:
- - OutputRecorder (depends on 'OutputCols' environment variable)
- - SharedMemoryRecorder (depends on 'SharedMemory' environment variable)
- - FileRecorder (depends on 'ScanDir' and 'ScanData' environment variables)
- - ScanDataEnvironment with the following contents:
- - 'serialno' : a integer identifier for the scan operation
- - 'user' : the user which started the scan
- - 'title' : the scan title (build from macro.getCommand)
- - 'datadesc' : a seq<ColumnDesc> describing each column of data
- (labels, data format, data shape, etc)
- - 'estimatedtime' : a float representing an estimation for
- the duration of the scan (in seconds). Negative means
- the time estimation is known not to be accurate. Anyway,
- time estimation has 'at least' semantics.
- - 'total_scan_intervals' : total number of scan intervals. Negative means
- the estimation is known not to be accurate. In
- this case, estimation has 'at least' semantics.
- - '' : a datetime.datetime representing the start of the scan
- - 'instrumentlist' : a list of Instrument objects containing info
- about the physical setup of the motors, counters,...
- - <extra environment> given in the constructor
- (at the end of the scan, extra keys 'endtime' and 'deadtime' will be added
- representing the time at the end of the scan and the dead time)
-
- This object is passed to all recorders at the beginning and at the end
- of the scan (when startRecordList and endRecordList is called)
-
- At each step of the scan, for each Recorder, the writeRecord method will
- be called with a Record object as parameter. The Record.data member will be
- a dictionary containing:
- - 'point_nb' : the point number of the scan
- - for each column of the scan (motor or counter), a key with the
- corresponding column name will contain the value"""
-
- MAX_SCAN_HISTORY = 20
-
- env = ('ActiveMntGrp', 'ExtraColumns' 'ScanDir', 'ScanFile', 'SharedMemory', 'OutputCols')
-
- def __init__(self, macro, generator=None, moveables=[], env={}, constraints=[], extrainfodesc=[]):
- self._macro = macro
- self._generator = generator
- self._extrainfodesc = extrainfodesc
-
- #nasty hack to make sure macro has access to gScan as soon as possible
- self._macro._gScan = self #TODO: CAUTION! this may be causing a circular reference!
-
- self._moveables, moveable_names = [], []
- for moveable in moveables:
- if not isinstance(moveable, MoveableDesc):
- moveable = MoveableDesc(moveable=moveable)
- moveable_names.append(moveable.moveable.getName())
- self._moveables.append(moveable)
-
- name = self.__class__.__name__
- self.call__init__(Logger, name)
-
- # ----------------------------------------------------------------------
- # Setup motion objects
- # ----------------------------------------------------------------------
- self._motion = macro.getMotion(moveable_names)
-
- # ----------------------------------------------------------------------
- # Find the measurement group
- # ----------------------------------------------------------------------
- try:
- mnt_grp_name = macro.getEnv('ActiveMntGrp')
- except UnknownEnv:
- mnt_grps = macro.getObjs(".*", type_class=Type.MeasurementGroup)
- if len(mnt_grps) == 0:
- raise ScanSetupError('No Measurement Group defined')
- mnt_grp = mnt_grps[0]
- macro.info("ActiveMntGrp not defined. Using %s", mnt_grp)
- macro.setEnv('ActiveMntGrp', mnt_grp.getName())
- else:
- if not isinstance(mnt_grp_name, (str, unicode)):
- t = type(mnt_grp_name).__name__
- raise TypeError("ActiveMntGrp MUST be string. It is '%s'" % t)
-
- mnt_grp = macro.getObj(mnt_grp_name,
- type_class=Type.MeasurementGroup)
-
- if mnt_grp is None:
- raise ScanSetupError("ActiveMntGrp has invalid value: '%s'"
- % mnt_grp_name)
-
- self._master = mnt_grp.getTimer()
-
- if self._master is None:
- raise ScanSetupError('%s has no timer defined' % mnt_grp.getName())
-
- self._measurement_group = mnt_grp
-
- # ----------------------------------------------------------------------
- # Setup extra columns
- # ----------------------------------------------------------------------
- self._extra_columns = self._getExtraColumns()
-
- # ----------------------------------------------------------------------
- # Setup data management
- # ----------------------------------------------------------------------
-
- # Generate data handler
- data_handler = ScanFactory().getDataHandler()
-
- # The Scan data object
- data = ScanFactory().getScanData(data_handler)
-
- # The Output recorder (if any)
- output_recorder = self._getOutputRecorder()
-
- # The Output recorder (if any)
- json_recorder = self._getJsonRecorder()
-
- # The File recorders (if any)
- file_recorders = self._getFileRecorders()
-
- # The Shared memory recorder (if any)
- shm_recorder = self._getSharedMemoryRecorder(0)
- shm_recorder_1d = None
- if shm_recorder is not None:
- shm_recorder_1d = self._getSharedMemoryRecorder(1)
-
- data_handler.addRecorder(output_recorder)
- data_handler.addRecorder(json_recorder)
- for file_recorder in file_recorders:
- data_handler.addRecorder(file_recorder)
- data_handler.addRecorder(shm_recorder)
- data_handler.addRecorder(shm_recorder_1d)
-
- self._data = data
- self._data_handler = data_handler
-
- # ----------------------------------------------------------------------
- # Setup environment
- # ----------------------------------------------------------------------
- self._setupEnvironment(env)
-
- def _getExtraColumns(self):
- ret = []
- try:
- cols = self.macro.getEnv('ExtraColumns')
- except InterruptException:
- raise
- except:
- self.info('ExtraColumns is not defined')
- return ret
-
- try:
- for i, kwargs in enumerate(cols):
- kw = dict(kwargs)
- try:
- if kw.has_key('instrument'):
- instrument = self._macro.getObj(kw['instrument'],
- type_class=Type.Instrument)
- if instrument:
- kw['instrument'] = instrument
- ret.append(TangoExtraData(**kw))
- except InterruptException:
- raise
- except Exception, colexcept:
- colname = kw.get('label', str(i))
- self.macro.warning("Extra column %s is invalid: %s",
- colname, str(colexcept))
- except InterruptException:
- raise
- except Exception:
- self.macro.warning('ExtraColumns has invalid value. Must be a '
- 'sequence of maps')
- return ret
-
- def _getJsonRecorder(self):
- try:
- json_enabled = self.macro.getEnv('JsonRecorder')
- if json_enabled:
- return JsonRecorder(self.macro)
- except InterruptException:
- raise
- except Exception:
- pass
- self.info('JsonRecorder is not defined. Use "senv JsonRecorder '
- 'True" to enable it')
-
- def _getOutputRecorder(self):
- cols = None
- try:
- cols = self.macro.getEnv('OutputCols')
- except InterruptException:
- raise
- except:
- pass
- return OutputRecorder(self.macro, cols=cols, number_fmt='%g')
-
- def _getFileRecorders(self):
- macro = self.macro
- try:
- scan_dir = macro.getEnv('ScanDir')
- except InterruptException:
- raise
- except Exception:
- macro.warning('ScanDir is not defined. This operation will not be '
- 'stored persistently. Use Use "expconf" (or "senv ScanDir '
- '<abs directory>") to enable it')
- return ()
-
- if not isinstance(scan_dir, (str, unicode)):
- scan_dir_t = type(scan_dir).__name__
- raise TypeError("ScanDir MUST be string. It is '%s'" % scan_dir_t)
-
- try:
- file_names = macro.getEnv('ScanFile')
- except InterruptException:
- raise
- except Exception:
- macro.warning('ScanFile is not defined. This operation will not '
- 'be stored persistently. Use "expconf" (or "senv ScanFile <scan '
- 'file(s)>") to enable it')
- return ()
-
- if isinstance(file_names, (str, unicode)):
- file_names = (file_names,)
- elif not operator.isSequenceType(file_names):
- scan_file_t = type(file_names).__name__
- raise TypeError("ScanFile MUST be string or sequence of strings."\
- " It is '%s'" % scan_file_t)
-
- file_recorders = []
- for file_name in file_names:
- abs_file_name = os.path.join(scan_dir, file_name)
- try:
- file_recorder = FileRecorder(abs_file_name, macro=macro)
- file_recorders.append(file_recorder)
- except InterruptException:
- raise
- except Exception:
- macro.warning("Error creating recorder for %s", abs_file_name)
- macro.debug("Details:", exc_info=1)
-
- if len(file_recorders) == 0:
- macro.warning("No valid recorder found. This operation will not be "
- " stored persistently")
- return file_recorders
-
- def _getSharedMemoryRecorder(self, eid):
- macro, mg, shm = self.macro, self.measurement_group, False
- try:
- shm = macro.getEnv('SharedMemory')
- except InterruptException:
- raise
- except Exception:
- self.info('SharedMemory is not defined. Use "senv '
- 'SharedMemory sps" to enable it')
- return
-
- if not shm:
- return
-
- kwargs = {}
- # For now we only support SPS shared memory format
- if shm.lower() == 'sps':
- cols = 1 # Point nb column
- cols += len(self.moveables) # motor columns
- ch_nb = len(mg.getChannels())
- oned_nb = 0
- array_prefix = mg.getName().upper()
-
- try:
- oned_nb = len(mg.OneDExpChannels)
- except InterruptException:
- raise
- except:
- oned_nb = 0
-
- twod_nb = 0
- try:
- twod_nb = len(mg.TwoDExpChannels)
- except InterruptException:
- raise
- except:
- twod_nb = 0
-
- if eid == 0:
- cols += (ch_nb - oned_nb - twod_nb) # counter/timer & 0D channel columns
- elif eid == 1:
- cols = 1024
-
- if eid == 0:
- kwargs.update({ 'program' : macro.getDoorName(),
- 'array' : "%s_0D" % array_prefix,
- 'shape' : (cols, 4096) } )
- elif eid == 1:
- if oned_nb == 0:
- return
- else:
- kwargs.update({ 'program' : macro.getDoorName(),
- 'array' : "%s_1D" % array_prefix,
- 'shape' : (cols, 99) } )
-
- shmRecorder = SharedMemoryRecorder(shm, **kwargs)
- if shmRecorder is None:
- self.info('SharedMemory %s is not available'%shm)
- return shmRecorder
-
- def _secsToTimedelta(self, secs):
- days, secs = divmod(secs, 86400)
- # we don't have to care about microseconds because if secs is a float
- # timedelta will do it for us
- return datetime.timedelta(days, secs)
-
- def _timedeltaToSecs(self, td):
- return 86400*td.days + td.seconds + 1E-6*td.microseconds
-
- def _setupEnvironment(self, additional_env):
- try:
- serialno = self.macro.getEnv("ScanID") + 1
- except UnknownEnv:
- serialno = 1
- self.macro.setEnv("ScanID", serialno)
-
- env = ScanDataEnvironment(
- { 'serialno' : serialno,
- 'user' : USER_NAME, #TODO: this should be got from self.measurement_group.getChannelsInfo()
- 'title' : self.macro.getCommand() } )
-
- # Initialize the data_desc list (and add the point number column)
- data_desc = [
- ColumnDesc(name='point_nb', label='#Pt No', dtype='int64')
- ]
-
- # add motor columns
- ref_moveables = []
- for moveable in self.moveables:
- data_desc.append(moveable)
- if moveable.is_reference:
- ref_moveables.insert(0, moveable.name)
-
- if not ref_moveables and len(self.moveables):
- ref_moveables.append(data_desc[-1].name)
- env['ref_moveables'] = ref_moveables
-
- # add master column
- master = self._master
- instrument = master['instrument']
-
- #add channels from measurement group
- channels_info = self.measurement_group.getChannelsInfo()
- counters = []
- for ci in channels_info:
- instrument = ci.instrument or ''
- try:
- instrumentFullName = self.macro.findObjs(instrument, type_class=Type.Instrument)[0].getFullName()
- except InterruptException:
- raise
- except:
- instrumentFullName = ''
- #substitute the axis placeholder by the corresponding moveable.
- plotAxes = []
- i = 0
- for a in ci.plot_axes:
- if a == '<mov>':
- plotAxes.append(ref_moveables[i])
- i += 1
- else: plotAxes.append(a)
-
- #create the ColumnDesc object
- column = ColumnDesc(name=ci.full_name,
- label=ci.label,
- dtype=ci.data_type,
- shape=ci.shape,
- instrument=instrumentFullName,
- source=ci.source,
- output=ci.output,
- conditioning=ci.conditioning,
- normalization=ci.normalization,
- plot_type=ci.plot_type,
- plot_axes=plotAxes,
- data_units=ci.unit)
- data_desc.append(column)
- counters.append(column.name)
- counters.remove(master['full_name'])
- env['counters'] = counters
-
- for extra_column in self._extra_columns:
- data_desc.append(extra_column.getColumnDesc())
- # add extra columns
- data_desc += self._extrainfodesc
- data_desc.append(ColumnDesc(name='timestamp', label='dt', dtype='float64'))
-
- env['datadesc'] = data_desc
-
- #set the data compression default
- try:
- env['DataCompressionRank'] = self.macro.getEnv('DataCompressionRank')
- except UnknownEnv:
- env['DataCompressionRank'] = -1
-
- #set the sample information
- #@todo: use the instrument API to get this info
- try:
- env['SampleInfo'] = self.macro.getEnv('SampleInfo')
- except UnknownEnv:
- env['SampleInfo'] = {}
-
- #set the source information
- #@todo: use the instrument API to get this info
- try:
- env['SourceInfo'] = self.macro.getEnv('SourceInfo')
- except UnknownEnv:
- env['SourceInfo'] = {}
-
- #take the pre-scan snapshot
- try:
- preScanSnapShot = self.macro.getEnv('PreScanSnapshot')
- except UnknownEnv:
- preScanSnapShot = []
- env['preScanSnapShot'] = self.takeSnapshot(elements=preScanSnapShot)
-
- env['macro_id'] = self.macro.getID()
- try:
- env['ScanFile'] = self.macro.getEnv('ScanFile')
- except InterruptException:
- raise
- except:
- env['ScanFile'] = None
- try:
- env['ScanDir'] = self.macro.getEnv('ScanDir')
- except InterruptException:
- raise
- except:
- env['ScanDir'] = None
- env['estimatedtime'], env['total_scan_intervals'] = self._estimate()
- env['instrumentlist'] = self._macro.findObjs('.*', type_class=Type.Instrument)
-
- #env.update(self._getExperimentConfiguration) #add all the info from the experiment configuration to the environment
- env.update(additional_env)
- self._env = env
-
- # Give the environment to the ScanData
- self.data.setEnviron(env)
-
- def takeSnapshot(self, elements=[]):
- '''reads the current values of the given elements
-
- :param elements: (list<str,str>) list of tuples of label,src for the elements to read
- (can be pool elements or Taurus attribute names).
-
- :return: (list<ColumnDesc>) a list of :class:`ColumnDesc`, each including a
- "pre_scan_value" attribute with the read value for that attr
- '''
- manager = self.macro.getManager()
- all_elements_info = manager.get_elements_with_interface('Element')
- ret = []
- for src, label in elements:
- try:
- if src in all_elements_info:
- ei = all_elements_info[src]
- column = ColumnDesc(name=ei.full_name,
- label=label,
- instrument=ei.instrument,
- source=ei.source)
- else:
- column = ColumnDesc(name=src,
- label=label,
- source=src)
-
- v = PyTango.AttributeProxy(column.source).read().value #@Fixme: Tango-centric. It should work for any Taurus Attribute
- column.pre_scan_value = v
- column.shape = np.shape(v)
- column.dtype = getattr(v, 'dtype', np.dtype(type(v))).name
- ret.append(column)
- except:
- self.macro.warning('Error taking pre-scan snapshot of %s (%s)', label, src)
- self.debug('Details:', exc_info=1)
- return ret
-
- def get_virtual_motors(self):
- ret = []
- for moveable in self.moveables:
- try:
- v_motor = VMotor.fromMotor(moveable.moveable)
- except:
- #self.debug("Details:", exc_info=1)
- v_motor = VMotor(min_vel=0, max_vel=float('+inf'),
- accel_time=0, decel_time=0)
- ret.append(v_motor)
- return ret
-
- MAX_ITER = 100000
-
- def _estimate(self, max_iter=None):
- with_time = hasattr(self.macro, "getTimeEstimation")
- with_interval = hasattr(self.macro, "getIntervalEstimation")
- if with_time and with_interval:
- t, i = self.macro.getTimeEstimation(), self.macro.getIntervalEstimation()
- return t, i
-
- max_iter = max_iter or self.MAX_ITER
- iterator = self.generator()
- total_time = 0.0
- interval_nb = 0
- try:
- if not with_time:
- start_pos = self.motion.readPosition(force=True)
- v_motors = self.get_virtual_motors()
- motion_time, acq_time = 0.0, 0.0
- while interval_nb < max_iter:
- step = iterator.next()
- end_pos = step['positions']
- max_path_duration = 0.0
- for v_motor, start, stop in zip(v_motors, start_pos, end_pos):
- path = MotionPath(v_motor, start, stop)
- max_path_duration = max(max_path_duration, path.duration)
- integ_time = step.get("integ_time", 0.0)
- acq_time += integ_time
- motion_time += max_path_duration
- total_time += integ_time + max_path_duration
- interval_nb += 1
- start_pos = end_pos
- if with_interval:
- interval_nb = self.macro.getIntervalEstimation()
- else:
- while interval_nb < max_iter:
- step = iterator.next()
- interval_nb += 1
- total_time = self.macro.getTimeEstimation()
- except StopIteration:
- return total_time, interval_nb
- # max iteration reached.
- return -total_time, -interval_nb
-
- @property
- def data(self):
- return self._data
-
- @property
- def macro(self):
- return self._macro
-
- @property
- def measurement_group(self):
- return self._measurement_group
-
- @property
- def generator(self):
- return self._generator
-
- @property
- def motion(self):
- return self._motion
-
- @property
- def moveables(self):
- return self._moveables
-
- @property
- def steps(self):
- if not hasattr(self, '_steps'):
- self._steps = enumerate(self.generator())
- return self._steps
-
- def start(self):
- self.do_backup()
- env = self._env
- env['startts'] = ts = time.time()
- env['starttime'] = datetime.datetime.fromtimestamp(ts)
- env['acqtime'] = 0
- env['motiontime'] = 0
- env['deadtime'] = 0
- self.data.start()
-
- def end(self):
- env = self._env
- env['endts'] = end_ts = time.time()
- env['endtime'] = datetime.datetime.fromtimestamp(end_ts)
- total_time = end_ts - env['startts']
- estimated = env['estimatedtime']
- acq_time = env['acqtime']
- #env['deadtime'] = 100.0 * (total_time - estimated) / total_time
-
- env['deadtime'] = total_time - acq_time
- if 'delaytime' in env:
- env['motiontime'] = total_time - acq_time - env['delaytime']
- elif 'motiontime' in env:
- env['delaytime'] = total_time - acq_time - env['motiontime']
-
- self.data.end()
- try:
- scan_history = self.macro.getEnv('ScanHistory')
- except UnknownEnv:
- scan_history = []
-
- scan_file = env['ScanFile']
- if isinstance(scan_file, (str, unicode)):
- scan_file = scan_file,
-
- names = [ col.name for col in env['datadesc'] ]
- history = dict(startts=env['startts'], endts=env['endts'],
- estimatedtime=env['estimatedtime'],
- deadtime=env['deadtime'], title=env['title'],
- serialno=env['serialno'], user=env['user'],
- ScanFile=scan_file, ScanDir=env['ScanDir'],
- channels=names)
- scan_history.append(history)
- while len(scan_history) > self.MAX_SCAN_HISTORY:
- scan_history.pop(0)
- self.macro.setEnv('ScanHistory', scan_history)
-
- def scan(self):
- for _ in self.step_scan():
- pass
-
- def step_scan(self):
- self.start()
- try:
- ex = None
- try:
- for i in self.scan_loop():
- self.macro.pausePoint()
- yield i
- except ScanException, e:
- #self.macro.warning(e.msg)
- ex = e
- self.end()
- if not ex is None: raise e
- finally:
- self.do_restore()
-
- def scan_loop(self):
- raise NotImplementedError('Scan method cannot be called by '
- 'abstract class')
-
- def do_backup(self):
- try:
- if hasattr(self.macro, 'do_backup'):
- self.macro.do_backup()
- except:
- self.macro.warning("Failed to execute macro 'do_backup'")
- self.debug("Details:", exc_info=1)
-
- def do_restore(self):
- try:
- if hasattr(self.macro, 'do_restore'):
- self.macro.do_restore()
- except:
- self.macro.warning("Failed to execute macro 'do_restore'")
- self.debug("Details:", exc_info=1)
-
-
-class SScan(GScan):
- """Step scan"""
-
- def scan_loop(self):
- lstep = None
- macro = self.macro
- scream = False
-
- if hasattr(macro, "nr_points"):
- nr_points = float(macro.nr_points)
- scream = True
- else:
- yield 0.0
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('pre-scan'):
- hook()
-
- self._sum_motion_time = 0
- self._sum_acq_time = 0
-
- for i, step in self.steps:
- # allow scan to be stopped between points
- macro.checkPoint()
- self.stepUp(i, step, lstep)
- lstep = step
- if scream:
- yield ((i + 1) / nr_points) * 100.0
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('post-scan'):
- hook()
-
- if not scream:
- yield 100.0
-
- self._env['motiontime'] = self._sum_motion_time
- self._env['acqtime'] = self._sum_acq_time
-
- def stepUp(self, n, step, lstep):
- motion, mg = self.motion, self.measurement_group
- startts = self._env['startts']
-
- #pre-move hooks
- for hook in step.get('pre-move-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- # Move
- self.debug("[START] motion")
- move_start_time = time.time()
- try:
- state, positions = motion.move(step['positions'])
- self._sum_motion_time += time.time() - move_start_time
- except InterruptException:
- raise
- except:
- self.dump_information(n, step)
- raise
- self.debug("[ END ] motion")
-
- curr_time = time.time()
- dt = curr_time - startts
-
- #post-move hooks
- for hook in step.get('post-move-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- # allow scan to be stopped between motion and data acquisition
- self.macro.checkPoint()
-
- if state != Ready:
- self.dump_information(n, step)
- m = "Scan aborted after problematic motion: " \
- "Motion ended with %s\n" % str(state)
- raise ScanException({ 'msg' : m })
-
- #pre-acq hooks
- for hook in step.get('pre-acq-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except: pass
-
- integ_time = step['integ_time']
- # Acquire data
- self.debug("[START] acquisition")
- state, data_line = mg.count(integ_time)
- for ec in self._extra_columns:
- data_line[ec.getName()] = ec.read()
- self.debug("[ END ] acquisition")
- self._sum_acq_time += integ_time
-
- #post-acq hooks
- for hook in step.get('post-acq-hooks', ()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- #hooks for backwards compatibility:
- if step.has_key('hooks'):
- self.macro.info('Deprecation warning: you should use '
- '"post-acq-hooks" instead of "hooks" in the step '
- 'generator')
- for hook in step.get('hooks', ()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- # Add final moveable positions
- data_line['point_nb'] = n
- data_line['timestamp'] = dt
- for i, m in enumerate(self.moveables):
- data_line[m.moveable.getName()] = positions[i]
-
- #Add extra data coming in the step['extrainfo'] dictionary
- if step.has_key('extrainfo'): data_line.update(step['extrainfo'])
-
- self.data.addRecord(data_line)
-
- #post-step hooks
- for hook in step.get('post-step-hooks', ()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- def dump_information(self, n, step):
- moveables = self.motion.moveable_list
- msg = ["Report: Stopped at step #" + str(n) + " with:"]
- for moveable in moveables:
- msg.append(moveable.information())
- self.macro.info("\n".join(msg))
-
-
-class CScan(GScan):
- """Continuous scan abstract class. Implements helper methods."""
-
- def __init__(self, macro, generator=None, moveables=[],
- env={}, constraints=[], extrainfodesc=[]):
- GScan.__init__(self, macro, generator=generator,
- moveables=moveables, env=env, constraints=constraints,
- extrainfodesc=extrainfodesc)
- self._current_waypoint_finished = False
- self._all_waypoints_finished = False
- self.motion_event = threading.Event()
- self.motion_end_event = threading.Event()
- data_structures = self.populate_moveables_data_structures(moveables)
- self._moveables_trees, \
- physical_moveables_names, \
- self._physical_moveables = data_structures
- self._physical_motion = self.macro.getMotion(physical_moveables_names)
-
- def populate_moveables_data_structures(self, moveables):
- '''Populates moveables data structures.
- :param moveables: (list<Moveable>) data structures will be generated
- for these moveables
- :return (moveable_trees, physical_moveables_names, physical_moveables)
- - moveable_trees (list<Tree>) - each tree represent one Moveables
- with its hierarchy of inferior moveables.
- - physical_moveables_names (list<str> - list of the names of the
- physical moveables. List order is important and preserved.
- - physical_moveables (list<Moveable> - list of the moveable objects.
- List order is important and preserved.'''
-
- def generate_moveable_node(macro, moveable):
- '''Function to generate a moveable data structures based on moveable object.
- Internally can be recursively called if moveable is a PseudoMotor.
- :param moveable: moveable object
- :return (moveable_node, physical_moveables_names, physical_moveables)
- - moveable_node (BaseNode) - can be a BranchNode if moveable is a PseudoMotor
- or a LeafNode if moveable is a PhysicalMotor.
- - physical_moveables_names (list<str> - list of the names of the
- physical moveables. List order is important and preserved.
- - physical_moveables (list<Moveable> - list of the moveable objects.
- List order is important and preserved.'''
- moveable_node = None
- physical_moveables_names = []
- physical_moveables = []
- moveable_type = moveable.getType()
- if moveable_type == "PseudoMotor":
- moveable_node = BranchNode(moveable)
- moveables_names = moveable.elements
- sub_moveables = [macro.getMoveable(name) \
- for name in moveables_names]
- for sub_moveable in sub_moveables:
- sub_moveable_node, \
- _physical_moveables_names, \
- _physical_moveables = generate_moveable_node(macro,
- sub_moveable)
- physical_moveables_names += _physical_moveables_names
- physical_moveables += _physical_moveables
- moveable_node.addChild(sub_moveable_node)
- elif moveable_type == "Motor":
- moveable_node = LeafNode(moveable)
- moveable_name = moveable.getName()
- physical_moveables_names.append(moveable_name)
- physical_moveables.append(moveable)
- return moveable_node, physical_moveables_names, physical_moveables
-
- moveable_trees = []
- physical_moveables_names = []
- physical_moveables = []
-
- for moveable in moveables:
- moveable_root_node, _physical_moveables_names, _physical_moveables = \
- generate_moveable_node(self.macro, moveable.moveable)
- moveable_tree = Tree(moveable_root_node)
- moveable_trees.append(moveable_tree)
- physical_moveables_names += _physical_moveables_names
- physical_moveables += _physical_moveables
- return moveable_trees, physical_moveables_names, physical_moveables
-
- def get_moveables_trees(self):
- '''Returns reference to the list of the moveables trees'''
- return self._moveables_trees
-
- def on_waypoints_end(self, restore_positions=None):
- """To be called by the waypoint thread to handle the end of waypoints
- (either because no more waypoints or because a macro abort was
- triggered)"""
- self.set_all_waypoints_finished(True)
- if restore_positions is not None:
- self._setFastMotions()
- self.macro.info("Correcting overshoot...")
- self._physical_motion.move(restore_positions)
- #self.motion.move(restore_positions)
- self.do_restore()
- self.motion_end_event.set()
- self.motion_event.set()
-
- def go_through_waypoints(self, iterate_only=False):
- """Go through the different waypoints."""
- try:
- self._go_through_waypoints()
- except:
- self.macro.error("An error occured moving to waypoints. Aborting...")
- self.macro.debug("Details:", exc_info=1)
- self.on_waypoints_end()
-
- def _go_through_waypoints(self):
- """Internal, unprotected method to go through the different waypoints."""
- raise NotImplementedError("_go_through_waypoints must be implemented " +
- "in CScan derived classes")
-
- def waypoint_estimation(self):
- """Internal, unprotected method to go through the different waypoints."""
- motion, waypoints = self.motion, self.generator()
- total_duration = 0
- #v_motors = self.get_virtual_motors()
- curr_positions, last_end_positions = motion.readPosition(force=True), None
- for i, waypoint in enumerate(waypoints):
- start_positions = waypoint.get('start_positions', last_end_positions)
- positions = waypoint['positions']
- if start_positions is None:
- last_end_positions = positions
- continue
-
- waypoint_info = self.prepare_waypoint(waypoint, start_positions,
- iterate_only=True)
- motion_paths, delta_start, acq_duration = waypoint_info
-
- start_path, end_path = [] , []
- for path in motion_paths:
- start_path.append(path.initial_user_pos)
- end_path.append(path.final_user_pos)
-
- # move from last waypoint to start position of this waypoint
- first_duration = 0
- if i == 1:
- # first waypoint means, moving from current position to the
- # start of first waypoint
- initial = curr_positions
- else:
- initial = start_positions
- for _path, start, end in zip(motion_paths, initial, start_path):
- v_motor = _path.motor
- path = MotionPath(v_motor, start, end)
- first_duration = max(first_duration, path.duration)
-
- # move from waypoint start position to waypoint end position
- second_duration = 0
- for _path, start, end in zip(motion_paths, start_path, end_path):
- v_motor = _path.motor
- path = MotionPath(v_motor, start, end)
- second_duration = max(second_duration, path.duration)
-
- total_duration += first_duration + second_duration
-
- last_end_positions = end_path
-
- # add correct overshoot time
- overshoot_duration = 0
- for _path, start, end in zip(motion_paths, last_end_positions, positions):
- v_motor = _path.motor
- path = MotionPath(v_motor, start, end)
- overshoot_duration = max(overshoot_duration, path.duration)
-
- total_duration += overshoot_duration
- return total_duration
-
- def prepare_waypoint(self, waypoint, start_positions, iterate_only=False):
- raise NotImplementedError("prepare_waypoint must be implemented in " +
- "CScan derived classes")
-
- def set_all_waypoints_finished(self, v):
- self._all_waypoints_finished = v
-
- def do_backup(self):
- super(CScan, self).do_backup()
- self._backup = backup = []
- for moveable in self._physical_moveables:
- # first backup all motor parameters
- motor = moveable
- try:
- velocity = motor.getVelocity()
- accel_time = motor.getAcceleration()
- decel_time = motor.getDeceleration()
- motor_backup = dict(moveable=moveable, velocity=velocity,
- acceleration=accel_time,
- deceleration=decel_time)
- self.debug("Backup of %s", motor)
- except AttributeError:
- motor_backup = None
- backup.append(motor_backup)
-
- def do_restore(self):
- super(CScan, self).do_restore()
- # restore changed motors to initial state
- for motor_backup in self._backup:
- if motor_backup is None:
- continue
- try:
- motor = motor_backup['moveable']
- motor.setVelocity(motor_backup['velocity'])
- motor.setAcceleration(motor_backup['acceleration'])
- motor.setDeceleration(motor_backup['deceleration'])
- self.debug("Restored %s", motor)
- except:
- self.macro.warning("Failed to restore %s", motor)
- self.debug("Details:", exc_info=1)
-
- def _setFastMotions(self, motors=None):
- '''make given motors go at their max speed and accel'''
- if motors is None:
- motors = [b.get('moveable') for b in self._backup if b is not None]
-
- for motor in motors:
- try:
- motor.setVelocity(self.get_max_top_velocity(motor))
- motor.setAcceleration(self.get_min_acc_time(motor))
- motor.setDeceleration(self.get_min_dec_time(motor))
- self.debug("%s put into fast motion", motor)
- except:
- self.macro.warning("Failed to put %s into fast motion", motor)
- self.debug("Details:", exc_info=1)
-
- def get_max_top_velocity(self, motor):
- """Helper method to find the maximum top velocity for the motor.
- If the motor doesn't have a defined range for top velocity,
- then use the current top velocity"""
-
- top_vel_obj = motor.getVelocityObj()
- min_top_vel, max_top_vel = top_vel_obj.getRange()
- try:
- max_top_vel = float(max_top_vel)
- except ValueError:
- try:
- #hack to avoid recursive velocity reduction
- self._maxVelDict = getattr(self,'_maxVelDict',{})
- if not motor in self._maxVelDict:
- self._maxVelDict[motor] = motor.getVelocity()
- max_top_vel = self._maxVelDict[motor]
- except AttributeError:
- pass
- return max_top_vel
-
- def get_min_acc_time(self, motor):
- """Helper method to find the minimum acceleration time for the motor.
- If the motor doesn't have a defined range for the acceleration time,
- then use the current acceleration time"""
-
- acc_time_obj = motor.getAccelerationObj()
- min_acc_time, max_acc_time = acc_time_obj.getRange()
- try:
- min_acc_time = float(min_acc_time)
- except ValueError:
- min_acc_time = motor.getAcceleration()
- return min_acc_time
-
- def get_min_dec_time(self, motor):
- """Helper method to find the minimum deceleration time for the motor.
- If the motor doesn't have a defined range for the acceleration time,
- then use the current acceleration time"""
-
- dec_time_obj = motor.getDecelerationObj()
- min_dec_time, max_dec_time = dec_time_obj.getRange()
- try:
- min_dec_time = float(min_dec_time)
- except ValueError:
- min_dec_time = motor.getDeceleration()
- return min_dec_time
-
- def set_max_top_velocity(self, motor):
- """Helper method to set the maximum top velocity for the motor to
- its maximum allowed limit."""
-
- v = self.get_max_top_velocity(motor)
- try:
- motor.setVelocity(v)
- except:
- pass
-
-
-class CSScan(CScan):
- """Continuous scan controlled by software"""
-
- def __init__(self, macro, waypointGenerator=None, periodGenerator=None,
- moveables=[], env={}, constraints=[], extrainfodesc=[]):
- CScan.__init__(self, macro, generator=waypointGenerator,
- moveables=moveables, env=env, constraints=constraints,
- extrainfodesc=extrainfodesc)
- self._periodGenerator = periodGenerator
-
-
- def _calculateTotalAcquisitionTime(self):
- return None
-
- @property
- def period_generator(self):
- return self._periodGenerator
-
- @property
- def period_steps(self):
- if not hasattr(self, '_period_steps'):
- self._period_steps = enumerate(self.period_generator())
- return self._period_steps
-
- def prepare_waypoint(self, waypoint, start_positions, iterate_only=False):
- slow_down = waypoint.get('slow_down', 1)
- positions = waypoint['positions']
-
- duration, cruise_duration, delta_start = 0, 0, 0
- ideal_paths, real_paths = [], []
- for i, (moveable, position) in enumerate(zip(self.moveables, positions)):
- motor = moveable.moveable
-
- coordinate = True
- try:
- base_vel, top_vel = motor.getBaseRate(), motor.getVelocity()
- accel_time, decel_time = motor.getAcceleration(), motor.getDeceleration()
-
- if slow_down > 0:
- # find and set the maximum top velocity for the motor.
- # If the motor doesn't have a defined range for top velocity,
- # then use the current top velocity
- max_top_vel = self.get_max_top_velocity(motor)
- if not iterate_only:
- motor.setVelocity(max_top_vel)
- else:
- max_top_vel = top_vel
- except AttributeError:
- if not iterate_only:
- self.macro.warning("%s motion will not be coordinated", motor)
- base_vel, top_vel, max_top_vel = 0, float('+inf'), float('+inf')
- accel_time, decel_time = 0, 0
- coordinate = False
-
- last_user_pos = start_positions[i]
-
- real_vmotor = VMotor(min_vel=base_vel, max_vel=max_top_vel,
- accel_time=accel_time,
- decel_time=decel_time)
- real_path = MotionPath(real_vmotor, last_user_pos, position)
- real_path.moveable = moveable
- real_path.apply_correction = coordinate
-
- # Find the cruise duration of motion at top velocity. For this create a
- # virtual motor which has instantaneous acceleration and deceleration
- ideal_vmotor = VMotor(min_vel=base_vel, max_vel=max_top_vel,
- accel_time=0, decel_time=0)
-
- # create a path which will tell us which is the cruise duration of this
- # motion at top velocity
- ideal_path = MotionPath(ideal_vmotor, last_user_pos, position)
- ideal_path.moveable = moveable
- ideal_path.apply_correction = coordinate
-
- # if really motor is moving in this waypoint
- if ideal_path.displacement > 0:
- # recalculate time to reach maximum velocity
- delta_start = max(delta_start, accel_time)
-
- # recalculate cruise duration of motion at top velocity
- cruise_duration = max(cruise_duration, ideal_path.duration)
- duration = max(duration, real_path.duration)
-
- ideal_paths.append(ideal_path)
- real_paths.append(real_path)
-
- if slow_down <= 0:
- return real_paths, 0, duration
-
- # after finding the duration, introduce the slow down factor added
- # by the user
- cruise_duration /= slow_down
-
- if cruise_duration == 0:
- cruise_duration = float('+inf')
-
- # now that we have the appropriate top velocity for all motors, the
- # cruise duration of motion at top velocity, and the time it takes to
- # recalculate
- for path in ideal_paths:
- vmotor = path.motor
- # in the case of pseudo motors or not moving a motor...
- if not path.apply_correction or path.displacement == 0:
- continue
- moveable = path.moveable
- motor = moveable.moveable
- new_top_vel = path.displacement / cruise_duration
- vmotor.setMaxVelocity(new_top_vel)
- accel_t, decel_t = motor.getAcceleration(), motor.getDeceleration()
- base_vel = vmotor.getMinVelocity()
- vmotor.setAccelerationTime(accel_t)
- vmotor.setDecelerationTime(decel_t)
- disp_sign = path.positive_displacement and 1 or -1
- new_initial_pos = path.initial_user_pos - accel_t * 0.5 * disp_sign * (new_top_vel + base_vel) - disp_sign * new_top_vel * (delta_start - accel_t)
- path.setInitialUserPos(new_initial_pos)
- new_final_pos = path.final_user_pos + disp_sign * vmotor.displacement_reach_min_vel
- path.setFinalUserPos(new_final_pos)
-
- return ideal_paths, delta_start, cruise_duration
-
-
- def go_through_waypoints(self, iterate_only=False):
- """go through the different waypoints."""
- try:
- self._go_through_waypoints()
- except Exception, e:
- self.macro.error("An error occured moving to waypoints. Aborting...")
- self.macro.debug("Details:", exc_info=1)
- self.on_waypoints_end()
- raise e
-
- def _go_through_waypoints(self):
- """Internal, unprotected method to go through the different waypoints."""
- macro, motion, waypoints = self.macro, self.motion, self.steps
- self.macro.debug("_go_through_waypoints() entering...")
-
- last_positions = None
- for _, waypoint in waypoints:
- self.macro.debug("Waypoint iteration...")
- start_positions = waypoint.get('start_positions')
- positions = waypoint['positions']
- if start_positions is None:
- start_positions = last_positions
- if start_positions is None:
- last_positions = positions
- continue
-
- waypoint_info = self.prepare_waypoint(waypoint, start_positions)
- motion_paths, delta_start, acq_duration = waypoint_info
-
- self.acq_duration = acq_duration
-
- #execute pre-move hooks
- for hook in waypoint.get('pre-move-hooks',[]):
- hook()
-
- start_pos, final_pos = [] , []
- for path in motion_paths:
- start_pos.append(path.initial_user_pos)
- final_pos.append(path.final_user_pos)
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- # move to start position
- self.macro.debug("Moving to start position: %s" % repr(start_pos))
- motion.move(start_pos)
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- # prepare motor(s) with the velocity required for synchronization
- for path in motion_paths:
- if not path.apply_correction:
- continue
- vmotor = path.motor
- motor = path.moveable.moveable
- motor.setVelocity(vmotor.getMaxVelocity())
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- self.timestamp_to_start = time.time() + delta_start
- self.motion_event.set()
-
- # move to waypoint end position
- motion.move(final_pos)
-
- self.motion_event.clear()
-
- if macro.isStopped():
- return self.on_waypoints_end()
-
- #execute post-move hooks
- for hook in waypoint.get('post-move-hooks',[]):
- hook()
-
- if start_positions is None:
- last_positions = positions
-
- self.on_waypoints_end(positions)
-
-
- def scan_loop(self):
- motion, mg, waypoints = self.motion, self.measurement_group, self.steps
- macro = self.macro
- manager = macro.getManager()
- scream = False
- motion_event = self.motion_event
- startts = self._env['startts']
-
- sum_delay = 0
- sum_integ_time = 0
-
- if hasattr(macro, "nr_points"):
- nr_points = float(macro.nr_points)
- scream = True
- else:
- yield 0.0
-
- moveables = [ m.moveable for m in self.moveables ]
- period_steps = self.period_steps
- point_nb, step = -1, None
- data = self.data
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('pre-scan'):
- hook()
-
- # start move & acquisition as close as possible
- # from this point on synchronization becomes critical
- manager.add_job(self.go_through_waypoints)
-
- while not self._all_waypoints_finished:
-
- # wait for motor to reach start position
- motion_event.wait()
-
- # allow scan to stop
- macro.checkPoint()
-
- if self._all_waypoints_finished:
- break
-
- # wait for motor to reach max velocity
- start_time = time.time()
- deltat = self.timestamp_to_start - start_time
- if deltat > 0:
- time.sleep(deltat)
- curr_time = acq_start_time = time.time()
- integ_time = 0
-
- # Acquisition loop: acquire consecutively until waypoint asks to
- # stop or we see that we will enter deceleration time in next
- # acquisition
- while motion_event.is_set():
-
- # allow scan to stop
- macro.checkPoint()
-
- try:
- point_nb, step = period_steps.next()
- except StopIteration:
- self._all_waypoints_finished = True
- break
-
- integ_time = step['integ_time']
-
- # If there is no more time to acquire... stop!
- elapsed_time = time.time() - acq_start_time
- if elapsed_time + integ_time > self.acq_duration:
- motion_event.clear()
- break;
-
- #pre-acq hooks
- for hook in step.get('pre-acq-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- self._all_waypoints_finished = True
- raise
- except: pass
-
- # allow scan to stop
- macro.checkPoint()
-
- positions = motion.readPosition(force=True)
-
- dt = time.time() - startts
-
- # Acquire data
- self.debug("[START] acquisition")
- state, data_line = mg.count(integ_time)
-
- sum_integ_time += integ_time
-
- # allow scan to stop
- macro.checkPoint()
-
- # After acquisition, test if we are asked to stop, probably because
- # the motor are stopped. In this case discard the last acquisition
- if not self._all_waypoints_finished:
- for ec in self._extra_columns:
- data_line[ec.getName()] = ec.read()
- self.debug("[ END ] acquisition")
-
- #post-acq hooks
- for hook in step.get('post-acq-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- self._all_waypoints_finished = True
- raise
- except:
- pass
-
- # Add final moveable positions
- data_line['point_nb'] = point_nb
- data_line['timestamp'] = dt
- for i, m in enumerate(self.moveables):
- data_line[m.moveable.getName()] = positions[i]
-
- #Add extra data coming in the step['extrainfo'] dictionary
- if step.has_key('extrainfo'): data_line.update(step['extrainfo'])
-
- self.data.addRecord(data_line)
-
- if scream:
- yield ((point_nb + 1) / nr_points) * 100.0
- else:
- break
- old_curr_time = curr_time
- curr_time = time.time()
- sum_delay += (curr_time - old_curr_time) - integ_time
-
- self.motion_end_event.wait()
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('post-scan'):
- hook()
-
-
- env = self._env
- env['acqtime'] = sum_integ_time
- env['delaytime'] = sum_delay
-
- if not scream:
- yield 100.0
-
-
-class CTScan(CScan):
- '''Continuous scan controlled by hardware trigger signals.
- Sequence of trigger signals is programmed in time. '''
-
- class ExtraTrigger:
- '''Helper class and temporary solution for configuring trigger device.
- It is used to configure any Tango device name implementing:
- +) following attributes:
- - InitialDelayTime [s] - delay time from calling Start to generating first pulse
- - HighTime [s] - time interval while signal will maintain its high state
- - LowTime [s] - time interval while signal will maintain its low state
- - SampPerChan - nr of pulses to be generated
- - IdleState - state (high or low) which signal will take after the Start command
- and which will maintain during the InitialDelayTime.
- +) following commands:
- - Start
- - Stop)'''
-
- MIN_HIGH_TIME = 0.0000002
- MIN_TIME_PER_TRIGGER = 0.000001
-
- def __init__(self, macro):
- self.macro = macro
-
- triggerDeviceName = self.macro.getEnv("TriggerDevice")
- self.master = None
- self.slaves = []
- masterName = None
- slaveNames = []
-
- if isinstance(triggerDeviceName, str):
- masterName = triggerDeviceName
- elif isinstance(triggerDeviceName, list):
- masterName = triggerDeviceName[0]
- slaveNames = triggerDeviceName[1:]
-
- for name in slaveNames:
- slave = PyTango.DeviceProxy(name)
- self.slaves.append(slave)
- if masterName != None:
- self.master = PyTango.DeviceProxy(masterName)
-
- def configure(self, scanTime=None, nrOfTriggers=None, idleState="Low", lowTime=None, highTime=None, delayTime=0):
- if not None in (scanTime, nrOfTriggers, delayTime, idleState):
- timePerTrigger = scanTime / nrOfTriggers
- if timePerTrigger < self.MIN_TIME_PER_TRIGGER:
- raise Exception("scanTime is not long enough to manage this amount of triggers")
- highTime = self.MIN_HIGH_TIME
- lowTime = timePerTrigger - highTime
- elif not None in (lowTime, highTime, delayTime, nrOfTriggers, idleState):
- pass
- else:
- raise Exception("Missing parameters.")
-
- self.master.write_attribute("InitialDelayTime", delayTime)
- self.master.write_attribute("HighTime", highTime) # 162.5 ns
- self.master.write_attribute("LowTime", lowTime) # 2.75 ms
- self.master.write_attribute("SampPerChan", long(nrOfTriggers))
- self.master.write_attribute("IdleState", idleState)
- self.master.write_attribute("SampleTimingType", "Implicit")
-
- for slave in self.slaves:
- slave.write_attribute("HighTime", highTime) # 162.5 ns
- slave.write_attribute("LowTime", lowTime) # 2.75 ms
- slave.write_attribute("SampPerChan", long(nrOfTriggers))
- slave.write_attribute("IdleState", idleState)
- slave.write_attribute("SampleTimingType", "Implicit")
-
- return timePerTrigger
-
- def getConfiguration(self):
- return None, None, None, None
-
- def start(self):
- for slave in self.slaves:
- self.macro.debug("Staring %s" % slave.name())
- slave.Start()
- if self.master != None:
- self.master.Start()
-
- def stop(self):
- for slave in self.slaves:
- self.macro.debug("Stopping %s" % slave.name())
- slave.Stop()
- if self.master != None:
- self.master.Stop()
-
-
- class ExtraMntGrp:
- '''Helper class and temporary solution for configuring experimental channels.
- It assumes that experimental channels are implementing:
- +) following attributes:
- - Data - an array of acquired data
- - TriggerMode - Soft or Gate - to configure/unconfigure channel for hardware trigger
- - NrOfTriggers - to specify how many hardware triggers and acquistions will be done
- - SamplingFrequency - have sence only for sampling experimental channels
- +) following SendToCtrl strings:
- - "pre-start"
- - "start"
- - "pre-stop"
- - "stop"'''
-
- def __init__(self, macro):
- self.macro = macro
- activeMntGrpName = self.macro.getEnv("ActiveMntGrp")
- self.mntGrp = self.macro.getMeasurementGroup(activeMntGrpName)
- self.activeChannels = []
- self.nrOfTriggers = 0
- channels = self.mntGrp.getChannels()
- for channel in channels:
- channelName = channel["name"]
- expChannel = self.macro.getExpChannel(channelName)
- expChannel.getHWObj().set_timeout_millis(120000) #in case of readout of position channels, it can take really long...
- self.activeChannels.append(expChannel)
-
- def isMoving(self):
- for channel in self.activeChannels:
- if channel.State() == PyTango.DevState.MOVING:
- return True
- return False
-
- def start(self):
- for channel in self.activeChannels:
- pool = channel.getPoolObj()
- ctrlName = channel.getControllerName()
- axis = channel.getAxis()
- self.macro.debug("Pre-starting controller: %s, axis: %d", ctrlName, axis)
- pool.SendToController([ctrlName, 'pre-start %d' % axis])
-
- for channel in self.activeChannels:
- pool = channel.getPoolObj()
- ctrlName = channel.getControllerName()
- axis = channel.getAxis()
- self.macro.debug("Starting controller: %s, axis: %d", ctrlName, axis)
- pool.SendToController([ctrlName, 'start %d' % axis])
-
- def stop(self):
- for channel in self.activeChannels:
- pool = channel.getPoolObj()
- ctrlName = channel.getControllerName()
- axis = channel.getAxis()
- self.macro.debug("Pre-stopping controller: %s, axis: %d", ctrlName, axis)
- pool.SendToController([ctrlName, 'pre-stop %d' % axis])
-
- for channel in self.activeChannels:
- pool = channel.getPoolObj()
- ctrlName = channel.getControllerName()
- axis = channel.getAxis()
- self.macro.debug("Stopping controller: %s, axis: %d", ctrlName, axis)
- pool.SendToController([ctrlName, 'stop %d' % axis])
-
- def getDataList(self):
- dataList = [ {"point_nb" : i, "timestamp" : 0} for i in xrange(self.nrOfTriggers) ]
- for channel in self.activeChannels:
- dataDesc = channel.getFullName()
- channelData = channel.getAttribute("Data").read().value
- for i, data in enumerate(channelData):
- dataList[i][dataDesc] = data
- return dataList
-
- def setSamplingFrequency(self, freq):
- for channel in self.activeChannels:
- channel.getAttribute('SamplingFrequency').write(freq)
-
- def setAcquisitionTime(self, acqTime):
- for channel in self.activeChannels:
- channel.getAttribute('AcquisitionTime').write(acqTime)
-
- def setTriggerMode(self, mode):
- if mode not in ["soft", "gate"]:
- raise Exception("Trigger mode must be either soft or gate.")
- for channel in self.activeChannels:
- channel.getAttribute('TriggerMode').write(mode)
-
- def setNrOfTriggers(self, nrOfTriggers):
- self.nrOfTriggers = nrOfTriggers
- for channel in self.activeChannels:
- channel.getAttribute('NrOfTriggers').write(nrOfTriggers)
-
- def configure(self, nrOfTriggers, acqTime, timePerTrigger, sampFreq=-1, triggerMode="gate"):
- self.macro.debug("acqTime: %s" % acqTime)
- if timePerTrigger == None:
- raise Exception("TimePerTrigger attribute must be set")
- acqTime = timePerTrigger * acqTime / 100.0
- self.setTriggerMode(triggerMode)
- self.setNrOfTriggers(nrOfTriggers)
- self.setSamplingFrequency(sampFreq)
- self.setAcquisitionTime(acqTime)
- self.macro.debug("MG: nrOfTriggers: %s, timePerTrigger: %s, acqTime: %s, sampFreq: %s" % (nrOfTriggers,timePerTrigger,acqTime,sampFreq))
-
- def getConfiguration(self):
- return None
-
- def setConfiguration(self, configuration):
- pass
-
- def __init__(self, macro, generator=None,
- moveables=[], env={}, constraints=[], extrainfodesc=[]):
- CScan.__init__(self, macro, generator=generator,
- moveables=moveables, env=env, constraints=constraints,
- extrainfodesc=extrainfodesc)
- self._measurement_group = self.ExtraMntGrp(macro)
- self.extraTrigger = self.ExtraTrigger(macro)
-
- def prepare_waypoint(self, waypoint, start_positions, iterate_only=False):
- '''Prepare list of MotionPath objects per each physical motor.
- :param waypoint: (dict) waypoint dictionary with necessary information
- :param start_positions: (list<float>) list of starting position per each
- physical motor
- :return (ideal_paths, acc_time, active_time)
- - ideal_paths: (list<MotionPath> representing motion attributes
- of each physical motor)
- - acc_time: acceleration time which will be used during the scan
- it corresponds to the longest acceleration time of
- all the motors
- - active_time: time interval while all the physical motors will
- maintain constant velocity'''
-
- positions = waypoint['positions']
- active_time = waypoint["active_time"]
-
- ideal_paths = []
-
- max_acc_time, max_dec_time = 0, 0
- for moveable, end_position in zip(self._physical_moveables, positions):
- motor = moveable
- self.macro.debug("Motor: %s" % motor.getName())
- self.macro.debug("AccTime: %f" % self.get_min_acc_time(motor))
- self.macro.debug("DecTime: %f" % self.get_min_dec_time(motor))
- max_acc_time = max(self.get_min_acc_time(motor), max_acc_time)
- max_dec_time = max(self.get_min_dec_time(motor), max_dec_time)
-
- acc_time = max_acc_time
- dec_time = max_dec_time
-
- for moveable, start_position, end_position in \
- zip(self._physical_moveables, start_positions, positions):
- base_vel = moveable.getBaseRate()
- ideal_vmotor = VMotor(accel_time=acc_time,
- decel_time=dec_time,
- min_vel=base_vel)
- ideal_path = MotionPath(ideal_vmotor,
- start_position,
- end_position,
- active_time)
- ideal_path.moveable = moveable
- ideal_path.apply_correction = True
- ideal_paths.append(ideal_path)
-
- return ideal_paths, acc_time, active_time
-
- def _go_through_waypoints(self):
- """Internal, unprotected method to go through the different waypoints.
- It controls all the three objects: motion, trigger and measurement
- group."""
- macro, motion, waypoints = self.macro, self._physical_motion, self.steps
- self.macro.debug("_go_through_waypoints() entering...")
-
- last_positions = None
- for _, waypoint in waypoints:
- self.macro.debug("Waypoint iteration...")
- start_positions = waypoint.get('start_positions')
- positions = waypoint['positions']
- if start_positions is None:
- start_positions = last_positions
- if start_positions is None:
- last_positions = positions
- continue
-
- waypoint_info = self.prepare_waypoint(waypoint, start_positions)
- motion_paths, delta_start, acq_duration = waypoint_info
-
- self.acq_duration = acq_duration
-
- #execute pre-move hooks
- for hook in waypoint.get('pre-move-hooks',[]):
- hook()
-
- start_pos, final_pos = [] , []
- for path in motion_paths:
- start_pos.append(path.initial_user_pos)
- final_pos.append(path.final_user_pos)
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- self.__mntGrpConfigured = False
- self.__triggerConfigured = False
- self.__mntGrpStarted = False
- self.__triggerStarted = False
-
- #validation of parameters
- for start, end in zip(self.macro.starts, self.macro.finals):
- if start == end:
- raise Exception("Start and End can not be equal.")
-
- startTimestamp = time.time()
-
- #extra pre configuration
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('pre-configuration'):
- hook()
- self.macro.checkPoint()
-
- #configuring trigger lines
- oldHighTime, oldLowTime, oldDelay, oldNrOfTriggers = \
- self.extraTrigger.getConfiguration()
- self.__triggerConfigured = True
- timePerTrigger = self.extraTrigger.configure(delayTime=delta_start,
- scanTime=acq_duration,
- nrOfTriggers=self.macro.nr_of_points)
- self.macro.checkPoint()
-
- #configuring measurementGroup
- self.mntGrpConfiguration = self._measurement_group.getConfiguration()
- self.__mntGrpConfigured = True
- self._measurement_group.configure(self.macro.nr_of_points,
- self.macro.acq_time,
- timePerTrigger)
- self.macro.checkPoint()
-
- #extra post configuration
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('post-configuration'):
- hook()
- self.macro.checkPoint()
-
- endTimestamp = time.time()
- self.macro.info("Configuration took %s time." % repr(endTimestamp - startTimestamp))
-
- # move to start position
- self.macro.debug("Moving to start position: %s" % repr(start_pos))
- motion.move(start_pos)
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- # prepare motor(s) to move with their maximum velocity
- for path in motion_paths:
- motor = path.moveable
- self.macro.debug("Motor: %s" % motor.getName())
- self.macro.debug("Velocity: %f" % path.max_vel)
- self.macro.debug("AccTime: %f" % path.max_vel_time)
- self.macro.debug("DecTime: %f" % path.min_vel_time)
- #TODO: check why we have 0 here
- #if 0 in [path.max_vel, path.max_vel_time, path.min_vel_time]:
- # continue
- motor.setVelocity(path.max_vel)
- motor.setAcceleration(path.max_vel_time)
- motor.setDeceleration(path.min_vel_time)
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('pre-start'):
- hook()
- self.macro.checkPoint()
-
- self.macro.debug("Starting measurement group")
- self.__mntGrpStarted = True
- self._measurement_group.start()
-
- self.timestamp_to_start = time.time() + delta_start
-
- self.motion_event.set()
-
- # move to waypoint end position
- self.macro.debug("Moving to waypoint position: %s" % repr(final_pos))
- self.macro.debug("Starting triggers")
- self.__triggerStarted = True
- self.extraTrigger.start()
- motion.move(final_pos)
-
- self.motion_event.clear()
-
- if macro.isStopped():
- self.on_waypoints_end()
- return
-
- #execute post-move hooks
- for hook in waypoint.get('post-move-hooks',[]):
- hook()
-
- self.macro.debug("Waiting for measurement group to finish")
- while self._measurement_group.isMoving():
- self.macro.checkPoint()
- time.sleep(0.1)
-
- self.macro.debug("Getting data")
- data_list = self._measurement_group.getDataList()
-
- def populate_ideal_positions():
- moveables = self.moveables
- nr_of_points = self.macro.nr_of_points
- starts = self.macro.starts
- finals = self.macro.finals
- positions_records = [{} for i in xrange(nr_of_points)]
-
- for moveable, start, final in zip(moveables, starts, finals):
- name = moveable.moveable.getName()
- for point_nr, position in enumerate(np.linspace(start, \
- final, nr_of_points)):
- positions_records[point_nr][name] = position
-
- return positions_records
-
- #TODO: decide what to do with moveables
- position_list = populate_ideal_positions()
-
- self.macro.debug("Storing data")
- for data_dict, position_dict in zip(data_list,position_list):
- data_dict.update(position_dict)
- self.data.addRecord(data_dict)
-
- if start_positions is None:
- last_positions = positions
-
- self.on_waypoints_end(positions)
-
- def on_waypoints_end(self, restore_positions=None):
- self.macro.debug("on_waypoints_end() entering...")
- CScan.on_waypoints_end(self, restore_positions=restore_positions)
- self.cleanup()
-
- def scan_loop(self):
- macro = self.macro
- manager = macro.getManager()
- scream = False
- motion_event = self.motion_event
- startts = self._env['startts']
-
- sum_delay = 0
- sum_integ_time = 0
-
- if hasattr(macro, "nr_points"):
- nr_points = float(macro.nr_points)
- scream = True
- else:
- yield 0.0
-
- moveables = [ m.moveable for m in self.moveables ]
-
- point_nb, step = -1, None
- data = self.data
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('pre-scan'):
- hook()
-
- self.go_through_waypoints()
-
-
- if hasattr(macro, 'getHooks'):
- for hook in macro.getHooks('post-scan'):
- hook()
-
- env = self._env
- env['acqtime'] = sum_integ_time
- env['delaytime'] = sum_delay
-
- if not scream:
- yield 100.0
-
- def cleanup(self):
- '''This method is responsible for restoring state of measurement group
- and trigger to its state before the scan.'''
- startTimestamp = time.time()
-
- if self.__mntGrpStarted:
- self.debug("Stopping measurement group")
- try:
- self._measurement_group.stop()
- except Exception, e:
- self.warning("Exception while trying to stop measurement group.")
- self.debug(e)
-
- if self.__triggerStarted:
- self.debug("Stopping triggers")
- try:
- self.extraTrigger.stop()
- except Exception, e:
- self.warning("Exception while trying to stop trigger.")
- self.debug(e)
-
- if hasattr(self.macro, 'getHooks'):
- for hook in self.macro.getHooks('pre-cleanup'):
- self.debug("Executing pre-cleanup hook")
- try:
- hook()
- except Exception, e:
- self.warning("Exception while trying to execute a pre-cleanup hook")
- self.debug(e)
-
- if self.__mntGrpConfigured:
- self.debug("Restoring configuration of measurement group")
- try:
- self._measurement_group.setConfiguration(self.mntGrpConfiguration)
- #TODO: mntGrp configuration should contain also: nrOfTriggers, acqTime, sampling frequency
- except:
- self.warning("Exception while trying to restore measurement group parameters")
- self.debug(e)
-
- if hasattr(self.macro, 'getHooks'):
- for hook in self.macro.getHooks('post-cleanup'):
- self.debug("Executing post-cleanup hook")
- try:
- hook()
- except Exception, e:
- self.warning("Exception while trying to execute a post-cleanup hook")
- self.debug(e)
-
- endTimestamp = time.time()
- self.debug("Cleanup took %s time." % repr(endTimestamp - startTimestamp))
-
-
-class HScan(SScan):
- """Hybrid scan"""
-
- def stepUp(self, n, step, lstep):
- motion, mg = self.motion, self.measurement_group
- startts = self._env['startts']
-
- #pre-move hooks
- for hook in step.get('pre-move-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- positions, integ_time = step['positions'], step['integ_time']
-
- try:
- m_ID = motion.startMove(positions)
- mg_ID = mg.startCount(integ_time)
- except InterruptException:
- raise
- except:
- self.dump_information(n, step)
- raise
-
- try:
- motion.waitMove(id=m_ID)
- mg.waitCount(id=mg_ID)
- except InterruptException:
- raise
- except:
- self.dump_information(n, step)
- raise
- self._sum_acq_time += integ_time
-
- curr_time = time.time()
- dt = curr_time - startts
-
- m_state, m_positions = motion.readState(), motion.readPosition()
-
- if m_state != Ready:
- self.dump_information(n, step)
- m = "Scan aborted after problematic motion: " \
- "Motion ended with %s\n" % str(m_state)
- raise ScanException({ 'msg' : m })
-
- data_line = mg.getValues()
-
- # Add final moveable positions
- data_line['point_nb'] = n
- data_line['timestamp'] = dt
- for i, m in enumerate(self.moveables):
- data_line[m.moveable.getName()] = m_positions[i]
-
- #Add extra data coming in the step['extrainfo'] dictionary
- if step.has_key('extrainfo'): data_line.update(step['extrainfo'])
-
- self.data.addRecord(data_line)
-
- #post-step hooks
- for hook in step.get('post-step-hooks',()):
- hook()
- try:
- step['extrainfo'].update(hook.getStepExtraInfo())
- except InterruptException:
- raise
- except:
- pass
-
- def dump_information(self, n, step):
- moveables = self.motion.moveable_list
- msg = ["Report: Stopped at step #" + str(n) + " with:"]
- for moveable in moveables:
- msg.append(moveable.information())
- self.macro.info("\n".join(msg))
diff --git a/src/sardana/macroserver/scan/recorder/__init__.py b/src/sardana/macroserver/scan/recorder/__init__.py
deleted file mode 100644
index 8f71c3f1..00000000
--- a/src/sardana/macroserver/scan/recorder/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan recorder module"""
-
-__docformat__ = 'restructuredtext'
-
-from .datarecorder import *
-from .output import *
-from .sharedmemory import *
-from .storage import * \ No newline at end of file
diff --git a/src/sardana/macroserver/scan/recorder/datarecorder.py b/src/sardana/macroserver/scan/recorder/datarecorder.py
deleted file mode 100644
index ceb8538b..00000000
--- a/src/sardana/macroserver/scan/recorder/datarecorder.py
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan data recorder module"""
-
-__all__ = ["DataFormats", "SaveModes", "RecorderStatus", "DataHandler",
- "DataRecorder", "DumbRecorder"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from taurus.core.util.log import Logger
-from taurus.core.util.enumeration import Enumeration
-
-DataFormats = Enumeration('DataFormats', ('Spec', 'CSV', 'XLS', 'w5', 'w4',
- 'wx', 'fio'))
-SaveModes = Enumeration('SaveModes', ('Record', 'Block'))
-RecorderStatus = Enumeration('RecorderStatus', ('Idle', 'Active', 'Disable'))
-
-
-class DataHandler:
- """ The data handler is the data recording center of a system. It contains
- one or several recorders. All data transit through the handler, then
- given to recorders for final saving """
-
- def __init__(self):
- self.recorders = []
-
- def addRecorder(self, recorder):
- if recorder is not None:
- self.recorders.append(recorder)
-
- def startRecordList(self, recordlist):
- for recorder in self.recorders:
- if recorder.savemode is SaveModes.Record:
- recorder.startRecordList(recordlist)
-
- def endRecordList(self, recordlist):
- for recorder in self.recorders:
- if recorder.savemode is SaveModes.Record:
- recorder.endRecordList(recordlist)
- else:
- recorder.writeRecordList(recordlist)
-
- def addRecord(self, recordlist, record):
- for recorder in self.recorders:
- if recorder.savemode is SaveModes.Record:
- recorder.writeRecord(record)
- else: # blockSave
- pass
-
- def addCustomData(self, value, name, **kwargs):
- '''Write data other than a record.
-
- :param value: The value to be written
- :param name: An identification for this value
-
- Optional keyword arguments can be passed with information that some
- recorders may need in order to record this value. For example: the NeXus
- recorder will make use of "nxpath" info if available to place the value
- where it belongs in the nexus hierarchy. Check the `addCustomData`
- method of each recorder to see what they use/require.
- '''
- for recorder in self.recorders:
- recorder.addCustomData(value, name, **kwargs)
-#
-# Recorders
-#
-
-class DataRecorder(Logger):
- """ Generic class for data recorder. Does nothing"""
- def __init__(self, **pars):
- name = self.__class__.__name__
- self.call__init__(Logger, name)
- self.recordlist = None
- self.status = RecorderStatus.Idle
- self.savemode = SaveModes.Record
-
- def getStatus(self):
- return self.status
-
- def disable(self):
- self.status = RecorderStatus.Disable
-
- def enable(self):
- self.status = RecorderStatus.Idle
-
- def startRecordList(self, recordlist):
- is_idle = self.status is RecorderStatus.Idle
- if is_idle:
- self.recordlist = recordlist
-
- self._startRecordList(recordlist)
-
- if is_idle:
- return 0
- else:
- return -1
-
- def _startRecordList(self, recordlist):
- pass
-
- def endRecordList(self, recordlist):
- self._endRecordList(recordlist)
-
- self.status = RecorderStatus.Idle
- self.recordlist = None
-
- def _endRecordList(self, recordlist):
- pass
-
- def writeRecordList(self, recordlist):
- """ Only in BLOCK_MODE. Will write whole RecordList """
- self._startRecordList(recordlist)
- for record in recordlist.records:
- self.writeRecord(record)
- self._endRecordList(recordlist)
-
- def writeRecord(self, record):
- self._writeRecord(record)
-
- def _writeRecord(self, record):
- pass
-
- def setSaveMode(self, mode):
- self.savemode = mode
-
- def addCustomData(self, value, name, **kwargs):
- try:
- self._addCustomData(value, name, **kwargs)
- except Exception, e:
- raise RuntimeError('%s can not process custom data: %s' %
- (self.__class__.__name__, e))
-
- def _addCustomData(self, value, name, **kwargs):
- pass
-
-
-class DumbRecorder(DataRecorder):
- def _startRecordList(self, recordlist):
- print "Starting new recording"
- print "# Title : ", recordlist.getEnvironValue('title')
- env = recordlist.getEnviron()
- for envky in env.keys():
- if envky != 'title' and envky != 'labels':
- print "# %8s : %s " % (envky, str(env[envky]))
- print "# Started: ", time.ctime(env['starttime'])
- print "# L: ",
- print " ".join(env['labels'])
-
- def _writeRecord(self, record):
- print record.data
-
- def _endRecordList(self, recordlist):
- print "Ending recording"
- env = recordlist.getEnviron()
- print "Recording ended at: ", time.ctime(env['endtime'])
diff --git a/src/sardana/macroserver/scan/recorder/output.py b/src/sardana/macroserver/scan/recorder/output.py
deleted file mode 100644
index 43667250..00000000
--- a/src/sardana/macroserver/scan/recorder/output.py
+++ /dev/null
@@ -1,270 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan data output recorder module"""
-
-__all__ = ["JsonRecorder", "OutputRecorder"]
-
-__docformat__ = 'restructuredtext'
-
-import numpy
-import datetime
-import operator
-import string
-
-from taurus.core.util.codecs import CodecFactory
-from taurus.core.util.containers import CaselessList
-
-from sardana.macroserver.scan.recorder.datarecorder import DataRecorder
-from sardana.macroserver.scan.recorder.storage import BaseFileRecorder
-
-
-class JsonRecorder(DataRecorder):
- def __init__(self, stream, cols=None, **pars):
- DataRecorder.__init__(self, **pars)
- self._stream = stream
- self._codec = CodecFactory().getCodec('json')
-
- def _startRecordList(self, recordlist):
- macro_id = recordlist.getEnvironValue('macro_id')
- title = recordlist.getEnvironValue('title')
- counters = recordlist.getEnvironValue('counters')
- scanfile = recordlist.getEnvironValue('ScanFile')
- scandir = recordlist.getEnvironValue('ScanDir')
- serialno = recordlist.getEnvironValue('serialno')
- column_desc = recordlist.getEnvironValue('datadesc')
- ref_moveables = recordlist.getEnvironValue('ref_moveables')
- estimatedtime = recordlist.getEnvironValue('estimatedtime')
- total_scan_intervals = recordlist.getEnvironValue('total_scan_intervals')
- start_time = recordlist.getEnvironValue('starttime').ctime()
- self.column_desc = []
- discarded = []
- for e in column_desc:
- if len(e.shape) == 0:
- self.column_desc.append(e)
- else:
- discarded.append(e.label)
- if discarded:
- self.info('The following data will not be json-serialized: %s',
- " ".join(discarded))
- column_desc = [d.toDict() for d in self.column_desc]
- data = {'column_desc': column_desc,
- 'ref_moveables': ref_moveables,
- 'estimatedtime': estimatedtime,
- 'total_scan_intervals': total_scan_intervals,
- 'starttime': start_time,
- 'title': title,
- 'counters': counters,
- 'scanfile': scanfile,
- 'scandir': scandir,
- 'serialno': serialno}
- self._sendPacket(type="data_desc", data=data, macro_id=macro_id)
-
- def _endRecordList(self, recordlist):
- macro_id = recordlist.getEnvironValue('macro_id')
- data = { 'endtime' : recordlist.getEnvironValue('endtime').ctime(),
- 'deadtime' : recordlist.getEnvironValue('deadtime') }
- self._sendPacket(type="record_end", data=data, macro_id=macro_id)
-
- def _writeRecord(self, record):
- macro_id = self.recordlist.getEnvironValue('macro_id')
- data = {} # dict(record.data)
- for k in self.column_desc:
- name = k.name
- data[name] = record.data[name]
- self._sendPacket(type="record_data", data=data, macro_id=macro_id)
-
- def _sendPacket(self, **kwargs):
- '''creates a JSON packet using the keyword arguments passed
- and then sends it'''
- #data = self._codec.encode(('', kwargs))
- #self._stream.sendRecordData(*data)
- self._stream.sendRecordData(kwargs, codec='json')
-
- def _addCustomData(self, value, name, **kwargs):
- '''
- The custom data will be sent as a packet with type='custom_data'
- and its data will be the dictionary of keyword arguments passed to this
- method plus 'name' and 'value'
- '''
- #try to convert to list to avoid serialization problems
- try:
- value = value.tolist()
- except:
- pass
- macro_id = self._stream.getID()
- data = dict(kwargs) # shallow copy
- data['name'] = name
- data['value'] = value
- self._sendPacket(type="custom_data", data=data, macro_id=macro_id)
-
-
-class OutputRecorder(DataRecorder):
-
- def __init__(self, stream, cols=None, number_fmt='%8.4f', col_width=8,
- col_sep=' ', **pars):
- DataRecorder.__init__(self, **pars)
- self._stream = stream
- if not number_fmt.startswith('%'):
- number_fmt = '%%s' % number_fmt
- self._number_fmt = number_fmt
- self._col_sep = col_sep
- self._col_width = col_width
- if operator.isSequenceType(cols) and \
- not isinstance(cols, (str, unicode)):
- cols = CaselessList(cols)
- elif operator.isNumberType(cols):
- cols = cols
- else:
- cols = None
- self._columns = cols
-
- def _startRecordList(self, recordlist):
- starttime = recordlist.getEnvironValue('starttime').ctime()
- estimatedtime = recordlist.getEnvironValue('estimatedtime')
- data_desc = recordlist.getEnvironValue('datadesc')
- serialno = recordlist.getEnvironValue('serialno')
- col_sep = self._col_sep
- cols = self._columns
- number_fmt = self._number_fmt
- col_width = self._col_width
- dh = recordlist.getDataHandler()
-
- for fr in [r for r in dh.recorders if isinstance(r, BaseFileRecorder)]:
- self._stream.info('Operation will be saved in %s (%s)',
- fr.getFileName(), fr.getFormat())
-
- msg = "Scan #%d started at %s." % (serialno, starttime)
- if not estimatedtime is None:
- estimatedtime = datetime.timedelta(0, abs(estimatedtime))
- msg += " It will take at least %s\n" % estimatedtime
- msg += "Moving to start positions..."
- self._stream.info(msg)
-
- labels, col_names, col_sizes = [], [], []
- header_rows, header_len = 1, 0
- for col, column in enumerate(data_desc):
- if not getattr(column, 'output', True):
- continue
- name = column.name
- if operator.isSequenceType(cols) and name not in cols:
- continue
- if operator.isNumberType(cols) and col >= cols:
- break
- col_names.append(name)
- label = column.label.strip()
- if len(label) > col_width:
- label = label.split("/")
- else:
- label = [label]
- header_rows = max(header_rows, len(label))
- labels.append(label)
- col_size = max(col_width, max(map(len, label)))
- header_len += col_size
- col_sizes.append(col_size)
-
- nb_cols = len(col_names)
- header_len += (nb_cols - 1) * len(col_sep)
- self._labels = labels
- self._col_names = col_names
- self._col_sizes = col_sizes
-
- header = [[] for i in range(header_rows)]
- for col, (label, col_size) in enumerate(zip(labels, col_sizes)):
- empty_row_nb = header_rows - len(label)
- for row in range(empty_row_nb):
- header[row].append(col_size * " ")
- for i, l in enumerate(label):
- header[i + empty_row_nb].append(string.center(l, col_size))
- head = []
- for header_row in header:
- head.append(col_sep.join(header_row))
-
- header = "\n".join(head)
-
- cell_t_number = '%%%%(%%s)%s' % number_fmt[1:]
-
- self._scan_line_t = [(col_names[0], '%%(%s)8d' % col_names[0])]
- self._scan_line_t += [(name, cell_t_number % name) for name in col_names[1:]]
-
- self._stream.output(header)
- self._stream.flushOutput()
-
- def _endRecordList(self, recordlist):
- self._stream.flushOutput()
- starttime = recordlist.getEnvironValue('starttime')
- endtime = recordlist.getEnvironValue('endtime')
- deadtime = recordlist.getEnvironValue('deadtime')
- motiontime = recordlist.getEnvironValue('motiontime')
- totaltime = endtime - starttime
- endtime = endtime.ctime()
- serialno = recordlist.getEnvironValue('serialno')
-
- dh = recordlist.getDataHandler()
-
- for fr in [ r for r in dh.recorders if isinstance(r, BaseFileRecorder) ]:
- self._stream.info('Operation saved in %s (%s)', fr.getFileName(),
- fr.getFormat())
-
- endts = recordlist.getEnvironValue('endts')
- startts = recordlist.getEnvironValue('startts')
- totaltimets = endts - startts
- deadtime_perc = deadtime * 100.0 / totaltimets
- motiontime_perc = motiontime * 100.0 / totaltimets
- info_string = 'Scan #%s ended at %s, taking %s.' + \
- 'Dead time %.1f%% (motion dead time %.1f%%)'
- self._stream.info(info_string % (serialno, endtime, totaltime,
- deadtime_perc, motiontime_perc))
-
- def _writeRecord(self, record):
- cells = []
- for i, (name, cell) in enumerate(self._scan_line_t):
- cell_data = record.data[name]
- if isinstance(cell_data, numpy.ndarray):
- cell = str(cell_data.shape)
- elif cell_data is None:
- cell = "<nodata>"
- elif isinstance(cell_data, (str, unicode)):
- cell = "<string>"
- else:
- cell %= record.data
- cell = string.center(cell.strip(), self._col_sizes[i])
- cells.append(cell)
- scan_line = self._col_sep.join(cells)
-
- self._stream.output(scan_line)
- self._stream.flushOutput()
-
- def _addCustomData(self, value, name, **kwargs):
- '''
- The custom data will be added as an info line in the form:
- Custom data: name : value
- '''
- if numpy.rank(value) > 0:
- v = 'Array(%s)' % str(numpy.shape(value))
- else:
- v = str(value)
- self._stream.output('Custom data: %s : %s' % (name, v))
- self._stream.flushOutput()
diff --git a/src/sardana/macroserver/scan/recorder/sharedmemory.py b/src/sardana/macroserver/scan/recorder/sharedmemory.py
deleted file mode 100644
index a5f3b636..00000000
--- a/src/sardana/macroserver/scan/recorder/sharedmemory.py
+++ /dev/null
@@ -1,320 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan data output recorder module"""
-
-__all__ = ["SharedMemoryRecorder"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-import numpy
-import operator
-
-from sardana.macroserver.scan.recorder.datarecorder import DataRecorder
-
-SPS_AVAILABLE = False
-try:
- import sps
- SPS_AVAILABLE = True
-except:
- pass
-
-class _SharedMemoryRecorder(DataRecorder):
-
- def __init__(self, **pars):
- DataRecorder.__init__(self, **pars)
-
-
-class SPSRecorder(_SharedMemoryRecorder):
-
- maxenv = 50
- envlen = 1024
-
- def __init__(self, program=None, array=None, shape=None, **kwpars):
- """ @param[in] program SPS program name
- @param[in] array SPS array name
- @param[in] shape tuple (cols, rows)
- @param[in] pars keyword extra parameters
- """
- _SharedMemoryRecorder.__init__(self, **kwpars)
- self.shape = shape
- self.owner = False
- self.owner_ENV = False
- self.setID(program, array)
-
- def setID(self, program, array):
- self.program = program.replace('/', '')
- self.array = array.replace('_', '')
- if not array is None:
- self.array_ENV = "%s_ENV" % self.array
- else:
- self.array_ENV = None
- if program and array:
- self.init()
-
- def init(self):
- pass
-
- def setSize(self, rows, cols):
- self.shape = (cols, rows)
- self.rows = rows
- self.cols = cols
-
- def isInitialized(self):
- ret = not (self.program is None or self.array_ENV is None or self.array is None)
- return ret and not self.shape is None
-
- def putEnv(self, name, value):
- if not self.isInitialized(): return
- sps.putenv(self.program, self.array_ENV, name, str(value))
-
- def putAllEnv(self, d):
- if not self.isInitialized(): return
- p, a = self.program, self.array_ENV
- for k, v in d.iteritems():
- sps.putenv(p, a, k, str(v))
-
- def _startRecordList(self, recordlist):
- if not self.isInitialized(): return
-
- arraylist = sps.getarraylist(self.program)
-
- if self.array in arraylist:
- shm = sps.attach(self.program, self.array)
- else:
- cols, rows = self.shape
- sps.create(self.program, self.array, rows, cols, sps.DOUBLE)
- self.owner = True
-
- if self.array_ENV in arraylist:
- shm_env = sps.attach(self.program, self.array_ENV)
- else:
- sps.create(self.program, self.array_ENV, self.maxenv, self.envlen,
- sps.STRING)
- self.owner_ENV = True
-
- self.nopts = 0
-
- env = recordlist.getEnviron()
-
- self.labels = [ col.label for col in env['datadesc'] ]
-
- env = { 'title' : env['title'],
- 'started' : env['starttime'].ctime(),
- 'ended' : '',
- 'axistitles' : ' '.join(self.labels),
- 'ylabel' : 'Counts',
- 'nopts' : self.nopts,
- 'xbeg' : 0,
- 'xend' : 200,
- 'aborted' : 0,
- 'command' : 'done',
- 'fitresult' : '0' }
-
- self.putAllEnv(env)
-
- def _writeRecord(self, record):
- if not self.isInitialized(): return
-
- vals = []
-
- for colname in self.labels:
- val = record.data.get(colname)
- if (not val is None) and (operator.isNumberType(val) and (type(val) in [int, float, long])):
- vals.append(val)
- elif (not val is None) and (operator.isNumberType(val)):
- valsmca = []
- for i in range(0, len(val)):
- valsmca.append(val[i])
- sufix = "1D"
- if self.array.endswith(sufix):
- valsmca = numpy.array(valsmca)
- sps.putdatarow(self.program, self.array, record.recordno, valsmca)
-
- sufix = "0D"
- if self.array.endswith(sufix):
- vals = numpy.array(vals)
- sps.putdatarow(self.program, self.array, record.recordno, vals)
-
- self.nopts += 1
-
- env = { 'nopts' : self.nopts,
- 'peak' : 111,
- 'peakpos' : 34,
- 'fwhm' : 12.3,
- 'fwhmpos' : 45,
- 'com' : 23 }
-
- self.putAllEnv(env)
-
- def _endRecordList(self, recordlist):
- if not self.isInitialized(): return
- env = recordlist.getEnviron()
- self.putEnv('ended', env.get('endtime').ctime())
-
-
-class ShmRecorder(DataRecorder):
-
- """ Sets data in shared memory to be used by sps """
-
- maxenv = 50
- envlen = 1024
-
- def setShmID(self, shmid):
- self.shm_id = shmid
- self.shm_id_ENV = shmid + "_ENV"
-
- def setShmMntGrp(self, mnt_grp):
- self.mnt_grp = mnt_grp
-
- def setProgram(self, progname):
- self.progname = progname
-
- def isInitialized(self):
- try:
- getattr(self, "shm_id")
- getattr(self, "shm_id_env")
- getattr(self, "progname")
- return True
- except:
- return False
-
- def setSize(self, rows, cols):
- self.rows = rows
- self.cols = cols
-
- def putenv(self, name, value):
- sps.putenv(self.progname, self.shm_id_env, name, str(value))
-
- def setChanDimList(self, chandimlist):
- self.chandimlist = chandimlist
-
- def _startRecordList(self, recordlist):
-
- if not self.isInitialized(): return
-
- arraylist = sps.getarraylist(self.progname)
-
- if self.shm_id in arraylist:
- shm = sps.attach(self.progname, self.shm_id)
- else:
- sps.create(self.progname, self.shm_id, self.rows, self.cols,
- sps.DOUBLE)
-
- if self.shm_id_env in arraylist:
- shm_env = sps.attach(self.progname, self.shm_id_env)
- else:
- sps.create(self.progname, self.shm_id_env, self.maxenv, self.envlen,
- sps.STRING)
-
- print "Starting new SHM recording"
-
- self.putenv('title', recordlist.getEnvironValue('title'))
-
- for env, val in recordlist.getEnviron().items():
- if env != 'title' and env != 'labels':
- self.putenv(env , val)
-
- self.nopts = 0
-
- self.putenv('started', time.ctime(recordlist.getEnvironValue('starttime')))
- self.putenv('ended', '')
- self.putenv('axistitles', ' '.join(recordlist.getEnvironValue('labels')))
- self.putenv('ylabel', 'Counts')
- self.putenv('nopts', self.nopts)
- self.putenv('xbeg', 100)
- self.putenv('xend', 200)
- self.putenv('aborted', 0)
- self.putenv('command', 'done')
- self.putenv('fitresult', '0')
-
- self.labels = recordlist.getEnvironValue('labels')
-
- def _writeRecord(self, record):
- # uhmm. only numeric values can be written
-
- if not self.isInitialized(): return
-
- vals = []
-
- dim_list = []
- for colname in self.labels:
- dim_list.append(0)
- val = record.data.get(colname)
- if (not val is None) and (type(val) in [int, float, long]):
- vals.append(val)
-
- myj = 0
-
- for val2 in record.data:
- tmp = val2 + '_value'
- #esto me da el nombre del canal
- for dim in self.chandimlist:
- if tmp == dim:
- dim_list[myj] = self.chandimlist[dim]
- myj = myj + 1
-
- myj = 0
-
- for val2 in record.data.values():
- valsmca = []
- if type(val2) in [list]:
- if dim_list[myj] == 1:
- for i in range(0, len(val2)):
- valsmca.append(val2[i])
- tmp_name = self.mnt_grp + "_1D"
- if self.shm_id == tmp_name:
- valsmca = numpy.array(valsmca)
- sps.putdatarow(self.progname, self.shm_id, record.recordno, valsmca)
- myj = myj + 1
-
- vals = numpy.array(vals)
- tmp_name = self.mnt_grp + "_0D"
- if self.shm_id == tmp_name:
- sps.putdatarow(self.progname, self.shm_id, record.recordno, vals)
-
- self.nopts += 1
- self.putenv('nopts', self.nopts)
- self.putenv('peak', 111)
- self.putenv('peakpos', 34)
- self.putenv('fwhm', 12.3)
- self.putenv('fwhmpos', 45)
- self.putenv('com', 23)
-
-
- def _endRecordList(self, recordlist):
- if not self.isInitialized(): return
- self.putenv('ended', time.ctime(recordlist.getEnvironValue('endtime')))
-
-
-def SharedMemoryRecorder(type, **pars):
- global SPS_AVAILABLE
- if type == 'sps' and SPS_AVAILABLE:
- klass = SPSRecorder
- else:
- return
-
- return klass(**pars)
diff --git a/src/sardana/macroserver/scan/recorder/storage.py b/src/sardana/macroserver/scan/recorder/storage.py
deleted file mode 100644
index f4c2dab6..00000000
--- a/src/sardana/macroserver/scan/recorder/storage.py
+++ /dev/null
@@ -1,1300 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan data output recorder module"""
-
-__all__ = ["BaseFileRecorder", "FileRecorder"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import time
-import itertools
-import re
-
-import numpy
-
-import PyTango
-
-from sardana.taurus.core.tango.sardana import PlotType
-from sardana.macroserver.macro import Type
-from sardana.macroserver.scan.recorder.datarecorder import DataRecorder, \
- DataFormats, SaveModes
-from taurus.core.util.containers import chunks
-
-
-class BaseFileRecorder(DataRecorder):
- def __init__(self, **pars):
- DataRecorder.__init__(self, **pars)
- self.filename = None
- self.fd = None
-
- def getFileName(self):
- return self.filename
-
- def getFileObj(self):
- return self.fd
-
- def getFormat(self):
- return '<unknown>'
-
-
-class FIO_FileRecorder(BaseFileRecorder):
- """ Saves data to a file """
-
- formats = { DataFormats.fio : '.fio' }
-
- def __init__(self, filename=None, macro=None, **pars):
- BaseFileRecorder.__init__(self)
- self.base_filename = filename
- if macro:
- self.macro = macro
- self.db = PyTango.Database()
- if filename:
- self.setFileName(self.base_filename)
-
- def setFileName(self, filename):
- if self.fd != None:
- self.fd.close()
-
- dirname = os.path.dirname(filename)
-
- if not os.path.isdir(dirname):
- try:
- os.makedirs(dirname)
- except:
- self.filename = None
- return
- self.currentlist = None
- #
- # construct the filename, e.g. : /dir/subdir/etcdir/prefix_00123.fio
- #
- tpl = filename.rpartition('.')
- try: # For avoiding error when calling at __init__
- serial = self.recordlist.getEnvironValue('serialno')
- self.filename = "%s_%05d.%s" % (tpl[0], serial, tpl[2])
- #
- # in case we have MCAs, prepare the dir name
- #
- self.mcaDirName = "%s_%05d" % (tpl[0], serial)
- except:
- self.filename = "%s_%s.%s" % (tpl[0], "[ScanId]", tpl[2])
-
- def getFormat(self):
- return DataFormats.whatis(DataFormats.fio)
-
- def _startRecordList(self, recordlist):
-
- if self.base_filename is None:
- return
-
- self.setFileName(self.base_filename)
-
- envRec = recordlist.getEnviron()
-
- self.sampleTime = envRec['estimatedtime'] / (envRec['total_scan_intervals'] + 1)
- #datetime object
- start_time = envRec['starttime']
-
- self.motorNames = envRec[ 'ref_moveables']
- self.mcaNames = []
- self.ctNames = []
- for e in envRec['datadesc']:
- if len( e.shape) == 1:
- self.mcaNames.append( e.name)
- else:
- self.ctNames.append( e.name)
- #
- # we need the aliases for the column description
- #
- self.mcaAliases = []
- for mca in self.mcaNames:
- lst = mca.split("/")
- self.mcaAliases.append( self.db.get_alias( "/".join( lst[1:])))
-
- # self.names = [ e.name for e in envRec['datadesc'] ]
- self.fd = open( self.filename,'w')
- #
- # write the comment section of the header
- #
- self.fd.write("!\n! Comments\n!\n%%c\n %s\nuser %s Acquisition started at %s\n" %
- (envRec['title'], envRec['user'], start_time.ctime()))
- self.fd.flush()
- #
- # write the parameter section, including the motor positions, if needed
- #
- self.fd.write("!\n! Parameter\n!\n%p\n")
- self.fd.flush()
- env = self.macro.getAllEnv()
- if env.has_key( 'FlagFioWriteMotorPositions') and env['FlagFioWriteMotorPositions'] == True:
- all_motors = self.macro.findObjs('.*', type_class=Type.Motor)
- all_motors.sort()
- for mot in all_motors:
- pos = mot.getPosition()
- if pos is None:
- record = "%s = nan\n" % (mot)
- else:
- record = "%s = %g\n" % (mot, mot.getPosition())
-
- self.fd.write( record)
- self.fd.flush()
- #
- # write the data section starting with the description of the columns
- #
- self.fd.write("!\n! Data\n!\n%d\n")
- self.fd.flush()
- i = 1
- for col in envRec[ 'datadesc']:
- if col.name == 'point_nb':
- continue
- if col.name == 'timestamp':
- continue
- dType = 'FLOAT'
- if col.dtype == 'float64':
- dType = 'DOUBLE'
- outLine = " Col %d %s %s\n" % ( i, col.label, dType)
- self.fd.write( outLine)
- i += 1
- #
- # 11.9.2012 timestamp to the end
- #
- outLine = " Col %d %s %s\n" % ( i, 'timestamp', 'DOUBLE')
- self.fd.write( outLine)
-
- self.fd.flush()
-
- def _writeRecord(self, record):
- if self.filename is None:
- return
- nan, ctNames, fd = float('nan'), self.ctNames, self.fd
- outstr = ''
- for c in ctNames:
- if c == "timestamp" or c == "point_nb":
- continue
- outstr += ' ' + str(record.data.get(c, nan))
- #
- # 11.9.2012 timestamp to the end
- #
- outstr += ' ' + str(record.data.get('timestamp', nan))
- outstr += '\n'
-
- fd.write( outstr )
- fd.flush()
-
- if len( self.mcaNames) > 0:
- self._writeMcaFile( record)
-
- def _endRecordList(self, recordlist):
- if self.filename is None:
- return
-
- envRec = recordlist.getEnviron()
- end_time = envRec['endtime'].ctime()
- self.fd.write("! Acquisition ended at %s\n" % end_time)
- self.fd.flush()
- self.fd.close()
-
- def _writeMcaFile( self, record):
- if self.mcaDirName is None:
- return
-
- if not os.path.isdir( self.mcaDirName):
- try:
- os.makedirs( self.mcaDirName)
- except:
- self.mcaDirName = None
- return
- currDir = os.getenv( 'PWD')
- os.chdir( self.mcaDirName)
-
- serial = self.recordlist.getEnvironValue('serialno')
- if type(self.recordlist.getEnvironValue('ScanFile')).__name__ == 'list':
- scanFile = self.recordlist.getEnvironValue('ScanFile')[0]
- else:
- scanFile = self.recordlist.getEnvironValue('ScanFile')
-
- mcaFileName = "%s_%05d_mca_s%d.fio" % (scanFile.split('.')[0], serial, record.data['point_nb'] + 1)
- fd = open( mcaFileName,'w')
- fd.write("!\n! Comments\n!\n%%c\n Position %g, Index %d \n" %
- ( record.data[ self.motorNames[0]], record.data[ 'point_nb']))
- fd.write("!\n! Parameter \n%%p\n Sample_time = %g \n" % ( self.sampleTime))
- self.fd.flush()
-
- col = 1
- fd.write("!\n! Data \n%d \n")
- for mca in self.mcaAliases:
- fd.write(" Col %d %s FLOAT \n" % (col, mca))
- col = col + 1
-
- if not record.data[ self.mcaNames[0]] is None:
- #print "+++storage.py, recordno", record.recordno
- #print "+++storage.py, record.data", record.data
- #print "+++storage.py, len %d, %s" % (len( record.data[ self.mcaNames[0]]), self.mcaNames[0])
- #
- # the MCA arrays me be of different size. the short ones are extended by zeros.
- #
- lMax = len( record.data[ self.mcaNames[0]])
- for mca in self.mcaNames:
- if len(record.data[ mca]) > lMax:
- lMax = len(record.data[ mca])
-
- for i in range( 0, lMax):
- line = ""
- for mca in self.mcaNames:
- if i > (len(record.data[mca]) - 1):
- line = line + " 0"
- else:
- line = line + " " + str( record.data[ mca][i])
- line = line + "\n"
- fd.write(line)
-
- fd.close()
- else:
- #print "+++storage.py, recordno", record.recordno, "data None"
- pass
-
- os.chdir( currDir)
-
-class SPEC_FileRecorder(BaseFileRecorder):
- """ Saves data to a file """
-
- formats = { DataFormats.Spec : '.spec' }
- supported_dtypes = ('float32','float64','int8',
- 'int16','int32','int64','uint8',
- 'uint16','uint32','uint64')
-
- def __init__(self, filename=None, macro=None, **pars):
- BaseFileRecorder.__init__(self)
- if filename:
- self.setFileName(filename)
-
- def setFileName(self, filename):
- if self.fd != None:
- self.fd.close()
-
- dirname = os.path.dirname(filename)
-
- if not os.path.isdir(dirname):
- try:
- os.makedirs(dirname)
- except:
- self.filename = None
- return
- self.filename = filename
- self.currentlist = None
-
- def getFormat(self):
- return DataFormats.whatis(DataFormats.Spec)
-
- def _startRecordList(self, recordlist):
- '''Prepares and writes the scan header.'''
- if self.filename is None:
- return
-
- env = recordlist.getEnviron()
-
- #datetime object
- start_time = env['starttime']
- epoch = time.mktime(start_time.timetuple())
- serialno = env['serialno']
-
- #store names for performance reason
- labels = []
- names = []
- for e in env['datadesc']:
- dims = len(e.shape)
- if not dims or (dims == 1 and e.shape[0] == 1):
- sanitizedlabel = "".join(x for x in e.label.replace(' ', '_') if x.isalnum() or x == '_') #substitute whitespaces by underscores and remove other non-alphanumeric characters
- labels.append(sanitizedlabel)
- names.append(e.name)
- self.names = names
-
- # prepare pre-scan snapshot
- snapshot_labels, snapshot_values = self._preparePreScanSnapshot(env)
- # format scan header
- data = {
- 'serialno': serialno,
- 'title': env['title'],
- 'user': env['user'],
- 'epoch': epoch,
- 'starttime': start_time.ctime(),
- 'nocols': len(names),
- 'labels': ' '.join(labels)
- }
- #Compatibility with PyMca
- if os.path.exists(self.filename):
- header = '\n'
- else:
- header = ''
- header += '#S %(serialno)s %(title)s\n'
- header += '#U %(user)s\n'
- header += '#D %(epoch)s\n'
- header += '#C Acquisition started at %(starttime)s\n'
- # add a pre-scan snapshot (sep is two spaces for labels!!)
- header += self._prepareMultiLines('O', ' ', snapshot_labels)
- header += self._prepareMultiLines('P', ' ', snapshot_values)
- header += '#N %(nocols)s\n'
- header += '#L %(labels)s\n'
-
- self.fd = open(self.filename,'a')
- self.fd.write(header % data )
- self.fd.flush()
-
- def _prepareMultiLines(self, character, sep, items_list):
- '''Translate list of lists of items into multiple line string
-
- :param character (string): each line will start #<character><line_nr>
- :sep: separator (string): separator to use between items
- :param items_list (list):list of lists of items
-
- :return multi_lines (string): string with all the items'''
- multi_lines = ''
- for nr, items in enumerate(items_list):
- start = '#%s%d ' % (character, nr)
- items_str = sep.join(map(str, items))
- end = '\n'
- line = start + items_str + end
- multi_lines += line
- return multi_lines
-
- def _preparePreScanSnapshot(self, env):
- '''Extract pre-scan snapshot, filters elements of shape different
- than scalar and split labels and values into chunks of 8 items.
-
- :param: env (dict) scan environment
-
- :return: labels, values (tuple<list,list>)
- labels - list of chunks with 8 elements containing labels
- values - list of chunks with 8 elements containing values
- '''
- # preScanSnapShot is a list o ColumnDesc objects
- pre_scan_snapshot = env.get('preScanSnapShot',[])
- labels = []; values = []
- for column_desc in pre_scan_snapshot:
- shape = column_desc.shape # shape is a tuple of dimensions
- label = column_desc.label
- dtype = column_desc.dtype
- pre_scan_value = column_desc.pre_scan_value
- # skip items with shape different than scalar
- if len(shape) > 0:
- self.info('Pre-scan snapshot of "%s" will not be stored.' + \
- ' Reason: value is non-scalar', label)
- continue
- if dtype not in self.supported_dtypes:
- self.info('Pre-scan snapshot of "%s" will not be stored.' + \
- ' Reason: type %s not supported', label, dtype)
- continue
- labels.append(label)
- values.append(pre_scan_value)
- # split labels in chunks o 8 items
- labels_chunks = list(chunks(labels, 8))
- values_chunks = list(chunks(values, 8))
- return labels_chunks, values_chunks
-
- def _writeRecord(self, record):
- if self.filename is None:
- return
- nan, names, fd = float('nan'), self.names, self.fd
-
- d = []
- for c in names:
- data = record.data.get(c)
- if data is None: data = nan
- d.append(str(data))
- outstr = ' '.join(d)
- outstr += '\n'
-
- fd.write( outstr )
- fd.flush()
-
- def _endRecordList(self, recordlist):
- if self.filename is None:
- return
-
- env = recordlist.getEnviron()
- end_time = env['endtime'].ctime()
- self.fd.write("#C Acquisition ended at %s\n" % end_time)
- self.fd.flush()
- self.fd.close()
-
-
- def _addCustomData(self, value, name, **kwargs):
- '''
- The custom data will be added as a comment line in the form::
-
- #C name : value
-
- ..note:: non-scalar values (or name/values containing end-of-line) will not be written
- '''
- if self.filename is None:
- self.info('Custom data "%s" will not be stored in SPEC file. Reason: uninitialized file',name)
- return
- if numpy.rank(value) > 0: #ignore non-scalars
- self.info('Custom data "%s" will not be stored in SPEC file. Reason: value is non-scalar', name)
- return
- v = str(value)
- if '\n' in v or '\n' in name: #ignore if name or the string representation of the value contains end-of-line
- self.info('Custom data "%s" will not be stored in SPEC file. Reason: unsupported format',name)
- return
-
- fileWasClosed = self.fd is None or self.fd.closed
- if fileWasClosed:
- try:
- self.fd = open(self.filename,'a')
- except:
- self.info('Custom data "%s" will not be stored in SPEC file. Reason: cannot open file',name)
- return
- self.fd.write('#C %s : %s\n' % (name, v))
- self.fd.flush()
- if fileWasClosed:
- self.fd.close() #leave the file descriptor as found
-
-
-
-class BaseNEXUS_FileRecorder(BaseFileRecorder):
- """Base class for NeXus file recorders"""
-
- formats = { DataFormats.w5 : '.h5',
- DataFormats.w4 : '.h4',
- DataFormats.wx : '.xml' }
- supported_dtypes = ('float32','float64','int8',
- 'int16','int32','int64','uint8',
- 'uint16','uint32','uint64') #note that 'char' is not supported yet!
- _dataCompressionRank = -1
-
- def __init__(self, filename=None, macro=None, overwrite=False, **pars):
- BaseFileRecorder.__init__(self, **pars)
-
- try:
- import nxs #check if Nexus data format is supported by this system
- self.nxs = nxs
- except ImportError:
- raise Exception("NeXus is not available")
-
- self.macro = macro
- self.overwrite = overwrite
- if filename:
- self.setFileName(filename)
-
- self.instrDict = {}
- self.entryname = 'entry'
-
- def setFileName(self, filename):
- if self.fd is not None:
- self.fd.close()
-
- self.filename = filename
- #obtain preferred nexus file mode for writing from the filename extension (defaults to hdf5)
- extension = os.path.splitext(filename)[1]
- inv_formats = dict(itertools.izip(self.formats.itervalues(), self.formats.iterkeys()))
- self.nxfilemode = inv_formats.get(extension.lower(), DataFormats.w5)
- self.currentlist = None
-
- def getFormat(self):
- return DataFormats.whatis(self.nxfilemode)
-
- def sanitizeName(self, name):
- '''It returns a version of the given name that can be used as a python
- variable (and conforms to NeXus best-practices for dataset names)'''
- #make sure the name does not start with a digit
- if name[0].isdigit(): name = "_%s" % name
- #substitute whitespaces by underscores and remove other non-alphanumeric characters
- return "".join(x for x in name.replace(' ','_') if x.isalnum() or x=='_')
-
-
- def _nxln(self, src, dst, name=None):
- '''convenience function to create NX links with just one call. On successful return, dst will be open.
-
- :param src: (str or NXgroup or NXfield) source group or dataset (or its path)
- :param dst: (str or NXgroup) the group that will hold the link (or its path)
- :param name: (str) name for the link. If not given, the name of the source is used
-
- .. note:: `groupname:nxclass` notation can be used for both paths for better performance
- '''
-
- fd = getattr(self, 'fd')
- if fd is None:
- fd = getattr(src,'nxfile', getattr(dst,'nxfile'))
- if fd is None:
- raise NeXusError('Cannot get a file handle')
-
- if isinstance(src, self.nxs.NXobject):
- src = src.nxpath
- if isinstance(dst, self.nxs.NXobject):
- dst = dst.nxpath
-
- fd.openpath(src)
- try:
- nid = fd.getdataID()
- except self.nxs.NeXusError:
- nid = fd.getgroupID()
- fd.openpath(dst)
- if name is None:
- fd.makelink(nid)
- else:
- fd.makenamedlink(name,nid)
-
- #===========================================================================
- # Unimplemented methods that must be implemented in derived classes
- #===========================================================================
-
- def _startRecordList(self, recordlist):
- raise NotImplementedError('_startRecordList must be implemented in BaseNEXUS_FileRecorder derived classes')
-
- def _writeRecord(self, record):
- raise NotImplementedError('_writeRecord must be implemented in BaseNEXUS_FileRecorder derived classes')
-
- def _endRecordList(self, recordlist):
- raise NotImplementedError('_endRecordList must be implemented in BaseNEXUS_FileRecorder derived classes')
-
-
-class BaseNAPI_FileRecorder(BaseNEXUS_FileRecorder):
- """Base class for NeXus file recorders (NAPI-based)"""
-
- #===========================================================================
- # Convenience methods to make NAPI less tedious
- #===========================================================================
-
- _nxentryInPath = re.compile(r'/[^/:]+:NXentry')
-
- def _makedata(self, name, dtype=None, shape=None, mode='lzw', chunks=None, comprank=None):
- '''
- combines :meth:`nxs.NeXus.makedata` and :meth:`nxs.NeXus.compmakedata` by selecting between
- using compression or not based on the comprank parameter and the rank of the data.
- Compression will be used only if the shape of the data is given and its length is larger
- than comprank. If comprank is not passed (or None is passed) the default dataCompressionRank
- will be used
- '''
- if comprank is None:
- comprank = self._dataCompressionRank
-
- if shape is None or comprank<0 or (len(shape) < comprank):
- return self.fd.makedata(name, dtype=dtype, shape=shape)
- else:
- try:
- self.fd.compmakedata(name, dtype=dtype, shape=shape, mode=mode, chunks=chunks)
- except ValueError: #workaround for bug in nxs<4.3 (compmakedatafails if chunks is not explicitly passed)
- chunks = [1]*len(shape)
- chunks[-1] = shape[-1]
- self.fd.compmakedata(name, dtype=dtype, shape=shape, mode=mode, chunks=chunks)
-
- def _writeData(self, name, data, dtype, shape=None, chunks=None, attrs=None):
- '''
- convenience method that creates datasets (calling self._makedata), opens
- it (napi.opendata) and writes the data (napi.putdata).
- It also writes attributes (napi.putattr) if passed in a dictionary and
- it returns the data Id (useful for linking). The dataset is left closed.
- '''
- if shape is None:
- if dtype == 'char':
- shape = [len(data)]
- chunks = chunks or list(shape) #for 'char', write the whole block in one chunk
- else:
- shape = getattr(data,'shape',[1])
- self._makedata(name, dtype=dtype, shape=shape, chunks=chunks)
- self.fd.opendata(name)
- self.fd.putdata(data)
- if attrs is not None:
- for k,v in attrs.items():
- self.fd.putattr(k,v)
- nid = self.fd.getdataID()
- self.fd.closedata()
- return nid
-
- def _newentryname(self, prefix='entry', suffix='', offset=1):
- '''Returns a str representing the name for a new entry.
- The name is formed by the prefix and an incremental numeric suffix.
- The offset indicates the start of the numeric suffix search'''
- i = offset
- while True:
- entry = "%s%i" % (prefix, i)
- if suffix:
- entry += " - " + suffix
- try:
- self.fd.opengroup(entry,'NXentry')
- self.fd.closegroup()
- i += 1
- except ValueError: #no such group name exists
- return entry
-
- def _nxln(self, src, dst):
- '''convenience function to create NX links with just one call. On successful return, dst will be open.
-
- :param src: (str) the nxpath to the source group or dataset
- :param dst: (str) the nxpath to the group that will hold the link
-
- .. note:: `groupname:nxclass` notation can be used for both paths for better performance
- '''
- self.fd.openpath(src)
- try:
- nid = self.fd.getdataID()
- except self.nxs.NeXusError:
- nid = self.fd.getgroupID()
- self.fd.openpath(dst)
- self.fd.makelink(nid)
-
- def _createBranch(self, path):
- """
- Navigates the nexus tree starting in / and finishing in path.
-
- If path does not start with `/<something>:NXentry`, the current entry is
- prepended to it.
-
- This method creates the groups if they do not exist. If the
- path is given using `name:nxclass` notation, the given nxclass is used.
- Otherwise, the class name is obtained from self.instrDict values (and if
- not found, it defaults to NXcollection). If successful, path is left
- open
- """
- m = self._nxentryInPath.match(path)
- if m is None:
- self._createBranch("/%s:NXentry" % self.entryname) #if at all, it will recurse just once
-# self.fd.openpath("/%s:NXentry" % self.entryname)
- else:
- self.fd.openpath("/")
-
- relpath = ""
- for g in path.split('/'):
- if len(g) == 0:
- continue
- relpath = relpath + "/"+ g
- if ':' in g:
- g,group_type = g.split(':')
- else:
- try:
- group_type = self.instrDict[relpath].klass
- except:
- group_type = 'NXcollection'
- try:
- self.fd.opengroup(g, group_type)
- except:
- self.fd.makegroup(g, group_type)
- self.fd.opengroup(g, group_type)
-
-
-class NXscan_FileRecorder(BaseNAPI_FileRecorder):
- """saves data to a nexus file that follows the NXscan application definition
-
- """
-
- def __init__(self, filename=None, macro=None, overwrite=False, **pars):
- BaseNAPI_FileRecorder.__init__(self, filename=filename, macro=macro, overwrite=overwrite, **pars)
-
- def _startRecordList(self, recordlist):
- nxs = self.nxs
- nxfilemode = self.getFormat()
-
- if self.filename is None:
- return
-
- self.currentlist = recordlist
- env = self.currentlist.getEnviron()
- serialno = env["serialno"]
- self._dataCompressionRank = env.get("DataCompressionRank", self._dataCompressionRank)
-
- if not self.overwrite and os.path.exists(self.filename): nxfilemode='rw'
- self.fd = nxs.open(self.filename, nxfilemode)
- self.entryname = "entry%d" % serialno
- try:
- self.fd.makegroup(self.entryname,"NXentry")
- except NeXusError:
- entrynames = self.fd.getentries().keys()
-
- #===================================================================
- ##Warn and abort
- if self.entryname in entrynames:
- raise RuntimeError(('"%s" already exists in %s. To prevent data corruption the macro will be aborted.\n'%(self.entryname, self.filename)+
- 'This is likely caused by a wrong ScanID\n'+
- 'Possible workarounds:\n'+
- ' * first, try re-running this macro (the ScanID may be automatically corrected)\n'
- ' * if not, try changing ScanID with senv, or...\n'+
- ' * change the file name (%s will be in both files containing different data)\n'%self.entryname+
- '\nPlease report this problem.'))
- else:
- raise
- #===================================================================
-
- #===================================================================
- ## Warn and continue writing to another entry
- #if self.entryname in entrynames:
- # i = 2
- # newname = "%s_%i"%(self.entryname,i)
- # while(newname in entrynames):
- # i +=1
- # newname = "%s_%i"%(self.entryname,i)
- # self.warning('"%s" already exists. Using "%s" instead. This may indicate a bug in %s',self.entryname, newname, self.macro.name)
- # self.macro.warning('"%s" already exists. Using "%s" instead. \nThis may indicate a bug in %s. Please report it.',self.entryname, newname, self.macro.name)
- # self.entryname = newname
- # self.fd.makegroup(self.entryname,"NXentry")
- #===================================================================
-
- self.fd.opengroup(self.entryname,"NXentry")
-
-
- #adapt the datadesc to the NeXus requirements
- self.datadesc = []
- for dd in env['datadesc']:
- dd = dd.clone()
- dd.label = self.sanitizeName(dd.label)
- if dd.dtype == 'bool':
- dd.dtype = 'int8'
- self.debug('%s will be stored with type=%s',dd.name,dd.dtype)
- if dd.dtype in self.supported_dtypes:
- self.datadesc.append(dd)
- else:
- self.warning('%s will not be stored. Reason: type %s not supported',dd.name,dd.dtype)
-
- #make a dictionary out of env['instrumentlist'] (use fullnames -paths- as keys)
- self.instrDict = {}
- for inst in env.get('instrumentlist', []):
- self.instrDict[inst.getFullName()] = inst
- if self.instrDict is {}:
- self.warning("missing information on NEXUS structure. Nexus Tree won't be created")
-
- self.debug("starting new recording %d on file %s", env['serialno'], self.filename)
-
- #populate the entry with some data
- self._writeData('definition', 'NXscan', 'char') #this is the Application Definition for NeXus Generic Scans
- import sardana.release
- program_name = "%s (%s)" % (sardana.release.name, self.__class__.__name__)
- self._writeData('program_name', program_name, 'char', attrs={'version':sardana.release.version})
- self._writeData("start_time",env['starttime'].isoformat(),'char') #note: the type should be NX_DATE_TIME, but the nxs python api does not recognize it
- self.fd.putattr("epoch",time.mktime(env['starttime'].timetuple()))
- self._writeData("title",env['title'],'char')
- self._writeData("entry_identifier",str(env['serialno']),'char')
- self.fd.makegroup("user","NXuser") #user data goes in a separate group following NX convention...
- self.fd.opengroup("user","NXuser")
- self._writeData("name",env['user'],'char')
- self.fd.closegroup()
-
- #prepare the "measurement" group
- self._createBranch("measurement:NXcollection")
- if self.savemode == SaveModes.Record:
- #create extensible datasets
- for dd in self.datadesc:
- self._makedata(dd.label, dd.dtype, [nxs.UNLIMITED] + list(dd.shape), chunks=[1] + list(dd.shape)) #the first dimension is extensible
- if hasattr(dd, 'data_units'):
- self.fd.opendata(dd.label)
- self.fd.putattr('units', dd.data_units)
- self.fd.closedata()
-
- else:
- #leave the creation of the datasets to _writeRecordList (when we actually know the length of the data to write)
- pass
-
- self._createPreScanSnapshot(env)
-
- self.fd.flush()
-
- def _createPreScanSnapshot(self, env):
- #write the pre-scan snapshot in the "measurement:NXcollection/pre_scan_snapshot:NXcollection" group
- self.preScanSnapShot = env.get('preScanSnapShot',[])
- self._createBranch('measurement:NXcollection/pre_scan_snapshot:NXcollection')
- links = {}
- for dd in self.preScanSnapShot: #desc is a ColumnDesc object
- label = self.sanitizeName(dd.label)
- dtype = dd.dtype
- pre_scan_value = dd.pre_scan_value
- if dd.dtype == 'bool':
- dtype = 'int8'
- pre_scan_value = numpy.int8(dd.pre_scan_value)
- self.debug('Pre-scan snapshot of %s will be stored with type=%s',dd.name, dtype)
- if dtype in self.supported_dtypes:
- nid = self._writeData(label, pre_scan_value, dtype, shape=dd.shape or (1,)) #@todo: fallback shape is hardcoded!
- links[label] = nid
- else:
- self.warning('Pre-scan snapshot of %s will not be stored. Reason: type %s not supported',dd.name, dtype)
-
- self.fd.closegroup() #we are back at the measurement group
-
- measurement_entries = self.fd.getentries()
- for label,nid in links.items():
- if label not in measurement_entries:
- self.fd.makelink(nid)
-
- def _writeRecord(self, record):
- if self.filename is None:
- return
- # most used variables in the loop
- fd, debug, warning = self.fd, self.debug, self.warning
- nparray, npshape = numpy.array, numpy.shape
- rec_data, rec_nb = record.data, record.recordno
-
- for dd in self.datadesc:
- if record.data.has_key( dd.name ):
- data = rec_data[dd.name]
- fd.opendata(dd.label)
-
- if data is None:
- data = numpy.zeros(dd.shape, dtype=dd.dtype)
- if not hasattr(data, 'shape'):
- data = nparray([data], dtype=dd.dtype)
- elif dd.dtype != data.dtype.name:
- debug('%s casted to %s (was %s)', dd.label, dd.dtype,
- data.dtype.name)
- data = data.astype(dd.dtype)
-
- slab_offset = [rec_nb] + [0] * len(dd.shape)
- shape = [1] + list(npshape(data))
- try:
- fd.putslab(data, slab_offset, shape)
- except:
- warning("Could not write <%s> with shape %s", data, shape)
- raise
-
- ###Note: the following 3 lines of code were substituted by the one above.
- ### (now we trust the datadesc info instead of asking the nxs file each time)
- #shape,dtype=self.fd.getinfo()
- #shape[0]=1 #the shape of the record is of just 1 slab in the extensible dimension (first dim)
- #self.fd.putslab(record.data[lbl],[record.recordno]+[0]*(len(shape)-1),shape)
- fd.closedata()
- else:
- debug("missing data for label '%s'", dd.label)
- fd.flush()
-
- def _endRecordList(self, recordlist):
-
- if self.filename is None:
- return
-
- self._populateInstrumentInfo()
- self._createNXData()
-
- env = self.currentlist.getEnviron()
- self.fd.openpath("/%s:NXentry" % self.entryname)
- self._writeData("end_time",env['endtime'].isoformat(),'char')
- self.fd.flush()
- self.debug("Finishing recording %d on file %s:", env['serialno'], self.filename)
- #self.fd.show('.') #prints nexus file summary on stdout (only the current entry)
- self.fd.close()
- self.currentlist = None
-
- def writeRecordList(self, recordlist):
- """Called when in BLOCK writing mode"""
- self._startRecordList( recordlist )
- for dd in self.datadesc:
- self._makedata(dd.label, dd.dtype, [len(recordlist.records)]+list(dd.shape), chunks=[1]+list(dd.shape))
- self.fd.opendata(dd.label)
- try:
- #try creating a single block to write it at once
- block=numpy.array([r.data[dd.label] for r in recordlist.records],dtype=dd.dtype)
- #if dd.dtype !='char': block=numpy.array(block,dtype=dtype) #char not supported anyway
- self.fd.putdata(block)
- except KeyError:
- #if not all the records contain this field, we cannot write it as a block.. so do it record by record (but only this field!)
- for record in recordlist.records:
- if record.data.has_key( dd.label ):
- self.fd.putslab(record.data[dd.label],[record.recordno]+[0]*len(dd.shape),[1]+list(dd.shape))
- else:
- self.debug("missing data for label '%s' in record %i", dd.label, record.recordno)
- self.fd.closedata()
- self._endRecordList( recordlist )
-
- def _populateInstrumentInfo(self):
- measurementpath = "/%s:NXentry/measurement:NXcollection" % self.entryname
- #create a link for each
- for dd in self.datadesc:
- if getattr(dd, 'instrument', None): #we don't link if it is None or it is empty
- try:
- datapath = "%s/%s" % (measurementpath, dd.label)
- self.fd.openpath(datapath)
- nid = self.fd.getdataID()
- self._createBranch(dd.instrument)
- self.fd.makelink(nid)
- except Exception,e:
- self.warning("Could not create link to '%s' in '%s'. Reason: %s",datapath, dd.instrument, repr(e))
-
- for dd in self.preScanSnapShot:
- if getattr(dd,'instrument', None):
- try:
- label = self.sanitizeName(dd.label)
- datapath = "%s/pre_scan_snapshot:NXcollection/%s" % (measurementpath, label)
- self.fd.openpath(datapath)
- nid = self.fd.getdataID()
- self._createBranch(dd.instrument)
- self.fd.makelink(nid)
- except Exception,e:
- self.warning("Could not create link to '%s' in '%s'. Reason: %s",datapath, dd.instrument, repr(e))
-
- def _createNXData(self):
- '''Creates groups of type NXdata by making links to the corresponding datasets
- '''
- #classify by type of plot:
- plots1d = {}
- plots1d_names = {}
- i = 1
- for dd in self.datadesc:
- ptype = getattr(dd, 'plot_type', PlotType.No)
- if ptype == PlotType.No:
- continue
- elif ptype == PlotType.Spectrum:
- axes = ":".join(dd.plot_axes) #converting the list into a colon-separated string
- if axes in plots1d:
- plots1d[axes].append(dd)
- else:
- plots1d[axes] = [dd]
- plots1d_names[axes] = 'plot_%i' % i #Note that datatesc ordering determines group name indexing
- i += 1
- else:
- continue #@todo: implement support for images and other
-
- #write the 1D NXdata group
- for axes, v in plots1d.items():
- self.fd.openpath("/%s:NXentry" % (self.entryname))
- groupname = plots1d_names[axes]
- self.fd.makegroup(groupname,'NXdata')
- #write the signals
- for i, dd in enumerate(v):
- src = "/%s:NXentry/measurement:NXcollection/%s" % (self.entryname, dd.label)
- dst = "/%s:NXentry/%s:NXdata" % (self.entryname, groupname)
- self._nxln(src, dst)
- self.fd.opendata(dd.label)
- self.fd.putattr('signal', min(i + 1, 2))
- self.fd.putattr('axes', axes)
- self.fd.putattr('interpretation', 'spectrum')
- #write the axes
- for axis in axes.split(':'):
- src = "/%s:NXentry/measurement:NXcollection/%s" % (self.entryname, axis)
- dst = "/%s:NXentry/%s:NXdata" % (self.entryname, groupname)
- try:
- self._nxln(src, dst)
- except:
- self.warning("cannot create link for '%s'. Skipping",axis)
-
- def _addCustomData(self, value, name, nxpath=None, dtype=None, **kwargs):
- '''
- apart from value and name, this recorder can use the following optional parameters:
-
- :param nxpath: (str) a nexus path (optionally using name:nxclass notation for
- the group names). See the rules for automatic nxclass
- resolution used by
- :meth:`NXscan_FileRecorder._createBranch`.
- If None given, it defaults to
- nxpath='custom_data:NXcollection'
-
- :param dtype: name of data type (it is inferred from value if not given)
-
- '''
- if nxpath is None:
- nxpath = 'custom_data:NXcollection'
- if dtype is None:
- if numpy.isscalar(value):
- dtype = numpy.dtype(type(value)).name
- if numpy.issubdtype(dtype, str):
- dtype = 'char'
- if dtype == 'bool':
- value, dtype = int(value), 'int8'
- else:
- value = numpy.array(value)
- dtype = value.dtype.name
-
- if dtype not in self.supported_dtypes and dtype != 'char':
- self.warning("cannot write '%s'. Reason: unsupported data type",name)
- return
- #open the file if necessary
- fileWasClosed = self.fd is None or not self.fd.isopen
- if fileWasClosed:
- if not self.overwrite and os.path.exists(self.filename): nxfilemode = 'rw'
- import nxs
- self.fd = nxs.open(self.filename, nxfilemode)
- #write the data
- self._createBranch(nxpath)
- try:
- self._writeData(name, value, dtype)
- except ValueError, e:
- msg = "Error writing %s. Reason: %s" % (name, str(e))
- self.warning(msg)
- self.macro.warning(msg)
- #leave the file as it was
- if fileWasClosed:
- self.fd.close()
-
-
-class NXxas_FileRecorder(BaseNEXUS_FileRecorder):
- """saves data to a nexus file that follows the NXsas application definition
-
- """
-
- def __init__(self, filename=None, macro=None, overwrite=False, **pars):
- BaseNEXUS_FileRecorder.__init__(self, filename=filename, macro=macro, overwrite=overwrite, **pars)
-
-
- def _startRecordList(self, recordlist):
- nxs = self.nxs
- if self.filename is None:
- return
-
- #get the recordlist environment
- self.currentlist = recordlist
- env = self.currentlist.getEnviron()
-
- #adapt the datadesc to the NeXus requirements
- self.datadesc = []
- for dd in env['datadesc']:
- dd = dd.clone()
- dd.label = self.sanitizeName(dd.label)
- if dd.dtype == 'bool':
- dd.dtype = 'int8'
- self.debug('%s will be stored with type=%s',dd.name,dd.dtype)
- if dd.dtype in self.supported_dtypes:
- self.datadesc.append(dd)
- else:
- self.warning('%s will not be stored. Reason: type %s not supported',dd.name,dd.dtype)
-
-
- serialno = env["serialno"]
- nxfilemode = self.getFormat()
- if not self.overwrite and os.path.exists(self.filename): nxfilemode='rw'
-
- self.debug("starting new recording %d on file %s", serialno, self.filename)
-
- #create an nxentry and write it to file
- self.nxentry = nxs.NXentry(name= "entry%d" % serialno)
- self.nxentry.save(self.filename, format=nxfilemode)
-
- #add fields to nxentry
- import sardana.release
- program_name = "%s (%s)" % (sardana.release.name, self.__class__.__name__)
- self.nxentry.insert(nxs.NXfield(name='start_time', value=env['starttime'].isoformat()))
- self.nxentry.insert(nxs.NXfield(name='title', value=env['title']))
- self.nxentry.insert(nxs.NXfield(name='definition', value='NXxas'))
- self.nxentry.insert(nxs.NXfield(name='epoch', value=time.mktime(env['starttime'].timetuple())))
- self.nxentry.insert(nxs.NXfield(name='program_name', value=program_name, attrs={'version':sardana.release.version}))
- self.nxentry.insert(nxs.NXfield(name='entry_identifier', value=env['serialno']))
-
- #add the "measurement" group (a NXcollection containing all counters from the mntgrp for convenience)
- measurement = nxs.NXcollection(name='measurement')
- self.ddfieldsDict = {}
- for dd in self.datadesc:
- field = NXfield_comp(name=dd.label,
- dtype=dd.dtype,
- shape=[nxs.UNLIMITED] + list(dd.shape),
- nxslab_dims=[1] + list(dd.shape)
- )
- if hasattr(dd,'data_units'):
- field.attrs['units'] = dd.data_units
- measurement.insert(field)
- #create a dict of fields in the datadesc for easier access later on
- self.ddfieldsDict[dd.label] = field
-
- self.nxentry.insert(measurement)
-
- #user group
- nxuser = nxs.NXuser()
- self.nxentry.insert(nxuser)
- nxuser['name'] = env['user']
-
- #sample group
- nxsample = nxs.NXsample()
- self.nxentry.insert(nxsample)
- nxsample['name'] = env['SampleInfo'].get('name','Unknown')
-
- #monitor group
- scan_acq_time = env.get('integ_time')
- scan_monitor_mode = scan_acq_time>1 and 'timer' or 'monitor'
- nxmonitor = nxs.NXmonitor(mode=scan_monitor_mode,
- preset=scan_acq_time)
- self.nxentry.insert(nxmonitor)
- monitor_data = self.ddfieldsDict[self.sanitizeName(env['monitor'])] #to be linked later on
-
- #instrument group
- nxinstrument = nxs.NXinstrument()
- self.nxentry.insert(nxinstrument)
-
- #monochromator group
- nxmonochromator = nxs.NXmonochromator()
- nxinstrument.insert(nxmonochromator)
- energy_data = self.ddfieldsDict[self.sanitizeName(env['monochromator'])] #to be linked later on
-
- #incoming_beam group
- nxincoming_beam = nxs.NXdetector(name='incoming_beam')
- nxinstrument.insert(nxincoming_beam)
- incbeam_data = self.ddfieldsDict[self.sanitizeName(env['incbeam'])] #to be linked later on
-
- #absorbed_beam group
- nxabsorbed_beam = nxs.NXdetector(name='absorbed_beam')
- nxinstrument.insert(nxabsorbed_beam)
- absbeam_data = self.ddfieldsDict[self.sanitizeName(env['absbeam'])] #to be linked later on
- absbeam_data.attrs['signal'] = '1'
- absbeam_data.attrs['axes'] = 'energy'
-
- #source group
- nxsource = nxs.NXsource()
- nxinstrument.insert(nxsource)
- nxinstrument['source']['name'] = env.get('SourceInfo',{}).get('name','Unknown')
- nxinstrument['source']['type'] = env.get('SourceInfo',{}).get('type','Unknown')
- nxinstrument['source']['probe'] = env.get('SourceInfo',{}).get('x-ray','Unknown')
-
- #data group
- nxdata = nxs.NXdata()
- self.nxentry.insert(nxdata)
-
-
- #@todo create the PreScanSnapshot
- #self._createPreScanSnapshot(env)
-
- #write everything to file
- self.nxentry.write()
-
- #@todo: do this with the PyTree api instead(how to do named links with the PyTree API????)
- self._nxln(monitor_data, nxmonitor, name='data')
- self._nxln(incbeam_data, nxincoming_beam, name='data')
- self._nxln(absbeam_data, nxabsorbed_beam, name='data')
- self._nxln(energy_data, nxmonochromator, name='energy')
- self._nxln(energy_data, nxdata, name='energy')
- self._nxln(absbeam_data, nxdata, name='absorbed_beam')
-
- self.nxentry.nxfile.flush()
-
-
- def _writeRecord(self, record):
- # most used variables in the loop
- fd, debug, warning = self.nxentry.nxfile, self.debug, self.warning
- nparray, npshape = numpy.array, numpy.shape
- rec_data, rec_nb = record.data, record.recordno
-
- for dd in self.datadesc:
- if record.data.has_key( dd.name ):
- data = rec_data[dd.name]
- field = self.ddfieldsDict[dd.label]
-
- if data is None:
- data = numpy.zeros(dd.shape, dtype=dd.dtype)
- if not hasattr(data, 'shape'):
- data = nparray([data], dtype=dd.dtype)
- elif dd.dtype != data.dtype.name:
- debug('%s casted to %s (was %s)', dd.label, dd.dtype,
- data.dtype.name)
- data = data.astype(dd.dtype)
-
- slab_offset = [rec_nb] + [0] * len(dd.shape)
- shape = [1] + list(npshape(data))
- try:
- field.put(data, slab_offset, shape)
- field.write()
- except:
- warning("Could not write <%s> with shape %s", data, shape)
- raise
- else:
- debug("missing data for label '%s'", dd.label)
- self.nxentry.nxfile.flush()
-
-
- def _endRecordList(self, recordlist):
- env=self.currentlist.getEnviron()
- self.nxentry.insert(nxs.NXfield(name='end_time', value=env['endtime'].isoformat()))
- #self._populateInstrumentInfo()
- #self._createNXData()
- self.nxentry.write()
- self.nxentry.nxfile.flush()
- self.debug("Finishing recording %d on file %s:", env['serialno'], self.filename)
- return
-
-
-
-#===============================================================================
-# BEGIN: THIS BLOCK SHOULD BE REMOVED IF NEXUS ACCEPTS THE PATCH TO NXfield
-#===============================================================================
-try:
- from nxs import NXfield #needs Nexus v>=4.3
- from nxs import napi, NeXusError
-
- class NXfield_comp(NXfield):
-
- #NOTE: THE CONSTRUCTOR IS OPTIONAL. IF NOT IMPLEMENTED, WE CAN STILL USE THE nxslab_dims PROPERTY
- def __init__(self, value=None, name='field', dtype=None, shape=(), group=None,
- attrs={}, nxslab_dims=None, **attr):
- NXfield.__init__(self, value=value, name=name, dtype=dtype, shape=shape, group=group,
- attrs=attrs, **attr)
- self._slab_dims = nxslab_dims
-
- def write(self):
- """
- Write the NXfield, including attributes, to the NeXus file.
- """
- if self.nxfile:
- if self.nxfile.mode == napi.ACC_READ:
- raise NeXusError("NeXus file is readonly")
- if not self.infile:
- shape = self.shape
- if shape == (): shape = (1,)
- with self.nxgroup as path:
- if self.nxslab_dims is not None:
- #compress
- path.compmakedata(self.nxname, self.dtype, shape, 'lzw',
- self.nxslab_dims)
- else:
- # Don't use compression
- path.makedata(self.nxname, self.dtype, shape)
- self._infile = True
- if not self.saved:
- with self as path:
- path._writeattrs(self.attrs)
- value = self.nxdata
- if value is not None:
- path.putdata(value)
- self._saved = True
- else:
- raise IOError("Data is not attached to a file")
-
- def _getnxslabdims(self):
- try:
- return self._nxslab_dims
- except:
- slab_dims = None
- #even if slab_dims have not been set, check if the dataset is large
- shape = self.shape or (1,)
- if numpy.prod(shape) > 10000:
- slab_dims = numpy.ones(len(shape),'i')
- slab_dims[-1] = min(shape[-1], 100000)
- return slab_dims
-
- def _setnxslabdims(self, slab_dims):
- self._nxslab_dims = slab_dims
-
- nxslab_dims = property(_getnxslabdims,_setnxslabdims,doc="Slab (a.k.a. chunk) dimensions for compression")
-except:
- pass #NXxas_FileRecorder won't be usable
-
-
-#===============================================================================
-# END: THE ABOVE BLOCK SHOULD BE REMOVED IF NEXUS ACCEPTS THE PATCH TO NXfield
-#===============================================================================
-
-
-def FileRecorder(filename, macro, **pars):
- ext = os.path.splitext(filename)[1].lower() or '.spec'
-
- hintedklass = globals().get(getattr(macro,'hints',{}).get('FileRecorder',None))
-
- if hintedklass is not None and issubclass(hintedklass, BaseFileRecorder):
- klass = hintedklass
- elif ext in NXscan_FileRecorder.formats.values():
- klass = NXscan_FileRecorder
- elif ext in FIO_FileRecorder.formats.values():
- klass = FIO_FileRecorder
- else:
- klass = SPEC_FileRecorder
- return klass(filename=filename, macro=macro, **pars)
diff --git a/src/sardana/macroserver/scan/scandata.py b/src/sardana/macroserver/scan/scandata.py
deleted file mode 100644
index 9fb6eef2..00000000
--- a/src/sardana/macroserver/scan/scandata.py
+++ /dev/null
@@ -1,301 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the macro server scan data module"""
-
-__all__ = ["ColumnDesc", "MoveableDesc", "Record", "RecordEnvironment",
- "ScanDataEnvironment", "RecordList", "ScanData", "ScanFactory"]
-
-import copy
-
-from taurus.core.util.singleton import Singleton
-
-from sardana.macroserver.scan.recorder import DataHandler
-
-
-class ColumnDesc:
- """The description of a column for a Record"""
-
- _TYPE_MAP = {"short": "int16",
- "ushort": "uint16"}
- _shape = []
- _dtype = 'float64'
-
- def __init__(self, **kwargs):
- """Expected keywords are:
-
- - name (str, mandatory): unique column name
- - label (str, optional): column label (defaults to name)
- - dtype (str, optional): data type. Defaults to 'float64'
- - shape (seq, optional): data shape. Defaults to []
-
- Any keyword not in the previous list will be converted to a member of
- the :class:`ColumnDesc`"""
- #enforce that the mandatory arguments are present
- try:
- self.name = kwargs.pop('name')
- except:
- raise TypeError('"name" parameter is mandatory')
-
- #make sure that at least the required members exist
- self.label = kwargs.pop('label', self.name)
- self.setDtype(kwargs.pop('dtype', self.__class__._dtype))
- self.setShape(kwargs.pop('shape', self.__class__._shape))
-
- # create members of the ColumnDesc class using the remaining keyword
- # args
- self._extra_kwargs = kwargs
- self.__dict__.update(kwargs)
-
- def getShape(self):
- return self._shape
-
- def setShape(self, shape):
- self._shape = self._simplifyShape(shape)
-
- def getDtype(self):
- return self._dtype
-
- def setDtype(self, dtype):
- self._dtype = self.tr(dtype)
-
- shape = property(getShape, setShape)
- dtype = property(getDtype, setDtype)
-
- @staticmethod
- def _simplifyShape(s):
- '''the idea is to strip the shape of useless "ones" at the beginning.
- For example:
-
- - () -> ()
- - (1,) -> ()
- - (1,1,1,1) -> ()
- - (2,) -> (2)
- - (1,2) -> (2)
- - (1,2,3) -> (2,3)
- - (2,3) -> (2,3)
- - (1,1,1,2,3) -> (2,3)
- - (3,1,1) -> (3,1,1)
- '''
- s = list(s)
- for i, e in enumerate(s):
- if e > 1:
- return s[i:]
- return []
-
- def tr(self, dtype):
- return self._TYPE_MAP.get(dtype, dtype)
-
- def toDict(self):
- '''creates a dictionary representation of the record'''
- d = copy.deepcopy(self._extra_kwargs)
- for k in ['name', 'label', 'dtype', 'shape']:
- d[k] = getattr(self, k)
- return d
-
- def clone(self):
- return copy.deepcopy(self)
- #return self.__class__(**self.toDict())
-
-
-class MoveableDesc(ColumnDesc):
-
- def __init__(self, **kwargs):
- """Expected keywords are:
-
- - moveable (Moveable, mandatory): moveable object
- - name (str, optional): column name (defaults to moveable name)
- - label (str, optional): column label (defaults to moveable
- name)
- - dtype (str, optional): data type. Defaults to 'float64'
- - shape (seq, optional): data shape. Defaults to (1,)
- - instrument (Instrument, optional): instrument object.
- Defaults to moveable instrument"""
-
- try:
- self.moveable = moveable = kwargs.pop('moveable')
- except KeyError:
- raise TypeError("moveable parameter is mandatory")
- name = moveable.getName()
- kwargs['name'] = kwargs.get('name', name)
- kwargs['label'] = kwargs.get('label', name)
- kwargs['instrument'] = kwargs.get('instrument', moveable.instrument)
-
- self.min_value = kwargs.get('min_value')
- self.max_value = kwargs.get('max_value')
- self.is_reference = kwargs.get('is_reference')
- ColumnDesc.__init__(self, **kwargs)
-
- def toDict(self):
- d = ColumnDesc.toDict(self)
- d['min_value'] = self.min_value
- d['max_value'] = self.max_value
- d['is_reference'] = self.is_reference
- return d
-
- def clone(self):
- return self.__class__(moveable=self.moveable, **self.toDict())
-
-
-class Record:
- """ One record is a set of values measured at the same time.
-
- The Record.data member will be
- a dictionary containing:
- - 'point_nb' : (int) the point number of the scan
- - for each column of the scan (motor or counter), a key with the
- corresponding column name (str) and the corresponding value
- """
-
- def __init__(self, data):
- self.recordno = 0
- self.data = data
- self.complete = 0
- self.written = 0
-
- def setRecordNo(self, recordno):
- self.recordno = recordno
-
- def setComplete(self):
- self.complete = 1
-
- def setWritten(self):
- self.written = 1
-
-
-class RecordEnvironment(dict):
- """ A RecordEnvironment is a set of arbitrary pairs of type
- label/value in the form of a dictionary.
- """
- __needed = ['title', 'labels']
-
- def isValid(self):
- """ Check valid environment = all needed keys present """
-
- if not self.needed:
- return 1
-
- for ky in self.needed + self.__needed:
- if ky not in self.keys():
- return 0
- else:
- return 1
-
-
-class ScanDataEnvironment(RecordEnvironment):
- """It describes a recordlist and its environment
-
- A recordlist environment contains a number of predefined label/value pairs
- Values can be either a string, a numeric value or a list of strings,
- numbers
-
- title: mandatory
- labels: mandatory. label for each of the fields in a record of the
- recordlist
- fielddesc: description of the content of each of the fields in a record.
- Can be used to affect the way the field is saved by the
- recorder. If not present all fields are by default of type
- FLOAT and FORMAT ".8g"
- """
- needed = ['title', 'labels', 'user']
-
-
-class RecordList(dict):
- """ A RecordList is a set of records: for example a scan.
- It is composed of a environment and a list of records"""
-
- def __init__(self, datahandler, environ=None):
-
- self.datahandler = datahandler
- if environ == None:
- self.environ = RecordEnvironment()
- else:
- self.environ = environ
- self.records = []
-
- # make it pickable
- def __getstate__(self):
- return dict(datahandler=None, environ=None, records=self.records)
-
- def setEnviron(self, environ):
- self.environ = environ
-
- def updateEnviron(self, environ):
- self.environ.update(environ)
-
- def setEnvironValue(self, name, value):
- self.environ[name] = value
-
- def getEnvironValue(self, name):
- return self.environ[name]
-
- def getEnviron(self):
- return self.environ
-
- def start(self):
- self.recordno = 0
- self.datahandler.startRecordList(self)
-
- def addRecord(self, record):
- rc = Record(record)
- rc.setRecordNo(self.recordno)
- self.records.append(rc)
- self[self.recordno] = rc
- self.recordno += 1
-
- self.datahandler.addRecord(self, rc)
-
- def addRecords(self, records):
- map(self.addRecord, records)
-
- def end(self):
- self.datahandler.endRecordList(self)
-
- def getDataHandler(self):
- return self.datahandler
-
-
-class ScanData(RecordList):
-
- def __init__(self, environment=None, data_handler=None):
- dh = data_handler or DataHandler()
- RecordList.__init__(self, dh, environment)
-
-
-class ScanFactory(Singleton):
-
- def __init__(self):
- """ Initialization. Nothing to be done here for now."""
- pass
-
- def init(self, *args):
- """Singleton instance initialization."""
- pass
-
- def getDataHandler(self):
- return DataHandler()
-
- def getScanData(self, dh):
- return ScanData(data_handler=dh)
diff --git a/src/sardana/pool/__init__.py b/src/sardana/pool/__init__.py
deleted file mode 100644
index 5fb3a8cb..00000000
--- a/src/sardana/pool/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the main device pool module"""
-
-__all__ = ["ControllerAPI", "AcqTriggerType", "AcqMode", "PoolUtil"]
-
-__docformat__ = 'restructuredtext'
-
-from .pooldefs import ControllerAPI, AcqTriggerType, AcqMode
-from .poolutil import PoolUtil
diff --git a/src/sardana/pool/controller.py b/src/sardana/pool/controller.py
deleted file mode 100644
index acb8f837..00000000
--- a/src/sardana/pool/controller.py
+++ /dev/null
@@ -1,1378 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of the Controller base classes"""
-
-__all__ = ["DataAccess", "SardanaValue", "Type", "Access", "Description",
- "DefaultValue", "FGet", "FSet",
- "Memorized", "MemorizedNoInit", "NotMemorized", "MaxDimSize",
- "Controller", "Readable", "Startable", "Stopable", "Loadable",
- "MotorController", "CounterTimerController", "ZeroDController",
- "OneDController", "TwoDController",
- "PseudoMotorController", "IORegisterController"]
-
-__docformat__ = 'restructuredtext'
-
-import copy
-
-from taurus.core.taurushelper import getLogLevel
-from taurus.core.util.log import Logger
-
-from sardana import DataAccess
-from sardana.sardanavalue import SardanaValue
-from sardana.pool.pooldefs import ControllerAPI, AcqTriggerType, AcqMode
-
-
-#: Constant data type (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-Type = 'type'
-
-#: Constant data access (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-Access = 'r/w type'
-
-#: Constant description (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-Description = 'description'
-
-#: Constant default value (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-DefaultValue = 'defaultvalue'
-
-#: Constant for getter function (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-FGet = "fget"
-
-#: Constant for setter function (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-FSet = "fset"
-
-#: Constant memorize (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-#: Possible values for this key are :obj:`Memorized`, :obj:`MemorizedNoInit`
-#: and :obj:`NotMemorized`
-Memorize = "memorized"
-
-#: Constant memorized (to be used as a *value* in the :obj:`Memorize` field
-#: definition in :attr:`~Controller.axis_attributes` or
-#: :attr:`~Controller.ctrl_attributes`)
-Memorized = "true"
-
-#: Constant memorize but not write at initialization (to be used as a *value*
-#: in the :obj:`Memorize` field definition in
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-MemorizedNoInit = "true_without_hard_applied"
-
-#: Constant not memorize (to be used as a *value*
-#: in the :obj:`Memorize` field definition in
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-NotMemorized = "false"
-
-#: Constant MaxDimSize (to be used as a *key* in the definition of
-#: :attr:`~Controller.axis_attributes` or :attr:`~Controller.ctrl_attributes`)
-MaxDimSize = "maxdimsize"
-
-
-class Controller(object):
- """Base controller class. Do **NOT** inherit from this class directly
-
- :param str inst: controller instance name
- :param dict props: a dictionary containning pairs of property name,
- property value
- :arg args:
- :keyword kwargs:"""
-
- #: .. deprecated:: 1.0
- #: use :attr:`~Controller.ctrl_properties` instead
- class_prop = {}
-
- #: A sequence of :obj:`str` representing the controller features
- ctrl_features = []
-
- #: .. deprecated:: 1.0
- #: use :attr:`~Controller.axis_attributes` instead
- ctrl_extra_attributes = {}
-
- #: A :class:`dict` containing controller properties where:
- #:
- #: - key : (:obj:`str`) controller property name
- #: - value : :class:`dict` with with three :obj:`str` keys ("type",
- #: "description" and "defaultvalue" case insensitive):
- #:
- #: - for :obj:`Type`, value is one of the values described in
- #: :ref:`sardana-controller-data-type`
- #:
- #: - for :obj:`Description`, value is a :obj:`str` description of the
- #: property.
- #: if is not given it defaults to empty string.
- #:
- #: - for :obj:`DefaultValue`, value is a python object or None if no
- #: default value exists for the property.
- #:
- #: Example::
- #:
- #: from sardana.pool.controller import MotorController, \
- #: Type, Description, DefaultValue
- #:
- #: class MyCtrl(MotorController):
- #:
- #: ctrl_properties = \
- #: {
- #: 'host' : { Type : str,
- #: Description : "host name" },
- #: 'port' : { Type : int,
- #: Description : "port number",
- #: DefaultValue: 5000 }
- #: }
- #:
- ctrl_properties = {}
-
- #: A :class:`dict` containning controller extra attributes where:
- #:
- #: - key : (:obj:`str`) controller attribute name
- #: - value : :class:`dict` with :obj:`str` possible keys: "type",
- #: "r/w type", "description", "fget", "fset" and "maxdimsize"
- #: (case insensitive):
- #:
- #: - for :obj:`Type`, value is one of the values described in
- #: :ref:`sardana-controller-data-type`
- #:
- #: - for :obj:`Access`, value is one of
- #: :obj:`~sardana.sardanadefs.DataAccess` ("read" or "read_write"
- #: (case insensitive) strings are also accepted) [default: ReadWrite]
- #:
- #: - for :obj:`Description`, value is a :obj:`str` description of the
- #: attribute [default: "" (empty string)]
- #:
- #: - for :obj:`FGet`, value is a :obj:`str` with the method name for
- #: the attribute getter [default: "get"<controller attribute name>]
- #:
- #: - for :obj:`FSet`, value is a :obj:`str` with the method name for
- #: the attribute setter. [default, if :obj:`Access` = "read_write":
- #: "set"<controller attribute name>]
- #:
- #: - for :obj:`DefaultValue`, value is a python object or None if no
- #: default value exists for the attribute. If given, the attribute is
- #: set when the controller is first created.
- #:
- #: - for :obj:`Memorize`, value is a :obj:`str` with possible values:
- #: :obj:`Memorized`, :obj:`MemorizedNoInit` and
- #: :obj:`NotMemorized` [default: :obj:`Memorized`]
- #:
- #: .. versionadded:: 1.1
- #:
- #: - for :obj:`MaxDimSize`, value is a :obj:`tuple` with possible values:
- #: - for scalar **must** be an empty tuple ( () or [] )
- #: [default: ()]
- #: - for 1D arrays a sequence with one value (example: (1024,))
- #: [default: (2048,)]
- #: - for 1D arrays a sequence with two values (example: (1024, 1024))
- #: [default: (2048, 2048)]
- #:
- #: .. versionadded:: 1.1
- #:
- #: .. versionadded:: 1.0
- #:
- #: Example::
- #:
- #: from sardana.pool.controller import PseudoMotorController, \
- #: Type, Description, DefaultValue, DataAccess
- #:
- #: class HKLCtrl(PseudoMotorController):
- #:
- #: ctrl_attributes = \
- #: {
- #: 'ReflectionMatrix' : { Type : ( (float,), ),
- #: Description : "The reflection matrix",
- #: Access : DataAccess.ReadOnly,
- #: FGet : 'getReflectionMatrix', },
- #: }
- #:
- #: def getReflectionMatrix(self):
- #: return ( (1.0, 0.0), (0.0, 1.0) )
- ctrl_attributes = {}
-
- #: A :class:`dict` containning controller extra attributes for each axis
- #: where:
- #:
- #: - key : (:obj:`str`) axis attribute name
- #: - value : :class:`dict` with three :obj:`str` keys
- #: ("type", "r/w type", "description" case insensitive):
- #:
- #: - for :obj:`Type`, value is one of the values described in
- #: :ref:`sardana-controller-data-type`
- #:
- #: - for :obj:`Access`, value is one of
- #: :obj:`~sardana.sardanadefs.DataAccess` ("read" or "read_write"
- #: (case insensitive) strings are also accepted)
- #:
- #: - for :obj:`Description`, value is a :obj:`str` description of the
- #: attribute
- #:
- #: - for :obj:`DefaultValue`, value is a python object or None if no
- #: default value exists for the attribute. If given, the attribute is
- #: set when the axis is first created.
- #:
- #: - for :obj:`Memorize`, value is a :obj:`str` with possible values:
- #: :obj:`Memorized`, :obj:`MemorizedNoInit` and
- #: :obj:`NotMemorized` [default: :obj:`Memorized`]
- #:
- #: .. versionadded:: 1.1
- #:
- #: - for :obj:`MaxDimSize`, value is a :obj:`tuple` with possible values:
- #: - for scalar **must** be an empty tuple ( () or [] )
- #: [default: ()]
- #: - for 1D arrays a sequence with one value (example: (1024,))
- #: [default: (2048,)]
- #: - for 1D arrays a sequence with two values (example: (1024, 1024))
- #: [default: (2048, 2048)]
- #:
- #: .. versionadded:: 1.1
- #:
- #: .. versionadded:: 1.0
- #:
- #: Example::
- #:
- #: from sardana.pool.controller import MotorController, \
- #: Type, Description, DefaultValue, DataAccess
- #:
- #: class MyMCtrl(MotorController):
- #:
- #: axis_attributes = \
- #: {
- #: 'EncoderSource' : { Type : str,
- #: Description : 'motor encoder source', },
- #: }
- #:
- #: def getAxisPar(self, axis, name):
- #: name = name.lower()
- #: if name == 'encodersource':
- #: return self._encodersource[axis]
- #:
- #: def setAxisPar(self, axis, name, value):
- #: name = name.lower()
- #: if name == 'encodersource':
- #: self._encodersource[axis] = value
- axis_attributes = {}
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {}
-
- #: A :obj:`str` representing the controller gender
- gender = None
-
- #: A :obj:`str` representing the controller model name
- model = 'Generic'
-
- #: A :obj:`str` representing the controller organization
- organization = 'Sardana team'
-
- #: A :obj:`str` containning the path to the image file
- image = None
-
- #: A :obj:`str` containning the path to the image logo file
- logo = None
-
- def __init__(self, inst, props, *args, **kwargs):
- self._inst_name = inst
- self._log = Logger("Controller.%s" % inst)
- self._log.log_obj.setLevel(getLogLevel())
- self._args = args
- self._kwargs = kwargs
- self._api_version = self._findAPIVersion()
- for prop_name, prop_value in props.items():
- setattr(self, prop_name, prop_value)
-
- def _findAPIVersion(self):
- """*Internal*. By default return the Pool Controller API
- version of the pool where the controller is running"""
- return ControllerAPI
-
- def _getPoolController(self):
- """*Internal*."""
- if hasattr(self, '_kwargs'):
- kw = self._kwargs
- if kw is not None:
- ctrl_wr = kw.get('pool_controller')
- if ctrl_wr is not None:
- return ctrl_wr()
-
- def AddDevice(self, axis):
- """**Controller API**. Override if necessary. Default implementation
- does nothing.
-
- :param int axis: axis number"""
- pass
-
- def DeleteDevice(self, axis):
- """**Controller API**. Override if necessary. Default implementation
- does nothing.
-
- :param int axis: axis number"""
- pass
-
- @property
- def inst_name(self):
- """**Controller API**. The controller instance name.
-
- .. deprecated:: 1.0
- use :meth:`~Controller.GetName` instead"""
- return self._inst_name
-
- def GetName(self):
- """**Controller API**. The controller instance name.
-
- :return: the controller instance name
- :rtype: str
-
- .. versionadded:: 1.0"""
- return self._inst_name
-
- def GetAxisName(self, axis):
- """**Controller API**. The axis name.
-
- :return: the axis name
- :rtype: str
-
- .. versionadded:: 1.0"""
- ctrl = self._getPoolController()
- if ctrl is not None:
- return ctrl.get_element(axis=axis).name
- return str(axis)
-
- def PreStateAll(self):
- """**Controller API**. Override if necessary.
- Called to prepare a read of the state of all axis.
- Default implementation does nothing."""
- pass
-
- def PreStateOne(self, axis):
- """**Controller API**. Override if necessary.
- Called to prepare a read of the state of a single axis.
- Default implementation does nothing.
-
- :param int axis: axis number"""
- pass
-
- def StateAll(self):
- """**Controller API**. Override if necessary.
- Called to read the state of all selected axis.
- Default implementation does nothing."""
- pass
-
- def StateOne(self, axis):
- """**Controller API**. Override is MANDATORY.
- Called to read the state of one axis.
- Default implementation raises :exc:`NotImplementedError`."""
- raise NotImplementedError("StateOne must be defined in the controller")
-
- #def SetCtrlPar(self, unit, parameter, value):
- def SetCtrlPar(self, parameter, value):
- """**Controller API**. Override if necessary.
- Called to set a parameter with a value. Default implementation sets
- this object member named '_'+parameter with the given value.
-
- .. versionadded:: 1.0"""
- setattr(self, '_' + parameter, value)
-
- #def GetCtrlPar(self, unit, parameter):
- def GetCtrlPar(self, parameter):
- """**Controller API**. Override if necessary.
- Called to set a parameter with a value. Default implementation returns
- the value contained in this object's member named '_'+parameter.
-
- .. versionadded:: 1.0"""
- return getattr(self, '_' + parameter)
-
- #def SetAxisPar(self, unit, axis, parameter, value):
- def SetAxisPar(self, axis, parameter, value):
- """**Controller API**. Override is MANDATORY.
- Called to set a parameter with a value on the given axis. Default
- implementation calls deprecated :meth:`~Controller.SetPar` which, by
- default, raises :exc:`NotImplementedError`.
-
- .. versionadded:: 1.0"""
- return self.SetPar(axis, parameter, value)
-
- #def GetAxisPar(self, unit, axis, parameter):
- def GetAxisPar(self, axis, parameter):
- """**Controller API**. Override is MANDATORY.
- Called to get a parameter value on the given axis. Default
- implementation calls deprecated :meth:`~Controller.GetPar` which, by
- default, raises :exc:`NotImplementedError`.
-
- .. versionadded:: 1.0"""
- return self.GetPar(axis, parameter)
-
- def SetAxisExtraPar(self, axis, parameter, value):
- """**Controller API**. Override if necessary.
- Called to set a parameter with a value on the given axis. Default
- implementation calls deprecated :meth:`~Controller.SetExtraAttributePar`
- which, by default, raises :exc:`NotImplementedError`.
-
- .. versionadded:: 1.0"""
- return self.SetExtraAttributePar(axis, parameter, value)
-
- def GetAxisExtraPar(self, axis, parameter):
- """**Controller API**. Override if necessary.
- Called to get a parameter value on the given axis. Default
- implementation calls deprecated :meth:`~Controller.GetExtraAttributePar`
- which, by default, raises :exc:`NotImplementedError`.
-
- .. versionadded:: 1.0"""
- return self.GetExtraAttributePar(axis, parameter)
-
- def SetPar(self, axis, parameter, value):
- """**Controller API**. Called to set a parameter with a value on
- the given axis. Default implementation raises
- :exc:`NotImplementedError`.
-
- .. deprecated:: 1.0
- use :meth:`~Controller.SetAxisPar` instead"""
- raise NotImplementedError("SetAxisPar must be defined in the "
- "controller")
-
- def GetPar(self, axis, parameter):
- """**Controller API**. Called to get a parameter value on the given
- axis. Default implementation raises :exc:`NotImplementedError`.
-
- .. deprecated:: 1.0
- use :meth:`~Controller.GetAxisPar` instead"""
- raise NotImplementedError("GetAxisPar must be defined in the "
- "controller")
-
- def SetExtraAttributePar(self, axis, parameter, value):
- """**Controller API**. Called to set a parameter with a value on the
- given axis. Default implementation raises :exc:`NotImplementedError`.
-
- .. deprecated:: 1.0
- use :meth:`~Controller.SetAxisExtraPar` instead"""
- raise NotImplementedError("SetAxisExtraPar must be defined in the "
- "controller")
-
- def GetExtraAttributePar(self, axis, parameter):
- """**Controller API**. Called to get a parameter value on the given
- axis. Default implementation raises :exc:`NotImplementedError`.
-
- .. deprecated:: 1.0
- use :meth:`~Controller.GetAxisExtraPar` instead"""
- raise NotImplementedError("GetAxisExtraPar must be defined in the "
- "controller")
-
- def GetAxisAttributes(self, axis):
- """**Controller API**. Override if necessary.
- Returns a dictionary of all attributes per axis.
- Default implementation returns a new :class:`dict` with the standard
- attributes plus the :attr:`~Controller.axis_attributes`
-
- :param int axis: axis number
- :return: a dict containing attribute information as defined in
- :attr:`~Controller.axis_attributes`
-
- .. versionadded:: 1.0"""
- ret = copy.deepcopy(self.standard_axis_attributes)
- axis_attrs = copy.deepcopy(self.axis_attributes)
- old_axis_attrs = copy.deepcopy(self.ctrl_extra_attributes)
- ret.update(axis_attrs)
- ret.update(old_axis_attrs)
- return ret
-
- def SendToCtrl(self, stream):
- """**Controller API**. Override if necessary.
- Sends a string to the controller.
- Default implementation raises :exc:`NotImplementedError`.
-
- :param str stream: stream to be sent
- :return: any relevant information e.g. response of the controller
- :rtype: str"""
- raise NotImplementedError("SendToCtrl not implemented")
-
-
-class Startable(object):
- """A Startable interface. A controller for which it's axis are 'startable'
- (like a motor, for example) should implement this interface
-
- .. note: Do not inherit directly from :class:`Startable`."""
-
- def PreStartAll(self):
- """**Controller API**. Override if necessary.
- Called to prepare a start of all axis (whatever pre-start means).
- Default implementation does nothing."""
- pass
-
- def PreStartOne(self, axis, value):
- """**Controller API**. Override if necessary.
- Called to prepare a start of the given axis (whatever pre-start means).
- Default implementation returns True.
-
- :param int axis: axis number
- :param float value: new value
- :return: True means a successfull pre-start or False for a failure
- :rtype: bool"""
- return True
-
- def StartOne(self, axis, value):
- """**Controller API**. Override if necessary.
- Called to do a start of the given axis (whatever start means).
- Default implementation raises :exc:`NotImplementedError`
-
- :param int axis: axis number
- :param float value: new value"""
- raise NotImplementedError("StartOne must be defined in the controller")
-
- def StartAll(self):
- """**Controller API**. Override is MANDATORY!
- Default implementation does nothing."""
- pass
-
-
-class Stopable(object):
- """A Stopable interface. A controller for which it's axis are 'stoppable'
- (like a motor, for example) should implement this interface
-
- .. note: Do not inherit directly from :class:`Stopable`."""
-
- def AbortOne(self, axis):
- """**Controller API**. Override is MANDATORY!
- Default implementation raises :exc:`NotImplementedError`.
- Aborts one of the axis
-
- :param int axis: axis number"""
- raise NotImplementedError("AbortOne must be defined in te controller")
-
- def AbortAll(self):
- """**Controller API**. Override if necessary.
- Aborts all active axis of this controller. Default implementation
- calls :meth:`~Controller.AbortOne` on each active axis.
-
- .. versionadded:: 1.0"""
- exceptions = []
- axes = self._getPoolController().get_element_axis().keys()
- for axis in axes:
- try:
- self.AbortOne(axis)
- except:
- import sys
- exceptions.append(sys.exc_info())
- if len(exceptions) > 0:
- raise Exception(exceptions)
-
- def StopOne(self, axis):
- """**Controller API**. Override if necessary.
- Stops one of the axis.
- *This method is reserved for future implementation.*
- Default implementation calls :meth:`~Controller.AbortOne`.
-
- :param int axis: axis number
-
- .. versionadded:: 1.0"""
- self.AbortOne(axis)
-
- def StopAll(self):
- """**Controller API**. Override if necessary.
- Stops all active axis of this controller.
- *This method is reserved for future implementation.*
- Default implementation calls :meth:`~Controller.StopOne` on each
- active axis.
-
- .. versionadded:: 1.0"""
- exceptions = []
- axes = self._getPoolController().get_element_axis().keys()
- for axis in axes:
- try:
- self.StopOne(axis)
- except:
- import sys
- exceptions.append(sys.exc_info())
- if len(exceptions) > 0:
- raise Exception(exceptions)
-
-
-class Readable(object):
- """A Readable interface. A controller for which it's axis are 'readable'
- (like a motor, counter or 1D for example) should implement this interface
-
- .. note: Do not inherit directly from Readable."""
-
- def PreReadAll(self):
- """**Controller API**. Override if necessary.
- Called to prepare a read of the value of all axis.
- Default implementation does nothing."""
- pass
-
- def PreReadOne(self, axis):
- """**Controller API**. Override if necessary.
- Called to prepare a read of the value of a single axis.
- Default implementation does nothing.
-
- :param int axis: axis number"""
- pass
-
- def ReadAll(self):
- """**Controller API**. Override if necessary.
- Called to read the value of all selected axis
- Default implementation does nothing."""
- pass
-
- def ReadOne(self, axis):
- """**Controller API**. Override is MANDATORY!
- Default implementation raises :exc:`NotImplementedError`
-
- :param int axis: axis number
- :return: the axis value
- :rtype: object
- """
- raise NotImplementedError("ReadOne must be defined in the controller")
-
-
-class Loadable(object):
- """A Loadable interface. A controller for which it's axis are 'loadable'
- (like a counter, 1D or 2D for example) should implement this interface
-
- .. note: Do not inherit directly from Loadable."""
-
- def PreLoadAll(self):
- """**Controller API**. Override if necessary.
- Called to prepare loading the integration time / monitor value.
- Default implementation does nothing."""
- pass
-
- def PreLoadOne(self, axis, value):
- """**Controller API**. Override if necessary.
- Called to prepare loading the master channel axis with the integration
- time / monitor value.
- Default implementation returns True.
-
- :param int axis: axis number
- :param float value: integration time /monitor value
- :return: True means a successfull PreLoadOne or False for a failure
- :rtype: bool"""
- return True
-
- def LoadAll(self):
- """**Controller API**. Override if necessary.
- Called to load the integration time / monitor value.
- Default implementation does nothing."""
- pass
-
- def LoadOne(self, axis, value):
- """**Controller API**. Override is MANDATORY!
- Called to load the integration time / monitor value.
- Default implementation raises :exc:`NotImplementedError`.
-
- :param int axis: axis number
- :param float value: integration time /monitor value"""
- raise NotImplementedError("LoadOne must be defined in the controller")
-
-
-class MotorController(Controller, Startable, Stopable, Readable):
- """Base class for a motor controller. Inherit from this class to implement
- your own motor controller for the device pool.
-
- A motor controller should support these axis parameters:
-
- - acceleration
- - deceleration
- - velocity
- - base_rate
- - step_per_unit
-
- These parameters are configured through the
- :meth:`~Controller.GetAxisPar`/:meth:`~Controller.SetAxisPar`
- API (in version <1.0 the methods were called
- :meth:`~Controller.GetPar`/:meth:`~Controller.SetPar`. Default
- :meth:`~Controller.GetAxisPar` and
- :meth:`~Controller.SetAxisPar` still call
- :meth:`~Controller.GetPar` and :meth:`~Controller.SetPar`
- respectively in order to maintain backward compatibility).
- """
-
- #: A constant representing no active switch.
- NoLimitSwitch = 0
-
- #: A constant representing an active *home* switch.
- #: You can *OR* two or more switches together. For example, to say both
- #: upper and lower limit switches are active::
- #:
- #: limit_switches = self.HomeLimitSwitch | self.LowerLimitSwitch
- HomeLimitSwitch = 1
-
- #: A constant representing an active *upper limit* switch.
- #: You can *OR* two or more switches together. For example, to say both
- #: upper and lower limit switches are active::
- #:
- #: limit_switches = self.UpperLimitSwitch | self.LowerLimitSwitch
- UpperLimitSwitch = 2
-
- #: A constant representing an active *lower limit* switch.
- #: You can *OR* two or more switches together. For example, to say both
- #: upper and lower limit switches are active::
- #:
- #: limit_switches = self.UpperLimitSwitch | self.LowerLimitSwitch
- LowerLimitSwitch = 4
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {
- 'Position' : { 'type' : float,
- 'description' : 'Position', },
- 'DialPosition' : { 'type' : float,
- 'description' : 'Dial Position', },
- 'Offset' : { 'type' : float,
- 'description' : 'Offset', },
- 'Sign' : { 'type' : float,
- 'description' : 'Sign', },
- 'Step_per_unit' : { 'type' : float,
- 'description' : 'Steps per unit', },
- 'Acceleration' : { 'type' : float,
- 'description' : 'Acceleration time (s)', },
- 'Deceleration' : { 'type' : float,
- 'description' : 'Deceleration time (s)', },
- 'Base_rate' : { 'type' : float,
- 'description' : 'Base rate', },
- 'Velocity' : { 'type' : float,
- 'description' : 'Velocity', },
- 'Backlash' : { 'type' : float,
- 'description' : 'Backlash', },
- 'Limit_switches' : { 'type' : (bool,),
- 'description' : "This attribute is the motor "\
- "limit switches state. It's an array with 3 \n"\
- "elements which are:\n"\
- "0 - The home switch\n"\
- "1 - The upper limit switch\n"\
- "2 - The lower limit switch\n"\
- "False means not active. True means active", },
- }
- standard_axis_attributes.update(Controller.standard_axis_attributes)
-
- #: A :obj:`str` representing the controller gender
- gender = 'Motor controller'
-
- def GetAxisAttributes(self, axis):
- """**Motor Controller API**. Override if necessary.
- Returns a sequence of all attributes per axis.
- Default implementation returns a :class:`dict` containning:
-
- - Position
- - DialPosition
- - Offset
- - Sign
- - Step_per_unit
- - Acceleration
- - Deceleration
- - Base_rate
- - Velocity
- - Backlash
- - Limit_switches
-
- plus all attributes contained in :attr:`~Controller.axis_attributes`
-
- .. note::
- Normally you don't need to Override this method. You just implement
- the class member :attr:`~Controller.axis_attributes`. Typically,
- you will need to Override this method in two cases:
-
- - certain axes contain a different set of extra attributes
- which cannot be simply defined in
- :attr:`~Controller.axis_attributes`
- - some axes (or all) don't implement a set of standard
- moveable parameters (ex.: if a motor controller is created to
- control a power supply, it may have a position (current) and
- a velocity (ramp speed) but it may not have acceleration)
-
- :param int axis: axis number
- :return: a dict containing attribute information as defined in
- :attr:`~Controller.axis_attributes`
-
- .. versionadded:: 1.0"""
- return Controller.GetAxisAttributes(self, axis)
-
- def DefinePosition(self, axis, position):
- """**Motor Controller API**. Override is recommended!
- This method is called to load a new motor position.
- Default implementation does nothing.
- """
-# raise NotImplementedError("DefinePosition must be defined in the "
-# "controller")
- pass
-
-
-class CounterTimerController(Controller, Readable, Startable, Stopable, Loadable):
- """Base class for a counter/timer controller. Inherit from this class to
- implement your own counter/timer controller for the device pool.
-
- A counter timer controller should support these controller parameters:
-
- - timer
- - monitor
- - trigger_type"""
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {
- 'Value' : { 'type' : float,
- 'description' : 'Value', },
- }
- standard_axis_attributes.update(Controller.standard_axis_attributes)
-
- #: A :obj:`str` representing the controller gender
- gender = 'Counter/Timer controller'
-
- def __init__(self, inst, props, *args, **kwargs):
- Controller.__init__(self, inst, props, *args, **kwargs)
- self._timer = None
- self._monitor = None
- self._master = None
- self._trigger_type = AcqTriggerType.Unknown
-
- def PreStartAllCT(self):
- """**Counter/Timer Controller API**. Override if necessary.
- Called to prepare an acquisition of all selected axis.
- Default implementation does nothing.
-
- .. deprecated:: 1.0
- use :meth:`~CounterTimerController.PreStartAll` instead"""
- pass
-
- def PreStartOneCT(self, axis):
- """**Counter/Timer Controller API**. Override if necessary.
- Called to prepare an acquisition a single axis.
- Default implementation returns True.
-
- :param int axis: axis number
- :return: True means a successfull PreStartOneCT or False for a failure
- :rtype: bool
-
- .. deprecated:: 1.0
- use :meth:`~CounterTimerController.PreStartOne` instead"""
- return True
-
- def StartOneCT(self, axis):
- """**Counter/Timer Controller API**. Override if necessary.
- Called to start an acquisition of a selected axis.
- Default implementation does nothing.
-
- :param int axis: axis number
-
- .. deprecated:: 1.0
- use :meth:`~CounterTimerController.StartOne` instead"""
- pass
-
- def StartAllCT(self):
- """**Counter/Timer Controller API**. Override is MANDATORY!
- Called to start an acquisition of a selected axis.
- Default implementation raises :exc:`NotImplementedError`.
-
- .. deprecated:: 1.0
- use :meth:`~CounterTimerController.StartAll` instead"""
- raise NotImplementedError("StartAll must be defined in the "
- "controller")
-
- def PreStartAll(self):
- """**Controller API**. Override if necessary.
- Called to prepare a write of the position of all axis. Default
- implementation calls deprecated
- :meth:`~CounterTimerController.PreStartAllCT` which, by default, does
- nothing.
-
- .. versionadded:: 1.0"""
- return self.PreStartAllCT()
-
- def PreStartOne(self, axis, value=None):
- """**Controller API**. Override if necessary.
- Called to prepare a write of the position of a single axis.
- Default implementation calls deprecated
- :meth:`~CounterTimerController.PreStartOneCT` which, by default,
- returns True.
-
- :param int axis: axis number
- :param float value: the value
- :return: True means a successfull pre-start or False for a failure
- :rtype: bool
-
- .. versionadded:: 1.0"""
- return self.PreStartOneCT(axis)
-
- def StartOne(self, axis, value=None):
- """**Controller API**. Override if necessary.
- Called to write the position of a selected axis. Default
- implementation calls deprecated
- :meth:`~CounterTimerController.StartOneCT` which, by default, does
- nothing.
-
- :param int axis: axis number
- :param float value: the value"""
- return self.StartOneCT(axis)
-
- def StartAll(self):
- """**Controller API**. Override is MANDATORY!
- Default implementation calls deprecated
- :meth:`~CounterTimerController.StartAllCT` which, by default, raises
- :exc:`NotImplementedError`."""
- return self.StartAllCT()
-
-
-class ZeroDController(Controller, Readable, Stopable):
- """Base class for a 0D controller. Inherit from this class to
- implement your own 0D controller for the device pool."""
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {
- 'Value' : { 'type' : float,
- 'description' : 'Value', },
- }
- standard_axis_attributes.update(Controller.standard_axis_attributes)
-
- #: A :obj:`str` representing the controller gender
- gender = '0D controller'
-
- def AbortOne(self, axis):
- """This method is not executed by the system.
- Default implementation does nothing.
-
- :param int axis: axis number"""
- pass
-
-
-class OneDController(Controller, Readable, Startable, Stopable, Loadable):
- """Base class for a 1D controller. Inherit from this class to
- implement your own 1D controller for the device pool.
-
- .. versionadded:: 1.2"""
-
- standard_axis_attributes = {
- 'Value' : { 'type' : (float,),
- 'description' : 'Value',
- 'maxdimsize' : (16*1024,) },
- }
- standard_axis_attributes.update(Controller.standard_axis_attributes)
-
- #: A :obj:`str` representing the controller gender
- gender = '1D controller'
-
- def GetAxisPar(self, axis, parameter):
- """**Controller API**. Override is MANDATORY.
- Called to get a parameter value on the given axis.
- If parameter == 'data_source', default implementation returns None,
- meaning let sardana decide the proper URI for accessing the axis value.
- Otherwise, default implementation calls deprecated
- :meth:`~Controller.GetPar` which, by default, raises
- :exc:`NotImplementedError`.
-
- .. versionadded:: 1.2"""
- if parameter.lower() == 'data_source':
- return None
- return self.GetPar(axis, parameter)
-
-
-class TwoDController(Controller, Readable, Startable, Stopable, Loadable):
- """Base class for a 2D controller. Inherit from this class to
- implement your own 2D controller for the device pool."""
-
- standard_axis_attributes = {
- 'Value' : { 'type' : ((float,),),
- 'description' : 'Value',
- 'maxdimsize' : (4*1024, 4*1024) },
- }
- standard_axis_attributes.update(Controller.standard_axis_attributes)
-
- #: A :obj:`str` representing the controller gender
- gender = '2D controller'
-
- def GetAxisPar(self, axis, parameter):
- """**Controller API**. Override is MANDATORY.
- Called to get a parameter value on the given axis.
- If parameter == 'data_source', default implementation returns None,
- meaning let sardana decide the proper URI for accessing the axis value.
- Otherwise, default implementation calls deprecated
- :meth:`~Controller.GetPar` which, by default, raises
- :exc:`NotImplementedError`.
-
- .. versionadded:: 1.2"""
- if parameter.lower() == 'data_source':
- return None
- return self.GetPar(axis, parameter)
-
-
-class PseudoController(Controller):
- """Base class for all pseudo controllers.
-
- .. note: Do not inherit directly from :class:`PseudoController`."""
-
- def _getElem(self, index_or_role, roles, local_cache, ids):
- """*Iternal*."""
- elem = local_cache.get(index_or_role)
- if elem is None:
- pool = self._getPoolController().pool
- if type(index_or_role) == int:
- index = index_or_role
- role = roles[index]
- else:
- role = index_or_role
- index = roles.index(role)
- motor_id = ids[index]
- elem = pool.get_element_by_id(motor_id)
- local_cache[index] = local_cache[role] = elem
- return elem
-
-
-class PseudoMotorController(PseudoController):
- """Base class for a pseudo motor controller. Inherit from this class to
- implement your own pseudo motor controller for the device pool.
-
- Every Pseudo Motor implementation must be a subclass of this class.
- Current procedure for a correct implementation of a Pseudo Motor class:
-
- - mandatory:
- - define the class level attributes
- :attr:`~PseudoMotorController.pseudo_motor_roles`,
- :attr:`~PseudoMotorController.motor_roles`
- - write :meth:`~PseudoMotorController.CalcPseudo` method
- - write :meth:`~PseudoMotorController.CalcPhysical` method.
- - optional:
- - write :meth:`~PseudoMotorController.CalcAllPseudo` and
- :meth:`~PseudoMotorController.CalcAllPhysical` if great performance
- gain can be achived"""
-
- #: a sequence of strings describing the role of each pseudo motor axis in
- #: this controller
- pseudo_motor_roles = ()
-
- #: a sequence of strings describing the role of each motor in this
- #: controller
- motor_roles = ()
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {
- 'Position' : { 'type' : float,
- 'description' : 'Position', },
- }
-
- #: A :obj:`str` representing the controller gender
- gender = 'Pseudo motor controller'
-
- def __init__(self, inst, props, *args, **kwargs):
- self.__motor_role_elements = {}
- self.__pseudo_motor_role_elements = {}
- PseudoController.__init__(self, inst, props, *args, **kwargs)
-
- def CalcAllPseudo(self, physical_pos, curr_pseudo_pos):
- """**Pseudo Motor Controller API**. Override if necessary.
- Calculates the positions of all pseudo motors that belong to the
- pseudo motor system from the positions of the physical motors.
- Default implementation does a loop calling
- :meth:`PseudoMotorController.calc_pseudo` for each pseudo motor role.
-
- :param sequence<float> physical_pos: a sequence containing physical
- motor positions
- :param sequence<float> curr_pseudo_pos: a sequence containing the
- current pseudo motor
- positions
- :return: a sequece of pseudo motor positions (one for each pseudo
- motor role)
- :rtype: sequence<float>
-
- .. versionadded:: 1.0"""
- ret = []
- for i in range(len(self.pseudo_motor_roles)):
- ret.append(self.CalcPseudo(i+1, physical_pos, curr_pseudo_pos))
- return ret
-
- def CalcAllPhysical(self, pseudo_pos, curr_physical_pos):
- """**Pseudo Motor Controller API**. Override if necessary.
- Calculates the positions of all motors that belong to the pseudo
- motor system from the positions of the pseudo motors.
- Default implementation does a loop calling
- :meth:`PseudoMotorController.calc_physical` for each motor role.
-
- :param sequence<float> pseudo_pos: a sequence containing pseudo motor
- positions
- :param sequence<float> curr_physical_pos: a sequence containing the
- current physical motor
- positions
- :return: a sequece of motor positions (one for each motor role)
- :rtype: sequence<float>
-
- .. versionadded:: 1.0"""
- ret = []
- for i in range(len(self.motor_roles)):
- pos = self.CalcPhysical(i+1, pseudo_pos, curr_physical_pos)
- ret.append(pos)
- return ret
-
- def CalcPseudo(self, axis, physical_pos, curr_pseudo_pos):
- """**Pseudo Motor Controller API**. Override is **MANDATORY**.
- Calculate pseudo motor position given the physical motor positions
-
- :param int axis: the pseudo motor role axis
- :param sequence<float> physical_pos: a sequence containing motor
- positions
- :param sequence<float> curr_pseudo_pos: a sequence containing the
- current pseudo motor
- positions
- :return: a pseudo motor position corresponding to the given axis
- pseudo motor role
- :rtype: float
-
- .. versionadded:: 1.0"""
- return self.calc_pseudo(axis, physical_pos)
-
- def CalcPhysical(self, axis, pseudo_pos, curr_physical_pos):
- """**Pseudo Motor Controller API**. Override is **MANDATORY**.
- Calculate physical motor position given the pseudo motor positions.
-
- :param axis: the motor role axis
- :type axis: int
- :param pseudo_pos: a sequence containing pseudo motor positions
- :type pseudo_pos: sequence<float>
- :param curr_physical_pos: a sequence containing the current physical
- motor positions
- :type curr_physical_pos: sequence<float>
- :return: a motor position corresponding to the given axis motor role
- :rtype: float
-
- .. versionadded:: 1.0"""
- return self.calc_physical(axis, pseudo_pos)
-
- def calc_all_pseudo(self, physical_pos):
- """**Pseudo Motor Controller API**. Override if necessary.
- Calculates the positions of all pseudo motors that belong to the
- pseudo motor system from the positions of the physical motors.
- Default implementation does a loop calling
- :meth:`PseudoMotorController.calc_pseudo` for each pseudo motor role.
-
- :param sequence<float> physical_pos: a sequence of physical motor
- positions
- :return: a sequece of pseudo motor positions (one for each pseudo
- motor role)
- :rtype: sequence<float>
-
- .. deprecated:: 1.0
- implement :meth:`~PseudoMotorController.CalcAllPseudo` instead"""
- ret = []
- for i in range(len(self.pseudo_motor_roles)):
- ret.append(self.calc_pseudo(i+1, physical_pos))
- return ret
-
-
- def calc_all_physical(self, pseudo_pos):
- """**Pseudo Motor Controller API**. Override if necessary.
- Calculates the positions of all motors that belong to the pseudo
- motor system from the positions of the pseudo motors.
- Default implementation does a loop calling
- :meth:`PseudoMotorController.calc_physical` for each motor role.
-
- :param pseudo_pos: a sequence of pseudo motor positions
- :type pseudo_pos: sequence<float>
- :return: a sequece of motor positions (one for each motor role)
- :rtype: sequence<float>
-
- .. deprecated:: 1.0
- implement :meth:`~PseudoMotorController.CalcAllPhysical`
- instead"""
- ret = []
- for i in range(len(self.motor_roles)):
- pos = self.calc_physical(i+1, pseudo_pos)
- ret.append(pos)
- return ret
-
- def calc_pseudo(self, axis, physical_pos):
- """**Pseudo Motor Controller API**. Override is **MANDATORY**.
- Calculate pseudo motor position given the physical motor positions
-
- :param int axis: the pseudo motor role axis
- :param sequence<float> physical_pos: a sequence of motor positions
- :return: a pseudo motor position corresponding to the given axis
- pseudo motor role
- :rtype: float
-
- .. deprecated:: 1.0
- implement :meth:`~PseudoMotorController.CalcPseudo` instead"""
- raise NotImplementedError("CalcPseudo must be defined in te controller")
-
- def calc_physical(self, axis, pseudo_pos):
- """**Pseudo Motor Controller API**. Override is **MANDATORY**.
- Calculate physical motor position given the pseudo motor positions.
-
- :param axis: the motor role axis
- :type axis: int
- :param pseudo_pos: a sequence of pseudo motor positions
- :type pseudo_pos: sequence<float>
- :return: a motor position corresponding to the given axis motor role
- :rtype: float
-
- .. deprecated:: 1.0
- implement :meth:`~PseudoMotorController.CalcPhysical` instead"""
- raise NotImplementedError("CalcPhysical must be defined in the "
- "controller")
-
- def GetMotor(self, index_or_role):
- """Returns the motor for a given role/index.
-
- .. warning::
- * Use with care: Executing motor methods can be dangerous!
-
- * Since the controller is built before any element (including
- motors), this method will **FAIL** when called from the controller
- constructor
-
- :param index_or_role: index number or role name
- :type index_or_role: int or str
- :return: Motor object for the given role/index
- :rtype: :class:`~sardana.pool.poolmotor.PoolMotor`"""
- return self._getElem(index_or_role, self.motor_roles,
- self.__motor_role_elements,
- self._kwargs['motor_ids'])
-
- def GetPseudoMotor(self, index_or_role):
- """Returns the pseudo motor for a given role/index.
-
- .. warning::
- * Use with care: Executing pseudo motor methods can be dangerous!
-
- * Since the controller is built before any element (including pseudo
- motors), this method will **FAIL** when called from the controller
- constructor
-
- :param index_or_role: index number or role name
- :type index_or_role: int or str
- :return: PseudoMotor object for the given role/index
- :rtype: :class:`~sardana.pool.poolpseudomotor.PoolPseudoMotor`"""
- dict_ids = self._getPoolController().get_element_ids()
- dict_axis = self._getPoolController().get_element_axis()
- pseudo_motor_ids = []
- for akey, aname in dict_axis.items():
- pseudo_motor_ids.append(dict_ids.keys()[dict_ids.values().index(aname)])
- return self._getElem(index_or_role, self.pseudo_motor_roles,
- self.__pseudo_motor_role_elements,
- pseudo_motor_ids)
-# self._kwargs['pseudo_motor_roles'])
-
-
-class PseudoCounterController(Controller):
- """Base class for a pseudo counter controller. Inherit from this class to
- implement your own pseudo counter controller for the device pool.
-
- Every Pseudo Counter implementation must be a subclass of this class.
- Current procedure for a correct implementation of a Pseudo Counter class:
-
- - mandatory:
- - define the class level attributes
- :attr:`~PseudoCounterController.counter_roles`,
- - write :meth:`~PseudoCounterController.Calc` method"""
-
- #: a sequence of strings describing the role of each pseudo counter axis in
- #: this controller
- pseudo_counter_roles = ()
-
- #: a sequence of strings describing the role of each counter in this
- #: controller
- counter_roles = ()
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {
- 'Value' : { 'type' : float,
- 'description' : 'Value', },
- }
-
- #: A :obj:`str` representing the controller gender
- gender = 'Pseudo counter controller'
-
- def Calc(self, axis, values):
- """**Pseudo Counter Controller API**. Override is **MANDATORY**.
- Calculate pseudo counter position given the counter values.
-
- :param int axis: the pseudo counter role axis
- :param sequence<float> values: a sequence containing current values
- of underlying elements
- :return: a pseudo counter value corresponding to the given axis
- pseudo counter role
- :rtype: float
-
- .. versionadded:: 1.0"""
- return self.calc(axis, values)
-
- def calc(self, axis, values):
- """**Pseudo Counter Controller API**. Override is **MANDATORY**.
- Calculate pseudo counter value given the counter values.
-
- :param int axis: the pseudo counter role axis
- :param sequence<float> values: a sequence containing current values
- of underlying elements
- :return: a pseudo counter value corresponding to the given axis
- pseudo counter role
- :rtype: float
-
- .. deprecated:: 1.0
- implement :meth:`~PseudoCounterController.Calc` instead"""
- raise NotImplementedError("Calc must be defined in te controller")
-
- def CalcAll(self, values):
- """**Pseudo Counter Controller API**. Override if necessary.
- Calculates all pseudo counter values from the values of counters.
- Default implementation does a loop calling
- :meth:`PseudoCounterController.Calc` for each pseudo counter role.
-
- :param sequence<float> values: a sequence containing current values
- of underlying elements
- :return: a sequece of pseudo counter values (one for each pseudo
- counter role)
- :rtype: sequence<float>
-
- .. versionadded:: 1.2"""
- f, n = self.Calc, len(self.pseudo_counter_roles)
- return [ f(i+1, values) for i in range(n) ]
-
-
-class IORegisterController(Controller, Readable):
- """Base class for a IORegister controller. Inherit from this class to
- implement your own IORegister controller for the device pool.
- """
-
- #: .. deprecated:: 1.0
- #: use :attr:`~Controller.axis_attributes` instead
- predefined_values = ()
-
- #: A :class:`dict` containing the standard attributes present on each axis
- #: device
- standard_axis_attributes = {
- 'Value' : { 'type' : float,
- 'description' : 'Value', },
- }
-
- #: A :obj:`str` representing the controller gender
- gender = 'I/O register controller'
-
- def __init__(self, inst, props, *args, **kwargs):
- Controller.__init__(self, inst, props, *args, **kwargs)
-
- def WriteOne(self):
- """**IORegister Controller API**. Override if necessary."""
- pass
-
diff --git a/src/sardana/pool/pool.py b/src/sardana/pool/pool.py
deleted file mode 100644
index d5f5a839..00000000
--- a/src/sardana/pool/pool.py
+++ /dev/null
@@ -1,708 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the main pool class"""
-
-from __future__ import print_function
-from __future__ import with_statement
-
-__all__ = ["Pool"]
-
-__docformat__ = 'restructuredtext'
-
-import os.path
-import logging.handlers
-
-from taurus.core.taurusvalidator import AttributeNameValidator
-from taurus.core.util.containers import CaselessDict
-
-from sardana import InvalidId, ElementType, TYPE_ACQUIRABLE_ELEMENTS, \
- TYPE_PSEUDO_ELEMENTS, TYPE_PHYSICAL_ELEMENTS, TYPE_MOVEABLE_ELEMENTS
-from sardana.sardanamanager import SardanaElementManager, SardanaIDManager
-from sardana.sardanamodulemanager import ModuleManager
-from sardana.sardanaevent import EventType
-from sardana.pool.poolobject import PoolObject
-from sardana.pool.poolcontainer import PoolContainer
-from sardana.pool.poolcontroller import PoolController
-from sardana.pool.poolmonitor import PoolMonitor
-from sardana.pool.poolmetacontroller import TYPE_MAP_OBJ
-from sardana.pool.poolcontrollermanager import ControllerManager
-
-
-class Graph(dict):
-
- def find_path(self, start, end, path=[]):
- path = path + [start]
- if start == end:
- return path
- if start not in self:
- return None
- for node in self[start]:
- if node not in path:
- newpath = self.find_path(node, end, path)
- if newpath:
- return newpath
- return None
-
- def find_all_paths(self, start, end, path=[]):
- path = path + [start]
- if start == end:
- return [path]
- if start not in self:
- return []
- paths = []
- for node in self[start]:
- if node not in path:
- newpaths = self.find_all_paths(node, end, path)
- for newpath in newpaths:
- paths.append(newpath)
- return paths
-
- def find_shortest_path(self, start, end, path=[]):
- path = path + [start]
- if start == end:
- return path
- if start not in self:
- return None
- shortest = None
- for node in self[start]:
- if node not in path:
- newpath = self.find_shortest_path(node, end, path)
- if newpath:
- if not shortest or len(newpath) < len(shortest):
- shortest = newpath
- return shortest
-
-
-class Pool(PoolContainer, PoolObject, SardanaElementManager, SardanaIDManager):
- """The central pool class."""
-
- #: Default value representing the number of state reads per position
- #: read during a motion loop
- Default_MotionLoop_StatesPerPosition = 10
-
- #: Default value representing the sleep time for each motion loop
- Default_MotionLoop_SleepTime = 0.01
-
- #: Default value representing the number of state reads per value
- #: read during a motion loop
- Default_AcqLoop_StatesPerValue = 10
-
- #: Default value representing the sleep time for each acquisition loop
- Default_AcqLoop_SleepTime = 0.01
-
- Default_DriftCorrection = True
-
- def __init__(self, full_name, name=None):
- self._path_id = None
- self._motion_loop_states_per_position = self.Default_MotionLoop_StatesPerPosition
- self._motion_loop_sleep_time = self.Default_MotionLoop_SleepTime
- self._acq_loop_states_per_value = self.Default_AcqLoop_StatesPerValue
- self._acq_loop_sleep_time = self.Default_AcqLoop_SleepTime
- self._drift_correction = self.Default_DriftCorrection
- self._remote_log_handler = None
-
- # dict<str, dict<str, str>>
- # keys are acquisition channel names and value is a dict describing the
- # channel containing:
- # - 'name': with value being the channel name (given by user)
- # - 'full_name': acq channel full name (ex: tango attribute)
- # - 'origin': 'local' if local to this server or 'remote' if a remote
- # channel
- self._extra_acquisition_element_names = CaselessDict()
-
- PoolContainer.__init__(self)
- PoolObject.__init__(self, full_name=full_name, name=name, id=InvalidId,
- pool=self, elem_type=ElementType.Pool)
- self._monitor = PoolMonitor(self, "PMonitor", auto_start=False)
- #self.init_local_logging()
- ControllerManager().set_pool(self)
-
- # TODO: not ready to use. path must be the same as the one calculated in
- # sardana.tango.core.util:prepare_logging
- def init_local_logging(self):
- log = logging.getLogger("Controller")
- log.propagate = 0
- path = os.path.join(os.sep, "tmp", "tango")
- log_file_name = os.path.join(path, 'controller.log.txt')
- try:
- if not os.path.exists(path):
- os.makedirs(path, 0777)
- f_h = logging.handlers.RotatingFileHandler(log_file_name,
- maxBytes=1E7,
- backupCount=5)
-
- f_h.setFormatter(self.getLogFormat())
- log.addHandler(f_h)
- self.info("Controller logs stored in %s", log_file_name)
- except:
- self.warning("Controller logs could not be created!")
- self.debug("Details:", exc_info=1)
-
- def clear_remote_logging(self):
- rh = self._remote_log_handler
- if rh is None:
- return
- log = logging.getLogger("Controller")
- log.removeHandler(rh)
- self._remote_log_handler = None
-
- def init_remote_logging(self, host=None, port=None):
- """Initializes remote logging.
-
- :param host: host name [default: None, meaning use the machine host name
- as returned by :func:`socket.gethostname`].
- :type host: str
- :param port: port number [default: None, meaning use
- :data:`logging.handlers.DEFAULT_TCP_LOGGING_PORT`"""
- log = logging.getLogger("Controller")
-
- # port 0 means no remote logging
- if port == 0:
- return
-
- # first check that the handler has not been initialized yet
- for handler in log.handlers:
- if isinstance(handler, logging.handlers.SocketHandler):
- return
- if host is None:
- import socket
- host = socket.gethostname()
- #host = socket.getfqdn()
- if port is None:
- port = logging.handlers.DEFAULT_TCP_LOGGING_PORT
- handler = logging.handlers.SocketHandler(host, port)
- if hasattr(handler, 'retryMax'):
- # default max retry is 30s which seems too much. Let's make it that
- # the pool tries to reconnect to a client every 10s (similar to the
- # tango event reconnection
- handler.retryMax = 10.0
- log.addHandler(handler)
- self.info("Remote logging initialized for host '%s' on port %d",
- host, port)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolObject.serialize(self, *args, **kwargs)
- kwargs['type'] = self.__class__.__name__
- kwargs['id'] = InvalidId
- kwargs['parent'] = None
- return kwargs
-
- def set_motion_loop_sleep_time(self, motion_loop_sleep_time):
- self._motion_loop_sleep_time = motion_loop_sleep_time
-
- def get_motion_loop_sleep_time(self):
- return self._motion_loop_sleep_time
-
- motion_loop_sleep_time = property(get_motion_loop_sleep_time,
- set_motion_loop_sleep_time,
- doc="motion sleep time (s)")
-
- def set_motion_loop_states_per_position(self, motion_loop_states_per_position):
- self._motion_loop_states_per_position = motion_loop_states_per_position
-
- def get_motion_loop_states_per_position(self):
- return self._motion_loop_states_per_position
-
- motion_loop_states_per_position = property(get_motion_loop_states_per_position,
- set_motion_loop_states_per_position,
- doc="Number of State reads done before doing a position read in the "
- "motion loop")
-
- def set_acq_loop_sleep_time(self, acq_loop_sleep_time):
- self._acq_loop_sleep_time = acq_loop_sleep_time
-
- def get_acq_loop_sleep_time(self):
- return self._acq_loop_sleep_time
-
- acq_loop_sleep_time = property(get_acq_loop_sleep_time,
- set_acq_loop_sleep_time,
- doc="acquisition sleep time (s)")
-
- def set_acq_loop_states_per_value(self, acq_loop_states_per_value):
- self._acq_loop_states_per_value = acq_loop_states_per_value
-
- def get_acq_loop_states_per_value(self):
- return self._acq_loop_states_per_value
-
- acq_loop_states_per_value = property(get_acq_loop_states_per_value,
- set_acq_loop_states_per_value,
- doc="Number of State reads done before doing a value read in the "
- "acquisition loop")
-
- def set_drift_correction(self, drift_correction):
- self._drift_correction = drift_correction
-
- def get_drift_correction(self):
- return self._drift_correction
-
- drift_correction = property(get_drift_correction,
- set_drift_correction,
- doc="drift correction")
- @property
- def monitor(self):
- return self._monitor
-
- @property
- def ctrl_manager(self):
- return ControllerManager()
-
- def set_python_path(self, path):
- mod_man = ModuleManager()
- if self._path_id is not None:
- mod_man.remove_python_path(self._path_id)
- self._path_id = mod_man.add_python_path(path)
-
- def set_path(self, path):
- self.ctrl_manager.setControllerPath(path, reload=False)
-
- def get_controller_libs(self):
- return self.ctrl_manager.getControllerLibs()
-
- def get_controller_lib_names(self):
- return self.ctrl_manager.getControllerLibNames()
-
- def get_controller_class_names(self):
- return self.ctrl_manager.getControllerNames()
-
- def get_controller_classes(self):
- return self.ctrl_manager.getControllers()
-
- def get_controller_class_info(self, name):
- return self.ctrl_manager.getControllerMetaClass(name)
-
- def get_controller_classes_info(self, names):
- return self.ctrl_manager.getControllerMetaClasses(names)
-
- def get_controller_libs_summary_info(self):
- libs = self.get_controller_libs()
- ret = []
- for ctrl_lib_info in libs:
- elem = "%s (%s)" % (ctrl_lib_info.getName(), ctrl_lib_info.getFileName())
- ret.append(elem)
- return ret
-
- def get_controller_classes_summary_info(self):
- ctrl_classes = self.get_controller_classes()
- ret = []
- for ctrl_class_info in ctrl_classes:
- types = ctrl_class_info.getTypes()
- types_str = [ TYPE_MAP_OBJ[t].name for t in types if t != ElementType.Controller ]
- types_str = ", ".join(types_str)
- elem = "%s (%s) %s" % (ctrl_class_info.getName(), ctrl_class_info.getFileName(), types_str)
- ret.append(elem)
- return ret
-
- def get_elements_str_info(self, obj_type=None):
- if obj_type is None:
- objs = self.get_element_id_map().values()
- objs.extend(self.get_controller_classes())
- objs.extend(self.get_controller_libs())
- elif obj_type == ElementType.ControllerClass:
- objs = self.get_controller_classes()
- elif obj_type == ElementType.ControllerLibrary:
- objs = self.get_controller_libs()
- else:
- objs = self.get_elements_by_type(obj_type)
- name = self.full_name
- return [ obj.str(pool=name) for obj in objs ]
-
- def get_elements_info(self, obj_type=None):
- if obj_type is None:
- objs = self.get_element_id_map().values()
- objs.extend(self.get_controller_classes())
- objs.extend(self.get_controller_libs())
- objs.append(self)
- elif obj_type == ElementType.ControllerClass:
- objs = self.get_controller_classes()
- elif obj_type == ElementType.ControllerLibrary:
- objs = self.get_controller_libs()
- else:
- objs = self.get_elements_by_type(obj_type)
- name = self.full_name
- return [ obj.serialize(pool=name) for obj in objs ]
-
- def get_acquisition_elements_info(self):
- ret = []
- for _, element in self.get_element_name_map().items():
- if element.get_type() not in TYPE_ACQUIRABLE_ELEMENTS:
- continue
- acq_channel = element.get_default_acquisition_channel()
- full_name = "{0}/{1}".format(element.full_name, acq_channel)
- info = dict(name=element.name, full_name=full_name, origin='local')
- ret.append(info)
- ret.extend(self._extra_acquisition_element_names.values())
- return ret
-
- def get_acquisition_elements_str_info(self):
- return map(self.str_object, self.get_acquisition_elements_info())
-
- def create_controller(self, **kwargs):
- ctrl_type = kwargs['type']
- lib = kwargs['library']
- class_name = kwargs['klass']
- name = kwargs['name']
- elem_type = ElementType[ctrl_type]
- mod_name, _ = os.path.splitext(lib)
- kwargs['module'] = mod_name
-
- td = TYPE_MAP_OBJ[ElementType.Controller]
- klass_map = td.klass
- auto_full_name = td.auto_full_name
- kwargs['full_name'] = full_name = \
- kwargs.get("full_name", auto_full_name.format(**kwargs))
- self.check_element(name, full_name)
-
- ctrl_class_info = None
- ctrl_lib_info = self.ctrl_manager.getControllerLib(mod_name)
- if ctrl_lib_info is not None:
- ctrl_class_info = ctrl_lib_info.get_controller(class_name)
-
- kwargs['pool'] = self
- kwargs['class_info'] = ctrl_class_info
- kwargs['lib_info'] = ctrl_lib_info
- eid = kwargs.get('id')
- if eid is None:
- kwargs['id'] = eid = self.get_new_id()
- else:
- self.reserve_id(eid)
-
- # For pseudo controllers make sure 'role_ids' is given
- klass = klass_map.get(elem_type, PoolController)
- if elem_type in TYPE_PSEUDO_ELEMENTS:
- motor_roles = kwargs['role_ids']
-
- # make sure the properties (that may have come from a case insensitive
- # environment like tango) are made case sensitive
- props = {}
- if ctrl_class_info is None:
- ctrl_prop_info = {}
- else:
- ctrl_prop_info = ctrl_class_info.ctrl_properties
- for k, v in kwargs['properties'].items():
- info = ctrl_prop_info.get(k)
- if info is None:
- props[k] = v
- else:
- props[info.name] = v
- kwargs['properties'] = props
-
- ctrl = klass(**kwargs)
- ret = self.add_element(ctrl)
- self.fire_event(EventType("ElementCreated"), ctrl)
- return ret
-
- def create_element(self, **kwargs):
- etype = kwargs['type']
- ctrl_id = kwargs['ctrl_id']
- axis = kwargs['axis']
- elem_type = ElementType[etype]
- name = kwargs['name']
-
- try:
- ctrl = self.get_element(id=ctrl_id)
- except:
- raise Exception("No controller with id '%d' found" % ctrl_id)
-
- elem_axis = ctrl.get_element(axis=axis)
- if elem_axis is not None:
- raise Exception("Controller already contains axis %d (%s)"
- % (axis, elem_axis.get_name()))
-
- kwargs['pool'] = self
- kwargs['ctrl'] = ctrl
- kwargs['ctrl_name'] = ctrl.get_name()
-
- td = TYPE_MAP_OBJ[elem_type]
- klass = td.klass
- auto_full_name = td.auto_full_name
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
-
- self.check_element(name, full_name)
-
- if ctrl.is_online():
- ctrl_types, ctrl_id = ctrl.get_ctrl_types(), ctrl.get_id()
- if elem_type not in ctrl_types:
- ctrl_type_str = ElementType.whatis(ctrl_types[0])
- raise Exception("Cannot create %s in %s controller"
- % (etype, ctrl_type_str))
-
- #check if controller is online
- #check if axis is allowed
- #create the element in the controller
-
- eid = kwargs.get('id')
- if eid is None:
- kwargs['id'] = eid = self.get_new_id()
- else:
- self.reserve_id(eid)
- elem = klass(**kwargs)
- ctrl.add_element(elem)
- ret = self.add_element(elem)
- self.fire_event(EventType("ElementCreated"), elem)
- return ret
-
- def create_motor_group(self, **kwargs):
- name = kwargs['name']
- elem_ids = kwargs["user_elements"]
-
- kwargs['pool'] = self
- kwargs["pool_name"] = self.name
- td = TYPE_MAP_OBJ[ElementType.MotorGroup]
- klass = td.klass
- auto_full_name = td.auto_full_name
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
- kwargs.pop('pool_name')
-
- self.check_element(name, full_name)
-
- for elem_id in elem_ids:
- elem = self.pool.get_element(id=elem_id)
- if elem.get_type() not in (ElementType.Motor, ElementType.PseudoMotor):
- raise Exception("%s is not a motor" % elem.name)
-
- eid = kwargs.get('id')
- if eid is None:
- kwargs['id'] = eid = self.get_new_id()
- else:
- self.reserve_id(eid)
-
- elem = klass(**kwargs)
-
- ret = self.add_element(elem)
- self.fire_event(EventType("ElementCreated"), elem)
- return ret
-
- def create_measurement_group(self, **kwargs):
- name = kwargs['name']
- elem_ids = kwargs["user_elements"]
-
- kwargs['pool'] = self
- kwargs["pool_name"] = self.name
-
- td = TYPE_MAP_OBJ[ElementType.MeasurementGroup]
- klass = td.klass
- auto_full_name = td.auto_full_name
-
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
- kwargs.pop('pool_name')
-
- self.check_element(name, full_name)
-
- for elem_id in elem_ids:
- if type(elem_id) is int:
- self.pool.get_element(id=elem_id)
- else:
- tg_attr_validator = AttributeNameValidator()
- params = tg_attr_validator.getParams(elem_id)
- if params is None:
- raise Exception("Invalid channel name %s" % elem_id)
-
- eid = kwargs.get('id')
- if eid is None:
- kwargs['id'] = eid = self.get_new_id()
- else:
- self.reserve_id(eid)
-
- elem = klass(**kwargs)
-
- ret = self.add_element(elem)
- self.fire_event(EventType("ElementCreated"), elem)
- return ret
-
- def delete_element(self, name):
- try:
- elem = self.get_element(name=name)
- except:
- try:
- elem = self.get_element(full_name=name)
- except:
- raise Exception("There is no element with name '%s'" % name)
-
- elem_type = elem.get_type()
- if elem_type == ElementType.Controller:
- if len(elem.get_elements()) > 0:
- raise Exception("Cannot delete controller with elements. "
- "Delete elements first")
- elif elem_type == ElementType.Instrument:
- if elem.has_instruments():
- raise Exception("Cannot delete instrument with instruments. "
- "Delete instruments first")
- if elem.has_elements():
- raise Exception("Cannot delete instrument with elements")
- parent_instrument = elem.parent_instrument
- if parent_instrument is not None:
- parent_instrument.remove_instrument(elem)
- elif hasattr(elem, "get_controller"):
- ctrl = elem.get_controller()
- ctrl.remove_element(elem)
- instrument = elem.instrument
- if instrument is not None:
- instrument.remove_element(elem)
-
- self.remove_element(elem)
-
- self.fire_event(EventType("ElementDeleted"), elem)
-
- def create_instrument(self, full_name, klass_name, id=None):
- is_root = full_name.count('/') == 1
-
- if is_root:
- parent_full_name, _ = '', full_name[1:]
- parent = None
- else:
- parent_full_name, _ = full_name.rsplit('/', 1)
- try:
- parent = self.get_element_by_full_name(parent_full_name)
- except:
- raise Exception("No parent instrument named '%s' found"
- % parent_full_name)
- if parent.get_type() != ElementType.Instrument:
- raise Exception("%s is not an instrument as expected"
- % parent_full_name)
-
- self.check_element(full_name, full_name)
-
- td = TYPE_MAP_OBJ[ElementType.Instrument]
- klass = td.klass
-
- if id is None:
- id = self.get_new_id()
- else:
- self.reserve_id(id)
- elem = klass(id=id, name=full_name, full_name=full_name,
- parent=parent, klass=klass_name, pool=self)
- if parent:
- parent.add_instrument(elem)
- ret = self.add_element(elem)
- self.fire_event(EventType("ElementCreated"), elem)
- return ret
-
- def stop(self):
- controllers = self.get_elements_by_type(ElementType.Controller)
- for controller in controllers:
- controller.stop_all()
-
- def abort(self):
- controllers = self.get_elements_by_type(ElementType.Controller)
- for controller in controllers:
- controller.abort_all()
-
- # --------------------------------------------------------------------------
- # (Re)load code
- # --------------------------------------------------------------------------
-
- def reload_controller_lib(self, lib_name):
- manager = self.ctrl_manager
-
- old_lib = manager.getControllerLib(lib_name)
- new_elements, changed_elements, deleted_elements = [], [], []
- old_ctrl_classes = ()
- if old_lib is not None:
- ctrl_infos = old_lib.get_controllers()
- pool_ctrls = self.get_elements_by_type(ElementType.Controller)
- init_pool_ctrls = []
- for pool_ctrl in pool_ctrls:
- if pool_ctrl.get_ctrl_info() in ctrl_infos:
- init_pool_ctrls.append(pool_ctrl)
- old_ctrl_classes = ctrl_infos
- changed_elements.append(old_lib)
-
- new_lib = manager.reloadControllerLib(lib_name)
-
- if old_lib is None:
- new_elements.extend(new_lib.get_controllers())
- new_elements.append(new_lib)
- else:
- new_names = set([ ctrl.name for ctrl in new_lib.get_controllers() ])
- old_names = set([ ctrl.name for ctrl in old_lib.get_controllers() ])
- changed_names = set.intersection(new_names, old_names)
- deleted_names = old_names.difference(new_names)
- new_names = new_names.difference(old_names)
-
- for new_name in new_names:
- new_elements.append(new_lib.get_controller(new_name))
- for changed_name in changed_names:
- changed_elements.append(new_lib.get_controller(changed_name))
- for deleted_name in deleted_names:
- deleted_elements.append(old_lib.get_controller(deleted_name))
-
- evt = { "new" : new_elements, "change" : changed_elements,
- "del" : deleted_elements }
-
- self.fire_event(EventType("ElementsChanged"), evt)
-
- if old_lib is not None:
- for pool_ctrl in init_pool_ctrls:
- pool_ctrl.re_init()
-
- def reload_controller_class(self, class_name):
- ctrl_info = self.ctrl_manager.getControllerMetaClass(class_name)
- lib_name = ctrl_info.module_name
- self.reload_controller_lib(lib_name)
-
- def get_element_id_graph(self):
- physical_elems_id_map = {}
- elem_type_map = self.get_element_type_map()
- for elem_type in TYPE_PHYSICAL_ELEMENTS:
- physical_elems_id_map.update(elem_type_map[elem_type])
- #TODO
-
- def _build_element_id_dependencies(self, elem_id, graph=None):
- if graph is None:
- graph = Graph()
- elem = self.get_element_by_id(elem_id)
- if elem.get_id() in graph or elem.get_type() in TYPE_PHYSICAL_ELEMENTS:
- return graph
- graph[elem_id] = list(elem.get_user_element_ids())
- return graph
-
- def get_moveable_id_graph(self):
- moveable_elems_id_map = {}
- elem_type_map = self.get_element_type_map()
- for elem_type in TYPE_MOVEABLE_ELEMENTS:
- moveable_elems_id_map.update(elem_type_map[elem_type])
- graph = Graph()
- for moveable_id in moveable_elems_id_map:
- self._build_element_id_dependencies(moveable_id, graph)
- return graph
-
- def _build_element_dependencies(self, elem, graph=None):
- if graph is None:
- graph = Graph()
- if elem.get_id() in graph or elem.get_type() in TYPE_PHYSICAL_ELEMENTS:
- return graph
- graph[elem] = list(elem.get_user_elements())
- return graph
-
- def get_moveable_graph(self):
- moveable_elems_map = {}
- elem_type_map = self.get_element_type_map()
- for elem_type in TYPE_MOVEABLE_ELEMENTS:
- moveable_elems_map.update(elem_type_map[elem_type])
- graph = Graph()
- for moveable in moveable_elems_map.values():
- self._build_element_dependencies(moveable, graph)
- return graph
diff --git a/src/sardana/pool/poolacquisition.py b/src/sardana/pool/poolacquisition.py
deleted file mode 100644
index 9833ce3c..00000000
--- a/src/sardana/pool/poolacquisition.py
+++ /dev/null
@@ -1,558 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the class for an
-acquisition"""
-
-__all__ = ["AcquisitionState", "AcquisitionMap", "PoolCTAcquisition",
- "Pool0DAcquisition", "Channel", "PoolIORAcquisition"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from taurus.core.util.log import DebugIt
-from taurus.core.util.enumeration import Enumeration
-
-from sardana import State, ElementType, TYPE_TIMERABLE_ELEMENTS
-from sardana.sardanathreadpool import get_thread_pool
-from sardana.pool.poolaction import ActionContext, PoolActionItem, PoolAction
-
-#: enumeration representing possible motion states
-AcquisitionState = Enumeration("AcquisitionState", (\
- "Stopped",
-# "StoppedOnError",
-# "StoppedOnAbort",
- "Acquiring",
- "Invalid"))
-
-AS = AcquisitionState
-AcquiringStates = AS.Acquiring,
-StoppedStates = AS.Stopped, #MS.StoppedOnError, MS.StoppedOnAbort
-
-AcquisitionMap = {
- #AS.Stopped : State.On,
- AS.Acquiring : State.Moving,
- AS.Invalid : State.Invalid,
-}
-
-class PoolAcquisition(PoolAction):
-
- def __init__(self, main_element, name="Acquisition"):
- PoolAction.__init__(self, main_element, name)
- ctname = name + ".CTAcquisition"
- zerodname = name + ".0DAcquisition"
- self._0d_acq = zd_acq = Pool0DAcquisition(main_element, name=zerodname)
- self._ct_acq = PoolCTAcquisition(main_element, name=ctname, slaves=(zd_acq,))
-
- def run(self, *args, **kwargs):
- n = kwargs.get('multiple', 1)
- if n == 1:
- return self._run_single(*args, **kwargs)
- return self._run_multiple(*args, **kwargs)
-
- def _run_multiple(self, *args, **kwargs):
- n = kwargs['multiple']
- synch = kwargs.get("synch", False)
- if synch:
- for _ in range(n):
- self._run_single(self, *args, **kwargs)
- else:
- kwargs["synch"] = True
- get_thread_pool().add(self._run_multiple, None, *args, **kwargs)
-
- def _run_single(self, *args, **kwargs):
- """Runs this action"""
- synch = kwargs.get("synch", False)
- ct_acq = self._ct_acq
- zd_acq = self._0d_acq
- if synch:
- ct_acq.run(*args, **kwargs)
- else:
- ct_acq.run(*args, **kwargs)
- zd_acq.run(*args, **kwargs)
-
- def _get_acq_for_element(self, element):
- elem_type = element.get_type()
- if elem_type in TYPE_TIMERABLE_ELEMENTS:
- return self._ct_acq
- elif elem_type == ElementType.ZeroDExpChannel:
- return self._0d_acq
-
- def clear_elements(self):
- """Clears all elements from this action"""
-
- def add_element(self, element):
- """Adds a new element to this action.
-
- :param element: the new element to be added
- :type element: sardana.pool.poolelement.PoolElement"""
- return self._get_acq_for_element(element).add_element(element)
-
- def remove_element(self, element):
- """Removes an element from this action. If the element is not part of
- this action, a ValueError is raised.
-
- :param element: the new element to be removed
- :type element: sardana.pool.poolelement.PoolElement
-
- :raises: ValueError"""
- return self._get_acq_for_element(element).add_element(element)
-
- def get_elements(self, copy_of=False):
- """Returns a sequence of all elements involved in this action.
-
- :param copy_of: If False (default) the internal container of elements is
- returned. If True, a copy of the internal container is
- returned instead
- :type copy_of: bool
- :return: a sequence of all elements involved in this action.
- :rtype: seq<sardana.pool.poolelement.PoolElement>"""
- return self._ct_acq.get_elements() + self._0d_acq.get_elements()
-
- def get_pool_controller_list(self):
- """Returns a list of all controller elements involved in this action.
-
- :return: a list of all controller elements involved in this action.
- :rtype: list<sardana.pool.poolelement.PoolController>"""
- return self._pool_ctrl_list
-
- def get_pool_controllers(self):
- """Returns a dict of all controller elements involved in this action.
-
- :return: a dict of all controller elements involved in this action.
- :rtype: dict<sardana.pool.poolelement.PoolController, seq<sardana.pool.poolelement.PoolElement>>"""
- ret = {}
- ret.update(self._ct_acq.get_pool_controllers())
- ret.update(self._0d_acq.get_pool_controllers())
- return ret
-
- def read_value(self, ret=None, serial=False):
- """Reads value information of all elements involved in this action
-
- :param ret: output map parameter that should be filled with value
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW value requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing value information per element
- :rtype: dict<:class:~`sardana.pool.poolelement.PoolElement`,
- :class:~`sardana.sardanavalue.SardanaValue`>"""
- ret = self._ct_acq.read_value(ret=ret, serial=serial)
- ret.update(self._0d_acq.read_value(ret=ret, serial=serial))
- return ret
-
-
-class Channel(PoolActionItem):
-
- def __init__(self, acquirable, info=None):
- PoolActionItem.__init__(self, acquirable)
- if info:
- self.__dict__.update(info)
-
- def __getattr__(self, name):
- return getattr(self.element, name)
-
-
-class PoolCTAcquisition(PoolAction):
-
- def __init__(self, main_element, name="CTAcquisition", slaves=None):
- self._channels = None
-
- if slaves is None:
- slaves = ()
- self._slaves = slaves
-
- PoolAction.__init__(self, main_element, name)
-
- def get_read_value_loop_ctrls(self):
- return self._pool_ctrl_dict_loop
-
- def start_action(self, *args, **kwargs):
- """Prepares everything for acquisition and starts it.
-
- :param: config"""
-
- pool = self.pool
-
- # prepare data structures
- self._aborted = False
- self._stopped = False
-
- self._acq_sleep_time = kwargs.pop("acq_sleep_time",
- pool.acq_loop_sleep_time)
- self._nb_states_per_value = \
- kwargs.pop("nb_states_per_value",
- pool.acq_loop_states_per_value)
-
- self._integ_time = integ_time = kwargs.get("integ_time")
- self._mon_count = mon_count = kwargs.get("monitor_count")
- if integ_time is None and mon_count is None:
- raise Exception("must give integration time or monitor counts")
- if integ_time is not None and mon_count is not None:
- raise Exception("must give either integration time or monitor counts (not both)")
-
- _ = kwargs.get("items", self.get_elements())
- cfg = kwargs['config']
-
- # determine which is the controller which holds the master channel
-
- if integ_time is not None:
- master_key = 'timer'
- master_value = integ_time
- if mon_count is not None:
- master_key = 'monitor'
- master_value = -mon_count
-
- master = cfg[master_key]
- master_ctrl = master.controller
-
- pool_ctrls_dict = dict(cfg['controllers'])
- pool_ctrls_dict.pop('__tango__', None)
- pool_ctrls = []
- self._pool_ctrl_dict_loop = _pool_ctrl_dict_loop = {}
- for ctrl, v in pool_ctrls_dict.items():
- if ctrl.is_timerable():
- pool_ctrls.append(ctrl)
- if ElementType.CTExpChannel in ctrl.get_ctrl_types():
- _pool_ctrl_dict_loop[ctrl] = v
-
- # make sure the controller which has the master channel is the last to
- # be called
- pool_ctrls.remove(master_ctrl)
- pool_ctrls.append(master_ctrl)
-
- # Determine which channels are active
- self._channels = channels = {}
- for pool_ctrl in pool_ctrls:
- ctrl = pool_ctrl.ctrl
- pool_ctrl_data = pool_ctrls_dict[pool_ctrl]
- main_unit_data = pool_ctrl_data['units']['0']
- elements = main_unit_data['channels']
-
- for element, element_info in elements.items():
- axis = element.axis
- channel = Channel(element, info=element_info)
- channels[element] = channel
-
- #for channel in channels:
- # channel.prepare_to_acquire(self)
-
- with ActionContext(self):
-
- # PreLoadAll, PreLoadOne, LoadOne and LoadAll
- for pool_ctrl in pool_ctrls:
- ctrl = pool_ctrl.ctrl
- pool_ctrl_data = pool_ctrls_dict[pool_ctrl]
- main_unit_data = pool_ctrl_data['units']['0']
- ctrl.PreLoadAll()
- master = main_unit_data[master_key]
- axis = master.axis
- res = ctrl.PreLoadOne(axis, master_value)
- if not res:
- raise Exception("%s.PreLoadOne(%d) returns False" % (pool_ctrl.name, axis,))
- ctrl.LoadOne(axis, master_value)
- ctrl.LoadAll()
-
- # PreStartAll on all controllers
- for pool_ctrl in pool_ctrls:
- pool_ctrl.ctrl.PreStartAll()
-
- # PreStartOne & StartOne on all elements
- for pool_ctrl in pool_ctrls:
- ctrl = pool_ctrl.ctrl
- pool_ctrl_data = pool_ctrls_dict[pool_ctrl]
- main_unit_data = pool_ctrl_data['units']['0']
- elements = main_unit_data['channels']
- for element in elements:
- axis = element.axis
- channel = channels[element]
- if channel.enabled:
- ret = ctrl.PreStartOne(axis, master_value)
- if not ret:
- raise Exception("%s.PreStartOne(%d) returns False" \
- % (pool_ctrl.name, axis))
- ctrl.StartOne(axis, master_value)
-
- # set the state of all elements to and inform their listeners
- for channel in channels:
- channel.set_state(State.Moving, propagate=2)
-
- # StartAll on all controllers
- for pool_ctrl in pool_ctrls:
- pool_ctrl.ctrl.StartAll()
-
- def in_acquisition(self, states):
- """Determines if we are in acquisition or if the acquisition has ended
- based on the current unit trigger modes and states returned by the
- controller(s)
-
- :param states: a map containing state information as returned by
- read_state_info
- :type states: dict<PoolElement, State>
- :return: returns True if in acquisition or False otherwise
- :rtype: bool"""
- for elem in states:
- s = states[elem][0][0]
- if self._is_in_action(s):
- return True
-
- def action_loop(self):
- i = 0
-
- states, values = {}, {}
- for element in self._channels:
- states[element] = None
- #values[element] = None
-
- nap = self._acq_sleep_time
- nb_states_per_value = self._nb_states_per_value
-
- # read values to send a first event when starting to acquire
- with ActionContext(self):
- self.raw_read_value_loop(ret=values)
- for acquirable, value in values.items():
- acquirable.put_value(value, propagate=2)
-
- while True:
- self.read_state_info(ret=states)
-
- if not self.in_acquisition(states):
- break
-
- # read value every n times
- if not i % nb_states_per_value:
- self.read_value_loop(ret=values)
- for acquirable, value in values.items():
- acquirable.put_value(value)
-
- time.sleep(nap)
- i += 1
-
- for slave in self._slaves:
- try:
- slave.stop_action()
- except:
- self.warning("Unable to stop slave acquisition %s",
- slave.getLogName())
- self.debug("Details", exc_info=1)
-
- with ActionContext(self):
- self.raw_read_state_info(ret=states)
- self.raw_read_value_loop(ret=values)
-
- for acquirable, state_info in states.items():
- # first update the element state so that value calculation
- # that is done after takes the updated state into account
- acquirable.set_state_info(state_info, propagate=0)
- if acquirable in values:
- value = values[acquirable]
- acquirable.put_value(value, propagate=2)
- with acquirable:
- acquirable.clear_operation()
- state_info = acquirable._from_ctrl_state_info(state_info)
- acquirable.set_state_info(state_info, propagate=2)
-
-
-class Pool0DAcquisition(PoolAction):
-
- def __init__(self, main_element, name="0DAcquisition"):
- self._channels = None
- PoolAction.__init__(self, main_element, name)
-
- def start_action(self, *args, **kwargs):
- """Prepares everything for acquisition and starts it.
-
- :param: config"""
-
- pool = self.pool
-
- # prepare data structures
- self._aborted = False
- self._stopped = False
-
- self._acq_sleep_time = kwargs.pop("acq_sleep_time",
- pool.acq_loop_sleep_time)
- self._nb_states_per_value = \
- kwargs.pop("nb_states_per_value",
- pool.acq_loop_states_per_value)
-
- integ_time = kwargs.get("integ_time")
- mon_count = kwargs.get("monitor_count")
- if integ_time is None and mon_count is None:
- raise Exception("must give integration time or monitor counts")
- if integ_time is not None and mon_count is not None:
- raise Exception("must give either integration time or monitor counts (not both)")
-
- items = kwargs.get("items")
- if items is None:
- items = self.get_elements()
- cfg = kwargs['config']
-
- pool_ctrls_dict = dict(cfg['controllers'])
- pool_ctrls_dict.pop('__tango__', None)
- pool_ctrls = []
- for ctrl in pool_ctrls_dict:
- if ElementType.ZeroDExpChannel in ctrl.get_ctrl_types():
- pool_ctrls.append(ctrl)
-
- # Determine which channels are active
- self._channels = channels = {}
- for pool_ctrl in pool_ctrls:
- ctrl = pool_ctrl.ctrl
- pool_ctrl_data = pool_ctrls_dict[pool_ctrl]
- main_unit_data = pool_ctrl_data['units']['0']
- elements = main_unit_data['channels']
-
- for element, element_info in elements.items():
- channel = Channel(element, info=element_info)
- channels[element] = channel
-
- with ActionContext(self):
- # set the state of all elements to and inform their listeners
- for channel in channels:
- channel.clear_buffer()
- channel.set_state(State.Moving, propagate=2)
-
- def in_acquisition(self, states):
- """Determines if we are in acquisition or if the acquisition has ended
- based on the current unit trigger modes and states returned by the
- controller(s)
-
- :param states: a map containing state information as returned by
- read_state_info
- :type states: dict<PoolElement, State>
- :return: returns True if in acquisition or False otherwise
- :rtype: bool"""
- for state in states:
- s = states[state][0]
- if self._is_in_action(s):
- return True
-
- def action_loop(self):
- i = 0
-
- states, values = {}, {}
- for element in self._channels:
- states[element] = None
- values[element] = None
-
- nap = self._acq_sleep_time
- while not (self._stopped or self._aborted):
- self.read_value(ret=values)
- for acquirable, value in values.items():
- acquirable.put_value(value)
-
- i += 1
- time.sleep(nap)
-
- with ActionContext(self):
- self.raw_read_state_info(ret=states)
-
- for acquirable, state_info in states.items():
- # first update the element state so that value calculation
- # that is done after takes the updated state into account
- state_info = acquirable._from_ctrl_state_info(state_info)
- acquirable.set_state_info(state_info, propagate=0)
- with acquirable:
- acquirable.clear_operation()
- acquirable.set_state_info(state_info, propagate=2)
-
- def stop_action(self, *args, **kwargs):
- """Stop procedure for this action."""
- self._stopped = True
-
- def abort_action(self, *args, **kwargs):
- """Aborts procedure for this action"""
- self._aborted = True
-
-
-class PoolIORAcquisition(PoolAction):
-
- def __init__(self, pool, name="IORAcquisition"):
- self._channels = None
- PoolAction.__init__(self, pool, name)
-
- def start_action(self, *args, **kwargs):
- pass
-
- def in_acquisition(self, states):
- return True
- pass
-
- @DebugIt()
- def action_loop(self):
- i = 0
-
- states, values = {}, {}
- for element in self._channels:
- states[element] = None
- values[element] = None
-
- # read values to send a first event when starting to acquire
- self.read_value(ret=values)
- for acquirable, value in values.items():
- acquirable.put_value(value, propagate=2)
-
- while True:
- self.read_state_info(ret=states)
-
- if not self.in_acquisition(states):
- break
-
- # read value every n times
- if not i % 5:
- self.read_value(ret=values)
- for acquirable, value in values.items():
- acquirable.put_value(value)
-
- i += 1
- time.sleep(0.01)
-
- self.read_state_info(ret=states)
-
- # first update the element state so that value calculation
- # that is done after takes the updated state into account
- for acquirable, state_info in states.items():
- acquirable.set_state_info(state_info, propagate=0)
-
- # Do NOT send events before we exit the OperationContext, otherwise
- # we may be asked to start another action before we leave the context
- # of the current action. Instead, send the events in the finish hook
- # which is executed outside the OperationContext
-
- def finish_hook(*args, **kwargs):
- # read values and propagate the change to all listeners
- self.read_value(ret=values)
- for acquirable, value in values.items():
- acquirable.put_value(value, propagate=2)
-
- # finally set the state and propagate to all listeners
- for acquirable, state_info in states.items():
- acquirable.set_state_info(state_info, propagate=2)
-
- self.set_finish_hook(finish_hook)
diff --git a/src/sardana/pool/poolaction.py b/src/sardana/pool/poolaction.py
deleted file mode 100644
index 4a9b0f3f..00000000
--- a/src/sardana/pool/poolaction.py
+++ /dev/null
@@ -1,645 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the class for an
-abstract action over a set of pool elements"""
-
-__all__ = ["PoolActionItem", "OperationInfo", "ActionContext", "PoolAction",
- "get_thread_pool"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import weakref
-import traceback
-import threading
-
-from taurus.core.util.log import Logger
-
-from sardana import State
-from sardana.sardanathreadpool import get_thread_pool
-from sardana.pool.poolobject import PoolObject
-
-
-class PoolActionItem(object):
- """The base class for an atomic action item"""
-
- def __init__(self, element):
- self._element = weakref.ref(element)
-
- def get_element(self):
- """Returns the element associated with this item"""
- return self._element()
-
- def set_element(self, element):
- """Sets the element for this item"""
- self._element = weakref.ref(element)
-
- element = property(get_element)
-
-
-class OperationInfo(object):
- """Stores synchronization data for a certain operation"""
-
- def __init__(self):
- """Constructor"""
- self.state_count = 0
- self.state_lock = threading.Lock()
- self.state_event_lock = threading.Lock()
- self.state_event = threading.Event()
-
- def init(self, count):
- """Initializes this operation with a certain count"""
- self.state_count = count
- self.state_event.clear()
- if count == 0:
- self.state_event.set()
-
- def wait(self, timeout=None):
- """waits for the operation to finish"""
- return self.state_event.wait(timeout)
-
- def finish_one(self):
- """Notifies this operation that one step was finished"""
- with self.state_event_lock:
- self.state_count = self.state_count - 1
- if self.state_count < 1:
- self.state_count = 0
- self.state_event.set()
-
- def acquire(self):
- """Acquires this operation lock"""
- self.state_lock.acquire()
-
- def release(self):
- """Releases this operation lock"""
- self.state_lock.release()
-
- def __enter__(self):
- return self.acquire()
-
- def __exit__(self, exc_type, exc_value, exc_traceback):
- return self.release()
-
-
-class BaseOperationContext(object):
- """Stores operation context"""
-
- def __init__(self, pool_action):
- self._pool_action = pool_action
-
- def enter(self):
- """Enters operation context"""
- pool_action = self._pool_action
- for element in pool_action.get_elements():
- element.lock()
- element.set_operation(pool_action)
- for ctrl in pool_action.get_pool_controller_list():
- ctrl.lock()
-
- def exit(self):
- """Leaves operation context"""
- pool_action = self._pool_action
- for element in reversed(pool_action.get_elements()):
- element.clear_operation()
- element.unlock()
- for ctrl in reversed(pool_action.get_pool_controller_list()):
- ctrl.unlock()
- pool_action.finish_action()
- return False
-
- def __enter__(self):
- return self.enter()
-
- def __exit__(self, exc_type, exc_value, exc_traceback):
- return self.exit()
-
-
-class OperationContext(BaseOperationContext):
- """Concrete operation context"""
-
- def enter(self):
- pool_action = self._pool_action
- for element in pool_action.get_elements():
- element.set_operation(pool_action)
-
- def exit(self):
- pool_action = self._pool_action
- for element in reversed(pool_action.get_elements()):
- element.clear_operation()
- pool_action.finish_action()
- return False
-
- def __enter__(self):
- return self.enter()
-
- def __exit__(self, exc_type, exc_value, exc_traceback):
- return self.exit()
-
-
-class ActionContext(object):
- """Stores an atomic action context"""
-
- def __init__(self, pool_action):
- self._pool_action = pool_action
-
- def enter(self):
- """Enters operation"""
- pool_action = self._pool_action
- for element in pool_action.get_elements():
- element.lock()
- for ctrl in pool_action.get_pool_controller_list():
- ctrl.lock()
-
- def exit(self):
- """Leaves operation"""
- pool_action = self._pool_action
- for element in reversed(pool_action.get_elements()):
- element.unlock()
- for ctrl in reversed(pool_action.get_pool_controller_list()):
- ctrl.unlock()
- return False
-
- def __enter__(self):
- return self.enter()
-
- def __exit__(self, exc_type, exc_value, exc_traceback):
- return self.exit()
-
-
-class PoolAction(Logger):
- """A generic class to handle any type of operation (like motion or
- acquisition)"""
-
- def __init__(self, main_element, name="GlobalAction"):
- Logger.__init__(self, name)
- self._action_run_lock = threading.Lock()
- self._main_element = weakref.ref(main_element)
- self._aborted = False
- self._stopped = False
- self._elements = []
- self._pool_ctrl_dict = {}
- self._pool_ctrl_list = []
- self._finish_hook = None
- self._running = False
- self._state_info = OperationInfo()
- self._value_info = OperationInfo()
-
- def get_main_element(self):
- """Returns the main element for this action
-
- :return: sardana.pool.poolelement.PoolElement"""
- return self._main_element()
-
- main_element = property(get_main_element)
-
- def get_pool(self):
- """Returns the pool object for thi action
-
- :return: sardana.pool.pool.Pool"""
- return self.main_element.pool
-
- pool = property(get_pool)
-
- def clear_elements(self):
- """Clears all elements from this action"""
- self._elements = []
- self._pool_ctrl_dict = {}
- self._pool_ctrl_list = []
-
- def add_element(self, element):
- """Adds a new element to this action.
-
- :param element: the new element to be added
- :type element: sardana.pool.poolelement.PoolElement"""
- ctrl = element.controller
- ctrl_items = self._pool_ctrl_dict.get(ctrl)
- if ctrl_items is None:
- ctrl_items = []
- self._pool_ctrl_dict[ctrl] = ctrl_items
- self._pool_ctrl_list.append(ctrl)
- self._pool_ctrl_list.sort(key=PoolObject.get_id)
-
- self._elements.append(element)
- ctrl_items.append(element)
- # make sure elements are ordered by ID so that a multiple lock always
- # locks and unlocks in the same order
- self._elements.sort(key=PoolObject.get_id)
- ctrl_items.sort(key=PoolObject.get_id)
-
- def remove_element(self, element):
- """Removes an element from this action. If the element is not part of
- this action, a ValueError is raised.
-
- :param element: the new element to be removed
- :type element: sardana.pool.poolelement.PoolElement
-
- :raises: ValueError"""
- ctrl = element.controller
- #element = weakref.ref(element)
- try:
- idx = self._elements.index(element)
- except ValueError:
- raise ValueError("action doesn't contain %s" % element.name)
- del self._elements[idx]
- ctrl_items = self._pool_ctrl_dict[ctrl]
- del ctrl_items[ctrl_items.index(element)]
- if not len(ctrl_items):
- del self._pool_ctrl_dict[ctrl]
- del self._pool_ctrl_list[self._pool_ctrl_list.index(ctrl)]
-
- def get_elements(self, copy_of=False):
- """Returns a sequence of all elements involved in this action.
-
- :param copy_of: If False (default) the internal container of elements is
- returned. If True, a copy of the internal container is
- returned instead
- :type copy_of: bool
- :return: a sequence of all elements involved in this action.
- :rtype: seq<sardana.pool.poolelement.PoolElement>"""
- elements = self._elements
- if copy_of:
- elements = tuple(elements)
- return elements
-
- def get_pool_controller_list(self):
- """Returns a list of all controller elements involved in this action.
-
- :return: a list of all controller elements involved in this action.
- :rtype: list<sardana.pool.poolelement.PoolController>"""
- return self._pool_ctrl_list
-
- def get_pool_controllers(self):
- """Returns a dict of all controller elements involved in this action.
-
- :return: a dict of all controller elements involved in this action.
- :rtype: dict<sardana.pool.poolelement.PoolController,
- seq<sardana.pool.poolelement.PoolElement>>"""
- return self._pool_ctrl_dict
-
- def _is_in_action(self, state):
- """Determines if the given state is a busy state (Moving or Running) or
- not.
-
- :return: True if state is a busy state or False otherwise
- :rtype: bool"""
- return state == State.Moving or state == State.Running
-
- def is_running(self):
- """Determines if this action is running or not
-
- :return: True if action is running or False otherwise
- :rtype: bool"""
- return self._running
-
- def run(self, *args, **kwargs):
- """Runs this action"""
-
- self._running = True
- synch = kwargs.pop("synch", False)
-
- if synch:
- try:
- with OperationContext(self) as context:
- self.start_action(*args, **kwargs)
- self.action_loop()
- finally:
- self._running = False
- else:
- context = OperationContext(self)
- context.enter()
- try:
- self.start_action(*args, **kwargs)
- except:
- context.exit()
- self._running = False
- raise
- get_thread_pool().add(self._asynch_action_loop, None, context)
-
- def start_action(self, *args, **kwargs):
- """Start procedure for this action. Default implementation raises
- NotImplementedError
-
- :raises: NotImplementedError"""
- raise NotImplementedError("start_action must be implemented in "
- "subclass")
-
- def set_finish_hook(self, hook):
- """Attaches/Detaches a finish hook
-
- :param hook: a callable object or None
- :type hook: callable or None"""
- self._finish_hook = hook
-
- def finish_action(self):
- """Finishes the action execution. If a finish hook is defined it safely
- executes it. Otherwise nothing happens"""
- hook = self._finish_hook
- if hook is None:
- return
- try:
- hook()
- except:
- self.warning("Exception running function finish hook", exc_info=1)
-
- def stop_action(self, *args, **kwargs):
- """Stop procedure for this action."""
- self._stopped = True
- for pool_ctrl, elements in self._pool_ctrl_dict.items():
- pool_ctrl.stop_elements(elements)
-
- def abort_action(self, *args, **kwargs):
- """Aborts procedure for this action"""
- self._aborted = True
- for pool_ctrl, elements in self._pool_ctrl_dict.items():
- pool_ctrl.abort_elements(elements)
-
- def emergency_break(self):
- """Tries to execute a stop. If it fails try an abort"""
- self._stopped = True
- for pool_ctrl, elements in self._pool_ctrl_dict.items():
- pool_ctrl.emergency_break(elements)
-
- def was_stopped(self):
- """Determines if the action has been stopped from outside
-
- :return: True if action has been stopped from outside or False otherwise
- :rtype: bool"""
- return self._stopped
-
- def was_aborted(self):
- """Determines if the action has been aborted from outside
-
- :return: True if action has been aborted from outside or False otherwise
- :rtype: bool"""
- return self._aborted
-
- def was_action_interrupted(self):
- """Determines if the action has been interruped from outside (either
- from an abort or a stop).
-
- :return: True if action has been interruped from outside or False
- otherwise
- :rtype: bool"""
- return self.was_aborted() or self.was_stopped()
-
- def _asynch_action_loop(self, context):
- """Internal method. Asynchronous action loop"""
- try:
- self.action_loop()
- finally:
- context.exit()
- self._running = False
-
- def action_loop(self):
- """Action loop for this action. Default implementation raises
- NotImplementedError
-
- :raises: NotImplementedError"""
- raise NotImplementedError("action_loop must be implemented in subclass")
-
- def read_state_info(self, ret=None, serial=False):
- """Reads state information of all elements involved in this action
-
- :param ret: output map parameter that should be filled with state
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW state requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing state information per element
- :rtype: dict<sardana.pool.poolelement.PoolElement, stateinfo>"""
- with ActionContext(self):
- return self.raw_read_state_info(ret=ret, serial=serial)
-
- def raw_read_state_info(self, ret=None, serial=False):
- """**Unsafe**. Reads state information of all elements involved in this
- action
-
- :param ret: output map parameter that should be filled with state
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW state requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing state information per element
- :rtype: dict<sardana.pool.poolelement.PoolElement, stateinfo>"""
- if ret is None:
- ret = {}
- read = self._raw_read_state_info_concurrent
- if serial:
- read = self._raw_read_state_info_serial
- state_info = self._state_info
-
- with state_info:
- state_info.init(len(self._pool_ctrl_dict))
- read(ret)
- state_info.wait()
- return ret
-
- def _raw_read_state_info_serial(self, ret):
- """Internal method. Read state in a serial mode"""
- for pool_ctrl in self._pool_ctrl_dict:
- self._raw_read_ctrl_state_info(ret, pool_ctrl)
- return ret
-
- def _raw_read_state_info_concurrent(self, ret):
- """Internal method. Read state in a concurrent mode"""
- th_pool = get_thread_pool()
- for pool_ctrl in self._pool_ctrl_dict:
- th_pool.add(self._raw_read_ctrl_state_info, None, ret, pool_ctrl)
- return ret
-
- def _get_ctrl_error_state_info(self, pool_ctrl):
- """Internal method. Returns the controller error in form of a
- tuple<sardana.State, str>"""
- exc_t, exc_v, trb = sys.exc_info()
- if exc_t is None:
- if pool_ctrl.is_online():
- return State.Fault, "Unknown controller error"
- else:
- if pool_ctrl.is_online():
- err_msg = "".join(traceback.format_exception(exc_t, exc_v, trb))
- return State.Fault, "Unexpected controller error:\n" + err_msg
- return State.Fault, pool_ctrl.get_ctrl_error_str()
-
- def _raw_read_ctrl_state_info(self, ret, pool_ctrl):
- """Internal method. Read controller information and store it in ret
- parameter"""
- try:
- axes = [elem.axis for elem in self._pool_ctrl_dict[pool_ctrl]]
- state_infos, error = pool_ctrl.raw_read_axis_states(axes)
- if error:
- pool_ctrl.warning("Read state error")
- for elem, (state_info, exc_info) in state_infos.items():
- if exc_info is not None:
- pool_ctrl.debug("Axis %s error details:", elem.axis,
- exc_info=exc_info)
- ret.update(state_infos)
- except:
- self.error("Something wrong happend: Error should have been caught"
- "by ctrl.read_axis_states")
- self.debug("Details: ", exc_info=1)
- state_info = self._get_ctrl_error_state_info(pool_ctrl)
- for elem in self._pool_ctrl_dict[pool_ctrl]:
- ret[elem] = state_info
- finally:
- self._state_info.finish_one()
-
- def get_read_value_ctrls(self):
- return self._pool_ctrl_dict
-
- def read_value(self, ret=None, serial=False):
- """Reads value information of all elements involved in this action
-
- :param ret: output map parameter that should be filled with value
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW value requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing value information per element
- :rtype: dict<:class:~`sardana.pool.poolelement.PoolElement`,
- (value object, Exception or None)>"""
- with ActionContext(self):
- return self.raw_read_value(ret=ret, serial=serial)
-
- def raw_read_value(self, ret=None, serial=False):
- """**Unsafe**. Reads value information of all elements involved in this
- action
-
- :param ret: output map parameter that should be filled with value
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW value requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing value information per element
- :rtype: dict<:class:~`sardana.pool.poolelement.PoolElement,
- :class:`sardana.sardanavalue.SardanaValue` >"""
-
- if ret is None:
- ret = {}
-
- read = self._raw_read_value_concurrent
- if serial:
- read = self._raw_read_value_serial
-
- value_info = self._value_info
-
- with value_info:
- value_info.init(len(self.get_read_value_ctrls()))
- read(ret)
- value_info.wait()
- return ret
-
- def _raw_read_value_serial(self, ret):
- """Internal method. Read value in a serial mode"""
- for pool_ctrl in self.get_read_value_ctrls():
- self._raw_read_ctrl_value(ret, pool_ctrl)
- return ret
-
- def _raw_read_value_concurrent(self, ret):
- """Internal method. Read value in a concurrent mode"""
- th_pool = get_thread_pool()
- for pool_ctrl in self.get_read_value_ctrls():
- th_pool.add(self._raw_read_ctrl_value, None, ret, pool_ctrl)
- return ret
-
- def _raw_read_ctrl_value(self, ret, pool_ctrl):
- """Internal method. Read controller value information and store it in
- ret parameter"""
- try:
- axes = [elem.axis for elem in self._pool_ctrl_dict[pool_ctrl]]
- value_infos = pool_ctrl.raw_read_axis_values(axes)
- ret.update(value_infos)
- finally:
- self._value_info.finish_one()
-
- def get_read_value_loop_ctrls(self):
- return self._pool_ctrl_dict
-
- def read_value_loop(self, ret=None, serial=False):
- """Reads value information of all elements involved in this action
-
- :param ret: output map parameter that should be filled with value
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW value requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing value information per element
- :rtype: dict<:class:~`sardana.pool.poolelement.PoolElement`,
- (value object, Exception or None)>"""
- with ActionContext(self):
- return self.raw_read_value_loop(ret=ret, serial=serial)
-
- def raw_read_value_loop(self, ret=None, serial=False):
- """**Unsafe**. Reads value information of all elements involved in this
- action
-
- :param ret: output map parameter that should be filled with value
- information. If None is given (default), a new map is
- created an returned
- :type ret: dict
- :param serial: If False (default) perform controller HW value requests
- in parallel. If True, access is serialized.
- :type serial: bool
- :return: a map containing value information per element
- :rtype: dict<:class:~`sardana.pool.poolelement.PoolElement,
- :class:`sardana.sardanavalue.SardanaValue` >"""
-
- if ret is None:
- ret = {}
-
- read = self._raw_read_value_concurrent_loop
- if serial:
- read = self._raw_read_value_serial_loop
-
- value_info = self._value_info
-
- with value_info:
- value_info.init(len(self.get_read_value_loop_ctrls()))
- read(ret)
- value_info.wait()
- return ret
-
- def _raw_read_value_serial_loop(self, ret):
- """Internal method. Read value in a serial mode"""
- for pool_ctrl in self.get_read_value_loop_ctrls():
- self._raw_read_ctrl_value(ret, pool_ctrl)
- return ret
-
- def _raw_read_value_concurrent_loop(self, ret):
- """Internal method. Read value in a concurrent mode"""
- th_pool = get_thread_pool()
- for pool_ctrl in self.get_read_value_loop_ctrls():
- th_pool.add(self._raw_read_ctrl_value, None, ret, pool_ctrl)
- return ret
diff --git a/src/sardana/pool/poolbasechannel.py b/src/sardana/pool/poolbasechannel.py
deleted file mode 100644
index 922632cc..00000000
--- a/src/sardana/pool/poolbasechannel.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for experiment channels"""
-
-__all__ = ["Value", "PoolBaseChannel"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanaattribute import SardanaAttribute
-
-from sardana.pool.poolelement import PoolElement
-from sardana.pool.poolacquisition import PoolCTAcquisition
-
-
-class Value(SardanaAttribute):
-
- def __init__(self, *args, **kwargs):
- super(Value, self).__init__(*args, **kwargs)
-
- def update(self, cache=True, propagate=1):
- if not cache or not self.has_value():
- value = self.obj.read_value()
- self.set_value(value, propagate=propagate)
-
-
-class PoolBaseChannel(PoolElement):
-
- ValueAttributeClass = Value
- AcquisitionClass = PoolCTAcquisition
-
- def __init__(self, **kwargs):
- PoolElement.__init__(self, **kwargs)
- self._value = self.ValueAttributeClass(self, listeners=self.on_change)
- if not self.AcquisitionClass is None:
- acq_name = "%s.Acquisition" % self._name
- self.set_action_cache(self.AcquisitionClass(self, name=acq_name))
-
- def get_value_attribute(self):
- """Returns the value attribute object for this experiment channel
-
- :return: the value attribute
- :rtype: :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self._value
-
- # --------------------------------------------------------------------------
- # Event forwarding
- # --------------------------------------------------------------------------
-
- def on_change(self, evt_src, evt_type, evt_value):
- # forward all events coming from attributes to the listeners
- self.fire_event(evt_type, evt_value)
-
- # --------------------------------------------------------------------------
- # default acquisition channel
- # --------------------------------------------------------------------------
-
- def get_default_attribute(self):
- return self.get_value_attribute()
-
- # --------------------------------------------------------------------------
- # acquisition
- # --------------------------------------------------------------------------
-
- def get_acquisition(self):
- return self.get_action_cache()
-
- acquisition = property(get_acquisition, doc="acquisition object")
-
- # --------------------------------------------------------------------------
- # value
- # --------------------------------------------------------------------------
-
- def read_value(self):
- """Reads the channel value from hardware.
-
- :return:
- a :class:`~sardana.sardanavalue.SardanaValue` containing the channel
- value
- :rtype:
- :class:`~sardana.sardanavalue.SardanaValue`"""
- return self.acquisition.read_value()[self]
-
- def put_value(self, value, propagate=1):
- """Sets a value.
-
- :param value:
- the new value
- :type value:
- :class:`~sardana.sardanavalue.SardanaValue`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- val_attr = self._value
- val_attr.set_value(value, propagate=propagate)
- return val_attr
-
- def get_value(self, cache=True, propagate=1):
- """Returns the channel value.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the channel value
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self._get_value(cache=cache, propagate=propagate)
-
- def _get_value(self, cache=True, propagate=1):
- value = self.get_value_attribute()
- value.update(cache=cache, propagate=propagate)
- return value
-
- def set_value(self, value):
- """Starts an acquisition on this channel
-
- :param value:
- the value to count
- :type value:
- :class:`~numbers.Number`"""
- return self._set_value(value)
-
- def _set_value(self, value):
- self.start_acquisition(value)
-
- value = property(get_value, set_value, doc="channel value")
-
- def start_acquisition(self, value=None):
- self._aborted = False
- self._stopped = False
- if value is None:
- value = self.get_write_value()
- if value is None:
- raise Exception("Invalid integration_time '%s'. Hint set a new value for 'value' first" % value)
- if not self._simulation_mode:
- acq = self.acquisition.run(integ_time=value)
diff --git a/src/sardana/pool/poolbaseelement.py b/src/sardana/pool/poolbaseelement.py
deleted file mode 100644
index fc967196..00000000
--- a/src/sardana/pool/poolbaseelement.py
+++ /dev/null
@@ -1,360 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolBaseElement"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-import threading
-
-from taurus.core.util.lock import TaurusLock
-
-from sardana import State
-from sardana.sardanaevent import EventType
-from sardana.pool.poolobject import PoolObject
-
-
-class PoolBaseElement(PoolObject):
- """A Pool object that besides the name, reference to the pool, ID, full_name
- and user_full_name has:
-
- - _simulation_mode : boolean telling if in simulation mode
- - _state : element state
- - _status : element status"""
-
- def __init__(self, **kwargs):
- self._simulation_mode = False
- self._state = None
- self._state_event = None
- self._status = None
- self._status_event = None
- self._action_cache = None
- self._aborted = False
- self._stopped = False
-
- lock_name = kwargs['name'] + "Lock"
-
- # A lock for high level operations: monitoring, motion or acquisition
- self._lock = TaurusLock(name=lock_name, lock=threading.RLock())
-
- # The operation context in which the element is involved
- self._operation = None
-
- # The :class:`PoolAction` in which element is involved
- self._pool_action = None
-
- super(PoolBaseElement, self).__init__(**kwargs)
-
- def __enter__(self):
- self.lock()
-
- def __exit__(self, exc_type, exc_value, traceback):
- self.unlock()
- return False
-
- def lock(self, blocking=True):
- """Acquires the this element lock
-
- :param blocking:
- whether or not to block if lock is already acquired [default: True]
- :type blocking: bool"""
- ret = self._lock.acquire(blocking)
- return ret
-
- def unlock(self):
- ret = self._lock.release()
- return ret
-
- def get_action_cache(self):
- """Returns the internal action cache object"""
- return self._action_cache
-
- def serialize(self, *args, **kwargs):
- ret = PoolObject.serialize(self, *args, **kwargs)
- return ret
-
- # --------------------------------------------------------------------------
- # simulation mode
- # --------------------------------------------------------------------------
-
- def get_simulation_mode(self, cache=True, propagate=1):
- """Returns the simulation mode for this object.
-
- :param cache: not used [default: True]
- :type cache: bool
- :param propagate: [default: 1]
- :type propagate: int
- :return: the current simulation mode
- :rtype: bool"""
- return self._simulation_mode
-
- def set_simulation_mode(self, simulation_mode, propagate=1):
- self._simulation_mode = simulation_mode
- if not propagate:
- return
- if simulation_mode == self._simulation_mode:
- # current state is equal to last state_event. Skip event
- return
- self.fire_event(EventType("simulation_mode", priority=propagate),
- simulation_mode)
-
- def put_simulation_mode(self, simulation_mode):
- self._simulation_mode = simulation_mode
-
- simulation_mode = property(get_simulation_mode, set_simulation_mode,
- doc="element simulation mode")
-
- # --------------------------------------------------------------------------
- # state
- # --------------------------------------------------------------------------
-
- def get_state(self, cache=True, propagate=1):
- """Returns the state for this object. If cache is True (default) it
- returns the current state stored in cache (it will force an update if
- cache is empty). If propagate > 0 and if the state changed since last
- read, it will propagate the state event to all listeners.
-
- :param cache:
- tells if return value from local cache or update from HW read
- [default: True]
- :type cache: bool
- :param propagate:
- if > 0 propagates the event in case it changed since last HW read.
- Values bigger that mean the event if sent should be a priority event
- [default: 1]
- :type propagate: int
- :return: the current object state
- :rtype: :obj:`sardana.State`"""
- if not cache or self._state is None:
- state_info = self.read_state_info()
- self._set_state_info(state_info, propagate=propagate)
- return self._state
-
- def inspect_state(self):
- """Looks at the current cached value of state
-
- :return: the current object state
- :rtype: :obj:`sardana.State`"""
- return self._state
-
- def set_state(self, state, propagate=1):
- self._set_state(state, propagate=propagate)
-
- def _set_state(self, state, propagate=1):
- self._state = state
- if not propagate:
- return
- if state == self._state_event:
- # current state is equal to last state_event. Skip event
- return
- self._state_event = state
- self.fire_event(EventType("state", priority=propagate), state)
-
- def put_state(self, state):
- self._state = state
-
- state = property(get_state, set_state, doc="element state")
-
- # --------------------------------------------------------------------------
- # status
- # --------------------------------------------------------------------------
-
- def inspect_status(self):
- """Looks at the current cached value of status
-
- :return: the current object status
- :rtype: str"""
- return self._status
-
- def get_status(self, cache=True, propagate=1):
- """Returns the status for this object. If cache is True (default) it
- returns the current status stored in cache (it will force an update if
- cache is empty). If propagate > 0 and if the status changed since last
- read, it will propagate the status event to all listeners.
-
- :param cache:
- tells if return value from local cache or update from HW read
- [default: True]
- :type cache: bool
- :param propagate:
- if > 0 propagates the event in case it changed since last HW read.
- Values bigger that mean the event if sent should be a priority event
- [default: 1]
- :type propagate: int
- :return: the current object status
- :rtype: str"""
- if not cache or self._status is None:
- state_info = self.read_state_info()
- self._set_state_info(state_info, propagate=propagate)
- return self._status
-
- def set_status(self, status, propagate=1):
- self._set_status(status, propagate=propagate)
-
- def _set_status(self, status, propagate=1):
- self._status = status
- if not propagate:
- return
- s_evt = self._status_event
- if s_evt is not None and len(status) == len(s_evt) and status == s_evt:
- # current status is equal to last status_event. Skip event
- return
- self._status_event = status
- self.fire_event(EventType("status", priority=propagate), status)
-
- def put_status(self, status):
- self._status = status
-
- status = property(get_status, set_status, doc="element status")
-
- # --------------------------------------------------------------------------
- # state information
- # --------------------------------------------------------------------------
-
- _STD_STATUS = "{name} is {state}\n{ctrl_status}"
- def calculate_state_info(self, status_info=None):
- """Transforms the given state information. This specific base
- implementation transforms the given state,status tuple into a
- state, new_status tuple where new_status is "*self.name* is *state*
- plus the given status.
- It is assumed that the given status comes directly from the controller
- status information.
-
- :param status_info:
- given status information [default: None, meaning use current state status.
- :type status_info: tuple<State, str>
- :return: a transformed state information
- :rtype: tuple<State, str>"""
- if status_info is None:
- status_info = self._state, self._status
- state, status = status_info
- state_str = State[state]
- new_status = self._STD_STATUS.format(name=self.name, state=state_str,
- ctrl_status=status)
- return status_info[0], new_status
-
- def set_state_info(self, state_info, propagate=1):
- self._set_state_info(state_info, propagate=propagate)
-
- def _set_state_info(self, state_info, propagate=1):
- state_info = self.calculate_state_info(state_info)
- state, status = state_info[:2]
- self._set_status(status, propagate=propagate)
- self._set_state(state, propagate=propagate)
-
- def read_state_info(self):
- action_cache = self.get_action_cache()
- ctrl_state_info = action_cache.read_state_info(serial=True)[self]
- return self._from_ctrl_state_info(ctrl_state_info)
-
- def put_state_info(self, state_info):
- self.set_state_info(state_info, propagate=0)
-
- def _from_ctrl_state_info(self, state_info):
- try:
- state_str = State.whatis(state_info)
- return int(state_info), "{0} is in {1}".format(self.name, state_str)
- except KeyError:
- pass
- state_info, _ = state_info
- state, status = state_info[:2]
- state = int(state)
- return state, status
-
- # --------------------------------------------------------------------------
- # default attribute
- # --------------------------------------------------------------------------
-
- def get_default_attribute(self):
- return NotImplementedError("%s doesn't have default attribute" % self.__class__.__name__)
-
- # --------------------------------------------------------------------------
- # default acquisition channel name
- # --------------------------------------------------------------------------
-
- def get_default_acquisition_channel(self):
- return self.get_default_attribute().name
-
- # --------------------------------------------------------------------------
- # stop
- # --------------------------------------------------------------------------
-
- def stop(self):
- self._stopped = True
-
- def was_stopped(self):
- return self._stopped
-
- # --------------------------------------------------------------------------
- # abort
- # --------------------------------------------------------------------------
-
- def abort(self):
- self._aborted = True
-
- def was_aborted(self):
- return self._aborted
-
- # --------------------------------------------------------------------------
- # interrupted
- # --------------------------------------------------------------------------
-
- def was_interrupted(self):
- """Tells if action ended by an abort or stop"""
- return self.was_aborted() or self.was_stopped()
-
- # --------------------------------------------------------------------------
- # involved in an operation
- # --------------------------------------------------------------------------
-
- def is_action_running(self):
- """Determines if the element action is running or not."""
- return self.get_action_cache().is_running()
-
- def is_in_operation(self):
- """Returns True if this element is involved in any operation"""
- return self.get_operation() is not None
-
- def is_in_local_operation(self):
- return self.get_operation() == self.get_action_cache()
-
- def get_operation(self):
- return self._operation
-
- def set_operation(self, operation):
- if self.is_in_operation() and operation is not None:
- raise Exception("%s is already involved in an operation"
- % self.name)
- if operation is not None:
- self._aborted = False
- self._stopped = False
- self._operation = operation
-
- def clear_operation(self):
- return self.set_operation(None) \ No newline at end of file
diff --git a/src/sardana/pool/poolbasegroup.py b/src/sardana/pool/poolbasegroup.py
deleted file mode 100644
index 37ff0aad..00000000
--- a/src/sardana/pool/poolbasegroup.py
+++ /dev/null
@@ -1,384 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolBaseGroup"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.taurusvalidator import AttributeNameValidator
-
-from sardana import State, ElementType, TYPE_PHYSICAL_ELEMENTS
-from sardana.pool.poolexternal import PoolExternalObject
-from sardana.pool.poolcontainer import PoolContainer
-
-
-class PoolBaseGroup(PoolContainer):
-
- def __init__(self, **kwargs):
- self._pending = True
- self._user_element_ids = None
- self._user_elements = None
- self._physical_elements = None
- self._physical_elements_set = None
- self._state_statistics = {}
- self._pool = kwargs.pop('pool')
- self.set_user_element_ids(kwargs.pop('user_elements'))
- PoolContainer.__init__(self)
- try:
- self._build_elements()
- except KeyError:
- self.info("failed to build element information. No problem. " \
- "Probably one or more underlying elements have not " \
- "been constructed yet")
-
- def _get_pool(self):
- return self._pool
-
- def _create_action_cache(self):
- raise NotImplementedError
-
- def _get_action_cache(self):
- if self._action_cache is None:
- self._action_cache = self._fill_action_cache()
- return self._action_cache
-
- def _set_action_cache(self, action_cache):
- physical_elements = self.get_physical_elements()
- if self._action_cache is not None:
- for ctrl_physical_elements in physical_elements.values():
- for physical_element in ctrl_physical_elements:
- action_cache.remove_element(physical_element)
-
- self._action_cache = self._fill_action_cache(action_cache)
-
- def _fill_action_cache(self, action_cache=None, physical_elements=None):
- if action_cache is None:
- action_cache = self._create_action_cache()
- if physical_elements is None:
- physical_elements = self.get_physical_elements()
- for _, ctrl_physical_elements in physical_elements.items():
- for physical_element in ctrl_physical_elements:
- action_cache.add_element(physical_element)
- return action_cache
-
- def _calculate_element_state(self, elem, elem_state_info):
- u_state, u_status = elem_state_info
- if u_status is None:
- u_status = '%s is None' % elem.name
- else:
- u_status = u_status.split("\n", 1)[0]
- return u_state, u_status
-
- def _calculate_states(self, state_info=None):
- user_elements = self.get_user_elements()
- none, unknown = set(), set()
- fault, alarm, on, moving = set(), set(), set(), set()
- status = []
- if state_info is None:
- state_info = {}
- for elem in user_elements:
- if elem.get_type() == ElementType.External:
- continue
- # cannot call get_state(us) here since it may lead to dead lock!
- si = elem.inspect_state(), elem.inspect_status()
- state_info[elem] = si
- for elem, elem_state_info in state_info.items():
- elem_type = elem.get_type()
- if elem_type == ElementType.External:
- continue
- u_state, u_status = self._calculate_element_state(elem, elem_state_info)
- if u_state == State.Moving:
- moving.add(elem)
- elif u_state == State.On:
- on.add(elem)
- elif u_state == State.Fault:
- fault.add(elem)
- elif u_state == State.Alarm:
- alarm.add(elem)
- elif u_state is State.Unknown:
- unknown.add(elem)
- elif u_state is None:
- none.add(elem)
- status.append(u_status)
- state = State.On
- if none or unknown:
- state = State.Unknown
- if fault:
- state = State.Fault
- elif alarm:
- state = State.Alarm
- elif moving:
- state = State.Moving
- self._state_statistics = { State.On : on, State.Fault : fault,
- State.Alarm : alarm, State.Moving : moving,
- State.Unknown : unknown, None : none }
- status = "\n".join(status)
- return state, status
-
- def _is_managed_element(self, element):
- return True
-
- def _build_elements(self):
- self._user_elements = []
- self._physical_elements = {}
- self._physical_elements_set = set()
-
- pool = self._get_pool()
- for user_element_id in self._user_element_ids:
- # an internal element
- internal = type(user_element_id) is int
- if internal:
- try:
- user_element = pool.get_element(id=user_element_id)
- except KeyError:
- self._pending = True
- self._user_elements = None
-
- self._physical_elements = None
- self._physical_elements_set = None
- raise
- internal = self._is_managed_element(user_element)
- if not internal:
- user_element_id = user_element.get_source()
- # a tango channel or non internal element (ex: ioregister or motor
- # in measurement group)
- if not internal:
- validator = AttributeNameValidator()
- params = validator.getParams(user_element_id)
- params['pool'] = self._get_pool()
- user_element = PoolExternalObject(**params)
- self.add_user_element(user_element)
- self._pending = False
-
- def on_element_changed(self, evt_src, evt_type, evt_value):
- pass
-
- def set_user_element_ids(self, new_element_ids):
- self.clear_user_elements()
- self._user_element_ids = new_element_ids
-
- def get_user_element_ids(self):
- """Returns the sequence of user element IDs
-
- :return: the sequence of user element IDs
- :rtype: sequence< :obj:`int`>"""
- return self._user_element_ids
-
- user_element_ids = property(get_user_element_ids)
-
- def get_user_elements(self):
- """Returns the sequence of user elements
-
- :return: the sequence of user elements
- :rtype: sequence< :class:`~sardana.pool.poolelement.PoolElement`>"""
- if self._pending:
- self._build_elements()
- return self._user_elements
-
- def get_user_elements_attribute_iterator(self):
- """Returns an iterator over the main attribute of each user element.
-
- :return: an iterator over the main attribute of each user element.
- :rtype: iter< :class:`~sardana.sardanaattribute.SardanaAttribute` >"""
- for element in self.get_user_elements():
- yield element.get_default_attribute()
-
- get_user_elements_attribute = get_user_elements_attribute_iterator
- get_user_elements_attribute.__doc__ = get_user_elements_attribute_iterator.__doc__
-
- def get_user_elements_attribute_sequence(self):
- """Returns a sequence of main attribute of each user element.
-
- In loops use preferably :meth:`get_user_elements_attribute_iterator` for
- performance and memory reasons.
-
- :return: a sequence of main attribute of each user element.
- :rtype: sequence< :class:`~sardana.sardanaattribute.SardanaAttribute` >"""
- return list(self.get_user_elements_attribute_iterator())
-
- def get_user_elements_attribute_map(self):
- """Returns a dictionary of main attribute of each user element.
-
- :return: a dictionary of main attribute of each user element.
- :rtype: dict< :class:`~sardana.pool.poolelement.PoolElement`,
- :class:`~sardana.sardanaattribute.SardanaAttribute` >"""
- ret = {}
- for element in self.get_user_elements():
- ret[element] = element.get_default_attribute()
- return ret
-
- def get_physical_elements(self):
- """Returns a dictionary or physical elements where key is a controller
- object and value is a sequence of pool elements
-
- :return: a dictionary of physical elements
- :rtype: dict< :class:`~sardana.pool.poolcontroller.PoolController,
- sequence<:class:`~sardana.pool.poolelement.PoolElement`>"""
- if self._pending:
- self._build_elements()
- return self._physical_elements
-
- def get_physical_elements_iterator(self):
- """Returns an iterator over the physical elements.
-
- .. warning:: The order is non deterministic.
-
- :return: an iterator over the physical elements.
- :rtype: iter<:class:`~sardana.pool.poolelement.PoolElement` >"""
- for _, elements in self.get_physical_elements().items():
- for element in elements:
- yield element
-
- def get_physical_elements_attribute_iterator(self):
- """Returns an iterator over the main attribute of each physical element.
-
- .. warning:: The order is non deterministic.
-
- :return: an iterator over the main attribute of each physical element.
- :rtype: iter< :class:`~sardana.sardanaattribute.SardanaAttribute` >"""
- for element in self.get_physical_elements_iterator():
- yield element.get_default_attribute()
-
- def get_physical_elements_set(self):
- if self._pending:
- self._build_elements()
- return self._physical_elements_set
-
- def add_user_element(self, element, index=None):
- user_elements = self._user_elements
- physical_elements = self._physical_elements
- physical_elements_set = self._physical_elements_set
-
- if element in user_elements:
- raise Exception("Group already contains %s" % element.name)
- if index is None:
- index = len(user_elements)
- user_elements.insert(index, element)
-
- if not self._is_managed_element(element):
- return index
-
- self.add_element(element)
- self._find_physical_elements(element,
- physical_elements=physical_elements,
- physical_elements_set=physical_elements_set)
- action_cache = self._action_cache
- if action_cache is not None:
- self._fill_action_cache(action_cache=action_cache,
- physical_elements=physical_elements)
- element.add_listener(self.on_element_changed)
- return index
-
- def _find_physical_elements(self, element, physical_elements=None,
- physical_elements_set=None):
- elem_type = element.get_type()
- if physical_elements is None:
- physical_elements = {}
- if physical_elements_set is None:
- physical_elements_set = set()
-
- if elem_type in TYPE_PHYSICAL_ELEMENTS:
- ctrl = element.controller
- own_elements = physical_elements.get(ctrl)
- if own_elements is None:
- physical_elements[ctrl] = own_elements = set()
- own_elements.add(element)
- physical_elements_set.add(element)
- else:
- for ctrl, elements in element.get_physical_elements().items():
- own_elements = physical_elements.get(ctrl)
- if own_elements is None:
- physical_elements[ctrl] = own_elements = set()
- own_elements.update(elements)
- physical_elements_set.update(elements)
- return physical_elements
-
- # TODO: too complicated to implement for now
-# def remove_user_element(self, element):
-# try:
-# idx = self._user_elements.index(element)
-# except ValueError:
-# raise Exception("Group doesn't contain %s" % element.name)
-# action_cache = self.get_action_cache()
-# element.remove_listener(self.on_element_changed)
-# action_cache.remove_element(element)
-# del self._user_elements[idx]
-# del self._user_element_ids[self._user_element_ids.index(element.id)]
-# self.remove_element(element)
-
- def clear_user_elements(self):
- user_elements = self._user_elements
- if user_elements is not None:
- for element in user_elements:
- if element.get_type() != ElementType.External:
- element.remove_listener(self.on_element_changed)
- self.remove_element(element)
- self._action_cache = None
- self._pending = True
- self._user_elements = None
- self._user_element_ids = None
- self._physical_elements = None
-
-
- # --------------------------------------------------------------------------
- # stop
- # --------------------------------------------------------------------------
-
- def stop(self):
- for ctrl, elements in self.get_physical_elements().items():
- self.debug("Stopping %s %s", ctrl.name, [e.name for e in elements])
- try:
- ctrl.stop_elements(elements=elements)
- except:
- self.error("Unable to stop controller %s", ctrl.name)
- self.debug("Details:", exc_info=1)
-
- # --------------------------------------------------------------------------
- # abort
- # --------------------------------------------------------------------------
-
- def abort(self):
- for ctrl, elements in self.get_physical_elements().items():
- self.debug("Aborting %s %s", ctrl.name, [e.name for e in elements])
- try:
- ctrl.abort_elements(elements=elements)
- except:
- self.error("Unable to abort controller %s", ctrl.name)
- self.debug("Details:", exc_info=1)
-
- # --------------------------------------------------------------------------
- # involved in an operation
- # --------------------------------------------------------------------------
-
- def get_operation(self):
- for _, elements in self.get_physical_elements().items():
- for element in elements:
- op = element.get_operation()
- if op is not None:
- return op
- return None
diff --git a/src/sardana/pool/poolbaseobject.py b/src/sardana/pool/poolbaseobject.py
deleted file mode 100644
index 37bb609a..00000000
--- a/src/sardana/pool/poolbaseobject.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for Pool object"""
-
-__all__ = ["PoolBaseObject"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanabase import SardanaBaseObject
-
-
-class PoolBaseObject(SardanaBaseObject):
- """The Pool most abstract object."""
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('pool')
- SardanaBaseObject.__init__(self, **kwargs)
-
- def get_pool(self):
- """Return the :class:`sardana.pool.pool.Pool` which *owns* this pool
- object.
-
- :return: the pool which *owns* this pool object.
- :rtype: :class:`sardana.pool.pool.Pool`"""
- return self.get_manager()
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaBaseObject.serialize(self, *args, **kwargs)
- kwargs['pool'] = self.pool.name
- return kwargs
-
- pool = property(get_pool,
- doc="reference to the :class:`sardana.pool.pool.Pool`")
-
diff --git a/src/sardana/pool/poolcontainer.py b/src/sardana/pool/poolcontainer.py
deleted file mode 100644
index 43b77c9d..00000000
--- a/src/sardana/pool/poolcontainer.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for a pool container element"""
-
-__all__ = ["PoolContainer"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanacontainer import SardanaContainer
-
-
-class PoolContainer(SardanaContainer):
- """A container class for pool elements"""
-
- def get_controller_class(self, **kwargs):
- eid = kwargs.get("id")
- if eid is not None:
- return self.get_controller_class_by_id(eid, **kwargs)
-
- name = kwargs.pop("name")
- self.get_controller_class_by_name(name, **kwargs)
-
- def get_controller_class_by_id(self, eid, **kwargs):
- raise NotImplementedError
-
- def get_controller_class_by_name(self, name, **kwargs):
- raise NotImplementedError \ No newline at end of file
diff --git a/src/sardana/pool/poolcontroller.py b/src/sardana/pool/poolcontroller.py
deleted file mode 100644
index 2ef97d42..00000000
--- a/src/sardana/pool/poolcontroller.py
+++ /dev/null
@@ -1,948 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolController", "PoolPseudoMotorController",
- "PoolPseudoCounterController"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import weakref
-import StringIO
-import traceback
-import functools
-
-from taurus.core.util.containers import CaselessDict
-
-from sardana import State, ElementType, TYPE_TIMERABLE_ELEMENTS
-from sardana.sardanaevent import EventType
-from sardana.sardanavalue import SardanaValue
-
-from sardana.pool.poolextension import translate_ctrl_value
-from sardana.pool.poolbaseelement import PoolBaseElement
-
-
-class PoolBaseController(PoolBaseElement):
- """Base class for all controllers"""
- def __init__(self, **kwargs):
- self._ctrl = None
- self._ctrl_error = None
- self._element_ids = {}
- self._pending_element_ids = {}
- self._element_axis = {}
- self._pending_element_axis = {}
- self._element_names = CaselessDict()
- self._pending_element_names = CaselessDict()
- self._operator = None
- kwargs['elem_type'] = ElementType.Controller
- super(PoolBaseController, self).__init__(**kwargs)
-
- def get_ctrl_types(self):
- raise NotImplementedError
-
- def get_ctrl_type_names(self):
- return map(ElementType.whatis, self.get_ctrl_types())
-
- def is_online(self):
- return True
-
- def get_ctrl_error(self):
- return self._ctrl_error
-
- def get_ctrl_error_str(self):
- """"""
- err = self._ctrl_error
- if err is None:
- return ""
- sio = StringIO.StringIO()
- traceback.print_exception(err[0], err[1], err[2], None, sio)
- s = sio.getvalue()
- sio.close()
- if s[-1:] == "\n":
- s = s[:-1]
- return s
-
- def add_element(self, elem, propagate=1):
- name, axis, eid = elem.get_name(), elem.get_axis(), elem.get_id()
- if self.is_online():
- try:
- self._ctrl.AddDevice(axis)
- except:
- self.error("Unable to add %s(%s)", name, axis, exc_info=1)
- self._pending_element_ids[eid] = elem
- self._pending_element_axis[axis] = elem
- self._pending_element_names[name] = elem
- self._element_ids[eid] = elem
- self._element_axis[axis] = elem
- self._element_names[name] = elem
- else:
- #TODO: raise exception
- self._pending_element_ids[eid] = elem
- self._pending_element_axis[axis] = elem
- self._pending_element_names[name] = elem
- if propagate:
- elements = self.get_elements()
- elements = [ elements[_id].name for _id in sorted(elements) ]
- self.fire_event(EventType("elementlist", priority=propagate),
- elements)
-
- def remove_element(self, elem, propagate=1):
- name, axis, eid = elem.get_name(), elem.get_axis(), elem.get_id()
- f = self._element_ids.has_key(eid)
- if not f:
- f = self._pending_element_ids.has_key(eid)
- if not f:
- raise Exception("element '%s' is not in controller")
- del self._pending_element_ids[eid]
- del self._pending_element_axis[axis]
- del self._pending_element_names[name]
- else:
- del self._element_ids[eid]
- del self._element_axis[axis]
- del self._element_names[name]
- try:
- self._ctrl.DeleteDevice(axis)
- except:
- self.error("Unable to delete %s(%s)", name, axis, exc_info=1)
- if propagate:
- elements = self.get_elements()
- elements = [ elements[_id].name for _id in sorted(elements) ]
- self.fire_event(EventType("elementlist", priority=propagate),
- elements)
-
- def remove_axis(self, axis, propagate=1):
- f = self._element_axis.has_key(axis)
- if not f:
- f = self._pending_element_axis.has_key(axis)
- if not f:
- raise Exception("element '%s' is not in controller")
- elem = self._pending_element_axis[axis]
- else:
- elem = self._element_axis[axis]
- self.remove_element(elem, propagate=propagate)
-
- def get_elements(self):
- return self._element_ids
-
- def get_element_ids(self):
- return self._element_ids
-
- def get_element_axis(self):
- return self._element_axis
-
- def get_element(self, **kwargs):
- k = kwargs.get('axis')
- if k is None:
- k = kwargs.get('name')
- if k is None:
- k = kwargs.get('id')
- if k is None:
- raise Exception("Must give either name, id or axis")
- d, pd = self._element_ids, self._pending_element_ids
- else:
- d, pd = self._element_names, self._pending_element_names
- else:
- d, pd = self._element_axis, self._pending_element_axis
-
- elem = d.get(k)
- if elem is None:
- elem = pd.get(k)
- return elem
-
- def read_axis_states(self, axes=None):
- """Reads the state for the given axes. If axes is None, reads the
- state of all active axes.
-
- :param axes: the list of axis to get the state. Default is None meaning
- all active axis in this controller
- :type axes: seq<int> or None
- :return: a map containing the controller state information for each axis
- :rtype: dict<PoolElement, state info>
- """
- raise NotImplementedError
-
- def read_axis_values(self, axes=None):
- """Reads the value for the given axes. If axes is None, reads the
- value of all active axes.
-
- :param axes: the list of axis to get the value. Default is None meaning
- all active axis in this controller
- :type axes: seq<int> or None
- :return: a map containing the controller value information for each axis
- :rtype: dict<PoolElement, value>
- """
- raise NotImplementedError
-
- def get_status(self, cache=True, propagate=1):
- """Returns the status for this object. If cache is True (default) it
- returns the current status stored in cache (it will force an update if
- cache is empty). If propagate > 0 and if the status changed since last
- read, it will propagate the status event to all listeners.
-
- :param cache:
- tells if return value from local cache or update from HW read
- [default: True]
- :type cache: bool
- :param propagate:
- if > 0 propagates the event in case it changed since last HW read.
- Values bigger that mean the event if sent should be a priority event
- [default: 1]
- :type propagate: int
- :return: the current object status
- :rtype: str"""
- if not cache or self._status is None:
- state_info = None
- self._set_state_info(state_info, propagate=propagate)
- return self._status
-
- _STD_STATUS = '{name} is {state}'
- def calculate_state_info(self, status_info=None):
- """Transforms the given state information. This specific base
- implementation transforms the given state,status tuple into a
- state, new_status tuple where new_status is "*self.name* is *state*.
-
- :param status_info:
- given status information [default: None, meaning use current state status.
- :type status_info: tuple<State, str>
- :return: a transformed state information
- :rtype: tuple<State, str>"""
- if status_info is None:
- status_info = self._state, self._status
- state, _ = status_info
- state_str = State[state]
- new_status = self._STD_STATUS.format(name=self.name, state=state_str)
- return status_info[0], new_status
-
-
-def check_ctrl(fn):
- @functools.wraps(fn)
- def wrapper(pool_ctrl, *args, **kwargs):
- if not pool_ctrl.is_online():
- raise Exception("Cannot execute '%s' because '%s' is offline" % \
- (fn.__name__, pool_ctrl.name))
- return fn(pool_ctrl, *args, **kwargs)
- return wrapper
-
-def ctrl_access(fn):
- @functools.wraps(fn)
- def wrapper(pool_ctrl, *args, **kwargs):
- with pool_ctrl:
- return fn(pool_ctrl, *args, **kwargs)
- return wrapper
-
-
-class PoolController(PoolBaseController):
- """Controller class mediator for sardana controller plugins"""
-
- def __init__(self, **kwargs):
- self._lib_info = kwargs.pop('lib_info')
- self._ctrl_info = kwargs.pop('class_info')
- self._lib_name = kwargs.pop('library')
- self._class_name = kwargs.pop('klass')
- self._properties = kwargs.pop('properties')
- super(PoolController, self).__init__(**kwargs)
- self.re_init()
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolBaseController.serialize(self, *args, **kwargs)
- ctrl_info = self._ctrl_info
- if ctrl_info is None:
- kwargs['module'] = self._lib_name
- kwargs['klass'] = self._class_name
- kwargs['language'] = 'Python'
- kwargs['file_name'] = None
- kwargs['types'] = None
- kwargs['main_type'] = None
- kwargs['parent'] = self._class_name
- else:
- types = self.get_ctrl_type_names()
- kwargs['module'] = ctrl_info.module_name
- kwargs['klass'] = ctrl_info.name
- kwargs['language'] = 'Python'
- kwargs['file_name'] = ctrl_info.file_name
- kwargs['types'] = types
- kwargs['parent'] = ctrl_info.name
- if len(types):
- kwargs['main_type'] = types[0]
- else:
- kwargs['main_type'] = None
- return kwargs
-
- def _create_ctrl_args(self):
- name = self.name
- klass = self._ctrl_info.klass
- props = dict(self._properties)
- args, kwargs = [], dict(pool_controller=weakref.ref(self))
- return name, klass, props, args, kwargs
-
- def _create_controller(self):
- name, klass, props, args, kwargs = self._create_ctrl_args()
- api = self._ctrl_info.api_version
- if api == 0:
- ctrl = klass(name, props)
- ctrl._args = args
- ctrl._kwargs = kwargs
- elif api == 1:
- ctrl = klass(name, props, *args, **kwargs)
- return ctrl
-
- def _init(self):
- if self._ctrl_info is None:
- if self._lib_info is not None:
- self._ctrl_error = self._lib_info.get_error()
- return
- try:
- self._ctrl = self._create_controller()
- except:
- self._ctrl = None
- self._ctrl_error = sys.exc_info()
-
- def re_init(self):
- self.set_state(State.Init, propagate=2)
- status = "{0} is Initializing (temporarily unavailable)".format(self.name)
- self.set_status(status, propagate=2)
- manager = self.pool.ctrl_manager
- old_e_ids = self._element_ids
- old_p_e_ids = self._pending_element_ids
-
- elem_axis = dict(self._element_axis)
- for axis in elem_axis:
- self.remove_axis(axis, propagate=0)
-
- if self._lib_info is None:
- mod_name = self.get_library_name()
- else:
- mod_name = self._lib_info.name
-
- if self._ctrl_info is None:
- class_name = self.get_class_name()
- else:
- class_name = self._ctrl_info.name
-
- self._ctrl_error = None
- self._ctrl_info = None
- self._lib_info = manager.getControllerLib(mod_name)
- if self._lib_info is not None:
- self._ctrl_info = self._lib_info.get_controller(class_name)
- self._init()
-
- for elem in elem_axis.values():
- self.add_element(elem, propagate=0)
-
- state, status = State.Fault, ""
- if self.is_online():
- state = State.On
- else:
- status = "\n" + self.get_ctrl_error_str()
-
- status = "{0} is {1}".format(self.name, State[state]) + status
- self.set_status(status, propagate=2)
- self.set_state(state, propagate=2)
-
- def get_ctrl_types(self):
- return self._ctrl_info.types
-
- def is_timerable(self):
- for t in self._ctrl_info.types:
- if t in TYPE_TIMERABLE_ELEMENTS:
- return True
- return False
-
- def is_online(self):
- return self._ctrl_error is None and self._ctrl is not None
-
- def get_ctrl(self):
- return self._ctrl
-
- ctrl = property(fget=get_ctrl, doc="actual controller object")
-
- def get_ctrl_info(self):
- return self._ctrl_info
-
- ctrl_info = property(fget=get_ctrl_info, doc="controller information object")
-
- def set_operator(self, operator):
- """Defines the current operator object for this controller.
- For example, in acquisition, it should be a :class:`PoolMeasurementGroup`
- object.
-
- :param operator: the new operator object
- :type operator: object"""
- self._operator = operator
-
- def get_operator(self):
- return self._operator
-
- operator = property(fget=get_operator, fset=set_operator, doc="current controller operator")
-
- # START API WHICH ACCESSES CONTROLLER API ----------------------------------
-
- @check_ctrl
- def set_log_level(self, level):
- self.ctrl._log.log_obj.setLevel(level)
-
- @check_ctrl
- def get_log_level(self):
- return self.ctrl._log.log_obj.level
-
- def get_library_name(self):
- return self._lib_name
-
- def get_class_name(self):
- return self._class_name
-
- @check_ctrl
- def get_axis_attributes(self, axis):
- return self.ctrl.GetAxisAttributes(axis)
-
- @check_ctrl
- def get_ctrl_attr(self, name):
- ctrl_info = self.ctrl_info
- attr_info = ctrl_info.ctrl_attributes[name]
- if hasattr(self.ctrl, attr_info.fget):
- return getattr(self.ctrl, attr_info.fget)()
- else:
- return self.ctrl.GetCtrlPar(name)
-
- @check_ctrl
- def set_ctrl_attr(self, name, value):
- ctrl_info = self.ctrl_info
- attr_info = ctrl_info.ctrl_attributes[name]
- if hasattr(self.ctrl, attr_info.fset):
- return getattr(self.ctrl, attr_info.fset)(value)
- else:
- return self.ctrl.SetCtrlPar(name, value)
-
- @check_ctrl
- def get_axis_attr(self, axis, name):
- ctrl_info = self.ctrl_info
- axis_attr_info = ctrl_info.axis_attributes[name]
- if hasattr(self.ctrl, axis_attr_info.fget):
- ret = getattr(self.ctrl, axis_attr_info.fget)(axis)
- else:
- ret = self.ctrl.GetAxisExtraPar(axis, name)
- return ret
-
- @check_ctrl
- def set_axis_attr(self, axis, name, value):
- ctrl_info = self.ctrl_info
- axis_attr_info = ctrl_info.axis_attributes[name]
- try:
- return getattr(self.ctrl, axis_attr_info.fset)(axis, value)
- except AttributeError:
- return self.ctrl.SetAxisExtraPar(axis, name, value)
-
- @check_ctrl
- def set_ctrl_par(self, name, value):
- #return self.ctrl.setCtrlPar(unit, name, value)
- return self.ctrl.SetCtrlPar(name, value)
-
- @check_ctrl
- def get_ctrl_par(self, name):
- #return self.ctrl.getCtrlPar(unit, name, value)
- return self.ctrl.GetCtrlPar(name)
-
- @check_ctrl
- def set_axis_par(self, axis, name, value):
- #return self.ctrl.SetAxisPar(unit, axis, name, value)
- return self.ctrl.SetAxisPar(axis, name, value)
-
- @check_ctrl
- def get_axis_par(self, axis, name):
- #return self.ctrl.GetAxisPar(unit, axis, name, value)
- return self.ctrl.GetAxisPar(axis, name)
-
-
- # END API WHICH ACCESSES CONTROLLER API ------------------------------------
-
- # START API WHICH ACCESSES CRITICAL CONTROLLER API (like StateOne) ---------
-
- def __build_exc_info(self, ctrl_states, axes, exc_info):
- status = "".join(traceback.format_exception(*exc_info))
- state_info = State.Fault, status
- for axis in axes:
- element = self.get_element(axis=axis)
- ctrl_states[element] = state_info
-
- @staticmethod
- def _format_exception(exc_info):
- fmt_exc = traceback.format_exception_only(*exc_info[:2])
- fmt_exc = "".join(fmt_exc)
- if fmt_exc.endswith("\n"):
- fmt_exc = fmt_exc[:-1]
- return fmt_exc
-
- def raw_read_axis_states(self, axes=None, ctrl_states=None):
- """**Unsafe method**. Reads the state for the given axes. If axes
- is None, reads the state of all active axes.
-
- :param axes: the list of axis to get the state. Default is None meaning
- all active axis in this controller
- :type axes: seq<int> or None
- :return:
- a tuple of two elements: a map containing the controller state
- information for each axis and a boolean telling if an error occured
- :rtype: dict<PoolElement, state info>, bool"""
- if axes is None:
- axes = self._element_axis.keys()
- if ctrl_states is None:
- ctrl_states = {}
-
- ctrl = self.ctrl
-
- try:
- ctrl.PreStateAll()
- for axis in axes:
- ctrl.PreStateOne(axis)
- ctrl.StateAll()
- except:
- exc_info = sys.exc_info()
- status = self._format_exception(exc_info)
- state_info = (State.Fault, status), exc_info
- for axis in axes:
- element = self.get_element(axis=axis)
- ctrl_states[element] = state_info
- return ctrl_states, True
-
- error = False
- for axis in axes:
- element = self.get_element(axis=axis)
- try:
- state_info = ctrl.StateOne(axis)
- if state_info is None:
- raise Exception("%s.StateOne(%s(%d)) returns 'None'"
- % (self.name, element.name, axis))
- state_info = state_info, None
- except:
- exc_info = sys.exc_info()
- status = self._format_exception(exc_info)
- state_info = (State.Fault, status), exc_info
- error = True
- ctrl_states[element] = state_info
- return ctrl_states, error
-
- @check_ctrl
- def read_axis_states(self, axes=None):
- """Reads the state for the given axes. If axes is None, reads the
- state of all active axes.
-
- :param axes: the list of axis to get the state. Default is None
- meaning all active axis in this controller
- :type axes: seq<int> or None
- :return: a map containing the controller state information for each axis
- :rtype: dict<PoolElement, state info>"""
- return self.raw_read_axis_states(axes=axes)
-
- def _read_axis_value(self, element):
- try:
- axis = element.get_axis()
- ctrl_value = self.ctrl.ReadOne(axis)
- if ctrl_value is None:
- msg = '%s.ReadOne(%s[%d]) return error: Expected value, ' \
- 'got None instead' % (self.name, element.name, axis)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
- def raw_read_axis_values(self, axes=None, ctrl_values=None):
- """**Unsafe method**. Reads the value for the given axes. If axes
- is None, reads the value of all active axes.
-
- :param axes: the list of axis to get the value. Default is None
- meaning all active axis in this controller
- :type axes: seq<int> or None
- :return: a map containing the controller value information for each axis
- :rtype: dict<PoolElement, SardanaValue>"""
- if axes is None:
- axes = self._element_axis.keys()
- if ctrl_values is None:
- ctrl_values = {}
-
- ctrl = self.ctrl
-
- try:
- ctrl.PreReadAll()
- for axis in axes:
- ctrl.PreReadOne(axis)
- ctrl.ReadAll()
- except:
- exc_info = sys.exc_info()
- for axis in axes:
- element = self.get_element(axis=axis)
- ctrl_values[element] = SardanaValue(exc_info=exc_info)
- return ctrl_values
-
- for axis in axes:
- element = self.get_element(axis=axis)
- ctrl_values[element] = self._read_axis_value(element)
-
- return ctrl_values
-
- @check_ctrl
- def read_axis_values(self, axes=None):
- """Reads the value for the given axes. If axes is None, reads the
- value of all active axes.
-
- :param axes: the list of axis to get the value. Default is None meaning
- all active axis in this controller
- :type axes: seq<int> or None
- :return: a map containing the controller value information for each axis
- :rtype: dict<PoolElement, SardanaValue>"""
- return self.raw_read_axis_values(axes=axes)
-
- def raw_stop_all(self):
- try:
- return self._raw_stop_all()
- except:
- pass
-
- def raw_stop_one(self, axis):
- try:
- self._raw_stop_one(axis)
- except:
- pass
-
- def _raw_stop_all(self):
- try:
- return self.ctrl.StopAll()
- except:
- self.warning("StopAll() raises exception")
- self.debug("Details:", exc_info=1)
- raise
-
- def _raw_stop_one(self, axis):
- try:
- self.ctrl.StopOne(axis)
- except:
- self.warning("StopOne(%d) raises exception", axis)
- self.debug("Details:", exc_info=1)
- raise
-
- @check_ctrl
- def stop_all(self):
- self.raw_stop_all()
-
- stop = stop_all
-
- @check_ctrl
- def stop_one(self, axis):
- return self.raw_stop_one(axis)
-
- @check_ctrl
- def stop_axes(self, axes=None):
- """Stops the given axes. If axes is None, stops all active axes.
-
- :param axes: the list of axis to stop. Default is None
- meaning all active axis in this controller
- :type axes: seq<int> or None
- """
- if axes is None:
- return self.raw_stop_all()
-
- for axis in axes:
- self.raw_stop_one(axis)
-
- @check_ctrl
- def stop_elements(self, elements=None):
- """Stops the given elements. If axes is None, stops all active axes.
-
- :param elements: the list of elements to stop. Default is None
- meaning all active axis in this controller
- :type axes: seq<PoolElement> or None
- """
- if elements is None:
- return self.raw_stop_all()
-
- for element in elements:
- self.raw_stop_one(element.axis)
-
- def raw_abort_all(self):
- try:
- return self._raw_abort_all()
- except:
- pass
-
- def raw_abort_one(self, axis):
- try:
- self._raw_abort_one(axis)
- except:
- pass
-
- def _raw_abort_all(self):
- try:
- return self.ctrl.AbortAll()
- except:
- self.warning("AbortAll() raises exception")
- self.debug("Details:", exc_info=1)
- raise
-
- def _raw_abort_one(self, axis):
- try:
- self.ctrl.AbortOne(axis)
- except:
- self.warning("AbortOne(%d) raises exception", axis)
- self.debug("Details:", exc_info=1)
- raise
-
- @check_ctrl
- def abort_all(self):
- self.raw_abort_all()
-
- @check_ctrl
- def abort_one(self, axis):
- return self.raw_abort_one(axis)
-
- @check_ctrl
- def abort_axes(self, axes=None):
- """Aborts the given axes. If axes is None, aborts all active axes.
-
- :param axes: the list of axis to abort. Default is None
- meaning all active axis in this controller
- :type axes: seq<int> or None
- """
- if axes is None:
- return self.raw_abort_all()
-
- for axis in axes:
- self.raw_abort_one(axis)
-
- @check_ctrl
- def abort_elements(self, elements=None):
- """Aborts the given elements. If axes is None, aborts all active axes.
-
- :param elements: the list of elements to abort. Default is None
- meaning all active axis in this controller
- :type axes: seq<PoolElement> or None
- """
- if elements is None:
- return self.raw_abort_all()
-
- for element in elements:
- self.raw_abort_one(element.axis)
-
- abort = abort_all
-
- @check_ctrl
- def emergency_break(self, elements=None):
- """Stops the given elements. If axes is None, stops all active axes.
- If stop raises exception, an abort is attempted.
-
- :param elements: the list of elements to stop. Default is None
- meaning all active axis in this controller
- :type axes: seq<PoolElement> or None
- """
- if elements is None:
- try:
- return self._raw_stop_all()
- except:
- return self.raw_abort_all()
-
- for element in elements:
- try:
- self._raw_stop_one(element.axis)
- except:
- self.raw_abort_one(element.axis)
-
- @check_ctrl
- def send_to_controller(self, stream):
- return self.ctrl.SendToCtrl(stream)
-
- # END API WHICH ACCESSES CRITICAL CONTROLLER API (like StateOne) -----------
-
- # START SPECIFIC TO MOTOR CONTROLLER ---------------------------------------
-
- def raw_move(self, axis_pos):
- ctrl = self.ctrl
- ctrl.PreStartAll()
- for axis, dial_position in axis_pos.items():
- ret = ctrl.PreStartOne(axis, dial_position)
- if not ret:
- raise Exception("%s.PreStartOne(%d, %f) returns False" \
- % (self.name, axis, dial_position))
-
- for axis, dial_position in axis_pos.items():
- ctrl.StartOne(axis, dial_position)
-
- ctrl.StartAll()
-
- @check_ctrl
- def move(self, axis_pos):
- return self.raw_move(axis_pos)
-
- def has_backlash(self):
- return "Backlash" in self._ctrl.ctrl_features
-
- def wants_rounding(self):
- return "Rounding" in self._ctrl.ctrl_features
-
- @check_ctrl
- def define_position(self, axis, position):
- return self.ctrl.DefinePosition(axis, position)
-
- # END SPECIFIC TO MOTOR CONTROLLER -----------------------------------------
-
- # START SPECIFIC TO IOR CONTROLLER -----------------------------------------
-
- def write_one(self, axis, value):
- self.ctrl.WriteOne(axis, value)
-
- # END SPECIFIC TO IOR CONTROLLER -------------------------------------------
-
-
-class PoolPseudoMotorController(PoolController):
-
- def __init__(self, **kwargs):
- self._motor_ids = kwargs.pop('role_ids')
- super(PoolPseudoMotorController, self).__init__(**kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolController.serialize(self, *args, **kwargs)
- kwargs['type'] = 'Controller'
- return kwargs
-
- def _create_ctrl_args(self):
- pars = PoolController._create_ctrl_args(self)
- kwargs = pars[4]
- kwargs['motor_ids'] = tuple(self._motor_ids)
- return pars
-
- def _read_axis_value(self, element):
- try:
- axis = element.get_axis()
- ctrl_value = self.ctrl.ReadOne(axis)
- if ctrl_value is None:
- msg = '%s.ReadOne(%s[%d]) return error: Expected value, ' \
- 'got None instead' % (self.name, element.name, axis)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
- @check_ctrl
- def calc_all_pseudo(self, physical_pos, curr_pseudo_pos):
- ctrl = self.ctrl
- try:
- ctrl_value = ctrl.CalcAllPseudo(physical_pos, curr_pseudo_pos)
- if ctrl_value is None:
- msg = '%s.CalcAllPseudo() return error: Expected value, ' \
- 'got None instead' % (self.name,)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
- @check_ctrl
- def calc_all_physical(self, pseudo_pos, curr_physical_pos):
- ctrl = self.ctrl
- try:
- ctrl_value = ctrl.CalcAllPhysical(pseudo_pos, curr_physical_pos)
- if ctrl_value is None:
- msg = '%s.CalcAllPhysical() return error: Expected value, ' \
- 'got None instead' % (self.name,)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
- @check_ctrl
- def calc_pseudo(self, axis, physical_pos, curr_pseudo_pos):
- ctrl = self.ctrl
- try:
- ctrl_value = ctrl.CalcPseudo(axis, physical_pos, curr_pseudo_pos)
- if ctrl_value is None:
- msg = '%s.CalcPseudo() return error: Expected value, ' \
- 'got None instead' % (self.name,)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
- @check_ctrl
- def calc_physical(self, axis, pseudo_pos, curr_physical_pos):
- ctrl = self.ctrl
- try:
- ctrl_value = ctrl.CalcPhysical(axis, pseudo_pos, curr_physical_pos)
- if ctrl_value is None:
- msg = '%s.CalcPhysical() return error: Expected value, ' \
- 'got None instead' % (self.name,)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
-
-class PoolPseudoCounterController(PoolController):
-
- def __init__(self, **kwargs):
- self._counter_ids = kwargs.pop('role_ids')
- super(PoolPseudoCounterController, self).__init__(**kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolController.serialize(self, *args, **kwargs)
- kwargs['type'] = 'Controller'
- return kwargs
-
- def _create_ctrl_args(self):
- pars = PoolController._create_ctrl_args(self)
- kwargs = pars[4]
- kwargs['counter_ids'] = tuple(self._counter_ids)
- return pars
-
- @check_ctrl
- def calc(self, axis, values):
- ctrl = self.ctrl
- try:
- ctrl_value = ctrl.Calc(axis, values)
- if ctrl_value is None:
- msg = '%s.Calc() return error: Expected value, ' \
- 'got None instead' % (self.name,)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
-
- def calc_all(self, values):
- ctrl = self.ctrl
- try:
- ctrl_value = ctrl.CalcAll(values)
- if ctrl_value is None:
- msg = '%s.CalcAll() return error: Expected value, ' \
- 'got None instead' % (self.name,)
- raise ValueError(msg)
- value = translate_ctrl_value(ctrl_value)
- except:
- value = SardanaValue(exc_info=sys.exc_info())
- return value
diff --git a/src/sardana/pool/poolcontrollermanager.py b/src/sardana/pool/poolcontrollermanager.py
deleted file mode 100644
index d2664c72..00000000
--- a/src/sardana/pool/poolcontrollermanager.py
+++ /dev/null
@@ -1,552 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the class which
-controls finding, loading/unloading of device pool controller plug-ins."""
-
-__all__ = ["ControllerManager"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import re
-import sys
-import copy
-import types
-import inspect
-
-from taurus.core import ManagerState
-from taurus.core.util.log import Logger
-from taurus.core.util.singleton import Singleton
-
-from sardana.sardanamodulemanager import ModuleManager
-from sardana.pool import controller
-from sardana.pool.poolexception import UnknownController
-from sardana.pool.poolmetacontroller import ControllerLibrary, ControllerClass
-
-CONTROLLER_TEMPLATE = '''
-
-class @controller_name@(MotorController):
- """This class representes a Sardana motor controller."""
-
- ctrl_features = []
- MaxDevice = 1024
-
- ctrl_properties = {}
- ctrl_attributes = {}
- axis_attributes = {}
-
- def __init__(self, inst, props, *args, **kwargs):
- MotorController.__init__(self, inst, props, *args, **kwargs)
-
-'''
-
-
-class ControllerManager(Singleton, Logger):
- """The singleton class responsible for managing controller plug-ins."""
-
- DEFAULT_CONTROLLER_DIRECTORIES = 'poolcontrollers',
-
- def __init__(self):
- """Initialization. Nothing to be done here for now."""
- pass
-
- def init(self, *args, **kwargs):
- """Singleton instance initialization."""
- name = self.__class__.__name__
- self._state = ManagerState.UNINITIALIZED
- self.call__init__(Logger, name)
- self._pool = None
- self.reInit()
-
- def reInit(self):
- """Singleton re-initialization."""
- if self._state == ManagerState.INITED:
- return
-
- #: dict<str, metacontroller.ControllerLibray>
- #: key - module name (without path and without extension)
- #: value - ControllerLibrary object representing the module
- self._modules = {}
-
- #: dict<str, <metacontroller.ControllerClass>
- #: key - controller name
- #: value - ControllerClass object representing the controller
- self._controller_dict = {}
-
- #: list<str>
- #: elements are absolute paths
- self._controller_path = []
-
- l = []
- for _, klass in inspect.getmembers(controller, inspect.isclass):
- if not issubclass(klass, controller.Controller):
- continue
- l.append(klass)
- self._base_classes = l
-
- self._state = ManagerState.INITED
-
- def cleanUp(self):
- """Singleton clean up."""
- if self._state == ManagerState.CLEANED:
- return
-
- #if self._modules:
- # ModuleManager().unloadModules(self._modules.keys())
-
- self._controller_path = None
- self._controller_dict = None
- self._modules = None
-
- self._state = ManagerState.CLEANED
-
- def set_pool(self, pool):
- self._pool = pool
-
- def get_pool(self):
- return self._pool
-
- def setControllerPath(self, controller_path, reload=True):
- """Registers a new list of controller directories in this manager.
-
- :param seq<str> controller_path: a sequence of absolute paths where this
- manager should look for controllers
-
- .. warning::
- as a consequence all the controller modules will be reloaded.
- This means that if any reference to an old controller object was
- kept it will refer to an old module (which could possibly generate
- problems of type class A != class A)."""
- p = []
- for item in controller_path:
- p.extend(item.split(":"))
-
- # filter empty and commented paths
- p = [ i for i in p if i and not i.startswith("#") ]
-
- # add basic dummy controller directory(ies)
- pool_dir = os.path.dirname(os.path.abspath(__file__))
- for ctrl_dir in self.DEFAULT_CONTROLLER_DIRECTORIES:
- ctrl_dir = os.path.join(pool_dir, ctrl_dir)
- if not ctrl_dir in p:
- p.append(ctrl_dir)
-
- self._controller_path = p
-
- controller_file_names = self._findControllerLibNames()
-
- for controller_file_name in controller_file_names:
- try:
- self.reloadControllerLib(controller_file_name, reload=reload)
- except Exception:
- pass
-
- def getControllerPath(self):
- """Returns the current sequence of absolute paths used to look for
- controllers.
-
- :return: sequence of absolute paths
- :rtype: seq<str>"""
- return self._controller_path
-
- def _findControllerLibNames(self, path=None):
- """internal method"""
- path = path or self.getControllerPath()
- ret = []
- for p in path:
- try:
- for f in os.listdir(p):
- name, ext = os.path.splitext(f)
- if not name[0].isalpha():
- continue
- if ext.endswith('py'):
- ret.append(name)
- except:
- self.debug("'%s' is not a valid path" % p)
- return ret
-
- def _fromNameToFileName(self, lib_name, path=None):
- """internal method"""
- path = path or self.getControllerPath()[0]
- f_name = lib_name
- if not f_name.endswith('.py'):
- f_name += '.py'
-
- if os.path.isabs(f_name):
- path, _ = os.path.split(f_name)
- if not path in self.getControllerPath():
- raise Exception("'%s' is not part of the PoolPath" % path)
- else:
- f_name = os.path.join(path, f_name)
- return f_name
-
- def getOrCreateControllerLib(self, lib_name, controller_name=None):
- """Gets the exiting controller lib or creates a new controller lib file.
- If name is not None, a controller template code for the given controller
- name is appended to the end of the file.
-
- :param str lib_name: module name, python file name, or full file name
- (with path)
- :param str controller_name: an optional controller name. If given a
- controller template code is appended to the
- end of the file [default: None, meaning no
- controller code is added)
-
- :return: a sequence with three items: full_filename, code, line number
- line number is 0 if no controller is created or n representing
- the first line of code for the given controller name.
- :rtype: tuple<str, str, int>
- """
- # if only given the module name
- controller_lib = self.getControllerLib(lib_name)
-
- if controller_name is None:
- line_nb = 0
- if controller_lib is None:
- f_name, code = self.createControllerLib(lib_name), ''
- else:
- f_name = controller_lib.get_file_name()
- f = file(f_name)
- code = f.read()
- f.close()
- else:
- # if given controller name
- if controller_lib is None:
- f_name, code, line_nb = self.createController(lib_name, controller_name)
- else:
- controller = controller_lib.get_controller(controller_name)
- if controller is None:
- f_name, code, line_nb = self.createController(lib_name, controller_name)
- else:
- _, line_nb = controller.getCode()
- f_name = controller.getFileName()
- f = file(f_name)
- code = f.read()
- f.close()
-
- return [ f_name, code, line_nb ]
-
- def setControllerLib(self, lib_name, code):
- """Creates a new controller library file with the given name and code.
- The new module is imported and becomes imediately available.
-
- :param str lib_name: name of the new library
- :param str code: python code of the new library"""
- f_name = self._fromNameToFileName(lib_name)
- f = open(f_name, 'w')
- f.write(code)
- f.flush()
- f.close()
- _, name = os.path.split(f_name)
- mod, _ = os.path.splitext(name)
- self.reloadControllerLib(mod)
-
- def createControllerLib(self, lib_name, path=None):
- """Creates a new empty controller library (python module)"""
- f_name = self._fromNameToFileName(lib_name, path)
-
- if os.path.exists(f_name):
- raise Exception("Unable to create controller lib: '%s' already exists" % f_name)
-
- f = open(f_name, 'w')
- f.close()
- return f_name
-
- def createController(self, lib_name, controller_name):
- """Creates a new controller"""
- f_name = self._fromNameToFileName(lib_name)
-
- create = not os.path.exists(f_name)
-
- template = ''
- if create:
- template += 'from sardana.pool.controller import *\n\n'
- line_nb = 4
- else:
- template += '\n'
- t = open(f_name, 'rU')
- line_nb = -1
- for line_nb, _ in enumerate(t): pass
- line_nb += 3
- t.close()
-
- f = open(f_name, 'a+')
- try:
- dir_name = os.path.realpath(__file__)
- dir_name = os.path.dirname(dir_name)
- template_fname = 'controller_template.txt'
- template_fname = os.path.join(dir_name, template_fname)
- f_templ = open(template_fname, 'r')
- template += f_templ.read()
- f_templ.close()
- except:
- self.debug("Failed to open template controller file. Using simplified template")
- template += CONTROLLER_TEMPLATE
- if f_templ:
- f_templ.close()
-
- template = template.replace('@controller_name@', controller_name)
- try:
- f.write(template)
- f.flush()
- f.seek(0)
- code = f.read()
- finally:
- f.close()
- return f_name, code, line_nb
-
- def reloadController(self, controller_name, path=None):
- """Reloads the module corresponding to the given controller name
-
- :raises: :exc:`sardana.pool.poolexception.UnknownController`
- in case the controller is unknown or :exc:`ImportError` if
- the reload process is not successfull
-
- :param str controller_name: controller class name
- :param seq<str> path: a list of absolute path to search for libraries
- [default: None, meaning the current ControllerPath
- will be used]"""
- self.reloadControllers([controller_name], path=path)
-
- def reloadControllers(self, controller_names, path=None):
- """Reloads the modules corresponding to the given controller names
-
- :raises: :exc:`sardana.pool.poolexception.UnknownController`
- in case the controller is unknown or :exc:`ImportError` if
- the reload process is not successful
-
- :param seq<str> controller_names: a list of controller class names
- :param seq<str> path: a list of absolute path to search for libraries
- [default: None, meaning the current ControllerPath
- will be used]"""
- module_names = []
- for controller_name in controller_names:
- module_name = self.getControllerMetaClass(controller_name).get_module_name()
- module_names.append(module_name)
- self.reloadControllerLibs(module_names, path=path)
-
- def reloadControllerLibs(self, module_names, path=None, reload=True):
- """Reloads the given library(=module) names
-
- :raises: :exc:`sardana.pool.poolexception.UnknownController`
- in case the controller is unknown or :exc:`ImportError` if
- the reload process is not successful
-
- :param seq<str> module_names: a list of module names
- :param seq<str> path: a list of absolute path to search for libraries
- [default: None, meaning the current ControllerPath
- will be used]"""
- ret = []
- for module_name in module_names:
- try:
- m = self.reloadControllerLib(module_name, path, reload=reload)
- if m: ret.append(m)
- except:
- self.info("Failed to reload controller library %s", module_name)
- self.debug("Failed to reload controller library %s details",
- module_name, exc_info=1)
-
- return ret
-
- def reloadControllerLib(self, module_name, path=None, reload=True):
- """Reloads the given library(=module) names
-
- :raises: :exc:`sardana.pool.poolexception.UnknownController`
- in case the controller is unknown or :exc:`ImportError` if
- the reload process is not successful
-
- :param str module_name: controller library name (=python module name)
- :param seq<str> path: a list of absolute path to search for libraries
- [default: None, meaning the current ControllerPath
- will be used]
-
- :return: the ControllerLib object for the reloaded controller lib
- :rtype: sardana.pool.poolmetacontroller.ControllerLibrary
- """
- path = path or self.getControllerPath()
- # reverse the path order:
- # more priority elements last. This way if there are repeated elements
- # they first ones (lower priority) will be overwritten by the last ones
- if path:
- path = copy.copy(path)
- path.reverse()
-
- # if there was previous Controller Lib info remove it
- if self._modules.has_key(module_name):
- self._modules.pop(module_name)
-
- m, exc_info = None, None
- try:
- m = ModuleManager().reloadModule(module_name, path, reload=reload)
- except:
- exc_info = sys.exc_info()
-
- controller_lib = None
- params = dict(module=m, name=module_name, pool=self.get_pool())
- if m is None or exc_info is not None:
- params['exc_info'] = exc_info
- controller_lib = ControllerLibrary(**params)
- self._modules[module_name] = controller_lib
- else:
- controller_lib = ControllerLibrary(**params)
- lib_contains_controllers = False
- abs_file = controller_lib.file_path
- for _, klass in inspect.getmembers(m, inspect.isclass):
- if issubclass(klass, controller.Controller):
- # if it is a class defined in some other class forget it to
- # avoid replicating the same controller in different
- # controller files
- if inspect.getabsfile(klass) != abs_file:
- continue
- lib_contains_controllers = True
- self.addController(controller_lib, klass)
-
- if lib_contains_controllers:
- self._modules[module_name] = controller_lib
-
- return controller_lib
-
- def addController(self, controller_lib, klass):
- """Adds a new controller class"""
- controller_name = klass.__name__
- exists = controller_lib.has_controller(controller_name)
- if exists:
- action = "Updating"
- else:
- action = "Adding"
-
- self.debug("%s controller %s" % (action, controller_name))
-
- try:
- controller_class = ControllerClass(pool=self.get_pool(),
- lib=controller_lib, klass=klass)
- #self._setControllerTypes(klass, controller_class)
- controller_lib.add_controller(controller_class)
- self._controller_dict[controller_name] = controller_class
-
- except:
- self.warning("Failed to add controller class %s", controller_name,
- exc_info=1)
-
- if exists:
- action = "Updated"
- else:
- action = "Added"
- self.debug("%s controller %s" % (action, controller_name))
-
- def getControllerNames(self):
- return sorted(self._controller_dict.keys())
-
- def getControllerLibNames(self):
- return sorted(self._modules.keys())
-
- def getControllerLibs(self, filter=None):
- ret, expr = [], None
- if filter is not None:
- expr = re.compile(filter, re.IGNORECASE)
- for name, lib in self._modules.iteritems():
- if lib.has_errors() or (expr is not None and expr.match(name) is None):
- continue
- ret.append(lib)
- ret.sort()
- return ret
-
- def getControllers(self, filter=None):
- if filter is None:
- return sorted(self._controller_dict.values())
- expr = re.compile(filter, re.IGNORECASE)
-
- ret = [ kls for n, kls in self._controller_dict.iteritems() if not expr.match(n) is None ]
- ret.sort()
- return ret
-
- def getControllerMetaClass(self, controller_name):
- ret = self._controller_dict.get(controller_name)
- if ret is None:
- raise UnknownController("Unknown controller %s" % controller_name)
- return ret
-
- def getControllerMetaClasses(self, controller_names):
- ret = {}
- for name in controller_names:
- ret[name] = self._controller_dict.get(name)
- return ret
-
- def getControllerLib(self, name):
- if os.path.isabs(name):
- abs_file_name = name
- for lib in self._modules.values():
- if lib.file_path == abs_file_name:
- return lib
- elif name.count(os.path.extsep):
- file_name = name
- for lib in self._modules.values():
- if lib.file_name == file_name:
- return lib
- module_name = name
- return self._modules.get(module_name)
-
- def getControllerClass(self, controller_name):
- return self.getControllerMetaClass(controller_name).klass
-
- def _getPlainControllerInfo(self, controller_names):
- ret = []
- for controller_name in controller_names:
- controller_class = self.getControllerMetaClass(controller_name)
- if controller_class is not None:
- ret += controller_class.getInfo()
- return ret
-
- def decodeControllerParameters(self, in_par_list):
- if len(in_par_list) == 0:
- raise RuntimeError('Controller name not specified')
- controller_name_or_klass = in_par_list[0]
- controller_class = controller_name_or_klass
- if type(controller_class) in types.StringTypes:
- controller_class = self.getControllerClass(controller_class)
- if controller_class is None:
- raise UnknownController("Unknown controller %s" % controller_name_or_klass)
- from sardana.macroserver.msparameter import ParamDecoder
- out_par_list = ParamDecoder(controller_class, in_par_list)
- return controller_class, in_par_list, out_par_list
-
- def strControllerParamValues(self, par_list):
- """Creates a short string representation of the parameter values list.
-
- :param par_list: list of strings representing the parameter values.
- :type par_list: list<str>
- :return: a list containning an abreviated version of the par_list
- argument.
- :rtype: list<str>
- """
- ret = []
- for p in par_list:
- param_str = str(p)
- if len(param_str) > 9:
- param_str = param_str[:9] + "..."
- ret.append(param_str)
- return ret
-
diff --git a/src/sardana/pool/poolcontrollers/DiscretePseudoMotorController.py b/src/sardana/pool/poolcontrollers/DiscretePseudoMotorController.py
deleted file mode 100644
index 96885064..00000000
--- a/src/sardana/pool/poolcontrollers/DiscretePseudoMotorController.py
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of a discrete pseudo motor controller
-for the Sardana Device Pool"""
-
-__all__ = ["DiscretePseudoMotorController"]
-
-__docformat__ = 'restructuredtext'
-
-import json
-
-from sardana import DataAccess
-from sardana.pool.controller import PseudoMotorController
-from sardana.pool.controller import Type, Access, Description
-
-CALIBRATION = 'Calibration'
-LABELS = 'Labels'
-
-
-class DiscretePseudoMotorController(PseudoMotorController):
- """A discrete pseudo motor controller which converts physical motor positions
- to discrete values"""
-
- gender = "DiscretePseudoMotorController"
- model = "PseudoMotor"
- organization = "Sardana team"
- image = ""
-
- pseudo_motor_roles = ("OutputMotor",)
- motor_roles = ("InputMotor",)
-
- axis_attributes = {CALIBRATION:#type hackish until arrays supported
- {Type : str,
- Description : 'Flatten list of a list of triples and [min,cal,max]',
- Access : DataAccess.ReadWrite,
- 'fget' : 'get%s' % CALIBRATION,
- 'fset' : 'set%s' % CALIBRATION},
- LABELS:#type hackish until arrays supported
- {Type : str,
- Description : 'String list with the meaning of each discrete position',
- Access : DataAccess.ReadWrite,
- 'fget' : 'get%s' % LABELS,
- 'fset' : 'set%s' % LABELS}
- }
-
-
- def __init__(self, inst, props, *args, **kwargs):
- PseudoMotorController.__init__(self, inst, props, *args, **kwargs)
- self._calibration = None
- self._positions = None
- self._labels = None
-
-
- def GetAxisAttributes(self, axis):
- axis_attrs = PseudoMotorController.GetAxisAttributes(self, axis)
- axis_attrs = dict(axis_attrs)
- axis_attrs['Position']['type'] = float
- return axis_attrs
-
-
- def CalcPseudo(self, axis, physical_pos, curr_pseudo_pos):
- llabels = len(self._labels)
- positions = self._positions
- calibration = self._calibration
- lcalibration = len(calibration)
-
- value = physical_pos[0]
- #case 0: nothing to translate, only round about integer the attribute value
- if llabels == 0:
- return int(value)
- #case 1: only uses the labels. Available positions in POSITIONS
- elif lcalibration == 0:
- value = int(value)
- try: positions.index(value)
- except: raise Exception("Invalid position.")
- else: return value
- #case 1+fussy: the physical position must be in one of the defined
- #ranges, and the DiscretePseudoMotor position is defined in labels
- elif llabels == lcalibration:
- for fussyPos in calibration:
- if value >= fussyPos[0] and value <= fussyPos[2]:
- return positions[calibration.index(fussyPos)]
- #if the loop ends, current value is not in the fussy areas.
- raise Exception("Invalid position.")
- else:
- raise Exception("Bad configuration on axis attributes.")
-
-
- def CalcPhysical(self, axis, pseudo_pos, curr_physical_pos):
- #If Labels is well defined, the write value must be one this struct
- llabels = len(self._labels)
- positions = self._positions
- calibration = self._calibration
- lcalibration = len(calibration)
- value = pseudo_pos[0]
-
- #case 0: nothing to translate, what is written goes to the attribute
- if llabels == 0:
- return value
- #case 1: only uses the labels. Available positions in POSITIONS
- elif lcalibration == 0:
- self._log.debug("Value = %s", value)
- try: positions.index(value)
- except: raise Exception("Invalid position.")
- return value
- #case 1+fussy: the write to the to the DiscretePseudoMotorController
- #is translated to the central position of the calibration.
- elif llabels == lcalibration:
- self._log.debug("Value = %s", value)
- try: destination = positions.index(value)
- except: raise Exception("Invalid position.")
- self._log.debug("destination = %s", destination)
- calibrated_position = calibration[destination][1]#central element
- self._log.debug("calibrated_position = %s", calibrated_position)
- return calibrated_position
-
-
- def getLabels(self,axis):
- #hackish until we support DevVarDoubleArray in extra attrs
- labels = self._labels
- positions = self._positions
- labels_str = ""
- for i in range(len(labels)):
- labels_str += "%s:%d "%(labels[i],positions[i])
- return labels_str[:-1]#remove the final space
-
-
- def setLabels(self,axis,value):
- #hackish until we support DevVarStringArray in extra attrs
- labels = []
- positions = []
- for pair in value.split():
- l,p = pair.split(':')
- labels.append(l)
- positions.append(int(p))
- if len(labels) == len(positions):
- self._labels = labels
- self._positions = positions
- else:
- raise Exception("Rejecting labels: invalid structure")
-
-
- def getCalibration(self,axis):
- return json.dumps(self._calibration)
-
-
- def setCalibration(self,axis,value):
- try:
- self._calibration = json.loads(value)
- except:
- raise Exception("Rejecting calibration: invalid structure")
diff --git a/src/sardana/pool/poolcontrollers/DummyCounterTimerController.py b/src/sardana/pool/poolcontrollers/DummyCounterTimerController.py
deleted file mode 100644
index 387cb2ee..00000000
--- a/src/sardana/pool/poolcontrollers/DummyCounterTimerController.py
+++ /dev/null
@@ -1,187 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import time
-from sardana import State
-from sardana.pool.controller import CounterTimerController
-
-
-class Channel:
-
- def __init__(self,idx):
- self.idx = idx # 1 based index
- self.value = 0.0
- self.is_counting = False
- self.active = True
-
-
-class DummyCounterTimerController(CounterTimerController):
- "This class is the Tango Sardana CounterTimer controller for tests"
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- StoppedMode = 0
- TimerMode = 1
- MonitorMode = 2
- CounterMode = 3
-
- def __init__(self, inst, props, *args, **kwargs):
- CounterTimerController.__init__(self, inst, props, *args, **kwargs)
- self.channels = self.MaxDevice*[None,]
- self.reset()
-
- def reset(self):
- self.start_time = None
- self.integ_time = None
- self.monitor_count = None
- self.read_channels = {}
- self.counting_channels = {}
-
- def AddDevice(self,ind):
- idx = ind - 1
- self.channels[idx] = Channel(ind)
-
- def DeleteDevice(self,ind):
- idx = ind - 1
- self.channels[idx] = None
-
- def PreStateAll(self):
- pass
-
- def PreStateOne(self, ind):
- pass
-
- def StateAll(self):
- pass
-
- def StateOne(self, ind):
- idx = ind - 1
- sta = State.On
- status = "Stopped"
- if ind in self.counting_channels:
- channel = self.channels[idx]
- now = time.time()
- elapsed_time = now - self.start_time
- self._updateChannelState(ind, elapsed_time)
- if channel.is_counting:
- sta = State.Moving
- status = "Acquiring"
- return sta, status
-
- def _updateChannelState(self, ind, elapsed_time):
- if self.integ_time is not None:
- # counting in time
- if elapsed_time >= self.integ_time:
- self._finish(elapsed_time)
- elif self.monitor_count is not None:
- # monitor counts
- v = int(elapsed_time*100*ind)
- if v >= self.monitor_count:
- self._finish(elapsed_time)
-
- def _updateChannelValue(self, ind, elapsed_time):
- channel = self.channels[ind-1]
- if self.integ_time is not None:
- t = elapsed_time
- if not channel.is_counting:
- t = self.integ_time
- if ind == self._timer:
- channel.value = t
- else:
- channel.value = t * channel.idx
- elif self.monitor_count is not None:
- channel.value = int(elapsed_time*100*ind)
- if ind == self._monitor:
- if not channel.is_counting:
- channel.value = self.monitor_count
-
- def _finish(self, elapsed_time, ind=None):
- if ind is None:
- for ind, channel in self.counting_channels.items():
- channel.is_counting = False
- self._updateChannelValue(ind, elapsed_time)
- else:
- if ind in self.counting_channels:
- channel = self.counting_channels[ind]
- channel.is_counting = False
- self._updateChannelValue(ind, elapsed_time)
- else:
- channel = self.channels[ind-1]
- channel.is_counting = False
- self.counting_channels = {}
-
- def PreReadAll(self):
- self.read_channels = {}
-
- def PreReadOne(self,ind):
- channel = self.channels[ind-1]
- self.read_channels[ind] = channel
-
- def ReadAll(self):
- # if in acquisition then calculate the values to return
- if self.counting_channels:
- now = time.time()
- elapsed_time = now - self.start_time
- for ind, channel in self.read_channels.items():
- self._updateChannelState(ind, elapsed_time)
- if channel.is_counting:
- self._updateChannelValue(ind, elapsed_time)
-
- def ReadOne(self, ind):
- v = self.read_channels[ind].value
- return v
-
- def PreStartAll(self):
- self.counting_channels = {}
-
- def PreStartOne(self, ind, value=None):
- idx = ind - 1
- channel = self.channels[idx]
- channel.value = 0.0
- self.counting_channels[ind] = channel
- return True
-
- def StartOne(self, ind, value=None):
- self.counting_channels[ind].is_counting = True
-
- def StartAll(self):
- self.start_time = time.time()
-
- def LoadOne(self, ind, value):
- if value > 0:
- self.integ_time = value
- self.monitor_count = None
- else:
- self.integ_time = None
- self.monitor_count = -value
-
- def AbortOne(self, ind):
- now = time.time()
- if ind in self.counting_channels:
- elapsed_time = now - self.start_time
- self._finish(elapsed_time, ind=ind)
-
diff --git a/src/sardana/pool/poolcontrollers/DummyIORController.py b/src/sardana/pool/poolcontrollers/DummyIORController.py
deleted file mode 100644
index bd0317ea..00000000
--- a/src/sardana/pool/poolcontrollers/DummyIORController.py
+++ /dev/null
@@ -1,60 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from sardana import State
-from sardana.pool.controller import IORegisterController
-
-
-class DummyIORController(IORegisterController):
- """This controller offers as many IORegisters as the user wants (up to
- 1024)."""
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- predefined_values = "0", "Online", "1" , "Offline", "2", "Standby"
-
- def __init__(self, inst, props, *args, **kwargs):
- IORegisterController.__init__(self, inst, props, *args, **kwargs)
- self.myvalue = 1
-
- def AddDevice(self, axis):
- self._log.debug('AddDevice %d' % axis)
-
- def DeleteDevice(self, axis):
- pass
-
- def StateOne(self, axis):
- return (State.On,"Device in On state")
-
- def ReadOne(self, axis):
- return self.myvalue
-
- def WriteOne(self, axis, value):
- self.myvalue = value
-
- def SendToCtrl(self,in_data):
- return ""
diff --git a/src/sardana/pool/poolcontrollers/DummyMotorController.py b/src/sardana/pool/poolcontrollers/DummyMotorController.py
deleted file mode 100644
index b12fba43..00000000
--- a/src/sardana/pool/poolcontrollers/DummyMotorController.py
+++ /dev/null
@@ -1,798 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import time
-from math import pow, sqrt
-
-from sardana import State, SardanaValue
-from sardana.pool.controller import MotorController
-from sardana.pool.controller import DefaultValue, Description, FGet, FSet, Type
-
-
-class BaseMotion(object):
-
- def __init__(self):
- self.min_vel = -1
- self.max_vel = -1
- self.accel_time = -1
- self.decel_time = -1
- self.accel = -1
- self.decel = -1
-
- self.init_pos = -1
- self.final_pos = -1
- self.curr_pos = -1
-
-
-class Motion(BaseMotion):
-
- def __init__(self):
- BaseMotion.__init__(self)
-
- self.dsplmnt_reach_max_vel = -1
- self.dsplmnt_reach_min_vel = -1
- self.dsplmnt = -1
-
- self.curr_instant = -1
- self.start_instant = -1
-
- self.positive_dsplmnt = True
- self.small_motion = False
-
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = -1
-
- # necessary displacement to reach maximum velocity
- self.curr_dsplmnt_reach_max_vel = -1
-
- # necessary displacement to reach minimum velocity
- self.curr_dsplmnt_reach_min_vel = -1
-
- # maximum velocity possible
- self.curr_max_vel = -1
-
- # time at maximum velocity
- self.curr_at_max_vel_dsplmnt = -1
-
- # time to reach maximum velocity
- self.curr_max_vel_time = -1
-
- # time to reach minimum velocity
- self.curr_min_vel_time = -1
-
- # time at maximum velocity
- self.curr_at_max_vel_time = -1
-
- # instant when maximum velocity should be reached
- self.curr_max_vel_instant = -1
-
- # instant when should start decelerating
- self.curr_min_vel_instant = -1
-
- # time the motion will take
- self.duration = -1
-
- # instant the motion will end
- self.final_instant = -1
-
- # steps per unit
- self.step_per_unit = 1
-
- self.inMotion = False
-
- self.lower_ls = float('-inf')
- self.upper_ls = float('+inf')
-
- self.power = True
- self.enabled = True
-
- self.__recalculate_acc_constants()
-
- def setMinVelocity(self,vi):
- """ Sets the minimum velocity in ms^-1. A.k.a. base rate"""
- vi = float(vi)
- if vi < 0:
- raise "Minimum velocity must be >= 0"
-
- self.min_vel = vi
-
- if self.max_vel < self.min_vel:
- self.max_vel = self.min_vel
-
- # force recalculation of accelerations
- if self.accel_time >= 0:
- self.setAccelerationTime(self.accel_time)
- if self.decel_time >= 0:
- self.setDecelerationTime(self.decel_time)
-
- def getMinVelocity(self):
- return self.min_vel
-
- def setMaxVelocity(self,vf):
- """ Sets the maximum velocity in ms^-1."""
- vf = float(vf)
- if vf <= 0:
- raise "Maximum velocity must be > 0"
-
- self.max_vel = vf
-
- if self.min_vel > self.max_vel:
- self.min_vel = self.max_vel
-
- # force recalculation of accelerations
- if self.accel_time >= 0:
- self.setAccelerationTime(self.accel_time)
- if self.decel_time >= 0:
- self.setDecelerationTime(self.decel_time)
-
- def getMaxVelocity(self):
- return self.max_vel
-
- def setAccelerationTime(self,at):
- """Sets the time to go from minimum velocity to maximum velocity in seconds"""
- at = float(at)
- if at <= 0:
- raise "Acceleration time must be > 0"
-
- self.accel_time = at
- self.accel = (self.max_vel - self.min_vel) / at
-
- self.__recalculate_acc_constants()
-
- def getAccelerationTime(self):
- return self.accel_time
-
- def setDecelerationTime(self,dt):
- """Sets the time to go from maximum velocity to minimum velocity in seconds"""
- dt = float(dt)
- if dt <= 0:
- raise "Deceleration time must be > 0"
-
- self.decel_time = dt
- self.decel = (self.min_vel - self.max_vel) / dt
-
- self.__recalculate_acc_constants()
-
- def getDecelerationTime(self):
- return self.decel_time
-
- def setAcceleration(self,a):
- """Sets the acceleration in ms^-2"""
- a = float(a)
- if a < 0:
- raise "Acceleration must be >= 0"
-
- self.accel = float(a)
-
- if a > 0:
- self.accel_time = (self.max_vel - self.min_vel) / a
- else:
- self.accel_time = float('INF')
-
- self.__recalculate_acc_constants()
-
- def setDeceleration(self,d):
- """Sets the deceleration in ms^-2"""
- d = float(d)
- if d > 0:
- raise "Deceleration must be <= 0"
-
- self.decel = d
-
- if d < 0:
- self.decel_time = (self.min_vel - self.max_vel) / d
- else:
- self.decel_time = float('INF')
-
- self.__recalculate_acc_constants()
-
- def getStepPerUnit(self):
- return self.step_per_unit
-
- def setStepPerUnit(self, spu):
- self.step_per_unit = spu
-
- def __recalculate_acc_constants(self):
- """pre-computations assuming maximum speed can be reached in a motion"""
-
- self.dsplmnt_reach_max_vel = 0.5 * self.accel * pow(self.accel_time,2)
- self.dsplmnt_reach_max_vel += self.min_vel * self.accel_time
-
- self.dsplmnt_reach_min_vel = 0.5 * self.decel * pow(self.decel_time,2)
- self.dsplmnt_reach_min_vel += self.max_vel * self.decel_time
-
- def startMotion(self, initial_user_pos, final_user_pos, start_instant=None):
- """starts a new motion"""
-
- if not self.power:
- raise Exception("Motor is powered off")
-
- initial_pos = initial_user_pos * self.step_per_unit
- final_pos = final_user_pos * self.step_per_unit
-
- if self.inMotion:
- raise Exception("Already in motion")
-
- if initial_pos == final_pos:
- return
-
- self.init_pos = initial_pos
- self.final_pos = final_pos
- self.curr_pos = initial_pos
- self.dsplmnt = abs(final_pos - initial_pos)
-
- start_instant = start_instant or time.time()
- self.curr_instant = start_instant
- self.start_instant = start_instant
-
- self.positive_dsplmnt = final_pos >= initial_pos
-
- displmnt_not_cnst = self.dsplmnt_reach_max_vel + self.dsplmnt_reach_min_vel
- self.small_motion = self.dsplmnt < displmnt_not_cnst
-
- if self.positive_dsplmnt:
- self.curr_accel = self.accel
- self.curr_decel = self.decel
- else:
- self.curr_accel = -self.accel
- self.curr_decel = -self.decel
-
-
- if not self.small_motion:
-
- # necessary displacement to reach maximum velocity
- self.curr_dsplmnt_reach_max_vel = self.dsplmnt_reach_max_vel
- # necessary diplacement to reach minimum velocity
- self.curr_dsplmnt_reach_min_vel = self.dsplmnt_reach_min_vel
-
- if self.positive_dsplmnt:
- self.curr_max_vel = self.max_vel
- self.curr_min_vel = self.min_vel
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = self.init_pos + self.curr_dsplmnt_reach_max_vel
- else:
- self.curr_max_vel = -self.max_vel
- self.curr_min_vel = -self.min_vel
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = self.init_pos - self.curr_dsplmnt_reach_max_vel
-
- # displacement at maximum velocity
- self.curr_at_max_vel_dsplmnt = self.dsplmnt - (self.curr_dsplmnt_reach_max_vel + self.curr_dsplmnt_reach_min_vel)
-
- else: # Small movement
- # position where maximum velocity will be reached
- self.curr_max_vel_pos = self.init_pos * self.curr_accel - self.final_pos * self.curr_decel
- self.curr_max_vel_pos /= self.curr_accel - self.curr_decel
-
- # necessary displacement to reach maximum velocity
- self.curr_dsplmnt_reach_max_vel = abs(self.curr_max_vel_pos - self.init_pos)
-
- # necessary diplacement to reach minimum velocity
- self.curr_dsplmnt_reach_min_vel = abs(self.final_pos - self.curr_max_vel_pos)
-
- # maximum velocity possible
- cnst = 2 * self.curr_accel * self.curr_decel * self.dsplmnt / (self.curr_decel - self.curr_accel)
- max_vel_2 = pow(self.min_vel, 2) + cnst
-
- self.curr_max_vel = sqrt(abs(max_vel_2))
-
- if self.positive_dsplmnt:
- self.curr_min_vel = self.min_vel
- else:
- self.curr_max_vel = -self.curr_max_vel
- self.curr_min_vel = -self.min_vel
-
- # displacement at maximum velocity
- self.curr_at_max_vel_dsplmnt = 0.0
-
- # time to reach maximum velocity
- self.curr_max_vel_time = abs((self.curr_max_vel - self.curr_min_vel) / self.curr_accel)
-
- # time to reach minimum velocity
- self.curr_min_vel_time = abs((self.curr_min_vel - self.curr_max_vel) / self.curr_decel)
-
- # time at maximum velocity
- self.curr_at_max_vel_time = abs(self.curr_at_max_vel_dsplmnt / self.curr_max_vel)
-
- # instant when maximum velocity should be reached
- self.curr_max_vel_instant = self.start_instant + self.curr_max_vel_time
-
- # instant when should start decelerating
- self.curr_min_vel_instant = self.curr_max_vel_instant + self.curr_at_max_vel_time
-
- # time the motion will take
- self.duration = self.curr_max_vel_time + self.curr_at_max_vel_time + self.curr_min_vel_time
-
- # instant the motion will end
- self.final_instant = self.start_instant + self.duration
-
- # uncomment following line if need output concerning the movement that
- # has just started
- # self.info()
-
- # ASSERTIONS
- if self.positive_dsplmnt:
- assert(self.curr_max_vel_pos >= self.init_pos)
- assert(self.curr_max_vel_pos <= self.final_pos)
- else:
- assert(self.curr_max_vel_pos <= self.init_pos)
- assert(self.curr_max_vel_pos >= self.final_pos)
-
- assert(self.curr_dsplmnt_reach_max_vel >= 0.0)
- assert(self.curr_dsplmnt_reach_min_vel >= 0.0)
-
- assert(self.final_instant >= self.start_instant)
- assert(self.curr_max_vel <= self.max_vel)
- assert(self.start_instant <= self.curr_max_vel_instant)
- assert(self.final_instant >= self.curr_min_vel_instant)
-
- assert(self.curr_max_vel_time > 0.0)
- assert(self.curr_min_vel_time > 0.0)
- assert(self.duration > 0.0)
-
- if self.small_motion:
- assert(self.curr_max_vel_instant == self.curr_min_vel_instant)
- assert(self.curr_at_max_vel_time == 0.0)
- else:
- assert(self.curr_max_vel_instant <= self.curr_min_vel_instant)
- assert(self.curr_at_max_vel_time >= 0.0)
-
- self.inMotion = True
-
- def abortMotion(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- if not self.inMotion:
- return self.curr_pos
-
- self.curr_pos = self.getCurrentPosition(curr_instant)
- self.inMotion = False
- return self.curr_pos
-
- def isInMotion(self,curr_instant=None):
- curr_instant = curr_instant or time.time()
- #we call getCurrentPosition because inside it updates the inMotion flag
- self.getCurrentPosition(curr_instant)
- return self.inMotion
-
- def setCurrentPosition(self, curr_pos):
- self.curr_pos = curr_pos
- self.init_pos = curr_pos
-
- def getCurrentPosition(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- self.curr_instant = curr_instant
- pos = None
- if self.inMotion:
- # if motion should be ended...
- if self.curr_instant >= self.final_instant:
- self.inMotion = False
- pos = self.final_pos
- else:
- pos = self.init_pos
- if curr_instant > self.curr_min_vel_instant:
- if self.positive_dsplmnt:
- pos += self.curr_dsplmnt_reach_max_vel
- pos += self.curr_at_max_vel_dsplmnt
- else:
- pos -= self.curr_dsplmnt_reach_max_vel
- pos -= self.curr_at_max_vel_dsplmnt
- dt = curr_instant - self.curr_min_vel_instant
- pos += self.curr_max_vel * dt + 0.5 * self.curr_decel * pow(dt,2)
- elif curr_instant > self.curr_max_vel_instant:
- if self.positive_dsplmnt:
- pos += self.curr_dsplmnt_reach_max_vel
- else:
- pos -= self.curr_dsplmnt_reach_max_vel
- dt = curr_instant - self.curr_max_vel_instant
- pos += self.curr_max_vel * dt
- else:
- dt = curr_instant - self.start_instant
- pos += self.curr_min_vel * dt + 0.5 * self.curr_accel * pow(dt,2)
- else:
- pos = self.curr_pos
- if pos <= self.lower_ls:
- pos = self.lower_ls
- self.inMotion = False
- elif pos >= self.upper_ls:
- pos = self.upper_ls
- self.inMotion = False
- self.curr_pos = pos
- return pos
-
- def setCurrentUserPosition(self, user_pos):
- self.setCurrentPosition(user_pos*self.step_per_unit)
-
- def getCurrentUserPosition(self, curr_instant=None):
- return self.getCurrentPosition(curr_instant=curr_instant) / self.step_per_unit
-
- def hitLowerLimit(self):
- user_pos = self.curr_pos / self.step_per_unit
- return user_pos <= self.lower_ls
-
- def hitUpperLimit(self):
- user_pos = self.curr_pos / self.step_per_unit
- return user_pos >= self.upper_ls
-
- def getLowerLimitSwitch(self):
- return self.lower_ls
-
- def setLowerLimitSwitch(self, user_lower_ls):
- self.lower_ls = user_lower_ls
-
- def getUpperLimitSwitch(self):
- return self.upper_ls
-
- def setUpperLimitSwitch(self, user_upper_ls):
- self.upper_ls = user_upper_ls
-
- def turnOn(self):
- self.power = True
-
- def turnOff(self):
- self.power = False
-
- def isTurnedOn(self):
- return self.power
-
- def hasPower(self):
- return self.power
-
- def setPower(self, power):
- self.power = power
-
- def info(self):
- print "Small movement =",self.small_motion
- print "length =",self.dsplmnt
- print "position where maximum velocity will be reached =",self.curr_max_vel_pos
- print "necessary displacement to reach maximum velocity =",self.curr_dsplmnt_reach_max_vel
- print "necessary displacement to stop from maximum velocity =",self.curr_dsplmnt_reach_min_vel
- print "maximum velocity possible =",self.curr_max_vel
- print "time at top velocity =",self.curr_at_max_vel_time
- print "displacement at top velocity =",self.curr_at_max_vel_dsplmnt
- print "time to reach maximum velocity =",self.curr_max_vel_time
- print "time to reach minimum velocity =",self.curr_min_vel_time
- print "time the motion will take =",self.duration
- print "instant when maximum velocity should be reached =",self.curr_max_vel_instant
- print "instant when should start decelerating =",self.curr_min_vel_instant
- print "instant the motion will end",self.final_instant
- print ""
- print "For long movements (where top vel is possible), necessary displacement to reach maximum velocity =",self.dsplmnt_reach_max_vel
- print "For long movements (where top vel is possible), necessary displacement to stop from maximum velocity =",self.dsplmnt_reach_min_vel
-
-
-class BasicDummyMotorController(MotorController):
- """This class represents a basic, dummy Sardana motor controller."""
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- def __init__(self, inst, props, *args, **kwargs):
- MotorController.__init__(self, inst, props, *args, **kwargs)
- self.m = self.MaxDevice*[None,]
-
- def GetAxisAttributes(self, axis):
- axis_attrs = MotorController.GetAxisAttributes(self, axis)
- new_axis_attrs = {}
- for attr in ('Position', 'Limit_switches'):
- new_axis_attrs[attr] = axis_attrs[attr]
- return new_axis_attrs
-
- def AddDevice(self,axis):
- MotorController.AddDevice(self, axis)
- idx = axis - 1
- if len(self.m) < axis:
- raise Exception("Invalid axis %d" % axis)
- if self.m[idx] is None:
- m = Motion()
- m.setMinVelocity(2)
- m.setMaxVelocity(100)
- m.setAccelerationTime(2)
- m.setDecelerationTime(2)
- m.setCurrentPosition(0)
- self.m[idx] = m
-
- def DeleteDevice(self, axis):
- MotorController.DeleteDevice(self, axis)
- idx = axis - 1
- if len(self.m) < axis or not self.m[idx]:
- self._log.error("Invalid axis %d" % axis)
- #self.m[idx] = None
-
- def StateOne(self, axis):
- #self._log.debug("StateOne(%d)", axis)
- #raise Exception("Cannot StateOne %d" % axis)
- idx = axis - 1
- m = self.m[idx]
- state = State.On
- status = "Motor HW is ON"
- if m.isInMotion():
- state = State.Moving
- status = "Motor HW is MOVING"
- m.getCurrentUserPosition()
- switchstate = 0
- if m.hitLowerLimit():
- switchstate |= MotorController.LowerLimitSwitch
- state = State.Alarm
- status = "Motor HW is in ALARM. Hit hardware lower limit switch"
- if m.hitUpperLimit():
- switchstate |= MotorController.UpperLimitSwitch
- state = State.Alarm
- status = "Motor HW is in ALARM. Hit hardware upper limit switch"
- if state != State.Alarm and not m.hasPower():
- state = State.Off
- status = "Motor is powered off"
- #self._log.info("StateOne(%s) = %s", axis, (state, status, switchstate))
- return state, status, switchstate
-
- def ReadOne(self, axis):
- #self._log.debug("ReadOne(%d)", axis)
- #raise Exception("Cannot ReadOne")
- idx = axis - 1
- m = self.m[idx]
- ts = time.time() #simulate as if we got it from hardware
- return SardanaValue(m.getCurrentUserPosition(), timestamp=ts)
- #return m.getCurrentUserPosition()
-
- def PreStartAll(self):
- #raise Exception("Cannot move on PreStartAll")
- self.motions = {}
-
- def PreStartOne(self, axis, pos):
- #raise Exception("Cannot move on PreStartOne")
- idx = axis - 1
- m = self.m[idx]
- return m.hasPower()
-
- def StartOne(self, axis, pos):
- #raise Exception("Cannot move on StartOne")
- idx = axis - 1
- self.motions[self.m[idx]] = pos
-
- def StartAll(self):
- #raise Exception("Cannot move on StartAll")
- t = time.time()
- for motion, pos in self.motions.items():
- motion.startMotion(motion.getCurrentUserPosition(t), pos, t)
-
- def AbortOne(self, axis):
- self._log.info("AbortOne(%d)", axis)
- idx = axis - 1
- self.m[idx].abortMotion()
-
- def SendToCtrl(self, stream):
- return stream
-
-class FastDummyMotorController(MotorController):
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- def __init__(self, inst, props, *args, **kwargs):
- MotorController.__init__(self, inst, props, *args, **kwargs)
- self.m = self.MaxDevice*[None,]
-
- def GetAxisAttributes(self, axis):
- axis_attrs = MotorController.GetAxisAttributes(self, axis)
- new_axis_attrs = {}
- for attr in ('Position', 'Limit_switches'):
- new_axis_attrs[attr] = axis_attrs[attr]
- return new_axis_attrs
-
- def AddDevice(self,axis):
- MotorController.AddDevice(self, axis)
- idx = axis - 1
- if len(self.m) < axis:
- raise Exception("Invalid axis %d" % axis)
- if self.m[idx] is None:
- self.m[idx] = BaseMotion()
-
- def DeleteDevice(self, axis):
- MotorController.DeleteDevice(self, axis)
- idx = axis - 1
- if len(self.m) < axis or not self.m[idx]:
- self._log.error("Invalid axis %d" % axis)
- #self.m[idx] = None
-
- def StateOne(self, axis):
- #self._log.debug("StateOne(%d)", axis)
- state = State.On
- status = "Motor HW is ON"
- switchstate = 0
- return state, status, switchstate
-
- def ReadOne(self, axis):
- self._log.debug("ReadOne(%d)", axis)
- idx = axis - 1
- m = self.m[idx]
- return m.curr_pos
-
- def PreStartAll(self):
- self.motions = {}
-
- def PreStartOne(self, axis, pos):
- return True
-
- def StartOne(self, axis, pos):
- idx = axis - 1
- self.motions[self.m[idx]] = pos
-
- def StartAll(self):
- for motion, pos in self.motions.items():
- motion.curr_pos = pos
-
- def AbortOne(self, axis):
- pass
-
-
-class DiscreteDummyMotorController(BasicDummyMotorController):
- """This class represents a discrete, dummy Sardana motor controller."""
-
- def __init__(self, inst, props, *args, **kwargs):
- BasicDummyMotorController.__init__(self, inst, props, *args, **kwargs)
-
- def GetAxisAttributes(self, axis):
- axis_attrs = MotorController.GetAxisAttributes(self, axis)
- new_axis_attrs = dict(Position=axis_attrs['Position'])
- new_axis_attrs['Position'][Type] = int
- return new_axis_attrs
-
- def AddDevice(self, axis):
- BasicDummyMotorController.AddDevice(self, axis)
- idx = axis - 1
- m = self.m[idx]
- m.setMinVelocity(0)
- m.setMaxVelocity(1)
- m.setAccelerationTime(0.01)
- m.setDecelerationTime(0.01)
- m.setCurrentPosition(0)
-
- def ReadOne(self, axis):
- pos = BasicDummyMotorController.ReadOne(self, axis)
- return int(pos)
-
-
-class DummyMotorController(BasicDummyMotorController):
- """This class represents a dummy Sardana motor controller."""
-
- ctrl_features = []
-
- model = "Best"
-
- ctrl_attributes = {
- 'LowerLimitSwitch' : { Type : float,
- Description : 'lower limit switch position',
- FGet : 'getLowerLimitSwitch',
- FSet : 'setLowerLimitSwitch',
- DefaultValue: -9999.9999, },
- 'UpperLimitSwitch' : { Type : float,
- Description : 'upper limit switch position',
- DefaultValue: 8888.8888 }
- }
-
- axis_attributes = {
- 'LowerLimitSwitch' : { Type : float,
- Description : 'lower limit switch position',
- FGet : 'getLLS',
- FSet : 'setLLS',
- DefaultValue: -9999.9999 },
- 'UpperLimitSwitch' : { Type : float,
- Description : 'upper limit switch position',
- FGet : 'getULS',
- FSet : 'setULS',
- DefaultValue: 8888.8888 },
- 'Power' : { Type : bool,
- Description : 'motor power',
- FGet : 'getPower',
- FSet : 'setPower',
- DefaultValue: True },
- }
-
- ctrl_properties = {
- 'Prop1' : { Type : str,
- Description : 'demo property 1',
- DefaultValue : 'test property 1'},
- 'Prop2' : { Type : int,
- Description : 'demo property 1',
- DefaultValue : 531},
- }
-
- def __init__(self, inst, props, *args, **kwargs):
- BasicDummyMotorController.__init__(self, inst, props, *args, **kwargs)
- self._lowerLS = float("-inf")
- self._upperLS = float("+inf")
-
- def GetAxisAttributes(self, axis):
- return MotorController.GetAxisAttributes(self, axis)
-
- def SetAxisPar(self, axis, name, value):
- idx = axis - 1
- m = self.m[idx]
- name = name.lower()
- if name == "acceleration":
- m.setAccelerationTime(value)
- elif name == "deceleration":
- m.setDecelerationTime(value)
- elif name == "base_rate":
- m.setMinVelocity(value)
- elif name == "velocity":
- m.setMaxVelocity(value)
- elif name == "step_per_unit":
- m.setStepPerUnit(value)
-
- def GetAxisPar(self, axis, name):
- idx = axis - 1
- m = self.m[idx]
- name = name.lower()
- if name == "acceleration":
- v = m.getAccelerationTime()
- elif name == "deceleration":
- v = m.getDecelerationTime()
- elif name == "base_rate":
- v = m.getMinVelocity()
- elif name == "velocity":
- v = m.getMaxVelocity()
- elif name == "step_per_unit":
- v = m.getStepPerUnit()
- return v
-
- def DefinePosition(self, axis, position):
- idx = axis - 1
- m = self.m[idx]
- m.offset = position - m.getCurrentUserPosition()
- m.setCurrentUserPosition(position)
-
- def getLowerLimitSwitch(self):
- return self._lowerLS
-
- def setLowerLimitSwitch(self, value):
- self._lowerLS = value
-
- def getUpperLimitSwitch(self):
- return self._upperLS
-
- def setUpperLimitSwitch(self, value):
- self._upperLS = value
-
- def getLLS(self, axis):
- return self.m[axis - 1].getLowerLimitSwitch()
-
- def setLLS(self, axis, ls):
- self.m[axis - 1].setLowerLimitSwitch(ls)
-
- def getULS(self, axis):
- return self.m[axis - 1].getUpperLimitSwitch()
-
- def setULS(self, axis, ls):
- self.m[axis - 1].setUpperLimitSwitch(ls)
-
- def getPower(self, axis):
- return self.m[axis - 1].hasPower()
-
- def setPower(self, axis, power):
- self.m[axis - 1].setPower(power)
diff --git a/src/sardana/pool/poolcontrollers/DummyOneDController.py b/src/sardana/pool/poolcontrollers/DummyOneDController.py
deleted file mode 100644
index 06806baf..00000000
--- a/src/sardana/pool/poolcontrollers/DummyOneDController.py
+++ /dev/null
@@ -1,243 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/axisex.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import time
-import numpy
-
-from sardana import State
-from sardana.pool.controller import OneDController, MaxDimSize
-from sardana.pool.controller import DefaultValue, Description, FGet, FSet, Type
-
-def gauss(x, mean, ymax, fwhm, yoffset=0):
- return yoffset + ymax*numpy.power(2,-4*((x-mean)/fwhm)**2)
-
-class Channel:
-
- def __init__(self,idx):
- self.idx = idx # 1 based axisex
- self.value = []
- self.is_counting = False
- self.active = True
- self.amplitude = BaseValue('1.0')
-
-
-class BaseValue(object):
-
- def __init__(self, value):
- self.raw_value = value
- self.init()
-
- def init(self):
- self.value = float(self.raw_value)
-
- def get(self):
- return self.value
-
- def get_value_name(self):
- return self.raw_value
-
-
-class TangoValue(BaseValue):
-
- def init(self):
- import PyTango
- self.attr_proxy = PyTango.AttributeProxy(self.raw_value)
-
- def get(self):
- return self.attr_proxy.read().value
-
-
-class DummyOneDController(OneDController):
- "This class is the Tango Sardana OneDController controller for tests"
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- BufferSize = 1024,
-
- axis_attributes = {
- 'Amplitude' : {
- Type : str,
- FGet : 'getAmplitude',
- FSet : 'setAmplitude',
- Description : 'Amplitude. Maybe a number or a tango attribute(must start with tango://)',
- DefaultValue : '1.0' },
- }
-
- def __init__(self, inst, props, *args, **kwargs):
- OneDController.__init__(self, inst, props, *args, **kwargs)
- self.channels = self.MaxDevice*[None,]
- self.reset()
-
- def GetAxisAttributes(self, axis):
- # the default max shape for 'value' is (16*1024,). We don't need so much
- # so we set it to BufferSize
- attrs = super(DummyOneDController, self).GetAxisAttributes(axis)
- attrs['Value'][MaxDimSize] = self.BufferSize
- return attrs
-
- def reset(self):
- self.start_time = None
- self.integ_time = None
- self.monitor_count = None
- self.read_channels = {}
- self.counting_channels = {}
-
- def AddDevice(self,axis):
- idx = axis - 1
- self.channels[idx] = channel = Channel(axis)
- channel.value = numpy.zeros(self.BufferSize, dtype=numpy.float64)
-
- def DeleteDevice(self,axis):
- idx = axis - 1
- self.channels[idx] = None
-
- def PreStateAll(self):
- pass
-
- def PreStateOne(self, axis):
- pass
-
- def StateAll(self):
- pass
-
- def StateOne(self, axis):
- idx = axis - 1
- sta = State.On
- status = "Stopped"
- if axis in self.counting_channels:
- channel = self.channels[idx]
- now = time.time()
- elapsed_time = now - self.start_time
- self._updateChannelState(axis, elapsed_time)
- if channel.is_counting:
- sta = State.Moving
- status = "Acquiring"
- return sta, status
-
- def _updateChannelState(self, axis, elapsed_time):
- channel = self.channels[axis-1]
- if self.integ_time is not None:
- # counting in time
- if elapsed_time >= self.integ_time:
- self._finish(elapsed_time)
- elif self.monitor_count is not None:
- # monitor counts
- v = int(elapsed_time*100*axis)
- if v >= self.monitor_count:
- self._finish(elapsed_time)
-
- def _updateChannelValue(self, axis, elapsed_time):
- channel = self.channels[axis-1]
- t = elapsed_time
- if self.integ_time is not None and not channel.is_counting:
- t = self.integ_time
- x = numpy.linspace(-10, 10, self.BufferSize[0])
- amplitude = axis * t * channel.amplitude.get()
- channel.value = gauss(x, 0, amplitude, 4)
-
- def _finish(self, elapsed_time, axis=None):
- if axis is None:
- for axis, channel in self.counting_channels.items():
- channel.is_counting = False
- self._updateChannelValue(axis, elapsed_time)
- else:
- if axis in self.counting_channels:
- channel = self.counting_channels[axis]
- channel.is_counting = False
- self._updateChannelValue(axis, elapsed_time)
- else:
- channel = self.channels[axis-1]
- channel.is_counting = False
- self.counting_channels = {}
-
- def PreReadAll(self):
- self.read_channels = {}
-
- def PreReadOne(self,axis):
- channel = self.channels[axis-1]
- self.read_channels[axis] = channel
-
- def ReadAll(self):
- # if in acquisition then calculate the values to return
- if self.counting_channels:
- now = time.time()
- elapsed_time = now - self.start_time
- for axis, channel in self.read_channels.items():
- self._updateChannelState(axis, elapsed_time)
- if channel.is_counting:
- self._updateChannelValue(axis, elapsed_time)
-
- def ReadOne(self, axis):
- self._log.debug("ReadOne(%s)", axis)
- v = self.read_channels[axis].value
- return v
-
- def PreStartAll(self):
- self.counting_channels = {}
-
- def PreStartOne(self, axis, value):
- idx = axis - 1
- channel = self.channels[idx]
- channel.value = 0.0
- self.counting_channels[axis] = channel
- return True
-
- def StartOne(self, axis, value):
- self.counting_channels[axis].is_counting = True
-
- def StartAll(self):
- self.start_time = time.time()
-
- def LoadOne(self, axis, value):
- idx = axis - 1
- if value > 0:
- self.integ_time = value
- self.monitor_count = None
- else:
- self.integ_time = None
- self.monitor_count = -value
-
- def AbortOne(self, axis):
- now = time.time()
- if axis in self.counting_channels:
- elapsed_time = now - self.start_time
- self._finish(elapsed_time, axis=axis)
-
- def getAmplitude(self, axis):
- idx = axis - 1
- channel = self.channels[idx]
- return channel.amplitude.get_value_name()
-
- def setAmplitude(self, axis, value):
- idx = axis - 1
- channel = self.channels[idx]
-
- klass = BaseValue
- if value.startswith("tango://"):
- klass = TangoValue
- channel.amplitude = klass(value)
-
diff --git a/src/sardana/pool/poolcontrollers/DummyTwoDController.py b/src/sardana/pool/poolcontrollers/DummyTwoDController.py
deleted file mode 100644
index 492e45c3..00000000
--- a/src/sardana/pool/poolcontrollers/DummyTwoDController.py
+++ /dev/null
@@ -1,243 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.tango-controls.org/static/sardana/latest/doc/html/axisex.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import time
-import numpy
-
-from sardana import State
-from sardana.pool.controller import TwoDController, MaxDimSize
-
-def gauss(x, mean, ymax, fwhm, yoffset=0):
- return yoffset + ymax*numpy.power(2,-4*((x-mean)/fwhm)**2)
-
-class Channel:
-
- def __init__(self,idx):
- self.idx = idx # 1 based axisex
- self.value = []
- self.is_counting = False
- self.active = True
- self.amplitude = BaseValue('1.0')
-
-
-class BaseValue(object):
-
- def __init__(self, value):
- self.raw_value = value
- self.init()
-
- def init(self):
- self.value = float(self.raw_value)
-
- def get(self):
- return self.value
-
- def get_value_name(self):
- return self.raw_value
-
-
-class TangoValue(BaseValue):
-
- def init(self):
- import PyTango
- self.attr_proxy = PyTango.AttributeProxy(self.raw_value)
-
- def get(self):
- return self.attr_proxy.read().value
-
-
-class DummyTwoDController(TwoDController):
- "This class is the Tango Sardana OneDController controller for tests"
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- BufferSize = 1024, 1024
-
- axis_attributes = {
- 'Amplitude' : {
- 'type' : str,
- 'fget' : 'getAmplitude',
- 'fset' : 'setAmplitude',
- 'description' : 'Amplitude. Maybe a number or a tango attribute(must start with tango://)',
- 'defaultvalue': '1.0' },
- }
-
- def __init__(self, inst, props, *args, **kwargs):
- TwoDController.__init__(self, inst, props, *args, **kwargs)
- self.channels = self.MaxDevice*[None,]
- self.reset()
-
- def GetAxisAttributes(self, axis):
- # the default max shape for 'value' is (16*1024,). We don't need so much
- # so we set it to BufferSize
- attrs = super(DummyTwoDController, self).GetAxisAttributes(axis)
- attrs['Value'][MaxDimSize] = self.BufferSize
- return attrs
-
- def reset(self):
- self.start_time = None
- self.integ_time = None
- self.monitor_count = None
- self.read_channels = {}
- self.counting_channels = {}
-
- def AddDevice(self,axis):
- idx = axis - 1
- self.channels[idx] = channel = Channel(axis)
- channel.value = numpy.zeros(self.BufferSize, dtype=numpy.float64)
-
- def DeleteDevice(self,axis):
- idx = axis - 1
- self.channels[idx] = None
-
- def PreStateAll(self):
- pass
-
- def PreStateOne(self, axis):
- pass
-
- def StateAll(self):
- pass
-
- def StateOne(self, axis):
- idx = axis - 1
- sta = State.On
- status = "Stopped"
- if axis in self.counting_channels:
- channel = self.channels[idx]
- now = time.time()
- elapsed_time = now - self.start_time
- self._updateChannelState(axis, elapsed_time)
- if channel.is_counting:
- sta = State.Moving
- status = "Acquiring"
- return sta, status
-
- def _updateChannelState(self, axis, elapsed_time):
- channel = self.channels[axis-1]
- if self.integ_time is not None:
- # counting in time
- if elapsed_time >= self.integ_time:
- self._finish(elapsed_time)
- elif self.monitor_count is not None:
- # monitor counts
- v = int(elapsed_time*100*axis)
- if v >= self.monitor_count:
- self._finish(elapsed_time)
-
- def _updateChannelValue(self, axis, elapsed_time):
- channel = self.channels[axis-1]
- t = elapsed_time
- if self.integ_time is not None and not channel.is_counting:
- t = self.integ_time
- x = numpy.linspace(-10, 10, self.BufferSize[0])
- y = numpy.linspace(-10, 10, self.BufferSize[1])
- x, y = numpy.meshgrid(x, y)
- amplitude = axis * t * channel.amplitude.get()
- channel.value = gauss(x, 0, amplitude, 4) * gauss(y, 0, amplitude, 4)
-
- def _finish(self, elapsed_time, axis=None):
- if axis is None:
- for axis, channel in self.counting_channels.items():
- channel.is_counting = False
- self._updateChannelValue(axis, elapsed_time)
- else:
- if axis in self.counting_channels:
- channel = self.counting_channels[axis]
- channel.is_counting = False
- self._updateChannelValue(axis, elapsed_time)
- else:
- channel = self.channels[axis-1]
- channel.is_counting = False
- self.counting_channels = {}
-
- def PreReadAll(self):
- self.read_channels = {}
-
- def PreReadOne(self,axis):
- channel = self.channels[axis-1]
- self.read_channels[axis] = channel
-
- def ReadAll(self):
- # if in acquisition then calculate the values to return
- if self.counting_channels:
- now = time.time()
- elapsed_time = now - self.start_time
- for axis, channel in self.read_channels.items():
- self._updateChannelState(axis, elapsed_time)
- if channel.is_counting:
- self._updateChannelValue(axis, elapsed_time)
-
- def ReadOne(self, axis):
- self._log.debug("ReadOne(%s)", axis)
- return self.read_channels[axis].value
-
- def PreStartAll(self):
- self.counting_channels = {}
-
- def PreStartOne(self, axis, value):
- idx = axis - 1
- channel = self.channels[idx]
- channel.value = 0.0
- self.counting_channels[axis] = channel
- return True
-
- def StartOne(self, axis, value):
- self.counting_channels[axis].is_counting = True
-
- def StartAll(self):
- self.start_time = time.time()
-
- def LoadOne(self, axis, value):
- idx = axis - 1
- if value > 0:
- self.integ_time = value
- self.monitor_count = None
- else:
- self.integ_time = None
- self.monitor_count = -value
-
- def AbortOne(self, axis):
- now = time.time()
- if axis in self.counting_channels:
- elapsed_time = now - self.start_time
- self._finish(elapsed_time, axis=axis)
-
- def getAmplitude(self, axis):
- idx = axis - 1
- channel = self.channels[idx]
- return channel.amplitude.get_value_name()
-
- def setAmplitude(self, axis, value):
- idx = axis - 1
- channel = self.channels[idx]
-
- klass = BaseValue
- if value.startswith("tango://"):
- klass = TangoValue
- channel.amplitude = klass(value)
-
diff --git a/src/sardana/pool/poolcontrollers/DummyZeroDController.py b/src/sardana/pool/poolcontrollers/DummyZeroDController.py
deleted file mode 100644
index f686a41a..00000000
--- a/src/sardana/pool/poolcontrollers/DummyZeroDController.py
+++ /dev/null
@@ -1,77 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import random
-
-from sardana import State
-from sardana.pool.controller import ZeroDController
-
-class Channel:
-
- def __init__(self,idx):
- self.idx = idx # 1 based index
- self.value = 0.0
- self.active = False
-
-
-class DummyZeroDController(ZeroDController):
- """This class represents a dummy Sardana 0D controller."""
-
- gender = "Simulation"
- model = "Basic"
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- def __init__(self, inst, props, *args, **kwargs):
- ZeroDController.__init__(self, inst, props, *args, **kwargs)
-
- self.channels = [ Channel(i+1) for i in xrange(self.MaxDevice) ]
- self.read_channels = {}
-
- def AddDevice(self,ind):
- self.channels[ind].active = True
-
- def DeleteDevice(self,ind):
- self.channels[ind].active = False
-
- def StateOne(self,ind):
- return State.On, "OK"
-
- def _setChannelValue(self, channel):
- channel.value = 100 * channel.idx + 10*(random.random()-0.5)
-
- def PreReadAll(self):
- self.read_channels = {}
-
- def PreReadOne(self,ind):
- channel = self.channels[ind-1]
- self.read_channels[ind] = channel
-
- def ReadAll(self):
- for channel in self.read_channels.values():
- self._setChannelValue(channel)
-
- def ReadOne(self,ind):
- v = self.read_channels[ind].value
- return v
diff --git a/src/sardana/pool/poolcontrollers/IoverI0.py b/src/sardana/pool/poolcontrollers/IoverI0.py
deleted file mode 100644
index 4c5049c4..00000000
--- a/src/sardana/pool/poolcontrollers/IoverI0.py
+++ /dev/null
@@ -1,50 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of a I/I0 pseudo counter controller
-for the Sardana Device Pool"""
-
-__all__ = ["IoverI0"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.pool.controller import PseudoCounterController
-
-
-class IoverI0(PseudoCounterController):
- """ A simple pseudo counter which receives two counter values (I and I0)
- and returns I/I0"""
-
- gender = "IoverI0"
- model = "Default I/I0"
- organization = "Sardana team"
-
- counter_roles = "I", "I0"
-
- def Calc(self, axis, counter_values):
- i, i0 = counter_values
- try:
- i = float(i/i0)
- except ZeroDivisionError:
- pass
- return i
diff --git a/src/sardana/pool/poolcontrollers/Slit.py b/src/sardana/pool/poolcontrollers/Slit.py
deleted file mode 100644
index e34526d0..00000000
--- a/src/sardana/pool/poolcontrollers/Slit.py
+++ /dev/null
@@ -1,96 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition of a slit pseudo motor controller
-for the Sardana Device Pool"""
-
-__all__ = ["Slit"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana import DataAccess
-from sardana.pool.controller import PseudoMotorController
-from sardana.pool.controller import DefaultValue, Description, Access, Type
-
-
-class Slit(PseudoMotorController):
- """A Slit pseudo motor controller for handling gap and offset pseudo
- motors. The system uses to real motors sl2t (top slit) and sl2b (bottom
- slit)"""
-
- gender = "Slit"
- model = "Default Slit"
- organization = "Sardana team"
-
- pseudo_motor_roles = "Gap", "Offset"
- motor_roles = "sl2t", "sl2b"
-
- ctrl_properties = { 'sign' : { Type : float,
- Description : 'Gap = sign * calculated gap\nOffset = sign * calculated offet',
- DefaultValue : 1 }, }
-
- axis_attributes = { 'example' : { Type : int,
- Access : DataAccess.ReadWrite,
- Description : 'test purposes' }, }
-
- def __init__(self, inst, props, *args, **kwargs):
- PseudoMotorController.__init__(self, inst, props, *args, **kwargs)
- self._log.debug("Created SLIT %s", inst)
- self._example = {}
-
- def CalcPhysical(self, index, pseudo_pos, curr_physical_pos):
- half_gap = pseudo_pos[0]/2.0
- if index == 1:
- ret = self.sign * (pseudo_pos[1] + half_gap)
- else:
- ret = self.sign * (half_gap - pseudo_pos[1])
- self._log.debug("Slit.CalcPhysical(%d, %s) -> %f", index, pseudo_pos, ret)
- return ret
-
- def CalcPseudo(self, index, physical_pos, curr_pseudo_pos):
- gap = physical_pos[1] + physical_pos[0]
- if index == 1:
- ret = self.sign * gap
- else:
- ret = self.sign * (physical_pos[0] - gap/2.0)
- return ret
-
- def CalcAllPseudo(self, physical_pos, curr_pseudo_pos):
- """Calculates the positions of all pseudo motors that belong to the
- pseudo motor system from the positions of the physical motors."""
- gap = physical_pos[1] + physical_pos[0]
- return (self.sign * gap,
- self.sign * (physical_pos[0] - gap/2.0))
-
- #def CalcAllPhysical(self, pseudo_pos, curr_physical_pos):
- # """Calculates the positions of all motors that belong to the pseudo
- # motor system from the positions of the pseudo motors."""
- # half_gap = pseudo_pos[0]/2.0
- # return (self.sign * (pseudo_pos[1] + half_gap),
- # self.sign * (half_gap - pseudo_pos[1]))
-
- def SetAxisExtraPar(self, axis, parameter, value):
- self._example[axis] = value
-
- def GetAxisExtraPar(self, axis, parameter):
- return self._example.get(axis, -1)
diff --git a/src/sardana/pool/poolcontrollers/TangoController.py b/src/sardana/pool/poolcontrollers/TangoController.py
deleted file mode 100644
index dced73c9..00000000
--- a/src/sardana/pool/poolcontrollers/TangoController.py
+++ /dev/null
@@ -1,200 +0,0 @@
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import math
-
-import PyTango
-
-from taurus.core.util.containers import CaselessDict
-
-from sardana import State, DataAccess
-from sardana.pool.controller import MotorController, CounterTimerController, \
- ZeroDController, \
- Type, Access, Description, DefaultValue
-
-TangoAttribute = "TangoAttribute"
-Formula = "Formula"
-
-class ReadTangoAttributes(object):
- """ Generic class that has as many devices as the user wants.
- Each device has a tango attribute and a formula and the 'hardware' tango calls
- are optimized in the sense that only one call per tango device is issued.
- """
- axis_attributes = {
- TangoAttribute : { Type : str, Access : DataAccess.ReadWrite,
- Description : 'Attribute to read (e.g. a/b/c/attr)' },
- Formula : { Type : str, Access : DataAccess.ReadWrite,
- DefaultValue : "VALUE",
- Description : 'The Formula to get the desired value.\n'
- 'e.g. "math.sqrt(VALUE)"' },
- }
-
- def __init__(self):
- #: dict<int(axis), str(reason for being in pending)>
- self._pending = {}
-
- #: dict<str(dev name), tuple<DeviceProxy, list<str(attributes name)>>>
- self._devices = CaselessDict()
-
- #: dict<int(axis), seq<str<tango full attribute name>, str<attr name>, DeviceProxy>>
- self._axis_tango_attributes = {}
-
- #: dict<int(axis), str<formula>>
- self._axis_formulas = {}
-
- def add_device(self, axis):
- self._pending[axis] = "No tango attribute associated to this device yet"
- self._axis_formulas[axis] = self.axis_attribute[Formula][DefaultValue]
-
- def delete_device(self, axis):
- if axis in self._pending:
- del self._pending[axis]
- else:
- del self._axis_tango_attributes[axis]
- del self._axis_formulas[axis]
-
- def state_one(self, axis):
- pending_info = self._pending.get(axis)
- if pending_info is not None:
- return State.Fault, pending_info
- return State.On, 'Always ON, just reading tango attribute'
-
- def pre_read_all(self):
- self._devices_read = {}
-
- def pre_read_one(self, axis):
- attr_name, dev = self._axis_tango_attributes[axis][1:]
- dev_attrs = self._devices_read.get(dev)
- if dev_attrs is None:
- self._
- self._devices_read[dev] = dev_attrs = []
- dev_attrs.append(attr_name)
-
- def read_all(self):
- pass
-
- def read_one(self, axis):
- pass
-
- def get_extra_attribute_par(self, axis, name):
- if name == TangoAttribute:
- return self._axis_tango_attributes[axis][0]
- elif name == Formula:
- return self._axis_formulas[axis]
-
- def set_extra_attribute_par(self, axis, name, value):
- if name == TangoAttribute:
- value = value.lower()
- self._axis_tango_attributes[axis] = data = value, None, None
- try:
- dev_name, attr_name = value.rsplit("/", 1)
- data[1] = attr_name
- except:
- self._pending[axis] = "invalid device name " + value
- raise Exception(self._pending[axis])
- dev_info = self._devices.get(dev_name)
- if dev_info is None:
- try:
- proxy = PyTango.DeviceProxy(dev_name)
- except PyTango.DevFailed, df:
- if len(df):
- self._pending[axis] = df[0].reason + ": " + df[0].desc
- else:
- self._pending[axis] = "Unknwon PyTango Error: " + str(df)
- raise
- self._devices[dev_name] = dev_info = proxy, []
- data[2] = dev_info[0]
- dev_info[1].append(attr_name)
-
- elif name == Formula:
- self._axis_formulas[axis] = value
-
-class TangoCounterTimerController(ReadTangoAttributes, CounterTimerController):
- """This controller offers as many channels as the user wants.
- Each channel has two _MUST_HAVE_ extra attributes:
- +) TangoAttribute - Tango attribute to retrieve the value of the counter
- +) Formula - Formula to evaluate using 'VALUE' as the tango attribute value
- As examples you could have:
- ch1.TangoExtraAttribute = 'my/tango/device/attribute1'
- ch1.Formula = '-1 * VALUE'
- ch2.TangoExtraAttribute = 'my/tango/device/attribute2'
- ch2.Formula = 'math.sqrt(VALUE)'
- ch3.TangoExtraAttribute = 'my_other/tango/device/attribute1'
- ch3.Formula = 'math.cos(VALUE)'
- """
-
- gender = ""
- model = ""
- organization = "Sardana team"
-
- MaxDevice = 1024
-
- def __init__(self, inst, props, *args, **kwargs):
- ReadTangoAttributes.__init__(self)
- CounterTimerController.__init__(self, inst, props, *args, **kwargs)
-
- def AddDevice(self, axis):
- self.add_device(axis)
-
- def DeleteDevice(self, axis):
- self.delete_device(axis)
-
- def StateOne(self, axis):
- return self.state_one(axis)
-
- def PreReadAll(self):
- self.pre_read_all()
-
- def PreReadOne(self, axis):
- self.pre_read_one(axis)
-
- def ReadAll(self):
- self.read_all()
-
- def ReadOne(self, axis):
- return self.read_one(axis)
-
- def GetExtraAttributePar(self, axis, name):
- return self.get_extra_attribute_par(axis, name)
-
- def SetExtraAttributePar(self, axis, name, value):
- self.set_extra_attribute_par(axis, name, value)
-
- def SendToCtrl(self, in_data):
- return ""
-
- def AbortOne(self, axis):
- pass
-
- def PreStartAllCT(self):
- pass
-
- def StartOneCT(self, axis):
- pass
-
- def StartAllCT(self):
- pass
-
- def LoadOne(self, axis, value):
- pass
-
diff --git a/src/sardana/pool/poolcontrollers/__init__.py b/src/sardana/pool/poolcontrollers/__init__.py
deleted file mode 100644
index 59eb13f4..00000000
--- a/src/sardana/pool/poolcontrollers/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """ \ No newline at end of file
diff --git a/src/sardana/pool/poolcountertimer.py b/src/sardana/pool/poolcountertimer.py
deleted file mode 100644
index 417f94f2..00000000
--- a/src/sardana/pool/poolcountertimer.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for CounterTimer"""
-
-__all__ = ["PoolCounterTimer"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana import ElementType
-
-from sardana.pool.poolbasechannel import PoolBaseChannel
-
-
-class PoolCounterTimer(PoolBaseChannel):
-
- def __init__(self, **kwargs):
- kwargs['elem_type'] = ElementType.CTExpChannel
- PoolBaseChannel.__init__(self, **kwargs)
-
- # -------------------------------------------------------------------------
- # value
- # -------------------------------------------------------------------------
-
- def set_write_value(self, w_value, timestamp=None, propagate=1):
- """Sets a new write value for the value.
-
- :param w_value:
- the new write value for value
- :type w_value:
- :class:`~numbers.Number`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- self._value.set_write_value(w_value, timestamp=timestamp,
- propagate=propagate)
diff --git a/src/sardana/pool/pooldefs.py b/src/sardana/pool/pooldefs.py
deleted file mode 100644
index 9777a711..00000000
--- a/src/sardana/pool/pooldefs.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This file contains the basic pool definitions."""
-
-__all__ = ["ControllerAPI", "AcqTriggerType", "AcqMode"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.taurus.core.tango.sardana import AcqTriggerType, AcqMode
-
-#: A constant defining the controller API version currently supported
-ControllerAPI = 1.1
diff --git a/src/sardana/pool/poolelement.py b/src/sardana/pool/poolelement.py
deleted file mode 100644
index 6f3e5775..00000000
--- a/src/sardana/pool/poolelement.py
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolElement", "PoolElementFrontend"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-
-from sardana.sardanaevent import EventType
-from sardana.pool.poolbaseelement import PoolBaseElement
-
-
-class PoolElement(PoolBaseElement):
- """A Pool element is an Pool object which is controlled by a controller.
- Therefore it contains a _ctrl_id and a _axis (the id of the element in
- the controller)."""
-
- def __init__(self, **kwargs):
- ctrl = kwargs.pop('ctrl')
- self._ctrl = weakref.ref(ctrl)
- self._axis = kwargs.pop('axis')
- self._ctrl_id = ctrl.get_id()
- try:
- instrument = kwargs.pop('instrument')
- self.set_instrument(instrument)
- except KeyError:
- self._instrument = None
- super(PoolElement, self).__init__(**kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolBaseElement.serialize(self, *args, **kwargs)
- kwargs['controller'] = self.controller.full_name
- kwargs['unit'] = '0' #TODO: hardcoded unit to 0
- kwargs['axis'] = self.axis
- if self.instrument is not None:
- kwargs['instrument'] = self.instrument.full_name
- else:
- kwargs['instrument'] = None
- kwargs['source'] = self.get_source()
- return kwargs
-
- def get_parent(self):
- return self.get_controller()
-
- def get_controller(self):
- if self._ctrl is None:
- return None
- return self._ctrl()
-
- def get_controller_id(self):
- return self._ctrl_id
-
- def get_axis(self):
- return self._axis
-
- def set_action_cache(self, action_cache):
- self._action_cache = action_cache
- action_cache.add_element(self)
-
- def get_source(self):
- return "{0}/{1}".format(self.full_name, self.get_default_acquisition_channel())
-
- # --------------------------------------------------------------------------
- # instrument
- # --------------------------------------------------------------------------
-
- def get_instrument(self):
- if self._instrument is None:
- return None
- return self._instrument()
-
- def set_instrument(self, instrument, propagate=1):
- self._set_instrument(instrument, propagate=propagate)
-
- def _set_instrument(self, instrument, propagate=1):
- if self._instrument is not None:
- self._instrument().remove_element(self)
- new_instrument_name = ""
- if instrument is None:
- self._instrument = None
- else:
- self._instrument = weakref.ref(instrument)
- new_instrument_name = instrument.full_name
- instrument.add_element(self)
- if not propagate:
- return
- self.fire_event(EventType("instrument", priority=propagate),
- new_instrument_name)
-
- # --------------------------------------------------------------------------
- # stop
- # --------------------------------------------------------------------------
-
- def stop(self):
- self.info("Stop!")
- PoolBaseElement.stop(self)
- self.controller.stop_one(self.axis)
-
- # --------------------------------------------------------------------------
- # abort
- # --------------------------------------------------------------------------
-
- def abort(self):
- self.info("Abort!")
- PoolBaseElement.abort(self)
- self.controller.abort_one(self.axis)
-
- def get_par(self, name):
- return self.controller.get_axis_par(self.axis, name)
-
- def set_par(self, name, value):
- return self.controller.set_axis_par(self.axis, name, value)
-
- def get_extra_par(self, name):
- return self.controller.get_axis_attr(self.axis, name)
-
- def set_extra_par(self, name, value):
- return self.controller.set_axis_attr(self.axis, name, value)
-
- axis = property(get_axis, doc="element axis")
- controller = property(get_controller, doc="element controller")
- controller_id = property(get_controller_id, doc="element controller id")
- instrument = property(get_instrument, set_instrument,
- doc="element instrument")
diff --git a/src/sardana/pool/poolexception.py b/src/sardana/pool/poolexception.py
deleted file mode 100644
index 60abd893..00000000
--- a/src/sardana/pool/poolexception.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for pool exceptions"""
-
-__all__ = ["PoolException", "UnknownController", "UnknownControllerLibrary"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanaexception import SardanaException, UnknownCode, \
- UnknownLibrary
-
-
-class PoolException(SardanaException):
- pass
-
-
-class UnknownController(UnknownCode):
- pass
-
-
-class UnknownControllerLibrary(UnknownLibrary):
- pass
diff --git a/src/sardana/pool/poolextension.py b/src/sardana/pool/poolextension.py
deleted file mode 100644
index 31d0b670..00000000
--- a/src/sardana/pool/poolextension.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines the base
-classes for sardana value translation"""
-
-__all__ = ["CannotTranslateException",
- "register_controller_value_translator",
- "register_controller_state_translator",
- "ControllerValueTranslator", "ControllerStateTranslator"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanavalue import SardanaValue
-
-__CTRL_STATE_TRANSLATORS = {}
-__CTRL_VALUE_TRANSLATORS = {}
-
-
-class CannotTranslateException(Exception):
-
- def __init__(self, *args, **kwargs):
- super(CannotTranslateException, self).__init__(*args, **kwargs)
-
-
-class BaseControllerTranslator(object):
-
- def translate(self, value):
- raise CannotTranslateException
-
- def __call__(self, value):
- return self.translate(value)
-
-
-class ControllerValueTranslator(BaseControllerTranslator):
- pass
-
-
-class ControllerStateTranslator(BaseControllerTranslator):
- pass
-
-
-def register_controller_value_translator(klass, *args, **kwargs):
- if not issubclass(klass, ControllerValueTranslator):
- raise Exception("Cannot register controller value translator. " \
- "Class must inherit from ControllerValueTranslator")
- __CTRL_VALUE_TRANSLATORS[klass] = klass(*args, **kwargs)
-
-
-def register_controller_state_translator(klass, *args, **kwargs):
- if not issubclass(klass, ControllerStateTranslator):
- raise Exception("Cannot register controller value translator. " \
- "Class must inherit from ControllerStateTranslator")
- __CTRL_STATE_TRANSLATORS[klass] = klass(*args, **kwargs)
-
-
-def translate_ctrl_value(value):
- if isinstance(value, SardanaValue):
- return value
-
- for _, translator in __CTRL_VALUE_TRANSLATORS.items():
- try:
- return translator(value)
- except CannotTranslateException:
- continue
-
- # Fallback translator
- return SardanaValue(value=value)
diff --git a/src/sardana/pool/poolexternal.py b/src/sardana/pool/poolexternal.py
deleted file mode 100644
index a144b9d0..00000000
--- a/src/sardana/pool/poolexternal.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for external objects to the pool (like tango objects)"""
-
-__all__ = ["PoolBaseExternalObject", "PoolTangoObject", "PoolExternalObject"]
-
-__docformat__ = 'restructuredtext'
-
-import PyTango
-
-from sardana import ElementType
-from sardana.pool.poolbaseobject import PoolBaseObject
-
-
-class PoolBaseExternalObject(PoolBaseObject):
- """TODO"""
-
- def __init__(self, **kwargs):
- kwargs['elem_type'] = ElementType.External
- PoolBaseObject.__init__(self, **kwargs)
-
- def get_source(self):
- return self.full_name
-
- def get_config(self):
- raise NotImplementedError
-
-
-class PoolTangoObject(PoolBaseExternalObject):
- """TODO"""
-
- def __init__(self, **kwargs):
- scheme = kwargs.pop('scheme', 'tango')
- attribute_name = kwargs.pop('attributename')
- host, port = kwargs.pop('host', None), kwargs.pop('port', None)
- devalias = kwargs.pop('devalias', None)
- device_name = kwargs.pop('devicename', None)
- if host is None:
- db = PyTango.Database()
- host, port = db.get_db_host(), db.get_db_port()
- else:
- db = PyTango.Database(host, port)
- full_name = "<unknown>"
- if device_name is None:
- if devalias is not None:
- try:
- device_name = db.get_device_alias(devalias)
- full_name = "{0}:{1}/{2}/{3}".format(host, port,
- device_name,
- attribute_name)
- except:
- full_name = "{0}/{1}".format(devalias, attribute_name)
- else:
- full_name = "{0}:{1}/{2}/{3}".format(host, port, device_name,
- attribute_name)
- self._device_name = device_name
- self._attribute_name = attribute_name
- self._config = None
- self._device = None
- kwargs['name'] = attribute_name
- kwargs['full_name'] = full_name
- PoolBaseExternalObject.__init__(self, **kwargs)
-
- def get_device_name(self):
- return self._device_name
-
- def get_attribute_name(self):
- return self._attribute_name
-
- def get_device(self):
- device = self._device
- if device is None:
- try:
- self._device = device = PyTango.DeviceProxy(self._device_name)
- except:
- pass
- return device
-
- def get_config(self):
- config = self._config
- if config is None:
- try:
- self._config = config = \
- self._device.get_attribute_config(self._attribute_name)
- except:
- pass
- return config
-
- device_name = property(get_device_name)
- attribute_name = property(get_attribute_name)
-
-
-_SCHEME_CLASS = { 'tango' : PoolTangoObject,
- None : PoolTangoObject}
-
-
-def PoolExternalObject(**kwargs):
- scheme = kwargs.get('scheme', 'tango')
- klass = _SCHEME_CLASS[scheme]
- return klass(**kwargs)
-
diff --git a/src/sardana/pool/poolgroupelement.py b/src/sardana/pool/poolgroupelement.py
deleted file mode 100644
index ec35eb12..00000000
--- a/src/sardana/pool/poolgroupelement.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolGroupElement"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.pool.poolbaseelement import PoolBaseElement
-from sardana.pool.poolbasegroup import PoolBaseGroup
-
-
-class PoolGroupElement(PoolBaseElement, PoolBaseGroup):
-
- def __init__(self, **kwargs):
- user_elements = kwargs.pop('user_elements')
- PoolBaseElement.__init__(self, **kwargs)
- PoolBaseGroup.__init__(self, user_elements=user_elements,
- pool=kwargs['pool'])
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolBaseElement.serialize(self, *args, **kwargs)
- elements = [elem.name for elem in self.get_user_elements()]
- physical_elements = []
- for elem_list in self.get_physical_elements().values():
- for elem in elem_list:
- physical_elements.append(elem.name)
- kwargs['elements'] = elements
- kwargs['physical_elements'] = physical_elements
- return kwargs
-
- def get_action_cache(self):
- return self._get_action_cache()
-
- def set_action_cache(self, action_cache):
- self._set_action_cache(action_cache)
-
- # -------------------------------------------------------------------------
- # state information
- # -------------------------------------------------------------------------
-
- def read_state_info(self):
- state_info = {}
- ctrl_state_info = self.get_action_cache().read_state_info(serial=True)
- for elem, ctrl_elem_state_info in ctrl_state_info.items():
- elem_state_info = elem._from_ctrl_state_info(ctrl_elem_state_info)
- elem.put_state_info(elem_state_info)
- state = elem.get_state(cache=True, propagate=0)
- status = elem.get_status(cache=True, propagate=0)
- state_info[elem] = state, status
- return state_info
-
- def _set_state_info(self, state_info, propagate=1):
- state_info = self._calculate_states(state_info)
- state, status = state_info
- self._set_status(status, propagate=propagate)
- self._set_state(state, propagate=propagate)
-
- # -------------------------------------------------------------------------
- # stop
- # -------------------------------------------------------------------------
-
- def stop(self):
- PoolBaseElement.stop(self)
- PoolBaseGroup.stop(self)
-
- # -------------------------------------------------------------------------
- # abort
- # -------------------------------------------------------------------------
-
- def abort(self):
- PoolBaseElement.abort(self)
- PoolBaseGroup.abort(self)
-
- # -------------------------------------------------------------------------
- # involved in an operation
- # -------------------------------------------------------------------------
-
- def get_operation(self):
- return PoolBaseGroup.get_operation(self)
diff --git a/src/sardana/pool/poolinstrument.py b/src/sardana/pool/poolinstrument.py
deleted file mode 100644
index 039e5e80..00000000
--- a/src/sardana/pool/poolinstrument.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for instrument"""
-
-__all__ = ["PoolInstrument"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-
-from sardana import ElementType
-
-from sardana.pool.poolobject import PoolObject
-
-
-class PoolInstrument(PoolObject):
-
- def __init__(self, **kwargs):
- self._parent_instrument = kwargs.pop("parent")
- self._instrument_class = kwargs.pop("klass")
- if self._parent_instrument:
- self._parent_instrument = weakref.ref(self._parent_instrument)
- self._child_instruments = {}
- self._elements = {}
- kwargs['elem_type'] = ElementType.Instrument
- super(PoolInstrument, self).__init__(**kwargs)
-
- def get_parent(self):
- return self.get_parent_instrument()
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolObject.serialize(self, *args, **kwargs)
- kwargs['klass'] = self.instrument_class
- if self.parent_instrument is not None:
- kwargs['parent_instrument'] = self.parent_instrument.full_name
- else:
- kwargs['parent_instrument'] = None
- return kwargs
-
- def get_instrument_class(self):
- return self._instrument_class
-
- def add_instrument(self, instrument):
- self._child_instruments[instrument.id] = instrument
-
- def remove_instrument(self, instrument):
- del self._child_instruments[instrument.id]
-
- def get_instruments(self):
- return self._child_instruments.values()
-
- def set_parent_instrument(self, instrument):
- if instrument:
- self._parent_instrument = weakref.ref(instrument)
- else:
- self._parent_instrument = None
-
- def get_parent_instrument(self):
- if self.has_parent_instrument():
- return self._parent_instrument()
-
- def has_parent_instrument(self):
- return self._parent_instrument is not None
-
- def add_element(self, element):
- self._elements[element.id] = weakref.ref(element)
-
- def remove_element(self, element):
- del self._elements[element.id]
-
- def get_elements(self):
- return [ e() for e in self._elements.values() ]
-
- def has_instruments(self):
- return len(self._child_instruments) > 0
-
- def has_elements(self):
- return len(self._elements) > 0
-
- instruments = property(get_instruments)
- elements = property(get_elements)
- instrument_class = property(get_instrument_class)
- parent_instrument = property(get_parent_instrument)
diff --git a/src/sardana/pool/poolioregister.py b/src/sardana/pool/poolioregister.py
deleted file mode 100644
index d08955bb..00000000
--- a/src/sardana/pool/poolioregister.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for """
-
-__all__ = ["PoolIORegister"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from sardana import ElementType
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.poolelement import PoolElement
-from sardana.pool.poolacquisition import PoolIORAcquisition
-
-
-class Value(SardanaAttribute):
-
- def __init__(self, *args, **kwargs):
- super(Value, self).__init__(*args, **kwargs)
-
- def update(self, cache=True, propagate=1):
- if not cache or not self.has_value():
- value = self.obj.read_value()
- self.set_value(value, propagate=propagate)
-
-
-class PoolIORegister(PoolElement):
-
- def __init__(self, **kwargs):
- kwargs['elem_type'] = ElementType.IORegister
- PoolElement.__init__(self, **kwargs)
- self._value = Value(self, listeners=self.on_change)
- self._config = None
- acq_name = "%s.Acquisition" % self._name
- self.set_action_cache(PoolIORAcquisition(self.pool, name=acq_name))
-
- def get_value_attribute(self):
- """Returns the value attribute object for this IO register
-
- :return: the value attribute
- :rtype: :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self._value
-
- # -------------------------------------------------------------------------
- # Event forwarding
- # -------------------------------------------------------------------------
-
- def on_change(self, evt_src, evt_type, evt_value):
- # forward all events coming from attributes to the listeners
- self.fire_event(evt_type, evt_value)
-
- # -------------------------------------------------------------------------
- # default acquisition channel
- # -------------------------------------------------------------------------
-
- def get_default_attribute(self):
- return self.get_value_attribute()
-
- # -------------------------------------------------------------------------
- # value
- # -------------------------------------------------------------------------
- def read_value(self):
- """Reads the IO register value from hardware.
-
- :return:
- a :class:`~sardana.sardanavalue.SardanaValue` containing the IO
- register value
- :rtype:
- :class:`~sardana.sardanavalue.SardanaValue`"""
- return self.get_action_cache().read_value()[self]
-
- def put_value(self, value, propagate=1):
- """Sets a value.
-
- :param value:
- the new value
- :type value:
- :class:`~sardana.sardanavalue.SardanaValue`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- val_attr = self._value
- val_attr.set_value(value, propagate=propagate)
- return val_attr
-
- def get_value(self, cache=True, propagate=1):
- value = self.get_value_attribute()
- value.update(cache=cache, propagate=propagate)
- return value
-
- def set_value(self, value, timestamp=None):
- self.write_register(value, timestamp=timestamp)
-
- def set_write_value(self, w_value, timestamp=None, propagate=1):
- """Sets a new write value for the IO registere
-
- :param w_value:
- the new write value for IO register
- :type w_value:
- :class:`~numbers.Number`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- self._value.set_write_value(w_value, timestamp=timestamp,
- propagate=propagate)
-
- value = property(get_value, set_value, doc="ioregister value")
-
- def write_register(self, value, timestamp=None):
- self._aborted = False
- self._stopped = False
- if not self._simulation_mode:
- if timestamp is None:
- timestamp = time.time()
- self.set_write_value(value, timestamp=timestamp, propagate=0)
- self.controller.write_one(self.axis, value)
diff --git a/src/sardana/pool/poolmeasurementgroup.py b/src/sardana/pool/poolmeasurementgroup.py
deleted file mode 100644
index 25cab6de..00000000
--- a/src/sardana/pool/poolmeasurementgroup.py
+++ /dev/null
@@ -1,523 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolMeasurementGroup"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.taurusvalidator import AttributeNameValidator
-
-from sardana import State, ElementType, \
- TYPE_EXP_CHANNEL_ELEMENTS, TYPE_TIMERABLE_ELEMENTS
-from sardana.sardanaevent import EventType
-from sardana.pool.pooldefs import AcqMode, AcqTriggerType
-from sardana.pool.poolgroupelement import PoolGroupElement
-from sardana.pool.poolacquisition import PoolAcquisition
-from sardana.pool.poolexternal import PoolExternalObject
-
-from sardana.taurus.core.tango.sardana import PlotType, Normalization
-
-#----------------------------------------------
-# Measurement Group Configuration information
-#----------------------------------------------
-# dict <str, obj> with (at least) keys:
-# - 'timer' : the timer channel name / timer channel id
-# - 'monitor' : the monitor channel name / monitor channel id
-# - 'controllers' : dict<Controller, dict> where:
-# - key: ctrl
-# - value: dict<str, dict> with (at least) keys:
-# - 'units': dict<str, dict> with (at least) keys:
-# - 'id' : the unit ID inside the controller
-# - 'timer' : the timer channel name / timer channel id
-# - 'monitor' : the monitor channel name / monitor channel id
-# - 'trigger_type' : 'Gate'/'Software'
-# - 'channels' where value is a dict<str, obj> with (at least) keys:
-# - 'id' : the channel name ( channel id )
-# optional keys:
-# - 'enabled' : True/False (default is True)
-# any hints:
-# - 'output' : True/False (default is True)
-# - 'plot_type' : 'No'/'1D'/'2D' (default is 'No')
-# - 'plot_axes' : list<str> 'where str is channel name/'step#/'index#' (default is [])
-# - 'label' : prefered label (default is channel name)
-# - 'scale' : <float, float> with min/max (defaults to channel
-# range if it is defined
-# - 'plot_color' : int representing RGB
-# optional keys:
-# - 'label' : measurement group label (defaults to measurement group name)
-# - 'description' : measurement group description
-
-# <MeasurementGroupConfiguration>
-# <timer>UxTimer</timer>
-# <monitor>CT1</monitor>
-# </MeasurementGroupConfiguration>
-
-# Example: 2 NI cards, where channel 1 of card 1 is wired to channel 1 of card 2
-# at configuration time we should set:
-# ctrl.setPar( <unit>, <parameter name>, <parameter value> )
-# ni0ctrl.setCtrlPar(0, 'trigger_type', AcqTriggerType.Software)
-# ni0ctrl.setCtrlPar(0, 'timer', 1) # channel 1 is the timer
-# ni0ctrl.setCtrlPar(0, 'monitor', 4) # channel 4 is the monitor
-# ni1ctrl.setCtrlPar(0, 'trigger_type', AcqTriggerType.ExternalTrigger)
-# ni1ctrl.setCtrlPar(0, 'master', 0)
-
-# when we count for 1.5 seconds:
-# ni1ctrl.Load(1.5)
-# ni0ctrl.Load(1.5)
-# ni1ctrl.Start()
-# ni0ctrl.Start()
-
-"""
-
-"""
-
-class PoolMeasurementGroup(PoolGroupElement):
-
- DFT_DESC = 'General purpose measurement group'
-
- def __init__(self, **kwargs):
- self._integration_time = None
- self._monitor_count = None
- self._acquisition_mode = AcqMode.Timer
- self._config = None
- self._config_dirty = True
- kwargs['elem_type'] = ElementType.MeasurementGroup
- PoolGroupElement.__init__(self, **kwargs)
- self.set_configuration(kwargs.get('configuration'))
-
- def _create_action_cache(self):
- acq_name = "%s.Acquisition" % self._name
- return PoolAcquisition(self, acq_name)
-
- def _calculate_element_state(self, elem, elem_state_info):
- if elem.get_type() == ElementType.ZeroDExpChannel:
- if elem_state_info[0] == State.Moving:
- elem_state_info = State.On, elem_state_info[1]
- return PoolGroupElement._calculate_element_state(self, elem,
- elem_state_info)
-
- def on_element_changed(self, evt_src, evt_type, evt_value):
- name = evt_type.name
- if name == 'state':
- if evt_src.get_type() == ElementType.ZeroDExpChannel:
- # 0D channels are "passive", which means they cannot contribute
- # to set the measurement group into a moving state
- if evt_value in (State.On, State.Moving):
- return
- state, status = self._calculate_states()
- self.set_state(state, propagate=2)
- self.set_status("\n".join(status))
-
- def get_pool_controllers(self):
- return self.get_acquisition().get_pool_controllers()
-
- def get_pool_controller_by_name(self, name):
- name = name.lower()
- for ctrl in self.get_pool_controllers():
- if ctrl.name.lower() == name or ctrl.full_name.lower() == name:
- return ctrl
-
- # --------------------------------------------------------------------------
- # configuration
- # --------------------------------------------------------------------------
-
- def _is_managed_element(self, element):
- return element.get_type() in TYPE_EXP_CHANNEL_ELEMENTS
-
- def _build_channel_defaults(self, channel_data, channel):
- """Fills the channel default values for the given channel dictionary"""
-
- external_from_name = isinstance(channel, (str, unicode))
- ndim = None
- instrument = None
- if external_from_name:
- name = full_name = source = channel
- else:
- name = channel.name
- full_name = channel.full_name
- source = channel.get_source()
- ndim = None
- instrument = None
- ctype = channel.get_type()
- if ctype != ElementType.External:
- instrument = channel.instrument
- if ctype == ElementType.CTExpChannel:
- ndim = 0
- elif ctype == ElementType.PseudoCounter:
- ndim = 0
- elif ctype == ElementType.ZeroDExpChannel:
- ndim = 0
- elif ctype == ElementType.OneDExpChannel:
- ndim = 1
- elif ctype == ElementType.TwoDExpChannel:
- ndim = 2
- elif ctype == ElementType.External:
- config = channel.get_config()
- if config is not None:
- ndim = int(config.data_format)
- elif ctype == ElementType.IORegister:
- ndim = 0
-
- # Definitively should be initialized by measurement group
- # index MUST be here already (asserting this in the following line)
- channel_data['index'] = channel_data['index']
- channel_data['name'] = channel_data.get('name', name)
- channel_data['full_name'] = channel_data.get('full_name', full_name)
- channel_data['source'] = channel_data.get('source', source)
- channel_data['enabled'] = channel_data.get('enabled', True)
- channel_data['label'] = channel_data.get('label', channel_data['name'])
- channel_data['instrument'] = channel_data.get('instrument', getattr(instrument, 'name', None))
- channel_data['ndim'] = ndim
- # Probably should be initialized by measurement group
- channel_data['output'] = channel_data.get('output', True)
-
- # Perhaps should NOT be initialized by measurement group
- channel_data['plot_type'] = channel_data.get('plot_type', PlotType.No)
- channel_data['plot_axes'] = channel_data.get('plot_axes', [])
- channel_data['conditioning'] = channel_data.get('conditioning', '')
- channel_data['normalization'] = channel_data.get('normalization', Normalization.No)
-
- return channel_data
-
- def _build_configuration(self):
- """Builds a configuration object from the list of elements"""
- config = {}
- user_elements = self.get_user_elements()
- ctrls = self.get_pool_controllers()
-
- # find the first CT
- first_timerable = None
- for elem in user_elements:
- if elem.get_type() in TYPE_TIMERABLE_ELEMENTS:
- first_timerable = elem
- break
- if first_timerable is None:
- raise Exception("It is not possible to construct a measurement "
- "group without at least one timer able channel "
- "(Counter/timer, 1D or 2D)")
- g_timer = g_monitor = first_timerable
- config['timer'] = g_timer
- config['monitor'] = g_monitor
- config['controllers'] = controllers = {}
-
- external_user_elements = []
- for index, element in enumerate(user_elements):
- elem_type = element.get_type()
- if elem_type == ElementType.External:
- external_user_elements.append((index, element))
- continue
-
- ctrl = element.controller
- ctrl_data = controllers.get(ctrl)
-
- # attention: following lines are only prepared for 1 unit per
- # controller
- if ctrl_data is None:
- controllers[ctrl] = ctrl_data = {}
- ctrl_data['units'] = units = {}
- units['0'] = unit_data = {}
- unit_data['id'] = 0
- unit_data['channels'] = channels = {}
- if elem_type in TYPE_TIMERABLE_ELEMENTS:
- elements = ctrls[ctrl]
- if g_timer in elements:
- unit_data['timer'] = g_timer
- else:
- unit_data['timer'] = elements[0]
- if g_monitor in elements:
- unit_data['monitor'] = g_monitor
- else:
- unit_data['monitor'] = elements[0]
- unit_data['trigger_type'] = AcqTriggerType.Software
- else:
- channels = ctrl_data['units']['0']['channels']
- channels[element] = channel_data = {}
- channel_data['index'] = user_elements.index(element)
- channel_data = self._build_channel_defaults(channel_data, element)
- config['label'] = self.name
- config['description'] = self.DFT_DESC
-
- if len(external_user_elements) > 0:
- controllers['__tango__'] = ctrl_data = {}
- ctrl_data['units'] = units = {}
- units['0'] = unit_data = {}
- unit_data['id'] = 0
- unit_data['channels'] = channels = {}
- for index, element in external_user_elements:
- channels[element] = channel_data = {}
- channel_data['index'] = index
- channel_data = self._build_channel_defaults(channel_data, element)
- return config
-
- def set_configuration(self, config=None, propagate=1):
- if config is None:
- config = self._build_configuration()
- else:
- # create a configuration based on a new configuration
- user_elem_ids = {}
- pool = self.pool
- for c, c_data in config['controllers'].items():
- external = isinstance(c, (str, unicode))
- # attention: following line only prepared for 1 unit per controller
- for channel_data in c_data['units']['0']['channels'].values():
- if external:
- element = id = channel_data['full_name']
- channel_data['source'] = id
- else:
- element = pool.get_element_by_full_name(channel_data['full_name'])
- id = element.id
- user_elem_ids[channel_data['index']] = id
- channel_data = self._build_channel_defaults(channel_data, element)
- indexes = sorted(user_elem_ids.keys())
- assert indexes == range(len(indexes))
- self.set_user_element_ids([ user_elem_ids[idx] for idx in indexes ])
-
- # checks
- g_timer, g_monitor = config['timer'], config['monitor']
-
- # attention: following line only prepared for 1 unit per controller
- timer_ctrl_data = config['controllers'][g_timer.controller]['units']['0']
- if timer_ctrl_data['timer'] != g_timer:
- self.warning('unit timer and global timer mismatch. '
- 'Using global timer')
- self.debug('For controller %s, timer is defined as channel %s. '
- 'The global timer is set to channel %s which belongs '
- 'to the same controller', g_timer.controller.name,
- timer_ctrl_data['timer'].name, g_timer.name)
- timer_ctrl_data['timer'] = g_timer
-
- # attention: following line only prepared for 1 unit per controller
- monitor_ctrl_data = config['controllers'][g_monitor.controller]['units']['0']
- if monitor_ctrl_data['monitor'] != g_monitor:
- self.warning('unit monitor and global monitor mismatch. '
- 'Using global monitor')
- self.debug('For controller %s, monitor is defined as channel %s. '
- 'The global timer is set to channel %s which belongs '
- 'to the same controller', g_monitor.controller.name,
- monitor_ctrl_data['monitor'].name, g_monitor.name)
- monitor_ctrl_data['monitor'] != g_monitor
-
- self._config = config
- self._config_dirty = True
- if not propagate:
- return
- self.fire_event(EventType("configuration", priority=propagate), config)
-
- def set_configuration_from_user(self, cfg, propagate=1):
- config = {}
- user_elements = self.get_user_elements()
- pool = self.pool
-
- timer_name = cfg.get('timer', user_elements[0].full_name)
- monitor_name = cfg.get('monitor', user_elements[0].full_name)
- config['timer'] = pool.get_element_by_full_name(timer_name)
- config['monitor'] = pool.get_element_by_full_name(monitor_name)
- config['controllers'] = controllers = {}
-
- for c_name, c_data in cfg['controllers'].items():
- # discard controllers which don't have items (garbage)
- ch_count = 0
- for u_data in c_data['units'].values():
- ch_count += len(u_data['channels'])
- if ch_count == 0:
- continue
-
- external = c_name.startswith('__')
- if external:
- ctrl = c_name
- else:
- ctrl = pool.get_element_by_full_name(c_name)
- assert ctrl.get_type() == ElementType.Controller
- controllers[ctrl] = ctrl_data = {}
- ctrl_data['units'] = units = {}
- for u_id, u_data in c_data['units'].items():
- # discard units which don't have items (garbage)
- if len(u_data['channels']) == 0:
- continue
- units[u_id] = unit_data = dict(u_data)
- unit_data['id'] = u_data.get('id', u_id)
- if not external and ctrl.is_timerable():
- unit_data['timer'] = pool.get_element_by_full_name(u_data['timer'])
- unit_data['monitor'] = pool.get_element_by_full_name(u_data['monitor'])
- unit_data['trigger_type'] = u_data['trigger_type']
- unit_data['channels'] = channels = {}
- for ch_name, ch_data in u_data['channels'].items():
- if external:
- validator = AttributeNameValidator()
- params = validator.getParams(ch_data['full_name'])
- params['pool'] = self.pool
- channel = PoolExternalObject(**params)
- else:
- channel = pool.get_element_by_full_name(ch_name)
- channels[channel] = dict(ch_data)
-
- config['label'] = cfg.get('label', self.name)
- config['description'] = cfg.get('description', self.DFT_DESC)
- self.set_configuration(config, propagate=propagate)
-
- def get_configuration(self):
- return self._config
-
- def get_user_configuration(self):
- cfg = self.get_configuration()
- config = {}
-
- config['timer'] = cfg['timer'].full_name
- config['monitor'] = cfg['monitor'].full_name
- config['controllers'] = controllers = {}
-
- for c, c_data in cfg['controllers'].items():
- ctrl_name = c
- if not isinstance(c, (str, unicode)):
- ctrl_name = c.full_name
- external = ctrl_name.startswith('__')
- controllers[ctrl_name] = ctrl_data = {}
- ctrl_data['units'] = units = {}
- for u_id, u_data in c_data['units'].items():
- units[u_id] = unit_data = {}
- unit_data['id'] = u_data['id']
- if not external and c.is_timerable():
- if u_data.has_key('timer'):
- unit_data['timer'] = u_data['timer'].full_name
- if u_data.has_key('monitor'):
- unit_data['monitor'] = u_data['monitor'].full_name
- if u_data.has_key('trigger_type'):
- unit_data['trigger_type'] = u_data['trigger_type']
- unit_data['channels'] = channels = {}
- for ch, ch_data in u_data['channels'].items():
- channels[ch.full_name] = dict(ch_data)
-
- config['label'] = cfg['label']
- config['description'] = cfg['description']
- return config
-
- def load_configuration(self, force=False):
- """Loads the current configuration to all involved controllers"""
- cfg = self.get_configuration()
- g_timer, g_monitor = cfg['timer'], cfg['monitor']
-
- for ctrl, ctrl_data in cfg['controllers'].items():
- # skip external channels
- if type(ctrl) is str:
- continue
- if ctrl.operator == self and not force and not self._config_dirty:
- continue
- ctrl.operator = self
- if ctrl.is_timerable():
- for unit, unit_data in ctrl_data['units'].items():
- #if ctrl == g_timer.controller:
- # ctrl.set_ctrl_par('timer', g_timer.axis)
- #if ctrl == g_monitor.controller:
- # ctrl.set_ctrl_par('monitor', g_monitor.axis)
- ctrl.set_ctrl_par('timer', unit_data['timer'].axis)
- ctrl.set_ctrl_par('monitor', unit_data['monitor'].axis)
- ctrl.set_ctrl_par('trigger_type', unit_data['trigger_type'])
-
- self._config_dirty = False
-
- def get_timer(self):
- return self.get_configuration()['timer']
-
- timer = property(get_timer)
-
- # --------------------------------------------------------------------------
- # integration time
- # --------------------------------------------------------------------------
-
- def get_integration_time(self):
- return self._integration_time
-
- def set_integration_time(self, integration_time, propagate=1):
- self._integration_time = integration_time
- if not propagate:
- return
- self.fire_event(EventType("integration_time", priority=propagate),
- integration_time)
-
- integration_time = property(get_integration_time, set_integration_time,
- doc="the current integration time")
-
- # --------------------------------------------------------------------------
- # integration time
- # --------------------------------------------------------------------------
-
- def get_monitor_count(self):
- return self._monitor_count
-
- def set_monitor_count(self, monitor_count, propagate=1):
- self._monitor_count = monitor_count
- if not propagate:
- return
- self.fire_event(EventType("monitor_count", priority=propagate),
- monitor_count)
-
- monitor_count = property(get_monitor_count, set_monitor_count,
- doc="the current monitor count")
-
- # --------------------------------------------------------------------------
- # acquisition mode
- # --------------------------------------------------------------------------
-
- def get_acquisition_mode(self):
- return self._acquisition_mode
-
- def set_acquisition_mode(self, acquisition_mode, propagate=1):
- self._acquisition_mode = acquisition_mode
- if not propagate:
- return
- self.fire_event(EventType("acquisition_mode", priority=propagate),
- acquisition_mode)
-
- acquisition_mode = property(get_acquisition_mode, set_acquisition_mode,
- doc="the current acquisition mode")
-
- # --------------------------------------------------------------------------
- # acquisition
- # --------------------------------------------------------------------------
-
- def start_acquisition(self, value=None, multiple=1):
- self._aborted = False
- if not self._simulation_mode:
- # load configuration into controller(s) if necessary
- self.load_configuration()
- # start acquisition
- kwargs = dict(head=self, config=self._config, multiple=multiple)
- if self.acquisition_mode == AcqMode.Timer:
- kwargs["integ_time"] = self._integration_time
- elif self.acquisition_mode == AcqMode.Monitor:
- kwargs["monitor_count"] = self._monitor_count
- self.acquisition.run(**kwargs)
-
- def set_acquisition(self, acq_cache):
- self.set_action_cache(acq_cache)
-
- def get_acquisition(self):
- return self.get_action_cache()
-
- acquisition = property(get_acquisition, doc="acquisition object")
-
diff --git a/src/sardana/pool/poolmetacontroller.py b/src/sardana/pool/poolmetacontroller.py
deleted file mode 100644
index 3c3d1e68..00000000
--- a/src/sardana/pool/poolmetacontroller.py
+++ /dev/null
@@ -1,350 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for"""
-
-__all__ = ["CONTROLLER_TEMPLATE", "CTRL_TYPE_MAP", "TYPE_MAP", "TYPE_MAP_OBJ",
- "TypeData", "DTYPE_MAP", "DACCESS_MAP", "DataInfo",
- "ControllerLibrary", "ControllerClass"]
-
-__docformat__ = 'restructuredtext'
-
-import types
-import inspect
-
-from taurus.core.util.containers import CaselessDict
-
-from sardana import DataType, DataFormat, DataAccess, \
- to_dtype_dformat, to_daccess, \
- ElementType, TYPE_ELEMENTS, InvalidId
-from sardana.sardanameta import SardanaLibrary, SardanaClass
-from sardana.pool.poolmotor import PoolMotor
-from sardana.pool.poolpseudomotor import PoolPseudoMotor
-from sardana.pool.poolmotorgroup import PoolMotorGroup
-from sardana.pool.poolmeasurementgroup import PoolMeasurementGroup
-from sardana.pool.poolcountertimer import PoolCounterTimer
-from sardana.pool.poolzerodexpchannel import Pool0DExpChannel
-from sardana.pool.poolonedexpchannel import Pool1DExpChannel
-from sardana.pool.pooltwodexpchannel import Pool2DExpChannel
-from sardana.pool.poolpseudocounter import PoolPseudoCounter
-from sardana.pool.poolinstrument import PoolInstrument
-from sardana.pool.poolioregister import PoolIORegister
-from sardana.pool.poolcontroller import PoolController, \
- PoolPseudoMotorController, PoolPseudoCounterController
-from sardana.pool.controller import Controller, MotorController, \
- CounterTimerController, ZeroDController, OneDController, TwoDController, \
- PseudoMotorController, PseudoCounterController, IORegisterController
-from sardana.pool.controller import Type, Access, Description, DefaultValue, \
- FGet, FSet, Memorize, Memorized, MaxDimSize
-
-
-#: String containing template code for a controller class
-CONTROLLER_TEMPLATE = """class @controller_name@(@controller_type@):
- \"\"\"@controller_name@ description.\"\"\"
-
-"""
-
-ET = ElementType
-
-#: a dictionary dict<:data:`~sardana.ElementType`, class>
-#: mapping element type enumeration with the corresponding controller pool class
-#: (:class:`~sardana.pool.poolcontroller.PoolController` or sub-class of it).
-CTRL_TYPE_MAP = {
- ET.Motor : PoolController,
- ET.CTExpChannel : PoolController,
- ET.OneDExpChannel : PoolController,
- ET.TwoDExpChannel : PoolController,
- ET.PseudoMotor : PoolPseudoMotorController,
- ET.PseudoCounter : PoolPseudoCounterController,
- ET.IORegister : PoolController,
-}
-
-#: dictionary dict<:data:`~sardana.ElementType`, :class:`tuple`>
-#: where tuple is a sequence:
-#:
-#: #. type string representation
-#: #. family
-#: #. internal pool class
-#: #. automatic full name
-#: #. controller class
-TYPE_MAP = {
- ET.Controller : ("Controller", "Controller", CTRL_TYPE_MAP, "controller/{klass}/{name}", Controller),
- ET.Instrument : ("Instrument", "Instrument", PoolInstrument, "{full_name}", None),
- ET.Motor : ("Motor", "Motor", PoolMotor, "motor/{ctrl_name}/{axis}", MotorController),
- ET.CTExpChannel : ("CTExpChannel", "ExpChannel", PoolCounterTimer, "expchan/{ctrl_name}/{axis}", CounterTimerController),
- ET.ZeroDExpChannel : ("ZeroDExpChannel", "ExpChannel", Pool0DExpChannel, "expchan/{ctrl_name}/{axis}", ZeroDController),
- ET.OneDExpChannel : ("OneDExpChannel", "ExpChannel", Pool1DExpChannel, "expchan/{ctrl_name}/{axis}", OneDController),
- ET.TwoDExpChannel : ("TwoDExpChannel", "ExpChannel", Pool2DExpChannel, "expchan/{ctrl_name}/{axis}", TwoDController),
- ET.PseudoMotor : ("PseudoMotor", "Motor", PoolPseudoMotor, "pm/{ctrl_name}/{axis}", PseudoMotorController),
- ET.PseudoCounter : ("PseudoCounter", "ExpChannel", PoolPseudoCounter, "pc/{ctrl_name}/{axis}", PseudoCounterController),
- ET.MotorGroup : ("MotorGroup", "MotorGroup", PoolMotorGroup, "mg/{pool_name}/{name}", None),
- ET.MeasurementGroup : ("MeasurementGroup", "MeasurementGroup", PoolMeasurementGroup, "mntgrp/{pool_name}/{name}", None),
- ET.IORegister : ("IORegister", "IORegister" , PoolIORegister, "ioregister/{ctrl_name}/{axis}", IORegisterController),
-}
-
-class TypeData(object):
- """Information for a specific Element type"""
-
- def __init__(self, **kwargs):
- self.__dict__.update(kwargs)
-
-#: dictionary
-#: dict<:data:`~sardana.ElementType`, :class:`~sardana.pool.poolmetacontroller.TypeData`>
-TYPE_MAP_OBJ = {}
-for t, d in TYPE_MAP.items():
- o = TypeData(type=t, name=d[0], family=d[1], klass=d[2] ,
- auto_full_name=d[3], ctrl_klass=d[4])
- TYPE_MAP_OBJ[t] = o
-
-
-class ControllerLibrary(SardanaLibrary):
- """Object representing a python module containning controller classes.
- Public members:
-
- - module - reference to python module
- - f_path - complete (absolute) path and filename
- - f_name - filename (including file extension)
- - path - complete (absolute) path
- - name - module name (without file extension)
- - controller_list - list<ControllerClass>
- - exc_info - exception information if an error occured when loading
- the module
- """
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('pool')
- kwargs['elem_type'] = ElementType.ControllerLibrary
- SardanaLibrary.__init__(self, **kwargs)
-
- add_controller = SardanaLibrary.add_meta_class
- get_controller = SardanaLibrary.get_meta_class
- get_controllers = SardanaLibrary.get_meta_classes
- has_controller = SardanaLibrary.has_meta_class
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaLibrary.serialize(self, *args, **kwargs)
- kwargs['pool'] = self.get_manager().name
- kwargs['id'] = InvalidId
- return kwargs
-
- @property
- def controllers(self):
- return self.meta_classes
-
-
-class DataInfo(object):
-
- def __init__(self, name, dtype, dformat=DataFormat.Scalar,
- access=DataAccess.ReadWrite, description="",
- default_value=None, memorized='true',
- fget=None, fset=None, maxdimsize=None):
- self.name = name
- self.dtype = dtype
- self.dformat = dformat
- self.access = access
- self.description = description
- self.default_value = default_value
- self.memorized = memorized
- self.fget = fget or "get%s" % name
- self.fset = fset or "set%s" % name
- if maxdimsize == None:
- if dformat == DataFormat.Scalar:
- maxdimsize = ()
- elif dformat == DataFormat.OneD:
- maxdimsize = 2048,
- elif dformat == DataFormat.TwoD:
- maxdimsize = 2048, 2048
- self.maxdimsize = maxdimsize
-
- def copy(self):
- s = self
- d = DataInfo(s.name, s.dtype, dformat=s.dformat, access=s.access,
- description=s.description, default_value=s.default_value,
- memorized=s.memorized, fget=s.fget, fset=s.fset,
- maxdimsize=self.maxdimsize)
- return d
-
- @classmethod
- def toDataInfo(klass, name, info):
- info = CaselessDict(info)
- dtype = info[Type]
- dtype, dformat = to_dtype_dformat(dtype)
- default_value = info.get(DefaultValue)
- description = info.get(Description, '')
- daccess = info.get(Access, DataAccess.ReadWrite)
- daccess = to_daccess(daccess)
- memorized = info.get(Memorize, Memorized)
- maxdimsize = info.get(MaxDimSize)
- fget = info.get(FGet)
- fset = info.get(FSet)
- if default_value is not None and dtype != DataType.String:
- if type(default_value) in types.StringTypes:
- default_value = eval(default_value)
- return DataInfo(name, dtype, dformat=dformat, access=daccess,
- description=description, default_value=default_value,
- memorized=memorized, fget=fget, fset=fset,
- maxdimsize=maxdimsize)
-
- def toDict(self):
- return { 'name' : self.name, 'type' : DataType.whatis(self.dtype),
- 'format' : DataFormat.whatis(self.dformat),
- 'access' : DataAccess.whatis(self.access),
- 'description' : self.description,
- 'default_value' : self.default_value,
- 'memorized' : self.memorized,
- 'maxdimsize' : self.maxdimsize }
-
- def serialize(self, *args, **kwargs):
- kwargs.update(self.toDict())
- return kwargs
-
- def __repr__(self):
- return "{0}(name={1}, type={2}, format={3}, access={4})".format(
- self.__class__.__name__, self.name, DataType[self.dtype],
- DataFormat[self.dformat], DataAccess[self.access])
-
-#class PropertyInfo(DataInfo):
-
-# def __init__(self, name, dtype, dformat=DataFormat.Scalar,
-# description="", default_value=None):
-# DataInfo.__init__(self, name, dtype, dformat, access=DataAcces.ReadWrite,
-# description=description, default_value=default_value)
-
-
-#class AttributeInfo(DataInfo):
-
-# def __init__(self, name, dtype, dformat=DataFormat.Scalar,
-# access=DataAccess.ReadWrite, description=""):
-# DataInfo.__init__(self, name, dtype, dformat, access=DataAcces.ReadWrite,
-# description=description, default_value=None)
-
-class ControllerClass(SardanaClass):
- """Object representing a python controller class.
- Public members:
-
- - name - class name
- - klass - python class object
- - lib - ControllerLibrary object representing the module where the
- controller is."""
-
- def __init__(self, **kwargs):
- kwargs['manager'] = kwargs.pop('pool')
- kwargs['elem_type'] = ElementType.ControllerClass
- SardanaClass.__init__(self, **kwargs)
-
- self.types = []
- self.dict_extra = {}
- self.api_version = 1
-
- klass = self.klass
- # Generic controller information
- self.ctrl_features = tuple(klass.ctrl_features)
-
- self.ctrl_properties = props = CaselessDict()
- for k, v in klass.class_prop.items(): # old member
- props[k] = DataInfo.toDataInfo(k, v)
- for k, v in klass.ctrl_properties.items():
- props[k] = DataInfo.toDataInfo(k, v)
-
- self.ctrl_attributes = ctrl_attrs = CaselessDict()
- for k, v in klass.ctrl_attributes.items():
- ctrl_attrs[k] = DataInfo.toDataInfo(k, v)
-
- self.axis_attributes = axis_attrs = CaselessDict()
- for k, v in klass.ctrl_extra_attributes.items(): # old member
- axis_attrs[k] = DataInfo.toDataInfo(k, v)
- for k, v in klass.axis_attributes.items():
- axis_attrs[k] = DataInfo.toDataInfo(k, v)
-
- self.types = types = self.__build_types()
- self.type_names = map(ElementType.whatis, types)
-
- if ElementType.PseudoMotor in types:
- self.motor_roles = tuple(klass.motor_roles)
- self.pseudo_motor_roles = tuple(klass.pseudo_motor_roles)
- if len(self.pseudo_motor_roles) == 0:
- self.pseudo_motor_roles = (klass.__name__,)
- self.dict_extra['motor_roles'] = self.motor_roles
- self.dict_extra['pseudo_motor_roles'] = self.pseudo_motor_roles
-
- if ElementType.PseudoCounter in types:
- self.counter_roles = tuple(klass.counter_roles)
- self.pseudo_counter_roles = tuple(klass.pseudo_counter_roles)
- if len(self.pseudo_counter_roles) == 0:
- self.pseudo_counter_roles = (klass.__name__,)
- self.dict_extra['counter_roles'] = self.counter_roles
- self.dict_extra['pseudo_counter_roles'] = self.pseudo_counter_roles
-
- if ElementType.IORegister in types:
- self.dict_extra['predefined_values'] = klass.predefined_values
-
- init_args = inspect.getargspec(klass.__init__)
- if init_args.varargs is None or init_args.keywords is None:
- self.api_version = 0
-
- def __build_types(self):
- types = []
- klass = self.klass
- for _type, type_data in TYPE_MAP_OBJ.items():
- if not _type in TYPE_ELEMENTS:
- continue
- if issubclass(klass, type_data.ctrl_klass):
- types.append(_type)
- return types
-
- def serialize(self, *args, **kwargs):
- kwargs = SardanaClass.serialize(self, *args, **kwargs)
- kwargs['id'] = InvalidId
- kwargs['pool'] = self.get_manager().name
- kwargs['gender'] = self.gender
- kwargs['model'] = self.model
- kwargs['organization'] = self.organization
- kwargs['types'] = self.type_names
- if len(self.type_names):
- kwargs['main_type'] = self.type_names[0]
- else:
- kwargs['main_type'] = None
- kwargs['api_version'] = self.api_version
- kwargs.update(self.dict_extra)
- return kwargs
-
- @property
- def controller_class(self):
- return self.klass
-
- @property
- def gender(self):
- return self.klass.gender
-
- @property
- def model(self):
- return self.klass.model
-
- @property
- def organization(self):
- return self.klass.organization
-
-
diff --git a/src/sardana/pool/poolmonitor.py b/src/sardana/pool/poolmonitor.py
deleted file mode 100644
index 92bf9568..00000000
--- a/src/sardana/pool/poolmonitor.py
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This file contains the pool monitor class"""
-
-__all__ = ["PoolMonitor"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-import threading
-
-from taurus.core.util.log import Logger
-
-from sardana import ElementType, TYPE_PSEUDO_ELEMENTS
-
-from sardana.pool.poolobject import PoolObject
-
-
-class PoolMonitor(Logger, threading.Thread):
-
- MIN_THREADS = 1
- MAX_THREADS = 10
-
- def __init__(self, pool, name='PoolMonitor', period=5.0, min_sleep=1.0,
- auto_start=True):
- Logger.__init__(self, name)
- threading.Thread.__init__(self, name=name)
- self.daemon = True
- self._period = period
- self._min_sleep = min_sleep
- self._pool = pool
- self._stop = False
- self._pause = threading.Event()
- self._thread_pool = None
- self._ctrl_ids = []
- self._elem_ids = []
- pool.add_listener(self.on_pool_changed)
- if not auto_start:
- self.pause()
- self.start()
-
- def on_pool_changed(self, evt_src, evt_type, evt_value):
- evt_name = evt_type.name.lower()
- if "created" in evt_name or "deleted" in evt_name:
- pool = self._pool
- pool_ctrls = pool.get_elements_by_type(ElementType.Controller)
- pool_ctrls.sort(key=PoolObject.get_id)
- ctrl_ids = []
- elem_ids = []
- for pool_ctrl in pool_ctrls:
- if not pool_ctrl.is_online():
- continue
- types = set(pool_ctrl.get_ctrl_types())
- if types.isdisjoint(TYPE_PSEUDO_ELEMENTS):
- ctrl_ids.append(pool_ctrl.id)
- elem_ids.extend(pool_ctrl.get_element_ids().keys())
- elem_ids.sort()
- self._elem_ids = elem_ids
- self._ctrl_ids = ctrl_ids
-
- def update_state_info(self):
- """Update state information of every element."""
-
- pool = self._pool
- elems, ctrls, ctrl_items = [], [], {}
- try:
- blocked_ctrls = set()
- for elem_id in self._elem_ids:
- elem = pool.get_element_by_id(elem_id)
- ctrl = elem.controller
- if elem.is_in_operation():
- blocked_ctrls.add(ctrl)
- continue
- if ctrl in blocked_ctrls:
- continue
- ret = elem.lock(blocking=False)
- if ret:
- elems.append(elem)
- ctrl_elems = ctrl_items.get(ctrl)
- if ctrl_elems is None:
- ctrl_items[ctrl] = ctrl_elems = []
- ctrl_elems.append(elem)
- else:
- blocked_ctrls.add(ctrl)
-
- for ctrl, ctrl_elems in ctrl_items.items():
- ret = ctrl.lock(blocking=False)
- if ret:
- ctrls.append(ctrl)
- else:
- for elem in reversed(ctrl_elems):
- elem.unlock()
- elems.remove(elem)
-
- self._update_state_info_serial(ctrl_items)
- finally:
- for ctrl in reversed(ctrls):
- ctrl.unlock()
- for elem in reversed(elems):
- elem.unlock()
-
- def _update_state_info_serial(self, pool_ctrls):
- for pool_ctrl, elems in pool_ctrls.items():
- self._update_ctrl_state_info(pool_ctrl, elems)
-
- def _update_ctrl_state_info(self, pool_ctrl, elems):
- axes = [elem.axis for elem in elems]
- state_infos, exc_info = pool_ctrl.raw_read_axis_states(axes)
- if len(exc_info):
- self.info("STATE ERROR %s", exc_info)
- for elem, state_info in state_infos.items():
- state_info = elem._from_ctrl_state_info(state_info)
- elem.set_state_info(state_info)
-
- def stop(self):
- self.resume()
- self._stop = True
-
- def pause(self):
- self._pause.clear()
-
- def resume(self):
- self._pause.set()
-
- def monitor(self):
- ret = self.update_state_info()
-
- def run(self):
- nap_time = period = self._period
- i, startup = 0, time.time()
- while True:
- if self._stop:
- break
- time.sleep(nap_time)
- self._pause.wait()
- self.monitor()
- finish = time.time()
- nap_time = -1
- while nap_time < 0:
- i += 1
- nap_time = (startup + i * self._period) - finish
diff --git a/src/sardana/pool/poolmotion.py b/src/sardana/pool/poolmotion.py
deleted file mode 100644
index 210675bd..00000000
--- a/src/sardana/pool/poolmotion.py
+++ /dev/null
@@ -1,503 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the class for a
-motion"""
-
-__all__ = ["MotionState", "MotionMap", "PoolMotion", "PoolMotionItem"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from taurus.core.util.log import DebugIt
-from taurus.core.util.enumeration import Enumeration
-
-from sardana import State
-from sardana.pool.poolaction import ActionContext, PoolActionItem, PoolAction
-
-#: enumeration representing possible motion states
-MotionState = Enumeration("MotionSate", (\
- "Stopped",
-# "StoppedOnError",
-# "StoppedOnAbort",
- "Moving",
- "MovingBacklash",
- "MovingInstability",
- "Invalid"))
-
-MS = MotionState
-MovingStates = MS.Moving, MS.MovingBacklash, MS.MovingInstability
-StoppedStates = MS.Stopped, #MS.StoppedOnError, MS.StoppedOnAbort
-
-#MotionAction = Enumeration("MotionAction", ( \
-# "StartMotion",
-# "Finish",
-# "Abort",
-# "NoAction",
-# "Invalid") )
-
-#MA = MotionAction
-
-MotionMap = {
- #MS.Stopped : State.On,
- MS.Moving : State.Moving,
- MS.MovingBacklash : State.Moving,
- MS.MovingInstability : State.Moving,
- MS.Invalid : State.Invalid,
-}
-
-
-class PoolMotionItem(PoolActionItem):
- """An item involved in the motion. Maps directly to a motor object"""
-
- def __init__(self, moveable, position, dial_position, do_backlash,
- backlash, instability_time=None):
- PoolActionItem.__init__(self, moveable)
- self.position = position
- self.interrupted = False
- self.dial_position = dial_position
- self.do_backlash = do_backlash
- self.backlash = backlash
- self.instability_time = instability_time
- self.old_motion_state = MS.Invalid
- self.motion_state = MS.Stopped
- self.start_time = None
- self.stop_time = None
- self.stop_final_time = None
- self.old_state_info = State.Invalid, "Uninitialized", \
- (False, False, False)
- self.state_info = State.On, "Uninitialized", (False, False, False)
-
- def has_instability_time(self):
- return self.instability_time is not None
-
- def in_motion(self):
- return self.motion_state in MovingStates
-
- def get_moveable(self):
- return self.element
-
- moveable = property(fget=get_moveable)
-
- def get_state_info(self):
- si = self.state_info
- return MotionMap.get(self.motion_state, si[0]), si[1], si[2]
-
- def start(self, new_state):
- self.old_state_info = self.state_info
- self.state_info = new_state, self.state_info[1], self.state_info[2]
-
- def stopped(self, timestamp):
- self.stop_time = timestamp
- if self.instability_time is None:
- self.stop_final_time = timestamp
- new_ms = MS.Stopped
- else:
- new_ms = MS.MovingInstability
- return new_ms
-
- def handle_instability(self, timestamp):
- new_ms = MS.MovingInstability
- dt = timestamp - self.stop_time
- if dt >= self.instability_time:
- self.stop_final_time = timestamp
- new_ms = MS.Stopped
- return new_ms
-
- def on_state_switch(self, state_info, timestamp=None):
- if timestamp is None:
- timestamp = time.time()
- self.old_state_info = self.state_info
- self.state_info = state_info
- old_state = self.old_state_info[0]
- state = state_info[0]
- new_ms = ms = self.motion_state
- moveable = self.moveable
- self.interrupted = moveable.was_interrupted()
-
- if self.interrupted:
- if ms == MS.MovingInstability:
- new_ms = self.handle_instability(timestamp)
- elif state == State.Moving:
- new_ms = MS.Moving
- elif old_state == State.Moving:
- new_ms = self.stopped(timestamp)
- elif ms == MS.Stopped:
- if state == State.Moving:
- self.start_time = timestamp
- new_ms = MS.Moving
- elif ms == MS.Moving:
- if state != State.Moving:
- if self.do_backlash and state == State.On:
- new_ms = MS.MovingBacklash
- else:
- new_ms = self.stopped(timestamp)
- elif ms == MS.MovingBacklash:
- if state != State.Moving:
- new_ms = self.stopped(timestamp)
- elif ms == MS.MovingInstability:
- new_ms = self.handle_instability(timestamp)
- self.old_motion_state, self.motion_state = ms, new_ms
- return ms, new_ms
-
-_NON_ERROR_STATES = State.On, State.Moving, State.Running
-
-class PoolMotion(PoolAction):
- """This class manages motion actions"""
-
- def __init__(self, main_element, name="GlobalMotion"):
- PoolAction.__init__(self, main_element, name)
- self._motion_info = None
- self._motion_sleep_time = None
- self._nb_states_per_position = None
-
- def _recover_start_error(self, ctrl, meth_name, read_state=False):
- self.error("%s throws exception on %s. Stopping...", ctrl, meth_name)
- self.debug("Details:", exc_info=1)
-
- self.emergency_break()
-
- if read_state:
- states = {}
- self.read_state_info(ret=states)
- for moveable, state_info in states.items():
- state_info = moveable._from_ctrl_state_info(state_info)
- moveable._set_state_info(state_info)
-
- def pre_start_all(self, pool_ctrls):
- # PreStartAll on all controllers
- for pool_ctrl in pool_ctrls:
- try:
- pool_ctrl.ctrl.PreStartAll()
- except:
- self._recover_start_error(pool_ctrl, "PreStartAll")
- raise
-
- def pre_start_one(self, moveables, items):
- # PreStartOne on all elements
- for moveable in moveables:
- pool_ctrl = moveable.controller
- ctrl, axis = pool_ctrl.ctrl, moveable.axis
- dial = items[moveable][1]
- ret = ctrl.PreStartOne(axis, dial)
- if not ret:
- try:
- msg = "%s.PreStartOne(%s(%d), %f) returns False" \
- % (pool_ctrl.name, moveable.name, axis, dial)
- raise Exception(msg)
- except:
- self._recover_start_error(pool_ctrl, "PreStartOne")
- raise
-
- def start_one(self, moveables, motion_info):
- # StartOne on all elements
- for moveable in moveables:
- pool_ctrl = moveable.controller
- ctrl = pool_ctrl.ctrl
- axis = moveable.axis
- dial_position = motion_info[moveable].dial_position
- try:
- ctrl.StartOne(axis, dial_position)
- except:
- self._recover_start_error(pool_ctrl, "StartOne")
- raise
-
- def start_all(self, pool_ctrls, moveables, motion_info):
- # Change the state to Moving
- for moveable in moveables:
- moveable_info = motion_info[moveable]
- moveable.set_state(State.Moving, propagate=2)
- state_info = moveable.inspect_state(), \
- moveable.inspect_status(), \
- moveable.inspect_limit_switches()
- moveable_info.on_state_switch(state_info)
-
- # StartAll on all controllers
- for pool_ctrl in pool_ctrls:
- try:
- pool_ctrl.ctrl.StartAll()
- except:
- self._recover_start_error(pool_ctrl, "StartOne",
- read_state=True)
- raise
-
- def start_action(self, *args, **kwargs):
- """kwargs['items'] is a dict<moveable, (pos, dial, do_backlash, backlash)
- """
- items = kwargs.pop("items")
-
- pool = self.pool
-
- # prepare data structures
- self._aborted = False
- self._stopped = False
- self._motion_sleep_time = kwargs.pop("motion_sleep_time",
- pool.motion_loop_sleep_time)
- self._nb_states_per_position = \
- kwargs.pop("nb_states_per_position",
- pool.motion_loop_states_per_position)
-
- self._motion_info = motion_info = {}
- for moveable, motion_data in items.items():
- it = moveable.instability_time
- motion_info[moveable] = PoolMotionItem(moveable, *motion_data,
- instability_time=it)
-
- pool_ctrls = self.get_pool_controller_list()
- moveables = self.get_elements()
-
- with ActionContext(self):
- self.pre_start_all(pool_ctrls)
- self.pre_start_one(moveables, items)
- self.start_one(moveables, motion_info)
- self.start_all(pool_ctrls, moveables, motion_info)
-
- def backlash_item(self, motion_item):
- moveable = motion_item.moveable
- controller = moveable.controller
- axis = moveable.axis
- position = motion_item.backlash
- try:
- controller.move({axis: position})
- except:
- self.warning("could not start backlash on %s", moveable.name,
- exc_info=1)
-
- @DebugIt()
- def action_loop(self):
- i = 0
- states, positions = {}, {}
- for k in self.get_elements():
- states[k] = None
- positions[k] = None
-
- nap = self._motion_sleep_time
- nb_states_per_pos = self._nb_states_per_position
- motion_info = self._motion_info
- emergency_stop = set()
-
- # read positions to send a first event when starting to move
- #with ActionContext(self) as context:
- # positions = self.raw_read_dial_position()
- # position_error_occured = self._position_error_occured(positions)
- # if position_error_occured:
- # self.error("Pre-loop read position error")
- # self.emergency_break()
- # for moveable, position_info in positions.items():
- # if position_info[1] is not None:
- # self.error("%s error reading position",moveable.name)
- # self.debug("Details:", exc_info=position_info[1])
- #
- # # send position
- # for moveable, position_info in positions.items():
- # moveable.put_dial_position(position_info, propagate=2)
- # position = moveable.get_position(propagate=0)
- # if position.in_error():
- # emergency_stop.add(moveable)
- #
- # # send state
- # self.read_state_info(ret=states)
- # for moveable, state_info in states.items():
- # state_info = moveable._from_ctrl_state_info(state_info)
- # state_info = list(state_info)
- # state_info[0] = State.Fault
- # moveable.set_state_info(state_info, propagate=2)
- # return
- # else:
- # for moveable, position_info in positions.items():
- # moveable.put_dial_position(position_info)
-
- while True:
- self.read_state_info(ret=states)
- state_error_occured = self._state_error_occured(states)
- timestamp = time.time()
- in_motion = False
- for moveable, state_info in states.items():
- motion_item = motion_info[moveable]
- state_info = moveable._from_ctrl_state_info(state_info)
-
- state, status, limit_switches = state_info
- old_motion_state, motion_state = \
- motion_item.on_state_switch(state_info,
- timestamp=timestamp)
- real_state_info = motion_item.get_state_info()
- moving = motion_item.in_motion()
-
- # Something wrong happened: Stop all motors and report
- if state_error_occured:
- in_motion = False
- emergency_stop.add(moveable)
-
- start_backlash = motion_state == MS.MovingBacklash and \
- old_motion_state != MS.MovingBacklash
- start_instability = motion_state == MS.MovingInstability and \
- old_motion_state != MS.MovingInstability
- stopped_now = not moving and old_motion_state in MovingStates
-
- # make sure the state is placed in the motor
- moveable.put_state_info(real_state_info)
-
- if emergency_stop:
- continue
-
- # if motor stopped 'well' and there is a backlash to do...
- if start_backlash:
- moveable.debug("Starting backlash")
- # make sure the last position after the first motion is
- # sent before starting the backlash motion
- moveable.get_position(cache=False, propagate=2)
- self.backlash_item(motion_item)
- moving = motion_item.in_motion()
- elif start_instability:
- moveable.debug("Starting to wait for instability")
- # make sure the last position after the first motion is
- # sent before starting the backlash motion
- moveable.get_position(cache=False, propagate=2)
- elif stopped_now:
- moveable.debug("Stopped")
-
- # try to read a last position to force an event
- moveable.get_position(cache=False, propagate=2)
-
- ## free the motor from the OperationContext so we can send
- ## a state event. Otherwise we may be asked to move the
- ## motor again which would result in an exception saying
- ## that the motor is already involved in an operation
- ## ... but before protect the motor so that the monitor
- ## doesn't come in between the two instructions below and
- ## send a state event on it's own
- #with moveable:
- # moveable.clear_operation()
- moveable.set_state_info(real_state_info, propagate=2)
-
- # Then update the state
- if not stopped_now:
- moveable.set_state_info(real_state_info, propagate=1)
-
- if moving:
- in_motion = True
-
- if not in_motion:
- if state_error_occured:
- self.error("Loop read state error")
- self.emergency_break()
-
- # send positions
- self.read_dial_position(ret=positions)
- position_error_occured = self._position_error_occured(positions)
- if position_error_occured:
- self.error("Loop final read position error. "
- "Retrying...")
- self.read_dial_position(ret=positions)
- position_error_occured = self._position_error_occured(positions)
- if position_error_occured:
- self.error("Loop final read position error 2. "
- "Cannot send final position event!!!")
-
- for moveable, position_info in positions.items():
- moveable.put_dial_position(position_info, propagate=2)
-
- # send state
- for moveable in states:
- if moveable not in emergency_stop:
- moveable.get_state(cache=False, propagate=2)
- else:
- motion_item = motion_info[moveable]
- real_state_info = motion_item.get_state_info()
- moveable.set_state_info(real_state_info,
- propagate=2)
- break
-
- # read position every n times
- if not i % nb_states_per_pos:
- self.read_dial_position(ret=positions)
- # send position
- for moveable, position_value in positions.items():
- if position_value.error:
- self.error("Loop read position error for %s" % moveable.name)
- moveable.put_dial_position(position_value)
- i += 1
- time.sleep(nap)
-
- def _state_error_occured(self, d):
- for _, (state_info, exc_info) in d.items():
- state = state_info[0]
- if exc_info is not None or state not in _NON_ERROR_STATES:
- return True
- return False
-
- def _position_error_occured(self, positions):
- for _, value in positions.items():
- if value.error:
- return True
-
- def _recover_moving_error(self, location, emergency_stop):
- emergency_names = [moveable.name for moveable in emergency_stop]
- self.error("%s: error on %s", location, emergency_names)
-
- # stop everything
- self.emergency_break()
-
- def _recover_position_moving_error(self, location, emergency_stop,
- positions):
- self._recover_moving_error(location, emergency_stop)
-
- # send state
- states = {}
- self.read_state_info(ret=states)
- motion_info = self._motion_info
- for moveable in states:
- if moveable not in emergency_stop:
- moveable.get_state(cache=False, propagate=2)
- else:
- motion_item = motion_info[moveable]
- real_state_info = motion_item.get_state_info()
- moveable.set_state_info(real_state_info, propagate=2)
-
- def _recover_state_moving_error(self, location, emergency_stop, states):
- self._recover_moving_error(location, emergency_stop)
-
- # send positions
- positions = {}
- self.read_dial_position(ret=positions)
- for moveable, position_info in positions.items():
- moveable.put_dial_position(position_info, propagate=2)
-
- motion_info = self._motion_info
- # send state
- for moveable in states:
- if moveable not in emergency_stop:
- moveable.get_state(cache=False, propagate=2)
- else:
- motion_item = motion_info[moveable]
- real_state_info = motion_item.get_state_info()
- moveable.set_state_info(real_state_info, propagate=2)
-
- def read_dial_position(self, ret=None, serial=False):
- return self.read_value(ret=ret, serial=serial)
-
- def raw_read_dial_position(self, ret=None, serial=False):
- return self.raw_read_value(ret=ret, serial=serial)
diff --git a/src/sardana/pool/poolmotor.py b/src/sardana/pool/poolmotor.py
deleted file mode 100644
index a99aa90f..00000000
--- a/src/sardana/pool/poolmotor.py
+++ /dev/null
@@ -1,783 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for"""
-
-__all__ = ["PoolMotor"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-import math
-
-from sardana import EpsilonError, State, ElementType
-from sardana.sardanaattribute import SardanaAttribute, ScalarNumberAttribute, \
- SardanaSoftwareAttribute
-from sardana.sardanaevent import EventType
-from sardana.sardanautils import assert_type, is_number
-from sardana.pool.poolelement import PoolElement
-from sardana.pool.poolmotion import PoolMotion, MotionState
-
-
-class Position(SardanaAttribute):
-
- def __init__(self, *args, **kwargs):
- super(Position, self).__init__(*args, **kwargs)
- self.get_offset().add_listener(self.on_change)
- self.get_sign().add_listener(self.on_change)
- self.get_dial().add_listener(self.on_change)
-
- def get_dial(self):
- return self.obj.get_dial_position_attribute()
-
- def get_offset(self):
- return self.obj.get_offset_attribute()
-
- def get_sign(self):
- return self.obj.get_sign_attribute()
-
- def _in_error(self):
- return self.get_dial().in_error()
-
- def _has_value(self):
- return self.get_dial().has_value()
-
- def _has_write_value(self):
- return self.get_dial().has_write_value()
-
- def _get_value(self):
- return self.calc_position()
-
- def _get_write_value(self):
- dial = self.get_dial().get_write_value()
- return self.calc_position(dial=dial)
-
- def _set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- raise Exception("Cannot set position value for %s" % self.obj.name)
-
- def _set_write_value(self, w_value, timestamp=None, propagate=1):
- # let the write value be stored by dial using the current offset and
- # sign. This way, retrieving the write value is done in reverse applying
- # the offset and sign in use at that time
- w_dial = self.calc_dial_position(w_value)
- self.get_dial().set_write_value(w_dial, timestamp=timestamp, propagate=0)
- self.fire_write_event(propagate=propagate)
-
- def _get_exc_info(self):
- return self.get_dial().get_exc_info()
-
- def _get_timestamp(self):
- return self.get_dial().get_timestamp()
-
- def _get_write_timestamp(self):
- return self.get_dial().get_write_timestamp()
-
- def calc_position(self, dial=None):
- """Returns the computed position from last the dial position from the
- given parameter or (if None), the last dial position obtained from
- hardware read.
-
- :param dial: the new dial position [default: None, meaning use the
- current dial position.
- :return: the computed user position
- :rtype: obj
-
- :raises:
- :exc:`Exception` if dial_position is None and no read value has
- been set yet"""
- obj = self.obj
- if dial is None:
- dial_attr = obj.dial_position
- if dial_attr.in_error():
- raise dial_attr.exc_info[1]
- dial = dial_attr.value
- if not is_number(dial):
- raise Exception("Controller returns not a number %s" % dial)
- sign, offset = obj.sign.value, obj.offset.value
- return sign * dial + offset
-
- def calc_dial_position(self, position=None):
- """Returns the dial position for the given position. If position is
- not given (or is None) it uses this object's *write* value.
-
- :param position:
- the position to be converted to dial [default: None meaning use the
- this attribute's *write* value
- :type position: obj
- :return: the computed dial position
- :rtype: obj"""
- obj = self.obj
- if position is None:
- position = self.w_value
- sign, offset = obj.sign.value, obj.offset.value
- return (position - offset) / sign
-
- def calc_motion(self, new_position):
- """Calculate the motor position, dial position, backlash for the
- given final position."""
- obj = self.obj
- ctrl = obj.controller
- step_per_unit = obj._step_per_unit
- backlash = obj._backlash
-
- # compute dial position
- new_dial = self.calc_dial_position(new_position)
-
- # add backlash if necessary
- do_backlash = False
-
- if obj.has_backlash() and not ctrl.has_backlash():
- dial_attr = self.get_dial()
-
- if dial_attr.in_error():
- raise dial_attr.get_exc_info()[1]
-
- old_dial = dial_attr.value
- displacement = new_dial - old_dial
-
- if math.fabs(displacement) > EpsilonError:
- positive_displacement = displacement > 0
- positive_backlash = self.is_backlash_positive()
- do_backlash = positive_backlash != positive_displacement
- if do_backlash:
- new_dial = new_dial - backlash / step_per_unit
-
- # compute a rounding value if necessary
- if ctrl.wants_rounding():
- nb_step = round(new_dial * step_per_unit)
- new_dial = nb_step / step_per_unit
-
- backlash_position = new_dial
- if do_backlash:
- backlash_position = new_dial + backlash / step_per_unit
-
- return new_position, new_dial, do_backlash, backlash_position
-
- def on_change(self, evt_src, evt_type, evt_value):
- self.fire_read_event(propagate=evt_type.priority)
-
- def update(self, cache=True, propagate=1):
- self.get_dial().update(cache=cache, propagate=propagate)
-
-
-class DialPosition(ScalarNumberAttribute):
-
- def update(self, cache=True, propagate=1):
- if not cache or not self.has_value():
- dial_position_value = self.obj.read_dial_position()
- self.set_value(dial_position_value, propagate=propagate)
-
-
-class LimitSwitches(ScalarNumberAttribute):
- pass
-
-
-class Offset(SardanaSoftwareAttribute):
- pass
-
-
-class Sign(SardanaSoftwareAttribute):
- pass
-
-
-class PoolMotor(PoolElement):
- """An internal Motor object. **NOT** part of the official API. Accessing
- this object from a controller plug-in may lead to undetermined behavior
- like infinite recursion."""
-
- def __init__(self, **kwargs):
- kwargs['elem_type'] = ElementType.Motor
- PoolElement.__init__(self, **kwargs)
- on_change = self.on_change
- self._offset = Offset(self, initial_value=0, listeners=on_change)
- self._sign = Sign(self, initial_value=1, listeners=on_change)
- self._dial_position = DialPosition(self, listeners=on_change)
- self._position = Position(self, listeners=on_change)
- self._backlash = 0
- self._step_per_unit = 1.0
- self._limit_switches = LimitSwitches(self, name="Limit_switches",
- initial_value=3 * (False,),
- listeners=on_change)
- self._acceleration = None
- self._deceleration = None
- self._velocity = None
- self._base_rate = None
- self._instability_time = None
- self._in_start_move = False
- motion_name = "%s.Motion" % self._name
- self.set_action_cache(PoolMotion(self, motion_name))
-
- # --------------------------------------------------------------------------
- # Event forwarding
- # --------------------------------------------------------------------------
-
- def on_change(self, evt_src, evt_type, evt_value):
- # forward all events coming from attributes to the listeners
- self.fire_event(evt_type, evt_value)
-
- # --------------------------------------------------------------------------
- # state information
- # --------------------------------------------------------------------------
-
- def _from_ctrl_state_info(self, state_info):
- state_info, _ = state_info
-
- try:
- state_str = State.whatis(state_info)
- return int(state_info), "{0} is in {1}".format(self.name, state_str), 0
- except KeyError:
- pass
-
- if len(state_info) > 2:
- state, status, ls = state_info[:3]
- else:
- state, other = state_info[:2]
- if is_number(other):
- ls, status = other, ''
- else:
- ls, status = 0, other
- state, ls = int(state), tuple(map(bool, (ls & 1, ls & 2, ls & 4)))
- return state, status, ls
-
- def _set_state_info(self, state_info, propagate=1):
- PoolElement._set_state_info(self, state_info, propagate=propagate)
- ls = state_info[-1]
- if self._sign.value < 0:
- ls = ls[0], ls[2], ls[1]
- self._set_limit_switches(ls, propagate=propagate)
-
- # --------------------------------------------------------------------------
- # state information
- # --------------------------------------------------------------------------
-
- _STD_STATUS = "{name} is {state}{limit_switches}{ctrl_status}"
- def calculate_state_info(self, state_info=None):
- if state_info is None:
- state = self._state
- status = self._status
- ls = self._limit_switches.value
- else:
- state, status, ls = state_info
- if state == State.On:
- state_str = "Stopped"
- elif state == State.Moving:
- state_str = "Moving"
- motion = self.get_operation()
- if motion is None:
- state_str += " (external)"
- else:
- motion_state = motion._motion_info[self].motion_state
- if motion_state == MotionState.MovingBacklash:
- state_str += " (backlash)"
- elif motion_state == MotionState.MovingInstability:
- state_str += " (instability)"
- else:
- state_str = "in " + State[state]
-
- limit_switches = ""
- if ls[0]:
- limit_switches += ". Hit home switch"
- if ls[1]:
- limit_switches += ". Hit upper switch"
- if ls[2]:
- limit_switches += ". Hit lower switch"
-
- if len(status) > 0:
- status = "\n" + status
- new_status = self._STD_STATUS.format(name=self.name, state=state_str,
- limit_switches=limit_switches,
- ctrl_status=status)
- return state, new_status, ls
-
- # --------------------------------------------------------------------------
- # limit switches
- # --------------------------------------------------------------------------
-
- def inspect_limit_switches(self):
- """returns the current (cached value of the limit switches
-
- :return: the current limit switches flags"""
- return self._limit_switches
-
- def get_limit_switches(self, cache=True, propagate=1):
- """Returns the motor limit switches state.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the motor limit switches state
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- self.get_state(cache=cache, propagate=propagate)
- return self._limit_switches
-
- def set_limit_switches(self, ls, propagate=1):
- self._set_limit_switches(ls, propagate=propagate)
-
- def put_limit_switches(self, ls, propagate=1):
- self._limit_switches = tuple(ls)
-
- def _set_limit_switches(self, ls, propagate=1):
- self._limit_switches.set_value(tuple(ls), propagate=propagate)
-
- limit_switches = property(get_limit_switches, set_limit_switches,
- doc="motor limit switches")
-
- # --------------------------------------------------------------------------
- # instability time
- # --------------------------------------------------------------------------
-
- def has_instability_time(self, cache=True):
- it = self._instability_time
- return it is not None and it > 0.0
-
- def get_instability_time(self, cache=True):
- return self._instability_time
-
- def set_instability_time(self, instability_time, propagate=1):
- self._instability_time = instability_time
- if propagate > 0:
- self.fire_event(EventType("instability_time", priority=propagate),
- instability_time)
-
- instability_time = property(get_instability_time, set_instability_time,
- doc="motor instability time")
-
- # --------------------------------------------------------------------------
- # backlash
- # --------------------------------------------------------------------------
-
- def has_backlash(self, cache=True):
- return self._backlash != 0
-
- def is_backlash_positive(self, cache=True):
- return self._backlash > 0
-
- def is_backlash_negative(self, cache=True):
- return self._backlash < 0
-
- def get_backlash(self, cache=True):
- return self._backlash
-
- def set_backlash(self, backlash, propagate=1):
- self._backlash = backlash
- if propagate > 0:
- self.fire_event(EventType("backlash", priority=propagate), backlash)
-
- backlash = property(get_backlash, set_backlash, doc="motor backlash")
-
- # --------------------------------------------------------------------------
- # offset
- # --------------------------------------------------------------------------
-
- def get_offset_attribute(self):
- return self._offset
-
- def get_offset(self, cache=True):
- return self._offset
-
- def set_offset(self, offset, propagate=1):
- self._offset.set_value(offset, propagate=propagate)
-
- offset = property(get_offset, set_offset, doc="motor offset")
-
- # --------------------------------------------------------------------------
- # sign
- # --------------------------------------------------------------------------
-
- def get_sign_attribute(self):
- return self._sign
-
- def get_sign(self, cache=True):
- return self._sign
-
- def set_sign(self, sign, propagate=1):
- old_sign = self._sign.value
- self._sign.set_value(sign, propagate=propagate)
- # invert lower with upper limit switches and send event in case of change
- ls = self._limit_switches
- if old_sign != sign and ls.has_value():
- value = ls.value
- value = value[0], value[2], value[1]
- self._set_limit_switches(value, propagate=propagate)
-
- sign = property(get_sign, set_sign, doc="motor sign")
-
- # --------------------------------------------------------------------------
- # step per unit
- # --------------------------------------------------------------------------
-
- def get_step_per_unit(self, cache=True, propagate=1):
- if not cache or self._step_per_unit is None:
- step_per_unit = self.read_step_per_unit()
- self._set_step_per_unit(step_per_unit, propagate=propagate)
- return self._step_per_unit
-
- def set_step_per_unit(self, step_per_unit, propagate=1):
- if step_per_unit <= 0.0:
- raise Exception("Step per unit must be > 0.0")
- self.controller.set_axis_par(self.axis, "step_per_unit", step_per_unit)
- self._set_step_per_unit(step_per_unit, propagate=propagate)
-
- def _set_step_per_unit(self, step_per_unit, propagate=1):
- self._step_per_unit = step_per_unit
- if propagate:
- self.fire_event(EventType("step_per_unit", priority=propagate), step_per_unit)
- # force ask controller for new position to send priority event
- self.get_position(cache=False, propagate=2)
-
- def read_step_per_unit(self):
- step_per_unit = self.controller.get_axis_par(self.axis, "step_per_unit")
- assert_type(float, step_per_unit)
- return step_per_unit
-
- step_per_unit = property(get_step_per_unit, set_step_per_unit,
- doc="motor steps per unit")
-
- # --------------------------------------------------------------------------
- # acceleration
- # --------------------------------------------------------------------------
-
- def get_acceleration(self, cache=True, propagate=1):
- if not cache or self._acceleration is None:
- acceleration = self.read_acceleration()
- self._set_acceleration(acceleration, propagate=propagate)
- return self._acceleration
-
- def set_acceleration(self, acceleration, propagate=1):
- self.controller.set_axis_par(self.axis, "acceleration", acceleration)
- self._set_acceleration(acceleration, propagate=propagate)
-
- def _set_acceleration(self, acceleration, propagate=1):
- self._acceleration = acceleration
- if not propagate:
- return
- self.fire_event(EventType("acceleration", priority=propagate), acceleration)
-
- def read_acceleration(self):
- acceleration = self.controller.get_axis_par(self.axis, "acceleration")
- assert_type(float, acceleration)
- return acceleration
-
- acceleration = property(get_acceleration, set_acceleration,
- doc="motor acceleration")
-
- # --------------------------------------------------------------------------
- # deceleration
- # --------------------------------------------------------------------------
-
- def get_deceleration(self, cache=True, propagate=1):
- if not cache or self._deceleration is None:
- deceleration = self.read_deceleration()
- self._set_deceleration(deceleration, propagate=propagate)
- return self._deceleration
-
- def set_deceleration(self, deceleration, propagate=1):
- self.controller.set_axis_par(self.axis, "deceleration", deceleration)
- self._set_deceleration(deceleration, propagate=propagate)
-
- def _set_deceleration(self, deceleration, propagate=1):
- self._deceleration = deceleration
- if not propagate:
- return
- self.fire_event(EventType("deceleration", priority=propagate), deceleration)
-
- def read_deceleration(self):
- deceleration = self.controller.get_axis_par(self.axis, "deceleration")
- assert_type(float, deceleration)
- return deceleration
-
- deceleration = property(get_deceleration, set_deceleration,
- doc="motor deceleration")
- # --------------------------------------------------------------------------
- # base_rate
- # --------------------------------------------------------------------------
-
- def get_base_rate(self, cache=True, propagate=1):
- if not cache or self._base_rate is None:
- base_rate = self.read_base_rate()
- self._set_base_rate(base_rate, propagate=propagate)
- return self._base_rate
-
- def set_base_rate(self, base_rate, propagate=1):
- self.controller.set_axis_par(self.axis, "base_rate", base_rate)
- self._set_base_rate(base_rate, propagate=propagate)
-
- def _set_base_rate(self, base_rate, propagate=1):
- self._base_rate = base_rate
- if not propagate:
- return
- self.fire_event(EventType("base_rate", priority=propagate), base_rate)
-
- def read_base_rate(self):
- base_rate = self.controller.get_axis_par(self.axis, "base_rate")
- assert_type(float, base_rate)
- return base_rate
-
- base_rate = property(get_base_rate, set_base_rate,
- doc="motor base rate")
-
- # --------------------------------------------------------------------------
- # velocity
- # --------------------------------------------------------------------------
-
- def get_velocity(self, cache=True, propagate=1):
- if not cache or self._velocity is None:
- velocity = self.read_velocity()
- self._set_velocity(velocity, propagate=propagate)
- return self._velocity
-
- def set_velocity(self, velocity, propagate=1):
- self.controller.set_axis_par(self.axis, "velocity", velocity)
- self._set_velocity(velocity, propagate=propagate)
-
- def _set_velocity(self, velocity, propagate=1):
- self._velocity = velocity
- if not propagate:
- return
- self.fire_event(EventType("velocity", priority=propagate), velocity)
-
- def read_velocity(self):
- velocity = self.controller.get_axis_par(self.axis, "velocity")
- assert_type(float, velocity)
- return velocity
-
- velocity = property(get_velocity, set_velocity,
- doc="motor velocity")
-
- # --------------------------------------------------------------------------
- # position & dial position
- # --------------------------------------------------------------------------
-
- def define_position(self, position):
- dial = self.get_position_attribute().calc_dial_position(position)
- self.controller.define_position(self.axis, dial)
- # force an event with the new position
- self.get_position(cache=False, propagate=2)
-
- def get_position_attribute(self):
- """Returns the position attribute object for this motor
-
- :return: the position attribute
- :rtype: :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self._position
-
- def get_position(self, cache=True, propagate=1):
- """Returns the user position.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the user position
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- position = self._position
- position.update(cache=cache, propagate=propagate)
- return position
-
- def set_position(self, position):
- """Moves the motor to the specified user position
-
- :param position:
- the user position to move to
- :type position:
- :class:`~numbers.Number`"""
- self.start_move(position)
-
- def set_write_position(self, w_position, timestamp=None, propagate=1):
- """Sets a new write value for the user position.
-
- :param w_position:
- the new write value for user position
- :type w_position:
- :class:`~numbers.Number`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- self._position.set_write_value(w_position, timestamp=timestamp,
- propagate=propagate)
-
- def read_dial_position(self):
- """Reads the dial position from hardware.
-
- :return:
- a :class:`~sardana.sardanavalue.SardanaValue` containing the dial
- position
- :rtype:
- :class:`~sardana.sardanavalue.SardanaValue`"""
- return self.motion.read_dial_position(serial=True)[self]
-
- def put_dial_position(self, dial_position_value, propagate=1):
- """Sets a new dial position.
-
- :param dial_position_value:
- the new dial position value
- :type dial_position_value:
- :class:`~sardana.sardanavalue.SardanaValue`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- dp = self._dial_position
- dp.set_value(dial_position_value, propagate=propagate)
- return dp
-
- def get_dial_position_attribute(self):
- """Returns the dial position attribute object for this motor
-
- :return: the dial position attribute
- :rtype: :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self._dial_position
-
- def get_dial_position(self, cache=True, propagate=1):
- """Returns the dial position.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the dial position
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- dp = self._dial_position
- dp.update(cache=cache, propagate=propagate)
- return dp
-
- position = property(get_position, set_position, doc="motor user position")
- dial_position = property(get_dial_position, doc="motor dial position")
-
- # --------------------------------------------------------------------------
- # default acquisition channel
- # --------------------------------------------------------------------------
-
- def get_default_attribute(self):
- return self.get_position_attribute()
-
- # --------------------------------------------------------------------------
- # motion
- # --------------------------------------------------------------------------
-
- def get_motion(self):
- return self.get_action_cache()
-
- motion = property(get_motion, doc="motion object")
-
- # --------------------------------------------------------------------------
- # motion calculation
- # --------------------------------------------------------------------------
-
- def calculate_motion(self, new_position, items=None, calculated=None):
- """Calculate the motor position, dial position, backlash for the
- given final position. Items specifies the where to put the calculated
- values, calculated is not used by physical motors"""
-
- step_per_unit = self._step_per_unit
- backlash = self._backlash
- ctrl = self.controller
- pos_attr = self.get_position_attribute()
-
- # compute dial position
- new_dial = pos_attr.calc_dial_position(new_position)
-
- # add backlash if necessary
- do_backlash = False
-
- if self.has_backlash() and not ctrl.has_backlash():
- dial_attr = self.get_dial_position_attribute()
-
- if dial_attr.in_error():
- raise dial_attr.get_exc_info()[1]
-
- old_dial = dial_attr.value
- displacement = new_dial - old_dial
-
- if math.fabs(displacement) > EpsilonError:
- positive_displacement = displacement > 0
- positive_backlash = self.is_backlash_positive()
- do_backlash = positive_backlash != positive_displacement
- if do_backlash:
- new_dial = new_dial - backlash / step_per_unit
-
- # compute a rounding value if necessary
- if ctrl.wants_rounding():
- nb_step = round(new_dial * step_per_unit)
- new_dial = nb_step / step_per_unit
-
- backlash_position = new_dial
- if do_backlash:
- backlash_position = new_dial + backlash / step_per_unit
-
- if items is None:
- items = {}
- items[self] = new_position, new_dial, do_backlash, backlash_position
- return items
-
- def start_move(self, new_position):
- self._in_start_move = True
- try:
- return self._start_move(new_position)
- finally:
- self._in_start_move = False
-
- def _start_move(self, new_position):
- if not self._simulation_mode:
- # update the dial value from the controller in case motor has been
- # moved outside sardana.
- # TODO: also update step_per_unit
- self.get_dial_position_attribute().update(cache=False, propagate=1)
-
- # calculate the motion (dial position, backlash, etc)
- items = self.calculate_motion(new_position)
- self.debug("Start motion user=%f, dial=%f, backlash? %s, "
- "dial_backlash=%f", *items[self])
-
- timestamp = time.time()
- # update the write position
- self.set_write_position(items[self][0], timestamp=timestamp, propagate=0)
-
- # move!
- self.motion.run(items=items)
diff --git a/src/sardana/pool/poolmotorgroup.py b/src/sardana/pool/poolmotorgroup.py
deleted file mode 100644
index d845d986..00000000
--- a/src/sardana/pool/poolmotorgroup.py
+++ /dev/null
@@ -1,271 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for"""
-
-__all__ = ["PoolMotorGroup"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-import collections
-
-from sardana import ElementType
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.poolgroupelement import PoolGroupElement
-from sardana.pool.poolmotion import PoolMotion
-
-
-class Position(SardanaAttribute):
-
- def __init__(self, *args, **kwargs):
- self._w_value_map = None
- super(Position, self).__init__(*args, **kwargs)
- for pos_attr in self.obj.get_physical_position_attribute_iterator():
- pos_attr.add_listener(self.on_change)
-
- def _has_value(self):
- for pos_attr in self.obj.get_physical_position_attribute_iterator():
- if not pos_attr.has_value():
- return False
- return True
-
- def _in_error(self):
- for pos_attr in self.obj.get_physical_position_attribute_iterator():
- if pos_attr.in_error():
- return True
- return False
-
- def get_elements(self):
- return self.obj.get_user_elements()
-
- def get_element_nb(self):
- return len(self.get_user_elements())
-
- def _get_exc_info(self):
- for position_attr in self.obj.get_physical_position_attribute_iterator():
- if position_attr.error:
- return position_attr.get_exc_info()
-
- def _get_timestamp(self):
- return max([ pos_attr.timestamp for pos_attr in self.obj.get_physical_position_attribute_iterator() ])
-
- def _set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- raise Exception("Cannot set position value for motor group %s" % self.obj.name)
-
- def _get_value(self):
- return [ position.value for position in self.obj.get_physical_position_attribute_iterator() ]
-
- def _get_write_value(self):
- return [ position.w_value for position in self.obj.get_physical_position_attribute_iterator() ]
-
- def _set_write_value(self, w_value, timestamp=None, propagate=1):
- assert len(w_value) == self.get_element_nb()
- if isinstance(w_value, collections.Sequence):
- w_value_map = {}
- for v, elem in zip(w_value, self.get_elements()):
- w_value_map[elem] = v
- else:
- w_value_map = w_value
- w_value = []
- for elem in self.get_elements():
- w_value.append(w_value_map[elem])
- self._w_value_map = w_value
- super(Position, self).set_write_value(w_value, timestamp=timestamp,
- propagate=propagate)
-
- def on_change(self, evt_src, evt_type, evt_value):
- self.fire_read_event(propagate=evt_type.priority)
-
- def update(self, cache=True, propagate=1):
- if cache:
- for phy_elem_pos in self.obj.get_low_level_physical_position_attribute_iterator():
- if not phy_elem_pos.has_value():
- cache = False
- break
- if not cache:
- dial_position_values = self.obj.motion.read_dial_position(serial=True)
- for motion_obj, position_value in dial_position_values.items():
- motion_obj.put_dial_position(position_value, propagate=propagate)
-
-
-class PoolMotorGroup(PoolGroupElement):
-
- def __init__(self, **kwargs):
- self._physical_elements = []
- self._in_start_move = False
- kwargs['elem_type'] = ElementType.MotorGroup
- PoolGroupElement.__init__(self, **kwargs)
- on_change = self.on_change
- self._position = Position(self, listeners=on_change)
-
- def _create_action_cache(self):
- motion_name = "%s.Motion" % self._name
- return PoolMotion(self, motion_name)
-
- # --------------------------------------------------------------------------
- # Event forwarding
- # --------------------------------------------------------------------------
-
- def on_change(self, evt_src, evt_type, evt_value):
- # forward all events coming from attributes to the listeners
- self.fire_event(evt_type, evt_value)
-
- def on_element_changed(self, evt_src, evt_type, evt_value):
- name = evt_type.name.lower()
- if name in ('state', 'position'):
- state, status = self._calculate_states()
- if name == 'state':
- propagate_state = evt_type.priority
- else:
- propagate_state = 0
- self.set_state(state, propagate=propagate_state)
- self.set_status(status, propagate=propagate_state)
-
- def add_user_element(self, element, index=None):
- elem_type = element.get_type()
- if elem_type == ElementType.Motor:
- pass
- elif elem_type == ElementType.PseudoMotor:
- #TODO: make this happen
- pass
- else:
- raise Exception("element %s is not a motor" % element.name)
-
- PoolGroupElement.add_user_element(self, element, index=index)
-
- # --------------------------------------------------------------------------
- # position
- # --------------------------------------------------------------------------
-
- def get_position_attribute(self):
- return self._position
-
- def get_low_level_physical_position_attribute_iterator(self):
- return self.get_physical_elements_attribute_iterator()
-
- def get_physical_position_attribute_iterator(self):
- return self.get_user_elements_attribute_iterator()
-
- def get_physical_positions_attribute_sequence(self):
- return self.get_user_elements_attribute_sequence()
-
- def get_physical_positions_attribute_map(self):
- return self.get_user_elements_attribute_map()
-
- def get_position(self, cache=True, propagate=1):
- """Returns the user position.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the user position
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- position = self._position
- position.update(cache=cache, propagate=propagate)
- return position
-
- def set_position(self, positions):
- """Moves the motor group to the specified user positions
-
- :param positions:
- the user positions to move to
- :type positions:
- sequence< :class:`~numbers.Number` >"""
- self.start_move(positions)
-
- def set_write_position(self, w_position, timestamp=None, propagate=1):
- """Sets a new write value for the user position.
-
- :param w_position:
- the new write value for user position
- :type w_position:
- sequence< :class:`~numbers.Number` >
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate: int"""
- self._position.set_write_value(w_position, timestamp=timestamp,
- propagate=propagate)
-
- position = property(get_position, set_position, doc="motor group positions")
-
- # --------------------------------------------------------------------------
- # default acquisition channel
- # --------------------------------------------------------------------------
-
- def get_default_attribute(self):
- return self.get_position_attribute()
-
- # --------------------------------------------------------------------------
- # motion
- # --------------------------------------------------------------------------
-
- def get_motion(self):
- return self.get_action_cache()
-
- motion = property(get_motion, doc="motion object")
-
- # --------------------------------------------------------------------------
- # motion calculation
- # --------------------------------------------------------------------------
-
- def calculate_motion(self, new_positions, items=None):
- user_elements = self.get_user_elements()
- if items is None:
- items = {}
- calculated = {}
- for new_position, element in zip(new_positions, user_elements):
- calculated[element] = new_position
-
- for new_position, element in zip(new_positions, user_elements):
- element.calculate_motion(new_position, items=items,
- calculated=calculated)
- return items
-
- def start_move(self, new_position):
- self._in_start_move = True
- try:
- return self._start_move(new_position)
- finally:
- self._in_start_move = False
-
- def _start_move(self, new_positions):
- self._aborted = False
- items = self.calculate_motion(new_positions)
- timestamp = time.time()
- for item, position_info in items.items():
- item.set_write_position(position_info[0], timestamp=timestamp,
- propagate=0)
- if not self._simulation_mode:
- self.motion.run(items=items)
diff --git a/src/sardana/pool/poolmoveable.py b/src/sardana/pool/poolmoveable.py
deleted file mode 100644
index a05bce6f..00000000
--- a/src/sardana/pool/poolmoveable.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for moveable elements"""
-
-__all__ = ["PoolMoveable"]
-
-__docformat__ = 'restructuredtext'
-
-
-class PoolMoveable(object):
-
- def get_size(self):
- raise RuntimeError("Must be implemented in subclass")
-
- def calc_move(self, positions, ctrl_map, trust=False):
- raise RuntimeError("Must be implemented in subclass")
-
- def set_value(self, v, propagate=True):
- raise RuntimeError("Must be implemented in subclass")
-
- def get_value(self, cache=True):
- raise RuntimeError("Must be implemented in subclass")
diff --git a/src/sardana/pool/poolobject.py b/src/sardana/pool/poolobject.py
deleted file mode 100644
index 3e4c8e2f..00000000
--- a/src/sardana/pool/poolobject.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for Pool object"""
-
-__all__ = ["PoolObject"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana.sardanabase import SardanaObjectID
-from sardana.pool.poolbaseobject import PoolBaseObject
-
-
-class PoolObject(SardanaObjectID, PoolBaseObject):
- """A Pool object that besides the name and reference to the pool has:
-
- - _id : the internal identifier"""
-
- def __init__(self, **kwargs):
- SardanaObjectID.__init__(self, id=kwargs.pop('id'))
- PoolBaseObject.__init__(self, **kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolBaseObject.serialize(self, *args, **kwargs)
- kwargs = SardanaObjectID.serialize(self, *args, **kwargs)
- return kwargs
diff --git a/src/sardana/pool/poolonedexpchannel.py b/src/sardana/pool/poolonedexpchannel.py
deleted file mode 100644
index 63d93c72..00000000
--- a/src/sardana/pool/poolonedexpchannel.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for OneDExpChannel"""
-
-__all__ = ["Pool1DExpChannel"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana import ElementType
-from sardana.sardanaevent import EventType
-
-from sardana.pool.poolbasechannel import PoolBaseChannel
-
-
-class Pool1DExpChannel(PoolBaseChannel):
-
- def __init__(self, **kwargs):
- self._data_source = None
- kwargs['elem_type'] = ElementType.OneDExpChannel
- PoolBaseChannel.__init__(self, **kwargs)
-
- # -------------------------------------------------------------------------
- # data source
- # -------------------------------------------------------------------------
-
- def get_data_source(self, cache=True, propagate=1):
- if not cache or self._data_source is None:
- data_source = self.read_data_source()
- self._set_data_source(data_source, propagate=propagate)
- return self._data_source
-
- def _set_data_source(self, data_source, propagate=1):
- self._data_source = data_source
- if not propagate:
- return
- self.fire_event(EventType("data_source", priority=propagate),
- data_source)
-
- def read_data_source(self):
- data_source = self.controller.get_axis_par(self.axis, "data_source")
- return data_source
-
- data_source = property(get_data_source,
- doc="source identifier for the 1D data")
diff --git a/src/sardana/pool/poolpseudocounter.py b/src/sardana/pool/poolpseudocounter.py
deleted file mode 100644
index 5a972c56..00000000
--- a/src/sardana/pool/poolpseudocounter.py
+++ /dev/null
@@ -1,358 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the
-PoolPseudoCounter class"""
-
-__all__ = ["PoolPseudoCounter"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from sardana import State, ElementType, TYPE_PHYSICAL_ELEMENTS
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.sardanaexception import SardanaException
-from sardana.sardanavalue import SardanaValue
-from sardana.pool.poolexception import PoolException
-from sardana.pool.poolbasechannel import PoolBaseChannel
-from sardana.pool.poolbasegroup import PoolBaseGroup
-from sardana.pool.poolacquisition import PoolAcquisition
-
-
-class Value(SardanaAttribute):
-
- def __init__(self, *args, **kwargs):
- self._exc_info = None
- super(Value, self).__init__(*args, **kwargs)
- for value_attr in self.obj.get_physical_value_attribute_iterator():
- value_attr.add_listener(self.on_change)
-
- def _in_error(self):
- for value_attr in self.obj.get_physical_value_attribute_iterator():
- if value_attr.error:
- return True
- return self._exc_info != None
-
- def _has_value(self):
- for value_attr in self.obj.get_physical_value_attribute_iterator():
- if not value_attr.has_value():
- return False
- return True
-
- def _get_value(self):
- return self.calc().value
-
- def _set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- raise Exception("Cannot set value for %s" % self.obj.name)
-
- def _get_write_value(self):
- w_values = self.get_physical_write_values()
- return self.calc_pseudo(physical_values=w_values).value
-
- def _set_write_value(self, w_value, timestamp=None, propagate=1):
- raise Exception("Cannot set write value for %s" % self.obj.name)
-
- def _get_exc_info(self):
- exc_info = self._exc_info
- if exc_info is None:
- for value_attr in self.obj.get_physical_value_attribute_iterator():
- if value_attr.error:
- return value_attr.get_exc_info()
- return exc_info
-
- def _get_timestamp(self):
- timestamps = [ value_attr.timestamp for value_attr in self.obj.get_physical_value_attribute_iterator() ]
- if not len(timestamps):
- timestamps = self._local_timestamp,
- return max(timestamps)
-
- def get_physical_write_values(self):
- ret = []
- for value_attr in self.obj.get_physical_value_attribute_iterator():
- if value_attr.has_write_value():
- value = value_attr.w_value
- else:
- if not value_attr.has_value():
- # if underlying counter doesn't have value yet, it is
- # because of a cold start
- value_attr.update(propagate=0)
- if value_attr.in_error():
- raise PoolException("Cannot get '%' value" % value_attr.obj.name,
- exc_info=value_attr.exc_info)
- value = value_attr.value
- ret.append(value)
- return ret
-
- def get_physical_values(self):
- ret = []
- for value_attr in self.obj.get_physical_value_attribute_iterator():
- # if underlying channel doesn't have value yet, it is because
- # of a cold start
- if not value_attr.has_value():
- value_attr.update(propagate=0)
- if value_attr.in_error():
- raise PoolException("Cannot get '%' value" % value_attr.obj.name,
- exc_info=value_attr.exc_info)
- ret.append(value_attr.value)
- return ret
-
- def calc(self, physical_values=None):
- try:
- obj = self.obj
- if physical_values is None:
- physical_values = self.get_physical_values()
- else:
- l_v, l_u = len(physical_values), len(obj.get_user_elements())
- if l_v != l_u:
- raise IndexError("CalcPseudo(%s): must give %d physical " \
- "values (you gave %d)" % (obj.name, l_u, l_v))
- ctrl, axis = obj.controller, obj.axis
- result = ctrl.calc(axis, physical_values)
- except SardanaException as se:
- result = SardanaValue(exc_info=se.exc_info)
- except:
- result = SardanaValue(exc_info=sys.exc_info())
- return result
-
- def calc_all(self, physical_values=None):
- try:
- obj = self.obj
- if physical_values is None:
- physical_values = self.get_physical_values()
- else:
- l_v, l_u = len(physical_values), len(obj.get_user_elements())
- if l_v != l_u:
- raise IndexError("CalcAllPseudo(%s): must give %d physical " \
- "values (you gave %d)" % (obj.name, l_u, l_v))
- ctrl, axis = obj.controller, obj.axis
- result = ctrl.calc_all(axis, physical_values)
- except SardanaException as se:
- result = SardanaValue(exc_info=se.exc_info)
- except:
- result = SardanaValue(exc_info=sys.exc_info())
- return result
-
- def on_change(self, evt_src, evt_type, evt_value):
- self.fire_read_event(propagate=evt_type.priority)
-
- def update(self, cache=True, propagate=1):
- if cache:
- for phy_elem_val in self.obj.get_low_level_physical_value_attribute_iterator():
- if not phy_elem_val.has_value():
- cache = False
- break
- if not cache:
- values = self.obj.acquisition.read_value(serial=True)
- if not len(values):
- self._local_timestamp = time.time()
- for acq_obj, value in values.items():
- acq_obj.put_value(value, propagate=propagate)
-
-
-class PoolPseudoCounter(PoolBaseGroup, PoolBaseChannel):
- """A class representing a Pseudo Counter in the Sardana Device Pool"""
-
- ValueAttributeClass = Value
- AcquisitionClass = None
-
- def __init__(self, **kwargs):
- self._siblings = None
- user_elements = kwargs.pop('user_elements')
- kwargs['elem_type'] = ElementType.PseudoCounter
- # don't switch the order of constructors!
- PoolBaseGroup.__init__(self, user_elements=user_elements,
- pool=kwargs['pool'])
- PoolBaseChannel.__init__(self, **kwargs)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolBaseChannel.serialize(self, *args, **kwargs)
- elements = [ elem.name for elem in self.get_user_elements() ]
- physical_elements = []
- for elem_list in self.get_physical_elements().values():
- for elem in elem_list:
- physical_elements.append(elem.name)
- cl_name = self.__class__.__name__
- cl_name = cl_name[4:]
- kwargs['elements'] = elements
- kwargs['physical_elements'] = physical_elements
- return kwargs
-
- def on_element_changed(self, evt_src, evt_type, evt_value):
- name = evt_type.name.lower()
- # always calculate state.
- status_info = self._calculate_states()
- state, status = self.calculate_state_info(status_info=status_info)
- state_propagate = 0
- status_propagate = 0
- if name == 'state':
- state_propagate = evt_type.priority
- elif name == 'status':
- status_propagate = evt_type.priority
- self.set_state(state, propagate=state_propagate)
- self.set_status(status, propagate=status_propagate)
-
- def _create_action_cache(self):
- acq_name = "%s.Acquisition" % self._name
- return PoolAcquisition(self, acq_name)
-
- def get_action_cache(self):
- return self._get_action_cache()
-
- def set_action_cache(self, action_cache):
- self._set_action_cache(action_cache)
-
- def get_siblings(self):
- if self._siblings is None:
- self._siblings = siblings = set()
- for axis, sibling in self.controller.get_element_axis().items():
- if axis == self.axis:
- continue
- siblings.add(sibling)
- return self._siblings
-
- siblings = property(fget=get_siblings,
- doc="the siblings for this pseudo counter")
-
- # ------------------------------------------------------------------------
- # value
- # ------------------------------------------------------------------------
-
- def calc(self, physical_values=None):
- return self.get_value_attribute().calc(physical_values=physical_values)
-
- def calc_all(self, physical_values=None):
- return self.get_value_attribute().calc_all(physical_values=physical_values)
-
- def get_low_level_physical_value_attribute_iterator(self):
- return self.get_physical_elements_attribute_iterator()
-
- def get_physical_value_attribute_iterator(self):
- return self.get_user_elements_attribute_iterator()
-
- def get_physical_values_attribute_sequence(self):
- return self.get_user_elements_attribute_sequence()
-
- def get_physical_values_attribute_map(self):
- return self.get_user_elements_attribute_map()
-
- def get_physical_values(self, cache=True, propagate=1):
- """Get value for underlying elements.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the physical value
- :rtype:
- dict <PoolElement, :class:`~sardana.sardanaattribute.SardanaAttribute` >"""
- self._value.update(cache=cache, propagate=propagate)
- return self.get_physical_values_attribute_map()
-
- def get_siblings_values(self, use=None):
- """Get the last values for all siblings.
-
- :param use: the already calculated values. If a sibling is in this
- dictionary, the value stored here is used instead
- :type use: dict <PoolElement, :class:`~sardana.sardanavalue.SardanaValue` >
- :return: a dictionary with siblings values
- :rtype:
- dict <PoolElement, value(float?) >"""
- values = {}
- for sibling in self.siblings:
- value_attr = sibling.get_value_attribute()
- if use and sibling in use:
- pos = use[sibling]
- else:
- pos = value_attr.value
- values[sibling] = pos
- return values
-
- def get_value(self, cache=True, propagate=1):
- """Returns the pseudo counter value.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the pseudo counter value
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- value_attr = self._value
- value_attr.update(cache=cache, propagate=propagate)
- return value_attr
-
- def set_value(self, value, propagate=1):
- raise Exception("Not possible to set_value of a pseudo counter")
-
- value = property(get_value, doc="pseudo counter value")
-
- # --------------------------------------------------------------------------
- # state information
- # --------------------------------------------------------------------------
-
- _STD_STATUS = "{name} is {state}\n{ctrl_status}"
- def calculate_state_info(self, status_info=None):
- if status_info is None:
- status_info = self._state, self._status
- state, status = status_info
- if state == State.On:
- state_str = "Stopped"
- else:
- state_str = "in " + State[state]
- new_status = self._STD_STATUS.format(name=self.name, state=state_str,
- ctrl_status=status)
- return status_info[0], new_status
-
- def read_state_info(self, state_info=None):
- if state_info is None:
- state_info = {}
- action_cache = self.get_action_cache()
- ctrl_state_infos = action_cache.read_state_info(serial=True)
- for obj, ctrl_state_info in ctrl_state_infos.items():
- state_info[obj] = state_info = \
- obj._from_ctrl_state_info(ctrl_state_info)
- obj.put_state_info(state_info)
- for user_element in self.get_user_elements():
- if user_element.get_type() not in TYPE_PHYSICAL_ELEMENTS:
- state_info = user_element._calculate_states()
- user_element.put_state_info(state_info)
-
- ret = self._calculate_states()
- return ret
-
diff --git a/src/sardana/pool/poolpseudomotor.py b/src/sardana/pool/poolpseudomotor.py
deleted file mode 100644
index d22b5c4a..00000000
--- a/src/sardana/pool/poolpseudomotor.py
+++ /dev/null
@@ -1,583 +0,0 @@
-#!/usr/bin/env python
-from sardana.sardanavalue import SardanaValue
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the
-PoolPseudoMotor class"""
-
-__all__ = ["PoolPseudoMotor", "PoolPseudoMotorFrontend"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-import collections
-
-from sardana import State, ElementType, TYPE_PHYSICAL_ELEMENTS
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.sardanaexception import SardanaException
-
-from sardana.pool.poolbaseelement import PoolBaseElement
-from sardana.pool.poolelement import PoolElement
-from sardana.pool.poolbasegroup import PoolBaseGroup
-from sardana.pool.poolmotion import PoolMotion
-from sardana.pool.poolexception import PoolException
-
-
-class Position(SardanaAttribute):
-
- def __init__(self, *args, **kwargs):
- self._exc_info = None
- super(Position, self).__init__(*args, **kwargs)
-
- # 130226: We found a bug https://sourceforge.net/p/sardana/tickets/2/ that makes the Pool segfault with some pseudomotor configuration:
- # It can be reproduced by:
- # 4 physical motors: m1 m2 m3 m4
- # 2 slits: s1g,s1o = f(m1,m2) and s2g,s2o = f(m3,m4)
- # The pool will not be able to start if we create a third slit with s3g,s3o = f(s1g, s2g)
- # self.obj.get_physical_position_attribute_iterator() raises a KeyError exception
- # so we will flag the Position object as no_listeners for later configuration
- # We should still investigate the root of the problem when ordering the creation of elements
- self._listeners_configured = False
- try:
- for position_attr in self.obj.get_physical_position_attribute_iterator():
- position_attr.add_listener(self.on_change)
- self._listeners_configured = True
- except KeyError:
- pass
-
- def _in_error(self):
- for position_attr in self.obj.get_physical_position_attribute_iterator():
- if position_attr.error:
- return True
- return self._exc_info != None
-
- def _has_value(self):
- for position_attr in self.obj.get_physical_position_attribute_iterator():
- if not position_attr.has_value():
- return False
- return True
-
- def _has_write_value(self):
- for position_attr in self.obj.get_physical_position_attribute_iterator():
- if not position_attr.has_write_value():
- return False
- return True
-
- def _get_value(self):
- return self.calc_pseudo().value
-
- def _set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- raise Exception("Cannot set position value for %s" % self.obj.name)
-
- def _get_write_value(self):
- w_positions = self.get_physical_write_positions()
- return self.calc_pseudo(physical_positions=w_positions).value
-
- def _set_write_value(self, w_value, timestamp=None, propagate=1):
- raise Exception("Cannot set position write value for %s" % self.obj.name)
-
- def _get_exc_info(self):
- exc_info = self._exc_info
- if exc_info is None:
- for position_attr in self.obj.get_physical_position_attribute_iterator():
- if position_attr.error:
- return position_attr.get_exc_info()
- return exc_info
-
- def _get_timestamp(self):
- timestamps = [ pos_attr.timestamp for pos_attr in self.obj.get_physical_position_attribute_iterator() ]
- if not len(timestamps):
- timestamps = self._local_timestamp,
- return max(timestamps)
-
- def get_physical_write_positions(self):
- ret = []
- for pos_attr in self.obj.get_physical_position_attribute_iterator():
- if pos_attr.has_write_value():
- value = pos_attr.w_value
- else:
- if not pos_attr.has_value():
- # if underlying moveable doesn't have position yet, it is
- # because of a cold start
- pos_attr.update(propagate=0)
- if pos_attr.in_error():
- raise PoolException("Cannot get '%' position" % pos_attr.obj.name,
- exc_info=pos_attr.exc_info)
- value = pos_attr.value
- ret.append(value)
- return ret
-
- def get_physical_positions(self):
- ret = []
- for pos_attr in self.obj.get_physical_position_attribute_iterator():
- # if underlying moveable doesn't have position yet, it is because
- # of a cold start
- if not pos_attr.has_value():
- pos_attr.update(propagate=0)
- if pos_attr.in_error():
- raise PoolException("Cannot get '%' position" % pos_attr.obj.name,
- exc_info=pos_attr.exc_info)
- ret.append(pos_attr.value)
- return ret
-
- def calc_pseudo(self, physical_positions=None):
- try:
- obj = self.obj
- if physical_positions is None:
- physical_positions = self.get_physical_positions()
- else:
- l_p, l_u = len(physical_positions), len(obj.get_user_elements())
- if l_p != l_u:
- raise IndexError("CalcPseudo(%s): must give %d physical " \
- "positions (you gave %d)" % (obj.name, l_u, l_p))
- result = obj.controller.calc_pseudo(obj.axis, physical_positions, None)
- except SardanaException as se:
- result = SardanaValue(exc_info=se.exc_info)
- except:
- result = SardanaValue(exc_info=sys.exc_info())
- return result
-
- def calc_all_pseudo(self, physical_positions=None):
- try:
- obj = self.obj
- if physical_positions is None:
- physical_positions = self.get_physical_positions()
- else:
- l_p, l_u = len(physical_positions), len(obj.get_user_elements())
- if l_p != l_u:
- raise IndexError("CalcAllPseudo():: must give %d physical " \
- "positions (you gave %d)" % (l_u, l_p))
- result = obj.controller.calc_all_pseudo(physical_positions, None)
- except SardanaException as se:
- result = SardanaValue(exc_info=se.exc_info)
- except:
- result = SardanaValue(exc_info=sys.exc_info())
- return result
-
- def calc_physical(self, new_position):
- try:
- obj = self.obj
- curr_physical_positions = self.get_physical_positions()
- if isinstance(new_position, collections.Sequence):
- new_positions = new_position
- else:
- positions = obj.get_siblings_positions()
- positions[obj] = new_position
- new_positions = len(positions) * [None]
- for pseudo, position in positions.items():
- new_positions[pseudo.axis - 1] = position
-
- result = obj.controller.calc_all_physical(new_positions,
- curr_physical_positions)
- except SardanaException as se:
- result = SardanaValue(exc_info=se.exc_info)
- except:
- result = SardanaValue(exc_info=sys.exc_info())
- return result
-
- def on_change(self, evt_src, evt_type, evt_value):
- self.fire_read_event(propagate=evt_type.priority)
-
- def update(self, cache=True, propagate=1):
- if cache:
- for phy_elem_pos in self.obj.get_low_level_physical_position_attribute_iterator():
- if not phy_elem_pos.has_value():
- cache = False
- break
- if not cache:
- dial_position_values = self.obj.motion.read_dial_position(serial=True)
- if not len(dial_position_values):
- self._local_timestamp = time.time()
- for motion_obj, position_value in dial_position_values.items():
- motion_obj.put_dial_position(position_value, propagate=propagate)
-
-
-class PoolPseudoMotor(PoolBaseGroup, PoolElement):
- """A class representing a Pseudo Motor in the Sardana Device Pool"""
-
- def __init__(self, **kwargs):
- self._siblings = None
- self._in_start_move = False
- self._drift_correction = kwargs.pop('drift_correction', None)
- user_elements = kwargs.pop('user_elements')
- kwargs['elem_type'] = ElementType.PseudoMotor
- PoolElement.__init__(self, **kwargs)
- PoolBaseGroup.__init__(self, user_elements=user_elements,
- pool=kwargs['pool'])
- self._position = Position(self, listeners=self.on_change)
-
- # --------------------------------------------------------------------------
- # Event forwarding
- # --------------------------------------------------------------------------
-
- def on_change(self, evt_src, evt_type, evt_value):
- # forward all events coming from attributes to the listeners
- self.fire_event(evt_type, evt_value)
-
- def serialize(self, *args, **kwargs):
- kwargs = PoolElement.serialize(self, *args, **kwargs)
- elements = [ elem.name for elem in self.get_user_elements() ]
- physical_elements = []
- for elem_list in self.get_physical_elements().values():
- for elem in elem_list:
- physical_elements.append(elem.name)
- cl_name = self.__class__.__name__
- cl_name = cl_name[4:]
- kwargs['elements'] = elements
- kwargs['physical_elements'] = physical_elements
- return kwargs
-
- def _create_action_cache(self):
- motion_name = "%s.Motion" % self._name
- return PoolMotion(self, motion_name)
-
- def set_drift_correction(self, drift_correction):
- self._drift_correction = drift_correction
-
- def get_drift_correction(self):
- dc = self._drift_correction
- if dc is None:
- dc = self.manager.drift_correction
- return dc
-
- drift_correction = property(get_drift_correction,
- set_drift_correction,
- doc="drift correction")
-
- def get_action_cache(self):
- return self._get_action_cache()
-
- def set_action_cache(self, action_cache):
- self._set_action_cache(action_cache)
-
- def get_siblings(self):
- if self._siblings is None:
- self._siblings = siblings = set()
- for axis, sibling in self.controller.get_element_axis().items():
- if axis == self.axis:
- continue
- siblings.add(sibling)
- return self._siblings
-
- siblings = property(fget=get_siblings,
- doc="the siblings for this pseudo motor")
-
- def on_element_changed(self, evt_src, evt_type, evt_value):
- name = evt_type.name.lower()
- # always calculate state.
- status_info = self._calculate_states()
- state, status = self.calculate_state_info(status_info=status_info)
- state_propagate = 0
- status_propagate = 0
- if name == 'state':
- state_propagate = evt_type.priority
- elif name == 'status':
- status_propagate = evt_type.priority
- self.set_state(state, propagate=state_propagate)
- self.set_status(status, propagate=status_propagate)
-
- def add_user_element(self, element, index=None):
- elem_type = element.get_type()
- if elem_type == ElementType.Motor:
- pass
- elif elem_type == ElementType.PseudoMotor:
- #TODO: make this happen
- pass
- else:
- raise Exception("element %s is not a motor" % element.name)
-
- PoolBaseGroup.add_user_element(self, element, index=index)
-
- # ------------------------------------------------------------------------
- # position
- # ------------------------------------------------------------------------
-
- def calc_pseudo(self, physical_positions=None):
- return self.get_position_attribute().calc_pseudo(physical_positions=physical_positions)
-
- def calc_physical(self, new_position):
- return self.get_position_attribute().calc_physical(new_position)
-
- def calc_all_pseudo(self, physical_positions=None):
- return self.get_position_attribute().calc_all_pseudo(physical_positions=physical_positions)
-
- def get_position_attribute(self):
- return self._position
-
- def get_low_level_physical_position_attribute_iterator(self):
- return self.get_physical_elements_attribute_iterator()
-
- def get_physical_position_attribute_iterator(self):
- return self.get_user_elements_attribute_iterator()
-
- def get_physical_positions_attribute_sequence(self):
- return self.get_user_elements_attribute_sequence()
-
- def get_physical_positions_attribute_map(self):
- return self.get_user_elements_attribute_map()
-
- def get_physical_positions(self, cache=True, propagate=1):
- """Get positions for underlying elements.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the physical positions
- :rtype:
- dict <PoolElement, :class:`~sardana.sardanaattribute.SardanaAttribute` >"""
- self._position.update(cache=cache, propagate=propagate)
- return self.get_physical_positions_attribute_map()
-
- def get_siblings_positions(self, use=None, write_pos=True):
- """Get the last positions for all siblings.
- If write_pos is True and a sibling has already been moved before,
- it's last write position is used. Otherwise its read position is used
- instead.
-
- :param use: the already calculated positions. If a sibling is in this
- dictionary, the position stored here is used instead
- :type use: dict <PoolElement, :class:`~sardana.sardanavalue.SardanaValue` >
- :param write_pos: determines if should try to use the last set point
- [default: True]
- :type write_pos: bool
- :return: a dictionary with siblings write positions
- :rtype:
- dict <PoolElement, position(float?) >"""
- positions = {}
- for sibling in self.siblings:
- pos_attr = sibling.get_position(propagate=0)
- if use and sibling in use:
- pos = use[sibling]
- elif pos_attr.has_write_value() and write_pos:
- pos = pos_attr.w_value
- else:
- if pos_attr.in_error():
- raise PoolException("Cannot get '%s' position" % sibling.name,
- exc_info=pos_attr.exc_info)
- pos_value = pos_attr.calc_pseudo()
- if pos_value.error:
- raise PoolException("Cannot get '%s' position" % sibling.name,
- exc_info=pos_value.exc_info)
- pos = pos_value.value
- positions[sibling] = pos
- return positions
-
- def get_position(self, cache=True, propagate=1):
- """Returns the user position.
-
- :param cache:
- if ``True`` (default) return value in cache, otherwise read value
- from hardware
- :type cache:
- bool
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int
- :return:
- the user position
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- position_attr = self._position
- position_attr.update(cache=cache, propagate=propagate)
- return position_attr
-
- def set_position(self, position):
- """Moves the motor to the specified user position
-
- :param position:
- the user position to move to
- :type position:
- :class:`~numbers.Number`"""
- self.start_move(position)
-
- def set_write_position(self, w_position, timestamp=None, propagate=1):
- """Sets a new write value for the user position.
-
- :param w_position:
- the new write value for user position
- :type w_position:
- :class:`~numbers.Number`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- # SardanaAttribute position will raise an exception so we let it do it
- self._position.set_write_value(w_position, timestamp=timestamp,
- propagate=propagate)
-
- position = property(get_position, set_position, doc="pseudo motor position")
-
- # ------------------------------------------------------------------------
- # state information
- # ------------------------------------------------------------------------
-
- _STD_STATUS = "{name} is {state}\n{ctrl_status}"
- def calculate_state_info(self, status_info=None):
-
- # Refer to Position.__init__ method for an explanation on this 'hack'
- if not self._position._listeners_configured:
- for position_attr in self.get_physical_position_attribute_iterator():
- position_attr.add_listener(self._position.on_change)
- self._position._listeners_configured = True
-
- if status_info is None:
- status_info = self._state, self._status
- state, status = status_info
- if state == State.On:
- state_str = "Stopped"
- else:
- state_str = "in " + State[state]
- new_status = self._STD_STATUS.format(name=self.name, state=state_str,
- ctrl_status=status)
- return status_info[0], new_status
-
- def read_state_info(self, state_info=None):
- if state_info is None:
- state_info = {}
- action_cache = self.get_action_cache()
- ctrl_state_infos = action_cache.read_state_info(serial=True)
- for motion_obj, ctrl_state_info in ctrl_state_infos.items():
- state_info[motion_obj] = motion_state_info = \
- motion_obj._from_ctrl_state_info(ctrl_state_info)
- motion_obj.put_state_info(motion_state_info)
- for user_element in self.get_user_elements():
- if user_element.get_type() not in TYPE_PHYSICAL_ELEMENTS:
- motion_state_info = user_element._calculate_states()
- user_element.put_state_info(motion_state_info)
-
- ret = self._calculate_states()
- return ret
-
- # --------------------------------------------------------------------------
- # default acquisition channel
- # --------------------------------------------------------------------------
-
- def get_default_attribute(self):
- return self.get_position_attribute()
-
- # ------------------------------------------------------------------------
- # motion
- # ------------------------------------------------------------------------
-
- def get_motion(self):
- return self.get_action_cache()
-
- motion = property(get_motion, doc="motion object")
-
- # ------------------------------------------------------------------------
- # motion calculation
- # ------------------------------------------------------------------------
-
- def calculate_motion(self, new_position, items=None, calculated=None):
- # if items already contains the positions for this pseudo motor
- # underlying motors it means the motion has already been calculated
- # by a sibling
- if items is not None and len(items):
- physical_elements = self.get_physical_elements_set()
- s_items = set(items)
- if s_items == physical_elements:
- if calculated is not None and self in calculated:
- return
-
- user_elements = self.get_user_elements()
- positions = self.get_siblings_positions(use=calculated,
- write_pos=self.drift_correction)
- positions[self] = new_position
- pseudo_positions = len(positions) * [None]
- for pseudo, position in positions.items():
- pseudo_positions[pseudo.axis - 1] = position
- curr_physical_positions = self._position.get_physical_positions()
- physical_positions = self.controller.calc_all_physical(pseudo_positions,
- curr_physical_positions)
- if physical_positions.error:
- raise PoolException("Cannot calculate motion: "
- "calc_all_physical raises exception",
- exc_info=physical_positions.exc_info)
- else:
- if physical_positions.value is None:
- raise PoolException("Cannot calculate motion: "
- "calc_all_physical returns None")
-
- if items is None:
- items = {}
- for new_position, element in zip(physical_positions.value, user_elements):
- if new_position is None:
- raise PoolException("Cannot calculate motion: %s reports "
- "position to be None" % element.name)
- element.calculate_motion(new_position, items=items,
- calculated=calculated)
- return items
-
- def start_move(self, new_position):
- self._in_start_move = True
- try:
- return self._start_move(new_position)
- finally:
- self._in_start_move = False
-
- def _start_move(self, new_position):
- self._aborted = False
- self._stopped = False
- items = self.calculate_motion(new_position)
- timestamp = time.time()
- for item, position_info in items.items():
- item.set_write_position(position_info[0], timestamp=timestamp,
- propagate=1)
- if not self._simulation_mode:
- self.motion.run(items=items)
-
- # ------------------------------------------------------------------------
- # stop
- # ------------------------------------------------------------------------
-
- def stop(self):
- #surpass the PoolElement.stop because it doesn't do what we want
- PoolBaseElement.stop(self)
- PoolBaseGroup.stop(self)
-
- # ------------------------------------------------------------------------
- # abort
- # ------------------------------------------------------------------------
-
- def abort(self):
- #surpass the PoolElement.abort because it doesn't do what we want
- PoolBaseElement.abort(self)
- PoolBaseGroup.abort(self)
-
- # ------------------------------------------------------------------------
- # involved in an operation
- # ------------------------------------------------------------------------
-
- def get_operation(self):
- return PoolBaseGroup.get_operation(self)
diff --git a/src/sardana/pool/pooltwodexpchannel.py b/src/sardana/pool/pooltwodexpchannel.py
deleted file mode 100644
index 59e6d390..00000000
--- a/src/sardana/pool/pooltwodexpchannel.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for TwoDExpChannel"""
-
-__all__ = ["Pool2DExpChannel"]
-
-__docformat__ = 'restructuredtext'
-
-from sardana import ElementType
-from sardana.sardanaevent import EventType
-
-from sardana.pool.poolbasechannel import PoolBaseChannel
-
-
-class Pool2DExpChannel(PoolBaseChannel):
-
- def __init__(self, **kwargs):
- self._data_source = None
- kwargs['elem_type'] = ElementType.TwoDExpChannel
- PoolBaseChannel.__init__(self, **kwargs)
-
- # --------------------------------------------------------------------------
- # data source
- # --------------------------------------------------------------------------
-
- def get_data_source(self, cache=True, propagate=1):
- if not cache or self._data_source is None:
- data_source = self.read_data_source()
- self._set_data_source(data_source, propagate=propagate)
- return self._data_source
-
- def _set_data_source(self, data_source, propagate=1):
- self._data_source = data_source
- if not propagate:
- return
- self.fire_event(EventType("data_source", priority=propagate), data_source)
-
- def read_data_source(self):
- data_source = self.controller.get_axis_par(self.axis, "data_source")
- return data_source
-
- data_source = property(get_data_source, doc="source identifier for the 2D data")
diff --git a/src/sardana/pool/poolutil.py b/src/sardana/pool/poolutil.py
deleted file mode 100644
index 34151167..00000000
--- a/src/sardana/pool/poolutil.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Pool utils"""
-
-__all__ = ["PoolUtil"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.util.containers import CaselessDict
-
-
-class _PoolUtil(object):
-
- def __init__(self):
- self._ctrl_proxies = CaselessDict()
-
- def __call__(self, *args, **kwargs):
- return self
-
- def get_device(self, *args, **kwargs):
- ctrl_name = args[0]
- device_name = args[1]
- ctrl_devs = self._ctrl_proxies.get(ctrl_name)
- if ctrl_devs is None:
- self._ctrl_proxies[ctrl_name] = ctrl_devs = CaselessDict()
- dev = ctrl_devs.get(device_name)
- if dev is None:
- import PyTango
- ctrl_devs[device_name] = dev = PyTango.DeviceProxy(device_name)
- return dev
-
- get_motor = get_phy_motor = get_pseudo_motor = get_motor_group = \
- get_exp_channel = get_ct_channel = get_zerod_channel = get_oned_channel = \
- get_twod_channel = get_pseudo_counter_channel = get_measurement_group = \
- get_com_channel = get_ioregister = get_device
-
-PoolUtil = _PoolUtil()
diff --git a/src/sardana/pool/poolzerodexpchannel.py b/src/sardana/pool/poolzerodexpchannel.py
deleted file mode 100644
index 95da098d..00000000
--- a/src/sardana/pool/poolzerodexpchannel.py
+++ /dev/null
@@ -1,310 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool library. It defines the base classes
-for ZeroDExpChannel"""
-
-__all__ = ["Pool0DExpChannel"]
-
-__docformat__ = 'restructuredtext'
-
-import numpy
-import time
-
-from sardana import ElementType
-from sardana.sardanaevent import EventType
-from sardana.sardanaattribute import SardanaAttribute
-
-from sardana.pool.poolbasechannel import PoolBaseChannel
-from sardana.pool.poolacquisition import Pool0DAcquisition
-
-
-class BaseAccumulation(object):
-
- def __init__(self):
- self.buffer = numpy.zeros(shape=(2, 16384), dtype=numpy.float64)
- self.clear()
-
- def clear(self):
- self.nb_points = 0
- self.value = None
-
- def get_value_buffer(self):
- return self.buffer[0][:self.nb_points]
-
- def get_time_buffer(self):
- return self.buffer[1][:self.nb_points]
-
- def append_value(self, value, timestamp=None):
- if timestamp is None:
- timestamp = time.time()
- idx = self.nb_points
- self.nb_points += 1
- self.buffer[0][idx] = value
- self.buffer[1][idx] = timestamp
- self.update_value(value, timestamp)
-
- def update_value(self, value, timestamp):
- self.value = value
-
-
-LastAccumulation = BaseAccumulation
-
-
-class SumAccumulation(BaseAccumulation):
-
- def clear(self):
- BaseAccumulation.clear(self)
- self.sum = 0.0
-
- def update_value(self, value, timestamp):
- self.sum += value
-
-
-class AverageAccumulation(SumAccumulation):
-
- def update_value(self, value, timestamp):
- SumAccumulation.update_value(self, value, timestamp)
- self.value = self.sum / self.nb_points
-
-
-class IntegralAccumulation(BaseAccumulation):
-
- def clear(self):
- BaseAccumulation.clear(self)
- self.sum = 0.0
- self.last_value = None
- self.start_time = None
-
- def update_value(self, value, timestamp):
- if self.nb_points == 1:
- self.last_value = value, timestamp
- self.start_time = timestamp
- self.value = value
- else:
- last_value, last_timestamp = self.last_value
- dt = timestamp - last_timestamp
- self.sum += dt * (last_value + value) / 2.0
- total_dt = timestamp - self.start_time
- self.value = self.sum / total_dt
- self.last_value = value, timestamp
-
-
-def get_accumulation_class(ctype):
- return globals()[ctype + "Accumulation"]
-
-
-class CurrentValue(SardanaAttribute):
-
- def update(self, cache=True, propagate=1):
- if not cache or not self.has_value():
- value = self.obj.read_current_value()
- self.set_value(value, propagate=propagate)
-
-
-class Value(SardanaAttribute):
-
- DefaultAccumulationType = "Average"
-
- def __init__(self, *args, **kwargs):
- accumulation_type = kwargs.pop('accumulation_type', self.DefaultAccumulationType)
- super(Value, self).__init__(*args, **kwargs)
- self.set_accumulation_type(accumulation_type)
-
- def get_val(self):
- return self.obj.get_value_attribute()
-
- def set_accumulation_type(self, ctype):
- klass = get_accumulation_class(ctype)
- self._accumulation = klass()
-
- def get_accumulation_type(self):
- klass_name = self._accumulation.__class__.__name__
- return klass_name[:klass_name.index("Accumulation")]
-
- def get_accumulation(self):
- return self._accumulation
-
- accumulation = property(get_accumulation)
-
- def _get_value(self):
- value = self._accumulation.value
- if value is None:
- raise Exception("Value not available: no acquisition done so far!")
- return value
-
- def get_value_buffer(self):
- return self.accumulation.get_value_buffer()
-
- def get_time_buffer(self):
- return self.accumulation.get_time_buffer()
-
- def clear_buffer(self):
- self.accumulation.clear()
-
- def append_value(self, value, propagate=1):
- self.accumulation.append_value(value.value, value.timestamp)
- if propagate > 0:
- evt_type = EventType(self.name, priority=propagate)
- self.fire_event(evt_type, self)
-
-
-class Pool0DExpChannel(PoolBaseChannel):
-
- ValueAttributeClass = Value
- AcquisitionClass = Pool0DAcquisition
-
- def __init__(self, **kwargs):
- kwargs['elem_type'] = ElementType.ZeroDExpChannel
- PoolBaseChannel.__init__(self, **kwargs)
- self._current_value = CurrentValue(self, listeners=self.on_change)
-
- # -------------------------------------------------------------------------
- # Accumulation
- # -------------------------------------------------------------------------
-
- def get_accumulation_type(self):
- return self.get_value_attribute().get_accumulation_type()
-
- def get_accumulation(self):
- return self.get_value_attribute().get_accumulation()
-
- def set_accumulation_type(self, ctype):
- return self.get_value_attribute().set_accumulation_type(ctype)
-
- accumulation = property(get_accumulation)
-
- # -------------------------------------------------------------------------
- # value
- # -------------------------------------------------------------------------
-
- def get_accumulated_value_attribute(self):
- """Returns the accumulated value attribute object for this 0D.
-
- :return: the accumulated value attribute
- :rtype: :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self.get_value_attribute()
-
- def get_current_value_attribute(self):
- """Returns the current value attribute object for this 0D.
-
- :return: the current value attribute
- :rtype: :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- return self._current_value
-
- def get_accumulated_value(self):
- """Gets the accumulated value for this 0D.
-
- :return:
- a :class:`~sardana.sardanavalue.SardanaValue` containing the 0D
- value
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`
-
- :raises: Exception if no acquisition has been done yet on this 0D"""
- return self.get_accumulated_value_attribute()
-
- def read_current_value(self):
- """Reads the 0D value from hardware.
-
- :return:
- a :class:`~sardana.sardanavalue.SardanaValue` containing the counter
- value
- :rtype:
- :class:`~sardana.sardanavalue.SardanaValue`"""
- return self.acquisition.read_value()[self]
-
- def put_current_value(self, value, propagate=1):
- """Sets a value.
-
- :param value:
- the new value
- :type value:
- :class:`~sardana.sardanavalue.SardanaValue`
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate:
- int"""
- curr_val_attr = self.get_current_value_attribute()
- curr_val_attr.set_value(value, propagate=propagate)
- if self.is_in_operation():
- acc_val_attr = self.get_accumulated_value_attribute()
- acc_val_attr.append_value(value, propagate=propagate)
-
- def get_current_value(self, cache=True, propagate=1):
- """Returns the counter value.
-
- :return:
- the 0D accumulated value
- :rtype:
- :class:`~sardana.sardanaattribute.SardanaAttribute`"""
- curr_val_attr = self.get_current_value_attribute()
- curr_val_attr.update(cache=cache, propagate=propagate)
- return curr_val_attr
-
- current_value = property(get_current_value, doc="0D value")
- accumulated_value = property(get_accumulated_value, doc="0D value")
-
- def put_value(self, value, propagate=1):
- return self.put_current_value(value, propagate=propagate)
-
- def _get_value(self):
- return self.get_current_value()
-
- def append_value(self, value, timestamp=None, propagate=1):
- cumulation = self.cumulation
- cumulation.append_value(value, timestamp)
- if not propagate:
- return
- self.fire_event(EventType("value", priority=propagate), cumulation.value)
-
- def clear_buffer(self):
- self.get_accumulated_value_attribute().clear_buffer()
-
- # -------------------------------------------------------------------------
- # value buffer
- # -------------------------------------------------------------------------
-
- def get_value_buffer(self):
- return self.get_accumulated_value_attribute().get_value_buffer()
-
- value_buffer = property(get_value_buffer)
-
- # -------------------------------------------------------------------------
- # time buffer
- # -------------------------------------------------------------------------
-
- def get_time_buffer(self):
- return self.get_accumulated_value_attribute().get_time_buffer()
-
- time_buffer = property(get_time_buffer)
-
- def start_acquisition(self, value=None):
- self._aborted = False
- self.clear_buffer()
- if value is None:
- raise Exception("Invalid integration_time '%s'. Hint set a new value for 'value' first" % value)
- if not self._simulation_mode:
- acq = self.acquisition.run()
diff --git a/src/sardana/pool/test/__init__.py b/src/sardana/pool/test/__init__.py
deleted file mode 100644
index 8e32ce7e..00000000
--- a/src/sardana/pool/test/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the pool test module"""
-
-from .fake import *
-from .helper import *
-from .dummyconfs import *
diff --git a/src/sardana/pool/test/dummyconfs.py b/src/sardana/pool/test/dummyconfs.py
deleted file mode 100644
index 07fb3119..00000000
--- a/src/sardana/pool/test/dummyconfs.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-__all__ = ['dummyCounterTimerConf01', 'dummyMeasurementGroupConf01',
- 'dummyPoolCTCtrlConf01']
-
-# Pool Elements
-
-'''Minimum configuration to create a Pool CounterTimer'''
-dummyCounterTimerConf01 = { 'axis': 1,
- 'ctrl': None,
- 'full_name': '',
- 'id': 2,
- 'name': '',
- 'pool': None }
-
-'''Minimum configuration to create a Pool MeasurementGroup'''
-dummyMeasurementGroupConf01 = { 'full_name': '',
- 'id': 3,
- 'name': '',
- 'pool': None,
- 'user_elements': [2] }
-
-# Pool Ctrls
-
-'''Minimum configuration to create a Pool CounterTimer controller'''
-dummyPoolCTCtrlConf01 = { 'class_info': None,
- 'full_name': '',
- 'id': 1,
- 'klass': 'DummyCounterTimerController',
- 'lib_info': None,
- 'library': 'DummyCounterTimerController.py',
- 'name': '',
- 'pool': None,
- 'properties': {},
- 'role_ids': '',
- 'type': 'CTExpChannel' }
diff --git a/src/sardana/pool/test/fake.py b/src/sardana/pool/test/fake.py
deleted file mode 100644
index a3c85846..00000000
--- a/src/sardana/pool/test/fake.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-__all__ = ['FakePool']
-
-from sardana.pool.poolcontrollermanager import ControllerManager
-
-class FakePool(object):
- ''' Fake class to simulate the behaviour of the Pool class
- '''
- acq_loop_sleep_time = 0.1
- acq_loop_states_per_value = 10
-
- elements = {}
-
- def __init__(self):
- self.ctrl_manager = ControllerManager()
- self.ctrl_manager.set_pool(self)
- self.ctrl_manager.setControllerPath([])
-
- def add_element(self, element):
- self.elements[element.id] = element
-
- def get_element(self, id):
- return self.elements[id]
diff --git a/src/sardana/pool/test/helper.py b/src/sardana/pool/test/helper.py
deleted file mode 100644
index c588f68e..00000000
--- a/src/sardana/pool/test/helper.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-__all__ = ['createPoolController', 'createPoolCounterTimer',
- 'createPoolMeasurementGroup']
-
-from sardana.pool.poolcontroller import PoolController
-from sardana.pool.poolcountertimer import PoolCounterTimer
-from sardana.pool.poolmeasurementgroup import PoolMeasurementGroup
-
-def createPoolController(pool, conf):
- '''Method to create a PoolController using a configuration dictionary
- '''
- kwargs = conf
-
- ctrl_manager = pool.ctrl_manager
- ctrl_class_info = None
- ctrl_lib_info = ctrl_manager.getControllerLib(kwargs['library'])
- if ctrl_lib_info is not None:
- ctrl_class_info = ctrl_lib_info.get_controller(kwargs['klass'])
-
- kwargs['pool'] = pool
- kwargs['lib_info'] = ctrl_lib_info
- kwargs['class_info'] = ctrl_class_info
- return PoolController(**kwargs)
-
-def createPoolCounterTimer(pool, poolcontroller, conf):
- '''Method to create a PoolCounterTimer using a configuration dictionary
- '''
- kwargs = conf
- kwargs['pool'] = pool
- kwargs['ctrl'] = poolcontroller
- return PoolCounterTimer(**kwargs)
-
-def createPoolMeasurementGroup(pool, conf):
- '''Method to create a PoolMeasurementGroup using a configuration dictionary
- '''
- kwargs = conf
- kwargs['pool'] = pool
- return PoolMeasurementGroup(**kwargs)
diff --git a/src/sardana/pool/test/test_ctacquisition.py b/src/sardana/pool/test/test_ctacquisition.py
deleted file mode 100644
index 3a7a562f..00000000
--- a/src/sardana/pool/test/test_ctacquisition.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import time
-from taurus.external import unittest
-from sardana.pool.poolmeasurementgroup import PoolMeasurementGroup
-from sardana.pool.test import (FakePool, createPoolController,
- createPoolMeasurementGroup,
- createPoolCounterTimer, dummyCounterTimerConf01,
- dummyPoolCTCtrlConf01,
- dummyMeasurementGroupConf01)
-
-class PoolMeasurementGroupTestCase(unittest.TestCase):
- """Class used for an acquisition done by a Measurement Group with a
- dummyCounterTimer channel. The Measurement Group runs with a freshly created
- fake Pool which does not depends on the Sardana Pool.
- """
-
- def setUp(self):
- """Setup:
- - Use resources for Controller, CounterTimer and MeasurementGroup
- features.
- - Create Controller, CounterTimer and MeasurementGroup.
- """
- pool = FakePool()
-
- pc = createPoolController(pool, dummyPoolCTCtrlConf01)
- pct = createPoolCounterTimer(pool, pc, dummyCounterTimerConf01)
-
- pc.add_element(pct)
- pool.add_element(pc)
- pool.add_element(pct)
-
- self.pmg = createPoolMeasurementGroup(pool, dummyMeasurementGroupConf01)
- self._pct = pct # keep a reference to use it in test_acquisition
-
- def test_init(self):
- """check that the PoolMeasurementGroup is correctly instantiated"""
- msg = 'PoolMeasurementGroup constructor does not create ' +\
- 'PoolMeasurementGroup instance'
- self.assertIsInstance(self.pmg, PoolMeasurementGroup, msg)
-
- def test_acquisition(self):
- """Test acquisition using the created measurement group without
- using a Sardana pool."""
- msg = 'Pool Measurement Group does not acquire'
- integ_time = 1
- self.pmg.set_integration_time(integ_time)
- self.pmg.start_acquisition()
-
- acq = self.pmg.get_acquisition()._ct_acq
- # 'acquiring..'
- while acq.is_running():
- time.sleep(0.05)
- values = acq.raw_read_value_loop()
- self.assertEqual(values[self._pct].value, integ_time, msg)
-
- def tearDown(self):
- unittest.TestCase.tearDown(self)
- self.pmg = None
- self._pct = None
diff --git a/src/sardana/pool/test/test_poolcontroller.py b/src/sardana/pool/test/test_poolcontroller.py
deleted file mode 100644
index 39fb1ff1..00000000
--- a/src/sardana/pool/test/test_poolcontroller.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from taurus.external import unittest
-from sardana.pool.test import (FakePool, createPoolController,
- dummyPoolCTCtrlConf01)
-from sardana.pool.poolcontroller import PoolController
-
-class PoolControllerTestCase(unittest.TestCase):
- """Unittest of PoolController Class"""
-
- def setUp(self):
- """Instantiate a fake Pool and create a Controller"""
- pool = FakePool()
- self.pc = createPoolController(pool, dummyPoolCTCtrlConf01)
-
- def test_init(self):
- """Verify that the created Controller is an instance of
- PoolController"""
- msg = 'PoolController constructor does not create ' +\
- 'PoolController instance'
- self.assertIsInstance(self.pc, PoolController, msg)
-
- def tearDown(self):
- unittest.TestCase.tearDown(self)
- self.pc = None
diff --git a/src/sardana/pool/test/test_poolcontrollermanager.py b/src/sardana/pool/test/test_poolcontrollermanager.py
deleted file mode 100644
index ae416a25..00000000
--- a/src/sardana/pool/test/test_poolcontrollermanager.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from taurus.external import unittest
-from sardana.pool.poolcontrollermanager import ControllerManager
-
-class ControllerManagerTestCase(unittest.TestCase):
- """Unittest of ControllerManager Class"""
-
- def setUp(self):
- """Create a ControllerManager"""
- self.cm = ControllerManager()
-
- def test_init(self):
- """Verify that the created ControllerManager is a ControllerManager
- instance."""
- msg = 'ControllerManager constructor does not create ' +\
- 'ControllerManager instance'
- self.assertIsInstance(self.cm, ControllerManager, msg)
-
- def tearDown(self):
- unittest.TestCase.tearDown(self)
- self.cm = None \ No newline at end of file
diff --git a/src/sardana/pool/test/test_poolcountertimer.py b/src/sardana/pool/test/test_poolcountertimer.py
deleted file mode 100644
index 410dae22..00000000
--- a/src/sardana/pool/test/test_poolcountertimer.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from taurus.external import unittest
-from sardana.pool.poolcountertimer import PoolCounterTimer
-from sardana.pool.test import (FakePool, createPoolController,
- createPoolCounterTimer, dummyCounterTimerConf01,
- dummyPoolCTCtrlConf01)
-
-class PoolCounterTimerTestCase(unittest.TestCase):
- """Unittest of PoolCounterTimer Class"""
-
- def setUp(self):
- """Create a Controller and a CounterTimer element"""
- pool = FakePool()
-
- pc = createPoolController(pool, dummyPoolCTCtrlConf01)
- self.pct = createPoolCounterTimer(pool, pc, dummyCounterTimerConf01)
-
- def test_init(self):
- """Verify that the created CounterTimer is a PoolCounterTimer
- instance."""
- msg = 'PoolCounterTimer constructor does not create ' +\
- 'PoolCounterTimer instance'
- self.assertIsInstance(self.pct, PoolCounterTimer, msg)
-
- def tearDown(self):
- unittest.TestCase.tearDown(self)
- self.pct = None \ No newline at end of file
diff --git a/src/sardana/release.py b/src/sardana/release.py
deleted file mode 100644
index 7326808e..00000000
--- a/src/sardana/release.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-__docformat__ = "restructuredtext"
-
-
-"""
-Release data for the taurus project. It contains the following members:
-
- - version : (str) version string
- - description : (str) brief description
- - long_description : (str) a long description
- - license : (str) license
- - authors : (dict<str, tuple<str,str>>) the list of authors
- - url : (str) the project url
- - download_url : (str) the project download url
- - platforms : list<str> list of supported platforms
- - keywords : list<str> list of keywords
-"""
-
-#: Name of the package for release purposes. This is the name which labels
-#: the tarballs and RPMs made by distutils, so it's best to lowercase it.
-name = 'sardana'
-
-#: For versions with substrings (like 0.6.16.svn), use an extra . to separate
-#: the new substring. We have to avoid using either dashes or underscores,
-#: because bdist_rpm does not accept dashes (an RPM) convention, and
-#: bdist_deb does not accept underscores (a Debian convention).
-version_info = (1, 5, 0, 'rc', 0)
-version = '.'.join(map(str, version_info[:3]))
-revision = str(version_info[4])
-
-description = "instrument control and data acquisition system"
-
-long_description = \
-'''Sardana is a Supervision, Control And Data Acquisition (SCADA) system for
- scientific installations. It is written in Python and based on the TANGO
- library. The hardware control and data acquisition routines can be
- accessed via an IPython console and a generic graphical user interface
- (both of which are easily extensible by the user).'''
-
-license = 'LGPL'
-
-authors = {'Tiago' : ('Tiago Coutinho','tiago.coutinho@esrf.fr'),
- 'Pascual-Izarra' : ('Carlos Pascual-Izarra','cpascual@cells.es'),
- 'Reszela' : ('Zbigniew Reszela','zreszela@cells.es') }
-
-url = 'http://www.sardana-controls.org'
-
-download_url = 'http://pypi.python.org/packages/source/s/sardana'
-
-platforms = ['Linux','Windows XP/2000/NT','Windows 95/98/ME']
-
-keywords = ['Sardana', 'Tango', 'Python', 'Control System']
diff --git a/src/sardana/requirements.py b/src/sardana/requirements.py
deleted file mode 100644
index 86f55c38..00000000
--- a/src/sardana/requirements.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-from __future__ import absolute_import
-
-__docformat__ = 'restructuredtext'
-
-__all__ = ["check_requirements"]
-
-import sys
-
-__requires__ = {
-# module minimum
- "Python" : (2, 6, 0),
- "PyTango" : (7, 2, 3),
- "taurus.core" : (3, 4, 0),
-}
-
-def check_requirements(exec_name=None):
-
- if exec_name is None:
- exec_name = sys.argv[0]
-
- pyver_ = __requires__['Python']
- pytangover_ = __requires__['PyTango']
- taurusver_ = __requires__['taurus.core']
-
- pyver_str_ = ".".join(map(str, pyver_))
- pytangover_str_ = ".".join(map(str, pytangover_))
- taurusver_str_ = ".".join(map(str, taurusver_))
-
- pyver = sys.version_info[:3]
- pyver_str = ".".join(map(str, pyver))
-
- if pyver < pyver_:
- print "Sardana requires python %s. Installed version is %s" % (pyver_str_, pyver_str)
- sys.exit(-1)
-
- pytangover = None
- try:
- import PyTango
- pytangover = PyTango.Release.version_info[:3]
- except ImportError:
- pass
- except:
- pytangover = tuple(map(int, PyTango.__version__.split('.', 3)))
-
- if pytangover is None:
- print "%s requires PyTango %s. No version installed" % (exec_name, pytangover_str_,)
- sys.exit(-1)
- if pytangover < pytangover_:
- pytangover_str = ".".join(map(str, pytangover))
- print "%s requires PyTango %s. Installed version is %s" % (exec_name, pytangover_str_, pytangover_str)
- sys.exit(-1)
-
- taurusver = None
- try:
- import taurus
- taurusver = taurus.Release.version_info[:3]
- except ImportError:
- pass
- except:
- taurusver = tuple(map(int, taurus.Release.version.split('.', 3)))
-
- if taurusver is None:
- print "%s requires taurus %s. No version installed" % (exec_name, taurusver_str_,)
- sys.exit(-1)
- if taurusver < taurusver_:
- taurusver_str = ".".join(map(str, taurusver))
- print "%s requires taurus %s. Installed version is %s" % (exec_name, taurusver_str_, taurusver_str)
- sys.exit(-1)
-
- try:
- from lxml import etree
- except:
- print "Could not find any suitable XML library"
- sys.exit(-1)
diff --git a/src/sardana/sardanaattribute.py b/src/sardana/sardanaattribute.py
deleted file mode 100644
index 4fbd6820..00000000
--- a/src/sardana/sardanaattribute.py
+++ /dev/null
@@ -1,366 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines the base classes
-for Sardana attributes"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaAttribute", "SardanaSoftwareAttribute",
- "ScalarNumberAttribute", "SardanaAttributeConfiguration"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-import datetime
-
-from .sardanaevent import EventGenerator, EventType
-from .sardanadefs import ScalarNumberFilter
-from .sardanavalue import SardanaValue
-
-
-class SardanaAttribute(EventGenerator):
- """Class representing an atomic attribute like position of a motor or a
- counter value"""
-
- def __init__(self, obj, name=None, initial_value=None, **kwargs):
- super(SardanaAttribute, self).__init__(**kwargs)
- if obj is not None:
- obj = weakref.ref(obj)
- self._obj = obj
- self.name = name or self.__class__.__name__
- self._r_value = None
- self._last_event_value = None
- self._w_value = None
- self.filter = lambda a, b: True
- self.config = SardanaAttributeConfiguration()
- if initial_value is not None:
- self.set_value(initial_value)
-
- def has_value(self):
- """Determines if the attribute's read value has been read at least once
- in the lifetime of the attribute.
-
- :return: True if the attribute has a read value stored or False otherwise
- :rtype: bool"""
- return self._has_value()
-
- def _has_value(self):
- return not self._r_value is None
-
- def has_write_value(self):
- """Determines if the attribute's write value has been read at least once
- in the lifetime of the attribute.
-
- :return: True if the attribute has a write value stored or False otherwise
- :rtype: bool"""
- return self._has_write_value()
-
- def _has_write_value(self):
- return self._w_value is not None
-
- def get_obj(self):
- """Returns the object which *owns* this attribute
-
- :return: the object which *owns* this attribute
- :rtype: obj"""
- return self._get_obj()
-
- def _get_obj(self):
- obj = self._obj
- if obj is not None:
- obj = obj()
- return obj
-
- def in_error(self):
- """Determines if this attribute is in error state.
-
- :return: True if the attribute is in error state or False otherwise
- :rtype: bool"""
- return self._in_error()
-
- def _in_error(self):
- return self.has_value() and self._r_value.error
-
- def set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- """Sets the current read value and propagates the event (if
- propagate > 0).
-
- :param value: the new read value for this attribute. If a SardanaValue
- is given, exc_info and timestamp are ignored (if given)
- :type value: obj or SardanaValue
- :param exc_info: exception information as returned by
- :func:`sys.exc_info` [default: None, meaning no
- exception]
- :type exc_info: tuple<3> or None
- :param timestamp: timestamp of attribute readout [default: None, meaning
- create a 'now' timestamp]
- :type timestamp: float or None
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate: int"""
- return self._set_value(value, exc_info=exc_info, timestamp=timestamp,
- propagate=propagate)
-
- def _set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- if isinstance(value, SardanaValue):
- rvalue = value
- else:
- rvalue = SardanaValue(value=value, exc_info=exc_info, timestamp=timestamp)
- self._r_value = rvalue
- self.fire_read_event(propagate=propagate)
-
- def get_value(self):
- """Returns the last read value for this attribute.
-
- :return: the last read value for this attribute
- :rtype: obj
-
- :raises: :exc:`Exception` if no read value has been set yet"""
- return self._get_value()
-
- def _get_value(self):
- return self.get_value_obj().value
-
- def get_value_obj(self):
- """Returns the last read value for this attribute.
-
- :return: the last read value for this attribute
- :rtype: :class:`~sardana.sardanavalue.SardanaValue`
-
- :raises: :exc:`Exception` if no read value has been set yet"""
- return self._get_value_obj()
-
- def _get_value_obj(self):
- if not self.has_value():
- raise Exception("{0}.{1} doesn't have a read value yet".format(
- self.obj.name, self.name))
- return self._r_value
-
- def set_write_value(self, w_value, timestamp=None, propagate=1):
- """Sets the current write value.
-
- :param value: the new write value for this attribute. If a SardanaValue
- is given, timestamp is ignored (if given)
- :type value: obj or SardanaValue
- :param timestamp: timestamp of attribute write [default: None, meaning
- create a 'now' timestamp]
- :type timestamp: float or None
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate: int"""
- return self._set_write_value(w_value, timestamp=timestamp,
- propagate=propagate)
-
- def _set_write_value(self, w_value, timestamp=None, propagate=1):
- if isinstance(w_value, SardanaValue):
- wvalue = w_value
- else:
- wvalue = SardanaValue(value=w_value, timestamp=timestamp)
- self._w_value = wvalue
- self.fire_write_event(propagate=propagate)
-
- def get_write_value(self):
- """Returns the last write value for this attribute.
-
- :return: the last write value for this attribute or None if value has
- not been written yet
- :rtype: obj"""
- return self._get_write_value()
-
- def _get_write_value(self):
- w_value = self.get_write_value_obj()
- if w_value is not None:
- return w_value.value
-
- def get_write_value_obj(self):
- """Returns the last write value object for this attribute.
-
- :return: the last write value for this attribute or None if value has
- not been written yet
- :rtype: :class:`~sardana.sardanavalue.SardanaValue`"""
- return self._get_write_value_obj()
-
- def _get_write_value_obj(self):
- if self.has_write_value():
- return self._w_value
-
- def get_exc_info(self):
- """Returns the exception information (like :func:`sys.exc_info`) about
- last attribute readout or None if last read did not generate an
- exception.
-
- :return: exception information or None
- :rtype: tuple<3> or None"""
- return self._get_exc_info()
-
- def _get_exc_info(self):
- exc_info = None
- if self.has_value():
- exc_info = self._r_value.exc_info
- return exc_info
-
- def accepts(self, propagate):
- if propagate < 1:
- return False
- if self._last_event_value is None:
- return True
- return propagate > 1 or self.filter(self.get_value(), self._last_event_value.value)
-
- def get_timestamp(self):
- """Returns the timestamp of the last readout or None if the attribute
- has never been read before
-
- :return: timestamp of the last readout or None
- :rtype: float or None"""
- return self._get_timestamp()
-
- def _get_timestamp(self):
- if self.has_value():
- return self._r_value.timestamp
-
- def get_write_timestamp(self):
- """Returns the timestamp of the last write or None if the attribute
- has never been written before
-
- :return: timestamp of the last write or None
- :rtype: float or None"""
- return self._get_write_timestamp()
-
- def _get_write_timestamp(self):
- if self.has_write_value():
- return self._w_value.timestamp
-
- def fire_write_event(self, propagate=1):
- """Fires an event to the listeners of the object which owns this
- attribute.
-
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate: int"""
- if propagate < 1:
- return
- evt_type = EventType("w_" + self.name, priority=propagate)
- self.fire_event(evt_type, self)
-
- def fire_read_event(self, propagate=1):
- """Fires an event to the listeners of the object which owns this
- attribute.
-
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate: int"""
- if self.accepts(propagate):
- obj = self.obj
- if obj is not None:
- self._last_event_value = self._r_value
- evt_type = EventType(self.name, priority=propagate)
- self.fire_event(evt_type, self)
-
- obj = property(get_obj, "container object for this attribute")
- value_obj = property(get_value_obj)
- write_value_obj = property(get_write_value_obj)
- value = property(get_value, set_value, "current read value for this attribute")
- w_value = property(get_write_value, set_write_value,
- "current write value for this attribute")
- timestamp = property(get_timestamp, doc="the read timestamp")
- w_timestamp = property(get_write_timestamp, doc="the write timestamp")
- error = property(in_error)
- exc_info = property(get_exc_info)
-
- def __repr__(self):
- v = None
- if self.in_error():
- v = "<Error>"
- elif self.has_value():
- v = self.value
- return "{0}(value={1})".format(self.name, v)
-
- def __str__(self):
- if self.has_value():
- value = "{0} at {1}".format(self.value, datetime.datetime.fromtimestamp(self.timestamp))
- else:
- value = "-----"
- if self.has_write_value():
- w_value = "{0} at {1}".format(self.w_value, datetime.datetime.fromtimestamp(self.w_timestamp))
- else:
- w_value = "-----"
-
- ret = """{0.__class__.__name__}(
- name = {0.name}
- manager = {0.obj}
- read = {1}
- write = {2})
-""".format(self, value, w_value)
- return ret
-
-
-class SardanaSoftwareAttribute(SardanaAttribute):
- """Class representing a software attribute. The difference between this and
- :class:`SardanaAttribute` is that, because it is a pure software attribute,
- there is no difference ever between the read and write values."""
-
- get_value = SardanaAttribute.get_value
-
- def set_value(self, value, exc_info=None, timestamp=None, propagate=1):
- """Sets the current read value and propagates the event (if
- propagate > 0).
-
- :param value: the new read value for this attribute
- :type value: obj
- :param exc_info: exception information as returned by
- :func:`sys.exc_info` [default: None, meaning no
- exception]
- :type exc_info: tuple<3> or None
- :param timestamp: timestamp of attribute readout [default: None, meaning
- create a 'now' timestamp]
- :type timestamp: float or None
- :param propagate:
- 0 for not propagating, 1 to propagate, 2 propagate with priority
- :type propagate: int"""
- SardanaAttribute.set_value(self, value, exc_info=exc_info,
- timestamp=timestamp)
- self.set_write_value(value, timestamp=self.timestamp)
-
- value = property(get_value, set_value, "current value for this attribute")
-
-
-class ScalarNumberAttribute(SardanaAttribute):
- """A :class:`SardanaAttribute` specialized for numbers"""
-
- def __init__(self, *args, **kwargs):
- SardanaAttribute.__init__(self, *args, **kwargs)
- self.filter = ScalarNumberFilter()
-
-
-class SardanaAttributeConfiguration(object):
- """Storage class for :class:`SardanaAttribute` information (like ranges)"""
- NoRange = float('-inf'), float('inf')
-
- def __init__(self):
- self.range = self.NoRange
- self.alarm = self.NoRange
- self.warning = self.NoRange
-
diff --git a/src/sardana/sardanabase.py b/src/sardana/sardanabase.py
deleted file mode 100644
index c8f5c43e..00000000
--- a/src/sardana/sardanabase.py
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana library. It defines the base
-classes for Sardana object"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaBaseObject", "SardanaObjectID"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-
-from taurus.core.util.log import Logger
-
-from sardana.sardanadefs import ElementType, Interface, InterfacesExpanded, InvalidId
-from sardana.sardanaevent import EventGenerator, EventReceiver
-
-
-class SardanaBaseObject(EventGenerator, EventReceiver, Logger):
- """The Sardana most abstract object. It contains only two members:
-
- - _manager : a weak reference to the manager (pool or ms) where it
- belongs
- - _name : the name
- - _full_name : the name (usually a tango device name, but can be
- anything else.)"""
-
- def __init__(self, **kwargs):
- EventGenerator.__init__(self)
- EventReceiver.__init__(self)
- self._type = kwargs.pop('elem_type')
- self._name = intern(kwargs.pop('name'))
- self._full_name = intern(kwargs.pop('full_name'))
- self._frontend = None
- Logger.__init__(self, self._name)
- self._manager = weakref.ref(kwargs.pop('manager'))
- self._parent = weakref.ref(kwargs.pop('parent', self.manager))
-
- def get_manager(self):
- """Return the :class:`sardana.Manager` which *owns* this sardana
- object.
-
- :return: the manager which *owns* this pool object.
- :rtype: :class:`sardana.Manager`"""
- return self._manager()
-
- def get_name(self):
- """Returns this sardana object name
-
- :return: this sardana object name
- :rtype: str"""
- return self._name
-
- def get_full_name(self):
- """Returns this sardana object full name
-
- :return: this sardana object full name
- :rtype: str"""
- return self._full_name
-
- def get_type(self):
- """Returns this sardana object type.
-
- :return: this sardana object type
- :rtype: :obj:`~sardana.sardanadefs.ElementType`"""
- return self._type
-
- def get_parent(self):
- """Returns this pool object parent.
-
- :return: this objects parent
- :rtype: :class:`~sardana.sardanabase.SardanaBaseObject`"""
- return self._parent()
-
- def get_parent_name(self):
- """Returns this sardana object parent's name.
-
- :return: this objects parent
- :rtype: str"""
- parent = self.get_parent()
- if parent and hasattr(parent, 'name'):
- return parent.name
-
- def get_frontend(self):
- """Returns this sardana frontend object or None if no frontend is
- registered
-
- :return: this objects frontend
- :rtype: :obj:`object`"""
- f = self._frontend
- if f is None:
- return None
- return f()
-
- def fire_event(self, event_type, event_value, listeners=None, protected=True):
- if protected:
- try:
- return EventGenerator.fire_event(self, event_type, event_value,
- listeners=listeners)
- except:
- self.warning("Error firing event <%r, %r>", event_type, event_value)
- self.debug("Details", exc_info=1)
- else:
- return EventGenerator.fire_event(self, event_type, event_value,
- listeners=listeners)
-
- def get_interfaces(self):
- """Returns the set of interfaces this object implements.
-
- :return:
- The set of interfaces this object implements.
- :rtype:
- class:`set` <:class:`sardana.sardanadefs.Interface`>"""
- return InterfacesExpanded[self.get_interface()]
-
- def get_interface(self):
- """Returns the interface this object implements.
-
- :return:
- The interface this object implements.
- :rtype:
- :class:`sardana.sardanadefs.Interface`"""
- return Interface[ElementType[self.get_type()]]
-
- def get_interface_names(self):
- """Returns a sequence of interface names this object implements.
-
- :return:
- The sequence of interfaces this object implements.
- :rtype:
- sequence<:obj:`str`>"""
- return map(Interface.get, self.get_interfaces())
-
- def serialize(self, *args, **kwargs):
- kwargs['name'] = self.name
- kwargs['full_name'] = self.full_name
- kwargs['type'] = ElementType.whatis(self.get_type())
- kwargs['manager'] = self.manager.name
- kwargs['parent'] = self.get_parent_name()
- kwargs['interfaces'] = self.get_interface_names()
- return kwargs
-
- def serialized(self, *args, **kwargs):
- return self.manager.serialize_element(self, *args, **kwargs)
-
- def str(self, *args, **kwargs):
- return self.manager.str_element(self, *args, **kwargs)
-
- def __str__(self):
- return self._name
-
- def __repr__(self):
- return "%s(%s)" % (self.__class__.__name__, self._name)
-
- manager = property(get_manager,
- doc="reference to the :class:`sardana.Manager`")
- name = property(get_name, doc="object name")
- full_name = property(get_full_name, doc="object full name")
- frontend = property(get_frontend, doc="the object frontend")
-
-
-class SardanaObjectID(object):
- """To be used by sardana objects which have an ID associated to them."""
-
- def __init__(self, id=InvalidId):
- self._id = id
-
- def get_id(self):
- """Returns this sardana object ID
-
- :return: this sardana object ID
- :rtype: int"""
- return self._id
-
- def serialize(self, *args, **kwargs):
- kwargs['id'] = self.id
- return kwargs
-
- id = property(get_id, doc="object ID")
diff --git a/src/sardana/sardanacontainer.py b/src/sardana/sardanacontainer.py
deleted file mode 100644
index 0cf84e54..00000000
--- a/src/sardana/sardanacontainer.py
+++ /dev/null
@@ -1,248 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for a pool container element"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaContainer"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.util.containers import CaselessDict
-from sardana.sardanadefs import InvalidId, ElementType
-
-
-class SardanaContainer(object):
- """A container class for sardana elements"""
-
- def __init__(self):
-
- # map of all elements
- # key - element ID
- # value - pointer to the element object
- self._element_ids = {}
-
- # map of all elements by name
- # key - element name
- # value - pointer to the element object
- self._element_names = CaselessDict()
-
- # map of all elements by name
- # key - element full name
- # value - pointer to the element object
- self._element_full_names = CaselessDict()
-
- # map of all elements by type
- # key - element type
- # value - map where:
- # key - element ID
- # value - pointer to the element object
- self._element_types = {}
-
- def add_element(self, e):
- """Adds a new :class:`pool.PoolObject` to this container
-
- :param e: the pool element to be added
- :type e: :class:`pool.PoolObject`
- """
- name, full_name, id = e.get_name(), e.get_full_name(), e.get_id()
- elem_type = e.get_type()
- self._element_ids[id] = e
- self._element_names[name] = e
- self._element_full_names[full_name] = e
- type_elems = self._element_types.get(elem_type)
- if type_elems is None:
- self._element_types[elem_type] = type_elems = {}
- type_elems[id] = e
- return e
-
- def remove_element(self, e):
- """Removes the :class:`pool.PoolObject` from this container
-
- :param e: the pool object to be removed
- :type e: :class:`pool.PoolObject`
-
- :throw: KeyError
- """
- name, full_name, id = e.get_name(), e.get_full_name(), e.get_id()
- elem_type = e.get_type()
- del self._element_ids[id]
- del self._element_names[name]
- del self._element_full_names[full_name]
- type_elems = self._element_types.get(elem_type)
- del type_elems[id]
-
- def get_element_id_map(self):
- """Returns a reference to the internal pool object ID map
-
- :return: the internal pool object ID map
- :rtype: dict<id, pool.PoolObject>
- """
- return self._element_ids
-
- def get_element_name_map(self):
- """Returns a reference to the internal pool object name map
-
- :return: the internal pool object name map
- :rtype: dict<str, pool.PoolObject>
- """
- return self._element_names
-
- def get_element_type_map(self):
- """Returns a reference to the internal pool object type map
-
- :return: the internal pool object type map
- :rtype: dict<pool.ElementType, dict<id, pool.PoolObject>>
- """
- return self._element_types
-
- def get_element(self, **kwargs):
- """Returns a reference to the requested pool object
-
- :param kwargs: if key 'id' given: search by ID
- else if key 'full_name' given: search by full name
- else if key 'name' given: search by name
-
- :return: the pool object
- :rtype: pool.PoolObject
-
- :throw: KeyError
- """
- if kwargs.has_key("id"):
- id = kwargs.pop("id")
- return self.get_element_by_id(id, **kwargs)
-
- if kwargs.has_key("full_name"):
- full_name = kwargs.pop("full_name")
- return self.get_element_by_full_name(full_name, **kwargs)
-
- name = kwargs.pop("name")
- return self.get_element_by_name(name, **kwargs)
-
- def get_element_by_name(self, name, **kwargs):
- """Returns a reference to the requested pool object
-
- :param name: pool object name
- :type name: str
-
- :return: the pool object
- :rtype: pool.PoolObject
-
- :throw: KeyError
- """
- ret = self._element_names.get(name)
- if ret is None:
- raise KeyError("There is no element with name '%s'" % name)
- return ret
-
- def get_element_by_full_name(self, full_name, **kwargs):
- """Returns a reference to the requested pool object
-
- :param name: pool object full name
- :type name: str
-
- :return: the pool object
- :rtype: pool.PoolObject
-
- :throw: KeyError
- """
- ret = self._element_full_names.get(full_name)
- if ret is None:
- raise KeyError("There is no element with full name '%s'" % full_name)
- return ret
-
- def get_element_by_id(self, id, **kwargs):
- """Returns a reference to the requested pool object
-
- :param id: pool object ID
- :type id: int
-
- :return: the pool object
- :rtype: pool.PoolObject
-
- :throw: KeyError
- """
- ret = self._element_ids.get(id)
- if ret is None:
- raise KeyError("There is no element with ID '%d'" % id)
- return ret
-
- def get_elements_by_type(self, t):
- """Returns a list of all pool objects of the given type
-
- :param t: element type
- :type t: pool.ElementType
-
- :return: list of pool objects
- :rtype: seq<pool.PoolObject>
- """
- elem_types_dict = self._element_types.get(t)
- if elem_types_dict is None:
- return []
- return elem_types_dict.values()
-
- def get_element_names_by_type(self, t):
- """Returns a list of all pool object names of the given type
-
- :param t: element type
- :type t: pool.ElementType
-
- :return: list of pool object names
- :rtype: seq<str>
- """
- return [ elem.get_name() for elem in self.get_elements_by_type(t) ]
-
- def rename_element(self, old_name, new_name):
- """Rename a pool object
-
- :param old_name: old pool object name
- :type old_name: str
- :param new_name: new pool object name
- :type new_name: str
- """
- raise NotImplementedError
-
- def check_element(self, name, full_name):
- raise_element_name = True
- try:
- elem = self.get_element(name=name)
- except:
- raise_element_name = False
- if raise_element_name:
- elem_type = ElementType[elem.get_type()]
- raise Exception("A %s with name '%s' already exists"
- % (elem_type, name))
-
- raise_element_full_name = True
- try:
- elem = self.get_element(full_name=full_name)
- except:
- raise_element_full_name = False
- if raise_element_full_name:
- elem_type = ElementType[elem.get_type()]
- raise Exception("A %s with full name '%s' already exists"
- % (elem_type, full_name))
diff --git a/src/sardana/sardanacustomsettings.py b/src/sardana/sardanacustomsettings.py
deleted file mode 100644
index a940419e..00000000
--- a/src/sardana/sardanacustomsettings.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-#############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Taurus is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Taurus is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
-##
-#############################################################################
-
-"""This module contains some Sardana-wide default configurations.
-
-The idea is that the final user may edit the values here to customize certain
-aspects of Sardana.
-"""
-
-#:UnitTest door name: the door to be used by unit tests.
-#:UNITTEST_DOOR_NAME Must be defined for running sardana unittests.
-UNITTEST_DOOR_NAME = "door/demo1/1"
-#:UnitTests Pool DS name: Pool DS to use in unit tests.
-UNITTEST_POOL_DS_NAME = "unittest1"
-#:UnitTests Pool Device name: Pool Device to use in unit tests.
-UNITTEST_POOL_NAME = "pool/demo1/1"
-
-#:Size and number of rotating backups of the log files.
-#:The Pool and MacroServer Device servers will use these values for their logs.
-LOG_FILES_SIZE = 1e7
-LOG_BCK_COUNT = 5
-
-#:Input handler for spock interactive macros. Accepted values are:
-#: - "CLI": Input via spock command line. This is the default.
-#: - "Qt": Input via Qt dialogs
-SPOCK_INPUT_HANDLER = "CLI"
diff --git a/src/sardana/sardanadefs.py b/src/sardana/sardanadefs.py
deleted file mode 100644
index 88eeb015..00000000
--- a/src/sardana/sardanadefs.py
+++ /dev/null
@@ -1,507 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the most generic sardana constants and enumerations"""
-
-from __future__ import absolute_import
-
-__all__ = ["EpsilonError", "SardanaServer", "ServerRunMode", "State",
- "DataType", "DataFormat", "DataAccess", "DTYPE_MAP", "R_DTYPE_MAP",
- "DACCESS_MAP",
- "from_dtype_str", "from_access_str", "to_dtype_dformat",
- "to_daccess", "InvalidId", "InvalidAxis", "ElementType",
- "Interface", "Interfaces", "InterfacesExpanded",
- "TYPE_ELEMENTS", "TYPE_GROUP_ELEMENTS", "TYPE_MOVEABLE_ELEMENTS",
- "TYPE_PHYSICAL_ELEMENTS", "TYPE_ACQUIRABLE_ELEMENTS",
- "TYPE_EXP_CHANNEL_ELEMENTS", "TYPE_TIMERABLE_ELEMENTS",
- "TYPE_PSEUDO_ELEMENTS", "INTERFACES", "INTERFACES_EXPANDED",
- "ScalarNumberFilter"]
-
-__docformat__ = 'restructuredtext'
-
-import math
-
-from taurus.core.util.enumeration import Enumeration
-
-#: maximum difference between two floats so that they are considered equal
-EpsilonError = 1E-16
-
-#: sardana element state enumeration
-State = Enumeration("State", (\
- "On",
- "Off",
- "Close",
- "Open",
- "Insert",
- "Extract",
- "Moving",
- "Standby",
- "Fault",
- "Init",
- "Running",
- "Alarm",
- "Disable",
- "Unknown",
- "Invalid"))
-
-
-class _SardanaServer(object):
- """Class representing the current sardana server state"""
-
- def __init__(self):
- self.server_state = State.Invalid
-
- def __repr__(self):
- return "SardanaServer()"
-
-
-#: the global object containing the SardanaServer information
-SardanaServer = _SardanaServer()
-
-#:
-#: The sardana server run mode:
-#:
-#: - **SynchPure** : Pure synchronous: Start the server and run the server loop
-#: until it stops
-#: - **SynchThread** : separate thread synchronous: start a thread running the
-#: server loop. Block until the server loop ends
-#: - **SynchProcess** : separate process synchronous: start a sub-process
-#: running the server loop. Block until the server loop ends
-#: - **AsynchThread** : separate thread asynchronous: start a thread running the
-#: server loop. Return immediately
-#: - **ASynchProcess** : separate process asynchronous: start a sub-process
-#: running the server loop. Return immediately
-ServerRunMode = Enumeration("ServerRunMode", \
- ("SynchPure", "SynchThread", "SynchProcess", \
- "AsynchThread", "AsynchProcess"))
-
-#: sardana data types (used by device pool controllers)
-DataType = Enumeration("DataType", (\
- "Integer",
- "Double",
- "String",
- "Boolean",
- "Encoded",
- "Invalid"))
-
-#: sardana data format enumeration (used by device pool controllers)
-DataFormat = Enumeration("DataFormat", (\
- "Scalar",
- "OneD",
- "TwoD",
- "Invalid"))
-
-#: sardana data access (used by device pool controllers)
-DataAccess = Enumeration("DataAccess", (\
- "ReadOnly",
- "ReadWrite",
- "Invalid"))
-
-#: dictionary dict<data type, :class:`sardana.DataType`>
-DTYPE_MAP = {
- 'int' : DataType.Integer,
- 'integer' : DataType.Integer,
- int : DataType.Integer,
- long : DataType.Integer,
- 'long' : DataType.Integer,
- DataType.Integer : DataType.Integer,
- 'float' : DataType.Double,
- 'double' : DataType.Double,
- float : DataType.Double,
- DataType.Double : DataType.Double,
- 'str' : DataType.String,
- 'string' : DataType.String,
- str : DataType.String,
- DataType.String : DataType.String,
- 'bool' : DataType.Boolean,
- 'boolean' : DataType.Boolean,
- bool : DataType.Boolean,
- DataType.Boolean : DataType.Boolean,
-}
-
-#: dictionary dict<data type, :class:`sardana.DataType`>
-R_DTYPE_MAP = {
- 'int' : int,
- 'integer' : int,
- int : int,
- long : int,
- 'long' : int,
- DataType.Integer : int,
- 'float' : float,
- 'double' : float,
- float : float,
- DataType.Double : float,
- 'str' : str,
- 'string' : str,
- str : str,
- DataType.String : str,
- 'bool' : bool,
- 'boolean' : bool,
- bool : bool,
- DataType.Boolean : bool,
-}
-
-#DTYPE_MAP.setdefault(DataType.Invalid)
-
-#: dictionary dict<access type, :class:`sardana.DataAccess`>
-DACCESS_MAP = {
- 'read' : DataAccess.ReadOnly,
- DataAccess.ReadOnly : DataAccess.ReadOnly,
- 'readwrite' : DataAccess.ReadWrite,
- 'read_write' : DataAccess.ReadWrite,
- DataAccess.ReadWrite : DataAccess.ReadWrite,
-}
-#DACCESS_MAP.setdefault(DataAccess.Invalid)
-
-def from_dtype_str(dtype):
- """Transforms the given dtype parameter (string/:obj:`DataType` or None)
- into a tuple of two elements (str, :obj:`DataFormat`) where the first
- element is a string with a simplified data type.
-
- - If None is given, it returns
- ('float', :obj:`DataFormat.Scalar`)
- - If :obj:`DataType` is given, it returns
- (:obj:`DataType`, :obj:`DataFormat.Scalar`)
-
- :param dtype: the data type to be transformed
- :type dtype: str or None or :obj:`DataType`
- :return: a tuple <str, :obj:`DataFormat`> for the given dtype
- :rtype: tuple<str, :obj:`DataFormat`>"""
- dformat = DataFormat.Scalar
- if dtype is None:
- dtype = 'float'
- elif isinstance(dtype, (str, unicode)):
- dtype = dtype.lower()
- if dtype.startswith("pytango."):
- dtype = dtype[len("pytango."):]
- if dtype.startswith("dev"):
- dtype = dtype[len("dev"):]
- if dtype.startswith("var"):
- dtype = dtype[len("var"):]
- if dtype.endswith("array"):
- dtype = dtype[:dtype.index("array")]
- dformat = DataFormat.OneD
- return dtype, dformat
-
-def from_access_str(access):
- """Transforms the given access parameter (string or :obj:`DataAccess`) into
- a simplified data access string.
-
- :param dtype: the access to be transformed
- :type dtype: str
- :return: a simple string for the given access
- :rtype: str"""
- if isinstance(access, (str, unicode)):
- access = access.lower()
- if access.startswith("pytango."):
- access = access[len("pytango."):]
- return access
-
-def to_dtype_dformat(data):
- """Transforms the given data parameter (string/ or sequence of string or
- sequence of sequence of string/:obj:`DataType`) into a tuple of two
- elements (:obj:`DataType`, :obj:`DataFormat`).
-
- :param data: the data information to be transformed
- :type data: str or seq<str> or seq<seq<str>>
- :return: a tuple <:obj:`DataType`, :obj:`DataFormat`> for the given data
- :rtype: tuple<:obj:`DataType`, :obj:`DataFormat`>
- """
- import operator
- dtype, dformat = data, DataFormat.Scalar
- if isinstance(data, (str, unicode)):
- dtype, dformat = from_dtype_str(data)
- elif operator.isSequenceType(data):
- dformat = DataFormat.OneD
- dtype = data[0]
- if type(dtype) == str:
- dtype, dformat2 = from_dtype_str(dtype)
- if dformat2 == DataFormat.OneD:
- dformat = DataFormat.TwoD
- elif operator.isSequenceType(dtype):
- dformat = DataFormat.TwoD
- dtype = dtype[0]
- if type(dtype) == str:
- dtype, _ = from_dtype_str(dtype)
- dtype = DTYPE_MAP.get(dtype, DataType.Invalid)
- return dtype, dformat
-
-def to_daccess(daccess):
- """Transforms the given access parameter (string or None) into a
- :obj:`DataAccess`. If None is given returns :obj:`DataAccess.ReadWrite`
-
- :param dtype: the access to be transformed
- :type dtype: str
- :return: a :obj:`DataAccess` for the given access
- :rtype: :obj:`DataAccess`"""
- if daccess is None:
- daccess = DataAccess.ReadWrite
- elif isinstance(daccess , (str, unicode)):
- daccess = DACCESS_MAP.get(from_access_str(daccess), DataAccess.ReadWrite)
- return daccess
-
-#: A constant representing an invalid ID
-InvalidId = 0
-
-#: A constant representing an invalid axis
-InvalidAxis = 0
-
-#: An enumeration describing the all possible element types in sardana
-ElementType = Enumeration("ElementType", (\
- "Pool",
- "Controller",
- "Motor",
- "CTExpChannel",
- "ZeroDExpChannel",
- "OneDExpChannel",
- "TwoDExpChannel",
- "ComChannel",
- "IORegister",
- "PseudoMotor",
- "PseudoCounter",
- "Constraint",
- "MotorGroup",
- "MeasurementGroup",
- "Instrument",
- "ControllerClass",
- "ControllerLibrary",
- "MacroServer",
- "Door",
- "MacroClass",
- "MacroLibrary",
- "MacroFunction",
- "External",
- "Meta",
- "ParameterType",
- "Unknown"))
-
-ET = ElementType
-
-#: a set containning all "controllable" element types.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_ELEMENTS = set((ET.Motor, ET.CTExpChannel, ET.ZeroDExpChannel, \
- ET.OneDExpChannel, ET.TwoDExpChannel, \
- ET.ComChannel, ET.IORegister, ET.PseudoMotor, \
- ET.PseudoCounter, ET.Constraint))
-
-#: a set containing all group element types.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_GROUP_ELEMENTS = set((ET.MotorGroup, ET.MeasurementGroup))
-
-#: a set containing the type of elements which are moveable.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_MOVEABLE_ELEMENTS = set((ET.Motor, ET.PseudoMotor, ET.MotorGroup))
-
-#: a set containing the possible types of physical elements.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_PHYSICAL_ELEMENTS = set((ET.Motor, ET.CTExpChannel, ET.ZeroDExpChannel, \
- ET.OneDExpChannel, ET.TwoDExpChannel, \
- ET.ComChannel, ET.IORegister))
-
-#: a set containing the possible types of acquirable elements.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_ACQUIRABLE_ELEMENTS = set((ET.Motor, ET.CTExpChannel, ET.ZeroDExpChannel, \
- ET.OneDExpChannel, ET.TwoDExpChannel, \
- ET.ComChannel, ET.IORegister, ET.PseudoMotor, \
- ET.PseudoCounter))
-
-#: a set containing the possible types of experimental channel elements.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_EXP_CHANNEL_ELEMENTS = set((ET.CTExpChannel, ET.ZeroDExpChannel, \
- ET.OneDExpChannel, ET.TwoDExpChannel, ET.PseudoCounter))
-
-#: a set containing the possible timer-able elements.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_TIMERABLE_ELEMENTS = set((ET.CTExpChannel, ET.OneDExpChannel,
- ET.TwoDExpChannel))
-
-#: a set containing the possible types of pseudo elements.
-#: Constant values belong to :class:`~sardana.sardanadefs.ElementType`
-TYPE_PSEUDO_ELEMENTS = set((ET.PseudoMotor, ET.PseudoCounter))
-
-##: An enumeration describing the all possible sardana interfaces
-#SardanaInterface = Enumeration("SardanaInterface", ( \
-# ("Object", 0b0000000000000001),
-# ("Element", 0b0000000000000011),
-# ("Class", 0b0000000000000101),
-# ("Library", 0b0000000000001001),
-# ("PoolObject", 0b0000000000010001),
-# ("PoolElement", 0b0000000000010011),
-# ("Pool", 0b0000000000110011),
-# ("Controller", 0b0000000001000001),
-# ("Moveable", 0b0000000010000001),
-# ("Acquirable", 0b0000000100000001),
-# ("Instrument", 0b0000001000000001),
-# ("Motor", 0b0000010000000001),
-# ("PseudoMotor", 0b0000100000000001),
-# ("IORegister", 0b0001000000000001),
-# ("ExpChannel", 0b0010000000000001),
-# ("CTExpChannel", 0b0100000000000001),
-# ("ZeroDExpChannel", 0b1000000000000001),
-# ("OneDExpChannel", 0b0000000000000001),
-# ("TwoDExpChannel", 0b0000000000000001),
-# ("PseudoCounter", 0b0000000000000001),
-# ("ComChannel", 0b0000000000000001),
-# ("MotorGroup", 0b0000000000000001),
-# ("MeasurementGroup", 0b0000000000000001),
-# ("ControllerLibrary", 0b0000000000000001),
-# ("ControllerClass", 0b0000000000000001),
-# ("Constraint", 0b0000000000000001),
-# ("External", 0b0000000000000001),
-
-# ("MacroServerObject", 0b0000000000000001),
-# ("MacroServerElement",0b0000000000000001),
-# ("MacroServer", 0b0000000000000001),
-# ("MacroLibrary", 0b0000000000000001),
-# ("MacroClass", 0b0000000000000001),
-# ("Macro", 0b0000000000000001), ) )
-
-#: a dictionary containing the direct interfaces supported by each type
-#: (:obj:`dict`\<:obj:`str`\, :obj:`tuple`\<:obj:`set`\<:obj:`str`\, :obj:`str`\>>>)
-INTERFACES = {
- "Meta" : (set(), "A generic sardana meta object"),
- "Object" : (set(), "A generic sardana object"),
- "Element" : (set(("Object",)), "A generic sardana element"),
- "Class" : (set(("Object",)), "A generic sardana class"),
- "Function" : (set(("Object",)), "A generic sardana function"),
- "Library" : (set(("Object",)), "A generic sardana library"),
- "PoolObject" : (set(("Object",)), "A Pool object"),
- "PoolElement" : (set(("Element", "PoolObject")), "A Pool element"),
- "Pool" : (set(("PoolElement",)), "A Pool"),
- "Controller" : (set(("PoolElement",)), "A controller"),
- "Moveable" : (set(("PoolElement",)), "A moveable element"),
- "Acquirable" : (set(("PoolElement",)), "An acquirable element"),
- "Instrument" : (set(("PoolElement",)), "An instrument"),
- "Motor" : (set(("Moveable", "Acquirable")), "a motor"),
- "PseudoMotor" : (set(("Moveable", "Acquirable")), "A pseudo motor"),
- "IORegister" : (set(("Acquirable",)), "An IO register"),
- "ExpChannel" : (set(("Acquirable",)), "A generic experimental channel"),
- "CTExpChannel" : (set(("ExpChannel",)), "A counter/timer experimental channel"),
- "ZeroDExpChannel" : (set(("ExpChannel",)), "A 0D experimental channel"),
- "OneDExpChannel" : (set(("ExpChannel",)), "A 1D experimental channel"),
- "TwoDExpChannel" : (set(("ExpChannel",)), "A 2D experimental channel"),
- "PseudoCounter" : (set(("ExpChannel",)), "A pseudo counter"),
- "ComChannel" : (set(("PoolElement",)), "A communication channel"),
- "MotorGroup" : (set(("PoolElement",),), "A motor group"),
- "MeasurementGroup" : (set(("PoolElement",),), "A measurement group"),
- "ControllerLibrary" : (set(("Library", "PoolObject")), "A controller library"),
- "ControllerClass" : (set(("Class", "PoolObject")), "A controller class"),
- "Constraint" : (set(("PoolObject",)), "A constraint"),
- "External" : (set(("Object",)), "An external object"),
-
- "MacroServerObject" : (set(("Object",)), "A generic macro server object"),
- "MacroServerElement" : (set(("Element", "MacroServerObject")), "A generic macro server element"),
- "MacroServer" : (set(("MacroServerElement",)), "A MacroServer"),
- "Door" : (set(("MacroServerElement",)), "A macro server door"),
- "MacroLibrary" : (set(("Library", "MacroServerObject")), "A macro server library"),
- "MacroCode" : (set(("MacroServerObject",)), "A macro server macro code"),
- "MacroClass" : (set(("Class", "MacroCode")), "A macro server macro class"),
- "MacroFunction" : (set(("Function", "MacroCode")), "A macro server macro function"),
- "Macro" : (set(("MacroClass", "MacroFunction")), "A macro server macro"),
-
- "ParameterType" : (set(("Meta",)), "A generic macro server parameter type"),
-}
-
-#: a dictionary containing the *all* interfaces supported by each type
-#: (:obj:`dict` <:obj:`str`, :obj:`set` < :obj:`str`> >)
-INTERFACES_EXPANDED = {}
-
-def __expand(name):
- direct_expansion, _ = INTERFACES[name]
- if isinstance(direct_expansion, (str, unicode)):
- direct_expansion = direct_expansion,
- exp = set(direct_expansion)
- for e in direct_expansion:
- e_value = INTERFACES_EXPANDED.get(e)
- if e_value is None:
- exp.update(__expand(e))
- else:
- exp.update(e_value[0])
- exp.add(name)
- return exp
-
-def __build_interfaces_expanded():
- global INTERFACES_EXPANDED
- for i in INTERFACES:
- INTERFACES_EXPANDED[i] = __expand(i), INTERFACES[i][1]
-
-__build_interfaces_expanded()
-
-def __expand_sardana_interface_data(si_map, name, curr_id):
- if name in si_map:
- return curr_id
- d = 0
- i_expanded = set(INTERFACES_EXPANDED[name][0])
- i_expanded.remove(name)
- for interface in i_expanded:
- if interface not in si_map:
- curr_id = __expand_sardana_interface_data(si_map, interface, curr_id)
- d |= si_map[interface]
- si_map[name] = long(d | curr_id)
- return 2 * curr_id
-
-def __root_expand_sardana_interface_data():
- curr_id = 1
- si_map = {}
- for interface in INTERFACES_EXPANDED:
- curr_id = __expand_sardana_interface_data(si_map, interface, curr_id)
- return si_map
-
-#: An enumeration describing the all possible sardana interfaces
-Interface = Enumeration("Interface",
- __root_expand_sardana_interface_data().items())
-
-def __create_sardana_interfaces():
- interfaces, interfaces_expanded = {}, {}
- for i in INTERFACES:
- i_enum = Interface[i]
- i_items, i_items_expanded = INTERFACES[i][0], INTERFACES_EXPANDED[i][0]
- i_enum_items = set(map(Interface.get, i_items))
- i_enum_items_expanded = set(map(Interface.get, i_items_expanded))
- interfaces[i_enum] = i_enum_items
- interfaces_expanded[i_enum] = i_enum_items_expanded
- return interfaces, interfaces_expanded
-
-_Interfaces, _InterfacesExpanded = __create_sardana_interfaces()
-
-
-#: a dictionary containing the direct interfaces supported by each type
-#: (:obj:`dict` <:obj:`sardana.sardanadefs.Interface`, :obj:`set` < :obj:`sardana.sardanadefs.Interface`> >)
-Interfaces = _Interfaces
-
-#: a dictionary containing the *all* interfaces supported by each type.
-#: (:obj:`dict` <:obj:`sardana.sardanadefs.Interface`, :obj:`set` < :obj:`sardana.sardanadefs.Interface`> >)
-InterfacesExpanded = _InterfacesExpanded
-
-
-class ScalarNumberFilter(object):
- """A simple scalar number filter that returns ``False`` if two numbers are
- indentical (i.e. |a-b| < error)"""
-
- def __call__(self, a, b):
- try:
- return math.fabs(a - b) > EpsilonError
- except:
- return a != b
diff --git a/src/sardana/sardanaevent.py b/src/sardana/sardanaevent.py
deleted file mode 100644
index 339f7a5d..00000000
--- a/src/sardana/sardanaevent.py
+++ /dev/null
@@ -1,190 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Pool libray. It defines the base classes
-for pool event mechanism"""
-
-from __future__ import absolute_import
-
-__all__ = ["EventGenerator", "EventReceiver", "EventType"]
-
-__docformat__ = 'restructuredtext'
-
-import weakref
-import collections
-
-from sardana.sardanautils import is_callable
-from taurus.core.util.event import CallableRef, BoundMethodWeakref
-
-
-def _get_callable_ref(listener, callback=None):
- """Returns a callable reference for the given listener"""
- meth = getattr(listener, 'event_received', None)
- if meth is not None and is_callable(meth):
- return weakref.ref(listener, callback)
- else:
- return CallableRef(listener, callback)
-
-
-class EventGenerator(object):
- """A class capable of generating events to their listeners"""
-
- def __init__(self, max_queue_len=10, listeners=None):
- self._listeners = []
- self._event_queue = collections.deque(maxlen=max_queue_len)
- if listeners is not None:
- if not isinstance(listeners, collections.Sequence):
- listeners = listeners,
- for listener in listeners:
- self.add_listener(listener)
-
- def _listener_died(self, weak_listener):
- """Callback executed when a listener dies"""
- if self._listeners is None:
- return
- try:
- self._listeners.remove(weak_listener)
- except ValueError:
- pass
-
- def add_listener(self, listener):
- """Adds a new listener for this object.
-
- :param listener: a listener"""
- if self._listeners is None or listener is None:
- return False
-
- weak_listener = _get_callable_ref(listener, self._listener_died)
- if weak_listener in self._listeners:
- return False
- self._listeners.append(weak_listener)
- return True
-
- def remove_listener(self, listener):
- """Removes an existing listener for this object.
-
- :param listener: the listener to be removed
- :return: True is succeeded or False otherwise"""
- if self._listeners is None:
- return
- weak_listener = _get_callable_ref(listener)
- try:
- self._listeners.remove(weak_listener)
- except ValueError:
- return False
- return True
-
- def has_listeners(self):
- """Returns True if anybody is listening to events from this object
-
- :return: True is at least one listener is listening or False otherwise
- """
- if self._listeners is None:
- return False
- return len(self._listeners) > 0
-
- def fire_event(self, event_type, event_value, listeners=None):
- self.flush_queue()
- self._fire_event(event_type, event_value, listeners=listeners)
-
- def _fire_event(self, event_type, event_value, listeners=None):
- """Sends an event to all listeners or a specific one"""
- if listeners is None:
- listeners = self._listeners
- if listeners is None:
- return
- if not isinstance(listeners, collections.Sequence):
- listeners = listeners,
- for listener in listeners:
- if isinstance(listener, weakref.ref) or \
- isinstance(listener, BoundMethodWeakref):
- real_listener = listener()
- else:
- real_listener = listener
- if real_listener is None:
- continue
- meth = getattr(real_listener, 'event_received', None)
- if meth is not None and is_callable(meth):
- real_listener.event_received(self, event_type, event_value)
- elif is_callable(real_listener):
- real_listener(self, event_type, event_value)
-
- def queue_event(self, event_type, event_value, listeners=None):
- queue = self._event_queue
- queue.append((event_type, event_value, listeners))
-
- def flush_queue(self):
- queue = self._event_queue
- n = len(queue)
- while n > 0:
- self._fire_event(*queue.pop())
- n = n - 1
-
-
-class EventReceiver(object):
- """A simple class that implements useful features for a class which is
- an event receiver. The actual class may inherit from this EventReceiver class
- and may choose to use just a part of the API provided by this class, the
- whole API or none of the API."""
-
- def __init__(self):
- self._events_blocked = False
-
- def block_events(self):
- self._events_blocked = True
-
- def unblock_events(self):
- self._events_blocked = False
-
- def are_events_blocked(self):
- return self._events_blocked
-
-
-class EventType(object):
- """Definition of an event type"""
-
- def __init__(self, name, priority=0):
- self.name = name
- self.priority = priority
-
- def __str__(self):
- return "EventType(name=%s, priority=%s)" % (self.name, self.priority)
-
- def __repr__(self):
- return "EventType(name=%s, priority=%s)" % (self.name, self.priority)
-
- def get_name(self):
- """Returns this event name
-
- :return: this event name
- :rtype: str"""
- return self.name
-
- def get_priority(self):
- """Returns this event priority
-
- :return: this event priority
- :rtype: str"""
- return self.priority
diff --git a/src/sardana/sardanaexception.py b/src/sardana/sardanaexception.py
deleted file mode 100644
index ca28fba8..00000000
--- a/src/sardana/sardanaexception.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines the base classes
-for sardana exceptions"""
-
-from __future__ import absolute_import
-
-__all__ = [ "AbortException", "SardanaException", "SardanaExceptionList",
- "UnknownCode", "UnknownLibrary", "LibraryError",
- "format_exception_only", "format_exception_only_str"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import traceback
-
-
-def format_exception_only(etype, value):
- msg = traceback.format_exception_only(etype, value)
- if msg[-1].endswith("\n"):
- msg[-1] = msg[-1][:-1]
- return msg
-
-def format_exception_only_str(etype, value):
- return "".join(format_exception_only(etype, value))
-
-class AbortException(Exception):
- pass
-
-
-class SardanaException(Exception):
-
- def __init__(self, *args, **kwargs):
- Exception.__init__(self, *args)
- if args:
- a1 = args[0]
- if isinstance(a1, dict):
- self.msg = a1.get("message", a1.get("msg", None))
- self.traceback = a1.get("traceback", a1.get("tb", None))
- self.type = a1.get("type", self.__class__.__name__)
- else:
- self.msg = str(a1)
- self.traceback = None
- self.type = self.__class__.__name__
- else:
- exc_info = kwargs.get("exc_info")
- if exc_info is None:
- self.msg = "Unknown sardana exception"
- else:
- msg = format_exception_only_str(*exc_info[:2])
- self.msg = msg
- self.traceback = None
- self.type = self.__class__.__name__
- if 'exc_info' in kwargs:
- self.exc_info = kwargs['exc_info']
- else:
- self.exc_info = kwargs.get('exc_info', sys.exc_info())
-
- def __str__(self):
- return self.msg
-
- def __repr__(self):
- return "%s: %s" % (self.type, self.msg)
-
-
-class SardanaExceptionList(SardanaException):
- def __init__(self, *args):
- SardanaException.__init__(self, *args)
- self.exceptions = args[0]
-
-
-class UnknownCode(SardanaException):
- pass
-
-
-class UnknownLibrary(SardanaException):
- pass
-
-
-class LibraryError(SardanaException):
- pass
-
diff --git a/src/sardana/sardanalock.py b/src/sardana/sardanalock.py
deleted file mode 100644
index 06749191..00000000
--- a/src/sardana/sardanalock.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines a *slow* lock
-class that provides additional debugging information"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaLock"]
-
-__docformat__ = 'restructuredtext'
-
-import logging
-import threading
-
-_VERBOSE = True
-
-
-def SardanaLock(verbose=None, name=None, lock=None):
- if verbose is None:
- verbose = _VERBOSE
- if verbose:
- return _SardanaLock(name=name, lock=lock)
- if lock is None:
- return threading.Lock()
- return lock
-
-
-class _SardanaLock(object):
- """A sardana lock"""
-
- def __init__(self, name=None, lock=None, level=logging.DEBUG):
- name = name or self.__class__.__name__
- self.__name = name
- self.__logger = logging.getLogger(name=name)
- self.__level = level
- if lock is None:
- lock = threading.Lock()
- self.__block = lock
- self.__owner = None
-
- def __repr__(self):
- owner = self.__owner
- if owner is not None:
- owner = owner.name
- return "<%s owner=%r>" % (self.__name, owner)
-
- def owner_name(self):
- owner = self.__owner
- if owner is not None:
- return owner.name
-
- def _note(self, msg, *args):
- self.__logger.log(self.__level, msg, *args)
-
- def acquire(self, blocking=1):
- if __debug__:
- self._note("[START] acquire(%s) [owner=%s]", blocking,
- self.owner_name())
- rc = self.__block.acquire(blocking)
- me = threading.current_thread()
- if rc:
- self.__owner = me
- state = "success"
- else:
- state = "failure"
- if __debug__:
- self._note("[ END ] acquire(%s) %s [owner=%s]", blocking, state,
- self.owner_name())
- return rc
-
- __enter__ = acquire
-
- def release(self):
- if __debug__:
- self._note("[START] release() [owner=%s]", self.owner_name())
- self.__block.release()
- self.__owner = None
- if __debug__:
- self._note("[ END ] release() [owner=%s]", self.owner_name())
-
- def __exit__(self, t, v, tb):
- self.release()
diff --git a/src/sardana/sardanamanager.py b/src/sardana/sardanamanager.py
deleted file mode 100644
index 93164fad..00000000
--- a/src/sardana/sardanamanager.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines the base class
-for Sardana manager"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaElementManager", "SardanaIDManager"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.util.codecs import CodecFactory
-
-from sardana import InvalidId
-
-
-class SardanaElementManager(object):
- """A class capable of manage elements"""
-
- SerializationProtocol = 'json'
-
- def get_serialization_protocol(self):
- return self.SerializationProtocol
-
- def set_serialization_protocol(self, protocol):
- self.SerializationProtocol = protocol
-
- serialization_protocol = property(get_serialization_protocol,
- set_serialization_protocol,
- doc="the serialization protocol")
-
- def serialize_element(self, element, *args, **kwargs):
- obj = element.serialize(*args, **kwargs)
- return self.serialize_object(obj)
-
- def serialize_object(self, obj, *args, **kwargs):
- return CodecFactory().encode(self.serialization_protocol, ('', obj),
- *args, **kwargs)[1]
-
- def str_element(self, element, *args, **kwargs):
- obj = element.serialize(*args, **kwargs)
- return self.str_object(obj)
-
- def str_object(self, obj, *args, **kwargs):
- # TODO: use the active codec instead of hardcoded json
- return CodecFactory().encode('json', ('', obj), *args, **kwargs)[1]
-
-
-class SardanaIDManager(object):
- """A class capable of manage ids"""
-
- _last_id = InvalidId
-
- def get_new_id(self):
- """Returns a new ID. The ID becomes reserved at this moment.
-
- :return: a new ID
- :rtype: int"""
- self._last_id += 1
- return self._last_id
-
- def rollback_id(self):
- """Free previously reserved ID"""
- self._last_id -= 1
-
- def reserve_id(self, nid):
- """Marks the given ID as reserved
-
- :param id: the ID to be reserved
- :type id: int"""
- assert type(nid) == int
- if nid > self._last_id:
- self._last_id = nid
- \ No newline at end of file
diff --git a/src/sardana/sardanameta.py b/src/sardana/sardanameta.py
deleted file mode 100644
index acc8e348..00000000
--- a/src/sardana/sardanameta.py
+++ /dev/null
@@ -1,510 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines the base
-classes for MetaLibrary and MetaClass"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaLibrary", "SardanaClass", "SardanaFunction"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import inspect
-import string
-import weakref
-import linecache
-import traceback
-
-from sardana.sardanabase import SardanaBaseObject
-
-
-# ----------------------------------------------------------------------------
-# Start patch around inspect issue http://bugs.python.org/issue993580
-
-def findsource(obj):
- """Return the entire source file and starting line number for an object.
-
- The argument may be a module, class, method, function, traceback, frame,
- or code object. The source code is returned as a list of all the lines
- in the file and the line number indexes a line in that list. An IOError
- is raised if the source code cannot be retrieved."""
- filename = inspect.getsourcefile(obj)
- if filename:
- linecache.checkcache(filename)
- return inspect.findsource(obj)
-
-def getsourcelines(object):
- """Return a list of source lines and starting line number for an object.
-
- The argument may be a module, class, method, function, traceback, frame,
- or code object. The source code is returned as a list of the lines
- corresponding to the object and the line number indicates where in the
- original source file the first line of code was found. An IOError is
- raised if the source code cannot be retrieved."""
- lines, lnum = findsource(object)
-
- if inspect.ismodule(object): return lines, 0
- else: return inspect.getblock(lines[lnum:]), lnum + 1
-
-def getsource(object):
- """Return the text of the source code for an object.
-
- The argument may be a module, class, method, function, traceback, frame,
- or code object. The source code is returned as a single string. An
- IOError is raised if the source code cannot be retrieved."""
- lines, lnum = getsourcelines(object)
- return string.join(lines, '')
-
-# End patch around inspect issue http://bugs.python.org/issue993580
-# ----------------------------------------------------------------------------
-
-
-class SardanaLibrary(SardanaBaseObject):
- """Object representing a python module containing sardana classes.
- Public members:
-
- - module - reference to python module
- - file_path - complete (absolute) path (with file name at the end)
- - file_name - file name (including file extension)
- - path - complete (absolute) path
- - name - (=module name) module name (without file extension)
- - meta_classes - dict<str, SardanMetaClass>
- - exc_info - exception information if an error occurred when loading
- the module"""
-
- description = '<Undocumented>'
-
- def __init__(self, **kwargs):
- self.module = module = kwargs.pop('module', None)
- self.file_path = file_path = kwargs.pop('file_path', None)
- self.exc_info = kwargs.pop('exc_info', None)
- if module is not None:
- file_path = os.path.abspath(module.__file__)
- self.file_path = file_path
- if file_path is None:
- self.path = kwargs.get('path', None)
- self.file_name = kwargs.get('file_name', None)
- name = kwargs.get('name', None)
- else:
- if self.file_path.endswith(".pyc"):
- self.file_path = self.file_path[:-1]
- self.path, self.file_name = os.path.split(self.file_path)
- name, _ = os.path.splitext(self.file_name)
- self.meta_classes = {}
- self.meta_functions = {}
- if module is not None and module.__doc__:
- self.description = module.__doc__
- self._code = getsourcelines(module)[0]
- else:
- self.description = name + " in error!"
- self._code = None
- kwargs['name'] = name
- kwargs['full_name'] = file_path or name
- SardanaBaseObject.__init__(self, **kwargs)
-
- def __cmp__(self, o):
- return cmp(self.full_name, o.full_name)
-
- def __str__(self):
- return self.name
-
- @property
- def module_name(self):
- """Returns the module name for this library.
-
- :return: the module name
- :rtype: str"""
- return self.name
-
- @property
- def code(self):
- """Returns a sequence of sourcelines corresponding to the module code.
-
- :return: list of source code lines
- :rtype: list<str>"""
- code = self._code
- if code is None:
- raise IOError('source code not available')
- return code
-
- def add_meta_class(self, meta_class):
- """Adds a new :class:~`sardana.sardanameta.SardanaClass` to this
- library.
-
- :param meta_class: the meta class to be added to this library
- :type meta_class: :class:~`sardana.sardanameta.SardanaClass`"""
- self.meta_classes[meta_class.name] = meta_class
-
- def get_meta_class(self, meta_class_name):
- """Returns a :class:~`sardana.sardanameta.SardanaClass` for the
- given meta class name or None if the meta class does not exist in this
- library.
-
- :param meta_class_name: the meta class name
- :type meta_class_name: str
- :return: a meta class or None
- :rtype: :class:~`sardana.sardanameta.SardanaClass`"""
- return self.meta_classes.get(meta_class_name)
-
- def get_meta_classes(self):
- """Returns a sequence of the meta classes that belong to this library.
-
- :return: a sequence of meta classes that belong to this library
- :rtype: seq<:class:~`sardana.sardanameta.SardanaClass`>"""
- return self.meta_classes.values()
-
- def has_meta_class(self, meta_class_name):
- """Returns True if the given meta class name belongs to this library
- or False otherwise.
-
- :param meta_class_name: the meta class name
- :type meta_class_name: str
-
- :return: True if the given meta class name belongs to this library
- or False otherwise
- :rtype: bool"""
- return meta_class_name in self.meta_classes
-
- def add_meta_function(self, meta_function):
- """Adds a new :class:~`sardana.sardanameta.SardanaFunction` to this
- library.
-
- :param meta_function: the meta function to be added to this library
- :type meta_function: :class:~`sardana.sardanameta.SardanaFunction`"""
- self.meta_functions[meta_function.name] = meta_function
-
- def get_meta_function(self, meta_function_name):
- """Returns a :class:~`sardana.sardanameta.SardanaFunction` for the
- given meta function name or None if the meta function does not exist in
- this library.
-
- :param meta_function_name: the meta function name
- :type meta_function_name: str
- :return: a meta function or None
- :rtype: :class:~`sardana.sardanameta.SardanaFunction`"""
- return self.meta_functions.get(meta_function_name)
-
- def get_meta_functions(self):
- """Returns a sequence of the meta functions that belong to this library.
-
- :return: a sequence of meta functions that belong to this library
- :rtype: seq<:class:~`sardana.sardanameta.SardanaFunction`>"""
- return self.meta_functions.values()
-
- def has_meta_function(self, meta_function_name):
- """Returns True if the given meta function name belongs to this library
- or False otherwise.
-
- :param meta_function_name: the meta function name
- :type meta_function_name: str
-
- :return: True if the given meta function name belongs to this library
- or False otherwise
- :rtype: bool"""
- return meta_function_name in self.meta_functions
-
- def get_meta(self, meta_name):
- """Returns a :class:~`sardana.sardanameta.SardanaCode` for the
- given meta name or None if the meta does not exist in this library.
-
- :param meta_name: the meta name (class, function)
- :type meta_name: str
- :return: a meta or None
- :rtype: :class:~`sardana.sardanameta.SardanaCode`"""
- ret = self.get_meta_class(meta_name)
- if ret is None:
- ret = self.get_meta_function(meta_name)
- return ret
-
- def has_meta(self, meta_name):
- """Returns True if the given meta name belongs to this library
- or False otherwise.
-
- :param meta_name: the meta name
- :type meta_name: str
-
- :return:
- True if the given meta (class or function) name belongs to this
- library or False otherwise
- :rtype: bool"""
- return self.has_meta_class(meta_name) or \
- self.has_meta_function(meta_name)
-
- def get_metas(self):
- """Returns a sequence of the meta (class and functions) that belong to
- this library.
-
- :return:
- a sequence of meta (class and functions) that belong to this library
- :rtype: seq<:class:~`sardana.sardanameta.SardanaCode`>"""
- return self.get_meta_classes() + self.get_meta_functions()
-
- def get_name(self):
- """Returns the module name for this library (same as
- :meth:~sardana.sardanameta.SardanaLibrary.get_module_name).
-
- :return: the module name
- :rtype: str"""
- return self.name
-
- def get_module_name(self):
- """Returns the module name for this library (same as
- :meth:~sardana.sardanameta.SardanaLibrary.get_name).
-
- :return: the module name
- :rtype: str"""
- return self.module_name
-
- def get_module(self):
- """Returns the python module for this library.
-
- :return: the python module
- :rtype: object"""
- return self.module
-
- def get_description(self):
- """Returns the this library documentation or "<Undocumented>" if no
- documentation exists.
-
- :return: this library documentation or None
- :rtype: str"""
- return self.description
-
- def get_code(self):
- """Returns a sequence of sourcelines corresponding to the module code.
-
- :return: list of source code lines
- :rtype: list<str>"""
- return self.code
-
- def get_file_path(self):
- """Returns the file path for this library. On posix systems is something
- like: /abs/path/filename.py
-
- :return: this library file path
- :rtype: str"""
- if self.file_path is None:
- return None
- if self.file_path.endswith('.pyc'):
- return self.file_path[:-1]
- return self.file_path
-
- def get_file_name(self):
- """Returns the file name for this library. On posix systems is something
- like: filename.py
-
- :return: this library file name
- :rtype: str"""
- return self.file_name
-
- def has_errors(self):
- """Returns True if this library has syntax errors or False otherwise.
-
- :return: True if this library has syntax errors or False otherwise
- :rtype: bool"""
- return self.exc_info != None
-
- def set_error(self, exc_info):
- """Sets the error information for this library
-
- :param exc_info: error information. It must be an object similar to the
- one returned by :func:`sys.exc_info`
- :type exc_info: tuple<type, value, traceback>"""
- self.exc_info = exc_info
- if exc_info is None:
- self.meta_classes = {}
- self.meta_functions = {}
-
- def get_error(self):
- """Gets the error information for this library or None if no error
- exists
-
- :return: error information. An object similar to the one returned by
- :func:`sys.exc_info`
- :rtype: tuple<type, value, traceback>"""
- return self.exc_info
-
- def serialize(self, *args, **kwargs):
- """Returns a serializable object describing this object.
-
- :return: a serializable dict
- :rtype: dict"""
- kwargs = SardanaBaseObject.serialize(self, *args, **kwargs)
- kwargs['id'] = 0
- kwargs['module'] = self.name
- kwargs['file_path'] = self.file_path
- kwargs['file_name'] = self.file_name
- kwargs['path'] = self.path
- kwargs['description'] = self.description
- kwargs['elements'] = self.meta_classes.keys() + self.meta_functions.keys()
- if self.exc_info is None:
- kwargs['exc_summary'] = None
- kwargs['exc_info'] = None
- else:
- kwargs['exc_summary'] = "".join(traceback.format_exception_only(*self.exc_info[:2]))
- kwargs['exc_info'] = "".join(traceback.format_exception(*self.exc_info))
- return kwargs
-
-
-class SardanaCode(SardanaBaseObject):
- """Object representing a python code (base for class and function)."""
-
- description = '<Undocumented>'
-
- def __init__(self, **kwargs):
- lib = kwargs.pop('lib')
- self._lib = weakref.ref(lib)
- self._code_obj = kwargs.pop('code')
- doc = self._code_obj.__doc__
- if doc:
- self.description = doc
- self._code = getsourcelines(self._code_obj)
- name = kwargs['name']
- kwargs['full_name'] = "{0}.{1}".format(lib.name, name)
- kwargs['parent'] = kwargs.pop('parent', self.lib)
- SardanaBaseObject.__init__(self, **kwargs)
-
- @property
- def code_object(self):
- return self._code_obj
-
- @property
- def lib(self):
- """Returns the library :class:~`sardana.sardanameta.SardanaLibrary`
- for this class.
-
- :return: a reference to the library where this class is located
- :rtype: :class:~`sardana.sardanameta.SardanaLibrary`"""
- return self._lib()
-
- @property
- def module(self):
- """Returns the python module for this class.
-
- :return: the python module
- :rtype: object"""
- return self.lib.module
-
- @property
- def module_name(self):
- """Returns the module name for this class.
-
- :return: the module name
- :rtype: str"""
- return self.lib.get_module_name()
-
- @property
- def file_path(self):
- """Returns the file path for for the library where this class is. On
- posix systems is something like: /abs/path/filename.py
-
- :return: the file path for for the library where this class is
- :rtype: str"""
- return self.lib.file_path
-
- @property
- def file_name(self):
- """Returns the file name for the library where this class is. On posix
- systems is something like: filename.py
-
- :return: the file name for the library where this class is
- :rtype: str"""
- return self.lib.file_name
-
- @property
- def path(self):
- """Returns the absolute path for the library where this class is. On
- posix systems is something like: /abs/path
-
- :return: the absolute path for the library where this class is
- :rtype: str"""
- return self.lib.path
-
- @property
- def code(self):
- """Returns a tuple (sourcelines, firstline) corresponding to the
- definition of this code object. sourcelines is a list of source code
- lines. firstline is the line number of the first source code line."""
- code = self._code
- if code is None:
- raise IOError('source code not available')
- return code
-
- def get_code(self):
- """Returns a tuple (sourcelines, firstline) corresponding to the
- definition of the controller class. sourcelines is a list of source code
- lines. firstline is the line number of the first source code line."""
- return self.code
-
- def serialize(self, *args, **kwargs):
- """Returns a serializable object describing this object.
-
- :return: a serializable dict
- :rtype: dict"""
- kwargs = SardanaBaseObject.serialize(self, *args, **kwargs)
- kwargs['id'] = 0
- kwargs['module'] = self.module_name
- kwargs['file_name'] = self.file_name
- kwargs['file_path'] = self.file_path
- kwargs['path'] = self.path
- kwargs['description'] = self.description
- return kwargs
-
- def get_brief_description(self, max_chars=60):
- desc = self.description.replace('\n', ' ')
- if len(desc) > (max_chars - 5):
- desc = desc[:max_chars - 5] + '[...]'
- return desc
-
-
-class SardanaClass(SardanaCode):
- """Object representing a python class."""
-
- def __init__(self, **kwargs):
- klass = kwargs.pop('klass')
- kwargs['code'] = klass
- kwargs['name'] = kwargs.pop('name', klass.__name__)
- SardanaCode.__init__(self, **kwargs)
-
- @property
- def klass(self):
- return self.code_object
-
-
-class SardanaFunction(SardanaCode):
- """Object representing a python function."""
-
- def __init__(self, **kwargs):
- function = kwargs.pop('function')
- kwargs['code'] = function
- kwargs['name'] = kwargs.pop('name', function.func_name)
- SardanaCode.__init__(self, **kwargs)
-
- @property
- def function(self):
- return self.code_object
-
diff --git a/src/sardana/sardanamodulemanager.py b/src/sardana/sardanamodulemanager.py
deleted file mode 100644
index 0abb7299..00000000
--- a/src/sardana/sardanamodulemanager.py
+++ /dev/null
@@ -1,288 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana library. It defines the base
-classes for module manager"""
-
-from __future__ import with_statement
-from __future__ import absolute_import
-
-__all__ = ["ModuleManager"]
-
-__docformat__ = 'restructuredtext'
-
-import imp
-import sys
-import threading
-
-from taurus.core import ManagerState
-from taurus.core.util.log import Logger
-from taurus.core.util.singleton import Singleton
-
-from .sardanamanager import SardanaIDManager
-
-_MINIMUM_EXCLUDE = [
-'sys',
-'os.path',
-'__builtin__',
-'__main__',
-'sardana',
-'taurus',
-'PyTango'
-]
-
-
-class PathContext(object):
-
- def __init__(self, path):
- self.path = path
-
- def __enter__(self):
- self.orig_path = list(sys.path)
- if self.path is not None:
- sys.path = self.path + sys.path
-
- def __exit__(self, etype, evalue, etraceback):
- sys.path = self.orig_path
-
-
-class PathManager(SardanaIDManager):
-
- def __init__(self):
- SardanaIDManager.__init__(self)
- self._orig_path = list(sys.path)
- self._path_lock = threading.Lock()
- #: dict<int(path_id), list<int(path start index), list<str(path)>>
- self._path_info = {}
-
- @staticmethod
- def _decode_path(path):
- p = []
- for item in path:
- p.extend(item.split(":"))
- return p
-
- def add_python_path(self, path):
- """Adds a new path to the python path.
-
- :param path:
- a sequence of strings each string may contain an absolute path or a
- list of ":" or "\n" separated absolute paths
- :type path: list<str>
- :return:
- a path id identifying the changes that were made to sys.path. This
- ID can be used in :meth:`remove_path` to remove only the added path
- :rtype: int"""
- path = self._decode_path(path)
- path_len = len(path)
- pif = self._path_info
-
- with self._path_lock:
- path_id = self.get_new_id()
-
- for _, p_info in pif.items():
- p_info[0] += path_len
-
- pif[path_id] = [0, path]
- sys.path = path + sys.path
- return path_id
-
- def remove_python_path(self, path_id):
- """Removes the path given by the path_id
-
- :param path_id:
- a path id identifying specific changes that were made to sys.path
- :type path_id: int"""
- pif = self._path_info
- start, path = pif[path_id]
- path_len = len(path)
-
- with self._path_lock:
- sys.path = sys.path[:start + 1] + sys.path[start + path_len:]
- del pif[path_id]
-
- def reset_python_path(self):
- with self._path_lock:
- sys.path = list(self._orig_path)
- self._path_info = {}
-
-
-class ModuleManager(Singleton, Logger):
- """This class handles python module loading/reloading and unloading."""
-
- def __init__(self):
- """ Initialization. Nothing to be done here for now."""
- pass
-
- def init(self, *args, **kwargs):
- """Singleton instance initialization."""
- name = self.__class__.__name__
- self._state = ManagerState.UNINITIALIZED
- self._path_manager = PathManager()
- self.call__init__(Logger, name)
- self.reInit()
-
- def reInit(self):
- if self._state == ManagerState.INITED:
- return
-
- # dict<str, module>
- # key - module name (without path and without extension)
- # value - python module object reference
- self._modules = {}
-
- self._state = ManagerState.INITED
-
- def cleanUp(self):
- if self._state == ManagerState.CLEANED:
- return
-
- self.unloadModules()
-
- self._modules = None
-
- self._state = ManagerState.CLEANED
-
- def reset_python_path(self):
- return self._path_manager.reset_python_path()
-
- def remove_python_path(self, path_id):
- return self._path_manager.remove_python_path(path_id)
-
- def add_python_path(self, path):
- return self._path_manager.add_python_path(path)
-
- def findFullModuleName(self, module_name, path=None):
- mfile = None
- try:
- mfile, pathname, _ = imp.find_module(module_name, path)
- finally:
- if mfile is not None:
- mfile.close()
- return pathname
-
- def reloadModule(self, module_name, path=None, reload=True):
- """Loads/reloads the given module name"""
-
- if not reload:
- return self.loadModule(module_name, path=path)
-
- self.unloadModule(module_name)
-
- m, mfile = None, None
- try:
- mfile, pathname, desc = imp.find_module(module_name, path)
- self.info("(re)loading module %s...", module_name)
- m = imp.load_module(module_name, mfile, pathname, desc)
- except:
- self.error("Error (re)loading module %s", module_name)
- self.debug("Details:", exc_info=1)
- raise
- finally:
- if mfile is not None:
- mfile.close()
-
- if m is None:
- return
-
- self._modules[module_name] = m
-
- return m
-
- def deep_reload_module(self, module_name, path=None, exclude=None):
-
- if module_name in sys.modules:
- module = sys.modules[module_name]
- else:
- module = self.loadModule(module_name, path)
-
- excl = list(_MINIMUM_EXCLUDE)
- if exclude is not None:
- excl.extend(exclude)
-
- import sardana.util.deepreload
- with PathContext(path):
- try:
- self.info("deep reloading module %s...", module_name)
- sardana.util.deepreload.reload(module, excl)
- except:
- self.error("Error deep reloading module %s", module_name)
- self.debug("Details:", exc_info=1)
- raise
-
- def loadModule(self, module_name, path=None):
- """Loads the given module name. If the module has been already loaded
- into this python interpreter, nothing is done.
-
- :param module_name: the module to be loaded.
- :type module_name: str
- :param path: list of paths to look for modules [default: None]
- :type path: seq<str> or None
- :return: python module
-
- :raises: ImportError"""
-
- if module_name in sys.modules:
- return sys.modules[module_name]
-
- with PathContext(path):
- self.info("loading module %s...", module_name)
- try:
- module = __import__(module_name, globals(), locals(), [], -1)
- except:
- self.error("Error loading module %s", module_name)
- self.debug("Details:", exc_info=1)
- raise
-
- self._modules[module_name] = module
-
- return module
-
- def unloadModule(self, module_name):
- """Unloads the given module name"""
- if self._modules.has_key(module_name):
- self.debug("unloading module %s" % module_name)
- assert(sys.modules.has_key(module_name))
- self._modules.pop(module_name)
- del sys.modules[module_name]
-
- def unloadModules(self, module_list=None):
- """Unloads the given module name"""
- modules = module_list or self._modules.keys()
- for module in modules:
- self.unloadModule(module)
-
- def getModule(self, module_name):
- """Returns the module object for the given module name"""
- m = self._modules.get(module_name)
- if m is None:
- m = self.reloadModule(module_name)
- return m
-
- def getModuleNames(self):
- module_names = self._modules.keys()
- module_names.sort()
- return module_names
-
diff --git a/src/sardana/sardanathreadpool.py b/src/sardana/sardanathreadpool.py
deleted file mode 100644
index 2efd1ddc..00000000
--- a/src/sardana/sardanathreadpool.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the function to access sardana thread pool"""
-
-from __future__ import with_statement
-from __future__ import absolute_import
-
-__all__ = ["get_thread_pool"]
-
-__docformat__ = 'restructuredtext'
-
-import threading
-
-from taurus.core.util.threadpool import ThreadPool
-
-__thread_pool_lock = threading.Lock()
-__thread_pool = None
-
-
-def get_thread_pool():
- """Returns the global pool of threads for Sardana
-
- :return: the global pool of threads object
- :rtype: taurus.core.util.ThreadPool"""
-
- global __thread_pool
- global __thread_pool_lock
- with __thread_pool_lock:
- if __thread_pool is None:
- __thread_pool = ThreadPool(name="SardanaTP", Psize=10)
- return __thread_pool
diff --git a/src/sardana/sardanautils.py b/src/sardana/sardanautils.py
deleted file mode 100644
index ae3debe6..00000000
--- a/src/sardana/sardanautils.py
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana library. It defines some
-utility methods"""
-
-from __future__ import absolute_import
-
-__all__ = ["is_pure_str", "is_non_str_seq", "is_integer", "is_number",
- "is_bool", "check_type", "assert_type", "str_to_value",
- "is_callable", "translate_version_str2int",
- "translate_version_str2list"]
-
-__docformat__ = 'restructuredtext'
-
-import numpy
-import numbers
-import collections
-
-from sardana.sardanadefs import DataType, DataFormat, DTYPE_MAP, R_DTYPE_MAP
-
-__str_klasses = [str]
-__int_klasses = [int, numpy.integer]
-__number_klasses = [numbers.Number, numpy.number]
-
-__DTYPE_MAP = dict(DTYPE_MAP)
-
-__use_unicode = False
-try:
- unicode
- __use_unicode = True
- __str_klasses.append(unicode)
- __DTYPE_MAP[unicode] = DataType.String
-except:
- pass
-
-__use_long = False
-try:
- long
- __use_long = True
- __int_klasses.append(long)
- __DTYPE_MAP[long] = DataType.Integer
-except:
- pass
-
-__bool_klasses = [bool] + __int_klasses
-
-__str_klasses = tuple(__str_klasses)
-__int_klasses = tuple(__int_klasses)
-__number_klasses = tuple(__number_klasses)
-__bool_klasses = tuple(__bool_klasses)
-
-def is_pure_str(obj):
- return isinstance(obj , __str_klasses)
-
-def is_non_str_seq(obj):
- return isinstance(obj, collections.Sequence) and not is_pure_str(obj)
-
-def is_integer(obj):
- return isinstance(obj, __int_klasses)
-
-def is_number(obj):
- return isinstance(obj, __number_klasses)
-
-def is_bool(obj):
- return isinstance(obj, __bool_klasses)
-
-def is_callable(obj):
- return hasattr(obj, "__call__")
-
-__METH_MAP = {
- DataType.Integer : is_integer,
- DataType.Double : is_number,
- DataType.String : is_pure_str,
- DataType.Boolean : is_bool,
-}
-
-def check_type(type_info, value):
- tinfo = __DTYPE_MAP.get(type_info, type_info)
- tmeth = __METH_MAP.get(tinfo, type_info)
- return tmeth(value)
-
-def assert_type(type_info, value):
- ret = check_type(type_info, value)
- if not ret:
- expected = R_DTYPE_MAP[type_info]
- recv = type(value)
- try:
- expected = expected.__name__
- except:
- expected = str(expected)
- try:
- recv = recv.__name__
- except:
- recv = str(recv)
- raise TypeError("Expected %s, but received %s", expected, recv)
- return ret
-
-_DTYPE_FUNC = {
- DataType.Integer : int,
- DataType.Double : float,
- DataType.String : str,
- DataType.Boolean : bool,
-}
-
-def str_to_value(value, dtype=DataType.Double, dformat=DataFormat.Scalar):
- f = _DTYPE_FUNC[dtype]
- if dformat == DataFormat.Scalar:
- ret = f(value)
- elif dformat == DataFormat.OneD:
- ret = [ f(v) for v in value ]
- elif dformat == DataFormat.TwoD:
- ret = []
- for v1 in value:
- ret.append([ f(v2) for v2 in v1 ])
- return ret
-
-def translate_version_str2int(version_str):
- """Translates a version string in format x[.y[.z[...]]] into a 000000 number.
- Each part of version number can have up to 99 possibilities."""
- import math
- parts = version_str.split('.')
- i, v, l = 0, 0, len(parts)
- if not l: return v
- while i < 3:
- try:
- v += int(parts[i]) * int(math.pow(10, (2 - i) * 2))
- l -= 1
- i += 1
- except ValueError:
- return v
- if not l: return v
- return v
-
- try:
- v += 10000 * int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += 100 * int(parts[1])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
-def translate_version_str2list(version_str, depth=2):
- """Translates a version string in format 'x[.y[.z[...]]]' into a list of
- numbers"""
- if version_str is None:
- ver = depth * [0, ]
- else:
- ver = []
- for i in version_str.split(".")[:depth]:
- try:
- i = int(i)
- except:
- i = 0
- ver.append(i)
- return ver
-
diff --git a/src/sardana/sardanavalue.py b/src/sardana/sardanavalue.py
deleted file mode 100644
index cf4ed782..00000000
--- a/src/sardana/sardanavalue.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module is part of the Python Sardana libray. It defines the base
-classes for Sardana values"""
-
-from __future__ import absolute_import
-
-__all__ = ["SardanaValue"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-
-class SardanaValue(object):
-
- def __init__(self, value=None, exc_info=None, timestamp=None,
- dtype=None, dformat=None):
- self.value = value
- self.error = exc_info is not None
- self.exc_info = exc_info
- if timestamp is None:
- timestamp = time.time()
- self.timestamp = timestamp
- self.dtype = dtype
- self.dformat = dformat
-
- def __repr__(self):
- v = None
- if self.error:
- v = "<Error>"
- else:
- v = self.value
- return "{0.__class__.__name__}(value={1}, timestamp={0.timestamp})".format(self, v)
-
- def __str__(self):
- return repr(self)
diff --git a/src/sardana/spock/__init__.py b/src/sardana/spock/__init__.py
deleted file mode 100644
index a725625d..00000000
--- a/src/sardana/spock/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides spock"""
-
-from genutils import load_ipython_extension, unload_ipython_extension, \
- load_config
diff --git a/src/sardana/spock/colors.py b/src/sardana/spock/colors.py
deleted file mode 100644
index 26105a75..00000000
--- a/src/sardana/spock/colors.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the sardana library"""
-
-__all__ = ['make_color_table', 'TermColors', 'HTMLColors', 'TermTangoColors',
- 'TermTauSWDevStateColors', 'HTMLTangoColors']
-
-__docformat__ = 'restructuredtext'
-
-def make_color_table(in_class,use_name=False):
- """Build a set of color attributes in a class.
-
- Helper function for building the *TermColors classes."""
-
- color_templates = (
- ("Black" , "0;30"),
- ("Red" , "0;31"),
- ("Green" , "0;32"),
- ("Brown" , "0;33"),
- ("Blue" , "0;34"),
- ("Purple" , "0;35"),
- ("Cyan" , "0;36"),
- ("LightGray" , "0;37"),
- ("DarkGray" , "1;30"),
- ("LightRed" , "1;31"),
- ("LightGreen" , "1;32"),
- ("Yellow" , "1;33"),
- ("LightBlue" , "1;34"),
- ("LightPurple" , "1;35"),
- ("LightCyan" , "1;36"),
- ("White" , "1;37"), )
-
- for name,value in color_templates:
- if use_name:
- setattr(in_class,name,in_class._base % name)
- else:
- setattr(in_class,name,in_class._base % value)
-
-class TermColors:
- """Color escape sequences.
-
- This class defines the escape sequences for all the standard (ANSI?)
- colors in terminals. Also defines a NoColor escape which is just the null
- string, suitable for defining 'dummy' color schemes in terminals which get
- confused by color escapes.
-
- This class should be used as a mixin for building color schemes.
-
- Basicaly this class is just a copy of IPython.ColorANSI.TermColors class"""
-
- NoColor = '' # for color schemes in color-less terminals.
- Normal = '\033[0m' # Reset normal coloring
- _base = '\033[%sm' # Template for all other colors
-
-class HTMLColors:
-
- NoColor = ''
- Normal = '</font>'
- _base = '<font color=%s>'
-
-# Build the actual color table as a set of class attributes:
-make_color_table(TermColors)
-make_color_table(HTMLColors,True)
-
-import PyTango
-
-TermTangoColors = { PyTango.DevState.ON : TermColors.Green,
- PyTango.DevState.ALARM : TermColors.Brown,
- PyTango.DevState.FAULT : TermColors.Red,
- PyTango.DevState.UNKNOWN : TermColors.LightGray,
- None : TermColors.DarkGray }
-
-from taurus.core import TaurusSWDevState
-
-TermTauSWDevStateColors = {
- TaurusSWDevState.Uninitialized : TermColors.LightGray,
- TaurusSWDevState.Running : TermColors.Green,
- TaurusSWDevState.Shutdown : TermColors.DarkGray,
- TaurusSWDevState.Crash : TermColors.Red,
- TaurusSWDevState.EventSystemShutdown : TermColors.Brown }
-
-HTMLTangoColors = { PyTango.DevState.ON : HTMLColors.Green,
- PyTango.DevState.ALARM : HTMLColors.Brown,
- PyTango.DevState.FAULT : HTMLColors.Red,
- PyTango.DevState.UNKNOWN : HTMLColors.LightGray,
- None : HTMLColors.DarkGray } \ No newline at end of file
diff --git a/src/sardana/spock/config.py b/src/sardana/spock/config.py
deleted file mode 100644
index 63328e19..00000000
--- a/src/sardana/spock/config.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock's ipython configuration class"""
-
-__all__ = ['Spock']
-
-from IPython.config.configurable import Configurable
-from IPython.utils.traitlets import Unicode, Bool
-
-class Spock(Configurable):
- macro_server_name = Unicode(config=True)
- door_name = Unicode(config=True)
- macro_server_alias = Unicode(config=True)
- door_alias = Unicode(config=True)
- ready = Bool(default_value=False, config=True) \ No newline at end of file
diff --git a/src/sardana/spock/exception.py b/src/sardana/spock/exception.py
deleted file mode 100644
index 1ce89b0a..00000000
--- a/src/sardana/spock/exception.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the sardana library"""
-
-__all__ = ['SpockException', 'SpockBadInstallation', 'SpockMissingRequirement',
- 'SpockMissingRecommended']
-
-__docformat__ = 'restructuredtext'
-
-
-class SpockException(Exception):
- pass
-
-class SpockBadInstallation(SpockException):
- pass
-
-class SpockMissingRequirement(SpockException):
- pass
-
-class SpockMissingRecommended(SpockException):
- pass
diff --git a/src/sardana/spock/genutils.py b/src/sardana/spock/genutils.py
deleted file mode 100644
index 563a267a..00000000
--- a/src/sardana/spock/genutils.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities"""
-
-def translate_version_str2list(version_str):
- """Translates a version string in format 'x[.y[.z[...]]]' into a list of
- numbers"""
- if version_str is None:
- ver = [0, 0]
- else:
- ver = []
- for i in version_str.split(".")[:2]:
- try:
- i = int(i)
- except:
- i = 0
- ver.append(i)
- return ver
-
-def get_ipython_version():
- """Returns the current IPython version"""
- import IPython
- v = None
- try:
- try:
- v = IPython.Release.version
- except:
- try:
- v = IPython.release.version
- except:
- pass
- except:
- pass
- return v
-
-def get_ipython_version_list():
- ipv_str = get_ipython_version()
- return translate_version_str2list(ipv_str)
-
-ipv = get_ipython_version_list()
-if ipv >= [0, 10] and ipv < [0, 11]:
- from ipython_00_10.genutils import *
-elif ipv >= [0, 11] and ipv < [1, 0]:
- from ipython_00_11.genutils import *
-else:
- from ipython_01_00.genutils import *
-
-
diff --git a/src/sardana/spock/inputhandler.py b/src/sardana/spock/inputhandler.py
deleted file mode 100644
index 3634befa..00000000
--- a/src/sardana/spock/inputhandler.py
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Spock submodule. It contains an input handler"""
-
-__all__ = ['SpockInputHandler', 'InputHandler']
-
-__docformat__ = 'restructuredtext'
-
-import sys
-from multiprocessing import Process, Pipe
-
-from taurus.core import TaurusManager
-from taurus.core.util.singleton import Singleton
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.dialog import TaurusMessageBox, TaurusInputDialog
-
-from sardana.taurus.core.tango.sardana.macroserver import BaseInputHandler
-
-from sardana.spock import genutils
-
-
-class SpockInputHandler(BaseInputHandler):
-
- def __init__(self):
- # don't call super __init__ on purpose
- self._input = genutils.spock_input
-
- def input(self, input_data=None):
- if input_data is None:
- input_data = {}
- prompt = input_data.get('prompt')
- if 'data_type' in input_data:
- print("Accepted input: %s" % input_data['data_type'])
- ret = dict(input=None, cancel=False)
- try:
- if prompt is None:
- ret['input'] = self._input()
- else:
- ret['input'] = self._input(prompt)
- except:
- ret['cancel'] = True
- return ret
-
- def input_timeout(self, input_data):
- print "SpockInputHandler input timeout"
-
-
-class MessageHandler(Qt.QObject):
-
- def __init__(self, conn, parent=None):
- Qt.QObject.__init__(self, parent)
- self._conn = conn
- self._dialog = None
- self.connect(self, Qt.SIGNAL("messageArrived"), self.on_message)
-
- def handle_message(self, input_data):
- self.emit(Qt.SIGNAL("messageArrived"), input_data)
-
- def on_message(self, input_data):
- msg_type = input_data['type']
- if msg_type == 'input':
- if 'macro_name' in input_data and 'title' not in input_data:
- input_data['title'] = input_data['macro_name']
- self._dialog = dialog = TaurusInputDialog(input_data=input_data)
- dialog.activateWindow()
- dialog.exec_()
- ok = dialog.result()
- value = dialog.value()
- ret = dict(input=None, cancel=False)
- if ok:
- ret['input'] = value
- else:
- ret['cancel'] = True
- self._conn.send(ret)
- elif msg_type == 'timeout':
- dialog = self._dialog
- if dialog:
- dialog.close()
-
-
-class InputHandler(Singleton, BaseInputHandler):
-
- def __init__(self):
- # don't call super __init__ on purpose
- pass
-
- def init(self, *args, **kwargs):
- self._conn, child_conn = Pipe()
- self._proc = proc = Process(target=self.safe_run,
- name="SpockInputHandler", args=(child_conn,))
- proc.daemon = True
- proc.start()
-
- def input(self, input_data=None):
- # parent process
- data_type = input_data.get('data_type', 'String')
- if isinstance(data_type, (str, unicode)):
- ms = genutils.get_macro_server()
- interfaces = ms.getInterfaces()
- if data_type in interfaces:
- input_data['data_type'] = [ elem.name for elem in interfaces[data_type].values() ]
- self._conn.send(input_data)
- ret = self._conn.recv()
- return ret
-
- def input_timeout(self, input_data):
- # parent process
- self._conn.send(input_data)
-
- def safe_run(self, conn):
- # child process
- try:
- return self.run(conn)
- except Exception, e:
- msgbox = TaurusMessageBox(*sys.exc_info())
- conn.send((e, False))
- msgbox.exec_()
-
- def run(self, conn):
- # child process
- self._conn = conn
- app = Qt.QApplication.instance()
- if app is None:
- app = Qt.QApplication([])
- app.setQuitOnLastWindowClosed(False)
- self._msg_handler = MessageHandler(conn)
- TaurusManager().addJob(self.run_forever, None)
- app.exec_()
- conn.close()
- print "Quit input handler"
-
- def run_forever(self):
- # child process
- message, conn = True, self._conn
- while message:
- message = conn.recv()
- if not message:
- continue
- self._msg_handler.handle_message(message)
- app = Qt.QApplication.instance()
- if app:
- app.quit()
-
diff --git a/src/sardana/spock/ipython_00_10/__init__.py b/src/sardana/spock/ipython_00_10/__init__.py
deleted file mode 100644
index 120e183f..00000000
--- a/src/sardana/spock/ipython_00_10/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities for ipython 0.10"""
diff --git a/src/sardana/spock/ipython_00_10/genutils.py b/src/sardana/spock/ipython_00_10/genutils.py
deleted file mode 100644
index 4f27ffcb..00000000
--- a/src/sardana/spock/ipython_00_10/genutils.py
+++ /dev/null
@@ -1,1023 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities"""
-
-__all__ = ['page', 'arg_split', 'get_gui_mode', 'get_pylab_mode',
- 'get_color_mode', 'get_ipapi',
- 'get_editor', 'ask_yes_no', 'spock_input',
- 'translate_version_str2int', 'get_ipython_version',
- 'get_ipython_version_number', 'get_python_version',
- 'get_python_version_number', 'get_ipython_dir',
- 'get_ipython_profiles', 'get_spock_profiles',
- 'get_non_spock_profiles', 'get_spock_user_profile_module',
- 'get_pytango_version', 'get_pytango_version_number',
- 'get_server_for_device', 'get_macroserver_for_door',
- 'get_device_from_user', 'get_tango_db', 'get_tango_host_from_user',
- 'print_dev_from_class', 'from_name_to_tango', 'clean_up',
- 'get_taurus_core_version', 'get_taurus_core_version_number',
- 'check_requirements', 'get_door', 'get_macro_server', 'expose_magic',
- 'unexpose_magic', 'expose_variable', 'expose_variables',
- 'unexpose_variable',
- 'create_spock_profile', 'check_for_upgrade', 'get_args',
- 'init_console', 'init_magic', 'init_pre_spock', 'init_post_spock',
- 'init_spock', 'start', 'mainloop', 'run',
- 'load_ipython_extension', 'unload_ipython_extension', 'load_config',
- 'MSG_FAILED','MSG_FAILED_WR', 'MSG_R', 'MSG_ERROR',
- 'MSG_DONE', 'MSG_OK' ]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import os
-import socket
-import imp
-
-import IPython
-import IPython.genutils
-import PyTango
-import PyTango.ipython
-
-from taurus.core.taurushelper import Factory
-from taurus.core.util.codecs import CodecFactory
-
-from sardana.spock import exception
-from sardana.spock import colors
-from sardana.spock import release
-
-arg_split = IPython.iplib.arg_split
-page = IPython.genutils.page
-TermColors = colors.TermColors
-
-
-requirements = {
-# module minimum recommended
- "IPython" : ("0.10.0", "0.10.0"),
- "Python" : ("2.6.0", "2.6.0"),
- "PyTango" : ("7.1.2", "7.2.0"),
- "taurus.core" : ("2.0.0", "2.1.0")
-}
-
-ENV_NAME = "_E"
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# IPython utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_gui_mode():
- if '-q4thread' in sys.argv:
- return 'qt'
- elif '-gthread' in sys.argv:
- return 'gtk'
- elif '-wthread' in sys.argv:
- return 'wx'
- return ''
-
-def get_pylab_mode():
- return get_gui_mode()
-
-def get_color_mode():
- return get_ipapi().options.colors
-
-def get_ipapi():
- return IPython.ipapi.get()
-
-def get_editor():
- return get_ipapi().options.editor
-
-def ask_yes_no(prompt,default=None):
- """Asks a question and returns a boolean (y/n) answer.
-
- If default is given (one of 'y','n'), it is used if the user input is
- empty. Otherwise the question is repeated until an answer is given.
-
- An EOF is treated as the default answer. If there is no default, an
- exception is raised to prevent infinite loops.
-
- Valid answers are: y/yes/n/no (match is not case sensitive)."""
-
- if default:
- prompt = '%s [%s]' % (prompt, default)
- return IPython.genutils.ask_yes_no(prompt, default)
-
-def spock_input(prompt='', ps2='... '):
- return IPython.genutils.raw_input_ext(prompt=prompt, ps2=ps2)
-
-def translate_version_str2int(version_str):
- """Translates a version string in format x[.y[.z[...]]] into a 000000 number"""
- import math
- parts = version_str.split('.')
- i, v, l = 0, 0, len(parts)
- if not l: return v
- while i<3:
- try:
- v += int(parts[i])*int(math.pow(10,(2-i)*2))
- l -= 1
- i += 1
- except ValueError:
- return v
- if not l: return v
- return v
-
- try:
- v += 10000*int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += 100*int(parts[1])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
-def get_ipython_version():
- """Returns the current IPython version"""
- v = None
- try:
- try:
- v = IPython.Release.version
- except Exception:
- try:
- v = IPython.release.version
- except Exception:
- pass
- except Exception:
- pass
- return v
-
-def get_ipython_version_number():
- """Returns the current IPython version number"""
- ipyver_str = get_ipython_version()
- if ipyver_str is None: return None
- return translate_version_str2int(ipyver_str)
-
-def get_python_version():
- return '.'.join(map(str,sys.version_info[:3]))
-
-def get_python_version_number():
- pyver_str = get_python_version()
- return translate_version_str2int(pyver_str)
-
-def get_ipython_dir():
- """Find the ipython local directory. Usually is <home>/.ipython"""
- if hasattr(PyTango.ipython, "get_ipython_dir"):
- return PyTango.ipython.get_ipython_dir()
-
- if hasattr(IPython.iplib, 'get_ipython_dir'):
- # Starting from ipython 0.9 they hadded this method
- return IPython.iplib.get_ipython_dir()
-
- # Try to find the profile in the current directory and then in the
- # default IPython dir
- #userdir = os.path.realpath(os.path.curdir)
- home_dir = IPython.genutils.get_home_dir()
-
- if os.name == 'posix':
- ipdir = '.ipython'
- else:
- ipdir = '_ipython'
- ipdir = os.path.join(home_dir, ipdir)
- ipythondir = os.path.abspath( os.environ.get('IPYTHONDIR', ipdir) )
- return ipythondir
-
-def get_ipython_profiles():
- """Helper function to find all ipython profiles"""
- if hasattr(PyTango.ipython, "get_ipython_profiles"):
- return PyTango.ipython.get_ipython_profiles()
-
- ret = []
- ipydir = get_ipython_dir()
- if os.path.isdir(ipydir):
- for i in os.listdir(ipydir):
- fullname = os.path.join(ipydir, i)
- if i.startswith("ipy_profile_") and i.endswith(".py"):
- if os.path.isfile(fullname):
- ret.append(i[len("ipy_profile_"):i.rfind(".")])
- return ret
-
-def get_spock_profiles(ipython_profiles=None):
- """Helper function to find all spock ipython profiles"""
- ret = []
- ipydir = get_ipython_dir()
- if not os.path.isdir(ipydir):
- return ret
- if ipython_profiles is None:
- ipython_profiles = get_ipython_profiles()
- ret = []
- for profile in ipython_profiles:
- profile_f = os.path.join(ipydir, "ipy_profile_%s.py" % profile)
- if not os.path.isfile(profile_f): continue
- try:
- for i, l in enumerate(file(profile_f)):
- if i > 10: break
- if l.find("spock_creation_version") >= 0:
- ret.append(profile)
- break
- except:
- pass
- return ret
-
-def get_non_spock_profiles(ipython_profiles=None):
- """Helper function to find all non spock ipython profiles"""
- if ipython_profiles is None:
- ipython_profiles = get_ipython_profiles()
- ipython_profiles = set(ipython_profiles)
- spock_profiles = set(get_spock_profiles(ipython_profiles=ipython_profiles))
- return ipython_profiles.difference(spock_profiles)
-
-def get_spock_user_profile_module(profile_name):
- return 'ipy_profile_%s' % profile_name
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# PyTango utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_pytango_version():
- try:
- import PyTango
- except:
- return None
- try:
- return PyTango.Release.version
- except:
- return '0.0.0'
-
-def get_pytango_version_number():
- tgver_str = get_pytango_version()
- if tgver_str is None: return None
- return translate_version_str2int(tgver_str)
-
-def get_server_for_device(device_name):
- db = get_tango_db()
- device_name = device_name.lower()
- server_list = db.get_server_list()
- for server in server_list:
- for dev in db.get_device_class_list(server)[::2]:
- if dev.lower() == device_name:
- return server
- return None
-
-def get_macroserver_for_door(door_name):
- """Returns the MacroServer device name in the same DeviceServer as the
- given door device"""
- full_door_name, door_name, door_alias = from_name_to_tango(door_name)
- db = get_tango_db()
- door_name = door_name.lower()
- server_list = list(db.get_server_list('MacroServer/*'))
- server_list += list(db.get_server_list('Sardana/*'))
- server_devs = None
- for server in server_list:
- server_devs = db.get_device_class_list(server)
- devs, klasses = server_devs[0::2], server_devs[1::2]
- for dev in devs:
- if dev.lower() == door_name:
- for i, klass in enumerate(klasses):
- if klass == 'MacroServer':
- return "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), devs[i])
- else:
- return None
-
-def get_device_from_user(expected_class, dft = None):
- """Gets a device of the given device class from user input"""
- dft = print_dev_from_class(expected_class, dft)
- prompt = "%s name from the list" % expected_class
- if not dft is None:
- prompt += "[%s]" % dft
- prompt += "? "
- from_user = raw_input(prompt).strip() or dft
-
- name = ''
- try:
- full_name, name, alias = from_name_to_tango(from_user)
- except:
- print "Warning: the given %s does not exist" % expected_class
- return name
-
- try:
- db = get_tango_db()
- cl_name = db.get_class_for_device(name)
- class_correct = cl_name == expected_class
- if not class_correct:
- print "Warning: the given name is not a %s (it is a %s)"%(expected_class,cl_name)
- except Exception as e:
- print "Warning: unable to confirm if '%s' is valid" % name
- print str(e)
- return full_name
-
-def get_tango_db():
- tg_host = PyTango.ApiUtil.get_env_var("TANGO_HOST")
-
- db = None
- if tg_host is None:
- host,port = get_tango_host_from_user()
- tg_host = "%s:%d" % (host,port)
- os.environ["TANGO_HOST"] = tg_host
- db = PyTango.Database()
- else:
- try:
- db = PyTango.Database()
- except:
- # tg host is not valid. Find a valid one
- host,port = get_tango_host_from_user()
- tg_host = "%s:%d" % (host,port)
- os.environ["TANGO_HOST"] = tg_host
-
- db = PyTango.Database()
- return db
-
-def get_tango_host_from_user():
-
- while True:
- prompt = "Please enter a valid tango host (<host>:<port>): "
- from_user = raw_input(prompt).strip()
-
- try:
- host, port = from_user.split(':')
- try:
- port = int(port)
- try:
- socket.gethostbyname(host)
- try:
- db = PyTango.Database(host,port)
- return db.get_db_host(), db.get_db_port()
- except:
- exp = "No tango database found at %s:%d" % (host,port)
- except:
- exp = "Invalid host name %s" % host
- except:
- exp = "Port must be a number > 0"
- except:
- exp = "Invalid tango host. Must be in format <host>:<port>"
- exp = "Invalid tango host. %s " % exp
- print exp
-
-def print_dev_from_class(classname, dft = None):
-
- db = get_tango_db()
- pytg_ver = get_pytango_version_number()
- if pytg_ver >= 030004:
- server_wildcard = '*'
- try:
- exp_dev_list = db.get_device_exported_for_class(classname)
- except Exception:
- exp_dev_list = []
- else:
- server_wildcard = '%'
- exp_dev_list = []
-
- res = None
- dev_list = db.get_device_name(server_wildcard,classname)
- tg_host = "%s:%s" % (db.get_db_host(),db.get_db_port())
- print "Available",classname,"devices from",tg_host,":"
- for dev in dev_list:
- full_name, name, alias = from_name_to_tango(dev)
- out = alias or name
- if alias: out += ' (a.k.a. %s)' % name
- out = "%-25s" % out
- if dev in exp_dev_list:
- out += " (running)"
- print out
- if dft:
- if dft.lower() == name.lower(): res = name
- elif not alias is None and dft.lower() == alias.lower(): res = alias
-
- return res
-
-def from_name_to_tango(name):
-
- db = get_tango_db()
-
- alias = None
-
- c = name.count('/')
- # if the db prefix is there, remove it first
- if c == 3 or c == 1:
- name = name[name.index("/")+1:]
-
- elems = name.split('/')
- l = len(elems)
-
- if l == 3:
- try:
- alias = db.get_alias(name)
- if alias.lower() == 'nada':
- alias = None
- except:
- alias = None
- elif l == 1:
- alias = name
- name = db.get_device_alias(alias)
- else:
- raise Exception("Invalid device name '%s'" % name)
-
- full_name = "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), name)
- return full_name, name, alias
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# taurus utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def clean_up():
- taurus.Manager().cleanUp()
-
-def get_taurus_core_version():
- try:
- import taurus
- return taurus.core.release.version
- except:
- return '0.0.0'
-
-def get_taurus_core_version_number():
- tgver_str = get_taurus_core_version()
- if tgver_str is None: return None
- return translate_version_str2int(tgver_str)
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Requirements checking
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def check_requirements():
- r = requirements
- minPyTango, recPyTango = map(translate_version_str2int, r["PyTango"])
- minIPython, recIPython = map(translate_version_str2int, r["IPython"])
- minPython, recPython = map(translate_version_str2int, r["Python"])
- minTaurusCore, recTaurusCore = map(translate_version_str2int, r["taurus.core"])
-
- currPython = get_python_version_number()
- currIPython = get_ipython_version_number()
- currPyTango = get_pytango_version_number()
- currTaurusCore = get_taurus_core_version_number()
-
- errMsg = ""
- warnMsg = ""
-
- errPython, errIPython, errPyTango, errTaurusCore = False, False, False, False
- if currPython is None:
- errMsg += "Spock needs Python version >= %s. No python installation found\n" % requirements["Python"][0]
- errPython = True
- elif currPython < minPython:
- errMsg += "Spock needs Python version >= %s. Current version is %s\n" % (requirements["Python"][0], get_python_version())
- errPython = True
-
- if currIPython is None:
- errMsg += "Spock needs IPython version >= %s. No IPython installation found\n" % requirements["IPython"][0]
- errIPython = True
- elif currIPython < minIPython:
- errMsg += "Spock needs IPython version >= %s. Current version is %s\n" % (requirements["IPython"][0], get_ipython_version())
- errIPython = True
-
- if currPyTango is None:
- errMsg += "Spock needs PyTango version >= %s. No PyTango installation found\n" % requirements["IPython"][0]
- errPyTango = True
- elif currPyTango < minPyTango:
- errMsg += "Spock needs PyTango version >= %s. " % requirements["PyTango"][0]
- if currPyTango > 0:
- errMsg += "Current version is %s\n" % get_pytango_version()
- else:
- errMsg += "Current version is unknown (most surely too old)\n"
- errPyTango = True
-
- if currTaurusCore is None:
- errMsg += "Spock needs taurus.core version >= %s. No taurus.core installation found\n" % requirements["taurus.core"][0]
- errTaurusCore = True
- elif currTaurusCore < minTaurusCore:
- errMsg += "Spock needs taurus.core version >= %s. " % requirements["taurus.core"][0]
- if currTaurusCore > 0:
- errMsg += "Current version is %s\n" % get_taurus_core_version()
- else:
- errMsg += "Current version is unknown (most surely too old)\n"
- errTaurusCore = True
-
- # Warnings
- if not errPython and currPython < recPython:
- warnMsg += "Spock recommends Python version >= %s. Current version is %s\n" % (requirements["Python"][1], get_python_version())
-
- if not errIPython and currIPython < recIPython:
- warnMsg += "Spock recommends IPython version >= %s. Current version is %s\n" % (requirements["IPython"][1], get_ipython_version())
-
- if not errPyTango and currPyTango < recPyTango:
- warnMsg += "Spock recommends PyTango version >= %s. Current version is %s\n" % (requirements["PyTango"][1], get_pytango_version())
-
- if not errTaurusCore and currTaurusCore < recTaurusCore:
- warnMsg += "Spock recommends taurus.core version >= %s. Current version is %s\n" % (requirements["taurus.core"][1], get_taurus_core_version())
-
- if errMsg:
- errMsg += warnMsg
- raise exception.SpockMissingRequirement, errMsg
-
- if warnMsg:
- raise exception.SpockMissingRecommended, warnMsg
-
- return True
-
-def _get_dev(dev_type):
- ip = get_ipapi()
- ret = ip.user_ns.get("_" + dev_type)
- if ret is not None:
- return ret
-
- dev_obj_name = '%s_NAME' % dev_type
- dev_name = ip.user_ns[dev_obj_name]
- factory = Factory()
- dev_obj = factory.getDevice(dev_name)
- ip.user_ns[dev_type] = PyTango.DeviceProxy(dev_name)
- ip.user_ns["_" + dev_type] = dev_obj
- setattr(ip, '_%s' % dev_type, dev_obj)
- return dev_obj
-
-def get_door():
- return _get_dev('DOOR')
-
-def get_macro_server():
- return _get_dev('MACRO_SERVER')
-
-def _macro_completer(self, event):
- """Method called by the IPython autocompleter. It will determine possible
- values for macro arguments.
- """
- ms = get_macro_server()
-
- macro_name = event.command.lstrip('%')
-
- # calculate parameter index
- param_idx = len(event.line.split()) - 1
- if not event.line.endswith(' '): param_idx -= 1
- # get macro info
- info = ms.getMacroInfoObj(macro_name)
- # if macro doesn't have parameters return
- if param_idx < 0 or not info.hasParams() : return
- # get the parameter info
- possible_params = info.getPossibleParams(param_idx)
- # return the existing elements for the given parameter type
- if possible_params:
- res = []
- for param in possible_params:
- res.extend(ms.getElementNamesWithInterface(param['type']))
- return res
-
-def expose_magic(name, fn, completer_func=_macro_completer):
- ip = get_ipapi()
- ip.expose_magic(name, fn)
-
- if completer_func is None:
- return
-
- # enable macro param completion
- ip.set_hook('complete_command', completer_func, str_key = name)
-
- # register also when the command as is typed with the magic prefix '%'
- name = str('%') + name
- ip.set_hook('complete_command', completer_func, str_key = name)
-
-def unexpose_magic(name):
- ip = get_ipapi()
- mg = 'magic_%s' % name
- delattr(ip.IP, mg)
-
-def expose_variable(name, value):
- get_ipapi().to_user_ns({ name : value })
-
-def unexpose_variable(name):
- user_ns = get_ipapi().user_ns
- del user_ns[name]
-
-def expose_variables(d):
- get_ipapi().to_user_ns(d)
-
-#def _expose_device(name):
-# ip.to_user_ns({ name : PyTango.DeviceProxy(name) })
-
-#def expose_device(name):
-# ip = get_ipapi()
-# ip.magic("bg _expose_device(%s)" % name)
-
-def create_spock_profile(userdir, dft_profile, profile, door_name=None):
- """Create a profile file from a profile template file """
-
- src_data = """\
-\"\"\"Settings for Spock session\"\"\"
-
-#
-# Please do not delete the next lines has they are used to check the version
-# number for possible upgrades
-# spock_creation_version = {version}
-# door_name = {door_name}
-#
-
-import IPython
-from sardana.spock.genutils import init_spock
-
-def main():
- ip = IPython.ipapi.get()
- init_spock(ip, '{macroserver_name}', '{door_name}')
-
-main()
-"""
-
- #
- # Discover door name
- #
- if door_name is None:
- door_name = get_device_from_user("Door", profile)
- else:
- full_door_name, door_name, door_alias = from_name_to_tango(door_name)
- door_name = full_door_name
-
- #
- # Discover macro server name
- #
- ms_name = get_macroserver_for_door(door_name)
-
- dest_data = src_data.format(version=release.version,
- macroserver_name=ms_name,
- door_name=door_name)
-
- f_name = '%s.py' % get_spock_user_profile_module(profile)
-
- dest_name = os.path.join(userdir, f_name)
-
- sys.stdout.write('Storing %s in %s... ' % (f_name, userdir))
- sys.stdout.flush()
- res = MSG_FAILED
- try:
- dest = open(dest_name,"w")
- dest.write(dest_data)
- dest.flush()
- dest.close()
- res = MSG_DONE
- finally:
- sys.stdout.write(res + '\n')
- sys.stdout.flush()
-
-def check_for_upgrade(ipy_profile_file, ipythondir, session, profile):
- # Check if the current profile is up to date with the spock version
- spock_profile_ver_str = '0.0.0'
- door_name = None
-
- # search for version and door inside the ipy_profile file
- for i, line in enumerate(ipy_profile_file):
- if i > 20 : break; # give up after 20 lines
- if line.startswith('# spock_creation_version = '):
- spock_profile_ver_str = line[line.index('=')+1:].strip()
- if line.startswith('# door_name = '):
- door_name = line[line.index('=')+1:].strip()
-
- # convert version from string to numbers
- spocklib_ver = translate_version_str2int(release.version)
- spock_profile_ver = translate_version_str2int(spock_profile_ver_str)
-
- if spocklib_ver == spock_profile_ver:
- return
- if spocklib_ver < spock_profile_ver:
- print '%sYour spock profile (%s) is newer than your spock version ' \
- '(%s)!' % (TermColors.Brown, spock_profile_ver_str, release.version)
- print 'Please upgrade spock or delete the current profile %s' % TermColors.Normal
- sys.exit(1)
-
- # there was no version track of spock profiles since spock 0.2.0 so change
- # the message
- if spock_profile_ver_str == '0.0.0':
- spock_profile_ver_str = '<= 0.2.0'
- msg = 'Your current spock door extension profile has been created with spock %s.\n' \
- 'Your current spock door extension version is %s, therefore a profile upgrade is needed.\n' \
- % (spock_profile_ver_str, release.version)
- print msg
- prompt = 'Do you wish to upgrade now (warn: this will shutdown the current spock session) ([y]/n)? '
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipythondir, session, profile, door_name)
- sys.exit(0)
-
-def get_args(argv):
-
- script_name = argv[0]
- script_dir, session = os.path.split(script_name)
- script_name = os.path.realpath(script_name)
- #script_dir = os.path.dirname(script_name)
-
- macro_server = None
- door = None
-
- # Define the profile file
- profile = "spockdoor"
- try:
- profile_idx = argv.index('-p') + 1
- if len(argv) > profile_idx:
- profile = argv[profile_idx]
- except:
- pass
-
- profile_modulename = get_spock_user_profile_module(profile)
-
- # Try to find the profile in the current directory and then in the
- # default IPython dir
- #userdir = os.path.realpath(os.path.curdir)
- ipythondir = get_ipython_dir()
-
- if not os.path.isdir(ipythondir):
- # Platform-dependent suffix.
- if os.name == 'posix':
- rc_suffix = ''
- else:
- rc_suffix = '.ini'
- IPython.iplib.user_setup(ipythondir, rc_suffix, mode='install',
- interactive=False)
-
- try:
- f, name, t = imp.find_module(profile_modulename, [ipythondir])
- check_for_upgrade(f, ipythondir, session, profile)
- except ImportError:
- # Create a new profile
- r = ''
- while not r in ['y','n']:
- prompt = 'Profile \'%s\' does not exist. Do you want to create '\
- 'one now ([y]/n)? ' % profile
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipythondir, session, profile)
- else:
- sys.stdout.write('No spock door extension profile was created. Starting normal spock...\n')
- sys.stdout.flush()
- profile = ''
-
- # inform the shell of the profile it should use
- if not '-p' in argv and profile:
- argv.append('-p')
- argv.append(profile)
-
- user_ns = { 'MACRO_SERVER_NAME' : macro_server,
- 'DOOR_NAME' : door,
- 'PROFILE' : profile }
-
- return user_ns
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Useful constants
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-MSG_G = '[%s%%s%s]' % (TermColors.Green, TermColors.Normal)
-MSG_R = '[%s%%s%s]' % (TermColors.Red, TermColors.Normal)
-MSG_FAILED = MSG_R % 'FAILED'
-MSG_FAILED_WR = MSG_R % 'FAILED: %s'
-MSG_ERROR = MSG_R % 'ERROR'
-MSG_DONE = MSG_G % 'DONE'
-MSG_OK = MSG_G % 'OK'
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# initialization methods
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def init_console(ip):
- # Handy tab-completers for %cd, %run, import etc.
- # Try commenting this out if you have completion problems/slowness
- import ipy_stock_completers
-
- spockver = release.version
- pyver = get_python_version()
- ipyver = get_ipython_version()
- pytangover = get_pytango_version()
- tauruscorever = get_taurus_core_version()
-
- TermColors = IPython.ColorANSI.TermColors
-
- d = { "version" : spockver,
- "pyver" : pyver,
- "ipyver" : ipyver,
- "pytangover" : pytangover,
- "taurusver" : tauruscorever,
- "profile" : ip.user_ns["PROFILE"],
- "door" : ip.user_ns["DOOR_ALIAS"] }
-
- d.update(TermColors.__dict__)
-
- # IPython options
- o = ip.options
- o.autocall = 1
- o.autoedit_syntax = 0
- o.autoindent = 1
- o.automagic = 1
- o.cache_size = 1000
- o.colors = 'Linux'
- o.color_info = 1
- o.confirm_exit = 0
- o.deep_reload = 0
- #o.editor = 'gedit'
- o.log = 0
- o.logfile = ''
- o.messages = 1
- o.pdb = 0
- o.pprint = 1
- o.quick = 0
- o.readline = 1
- o.screen_length = 0
- o.separate_in = '\n'
- o.separate_out = '\n'
- o.separate_out2 = ''
- o.nosep = 0
- o.wildcards_case_sensitive = 0
- o.object_info_string_level = 0
- o.xmode = 'Context'
- o.multi_line_specials = 1
- o.system_header = 'IPython system call: '
- o.system_verbose = 1
- o.wxversion = '0'
- o.colors = "GreenTango"
- o.prompt_in1 = "$DOOR_ALIAS$DOOR_STATE [\\#]: "
- o.prompt_out = "Result [\\#]: "
- o.readline_parse_and_bind.append('tab: complete')
- #o.readline_parse_and_bind.append('tab: menu-complete')
- o.readline_parse_and_bind.append('"\C-l": possible-completions')
- o.readline_parse_and_bind.append('set show-all-if-ambiguous on')
- o.readline_parse_and_bind.append('"\C-o": tab-insert')
- o.readline_parse_and_bind.append('"\M-i": " "')
- o.readline_parse_and_bind.append('"\M-o": "\d\d\d\d"')
- o.readline_parse_and_bind.append('"\M-I": "\d\d\d\d"')
- o.readline_parse_and_bind.append('"\C-r": reverse-search-history')
- o.readline_parse_and_bind.append('"\C-s": forward-search-history')
- o.readline_parse_and_bind.append('"\C-p": history-search-backward')
- o.readline_parse_and_bind.append('"\C-n": history-search-forward')
- o.readline_parse_and_bind.append('"\e[A": history-search-backward')
- o.readline_parse_and_bind.append('"\e[B": history-search-forward')
- o.readline_parse_and_bind.append('"\C-k": kill-line')
- o.readline_parse_and_bind.append('"\C-u": unix-line-discard')
- o.readline_remove_delims = '-/~'
- o.readline_merge_completions = 1
- o.readline_omit__names = 0
-
- banner = """\
-%(Purple)sSpock %(version)s%(Normal)s -- An interactive laboratory application.
-
-help -> Spock's help system.
-object? -> Details about 'object'. ?object also works, ?? prints more.
-"""
- banner = banner % d
- banner = banner.format(**d)
-
- o.banner = banner
-
-def init_magic(ip):
- import sardana.spock.magic
- magic = sardana.spock.magic
- expose_magic('debug', magic.debug, magic.debug_completer)
- expose_magic('www', magic.www, None)
- expose_magic('post_mortem', magic.post_mortem, None)
- expose_magic('spsplot', magic.spsplot, None)
- expose_magic('macrodata', magic.macrodata, None)
- expose_magic('edmac', magic.edmac, None)
- expose_magic('showscan', magic.showscan, None)
- expose_magic('expconf', magic.expconf, None)
- ip.set_hook('late_startup_hook', magic.spock_late_startup_hook)
- ip.set_hook('pre_prompt_hook', magic.spock_pre_prompt_hook)
-
-def init_pre_spock(ip, macro_server, door):
- so = IPython.ipstruct.Struct()
- full_door_tg_name, door_tg_name, door_tg_alias = from_name_to_tango(door)
- #macro_server = get_ms_for_door(door_tg_name)
- full_ms_tg_name, ms_tg_name, ms_tg_alias = from_name_to_tango(macro_server)
- ip.user_ns['MACRO_SERVER_NAME'] = full_ms_tg_name
- ip.user_ns['MACRO_SERVER_ALIAS'] = ms_tg_alias or ms_tg_name
- ip.user_ns['DOOR_NAME'] = full_door_tg_name
- ip.user_ns['DOOR_ALIAS'] = door_tg_alias or door_tg_name
- ip.user_ns['DOOR_STATE'] = ""
- ip.user_ns['spock_options'] = so
-
- if ip.IP.alias_table.has_key('mv'):
- del ip.IP.alias_table['mv']
-
- v = release.version
- alias = ip.user_ns['DOOR_ALIAS']
- profile = ip.user_ns['PROFILE']
-
- so.spock_banner = """\
-{Blue}Spock's sardana extension %s loaded with profile: %s (linked to door '%s'){Normal}
-""" % (v, profile, alias)
-
- # the CodecFactory is not thread safe. There are two attributes who will
- # request for it in the first event at startup in different threads
- # therefore this small hack: make sure CodecFactory is initialized.
- CodecFactory()
-
- factory = Factory()
-
- import sardana.spock.spockms
- macroserver = sardana.spock.spockms
-
- factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)
-
- mode = get_gui_mode()
- if mode == 'qt':
- factory.registerDeviceClass('Door', macroserver.QSpockDoor)
- else:
- factory.registerDeviceClass('Door', macroserver.SpockDoor)
-
- door = get_door()
- macro_server = get_macro_server()
-
- # Initialize the environment
- expose_variable(ENV_NAME, macro_server.getEnvironment())
-
-
-def init_post_spock(ip):
- init_console(ip)
- init_magic(ip)
-
-def init_spock(ip, macro_server, door):
- init_pre_spock(ip, macro_server, door)
- PyTango.ipython.init_ipython(ip)
- init_post_spock(ip)
-
-
-def start(user_ns=None):
- if '-pylab' not in sys.argv: sys.argv.insert(1, '-pylab')
- if '-q4thread' not in sys.argv: sys.argv.insert(1, '-q4thread')
-
- # Make sure the log level is changed to warning
- from taurus.core.taurushelper import setLogLevel, Warning
- CodecFactory()
- setLogLevel(Warning)
-
- try:
- check_requirements()
- except exception.SpockMissingRequirement, requirement:
- print str(requirement)
- sys.exit(-1)
- except exception.SpockMissingRecommended, recommended:
- print str(recommended)
-
- user_ns = user_ns or {}
- try:
- user_ns.update(get_args(sys.argv))
- except exception.SpockException, e:
- print e.message
- print 'Starting normal IPython console'
- except KeyboardInterrupt:
- print "\nUser pressed Ctrl+C. Exiting..."
- sys.exit()
- except Exception, e:
- print 'spock exited with an unmanaged exception: %s' % str(e)
- sys.exit(-2)
-
- return IPython.Shell.start(user_ns=user_ns)
-
-def mainloop(shell=None, user_ns=None):
- if shell is None:
- shell = start(user_ns)
- shell.mainloop()
-
-def run(user_ns=None):
- # initialize input handler as soon as possible
- import sardana.spock.inputhandler
- input_handler = sardana.spock.inputhandler.InputHandler()
-
- try:
- mainloop(user_ns=user_ns)
- finally:
- try:
- clean_up()
- except Exception:
- pass
-
-# for compatibility reasons with new IPython API (>=0.11) we add the following
-# empty methods
-
-def load_ipython_extension(ipython):
- pass
-
-def unload_ipython_extension(ipython):
- pass
-
-def load_config(config):
- pass
diff --git a/src/sardana/spock/ipython_00_11/__init__.py b/src/sardana/spock/ipython_00_11/__init__.py
deleted file mode 100644
index a2538b79..00000000
--- a/src/sardana/spock/ipython_00_11/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities for ipython > 0.10"""
diff --git a/src/sardana/spock/ipython_00_11/genutils.py b/src/sardana/spock/ipython_00_11/genutils.py
deleted file mode 100644
index 823bd794..00000000
--- a/src/sardana/spock/ipython_00_11/genutils.py
+++ /dev/null
@@ -1,1154 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities"""
-
-__all__ = ['page', 'arg_split', 'get_gui_mode', 'get_pylab_mode',
- 'get_color_mode', 'get_app',
- 'get_shell', 'get_ipapi', 'get_config', 'get_editor', 'ask_yes_no',
- 'spock_input',
- 'translate_version_str2int', 'get_ipython_version',
- 'get_ipython_version_number', 'get_python_version',
- 'get_python_version_number', 'get_ipython_dir',
- 'get_ipython_profiles',
- 'get_pytango_version', 'get_pytango_version_number',
- 'get_server_for_device', 'get_macroserver_for_door',
- 'get_device_from_user', 'get_tango_db', 'get_tango_host_from_user',
- 'print_dev_from_class', 'from_name_to_tango', 'clean_up',
- 'get_taurus_core_version', 'get_taurus_core_version_number',
- 'check_requirements', 'get_door', 'get_macro_server',
- 'expose_magic', 'unexpose_magic', 'expose_variable',
- 'expose_variables', 'unexpose_variable',
- 'create_spock_profile', 'check_for_upgrade', 'get_args',
- 'start', 'mainloop', 'run',
- 'load_ipython_extension', 'unload_ipython_extension', 'load_config',
- 'MSG_FAILED', 'MSG_FAILED_WR', 'MSG_R', 'MSG_ERROR',
- 'MSG_DONE', 'MSG_OK']
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import os
-import socket
-
-import IPython
-import IPython.core.magic
-from IPython.core.page import page
-from IPython.core.profiledir import ProfileDirError, ProfileDir
-from IPython.core.application import BaseIPythonApplication
-from IPython.core.interactiveshell import InteractiveShell
-from IPython.utils.io import ask_yes_no as _ask_yes_no
-from IPython.utils.io import raw_input_ext as _raw_input_ext
-from IPython.utils.path import get_ipython_dir
-from IPython.utils.process import arg_split
-from IPython.utils.coloransi import TermColors
-from IPython.config.application import Application
-from IPython.frontend.terminal.ipapp import TerminalIPythonApp, \
- launch_new_instance
-
-from taurus.core.taurushelper import Factory, Manager, Warning
-from taurus.core.util.codecs import CodecFactory
-from taurus.core.taurushelper import setLogLevel
-
-
-# make sure Qt is properly initialized
-from taurus.external.qt import Qt
-
-from sardana.spock import exception
-from sardana.spock import colors
-from sardana.spock import release
-
-SpockTermColors = colors.TermColors
-
-requirements = {
-# module minimum recommended
- "IPython" : ("0.11.0", "0.12.0"),
- "Python" : ("2.6.0", "2.6.0"),
- "PyTango" : ("7.2.0", "7.2.3"),
- "taurus.core" : ("3.0.0", "3.0.0")
-}
-
-ENV_NAME = "_E"
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# IPython utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_gui_mode():
- return 'qt'
-
-def get_pylab_mode():
- return get_app().pylab
-
-def get_color_mode():
- return get_config().InteractiveShell.colors
-
-def get_app():
- #return TerminalIPythonApp.instance()
- return Application.instance()
-
-def get_shell():
- """Get the global InteractiveShell instance."""
- return get_app().shell
-
-def get_ipapi():
- """Get the global InteractiveShell instance."""
- return InteractiveShell.instance()
-
-def get_config():
- return get_app().config
-
-def get_editor():
- return get_ipapi().editor
-
-def ask_yes_no(prompt,default=None):
- """Asks a question and returns a boolean (y/n) answer.
-
- If default is given (one of 'y','n'), it is used if the user input is
- empty. Otherwise the question is repeated until an answer is given.
-
- An EOF is treated as the default answer. If there is no default, an
- exception is raised to prevent infinite loops.
-
- Valid answers are: y/yes/n/no (match is not case sensitive)."""
-
- if default:
- prompt = '%s [%s]' % (prompt, default)
- return _ask_yes_no(prompt, default)
-
-def spock_input(prompt='', ps2='... '):
- return _raw_input_ext(prompt=prompt, ps2=ps2)
-
-def translate_version_str2int(version_str):
- """Translates a version string in format x[.y[.z[...]]] into a 000000 number"""
- import math
- parts = version_str.split('.')
- i, v, l = 0, 0, len(parts)
- if not l: return v
- while i<3:
- try:
- v += int(parts[i])*int(math.pow(10,(2-i)*2))
- l -= 1
- i += 1
- except ValueError:
- return v
- if not l: return v
- return v
-
- try:
- v += 10000*int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += 100*int(parts[1])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
-def get_ipython_version():
- """Returns the current IPython version"""
- v = None
- try:
- try:
- v = IPython.Release.version
- except Exception:
- try:
- v = IPython.release.version
- except Exception, e2:
- print e2
- except Exception, e3:
- print e3
- return v
-
-def get_ipython_version_number():
- """Returns the current IPython version number"""
- ipyver_str = get_ipython_version()
- if ipyver_str is None: return None
- return translate_version_str2int(ipyver_str)
-
-def get_python_version():
- return '.'.join(map(str,sys.version_info[:3]))
-
-def get_python_version_number():
- pyver_str = get_python_version()
- return translate_version_str2int(pyver_str)
-
-def get_ipython_profiles(path=None):
- """list profiles in a given root directory"""
- if path is None:
- path = get_ipython_dir()
- files = os.listdir(path)
- profiles = []
- for f in files:
- full_path = os.path.join(path, f)
- if os.path.isdir(full_path) and f.startswith('profile_'):
- profiles.append(f.split('_',1)[-1])
- return profiles
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# PyTango utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_pytango_version():
- try:
- import PyTango
- try:
- return PyTango.Release.version
- except:
- return '0.0.0'
- except:
- return None
-
-def get_pytango_version_number():
- tgver_str = get_pytango_version()
- if tgver_str is None: return None
- return translate_version_str2int(tgver_str)
-
-def get_server_for_device(device_name):
- db = get_tango_db()
- device_name = device_name.lower()
- server_list = db.get_server_list()
- for server in server_list:
- for dev in db.get_device_class_list(server)[::2]:
- if dev.lower() == device_name:
- return server
- return None
-
-def get_macroserver_for_door(door_name):
- """Returns the MacroServer device name in the same DeviceServer as the
- given door device"""
- _, door_name, _ = from_name_to_tango(door_name)
- db = get_tango_db()
- door_name = door_name.lower()
- server_list = list(db.get_server_list('MacroServer/*'))
- server_list += list(db.get_server_list('Sardana/*'))
- server_devs = None
- for server in server_list:
- server_devs = db.get_device_class_list(server)
- devs, klasses = server_devs[0::2], server_devs[1::2]
- for dev in devs:
- if dev.lower() == door_name:
- for i, klass in enumerate(klasses):
- if klass == 'MacroServer':
- return "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), devs[i])
- else:
- return None
-
-def get_device_from_user(expected_class, dft = None):
- """Gets a device of the given device class from user input"""
- dft = print_dev_from_class(expected_class, dft)
- prompt = "%s name from the list" % expected_class
- if not dft is None:
- prompt += "[%s]" % dft
- prompt += "? "
- from_user = raw_input(prompt).strip() or dft
-
- name = ''
- try:
- full_name, name, _ = from_name_to_tango(from_user)
- except:
- print "Warning: the given %s does not exist" % expected_class
- return name
-
- try:
- db = get_tango_db()
- cl_name = db.get_class_for_device(name)
- class_correct = cl_name == expected_class
- if not class_correct:
- print "Warning: the given name is not a %s (it is a %s)"%(expected_class,cl_name)
- except Exception as e:
- print "Warning: unable to confirm if '%s' is valid" % name
- print str(e)
- return full_name
-
-def get_tango_db():
- import PyTango
- tg_host = PyTango.ApiUtil.get_env_var("TANGO_HOST")
-
- db = None
- if tg_host is None:
- host,port = get_tango_host_from_user()
- tg_host = "%s:%d" % (host,port)
- os.environ["TANGO_HOST"] = tg_host
- db = PyTango.Database()
- else:
- try:
- db = PyTango.Database()
- except:
- # tg host is not valid. Find a valid one
- host,port = get_tango_host_from_user()
- tg_host = "%s:%d" % (host,port)
- os.environ["TANGO_HOST"] = tg_host
-
- db = PyTango.Database()
- return db
-
-def get_tango_host_from_user():
- import PyTango
- while True:
- prompt = "Please enter a valid tango host (<host>:<port>): "
- from_user = raw_input(prompt).strip()
-
- try:
- host, port = from_user.split(':')
- try:
- port = int(port)
- try:
- socket.gethostbyname(host)
- try:
- PyTango.Database(host, port)
- return (host, port)
- except:
- exp = "No tango database found at %s:%d" % (host, port)
- except:
- exp = "Invalid host name %s" % host
- except:
- exp = "Port must be a number > 0"
- except:
- exp = "Invalid tango host. Must be in format <host>:<port>"
- exp = "Invalid tango host. %s " % exp
- print exp
-
-def print_dev_from_class(classname, dft = None):
-
- db = get_tango_db()
- pytg_ver = get_pytango_version_number()
- if pytg_ver >= 030004:
- server_wildcard = '*'
- try:
- exp_dev_list = db.get_device_exported_for_class(classname)
- except:
- exp_dev_list = []
- else:
- server_wildcard = '%'
- exp_dev_list = []
-
- res = None
- dev_list = db.get_device_name(server_wildcard,classname)
- tg_host = "%s:%s" % (db.get_db_host(),db.get_db_port())
- print "Available",classname,"devices from",tg_host,":"
- for dev in dev_list:
- _, name, alias = from_name_to_tango(dev)
- out = alias or name
- if alias: out += ' (a.k.a. %s)' % name
- out = "%-25s" % out
- if dev in exp_dev_list:
- out += " (running)"
- print out
- if dft:
- if dft.lower() == name.lower(): res = name
- elif not alias is None and dft.lower() == alias.lower(): res = alias
-
- return res
-
-def from_name_to_tango(name):
-
- db = get_tango_db()
-
- alias = None
-
- c = name.count('/')
- # if the db prefix is there, remove it first
- if c == 3 or c == 1:
- name = name[name.index("/")+1:]
-
- elems = name.split('/')
- l = len(elems)
-
- if l == 3:
- try:
- alias = db.get_alias(name)
- if alias.lower() == 'nada':
- alias = None
- except:
- alias = None
- elif l == 1:
- alias = name
- name = db.get_device_alias(alias)
- else:
- raise Exception("Invalid device name '%s'" % name)
-
- full_name = "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), name)
- return full_name, name, alias
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# taurus utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def clean_up():
- Manager().cleanUp()
-
-def get_taurus_core_version():
- try:
- import taurus
- return taurus.core.release.version
- except:
- import traceback
- traceback.print_exc()
- return '0.0.0'
-
-def get_taurus_core_version_number():
- tgver_str = get_taurus_core_version()
- if tgver_str is None: return None
- return translate_version_str2int(tgver_str)
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Requirements checking
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def check_requirements():
- r = requirements
- minPyTango, recPyTango = map(translate_version_str2int, r["PyTango"])
- minIPython, recIPython = map(translate_version_str2int, r["IPython"])
- minPython, recPython = map(translate_version_str2int, r["Python"])
- minTaurusCore, recTaurusCore = map(translate_version_str2int, r["taurus.core"])
-
- currPython = get_python_version_number()
- currIPython = get_ipython_version_number()
- currPyTango = get_pytango_version_number()
- currTaurusCore = get_taurus_core_version_number()
-
- errMsg = ""
- warnMsg = ""
-
- errPython, errIPython, errPyTango, errTaurusCore = False, False, False, False
- if currPython is None:
- errMsg += "Spock needs Python version >= %s. No python installation found\n" % requirements["Python"][0]
- errPython = True
- elif currPython < minPython:
- errMsg += "Spock needs Python version >= %s. Current version is %s\n" % (requirements["Python"][0], get_python_version())
- errPython = True
-
- if currIPython is None:
- errMsg += "Spock needs IPython version >= %s. No IPython installation found\n" % requirements["IPython"][0]
- errIPython = True
- elif currIPython < minIPython:
- errMsg += "Spock needs IPython version >= %s. Current version is %s\n" % (requirements["IPython"][0], get_ipython_version())
- errIPython = True
-
- if currPyTango is None:
- errMsg += "Spock needs PyTango version >= %s. No PyTango installation found\n" % requirements["IPython"][0]
- errPyTango = True
- elif currPyTango < minPyTango:
- errMsg += "Spock needs PyTango version >= %s. " % requirements["PyTango"][0]
- if currPyTango > 0:
- errMsg += "Current version is %s\n" % get_pytango_version()
- else:
- errMsg += "Current version is unknown (most surely too old)\n"
- errPyTango = True
-
- if currTaurusCore is None:
- errMsg += "Spock needs taurus.core version >= %s. No taurus.core installation found\n" % requirements["taurus.core"][0]
- errTaurusCore = True
- elif currTaurusCore < minTaurusCore:
- errMsg += "Spock needs taurus.core version >= %s. " % requirements["taurus.core"][0]
- if currTaurusCore > 0:
- errMsg += "Current version is %s\n" % get_taurus_core_version()
- else:
- errMsg += "Current version is unknown (most surely too old)\n"
- errTaurusCore = True
-
- # Warnings
- if not errPython and currPython < recPython:
- warnMsg += "Spock recommends Python version >= %s. Current version " \
- "is %s\n" % (requirements["Python"][1],
- get_python_version())
-
- if not errIPython and currIPython < recIPython:
- warnMsg += "Spock recommends IPython version >= %s. Current version " \
- "is %s\n" % (requirements["IPython"][1],
- get_ipython_version())
-
- if not errPyTango and currPyTango < recPyTango:
- warnMsg += "Spock recommends PyTango version >= %s. Current version " \
- "is %s\n" % (requirements["PyTango"][1],
- get_pytango_version())
-
- if not errTaurusCore and currTaurusCore < recTaurusCore:
- warnMsg += "Spock recommends taurus.core version >= %s. Current " \
- "version is %s\n" % (requirements["taurus.core"][1],
- get_taurus_core_version())
-
- if errMsg:
- errMsg += warnMsg
- raise exception.SpockMissingRequirement, errMsg
-
- if warnMsg:
- raise exception.SpockMissingRecommended, warnMsg
-
- return True
-
-def _get_dev(dev_type):
- spock_config = get_config().Spock
- taurus_dev = None
- taurus_dev_var = "_" + dev_type
- if hasattr(spock_config, taurus_dev_var):
- taurus_dev = getattr(spock_config, taurus_dev_var)
- if taurus_dev is None:
- dev_name = getattr(spock_config, dev_type + '_name')
- factory = Factory()
- taurus_dev = factory.getDevice(dev_name)
- import PyTango
- dev = PyTango.DeviceProxy(dev_name)
- setattr(spock_config, dev_type, dev)
- setattr(spock_config, taurus_dev_var, taurus_dev)
- shell = get_shell()
- dev_type_upper = dev_type.upper()
- shell.user_ns[dev_type_upper] = dev
- shell.user_ns["_" + dev_type_upper] = taurus_dev
- return taurus_dev
-
-def get_door():
- return _get_dev('door')
-
-def get_macro_server():
- return _get_dev('macro_server')
-
-def _macro_completer(self, event):
- """Method called by the IPython autocompleter. It will determine possible
- values for macro arguments.
- """
- ms = get_macro_server()
-
- macro_name = event.command.lstrip('%')
- # calculate parameter index
- param_idx = len(event.line.split()) - 1
- if not event.line.endswith(' '): param_idx -= 1
- # get macro info
- info = ms.getMacroInfoObj(macro_name)
- # if macro doesn't have parameters return
- if param_idx < 0 or not info.hasParams() : return
- # get the parameter info
- possible_params = info.getPossibleParams(param_idx)
- # return the existing elements for the given parameter type
- if possible_params:
- res = []
- for param in possible_params:
- res.extend(ms.getElementNamesWithInterface(param['type']))
- return res
-
-def expose_magic(name, fn, completer_func=_macro_completer):
- shell = get_shell()
- fn.old_magic = shell.define_magic(name, fn)
- fn.old_completer = completer_func
-
- if completer_func is None:
- return
-
- # enable macro param completion
- if completer_func is not None:
- shell.set_hook('complete_command', completer_func, str_key = name)
- shell.set_hook('complete_command', completer_func, str_key = '%'+name)
-
-def unexpose_magic(name):
- shell = get_shell()
- mg_name = 'magic_' + name
- if hasattr(shell, mg_name):
- magic_fn = getattr(shell, mg_name)
- delattr(shell, mg_name)
- if hasattr(magic_fn, 'old_magic') and magic_fn.old_magic is not None:
- expose_magic(name, magic_fn.old_magic, magic_fn.old_completer)
-
-def expose_variable(name, value):
- get_shell().user_ns[name] = value
-
-def expose_variables(d):
- get_shell().user_ns.update(d)
-
-def unexpose_variable(name):
- user_ns = get_shell().user_ns
- del user_ns[name]
-
-def create_spock_profile(userdir, dft_profile, profile, door_name=None):
- """Create a profile file from a profile template file """
- if not os.path.isdir(userdir):
- ProfileDir.create_profile_dir(userdir)
- p_dir = ProfileDir.create_profile_dir_by_name(userdir, profile)
- config_file_name = BaseIPythonApplication.config_file_name.default_value
- abs_config_file_name = os.path.join(p_dir.location, config_file_name)
- create_config = True
- if os.path.isfile(abs_config_file_name):
- create_config = ask_yes_no("Spock configuration file already exists. "\
- "Do you wish to replace it?", default='y')
- if not create_config:
- return
-
- src_data = """\
-\"\"\"Settings for Spock session\"\"\"
-
-#
-# Please do not delete the next lines has they are used to check the version
-# number for possible upgrades
-# spock_creation_version = {version}
-# door_name = {door_name}
-#
-
-import PyTango.ipython
-import sardana.spock.genutils
-from sardana.spock.config import Spock
-
-config = get_config()
-config.Spock.macro_server_name = '{macroserver_name}'
-config.Spock.door_name = '{door_name}'
-
-load_subconfig('ipython_config.py', profile='default')
-sardana.spock.load_config(config)
-
-# Put any additional environment here and/or overwrite default sardana config
-config.IPKernelApp.pylab = 'inline'
-
-"""
- #
- # Discover door name
- #
- if door_name is None:
- door_name = get_device_from_user("Door", profile)
- else:
- full_door_name, door_name, _ = from_name_to_tango(door_name)
- door_name = full_door_name
-
- #
- # Discover macro server name
- #
- ms_name = get_macroserver_for_door(door_name)
-
- dest_data = src_data.format(version=release.version,
- macroserver_name=ms_name,
- door_name=door_name)
-
- sys.stdout.write('Storing %s in %s... ' % (config_file_name, p_dir.location))
- sys.stdout.flush()
-
-
- with file(abs_config_file_name, "w") as f:
- f.write(dest_data)
- f.close()
- sys.stdout.write(MSG_DONE + '\n')
-
-def check_for_upgrade(ipy_profile_file, ipythondir, session, profile):
- # Check if the current profile is up to date with the spock version
- spock_profile_ver_str = '0.0.0'
- door_name = None
-
- # search for version and door inside the ipy_profile file
- for i, line in enumerate(ipy_profile_file):
- if i > 20 : break; # give up after 20 lines
- if line.startswith('# spock_creation_version = '):
- spock_profile_ver_str = line[line.index('=')+1:].strip()
- if line.startswith('# door_name = '):
- door_name = line[line.index('=')+1:].strip()
-
- # convert version from string to numbers
- spocklib_ver = translate_version_str2int(release.version)
- spock_profile_ver = translate_version_str2int(spock_profile_ver_str)
-
- if spocklib_ver == spock_profile_ver:
- return
- if spocklib_ver < spock_profile_ver:
- print '%sYour spock profile (%s) is newer than your spock version ' \
- '(%s)!' % (SpockTermColors.Brown, spock_profile_ver_str, release.version)
- print 'Please upgrade spock or delete the current profile %s' % SpockTermColors.Normal
- sys.exit(1)
-
- # there was no version track of spock profiles since spock 0.2.0 so change
- # the message
- if spock_profile_ver_str == '0.0.0':
- spock_profile_ver_str = '<= 0.2.0'
- msg = 'Your current spock door extension profile has been created with spock %s.\n' \
- 'Your current spock door extension version is %s, therefore a profile upgrade is needed.\n' \
- % (spock_profile_ver_str, release.version)
- print msg
- prompt = 'Do you wish to upgrade now (warn: this will shutdown the current spock session) ([y]/n)? '
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipythondir, session, profile, door_name)
- sys.exit(0)
-
-def get_args(argv):
-
- script_name = argv[0]
- _, session = os.path.split(script_name)
- script_name = os.path.realpath(script_name)
-
- macro_server = None
- door = None
-
- # Define the profile file
- profile = "spockdoor"
- try:
- for _, arg in enumerate(argv[1:]):
- if arg.startswith('--profile='):
- profile=arg[10:]
- break
- else:
- argv.append("--profile=" + profile)
- except:
- pass
-
- ipython_dir = get_ipython_dir()
- try:
- ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
- except ProfileDirError:
- r = ''
- while not r in ('y','n'):
- prompt = 'Profile \'%s\' does not exist. Do you want to create '\
- 'one now ([y]/n)? ' % profile
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipython_dir, session, profile)
- else:
- sys.stdout.write('No spock door extension profile was created. Starting normal spock...\n')
- sys.stdout.flush()
- profile = ''
-
- # inform the shell of the profile it should use
- if not '--profile=' in argv and profile:
- argv.append('--profile=' + profile)
-
- user_ns = { 'MACRO_SERVER_NAME' : macro_server,
- 'DOOR_NAME' : door,
- 'PROFILE' : profile }
-
- return user_ns
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Useful constants
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-MSG_G = '[%s%%s%s]' % (SpockTermColors.Green, SpockTermColors.Normal)
-MSG_R = '[%s%%s%s]' % (SpockTermColors.Red, SpockTermColors.Normal)
-MSG_FAILED = MSG_R % 'FAILED'
-MSG_FAILED_WR = MSG_R % 'FAILED: %s'
-MSG_ERROR = MSG_R % 'ERROR'
-MSG_DONE = MSG_G % 'DONE'
-MSG_OK = MSG_G % 'OK'
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# initialization methods
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def init_taurus():
- # the CodecFactory is not thread safe. There are two attributes who will
- # request for it in the first event at startup in different threads
- # therefore this small hack: make sure CodecFactory is initialized.
- CodecFactory()
-
- factory = Factory()
-
- import sardana.spock.spockms
- macroserver = sardana.spock.spockms
-
- factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)
-
- mode = get_gui_mode()
- if mode == 'qt':
- factory.registerDeviceClass('Door', macroserver.QSpockDoor)
- else:
- factory.registerDeviceClass('Door', macroserver.SpockDoor)
-
-
-def load_ipython_extension(ipython):
- import sardana.spock.magic
- magic = sardana.spock.magic
-
- init_taurus()
-
- config = ipython.config
- user_ns = ipython.user_ns
- user_ns['MACRO_SERVER_NAME'] = config.Spock.macro_server_name
- user_ns['MACRO_SERVER_ALIAS'] = config.Spock.macro_server_alias
- user_ns['DOOR_NAME'] = config.Spock.door_name
- user_ns['DOOR_ALIAS'] = config.Spock.door_alias
- user_ns['DOOR_STATE'] = ""
-
- #shell.set_hook('late_startup_hook', magic.spock_late_startup_hook)
- ipython.set_hook('pre_prompt_hook', magic.spock_pre_prompt_hook)
-
- #if ip.IP.alias_table.has_key('mv'):
- # del ip.IP.alias_table['mv']
-
- door = get_door()
- macro_server = get_macro_server()
-
- # Initialize the environment
- expose_variable(ENV_NAME, macro_server.getEnvironment())
-
- new_style_magics = hasattr(IPython.core.magic, 'Magics') and hasattr(IPython.core.magic, 'magics_class')
-
- if new_style_magics:
- @IPython.core.magic.magics_class
- class Sardana(IPython.core.magic.Magics):
- debug = IPython.core.magic.line_magic(magic.debug)
- www = IPython.core.magic.line_magic(magic.www)
- post_mortem = IPython.core.magic.line_magic(magic.post_mortem)
- spsplot = IPython.core.magic.line_magic(magic.spsplot)
- macrodata = IPython.core.magic.line_magic(magic.macrodata)
- edmac = IPython.core.magic.line_magic(magic.edmac)
- showscan = IPython.core.magic.line_magic(magic.showscan)
- expconf = IPython.core.magic.line_magic(magic.expconf)
-
- ipython.register_magics(Sardana)
- else:
- expose_magic('debug', magic.debug, magic.debug_completer)
- expose_magic('www', magic.www, None)
- expose_magic('post_mortem', magic.post_mortem, None)
- expose_magic('spsplot', magic.spsplot, None)
- expose_magic('macrodata', magic.macrodata, None)
- expose_magic('edmac', magic.edmac, None)
- expose_magic('showscan', magic.showscan, None)
- expose_magic('expconf', magic.expconf, None)
-
- door.setConsoleReady(True)
-
-def unload_ipython_extension(ipython):
- pass
-
-def load_config(config):
- spockver = release.version
- pyver = get_python_version()
- ipyver = get_ipython_version()
- pytangover = get_pytango_version()
- tauruscorever = get_taurus_core_version()
-
- door = config.Spock.door_name
-
- if not hasattr(config.Spock, 'macro_server_name'):
- macro_server = get_macroserver_for_door(door)
- else:
- macro_server = config.Spock.macro_server_name
-
- full_door_tg_name, door_tg_name, door_tg_alias = from_name_to_tango(door)
- door_alias = door_tg_alias or door_tg_name
- full_ms_tg_name, ms_tg_name, ms_tg_alias = from_name_to_tango(macro_server)
- ms_alias = ms_tg_alias or ms_tg_name
-
- config.Spock.macro_server_name = full_ms_tg_name
- config.Spock.door_name = full_door_tg_name
- config.Spock.macro_server_alias = ms_alias
- config.Spock.door_alias = door_alias
-
- d = { "version" : spockver,
- "pyver" : pyver,
- "ipyver" : ipyver,
- "pytangover" : pytangover,
- "taurusver" : tauruscorever,
- #"profile" : ip.user_ns["PROFILE"],
- "door" : door_alias }
-
- d.update(TermColors.__dict__)
-
- gui_mode = get_gui_mode()
-
- banner = """\
-%(Purple)sSpock %(version)s%(Normal)s -- An interactive laboratory application.
-
-help -> Spock's help system.
-object? -> Details about 'object'. ?object also works, ?? prints more.
-"""
- banner = banner % d
- banner = banner.format(**d)
-
- ipy_ver = get_ipython_version_number()
-
- # ------------------------------------
- # Application
- # ------------------------------------
- app = config.Application
- app.log_level = 30
-
- # ------------------------------------
- # BaseIPythonApplication
- # ------------------------------------
- i_app = config.BaseIPythonApplication
- extensions = getattr(i_app, 'extensions', [])
- extensions.extend(["PyTango.ipython", "sardana.spock"])
- i_app.extensions = extensions
-
- # ------------------------------------
- # InteractiveShell
- # (IPython.core.interactiveshell)
- # ------------------------------------
- i_shell = config.InteractiveShell
- i_shell.autocall = 0
- i_shell.automagic = True
- i_shell.color_info = True
- i_shell.colors = 'Linux'
- i_shell.deep_reload = True
- i_shell.confirm_exit = False
-
- if ipy_ver >= 1200:
- # ------------------------------------
- # PromptManager (ipython >= 0.12)
- # ------------------------------------
- prompt = config.PromptManager
- prompt.in_template = '{DOOR_ALIAS} [\\#]: '
- prompt.in2_template = ' .\\D.: '
- prompt.out_template = 'Result [\\#]: '
- prompt.color_scheme = 'Linux'
- else:
- # (Deprecated in ipython >= 0.12 use PromptManager.in_template)
- i_shell.prompt_in1 = config.Spock.door_alias + ' [\\#]: '
-
- # (Deprecated in ipython >= 0.12 use PromptManager.in2_template)
- i_shell.prompt_in2 = ' .\\D.: '
-
- # (Deprecated in ipython >= 0.12 use PromptManager.out_template)
- i_shell.prompt_out = 'Result [\\#]: '
-
- # (Deprecated in ipython >= 0.12 use PromptManager.justify)
- i_shell.prompts_pad_left = True
-
- # ------------------------------------
- # IPCompleter
- # ------------------------------------
- completer = config.IPCompleter
- completer.omit__names = 2
- completer.greedy = False
-
- # ------------------------------------
- # InteractiveShellApp
- # ------------------------------------
- i_shell_app = config.InteractiveShellApp
- i_shell_app.ignore_old_config = True
-
- # ------------------------------------
- # TerminalIPythonApp: options for the IPython terminal (and not Qt Console)
- # ------------------------------------
- term_app = config.TerminalIPythonApp
- term_app.display_banner = True
- term_app.gui = gui_mode
- term_app.pylab='qt'
- #term_app.nosep = False
- #term_app.classic = True
-
- # ------------------------------------
- # IPKernelApp: options for the Qt Console
- # ------------------------------------
- #kernel_app = config.IPKernelApp
- ipython_widget = config.IPythonWidget
- ipython_widget.in_prompt = ' Spock [<span class="in-prompt-number">%i</span>]: '
- ipython_widget.out_prompt = 'Result [<span class="out-prompt-number">%i</span>]: '
- ipython_widget.input_sep = '\n'
- ipython_widget.output_sep = ''
- ipython_widget.output_sep2 = ''
- ipython_widget.enable_calltips = True
- if ipy_ver >= 1300:
- ipython_widget.gui_completion = 'droplist'
- else:
- ipython_widget.gui_completion = True
- ipython_widget.ansi_codes = True
- ipython_widget.paging = 'inside'
- #ipython_widget.pylab = 'inline'
-
- # ------------------------------------
- # ConsoleWidget
- # ------------------------------------
- # console_widget = config.ConsoleWidget
-
- # ------------------------------------
- # FrontendWidget
- # ------------------------------------
- frontend_widget = config.FrontendWidget
- frontend_widget.banner = banner
-
- # ------------------------------------
- # TerminalInteractiveShell
- # ------------------------------------
- term_i_shell = config.TerminalInteractiveShell
- term_i_shell.autocall = 2
- term_i_shell.automagic = True
- #term_i_shell.editor = 'gedit'
- #term_i_shell.editor = 'nano'
-
- term_i_shell.banner1 = banner
- term_i_shell.banner2 = "Connected to " + door_alias + "\n"
- #term_app.banner1 = banner
- #term_app.banner2 = "Connected to " + door_alias + "\n"
-
- # ------------------------------------
- # InlineBackend
- # ------------------------------------
- inline_backend = config.InlineBackend
- inline_backend.figure_format = 'svg'
-
- # ------------------------------------
- # InteractiveShellEmbed
- # ------------------------------------
- #i_shell_embed = config.InteractiveShellEmbed
-
- # ------------------------------------
- # NotebookApp
- # ------------------------------------
- #notebook_app = config.NotebookApp
-
- # ------------------------------------
- # NotebookManager
- # ------------------------------------
- #notebook_manager = config.NotebookManager
-
- # ------------------------------------
- # ZMQInteractiveShell
- # ------------------------------------
- #zmq_i_shell = config.ZMQInteractiveShell
-
- # Tell console everything is ready.
- config.Spock.ready = True
- return config
-
-def start(user_ns=None):
- # Make sure the log level is changed to warning
- CodecFactory()
- setLogLevel(Warning)
-
- try:
- check_requirements()
- except exception.SpockMissingRequirement, requirement:
- print str(requirement)
- sys.exit(-1)
- except exception.SpockMissingRecommended, recommended:
- print str(recommended)
-
- user_ns = user_ns or {}
- try:
- user_ns.update(get_args(sys.argv))
- except exception.SpockException, e:
- print e.message
- print 'Starting normal IPython console'
- except KeyboardInterrupt:
- print "\nUser pressed Ctrl+C. Exiting..."
- sys.exit()
- except Exception, e:
- print 'spock exited with an unmanaged exception: %s' % str(e)
- sys.exit(-2)
-
- app = TerminalIPythonApp.instance()
- app.initialize()
- #config = get_config()
- return app
-
-def mainloop(app=None, user_ns=None):
- if app is None:
- app = start(user_ns)
- app.start()
-
-def prepare_input_handler():
- # initialize input handler as soon as possible
- import sardana.spock.inputhandler
- _ = sardana.spock.inputhandler.InputHandler()
-
-
-def prepare_cmdline(argv=None):
- if argv is None:
- argv = sys.argv
-
- script_name = argv[0]
- _, session = os.path.split(script_name)
- script_name = os.path.realpath(script_name)
-
- # Define the profile file
- profile, append_profile = "spockdoor", True
- try:
- # in ipython the last option in the list takes precedence
- # so reversing order for searching of the profile
- reversed_argv = reversed(argv[1:])
- for _, arg in enumerate(reversed_argv):
- if arg.startswith('--profile='):
- profile=arg[10:]
- append_profile = False
- break
- except:
- pass
-
- ipython_dir = get_ipython_dir()
- try:
- ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
- except ProfileDirError:
- r = ''
- while not r in ('y', 'n'):
- prompt = "Profile '%s' does not exist. Do you want to create "\
- "one now ([y]/n)? " % profile
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipython_dir, session, profile)
- else:
- sys.stdout.write('No spock profile was created. '
- 'Starting ipython with default profile...\n')
- sys.stdout.flush()
- # removing all options refering to profile
- for _, arg in enumerate(argv[1:]):
- if arg.startswith('--profile='):
- argv.remove(arg)
- return
-
- if append_profile:
- argv.append("--profile=" + profile)
-
-
-def run():
-
- try:
- from IPython.utils.traitlets import Unicode
- from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
-
- class SpockConsole(RichIPythonWidget):
-
- banner = Unicode(config=True)
-
- def _banner_default(self):
- config = get_config()
- return config.FrontendWidget.banner
-
- import IPython.frontend.qt.console.qtconsoleapp
- IPythonQtConsoleApp = IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp
- IPythonQtConsoleApp.widget_factory = SpockConsole
- IPythonQtConsoleApp.version.default_value = release.version
- except ImportError:
- pass
-
- try:
- check_requirements()
- except exception.SpockMissingRequirement, requirement:
- print str(requirement)
- sys.exit(-1)
- except exception.SpockMissingRecommended, recommended:
- print str(recommended)
-
- prepare_input_handler()
- prepare_cmdline()
-
- launch_new_instance()
-
diff --git a/src/sardana/spock/ipython_01_00/__init__.py b/src/sardana/spock/ipython_01_00/__init__.py
deleted file mode 100644
index a2538b79..00000000
--- a/src/sardana/spock/ipython_01_00/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities for ipython > 0.10"""
diff --git a/src/sardana/spock/ipython_01_00/genutils.py b/src/sardana/spock/ipython_01_00/genutils.py
deleted file mode 100644
index 1add778d..00000000
--- a/src/sardana/spock/ipython_01_00/genutils.py
+++ /dev/null
@@ -1,1159 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock generic utilities"""
-
-__all__ = ['page', 'arg_split', 'get_gui_mode', 'get_pylab_mode',
- 'get_color_mode', 'get_app',
- 'get_shell', 'get_ipapi', 'get_config', 'get_editor', 'ask_yes_no',
- 'spock_input',
- 'translate_version_str2int', 'get_ipython_version',
- 'get_ipython_version_number', 'get_python_version',
- 'get_python_version_number', 'get_ipython_dir',
- 'get_ipython_profiles',
- 'get_pytango_version', 'get_pytango_version_number',
- 'get_server_for_device', 'get_macroserver_for_door',
- 'get_device_from_user', 'get_tango_db', 'get_tango_host_from_user',
- 'print_dev_from_class', 'from_name_to_tango', 'clean_up',
- 'get_taurus_core_version', 'get_taurus_core_version_number',
- 'check_requirements', 'get_door', 'get_macro_server',
- 'expose_magic', 'unexpose_magic', 'expose_variable',
- 'expose_variables', 'unexpose_variable',
- 'create_spock_profile', 'check_for_upgrade', 'get_args',
- 'start', 'mainloop', 'run',
- 'load_ipython_extension', 'unload_ipython_extension', 'load_config',
- 'MSG_FAILED', 'MSG_FAILED_WR', 'MSG_R', 'MSG_ERROR',
- 'MSG_DONE', 'MSG_OK']
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import os
-import socket
-
-import IPython
-import IPython.core.magic
-from IPython.core.page import page
-from IPython.core.profiledir import ProfileDirError, ProfileDir
-from IPython.core.application import BaseIPythonApplication
-from IPython.core.interactiveshell import InteractiveShell
-from IPython.utils.io import ask_yes_no as _ask_yes_no
-from IPython.utils.path import get_ipython_dir
-from IPython.utils.process import arg_split
-from IPython.utils.coloransi import TermColors
-from IPython.config.application import Application
-from IPython.terminal.ipapp import TerminalIPythonApp, launch_new_instance
-
-import taurus
-#from taurus.core import Release as TCRelease
-
-from taurus.core.taurushelper import Factory
-from taurus.core.util.codecs import CodecFactory
-
-# make sure Qt is properly initialized
-from taurus.external.qt import Qt
-
-from sardana.spock import exception
-from sardana.spock import colors
-from sardana.spock import release
-
-SpockTermColors = colors.TermColors
-
-requirements = {
-# module minimum recommended
- "IPython" : ("0.11.0", "0.12.0"),
- "Python" : ("2.6.0", "2.6.0"),
- "PyTango" : ("7.2.0", "7.2.3"),
- "taurus.core" : ("3.0.0", "3.0.0")
-}
-
-ENV_NAME = "_E"
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# IPython utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_gui_mode():
- return 'qt'
-
-def get_pylab_mode():
- return get_app().pylab
-
-def get_color_mode():
- return get_config().InteractiveShell.colors
-
-def get_app():
- #return TerminalIPythonApp.instance()
- return Application.instance()
-
-def get_shell():
- """Get the global InteractiveShell instance."""
- return get_app().shell
-
-def get_ipapi():
- """Get the global InteractiveShell instance."""
- return InteractiveShell.instance()
-
-def get_config():
- return get_app().config
-
-def get_editor():
- return get_ipapi().editor
-
-def ask_yes_no(prompt,default=None):
- """Asks a question and returns a boolean (y/n) answer.
-
- If default is given (one of 'y','n'), it is used if the user input is
- empty. Otherwise the question is repeated until an answer is given.
-
- An EOF is treated as the default answer. If there is no default, an
- exception is raised to prevent infinite loops.
-
- Valid answers are: y/yes/n/no (match is not case sensitive)."""
-
- if default:
- prompt = '%s [%s]' % (prompt, default)
- return _ask_yes_no(prompt, default)
-
-def spock_input(prompt='', ps2='... '):
- return raw_input(prompt)
-
-def translate_version_str2int(version_str):
- """Translates a version string in format x[.y[.z[...]]] into a 000000 number"""
- import math
- parts = version_str.split('.')
- i, v, l = 0, 0, len(parts)
- if not l: return v
- while i<3:
- try:
- v += int(parts[i])*int(math.pow(10,(2-i)*2))
- l -= 1
- i += 1
- except ValueError:
- return v
- if not l: return v
- return v
-
- try:
- v += 10000*int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += 100*int(parts[1])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
- try:
- v += int(parts[0])
- l -= 1
- except ValueError:
- return v
- if not l: return v
-
-def get_ipython_version():
- """Returns the current IPython version"""
- v = None
- try:
- try:
- v = IPython.Release.version
- except Exception:
- try:
- v = IPython.release.version
- except Exception, e2:
- print e2
- except Exception, e3:
- print e3
- return v
-
-def get_ipython_version_number():
- """Returns the current IPython version number"""
- ipyver_str = get_ipython_version()
- if ipyver_str is None: return None
- return translate_version_str2int(ipyver_str)
-
-def get_python_version():
- return '.'.join(map(str,sys.version_info[:3]))
-
-def get_python_version_number():
- pyver_str = get_python_version()
- return translate_version_str2int(pyver_str)
-
-def get_ipython_profiles(path=None):
- """list profiles in a given root directory"""
- if path is None:
- path = get_ipython_dir()
- files = os.listdir(path)
- profiles = []
- for f in files:
- full_path = os.path.join(path, f)
- if os.path.isdir(full_path) and f.startswith('profile_'):
- profiles.append(f.split('_',1)[-1])
- return profiles
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# PyTango utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_pytango_version():
- try:
- import PyTango
- try:
- return PyTango.Release.version
- except:
- return '0.0.0'
- except:
- return None
-
-def get_pytango_version_number():
- tgver_str = get_pytango_version()
- if tgver_str is None: return None
- return translate_version_str2int(tgver_str)
-
-def get_server_for_device(device_name):
- db = get_tango_db()
- device_name = device_name.lower()
- server_list = db.get_server_list()
- for server in server_list:
- for dev in db.get_device_class_list(server)[::2]:
- if dev.lower() == device_name:
- return server
- return None
-
-def get_macroserver_for_door(door_name):
- """Returns the MacroServer device name in the same DeviceServer as the
- given door device"""
- _, door_name, _ = from_name_to_tango(door_name)
- db = get_tango_db()
- door_name = door_name.lower()
- server_list = list(db.get_server_list('MacroServer/*'))
- server_list += list(db.get_server_list('Sardana/*'))
- server_devs = None
- for server in server_list:
- server_devs = db.get_device_class_list(server)
- devs, klasses = server_devs[0::2], server_devs[1::2]
- for dev in devs:
- if dev.lower() == door_name:
- for i, klass in enumerate(klasses):
- if klass == 'MacroServer':
- return "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), devs[i])
- else:
- return None
-
-def get_device_from_user(expected_class, dft = None):
- """Gets a device of the given device class from user input"""
- dft = print_dev_from_class(expected_class, dft)
- prompt = "%s name from the list" % expected_class
- if not dft is None:
- prompt += "[%s]" % dft
- prompt += "? "
- from_user = raw_input(prompt).strip() or dft
-
- name = ''
- try:
- full_name, name, _ = from_name_to_tango(from_user)
- except:
- print "Warning: the given %s does not exist" % expected_class
- return name
-
- try:
- db = get_tango_db()
- cl_name = db.get_class_for_device(name)
- class_correct = cl_name == expected_class
- if not class_correct:
- print "Warning: the given name is not a %s (it is a %s)"%(expected_class,cl_name)
- except Exception as e:
- print "Warning: unable to confirm if '%s' is valid" % name
- print str(e)
- return full_name
-
-def get_tango_db():
- import PyTango
- tg_host = PyTango.ApiUtil.get_env_var("TANGO_HOST")
-
- db = None
- if tg_host is None:
- host,port = get_tango_host_from_user()
- tg_host = "%s:%d" % (host,port)
- os.environ["TANGO_HOST"] = tg_host
- db = PyTango.Database()
- else:
- try:
- db = PyTango.Database()
- except:
- # tg host is not valid. Find a valid one
- host,port = get_tango_host_from_user()
- tg_host = "%s:%d" % (host,port)
- os.environ["TANGO_HOST"] = tg_host
-
- db = PyTango.Database()
- return db
-
-def get_tango_host_from_user():
- import PyTango
- while True:
- prompt = "Please enter a valid tango host (<host>:<port>): "
- from_user = raw_input(prompt).strip()
-
- try:
- host, port = from_user.split(':')
- try:
- port = int(port)
- try:
- socket.gethostbyname(host)
- try:
- PyTango.Database(host, port)
- return (host, port)
- except:
- exp = "No tango database found at %s:%d" % (host, port)
- except:
- exp = "Invalid host name %s" % host
- except:
- exp = "Port must be a number > 0"
- except:
- exp = "Invalid tango host. Must be in format <host>:<port>"
- exp = "Invalid tango host. %s " % exp
- print exp
-
-def print_dev_from_class(classname, dft = None):
-
- db = get_tango_db()
- pytg_ver = get_pytango_version_number()
- if pytg_ver >= 030004:
- server_wildcard = '*'
- try:
- exp_dev_list = db.get_device_exported_for_class(classname)
- except:
- exp_dev_list = []
- else:
- server_wildcard = '%'
- exp_dev_list = []
-
- res = None
- dev_list = db.get_device_name(server_wildcard,classname)
- tg_host = "%s:%s" % (db.get_db_host(),db.get_db_port())
- print "Available",classname,"devices from",tg_host,":"
- for dev in dev_list:
- _, name, alias = from_name_to_tango(dev)
- out = alias or name
- if alias: out += ' (a.k.a. %s)' % name
- out = "%-25s" % out
- if dev in exp_dev_list:
- out += " (running)"
- print out
- if dft:
- if dft.lower() == name.lower(): res = name
- elif not alias is None and dft.lower() == alias.lower(): res = alias
-
- return res
-
-def from_name_to_tango(name):
-
- db = get_tango_db()
-
- alias = None
-
- c = name.count('/')
- # if the db prefix is there, remove it first
- if c == 3 or c == 1:
- name = name[name.index("/")+1:]
-
- elems = name.split('/')
- l = len(elems)
-
- if l == 3:
- try:
- alias = db.get_alias(name)
- if alias.lower() == 'nada':
- alias = None
- except:
- alias = None
- elif l == 1:
- alias = name
- name = db.get_device_alias(alias)
- else:
- raise Exception("Invalid device name '%s'" % name)
-
- full_name = "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), name)
- return full_name, name, alias
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# taurus utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def clean_up():
- taurus.Manager().cleanUp()
-
-def get_taurus_core_version():
- try:
- import taurus
- return taurus.core.release.version
- except:
- import traceback
- traceback.print_exc()
- return '0.0.0'
-
-def get_taurus_core_version_number():
- tgver_str = get_taurus_core_version()
- if tgver_str is None: return None
- return translate_version_str2int(tgver_str)
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Requirements checking
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def check_requirements():
- r = requirements
- minPyTango, recPyTango = map(translate_version_str2int, r["PyTango"])
- minIPython, recIPython = map(translate_version_str2int, r["IPython"])
- minPython, recPython = map(translate_version_str2int, r["Python"])
- minTaurusCore, recTaurusCore = map(translate_version_str2int, r["taurus.core"])
-
- currPython = get_python_version_number()
- currIPython = get_ipython_version_number()
- currPyTango = get_pytango_version_number()
- currTaurusCore = get_taurus_core_version_number()
-
- errMsg = ""
- warnMsg = ""
-
- errPython, errIPython, errPyTango, errTaurusCore = False, False, False, False
- if currPython is None:
- errMsg += "Spock needs Python version >= %s. No python installation found\n" % requirements["Python"][0]
- errPython = True
- elif currPython < minPython:
- errMsg += "Spock needs Python version >= %s. Current version is %s\n" % (requirements["Python"][0], get_python_version())
- errPython = True
-
- if currIPython is None:
- errMsg += "Spock needs IPython version >= %s. No IPython installation found\n" % requirements["IPython"][0]
- errIPython = True
- elif currIPython < minIPython:
- errMsg += "Spock needs IPython version >= %s. Current version is %s\n" % (requirements["IPython"][0], get_ipython_version())
- errIPython = True
-
- if currPyTango is None:
- errMsg += "Spock needs PyTango version >= %s. No PyTango installation found\n" % requirements["IPython"][0]
- errPyTango = True
- elif currPyTango < minPyTango:
- errMsg += "Spock needs PyTango version >= %s. " % requirements["PyTango"][0]
- if currPyTango > 0:
- errMsg += "Current version is %s\n" % get_pytango_version()
- else:
- errMsg += "Current version is unknown (most surely too old)\n"
- errPyTango = True
-
- if currTaurusCore is None:
- errMsg += "Spock needs taurus.core version >= %s. No taurus.core installation found\n" % requirements["taurus.core"][0]
- errTaurusCore = True
- elif currTaurusCore < minTaurusCore:
- errMsg += "Spock needs taurus.core version >= %s. " % requirements["taurus.core"][0]
- if currTaurusCore > 0:
- errMsg += "Current version is %s\n" % get_taurus_core_version()
- else:
- errMsg += "Current version is unknown (most surely too old)\n"
- errTaurusCore = True
-
- # Warnings
- if not errPython and currPython < recPython:
- warnMsg += "Spock recommends Python version >= %s. Current version " \
- "is %s\n" % (requirements["Python"][1],
- get_python_version())
-
- if not errIPython and currIPython < recIPython:
- warnMsg += "Spock recommends IPython version >= %s. Current version " \
- "is %s\n" % (requirements["IPython"][1],
- get_ipython_version())
-
- if not errPyTango and currPyTango < recPyTango:
- warnMsg += "Spock recommends PyTango version >= %s. Current version " \
- "is %s\n" % (requirements["PyTango"][1],
- get_pytango_version())
-
- if not errTaurusCore and currTaurusCore < recTaurusCore:
- warnMsg += "Spock recommends taurus.core version >= %s. Current " \
- "version is %s\n" % (requirements["taurus.core"][1],
- get_taurus_core_version())
-
- if errMsg:
- errMsg += warnMsg
- raise exception.SpockMissingRequirement, errMsg
-
- if warnMsg:
- raise exception.SpockMissingRecommended, warnMsg
-
- return True
-
-def _get_dev(dev_type):
- spock_config = get_config().Spock
- taurus_dev = None
- taurus_dev_var = "_" + dev_type
- if hasattr(spock_config, taurus_dev_var):
- taurus_dev = getattr(spock_config, taurus_dev_var)
- if taurus_dev is None:
- dev_name = getattr(spock_config, dev_type + '_name')
- factory = Factory()
- taurus_dev = factory.getDevice(dev_name)
- import PyTango
- dev = PyTango.DeviceProxy(dev_name)
- setattr(spock_config, dev_type, dev)
- setattr(spock_config, taurus_dev_var, taurus_dev)
- shell = get_shell()
- dev_type_upper = dev_type.upper()
- shell.user_ns[dev_type_upper] = dev
- shell.user_ns["_" + dev_type_upper] = taurus_dev
- return taurus_dev
-
-def get_door():
- return _get_dev('door')
-
-def get_macro_server():
- return _get_dev('macro_server')
-
-def _macro_completer(self, event):
- """Method called by the IPython autocompleter. It will determine possible
- values for macro arguments.
- """
- ms = get_macro_server()
-
- macro_name = event.command.lstrip('%')
- # calculate parameter index
- param_idx = len(event.line.split()) - 1
- if not event.line.endswith(' '): param_idx -= 1
- # get macro info
- info = ms.getMacroInfoObj(macro_name)
- # if macro doesn't have parameters return
- if param_idx < 0 or not info.hasParams() : return
- # get the parameter info
- possible_params = info.getPossibleParams(param_idx)
- # return the existing elements for the given parameter type
- if possible_params:
- res = []
- for param in possible_params:
- res.extend(ms.getElementNamesWithInterface(param['type']))
- return res
-
-def expose_magic(name, fn, completer_func=_macro_completer):
- shell = get_shell()
- fn.old_magic = shell.define_magic(name, fn)
- fn.old_completer = completer_func
-
- if completer_func is None:
- return
-
- # enable macro param completion
- if completer_func is not None:
- shell.set_hook('complete_command', completer_func, str_key = name)
- shell.set_hook('complete_command', completer_func, str_key = '%'+name)
-
-def unexpose_magic(name):
- shell = get_shell()
- mg_name = 'magic_' + name
- if hasattr(shell, mg_name):
- magic_fn = getattr(shell, mg_name)
- delattr(shell, mg_name)
- if hasattr(magic_fn, 'old_magic') and magic_fn.old_magic is not None:
- expose_magic(name, magic_fn.old_magic, magic_fn.old_completer)
-
-def expose_variable(name, value):
- get_shell().user_ns[name] = value
-
-def expose_variables(d):
- get_shell().user_ns.update(d)
-
-def unexpose_variable(name):
- user_ns = get_shell().user_ns
- del user_ns[name]
-
-def create_spock_profile(userdir, dft_profile, profile, door_name=None):
- """Create a profile file from a profile template file """
- if not os.path.isdir(userdir):
- ProfileDir.create_profile_dir(userdir)
- p_dir = ProfileDir.create_profile_dir_by_name(userdir, profile)
- ###########################################################################
- # NOTE: BaseIPythonApplication.config_file_name.default_value should return
- # the config file name, but it returns an empty string instead (at least
- # in some cases). For now, we give a hardcoded name if it is empty
- # TODO: Check why this is the case
- config_file_name = BaseIPythonApplication.config_file_name.default_value
- config_file_name = config_file_name or 'ipython_config.py'
- ###########################################################################
- abs_config_file_name = os.path.join(p_dir.location, config_file_name)
- create_config = True
- if os.path.isfile(abs_config_file_name):
- create_config = ask_yes_no("Spock configuration file already exists. "\
- "Do you wish to replace it?", default='y')
- if not create_config:
- return
-
- src_data = """\
-\"\"\"Settings for Spock session\"\"\"
-
-#
-# Please do not delete the next lines has they are used to check the version
-# number for possible upgrades
-# spock_creation_version = {version}
-# door_name = {door_name}
-#
-
-import PyTango.ipython
-import sardana.spock.genutils
-from sardana.spock.config import Spock
-
-config = get_config()
-config.Spock.macro_server_name = '{macroserver_name}'
-config.Spock.door_name = '{door_name}'
-
-load_subconfig('ipython_config.py', profile='default')
-sardana.spock.load_config(config)
-
-# Put any additional environment here and/or overwrite default sardana config
-config.IPKernelApp.pylab = 'inline'
-
-"""
- #
- # Discover door name
- #
- if door_name is None:
- door_name = get_device_from_user("Door", profile)
- else:
- full_door_name, door_name, _ = from_name_to_tango(door_name)
- door_name = full_door_name
-
- #
- # Discover macro server name
- #
- ms_name = get_macroserver_for_door(door_name)
-
- dest_data = src_data.format(version=release.version,
- macroserver_name=ms_name,
- door_name=door_name)
-
- sys.stdout.write('Storing %s in %s... ' % (config_file_name, p_dir.location))
- sys.stdout.flush()
-
- with file(abs_config_file_name, "w") as f:
- f.write(dest_data)
- f.close()
- sys.stdout.write(MSG_DONE + '\n')
-
-def check_for_upgrade(ipy_profile_file, ipythondir, session, profile):
- # Check if the current profile is up to date with the spock version
- spock_profile_ver_str = '0.0.0'
- door_name = None
-
- # search for version and door inside the ipy_profile file
- for i, line in enumerate(ipy_profile_file):
- if i > 20 : break; # give up after 20 lines
- if line.startswith('# spock_creation_version = '):
- spock_profile_ver_str = line[line.index('=')+1:].strip()
- if line.startswith('# door_name = '):
- door_name = line[line.index('=')+1:].strip()
-
- # convert version from string to numbers
- spocklib_ver = translate_version_str2int(release.version)
- spock_profile_ver = translate_version_str2int(spock_profile_ver_str)
-
- if spocklib_ver == spock_profile_ver:
- return
- if spocklib_ver < spock_profile_ver:
- print '%sYour spock profile (%s) is newer than your spock version ' \
- '(%s)!' % (SpockTermColors.Brown, spock_profile_ver_str, release.version)
- print 'Please upgrade spock or delete the current profile %s' % SpockTermColors.Normal
- sys.exit(1)
-
- # there was no version track of spock profiles since spock 0.2.0 so change
- # the message
- if spock_profile_ver_str == '0.0.0':
- spock_profile_ver_str = '<= 0.2.0'
- msg = 'Your current spock door extension profile has been created with spock %s.\n' \
- 'Your current spock door extension version is %s, therefore a profile upgrade is needed.\n' \
- % (spock_profile_ver_str, release.version)
- print msg
- prompt = 'Do you wish to upgrade now (warn: this will shutdown the current spock session) ([y]/n)? '
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipythondir, session, profile, door_name)
- sys.exit(0)
-
-def get_args(argv):
-
- script_name = argv[0]
- _, session = os.path.split(script_name)
- script_name = os.path.realpath(script_name)
-
- macro_server = None
- door = None
-
- # Define the profile file
- profile = "spockdoor"
- try:
- for _, arg in enumerate(argv[1:]):
- if arg.startswith('--profile='):
- profile=arg[10:]
- break
- else:
- argv.append("--profile=" + profile)
- except:
- pass
-
- ipython_dir = get_ipython_dir()
- try:
- ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
- except ProfileDirError:
- r = ''
- while not r in ('y','n'):
- prompt = 'Profile \'%s\' does not exist. Do you want to create '\
- 'one now ([y]/n)? ' % profile
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipython_dir, session, profile)
- else:
- sys.stdout.write('No spock door extension profile was created. Starting normal spock...\n')
- sys.stdout.flush()
- profile = ''
-
- # inform the shell of the profile it should use
- if not '--profile=' in argv and profile:
- argv.append('--profile=' + profile)
-
- user_ns = { 'MACRO_SERVER_NAME' : macro_server,
- 'DOOR_NAME' : door,
- 'PROFILE' : profile }
-
- return user_ns
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Useful constants
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-MSG_G = '[%s%%s%s]' % (SpockTermColors.Green, SpockTermColors.Normal)
-MSG_R = '[%s%%s%s]' % (SpockTermColors.Red, SpockTermColors.Normal)
-MSG_FAILED = MSG_R % 'FAILED'
-MSG_FAILED_WR = MSG_R % 'FAILED: %s'
-MSG_ERROR = MSG_R % 'ERROR'
-MSG_DONE = MSG_G % 'DONE'
-MSG_OK = MSG_G % 'OK'
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# initialization methods
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def init_taurus():
- # the CodecFactory is not thread safe. There are two attributes who will
- # request for it in the first event at startup in different threads
- # therefore this small hack: make sure CodecFactory is initialized.
- CodecFactory()
-
- factory = Factory()
-
- import sardana.spock.spockms
- macroserver = sardana.spock.spockms
-
- factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)
-
- mode = get_gui_mode()
- if mode == 'qt':
- factory.registerDeviceClass('Door', macroserver.QSpockDoor)
- else:
- factory.registerDeviceClass('Door', macroserver.SpockDoor)
-
-
-def load_ipython_extension(ipython):
- import sardana.spock.magic
- magic = sardana.spock.magic
-
- init_taurus()
-
- config = ipython.config
- user_ns = ipython.user_ns
- user_ns['MACRO_SERVER_NAME'] = config.Spock.macro_server_name
- user_ns['MACRO_SERVER_ALIAS'] = config.Spock.macro_server_alias
- user_ns['DOOR_NAME'] = config.Spock.door_name
- user_ns['DOOR_ALIAS'] = config.Spock.door_alias
- user_ns['DOOR_STATE'] = ""
-
- #shell.set_hook('late_startup_hook', magic.spock_late_startup_hook)
- ipython.set_hook('pre_prompt_hook', magic.spock_pre_prompt_hook)
-
- #if ip.IP.alias_table.has_key('mv'):
- # del ip.IP.alias_table['mv']
-
- door = get_door()
- macro_server = get_macro_server()
-
- # Initialize the environment
- expose_variable(ENV_NAME, macro_server.getEnvironment())
-
- new_style_magics = hasattr(IPython.core.magic, 'Magics') and hasattr(IPython.core.magic, 'magics_class')
-
- if new_style_magics:
- @IPython.core.magic.magics_class
- class Sardana(IPython.core.magic.Magics):
- debug = IPython.core.magic.line_magic(magic.debug)
- www = IPython.core.magic.line_magic(magic.www)
- post_mortem = IPython.core.magic.line_magic(magic.post_mortem)
- spsplot = IPython.core.magic.line_magic(magic.spsplot)
- macrodata = IPython.core.magic.line_magic(magic.macrodata)
- edmac = IPython.core.magic.line_magic(magic.edmac)
- showscan = IPython.core.magic.line_magic(magic.showscan)
- expconf = IPython.core.magic.line_magic(magic.expconf)
-
- ipython.register_magics(Sardana)
- else:
- expose_magic('debug', magic.debug, magic.debug_completer)
- expose_magic('www', magic.www, None)
- expose_magic('post_mortem', magic.post_mortem, None)
- expose_magic('spsplot', magic.spsplot, None)
- expose_magic('macrodata', magic.macrodata, None)
- expose_magic('edmac', magic.edmac, None)
- expose_magic('showscan', magic.showscan, None)
- expose_magic('expconf', magic.expconf, None)
-
- door.setConsoleReady(True)
-
-def unload_ipython_extension(ipython):
- pass
-
-def load_config(config):
- spockver = release.version
- pyver = get_python_version()
- ipyver = get_ipython_version()
- pytangover = get_pytango_version()
- tauruscorever = get_taurus_core_version()
-
- door = config.Spock.door_name
-
- if not hasattr(config.Spock, 'macro_server_name'):
- macro_server = get_macroserver_for_door(door)
- else:
- macro_server = config.Spock.macro_server_name
-
- full_door_tg_name, door_tg_name, door_tg_alias = from_name_to_tango(door)
- door_alias = door_tg_alias or door_tg_name
- full_ms_tg_name, ms_tg_name, ms_tg_alias = from_name_to_tango(macro_server)
- ms_alias = ms_tg_alias or ms_tg_name
-
- config.Spock.macro_server_name = full_ms_tg_name
- config.Spock.door_name = full_door_tg_name
- config.Spock.macro_server_alias = ms_alias
- config.Spock.door_alias = door_alias
-
- d = { "version" : spockver,
- "pyver" : pyver,
- "ipyver" : ipyver,
- "pytangover" : pytangover,
- "taurusver" : tauruscorever,
- #"profile" : ip.user_ns["PROFILE"],
- "door" : door_alias }
-
- d.update(TermColors.__dict__)
-
- gui_mode = get_gui_mode()
-
- banner = """\
-%(Purple)sSpock %(version)s%(Normal)s -- An interactive laboratory application.
-
-help -> Spock's help system.
-object? -> Details about 'object'. ?object also works, ?? prints more.
-"""
- banner = banner % d
- banner = banner.format(**d)
-
- ipy_ver = get_ipython_version_number()
-
- # ------------------------------------
- # Application
- # ------------------------------------
- app = config.Application
- app.log_level = 30
-
- # ------------------------------------
- # BaseIPythonApplication
- # ------------------------------------
- i_app = config.BaseIPythonApplication
- extensions = getattr(i_app, 'extensions', [])
- extensions.extend(["PyTango.ipython", "sardana.spock"])
- i_app.extensions = extensions
-
- # ------------------------------------
- # InteractiveShell
- # (IPython.core.interactiveshell)
- # ------------------------------------
- i_shell = config.InteractiveShell
- i_shell.autocall = 0
- i_shell.automagic = True
- i_shell.color_info = True
- i_shell.colors = 'Linux'
- i_shell.deep_reload = True
- i_shell.confirm_exit = False
-
- if ipy_ver >= 1200:
- # ------------------------------------
- # PromptManager (ipython >= 0.12)
- # ------------------------------------
- prompt = config.PromptManager
- prompt.in_template = '{DOOR_ALIAS} [\\#]: '
- prompt.in2_template = ' .\\D.: '
- prompt.out_template = 'Result [\\#]: '
- prompt.color_scheme = 'Linux'
- else:
- # (Deprecated in ipython >= 0.12 use PromptManager.in_template)
- i_shell.prompt_in1 = config.Spock.door_alias + ' [\\#]: '
-
- # (Deprecated in ipython >= 0.12 use PromptManager.in2_template)
- i_shell.prompt_in2 = ' .\\D.: '
-
- # (Deprecated in ipython >= 0.12 use PromptManager.out_template)
- i_shell.prompt_out = 'Result [\\#]: '
-
- # (Deprecated in ipython >= 0.12 use PromptManager.justify)
- i_shell.prompts_pad_left = True
-
- # ------------------------------------
- # IPCompleter
- # ------------------------------------
- completer = config.IPCompleter
- completer.omit__names = 2
- completer.greedy = False
-
- # ------------------------------------
- # InteractiveShellApp
- # ------------------------------------
- i_shell_app = config.InteractiveShellApp
- i_shell_app.ignore_old_config = True
-
- # ------------------------------------
- # TerminalIPythonApp: options for the IPython terminal (and not Qt Console)
- # ------------------------------------
- term_app = config.TerminalIPythonApp
- term_app.display_banner = True
- term_app.gui = gui_mode
- term_app.pylab='qt'
- #term_app.nosep = False
- #term_app.classic = True
-
- # ------------------------------------
- # IPKernelApp: options for the Qt Console
- # ------------------------------------
- #kernel_app = config.IPKernelApp
- ipython_widget = config.IPythonWidget
- ipython_widget.in_prompt = ' Spock [<span class="in-prompt-number">%i</span>]: '
- ipython_widget.out_prompt = 'Result [<span class="out-prompt-number">%i</span>]: '
- ipython_widget.input_sep = '\n'
- ipython_widget.output_sep = ''
- ipython_widget.output_sep2 = ''
- ipython_widget.enable_calltips = True
- if ipy_ver >= 1300:
- ipython_widget.gui_completion = 'droplist'
- else:
- ipython_widget.gui_completion = True
- ipython_widget.ansi_codes = True
- ipython_widget.paging = 'inside'
- #ipython_widget.pylab = 'inline'
-
- # ------------------------------------
- # ConsoleWidget
- # ------------------------------------
- # console_widget = config.ConsoleWidget
-
- # ------------------------------------
- # FrontendWidget
- # ------------------------------------
- frontend_widget = config.FrontendWidget
- frontend_widget.banner = banner
-
- # ------------------------------------
- # TerminalInteractiveShell
- # ------------------------------------
- term_i_shell = config.TerminalInteractiveShell
- term_i_shell.autocall = 2
- term_i_shell.automagic = True
- #term_i_shell.editor = 'gedit'
- #term_i_shell.editor = 'nano'
-
- term_i_shell.banner1 = banner
- term_i_shell.banner2 = "Connected to " + door_alias + "\n"
- #term_app.banner1 = banner
- #term_app.banner2 = "Connected to " + door_alias + "\n"
-
- # ------------------------------------
- # InlineBackend
- # ------------------------------------
- inline_backend = config.InlineBackend
- inline_backend.figure_format = 'svg'
-
- # ------------------------------------
- # InteractiveShellEmbed
- # ------------------------------------
- #i_shell_embed = config.InteractiveShellEmbed
-
- # ------------------------------------
- # NotebookApp
- # ------------------------------------
- #notebook_app = config.NotebookApp
-
- # ------------------------------------
- # NotebookManager
- # ------------------------------------
- #notebook_manager = config.NotebookManager
-
- # ------------------------------------
- # ZMQInteractiveShell
- # ------------------------------------
- #zmq_i_shell = config.ZMQInteractiveShell
-
- # Tell console everything is ready.
- config.Spock.ready = True
- return config
-
-def start(user_ns=None):
- # Make sure the log level is changed to warning
- CodecFactory()
- taurus.setLogLevel(taurus.Warning)
-
- try:
- check_requirements()
- except exception.SpockMissingRequirement, requirement:
- print str(requirement)
- sys.exit(-1)
- except exception.SpockMissingRecommended, recommended:
- print str(recommended)
-
- user_ns = user_ns or {}
- try:
- user_ns.update(get_args(sys.argv))
- except exception.SpockException, e:
- print e.message
- print 'Starting normal IPython console'
- except KeyboardInterrupt:
- print "\nUser pressed Ctrl+C. Exiting..."
- sys.exit()
- except Exception, e:
- print 'spock exited with an unmanaged exception: %s' % str(e)
- sys.exit(-2)
-
- app = TerminalIPythonApp.instance()
- app.initialize()
- #config = get_config()
- return app
-
-def mainloop(app=None, user_ns=None):
- if app is None:
- app = start(user_ns)
- app.start()
-
-def prepare_input_handler():
- # initialize input handler as soon as possible
- import sardana.spock.inputhandler
- _ = sardana.spock.inputhandler.InputHandler()
-
-
-def prepare_cmdline(argv=None):
- if argv is None:
- argv = sys.argv
-
- script_name = argv[0]
- _, session = os.path.split(script_name)
- script_name = os.path.realpath(script_name)
-
- # Define the profile file
- profile, append_profile = "spockdoor", True
- try:
- # in ipython the last option in the list takes precedence
- # so reversing order for searching of the profile
- reversed_argv = reversed(argv[1:])
- for _, arg in enumerate(reversed_argv):
- if arg.startswith('--profile='):
- profile=arg[10:]
- append_profile = False
- break
- except:
- pass
-
- ipython_dir = get_ipython_dir()
- try:
- ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
- except ProfileDirError:
- r = ''
- while not r in ('y', 'n'):
- prompt = "Profile '%s' does not exist. Do you want to create "\
- "one now ([y]/n)? " % profile
- r = raw_input(prompt) or 'y'
- if r.lower() == 'y':
- create_spock_profile(ipython_dir, session, profile)
- else:
- sys.stdout.write('No spock profile was created. '
- 'Starting ipython with default profile...\n')
- sys.stdout.flush()
- # removing all options refering to profile
- for _, arg in enumerate(argv[1:]):
- if arg.startswith('--profile='):
- argv.remove(arg)
- return
-
- if append_profile:
- argv.append("--profile=" + profile)
-
-
-def run():
-
- try:
- from IPython.utils.traitlets import Unicode
- from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
-
- class SpockConsole(RichIPythonWidget):
-
- banner = Unicode(config=True)
-
- def _banner_default(self):
- config = get_config()
- return config.FrontendWidget.banner
-
- import IPython.qt.console.qtconsoleapp
- IPythonQtConsoleApp = IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp
- IPythonQtConsoleApp.widget_factory = SpockConsole
- IPythonQtConsoleApp.version.default_value = release.version
- except ImportError:
- pass
-
- try:
- check_requirements()
- except exception.SpockMissingRequirement, requirement:
- print str(requirement)
- sys.exit(-1)
- except exception.SpockMissingRecommended, recommended:
- print str(recommended)
-
- prepare_input_handler()
- prepare_cmdline()
-
- launch_new_instance()
-
diff --git a/src/sardana/spock/magic.py b/src/sardana/spock/magic.py
deleted file mode 100644
index 325c8b85..00000000
--- a/src/sardana/spock/magic.py
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Initial magic commands and hooks for the spock IPython environment"""
-
-__all__ = ['expconf', 'showscan', 'spsplot', 'debug_completer',
- 'debug', 'www',
- 'post_mortem', 'macrodata', 'edmac', 'spock_late_startup_hook',
- 'spock_pre_prompt_hook']
-
-
-from .genutils import page, get_door, get_macro_server, ask_yes_no, arg_split
-from .genutils import MSG_DONE, MSG_FAILED
-from .genutils import get_ipapi
-
-
-def expconf(self, parameter_s=''):
- """Launches a GUI for configuring the environment variables
- for the experiments (scans)"""
- try:
- from sardana.taurus.qt.qtgui.extra_sardana import ExpDescriptionEditor
- except:
- print "Error importing ExpDescriptionEditor "\
- "(hint: is taurus extra_sardana installed?)"
- return
- doorname = get_door().name()
-
- #===========================================================================
- ## ugly hack to avoid ipython/qt thread problems #e.g. see
- ## https://sourceforge.net/p/sardana/tickets/10/
- ## this hack does not allow inter-process communication and leaves the
- ## widget open after closing spock
- ## @todo: investigate cause of segfaults when using launching qt widgets from ipython
- #
- #w = ExpDescriptionEditor(door=doorname)
- #w.show() #launching it like this, produces the problem of https://sourceforge.net/p/sardana/tickets/10/
- import subprocess
- import sys
- fname = sys.modules[ExpDescriptionEditor.__module__].__file__
- args = ['python', fname, doorname]
- subprocess.Popen(args)
- #===========================================================================
-
-
-def showscan(self, parameter_s=''):
- """Shows a scan in a GUI.
-
- :param scan_id: scan number [default: None, meaning show last scan]"""
- params = parameter_s.split()
- door = get_door()
- online, scan_nb = False, None
- if len(params) > 0:
- if params[0].lower() == 'online':
- msg = 'To see the scans online, launch "expconf" and ' + \
- 'enable the plots from the "plots" button ' + \
- '(top-right in the first tab)'
- print msg
- return
- # show the scan plot, ignoring the plot configuration
- elif params[0].lower() == 'online_raw':
- online = True
- else:
- scan_nb = int(params[0])
- door.show_scan(scan_nb, online=online)
-
-
-def spsplot(self, parameter_s=''):
- get_door().plot()
-
-
-def debug_completer(self, event):
- # calculate parameter index
- param_idx = len(event.line.split()) - 1
- if not event.line.endswith(' '):
- param_idx -= 1
- if param_idx == 0:
- return ('off', 'on')
-
-
-def debug(self, parameter_s=''):
- """Activate/Deactivate macro server debug output"""
- params = parameter_s.split()
- door = get_door()
- if len(params) == 0:
- s = door.getDebugMode() and 'on' or 'off'
- print "debug mode is %s" % s
- return
- elif len(params) == 1:
- s = params[0].lower()
- if not s in ('off', 'on'):
- print "Usage: debug [on|off]"
- return
- door.setDebugMode(s == 'on')
- print "debug mode is now %s" % s
- else:
- print "Usage: debug [on|off]"
-
-
-def www(self, parameter_s=''):
- """What went wrong. Prints the error message from the last macro execution"""
- import PyTango
- door = get_door()
- try:
- last_macro = door.getLastRunningMacro()
- if last_macro is None:
- door.writeln("No macro ran from this console yet!")
- return
- if not hasattr(last_macro, 'exc_stack') or last_macro.exc_stack is None:
- door.writeln("Sorry, but no exception occurred running last " \
- "macro (%s)." % last_macro.name)
- return
- exc = "".join(last_macro.exc_stack)
- door.write(exc)
- except Exception, e:
- door.writeln("Unexpected exception occurred executing www:",
- stream=door.Error)
- door.writeln(str(e), stream=door.Error)
- import traceback
- traceback.print_exc()
-
-
-def post_mortem(self, parameter_s='', from_www=False):
- """Post mortem analysis. Prints the local stream buffer. If no stream is
- specified, it reads 'debug' stream. Valid values are output, critical,
- error, warning, info, debug, result"""
- params = parameter_s.split() or ['debug']
- door = get_door()
- logger = door.getLogObj(params[0])
- msg = ""
-
- if not from_www:
- try:
- msg = "\n".join(logger.read(cache=False).value)
- except:
- from_www = True
-
- if from_www:
- msg = "------------------------------\n" \
- "Server is offline.\n" \
- "This is a post mortem analysis\n" \
- "------------------------------\n"
- msg += "\n".join(logger.getLogBuffer())
- page(msg)
-
-def macrodata(self, parameter_s=''):
- """macrodata
-
- Returns the data produced by the last macro"""
- door = get_door()
- macro_data = door.read_attribute("RecordData")
-
- from taurus.core.util.codecs import CodecFactory
- factory = CodecFactory()
- data = factory.decode(macro_data.value)
- return data
-
-
-def edmac(self, parameter_s=''):
- """edmac <macro name> [<module>]
- Returns the contents of the macro file which contains the macro code for
- the given macro name. If the module is given and it does not exist a new
- one is created. If the given module is a simple module name and it does
- not exist, it will be created on the first directory mentioned in the
- MacroPath"""
- import os
- import tempfile
- import PyTango
-
- ms = get_macro_server()
-
- pars = arg_split(parameter_s, posix=True)
-
- if len(pars) == 1:
- macro_name = pars[0]
- macro_info = ms.getMacroInfoObj(macro_name)
- if macro_info is None:
- print "Macro '%s' could not be found" % macro_name
- return
- macro_lib = macro_info.module
- else:
- macro_name, macro_lib = pars
-
- macro_info = (macro_lib, macro_name)
- print 'Opening %s.%s...' % macro_info
-
- try:
- remote_fname, code, line_nb = ms.GetMacroCode(macro_info)
- except PyTango.DevFailed, e:
- PyTango.Except.print_exception(e)
- return
-
- fd, local_fname = tempfile.mkstemp(prefix='spock_%s_' % pars[0],
- suffix='.py', text=True)
- os.write(fd, code)
- os.close(fd)
-
- cmd = 'edit -x -n %s %s' % (line_nb, local_fname)
- ip = get_ipapi()
- ip.magic(cmd)
-
- if ask_yes_no('Do you want to apply the new code on the server?', 'y'):
- print 'Storing...',
- try:
- f = file(local_fname)
- try:
- new_code = f.read()
- ms.SetMacroCode([remote_fname, new_code])
- print MSG_DONE
- except Exception, e:
- print MSG_FAILED
- print 'Reason:', str(e)
- f.close()
- except:
- print 'Could not open file \'%s\' for safe transfer to the ' \
- 'server' % local_fname
- print 'Did you forget to save?'
- else:
- print "Discarding changes..."
-
- #if os.path.exists(local_fname):
- # if ask_yes_no('Delete temporary file \'%s\'?' % local_fname, 'y'):
- # os.remove(local_fname)
- # bkp = '%s~' % local_fname
- # if os.path.exists(bkp):
- # os.remove(bkp)
- try:
- os.remove(local_fname)
- except:
- pass
-
-
-def spock_late_startup_hook(self):
- try:
- get_door().setConsoleReady(True)
- except:
- import traceback
- print "Exception in spock_late_startup_hook:"
- traceback.print_exc()
-
-
-def spock_pre_prompt_hook(self):
- try:
- get_door().pre_prompt_hook(self)
- except:
- import traceback
- print "Exception in spock_pre_prompt_hook:"
- traceback.print_exc()
-
-#def spock_pre_runcode_hook(self):
-# print "spock_pre_runcode_hook"
-# return None
diff --git a/src/sardana/spock/parameter.py b/src/sardana/spock/parameter.py
deleted file mode 100644
index dd7ce826..00000000
--- a/src/sardana/spock/parameter.py
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Parameter parsing"""
-
-__all__ = ['AbstractParam', 'Param', 'ParamRepeat', 'ParamList']
-
-import sys
-
-class AbstractParam:
-
- def __init__(self, name=None, desc=None):
- self.name = name
- self.desc = desc
-
- def getParam(self,idx=0):
- return self
-
- def getParamStr(self):
- return "<"+self.name+">"
-
- def getParamDescr(self):
- str = self.name + " (" + self.type + ") - " + self.desc
- if self.defvalue != 'None':
- str = str + "\nDefault value: " + self.defvalue
- return str
-
- def getParamCount(self):
- return 1
-
- def formatParamValue(self,value):
- return value
-
- def __str__(self):
- return "%s(%s)" % (self.__class__.__name__, self.name)
-
-class Param(AbstractParam):
-
- def __init__(self, name=None, type_name=None, desc=None, defvalue=None,
- from_array=None):
- AbstractParam.__init__(self,name=name,desc=desc)
- self.type = type_name
- self.defvalue = defvalue
-
- if from_array is not None:
- for key in ['name', 'type', 'desc', 'defvalue']:
- setattr(self, key, from_array.read())
-
- def formatParamValue(self,value):
- ret = value
- if self.type == "File":
- f = open(ret,'r')
- ret = f.read()
- f.close()
- return ret
-
-
-class ParamRepeat(AbstractParam):
- def __init__(self, name=None, desc=None, opts=None, param_def=None,
- from_array=None):
- AbstractParam.__init__(self,name=name,desc=desc)
- self.opts = opts
- self.param_def = param_def
-
- if from_array is not None:
- self.name = from_array.read()
- type_name = from_array.read()
- if type_name != 'ParamRepeat':
- msg = 'Expecting "ParamRepeat" type, got ' + type_name
- raise ValueError, msg
- self.desc = from_array.read()
- opt_str = from_array.read()
- opt_list = opt_str.split(', ')
- opts = {}
- for opt_str in opt_list:
- name, val = opt_str.split('=')
- if val == repr(None):
- val = None
- else:
- try: val = int(val)
- except: pass
- opts[name] = val
- self.opts = opts
- self.param_def = ParamList(from_array=from_array)
-
- def getParam(self,idx=0):
- idx = idx % len(self.param_def.pars)
- return self.param_def.getParam(idx)
-
- def getParamStr(self):
- return "[" + self.param_def.getParamStr() + " ]"
-
- def getParamDescr(self):
- return self.param_def.getParamDescr()
-
- def getParamCount(self):
- return self.param_def.getParamCount()
-
- def formatParamValue(self,value):
- return self.param_def.formatParamValue(value)
-
-
-class ParamList(AbstractParam):
-
- def __init__(self, from_array):
- AbstractParam.__init__(self,name="ParamList",desc="List of parameters")
-
- self.pars = []
- self.has_param_repeat = False
-
- npars = int(from_array.read())
- for i in range(npars):
- if from_array[1] == 'ParamRepeat':
- par = ParamRepeat(from_array=from_array)
- self.has_param_repeat = True
- else:
- par = Param(from_array=from_array)
- self.pars.append(par)
-
- def getParam(self,idx=0):
- par_nb = len(self.pars)
- if idx < par_nb:
- par = idx
- return self.pars[idx].getParam(0)
- else:
- for i in range(par_nb):
- local_idx = idx - i
- local_nb = self.pars[i].getParamCount()
- if local_idx < local_nb:
- return self.pars[i].getParam(local_idx)
-
- def getParamStr(self):
- str = ""
- for par in self.pars:
- str = str + " " + par.getParamStr()
- return str
-
- def getParamDescr(self):
- str = ""
- for par in self.pars:
- str = str + "\n" + par.getParamDescr()
- return str
-
- def getParamCount(self):
- nb = 0
- for par in self.pars:
- local_nb = par.getParamCount()
- if local_nb == sys.maxint:
- return sys.maxint
- nb += local_nb
- return nb
-
- def formatParamValue(self,value):
-
- # for now we are not able to handle ParamRepeat with special value format
- if self.has_param_repeat:
- return value
-
- for i,v in enumerate(value):
- value[i] = self.pars[i].formatParamValue(v)
- return value \ No newline at end of file
diff --git a/src/sardana/spock/release.py b/src/sardana/spock/release.py
deleted file mode 100644
index c92bf882..00000000
--- a/src/sardana/spock/release.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Release data for the Spock project.
-"""
-
-# Name of the package for release purposes. This is the name which labels
-# the tarballs and RPMs made by distutils, so it's best to lowercase it.
-name = 'spock'
-
-# For versions with substrings (like 0.6.16.svn), use an extra . to separate
-# the new substring. We have to avoid using either dashes or underscores,
-# because bdist_rpm does not accept dashes (an RPM) convention, and
-# bdist_deb does not accept underscores (a Debian convention).
-
-revision = '1'
-
-#version = '0.8.1.svn.r' + revision.rstrip('M')
-version = '1.5.0'
-
-description = "An enhanced interactive Macro Server shell."
-
-long_description = \
-"""
-Spock provides an interactive environment for interacting with the Tango
-MacroServer Device. It is completely based on IPython which itself provides a
-replacement for the interactive Python interpreter with extra functionality.
- """
-
-license = 'GNU'
-
-authors = {'Tiago' : ('Tiago Coutinho','tiago.coutinho@esrf.fr'),
- 'Reszela' : ('Zbigniew Reszela','zreszela@cells.es') ,
- 'Pascual-Izarra' : ('Carlos Pascual-Izarra','cpascual@cells.es') }
-
-url = ''
-
-download_url = ''
-
-platforms = ['Linux','Windows XP/2000/NT','Windows 95/98/ME']
-
-keywords = ['Sardana', 'Interactive', 'MacroServer', 'Tango', 'Shell']
diff --git a/src/sardana/spock/spockms.py b/src/sardana/spock/spockms.py
deleted file mode 100755
index 3cd53f97..00000000
--- a/src/sardana/spock/spockms.py
+++ /dev/null
@@ -1,586 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package provides the spock macroserver connectivity"""
-
-__all__ = ['GUIViewer', 'SpockBaseDoor', 'QSpockDoor', 'SpockDoor',
- 'SpockMacroServer']
-
-import os
-import ctypes
-import PyTango
-
-from taurus.core import TaurusEventType, TaurusSWDevState
-
-from sardana.sardanautils import is_pure_str, is_non_str_seq
-from sardana.spock import genutils
-from sardana.spock.inputhandler import SpockInputHandler, InputHandler
-from sardana import sardanacustomsettings
-
-CHANGE_EVTS = TaurusEventType.Change, TaurusEventType.Periodic
-
-
-if genutils.get_gui_mode() == 'qt':
- from sardana.taurus.qt.qtcore.tango.sardana.macroserver import QDoor, QMacroServer
- BaseDoor = QDoor
- BaseMacroServer = QMacroServer
- BaseGUIViewer = object
-else:
- from sardana.taurus.core.tango.sardana.macroserver import BaseDoor, BaseMacroServer
- BaseGUIViewer = object
-
-
-class GUIViewer(BaseGUIViewer):
-
- def __init__(self, door=None):
- BaseGUIViewer.__init__(self)
- self._door = door
-
- def run(self):
- self.plot()
-
- def show_scan(self, scan_nb=None, scan_history_info=None, directory_map=None):
- if scan_nb is None and scan_history_info is None:
- #===================================================================
- ##Hack to avoid ipython-qt issues. See similar workaround in expconf magic command
- ## @todo: do this in a better way
- #import taurus.qt.qtgui.plot
- #w = taurus.qt.qtgui.plot.TaurusTrend()
- #w.model = "scan://" + self._door.getNormalName()
- #w.show()
- import subprocess
- args = ['taurustrend', 'scan://%s' % self._door.getNormalName()]
- subprocess.Popen(args)
- #===================================================================
- return
-
- scan_dir, scan_file = None, None
- if scan_nb is None:
- for scan in reversed(scan_history_info):
- scan_dir = scan.get('ScanDir')
- scan_file = scan.get('ScanFile')
- if scan_dir is None or scan_file is None:
- continue
- if not isinstance(scan_file, (str, unicode)):
- scan_file = scan_file[0]
- break
- else:
- print "Cannot plot scan:"
- print "No scan in scan history was saved into a file"
- return
- else:
- for scan in reversed(scan_history_info):
- if scan['serialno'] == scan_nb:
- scan_dir = scan.get('ScanDir')
- scan_file = scan.get('ScanFile')
- if scan_dir is None or scan_file is None:
- print "Cannot plot scan:"
- print "Scan %d was not saved into a file" % (scan_nb,)
- return
- if not isinstance(scan_file, (str, unicode)):
- scan_file = scan_file[0]
- break
- else:
- print "Cannot plot scan:"
- print "Scan %d not found in scan history" % (scan_nb,)
- return
-
- remote_file = os.path.join(scan_dir, scan_file)
-
- locations = [scan_dir]
- local_file = None
- if directory_map is None or not scan_dir in directory_map:
- if os.path.isdir(scan_dir):
- if scan_file in os.listdir(scan_dir):
- local_file = remote_file
- else:
- local_directories = directory_map[scan_dir]
- if isinstance(scan_file, (str, unicode)):
- local_directories = [local_directories]
- locations = local_directories
- if scan_dir not in locations: locations.append(scan_dir)
- for local_directory in local_directories:
- if os.path.isdir(local_directory):
- if scan_file in os.listdir(local_directory):
- local_file = os.path.join(local_directory, scan_file)
- break
- if local_file is None:
- print "Cannot plot scan:"
- print "Could not find %s in any of the following locations:" % (scan_file,)
- print "\n".join(locations)
- return
-
- import taurus.qt.qtgui.extra_nexus
- taurus_nexus_widget = taurus.qt.qtgui.extra_nexus.TaurusNeXusBrowser()
- taurus_nexus_widget.setMinimumSize(800, 600)
-
- print "Trying to open local scan file %s..." % (local_file,)
- taurus_nexus_widget.openFile(local_file)
- taurus_nexus_widget.show()
- nexus_widget = taurus_nexus_widget.neXusWidget()
- entry_name = "entry%d" % scan["serialno"]
- measurement_name = "%s/measurement" % entry_name
- title_name = "%s/title" % entry_name
- windowTitle = scan_file + "[" + entry_name + "]"
-
- try:
- #entry_index = taurus_nexus_widget.findNodeIndex(local_file, entry_name)
- measurement_index = taurus_nexus_widget.findNodeIndex(local_file, measurement_name)
- #nexus_widget.setRootIndex(entry_index)
- nexus_widget.setCurrentIndex(measurement_index)
- nexus_widget.expand(measurement_index)
- title_index = taurus_nexus_widget.findNodeIndex(local_file, title_name)
- file_model = nexus_widget.model()
- title = file_model.getNodeFromIndex(title_index)[0]
- windowTitle += " - " + title
- except Exception, e:
- print "Cannot plot scan:"
- print str(e)
-
- taurus_nexus_widget.setWindowTitle(windowTitle)
-
- def plot(self):
- try:
- import sps
- except:
- print 'sps module not available. No plotting'
- return
-
- try:
- import pylab
- except:
- print "pylab not available (try running 'spock -pylab'). No plotting"
- return
-
- door = genutils.get_door()
-
- try:
- env = dict(door.getEnvironmentObj().read().value)
- except Exception, e:
- print 'Unable to read environment. No plotting'
- print str(e)
- return
-
- program = door.getNormalName().replace('/', '').replace('_', '')
- try:
- array = env['ActiveMntGrp'].replace('/', '').replace('_', '').upper() + "0D"
- array_ENV = '%s_ENV' % array
- except:
- print 'ActiveMntGrp not defined. No plotting'
- return
-
- if not program in sps.getspeclist():
- print '%s not found. No plotting' % program
- return
-
- if not array in sps.getarraylist(program):
- print '%s not found in %s. No plotting' % (array, program)
- return
-
- if not array_ENV in sps.getarraylist(program):
- print '%s not found in %s. No plotting' % (array_ENV, program)
- return
-
- try:
- mem = sps.attach(program, array)
- mem_ENV = sps.attach(program, array_ENV)
- except Exception, e:
- print 'sps.attach error: %s. No plotting' % str(e)
- return
-
- # reconstruct the environment
- i, env = 0, {}
- while mem_ENV[i][0] != '':
- line = mem_ENV[i].tostring()
- eq, end = line.index('='), line.index('\x00')
- k, v = line[:eq], line[eq + 1:end]
- env[k] = v
- i += 1
-
-
- labels = env['axistitles'].split(' ')
-
- col_nb = len(labels)
-
- if col_nb < 4:
- print 'No data columns available in sps'
- return
-
- rows = int(env['nopts'])
-
- m = mem.transpose()
-
- x = m[1][:rows]
- colors = 'bgrcmyk'
- col_nb = min(col_nb, len(colors) + 3)
- # skip point_nb, motor and timer columns
- for i in xrange(3, col_nb):
- y = m[i][:rows]
- line, = pylab.plot(x, y, label=labels[i])
- line.linestyle = '-'
- line.linewidth = 1
- line.color = colors[i - 3]
- pylab.legend()
-
-
-class SpockBaseDoor(BaseDoor):
- """A CLI version of the Door device"""
-
- console_editors = 'vi', 'vim', 'nano', 'joe', 'pico', 'emacs'
-
- Critical = 'Critical'
- Error = 'Error'
- Info = 'Info'
- Warning = 'Warning'
- Output = 'Output'
- Debug = 'Debug'
- Result = 'Result'
- RecordData = 'RecordData'
-
- MathFrontend = "matplotlib"
-
- def __init__(self, name, **kw):
- self._consoleReady = kw.get("consoleReady", False)
- if not kw.has_key('silent'): kw['silent'] = False
- self._lines = []
- self._spock_state = None
- self._plotter = GUIViewer(self)
- self.call__init__(BaseDoor, name, **kw)
-
- def create_input_handler(self):
- return SpockInputHandler(self)
-
- def get_color_mode(self):
- return genutils.get_color_mode()
-
- def _get_macroserver_for_door(self):
- ret = genutils.get_macro_server()
- return ret
-
- def _preprocessParameters(self, parameters):
- if is_pure_str(parameters):
- inside_str = False
- pars = []
- par = ''
- for c in parameters:
- if c == '"':
- if inside_str:
- inside_str = False
- pars.append(par)
- par = ''
- else:
- inside_str = True
- elif c == ' ':
- if inside_str:
- par += c
- else:
- pars.append(par)
- par = ''
- else:
- par += c
- if par: pars.append(par)
- return pars
- elif is_non_str_seq(parameters):
- return parameters
-
- def preRunMacro(self, obj, parameters):
- return BaseDoor.preRunMacro(self, obj, self._preprocessParameters(parameters))
-
- def runMacro(self, obj, parameters=[], synch=False):
- return BaseDoor.runMacro(self, obj, parameters=parameters, synch=synch)
-
- def _runMacro(self, xml, **kwargs):
- #kwargs like 'synch' are ignored in this re-implementation
- if self._spock_state != TaurusSWDevState.Running:
- print "Unable to run macro: No connection to door '%s'" % self.getSimpleName()
- raise Exception("Unable to run macro: No connection")
- if xml is None:
- xml = self.getRunningXML()
- kwargs['synch'] = True
- try:
- return BaseDoor._runMacro(self, xml, **kwargs)
- except KeyboardInterrupt:
- self.write('\nCtrl-C received: Stopping... ')
- self.block_lines = 0
- self.command_inout("StopMacro")
- self.writeln("Done!")
- except PyTango.DevFailed, e:
- if is_non_str_seq(e.args) and \
- not isinstance(e.args, (str, unicode)):
- reason, desc = e.args[0].reason, e.args[0].desc
- macro_obj = self.getRunningMacro()
- if reason == 'MissingParam':
- print "Missing parameter:", desc
- print macro_obj.getInfo().doc
- elif reason == 'WrongParam':
- print "Wrong parameter:", desc
- print macro_obj.getInfo().doc
- elif reason == 'UnkownParamObj':
- print "Unknown parameter:", desc
- elif reason == 'MissingEnv':
- print "Missing environment:", desc
- elif reason in ('API_CantConnectToDevice', 'API_DeviceNotExported'):
- self._updateState(self._old_sw_door_state, TaurusSWDevState.Shutdown, silent=True)
- print "Unable to run macro: No connection to door '%s'" % self.getSimpleName()
- else:
- print "Unable to run macro:", reason, desc
-
- def _getMacroResult(self, macro):
- ret = None
- if macro.info.hasResult():
- ret = macro.getResult()
-
- if ret is None:
- return None
-
- if macro.info.getResult().type == 'File':
-
- commit_cmd = macro.info.hints['commit_cmd']
-
- if commit_cmd == None:
- return ret
-
- local_f_name = ret[0]
- remote_f_name = ret[1]
- line_nb = ret[3]
- commit = CommitFile(commit_cmd, local_f_name, remote_f_name)
- self.pending_commits.update({ remote_f_name : commit })
- ip = genutils.get_ipapi()
- editor = genutils.get_editor()
-
- cmd = 'edit -x -n %s %s' % (line_nb, local_f_name)
- if not editor in self.console_editors:
- cmd = 'bg _ip.magic("' + cmd + '")'
- ip.magic(cmd)
- # The return value of the macro was saved in a file and opened
- # with edit so we don't return anything to avoid big outputs
- # to the console
- ret = None
- return ret
-
- def plot(self):
- self._plotter.run()
-
- def show_scan(self, scan_nb=None, online=False):
- if online:
- self._plotter.show_scan()
- return
- env = self.getEnvironment()
- scan_history_info = env.get("ScanHistory")
- directory_map = env.get("DirectoryMap")
- self._plotter.show_scan(scan_nb=scan_nb,
- scan_history_info=scan_history_info,
- directory_map=directory_map)
-
- def stateChanged(self, s, t, v):
- old_sw_state = self._old_sw_door_state
- BaseDoor.stateChanged(self, s, t, v)
- new_sw_state = self._old_sw_door_state
- self._updateState(old_sw_state, new_sw_state)
-
- def _updateState(self, old_sw_state, new_sw_state, silent=False):
- user_ns = genutils.get_ipapi().user_ns
- if new_sw_state == TaurusSWDevState.Running:
- user_ns['DOOR_STATE'] = ""
- else:
- user_ns['DOOR_STATE'] = " (OFFLINE)"
-
- if not self.isConsoleReady():
- self._spock_state = new_sw_state
- return
-
- ss = self._spock_state
- if ss is not None and ss != new_sw_state and not silent:
- if ss == TaurusSWDevState.Running:
- self.write_asynch("\nConnection to door '%s' was lost.\n" % self.getSimpleName())
- elif new_sw_state == TaurusSWDevState.Running:
- self.write_asynch("\nConnection to the door (%s) has " \
- "been restablished\n" % self.getSimpleName())
- self._spock_state = new_sw_state
-
- def write_asynch(self, msg):
- self._lines.append(msg)
-
- def pre_prompt_hook(self, ip):
- self._flush_lines()
-
- def _flush_lines(self):
- for l in self._lines:
- self.write(l)
- self._lines = []
-
- def setConsoleReady(self, state):
- self._consoleReady = state
-
- def isConsoleReady(self):
- return self._consoleReady
-
- def write(self, msg, stream=None):
- if not self.isConsoleReady():
- return
- return BaseDoor.write(self, msg, stream=stream)
-
- def processRecordData(self, data):
- if data is None: return
- data = data[1]
- if data['type'] == 'function':
- func_name = data['func_name']
- if func_name.startswith("pyplot."):
- func_name = self.MathFrontend + "." + func_name
- args = data['args']
- kwargs = data['kwargs']
-
- members = func_name.split(".")
- mod_list, fname = members[:-1], members[-1]
- mod_name = ".".join(mod_list)
- if mod_name:
- mod = __import__(mod_name, fromlist=mod_list)
- func = getattr(mod, fname)
- else:
- func = __builtins__[fname]
- try:
- func(*args, **kwargs)
- except Exception as e:
- self.logReceived(self.Warning, ['Unable to execute %s: ' % func_name, str(e)])
-
- _RECORD_DATA_THRESOLD = 4 * 1024 * 1024 # 4Mb
-
- def _processInput(self, input_data):
- pyos_inputhook_ptr = ctypes.c_void_p.in_dll(ctypes.pythonapi, "PyOS_InputHook")
- old_pyos_inputhook_ptr = pyos_inputhook_ptr.value
- pyos_inputhook_ptr.value = ctypes.c_void_p(None).value
- ret = BaseDoor._processInput(self, input_data)
- pyos_inputhook_ptr.value = old_pyos_inputhook_ptr
- return ret
-
- def _processRecordData(self, data):
- if data is None: return
- value = data.value
- size = len(value[1])
- if size > self._RECORD_DATA_THRESOLD:
- sizekb = size / 1024
- self.logReceived(self.Info, ['Received long data record (%d Kb)' % sizekb,
- 'It may take some time to process. Please wait...'])
- return BaseDoor._processRecordData(self, data)
-
-
-from taurus.external.qt import Qt
-
-class QSpockDoor(SpockBaseDoor):
-
- def __init__(self, name, **kw):
- self.call__init__(SpockBaseDoor, name, **kw)
-
- Qt.QObject.connect(self, Qt.SIGNAL('recordDataUpdated'),
- self.processRecordData)
-
- def recordDataReceived(self, s, t, v):
- if genutils.get_pylab_mode() == "inline":
- if t not in CHANGE_EVTS: return
- res = BaseDoor.recordDataReceived(self, s, t, v)
- self.processRecordData(res)
- else:
- res = SpockBaseDoor.recordDataReceived(self, s, t, v)
- return res
-
- def create_input_handler(self):
- inputhandler = getattr(sardanacustomsettings, 'SPOCK_INPUT_HANDLER',
- "CLI")
-
- if inputhandler == "Qt":
- return InputHandler()
- else:
- return SpockInputHandler()
-
-
-class SpockDoor(SpockBaseDoor):
-
- def _processRecordData(self, data):
- data = SpockBaseDoor._processRecordData(self, data)
- return self.processRecordData(data)
-
-
-class SpockMacroServer(BaseMacroServer):
- """A CLI version of the MacroServer device"""
-
- def __init__(self, name, **kw):
- self._local_magic = {}
- self._local_var = set()
- self.call__init__(BaseMacroServer, name, **kw)
-
- def on_elements_changed(self, evt_src, evt_type, evt_value):
- return BaseMacroServer.on_elements_changed(self, evt_src, evt_type,
- evt_value)
-
- _SKIP_ELEMENTS = 'controller', 'motorgroup', 'instrument', \
- 'controllerclass', 'controllerlib', 'macrolib'
-
- def _addElement(self, element_data):
- element = BaseMacroServer._addElement(self, element_data)
- elem_type = element.type
- if "MacroCode" in element.interfaces:
- self._addMacro(element)
- elif elem_type not in self.NO_CLASS_TYPES:
- # TODO: when it becomes possible to do:
- # some taurus.Device.<attr name> = <value>
- # replace device_proxy with element
- device_proxy = element.getObj().getHWObj()
- genutils.expose_variable(element.name, device_proxy)
- return element
-
- def _removeElement(self, element_data):
- element = BaseMacroServer._removeElement(self, element_data)
- elem_type = element.type
- if "MacroCode" in element.interfaces:
- self._removeMacro(element)
- elif elem_type not in self.NO_CLASS_TYPES:
- genutils.unexpose_variable(element.name)
- return element
-
- def _addMacro(self, macro_info):
- macro_name = str(macro_info.name)
-
- def macro_fn(shell, parameter_s='', name=macro_name):
- parameters = genutils.arg_split(parameter_s, posix=True)
- door = genutils.get_door()
- door.runMacro(macro_name, parameters, synch=True)
- macro = door.getLastRunningMacro()
- if macro is not None: # maybe none if macro was aborted
- return macro.getResult()
-
- macro_fn.func_name = macro_name
- macro_fn.__doc__ = macro_info.doc
-
- # register magic command
- genutils.expose_magic(macro_name, macro_fn)
- self._local_magic[macro_name] = macro_fn
-
- return macro_info
-
- def _removeMacro(self, macro_info):
- macro_name = macro_info.name
- genutils.unexpose_magic(macro_name)
- del self._local_magic[macro_name]
diff --git a/src/sardana/spock/test/__init__.py b/src/sardana/spock/test/__init__.py
deleted file mode 100644
index c058d0cb..00000000
--- a/src/sardana/spock/test/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
diff --git a/src/sardana/spock/test/test_parameter.py b/src/sardana/spock/test/test_parameter.py
deleted file mode 100644
index 1f1d5059..00000000
--- a/src/sardana/spock/test/test_parameter.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""test_parameter module documentation"""
-
-from taurus.external import unittest
-from sardana.spock import parameter
-
-
-class ParamTestCase(unittest.TestCase):
-
- """
- Instantiate in different ways a Param object and verify that
- they are correct instances from the class Param.
- """
-
- def testInstanceCreation(self):
- """
- Instantiate in different ways a Param object.
- """
- spock_param = parameter.Param()
- self.assertIsInstance(spock_param, parameter.Param,
- 'Instantiation of an object Param without arguments ' +
- 'does not work \n')
-
- spock_param = parameter.Param(name='sardanaName')
- self.assertIsInstance(spock_param, parameter.Param,
- 'Instantiation of an object Param with argument name ' +
- 'does not work')
-
- spock_param = parameter.Param(name='sardanaName',
- desc='description_is_present')
- self.assertIsInstance(spock_param, parameter.Param,
- 'Instantiation of an object Param with arguments name ' +
- 'and description does not work')
-
- spock_param = parameter.Param(name='sardanaName',
- desc='description_is_present', type_name='integer')
- self.assertIsInstance(spock_param, parameter.Param,
- 'Instantiation of an object Param with arguments name, ' +
- 'description and type_name does not work')
-
- spock_param = parameter.Param(name='sardanaName',
- desc='description_is_present', type_name='integer', defvalue=7)
- self.assertIsInstance(spock_param, parameter.Param,
- 'Instantiation of an object Param with arguments name, ' +
- 'description, type_name and defvalue does not work')
diff --git a/src/sardana/tango/__init__.py b/src/sardana/tango/__init__.py
deleted file mode 100644
index 2c4027d7..00000000
--- a/src/sardana/tango/__init__.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__docformat__ = 'restructuredtext'
-
-def prepare_sardana(util):
- import pool
- import macroserver
- pool.prepare_pool(util)
- macroserver.prepare_macroserver(util)
-
-def main_sardana(args=None, start_time=None, mode=None):
- import core.util
- return core.util.run(prepare_sardana, args=args, start_time=start_time,
- mode=mode)
-
-run = main_sardana \ No newline at end of file
diff --git a/src/sardana/tango/core/SardanaDevice.py b/src/sardana/tango/core/SardanaDevice.py
deleted file mode 100644
index c9b14710..00000000
--- a/src/sardana/tango/core/SardanaDevice.py
+++ /dev/null
@@ -1,484 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Generic Sardana Tango device module"""
-
-from __future__ import with_statement
-
-__all__ = ["SardanaDevice", "SardanaDeviceClass"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-import threading
-
-import PyTango.constants
-from PyTango import Device_4Impl, DeviceClass, Util, DevState, \
- AttrQuality, TimeVal, ArgType, ApiUtil, DevFailed, WAttribute
-
-from taurus.core.util.threadpool import ThreadPool
-from taurus.core.util.log import Logger
-
-from sardana.tango.core.util import to_tango_state, NO_DB_MAP
-
-
-__thread_pool_lock = threading.Lock()
-__thread_pool = None
-
-
-def get_thread_pool():
- """Returns the global pool of threads for Sardana
-
- :return: the global pool of threads object
- :rtype: taurus.core.util.ThreadPool"""
-
- global __thread_pool
-
- if __thread_pool:
- return __thread_pool
-
- global __thread_pool_lock
- with __thread_pool_lock:
- if __thread_pool is None:
- __thread_pool = ThreadPool(name="EventTH", Psize=1, Qsize=1000)
- return __thread_pool
-
-
-class SardanaDevice(Device_4Impl, Logger):
- """SardanaDevice represents the base class for all Sardana
- :class:`PyTango.DeviceImpl` classes"""
-
- def __init__(self, dclass, name):
- """Constructor"""
- self.in_constructor = True
- try:
- Device_4Impl.__init__(self, dclass, name)
- self.init(name)
- Logger.__init__(self, name)
-
- self._state = DevState.INIT
- self._status = 'Waiting to be initialized...'
-
- # access to some tango API (like MultiAttribute and Attribute) is
- # still not thread safe so we have this lock to protect
- # Wa can't always use methods which use internally the
- # C++ AutoTangoMonitor because it blocks the entire tango device.
- self.tango_lock = threading.RLock()
-
- self._event_thread_pool = get_thread_pool()
- self.init_device()
- finally:
- self.in_constructor = False
-
- def init(self, name):
- """initialize the device once in the object lifetime. Override when
- necessary but **always** call the method from your super class
-
- :param str name: device name"""
-
- db = self.get_database()
- if db is None:
- self._alias = self._get_nodb_device_info()[0]
- else:
- try:
- self._alias = db.get_alias(name)
- if self._alias.lower() == 'nada':
- self._alias = None
- except:
- self._alias = None
-
- def get_alias(self):
- """Returns this device alias name
-
- :return: this device alias
- :rtype: str"""
- return self._alias
-
- alias = property(get_alias, doc="the device alias name")
-
- def get_full_name(self):
- """Returns the device full name in format
- dbname:dbport/<domain>/<family>/<member>
-
- :return: this device full name
- :rtype: str"""
- db = self.get_database()
- if db.get_from_env_var():
- db_name = ApiUtil.get_env_var("TANGO_HOST")
- else:
- if db.is_dbase_used():
- db_name = db.get_db_host() + ":" + db.get_db_port()
- else:
- db_name = db.get_file_name()
- return db_name + "/" + self.get_name()
-
- def init_device(self):
- """Initialize the device. Called during startup after :meth:`init` and
- every time the tango ``Init`` command is executed.
- Override when necessary but **always** call the method from your super
- class"""
- self.set_state(self._state)
- db = self.get_database()
- if db is None:
- self.init_device_nodb()
- else:
- self.get_device_properties(self.get_device_class())
-
- detect_evts = "state", "status"
- non_detect_evts = ()
- self.set_change_events(detect_evts, non_detect_evts)
-
- def _get_nodb_device_info(self):
- """Internal method. Returns the device info when tango database is not
- being used (example: in demos)"""
- name = self.get_name()
- tango_class = self.get_device_class().get_name()
- devices = NO_DB_MAP.get(tango_class, ())
- for dev_info in devices:
- if dev_info[1] == name:
- return dev_info
-
- def init_device_nodb(self):
- """Internal method. Initialize the device when tango database is not
- being used (example: in demos)"""
- _, _, props = self._get_nodb_device_info()
- for prop_name, prop_value in props.items():
- setattr(self, prop_name, prop_value)
-
- def delete_device(self):
- """Clean the device. Called during shutdown and every time the tango
- ``Init`` command is executed.
- Override when necessary but **always** call the method from your super
- class"""
- pass
-
- def set_change_events(self, evts_checked, evts_not_checked):
- """Helper method to set change events on attributes
-
- :param evts_checked:
- list of attribute names to activate change events programatically
- with tango filter active
- :type evts_checked: seq<:obj:`str`\>
- :param evts_not_checked:
- list of attribute names to activate change events programatically
- with tango filter inactive. Use this with care! Attributes
- configured with no change event filter may potentially generated a
- lot of events!
- :type evts_not_checked: seq<:obj:`str`\>"""
- for evt in evts_checked:
- self.set_change_event(evt, True, True)
- for evt in evts_not_checked:
- self.set_change_event(evt, True, False)
-
- def initialize_dynamic_attributes(self):
- """Initialize dynamic attributes. Default implementation does nothing.
- Override when necessary."""
- pass
-
- def get_event_thread_pool(self):
- """Return the :class:`~taurus.core.util.ThreadPool` used by sardana to
- send tango events.
-
- :return: the sardana :class:`~taurus.core.util.ThreadPool`
- :rtype: :class:`~taurus.core.util.ThreadPool`"""
- return self._event_thread_pool
-
- def get_attribute_by_name(self, attr_name):
- """Gets the attribute for the given name.
-
- :param attr_name: attribute name
- :type attr_name: str
- :return: the attribute object
- :rtype: :class:`~PyTango.Attribute`"""
- return self.get_device_attr().get_attr_by_name(attr_name)
-
- def get_wattribute_by_name(self, attr_name):
- """Gets the writable attribute for the given name.
-
- :param attr_name: attribute name
- :type attr_name: str
- :return: the attribute object
- :rtype: :class:`~PyTango.WAttribute`"""
- return self.get_device_attr().get_w_attr_by_name(attr_name)
-
- def get_database(self):
- """Helper method to return a reference to the current tango database
-
- :return: the Tango database
- :rtype: :class:`~PyTango.Database`"""
- return Util.instance().get_database()
-
- def set_write_attribute(self, attr, w_value):
- try:
- attr.set_write_value(w_value)
- except DevFailed as df:
- df0 = df[0]
- reason = df0.reason
- # if outside limit prefix the description with the device name
- if reason == PyTango.constants.API_WAttrOutsideLimit:
- desc = self.alias + ": " + df0.desc
- _df = DevFailed(*df[1:])
- PyTango.Except.re_throw_exception(_df, df0.reason, desc, df0.origin)
- raise df
-
- def set_attribute(self, attr, value=None, w_value=None, timestamp=None,
- quality=None, error=None, priority=1, synch=True):
- """Sets the given attribute value. If timestamp is not given, *now* is
- used as timestamp. If quality is not given VALID is assigned. If error
- is given an error event is sent (with no value and quality INVALID).
- If priority is > 1, the event filter is temporarily disabled so the event
- is sent for sure. If synch is set to True, wait for fire event to finish
-
- :param attr:
- the tango attribute
- :type attr: :class:`PyTango.Attribute`
- :param value:
- the value to be set (not mandatory if setting an error)
- [default: None]
- :type value: object
- :param w_value:
- the write value to be set (not mandatory)
- [default: None, meaning maintain current write value]
- :type value: object
- :param timestamp:
- the timestamp associated with the operation [default: None, meaning
- use *now* as timestamp]
- :type timestamp: float or :class:`PyTango.TimeVal`
- :param quality:
- attribute quality [default: None, meaning VALID]
- :type quality: :class:`PyTango.AttrQuality`
- :param error:
- a tango DevFailed error or None if not an error [default: None]
- :type error:
- :exc:`PyTango.DevFailed`
- :param priority:
- event priority [default: 1, meaning *normal* priority]. If
- priority is > 1, the event filter is temporarily disabled so the
- event is sent for sure. The event filter is restored to the
- previous value
- :type priority: int
- :param synch:
- If synch is set to True, wait for fire event to finish.
- If False, a job is sent to the sardana thread pool and the method
- returns immediately [default: True]
- """
- set_attr = self.set_attribute_push
- if synch:
- set_attr(attr, value=value, w_value=w_value, timestamp=timestamp,
- quality=quality, error=error, priority=priority,
- synch=synch)
- else:
- th_pool = self.get_event_thread_pool()
- th_pool.add(set_attr, None, attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality, error=error,
- priority=priority, synch=synch)
-
- def set_attribute_push(self, attr, value=None, w_value=None, timestamp=None,
- quality=None, error=None, priority=1, synch=True):
- """Synchronous internal implementation of :meth:`set_attribute` (synch
- is passed to this method because it might need to know if it is being
- executed in a synchronous or asynchronous context)."""
-
- if priority > 0 and not synch:
- with self.tango_lock:
- return self._set_attribute_push(attr, value=value,
- w_value=w_value, timestamp=timestamp, quality=quality,
- error=error, priority=priority)
- else:
- return self._set_attribute_push(attr, value=value,
- w_value=w_value, timestamp=timestamp, quality=quality,
- error=error, priority=priority)
-
- def _set_attribute_push(self, attr, value=None, w_value=None, timestamp=None,
- quality=None, error=None, priority=1):
- """Internal method."""
- fire_event = priority > 0
-
- recover = False
- if priority > 1 and attr.is_check_change_criteria():
- attr.set_change_event(True, False)
- recover = True
-
- attr_name = attr.get_name().lower()
-
- if value is None and error is None:
- raise Exception("Cannot set value of attribute '%s' with None" % (attr_name,))
-
- try:
- if error is not None and fire_event:
- self.push_change_event(attr_name, error)
- return
-
- # some versions of Tango have a memory leak if you do
- # push_change_event(attr_name, value [, ...]) on state or status.
- # This solves the problem.
- if attr_name == "state":
- self.set_state(value)
- if fire_event:
- self.push_change_event(attr_name)
- return
- elif attr_name == "status":
- self.set_status(value)
- if fire_event:
- self.push_change_event(attr_name)
- return
-
- if timestamp is None:
- timestamp = time.time()
- elif isinstance(timestamp, TimeVal):
- timestamp = TimeVal.totime(timestamp)
-
- if quality is None:
- quality = AttrQuality.ATTR_VALID
-
- data_type = attr.get_data_type()
- if w_value is not None and isinstance(attr, WAttribute):
- attr.set_write_value(w_value)
- if fire_event:
- if data_type == ArgType.DevEncoded:
- fmt, data = value
- args = attr_name, fmt, data, timestamp, quality
-
- else:
- args = attr_name, value, timestamp, quality
- self.push_change_event(*args)
- else:
- if data_type == ArgType.DevEncoded:
- fmt, data = value
- attr.set_value_date_quality(fmt, data, timestamp, quality)
- else:
- attr.set_value_date_quality(value, timestamp, quality)
- finally:
- if recover:
- attr.set_change_event(True, True)
-
- def calculate_tango_state(self, ctrl_state, update=False):
- """Calculate tango state based on the controller state.
-
- :param ctrl_state: the state returned by the controller
- :type ctrl_state: :obj:`~sardana.sardanadefs.State`
- :param bool update:
- if True, set the state of this device with the calculated tango
- state [default: False:
- :return: the corresponding tango state
- :rtype: :class:`PyTango.DevState`"""
- self._state = state = to_tango_state(ctrl_state)
- if update:
- self.set_state(state)
- return state
-
- def calculate_tango_status(self, ctrl_status, update=False):
- """Calculate tango status based on the controller status.
-
- :param str ctrl_status: the status returned by the controller
- :param bool update:
- if True, set the state of this device with the calculated tango
- state [default: False:
- :return: the corresponding tango state
- :rtype: str"""
- self._status = status = ctrl_status
- if update:
- self.set_status(status)
- return status
-
-
-class SardanaDeviceClass(DeviceClass):
- """SardanaDeviceClass represents the base class for all Sardana
- :class:`PyTango.DeviceClass` classes"""
-
- #:
- #: Sardana device class properties definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- class_property_list = {
- }
-
- #:
- #: Sardana device properties definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- device_property_list = {
- }
-
- #:
- #: Sardana device command definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- cmd_list = {
- }
-
- #:
- #: Sardana device attribute definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- attr_list = {
- }
-
- def __init__(self, name):
- DeviceClass.__init__(self, name)
- self.set_type(name)
-
- def _get_class_properties(self):
- """Internal method"""
- return dict(ProjectTitle="Sardana", Description="Generic description",
- doc_url="http://sardana-controls.org/",
- __icon=self.get_name().lower() + ".png",
- InheritedFrom=["Device_4Impl"])
-
- def write_class_property(self):
- """Write class properties ``ProjectTitle``, ``Description``,
- ``doc_url``, ``InheritedFrom`` and ``__icon``"""
- db = self.get_database()
- if db is None:
- return
- db.put_class_property(self.get_name(), self._get_class_properties())
-
- def dyn_attr(self, dev_list):
- """Invoked to create dynamic attributes for the given devices.
- Default implementation calls
- :meth:`SardanaDevice.initialize_dynamic_attributes` for each device
-
- :param dev_list: list of devices
- :type dev_list: :class:`PyTango.DeviceImpl`"""
- for dev in dev_list:
- try:
- dev.initialize_dynamic_attributes()
- except:
- dev.warning("Failed to initialize dynamic attributes")
- dev.debug("Details:", exc_info=1)
-
- def device_name_factory(self, dev_name_list):
- """Builds list of device names to use when no Database is being used
-
- :param dev_name_list: list to be filled with device names
- :type dev_name_list: seq<obj:`list`\>"""
- tango_class = self.get_name()
- devices = NO_DB_MAP.get(tango_class, ())
- for dev_info in devices:
- dev_name_list.append(dev_info[1])
diff --git a/src/sardana/tango/core/__init__.py b/src/sardana/tango/core/__init__.py
deleted file mode 100644
index 4401cf50..00000000
--- a/src/sardana/tango/core/__init__.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__docformat__ = 'restructuredtext'
-
-import PyTango.constants
-
-
-def __init_pytango_devfailed(mod):
- consts = (
-"API_AttrConfig", "API_AttrEventProp", "API_AttrIncorrectDataNumber",
-"API_AttrNoAlarm", "API_AttrNotAllowed", "API_AttrNotFound",
-"API_AttrNotWritable", "API_AttrOptProp", "API_AttrPropValueNotSet",
-"API_AttrValueNotSet", "API_AttrWrongDefined", "API_AttrWrongMemValue",
-"API_BadConfigurationProperty", "API_BlackBoxArgument", "API_BlackBoxEmpty",
-"API_CannotCheckAccessControl", "API_CannotOpenFile",
-"API_CantActivatePOAManager", "API_CantCreateClassPoa",
-"API_CantCreateLockingThread", "API_CantFindLockingThread",
-"API_CantGetClientIdent", "API_CantGetDevObjectId",
-"API_CantInstallSignal", "API_CantRetrieveClass", "API_CantRetrieveClassList",
-"API_CantStoreDeviceClass", "API_ClassNotFound",
-"API_CmdArgumentTypeNotSupported", "API_CommandNotAllowed",
-"API_CommandNotFound", "API_CorbaSysException", "API_CorruptedDatabase",
-"API_DatabaseAccess", "API_DeviceLocked", "API_DeviceNotFound",
-"API_DeviceNotLocked", "API_DeviceUnlockable", "API_DeviceUnlocked",
-"API_EventSupplierNotConstructed", "API_IncoherentDbData",
-"API_IncoherentDevData", "API_IncoherentValues", "API_IncompatibleAttrDataType",
-"API_IncompatibleCmdArgumentType", "API_InitMethodNotFound",
-"API_InitNotPublic", "API_InitThrowsException",
-"API_JavaRuntimeSecurityException", "API_MemoryAllocation",
-"API_MethodArgument", "API_MethodNotFound", "API_MissedEvents",
-"API_NotSupportedFeature", "API_NtDebugWindowError",
-"API_OverloadingNotSupported", "API_PolledDeviceNotInPoolConf",
-"API_PolledDeviceNotInPoolMap", "API_PollingThreadNotFound",
-"API_ReadOnlyMode", "API_SignalOutOfRange", "API_SystemCallFailed",
-"API_WAttrOutsideLimit", "API_WizardConfError", "API_WrongEventData",
-"API_WrongHistoryDataBuffer", "API_WrongLockingStatus", "API_ZmqInitFailed")
-
- for const in consts:
- setattr(mod, const, const)
-
-
-def __prepare_pytango():
-
- if not hasattr(PyTango.constants, "API_DeviceNotFound"):
- __init_pytango_devfailed(PyTango.constants)
-
-__prepare_pytango()
diff --git a/src/sardana/tango/core/attributehandler.py b/src/sardana/tango/core/attributehandler.py
deleted file mode 100644
index 0b81befd..00000000
--- a/src/sardana/tango/core/attributehandler.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the main macro server module"""
-
-__all__ = ["AttributeLogHandler", "AttributeBufferedLogHandler"]
-
-__docformat__ = 'restructuredtext'
-
-import logging
-import weakref
-import operator
-
-from taurus.core.util.containers import LIFO
-
-
-class AttributeLogHandler(logging.Handler):
-
- def __init__(self, dev, attr_name, level=logging.NOTSET, max_buff_size=0):
- logging.Handler.__init__(self, level)
- self._attr_name = attr_name
- self._level = level
- self._max_buff_size = max_buff_size
- self._dev = weakref.ref(dev)
- self._attr = dev.get_device_attr().get_attr_by_name(attr_name)
- self._buff = LIFO(max_buff_size)
-
- def emit(self, record):
- output = self.getRecordMessage(record)
- self.appendBuffer(output)
- self.sendText(output)
-
- def getRecordMessage(self, record):
- return self.format(record).split('\n')
-
- def sendText(self, output):
- dev = self._dev()
- attr = self._attr
- if attr is None or dev is None:
- return
- dev.set_attribute(attr, output)
-
- def read(self, attr):
- """Read from the buffer and assign to the attribute value"""
- attr.set_value(self._buff.getCopy())
-
- def clearBuffer(self):
- self._buff.clear()
-
- def appendBuffer(self, d):
- if operator.isSequenceType(d):
- if isinstance(d, (str, unicode)):
- self._buff.append(d)
- else:
- self._buff.extend(d)
- else:
- self._buff.append(str(d))
-
- def sync(self):
- pass
-
- def finish(self):
- pass
-
-AttributeBufferedLogHandler = AttributeLogHandler
diff --git a/src/sardana/tango/core/util.py b/src/sardana/tango/core/util.py
deleted file mode 100644
index a4a78111..00000000
--- a/src/sardana/tango/core/util.py
+++ /dev/null
@@ -1,967 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__docformat__ = 'restructuredtext'
-
-__all__ = ["get_tango_version_str", "get_tango_version_number",
- "get_pytango_version_str", "get_pytango_version_number",
- "exception_str",
- "GenericScalarAttr", "GenericSpectrumAttr", "GenericImageAttr",
- "memorize_write_attribute",
- "tango_protect", "to_tango_state", "to_tango_type_format",
- "to_tango_type", "to_tango_access", "to_tango_attr_info",
- "from_tango_access", "from_tango_type_format",
- "from_tango_state_to_state",
- "from_deviceattribute_value", "from_deviceattribute",
- "throw_sardana_exception",
- "prepare_tango_logging", "prepare_rconsole", "run_tango_server",
- "run"]
-
-import sys
-import time
-import string
-import logging
-import os.path
-import traceback
-
-import PyTango
-from PyTango import Util, Database, WAttribute, DbDevInfo, DevFailed, \
- DevVoid, DevLong, DevBoolean, DevString, DevDouble, \
- DevState, SCALAR, SPECTRUM, IMAGE, FMT_UNKNOWN, \
- READ_WRITE, READ, Attr, SpectrumAttr, ImageAttr, \
- DeviceClass, Except
-
-import taurus
-from taurus.core.util.log import Logger
-
-import sardana
-from sardana import State, SardanaServer, DataType, DataFormat, InvalidId, \
- DataAccess, to_dtype_dformat, to_daccess, Release, ServerRunMode
-from sardana.sardanaexception import SardanaException
-from sardana.sardanavalue import SardanaValue
-from sardana.util.wrap import wraps
-from sardana.pool.poolmetacontroller import DataInfo
-
-
-NO_DB_MAP = {
- "Pool" : (
- ("pool_demo", "sardana/pool/demo", dict(Version="1.0.0"),),
- ),
- "Controller" : (
- ("motctrl", "controller/dummymotorcontroller/motctrl",
- dict(Id=1, Type="Motor", Klass="DummyMotorController",
- Library="DummyMotorController.py", Role_ids=(),),),
- ("iorctrl", "controller/dummyiorcontroller/iorctrl",
- dict(Id=2, Type="IORegister", Klass="DummyIORController",
- Library="DummyIORController.py", Role_ids=(),),),
- ("ctctrl", "controller/dummycountertimercontroller/ctctrl",
- dict(Id=3, Type="CTExpChannel", Klass="DummyCounterTimerController",
- Library="DummyCounterTimerController.py", Role_ids=(),),),
- ("zerodctrl", "controller/dummyzerodcontroller/zerodctrl",
- dict(Id=4, Type="ZeroDExpChannel", Klass="DummyZeroDController",
- Library="DummyZeroDController.py", Role_ids=(),),),
- ("slitctrl", "controller/slit/slitctrl",
- dict(Id=5, Type="PseudoMotor", Klass="Slit",
- Library="Slit.py", Role_ids=(),),),
- ("ioi0ctrl", "controller/ioveri0/ioi0ctrl",
- dict(Id=6, Type="PseudoCounter", Klass="IoverI0",
- Library="IoverI0.py", Role_ids=(),),),
- ),
- "Motor" : (
- ("slt", "motor/motctrl/1", dict(Id=101, Axis=1, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("slb", "motor/motctrl/2", dict(Id=102, Axis=2, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("mot1", "motor/motctrl/3", dict(Id=103, Axis=3, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("mot2", "motor/motctrl/4", dict(Id=104, Axis=4, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("mot3", "motor/motctrl/5", dict(Id=105, Axis=5, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("mot4", "motor/motctrl/6", dict(Id=106, Axis=6, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("th", "motor/motctrl/7", dict(Id=107, Axis=7, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("tth", "motor/motctrl/8", dict(Id=108, Axis=8, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("chi", "motor/motctrl/9", dict(Id=109, Axis=9, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ("phi", "motor/motctrl/10", dict(Id=110, Axis=10, Ctrl_id=1, Instrument_id=InvalidId, Sleep_bef_last_read=0),),
- ),
- "IORegister" : (
- ("ior1", "ioregister/iorctrl/1", dict(Id=201, Axis=1, Ctrl_id=2, Instrument_id=InvalidId),),
- ("ior2", "ioregister/iorctrl/2", dict(Id=202, Axis=2, Ctrl_id=2, Instrument_id=InvalidId),),
- ("ior3", "ioregister/iorctrl/3", dict(Id=203, Axis=3, Ctrl_id=2, Instrument_id=InvalidId),),
- ("ior4", "ioregister/iorctrl/4", dict(Id=204, Axis=4, Ctrl_id=2, Instrument_id=InvalidId),),
- ),
- "CTExpChannel" : (
- ("ct1", "expchan/ctctrl/1", dict(Id=301, Axis=1, Ctrl_id=3, Instrument_id=InvalidId),),
- ("ct2", "expchan/ctctrl/2", dict(Id=302, Axis=2, Ctrl_id=3, Instrument_id=InvalidId),),
- ("ct3", "expchan/ctctrl/3", dict(Id=303, Axis=3, Ctrl_id=3, Instrument_id=InvalidId),),
- ("ct4", "expchan/ctctrl/4", dict(Id=304, Axis=4, Ctrl_id=3, Instrument_id=InvalidId),),
- ),
- "ZeroDExpChannel" : (
- ("zerod1", "expchan/zerodctrl/1", dict(Id=401, Axis=1, Ctrl_id=4, Instrument_id=InvalidId),),
- ("zerod2", "expchan/zerodctrl/2", dict(Id=402, Axis=2, Ctrl_id=4, Instrument_id=InvalidId),),
- ("zerod3", "expchan/zerodctrl/3", dict(Id=403, Axis=3, Ctrl_id=4, Instrument_id=InvalidId),),
- ("zerod4", "expchan/zerodctrl/4", dict(Id=404, Axis=4, Ctrl_id=4, Instrument_id=InvalidId),),
- ),
- "PseudoMotor" : (
- ("gap", "pm/slitctrl/1", dict(Id=501, Axis=1, Ctrl_id=5, Instrument_id=InvalidId, Elements=("101", "102",)),),
- ("offset", "pm/slitctrl/2", dict(Id=502, Axis=2, Ctrl_id=5, Instrument_id=InvalidId, Elements=("101", "102",)),),
- ),
- "PseudoCounter" : (
- ("inorm", "pc/ioi0ctrl/1", dict(Id=601, Axis=1, Ctrl_id=6, Instrument_id=InvalidId, Elements=("301", "302",)),),
- ),
- "MotorGroup" : (
- ("motgrp1", "mg/pool_demo/motgrp1", dict(Id=701, Elements=("103", "104",)),),
- ),
- "MeasurementGroup" : (
- ("mntgrp1", "mntgrp/pool_demo/mntgrp1", dict(Id=701, Elements=("301", "302", "303", "401",)),),
- ),
- "MacroServer" : (
- ("MS_demo", "sardana/ms/demo", dict(PoolNames=["sardana/pool/demo"]),),
- ),
- "Door" : (
- ("Door_demo", "sardana/door/demo",
- dict(Id=1001, MacroServerName="sardana/ms/demo", MaxMsgBufferSize=512),),
- ),
-}
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# PyTango utilities
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-def get_pytango_version_str():
- try:
- import PyTango
- except:
- return None
- try:
- return PyTango.Release.version
- except:
- return '0.0.0'
-
-def get_pytango_version_number():
- tgver_str = get_pytango_version_str()
- if tgver_str is None:
- return None
- import sardana.sardanautils
- return sardana.sardanautils.translate_version_str2int(tgver_str)
-
-def get_tango_version_str():
- try:
- import PyTango.constants
- except:
- return None
- try:
- return PyTango.constants.TgLibVers
- except:
- return '0.0.0'
-
-def get_tango_version_number():
- tgver_str = get_tango_version_str()
- if tgver_str is None:
- return None
- import sardana.sardanautils
- return sardana.sardanautils.translate_version_str2int(tgver_str)
-
-class GenericScalarAttr(Attr):
- pass
-
-
-class GenericSpectrumAttr(SpectrumAttr):
-
- def __init__(self, name, tg_type, tg_access, dim_x=2048):
- SpectrumAttr.__init__(self, name, tg_type, tg_access, dim_x)
-
-
-class GenericImageAttr(ImageAttr):
-
- def __init__(self, name, tg_type, tg_access, dim_x=2048, dim_y=2048):
- ImageAttr.__init__(self, name, tg_type, tg_access, dim_x, dim_y)
-
-def clean_device_attribute_memorized(db, dev_name, attr_name):
- props = "__value", "__value_ts"
- db.delete_device_attribute_property(dev_name, {attr_name : props })
-
-def clean_device_memorized(db, dev_name):
- for attr_name in PyTango.DeviceProxy(dev_name).get_attribute_list():
- clean_device_attribute_memorized(db, dev_name, attr_name)
-
-def clean_server_memorized(db, server_name, server_instance):
- server = server_name + "/" + server_instance
- dev_names = db.get_device_class_list(server)[::2]
- for dev_name in dev_names:
- clean_device_memorized(db, dev_name)
-
-def __set_last_write_value(attribute, lrv):
- attribute._last_write_value = lrv
- return lrv
-
-def __get_last_write_value(attribute):
- if hasattr(attribute, '_last_write_value'):
- lrv = attribute._last_write_value
- else:
- attribute._last_write_value = lrv = None
- return lrv
-
-def memorize_write_attribute(write_attr_func):
- """The main purpose is to use this as a decorator for write_<attr_name>
- device methods.
-
- Properly memorizes the attribute write value:
-
- - only memorize if write doesn't throw exception
- - also memorize the timestamp
-
- :param write_attr_func: the write method
- :type write_attr_func: callable
- :return: a write method safely wrapping the given write method
- :rtype: callable"""
-
- @wraps(write_attr_func)
- def write_attr_wrapper(self, attribute):
- ts = repr(time.time())
- attr_name = attribute.get_name()
- dev_name = self.get_name()
-
- if not isinstance(attribute, WAttribute):
- return write_attr_func(self, attribute)
-
- lwv = __get_last_write_value(attribute)
- wv = attribute.get_write_value(), ts
- store, raises_exc = wv, True
- store_value = False
- try:
- ret = write_attr_func(self, attribute)
- __set_last_write_value(attribute, wv)
- raises_exc = False
- finally:
- # if there is an exception recover from the last write value.
- # (don't catch and raise exceptions to avoid messing up the stack)
- if raises_exc:
- store_value = True
- if lwv is not None:
- store = lwv
- if store is not None:
- db = self.get_database()
- attr_values = dict(__value_ts=store[1])
- if store_value:
- attr_values['__value'] = store[0]
- db.put_device_attribute_property(dev_name, { attr_name : attr_values })
- return ret
-
- return write_attr_wrapper
-
-def tango_protect(wrapped, *args, **kwargs):
- @wraps(wrapped)
- def wrapper(self, *args, **kwargs):
- with self.tango_lock:
- return wrapped(self, *args, **kwargs)
- return wrapper
-
-def from_deviceattribute_value(da):
- if da.has_failed:
- return
- dtype, dformat, value = da.type, da.data_format, da.value
- if dtype == PyTango.DevState:
- if dformat == PyTango.SCALAR:
- return from_tango_state_to_state(value)
- elif dformat == PyTango.SPECTRUM:
- return list(map(from_tango_state_to_state, value))
- elif dformat == PyTango.IMAGE:
- return [ list(map(from_tango_state_to_state, v)) for v in value ]
- return value
-
-def from_deviceattribute(da):
- if da.has_failed:
- exc_info = DevFailed(*da.get_err_stack())
- value = None
- else:
- exc_info = None
- value = from_deviceattribute_value(da.value)
-
- dtype, dformat = from_tango_type_format(da.type, da.data_format)
-
- ret = SardanaValue(value=value, exc_info=exc_info,
- timestamp=da.time.totime(), dtype=dtype, dformat=dformat)
- return ret
-
-def to_tango_state(state):
- return DevState(state)
-
-def from_tango_state_to_state(state):
- return int(state)
-
-#: dictionary dict<:class:`sardana.DataType`, :class:`PyTango.CmdArgType`>
-TTYPE_MAP = {
- DataType.Integer : DevLong,
- DataType.Double : DevDouble,
- DataType.String : DevString,
- DataType.Boolean : DevBoolean,
-}
-R_TTYPE_MAP = dict((v, k) for k, v in TTYPE_MAP.items())
-
-#: dictionary dict<:class:`sardana.DataFormat`, :class:`PyTango.AttrFormat`>
-TFORMAT_MAP = {
- DataFormat.Scalar : SCALAR,
- DataFormat.OneD : SPECTRUM,
- DataFormat.TwoD : IMAGE,
-}
-R_TFORMAT_MAP = dict((v, k) for k, v in TFORMAT_MAP.items())
-
-#: dictionary dict<:class:`sardana.DataAccess`, :class:`PyTango.AttrWriteType`>
-TACCESS_MAP = {
- DataAccess.ReadOnly : READ,
- DataAccess.ReadWrite : READ_WRITE,
-}
-
-R_TACCESS_MAP = dict((v, k) for k, v in TACCESS_MAP.items())
-
-def exception_str(etype=None, value=None, sep='\n'):
- if etype is None:
- etype, value = sys.exc_info()[:2]
- return sep.join(traceback.format_exception_only(etype, value))
-
-def to_tango_access(access):
- """Transforms a :obj:`~sardana.DataAccess` into a
- :obj:`~PyTango.AttrWriteType`
-
- :param access: the access to be transformed
- :type access: :obj:`~sardana.DataAccess`
- :return: the tango attribute write type
- :rtype: :obj:`PyTango.AttrWriteType`"""
- return TACCESS_MAP[access]
-
-def from_tango_access(access):
- """Transforms a :obj:`~PyTango.AttrWriteType` into a
- :obj:`~sardana.DataAccess`
-
- :param access: the tango access to be transformed
- :type access: :obj:`~PyTango.AttrWriteType`
- :return: the sardana attribute write type
- :rtype: :obj:`~sardana.DataAccess`"""
- return R_TACCESS_MAP[access]
-
-def to_tango_type_format(dtype_or_info, dformat=None):
- """Transforms a :obj:`~sardana.DataType` :obj:`~sardana.DataFormat` into a
- :obj:`~PyTango.CmdArgType`, :obj:`~PyTango.AttrDataFormat` tuple
-
- :param dtype_or_info: the type to be transformed
- :type dtype_or_info: :obj:`~sardana.DataType`
- :param dformat: the format to be transformed
- :type dformat: :obj:`~sardana.DataFormat`
-
- :return: a tuple of two elements: the tango attribute write type, tango data format
- :rtype: tuple< :obj:`PyTango.CmdArgType`, :obj:`PyTango.AttrDataFormat` >"""
- dtype = dtype_or_info
- if dformat is None:
- dtype, dformat = to_dtype_dformat(dtype)
- return TTYPE_MAP.get(dtype, DevVoid), TFORMAT_MAP.get(dformat, FMT_UNKNOWN)
-
-def from_tango_type_format(dtype, dformat=PyTango.SCALAR):
- """Transforms a :obj:`~PyTango.CmdArgType`, :obj:`~PyTango.AttrDataFormat`
- into a :obj:`~sardana.DataType` :obj:`~sardana.DataFormat` tuple
-
- :param dtype: the type to be transformed
- :type dtype: :obj:`~PyTango.CmdArgType`
- :param dformat: the format to be transformed
- :type dformat: :obj:`~PyTango.AttrDataFormat`
-
- :return: a tuple of two elements: data type, data format
- :rtype: tuple< :obj:`~sardana.DataType`, :obj:`~sardana.DataFormat` >"""
- return R_TTYPE_MAP[dtype], R_TFORMAT_MAP[dformat]
-
-def to_tango_attr_info(attr_name, attr_info):
- if isinstance(attr_info, DataInfo):
- data_type, data_format = attr_info.dtype, attr_info.dformat
- data_access = attr_info.access
- desc = attr_info.description
- memorized = attr_info.memorized
- else:
- data_type, data_format = to_dtype_dformat(attr_info.get('type'))
- data_access = to_daccess(attr_info.get('r/w type'))
- desc = attr_info.get('description')
- memorized = attr_info.get('memorized')
-
- tg_type, tg_format = to_tango_type_format(data_type, data_format)
- tg_access = to_tango_access(data_access)
- tg_attr_info = [ [ tg_type, tg_format, tg_access ] ]
-
- extra = {}
- tg_attr_info.append(extra)
-
- if desc is not None and len(desc) > 0:
- extra['description'] = desc
- extra['memorized'] = memorized
- return attr_name, tg_attr_info
-
-def throw_sardana_exception(exc):
- """Throws an exception as a tango exception"""
- if isinstance(exc, SardanaException):
- if exc.exc_info and not None in exc.exc_info:
- Except.throw_python_exception(*exc.exc_info)
- else:
- tb = "<Unknown>"
- if exc.traceback is not None:
- tb = str(exc.traceback)
- Except.throw_exception(exc.type, exc.msg, tb)
- elif hasattr(exc, 'exc_info'):
- Except.throw_python_exception(*exc.exc_info)
- else:
- raise exc
-
-def ask_yes_no(prompt, default=None):
- """Asks a question and returns a boolean (y/n) answer.
-
- If default is given (one of 'y','n'), it is used if the user input is
- empty. Otherwise the question is repeated until an answer is given.
-
- An EOF is treated as the default answer. If there is no default, an
- exception is raised to prevent infinite loops.
-
- Valid answers are: y/yes/n/no (match is not case sensitive)."""
- answers = {'y':True, 'n':False, 'yes':True, 'no':False}
- ans = None
- if default is not None:
- d_l = default.lower()
- if d_l in ('y', 'yes'):
- prompt += " (Y/n) ?"
- elif d_l in ('n', 'no'):
- prompt += " (N/y) ?"
-
- while ans not in answers.keys():
- try:
- ans = raw_input(prompt + ' ').lower()
- if not ans: # response was an empty string
- ans = default
- except KeyboardInterrupt:
- print
- except EOFError:
- if default in answers.keys():
- ans = default
- print
- else:
- raise
-
- return answers[ans]
-
-def clean_tango_args(args):
- ret, ret_for_tango, ret_for_ORB = [], [], []
-
- tango_args = "-?", "-nodb", "-file="
- nb_args = len(args)
- i = 0
- while i < nb_args:
- arg = args[i]
- try:
- if arg.startswith("-v") and int(arg[2:]):
- ret_for_tango.append(arg)
- i += 1
- continue
- except:
- pass
- if arg.startswith('-ORB'):
- ret_for_ORB.append(arg)
- ret_for_tango.append(arg)
- i += 1
- if i < nb_args:
- ret_for_ORB.append(args[i])
- ret_for_tango.append(args[i])
- i += 1
- continue
- if arg.startswith(tango_args):
- ret_for_tango.append(arg)
- i += 1
- continue
- if arg == "-dlist":
- ret_for_tango.append(arg)
- i += 1
- while i < nb_args and args[i][0] != "-":
- arg = args[i]
- ret_for_tango.append(arg)
- i += 1
- continue
- ret.append(arg)
- i += 1
- return ret, ret_for_tango, ret_for_ORB
-
-def prepare_cmdline(parser=None, args=None):
- """Prepares the command line separating tango options from server specific
- options.
-
- :return: a sequence of options, arguments, tango arguments
- :rtype: seq<opt, list<str>, list<str>>"""
- import optparse
- if args is None:
- args = []
-
- proc_args, tango_args, ORB_args = clean_tango_args(args)
-
- if parser is None:
- version = "%s" % (Release.version)
- parser = optparse.OptionParser(version=version)
-
- parser.usage = "usage: %prog instance_name [options]"
- log_level_choices = "critical", "error", "warning", "info", "debug", "trace", \
- "0", "1", "2", "3", "4", "5"
- help_olog = "log output level. Possible values are (case sensitive): " \
- "critical (or 0), error (1), warning (2), info (3) " \
- "debug (4), trace (5) [default: %default]"
- help_flog = "log file level. Possible values are (case sensitive): " \
- "critical (or 0), error (1), warning (2), info (3) " \
- "debug (4), trace (5) [default: %default]. " \
- "Ignored if --without-log-file is True"
- help_fnlog = "log file name. When given, MUST be absolute file name. " \
- "[default: /tmp/tango/<DS name>/<DS instance name lower case>/log.txt]. " \
- "Ignored if --without-log-file is True"
- help_wflog = "When set to True disables logging into a file [default: %default]"
- help_rfoo = "rconsole port number. [default: %default meaning rconsole NOT active]"
- parser.add_option("--log-level", dest="log_level", metavar="LOG_LEVEL",
- help=help_olog, type="choice", choices=log_level_choices, default="warning")
- parser.add_option("--log-file-level", dest="log_file_level", metavar="LOG_FILE_LEVEL",
- help=help_flog, type="choice", choices=log_level_choices, default="debug")
- parser.add_option("--log-file-name", dest="log_file_name",
- help=help_fnlog, type="str", default=None)
- parser.add_option("--without-log-file", dest="without_log_file",
- help=help_wflog, default=False)
-
- parser.add_option("--rconsole-port", dest="rconsole_port",
- metavar="RCONSOLE_PORT", help=help_rfoo, type="int", default=0)
-
- res = list(parser.parse_args(proc_args))
- tango_args = res[1][:2] + tango_args
- res.append(tango_args)
- res.append(ORB_args)
- return res
-
-def prepare_environment(args, tango_args, ORB_args):
- """Since we have to create a Tango Database object before the Tango Util,
- omniORB doesn't recognize parameters on the command line anymore
- (tango, omniORB bug?), so we export these parameters as environment
- variables (this workaround seems to work)"""
- log_messages = []
- ORB_args_len = len(ORB_args)
- for i in range(ORB_args_len):
- arg = ORB_args[i]
- if arg.startswith("-ORB") and i + 1 < ORB_args_len:
- env_name = arg[1:]
- env_val = ORB_args[i + 1]
- os.environ[env_name] = env_val
- log_messages.append(("setting %s=%s", env_name, env_val))
- return log_messages
-
-def prepare_server(args, tango_args):
- """Register a proper server if the user gave an unknown server"""
- log_messages = []
- _, bin_name = os.path.split(args[0])
- server_name, _ = os.path.splitext(bin_name)
-
- if "-?" in tango_args:
- return log_messages
-
- nodb = "-nodb" in tango_args
- if nodb and not hasattr(DeviceClass, "device_name_factory"):
- print "In order to start %s with 'nodb' you need PyTango >= 7.2.3" % server_name
- sys.exit(1)
-
- if len(tango_args) < 2:
- valid = False
- while not valid:
- inst_name = raw_input("Please indicate %s instance name: " % server_name)
- #should be a instance name validator.
- valid_set = string.letters + string.digits + '_' + '-'
- out = ''.join([c for c in inst_name if c not in valid_set])
- valid = len(inst_name) > 0 and len(out) == 0
- if not valid:
- print "We only accept alphanumeric combinations"
- args.append(inst_name)
- tango_args.append(inst_name)
- else:
- inst_name = tango_args[1].lower()
-
- if "-nodb" in tango_args:
- return log_messages
-
- db = Database()
- if not exists_server_instance(db, server_name, inst_name):
- if ask_yes_no('%s does not exist. Do you wish create a new one' % inst_name, default='y'):
- if server_name == 'MacroServer' :
- # build list of pools to which the MacroServer should connect to
- pool_names = []
- pools = get_dev_from_class(db, "Pool")
- all_pools = pools.keys()
- for pool in pools.values():
- pool_alias = pool[2]
- if pool_alias is not None:
- all_pools.append(pool_alias)
- all_pools = map(str.lower, all_pools)
- for i in pools:
- print pools[i][3]
- while True:
- elem = raw_input("Please select pool to connect to (return to finish): ").strip()
- if not len(elem):
- break
- if elem.lower() not in all_pools:
- print "Unknown pool element"
- print all_pools
- else:
- pool_names.append(elem)
- log_messages += register_sardana(db, server_name, inst_name, pool_names)
- else:
- log_messages += register_sardana(db, server_name, inst_name)
- return log_messages
-
-def exists_server_instance(db, server_name, server_instance):
- known_inst = map(str.lower, db.get_instance_name_list(server_name))
- return server_instance.lower() in known_inst
-
-def register_sardana(db, bin_name, inst_name, pool_names=None):
- devices = []
- log_messages = []
- if bin_name == 'MacroServer':
- props = {'PoolNames' : pool_names}
- ms_alias = get_free_alias(db, "MS_" + inst_name)
- devices.append(('MacroServer', None, ms_alias, props))
- door_alias = get_free_alias(db, "Door_" + inst_name)
- devices.append(("Door", None, door_alias, {}))
- elif bin_name == 'Pool':
- pool_alias = get_free_alias(db, 'Pool_' + inst_name)
- devices.append(('Pool', None, pool_alias, {}))
- elif bin_name == 'Sardana':
- pool_dev_name = get_free_device(db, 'pool/' + inst_name)
- pool_alias = get_free_alias(db, 'Pool_' + inst_name)
- devices.append(('Pool', pool_dev_name, pool_alias, {}))
- ms_alias = get_free_alias(db, "MS_" + inst_name)
- devices.append(('MacroServer', None, ms_alias,
- {'PoolNames' : [pool_dev_name]}))
- door_alias = get_free_alias(db, "Door_" + inst_name)
- devices.append(("Door", None, door_alias, {}))
- register_server_with_devices(db, bin_name, inst_name, devices)
- log_messages.append(("Registered server '%s/%s'", bin_name, inst_name))
- for d in devices:
- dev_class, dev_alias = d[0], d[2]
- log_messages.append(("Registered %s %s", dev_class, dev_alias))
- return log_messages
-
-def register_server_with_devices(db, server_name, server_instance, devices):
- """Registers a new server with some devices in the Database.
- Devices is a seq<tuple<str, str, str, dict>>> where each item is a
- sequence of 4 elements :
- - device class
- - device name prefix
- - device alias
- - dictionary of properties
-
- :param db: database where to register devices
- :type db: PyTango.Database
- :param server_name: server name
- :type server_name: str
- :param server_instance: server instance name
- :type server_instance: str
- :param devices: map of devices to create.
- :type devices: dict<str, seq<tuple<str, str, dict>>>
- """
- info = DbDevInfo()
- info.server = server_name + "/" + server_instance
- for dev_info in devices:
- dev_class, prefix, alias, props = dev_info
- if prefix is None:
- prefix = dev_class + "/" + server_instance
- if prefix.count("/") == 1:
- prefix = get_free_device(db, prefix)
- info._class = dev_class
- info.name = prefix
- db.add_device(info)
- if alias is None:
- alias_prefix = dev_class + "_" + server_instance
- alias = get_free_alias(db, alias_prefix)
- db.put_device_alias(info.name, alias)
- if props is not None:
- db.put_device_property(info.name, props)
-
-def from_name_to_tango(db, name):
- alias = None
-
- c = name.count('/')
- # if the db prefix is there, remove it first
- if c == 3 or c == 1:
- name = name[name.index("/") + 1:]
-
- elems = name.split('/')
- l = len(elems)
-
- if l == 3:
- try:
- alias = db.get_alias(name)
- if alias.lower() == 'nada':
- alias = None
- except:
- alias = None
- elif l == 1:
- alias = name
- name = db.get_device_alias(alias)
- else:
- raise Exception("Invalid device name '%s'" % name)
-
- full_name = "%s:%s/%s" % (db.get_db_host(), db.get_db_port(), name)
- return full_name, name, alias
-
-def get_dev_from_class(db, classname):
- """Returns tuple<full device name, device name, alias, ouput string>"""
- server_wildcard = '*'
- try:
- exp_dev_list = db.get_device_exported_for_class(classname)
- except Exception:
- exp_dev_list = []
-
- res = {}
- dev_list = db.get_device_name(server_wildcard, classname)
- for dev in dev_list:
- full_name, name, alias = from_name_to_tango(db, dev)
- out = alias or name
- if alias: out += ' (a.k.a. %s)' % name
- out = "%-25s" % out
- if dev in exp_dev_list:
- out += " (running)"
- res[dev] = full_name, name, alias, out
- return res
-
-def get_free_server(db, prefix, start_from=1):
- prefix = prefix + "_"
- server_members = db.get_server_list(prefix + "*")
- server = server_members.value_string
- while prefix + str(start_from) in server:
- start_from += 1
- return prefix + str(start_from)
-
-def get_free_device(db, prefix, start_from=1):
- members = db.get_device_member(prefix + "/*")
- while str(start_from) in members:
- start_from += 1
- return prefix + "/" + str(start_from)
-
-def get_free_alias(db, prefix, start_from=1):
- '''Iterates until failure, trying to retrieve from the database device of
- the given alias. This way, first which fails is available in the database.
-
- :param db: database where to look for the free alias
- :type db: PyTango.Database
- :param start_from: alias suffix in form of consecutive number
- :type start_from: int
- '''
- while True:
- name = prefix + "_" + str(start_from)
- try:
- db.get_device_from_alias(name) # PyTango >= 8.1.0
- except PyTango.DevFailed:
- return name
- except AttributeError:
- try:
- db.get_device_alias(name) # deprecated since PyTango 8.1.0
- except PyTango.DevFailed:
- return name
- start_from += 1
-
-def prepare_taurus(options, args, tango_args):
- # make sure the polling is not active
- factory = taurus.Factory()
- factory.disablePolling()
-
-def prepare_logging(options, args, tango_args, start_time=None, log_messages=None):
- taurus.setLogLevel(taurus.Debug)
- root = Logger.getRootLog()
-
- # output logger configuration
- log_output_level = options.log_level
- log_level_map = { "0" : taurus.Critical, "critical" : taurus.Critical,
- "1" : taurus.Error, "error" : taurus.Error,
- "2" : taurus.Warning, "warning" : taurus.Warning,
- "3" : taurus.Info, "info" : taurus.Info,
- "4" : taurus.Debug, "debug" : taurus.Debug,
- "5" : taurus.Trace, "trace" : taurus.Trace,
- }
- log_output_level = log_level_map[log_output_level]
- root.handlers[0].setLevel(log_output_level)
-
- if not options.without_log_file:
- log_file_level = options.log_file_level
- log_file_level = log_level_map[log_file_level]
-
- # Create a file handler
- if options.log_file_name is None:
- _, ds_name = os.path.split(args[0])
- ds_name, _ = os.path.splitext(ds_name)
- ds_instance = args[-1].lower()
- import getpass
- try:
- tangodir = 'tango-%s' % getpass.getuser() #include the user name to avoid permission errors
- except:
- tangodir = 'tango' % getpass.getuser()
- path = os.path.join(os.sep, "tmp", tangodir, ds_name, ds_instance)
- log_file_name = os.path.join(path, 'log.txt')
- else:
- log_file_name = options.log_file_name
- path = os.path.dirname(log_file_name)
-
- # because some versions of python have a bug in logging.shutdown (this
- # function is not protected against deleted handlers) we store the
- # handlers we create to make sure a strong reference exists when the
- # logging.shutdown is called
- taurus._handlers = handlers = []
- try:
- if not os.path.exists(path):
- os.makedirs(path, 0777)
-
- from sardana import sardanacustomsettings
- maxBytes = getattr(sardanacustomsettings, 'LOG_FILES_SIZE', 1E7)
- backupCount = getattr(sardanacustomsettings, 'LOG_BCK_COUNT', 5)
-
- fmt = Logger.getLogFormat()
- f_h = logging.handlers.RotatingFileHandler(log_file_name,
- maxBytes=maxBytes,
- backupCount=backupCount)
- f_h.setFormatter(fmt)
- f_h.setLevel(log_file_level)
- root.addHandler(f_h)
- handlers.append(f_h)
-
- if start_time is not None:
- taurus.info("Started at %s", start_time)
- else:
- taurus.info("Starting up...")
- taurus.info("Log is being stored in %s", log_file_name)
- except:
- if start_time is not None:
- taurus.info("Started at %s", start_time)
- else:
- taurus.info("Starting up...")
- taurus.warning("'%s' could not be created. Logs will not be stored",
- log_file_name)
- taurus.debug("Error description", exc_info=1)
-
- if log_messages is None:
- log_messages = []
- for log_message in log_messages:
- taurus.info(*log_message)
-
- taurus.debug("Start args=%s", args)
- taurus.debug("Start tango args=%s", tango_args)
- taurus.debug("Start options=%s", options)
- taurus.debug("Using PyTango %s from %s", PyTango.Release.version, PyTango.__path__[0])
- taurus.debug("Using taurus %s from %s", taurus.Release.version, taurus.__path__[0])
- taurus.debug("Using sardana %s from %s", sardana.Release.version, sardana.__path__[0])
-
-def prepare_rconsole(options, args, tango_args):
- port = options.rconsole_port
- if port is None or port is 0:
- return
- taurus.debug("Setting up rconsole on port %d...", port)
- try:
- import rfoo.utils.rconsole
- rfoo.utils.rconsole.spawn_server(port=port)
- taurus.debug("Finished setting up rconsole")
- except:
- taurus.debug("Failed to setup rconsole", exc_info=1)
-
-def run_tango_server(tango_util=None, start_time=None):
- try:
- if tango_util is None:
- tango_util = Util(sys.argv)
- util = Util.instance()
- SardanaServer.server_state = State.Init
- util.server_init()
- SardanaServer.server_state = State.Running
- if start_time is not None:
- import datetime
- dt = datetime.datetime.now() - start_time
- taurus.info("Ready to accept request in %s", dt)
- else:
- taurus.info("Ready to accept request")
- util.server_run()
- SardanaServer.server_state = State.Off
- taurus.info("Exiting")
- except DevFailed:
- taurus.info("Exiting")
- taurus.critical("Server exited with DevFailed", exc_info=1)
- except KeyboardInterrupt:
- taurus.info("Exiting")
- taurus.critical("Interrupted by keyboard")
- except Exception:
- taurus.info("Exiting")
- taurus.critical("Server exited with unforeseen exception", exc_info=1)
- taurus.info("Exited")
-
-def run(prepare_func, args=None, tango_util=None, start_time=None, mode=None):
-
- if mode is None:
- mode = ServerRunMode.SynchPure
-
- if args is None:
- if mode != ServerRunMode.SynchPure:
- raise Exception("When running in separate thread/process, " \
- "'args' must be given")
- args = sys.argv
-
- name = args[0]
-
- if mode != ServerRunMode.SynchPure:
- if mode in (ServerRunMode.SynchThread, ServerRunMode.AsynchThread):
- import threading
- class task_klass(threading.Thread):
- def terminate(self):
- if not self.is_alive():
- return
- Util.instance().get_dserver_device().kill()
- else:
- import multiprocessing
- task_klass = multiprocessing.Process
- tango_util = None
-
- task_args = prepare_func,
- task_kwargs = dict(args=args, tango_util=tango_util,
- start_time=start_time, mode=ServerRunMode.SynchPure)
-
- task = task_klass(name=name, target=run, args=task_args,
- kwargs=task_kwargs)
- task.daemon = False
- task.start()
- if mode in (ServerRunMode.SynchThread, ServerRunMode.SynchProcess):
- task.join()
- return task
-
- log_messages = []
- try:
- options, args, tango_args, ORB_args = prepare_cmdline(args=args)
- except KeyboardInterrupt:
- pass
-
- log_messages.extend(prepare_environment(args, tango_args, ORB_args))
- log_messages.extend(prepare_server(args, tango_args))
-
- if tango_util == None:
- tango_util = Util(tango_args)
-
- prepare_func(tango_util)
- prepare_taurus(options, args, tango_args)
- prepare_logging(options, args, tango_args, start_time=start_time,
- log_messages=log_messages)
- prepare_rconsole(options, args, tango_args)
-
- run_tango_server(tango_util, start_time=start_time)
diff --git a/src/sardana/tango/macroserver/Door.py b/src/sardana/tango/macroserver/Door.py
deleted file mode 100644
index c21f6437..00000000
--- a/src/sardana/tango/macroserver/Door.py
+++ /dev/null
@@ -1,503 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import json
-import time
-import threading
-
-from lxml import etree
-
-from PyTango import Util, DevFailed, Except, DevVoid, DevLong, \
- DevLong64, DevString, DevState, DevEncoded, \
- DevVarStringArray, ArgType, \
- READ, READ_WRITE, SCALAR, SPECTRUM
-
-from taurus.core.util.log import DebugIt, LogFilter
-from taurus.core.util.codecs import CodecFactory
-
-from sardana import State, InvalidId, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.macroserver.macro import Macro
-from sardana.macroserver.msdoor import BaseInputHandler
-from sardana.macroserver.msexception import MacroServerException
-from sardana.tango.core.util import throw_sardana_exception
-from sardana.tango.core.attributehandler import AttributeLogHandler
-from sardana.tango.core.SardanaDevice import SardanaDevice, SardanaDeviceClass
-from sardana.macroserver.msexception import InputCancelled
-
-
-class TangoInputHandler(BaseInputHandler):
-
- def __init__(self, door, attr):
- self._value = None
- self._input_waitting = False
- self._input_event = threading.Event()
- self._door = door
- self._attr = attr
-
- def input(self, input_data=None):
- if input_data is None:
- input_data = {}
- self.input_data = input_data
- timeout = input_data.get('timeout')
- input_data = json.dumps(input_data)
- self._value = None
- self._input_waitting = True
- try:
- self._door.set_attribute(self._attr, value=input_data)
- res = self.input_wait(timeout=timeout)
- finally:
- self._input_waitting = False
-
- if res is None or res.get('cancel', False):
- raise InputCancelled('Input cancelled by user')
- return res['input']
-
- def input_received(self, value):
- if not self._input_waitting:
- return
- self._value = json.loads(value)
- self._input_event.set()
-
- def input_wait(self, timeout=None):
- wait = self._input_event.wait(timeout)
- # if there was a timeout:
- # - set the value to the default value (if one exists)
- # - inform clients that timeout occured and they should not wait for
- # user input anymore
- if not self._input_event.is_set():
- if 'default_value' in self.input_data:
- self._value = dict(input=self.input_data['default_value'])
- self.send_input_timeout()
- self._input_event.clear()
- return self._value
-
- def send_input_timeout(self):
- idata = self.input_data
- input_data = dict(type="timeout", macro_id=idata['macro_id'])
- if 'default_value' in idata:
- input_data['default_value'] = idata['default_value']
- input_data = json.dumps(input_data)
- door = self._door
- door.set_attribute(self._attr, value=input_data)
-
-
-class TangoFunctionHandler(object):
-
- def __init__(self, door, attr, module_name, format="bz2_pickle"):
- self.door = door
- self.attr = attr
- self.module_name = module_name
- self.format = format
-
- def handle(self, func_name, *args, **kwargs):
- codec = CodecFactory().getCodec(self.format)
- data = dict(type='function', func_name=func_name, args=args, kwargs=kwargs)
- event_value = codec.encode(('', data))
- self.door.set_attribute(self.attr, value=event_value)
-
- def __getattr__(self, name):
- def f(*args, **kwargs):
- full_name = self.module_name + "." + name
- return self.handle(full_name, *args, **kwargs)
- f.__name__ = name
- return f
-
-
-class TangoPylabHandler(TangoFunctionHandler):
-
- def __init__(self, door, attr, format="bz2_pickle"):
- TangoFunctionHandler.__init__(self, door, attr, "pylab",
- format="bz2_pickle")
-
-
-class TangoPyplotHandler(TangoFunctionHandler):
-
- def __init__(self, door, attr, format="bz2_pickle"):
- TangoFunctionHandler.__init__(self, door, attr, "pyplot",
- format="bz2_pickle")
-
-
-class Door(SardanaDevice):
-
- def __init__(self, dclass, name):
- SardanaDevice.__init__(self, dclass, name)
- self._last_result = ()
- self._input_handler = None
-
- def init(self, name):
- SardanaDevice.init(self, name)
- self._door = None
- self._macro_server_device = None
-
- def get_door(self):
- return self._door
-
- def set_door(self, door):
- self._door = door
-
- door = property(get_door, set_door)
-
- @property
- def macro_server_device(self):
- return self._macro_server_device
-
- @property
- def macro_server(self):
- return self.door.macro_server
-
- def delete_device(self):
- if self.getRunningMacro():
- self.debug("aborting running macro")
- self.macro_executor.abort()
-
- for handler, filter, format in self._handler_dict.values():
- handler.finish()
-
- door = self.door
- if door is not None:
- door.remove_listener(self.on_door_changed)
-
- @DebugIt()
- def init_device(self):
- SardanaDevice.init_device(self)
- levels = 'Critical', 'Error', 'Warning', 'Info', 'Output', 'Debug'
- detect_evts = ()
- non_detect_evts = ['State', 'Status', 'Result', 'RecordData',
- 'MacroStatus', 'Input'] + list(levels)
- self.set_change_events(detect_evts, non_detect_evts)
-
- util = Util.instance()
- db = util.get_database()
-
- # Find the macro server for this door
- macro_servers = util.get_device_list_by_class("MacroServer")
- if self.MacroServerName is None:
- self._macro_server_device = macro_servers[0]
- else:
- ms_name = self.MacroServerName.lower()
- for ms in macro_servers:
- if ms.get_name().lower() == ms_name or \
- ms.alias.lower() == ms_name:
- self._macro_server_device = ms
- break
-
- # support for old doors which didn't have ID
- if self.Id == InvalidId:
- self.Id = self.macro_server_device.macro_server.get_new_id()
- db.put_device_property(self.get_name(), dict(Id=self.Id))
-
- door = self.door
- if door is None:
- full_name = self.get_name()
- name = full_name
- macro_server = self.macro_server_device.macro_server
- self.door = door = \
- macro_server.create_element(type="Door", name=name,
- full_name=full_name, id=self.Id)
- self._setupLogHandlers(levels)
-
- multi_attr = self.get_device_attr()
-
- input_attr = multi_attr.get_attr_by_name('Input')
- self._input_handler = ih = TangoInputHandler(self, input_attr)
- door.set_input_handler(ih)
-
- recorddata_attr = multi_attr.get_attr_by_name('RecordData')
- self._pylab_handler = pylabh = TangoPylabHandler(self, recorddata_attr)
- door.set_pylab_handler(pylabh)
-
- self._pyplot_handler = pyploth = TangoPyplotHandler(self, recorddata_attr)
- door.set_pyplot_handler(pyploth)
-
- door.add_listener(self.on_door_changed)
- self.set_state(DevState.ON)
-
- def _setupLogHandlers(self, levels):
- self._handler_dict = {}
- for level in levels:
- handler = AttributeLogHandler(self, level,
- max_buff_size=self.MaxMsgBufferSize)
- filter = LogFilter(level=getattr(self, level))
- handler.addFilter(filter)
- self.addLogHandler(handler)
- format = None
- self._handler_dict[level] = handler, filter, format
-
- def on_door_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
-
- name = event_type.name.lower()
-
- multi_attr = self.get_device_attr()
- try:
- attr = multi_attr.get_attr_by_name(name)
- except DevFailed:
- return
-
- if name == "state":
- event_value = self.calculate_tango_state(event_value)
- elif name == "status":
- event_value = self.calculate_tango_status(event_value)
- elif name == "recorddata":
- format, value = event_value
- codec = CodecFactory().getCodec(format)
- event_value = codec.encode(('', value))
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- timestamp = event_value.timestamp
- event_value = event_value.value
-
- if attr.get_data_type() == ArgType.DevEncoded:
- codec = CodecFactory().getCodec('json')
- event_value = codec.encode(('', event_value))
- self.set_attribute(attr, value=event_value, timestamp=timestamp)
-
- @property
- def macro_executor(self):
- return self.door.macro_executor
-
- def getRunningMacro(self):
- return self.door.running_macro
-
- def always_executed_hook(self):
- pass
-
- def read_attr_hardware(self,data):
- pass
-
- def readLogAttr(self, attr):
- name = attr.get_name()
- handler, filter, format = self._handler_dict[name]
- handler.read(attr)
-
- read_Critical = read_Error = read_Warning = read_Info = read_Output = \
- read_Debug = read_Trace = readLogAttr
-
- def read_Input(self, attr):
- attr.set_value('')
-
- def write_Input(self, attr):
- value = attr.get_write_value()
- self.door.get_input_handler().input_received(value)
-
- #@DebugIt()
- def read_ElementList(self, attr):
- element_list = self.macro_server_device.getElementList()
- attr.set_value(*element_list)
-
- def sendRecordData(self, format, data):
- self.push_change_event('RecordData', format, data)
-
- def getLogAttr(self, name):
- return self._handler_dict.get(name)
-
- def read_Result(self, attr):
- # Add your own code here
- attr.set_value(self._last_result)
-
- def read_RecordData(self, attr):
- try:
- macro_data = self.door.get_macro_data()
- codec = CodecFactory().getCodec('bz2_pickle')
- data = codec.encode(('', macro_data))
- except MacroServerException, mse:
- throw_sardana_exception(mse)
-
- attr.set_value(*data)
-
- def read_MacroStatus(self, attr):
- attr.set_value('', '')
-
- def Abort(self):
- self.debug("Abort is deprecated. Use StopMacro instead")
- return self.StopMacro()
-
- def AbortMacro(self):
- self.debug("Aborting")
- self.macro_executor.abort()
- self.debug("Finished aborting")
-
- def is_Abort_allowed(self):
- return True
-
- def PauseMacro(self):
- macro = self.getRunningMacro()
- if macro is None:
- print "Unable to pause Null macro"
- return
- self.macro_executor.pause()
-
- def is_PauseMacro_allowed(self):
- return self.get_state() == Macro.Running
-
- def StopMacro(self):
- macro = self.getRunningMacro()
- if macro is None:
- return
- self.debug("stopping macro %s" % macro._getDescription())
- self.macro_executor.stop()
-
- def is_StopMacro_allowed(self):
- return self.get_state() == Macro.Running
-
- def ResumeMacro(self):
- macro = self.getRunningMacro()
- if macro is None:
- return
- self.debug("resume macro %s" % macro._getDescription())
- self.macro_executor.resume()
-
- def is_ResumeMacro_allowed(self):
- return self.get_state() == Macro.Pause
-
- def RunMacro(self, par_str_list):
- #first empty all the buffers
- for handler, filter, fmt in self._handler_dict.values():
- handler.clearBuffer()
-
- if len(par_str_list) == 0:
- return []
-
- xml_seq = self.door.run_macro(par_str_list, asynch=True)
- return [etree.tostring(xml_seq, pretty_print=False)]
-
- def is_RunMacro_allowed(self):
- return self.get_state() in [Macro.Finished, Macro.Abort]
-
- def SimulateMacro(self, par_str_list):
- raise Exception("Not implemented yet")
-
- def GetMacroEnv(self, argin):
- macro_name = argin[0]
- if len(argin) > 1:
- macro_env = argin[1:]
- else:
- macro_env = self.door.get_macro_class_info(macro_name).env
- env = self.door.get_env(macro_env, macro_name=macro_name)
- ret = []
- for k,v in env.iteritems():
- ret.extend((k,v))
- return ret
-
- def is_GetMacroEnv_allowed(self):
- return self.get_state() in [Macro.Finished, Macro.Abort]
-
-
-class DoorClass(SardanaDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- 'Id': [DevLong64, "Internal ID", [ InvalidId ] ],
- 'MaxMsgBufferSize':
- [DevLong,
- 'Maximum size for the Output, Result, Error, Warning, Debug and '
- 'Info buffers',
- [512] ],
- 'MacroServerName':
- [DevString,
- 'Name of the macro server device to connect to. [default: None, '
- 'meaning connect to the first registered macroserver',
- None ],
- }
-
- # Command definitions
- cmd_list = {
- 'Abort':
- [ [ DevVoid, ""],
- [ DevVoid, ""] ],
- 'PauseMacro':
- [ [DevVoid, ""],
- [DevVoid, ""] ],
- 'AbortMacro':
- [ [DevVoid, ""],
- [DevVoid, ""] ],
- 'StopMacro':
- [ [DevVoid, ""],
- [DevVoid, ""] ],
- 'ResumeMacro':
- [ [DevVoid, ""],
- [DevVoid, ""] ],
- 'RunMacro':
- [ [DevVarStringArray, 'Macro name and parameters'],
- [DevVarStringArray, 'Macro Result']],
- 'SimulateMacro':
- [ [DevVarStringArray, 'Macro name and parameters'],
- [DevVarStringArray, 'Macro statistics']],
- 'GetMacroEnv':
- [ [ DevVarStringArray, 'Macro name followed by an ' \
- 'optional list of environment names' ],
- [ DevVarStringArray, 'Macro environment as a list of '\
- 'pairs keys, value'] ],
-# 'ReloadMacro':
-# [[DevVarStringArray, "Macro(s) name(s)"],
-# [DevVarStringArray, "[OK] if successfull or a traceback " \
-# "if there was a error (one string with complete traceback of " \
-# "each error)"]],
-# 'ReloadMacroLib':
-# [[DevVarStringArray, "MacroLib(s) name(s)"],
-# [DevVarStringArray, "[OK] if successfull or a traceback " \
-# "if there was a error (one string with complete traceback of " \
-# "each error)"]],
- }
-
- # Attribute definitions
- attr_list = {
- 'Result' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Result for the last macro', } ],
- 'Critical' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Macro critical error message', } ],
- 'Error' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Macro error message', } ],
- 'Warning' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Macro warning message', } ],
- 'Info' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Macro information message', } ],
- 'Debug' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Macro debug message', } ],
- 'Output' : [ [ DevString, SPECTRUM, READ, 512],
- { 'label' : 'Macro output message', } ],
- 'Input' : [ [ DevString, SCALAR, READ_WRITE],
- { 'label' : 'Macro input prompt', } ],
- 'RecordData' : [ [ DevEncoded, SCALAR, READ],
- { 'label' : 'Record Data', } ],
- 'MacroStatus' : [ [ DevEncoded, SCALAR, READ],
- { 'label' : 'Macro Status', } ],
- 'ElementList' : [ [ DevEncoded, SCALAR, READ],
- { 'label':"Element list",
- 'description' : 'the list of all elements (a '
- 'JSON encoded dict)', } ],
- }
diff --git a/src/sardana/tango/macroserver/MacroServer.py b/src/sardana/tango/macroserver/MacroServer.py
deleted file mode 100644
index 12c2017c..00000000
--- a/src/sardana/tango/macroserver/MacroServer.py
+++ /dev/null
@@ -1,418 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The MacroServer tango module"""
-
-import os.path
-
-from PyTango import Util, Except, DevVoid, DevLong, DevString, DevState, \
- DevEncoded, DevVarStringArray, READ, READ_WRITE, SCALAR, SPECTRUM, DebugIt
-
-from taurus.core.util.codecs import CodecFactory
-
-from sardana import State, SardanaServer
-from sardana.tango.core.SardanaDevice import SardanaDevice, SardanaDeviceClass
-from sardana.macroserver.msexception import MacroServerException
-from sardana.macroserver.macroserver import MacroServer as MS
-
-
-class MacroServer(SardanaDevice):
- """The MacroServer tango class"""
-
- ElementsCache = None
- EnvironmentCache = None
-
- def __init__(self,cl, name):
- self._macro_server = None
- SardanaDevice.__init__(self,cl, name)
-
- def init(self, name):
- SardanaDevice.init(self, name)
-
- if self._alias is None:
- self._alias = Util.instance().get_ds_inst_name()
-
- self._macro_server = ms = MS(self.get_full_name(), self.alias)
- ms.add_listener(self.on_macro_server_changed)
-
- @property
- def macro_server(self):
- return self._macro_server
-
- def delete_device(self):
- SardanaDevice.delete_device(self)
- self.clear_log_report()
-
- def init_device(self):
- SardanaDevice.init_device(self)
- self.set_change_event('State', True, False)
- self.set_change_event('Status', True, False)
- self.set_change_event('TypeList', True, False)
- self.set_change_event('DoorList', True, False)
- self.set_change_event('MacroList', True, False)
- self.set_change_event('MacroLibList', True, False)
- self.set_change_event('Elements', True, False)
- self.set_change_event('Environment', True, False)
-
- dev_class = self.get_device_class()
- self.get_device_properties(dev_class)
-
- self.EnvironmentDb = self._calculate_name(self.EnvironmentDb)
- self.LogReportFilename = self._calculate_name(self.LogReportFilename)
-
- macro_server = self.macro_server
- macro_server.set_python_path(self.PythonPath)
- macro_server.set_max_parallel_macros(self.MaxParallelMacros)
-
- # if it is not possible to store/retrieve the environment from the
- # current path then setup a new unique path and store the environment
- # there forever
- try:
- macro_server.set_environment_db(self.EnvironmentDb)
- except:
- self.error("Failed to set environment DB to %s", self.EnvironmentDb)
- self.debug("Details:", exc_info=1)
- import tempfile
- env_db = os.path.join(tempfile.mkdtemp(),
- MacroServerClass.DefaultEnvRelDir)
- env_db = self._calculate_name(env_db)
- db = Util.instance().get_database()
- db.put_device_property(self.get_name(), dict(EnvironmentDb=env_db))
- self.EnvironmentDb = env_db
- macro_server.set_environment_db(self.EnvironmentDb)
-
- try:
- macro_server.set_log_report(self.LogReportFilename, self.LogReportFormat)
- except:
- self.error("Failed to setup log report to %s",
- self.LogReportFilename)
- self.debug("Details:", exc_info=1)
-
- macro_server.set_macro_path(self.MacroPath)
- macro_server.set_pool_names(self.PoolNames)
-
- if self.RConsolePort:
- try:
- import rfoo.utils.rconsole
- rfoo.utils.rconsole.spawn_server(port=self.RConsolePort)
- except Exception:
- self.warning("Failed to start rconsole")
- self.debug("Details:", exc_info=1)
- self.set_state(DevState.ON)
-
- def _calculate_name(self, name):
- if name is None:
- return None
- util = Util.instance()
- return name % { 'ds_name' : util.get_ds_name().lower(),
- 'ds_exec_name' : util.get_ds_exec_name(),
- 'ds_inst_name' : util.get_ds_inst_name().lower() }
-
- def on_macro_server_changed(self, evt_src, evt_type, evt_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- evt_name = evt_type.name.lower()
-
- multi_attr = self.get_device_attr()
- elems_attr = multi_attr.get_attr_by_name("Elements")
- if evt_name == "poolelementschanged":
- # force the element list cache to be rebuild next time someone reads
- # the element list
- self.ElementsCache = None
- self.set_attribute(elems_attr, value=evt_value.value)
- #self.push_change_event('Elements', *evt_value.value)
- elif evt_name in ("elementcreated", "elementdeleted"):
- # force the element list cache to be rebuild next time someone reads
- # the element list
- self.ElementsCache = None
-
- elem = evt_value
-
- value = { }
- if "created" in evt_name:
- key = 'new'
- else:
- key = 'del'
- json_elem = elem.serialize(pool=self.pool.full_name)
- value[key] = json_elem,
- value = CodecFactory().getCodec('json').encode(('', value))
- self.set_attribute(elems_attr, value=value)
- #self.push_change_event('Elements', *value)
- elif evt_name == "elementschanged":
- # force the element list cache to be rebuild next time someone reads
- # the element list
- self.ElementsCache = None
-
- ms_name = self.macro_server.full_name
- new_values, changed_values, deleted_values = [], [], []
- for elem in evt_value['new']:
- json_elem = elem.serialize(macro_server=ms_name)
- new_values.append(json_elem)
- for elem in evt_value['change']:
- json_elem = elem.serialize(macro_server=ms_name)
- changed_values.append(json_elem)
- for elem in evt_value['del']:
- json_elem = elem.serialize(macro_server=ms_name)
- deleted_values.append(json_elem)
- value = { "new" : new_values, "change": changed_values,
- "del" : deleted_values }
- value = CodecFactory().getCodec('json').encode(('', value))
- self.set_attribute(elems_attr, value=value)
- #self.push_change_event('Elements', *value)
- elif evt_name == "environmentchanged":
- self.EnvironmentCache = None
- env_attr = multi_attr.get_attr_by_name("Environment")
- value = CodecFactory().getCodec('pickle').encode(('', evt_value))
- self.set_attribute(env_attr, value=value)
-
-
- def always_executed_hook(self):
- pass
-
- def read_attr_hardware(self,data):
- pass
-
- def read_DoorList(self, attr):
- door_names = self.macro_server.get_door_names()
- attr.set_value(door_names)
-
- @DebugIt()
- def read_MacroList(self, attr):
- macro_names = self.macro_server.get_macro_names()
- attr.set_value(macro_names)
-
- def read_MacroLibList(self, attr):
- macro_lib_names = self.macro_server.get_macro_lib_names()
- attr.set_value(macro_lib_names)
-
- def read_TypeList(self, attr):
- type_names = self.macro_server.get_data_type_names_with_asterisc()
- attr.set_value(type_names)
-
- #@DebugIt()
- def getElements(self, cache=True):
- value = self.ElementsCache
- if cache and value is not None:
- return value
- elements = self.macro_server.get_elements_info()
- value = dict(new=elements)
- value = CodecFactory().getCodec('json').encode(('', value))
- self.ElementsCache = value
- return value
-
- #@DebugIt()
- def read_Elements(self, attr):
- fmt, data = self.getElements()
- attr.set_value(fmt, data)
-
- def is_Elements_allowed(self, req_type):
- return SardanaServer.server_state == State.Running
-
- is_DoorList_allowed = \
- is_MacroList_allowed = \
- is_MacroLibList_allowed = \
- is_TypeList_allowed = is_Elements_allowed
-
- def GetMacroInfo(self, macro_names):
- """GetMacroInfo(list<string> macro_names):
-
- Returns a list of string containing macro information.
- Each string is a JSON encoded.
-
- Params:
- - macro_name: a list of strings with the macro(s) name(s)
- Returns:
- - a list of string containing macro information.
- """
- macro_server = self.macro_server
- codec = CodecFactory().getCodec('json')
- ret = [ codec.encode(('', macro.serialize()))[1]
- for macro in macro_server.get_macros()
- if macro.name in macro_names ]
- return ret
-
- def ReloadMacro(self, macro_names):
- """ReloadMacro(list<string> macro_names):"""
- try:
- for macro_name in macro_names:
- self.macro_server.reload_macro(macro_name)
- except MacroServerException, mse:
- Except.throw_exception(mse.type, mse.msg, 'ReloadMacro')
- return ['OK']
-
- def ReloadMacroLib(self, lib_names):
- """ReloadMacroLib(sequence<string> lib_names):
- """
- try:
- for lib_name in lib_names:
- self.macro_server.reload_macro_lib(lib_name)
- except MacroServerException, mse:
- Except.throw_exception(mse.type, mse.msg, 'ReloadMacroLib')
- return ['OK']
-
- def GetMacroCode(self, argin):
- """GetMacroCode(<module name> [, <macro name>]) -> full filename, code, line_nb
- """
- ret = self.macro_server.get_or_create_macro_lib(*argin)
- return map(str, ret)
-
- def SetMacroCode(self, argin):
- lib_name, code = argin[:2]
- auto_reload = True
- if len(argin) > 2:
- auto_reload = argin[2].lower() in ('true', 'yes')
- self.macro_server.set_macro_lib(lib_name, code, auto_reload=auto_reload)
-
- #@DebugIt()
- def getEnvironment(self, cache=True):
- value = self.EnvironmentCache
- if cache and value is not None:
- return value
- env = self.macro_server.get_env()
- value = dict(new=env)
- value = CodecFactory().getCodec('pickle').encode(('', value))
- self.EnvironmentCache = value
- return value
-
- def read_Environment(self, attr):
- fmt, data = self.getEnvironment()
- attr.set_value(fmt, data)
-
- def write_Environment(self, attr):
- data = attr.get_write_value()
- data = CodecFactory().getCodec('pickle').decode(data)[1]
- self.macro_server.change_env(data)
-
- def is_Environment_allowed(self, req_type):
- return True
-
-
-class MacroServerClass(SardanaDeviceClass):
- """MacroServer Tango class class"""
-
- # Class Properties
- class_property_list = {
- }
-
-
- DefaultEnvBaseDir = "/tmp/tango"
- DefaultEnvRelDir = "%(ds_exec_name)s/%(ds_inst_name)s/macroserver.properties"
-
- DefaultLogReportFormat = '%(levelname)-8s %(asctime)s: %(message)s'
-
- # Device Properties
- device_property_list = {
- 'PoolNames':
- [DevVarStringArray,
- "Sardana device pool device names",
- [] ],
- 'MacroPath':
- [DevVarStringArray,
- "list of directories to search for macros (path separators "
- "can be '\n' or ':')",
- [] ],
- 'PythonPath':
- [DevVarStringArray,
- "list of directories to be appended to sys.path at startup (path "
- "separators can be '\n' or ':')",
- [] ],
- 'MaxParallelMacros':
- [DevLong,
- "Maximum number of macros that can execute concurrently.",
- [10] ],
- 'EnvironmentDb':
- [DevString,
- "The environment database (usually a plain file).",
- os.path.join(DefaultEnvBaseDir, DefaultEnvRelDir) ],
- 'RConsolePort':
- [DevLong,
- "The rconsole port number",
- None ],
- 'LogReportFilename':
- [DevString,
- "Filename (absolute) which contains user log reports [default: "
- "None, meaning don't store log report messages]. The system will "
- "save old log files by appending extensions to the filename. The "
- "extensions are date-and-time based, using the strftime "
- "format %Y-%m-%d_%H-%M-%S or a leading portion thereof, "
- "depending on the rollover interval.",
- None ],
- 'LogReportFormat':
- [DevString,
- "Log report format [default: '%s']" % DefaultLogReportFormat,
- DefaultLogReportFormat],
- }
-
- # Command definitions
- cmd_list = {
- 'GetMacroInfo':
- [[DevVarStringArray, "Macro(s) name(s)"],
- [DevVarStringArray, "Macro(s) description(s)"]],
- 'ReloadMacro':
- [[DevVarStringArray, "Macro(s) name(s)"],
- [DevVarStringArray, "[OK] if successfull or a traceback " \
- "if there was a error (one string with complete traceback of " \
- "each error)"]],
- 'ReloadMacroLib':
- [[DevVarStringArray, "MacroLib(s) name(s)"],
- [DevVarStringArray, "[OK] if successfull or a traceback " \
- "if there was a error (one string with complete traceback of " \
- "each error)" ]],
- 'GetMacroCode':
- [[DevVarStringArray, "<MacroLib name> [, <Macro name>]"],
- [DevVarStringArray, "result is a sequence of 3 strings:\n"
- "<full path and file name>, <code>, <line number>" ]],
- 'SetMacroCode':
- [[DevVarStringArray, "<MacroLib name>, <code> [, <Auto reload>=True]\n" \
- "- if macro lib is a simple module name:\n" \
- " - if it exists, it is overwritten, otherwise a new python " \
- "file is created in the directory of the first element in "\
- "the MacroPath property" \
- "- if macro lib is the full path name:\n" \
- " - if path is not in the MacroPath, an exception is thrown" \
- " - if file exists it is overwritten otherwise a new file " \
- "is created"],
- [DevVoid, "" ]],
- }
-
- # Attribute definitions
- attr_list = {
- 'DoorList' : [ [ DevString, SPECTRUM, READ, 256 ] ],
- 'MacroList' : [ [ DevString, SPECTRUM, READ, 4096 ] ],
- 'MacroLibList' : [ [ DevString, SPECTRUM, READ, 1024 ] ],
- 'TypeList' : [ [ DevString, SPECTRUM, READ, 256 ] ],
- 'Elements' : [ [ DevEncoded, SCALAR, READ ],
- { 'label' : "Elements",
- 'description' : "the list of all elements "
- "(a JSON encoded dict)", } ],
- 'Environment' : [ [ DevEncoded, SCALAR, READ_WRITE],
- { 'label' : 'Environment',
- 'description' : "The macro server environment "
- "(a JSON encoded dict)", } ],
- }
-
diff --git a/src/sardana/tango/macroserver/__init__.py b/src/sardana/tango/macroserver/__init__.py
deleted file mode 100644
index 9a6c4dd2..00000000
--- a/src/sardana/tango/macroserver/__init__.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__docformat__ = 'restructuredtext'
-
-from .MacroServer import *
-from .Door import *
-
-def prepare_macroserver(util):
- import taurus.core.util.log
- Logger = taurus.core.util.log.Logger
-
- # Two additional log levels:
- # output of a macro
- Logger.addLevelName(15, "OUTPUT")
-
- def output(loggable, msg, *args, **kw):
- loggable.getLogObj().log(Logger.Output, msg, *args, **kw)
-
- Logger.output = output
-
- # result of a macro
- Logger.addLevelName(18, "RESULT")
-
- util.add_class(MacroServerClass, MacroServer)
- util.add_class(DoorClass, Door)
-
-def main_macroserver(args=None, start_time=None, mode=None):
- import sardana.tango.core.util
- return sardana.tango.core.util.run(prepare_macroserver, args=args,
- start_time=start_time, mode=mode)
-
-run = main_macroserver
diff --git a/src/sardana/tango/macroserver/test/__init__.py b/src/sardana/tango/macroserver/test/__init__.py
deleted file mode 100644
index 53c59696..00000000
--- a/src/sardana/tango/macroserver/test/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from macroexecutor import TangoMacroExecutor
diff --git a/src/sardana/tango/macroserver/test/macroexecutor.py b/src/sardana/tango/macroserver/test/macroexecutor.py
deleted file mode 100644
index efab7afa..00000000
--- a/src/sardana/tango/macroserver/test/macroexecutor.py
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import copy
-import threading
-import PyTango
-from sardana.macroserver.macros.test import BaseMacroExecutor
-from taurus.core.util.codecs import CodecFactory
-from sardana import sardanacustomsettings
-
-
-class TangoAttrCb(object):
-
- '''An abstract callback class for Tango events'''
-
- def __init__(self, tango_macro_executor):
- self._tango_macro_executor = tango_macro_executor
-
-
-class TangoResultCb(TangoAttrCb):
-
- '''Callback class for Tango events of the Result attribute'''
-
- def push_event(self, *args, **kwargs):
- '''callback method receiving the event'''
- event_data = args[0]
- if event_data.err:
- result = event_data.errors
- else:
- result = event_data.attr_value.value
- self._tango_macro_executor._result = result
-
-
-class TangoLogCb(TangoAttrCb):
-
- '''Callback class for Tango events of the log attributes
- e.g. Output, Error, Critical
- '''
-
- def __init__(self, tango_macro_executor, log_name):
- self._tango_macro_executor = tango_macro_executor
- self._log_name = log_name
-
- def push_event(self, *args, **kwargs):
- '''callback method receiving the event'''
- event_data = args[0]
- if event_data.attr_value:
- log = event_data.attr_value.value
- log_buffer_name = '_%s' % self._log_name
- log_buffer = getattr(self._tango_macro_executor, log_buffer_name)
- log_buffer.append(log)
- common_buffer = self._tango_macro_executor._common
- if common_buffer != None:
- common_buffer.append(log)
-
-
-class TangoStatusCb(TangoAttrCb):
-
- '''Callback class for Tango events of the MacroStatus attribute'''
-
- START_STATES = ['start']
- DONE_STATES = ['finish', 'stop', 'exception']
-
- def push_event(self, *args, **kwargs):
- '''callback method receiving the event'''
- event_data = args[0]
- if event_data.err:
- self._state_buffer = event_data.errors
- self._tango_macro_executor._done_event.set()
- # make sure we get it as string since PyTango 7.1.4 returns a buffer
- # object and json.loads doesn't support buffer objects (only str)
- attr_value = event_data.attr_value
- v = map(str, attr_value.value)
- if not len(v[1]):
- return
- fmt = v[0]
- codec = CodecFactory().getCodec(fmt)
-
- # make sure we get it as string since PyTango 7.1.4 returns a buffer
- # object and json.loads doesn't support buffer objects (only str)
- v[1] = str(v[1])
- fmt, data = codec.decode(v)
- for macro_status in data:
- state = macro_status['state']
- self._tango_macro_executor._exception = macro_status.get(
- 'exc_type')
- if state in self.START_STATES:
- #print 'TangoStatusCb.push_event: setting _started_event'
- self._tango_macro_executor._started_event.set()
- elif state in self.DONE_STATES:
- # print 'TangoStatusCb.push_event: setting _done_event %s'
- # %(state)
- self._tango_macro_executor._done_event.set()
- #else:
- # print 'State %s' %(state)
- self._tango_macro_executor._state_buffer.append(state)
-
-
-class TangoMacroExecutor(BaseMacroExecutor):
-
- '''
- Macro executor implemented using Tango communication with the Door device
- '''
-
- def __init__(self, door_name=None):
- super(TangoMacroExecutor, self).__init__()
- if door_name == None:
- door_name = getattr(sardanacustomsettings, 'UNITTEST_DOOR_NAME')
- self._door = PyTango.DeviceProxy(door_name)
- self._done_event = None
- self._started_event = None
-
- def _clean(self):
- '''Recreates threading Events in case the macro executor is reused.'''
- super(TangoMacroExecutor, self)._clean()
- self._started_event = threading.Event()
- self._done_event = threading.Event()
-
- def _run(self, macro_name, macro_params):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- # preaparing RunMacro command input arguments
- argin = copy.copy(macro_params)
- argin.insert(0, macro_name)
- # registering for MacroStatus events
- status_cb = TangoStatusCb(self)
- self._status_id = self._door.subscribe_event('macrostatus',
- PyTango.EventType.CHANGE_EVENT,
- status_cb)
- # executing RunMacro command
- self._door.RunMacro(argin)
-
- def _wait(self, timeout):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- #TODO: In case of timeout = inf if the macro excecutor run a macro
- # with wrong parameters it'll never awake of the done_event wait
- # Pending to remove this comment when Sardana resolves the bug.
- if self._done_event:
- self._done_event.wait(timeout)
- self._door.unsubscribe_event(self._status_id)
-
- def _stop(self, started_event_timeout=3.0):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- self._started_event.wait(started_event_timeout)
- try:
- self._door.StopMacro()
- except PyTango.DevFailed as e:
- raise Exception("Unable to Stop macro: %s" % e)
-
- def _registerLog(self, log_level):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- log_cb = TangoLogCb(self, log_level)
- id_log_name = '_%s_id' % log_level
- id_log = self._door.subscribe_event(log_level,
- PyTango.EventType.CHANGE_EVENT,
- log_cb)
- setattr(self, id_log_name, id_log)
-
- def _unregisterLog(self, log_level):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- id_log_name = '_%s_id' % log_level
- id_log = getattr(self, id_log_name)
- self._door.unsubscribe_event(id_log)
-
- def _registerResult(self):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- result_cb = TangoResultCb(self)
- self._result_id = self._door.subscribe_event('result',
- PyTango.EventType.CHANGE_EVENT,
- result_cb)
-
- def _unregisterResult(self):
- '''reimplemented from :class:`BaseMacroExecutor`'''
- self._door.unsubscribe_event(self._result_id)
-
- def getData(self):
- '''Returns the data object for the last executed macro
-
- :return: (obj)
- '''
- data = self._door.RecordData
- return CodecFactory().decode(data)
diff --git a/src/sardana/tango/pool/CTExpChannel.py b/src/sardana/tango/pool/CTExpChannel.py
deleted file mode 100644
index 749854a9..00000000
--- a/src/sardana/tango/pool/CTExpChannel.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["CTExpChannel", "CTExpChannelClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import DevFailed, DevVoid, DevDouble, DevState, AttrQuality, \
- Except, READ, SCALAR
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.tango.core.util import to_tango_type_format, exception_str
-
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class CTExpChannel(PoolElementDevice):
-
- def __init__(self, dclass, name):
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def get_ct(self):
- return self.element
-
- def set_ct(self, ct):
- self.element = ct
-
- ct = property(get_ct, set_ct)
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- ct = self.ct
- if ct is not None:
- ct.remove_listener(self.on_ct_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
-
- ct = self.ct
- if ct is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.ct = ct = \
- self.pool.create_element(type="CTExpChannel",
- name=name, full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id)
- if self.instrument is not None:
- ct.set_instrument(self.instrument)
- ct.add_listener(self.on_ct_changed)
-
- ## force a state read to initialize the state attribute
- #state = ct.state
- self.set_state(DevState.ON)
-
- def on_ct_changed(self, event_source, event_type, event_value):
- try:
- self._on_ct_changed(event_source, event_type, event_value)
- except not DevFailed:
- msg = 'Error occurred "on_ct_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.motor.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_ct_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- try:
- attr = self.get_attribute_by_name(name)
- except DevFailed:
- return
-
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
- else:
- value = event_value
-
- if name == "value":
- w_value = event_source.get_value_attribute().w_value
- state = self.ct.get_state()
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
-
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.ct.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For value attribute, listen to what the controller says for data
- # type (between long and float)
- value = std_attrs.get('value')
- if value is not None:
- _, data_info, attr_info = value
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
- return std_attrs, dyn_attrs
-
- def initialize_dynamic_attributes(self):
- attrs = PoolElementDevice.initialize_dynamic_attributes(self)
-
- detect_evts = "value",
- non_detect_evts = ()
-
- for attr_name in detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, True)
- for attr_name in non_detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, False)
-
- def read_Value(self, attr):
- ct = self.ct
- use_cache = ct.is_in_operation() and not self.Force_HW_Read
- value = ct.get_value(cache=use_cache, propagate=0)
- if value.error:
- Except.throw_python_exception(*value.exc_info)
- state = ct.get_state(cache=use_cache, propagate=0)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value.value, quality=quality,
- timestamp=value.timestamp, priority=0)
-
- def is_Value_allowed(self, req_type):
- if self.get_state() in [DevState.FAULT, DevState.UNKNOWN]:
- return False
- return True
-
- def Start(self):
- self.ct.start_acquisition()
-
-
-class CTExpChannelClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {}
-
- # Device Properties
- device_property_list = {}
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'Start' : [ [DevVoid, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {}
- attr_list.update(PoolElementDeviceClass.attr_list)
-
- standard_attr_list = {
- 'Value' : [ [ DevDouble, SCALAR, READ ],
- { 'abs_change' : '1.0', } ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "Counter/Timer device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/Controller.py b/src/sardana/tango/pool/Controller.py
deleted file mode 100644
index d355c012..00000000
--- a/src/sardana/tango/pool/Controller.py
+++ /dev/null
@@ -1,294 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["Controller", "ControllerClass"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from PyTango import Util, DevFailed, Except
-from PyTango import DevVoid, DevLong, DevString
-from PyTango import DevVarStringArray, DevVarLongArray
-from PyTango import DispLevel, DevState, AttrQuality
-from PyTango import SCALAR, SPECTRUM
-from PyTango import READ_WRITE, READ
-
-from taurus.core.util.log import DebugIt
-from taurus.core.util.containers import CaselessDict
-
-from sardana import DataType, DataFormat
-from sardana import State, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.tango.core.util import to_tango_attr_info
-
-from PoolDevice import PoolDevice, PoolDeviceClass
-
-
-def to_bool(s):
- return s.lower() == "true"
-
-
-class Controller(PoolDevice):
-
- def __init__(self, dclass, name):
- PoolDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolDevice.init(self, name)
-
- def get_ctrl(self):
- return self.element
-
- def set_ctrl(self, ctrl):
- self.element = ctrl
-
- ctrl = property(get_ctrl, set_ctrl)
-
- @DebugIt()
- def delete_device(self):
- PoolDevice.delete_device(self)
-
- @DebugIt()
- def init_device(self):
- PoolDevice.init_device(self)
-
- detect_evts = "state", "status"
- non_detect_evts = "elementlist",
- self.set_change_events(detect_evts, non_detect_evts)
- ctrl = self.ctrl
- if ctrl is None:
- role_ids = self.get_role_ids()
- full_name = self.get_full_name()
- name = self.alias or full_name
- args = dict(type=self.Type, name=name, full_name=full_name,
- library=self.Library, klass=self.Klass,
- id=self.Id, role_ids=role_ids,
- properties=self._get_ctrl_properties())
- ctrl = self.pool.create_controller(**args)
- ctrl.add_listener(self.on_controller_changed)
- self.ctrl = ctrl
- self.set_state(DevState.ON)
- #self.set_state(to_tango_state(ctrl.get_state()))
- #self.set_status(ctrl.get_status())
- else:
- ctrl.re_init()
-
- def get_role_ids(self):
- db = Util.instance().get_database()
- if db is None:
- return []
- role_ids = db.get_device_property(self.get_name(), ['motor_role_ids'])['motor_role_ids']
- if len(role_ids) == 0:
- role_ids = db.get_device_property(self.get_name(), ['counter_role_ids'])['counter_role_ids']
- if len(role_ids) == 0:
- role_ids = self.Role_ids
- role_ids = map(int, role_ids)
-
- return role_ids
-
- def _get_ctrl_properties(self):
- try:
- ctrl_info = self.pool.get_controller_class_info(self.Klass)
- prop_infos = ctrl_info.ctrl_properties
- except:
- return {}
- db = Util.instance().get_database()
-
- if db is None:
- return {}
-
- props = {}
- if prop_infos:
- props.update(db.get_device_property(self.get_name(), prop_infos.keys()))
- for p in props.keys():
- if len(props[p]) == 0: props[p] = None
-
- ret = {}
- missing_props = []
- for prop_name, prop_value in props.items():
- if prop_value is None:
- dv = prop_infos[prop_name].default_value
- if dv is None:
- missing_props.append(prop_name)
- ret[prop_name] = dv
- continue
- prop_info = prop_infos[prop_name]
- dtype, dformat = prop_info.dtype, prop_info.dformat
-
- op = str
- if dtype == DataType.Integer:
- op = int
- elif dtype == DataType.Double:
- op = float
- elif dtype == DataType.Boolean:
- op = to_bool
- prop_value = map(op, prop_value)
- if dformat == DataFormat.Scalar:
- prop_value = prop_value[0]
- ret[prop_name] = prop_value
-
- if missing_props:
- self.set_state(DevState.ALARM)
- missing_props = ", ".join(missing_props)
- self.set_status("Controller has missing properties: %s"
- % missing_props)
-
- return ret
-
- def always_executed_hook(self):
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def dev_state(self):
- if self.ctrl is None or not self.ctrl.is_online():
- return DevState.FAULT
- return DevState.ON
-
- def dev_status(self):
- if self.ctrl is None or not self.ctrl.is_online():
- self._status = self.ctrl.get_ctrl_error_str()
- else:
- self._status = PoolDevice.dev_status(self)
- return self._status
-
- def read_ElementList(self, attr):
- attr.set_value(self.get_element_names())
-
- def CreateElement(self, argin):
- pass
-
- def DeleteElement(self, argin):
- pass
-
- def get_element_names(self):
- elements = self.ctrl.get_elements()
- return [ elements[id].get_name() for id in sorted(elements) ]
-
- def on_controller_changed(self, event_src, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
- timestamp = time.time()
- name = event_type.name.lower()
- multi_attr = self.get_device_attr()
- try:
- attr = multi_attr.get_attr_by_name(name)
- except DevFailed:
- return
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- error = None
-
- if name == "state":
- event_value = self.calculate_tango_state(event_value)
- elif name == "status":
- event_value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- timestamp = event_value.timestamp
- event_value = event_value.value
- self.set_attribute(attr, value=event_value, timestamp=timestamp,
- quality=quality, priority=priority, error=error,
- synch=False)
-
- def get_dynamic_attributes(self):
- if hasattr(self, "_dynamic_attributes_cache"):
- return self._standard_attributes_cache, self._dynamic_attributes_cache
- info = self.ctrl.ctrl_info
- if info is None:
- self.warning("Controller %s doesn't have any information", self.ctrl)
- return PoolDevice.get_dynamic_attributes(self)
- self._dynamic_attributes_cache = dyn_attrs = CaselessDict()
- self._standard_attributes_cache = std_attrs = CaselessDict()
- for attr_name, attr_data in info.ctrl_attributes.items():
- name, tg_info = to_tango_attr_info(attr_name, attr_data)
- dyn_attrs[attr_name] = attr_name, tg_info, attr_data
- return std_attrs, dyn_attrs
-
- def read_DynamicAttribute(self, attr):
- attr_name = attr.get_name()
- attr.set_value(self.ctrl.get_ctrl_attr(attr_name))
-
- def write_DynamicAttribute(self, attr):
- v = attr.get_write_value()
- attr_name = attr.get_name()
- self.ctrl.set_ctrl_attr(attr_name, v)
-
- def read_LogLevel(self, attr):
- l = self.ctrl.get_log_level()
- self.debug(l)
- attr.set_value(l)
-
- def write_LogLevel(self, attr):
- self.ctrl.set_log_level(attr.get_write_value())
-
-
-class ControllerClass(PoolDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
- class_property_list.update(PoolDeviceClass.class_property_list)
-
- # Device Properties
- device_property_list = {
- 'Type': [DevString, "", None ],
- 'Library': [DevString, "", None ],
- 'Klass': [DevString, "", None ],
- 'Role_ids': [DevVarLongArray, "", [] ],
- }
- device_property_list.update(PoolDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'CreateElement': [ [DevVarStringArray, ""], [DevVoid, ""] ],
- 'DeleteElement': [ [DevString, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {
- 'ElementList': [ [DevString, SPECTRUM, READ, 4096] ],
- 'LogLevel': [ [DevLong, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'label' : "Log level",
- 'Display level' : DispLevel.EXPERT } ],
- }
- attr_list.update(PoolDeviceClass.attr_list)
-
- def _get_class_properties(self):
- ret = PoolDeviceClass._get_class_properties(self)
- ret['Description'] = "Controller device class"
- ret['InheritedFrom'].insert(0, 'PoolDevice')
- return ret
-
diff --git a/src/sardana/tango/pool/IORegister.py b/src/sardana/tango/pool/IORegister.py
deleted file mode 100644
index e961f64c..00000000
--- a/src/sardana/tango/pool/IORegister.py
+++ /dev/null
@@ -1,252 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["IORegister", "IORegisterClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import DevFailed, Except
-from PyTango import DevVoid, DevLong
-from PyTango import DevState, AttrQuality
-from PyTango import READ_WRITE, SCALAR
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.poolexception import PoolException
-from sardana.sardanautils import str_to_value
-
-from sardana.tango.core.util import exception_str, throw_sardana_exception
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class IORegister(PoolElementDevice):
-
- def __init__(self, dclass, name):
- self.in_write_value = False
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def get_ior(self):
- return self.element
-
- def set_ior(self, ior):
- self.element = ior
-
- ior = property(get_ior, set_ior)
-
- def set_write_value_to_db(self):
- value_attr = self.ior.get_value_attribute()
- if value_attr.has_write_value():
- data = dict(Value=dict(__value=value_attr.w_value, __value_ts=value_attr.w_timestamp))
- db = self.get_database()
- db.put_device_attribute_property(self.get_name(), data)
-
- def get_write_value_from_db(self):
- name = 'Value'
- db = self.get_database()
- val_props = db.get_device_attribute_property(self.get_name(), name)[name]
- w_val = val_props["__value"][0]
-
- _, _, attr_info = self.get_dynamic_attributes()[0][name]
- w_val = str_to_value(w_val, attr_info.dtype, attr_info.dformat)
-
- w_val, w_ts = int(val_props["__value"][0]), None
- if "__value_ts" in val_props:
- w_ts = float(val_props["__value_ts"][0])
- return w_val, w_ts
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- ior = self.ior
- if ior is not None:
- ior.remove_listener(self.on_ior_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
-
- ior = self.ior
- if ior is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.ior = ior = \
- self.pool.create_element(type="IORegister", name=name,
- full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id)
- if self.instrument is not None:
- ior.set_instrument(self.instrument)
- ior.add_listener(self.on_ior_changed)
-
- ## force a state read to initialize the state attribute
- #state = ior.get_state(cache=False)
- self.set_state(DevState.ON)
-
- def on_ior_changed(self, event_source, event_type, event_value):
- try:
- self._on_ior_changed(event_source, event_type, event_value)
- except not DevFailed:
- msg = 'Error occurred "on_ior_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.ior.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_ior_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- if name == "w_value" and not self.in_write_value:
- self.debug("Storing value set point: %s", self.ior.value.w_value)
- self.set_write_value_to_db()
- return
-
- multi_attr = self.get_device_attr()
- try:
- attr = multi_attr.get_attr_by_name(name)
- except DevFailed:
- return
-
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
- state = self.ior.get_state(propagate=0)
-
- if name == "value":
- w_value = event_source.get_value_attribute().w_value
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.ior.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def initialize_dynamic_attributes(self):
- attrs = PoolElementDevice.initialize_dynamic_attributes(self)
-
- detect_evts = "value",
- non_detect_evts = ()
-
- for attr_name in detect_evts:
- if attrs.has_key(attr_name):
- self.set_change_event(attr_name, True, True)
- for attr_name in non_detect_evts:
- if attrs.has_key(attr_name):
- self.set_change_event(attr_name, True, False)
- return
-
- def read_Value(self, attr):
- value = self.ior.get_value(cache=False)
- if value.error:
- Except.throw_python_exception(*value.exc_info)
- self.set_attribute(attr, value=value.value, w_value=value.w_value,
- priority=0, timestamp=value.timestamp)
-
- def write_Value(self, attr):
- self.in_write_value = True
- value = attr.get_write_value()
- try:
- self.ior.set_value(value)
- # manually store write value in the database
- self.set_write_value_to_db()
- except PoolException as pe:
- throw_sardana_exception(pe)
- finally:
- self.in_write_value = False
-
- def is_Value_allowed(self, req_type):
- if self.get_state() in [DevState.FAULT, DevState.UNKNOWN]:
- return False
- return True
-
- def Start(self):
- self.ior.start_acquisition()
-
-
-class IORegisterClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'Start' : [ [DevVoid, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {}
- attr_list.update(PoolElementDeviceClass.attr_list)
-
- standard_attr_list = {
- 'Value' : [ [ DevLong, SCALAR, READ_WRITE ],
- { 'Memorized' : "true_without_hard_applied", }, ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "IORegister device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/MeasurementGroup.py b/src/sardana/tango/pool/MeasurementGroup.py
deleted file mode 100644
index 378e4251..00000000
--- a/src/sardana/tango/pool/MeasurementGroup.py
+++ /dev/null
@@ -1,250 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The sardana tango measurement group module"""
-
-__all__ = ["MeasurementGroup", "MeasurementGroupClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import Except, DevVoid, DevLong, DevDouble, DevString, \
- DispLevel, DevState, AttrQuality, \
- READ_WRITE, SCALAR
-
-from taurus.core.util.codecs import CodecFactory
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool import AcqMode
-from sardana.tango.core.util import exception_str
-from sardana.tango.pool.PoolDevice import PoolGroupDevice, PoolGroupDeviceClass
-
-
-class MeasurementGroup(PoolGroupDevice):
-
- def __init__(self, dclass, name):
- PoolGroupDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolGroupDevice.init(self, name)
-
- def get_measurement_group(self):
- return self.element
-
- def set_measurement_group(self, measurement_group):
- self.element = measurement_group
-
- measurement_group = property(get_measurement_group, set_measurement_group)
-
- @DebugIt()
- def delete_device(self):
- PoolGroupDevice.delete_device(self)
- mg = self.measurement_group
- if mg is not None:
- mg.remove_listener(self.on_measurement_group_changed)
-
- @DebugIt()
- def init_device(self):
- PoolGroupDevice.init_device(self)
-
- detect_evts = () # state and status are already set by the super class
- non_detect_evts = "configuration", "integrationtime", "monitorcount", \
- "acquisitionmode", "elementlist"
- self.set_change_events(detect_evts, non_detect_evts)
-
- self.Elements = list(self.Elements)
- for i in range(len(self.Elements)):
- try:
- self.Elements[i] = int(self.Elements[i])
- except:
- pass
- mg = self.measurement_group
- if mg is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.measurement_group = mg = \
- self.pool.create_measurement_group(name=name,
- full_name=full_name, id=self.Id,
- user_elements=self.Elements)
- mg.add_listener(self.on_measurement_group_changed)
-
- # force a state read to initialize the state attribute
- #state = self.measurement_group.state
- self.set_state(DevState.ON)
-
- def on_measurement_group_changed(self, event_source, event_type, event_value):
- try:
- self._on_measurement_group_changed(event_source, event_type, event_value)
- except:
- msg = 'Error occured "on_measurement_group_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.measurement_group.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_measurement_group_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name
- name = name.replace('_', '')
- multi_attr = self.get_device_attr()
- attr = multi_attr.get_attr_by_name(name)
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- error = None
-
- if name == "state":
- event_value = self.calculate_tango_state(event_value)
- elif name == "status":
- event_value = self.calculate_tango_status(event_value)
- elif name == "acquisitionmode":
- event_value = AcqMode.whatis(event_value)
- elif name == "configuration":
- cfg = self.measurement_group.get_user_configuration()
- codec = CodecFactory().getCodec('json')
- _, event_value = codec.encode(('', cfg))
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- timestamp = event_value.timestamp
- event_value = event_value.value
-
- self.set_attribute(attr, value=event_value, timestamp=timestamp,
- quality=quality, priority=priority, error=error,
- synch=False)
-
- def always_executed_hook(self):
- pass
- #state = to_tango_state(self.motor_group.get_state(cache=False))
-
- def read_attr_hardware(self, data):
- pass
-
- def read_IntegrationTime(self, attr):
- it = self.measurement_group.integration_time
- if it is None:
- it = float('nan')
- attr.set_value(it)
-
- def write_IntegrationTime(self, attr):
- self.measurement_group.integration_time = attr.get_write_value()
-
- def read_MonitorCount(self, attr):
- it = self.measurement_group.monitor_count
- if it is None:
- it = 0
- attr.set_value(it)
-
- def write_MonitorCount(self, attr):
- self.measurement_group.monitor_count = attr.get_write_value()
-
- def read_AcquisitionMode(self, attr):
- acq_mode = self.measurement_group.acquisition_mode
- acq_mode_str = AcqMode.whatis(acq_mode)
- attr.set_value(acq_mode_str)
-
- def write_AcquisitionMode(self, attr):
- acq_mode_str = attr.get_write_value()
- try:
- acq_mode = AcqMode.lookup[acq_mode_str]
- except KeyError:
- raise Exception("Invalid acquisition mode. Must be one of " + \
- ", ".join(AcqMode.keys()))
- self.measurement_group.acquisition_mode = acq_mode
-
- def read_Configuration(self, attr):
- cfg = self.measurement_group.get_user_configuration()
- codec = CodecFactory().getCodec('json')
- data = codec.encode(('', cfg))
- attr.set_value(data[1])
-
- def write_Configuration(self, attr):
- data = attr.get_write_value()
- cfg = CodecFactory().decode(('json', data), ensure_ascii=True)
- self.measurement_group.set_configuration_from_user(cfg)
-
- def Start(self):
- try:
- self.wait_for_operation()
- except:
- raise Exception("Cannot acquire: already involved in an operation")
- self.measurement_group.start_acquisition()
-
- def StartMultiple(self, n):
- try:
- self.wait_for_operation()
- except:
- raise Exception("Cannot acquire: already involved in an operation")
- self.measurement_group.start_acquisition(multiple=n)
-
-class MeasurementGroupClass(PoolGroupDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- }
- device_property_list.update(PoolGroupDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'Start': [ [DevVoid, ""], [DevVoid, ""] ],
- 'StartMultiple': [ [DevLong, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolGroupDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {
- 'IntegrationTime': [ [DevDouble, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.OPERATOR } ],
- 'MonitorCount': [ [DevLong, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.OPERATOR } ],
- 'AcquisitionMode': [ [DevString, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.OPERATOR } ],
- 'Configuration': [ [DevString, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.EXPERT } ],
- }
- attr_list.update(PoolGroupDeviceClass.attr_list)
-
- def _get_class_properties(self):
- ret = PoolGroupDeviceClass._get_class_properties(self)
- ret['Description'] = "Measurement group device class"
- ret['InheritedFrom'].insert(0, 'PoolGroupDevice')
- return ret
diff --git a/src/sardana/tango/pool/Motor.py b/src/sardana/tango/pool/Motor.py
deleted file mode 100644
index 1b7111b0..00000000
--- a/src/sardana/tango/pool/Motor.py
+++ /dev/null
@@ -1,683 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The sardana tango motor module"""
-
-__all__ = ["Motor", "MotorClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import DevFailed, Except, DevVoid, DevShort, \
- DevLong, DevDouble, DevBoolean, DispLevel, DevState, AttrQuality, \
- READ, READ_WRITE, SCALAR, SPECTRUM
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanautils import str_to_value
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.poolexception import PoolException
-from sardana.tango.core.util import memorize_write_attribute, exception_str, \
- to_tango_type_format, throw_sardana_exception
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class Motor(PoolElementDevice):
- """The tango motor device class. This class exposes through a tango device
-the sardana motor (:class:`~sardana.pool.poolmotor.PoolMotor`).
-
-.. rubric:: The states
-
-The motor interface knows five states which are ON, MOVING, ALARM,
-FAULT and UNKNOWN. A motor device is in MOVING state when it is
-moving! It is in ALARM state when it has reached one of the limit
-switches and is in FAULT if its controller software is not available
-(impossible to load it) or if a fault is reported from the hardware
-controller. The motor is in the UNKNOWN state if an exception occurs
-during the communication between the pool and the hardware controller.
-When the motor is in ALARM state, its status will indicate which limit
-switches is active.
-
-.. rubric:: The commands
-
-The motor interface supports 3 commands on top of the Tango classical
-Init, State and Status commands. These commands are summarized in the
-following table:
-
-============== ================ ================
-Command name Input data type Output data type
-============== ================ ================
-Stop void void
-Abort void void
-DefinePosition Tango::DevDouble void
-SaveConfig void void
-============== ================ ================
-
-- **Stop** : It stops a running motion. This command does not have input or
- output argument.
-
-- **Abort** : It aborts a running motion. This command does not have input or
- output argument.
-
-- **DefinePosition** : Loads a position into controller. It has one input
- argument which is the new position value (a double). It is allowed only in
- the ON or ALARM states. The unit used for the command input value is the
- physical unit: millimeters or milli-radians. It is always an absolute
- position.
-
-- **SaveConfig** : Write some of the motor parameters in database. Today, it
- writes the motor acceleration, deceleration, base_rate and velocity into
- database as motor device properties. It is allowed only in the ON or ALARM
- states
-
-The classical Tango Init command destroys the motor and re-create it.
-
-.. rubric:: The attributes
-
-The motor interface supports several attributes which are summarized
-in the following table:
-
-============== ================= =========== ======== ========= ===============
-Name Data type Data format Writable Memorized Operator/Expert
-============== ================= =========== ======== ========= ===============
-Position Tango::DevDouble Scalar R/W No * Operator
-DialPosition Tango::DevDouble Scalar R No Expert
-Offset Tango::DevDouble Scalar R/W Yes Expert
-Acceleration Tango::DevDouble Scalar R/W No Expert
-Base_rate Tango::DevDouble Scalar R/W No Expert
-Deceleration Tango::DevDouble Scalar R/W No Expert
-Velocity Tango::DevDouble Scalar R/W No Expert
-Limit_Switches Tango::DevBoolean Spectrum R No Expert
-SimulationMode Tango::DevBoolean Scalar R No Expert
-Step_per_unit Tango::DevDouble Scalar R/W Yes Expert
-Backlash Tango::DevLong Scalar R/W Yes Expert
-============== ================= =========== ======== ========= ===============
-
-- **Position** : This is read-write scalar double attribute. With the classical
- Tango min and max_value attribute properties, it is easy to define
- authorized limit for this attribute. See the definition of the
- DialPosition and Offset attributes to get a precise definition of the
- meaning of this attribute. It is not allowed to read or write this
- attribute when the motor is in FAULT or UNKNOWN state. It is also not
- possible to write this attribute when the motor is already MOVING.
- The unit used for this attribute is the physical unit: millimeters or
- milli-radian. It is always an **absolute position** .
-
-- **DialPosition** : This attribute is the motor dial position. The following
- formula links together the Position, DialPosition, Sign and Offset attributes:
-
- Position = Sign * DialPosition + Offset
-
- This allows to have the motor position centered around any position
- defined by the Offset attribute (classically the X ray beam position).
- It is a read only attribute. To set the motor position, the user has
- to use the Position attribute. It is not allowed to read this
- attribute when the motor is in FAULT or UNKNOWN mode. The unit used
- for this attribute is the physical unit: millimeters or milli-radian.
- It is also always an **absolute** position.
-
-- **Offset** : The offset to be applied in the motor position computation. By
- default set to 0. It is a memorized attribute. It is not allowed to
- read or write this attribute when the motor is in FAULT, MOVING or
- UNKNOWN mode.
-
-- **Acceleration** : This is an expert read-write scalar double attribute.
- This parameter value is written in database when the SaveConfig command is
- executed. It is not allowed to read or write this attribute when the motor is
- in FAULT or UNKNOWN state.
-
-- **Deceleration** : This is an expert read-write scalar double attribute.
- This parameter value is written in database when the SaveConfig command is
- executed. It is not allowed to read or write this attribute when the motor is
- in FAULT or UNKNOWN state.
-
-- **Base_rate** : This is an expert read-write scalar double attribute. This
- parameter value is written in database when the SaveConfig command is executed.
- It is not allowed to read or write this attribute when the motor is in
- FAULT or UNKNOWN state.
-
-- **Velocity** : This is an expert read-write scalar double attribute.
- This parameter value is written in database when the SaveConfig command is
- executed. It is not allowed to read or write this attribute when the motor is
- in FAULT or UNKNOWN state.
-
-- **Limit_Switches** : Three limit switches are managed by this attribute.
- Each of the switch are represented by a boolean value: False means inactive
- while True means active. It is a read only attribute. It is not possible to
- read this attribute when the motor is in UNKNOWN mode. It is a
- spectrum attribute with 3 values which are:
-
- - Data[0] : The Home switch value
-
- - Data[1] : The Upper switch value
-
- - Data[2] : The Lower switch value
-
-- **SimulationMode** : This is a read only scalar boolean attribute. When set,
- all motion requests are not forwarded to the software controller and then to
- the hardware. When set, the motor position is simulated and is immediately
- set to the value written by the user. To set this attribute, the user
- has to used the pool device Tango interface. The value of the
- position, acceleration, deceleration, base_rate, velocity and offset
- attributes are memorized at the moment this attribute is set. When
- this mode is turned off, if the value of any of the previously
- memorized attributes has changed, it is reapplied to the memorized
- value. It is not allowed to read this attribute when the motor is in
- FAULT or UNKNOWN states.
-
-- **Step_per_unit** : This is the number of motor step per millimeter or per
- degree. It is a memorized attribute. It is not allowed to read or write this
- attribute when the motor is in FAULT or UNKNOWN mode. It is also not
- allowed to write this attribute when the motor is MOVING. The default
- value is 1.
-
-- **Backlash** : If this attribute is defined to something different than 0,
- the motor will always stop the motion coming from the same mechanical
- direction. This means that it could be possible to ask the motor to go
- a little bit after the desired position and then to return to the
- desired position. The attribute value is the number of steps the motor
- will pass the desired position if it arrives from the "wrong"
- direction. This is a signed value. If the sign is positive, this means
- that the authorized direction to stop the motion is the increasing
- motor position direction. If the sign is negative, this means that the
- authorized direction to stop the motion is the decreasing motor
- position direction. It is a memorized attribute. It is not allowed to
- read or write this attribute when the motor is in FAULT or UNKNOWN
- mode. It is also not allowed to write this attribute when the motor is
- MOVING. Some hardware motor controllers are able to manage this
- backlash feature. If it is not the case, the motor interface will
- implement this behavior.
-
-All the motor devices will have the already described attributes but
-some hardware motor controller supports other features which are not
-covered by this list of pre-defined attributes. Using Tango dynamic
-attribute creation, a motor device may have extra attributes used to
-get/set the motor hardware controller specific features. These are the
-attributes specified on the controller with
-:attr:`~sardana.pool.controller.Controller.axis_attribues`.
-
-.. rubric:: The properties
-
-- **Sleep_before_last_read** : This property exposes the motor
- *instability time*. It defines the time in milli-second that the software
- managing a motor movement will wait between it detects the end of the
- motion and the last motor position reading.
-
-.. rubric:: Getting motor state and limit switches using event
-
-The simplest way to know if a motor is moving is to survey its state.
-If the motor is moving, its state will be MOVING. When the motion is
-over, its state will be back to ON (or ALARM if a limit switch has
-been reached). The pool motor interface allows client interested by
-motor state or motor limit switches value to use the Tango event
-system subscribing to motor state change event. As soon as a motor
-starts a motion, its state is changed to MOVING and an event is sent.
-As soon as the motion is over, the motor state is updated ans another
-event is sent. In the same way, as soon as a change in the limit
-switches value is detected, a change event is sent to client(s) which
-have subscribed to change event on the Limit_Switches attribute.
-
-
-.. rubric:: Reading the motor position attribute
-
-For each motor, the key attribute is its position. Special care has
-been taken on this attribute management. When the motor is not moving,
-reading the Position attribute will generate calls to the controller
-and therefore hardware access. When the motor is moving, its position
-is automatically read every 100 milli-seconds and stored in the Tango
-polling buffer. This means that a client reading motor Position
-attribute while the motor is moving will get the position from the
-Tango polling buffer and will not generate extra controller calls. It
-is also possible to get a motor position using the Tango event system.
-When the motor is moving, an event is sent to the registered clients
-when the change event criterion is true. By default, this change event
-criterion is set to be a difference in position of 5. It is tunable on
-a motor basis using the classical motor Position attribute abs_change
-property or at the pool device basis using its DefaultMotPos_AbsChange
-property. Anyway, not more than 10 events could be sent by second.
-Once the motion is over, the motor position is made unavailable from
-the Tango polling buffer and is read a last time after a tunable
-waiting time (Sleep_bef_last_read property). A forced change event
-with this value is sent to clients using events.
- """
-
- def __init__(self, dclass, name):
- """Constructor"""
- self.in_write_position = False
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def _is_allowed(self, req_type):
- return PoolElementDevice._is_allowed(self, req_type)
-
- def get_motor(self):
- return self.element
-
- def set_motor(self, motor):
- self.element = motor
-
- motor = property(get_motor, set_motor)
-
- def set_write_dial_position_to_db(self):
- dial = self.motor.get_dial_position_attribute()
- if dial.has_write_value():
- data = dict(DialPosition=dict(__value=dial.w_value, __value_ts=dial.w_timestamp))
- db = self.get_database()
- db.put_device_attribute_property(self.get_name(), data)
-
- def get_write_dial_position_from_db(self):
- name = 'DialPosition'
- db = self.get_database()
- pos_props = db.get_device_attribute_property(self.get_name(), name)[name]
- w_pos = pos_props["__value"][0]
-
- _, _, attr_info = self.get_dynamic_attributes()[0][name]
- w_pos = str_to_value(w_pos, attr_info.dtype, attr_info.dformat)
-
- w_pos, w_ts = float(pos_props["__value"][0]), None
- if "__value_ts" in pos_props:
- w_ts = float(pos_props["__value_ts"][0])
- return w_pos, w_ts
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- motor = self.motor
- if motor is not None:
- motor.remove_listener(self.on_motor_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
- motor = self.motor
- if motor is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.motor = motor = \
- self.pool.create_element(type="Motor", name=name,
- full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id)
- if self.instrument is not None:
- motor.set_instrument(self.instrument)
- # if in constructor, for all memorized no init attributes (position)
- # let poolmotor know their write values
- if self.in_constructor:
- try:
- w_pos, w_ts = self.get_write_dial_position_from_db()
- self.in_write_position = True
- try:
- motor.set_write_position(w_pos, timestamp=w_ts)
- finally:
- self.in_write_position = False
- except KeyError:
- pass
-
- if self.Sleep_bef_last_read > 0:
- motor.set_instability_time(self.Sleep_bef_last_read / 1000.0)
- motor.add_listener(self.on_motor_changed)
- self.set_state(DevState.ON)
-
- def on_motor_changed(self, event_source, event_type, event_value):
- try:
- self._on_motor_changed(event_source, event_type, event_value)
- except not DevFailed:
- msg = 'Error occurred "on_motor_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.motor.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_motor_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- if name == "w_position" and not self.in_write_position:
- self.debug("Storing dial set point: %s", self.motor.dial_position.w_value)
- self.set_write_dial_position_to_db()
- return
-
- try:
- attr = self.get_attribute_by_name(name)
- except DevFailed:
- return
-
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
- else:
- value = event_value
- state = self.motor.get_state(propagate=0)
-
- if name == "position":
- w_value = event_source.get_position_attribute().w_value
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- elif name == "dialposition" and state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
-
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For position attribute, listen to what the controller says for data
- # type (between long and float)
- pos = std_attrs.get('position')
- if pos is not None:
- _, data_info, attr_info = pos
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
- return std_attrs, dyn_attrs
-
- def initialize_dynamic_attributes(self):
- attrs = PoolElementDevice.initialize_dynamic_attributes(self)
-
- detect_evts = "position", "dialposition",
- non_detect_evts = "limit_switches", "step_per_unit", "offset", \
- "sign", "velocity", "acceleration", "deceleration", "base_rate", \
- "backlash"
-
- for attr_name in detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, True)
- for attr_name in non_detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, False)
-
- def read_Position(self, attr):
- motor = self.motor
- use_cache = motor.is_in_operation() and not self.Force_HW_Read
- state = motor.get_state(cache=use_cache, propagate=0)
- position = motor.get_position(cache=use_cache, propagate=0)
- if position.error:
- Except.throw_python_exception(*position.exc_info)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=position.value, w_value=position.w_value,
- quality=quality, priority=0,
- timestamp=position.timestamp)
-
- def write_Position(self, attr):
- self.in_write_position = True
- position = attr.get_write_value()
- try:
- self.info("write_Position(%s)", position)
- try:
- self.wait_for_operation()
- except:
- raise Exception("Cannot move: already in motion")
- try:
- self.motor.position = position
- except PoolException, pe:
- throw_sardana_exception(pe)
-
- # manually store write dial position in the database
- self.set_write_dial_position_to_db()
- finally:
- self.in_write_position = False
-
- def read_Acceleration(self, attr):
- attr.set_value(self.motor.get_acceleration(cache=False))
-
- @memorize_write_attribute
- def write_Acceleration(self, attr):
- self.motor.acceleration = attr.get_write_value()
-
- def read_Deceleration(self, attr):
- attr.set_value(self.motor.get_deceleration(cache=False))
-
- @memorize_write_attribute
- def write_Deceleration(self, attr):
- self.motor.deceleration = attr.get_write_value()
-
- def read_Base_rate(self, attr):
- attr.set_value(self.motor.get_base_rate(cache=False))
-
- @memorize_write_attribute
- def write_Base_rate(self, attr):
- self.motor.base_rate = attr.get_write_value()
-
- def read_Velocity(self, attr):
- attr.set_value(self.motor.get_velocity(cache=False))
-
- @memorize_write_attribute
- def write_Velocity(self, attr):
- self.motor.velocity = attr.get_write_value()
-
- def read_Offset(self, attr):
- attr.set_value(self.motor.get_offset(cache=False).value)
-
- @memorize_write_attribute
- def write_Offset(self, attr):
- self.motor.offset = attr.get_write_value()
-
- def read_DialPosition(self, attr):
- motor = self.motor
- use_cache = motor.is_in_operation() and not self.Force_HW_Read
- state = motor.get_state(cache=use_cache, propagate=0)
- dial_position = motor.get_dial_position(cache=use_cache, propagate=0)
- if dial_position.error:
- Except.throw_python_exception(*dial_position.exc_info)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=dial_position.value, quality=quality,
- priority=0, timestamp=dial_position.timestamp)
-
- def read_Step_per_unit(self, attr):
- attr.set_value(self.motor.get_step_per_unit(cache=False))
-
- @memorize_write_attribute
- def write_Step_per_unit(self, attr):
- step_per_unit = attr.get_write_value()
- self.motor.step_per_unit = step_per_unit
-
- def read_Backlash(self, attr):
- attr.set_value(self.motor.get_backlash(cache=False))
-
- @memorize_write_attribute
- def write_Backlash(self, attr):
- self.motor.backlash = attr.get_write_value()
-
- def read_Sign(self, attr):
- sign = self.motor.get_sign(cache=False).value
- attr.set_value(sign)
-
- @memorize_write_attribute
- def write_Sign(self, attr):
- self.motor.sign = attr.get_write_value()
-
- def read_Limit_switches(self, attr):
- motor = self.motor
- use_cache = motor.is_in_operation() and not self.Force_HW_Read
- limit_switches = motor.get_limit_switches(cache=use_cache)
- self.set_attribute(attr, value=limit_switches.value, priority=0,
- timestamp=limit_switches.timestamp)
-
- def DefinePosition(self, argin):
- self.motor.define_position(argin)
-
- # update write value of position attribute
- pos_attr = self.get_wattribute_by_name("position")
- pos_attr.set_write_value(argin)
-
- def is_DefinePosition_allowed(self):
- if self.get_state() in (DevState.FAULT, DevState.MOVING,
- DevState.UNKNOWN):
- return False
- return True
-
- def SaveConfig(self):
- raise NotImplementedError
-
- def is_SaveConfig_allowed(self):
- if self.get_state() in (DevState.FAULT, DevState.MOVING,
- DevState.UNKNOWN):
- return False
- return True
-
- def MoveRelative(self, argin):
- raise NotImplementedError
-
- def is_MoveRelative_allowed(self):
- if self.get_state() in (DevState.FAULT, DevState.MOVING,
- DevState.UNKNOWN):
- return False
- return True
-
- def get_attributes_to_restore(self):
- """Make sure position is the last attribute to restore"""
- restore_attributes = PoolElementDevice.get_attributes_to_restore(self)
- try:
- restore_attributes.remove('Position')
- restore_attributes.append('Position')
- except ValueError:
- pass
- return restore_attributes
-
- is_Position_allowed = _is_allowed
- is_Acceleration_allowed = _is_allowed
- is_Deceleration_allowed = _is_allowed
- is_Base_rate_allowed = _is_allowed
- is_Velocity_allowed = _is_allowed
- is_Offset_allowed = _is_allowed
- is_DialPosition_allowed = _is_allowed
- is_Step_per_unit_allowed = _is_allowed
- is_Backlash_allowed = _is_allowed
- is_Sign_allowed = _is_allowed
- is_Limit_switches_allowed = _is_allowed
-
-
-class MotorClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- 'Sleep_bef_last_read' : [DevLong,
- "Number of mS to sleep before the last read during a motor "
- "movement", 0],
- '_Acceleration' : [DevDouble, "", -1],
- '_Deceleration' : [DevDouble, "", -1],
- '_Velocity' : [DevDouble, "", -1],
- '_Base_rate' : [DevDouble, "", -1],
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'DefinePosition' : [ [DevDouble, "New position"], [DevVoid, ""] ],
- 'SaveConfig' : [ [DevVoid, ""], [DevVoid, ""] ],
- 'MoveRelative' : [ [DevDouble, "amount to move"], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {}
- attr_list.update(PoolElementDeviceClass.attr_list)
-
- standard_attr_list = {
- 'Position' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'abs_change' : '1.0', } ],
- 'Acceleration' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'Memorized' : "true", } ],
- 'Deceleration' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'Memorized' : "true", } ],
- 'Base_rate' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'Memorized' : "true",
- 'label' : 'Base rate', } ],
- 'Velocity' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'Memorized' : "true", } ],
- 'Offset' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.EXPERT } ],
- 'DialPosition' : [ [ DevDouble, SCALAR, READ ],
- { 'label' : "Dial position",
- 'Display level' : DispLevel.EXPERT } ],
- 'Step_per_unit': [ [ DevDouble, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'label' : "Steps p/ unit",
- 'Display level' : DispLevel.EXPERT } ],
- 'Backlash' : [ [ DevLong, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.EXPERT } ],
- 'Sign' : [ [ DevShort, SCALAR, READ_WRITE],
- { 'Memorized' : "true",
- 'Display level' : DispLevel.EXPERT } ],
- 'Limit_switches': [ [ DevBoolean, SPECTRUM, READ, 3],
- { 'label' : "Limit switches (H,U,L)",
- 'description' : "This attribute is the motor "\
- "limit switches state. It's an array with 3 \n"\
- "elements which are:\n"\
- "0 - The home switch\n"\
- "1 - The upper limit switch\n"\
- "2 - The lower limit switch\n"\
- "False means not active. True means active" } ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "Motor device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/MotorGroup.py b/src/sardana/tango/pool/MotorGroup.py
deleted file mode 100644
index 482fd74e..00000000
--- a/src/sardana/tango/pool/MotorGroup.py
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["MotorGroup", "MotorGroupClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import Except, DevState, DevDouble, AttrQuality, READ_WRITE, \
- SPECTRUM
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.poolexception import PoolException
-from sardana.tango.core.util import exception_str, throw_sardana_exception
-from sardana.tango.pool.PoolDevice import PoolGroupDevice, PoolGroupDeviceClass
-
-
-class MotorGroup(PoolGroupDevice):
-
- def __init__(self, dclass, name):
- self.in_write_position = False
- PoolGroupDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolGroupDevice.init(self, name)
-
- def _is_allowed(self, req_type):
- return PoolGroupDevice._is_allowed(self, req_type)
-
- def get_motor_group(self):
- return self.element
-
- def set_motor_group(self, motor_group):
- self.element = motor_group
-
- motor_group = property(get_motor_group, set_motor_group)
-
- @DebugIt()
- def delete_device(self):
- PoolGroupDevice.delete_device(self)
- motor_group = self.motor_group
- if motor_group is not None:
- motor_group.remove_listener(self.on_motor_group_changed)
-
- @DebugIt()
- def init_device(self):
- PoolGroupDevice.init_device(self)
- detect_evts = "position",
- non_detect_evts = "elementlist",
- self.set_change_events(detect_evts, non_detect_evts)
- self.Elements = map(int, self.Elements)
- motor_group = self.motor_group
- if motor_group is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.motor_group = motor_group = \
- self.pool.create_motor_group(name=name, id=self.Id,
- full_name=full_name, user_elements=self.Elements)
- motor_group.add_listener(self.on_motor_group_changed)
- self.set_state(DevState.ON)
-
- def on_motor_group_changed(self, event_source, event_type, event_value):
- try:
- self._on_motor_group_changed(event_source, event_type, event_value)
- except:
- msg = 'Error occurred "on_motor_group_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.motor_group.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_motor_group_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- attr = self.get_attribute_by_name(name)
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
- else:
- value = event_value
-
- state = self.motor_group.get_state(propagate=0)
-
- if name == "position":
- w_value = event_value.w_value
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
-
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- pass
- #state = to_tango_state(self.motor_group.get_state(cache=False))
-
- def read_attr_hardware(self, data):
- pass
-
- def _to_motor_positions(self, pos):
- positions = []
- for elem in self.motor_group.get_user_elements():
- position = pos[elem]
- if position.in_error():
- Except.throw_python_exception(*position.exc_info)
- positions.append(position.value)
- return positions
-
- def _to_motor_write_positions(self, pos):
- w_positions = []
- for elem in self.motor_group.get_user_elements():
- position = pos[elem]
- if position.in_error():
- Except.throw_python_exception(*position.exc_info)
- w_positions.append(position.w_value)
- return w_positions
-
- def read_Position(self, attr):
- # if motors are moving their position is already being updated with a
- # high frequency so don't bother overloading and just get the cached
- # values
- motor_group = self.motor_group
- use_cache = motor_group.is_in_operation() and not self.Force_HW_Read
- position = motor_group.get_position(cache=use_cache, propagate=0)
- if position.error:
- Except.throw_python_exception(*position.exc_info)
- state = motor_group.get_state(cache=use_cache, propagate=0)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=position.value, w_value=position.w_value,
- quality=quality, priority=0,
- timestamp=position.timestamp)
-
- def write_Position(self, attr):
- self.in_write_position = True
- try:
- position = attr.get_write_value()
- self.debug("write_Position(%s)", position)
- try:
- self.wait_for_operation()
- except:
- raise Exception("Cannot move: already in motion")
- try:
- self.motor_group.position = position
- except PoolException, pe:
- throw_sardana_exception(pe)
- finally:
- self.in_write_position = False
-
- is_Position_allowed = _is_allowed
-
-
-class MotorGroupClass(PoolGroupDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- }
- device_property_list.update(PoolGroupDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- }
- cmd_list.update(PoolGroupDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {
- 'Position' : [ [ DevDouble, SPECTRUM, READ_WRITE, 4096 ], ],
- }
- attr_list.update(PoolGroupDeviceClass.attr_list)
-
- def _get_class_properties(self):
- ret = PoolGroupDeviceClass._get_class_properties(self)
- ret['Description'] = "Motor group device class"
- ret['InheritedFrom'].insert(0, 'PoolGroupDevice')
- return ret
diff --git a/src/sardana/tango/pool/OneDExpChannel.py b/src/sardana/tango/pool/OneDExpChannel.py
deleted file mode 100644
index 03307805..00000000
--- a/src/sardana/tango/pool/OneDExpChannel.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["OneDExpChannel", "OneDExpChannelClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import DevFailed, DevVoid, DevString, DevState, AttrQuality, \
- Except, READ, SCALAR
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, DataFormat, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.controller import OneDController, MaxDimSize, Type
-from sardana.tango.core.util import to_tango_type_format, exception_str
-
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class OneDExpChannel(PoolElementDevice):
-
- def __init__(self, dclass, name):
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def get_oned(self):
- return self.element
-
- def set_oned(self, oned):
- self.element = oned
-
- oned = property(get_oned, set_oned)
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- oned = self.oned
- if oned is not None:
- oned.remove_listener(self.on_oned_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
- oned = self.oned
- if oned is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.oned = oned = \
- self.pool.create_element(type="OneDExpChannel",
- name=name, full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id)
- if self.instrument is not None:
- oned.set_instrument(self.instrument)
- oned.add_listener(self.on_oned_changed)
-
- ## force a state read to initialize the state attribute
- #state = ct.state
- self.set_state(DevState.ON)
-
- def on_oned_changed(self, event_source, event_type, event_value):
- try:
- self._on_oned_changed(event_source, event_type, event_value)
- except not DevFailed:
- msg = 'Error occurred "on_oned_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.motor.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_oned_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- try:
- attr = self.get_attribute_by_name(name)
- except DevFailed:
- return
-
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
-
- if name == "value":
- state = self.oned.get_state()
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.oned.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For value attribute, listen to what the controller says for data
- # type (between long and float) and length
- value = std_attrs.get('value')
- if value is not None:
- _, data_info, attr_info = value
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
- shape = attr_info.maxdimsize
- data_info[0][3] = shape[0]
- return std_attrs, dyn_attrs
-
- def read_Value(self, attr):
- oned = self.oned
- use_cache = oned.is_in_operation() and not self.Force_HW_Read
- value = oned.get_value(cache=use_cache, propagate=0)
- if value.error:
- Except.throw_python_exception(*value.exc_info)
- state = oned.get_state(cache=use_cache, propagate=0)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value.value, quality=quality,
- timestamp=value.timestamp, priority=0)
-
- def is_Value_allowed(self, req_type):
- if self.get_state() in [DevState.FAULT, DevState.UNKNOWN]:
- return False
- return True
-
- def read_DataSource(self, attr):
- data_source = self.oned.get_data_source()
- if data_source is None:
- data_source = "tango://{0}/value".format(self.get_full_name())
- attr.set_value(data_source)
-
- def Start(self):
- self.oned.start_acquisition()
-
-
-_DFT_VALUE_INFO = OneDController.standard_axis_attributes['Value']
-_DFT_VALUE_MAX_SHAPE = _DFT_VALUE_INFO[MaxDimSize]
-_DFT_VALUE_TYPE, _DFT_VALUE_FORMAT = to_tango_type_format(_DFT_VALUE_INFO[Type], DataFormat.OneD)
-
-
-class OneDExpChannelClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'Start' : [ [DevVoid, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {
- 'DataSource' : [ [ DevString, SCALAR, READ ] ],
- }
- attr_list.update(PoolElementDeviceClass.attr_list)
-
- standard_attr_list = {
- 'Value' : [ [ _DFT_VALUE_TYPE, _DFT_VALUE_FORMAT, READ,
- _DFT_VALUE_MAX_SHAPE[0] ],
- { 'abs_change' : '1.0', } ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "1D device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/Pool.py b/src/sardana/tango/pool/Pool.py
deleted file mode 100644
index e10a8877..00000000
--- a/src/sardana/tango/pool/Pool.py
+++ /dev/null
@@ -1,1478 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["Pool", "PoolClass"]
-
-__docformat__ = 'restructuredtext'
-
-import json
-import operator
-import os.path
-
-import PyTango
-
-from taurus import Factory
-from taurus.core.util.containers import CaselessDict
-from taurus.core.util.codecs import CodecFactory
-from taurus.core.util.log import Logger, DebugIt
-
-from sardana import State, SardanaServer, ElementType, Interface, \
- TYPE_ACQUIRABLE_ELEMENTS, TYPE_PSEUDO_ELEMENTS
-from sardana.pool.pool import Pool as POOL
-from sardana.pool.poolmetacontroller import TYPE_MAP_OBJ
-from sardana.tango.core.util import get_tango_version_number
-
-
-class Pool(PyTango.Device_4Impl, Logger):
-
- ElementsCache = None
-
- def __init__(self, cl, name):
- PyTango.Device_4Impl.__init__(self, cl, name)
- Logger.__init__(self, name)
- self.init(name)
- self.init_device()
-
- def init(self, full_name):
- try:
- db = Factory().getDatabase()
- alias = db.get_alias(full_name)
- if alias.lower() == 'nada':
- alias = None
- except:
- alias = None
-
- if alias is None:
- alias = PyTango.Util.instance().get_ds_inst_name()
-
- self._pool = POOL(self.get_full_name(), alias)
- self._pool.add_listener(self.on_pool_changed)
-
- def get_full_name(self):
- db = PyTango.Util.instance().get_database()
- db_name = db.get_db_host() + ":" + db.get_db_port()
- return db_name + "/" + self.get_name()
-
- @property
- def pool(self):
- return self._pool
-
- @DebugIt()
- def delete_device(self):
- #self.pool.monitor.pause()
- pass
-
- @DebugIt()
- def init_device(self):
- self.set_state(PyTango.DevState.INIT)
- self.get_device_properties(self.get_device_class())
- p = self.pool
- p.set_python_path(self.PythonPath)
- p.set_path(self.PoolPath)
- p.set_motion_loop_sleep_time(self.MotionLoop_SleepTime / 1000.0)
- p.set_motion_loop_states_per_position(self.MotionLoop_StatesPerPosition)
- p.set_acq_loop_sleep_time(self.AcqLoop_SleepTime / 1000.0)
- p.set_acq_loop_states_per_value(self.AcqLoop_StatesPerValue)
- p.set_drift_correction(self.DriftCorrection)
- if self.RemoteLog is None:
- p.clear_remote_logging()
- else:
- try:
- h_p = self.RemoteLog.split(":", 1)
- if len(h_p) == 1:
- host = h_p[0]
- port = None
- else:
- host, port = h_p
- port = int(port)
- p.init_remote_logging(host=host, port=port)
- except:
- self.warning("Invalid property value for 'RemoteLog': %s",
- self.RemoteLog)
- p.clear_remote_logging()
- self._recalculate_instruments()
- for attr in self.get_device_class().attr_list:
- if attr.lower().endswith("list"):
- self.set_change_event(attr, True, False)
- self.set_change_event("State", True, False)
- self.set_change_event("Status", True, False)
- self.set_change_event("Elements", True, False)
- #hold the monitor thread for now!
- #self.pool.monitor.resume()
- self.set_state(PyTango.DevState.ON)
-
- def _recalculate_instruments(self):
- il = self.InstrumentList = list(self.InstrumentList)
- p = self.pool
- instruments = p.get_element_type_map().get(ElementType.Instrument, {})
- ids = set()
- for i in range(0, len(il), 3):
- iklass, iname, iid = il[i:i + 3]
- iid = int(iid)
- ids.add(iid)
- if iid in instruments:
- #TODO make sure the instrument didn't change
- pass
- else:
- p.create_instrument(iname, iklass, id=iid)
-
- #@DebugIt()
- def always_executed_hook(self):
- pass
-
- #@DebugIt()
- def read_attr_hardware(self, data):
- pass
-
- #@DebugIt()
- def read_ControllerLibList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.ControllerLibrary)
- attr.set_value(info)
-
- #@DebugIt()
- def read_ControllerClassList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.ControllerClass)
- attr.set_value(info)
-
- #@PyTango.DebugIt(show_args=True,show_ret=True)
- def read_ControllerList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.Controller)
- attr.set_value(info)
-
- def read_InstrumentList(self, attr):
- #instruments = self._pool.get_elements_by_type(ElementType.Instrument)
- #instrument_names = map(PoolInstrument.get_full_name, instruments)
- #attr.set_value(instrument_names)
- info = self.pool.get_elements_str_info(ElementType.Instrument)
- attr.set_value(info)
-
- #@DebugIt()
- def read_ExpChannelList(self, attr):
- info = []
- info.extend(self.pool.get_elements_str_info(ElementType.CTExpChannel))
- info.extend(self.pool.get_elements_str_info(ElementType.ZeroDExpChannel))
- info.extend(self.pool.get_elements_str_info(ElementType.OneDExpChannel))
- info.extend(self.pool.get_elements_str_info(ElementType.TwoDExpChannel))
- info.extend(self.pool.get_elements_str_info(ElementType.PseudoCounter))
- attr.set_value(info)
-
- #@DebugIt()
- def read_AcqChannelList(self, attr):
- info = self.pool.get_acquisition_elements_str_info()
- attr.set_value(info)
-
- #@DebugIt()
- def read_MotorGroupList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.MotorGroup)
- attr.set_value(info)
-
- #@DebugIt()
- def read_MotorList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.Motor)
- info.extend(self.pool.get_elements_str_info(ElementType.PseudoMotor))
- attr.set_value(info)
-
- #@DebugIt()
- def read_MeasurementGroupList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.MeasurementGroup)
- attr.set_value(info)
-
- #@DebugIt()
- def read_IORegisterList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.IORegister)
- attr.set_value(info)
-
- #@DebugIt()
- def read_ComChannelList(self, attr):
- info = self.pool.get_elements_str_info(ElementType.Communication)
- attr.set_value(info)
-
- #@DebugIt()
- def getElements(self, cache=True):
- value = self.ElementsCache
- if cache and value is not None:
- return value
- value = dict(new=self.pool.get_elements_info())
- value = CodecFactory().encode('json', ('', value))
- self.ElementsCache = value
- return value
-
- #@DebugIt()
- def read_Elements(self, attr):
- element_list = self.getElements()
- attr.set_value(*element_list)
-
- def is_Elements_allowed(self, req_type):
- return True
- return SardanaServer.server_state == State.Running
-
- is_ControllerLibList_allowed = \
- is_ControllerClassList_allowed = \
- is_ControllerList_allowed = \
- is_InstrumentList_allowed = \
- is_ExpChannelList_allowed = \
- is_AcqChannelList_allowed = \
- is_MotorGroupList_allowed = \
- is_MotorList_allowed = \
- is_MeasurementGroupList_allowed = \
- is_IORegisterList_allowed = \
- is_ComChannelList_allowed = is_Elements_allowed
-
- def _get_interface_ids(self, interface, elem_names):
- _pool, motor_ids = self.pool, []
- for elem_name in elem_names:
- try:
- element = _pool.get_element_by_name(elem_name)
- except:
- element = _pool.get_element_by_full_name(elem_name)
- elem_interface = element.get_interface()
- if not Interface.Moveable & elem_interface:
- raise Exception("%s is a %s. It MUST be a moveable"
- % (element.name, Interface[elem_interface]))
- motor_ids.append(element.id)
- return motor_ids
-
- def _get_moveable_ids(self, elem_names):
- return self._get_interface_ids(Interface.Moveable, elem_names)
-
- def _get_acquirable_ids(self, elem_names):
- return self._get_interface_ids(Interface.Acquirable, elem_names)
-
- #@DebugIt()
- def CreateController(self, argin):
- kwargs = self._format_CreateController_arguments(argin)
- # TODO: Support in future sequence of elements
- kwargs = kwargs[0]
-
- type_str = kwargs['type']
- lib = kwargs['library']
- class_name = kwargs['klass']
- name = kwargs['name']
- properties = kwargs['properties']
- elem_type = ElementType[type_str]
- mod_name, _ = os.path.splitext(lib)
- kwargs['module'] = mod_name
-
- td = TYPE_MAP_OBJ[ElementType.Controller]
- auto_full_name = td.auto_full_name
- ctrl_class = td.ctrl_klass
-
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
- util = PyTango.Util.instance()
-
- # check that element doesn't exist yet
- self._check_element(name, full_name)
-
- # check library exists
- ctrl_manager = self.pool.ctrl_manager
- mod_name, _ = os.path.splitext(lib)
- ctrl_lib = ctrl_manager.getControllerLib(mod_name)
- if ctrl_lib is None:
- raise Exception("Controller library '%s' not found" % lib)
-
- # check class exists
- ctrl_class = ctrl_lib.get_controller(class_name)
- if ctrl_class is None:
- raise Exception("Controller class '%s' not found in '%s'"
- % (class_name, lib))
-
- # check that class type matches the required type
- if not elem_type in ctrl_class.types:
- raise Exception("Controller class '%s' does not implement '%s' "
- "interface" % (class_name, type_str))
-
- # check that necessary property values are set
- for prop_name, prop_info in ctrl_class.ctrl_properties.items():
- prop_value = properties.get(prop_name)
- if prop_value is None:
- if prop_info.default_value is None:
- raise Exception("Controller class '%s' needs property '%s'"
- % (class_name, prop_name))
- properties[prop_name] = prop_info.default_value
- else:
- properties[prop_name] = prop_value
-
- # for pseudo motor check that motors are given
- if elem_type == ElementType.PseudoMotor:
- klass_roles = ctrl_class.controller_class.motor_roles
- klass_pseudo_roles = ctrl_class.controller_class.pseudo_motor_roles
- if not len(klass_pseudo_roles):
- klass_pseudo_roles = class_name,
- roles = kwargs.get('roles')
- if roles is None:
- raise Exception("Pseudo motor controller class %s needs motors "
- "for roles: %s and pseudo roles: %s"
- % (class_name, ", ".join(klass_roles),
- ", ".join(klass_pseudo_roles)))
- motor_ids = []
- for klass_role in klass_roles:
- if not klass_role in roles:
- raise Exception("Pseudo motor controller class '%s' needs "
- "motor(s) for role(s) %s"
- % (class_name, klass_role))
- motor_name = roles[klass_role]
- motor_ids.extend(self._get_moveable_ids((motor_name,)))
- properties['motor_role_ids'] = motor_ids
-
- pseudo_motor_infos = {}
- pseudo_motor_ids = []
- for i, klass_pseudo_role in enumerate(klass_pseudo_roles):
- if not klass_pseudo_role in roles:
- raise Exception("Pseudo motor controller class '%s' needs "
- "pseudo motor name for role '%s'"
- % (class_name, klass_pseudo_role))
- pm_id = self.pool.get_new_id()
- pm_name = roles[klass_pseudo_role]
- info = dict(id=pm_id, name=pm_name, ctrl_name=name, axis=i + 1,
- type='PseudoMotor', elements=motor_ids)
- if pm_name.count(',') > 0:
- n, fn = map(str.strip, pm_name.split(',', 1))
- info['name'], info['full_name'] = n, fn
- pseudo_motor_infos[klass_pseudo_role] = info
- pseudo_motor_ids.append(pm_id)
- properties['pseudo_motor_role_ids'] = pseudo_motor_ids
- # for pseudo counter check counters are given
- elif elem_type == ElementType.PseudoCounter:
- klass_roles = ctrl_class.controller_class.counter_roles
- klass_pseudo_roles = ctrl_class.controller_class.pseudo_counter_roles
- if not len(klass_pseudo_roles):
- klass_pseudo_roles = class_name,
- roles = kwargs.get('roles')
- if roles is None:
- raise Exception("Pseudo counter controller class '%s' needs "
- "counter(s) for role(s): %s and pseudo "
- "role(s): %s"
- % (class_name, ", ".join(klass_roles),
- ", ".join(klass_pseudo_roles)))
- counter_ids = []
- for klass_role in klass_roles:
- if not klass_role in roles:
- raise Exception("Pseudo counter controller class '%s' "
- "needs counter name for role '%s'"
- % (class_name, klass_role))
- counter_name = roles[klass_role]
- counter_ids.extend(self._get_acquirable_ids((counter_name,)))
- properties['counter_role_ids'] = counter_ids
-
- pseudo_counter_infos = {}
- pseudo_counter_ids = []
- for i, klass_pseudo_role in enumerate(klass_pseudo_roles):
- if not klass_pseudo_role in roles:
- raise Exception("Pseudo counter controller class %s needs "
- "pseudo motor name for role %s"
- % (class_name, klass_pseudo_role))
- pc_id = self.pool.get_new_id()
- pc_name = roles[klass_pseudo_role]
- info = dict(id=pc_id, name=pc_name, ctrl_name=name, axis=i + 1,
- type='PseudoCounter', elements=counter_ids)
- if pc_name.count(',') > 0:
- n, fn = map(str.strip, pc_name.split(',', 1))
- info['name'], info['full_name'] = n, fn
- pseudo_counter_infos[klass_pseudo_role] = info
- pseudo_counter_ids.append(pc_id)
- properties['pseudo_counter_role_ids'] = pseudo_counter_ids
-
- properties['type'] = type_str
- properties['library'] = lib
- properties['klass'] = class_name
-
- def create_controller_cb(device_name):
- try:
- db = util.get_database()
- #types = [ pool.ElementType.whatis(t) for t in ctrl.get_ctrl_types() ]
- properties['id'] = self.pool.get_new_id()
- db.put_device_property(device_name, properties)
- except:
- self.warning("Unexpected error in controller creation callback",
- exc_info=True)
- raise
-
- util.create_device('Controller', full_name, name,
- cb=create_controller_cb)
-
- # Determine which controller writtable attributes have default value
- # and apply them to the newly created controller
- attrs = []
- for attr_name, attr_info in ctrl_class.ctrl_attributes.items():
- default_value = attr_info.default_value
- if default_value is None:
- continue
- attrs.append((attr_name, default_value))
- if attrs:
- ctrl_proxy = PyTango.DeviceProxy(full_name)
- try:
- ctrl_proxy.write_attributes(attrs)
- except:
- self.warning("Error trying to write controller default value "
- "for attribute(s)", exc_info=1)
-
- # for pseudo motor/counter controller also create pseudo
- # motor(s)/counter(s) automatically
- if elem_type == ElementType.PseudoMotor:
- for pseudo_motor_info in pseudo_motor_infos.values():
- self._create_single_element(pseudo_motor_info)
- elif elem_type == ElementType.PseudoCounter:
- for pseudo_counter_info in pseudo_counter_infos.values():
- self._create_single_element(pseudo_counter_info)
-
- #@DebugIt()
- def CreateInstrument(self, argin):
- instrument = self.pool.create_instrument(*argin)
- instrument_list = self.InstrumentList
- # update database property
- instrument_list.append(instrument.instrument_class)
- instrument_list.append(instrument.full_name)
- instrument_list.append(instrument.id)
- db = PyTango.Util.instance().get_database()
- props = { 'InstrumentList' : instrument_list }
- db.put_device_property(self.get_name(), props)
-
- #@DebugIt()
- def CreateElement(self, argin):
- kwargs_seq = self._format_CreateElement_arguments(argin)
- for kwargs in kwargs_seq:
- self._create_single_element(kwargs)
-
- def _create_single_element(self, kwargs):
- elem_type_str = kwargs['type']
- ctrl_name = kwargs['ctrl_name']
- axis = kwargs['axis']
-
- try:
- elem_type = ElementType[elem_type_str]
- except KeyError:
- raise Exception("Unknown element type '%s'" % elem_type_str)
- name = kwargs['name']
-
- td = TYPE_MAP_OBJ[elem_type]
- auto_full_name = td.auto_full_name
-
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
-
- ctrl = self.pool.get_element(name=ctrl_name)
-
- if ctrl.get_type() != ElementType.Controller:
- type_str = ElementType.whatis(ctrl.get_type())
- raise Exception("'%s' is not a controller (It is a %s)" %
- (ctrl_name, type_str))
-
- ctrl_types = ctrl.get_ctrl_types()
- if elem_type not in ctrl_types:
- ctrl_type_str = ElementType.whatis(ctrl_types[0])
- raise Exception("Cannot create %s in %s controller" %
- (type, ctrl_type_str))
-
- elem_axis = ctrl.get_element(axis=axis)
- if elem_axis is not None:
- raise Exception("Controller already contains axis %d (%s)" %
- (axis, elem_axis.get_name()))
-
- self._check_element(name, full_name)
-
- util = PyTango.Util.instance()
-
- def create_element_cb(device_name):
- try:
- db = util.get_database()
- data = { "id" : self.pool.get_new_id(),
- "ctrl_id" : ctrl.get_id(), "axis" : axis, }
- if elem_type in TYPE_PSEUDO_ELEMENTS:
- data['elements'] = kwargs['elements']
-
- db.put_device_property(device_name, data)
-
- data = {}
- if elem_type == ElementType.Motor:
- data["position"] = { "abs_change" : "1.0"}
- data["dialposition"] = { "abs_change" : "5.0"}
- if get_tango_version_number() < 80000:
- print 20 * "AH! "
- data["limit_switches"] = { "abs_change" : "1.0"}
- elif elem_type == ElementType.CTExpChannel:
- data["value"] = { "abs_change" : "1.0"}
- elif elem_type == ElementType.PseudoMotor:
- data["position"] = { "abs_change" : "1.0"}
- elif elem_type == ElementType.PseudoCounter:
- data["value"] = { "abs_change" : "1.0"}
- elif elem_type == ElementType.IORegister:
- data["value"] = { "abs_change" : "1"}
- db.put_device_attribute_property(device_name, data)
- except:
- import traceback
- traceback.print_exc()
-
- util.create_device(elem_type_str, full_name, name, cb=create_element_cb)
-
- # Hack to register event abs change until tango bug #3151801 is solved
- elem_proxy = PyTango.DeviceProxy(full_name)
- cfg = []
- if elem_type == ElementType.Motor:
- attr = elem_proxy.get_attribute_config_ex("position")[0]
- attr.events.ch_event.abs_change = "1"
- cfg.append(attr)
- try:
- attr = elem_proxy.get_attribute_config_ex("dialposition")[0]
- attr.events.ch_event.abs_change = "5.0"
- cfg.append(attr)
- except:
- pass
- try:
- if get_tango_version_number() < 80000:
- attr = elem_proxy.get_attribute_config_ex("limit_switches")[0]
- attr.events.ch_event.abs_change = "1"
- cfg.append(attr)
- except:
- pass
- elif elem_type == ElementType.CTExpChannel:
- attr = elem_proxy.get_attribute_config_ex("value")[0]
- attr.events.ch_event.abs_change = "1.0"
- cfg.append(attr)
- elif elem_type == ElementType.ZeroDExpChannel:
- attr = elem_proxy.get_attribute_config_ex("value")[0]
- attr.events.ch_event.abs_change = "1.0"
- cfg.append(attr)
- elif elem_type == ElementType.PseudoMotor:
- attr = elem_proxy.get_attribute_config_ex("position")[0]
- attr.events.ch_event.abs_change = "1"
- cfg.append(attr)
- elif elem_type == ElementType.PseudoCounter:
- attr = elem_proxy.get_attribute_config_ex("value")[0]
- attr.events.ch_event.abs_change = "1"
- cfg.append(attr)
- elif elem_type == ElementType.IORegister:
- attr = elem_proxy.get_attribute_config_ex("value")[0]
- attr.events.ch_event.abs_change = "1"
- cfg.append(attr)
- elem_proxy.set_attribute_config(cfg)
-
- return
-
- # Determine which writtable attributes have default value and apply
- # them to the newly created element
- ctrl_class_info = ctrl.get_ctrl_info()
- attrs = []
- for attr_name, attr_info in ctrl_class_info.getAxisAttributes().items():
- default_value = attr_info.default_value
- if default_value is None:
- continue
- attrs.append((attr_name, default_value))
- if attrs:
- elem_proxy = PyTango.DeviceProxy(full_name)
- try:
- elem_proxy.write_attributes(attrs)
- except:
- self.warning("Error trying to write default value for "
- "attribute(s)", exc_info=1)
-
- #@DebugIt()
- def CreateMotorGroup(self, argin):
- kwargs = self._format_CreateMotorGroup_arguments(argin)
- # TODO: Support in future sequence of elements
- kwargs = kwargs[0]
-
- util = PyTango.Util.instance()
-
- name = kwargs['name']
- kwargs['pool_name'] = self.pool.name
-
- td = TYPE_MAP_OBJ[ElementType.MotorGroup]
- auto_full_name = td.auto_full_name
-
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
-
- self._check_element(name, full_name)
-
- elem_ids = self._get_moveable_ids(kwargs["elements"])
-
- def create_motgrp_cb(device_name):
- db = util.get_database()
- data = { "id" : self.pool.get_new_id(),
- "elements" : elem_ids }
- db.put_device_property(device_name, data)
-
- data = {}
- data["position"] = { "abs_change" : "1.0" }
-
- db.put_device_attribute_property(device_name, data)
-
- util.create_device("MotorGroup", full_name, name, cb=create_motgrp_cb)
-
- #@DebugIt()
- def CreateMeasurementGroup(self, argin):
- kwargs = self._format_CreateMeasurementGroup_arguments(argin)
- # TODO: Support in future sequence of elements
- kwargs = kwargs[0]
-
- util = PyTango.Util.instance()
-
- name = kwargs['name']
- kwargs['pool_name'] = self.pool.name
-
- td = TYPE_MAP_OBJ[ElementType.MeasurementGroup]
- auto_full_name = td.auto_full_name
-
- full_name = kwargs.get("full_name", auto_full_name.format(**kwargs))
-
- self._check_element(name, full_name)
-
- elem_ids = []
- for elem_name in kwargs["elements"]:
- # if internal pool element (channel, motor, ioregister, etc) store
- # it's id
- try:
- elem = self.pool.get_element(name=elem_name)
- elem_ids.append(elem.id)
- except:
- # otherwise assume a tango attribute/command
- elem_ids.append(elem_name)
-
- def create_mntgrp_cb(device_name):
- db = util.get_database()
- data = { "id" : self.pool.get_new_id(),
- "elements" : elem_ids }
- db.put_device_property(device_name, data)
-
- data = { }
-
- db.put_device_attribute_property(device_name, data)
-
- util.create_device("MeasurementGroup", full_name, name,
- cb=create_mntgrp_cb)
-
- def _check_element(self, name, full_name):
- self.pool.check_element(name, full_name)
- db = PyTango.Util.instance().get_database()
- e = None
- try:
- db.import_device(name)
- e = Exception("The tango alias '%s' already exists" % name)
- except:
- pass
- if e: raise e
-
- try:
- db.import_device(full_name)
- e = Exception("The tango device '%s' already exists" % full_name)
- except:
- pass
- if e: raise e
-
- def on_pool_changed(self, evt_src, evt_type, evt_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- evt_name = evt_type.name.lower()
-
- if evt_name in ("elementcreated", "elementdeleted"):
- elem = evt_value
- elem_type = elem.get_type()
- td = TYPE_MAP_OBJ[elem_type]
- attribute_list_name = td.family + "List"
- info = self.pool.get_elements_str_info(elem_type)
- self.push_change_event(attribute_list_name, info)
-
- if elem_type in TYPE_ACQUIRABLE_ELEMENTS:
- info = self.pool.get_acquisition_elements_str_info()
- self.push_change_event('AcqChannelList', info)
-
- # force the element list cache to be rebuild next time someone reads
- # the element list
- self.ElementsCache = None
-
- value = { }
- if "created" in evt_name:
- key = 'new'
- else:
- key = 'del'
- json_elem = elem.serialize(pool=self.pool.full_name)
- value[key] = json_elem,
- value = CodecFactory().getCodec('json').encode(('', value))
- self.push_change_event('Elements', *value)
- elif evt_name == "elementschanged":
- # force the element list cache to be rebuild next time someone reads
- # the element list
- self.ElementsCache = None
- pool_name = self.pool.full_name
- new_values, changed_values, deleted_values = [], [], []
- for elem in evt_value['new']:
- json_elem = elem.serialize(pool=pool_name)
- new_values.append(json_elem)
- for elem in evt_value['change']:
- json_elem = elem.serialize(pool=pool_name)
- changed_values.append(json_elem)
- for elem in evt_value['del']:
- json_elem = elem.serialize(pool=pool_name)
- deleted_values.append(json_elem)
- value = { "new" : new_values, "change": changed_values,
- "del" : deleted_values }
- value = CodecFactory().getCodec('json').encode(('', value))
- self.push_change_event('Elements', *value)
-
- def _format_create_json_arguments(self, argin):
- elems, ret = json.loads(argin[0]), []
- if operator.isMappingType(elems):
- elems = [elems]
- for elem in elems:
- d = {}
- for k, v in elem.items():
- d[str(k)] = str(v)
- ret.append(d)
- return ret
-
- def _format_CreateElement_arguments(self, argin):
- if len(argin) == 0:
- msg = PoolClass.cmd_list["CreateElement"][0][1]
- raise Exception(msg)
- if len(argin) == 1:
- return self._format_create_json_arguments(argin)
-
- ret = { 'type' : argin[0], 'ctrl_name' : argin[1], 'axis': int(argin[2]),
- 'name' : argin[3] }
- if len(argin) > 4:
- ret['full_name'] = argin[4]
- return [ret]
-
- def _format_CreateController_arguments(self, argin):
- if len(argin) == 0:
- msg = PoolClass.cmd_list["CreateController"][0][1]
- raise Exception(msg)
- if len(argin) == 1:
- ret = self._format_create_json_arguments(argin)
- if not ret.has_key('type'):
- raise KeyError("Missing key 'type'")
- if not ret.has_key('library'):
- raise KeyError("Missing key 'library'")
- if not ret.has_key('klass'):
- raise KeyError("Missing key 'klass'")
- if not ret.has_key('name'):
- raise KeyError("Missing key 'name'")
- if not ret.has_key('properties'):
- ret['properties'] = CaselessDict()
- return ret
-
- ret = { 'type' : argin[0], 'library' : argin[1], 'klass' : argin[2],
- 'name' : argin[3] }
-
- i = 4
- roles = {}
- for arg in argin[4:]:
- role_data = arg.split('=', 1)
- if len(role_data) < 2:
- break
- role_name, role_element = role_data
- roles[role_name] = role_element
- i += 1
-
- if len(roles) > 0:
- ret['roles'] = roles
-
- p = argin[i:]
- if len(p) % 2:
- raise Exception("must give pair of property name, property value")
- props = CaselessDict()
- for name, value in zip(p[0::2], p[1::2]):
- props[name] = value
- ret['properties'] = props
- return [ret]
-
- def _format_CreateMotorGroup_arguments(self, argin):
- if len(argin) == 0:
- msg = PoolClass.cmd_list["CreateMotorGroup"][0][1]
- raise Exception(msg)
- if len(argin) == 1:
- ret = []
- try:
- elems = json.loads(argin[0])
- except:
- elems = argin
- if operator.isMappingType(elems):
- elems = [elems]
- for elem in elems:
- d = {}
- for k, v in elem.items():
- d[str(k)] = str(v)
- ret.append(d)
- return ret
- ret = { 'name' : argin[0] }
- if argin[-1].count('/') == 2:
- ret['full_name'] = argin[-1]
- del argin[-1]
- ret['elements'] = argin[1:]
- return [ret]
-
- def _format_CreateMeasurementGroup_arguments(self, argin):
- if len(argin) == 0:
- msg = PoolClass.cmd_list["CreateMeasurementGroup"][0][1]
- raise Exception(msg)
- if len(argin) == 1:
- ret = []
- try:
- elems = json.loads(argin[0])
- except:
- elems = argin
- if operator.isMappingType(elems):
- elems = [elems]
- for elem in elems:
- d = {}
- for k, v in elem.items():
- d[str(k)] = str(v)
- ret.append(d)
- return ret
- ret = { 'name' : argin[0] }
- #if argin[-1].count('/') == 2:
- # ret['full_name'] = argin[-1]
- # del argin[-1]
- channels = []
- for arg in argin[1:]:
- try:
- channel = self.pool.get_element_by_full_name(arg)
- channels.append(channel.name)
- except:
- try:
- channel = self.pool.get_element_by_name(arg)
- channels.append(channel.name)
- except:
- channels.append(arg)
- ret['elements'] = channels
- return [ret]
-
- #@DebugIt()
- def DeleteElement(self, name):
- try:
- elem = self.pool.get_element(full_name=name)
- except:
- elem = self.pool.get_element(name=name)
-
- elem_type = elem.get_type()
- if elem_type == ElementType.Controller:
- if len(elem.get_elements()) > 0:
- raise Exception("Cannot delete controller with elements. " \
- "Delete elements first")
-
- td = TYPE_MAP_OBJ[elem_type]
- type_name = td.name
-
- full_name = elem.get_full_name()
-
- self.pool.delete_element(name)
- if elem_type == ElementType.Instrument:
- # update database property
- il = self.InstrumentList
- idx = il.index(full_name)
- self.InstrumentList = il[:idx - 1] + il[idx + 2:]
- db = PyTango.Util.instance().get_database()
- props = { 'InstrumentList' : self.InstrumentList }
- db.put_device_property(self.get_name(), props)
- else:
- util = PyTango.Util.instance()
- util.delete_device(type_name, full_name)
-
- #@DebugIt()
- def GetControllerClassInfo(self, names):
- if names.startswith('['):
- names = json.loads(names)
- else:
- names = (names,)
- ctrl_classes = self.pool.get_controller_classes_info(names)
- ret = []
- for name in names:
- ctrl_class = ctrl_classes[name]
- data = None
- if ctrl_class is not None:
- data = ctrl_class.toDict()
- ret.append(data)
- return json.dumps(ret)
-
- #@DebugIt()
- def ReloadControllerLib(self, lib_name):
- self.pool.reload_controller_lib(lib_name)
-
- #@DebugIt()
- def ReloadControllerClass(self, class_name):
- self.pool.reload_controller_class(class_name)
-
- def Stop(self):
- self.pool.stop()
-
- def Abort(self):
- self.pool.abort()
-
- def SendToController(self, stream):
- ctrl_name, stream = stream[:2]
- try:
- ctrl = self.pool.get_element_by_name(ctrl_name)
- except KeyError:
- ctrl = self.pool.get_element_by_full_name(ctrl_name)
- return ctrl.send_to_controller(stream)
-
- def GetFile(self, name):
- p = self.pool
- manager = p.ctrl_manager
- lib = manager.getControllerLib(name)
- if lib is None:
- raise Exception("Unknown controller file '%s'", name)
- return lib.f_path, "".join(lib.getCode())
-
- def PutFile(self, file_data):
- p = self.pool
- manager = p.ctrl_manager
- manager.setControllerLib(*file_data)
-
- def GetControllerCode(self, argin):
- pass
-
- def SetControllerCode(self, argin):
- pass
-
-
-CREATE_CONTROLLER_PAR_IN_DOC = """\
-Must give either:
-
- * A JSON encoded dict as first string with:
- * mandatory keys: 'type', 'library', 'klass' and 'name' (values are
- strings).
- * optional keys:
- * 'properties': a dict with keys being property names and values
- the property values
- * 'roles': a dict with keys being controller roles and values being
- element names. (example: { 'gap' : 'motor21', 'offset' : 'motor55' }).
- Only applicable of pseudo controllers
- * a sequence of strings: <type>, <library>, <class>, <name>
- [, <role_name>'='<element name>] [, <property name>, <property value>]
-
- Examples::
-
- data = dict(type='Motor', library='DummyMotorController',
- klass='DummyMotorController',
- name='my_motor_ctrl_1')
- pool.CreateController([json.dumps(data)])
-
- pool.CreateController(['Motor', 'DummyMotorController', 'DummyMotorController',
- 'my_motor_ctrl_2'])
-"""
-
-CREATE_CONTROLLER_PAR_OUT_DOC = "None"
-
-CREATE_CONTROLLER_DOC = """\
-Tango command to create controller.
-
-:param argin:
- {0}
-:type argin: list<str>
-:return:
- {1}
-""".format(CREATE_CONTROLLER_PAR_IN_DOC, CREATE_CONTROLLER_PAR_OUT_DOC)
-
-CREATE_ELEMENT_PAR_IN_DOC = """\
-Must give either:
-
- * A JSON encoded dict as first string with:
- * mandatory keys: 'type', 'ctrl_name', 'axis', 'name' (values are
- strings).
- * optional keys:
- * 'full_name' : a string representing the full tango device name
-
- * a sequence of strings: <type>, <ctrl_name>, <axis>, <name> [, <full_name>]
-
- Examples::
-
- data = dict(type='Motor', ctrl_name='my_motor_ctrl_1', axis='4', name='theta',
- full_name='BL99/EH/THETA')
- pool.CreateElement([json.dumps(data)])
-
- pool.CreateElement(['Motor', 'my_motor_ctrl_1', '1', 'phi', 'BL99/EH/PHI'])
-"""
-
-CREATE_ELEMENT_PAR_OUT_DOC = "None"
-
-CREATE_ELEMENT_DOC = """\
-Tango command to create element (motor, counter/timer, 0D, 1D, 2D, IORegister).
-
-:param argin:
- {0}
-:type argin: list<str>
-:return:
- {1}
-""".format(CREATE_ELEMENT_PAR_IN_DOC, CREATE_ELEMENT_PAR_OUT_DOC)
-
-CREATE_INSTRUMENT_PAR_IN_DOC = """\
-Must give either:
-
- * A JSON encoded dict as first string with:
- * mandatory keys: 'full_name', 'klass' (values are strings).
- * a sequence of strings: <full_name>, <class>
-
- Examples::
-
- pool.CreateInstrument(['/OH', 'NXhutch'])
- pool.CreateInstrument(['/OH/Mono', 'NXmonochromator'])
- pool.CreateInstrument(['/EH', 'NXhutch'])
- pool.CreateInstrument(['/EH/Pilatus', 'NXdetector'])
-"""
-
-CREATE_INSTRUMENT_PAR_OUT_DOC = "None"
-
-CREATE_INSTRUMENT_DOC = """\
-Tango command to create instrument.
-
-:param argin:
- {0}
-:type argin: list<str>
-:return:
- {1}
-""".format(CREATE_INSTRUMENT_PAR_IN_DOC, CREATE_INSTRUMENT_PAR_OUT_DOC)
-
-CREATE_MOTOR_GROUP_PAR_IN_DOC = """\
-Must give either:
-
- * A JSON encoded dict as first string with:
- * mandatory keys: 'name', 'elements' (with value being a list of moveables)
- * optional keys:
- * 'full_name': with value being a full tango device name
-
- * a sequence of strings: <motor group name> [, <element> ]"
-
- Examples::
-
- data = dict(name='diffrac_motor_group', elements=['theta', 'theta2', 'phi'])
- pool.CreateMotorGroup([json.dumps(data)])
-
- pool.CreateMotorGroup(['diffrac_mg', 'theta', 'theta2' ])
-"""
-
-CREATE_MOTOR_GROUP_PAR_OUT_DOC = "None"
-
-CREATE_MOTOR_GROUP_DOC = """\
-Tango command to create motor group.
-
-:param argin:
- {0}
-:type argin: list<str>
-:return:
- {1}
-""".format(CREATE_MOTOR_GROUP_PAR_IN_DOC, CREATE_MOTOR_GROUP_PAR_OUT_DOC)
-
-Pool.CreateMotorGroup.__func__.__doc__ = CREATE_MOTOR_GROUP_DOC
-
-CREATE_MEASUREMENT_GROUP_PAR_IN_DOC = """\
-Must give either:
-
- * A JSON encoded dict as first string with:
- * mandatory keys: 'name', 'elements' (with value being a list of acquirables)"
- * optional keys:
- * 'full_name': with value being a full tango device name
-
- * a sequence of strings: <motor group name> [, <element> ]"
-
- An acquirable is either a sardana element (counter/timer, 0D, 1D, 2D, motor) or
- a tango attribute (ex: sys/tg_test/1/short_spectrum_ro)
-
- Examples::
-
- data = dict(name='my_exp_01', elements=['timer', 'C1', 'sys/tg_test/1/double_scalar'])
- pool.CreateMeasurementGroup([json.dumps(data)])
-
- pool.CreateMeasurementGroup(['my_exp_02', 'timer', 'CCD1', 'sys/tg_test/1/short_spectrum_ro'])
-"""
-
-CREATE_MEASUREMENT_GROUP_PAR_OUT_DOC = "None"
-
-CREATE_MEASUREMENT_GROUP_DOC = """\
-Tango command to create measurement group.
-
-:param argin:
- {0}
-:type argin: list<str>
-:return:
- {1}
-""".format(CREATE_MEASUREMENT_GROUP_PAR_IN_DOC, CREATE_MEASUREMENT_GROUP_PAR_OUT_DOC)
-
-DELETE_ELEMENT_PAR_IN_DOC = """\
-name of element to be deleted
-"""
-
-DELETE_ELEMENT_PAR_OUT_DOC = "None"
-
-DELETE_ELEMENT_DOC = """\
-Tango command to delete element.
-
-:param argin:
- {0}
-:type argin: str
-:return:
- {1}
-""".format(DELETE_ELEMENT_PAR_IN_DOC, DELETE_ELEMENT_PAR_OUT_DOC)
-
-GET_CONTROLLER_CLASS_INFO_PAR_IN_DOC = """\
-Must give either:
-
- * A JSON encoded list of controller class names
- * a controller class name
-
- Examples::
-
- data = "DummyMotorController", "DummyCounterTimerController"
- pool.GetControllerClassInfo(json.dumps(data))
- pool.GetControllerClassInfo("DummyMotorController")
-
-"""
-
-GET_CONTROLLER_CLASS_INFO_PAR_OUT_DOC = """
-a JSON encoded string describing the controller class
-"""
-
-GET_CONTROLLER_CLASS_INFO_DOC = """\
-Tango command to get detailed information about a controller class.
-
-:param argin:
- {0}
-:type argin: str
-:return:
- {1}
-:rtype: str
-""".format(GET_CONTROLLER_CLASS_INFO_PAR_IN_DOC, GET_CONTROLLER_CLASS_INFO_PAR_OUT_DOC)
-
-RELOAD_CONTROLLER_LIB_PAR_IN_DOC = """\
-the controller library name (without extension)
-"""
-
-RELOAD_CONTROLLER_LIB_PAR_OUT_DOC = "None"
-
-RELOAD_CONTROLLER_LIB_INFO_DOC = """\
-Tango command to reload the controller library code.
-
-:param argin:
- {0}
-:type argin: str
-:return:
- {1}
-""".format(RELOAD_CONTROLLER_LIB_PAR_IN_DOC, RELOAD_CONTROLLER_LIB_PAR_OUT_DOC)
-
-RELOAD_CONTROLLER_CLASS_PAR_IN_DOC = """\
-the controller class name
-"""
-
-RELOAD_CONTROLLER_CLASS_PAR_OUT_DOC = "None"
-
-RELOAD_CONTROLLER_CLASS_INFO_DOC = """\
-Tango command to reload the controller class code (reloads the entire library
-where the class is described).
-
-:param argin:
- {0}
-:type argin: str
-:return:
- {1}
-""".format(RELOAD_CONTROLLER_CLASS_PAR_IN_DOC, RELOAD_CONTROLLER_CLASS_PAR_OUT_DOC)
-
-STOP_PAR_IN_DOC = "None"
-STOP_PAR_OUT_DOC = "None"
-
-STOP_DOC = """\
-Stops all elements managed by this Pool
-
-:param argin:
- {0}
-:return:
- {1}
-""".format(STOP_PAR_IN_DOC, STOP_PAR_OUT_DOC)
-
-ABORT_PAR_IN_DOC = "None"
-ABORT_PAR_OUT_DOC = "None"
-
-ABORT_DOC = """\
-Aborts all elements managed by this Pool
-
-:param argin:
- {0}
-:return:
- {1}
-""".format(ABORT_PAR_IN_DOC, ABORT_PAR_OUT_DOC)
-
-SEND_TO_CONTROLLER_PAR_IN_DOC = """\
-a sequence of two strings: <controller name>, <data>
-"""
-
-SEND_TO_CONTROLLER_PAR_OUT_DOC = """\
-the controller response
-"""
-
-SEND_TO_CONTROLLER_DOC = """\
-Sends a string to a controller.
-
-:param argin:
- {0}
-:return:
- {1}
-""".format(SEND_TO_CONTROLLER_PAR_IN_DOC, SEND_TO_CONTROLLER_PAR_OUT_DOC)
-
-Pool.CreateController.__func__.__doc__ = CREATE_CONTROLLER_DOC
-Pool.CreateElement.__func__.__doc__ = CREATE_ELEMENT_DOC
-Pool.CreateInstrument.__func__.__doc__ = CREATE_INSTRUMENT_DOC
-Pool.CreateMotorGroup.__func__.__doc__ = CREATE_MOTOR_GROUP_DOC
-Pool.CreateMeasurementGroup.__func__.__doc__ = CREATE_MEASUREMENT_GROUP_DOC
-Pool.DeleteElement.__func__.__doc__ = DELETE_ELEMENT_DOC
-Pool.GetControllerClassInfo.__func__.__doc__ = GET_CONTROLLER_CLASS_INFO_DOC
-Pool.ReloadControllerLib.__func__.__doc__ = RELOAD_CONTROLLER_LIB_INFO_DOC
-Pool.ReloadControllerClass.__func__.__doc__ = RELOAD_CONTROLLER_CLASS_INFO_DOC
-Pool.Stop.__func__.__doc__ = STOP_DOC
-Pool.Abort.__func__.__doc__ = ABORT_DOC
-
-
-class PoolClass(PyTango.DeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- 'PoolPath':
- [PyTango.DevVarStringArray,
- "list of directories to search for controllers (path separators "
- "can be '\n' or ':')",
- []],
- 'PythonPath':
- [PyTango.DevVarStringArray,
- "list of directories to be appended to sys.path at startup (path "
- "separators can be '\n' or ':')",
- []],
- 'MotionLoop_SleepTime':
- [PyTango.DevLong,
- "Sleep time in the motion loop in mS [default: %dms]" %
- int(POOL.Default_MotionLoop_SleepTime * 1000),
- int(POOL.Default_MotionLoop_SleepTime * 1000)],
- 'MotionLoop_StatesPerPosition':
- [PyTango.DevLong,
- "Number of State reads done before doing a position read in the "
- "motion loop [default: %d]" % POOL.Default_MotionLoop_StatesPerPosition,
- POOL.Default_MotionLoop_StatesPerPosition],
- 'AcqLoop_SleepTime':
- [PyTango.DevLong,
- "Sleep time in the acquisition loop in mS [default: %dms]" %
- int(POOL.Default_AcqLoop_SleepTime * 1000),
- int(POOL.Default_AcqLoop_SleepTime * 1000)],
- 'AcqLoop_StatesPerValue':
- [PyTango.DevLong,
- "Number of State reads done before doing a value read in the "
- "acquisition loop [default: %d]" % POOL.Default_AcqLoop_StatesPerValue,
- POOL.Default_AcqLoop_StatesPerValue],
- 'RemoteLog':
- [PyTango.DevString,
- "Logging (python logging) host:port [default: None]",
- None],
- 'DriftCorrection':
- [PyTango.DevBoolean,
- "Globally apply drift correction on pseudo motors (can be "
- "overwritten at PseudoMotor level [default: %d]." %
- POOL.Default_DriftCorrection,
- POOL.Default_DriftCorrection],
- 'InstrumentList':
- [PyTango.DevVarStringArray,
- "List of instruments (internal property)",
- []],
- }
-
- # Command definitions
- cmd_list = {
- 'CreateController':
- [[PyTango.DevVarStringArray, CREATE_CONTROLLER_PAR_IN_DOC],
- [PyTango.DevVoid, CREATE_CONTROLLER_PAR_OUT_DOC]],
- 'CreateElement':
- [[PyTango.DevVarStringArray, CREATE_ELEMENT_PAR_IN_DOC],
- [PyTango.DevVoid, CREATE_ELEMENT_PAR_OUT_DOC]],
- 'CreateInstrument':
- [[PyTango.DevVarStringArray, CREATE_INSTRUMENT_PAR_IN_DOC],
- [PyTango.DevVoid, CREATE_INSTRUMENT_PAR_OUT_DOC]],
- 'CreateMotorGroup':
- [[PyTango.DevVarStringArray, CREATE_MOTOR_GROUP_PAR_IN_DOC],
- [PyTango.DevVoid, CREATE_MOTOR_GROUP_PAR_OUT_DOC]],
- 'CreateMeasurementGroup':
- [[PyTango.DevVarStringArray, CREATE_MEASUREMENT_GROUP_PAR_IN_DOC],
- [PyTango.DevVoid, CREATE_MEASUREMENT_GROUP_PAR_OUT_DOC]],
- 'DeleteElement':
- [[PyTango.DevString, DELETE_ELEMENT_PAR_IN_DOC],
- [PyTango.DevVoid, DELETE_ELEMENT_PAR_OUT_DOC]],
- 'GetControllerClassInfo':
- [[PyTango.DevString, GET_CONTROLLER_CLASS_INFO_PAR_IN_DOC],
- [PyTango.DevString, GET_CONTROLLER_CLASS_INFO_PAR_OUT_DOC]],
- 'ReloadControllerLib':
- [[PyTango.DevString, RELOAD_CONTROLLER_LIB_PAR_IN_DOC],
- [PyTango.DevVoid, RELOAD_CONTROLLER_LIB_PAR_OUT_DOC]],
- 'ReloadControllerClass':
- [[PyTango.DevString, RELOAD_CONTROLLER_CLASS_PAR_IN_DOC],
- [PyTango.DevVoid, RELOAD_CONTROLLER_CLASS_PAR_OUT_DOC]],
- 'GetControllerCode':
- [[PyTango.DevVarStringArray, "<Controller library name> [, <Controller class name>]"],
- [PyTango.DevVarStringArray, "result is a sequence of 3 strings:\n"
- "<full path and file name>, <code>, <line number>" ]],
- 'SetControllerCode':
- [[PyTango.DevVarStringArray, "<Controller library name>, <code> [, <Auto reload>=True]\n" \
- "- if controller library is a simple module name:\n" \
- " - if it exists, it is overwritten, otherwise a new python " \
- "file is created in the directory of the first element in "\
- "the PoolPath property" \
- "- if controller library is the full path name:\n" \
- " - if path is not in the PoolPath, an exception is thrown" \
- " - if file exists it is overwritten otherwise a new file " \
- "is created"],
- [PyTango.DevVoid, "" ]],
- 'Stop':
- [[PyTango.DevVoid, STOP_PAR_IN_DOC],
- [PyTango.DevVoid, STOP_PAR_OUT_DOC]],
- 'Abort':
- [[PyTango.DevVoid, ABORT_PAR_IN_DOC],
- [PyTango.DevVoid, ABORT_PAR_OUT_DOC]],
- 'SendToController':
- [[PyTango.DevVarStringArray, SEND_TO_CONTROLLER_PAR_IN_DOC],
- [PyTango.DevString, SEND_TO_CONTROLLER_PAR_OUT_DOC]],
- 'GetFile':
- [[PyTango.DevString, "name (may be module name, file name or full (with absolute path) file name"],
- [PyTango.DevVarStringArray, "[complete(with absolute path) file name, file contents]"]],
- 'PutFile':
- [[PyTango.DevVarStringArray, "[name (may be module name, file name or full (with absolute path) file name, file contents]"],
- [PyTango.DevVoid, ""]],
- }
-
-
- # Attribute definitions
- attr_list = {
- 'InstrumentList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Motor list",
- 'description':"the list of instruments (a JSON encoded dict)",
- } ],
- 'ControllerList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Controller list",
- 'description':"the list of controllers (a JSON encoded dict)",
- } ],
- 'ExpChannelList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Experiment channel list",
- 'description':"The list of experiment channels (a JSON encoded dict)",
- } ],
- 'AcqChannelList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Acquisition channel list",
- 'description':"The list of all acquisition channels (a JSON encoded dict)",
- } ],
- 'MotorGroupList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Motor group list",
- 'description':"the list of motor groups (a JSON encoded dict)",
- } ],
- 'ControllerLibList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Controller library list",
- 'description':"the list of controller libraries (a JSON encoded dict)",
- } ],
- 'ControllerClassList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Controller class list",
- 'description':"the list of controller classes (a JSON encoded dict)",
- } ],
- 'MotorList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Motor list",
- 'description':"the list of motors (a JSON encoded dict)",
- } ],
- 'MeasurementGroupList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Measurement group list",
- 'description':"the list of measurement groups (a JSON encoded dict)",
- } ],
- 'IORegisterList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"IORegister list",
- 'description':"the list of IORegisters (a JSON encoded dict)",
- } ],
- 'ComChannelList':
- [[PyTango.DevString,
- PyTango.SPECTRUM,
- PyTango.READ, 4096],
- {
- 'label':"Communication channel list",
- 'description':"the list of communication channels (a JSON encoded dict)",
- } ],
- 'Elements':
- [[PyTango.DevEncoded,
- PyTango.SCALAR,
- PyTango.READ],
- {
- 'label':"Elements",
- 'description':"the list of all elements (a JSON encoded dict)",
- } ],
- }
-
- def __init__(self, name):
- PyTango.DeviceClass.__init__(self, name)
- self.set_type(name)
-
- def _get_class_properties(self):
- return dict(ProjectTitle="Sardana", Description="Device Pool management class",
- doc_url="http://sardana-controls.org/",
- InheritedFrom="Device_4Impl")
-
- def write_class_property(self):
- util = PyTango.Util.instance()
- db = util.get_database()
- if db is None:
- return
- db.put_class_property(self.get_name(), self._get_class_properties())
diff --git a/src/sardana/tango/pool/PoolDevice.py b/src/sardana/tango/pool/PoolDevice.py
deleted file mode 100644
index 76d09b73..00000000
--- a/src/sardana/tango/pool/PoolDevice.py
+++ /dev/null
@@ -1,819 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Generic Tango Pool Device base classes"""
-
-__all__ = ["PoolDevice", "PoolDeviceClass",
- "PoolElementDevice", "PoolElementDeviceClass",
- "PoolGroupDevice", "PoolGroupDeviceClass"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from PyTango import Util, DevVoid, DevLong64, DevBoolean, DevString, \
- DevVarStringArray, DispLevel, DevState, SCALAR, SPECTRUM, \
- IMAGE, READ_WRITE, READ, AttrData, CmdArgType, DevFailed, seqStr_2_obj
-
-from taurus.core.util.containers import CaselessDict
-
-from sardana import InvalidId, InvalidAxis, ElementType
-from sardana.pool.poolmetacontroller import DataInfo
-from sardana.tango.core.SardanaDevice import SardanaDevice, SardanaDeviceClass
-from sardana.tango.core.util import GenericScalarAttr, GenericSpectrumAttr, \
- GenericImageAttr, to_tango_attr_info
-
-
-class PoolDevice(SardanaDevice):
- """Base Tango Pool device class"""
-
- #: list of extreme error states
- ExtremeErrorStates = DevState.FAULT, DevState.UNKNOWN
-
- #: list of busy states
- BusyStates = DevState.MOVING, DevState.RUNNING
-
- #: Maximum number of retries in a busy state
- BusyRetries = 3
-
- def __init__(self, dclass, name):
- """Constructor"""
- SardanaDevice.__init__(self, dclass, name)
-
- def init(self, name):
- """initialize the device once in the object lifetime. Override when
- necessary but **always** call the method from your super class
-
- :param str name: device name"""
- SardanaDevice.init(self, name)
- util = Util.instance()
- self._pool_device = util.get_device_list_by_class("Pool")[0]
- self._element = None
-
- @property
- def pool_device(self):
- """The tango pool device"""
- return self._pool_device
-
- @property
- def pool(self):
- """The sardana pool object"""
- return self.pool_device.pool
-
- def get_element(self):
- """Returns the underlying pool element object
-
- :return: the underlying pool element object
- :rtype: :class:`~sardana.pool.poolelement.PoolElement`"""
- return self._element
-
- def set_element(self, element):
- """Associates this device with the sardana element
-
- :param element: the sardana element
- :type element: :class:`~sardana.pool.poolelement.PoolElement`"""
- self._element = element
-
- element = property(get_element, set_element, doc="The underlying sardana element")
-
- def init_device(self):
- """Initialize the device. Called during startup after :meth:`init` and
- every time the tango ``Init`` command is executed.
- Override when necessary but **always** call the method from your super
- class"""
- SardanaDevice.init_device(self)
-
- def delete_device(self):
- """Clean the device. Called during shutdown and every time the tango
- ``Init`` command is executed.
- Override when necessary but **always** call the method from your super
- class"""
- SardanaDevice.delete_device(self)
-
- def Abort(self):
- """The tango abort command. Aborts the active operation"""
- self.element.abort()
- try:
- self.element.get_state(cache=False, propagate=2)
- except:
- self.warning("Abort: failed to read state")
-
- def is_Abort_allowed(self):
- """Returns True if it is allowed to execute the tango abort command
-
- :return: True if it is allowed to execute the tango abort command or
- False otherwise
- :rtype: bool"""
- return self.get_state() != DevState.UNKNOWN
-
- def Stop(self):
- """The tango stop command. Stops the active operation"""
- self.element.stop()
- try:
- self.element.get_state(cache=False, propagate=2)
- except:
- self.info("Stop: failed to read state")
-
- def is_Stop_allowed(self):
- """Returns True if it is allowed to execute the tango stop command
-
- :return: True if it is allowed to execute the tango stop command or
- False otherwise
- :rtype: bool"""
- return self.get_state() != DevState.UNKNOWN
-
- def _is_allowed(self, req_type):
- """Generic is_allowed"""
-# state = self.get_state()
-# if state in self.ExtremeErrorStates:
-# return False
-# if req_type == AttReqType.WRITE_REQ:
-# if state in self.BusyStates:
-# return False
- return True
-
- def get_dynamic_attributes(self):
- """Returns the standard dynamic and fully dynamic attributes for this
- device. The return is a tuple of two dictionaries:
-
- - standard attributes: caseless dictionary with key being the attribute
- name and value is a tuple of attribute name(str), tango information,
- attribute information
- - dynamic attributes: caseless dictionary with key being the attribute
- name and value is a tuple of attribute name(str), tango information,
- attribute information
-
- **tango information**
- seq< :class:`~PyTango.CmdArgType`, :class:`~PyTango.AttrDataFormat`, :class:`~PyTango.AttrWriteType` >
-
- **attribute information**
- attribute information as returned by the sardana controller
-
- :return: the standard dynamic and fully dynamic attributes
- :rtype: seq< :class:`~taurus.core.util.CaselessDict`, :class:`~taurus.core.util.CaselessDict`\>
- """
- return CaselessDict(), CaselessDict()
-
- def initialize_dynamic_attributes(self):
- """Initializes this device dynamic attributes"""
- self._attributes = attrs = CaselessDict()
-
- attr_data = self.get_dynamic_attributes()
-
- std_attrs, dyn_attrs = attr_data
- self.remove_unwanted_dynamic_attributes(std_attrs, dyn_attrs)
-
- if std_attrs is not None:
- read = self.__class__._read_DynamicAttribute
- write = self.__class__._write_DynamicAttribute
- is_allowed = self.__class__._is_DynamicAttribute_allowed
- for attr_name, data_info in std_attrs.items():
- attr_name, data_info, attr_info = data_info
- attr = self.add_standard_attribute(attr_name, data_info,
- attr_info, read,
- write, is_allowed)
- attrs[attr.get_name()] = None
-
- if dyn_attrs is not None:
- read = self.__class__._read_DynamicAttribute
- write = self.__class__._write_DynamicAttribute
- is_allowed = self.__class__._is_DynamicAttribute_allowed
- for attr_name, data_info in dyn_attrs.items():
- attr_name, data_info, attr_info = data_info
- attr = self.add_dynamic_attribute(attr_name, data_info,
- attr_info, read,
- write, is_allowed)
- attrs[attr.get_name()] = None
- return attrs
-
- def remove_unwanted_dynamic_attributes(self, new_std_attrs, new_dyn_attrs):
- """Removes unwanted dynamic attributes from previous device creation"""
-
- dev_class = self.get_device_class()
- multi_attr = self.get_device_attr()
- multi_class_attr = dev_class.get_class_attr()
- static_attr_names = map(str.lower, dev_class.attr_list.keys())
- static_attr_names.extend(('state', 'status'))
-
- new_attrs = CaselessDict(new_std_attrs)
- new_attrs.update(new_dyn_attrs)
-
- device_attr_names = []
- for i in range(multi_attr.get_attr_nb()):
- device_attr_names.append(multi_attr.get_attr_by_ind(i).get_name())
-
- for attr_name in device_attr_names:
- attr_name_lower = attr_name.lower()
- if attr_name_lower in static_attr_names:
- continue
- try:
- self.remove_attribute(attr_name)
- except:
- self.warning("Error removing dynamic attribute %s",
- attr_name_lower)
- self.debug("Details:", exc_info=1)
-
- klass_attr_names = []
- klass_attrs = multi_class_attr.get_attr_list()
- for ind in range(len(klass_attrs)):
- klass_attr_names.append(klass_attrs[ind].get_name())
-
- for attr_name in klass_attr_names:
- attr_name_lower = attr_name.lower()
- if attr_name_lower in static_attr_names:
- continue
- # if new dynamic attribute is in class attribute then delete it
- # from class attribute to be later on added again (eventually
- # with diffent data type or data format)
- if attr_name_lower in new_attrs:
- try:
- attr = multi_class_attr.get_attr(attr_name)
-
- old_type = CmdArgType(attr.get_type())
- old_format = attr.get_format()
- old_access = attr.get_writable()
-
- new_attr = new_attrs[attr_name]
- new_type, new_format, new_access = new_attr[1][0][:3]
- differ = new_type != old_type or \
- new_format != old_format or \
- new_access != old_access
- if differ:
- self.info("Replacing dynamic attribute %s", attr_name)
- self.debug("old type: %s, new type: %s",
- old_type, new_type)
- self.debug("old format: %s, new format: %s",
- old_format, new_format)
- self.debug("old access: %s, new access: %s",
- old_access, new_access)
- multi_class_attr.remove_attr(attr.get_name(),
- attr.get_cl_name())
- except:
- self.warning("Error removing dynamic attribute %s from "\
- " device class", attr_name)
- self.debug("Details:", exc_info=1)
-
- def add_dynamic_attribute(self, attr_name, data_info, attr_info, read,
- write, is_allowed):
- """Adds a single dynamic attribute
-
- :param str attr_name: the attribute name
- :param data_info: tango attribute information
- :type data_info: seq< :class:`~PyTango.CmdArgType`, :class:`~PyTango.AttrDataFormat`, :class:`~PyTango.AttrWriteType` >
- :param attr_info: attribute information
- :param read: read method for the attribute
- :param write: write method for the attribute
- :param is_allowed: is allowed method"""
- tg_type, tg_format, tg_access = data_info[0]
-
- if tg_access == READ:
- write = None
- if tg_format == SCALAR:
- attr = GenericScalarAttr(attr_name, tg_type, tg_access)
- if tg_format == SPECTRUM:
- dim_x = attr_info.maxdimsize[0]
- attr = GenericSpectrumAttr(attr_name, tg_type, tg_access,
- dim_x=dim_x)
- elif tg_format == IMAGE:
- dim_x, dim_y = attr_info.maxdimsize
- attr = GenericImageAttr(attr_name, tg_type, tg_access,
- dim_x=dim_x, dim_y=dim_y)
-
- if tg_access == READ_WRITE and tg_format == SCALAR:
- memorized = attr_info.memorized.lower()
- if memorized == 'true':
- attr.set_memorized()
- attr.set_memorized_init(True)
- elif memorized == 'true_without_hard_applied':
- attr.set_memorized()
- attr.set_memorized_init(False)
- attr.set_disp_level(DispLevel.EXPERT)
- return self.add_attribute(attr, read, write, is_allowed)
-
- def add_standard_attribute(self, attr_name, data_info, attr_info, read,
- write, is_allowed):
- """Adds a single standard dynamic attribute
-
- :param str attr_name: the attribute name
- :param data_info: tango attribute information
- :type data_info: seq< :class:`~PyTango.CmdArgType`, :class:`~PyTango.AttrDataFormat`, :class:`~PyTango.AttrWriteType` >
- :param attr_info: attribute information
- :param read: read method for the attribute
- :param write: write method for the attribute
- :param is_allowed: is allowed method"""
- dev_class = self.get_device_class()
- attr_data = AttrData(attr_name, dev_class.get_name(), data_info)
- attr = self.add_attribute(attr_data, read, write, is_allowed)
- return attr
-
- def read_DynamicAttribute(self, attr):
- """Generic read dynamic attribute.
- Default implementation raises :exc:`NotImplementedError`
-
- :param attr: attribute to be read
- :type attr: :class:`~PyTango.Attribute`
-
- :raises: :exc:`NotImplementedError`"""
- raise NotImplementedError
-
- def write_DynamicAttribute(self, attr):
- """Generic write dynamic attribute.
- Default implementation raises :exc:`NotImplementedError`
-
- :param attr: attribute to be written
- :type attr: :class:`~PyTango.Attribute`
-
- :raises: :exc:`NotImplementedError`"""
- raise NotImplementedError
-
- def is_DynamicAttribute_allowed(self, req_type):
- """Generic is dynamic attribute allowed.
- Default implementation calls :meth:`_is_allowed`
-
- :param req_type: request type
- :type attr: :class:`~PyTango.AttrRequestType`"""
- return self._is_allowed(req_type)
-
- def _read_DynamicAttribute(self, attr):
- """Generic internal read dynamic attribute.
- Checks if this object has a 'read_'+<attr_name> method and calls it.
- If not calls :meth:`read_DynamicAttribute`.
-
- :param attr: attribute to be read
- :type attr: :class:`~PyTango.Attribute`"""
- name = attr.get_name()
-
- read_name = "read_" + name
- if hasattr(self, read_name):
- read = getattr(self, read_name)
- return read(attr)
-
- return self.read_DynamicAttribute(attr)
-
- def _write_DynamicAttribute(self, attr):
- """Generic internal write dynamic attribute.
- Checks if this object has a 'write_'+<attr_name> method and calls it.
- If not calls :meth:`write_DynamicAttribute`.
-
- :param attr: attribute to be written
- :type attr: :class:`~PyTango.Attribute`"""
- name = attr.get_name()
- write_name = "write_" + name
- if hasattr(self, write_name):
- write = getattr(self, write_name)
- return write(attr)
- return self.write_DynamicAttribute(attr)
-
- def _is_DynamicAttribute_allowed(self, req_type):
- """Generic is dynamic attribute allowed.
- Default implementation calls :meth:`is_DynamicAttribute_allowed`
-
- :param req_type: request type
- :type attr: :class:`~PyTango.AttrRequestType`"""
- return self.is_DynamicAttribute_allowed(req_type)
-
- def dev_state(self):
- """Calculates and returns the device state. Called by Tango on a read
- state request.
-
- :return: the device state
- :rtype: :class:`~PyTango.DevState`"""
- element = self.element
- try:
- use_cache = element.is_in_operation() and not self.Force_HW_Read
- ctrl_state = element.get_state(cache=use_cache, propagate=0)
- state = self.calculate_tango_state(ctrl_state)
- return state
- except:
- self.error("Exception trying to return state")
- self.debug("Details:", exc_info=1)
- return DevState.FAULT
-
- def dev_status(self):
- """Calculates and returns the device status. Called by Tango on a read
- status request.
-
- :return: the device status
- :rtype: str"""
- element = self.element
- try:
- use_cache = element.is_in_operation() and not self.Force_HW_Read
- ctrl_status = self.element.get_status(cache=use_cache, propagate=0)
- status = self.calculate_tango_status(ctrl_status)
- return status
- except Exception, e:
- msg = "Exception trying to return status: %s" % str(e)
- self.error(msg)
- self.debug("Details:", exc_info=1)
- return msg
-
- def wait_for_operation(self):
- """Waits for an operation to finish. It uses the maxumum number of
- retries. Sleeps 0.01s between retries.
-
- :raises: :exc:`Exception` in case of a timeout"""
- element, n = self.element, self.BusyRetries
- while element.is_in_operation():
- if n == 0:
- raise Exception("Wait for operation timedout")
- time.sleep(0.01)
- self.warning("waited for operation")
- n = n - 1
-
- def Restore(self):
- """Restore tango command. Restores the attributes to their former glory.
- This applies to memorized writable attributes which have a set point
- stored in the database"""
- restore_attributes, db_values = self.get_restore_data()
- multi_attribute = self.get_device_attr()
-
- for attr_name in restore_attributes:
- props = db_values[attr_name]
- if props is None or not "__value" in props:
- continue
- attribute = multi_attribute.get_w_attr_by_name(attr_name)
- write_meth_name = "write_" + attr_name
- write_meth = getattr(self, write_meth_name, None)
- if write_meth is None:
- self.warning("Could not recover %s: %s does not exist",
- attr_name, write_meth_name)
- continue
- self.restore_attribute(attribute, write_meth, props['__value'])
-
- def get_restore_data(self):
- restore_attributes = self.get_attributes_to_restore()
- db = Util.instance().get_database()
- db_values = db.get_device_attribute_property(self.get_name(),
- restore_attributes)
- return restore_attributes, db_values
-
- def get_attributes_to_restore(self):
- std_attrs, dyn_attrs = self.get_dynamic_attributes()
- multi_attribute = self.get_device_attr()
-
- restore = []
- for attr_name in std_attrs:
- try:
- attribute = multi_attribute.get_w_attr_by_name(attr_name)
- except DevFailed:
- continue
- restore.append(attribute.get_name())
- for attr_name in dyn_attrs:
- try:
- attribute = multi_attribute.get_w_attr_by_name(attr_name)
- except DevFailed:
- continue
- restore.append(attribute.get_name())
- return restore
-
- def _get_attribute_value_from_db_value(self, attribute, db_value):
- value = seqStr_2_obj(db_value, attribute.get_data_type(),
- attribute.get_data_format())
- return value
-
- def restore_attribute(self, attribute, write_meth, db_value):
- value = self._get_attribute_value_from_db_value(attribute, db_value)
- attr_name = attribute.get_name()
- try:
- attribute.set_write_value(value)
- self.info("Restoring %s", attr_name)
- write_meth(attribute)
- except:
- self.warning("Could not recover %s: Error in write", attr_name)
- self.debug("Details:", exc_info=1)
-
-
-
-class PoolDeviceClass(SardanaDeviceClass):
- """Base Tango Pool Device Class class"""
-
- #:
- #: Sardana device class properties definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- class_property_list = SardanaDeviceClass.class_property_list
-
- #:
- #: Sardana device properties definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- device_property_list = {
- 'Id' : [DevLong64, "Internal ID", InvalidId ],
- 'Force_HW_Read' : [DevBoolean, "Force a hardware read of value even "
- "when in operation (motion/acquisition",
- False],
- }
- device_property_list.update(SardanaDeviceClass.device_property_list)
-
- #:
- #: Sardana device command definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- cmd_list = {
- 'Stop' : [ [DevVoid, ""], [DevVoid, ""] ],
- 'Abort' : [ [DevVoid, ""], [DevVoid, ""] ],
- 'Restore' : [ [DevVoid, ""], [DevVoid, ""] ],
- }
- cmd_list.update(SardanaDeviceClass.cmd_list)
-
- #:
- #: Sardana device attribute definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- attr_list = {
- }
- attr_list.update(SardanaDeviceClass.attr_list)
-
- standard_attr_list = {}
-
- def _get_class_properties(self):
- ret = SardanaDeviceClass._get_class_properties(self)
- ret['Description'] = "Generic Pool device class"
- ret['InheritedFrom'].insert(0, 'SardanaDevice')
- return ret
-
-
-class PoolElementDevice(PoolDevice):
- """Base Tango Pool Element Device class"""
-
- def init_device(self):
- """Initialize the device. Called during startup after :meth:`init` and
- every time the tango ``Init`` command is executed.
- Override when necessary but **always** call the method from your super
- class"""
- PoolDevice.init_device(self)
-
- self.instrument = None
- self.ctrl = None
- try:
- instrument_id = int(self.Instrument_id)
- if instrument_id != InvalidId:
- instrument = self.pool.get_element_by_id(instrument_id)
- self.instrument = instrument
- except ValueError:
- pass
- try:
- ctrl_id = int(self.Ctrl_id)
- if ctrl_id != InvalidId:
- ctrl = self.pool.get_element_by_id(ctrl_id)
- self.ctrl = ctrl
- except ValueError:
- pass
-
- def read_Instrument(self, attr):
- """Read the value of the ``Instrument`` tango attribute.
- Returns the instrument full name or empty string if this element doesn't
- belong to any instrument
-
- :param attr: tango instrument attribute
- :type attr: :class:`~PyTango.Attribute`"""
- instrument = self.element.instrument
- if instrument is None:
- attr.set_value('')
- else:
- attr.set_value(instrument.full_name)
-
- def write_Instrument(self, attr):
- """Write the value of the ``Instrument`` tango attribute.
- Sets a new instrument full name or empty string if this element doesn't
- belong to any instrument.
- The instrument **must** have been previously created.
-
- :param attr: tango instrument attribute
- :type attr: :class:`~PyTango.Attribute`"""
- name = attr.get_write_value()
- instrument = None
- if name:
- instrument = self.pool.get_element(full_name=name)
- if instrument.get_type() != ElementType.Instrument:
- raise Exception("%s is not an instrument" % name)
- self.element.instrument = instrument
- db = Util.instance().get_database()
- db.put_device_property(self.get_name(), { "Instrument_id" : instrument.id })
-
- def get_dynamic_attributes(self):
- """Override of :class:`PoolDevice.get_dynamic_attributes`.
- Returns the standard dynamic and fully dynamic attributes for this
- device. The return is a tuple of two dictionaries:
-
- - standard attributes: caseless dictionary with key being the attribute
- name and value is a tuple of attribute name(str), tango information,
- attribute information
- - dynamic attributes: caseless dictionary with key being the attribute
- name and value is a tuple of attribute name(str), tango information,
- attribute information
-
- **tango information**
- seq< :class:`~PyTango.CmdArgType`, :class:`~PyTango.AttrDataFormat`, :class:`~PyTango.AttrWriteType` >
-
- **attribute information**
- attribute information as returned by the sardana controller
-
- :return: the standard dynamic and fully dynamic attributes
- :rtype: seq< :class:`~taurus.core.util.CaselessDict`, :class:`~taurus.core.util.CaselessDict`\>
- """
-
- if hasattr(self, "_dynamic_attributes_cache"):
- return self._standard_attributes_cache, self._dynamic_attributes_cache
- ctrl = self.ctrl
- if ctrl is None:
- self.warning("no controller: dynamic attributes NOT created")
- return PoolDevice.get_dynamic_attributes(self)
- if not ctrl.is_online():
- self.warning("controller offline: dynamic attributes NOT created")
- return PoolDevice.get_dynamic_attributes(self)
-
- self._dynamic_attributes_cache = dyn_attrs = CaselessDict()
- self._standard_attributes_cache = std_attrs = CaselessDict()
- dev_class = self.get_device_class()
- axis_attrs = ctrl.get_axis_attributes(self.element.axis)
-
- std_attrs_lower = [ attr.lower() for attr in dev_class.standard_attr_list ]
- for attr_name, attr_info in axis_attrs.items():
- attr_name_lower = attr_name.lower()
- if attr_name_lower in std_attrs_lower:
- data_info = DataInfo.toDataInfo(attr_name, attr_info)
- tg_info = dev_class.standard_attr_list[attr_name]
- std_attrs[attr_name] = attr_name, tg_info, data_info
- else:
- data_info = DataInfo.toDataInfo(attr_name, attr_info)
- name, tg_info = to_tango_attr_info(attr_name, data_info)
- dyn_attrs[attr_name] = name, tg_info, data_info
- return std_attrs, dyn_attrs
-
- def read_DynamicAttribute(self, attr):
- """Read a generic dynamic attribute. Calls the controller of this
- element to get the dynamic attribute value
-
- :param attr: tango attribute
- :type attr: :class:`~PyTango.Attribute`"""
- name = attr.get_name()
- ctrl = self.ctrl
- if ctrl is None:
- raise Exception("Cannot read %s. Controller not build!" % name)
- v = ctrl.get_axis_attr(self.element.axis, name)
- if v is None:
- raise TypeError("Cannot read %s. Controller returns None" % (name,))
- attr.set_value(v)
-
- def write_DynamicAttribute(self, attr):
- """Write a generic dynamic attribute. Calls the controller of this
- element to get the dynamic attribute value
-
- :param attr: tango attribute
- :type attr: :class:`~PyTango.Attribute`"""
- name = attr.get_name()
- value = attr.get_write_value()
- self.debug("writing dynamic attribute %s with value %s", name, value)
- ctrl = self.ctrl
- if ctrl is None:
- raise Exception("Cannot write %s. Controller not build!" % name)
- ctrl.set_axis_attr(self.element.axis, name, value)
-
- def read_SimulationMode(self, attr):
- """Read the current simulation mode.
-
- :param attr: tango attribute
- :type attr: :class:`~PyTango.Attribute`"""
- attr.set_value(self.element.simulation_mode)
-
- def write_SimulationMode(self, attr):
- """Sets the simulation mode.
-
- :param attr: tango attribute
- :type attr: :class:`~PyTango.Attribute`"""
- self.element.simulation_mode = attr.get_write_value()
-
-
-class PoolElementDeviceClass(PoolDeviceClass):
- """Base Tango Pool Element Device Class class"""
-
- #:
- #: Sardana device properties definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- device_property_list = {
- "Axis" : [ DevLong64, "Axis in the controller", [ InvalidAxis ] ],
- "Ctrl_id" : [ DevLong64, "Controller ID", [ InvalidId ] ],
- "Instrument_id" : [ DevLong64, "Controller ID", [ InvalidId ] ],
- }
- device_property_list.update(PoolDeviceClass.device_property_list)
-
- #:
- #: Sardana device attribute definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- attr_list = {
- 'Instrument' : [ [DevString, SCALAR, READ_WRITE],
- { 'label' : "Instrument",
- 'Display level' : DispLevel.EXPERT } ],
- 'SimulationMode': [ [DevBoolean, SCALAR, READ_WRITE],
- { 'label' : "Simulation mode" } ],
- }
- attr_list.update(PoolDeviceClass.attr_list)
-
- cmd_list = {
- }
- cmd_list.update(PoolDeviceClass.cmd_list)
-
- def get_standard_attr_info(self, attr):
- """Returns information about the standard attribute
-
- :param str attr: attribute name
- :return: a sequence of tango data_type, data format"""
- return self.standard_attr_list[attr]
-
- def _get_class_properties(self):
- ret = PoolDeviceClass._get_class_properties(self)
- ret['Description'] = "Generic Pool element device class"
- ret['InheritedFrom'].insert(0, 'PoolDevice')
- return ret
-
-
-class PoolGroupDevice(PoolDevice):
- """Base Tango Pool Group Device class"""
-
- def read_ElementList(self, attr):
- """Read the element list.
-
- :param attr: tango attribute
- :type attr: :class:`~PyTango.Attribute`"""
- attr.set_value(self.get_element_names())
-
- def get_element_names(self):
- """Returns the list of element names.
-
- :return: a list of attribute names"""
- elements = self.element.get_user_elements()
- return [ element.name for element in elements ]
-
- def elements_changed(self, evt_src, evt_type, evt_value):
- """Callback for when the elements of this group changed"""
- self.push_change_event("ElementList", self.get_element_names())
-
-
-class PoolGroupDeviceClass(PoolDeviceClass):
- """Base Tango Pool Group Device Class class"""
-
- #:
- #: Sardana device properties definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- device_property_list = {
- "Elements" : [ DevVarStringArray, "elements in the group", [ ] ],
- }
- device_property_list.update(PoolDeviceClass.device_property_list)
-
- #:
- #: Sardana device command definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- cmd_list = {
- }
- cmd_list.update(PoolDeviceClass.cmd_list)
-
- #:
- #: Sardana device attribute definition
- #:
- #: .. seealso:: :ref:`server`
- #:
- attr_list = {
- 'ElementList' : [ [ DevString, SPECTRUM, READ, 4096] ],
- }
- attr_list.update(PoolDeviceClass.attr_list)
-
- def _get_class_properties(self):
- ret = PoolDeviceClass._get_class_properties(self)
- ret['Description'] = "Generic Pool group device class"
- ret['InheritedFrom'].insert(0, 'PoolDevice')
- return ret
diff --git a/src/sardana/tango/pool/PseudoCounter.py b/src/sardana/tango/pool/PseudoCounter.py
deleted file mode 100644
index 900b1936..00000000
--- a/src/sardana/tango/pool/PseudoCounter.py
+++ /dev/null
@@ -1,245 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["PseudoCounter", "PseudoCounterClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import Except, READ, SCALAR, DevDouble, \
- DevVarStringArray, DevVarDoubleArray, DevState, AttrQuality, DevFailed
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.tango.core.util import to_tango_type_format, exception_str, \
- throw_sardana_exception
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class PseudoCounter(PoolElementDevice):
-
- def __init__(self, dclass, name):
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def _is_allowed(self, req_type):
- return PoolElementDevice._is_allowed(self, req_type)
-
- def get_pseudo_counter(self):
- return self.element
-
- def set_pseudo_counter(self, pseudo_counter):
- self.element = pseudo_counter
-
- pseudo_counter = property(get_pseudo_counter, set_pseudo_counter)
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- pseudo_counter = self.pseudo_counter
- if pseudo_counter is not None:
- pseudo_counter.remove_listener(self.on_pseudo_counter_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
-
- self.Elements = map(int, self.Elements)
- pseudo_counter = self.pseudo_counter
- if pseudo_counter is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.pseudo_counter = pseudo_counter = \
- self.pool.create_element(type="PseudoCounter", name=name,
- full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id, user_elements=self.Elements)
- if self.instrument is not None:
- pseudo_counter.set_instrument(self.instrument)
- pseudo_counter.add_listener(self.on_pseudo_counter_changed)
-
- self.set_state(DevState.ON)
-
- def on_pseudo_counter_changed(self, event_source, event_type,
- event_value):
- try:
- self._on_pseudo_counter_changed(event_source, event_type,
- event_value)
- except:
- msg = 'Error occurred "on_pseudo_counter_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.pseudo_counter.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_pseudo_counter_changed(self, event_source, event_type,
- event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
- try:
- attr = self.get_attribute_by_name(name)
- except DevFailed:
- return
-
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
- else:
- value = event_value
- state = self.pseudo_counter.get_state(propagate=0)
-
- if name == "value":
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
-
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.pseudo_counter.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For value attribute, listen to what the controller says for data
- # type (between long and float)
- value = std_attrs.get('value')
- if value is not None:
- _, data_info, attr_info = value
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
- return std_attrs, dyn_attrs
-
- def initialize_dynamic_attributes(self):
- attrs = PoolElementDevice.initialize_dynamic_attributes(self)
-
- detect_evts = "value",
- non_detect_evts = ()
-
- for attr_name in detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, True)
- for attr_name in non_detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, False)
-
- def read_Value(self, attr):
- pseudo_counter = self.pseudo_counter
- use_cache = pseudo_counter.is_in_operation() and not self.Force_HW_Read
- value = pseudo_counter.get_value(cache=use_cache, propagate=0)
- if value.error:
- Except.throw_python_exception(*value.exc_info)
- quality = None
- state = pseudo_counter.get_state(cache=use_cache, propagate=0)
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value.value, quality=quality,
- priority=0, timestamp=value.timestamp)
-
- is_Value_allowed = _is_allowed
-
- def CalcPseudo(self, physical_values):
- """Returns the pseudo counter value for the given physical counters"""
- if not len(physical_values):
- physical_values = None
- result = self.pseudo_counter.calc(physical_values=physical_values)
- if result.error:
- throw_sardana_exception(result)
- return result.value
-
- def CalcAllPseudo(self, physical_values):
- """Returns the pseudo counter values for the given physical counters"""
- if not len(physical_values):
- physical_values = None
- result = self.pseudo_counter.calc(physical_values=physical_values)
- if result.error:
- throw_sardana_exception(result)
- return result.value
-
-
-class PseudoCounterClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- "Elements" : [ DevVarStringArray, "elements used by the pseudo", [ ] ],
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'CalcPseudo' : [ [DevVarDoubleArray, "physical values"], [DevDouble, "pseudo counter"] ],
- 'CalcAllPseudo' : [ [DevVarDoubleArray, "physical positions"], [DevVarDoubleArray, "pseudo counter values"] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- standard_attr_list = {
- 'Value' : [ [ DevDouble, SCALAR, READ ] ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "Pseudo counter device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/PseudoMotor.py b/src/sardana/tango/pool/PseudoMotor.py
deleted file mode 100644
index 1b6e472f..00000000
--- a/src/sardana/tango/pool/PseudoMotor.py
+++ /dev/null
@@ -1,301 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["PseudoMotor", "PseudoMotorClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import DevFailed, Except, READ_WRITE, SCALAR, DevVoid, \
- DevDouble, DevBoolean, DevVarStringArray, DevVarDoubleArray, DevState, \
- AttrQuality
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, SardanaServer
-from sardana.sardanaexception import SardanaException
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.tango.core.util import exception_str, to_tango_type_format, \
- throw_sardana_exception
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class PseudoMotor(PoolElementDevice):
-
- def __init__(self, dclass, name):
- self.in_write_position = False
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def _is_allowed(self, req_type):
- return PoolElementDevice._is_allowed(self, req_type)
-
- def get_pseudo_motor(self):
- return self.element
-
- def set_pseudo_motor(self, pseudo_motor):
- self.element = pseudo_motor
-
- pseudo_motor = property(get_pseudo_motor, set_pseudo_motor)
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- pseudo_motor = self.pseudo_motor
- if pseudo_motor is not None:
- pseudo_motor.remove_listener(self.on_pseudo_motor_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
-
- self.Elements = map(int, self.Elements)
- pseudo_motor = self.pseudo_motor
- if self.pseudo_motor is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.pseudo_motor = pseudo_motor = \
- self.pool.create_element(type="PseudoMotor", name=name,
- full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id, user_elements=self.Elements)
- if self.instrument is not None:
- pseudo_motor.set_instrument(self.instrument)
- pseudo_motor.set_drift_correction(self.DriftCorrection)
- pseudo_motor.add_listener(self.on_pseudo_motor_changed)
-
- self.set_state(DevState.ON)
-
- def on_pseudo_motor_changed(self, event_source, event_type, event_value):
- try:
- self._on_pseudo_motor_changed(event_source, event_type,
- event_value)
- except:
- msg = 'Error occurred "on_pseudo_motor_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.pseudo_motor.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_pseudo_motor_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- try:
- attr = self.get_attribute_by_name(name)
- except DevFailed:
- return
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
- else:
- value = event_value
- state = self.pseudo_motor.get_state(propagate=0)
-
- if name == "position":
- w_value = event_value.w_value
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
-
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.pseudo_motor.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For position attribute, listen to what the controller says for
- # data type (between long and float)
- pos = std_attrs.get('position')
- if pos is not None:
- _, data_info, attr_info = pos
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
- return std_attrs, dyn_attrs
-
- def initialize_dynamic_attributes(self):
- attrs = PoolElementDevice.initialize_dynamic_attributes(self)
-
- detect_evts = "position",
- non_detect_evts = ()
-
- for attr_name in detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, True)
- for attr_name in non_detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, False)
- return
-
- def read_Position(self, attr):
- pseudo_motor = self.pseudo_motor
- use_cache = pseudo_motor.is_in_operation() and not self.Force_HW_Read
- position = pseudo_motor.get_position(cache=use_cache, propagate=0)
- if position.error:
- throw_sardana_exception(position)
- state = pseudo_motor.get_state(cache=use_cache, propagate=0)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=position.value, w_value=position.w_value,
- quality=quality, priority=0,
- timestamp=position.timestamp)
-
- def write_Position(self, attr):
- self.in_write_position = True
- try:
- position = attr.get_write_value()
- self.debug("write_Position(%s)", position)
- try:
- self.wait_for_operation()
- except:
- raise Exception("Cannot move: already in motion")
- pseudo_motor = self.pseudo_motor
- try:
- pseudo_motor.position = position
- except SardanaException as se:
- throw_sardana_exception(se)
- finally:
- self.in_write_position = False
-
- def CalcPseudo(self, physical_positions):
- """Returns the pseudo motor position for the given physical positions"""
- if not len(physical_positions):
- physical_positions = None
- result = self.pseudo_motor.calc_pseudo(physical_positions=physical_positions)
- if result.error:
- throw_sardana_exception(result)
- return result.value
-
- def CalcPhysical(self, pseudo_position):
- """Returns the physical motor positions for the given pseudo motor
- position assuming the current pseudo motor write positions for all the
- other sibling pseudo motors"""
- result = self.pseudo_motor.calc_physical(pseudo_position)
- if result.error:
- throw_sardana_exception(result)
- return result.value
-
- def CalcAllPhysical(self, pseudo_positions):
- """Returns the physical motor positions for the given pseudo motor
- position(s)"""
- result = self.pseudo_motor.calc_physical(pseudo_positions)
- if result.error:
- throw_sardana_exception(result)
- return result.value
-
- def CalcAllPseudo(self, physical_positions):
- """Returns the pseudo motor position(s) for the given physical positions"""
- result = self.pseudo_motor.calc_all_pseudo(physical_positions)
- if result.error:
- throw_sardana_exception(result)
- return result.value
-
- def MoveRelative(self, argin):
- raise NotImplementedError
-
- def is_MoveRelative_allowed(self):
- if self.get_state() in (DevState.FAULT, DevState.MOVING,
- DevState.UNKNOWN):
- return False
- return True
-
- is_Position_allowed = _is_allowed
-
-
-class PseudoMotorClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- "Elements" : [ DevVarStringArray, "elements used by the pseudo", [ ] ],
- 'DriftCorrection':
- [DevBoolean,
- "Locally apply drift correction on pseudo motors. Default is the "
- "current global drift correction in the Pool Device",
- None],
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'CalcPseudo' : [ [DevVarDoubleArray, "physical positions"], [DevDouble, "pseudo position"] ],
- 'CalcPhysical' : [ [DevDouble, "pseudo position"], [DevVarDoubleArray, "physical positions"] ],
- 'CalcAllPseudo' : [ [DevVarDoubleArray, "physical positions"], [DevVarDoubleArray, "pseudo positions"] ],
- 'CalcAllPhysical' : [ [DevVarDoubleArray, "pseudo positions"], [DevVarDoubleArray, "physical positions"] ],
- 'MoveRelative' : [ [DevDouble, "amount to move"], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- standard_attr_list = {
- 'Position' : [ [ DevDouble, SCALAR, READ_WRITE ],
- { 'label' : "Position",
- 'abs_change' : '1.0', }, ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "Pseudo motor device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/TwoDExpChannel.py b/src/sardana/tango/pool/TwoDExpChannel.py
deleted file mode 100644
index 79f862e7..00000000
--- a/src/sardana/tango/pool/TwoDExpChannel.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["TwoDExpChannel", "TwoDExpChannelClass"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-
-from PyTango import DevFailed, DevVoid, DevString, DevState, AttrQuality, \
- Except, READ, SCALAR
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, DataFormat, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.controller import TwoDController, MaxDimSize, Type
-from sardana.tango.core.util import to_tango_type_format, exception_str
-
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class TwoDExpChannel(PoolElementDevice):
-
- def __init__(self, dclass, name):
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def get_twod(self):
- return self.element
-
- def set_twod(self, twod):
- self.element = twod
-
- twod = property(get_twod, set_twod)
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- twod = self.twod
- if twod is not None:
- twod.remove_listener(self.on_twod_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
- twod = self.twod
- if twod is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.twod = twod = \
- self.pool.create_element(type="TwoDExpChannel",
- name=name, full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id)
- if self.instrument is not None:
- twod.set_instrument(self.instrument)
- twod.add_listener(self.on_twod_changed)
-
- ## force a state read to initialize the state attribute
- #state = ct.state
- self.set_state(DevState.ON)
-
- def on_twod_changed(self, event_source, event_type, event_value):
- try:
- self._on_twod_changed(event_source, event_type, event_value)
- except not DevFailed:
- msg = 'Error occurred "on_twod_changed(%s.%s): %s"'
- exc_info = sys.exc_info()
- self.error(msg, self.motor.name, event_type.name,
- exception_str(*exc_info[:2]))
- self.debug("Details", exc_info=exc_info)
-
- def _on_twod_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name.lower()
-
- try:
- attr = self.get_attribute_by_name(name)
- except DevFailed:
- return
-
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- value, w_value, error = None, None, None
-
- if name == "state":
- value = self.calculate_tango_state(event_value)
- elif name == "status":
- value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- else:
- value = event_value.value
- timestamp = event_value.timestamp
-
- if name == "value":
- state = self.oned.get_state()
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value, w_value=w_value,
- timestamp=timestamp, quality=quality,
- priority=priority, error=error, synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.twod.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For value attribute, listen to what the controller says for data
- # type (between long and float) and length
- value = std_attrs.get('value')
- if value is not None:
- _, data_info, attr_info = value
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
- shape = attr_info.maxdimsize
- data_info[0][3] = shape[0]
- data_info[0][4] = shape[1]
- return std_attrs, dyn_attrs
-
- def read_Value(self, attr):
- twod = self.twod
- use_cache = twod.is_in_operation() and not self.Force_HW_Read
- value = twod.get_value(cache=use_cache, propagate=0)
- if value.error:
- Except.throw_python_exception(*value.exc_info)
- state = twod.get_state(cache=use_cache, propagate=0)
- quality = None
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value.value, quality=quality,
- timestamp=value.timestamp, priority=0)
-
- def is_Value_allowed(self, req_type):
- if self.get_state() in [DevState.FAULT, DevState.UNKNOWN]:
- return False
- return True
-
- def read_DataSource(self, attr):
- data_source = self.twod.get_data_source()
- if data_source is None:
- data_source = "tango://{0}/value".format(self.get_full_name())
- attr.set_value(data_source)
-
- def Start(self):
- self.twod.start_acquisition()
-
-
-_DFT_VALUE_INFO = TwoDController.standard_axis_attributes['Value']
-_DFT_VALUE_MAX_SHAPE = _DFT_VALUE_INFO[MaxDimSize]
-_DFT_VALUE_TYPE, _DFT_VALUE_FORMAT = to_tango_type_format(_DFT_VALUE_INFO[Type], DataFormat.TwoD)
-
-class TwoDExpChannelClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'Start' : [ [DevVoid, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {
- 'DataSource' : [ [ DevString, SCALAR, READ ] ],
- }
- attr_list.update(PoolElementDeviceClass.attr_list)
-
- standard_attr_list = {
- 'Value' : [ [ _DFT_VALUE_TYPE, _DFT_VALUE_FORMAT, READ,
- _DFT_VALUE_MAX_SHAPE[0], _DFT_VALUE_MAX_SHAPE[1] ],
- { 'abs_change' : '1.0', } ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "2D device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/ZeroDExpChannel.py b/src/sardana/tango/pool/ZeroDExpChannel.py
deleted file mode 100644
index b28e7525..00000000
--- a/src/sardana/tango/pool/ZeroDExpChannel.py
+++ /dev/null
@@ -1,254 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__all__ = ["ZeroDExpChannel", "ZeroDExpChannelClass"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from PyTango import Except
-from PyTango import DevVoid, DevDouble, DevString
-from PyTango import DispLevel, DevState, AttrQuality
-from PyTango import READ, READ_WRITE, SCALAR, SPECTRUM
-
-from taurus.core.util.log import DebugIt
-
-from sardana import State, DataFormat, SardanaServer
-from sardana.sardanaattribute import SardanaAttribute
-from sardana.pool.controller import ZeroDController, Type
-from sardana.tango.core.util import to_tango_type_format
-
-from sardana.tango.pool.PoolDevice import PoolElementDevice, \
- PoolElementDeviceClass
-
-
-class ZeroDExpChannel(PoolElementDevice):
-
- def __init__(self, dclass, name):
- PoolElementDevice.__init__(self, dclass, name)
-
- def init(self, name):
- PoolElementDevice.init(self, name)
-
- def get_zerod(self):
- return self.element
-
- def set_zerod(self, zerod):
- self.element = zerod
-
- zerod = property(get_zerod, set_zerod)
-
- @DebugIt()
- def delete_device(self):
- PoolElementDevice.delete_device(self)
- zerod = self.zerod
- if zerod is not None:
- zerod.remove_listener(self.on_zerod_changed)
-
- @DebugIt()
- def init_device(self):
- PoolElementDevice.init_device(self)
- zerod = self.zerod
- if zerod is None:
- full_name = self.get_full_name()
- name = self.alias or full_name
- self.zerod = zerod = \
- self.pool.create_element(type="ZeroDExpChannel", name=name,
- full_name=full_name, id=self.Id, axis=self.Axis,
- ctrl_id=self.Ctrl_id)
- zerod.add_listener(self.on_zerod_changed)
-
- ## force a state read to initialize the state attribute
- #state = zerod.state
- self.set_state(DevState.ON)
-
- def on_zerod_changed(self, event_source, event_type, event_value):
- # during server startup and shutdown avoid processing element
- # creation events
- if SardanaServer.server_state != State.Running:
- return
-
- timestamp = time.time()
- name = event_type.name
- quality = AttrQuality.ATTR_VALID
- priority = event_type.priority
- error = None
- attr = self.get_device_attr().get_attr_by_name(name)
-
- if name == "state":
- event_value = self.calculate_tango_state(event_value)
- elif name == "status":
- event_value = self.calculate_tango_status(event_value)
- else:
- if isinstance(event_value, SardanaAttribute):
- if event_value.error:
- error = Except.to_dev_failed(*event_value.exc_info)
- timestamp = event_value.timestamp
- event_value = event_value.value
-
- if name == "value":
- state = self.zerod.get_state()
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=event_value, timestamp=timestamp,
- quality=quality, priority=priority, error=error,
- synch=False)
-
- def always_executed_hook(self):
- #state = to_tango_state(self.zerod.get_state(cache=False))
- pass
-
- def read_attr_hardware(self, data):
- pass
-
- def get_dynamic_attributes(self):
- cache_built = hasattr(self, "_dynamic_attributes_cache")
-
- std_attrs, dyn_attrs = \
- PoolElementDevice.get_dynamic_attributes(self)
-
- if not cache_built:
- # For value attribute, listen to what the controller says for data
- # type (between long and float)
- value = std_attrs.get('value')
- if value is not None:
- attr_name, data_info, attr_info = value
- ttype, _ = to_tango_type_format(attr_info.dtype)
- data_info[0][0] = ttype
-
- # Add manually a 'CurrentValue' with the same time as 'Value'
- attr_name = 'CurrentValue'
- attr_info = attr_info.copy()
- attr_info.description = attr_name
- std_attrs[attr_name] = [attr_name, data_info, attr_info]
-
- return std_attrs, dyn_attrs
-
- def initialize_dynamic_attributes(self):
- attrs = PoolElementDevice.initialize_dynamic_attributes(self)
-
- detect_evts = "value",
- non_detect_evts = ()
-
- for attr_name in detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, True)
- for attr_name in non_detect_evts:
- if attr_name in attrs:
- self.set_change_event(attr_name, True, False)
-
- def read_Value(self, attr):
- zerod = self.zerod
- value = zerod.get_accumulated_value()
- quality = None
- if self.get_state() == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value.value, quality=quality, priority=0)
-
- def read_CurrentValue(self, attr):
- zerod = self.zerod
- #use_cache = ct.is_action_running() and not self.Force_HW_Read
- use_cache = self.get_state() == State.Moving and not self.Force_HW_Read
- value = zerod.get_current_value(cache=use_cache, propagate=0)
- if value.error:
- Except.throw_python_exception(*value.exc_info)
- quality = None
- state = zerod.get_state(cache=use_cache, propagate=0)
- if state == State.Moving:
- quality = AttrQuality.ATTR_CHANGING
- self.set_attribute(attr, value=value.value, quality=quality,
- priority=0, timestamp=value.timestamp)
-
- def Start(self):
- self.zerod.start_acquisition()
-
- def read_ValueBuffer(self, attr):
- attr.set_value(self.zerod.get_value_buffer())
-
- def read_TimeBuffer(self, attr):
- attr.set_value(self.zerod.get_time_buffer())
-
- def read_CumulationType(self, attr):
- attr.set_value(self.zerod.get_cumulation_type())
-
- def write_CumulationType(self, attr):
- self.zerod.set_cumulation_type(attr.get_write_value())
-
- def _is_allowed(self, req_type):
- return PoolElementDevice._is_allowed(self, req_type)
-
- is_Value_allowed = _is_allowed
- is_CurrentValue_allowed = _is_allowed
- is_CumulationType_allowed = _is_allowed
- is_ValueBuffer_allowed = _is_allowed
- is_TimeBuffer_allowed = _is_allowed
-
-
-_DFT_VALUE_INFO = ZeroDController.standard_axis_attributes['Value']
-_DFT_VALUE_TYPE, _DFT_VALUE_FORMAT = to_tango_type_format(_DFT_VALUE_INFO[Type], DataFormat.Scalar)
-
-
-class ZeroDExpChannelClass(PoolElementDeviceClass):
-
- # Class Properties
- class_property_list = {
- }
-
- # Device Properties
- device_property_list = {
- }
- device_property_list.update(PoolElementDeviceClass.device_property_list)
-
- # Command definitions
- cmd_list = {
- 'Start' : [ [DevVoid, ""], [DevVoid, ""] ],
- }
- cmd_list.update(PoolElementDeviceClass.cmd_list)
-
- # Attribute definitions
- attr_list = {
- 'ValueBuffer' : [ [ DevDouble, SPECTRUM, READ, 16 * 1024 ] ],
- 'TimeBuffer' : [ [ DevDouble, SPECTRUM, READ, 16 * 1024 ] ],
- 'CumulationType' : [ [ DevString, SCALAR, READ_WRITE ],
- { 'Memorized' : "true",
- 'label' : "Cumulation Type",
- 'Display level' : DispLevel.EXPERT } ],
- }
- attr_list.update(PoolElementDeviceClass.attr_list)
-
- standard_attr_list = {
- 'Value' : [ [ _DFT_VALUE_TYPE, SCALAR, READ, ],
- { 'abs_change' : '1.0', } ],
- }
- standard_attr_list.update(PoolElementDeviceClass.standard_attr_list)
-
- def _get_class_properties(self):
- ret = PoolElementDeviceClass._get_class_properties(self)
- ret['Description'] = "0D experimental channel device class"
- ret['InheritedFrom'].insert(0, 'PoolElementDevice')
- return ret
diff --git a/src/sardana/tango/pool/__init__.py b/src/sardana/tango/pool/__init__.py
deleted file mode 100644
index 8bd90f27..00000000
--- a/src/sardana/tango/pool/__init__.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-from sardana.pool.poolextension import ControllerStateTranslator
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""" """
-
-__docformat__ = 'restructuredtext'
-
-
-def prepare_pool(util):
-
- import PyTango
- from sardana.pool.poolextension import ControllerValueTranslator, \
- register_controller_value_translator, \
- ControllerStateTranslator, register_controller_state_translator, \
- CannotTranslateException
- from sardana.tango.core.util import from_deviceattribute
-
- class TangoControllerValueTranslator(ControllerValueTranslator):
-
- def translate(self, value):
- if not isinstance(value, PyTango.DeviceAttribute):
- return super(TangoControllerValueTranslator, self).translate(value)
- ret = from_deviceattribute(value)
- return ret
-
- register_controller_value_translator(TangoControllerValueTranslator)
-
- class TangoControllerStateTranslator(ControllerStateTranslator):
-
- def translate(self, value):
- if not isinstance(value, PyTango.DeviceAttribute):
- return super(TangoControllerValueTranslator, self).translate(value)
- if value.type != PyTango.DevState:
- raise CannotTranslateException("Expected DevState got %s" % value.type)
- ret = from_deviceattribute(value)
- return ret
-
- register_controller_state_translator(TangoControllerStateTranslator)
-
- from .Controller import ControllerClass, Controller
- from .Motor import MotorClass, Motor
- from .PseudoMotor import PseudoMotorClass, PseudoMotor
- from .MotorGroup import MotorGroupClass, MotorGroup
- from .CTExpChannel import CTExpChannelClass, CTExpChannel
- from .ZeroDExpChannel import ZeroDExpChannelClass, ZeroDExpChannel
- from .OneDExpChannel import OneDExpChannelClass, OneDExpChannel
- from .TwoDExpChannel import TwoDExpChannelClass, TwoDExpChannel
- from .PseudoCounter import PseudoCounterClass, PseudoCounter
- from .MeasurementGroup import MeasurementGroupClass, MeasurementGroup
- from .IORegister import IORegisterClass, IORegister
- from .Pool import PoolClass, Pool
-
- util.add_class(PoolClass, Pool)
- util.add_class(ControllerClass, Controller)
- util.add_class(MotorClass, Motor)
- util.add_class(IORegisterClass, IORegister)
- util.add_class(CTExpChannelClass, CTExpChannel)
- util.add_class(ZeroDExpChannelClass, ZeroDExpChannel)
- util.add_class(OneDExpChannelClass, OneDExpChannel)
- util.add_class(TwoDExpChannelClass, TwoDExpChannel)
- util.add_class(PseudoMotorClass, PseudoMotor)
- util.add_class(PseudoCounterClass, PseudoCounter)
- util.add_class(MotorGroupClass, MotorGroup)
- util.add_class(MeasurementGroupClass, MeasurementGroup)
-
-def main_pool(args=None, start_time=None, mode=None):
- import sardana.tango.core.util
- return sardana.tango.core.util.run(prepare_pool, args=args,
- start_time=start_time, mode=mode)
-
-run = main_pool
diff --git a/src/sardana/tango/pool/test/__init__.py b/src/sardana/tango/pool/test/__init__.py
deleted file mode 100644
index 4f1c8191..00000000
--- a/src/sardana/tango/pool/test/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from base import (BasePoolTestCase, ControllerLoadsTestCase,
- ControllerCreationTestCase, ElementCreationTestCase)
diff --git a/src/sardana/tango/pool/test/base.py b/src/sardana/tango/pool/test/base.py
deleted file mode 100644
index cecd45f4..00000000
--- a/src/sardana/tango/pool/test/base.py
+++ /dev/null
@@ -1,176 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Base classes for the controller tests"""
-
-__all__ = ['BasePoolTestCase', 'ControllerLoadsTestCase',
- 'ControllerCreationTestCase', 'ElementCreationTestCase']
-
-import os
-import PyTango
-from taurus import Device
-from taurus.external import unittest
-from taurus.core.tango.starter import ProcessStarter
-from sardana import sardanacustomsettings
-from sardana.taurus.core.tango.sardana import (registerExtensions,
- unregisterExtensions)
-from sardana.tango.core.util import (get_free_server, get_free_device,
- get_free_alias)
-from taurus.core.util import whichexecutable
-
-
-class BasePoolTestCase(object):
- """Abstract class for pool DS testing.
- """
- pool_ds_name = getattr(sardanacustomsettings, 'UNITTEST_POOL_DS_NAME')
- pool_name = getattr(sardanacustomsettings, 'UNITTEST_POOL_NAME')
-
- def setUp(self):
- """Start Pool DS and register extensions.
- """
- # Discover the Pool launcher script
- poolExec = whichexecutable.whichfile("Pool")
- # register Pool server
- pool_ds_name = "Pool/" + self.pool_ds_name
- pool_free_ds_name = get_free_server(PyTango.Database(),
- pool_ds_name)
- self._starter = ProcessStarter(poolExec, pool_free_ds_name)
- # register Pool device
- dev_name_parts = self.pool_name.split('/')
- prefix = '/'.join(dev_name_parts[0:2])
- start_from = int(dev_name_parts[2])
- self.pool_name = get_free_device(PyTango.Database(), prefix, start_from)
- self._starter.addNewDevice(self.pool_name, klass='Pool')
- # start Pool server
- self._starter.startDs()
- # register extensions so the test methods can use them
- registerExtensions()
- self.pool = Device(self.pool_name)
-
- def tearDown(self):
- """Remove the Pool instance.
- """
- unregisterExtensions()
- self._starter.cleanDb(force=True)
-
-
-# TODO: Currently test inputs are implemented as class members, it would be
-# more aesthetic to implement them as decorators.
-class ControllerLoadsTestCase(BasePoolTestCase):
- """Class for loading an arbitrary Sardana controller library and class.
- """
- controller_classes = []
- def test_controller_loads(self):
- """Test that the controller library and class can be loaded.
- """
- libraries = self.pool.getElementsOfType('ControllerLibrary').values()
- libraries_names = [lib.getName() for lib in libraries]
- classes = self.pool.getElementsOfType('ControllerClass').values()
- classes_names = [cls.getName() for cls in classes]
-
- for test_lib, test_classes in self.controller_classes.items():
- msg = 'ControllerLibrary %s was not correctly loaded.' % test_lib
- self.assertIn(test_lib, libraries_names, msg)
- msg = 'ControllerClass %s was not correctly loaded.'
- for test_class in test_classes:
- self.assertIn(test_class, classes_names, msg % test_class)
-
-
-# TODO: Currently test inputs are implemented as class members, it would be
-# more aesthetic to implement them as decorators.
-class ControllerCreationTestCase(BasePoolTestCase):
- """Class for creating a controller and testing the correct creation.
- """
- controller_infos = []
-
- def test_controller_creation(self):
- """Test that the controller has been created with the correct name.
- """
- for cls, name, props in self.controller_infos:
- ctrl = self.pool.createController(cls, name, *props)
- msg = 'Controller %s was not correctly created.' % name
- self.assertEqual(ctrl.getName(), name, msg)
- ctrl = self.pool.deleteElement(ctrl.getName())
-
-
-# TODO: Currently test inputs are implemented as class members, it would be
-# more aesthetic to implement them as decorators.
-class ElementCreationTestCase(BasePoolTestCase):
- """Class used for creating a Sardana controller and Sardana elements.
- """
- controller_infos = []
- NAME = 0
- AXIS = 1
-
- def test_element_creation(self):
- """Test that controller and elements have been correctly created.
- """
- for cls, name, props, elements in self.controller_infos:
- ctrl = self.pool.createController(cls, name, *props)
- msg = 'Controller %s was not correctly created.' % name
- self.assertEqual(ctrl.getName(), name, msg)
- for element_info in elements:
- test_name = element_info[self.NAME]
- test_axis = element_info[self.AXIS]
- elem = self.pool.createElement(test_name, ctrl, test_axis)
- msg = 'Element %s was not correctly created.' % test_name
- self.assertIsNotNone(elem, msg)
- name = elem.getName()
- msg = 'Element name: %s does not correspond to: %s.' % \
- (name, test_name)
- self.assertEqual(name, test_name, msg)
- elem = self.pool.deleteElement(test_name)
- msg = 'Element %s was not correctly deleted.' % test_name
- self.assertIsNotNone(elem, msg)
- ctrl = self.pool.deleteElement(ctrl.getName())
-
-
-if __name__ == '__main__':
-
- class BuiltinControllerLoadsTest(ControllerLoadsTestCase,
- unittest.TestCase):
-
- controller_classes = {
- 'DummyMotorController':('DummyMotorController',)
- }
-
- class BuiltinControllerCreationTest(ControllerCreationTestCase,
- unittest.TestCase):
-
- controller_infos = [('DummyMotorController', 'unittest', ())
- ]
-
- class BuiltinElementCreationTest(ElementCreationTestCase,
- unittest.TestCase):
- alias = get_free_alias(PyTango.Database(), "mot_test")
- controller_infos = [('DummyMotorController',
- 'unittest',
- (),
- [(alias, 1)])
- ]
-
- suite = unittest.defaultTestLoader.loadTestsFromTestCase(
- BuiltinElementCreationTest)
- unittest.TextTestRunner(descriptions=True, verbosity=2).run(suite)
diff --git a/src/sardana/tango/pool/test/test_Motor.py b/src/sardana/tango/pool/test/test_Motor.py
deleted file mode 100644
index 523a6ac8..00000000
--- a/src/sardana/tango/pool/test/test_Motor.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Tests Read Position from Sardana using PyTango"""
-import PyTango
-from taurus.external import unittest
-from sardana.tango.pool.test import BasePoolTestCase
-from sardana.tango.core.util import get_free_alias
-import numbers
-
-class ReadMotorPositionOutsideLim(BasePoolTestCase, unittest.TestCase):
- """TestCase class for testing that read position is possible when
- motor is out of SW limits. Verify that position has a numeric type.
- """
- def setUp(self):
- """Create dummy motor controller and dummy motor element
- """
- super(ReadMotorPositionOutsideLim, self).setUp()
- cls = 'DummyMotorController'
- self.ctrl_name = get_free_alias(PyTango.Database(), "readposctrl")
- props = ()
- ctrl = self.pool.createController(cls, self.ctrl_name, *props)
- #Add extra timeout of 3 seconds.
- if ctrl is None:
- elements_info = self.pool.getElementsInfo()
- ctrl = self.pool._wait_for_element_in_container(elements_info,
- self.ctrl_name, timeout = 3)
- self.elem_name = get_free_alias(PyTango.Database(), "mot_test")
- elem_axis = 1
- self.elem = self.pool.createElement(self.elem_name, ctrl, elem_axis)
- self.elem.DefinePosition(0)
-
- @unittest.expectedFailure #Note: this tests known bug #238
- def test_read_position_outside_sw_lim(self):
- """Test bug #238: reading position when motor is out of SW lims.
- Verify that position has a numeric type."""
- pc = self.elem.get_attribute_config("position")
- pc.min_value = "1"
- pc.max_value = "2"
- self.elem.set_attribute_config(pc)
- try:
- posread = self.elem.read_attribute('position').value
- except Exception as e_read:
- msg = ("Position cannot be read. Exception: %s" % e_read)
- self.fail(msg)
- msg = ("Position is not a number")
- self.assertIsInstance(posread, numbers.Number, msg)
-
- def tearDown(self):
- """Remove motor element and motor controller
- """
- self.pool.DeleteElement(self.elem_name)
- self.pool.DeleteElement(self.ctrl_name)
- super(ReadMotorPositionOutsideLim, self).tearDown()
diff --git a/src/sardana/taurus/__init__.py b/src/sardana/taurus/__init__.py
deleted file mode 100644
index e675cd1c..00000000
--- a/src/sardana/taurus/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""""""
diff --git a/src/sardana/taurus/core/__init__.py b/src/sardana/taurus/core/__init__.py
deleted file mode 100644
index ca50553e..00000000
--- a/src/sardana/taurus/core/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""""" \ No newline at end of file
diff --git a/src/sardana/taurus/core/tango/__init__.py b/src/sardana/taurus/core/tango/__init__.py
deleted file mode 100644
index ca50553e..00000000
--- a/src/sardana/taurus/core/tango/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""""" \ No newline at end of file
diff --git a/src/sardana/taurus/core/tango/sardana/__init__.py b/src/sardana/taurus/core/tango/sardana/__init__.py
deleted file mode 100644
index ceb4a074..00000000
--- a/src/sardana/taurus/core/tango/sardana/__init__.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The sardana package. It contains specific part of sardana"""
-
-__docformat__ = 'restructuredtext'
-
-from .sardana import *
-
-
-def registerExtensions():
- from . import pool
- from . import macroserver
-
- pool.registerExtensions()
- macroserver.registerExtensions()
-
-def unregisterExtensions():
- from . import pool
- from . import macroserver
-
- pool.unregisterExtensions()
- macroserver.unregisterExtensions()
diff --git a/src/sardana/taurus/core/tango/sardana/macro.py b/src/sardana/taurus/core/tango/sardana/macro.py
deleted file mode 100644
index ee942389..00000000
--- a/src/sardana/taurus/core/tango/sardana/macro.py
+++ /dev/null
@@ -1,1126 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The macro submodule."""
-
-__all__ = ["MacroInfo", "Macro", "MacroNode", "ParamFactory",
- "MacroRunException"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import copy
-import types
-import tempfile
-
-from lxml import etree
-
-import PyTango
-
-from taurus.core.util.user import USER_NAME
-from taurus.core.util.codecs import CodecFactory
-
-
-class MacroRunException(Exception):
- pass
-
-
-class MacroInfo(object):
- """Contains all information about a macro: name, documentation, parameters,
- result, etc"""
-
- def __init__(self, from_json_str=None, from_json=None):
- json_obj = from_json
- if from_json_str is not None:
- json_obj = self._fromJSON(from_json_str)
-
- if json_obj:
- self.__dict__.update(json_obj)
- self._buildDoc()
-
- def _fromJSON(self, json_str):
- json_codec = CodecFactory().getCodec('json')
- format, data = json_codec.decode(('json', json_str))
- return data
-
- def _buildDoc(self):
- if self.hasParams():
- self._parameter_line = self._buildParameterLine(self.parameters)
- self._parameter_description = self._buildParameterDescription(self.parameters)
- if self.hasResult():
- self._result_line = self._buildResultLine(self.result)
- self._result_description = self._buildResultDescription(self.result)
-
- doc = 'Syntax:\n\t%s %s' % (self.name, self.getParamStr())
- if self.hasResult():
- doc += ' -> ' + self.getResultStr()
- doc += '\n\n'
- doc += self.description
- if self.hasParams():
- doc += '\n\nParameters:\n\t'
- doc += '\n\t'.join(self.getParamDescr())
- if self.hasResult():
- doc += '\n\nResult:\n\t'
- doc += '\n\t'.join(self.getResultDescr())
- self.doc = doc
-
- def _hasParamComplex(self, parameters=None):
- if parameters is None:
- parameters = self.parameters
-
- for p in parameters:
- if self._isParamComplex(p):
- return True
- return False
-
- def _isParamComplex(self, p):
- return not self._isParamAtomic(p)
-
- def _isParamAtomic(self, p):
- return type(p['type']) in types.StringTypes
-
- def _buildParameterLine(self, parameters):
- l = []
- for p in parameters:
- t = p['type']
- if type(t) in types.StringTypes:
- #Simple parameter
- l.append('<%s>' % p['name'])
- else:
- l.append('[ %s ]' % self._buildParameterLine(t))
- return ' '.join(l)
-
- _buildResultLine = _buildParameterLine
-
- def _buildParameterDescription(self, parameters):
- l = []
- for p in parameters:
- t = p['type']
- if type(t) in types.StringTypes:
- #Simple parameter
- l.append('{name} : ({type}) {description}'.format(**p))
- else:
- l.extend(self._buildParameterDescription(t))
- return l
-
- _buildResultDescription = _buildParameterDescription
-
- def hasParams(self):
- """Determines if the macro has parameters
-
- :return: (bool) True if the macro has parameters or False otherwise
- """
- return hasattr(self , 'parameters')
-
- def getParamList(self):
- """Returs the list of parameters
-
- :return: (sequence) a list of parameters
- """
- if not self.hasParams():
- return []
- return self.parameters
-
- def getParam(self, idx=0):
- """Gets the parameter for the given index
-
- :param idx: (int) the index (default is 0)
-
- :return: (object) the parameter or None if the macro does not have the
- desired parameter
- """
- if not self.hasParams():
- return
- return self.parameters[idx]
-
- def getPossibleParams(self, idx, parameters=None):
- """Gets the possible parameters for the given index
-
- :param idx: (int) parameter index
- :param parameters: (sequence) sequence of parameter information (default
- is None which means use the macro parameters
- :return: (sequence) list of possible parameters
- """
- if parameters is None:
- parameters = self.parameters
-
- res = []
- n = len(parameters)
- if idx >= n:
- if self._hasParamComplex(parameters):
- p = copy.copy(parameters)
- p.reverse()
- res.extend(self.getPossibleParams(0, p))
- return res
-
- res = []
- for i, p in enumerate(parameters):
- atomic = self._isParamAtomic(p)
- if i < idx:
- if atomic: continue
- else:
- res.extend(self.getPossibleParams(idx - i, p['type']))
- elif i == idx:
- if atomic:
- res.append(p)
- else:
- res.extend(self.getPossibleParams(0, p['type']))
- else:
- break
- return res
-
- def getParamStr(self):
- """Returns the string line representing the macro parameters.
- For example, if a macro has a motor parameter followed by a list of
- numbers it will return:
- '<motor> [ <number> ]'
-
- :return: (str) a string representing the macro parameter line
- """
- if not self.hasParams():
- return ''
- return self._parameter_line
-
- def getParamDescr(self):
- """Returns the list of strings, each one documenting each macro parameter
-
- :return: (sequence<str>) list of parameter lines
- """
- if not self.hasParams():
- return []
- return self._parameter_description
-
- def hasResult(self):
- """Determines if the macro has a result
-
- :return: (bool) True if the macro has a result or False otherwise
- """
- return hasattr(self , 'result')
-
- def getResultList(self):
- """Returns the list of results
-
- :return: (sequence) a list of results
- """
- if not self.hasResult():
- return []
- return self.result
-
- def getResult(self, idx=0):
- """Gets the result for the given index
-
- :param idx: (int) the index (default is 0)
-
- :return: (object) the result or None if the macro does not have the
- desired result
- """
- return self.result[idx]
-
- def getResultStr(self):
- """Returns the string line representing the macro results.
- For example, if a macro returns a number, this method it will return:
- '<number>'
-
- :return: (str) a string representing the macro result line
- """
- if not self.hasResult():
- return ''
- return self._result_line
-
- def getResultDescr(self):
- """Returns the list of strings, each one documenting each macro result
-
- :return: (sequence<str>) list of result lines
- """
- if not self.hasResult():
- return []
- return self._result_description
-
- def formatResult(self, res):
- if not self.hasResult():
- if res is None:
- return None
- raise Exception('Macro %s does not return any result' % self.name)
- result_info = self.getResult()
- rtype = result_info['type']
- if rtype == 'File':
- fd, filename = tempfile.mkstemp(prefix='spock_', text=True)
- os.write(fd, res[1])
- os.close(fd)
- # put the local filename in the result
- res.insert(0, filename)
- return res
- if len(res) > 0:
- if rtype == 'Float':
- return float(res[0])
- elif rtype == 'Integer':
- return int(res[0])
- elif rtype == 'Boolean':
- return res[0].lower() == 'true'
- elif rtype in ('String', 'User', 'Filename'):
- return res[0]
- else:
- raise Exception('Unknown return type for macro %s' % self.name)
- else:
- return None
-
- def __str__(self):
- return self.name
-
-class Macro(object):
-
- Ready = PyTango.DevState.ON
- Init = PyTango.DevState.INIT
- Running = PyTango.DevState.RUNNING
- Pause = PyTango.DevState.STANDBY
- Fault = PyTango.DevState.FAULT
- Finished = PyTango.DevState.ON
- Abort = PyTango.DevState.ALARM
-
- def __init__(self, door, name, id, xml_obj):
- self.door = door
- self.name = name
- self.xml_node = xml_obj
- self.id = id
- self.range = None
- self.step = None
- self.result = None
-
- def getID(self):
- return self.id
-
- def getRange(self):
- return self.range
-
- def getStep(self):
- return self.step
-
- def getInfo(self):
- return self.door.macro_server.getMacroInfoObj(self.name)
-
- def setResult(self, res):
- self.result = self.getInfo().formatResult(res)
-
- def getResult(self):
- return self.result
-
-
-class BaseNode(object):
- """Base class defining basic interface for all type of nodes used to represent,
- relationship between sequence, macros and parameters."""
-
- def __init__(self, parent=None):
-# if parent:
-# parent = weakref.ref(parent)
- self._parent = parent
-
- def parent(self):
- return self._parent
-
- def setParent(self, parent):
-# if parent:
-# parent = weakref.ref(parent)
- self._parent = parent
-
- def value(self):
- return ""
-
- def isAllowedMoveUp(self):
- return False
-
- def isAllowedMoveDown(self):
- return False
-
- def isAllowedDelete(self):
- return False
-
-class BranchNode(BaseNode):
- """Class used to represent all types of elements which contain
- a list of other elements (children)"""
-
- def __init__(self, parent=None):
- BaseNode.__init__(self, parent)
- self._children = []
-
- def __len__(self):
- return len(self.children())
-
- def children(self):
- return self._children
-
- def child(self, idx):
- try:
- children = self.children()
- return children[idx]
- except:
- return None
-
- def rowOfChild(self, child):
- try:
- return self.children().index(child)
- except ValueError:
- return -1
-
- def insertChild(self, child, row=-1):
- child.setParent(self)
- if row == -1: row = len(self)
- self.children().insert(row, child)
- return row
-
- def removeChild(self, child):
- self.children().remove(child)
-
- def upChild(self, child):
- i = self.children().index(child)
- if i == 0: return
- self.removeChild(child)
- self.children().insert(child, i - 1)
-
- def downChild(self, child):
- i = self.children().index(child)
- if i == len(self) - 1: return
- self.removeChild(child)
- self.children().insert(i + 1, child)
-
- def toRun(self):
- values = []
- alert = ""
- for child in self.children():
- val, ale = child.toRun()
- values += val
- alert += ale
- return values, alert
-
-class ParamNode(BaseNode):
- """Base class for param elements: single parameters and param repeats.
- It groups a common interface of them."""
-
- def __init__(self, parent=None, param=None):
- BaseNode.__init__(self, parent)
- if param is None:
- self.setName(None)
- self.setDescription(None)
- self.setMin(None)
- self.setMax(None)
- else:
- self.setName(str(param.get('name')))
- self.setDescription(str(param.get('description')))
- self.setMin(str(param.get('min')))
- self.setMax(str(param.get('max')))
-
-
- def name(self):
- return self._name
-
- def setName(self, name):
- self._name = name
-
- def description(self):
- return self._description
-
- def setDescription(self, description):
- self._description = description
-
- def min(self):
- return self._min
-
- def setMin(self, min):
- if min == 'None':
- min = None
- elif min:
- min = float(min)
- self._min = min
-
- def max(self):
- return self._max
-
- def setMax(self, max):
- if max == 'None':
- max = None
- elif max:
- max = float(max)
- self._max = max
-
-
-class SingleParamNode(ParamNode):
- """Single parameter class."""
- def __init__(self, parent=None, param=None):
- ParamNode.__init__(self, parent, param)
- if param is None: return
- self.setType(str(param.get('type')))
- self.setDefValue(str(param.get('default_value', '')))
- if self.type() == "User":
- self.setDefValue(str(USER_NAME))
- self.setValue(self.defValue())
-
- def __len__(self):
- return 0
-
- def value(self):
- return self._value
-
- def setValue(self, value):
- self._value = value
-
- def defValue(self):
- return self._defValue
-
- def setDefValue(self, defValue):
- self._defValue = defValue
-
- def type(self):
- return self._type
-
- def setType(self, type):
- self._type = type
-
- def toXml(self):
- paramElement = etree.Element("param", name=self.name(),
- value=self.value())
- return paramElement
-
- def fromXml(self, xmlElement):
- self.setName(xmlElement.get("name"))
- self.setValue(xmlElement.get("value"))
-
- def isMotorParam(self):
- return self.type() == globals.PARAM_MOTOR
-
- def allMotors(self):
- if self.isMotorParam() and self.value() != 'None':
- return [self.value()]
- else:
- return[]
-
- def toRun(self):
- val = self.value()
- if val is None or val == "None" or val == "":
- alert = "Parameter <b>" + self.name() + "</b> is missing.<br>"
- return ([val], alert)
- return ([val], "")
-
-class RepeatParamNode(ParamNode, BranchNode):
- """Repeat parameter class."""
-
- def __init__(self, parent=None, param=None):
- ParamNode.__init__(self, parent, param)
- BranchNode.__init__(self, parent)
- if param is None:
- return
- self.setParamsInfo(copy.deepcopy(param.get('type')))
-
- def arrangeIndexes(self):
- for i, child in enumerate(self.children()):
- child.setIndex(i + 1)
-
- def paramsInfo(self):
- return self._paramsInfo
-
- def setParamsInfo(self, paramsInfo):
- self._paramsInfo = paramsInfo
-
- def newRepeat(self):
- repeatNode = RepeatNode(self)
- for repeatParam in self.paramsInfo():
- repeatNode.addParam(repeatParam)
- return repeatNode
-
- def addRepeat(self):
- repeat = RepeatNode(self)
- self.insertChild(repeat)
- for repeatParam in self.paramsInfo():
- repeat.addParam(repeatParam)
-
- def isReachedMin(self):
- if self.min() is None:
- return False
- return len(self) <= self.min()
-
- def isBelowMin(self):
- if self.min() is None:
- return False
- return len(self) < self.min()
-
- def isReachedMax(self):
- if self.max() is None:
- return False
- return len(self) == self.max()
-
- def isAboveMax(self):
- if self.max() is None:
- return False
- return len(self) > self.max()
-
- def insertChild(self, child, row=-1):
- #this line was removed on purpose
- #in case of importing sequences from plain text, it is possible that user introduced more repetitions than allowed
- #in this case later validation will inform him about exceeding a limit
- #if self.isReachedMax(): return
- return BranchNode.insertChild(self, child, row)
-
- def removeChild(self, child):
- if self.isReachedMin(): return
- child.setParent(None)
- begin = self.children().index(child) + 1
- for i in range(begin, len(self)):
- self.child(i).setIndex(self.child(i).index() - 1)
- BranchNode.removeChild(self, child)
-
- def upChild(self, child):
- i = self.children().index(child)
- if i == 0: return
- child.setIndex(child.index() - 1)
- self.child(i - 1).setIndex(self.child(i - 1).index() + 1)
- BranchNode.removeChild(self, child)
- self.insertChild(child, i - 1)
-
- def downChild(self, child):
- i = self.children().index(child)
- if i == len(self) - 1: return
- child.setIndex(child.index() + 1)
- self.child(i + 1).setIndex(self.child(i + 1).index() - 1)
- BranchNode.removeChild(self, child)
- self.insertChild(child, i + 1)
-
- def toRun(self):
- values = []
- alert = ""
- if self.isBelowMin():
- alert += "Parameter <b>" + self.name() + "</b> has not enough repeats<br>"
- for child in self.children():
- val, ale = child.toRun()
- values += val
- alert += ale
- return (values, alert)
-
- def toXml(self):
- paramElement = etree.Element("paramrepeat", name=self.name())
- for child in self.children():
- paramElement.append(child.toXml())
- return paramElement
-
- def fromXml(self, xmlElement):
- self.setName(xmlElement.get("name"))
- for repeatElement in xmlElement.getiterator("repeat"):
- repeat = RepeatNode(self)
- repeat.fromXml(repeatElement)
- self.insertChild(repeat)
-
- def allMotors(self):
- motors = []
- for child in self.children():
- motors += child.allMotors()
- return motors
-
-# def isAllowedMoveUp(self):
-# return self is not self.parent().child(0)
-#
-# def isAllowedMoveDown(self):
-# return self is not self.parent().child(len(self.parent()) - 1)
-
-
-class RepeatNode(BranchNode):
- """Class for repetition elements (group of params which were repeated in macro)"""
-
- def __init__(self, parent=None):
- BranchNode.__init__(self, parent)
- if parent is None: return
- self.setIndex(len(self.parent()) + 1)
-
- def index(self):
- return self._index
-
- def setIndex(self, index):
- self._index = index
-
- def name(self):
- return "#%d" % self.index()
-
- def addParam(self, param):
- type = param.get('type', None)
- if isinstance(type, list):
- paramRepeat = RepeatParamNode(self, param)
- self.insertChild(paramRepeat)
- paramRepeat.addRepeat()
- else:
- self.insertChild(SingleParamNode(self, param))
-
- def toXml(self):
- repeatElement = etree.Element("repeat", nr=str(self.index()))
- for child in self.children():
- repeatElement.append(child.toXml())
- return repeatElement
-
- def fromXml(self, xmlElement):
- self.setIndex(int(xmlElement.get("nr")))
- for paramElement in xmlElement:
- if paramElement.tag == "param":
- param = SingleParamNode(self)
- elif paramElement.tag == "paramrepeat":
- param = RepeatParamNode(self)
- param.fromXml(paramElement)
- self.insertChild(param)
-
- def allMotors(self):
- motors = []
- for child in self.children():
- motors += child.allMotors()
- return motors
-
- def isAllowedDel(self):
- pass
-
- def isAllowedMoveUp(self):
- return self is not self.parent().child(0)
-
- def isAllowedMoveDown(self):
- return self is not self.parent().child(len(self.parent()) - 1)
-
-class MacroNode(BranchNode):
- """Class to represent macro element."""
- count = 0
-
- def __init__(self, parent=None, name=None):
- BranchNode.__init__(self, parent)
- self.setId(None)
- self.setName(name)
- self.setPause(False)
- self.setProgress(0)
- self.setRange((0, 100))
- self.setParams([])
- self.setHooks([])
- self.setHookPlaces([])
- self.setAllowedHookPlaces([])
-
- def id(self):
- """
- Getter of macro's id property
-
- :return: (int)
-
- .. seealso: :meth:`MacroNode.setId`, assignId
- """
-
- return self._id
-
- def setId(self, id):
- """
- Setter of macro's id property
-
- :param id: (int) new macro's id
-
- See Also: id, assignId
- """
-
- self._id = id
-
- def assignId(self):
- """
- If macro didn't have an assigned id it assigns it
- and return macro's id.
-
- :return: (int)
-
- See Also: id, setId
- """
- id = self.id()
- if id is not None: return id
- MacroNode.count += 1
- self.setId(MacroNode.count)
- return MacroNode.count
-
- def name(self):
- return self._name
-
- def setName(self, name):
- self._name = name
-
- def isPause(self):
- return self._pause
-
- def setPause(self, pause):
- self._pause = pause
-
- def range(self):
- return self._range
-
- def setRange(self, range):
- self._range = range
-
- def progress(self):
- return self._progress
-
- def setProgress(self, progress):
- self._progress = progress
-
- def isAllowedHooks(self):
- return bool(self._allowedHookPlaces)
-
- def allowedHookPlaces(self):
- return self._allowedHookPlaces
-
- def setAllowedHookPlaces(self, allowedHookPlaces):
- self._allowedHookPlaces = allowedHookPlaces
-
- def hookPlaces(self):
- return self._hookPlaces
-
- def setHookPlaces(self, hookPlaces):
- self._hookPlaces = hookPlaces
-
- def addHookPlace(self, hookPlace):
- self._hookPlaces.append(hookPlace)
-
- def removeHookPlace(self, hookPlace):
- self._hookPlaces.remove(hookPlace)
-
- def hasParams(self):
- return self._hasParams
-
- def setHasParams(self, hasParams):
- self._hasParams = hasParams
-
-#################################
- def params(self):
- return self._params
-
- def setParams(self, params):
- self._params = params
-
- def addParam(self, param):
- param.setParent(self)
- self._params.append(param)
-
- def popParam(self, index=None):
- if index == None:
- return self._params.pop()
- else:
- return self._params.pop(index)
-
- def hooks(self):
- return self._hooks
-
- def setHooks(self, hooks):
- self._hooks = hooks
-
- def addHook(self, hook):
- hook.setParent(self)
- self._hooks.append(hook)
-
- def removeHook(self, hook):
- self._hooks.remove(hook)
-
- def rowOfHook(self, hook):
- try:
- return self.hooks().index(hook)
- except ValueError:
- return -1
-
-##################################
- def children(self):
- return self.params() + self.hooks()
-
- def insertChild(self, child, row=-1):
- child.setParent(self)
- if isinstance(child, MacroNode):
- if row == -1: row = len(self._hooks)
- else: row = row - len(self._params)
- self._hooks.insert(row, child)
- elif isinstance(child, ParamNode):
- if row == -1: row = len(self._params)
- self._params.insert(row, child)
- return self.rowOfChild(child)
-
- def removeChild(self, child):
- if isinstance(child, MacroNode):
- self._hooks.remove(child)
- elif isinstance(child, ParamNode):
- self._params.insert(child)
-
- def toRun(self):
- values = []
- alert = ""
- for child in self.children():
- if isinstance(child, ParamNode):
- val, ale = child.toRun()
- values += val
- alert += ale
- return values, alert
-
- def toSpockCommand(self):
- values, alerts = self.toRun()
- return "%s %s" % (self.name(), str.join(' ', values))
-
-
- def value(self):
- values, alerts = self.toRun()
- if len(values) == 0:
- return ''
- elif len(values) == 1:
- return '[%s]' % values[0]
- else:
- valueString = ''
- for value in values:
- valueString += (value + ', ')
- return '[%s]' % valueString[:-2]
-
-# def allMotors(self):
-# motors = []
-# for macro in self.allMacros():
-# motors += macro.ownMotors()
-# return motors
-#
-# def ownMotors(self):
-# motors = []
-# for macro in self.hooks():
-# motors += macro.allMotors()
-# return motors
-
- def allMacros(self):
- macros = self.allDescendants()
- macros.append(self)
- return macros
-
- def allDescendants(self):
- descendantsMacros = []
- ownMacros = []
- for child in self.children():
- if isinstance(child, MacroNode):
- ownMacros.append(child)
- descendantsMacros += child.allDescendants()
- return descendantsMacros + ownMacros
-
-# def descendantFromId(self, id):
-# descendant = None
-# for child in self.children():
-# if isinstance(child, MacroNode) and child.id() == id:
-# descendant = child
-# break
-# else:
-# for child in self.children():
-# descendant = child.descendantById(id)
-# return descendant
-
- def isAllowedMoveLeft(self):
- """This method checks if is is allowed to move macro to grandparent's hook list.
- It is enough to check that grandparent exist, cause all parents must allow hooks"""
- return self.parent().parent() is not None
-
- def moveLeft(self):
- """This method moves macro to grandparent's hook list
- and place it right after its ex-parent,
- it also returns newRow"""
- oldParent = self.parent()
- newParent = oldParent.parent()
- newRow = newParent.hooks().index(oldParent) + 1
- oldParent.removeHook(self)
- self.setParent(newParent)
- newParent.insertHook(newRow, self)
- return newRow
-
- def isAllowedMoveRight(self):
- """This method is used to check if it is allowed to move macro
- to it's first following sibling's hook list."""
- parent = self.parent()
- try:
- return parent.child(parent.rowOfChild(self) + 1).isAllowedHooks()
- except:
- return False
-
- def moveRight(self):
- """This method is used to move selected macro (pased via index)
- to it's first following sibling's hook list. In tree representation it basically move macro to the right"""
- parent = self.parent()
- for idx, hook in enumerate(parent.hooks()):
- if hook is self:
- newParent = parent.hook(idx + 1)
- parent.removeHook(self)
- self.setParent(newParent)
- newParent.insertHook(0, self)
- return 0
-
- def isAllowedMoveUp(self):
- parent = self.parent()
- if isinstance(parent, SequenceNode):
- return self is not self.parent().child(0)
- elif isinstance(parent, MacroNode):
- return self is not self.parent()._hooks[0]
- else:
- return False
-
- def moveUp(self):
- """This method moves hook up and returns newRow"""
- parent = self.parent()
- myOldRow = parent.rowOfHook(self)
- parent.removeHook(self)
- parent.insertHook(myOldRow - 1, self)
- return myOldRow - 1
-
- def isAllowedMoveDown(self):
- parent = self.parent()
- return parent.rowOfChild(self) < len(parent) - 1
-
- def moveDown(self):
- """This method moves hook up and returns newRow"""
- parent = self.parent()
- myOldRow = parent.rowOfHook(self)
- parent.removeHook(self)
- parent.insertHook(myOldRow + 1, self)
- return myOldRow + 1
-
- def toXml(self, withId=True):
- """
- Converts MacroNode obj to etree.Element obj.
-
- :param withId: (bool) if we want to export also macro id (default: True)
-
- See Also: fromXml
- """
-
- macroElement = etree.Element("macro", name=self.name())
- if withId: macroElement.set("id", str(self.id()))
- for hookPlace in self.hookPlaces():
- hookElement = etree.SubElement(macroElement, "hookPlace")
- hookElement.text = hookPlace
- for child in self.children():
- if isinstance(child, MacroNode):
- xmlElement = child.toXml(withId)
- else:
- xmlElement = child.toXml()
- macroElement.append(xmlElement)
- return macroElement
-
- def fromXml(self, xmlElement):
- """
- Fills properties of MacroNode obj from etree.Element obj passed as a parameter
-
- :param xmlElement: (etree.Element)
-
- See Also: toXml
- """
-
- self.setName(xmlElement.get("name"))
- hookPlaces = []
- for element in xmlElement:
- if element.tag == "param":
- param = SingleParamNode(self)
- param.fromXml(element)
- self.addParam(param)
- elif element.tag == "paramrepeat":
- param = RepeatParamNode(self)
- param.fromXml(element)
- self.addParam(param)
- elif element.tag == "macro":
- macro = MacroNode(self)
- macro.fromXml(element)
- self.addHook(macro)
- elif element.tag == "hookPlace":
- hookPlaces.append(element.text)
- self.setHookPlaces(hookPlaces)
-
- def fromPlainText(self, plainText):
- words = plainText.split()
- length = len(words)
- if length == 0:
- return
- self.setName(words[0])
- for index in range(1, length):
- param = SingleParamNode(self)
- param.setValue(words[index])
- self.addParam(param)
-
-
-class SequenceNode(BranchNode):
- """Class to represent sequence element."""
- comment_characters = ('#',)
-
- def __init__(self, parent=None):
- BranchNode.__init__(self, parent)
-
- def allMacros(self):
- macros = []
- for macro in self.children():
- macros += macro.allDescendants()
- macros += self.children()
- return macros
-
- def upMacro(self, macro):
- BranchNode.upChild(self, macro)
-
- def downMacro(self, macro):
- BranchNode.downChild(self, macro)
-
- def toXml(self, withId=True):
- sequenceElement = etree.Element("sequence")
- for child in self.children():
- sequenceElement.append(child.toXml(withId))
- return sequenceElement
-
- def fromXml(self, sequenceElement):
- for childElement in sequenceElement.iterchildren("macro"):
- macro = MacroNode(self)
- macro.fromXml(childElement)
- self.insertChild(macro)
-
- def fromPlainText(self, plainText):
- plainMacros = plainText.split('\n')
- for plainMacro in plainMacros:
- # stripping the whitespace characters
- plainMacro = plainMacro.strip()
- # ignoring the empty lines
- if len(plainMacro) == 0:
- continue
- # ignoring the commented lines
- if plainMacro[0] in self.comment_characters:
- continue
- macro = MacroNode(self)
- macro.fromPlainText(plainMacro)
- self.insertChild(macro)
-
-# def descendantFromId(self, id):
-# descendant = None
-# for child in self.children():
-# if isinstance(child, MacroNode) and child.id() == id:
-# descendant = child
-# break
-# else:
-# for child in self.children():
-# descendant = child.descendantById(id)
-# return descendant
-
-
-
-
-def ParamFactory(paramInfo):
- """Factory method returning param element, depends of the paramInfo argument."""
-
- if isinstance(paramInfo.get('type'), list):
- param = RepeatParamNode(param=paramInfo)
- if param.min() > 0:
- param.addRepeat()
- else:
- param = SingleParamNode(param=paramInfo)
- return param
-
diff --git a/src/sardana/taurus/core/tango/sardana/macroserver.py b/src/sardana/taurus/core/tango/sardana/macroserver.py
deleted file mode 100644
index d5145330..00000000
--- a/src/sardana/taurus/core/tango/sardana/macroserver.py
+++ /dev/null
@@ -1,1166 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The macroserver submodule. It contains specific part of macroserver"""
-
-__all__ = ['BaseInputHandler', 'BaseDoor', 'BaseMacroServer',
- 'registerExtensions']
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import time
-import uuid
-import weakref
-import threading
-import os.path as osp
-
-from lxml import etree
-
-import PyTango
-
-from taurus import Device, Factory
-from taurus.core.taurusmanager import TaurusManager
-from taurus.core.taurusbasetypes import TaurusEventType, TaurusSWDevState, \
- TaurusSerializationMode
-
-from taurus.core.util.log import Logger
-from taurus.core.util.containers import CaselessDict
-from taurus.core.util.codecs import CodecFactory
-from taurus.core.util.event import EventGenerator, AttributeEventWait
-from taurus.core.tango import TangoDevice
-
-
-from .macro import MacroInfo, Macro, \
- MacroNode, ParamFactory, RepeatNode, RepeatParamNode, SingleParamNode, \
- ParamNode
-from .sardana import BaseSardanaElementContainer, BaseSardanaElement
-from .pool import getChannelConfigs
-
-CHANGE_EVT_TYPES = TaurusEventType.Change, TaurusEventType.Periodic
-
-
-class Attr(Logger, EventGenerator):
-
- def __init__(self, dev, name, obj_class, attr):
- self._dev = weakref.ref(dev)
- self._obj_class = obj_class
- self._attr = attr
- self.call__init__(Logger, name)
- event_name = '%s %s' % (dev.getNormalName(), name)
- self.call__init__(EventGenerator, event_name)
-
- self._attr.addListener(self)
-
- def eventReceived(self, src, type, evt_value):
- if type == TaurusEventType.Error:
- self.fireEvent(None)
- elif type != TaurusEventType.Config:
- if evt_value:
- self.fireEvent(evt_value.value)
- else:
- self.fireEvent(None)
-
- def getTaurusAttribute(self):
- return self._attr
-
- def __getattr__(self, name):
- return getattr(self._attr, name)
-
-
-class LogAttr(Attr):
-
- def __init__(self, dev, name, obj_class, attr, max_buff_size=4096):
- self._log_buffer = []
- self._max_buff_size = max_buff_size
- self.call__init__(Attr, dev, name, obj_class, attr)
-
- def getLogBuffer(self):
- return self._log_buffer
-
- def clearLogBuffer(self):
- self._log_buffer = []
-
- def eventReceived(self, src, type, evt_value):
- if type == TaurusEventType.Change:
- if evt_value is None or evt_value.value is None:
- self.fireEvent(None)
- else:
- self._log_buffer.extend(evt_value.value)
- while len(self._log_buffer) > self._max_buff_size:
- self._log_buffer.pop(0)
- if evt_value:
- self.fireEvent(evt_value.value)
-
-
-class BaseInputHandler(object):
-
- def __init__(self):
- try:
- self._input = raw_input
- except NameError:
- self._input = input
-
- def input(self, input_data=None):
- if input_data is None:
- input_data = {}
- prompt = input_data.get('prompt')
- ret = dict(input=None, cancel=False)
- try:
- if prompt is None:
- ret['input'] = self._input()
- else:
- ret['input'] = self._input(prompt)
- except:
- ret['cancel'] = True
- return ret
-
- def input_timeout(self, input_data):
- print "input timeout"
-
-
-class MacroServerDevice(TangoDevice):
- """A class encapsulating a generic macro server device (usually a
- MacroServer or a Door"""
-
- def _getEventWait(self):
- if not hasattr(self, '_evt_wait'):
- # create an object that waits for attribute events.
- # each time we use it we have to connect and disconnect to an attribute
- self._evt_wait = AttributeEventWait()
- return self._evt_wait
-
-
-class ExperimentConfiguration(object):
-
- def __init__(self, door):
- self._door = door
-
- def get(self, cache=False):
- door = self._door
- macro_server = door.macro_server
- env = door.getEnvironment()
-
- ret = dict(ScanDir=env.get('ScanDir'),
- DataCompressionRank=env.get('DataCompressionRank', 0),
- PreScanSnapshot=env.get('PreScanSnapshot', []))
- scan_file = env.get('ScanFile')
- if scan_file is None:
- scan_file = []
- elif isinstance(scan_file, (str, unicode)):
- scan_file = [scan_file]
- ret['ScanFile'] = scan_file
- mnt_grps = macro_server.getElementNamesOfType("MeasurementGroup")
-
- active_mnt_grp = env.get('ActiveMntGrp')
- if active_mnt_grp is None and len(mnt_grps):
- active_mnt_grp = mnt_grps[0]
- door.putEnvironment('ActiveMntGrp', active_mnt_grp)
-
- ret['ActiveMntGrp'] = active_mnt_grp
- ret['MntGrpConfigs'] = mnt_grp_configs = CaselessDict()
-
- if len(mnt_grps) == 0:
- return ret
-
- mnt_grp_grps = PyTango.Group("grp")
- mnt_grp_grps.add(mnt_grps)
-
- codec = CodecFactory().getCodec('json')
- replies = mnt_grp_grps.read_attribute("configuration")
- for mnt_grp, reply in zip(mnt_grps, replies):
- try:
- mnt_grp_configs[mnt_grp] = \
- codec.decode(('json', reply.get_data().value),
- ensure_ascii=True)[1]
- except Exception, e:
- from taurus.core.util.log import warning
- warning('Cannot load Measurement group "%s": %s', repr(mnt_grp), repr(e))
- return ret
-
- def set(self, conf, mnt_grps=None):
- """Sets the ExperimentConfiguration dictionary."""
- env = dict(ScanDir=conf.get('ScanDir'),
- ScanFile=conf.get('ScanFile'),
- DataCompressionRank=conf.get('DataCompressionRank', -1),
- ActiveMntGrp=conf.get('ActiveMntGrp'),
- PreScanSnapshot=conf.get('PreScanSnapshot'))
- if mnt_grps is None:
- mnt_grps = conf['MntGrpConfigs'].keys()
- self._door.putEnvironments(env)
-
- codec = CodecFactory().getCodec('json')
- for mnt_grp in mnt_grps:
- try:
- mnt_grp_cfg = conf['MntGrpConfigs'][mnt_grp]
- if mnt_grp_cfg is None: #a mntGrp to be deleted
- pool = self._getPoolOfElement(mnt_grp)
- pool.DeleteElement(mnt_grp)
- else:
- try:
- mnt_grp_dev = Device(mnt_grp)
- except: #if the mnt_grp did not already exist, create it now
- chconfigs = getChannelConfigs(mnt_grp_cfg)
- chnames, chinfos = zip(*chconfigs) #unzipping
- pool = self._getPoolOfElement(chnames[0]) #We assume that all the channels belong to the same pool!
- pool.createMeasurementGroup([mnt_grp] + list(chnames))
- mnt_grp_dev = Device(mnt_grp)
-
- # TODO when we start using measurement group extension change the
- # code below with the following:
- # mnt_grp.setConfiguration(mnt_grp_cfg)
- data = codec.encode(('', mnt_grp_cfg))[1]
- mnt_grp_dev.write_attribute('configuration', data)
- except Exception, e:
- from taurus.core.util.log import error
- error('Could not create/delete/modify Measurement group "%s": %s', mnt_grp, repr(e))
-
- def _getPoolOfElement(self, elementname):
- ms = self._door.macro_server
- einfo = ms.getElementInfo(elementname)
- poolname = einfo.pool
- return ms.getElementInfo(poolname)
-
-# @property
-# def _pool(self):
-# pooldict = self._door.macro_server.getElementsOfType('Pool')
-# if len(pooldict)==0:
-# raise ValueError('Cannot access the Pool')
-# elif len(pooldict)>1:
-# raise ValueError('Multiple pools are not supported')
-# poolinfo = pooldict.values()[0]
-# return poolinfo
-
-
-class BaseDoor(MacroServerDevice):
- """ Class encapsulating Door device functionality."""
-
- On = PyTango.DevState.ON
- Running = PyTango.DevState.RUNNING
- Paused = PyTango.DevState.STANDBY
-
- Critical = 'Critical'
- Error = 'Error'
- Warning = 'Warning'
- Info = 'Info'
- Output = 'Output'
- Debug = 'Debug'
- Result = 'Result'
- RecordData = 'RecordData'
-
- BlockStart = '<BLOCK>'
- BlockFinish = '</BLOCK>'
-
- log_streams = (Error, Warning, Info, Output, Debug, Result)
-
- # maximum execution time without user interruption
- InteractiveTimeout = 0.1
-
-
- def __init__(self, name, **kw):
- self._log_attr = CaselessDict()
- self._block_lines = 0
- self._macro_server = None
- self._running_macros = None
- self._running_macro = None
- self._last_running_macro = None
- self._user_xml = None
- self._ignore_logs = kw.get("ignore_logs", False)
- self._silent = kw.get("silent", True)
- self._debug = kw.get("debug", False)
- self._output_stream = kw.get("output", sys.stdout)
- self._writeLock = threading.Lock()
- self._input_handler = self.create_input_handler()
-
- self.call__init__(MacroServerDevice, name, **kw)
-
- self._old_door_state = PyTango.DevState.UNKNOWN
- self._old_sw_door_state = TaurusSWDevState.Uninitialized
-
- self.getStateObj().addListener(self.stateChanged)
-
- for log_name in self.log_streams:
- tg_attr = self.getAttribute(log_name)
- attr = LogAttr(self, log_name, None, tg_attr)
- if log_name == 'Result':
- attr.subscribeEvent(self.resultReceived, log_name)
- else:
- attr.subscribeEvent(self.logReceived, log_name)
- self._log_attr[log_name] = attr
-
- input_attr = self.getAttribute("Input")
- input_attr.addListener(self.inputReceived)
-
- record_data_attr = self.getAttribute('RecordData')
- record_data_attr.addListener(self.recordDataReceived)
-
- macro_status_attr = self.getAttribute('MacroStatus')
- macro_status_attr.addListener(self.macroStatusReceived)
-
- self._experiment_configuration = ExperimentConfiguration(self)
-
- def create_input_handler(self):
- return BaseInputHandler()
-
- def get_input_handler(self):
- return self._input_handler
-
- def get_color_mode(self):
- return "NoColor"
-
- #def macrosChanged(self, s, v, t):
- # pass
-
- @property
- def log_start(self):
- if not hasattr(self, "_log_start"):
- import taurus.core.util.console
- if self.get_color_mode() == "NoColor":
- kls = taurus.core.util.console.NoColors
- else:
- kls = taurus.core.util.console.TermColors
- self._log_start = { BaseDoor.Critical : kls.LightRed,
- BaseDoor.Error : kls.Red,
- BaseDoor.Info : kls.LightBlue,
- BaseDoor.Warning : kls.Brown,
- BaseDoor.Output : kls.Normal,
- BaseDoor.Debug : kls.DarkGray,
- BaseDoor.Result : kls.LightGreen }
- return self._log_start
-
- @property
- def log_stop(self):
- if not hasattr(self, "_log_stop"):
- import taurus.core.util.console
- if self.get_color_mode() == "NoColor":
- kls = taurus.core.util.console.NoColors
- else:
- kls = taurus.core.util.console.TermColors
- self._log_stop = { BaseDoor.Critical : kls.Normal,
- BaseDoor.Error : kls.Normal,
- BaseDoor.Info : kls.Normal,
- BaseDoor.Warning : kls.Normal,
- BaseDoor.Output : kls.Normal,
- BaseDoor.Debug : kls.Normal,
- BaseDoor.Result : kls.Normal }
- return self._log_stop
-
- def getStateAttr(self):
- return self._state_attr
-
- @property
- def macro_server(self):
- if self._macro_server is None:
- self._macro_server = self._get_macroserver_for_door()
- return self._macro_server
-
- def _get_macroserver_for_door(self):
- """Returns the MacroServer device object in the same DeviceServer as this
- door"""
- db = self.factory().getDatabase()
- door_name = self.dev_name()
- server_list = list(db.get_server_list('MacroServer/*'))
- server_list += list(db.get_server_list('Sardana/*'))
- server_devs = None
- for server in server_list:
- server_devs = db.get_device_class_list(server)
- devs, klasses = server_devs[0::2], server_devs[1::2]
- for dev in devs:
- if dev.lower() == door_name:
- for i, klass in enumerate(klasses):
- if klass == 'MacroServer':
- return self.factory().getDevice(devs[i])
- else:
- return None
-
- def setDebugMode(self, state):
- self._debug = state
-
- def getDebugMode(self):
- return self._debug
-
- def setSilent(self, yesno):
- self._silent = yesno
-
- def isSilent(self):
- return self._silent
-
- def getLogObj(self, log_name='Debug'):
- return self._log_attr.get(log_name, None)
-
- def getRunningXML(self):
- return self._user_xml
-
- def getRunningMacro(self):
- return self._running_macro
-
- def getLastRunningMacro(self):
- return self._last_running_macro
-
- def abort(self, synch=True):
- if not synch:
- self.command_inout("AbortMacro")
- return
-
- evt_wait = AttributeEventWait(self.getAttribute("state"))
- evt_wait.lock()
- try:
- time_stamp = time.time()
- self.command_inout("AbortMacro")
- evt_wait.waitEvent(self.Running, equal=False, after=time_stamp,
- timeout=self.InteractiveTimeout)
- finally:
- evt_wait.unlock()
- evt_wait.disconnect()
-
- def stop(self, synch=True):
- if not synch:
- self.command_inout("StopMacro")
- return
-
- evt_wait = AttributeEventWait(self.getAttribute("state"))
- evt_wait.lock()
- try:
- time_stamp = time.time()
- self.command_inout("StopMacro")
- evt_wait.waitEvent(self.Running, equal=False, after=time_stamp,
- timeout=self.InteractiveTimeout)
- finally:
- evt_wait.unlock()
- evt_wait.disconnect()
-
- def _clearRunMacro(self):
- # Clear the log buffer
- map(LogAttr.clearLogBuffer, self._log_attr.values())
- self._running_macros = None
- self._running_macro = None
- self._user_xml = None
- self._block_lines = 0
-
- def preRunMacro(self, obj, parameters):
- self._clearRunMacro()
-
- xml_root = None
- if isinstance(obj , (str, unicode)):
- if obj.startswith('<') and not parameters:
- xml_root = etree.fromstring(obj)
- else:
- macros = []
- if len(parameters) == 0:
- macros_strs = obj.split('\n')
- for m in macros_strs:
- pars = m.split()
- macros.append((pars[0], pars[1:]))
- else:
- parameters = map(str, parameters)
- macros.append((obj, parameters))
- xml_root = xml_seq = etree.Element('sequence')
- for m in macros:
- xml_macro = etree.SubElement(xml_seq, 'macro')
- xml_macro.set('name', m[0])
- xml_macro.set('id', str(uuid.uuid1()))
- for p in m[1]:
- etree.SubElement(xml_macro, 'param', value=p)
- elif etree.iselement(obj):
- xml_root = obj
- else:
- raise TypeError('obj must be a string or a etree.Element')
-
- self._running_macros = {}
- for macro_xml in xml_root.xpath('//macro'):
- id, name = macro_xml.get('id'), macro_xml.get('name')
- self._running_macros[id] = Macro(self, name, id, macro_xml)
- return xml_root
-
- def postRunMacro(self, result, synch):
- pass
-
- def runMacro(self, obj, parameters=[], synch=False):
- self._user_xml = self.preRunMacro(obj, parameters)
- result = self._runMacro(self._user_xml, synch=synch)
- return self.postRunMacro(result, synch)
-
- def _runMacro(self, xml, synch=False):
- if not synch:
- return self.command_inout("RunMacro", [etree.tostring(xml)])
- timeout = self.InteractiveTimeout
- evt_wait = self._getEventWait()
- evt_wait.connect(self.getAttribute("state"))
- evt_wait.lock()
- try:
- evt_wait.waitEvent(self.Running, equal=False, timeout=timeout)
- ts = time.time()
- result = self.command_inout("RunMacro", [etree.tostring(xml)])
- evt_wait.waitEvent(self.Running, after=ts, timeout=timeout)
- if synch:
- evt_wait.waitEvent(self.Running, equal=False, after=ts,
- timeout=timeout)
- finally:
- self._clearRunMacro()
- evt_wait.unlock()
- evt_wait.disconnect()
- return result
-
- def stateChanged(self, s, t, v):
- self._old_door_state = self.getState()
- self._old_sw_door_state = self.getSWState()
-
- def resultReceived(self, log_name, result):
- """Method invoked by the arrival of a change event on the Result attribute"""
- if self._ignore_logs or self._running_macro is None:
- return
- self._running_macro.setResult(result)
- return result
-
- def putEnvironment(self, name, value):
- self.macro_server.putEnvironment(name, value)
-
- def putEnvironments(self, obj):
- self.macro_server.putEnvironments(obj)
-
- setEnvironment = putEnvironment
- setEnvironments = putEnvironments
-
- def getEnvironment(self, name=None):
- return self.macro_server.getEnvironment(name=name)
-
- def inputReceived(self, s, t, v):
- if t not in CHANGE_EVT_TYPES:
- return
- if v is None or self._running_macros is None:
- return
- input_data = CodecFactory().decode(('json', v.value))
- self.processInput(input_data)
-
- def processInput(self, input_data):
- TaurusManager().addJob(self._processInput, None, input_data)
-
- def _processInput(self, input_data):
- input_type = input_data['type']
- if input_type == 'input':
- result = self._input_handler.input(input_data)
- if result['input'] is '' and 'default_value' in input_data:
- result['input'] = input_data['default_value']
- result = CodecFactory().encode('json', ('', result))[1]
- self.write_attribute('Input', result)
- elif input_type == 'timeout':
- self._input_handler.input_timeout(input_data)
-
- def recordDataReceived(self, s, t, v):
- if t not in CHANGE_EVT_TYPES: return
- return self._processRecordData(v)
-
- def _processRecordData(self, data):
- if data is None or data.value is None: return
- # make sure we get it as string since PyTango 7.1.4 returns a buffer
- # object and json.loads doesn't support buffer objects (only str)
- data = map(str, data.value)
-
- size = len(data[1])
- if size == 0: return
- format = data[0]
- codec = CodecFactory().getCodec(format)
- data = codec.decode(data)
- return data
-
- def processRecordData(self, data):
- pass
-
- def macroStatusReceived(self, s, t, v):
- if v is None or self._running_macros is None:
- return
- if t not in CHANGE_EVT_TYPES: return
-
- # make sure we get it as string since PyTango 7.1.4 returns a buffer
- # object and json.loads doesn't support buffer objects (only str)
- v = map(str, v.value)
- if not len(v[1]):
- return
- format = v[0]
- codec = CodecFactory().getCodec(format)
-
- # make sure we get it as string since PyTango 7.1.4 returns a buffer
- # object and json.loads doesn't support buffer objects (only str)
- v[1] = str(v[1])
- fmt, data = codec.decode(v)
- for macro_status in data:
- id = macro_status.get('id')
- macro = self._running_macros.get(id)
- self._last_running_macro = self._running_macro = macro
- # if we don't have the ID it's because the macro is running a submacro
- # or another client is connected to the same door (shame on him!) and
- # executing a macro we discard this event
- if macro is not None:
- macro.__dict__.update(macro_status)
- return data
-
- def logReceived(self, log_name, output):
- if not output or self._silent or self._ignore_logs:
- return
-
- if log_name == self.Debug and not self._debug:
- return
-
- o = self.log_start[log_name]
- for line in output:
- if not self._debug:
- if line == self.BlockStart:
- for i in xrange(self._block_lines):
- o += '\x1b[2K\x1b[1A\x1b[2K' #erase current line, up one line, erase current line
- self._block_lines = 0
- continue
- elif line == self.BlockFinish:
- continue
- o += "%s\n" % line
- self._block_lines += 1
- o += self.log_stop[log_name]
- self.write(o)
-
- def write(self, msg, stream=None):
- if self.isSilent():
- return
- msg = msg.encode('utf-8')
- self._output_stream = sys.stdout
- out = self._output_stream
- if not stream is None:
- start, stop = self.log_start.get(stream), self.log_stop.get(stream)
- if start is not None and stop is not None:
- out.write(start)
- out.write(msg)
- out.write(stop)
- out.flush()
- return
- out.write(msg)
- out.flush()
-
- def writeln(self, msg='', stream=None):
- self.write("%s\n" % msg, stream=stream)
-
- def getExperimentConfigurationObj(self):
- return self._experiment_configuration
-
- def getExperimentConfiguration(self):
- return self._experiment_configuration.get()
-
- def setExperimentConfiguration(self, config, mnt_grps=None):
- self._experiment_configuration.set(config, mnt_grps=mnt_grps)
-
-
-class UnknownMacroServerElementFormat(Exception):
- pass
-
-
-class MacroPath(object):
-
- def __init__(self, ms):
- self._ms = weakref.ref(ms)
- self.refresh()
-
- def refresh(self):
- self.macro_path = mp = self._ms().get_property("MacroPath")["MacroPath"]
- self.base_macro_path = osp.commonprefix(self.macro_path)
- self.rel_macro_path = [ osp.relpath for p in mp, self.base_macro_path ]
-
-
-class Environment(dict):
-
- def __init__(self, macro_server):
- dict.__setattr__(self, "_macro_server_", weakref.ref(macro_server))
-
- def __setattr__(self, key, value):
- ms = self._macro_server_()
- if ms is not None:
- ms.putEnvironment(key, value)
-
- def __getattr__(self, key):
- return self[key]
-
- def __delattr__(self, key):
- ms = self._macro_server_()
- if ms is not None:
- ms.removeEnvironment(key)
-
- def __dir__(self):
- return [ key for key in self.keys() if not key.startswith("_") ]
-
-
-class BaseMacroServer(MacroServerDevice):
- """Class encapsulating Macro Server device functionality."""
-
- def __init__(self, name, **kw):
- self._env = Environment(self)
- self._elements = BaseSardanaElementContainer()
- self.call__init__(MacroServerDevice, name, **kw)
-
- attr = self.getAttribute("Elements")
- attr.setSerializationMode(TaurusSerializationMode.Serial)
- attr.addListener(self.on_elements_changed)
- attr.setSerializationMode(TaurusSerializationMode.Concurrent)
-
- attr = self.getAttribute('Environment')
- attr.setSerializationMode(TaurusSerializationMode.Serial)
- attr.addListener(self.on_environment_changed)
- attr.setSerializationMode(TaurusSerializationMode.Concurrent)
-
- NO_CLASS_TYPES = 'ControllerClass', 'ControllerLibrary', \
- 'MacroLibrary', 'Instrument', 'Meta', 'ParameterType'
-
- def on_environment_changed(self, evt_src, evt_type, evt_value):
- try:
- return self._on_environment_changed(evt_src, evt_type, evt_value)
- except Exception:
- self.error("Exception occurred processing environment")
- self.error("Details:", exc_info=1)
- return set(), set(), set()
-
- def _on_environment_changed(self, evt_src, evt_type, evt_value):
- ret = added, removed, changed = set(), set(), set()
- if evt_type not in CHANGE_EVT_TYPES:
- return ret
-
- env = CodecFactory().decode(evt_value.value)
-
- for key, value in env.get('new', {}).items():
- self._addEnvironment(key, value)
- added.add(key)
- for key in env.get('del', []):
- self._removeEnvironment(key)
- removed.add(key)
- for key, value in env.get('change', {}).items():
- self._removeEnvironment(key)
- self._addEnvironment(key, value)
- changed.add(key)
- return ret
-
- def _addEnvironment(self, key, value):
- self._env[key] = value
-
- def _removeEnvironment(self, key):
- try:
- self._env.pop(key)
- except KeyError:
- pass
-
- def putEnvironment(self, name, value):
- self.putEnvironments({ name : value })
-
- def putEnvironments(self, obj):
- obj = dict(new=obj)
- codec = CodecFactory().getCodec('pickle')
- self.write_attribute('Environment', codec.encode(('', obj)))
-
- setEnvironment = putEnvironment
- setEnvironments = putEnvironments
-
- def getEnvironment(self, name=None):
- if name is None:
- return self._env
- else:
- return self._env[name]
-
- def removeEnvironment(self, key):
- keys = key,
- return self.removeEnvironments(keys)
-
- def removeEnvironments(self, keys):
- obj = { 'del' : keys }
- codec = CodecFactory().getCodec('pickle')
- self.write_attribute('Environment', codec.encode(('', obj)))
-
- def getObject(self, element_info):
- elem_type = element_info.getType()
- data = element_info._data
- if elem_type in self.NO_CLASS_TYPES:
- obj = object()
- elif "MacroCode" in element_info.interfaces:
- obj = self._createMacroClassObject(element_info)
- else:
- obj = self._createDeviceObject(element_info)
- return obj
-
- def _createMacroClassObject(self, element_info):
- return MacroInfo(from_json=element_info._data)
-
- def _createDeviceObject(self, element_info):
- return Factory().getDevice(element_info.full_name)
-
- def on_elements_changed(self, evt_src, evt_type, evt_value):
- try:
- return self._on_elements_changed(evt_src, evt_type, evt_value)
- except Exception:
- self.error("Exception occurred processing elements")
- self.error("Details:", exc_info=1)
- return set(), set(), set()
-
- def _on_elements_changed(self, evt_src, evt_type, evt_value):
- ret = added, removed, changed = set(), set(), set()
- if evt_type not in CHANGE_EVT_TYPES:
- return ret
- try:
- elems = CodecFactory().decode(evt_value.value, ensure_ascii=True)
- except:
- self.error("Could not decode element info format=%s len=%s",
- evt_value.value[0], len(evt_value.value[1]))
- return ret
-
- for element_data in elems.get('new', ()):
- element_data['manager'] = self
- element = self._addElement(element_data)
- added.add(element)
- for element_data in elems.get('del', ()):
- element = self._removeElement(element_data)
- removed.add(element)
- for element_data in elems.get('change', ()):
- element = self._removeElement(element_data)
- element_data['manager'] = self
- element = self._addElement(element_data)
- changed.add(element)
- return ret
-
- def _addElement(self, element_data):
- element = BaseSardanaElement(**element_data)
- self.getElementsInfo().addElement(element)
- return element
-
- def _removeElement(self, element_data):
- name = element_data['name']
- element = self.getElementInfo(name)
- self.getElementsInfo().removeElement(element)
- return element
-
- def getElementsInfo(self):
- return self._elements
-
- def getElements(self):
- return self.getElementsInfo().getElements()
-
- def getElementInfo(self, name):
- return self.getElementsInfo().getElement(name)
-
- def getElementNamesOfType(self, elem_type):
- return self.getElementsInfo().getElementNamesOfType(elem_type)
-
- def getElementNamesWithInterface(self, interface):
- return self.getElementsInfo().getElementNamesWithInterface(interface)
-
- def getElementsWithInterface(self, interface):
- return self.getElementsInfo().getElementsWithInterface(interface)
-
- def getElementsWithInterfaces(self, interfaces):
- return self.getElementsInfo().getElementsWithInterfaces(interfaces)
-
- def getElementsOfType(self, elem_type):
- return self.getElementsInfo().getElementsOfType(elem_type)
-
- def getElementsOfTypes(self, elem_types):
- elems = CaselessDict()
- for elem_type in elem_types:
- elems.update(self.getElementsOfType(elem_type))
- return elems
-
- def getInterfaces(self):
- return self.getElementsInfo().getInterfaces()
-
- def getExpChannelElements(self):
- channel_types = "CTExpChannel", "ZeroDExpChannel", "OneDExpChannel", \
- "TwoDExpChannel", "PseudoCounter"
- return self.getElementsOfTypes(channel_types)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Macro API
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def getMacros(self):
- return dict(self.getElementsInfo().getElementsWithInterface('MacroCode'))
-
- def getMacroInfoObj(self, macro_name):
- return self.getElementsInfo().getElementWithInterface(macro_name, 'MacroCode')
-
- def getMacroStrList(self):
- return self.getElementNamesWithInterface('MacroCode')
-
- def getMacroNodeObj(self, macro_name):
- """
- This method retrieves information about macro from MacroServer
- and creates MacroNode object, filled with all information about parameters.
-
- :param macro_name: (str) macro name
-
- :return: (MacroNode)
-
- See Also: fillMacroNodeAddidtionalInfos
- """
-
- macroNode = MacroNode(name=macro_name)
- macroInfoObj = self.getMacroInfoObj(macro_name)
- if macroInfoObj is None: return
- allowedHookPlaces = []
- hints = macroInfoObj.hints
- if hints is not None:
- for hook in hints.get('allowsHooks', []):
- allowedHookPlaces.append(str(hook))
- macroNode.setAllowedHookPlaces(allowedHookPlaces)
- hasParams = bool(len(macroInfoObj.parameters))
- macroNode.setHasParams(hasParams)
- paramsInfo = macroInfoObj.parameters
- for paramInfo in paramsInfo:
- param = ParamFactory(paramInfo)
- macroNode.addParam(param)
- return macroNode
-
- def validateMacroName(self, macroName):
- macroInfo = self.getElementInfo(macroName)
- if macroInfo is None:
- raise Exception("%s macro does not exist in this sardana system." % macroName)
- elif macroInfo.type != 'MacroClass':
- raise Exception("%s element is not a macro." % macroName)
- return True
-
- def validateMacroNode(self, macroNode):
- paramNodes = macroNode.children()
- for paramNode in paramNodes:
- self.validateParamNode(paramNode)
- return True
-
- def validateParamNode(self, paramNode):
- assert isinstance(paramNode, ParamNode)
- if isinstance(paramNode, SingleParamNode):
- self.validateSingleParam(paramNode)
- else:
- self.validateRepeatParam(paramNode)
- return True
-
- def validateSingleParam(self, singleParamNode):
- name = singleParamNode.name()
- type = singleParamNode.type()
- value = singleParamNode.value()
-
- if type == "Boolean":
- pass
- elif type == "Env":
- pass
- elif type == "File":
- pass
- elif type == "Filename":
- pass
- elif type == "MotorParam":
- pass
- elif type == "String":
- pass
- elif type == "User":
- pass
- elif type == "MotorParam":
- pass
- elif type == "Integer":
- int(value)
- min = singleParamNode.min()
- max = singleParamNode.max()
- if min != None and value < min:
- raise Exception("%s parameter value: %s is below minimum allowed value." % (name, value))
- if max != None and value > max:
- raise Exception("%s parameter value: %s is above maximum allowed value." % (name, value))
- elif type == "Float":
- float(value)
- min = singleParamNode.min()
- max = singleParamNode.max()
- if min != None and value < min:
- raise Exception("%s parameter value: %s is below minimum allowed value." % (name, value))
- if max != None and value > max:
- raise Exception("%s parameter value: %s is above maximum allowed value." % (name, value))
- else:
- allowedInterfaces = self.getInterfaces().keys()
- if not type in allowedInterfaces:
- raise Exception("No element with %s interface exist in this sardana system." % type)
- allowedValues = self.getElementNamesWithInterface(type)
- if not value in allowedValues:
- raise Exception("%s element with %s interface does not exist in this sardana system." % (value, type))
- return True
-
- def validateRepeatParam(self, repeatParamNode):
- paramName = repeatParamNode.name()
- if repeatParamNode.isBelowMin():
- raise Exception("%s param repeats has not enough repeats." % (paramName))
- if repeatParamNode.isAboveMax():
- raise Exception("%s param repeat has too many repeats." % (paramName))
- repetitions = repeatParamNode.children()
- for repeat in repetitions:
- params = repeat.children()
- for param in params:
- if isinstance(param, SingleParamNode):
- self.validateSingleParam(param)
- else:
- self.validateRepeatParam(param)
- return True
-
-
- def fillMacroNodeAdditionalInfos(self, macroNode):
- """
- This method fills macroNode information which couldn't be stored
- in XML file.
-
- :param macroNode: (MacroNode) macro node obj populated from XML information
-
- See Also: getMacroNodeObj
- """
- macroName = macroNode.name()
- macroInfoObj = self.getMacroInfoObj(macroName)
- if macroInfoObj is None:
- raise Exception("It was not possible to get information about %s macro.\nCheck if MacroServer is alive and if this macro exist." % macroName)
- allowedHookPlaces = []
- hints = macroInfoObj.hints or {}
- for hook in hints.get("allowsHooks", []):
- allowedHookPlaces.append(str(hook))
- macroNode.setAllowedHookPlaces(allowedHookPlaces)
- hasParams = macroInfoObj.hasParams()
- macroNode.setHasParams(hasParams)
- if hasParams:
- paramList = macroInfoObj.getParamList()
- for paramNode, paramInfo in zip(macroNode.params(), paramList):
- self.__fillParamNodeAdditionalInfos(paramNode, paramInfo)
-
- def __fillParamNodeAdditionalInfos(self, paramNode, paramInfo):
- """
- This is a protected method foreseen to use only internally by
- fillMacroNodeAdditionaInfos, to be called for every param node obj."""
- type = paramInfo.get('type')
- paramNode.setDescription(str(paramInfo.get("description")))
- min = paramInfo.get("min")
- paramNode.setMin(min)
- max = paramInfo.get("max")
- paramNode.setMax(max)
- if isinstance(type, list):
- paramNode.setParamsInfo(type)
- for repeatNode in paramNode.children():
- for internalParamNode, internalParamInfo in zip(repeatNode.children(), type):
- self.__fillParamNodeAdditionalInfos(internalParamNode, internalParamInfo)
- else:
- paramNode.setType(str(type))
- paramNode.setDefValue(str(paramInfo.get("default_value")))
-
- def recreateMacroNodeAndFillAdditionalInfos(self, macroNode):
- """
- This method filles macroNode information which couldn't be stored
- in plain text file.
-
- :param macroNode: (MacroNode) macro node obj populated from plain text information
-
- See Also: getMacroNodeObj
- """
- macroName = macroNode.name()
- self.validateMacroName(macroName)
- macroInfoObj = self.getMacroInfoObj(macroName)
- if macroInfoObj is None:
- raise Exception("It was not possible to get information about %s macro.\nCheck if MacroServer is alive and if this macro exist." % macroName)
- allowedHookPlaces = []
- hints = macroInfoObj.hints or {}
- for hook in hints.get("allowsHooks", []):
- allowedHookPlaces.append(str(hook))
- macroNode.setAllowedHookPlaces(allowedHookPlaces)
- hasParams = macroInfoObj.hasParams()
- macroNode.setHasParams(hasParams)
- if not hasParams:
- return
- paramInfosList = macroInfoObj.getParamList()
- paramNodes = macroNode.params()
- paramIndex = 0
- for paramNode, paramInfo in zip(paramNodes, paramInfosList):
- paramType = paramInfo.get('type')
- if isinstance(paramType, list):
- paramNode = self.__recreateParamRepeatNodes(macroNode, paramIndex, paramInfo)
- else:
- paramNode.setName(paramInfo.get("name"))
- self.__recreateParamNodeAdditionalInfos(paramNode, paramInfo)
- paramIndex += 1
- self.validateMacroNode(macroNode)
-
- def __recreateParamRepeatNodes(self, macroNode, indexToStart, repeatParamInfo):
- #extracting rest of the single params which have to be adopted to param repeats
- paramNodes = []
- while len(macroNode.params()) > indexToStart:
- lastParam = macroNode.popParam()
- paramNodes.append(lastParam)
- paramNodes.reverse()
-
- nrOfSingleParams = len(paramNodes)
- paramName = repeatParamInfo.get("name")
- min = repeatParamInfo.get("min")
- max = repeatParamInfo.get("max")
- repeatParamChildrenInfos = repeatParamInfo.get("type")
-
- if nrOfSingleParams % len(repeatParamChildrenInfos):
- raise Exception("Param repeat %s doesn't have correct number of repetitions" % paramName)
- nrOfRepeats = nrOfSingleParams / len(repeatParamChildrenInfos)
- repeatParamNode = RepeatParamNode(macroNode, repeatParamInfo)
- for repeatIdx in range(nrOfRepeats):
- repeatNode = RepeatNode(repeatParamNode)
- for singleParamInfo in repeatParamChildrenInfos:
- singleParamName = singleParamInfo.get('name')
- singleParamNode = paramNodes.pop(0)
- singleParamNode.setName(singleParamName)
- repeatNode.insertChild(singleParamNode)
- repeatParamNode.insertChild(repeatNode)
- macroNode.addParam(repeatParamNode)
- return repeatParamNode
-
- def __recreateParamNodeAdditionalInfos(self, paramNode, paramInfo):
- """
- This is a protected method foreseen to use only internally by
- fillMacroNodeAdditionaInfos, to be called for every param node obj."""
- paramType = paramInfo.get('type')
- min = paramInfo.get("min")
- max = paramInfo.get("max")
- paramNode.setMin(min)
- paramNode.setMax(max)
- paramNode.setDescription(str(paramInfo.get("description")))
-
- if type(paramType) == list:
- paramNode.setParamsInfo(paramType)
- for repeatNode in paramNode.children():
- for internalParamNode, internalParamInfo in zip(repeatNode.children(), paramType):
- self.__recreateParamNodeAdditionalInfos(internalParamNode, internalParamInfo)
- else:
- paramNode.setType(paramType)
- paramNode.setDefValue(str(paramInfo.get("default_value")))
-
-
- def getMacroPathObj(self, cache=False):
- if not hasattr(self, "_macro_path"):
- self._macro_path = MacroPath(self)
- elif not cache:
- self._macro_path.refresh()
- return self._macro_path
-
-
-def registerExtensions():
- """Registers the macroserver extensions in the :class:`taurus.core.tango.TangoFactory`"""
- factory = Factory('tango')
- factory.registerDeviceClass('MacroServer', BaseMacroServer)
- factory.registerDeviceClass('Door', BaseDoor)
-
-def unregisterExtensions():
- """Registers the macroserver extensions in the :class:`taurus.core.tango.TangoFactory`"""
- factory = Factory('tango')
- factory.unregisterDeviceClass('MacroServer')
- factory.unregisterDeviceClass('Door')
diff --git a/src/sardana/taurus/core/tango/sardana/motion.py b/src/sardana/taurus/core/tango/sardana/motion.py
deleted file mode 100644
index f183983e..00000000
--- a/src/sardana/taurus/core/tango/sardana/motion.py
+++ /dev/null
@@ -1,567 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The sardana motion submodule. It contains specific part of sardana motion"""
-
-__all__ = ["Moveable", "MoveableSource", "Motion", "MotionGroup"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-
-from taurus.core.util.containers import CaselessDict
-
-class Moveable:
- """ An item that can 'move'. In order to move it you need to provide a list
- of values (normally interpreted as motor positions).
- Therefore this Moveable can represent a single motor, a group of motors"""
-
- def __init__(self):
- pass
-
- def startMove(self, new_pos, timeout=None):
- """ startMove(sequence<float> new_pos, double timeout=None) -> sequence<id>
-
- Calling this method will trigger a movement off all components of
- the movement."""
- pass
-
- def waitMove(self, timeout=None, id=None):
- """ waitMove(float timeout=None, sequence<id> id=None) -> None
-
- Waits for the movement to end. If no movement is active the method
- returns immediately."""
- pass
-
- def move(self, new_pos, timeout=None):
- """ move(list<double> new_pos, timeout=None) -> None
-
- Triggers a movement and waits for it to end.
-
- """
- self.waitMove(id=self.startMove(new_pos, timeout=timeout))
-
- def iterMove(self, new_pos, timeout=None):
- """ generator for motor positions"""
- pass
-
- def getLastMotionTime(self):
- raise NotImplementedError
-
- def getTotalLastMotionTime():
- raise NotImplementedError
-
- def abort(self, wait_ready=True, timeout=None):
- pass
-
- def readPosition(self, force=False):
- pass
-
- def getMoveableSource(self):
- return None
-
- def getSize(self):
- return 0
-
- def getIndex(self, name):
- pass
-
-
-class MoveableSource:
- """ A container of Moveable items. """
-
- def __init__(self):
- pass
-
- def getMoveable(self, names):
- """ getMoveable(list<string> names) -> Moveable
-
- Returns a Moveable object that handles all the moveable items given in
- names.
- """
- pass
-
-
-class BaseMotion(Moveable):
-
- def __init__(self, elements, moveable_srcs, allow_repeat=False,
- allow_unknown=False, read_only=False):
- self.read_only = read_only
-
- if len(elements) == 0:
- raise Exception("Motion with no elements")
-
- first_elem = elements[0]
-
- if isinstance(first_elem, (str, unicode)):
- self.init_by_names(elements, moveable_srcs, allow_repeat,
- allow_unknown)
- else:
- self.init_by_movables(elements, moveable_srcs, allow_repeat,
- allow_unknown)
-
- def getMoveable(self, sources, name):
- for source in sources:
- moveable = source.getMoveable(name)
- if moveable is not None:
- return moveable
-
-
-class MotionGroup(BaseMotion):
- """ A virtual motion group object """
-
- def __init__(self, elements, moveable_srcs, allow_repeat=False,
- allow_unknown=False, read_only=False):
- BaseMotion.__init__(self, elements, moveable_srcs,
- allow_repeat=allow_repeat,
- allow_unknown=allow_unknown, read_only=read_only)
- self.__total_motion_time = 0
-
- def init_by_movables(self, elements, moveable_srcs, allow_repeat, allow_unknown):
- self.moveable_list = elements
-
- def init_by_names(self, names, moveable_srcs, allow_repeat, allow_unknown):
- moveables = [ self.getMoveable(moveable_srcs, name) for name in names ]
- self.init_by_movables(moveables, moveable_srcs, allow_repeat,
- allow_unknown)
-
- def getLastMotionTime(self):
- times = [ moveable.getLastMotionTime() for moveable in self.moveable_list ]
- return max(times)
-
- def getTotalLastMotionTime():
- return self.__total_motion_time
-
- def startMove(self, pos_list, timeout=None):
- if self.read_only:
- raise Exception("Trying to move read only motion")
-
- if len(pos_list) != len(self.moveable_list):
- raise Exception("Invalid number of position values")
-
- ids = []
- for i, moveable in enumerate(self.moveable_list):
- ids.append(moveable.startMove(pos_list[i], timeout=timeout))
- return ids
-
- def waitMove(self, timeout=None, id=None):
- if id is None:
- id = len(self.moveable_list) * [None]
- for i, moveable in enumerate(self.moveable_list):
- moveable.waitMove(timeout=timeout, id=id[i])
-
- def move(self, new_pos, timeout=None):
- start_time = time.time()
- states, positions = [], []
- for moveable, pos in zip(self.moveable_list, new_pos):
- res = moveable.move(pos, timeout=timeout)
- states.append(res[0])
- positions.extend(res[1])
- import PyTango
- state = PyTango.DevState.ON
- if PyTango.DevState.FAULT in states:
- state = PyTango.DevState.FAULT
- elif PyTango.DevState.ALARM in states:
- state = PyTango.DevState.ALARM
- elif PyTango.DevState.UNKNOWN in states:
- state = PyTango.DevState.UNKNOWN
- elif PyTango.DevState.MOVING in states:
- state = PyTango.DevState.MOVING
- self.__total_motion_time = time.time() - start_time
- return state, positions
-
- def iterMove(self, new_pos, timeout=None):
- """ generator for motor positions"""
- raise NotImplementedError
-
- def getStatus(self):
-# res = []
-# for moveable in self.moveable_list:
-# status = moveable.status.split('\n')
-# res.append(moveable.getName() + ":")
-# for st in status:
-# res.append(" " + st)
-# return "\n".join(res)
- return "\n".join([ m.status() for m in self.moveable_list ])
-
- def readState(self, force=False):
- if len(self.moveable_list) == 1:
- return self.moveable_list[0].getState()
- return [ m.getState() for m in self.moveable_list ]
-
- def readPosition(self, force=False):
- return [ m.readPosition(force=force) for m in self.moveable_list ]
-
- def abort(self, wait_ready=True, timeout=None):
- for moveable in self.moveable_list:
- try:
- moveable.abort(wait_ready=wait_ready, timeout=timeout)
- except:
- pass
-
- def stop(self, wait_ready=True, timeout=None):
- for moveable in self.moveable_list:
- try:
- moveable.stop(wait_ready=wait_ready, timeout=timeout)
- except:
- pass
-
- def read(self):
- pass
-
-
-class Motion(BaseMotion):
- """ A motion object """
-
- def __init__(self, elements, moveable_srcs, allow_repeat=False,
- allow_unknown=False, read_only=False):
- BaseMotion.__init__(self, elements, moveable_srcs,
- allow_repeat=allow_repeat,
- allow_unknown=allow_unknown, read_only=read_only)
- self.__total_motion_time = 0
-
- def init_by_movables(self, elements, moveable_srcs, allow_repeat, allow_unknown):
- # TODO: Optimize this. Dont call init_by_names. It its possible to do it
- # manually with some performance gain
- names = [ elem.getName() for elem in elements]
- self.init_by_names(names, moveable_srcs, allow_repeat, allow_unknown)
-
- def init_by_names(self, names, moveable_srcs, allow_repeat, allow_unknown):
-
- ms_elem_names = self.getElemNamesByMoveableSource(names, moveable_srcs,
- allow_repeat=allow_repeat, allow_unknown=allow_unknown)
-
- # map<MoveableSource, Moveable>
- ms_moveables = {}
- for moveable_source, ms_names in ms_elem_names.items():
- moveable = moveable_source.getMoveable(ms_names)
- ms_moveables[moveable_source] = moveable
-
- # list<Moveable>
- moveable_list = ms_moveables.values()
-
- # list<tuple(int moveable_index, int position_index)>
- pos_to_moveable = len(names) * [None, ]
-
- for i, name in enumerate(names):
- moveable_index, position_index = -1, -1
- for j, moveable in enumerate(moveable_list):
- position_index = moveable.getIndex(name)
- if position_index >= 0:
- pos_to_moveable[i] = (j, position_index)
- break
-
- # list<string> moveable item names
- self.names = names
-
- # list<Moveable>
- self.moveable_list = moveable_list
-
- # list<tuple(int moveable_index, int position_index)>
- # the list index itself is the position index for this motion
- # the tuple for a given index gives the corresponding moveable index and
- # the position index inside the moveable object
- self.pos_to_moveable = pos_to_moveable
-
- # map<MoveableSource, Moveable>
- self.ms_moveables = ms_moveables
-
- # a buffer for positions for performance reasons
- #list<list<double>> index of outer list is the moveable index. The
- #contents of the list are the ordered positions for that moveable
- pos_buff = []
- total_count = 0
- for m in moveable_list:
- count = m.getSize()
- total_count += count
- pos_buff.append(m.getSize() * [0.0, ])
- self.pos_buff = pos_buff
-
- assert(len(self.pos_to_moveable) == len(self.names))
- assert(total_count == len(self.names))
-
- def getElemNamesByMoveableSource(self, names, moveable_sources,
- allow_repeat,
- allow_unknown):
- """ getElemNamesByMoveableSource(list<str>names,
- list<MoveableSource> moveable_sources,
- bool allow_repeat, bool allow_unknown)
-
- Organizes the elements by moveable source. The result is a dictionary
- with key being the MoveableSource and data a list of the names that
- belong to the that motion source.
- """
-
- ms_elems = {}
-
- for name in names:
- moveable = None
-
- for moveable_source in moveable_sources:
- moveable = moveable_source.getMoveable([name])
- if not moveable is None:
- if not ms_elems.has_key(moveable_source):
- ms_elems[moveable_source] = []
- moveable_source_moveables = ms_elems.get(moveable_source)
- present = name in moveable_source_moveables
- if not present or (present and allow_repeat):
- moveable_source_moveables.append(name)
- break
- elif present and not allow_repeat:
- raise Exception("Moveable item %s appears more "
- "than once" % name)
- if moveable is None and not allow_unknown:
- raise Exception("Moveable item %s not found" % name)
- return ms_elems
-
- def getLastMotionTime(self):
- times = [ moveable.getLastMotionTime() for moveable in self.moveable_list ]
- return max(times)
-
- def getTotalLastMotionTime():
- return self.__total_motion_time
-
- def startMove(self, pos_list, timeout=None):
- if self.read_only:
- raise Exception("Trying to move read only motion")
-
- if len(pos_list) != len(self.names):
- raise Exception("Invalid number of position values")
-
- buff = self.pos_buff
- for i, pair in enumerate(self.pos_to_moveable):
- pos = pos_list[i]
- buff[pair[0]][pair[1]] = pos
-
- ids = []
- for i, moveable in enumerate(self.moveable_list):
- ids.append(moveable.startMove(buff[i], timeout=timeout))
- return ids
-
- def waitMove(self, timeout=None, id=None):
- if id is None:
- id = len(self.moveable_list) * [None]
- for i, moveable in enumerate(self.moveable_list):
- moveable.waitMove(timeout=timeout, id=id[i])
-
- def move(self, new_pos, timeout=None):
- start_time = time.time()
- if len(self.moveable_list) == 1:
- moveable = self.moveable_list[0]
- ret = moveable.move(new_pos, timeout=timeout)
- else:
- start, ids = 0, []
- for moveable in self.moveable_list:
- end = start + moveable.getSize()
- pos = new_pos[start:end]
- id = moveable.startMove(pos, timeout=timeout)
- ids.append(id)
- start = end
- for moveable, id in zip(self.moveable_list, ids):
- moveable.waitMove(id=id, timeout=timeout)
- states, positions = self.readState(), self.readPosition()
- import PyTango
- state = PyTango.DevState.ON
- if PyTango.DevState.FAULT in states:
- state = PyTango.DevState.FAULT
- elif PyTango.DevState.ALARM in states:
- state = PyTango.DevState.ALARM
- elif PyTango.DevState.UNKNOWN in states:
- state = PyTango.DevState.UNKNOWN
- elif PyTango.DevState.MOVING in states:
- state = PyTango.DevState.MOVING
- ret = state, positions
- self.__total_motion_time = time.time()
- return ret
-
- def iterMove(self, new_pos, timeout=None):
- """ generator for motor positions"""
- assert len(self.moveable_list) == 1, "for now we support only 'simple' motions!!!!"
-
- moveable = self.moveable_list[0]
- for p in moveable.iterMove(new_pos, timeout=timeout):
- yield p
-
- def getStatus(self):
- return "\n".join([ m.status() for m in self.moveable_list ])
-
- def readState(self, force=False):
- if len(self.moveable_list) == 1:
- return self.moveable_list[0].getState()
- return [ m.getState() for m in self.moveable_list ]
-
- def readPosition(self, force=False):
- moveable_pos_list = [ m.readPosition(force=force) for m in self.moveable_list ]
- pos = [ moveable_pos_list[pair[0]][pair[1]] for pair in self.pos_to_moveable ]
- return pos
-
- def abort(self, wait_ready=True, timeout=None):
- for moveable in self.moveable_list:
- moveable.abort(wait_ready=wait_ready, timeout=timeout)
-
- def stop(self, wait_ready=True, timeout=None):
- for moveable in self.moveable_list:
- moveable.stop(wait_ready=wait_ready, timeout=timeout)
-
- def read(self):
- pass
-
-#-------------------------------------------------------------------------------
-# Small test framework
-#-------------------------------------------------------------------------------
-
-class PoolMoveableTest(Moveable):
- def __init__(self, name, elems, moveable_src, mov_items=None):
- self.name = name
- self.elem_names = elems
- self.moveable_src = moveable_src
- self.pos = len(elems) * [0.0, ]
-
- def startMove(self, new_pos, timeout=None):
- self.pos = new_pos
- # return the id as time_stamp
- return len(self.elem_names) * [time.time()]
-
- def waitMove(self, timeout=None, id=None):
- pass
-
- def abort(self, wait_ready=True, timeout=None):
- pass
-
- def readPosition(self, force=False):
- return self.pos
-
- def getMoveableSource(self):
- return self.moveable_src
-
- def getSize(self):
- return len(self.elem_names)
-
- def getIndex(self, name):
- try:
- return self.elem_names.index(name)
- except:
- return -1
-
-class PoolMSTest(MoveableSource):
-
- def __init__(self, initial_elems):
- MoveableSource.__init__(self)
- self.elem_names = initial_elems
- self.moveable_inc = 0
-
- self.motors = CaselessDict()
- for elem_name in initial_elems:
- self.motors[elem_name] = PoolMoveableTest(elem_name, [elem_name], self)
- self.motor_group = None
-
- def getMoveable(self, names):
- if len(names) == 1:
- return self.motors.get(names[0])
- l = [name for name in self.elem_names if name in names]
- self.motor_group = PoolMoveableTest("moveable %d" % self.moveable_inc, l, self)
- self.moveable_inc += 1
- return self.motor_group
-
-def test():
- ms1 = PoolMSTest(["m1", "m2", "m3", "m4"])
- ms2 = PoolMSTest(["m5", "m6", "m7", "m8"])
- ms3 = PoolMSTest(["m9", "m10", "m11", "m12"])
-
- motion1 = Motion(["m1"], [ms1, ms2, ms3])
-
- # some tests
- for p in [[5.0], [20.0], [0.0], [-14.5], [0.0]]:
- motion1.move(p)
- assert(ms1.motors["m1"].pos[0] == p[0])
- assert(motion1.readPosition() == p)
-
- motion2 = Motion(["m1", "m2", "m3"], [ms1, ms2, ms3])
- for p in [[5.0, 20.0, 0.0], [-14.5, 3.32, 232], [0.0, 0.0, 0.0]]:
- motion2.move(p)
- assert(ms1.motor_group.pos == p)
- assert(motion2.readPosition() == p)
-
- motion3 = Motion(["m3", "m1", "m2"], [ms1, ms2, ms3])
- for p in [[5.0, 20.0, 0.0], [-14.5, 3.32, 232], [0.0, 0.0, 0.0]]:
- motion3.move(p)
- assert(ms1.motor_group.pos[0] == p[1])
- assert(ms1.motor_group.pos[1] == p[2])
- assert(ms1.motor_group.pos[2] == p[0])
- assert(motion3.readPosition() == p)
-
- motion4 = Motion(["m2", "m6"], [ms1, ms2, ms3])
- for p in [[5.0, 20.0], [-14.5, 3.32], [0.0, 0.0]]:
- motion4.move(p)
- assert(ms1.motors["m2"].pos[0] == p[0])
- assert(ms2.motors["m6"].pos[0] == p[1])
- assert(motion4.readPosition() == p)
-
- motion5 = Motion(["m3", "m1", "m7"], [ms1, ms2, ms3])
- for p in [[5.0, 20.0, 0.0], [-14.5, 3.32, 232], [0.0, 0.0, 0.0]]:
- motion5.move(p)
- assert(ms1.motor_group.pos[1] == p[0])
- assert(ms1.motor_group.pos[0] == p[1])
- assert(ms2.motors["m7"].pos[0] == p[2])
- assert(motion5.readPosition() == p)
-
- motion6 = Motion(["m4", "m9", "m10", "m2"], [ms1, ms2, ms3])
- for p in [[5.0, 20.0, 0.0, 21.0], [-14.5, 3.32, 232, 45.4], [0.0, 0.0, 0.0, 0.0]]:
- motion6.move(p)
- assert(ms1.motor_group.pos[1] == p[0])
- assert(ms1.motor_group.pos[0] == p[3])
- assert(ms3.motor_group.pos[0] == p[1])
- assert(ms3.motor_group.pos[1] == p[2])
- assert(motion6.readPosition() == p)
-
- motion7 = Motion(["m4", "m9", "m7", "m2"], [ms1, ms2, ms3])
- for p in [[5.0, 20.0, 0.0, 21.0], [-14.5, 3.32, 232, 45.4], [0.0, 0.0, 0.0, 0.0]]:
- motion7.move(p)
- assert(ms1.motor_group.pos[1] == p[0])
- assert(ms1.motor_group.pos[0] == p[3])
- assert(ms3.motors["m9"].pos[0] == p[1])
- assert(ms2.motors["m7"].pos[0] == p[2])
- assert(motion7.readPosition() == p)
-
- try:
- m = Motion(["m1", "m2"], [ms1, ms2, ms3], read_only=True)
- m.startMove([0.5, 20.4])
- except Exception, e:
- assert(e.message == "Trying to move read only motion")
-
- try:
- m = Motion(["m1", "m1"], [ms1, ms2, ms3])
- except Exception, e:
- assert(e.message == "Moveable item m1 appears more than once")
-
- try:
- m = Motion(["m1", "m999"], [ms1, ms2, ms3])
- except Exception, e:
- assert(e.message == "Moveable item m999 not found")
-
-if __name__ == "__main__":
- test()
-
-
diff --git a/src/sardana/taurus/core/tango/sardana/pool.py b/src/sardana/taurus/core/tango/sardana/pool.py
deleted file mode 100644
index e68eb34b..00000000
--- a/src/sardana/taurus/core/tango/sardana/pool.py
+++ /dev/null
@@ -1,1794 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The device pool submodule. It contains specific part of sardana device pool"""
-
-__all__ = ["InterruptException", "StopException", "AbortException",
- "BaseElement", "ControllerClass", "ControllerLibrary",
- "PoolElement", "Controller", "ComChannel", "ExpChannel",
- "CTExpChannel", "ZeroDExpChannel", "OneDExpChannel", "TwoDExpChannel",
- "PseudoCounter", "Motor", "PseudoMotor", "MotorGroup",
- "MeasurementGroup", "IORegister", "Instrument", "Pool",
- "registerExtensions", "getChannelConfigs"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import sys
-import time
-import weakref
-import operator
-import traceback
-
-from PyTango import DevState, AttrDataFormat, AttrQuality, DevFailed, \
- DeviceProxy
-
-from taurus import Factory, Device
-from taurus.core.taurusbasetypes import TaurusEventType, TaurusSWDevState, \
- TaurusSerializationMode
-from taurus.core.taurusvalidator import AttributeNameValidator
-from taurus.core.util.log import Logger
-from taurus.core.util.singleton import Singleton
-from taurus.core.util.codecs import CodecFactory
-from taurus.core.util.containers import CaselessDict
-from taurus.core.util.event import EventGenerator, AttributeEventWait, \
- AttributeEventIterator
-from taurus.core.tango import TangoDevice, FROM_TANGO_TO_STR_TYPE
-
-from .sardana import BaseSardanaElementContainer, BaseSardanaElement
-from .motion import Moveable, MoveableSource
-
-Ready = Standby = DevState.ON
-Counting = Acquiring = Moving = DevState.MOVING
-Alarm = DevState.ALARM
-Fault = DevState.FAULT
-
-CHANGE_EVT_TYPES = TaurusEventType.Change, TaurusEventType.Periodic
-
-MOVEABLE_TYPES = 'Motor', 'PseudoMotor', 'MotorGroup'
-
-QUALITY = {
- AttrQuality.ATTR_VALID : 'VALID',
- AttrQuality.ATTR_INVALID : 'INVALID',
- AttrQuality.ATTR_CHANGING : 'CHANGING',
- AttrQuality.ATTR_WARNING : 'WARNING',
- AttrQuality.ATTR_ALARM : 'ALARM',
- None : 'UNKNOWN'
-}
-
-class InterruptException(Exception):
- pass
-
-class StopException(InterruptException):
- pass
-
-class AbortException(InterruptException):
- pass
-
-class BaseElement(object):
- """ The base class for elements in the Pool (Pool itself, Motor,
- ControllerClass, ExpChannel all should inherit from this class directly or
- indirectly)
- """
-
- def __repr__(self):
- pd = self.getPoolData()
- return "{0}({1})".format(pd['type'], pd['full_name'])
-
- def __str__(self):
- return self.getName()
-
- def serialize(self):
- return self.getPoolData()
-
- def str(self, n=0):
- """Returns a sequence of strings representing the object in 'consistent'
- way. Default is to return <name>, <controller name>, <axis>
-
- :param n: the number of elements in the tuple."""
- if n == 0:
- return CodecFactory.encode(('json'), self.serialize())
- return self._str_tuple[:n]
-
- def __cmp__(self, o):
- return cmp(self.getPoolData()['full_name'], o.getPoolData()['full_name'])
-
- def getName(self):
- return self.getPoolData()['name']
-
- def getPoolObj(self):
- return self._pool_obj
-
- def getPoolData(self):
- try:
- return self._pool_data
- except AttributeError:
- self._pool_data = self._find_pool_data()
- return self._pool_data
-
-
-class ControllerClass(BaseElement):
-
- def __init__(self, **kw):
- self.__dict__.update(kw)
- self.path, self.f_name = os.path.split(self.file_name)
- self.lib_name, self.ext = os.path.splitext(self.f_name)
-
- def __repr__(self):
- pd = self.getPoolData()
- return "ControllerClass({0})".format(pd['full_name'])
-
- def getSimpleFileName(self):
- return self.f_name
-
- def getFileName(self):
- return self.file_name
-
- def getClassName(self):
- return self.getName()
-
- def getType(self):
- return self.getTypes()[0]
-
- def getTypes(self):
- return self.types
-
- def getLib(self):
- return self.f_name
-
- def getGender(self):
- return self.gender
-
- def getModel(self):
- return self.model
-
- def getOrganization(self):
- return self.organization
-
- def __cmp__(self, o):
- t = cmp(self.getType(), o.getType())
- if t != 0: return t
- t = cmp(self.getGender(), o.getGender())
- if t != 0: return t
- return cmp(self.getClassName(), o.getClassName())
-
-
-class ControllerLibrary(BaseElement):
-
- def __init__(self, **kw):
- self.__dict__.update(kw)
-
- def getType(self):
- return self.getTypes()[0]
-
- def getTypes(self):
- return self.type
-
-
-class TangoAttributeEG(Logger, EventGenerator):
- """An event generator for a 'State' attribute"""
-
- def __init__(self, attr):
- self._attr = attr
- self.call__init__(Logger, 'EG', attr)
- event_name = '%s EG' % (attr.getParentObj().getNormalName())
- self.call__init__(EventGenerator, event_name)
-
- self._attr.addListener(self)
-
- def getAttribute(self):
- return self._attr
-
- def eventReceived(self, evt_src, evt_type, evt_value):
- """Event handler from Taurus"""
- if evt_type not in CHANGE_EVT_TYPES:
- return
- if evt_value is None:
- v = None
- else:
- v = evt_value.value
- EventGenerator.fireEvent(self, v)
-
- def read(self, force=False):
- try:
- self.last_val = self._attr.read(cache=not force).value
- except:
- self.error("Read error")
- self.debug("Details:", exc_info=1)
- self.last_val = None
- return EventGenerator.read(self)
-
- def readValue(self, force=False):
- r = self.read(force=force)
- if r is None:
- # do a retry
- r = self.read(force=force)
- return r
-
- def write(self, value):
- self._attr.write(value, with_read=False)
-
- def __getattr__(self, name):
- return getattr(self._attr, name)
-
-
-def reservedOperation(fn):
- def new_fn(*args, **kwargs):
- self = args[0]
- wr = self.getReservedWR()
- if wr is not None:
- if wr().isStopped():
- raise StopException("stopped before calling %s" % fn.__name__)
- elif wr().isAborted():
- raise AbortException("aborted before calling %s" % fn.__name__)
- try:
- return fn(*args, **kwargs)
- except:
- print "Exception occured in reserved operation: clearing events..."
- self._clearEventWait()
- raise
- return new_fn
-
-
-def get_pool_for_device(db, device):
- server_devs = db.get_device_class_list(device.info().server_id)
- for dev_name, klass_name in zip(server_devs[0::2], server_devs[1::2]):
- if klass_name == "Pool":
- return Device(dev_name)
-
-
-class PoolElement(BaseElement, TangoDevice):
- """Base class for a Pool element device."""
-
- def __init__(self, name, **kwargs):
- """PoolElement initialization."""
- self._reserved = None
- self._evt_wait = None
- self.__go_start_time = 0
- self.__go_end_time = 0
- self.__go_time = 0
- self._total_go_time = 0
- self.call__init__(TangoDevice, name, **kwargs)
-
- # dict<string, TangoAttributeEG>
- # key : the attribute name
- # value : the corresponding TangoAttributeEG
- self._attrEG = CaselessDict()
-
- # force the creation of a state attribute
- self.getStateEG()
-
- def _find_pool_data(self):
- pool = get_pool_for_device(self.getParentObj(), self.getHWObj())
- return pool.getElementInfo(self.getFullName())._data
-
- def cleanUp(self):
- TangoDevice.cleanUp(self)
- self._reserved = None
- f = self.factory()
-
- attr_map = self._attrEG
- for attr_name in attr_map.keys():
- attrEG = attr_map.pop(attr_name)
- attr = attrEG.getAttribute()
- attrEG = None
- f.removeExistingAttribute(attr)
-
- def reserve(self, obj):
- if obj is None:
- self._reserved = None
- return
- self._reserved = weakref.ref(obj, self._unreserveCB)
-
- def _unreserveCB(self, obj):
- self.unreserve()
-
- def unreserve(self):
- self._reserved = None
-
- def isReserved(self, obj=None):
- if obj is None:
- return self._reserved is not None
- else:
- o = self._reserved()
- return o == obj
-
- def getReservedWR(self):
- return self._reserved
-
- def getReserved(self):
- if self._reserved is None: return None
- return self._reserved()
-
- def dump_attributes(self):
- attr_names = self.get_attribute_list()
- req_id = self.read_attributes_asynch(attr_names)
- return self.read_attributes_reply(req_id, 2000)
-
- def _getAttrValue(self, name, force=False):
- attrEG = self._getAttrEG(name)
- if attrEG is None: return None
- return attrEG.readValue(force=force)
-
- def _getAttrEG(self, name):
- attrEG = self.getAttrEG(name)
- if attrEG is None:
- attrEG = self._createAttribute(name)
- return attrEG
-
- def _createAttribute(self, name):
- attrObj = self.getAttribute(name)
- if attrObj is None:
- self.warning("Unable to create attribute %s" % name)
- return None, None
- attrEG = TangoAttributeEG(attrObj)
- self._attrEG[name] = attrEG
- return attrEG
-
- def _getEventWait(self):
- if self._evt_wait is None:
- # create an object that waits for attribute events.
- # each time we use it we have to connect and disconnect to an attribute
- self._evt_wait = AttributeEventWait()
- return self._evt_wait
-
- def _clearEventWait(self):
- self._evt_wait = None
-
- def getStateEG(self):
- return self._getAttrEG('state')
-
- def getControllerName(self):
- return self.getControllerObj().name
-
- def getControllerObj(self):
- full_ctrl_name = self.getPoolData()['controller']
- return self.getPoolObj().getObj(full_ctrl_name, "Controller")
-
- def getAxis(self):
- return self.getPoolData()['axis']
-
- def getType(self):
- return self.getPoolData()['type']
-
- def getPoolObj(self):
- return self._pool_obj
-
- def waitReady(self, timeout=None):
- return self.getStateEG().waitEvent(Moving, equal=False, timeout=timeout)
-
- def getAttrEG(self, name):
- """Returns the TangoAttributeEG object"""
- return self._attrEG.get(name)
-
- def getAttrObj(self, name):
- """Returns the taurus.core.tangoattribute.TangoAttribute object"""
- attrEG = self._attrEG.get(name)
- if attrEG is None:
- return None
- return attrEG.getAttribute()
-
- def getInstrumentObj(self):
- return self._getAttrEG('instrument')
-
- def getInstrumentName(self, force=False):
- instr_name = self._getAttrValue('instrument', force=force)
- if not instr_name: return ''
- #instr_name = instr_name[:instr_name.index('(')]
- return instr_name
-
- def getInstrument(self):
- instr_name = self.getInstrumentName()
- if not instr_name: return None
- return self.getPoolObj().getObj("Instrument", instr_name)
-
- @reservedOperation
- def start(self, *args, **kwargs):
- evt_wait = self._getEventWait()
- evt_wait.connect(self.getAttribute("state"))
- evt_wait.lock()
- try:
- evt_wait.waitEvent(DevState.MOVING, equal=False)
- self.__go_time = 0
- self.__go_start_time = ts1 = time.time()
- self._start(*args, **kwargs)
- ts2 = time.time()
- evt_wait.waitEvent(DevState.MOVING, after=ts1)
- except:
- evt_wait.disconnect()
- raise
- finally:
- evt_wait.unlock()
- ts2 = evt_wait.getRecordedEvents().get(DevState.MOVING, ts2)
- return (ts2,)
-
- @reservedOperation
- def waitFinish(self, timeout=None, id=None):
- if id is not None:
- id = id[0]
- evt_wait = self._getEventWait()
- evt_wait.lock()
- try:
- evt_wait.waitEvent(DevState.MOVING, after=id, equal=False,
- timeout=timeout)
- finally:
- self.__go_end_time = time.time()
- self.__go_time = self.__go_end_time - self.__go_start_time
- evt_wait.unlock()
- evt_wait.disconnect()
-
- @reservedOperation
- def go(self, *args, **kwargs):
- self._total_go_time = 0
- start_time = time.time()
- eid = self.start(*args, **kwargs)
- self.waitFinish(id=eid)
- self._total_go_time = time.time() - start_time
-
- def getLastGoTime(self):
- """Returns the time it took for last go operation"""
- return self.__go_time
-
- def getTotalLastGoTime(self):
- """Returns the time it took for last go operation, including dead time
- to prepare, wait for events, etc"""
- return self._total_go_time
-
- def abort(self, wait_ready=True, timeout=None):
- state = self.getStateEG()
- state.lock()
- try:
- self.command_inout("Abort")
- if wait_ready:
- self.waitReady(timeout=timeout)
- finally:
- state.unlock()
-
- def stop(self, wait_ready=True, timeout=None):
- state = self.getStateEG()
- state.lock()
- try:
- self.command_inout("Stop")
- if wait_ready:
- self.waitReady(timeout=timeout)
- finally:
- state.unlock()
-
- def information(self, tab=' '):
- msg = self._information(tab=tab)
- return "\n".join(msg)
-
- def _information(self, tab=' '):
- indent = "\n" + tab + 10 * ' '
- msg = [ self.getName() + ":" ]
- try:
- state = str(self.state()).capitalize()
- except DevFailed, df:
- if len(df.args):
- state = df.args[0].desc
- else:
- e_info = sys.exc_info()[:2]
- state = traceback.format_exception_only(*e_info)
- except:
- e_info = sys.exc_info()[:2]
- state = traceback.format_exception_only(*e_info)
- msg.append(tab + " State: " + state)
-
- try:
- e_info = sys.exc_info()[:2]
- status = self.status()
- status = status.replace('\n', indent)
- except DevFailed, df:
- if len(df.args):
- status = df.args[0].desc
- else:
- e_info = sys.exc_info()[:2]
- status = traceback.format_exception_only(*e_info)
- except:
- e_info = sys.exc_info()[:2]
- status = traceback.format_exception_only(*e_info)
- msg.append(tab + " Status: " + status)
-
- return msg
-
-
-class Controller(PoolElement):
- """ Class encapsulating Controller functionality."""
-
- def __init__(self, name, **kw):
- """PoolElement initialization."""
- self.call__init__(PoolElement, name, **kw)
-
- def getModuleName(self):
- return self.getPoolData()['module']
-
- def getClassName(self):
- return self.getPoolData()['klass']
-
- def getTypes(self):
- return self.getPoolData()['types']
-
- def getMainType(self):
- return self.getPoolData()['main_type']
-
- def addElement(self, elem):
- axis = elem.getAxis()
- self._elems[axis] = elem
- self._last_axis = max(self._last_axis, axis)
-
- def removeElement(self, elem):
- axis = elem.getAxis()
- del self._elems[elem.getAxis()]
- if axis == self._last_axis:
- self._last_axis = max(self._elems)
-
- def getElementByAxis(self, axis):
- pool = self.getPoolObj()
- for _, elem in pool.getElementsOfType(self.getMainType()).items():
- if elem.controller != self.getName() or elem.getAxis() != axis:
- continue
- return elem
-
- def getElementByName(self, name):
- pool = self.getPoolObj()
- for name, elem in pool.getElementsOfType(self.getMainType()).items():
- if elem.controller != self.getName() or elem.getName() != name:
- continue
- return elem
-
- def getUsedAxis(self):
- pool = self.getPoolObj()
- axis = []
- for _, elem in pool.getElementsOfType(self.getMainType()).items():
- if elem.controller != self.getName():
- continue
- axis.append(elem.getAxis())
- return sorted(axis)
-
- def getLastUsedAxis(self):
- return max([1] + self.getUsedAxis())
-
- def __cmp__(self, o):
- return cmp(self.getName(), o.getName())
-
-
-class ComChannel(PoolElement):
- """ Class encapsulating CommunicationChannel functionality."""
- pass
-
-
-class ExpChannel(PoolElement):
- """ Class encapsulating ExpChannel functionality."""
- pass
-
-
-class CTExpChannel(ExpChannel):
- """ Class encapsulating CTExpChannel functionality."""
- pass
-
-
-class ZeroDExpChannel(ExpChannel):
- """ Class encapsulating ZeroDExpChannel functionality."""
- pass
-
-
-class OneDExpChannel(ExpChannel):
- """ Class encapsulating OneDExpChannel functionality."""
- pass
-
-
-class TwoDExpChannel(ExpChannel):
- """ Class encapsulating TwoDExpChannel functionality."""
- pass
-
-
-class PseudoCounter(ExpChannel):
- """ Class encapsulating PseudoCounter functionality."""
- pass
-
-
-class Motor(PoolElement, Moveable):
- """ Class encapsulating Motor functionality."""
-
- def __init__(self, name, **kw):
- """PoolElement initialization."""
- self.call__init__(PoolElement, name, **kw)
- self.call__init__(Moveable)
-
- def getPosition(self, force=False):
- return self._getAttrValue('position', force=force)
-
- def getDialPosition(self, force=False):
- return self._getAttrValue('dialposition', force=force)
-
- def getVelocity(self, force=False):
- return self._getAttrValue('velocity', force=force)
-
- def getAcceleration(self, force=False):
- return self._getAttrValue('acceleration', force=force)
-
- def getDeceleration(self, force=False):
- return self._getAttrValue('deceleration', force=force)
-
- def getBaseRate(self, force=False):
- return self._getAttrValue('base_rate', force=force)
-
- def getBacklash(self, force=False):
- return self._getAttrValue('backlash', force=force)
-
- def getLimitSwitches(self, force=False):
- return self._getAttrValue('limit_switches', force=force)
-
- def getOffset(self, force=False):
- return self._getAttrValue('offset', force=force)
-
- def getStepPerUnit(self, force=False):
- return self._getAttrValue('step_per_unit', force=force)
-
- def getSign(self, force=False):
- return self._getAttrValue('Sign', force=force)
-
- def getSimulationMode(self, force=False):
- return self._getAttrValue('SimulationMode', force=force)
-
- def getPositionObj(self):
- return self._getAttrEG('position')
-
- def getDialPositionObj(self):
- return self._getAttrEG('dialposition')
-
- def getVelocityObj(self):
- return self._getAttrEG('velocity')
-
- def getAccelerationObj(self):
- return self._getAttrEG('acceleration')
-
- def getDecelerationObj(self):
- return self._getAttrEG('deceleration')
-
- def getBaseRateObj(self):
- return self._getAttrEG('base_rate')
-
- def getBacklashObj(self):
- return self._getAttrEG('backlash')
-
- def getLimitSwitchesObj(self):
- return self._getAttrEG('limit_switches')
-
- def getOffsetObj(self):
- return self._getAttrEG('offset')
-
- def getStepPerUnitObj(self):
- return self._getAttrEG('step_per_unit')
-
- def getSimulationModeObj(self):
- return self._getAttrEG('step_per_unit')
-
- def setVelocity(self, value):
- return self.getVelocityObj().write(value)
-
- def setAcceleration(self, value):
- return self.getAccelerationObj().write(value)
-
- def setDeceleration(self, value):
- return self.getDecelerationObj().write(value)
-
- def setBaseRate(self, value):
- return self.getBaseRateObj().write(value)
-
- def setBacklash(self, value):
- return self.getBacklashObj().write(value)
-
- def setOffset(self, value):
- return self.getOffsetObj().write(value)
-
- def setStepPerUnit(self, value):
- return self.getStepPerUnitObj().write(value)
-
- def setSign(self, value):
- return self.getSignObj().write(value)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Moveable interface
- #
-
- def _start(self, *args, **kwargs):
- new_pos = args[0]
- if operator.isSequenceType(new_pos):
- new_pos = new_pos[0]
- try:
- self.write_attribute('position', new_pos)
- except DevFailed, df:
- for err in df:
- if err.reason == 'API_AttrNotAllowed':
- raise RuntimeError('%s is already moving' % self)
- else:
- raise
- self.final_pos = new_pos
-
- def go(self, *args, **kwargs):
- start_time = time.time()
- PoolElement.go(self, *args, **kwargs)
- ret = self.getStateEG().readValue(), self.readPosition()
- self._total_go_time = time.time() - start_time
- return ret
-
- startMove = PoolElement.start
- waitMove = PoolElement.waitFinish
- move = go
- getLastMotionTime = PoolElement.getLastGoTime
- getTotalLastMotionTime = PoolElement.getTotalLastGoTime
-
- @reservedOperation
- def iterMove(self, new_pos, timeout=None):
- if operator.isSequenceType(new_pos):
- new_pos = new_pos[0]
- state, pos = self.getAttribute("state"), self.getAttribute("position")
-
- evt_wait = self._getEventWait()
- evt_wait.connect(state)
- evt_wait.lock()
- try:
- #evt_wait.waitEvent(DevState.MOVING, equal=False)
- time_stamp = time.time()
- try:
- self.getPositionObj().write(new_pos)
- except DevFailed, err_traceback:
- for err in err_traceback:
- if err.reason == 'API_AttrNotAllowed':
- raise RuntimeError, '%s is already moving' % self
- else:
- raise
- self.final_pos = new_pos
- # putting timeout=0.1 and retries=1 is a patch for the case the when the initial
- # moving event doesn't arrive do to an unknow tango/pytango error at the time
- evt_wait.waitEvent(DevState.MOVING, time_stamp, timeout=0.1, retries=1)
- finally:
- evt_wait.unlock()
- evt_wait.disconnect()
-
- evt_iter_wait = AttributeEventIterator(state, pos)
- evt_iter_wait.lock()
- try:
- for evt_data in evt_iter_wait.events():
- src, value = evt_data
- if src == state and value != DevState.MOVING:
- raise StopIteration
- yield value
- finally:
- evt_iter_wait.unlock()
- evt_iter_wait.disconnect()
-
- def readPosition(self, force=False):
- return [ self.getPosition(force=force) ]
-
- def getMoveableSource(self):
- return self.getPoolObj()
-
- def getSize(self):
- return 1
-
- def getIndex(self, name):
- if name.lower() == self.getName().lower():
- return 0
- return -1
- #
- # End of Moveable interface
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def _information(self, tab=' '):
- msg = PoolElement._information(self, tab=tab)
- try:
- position = self.read_attribute("position")
- pos = str(position.value)
- if position.quality != AttrQuality.ATTR_VALID:
- pos += " [" + QUALITY[position.quality] + "]"
- except DevFailed, df:
- if len(df.args):
- pos = df.args[0].desc
- else:
- e_info = sys.exc_info()[:2]
- pos = traceback.format_exception_only(*e_info)
- except:
- e_info = sys.exc_info()[:2]
- pos = traceback.format_exception_only(*e_info)
-
- msg.append(tab + "Position: " + str(pos))
- return msg
-
-
-class PseudoMotor(PoolElement, Moveable):
- """ Class encapsulating PseudoMotor functionality."""
-
- def __init__(self, name, **kw):
- """PoolElement initialization."""
- self.call__init__(PoolElement, name, **kw)
- self.call__init__(Moveable)
-
- def getPosition(self, force=False):
- return self._getAttrValue('position', force=force)
-
- def getDialPosition(self, force=False):
- return self.getPosition(force=force)
-
- def getPositionObj(self):
- return self._getAttrEG('position')
-
- def getDialPositionObj(self):
- return self.getPositionObj()
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Moveable interface
- #
-
- def _start(self, *args, **kwargs):
- new_pos = args[0]
- if operator.isSequenceType(new_pos):
- new_pos = new_pos[0]
- try:
- self.write_attribute('position', new_pos)
- except DevFailed, df:
- for err in df:
- if err.reason == 'API_AttrNotAllowed':
- raise RuntimeError('%s is already moving' % self)
- else:
- raise
- self.final_pos = new_pos
-
- def go(self, *args, **kwargs):
- start_time = time.time()
- PoolElement.go(self, *args, **kwargs)
- ret = self.getStateEG().readValue(), self.readPosition()
- self._total_go_time = time.time() - start_time
- return ret
-
- startMove = PoolElement.start
- waitMove = PoolElement.waitFinish
- move = go
- getLastMotionTime = PoolElement.getLastGoTime
- getTotalLastMotionTime = PoolElement.getTotalLastGoTime
-
- def readPosition(self, force=False):
- return [ self.getPosition(force=force) ]
-
- def getMoveableSource(self):
- return self.getPoolObj()
-
- def getSize(self):
- return 1
-
- def getIndex(self, name):
- if name.lower() == self.getName().lower():
- return 0
- return -1
- #
- # End of Moveable interface
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def _information(self, tab=' '):
- msg = PoolElement._information(self, tab=tab)
- try:
- position = self.read_attribute("position")
- pos = str(position.value)
- if position.quality != AttrQuality.ATTR_VALID:
- pos += " [" + QUALITY[position.quality] + "]"
- except DevFailed, df:
- if len(df.args):
- pos = df.args[0].desc
- else:
- e_info = sys.exc_info()[:2]
- pos = traceback.format_exception_only(*e_info)
- except:
- e_info = sys.exc_info()[:2]
- pos = traceback.format_exception_only(*e_info)
-
- msg.append(tab + "Position: " + str(pos))
- return msg
-
-
-class MotorGroup(PoolElement, Moveable):
- """ Class encapsulating MotorGroup functionality."""
-
- def __init__(self, name, **kw):
- """PoolElement initialization."""
- self.call__init__(PoolElement, name, **kw)
- self.call__init__(Moveable)
-
- def _create_str_tuple(self):
- return 3 * ["TODO"]
-
- def getMotorNames(self):
- return self.getPoolData()['elements']
-
- def hasMotor(self, name):
- motor_names = map(str.lower, self.getMotorNames())
- return name.lower() in motor_names
-
- def getPosition(self, force=False):
- return self._getAttrValue('position', force=force)
-
- def getPositionObj(self):
- return self._getAttrEG('position')
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Moveable interface
- #
-
- def _start(self, *args, **kwargs):
- new_pos = args[0]
- try:
- self.write_attribute('position', new_pos)
- except DevFailed, df:
- for err in df:
- if err.reason == 'API_AttrNotAllowed':
- raise RuntimeError('%s is already moving' % self)
- else:
- raise
- self.final_pos = new_pos
-
- def go(self, *args, **kwargs):
- start_time = time.time()
- PoolElement.go(self, *args, **kwargs)
- ret = self.getStateEG().readValue(), self.readPosition()
- self._total_go_time = time.time() - start_time
- return ret
-
- startMove = PoolElement.start
- waitMove = PoolElement.waitFinish
- move = go
- getLastMotionTime = PoolElement.getLastGoTime
- getTotalLastMotionTime = PoolElement.getTotalLastGoTime
-
- def readPosition(self, force=False):
- return self.getPosition(force=force)
-
- def getMoveableSource(self):
- return self.getPoolObj()
-
- def getSize(self):
- return len(self.getMotorNames())
-
- def getIndex(self, name):
- try:
- motor_names = map(str.lower, self.getMotorNames())
- return motor_names.index(name.lower())
- except:
- return -1
-
- #
- # End of Moveable interface
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def _information(self, tab=' '):
- msg = PoolElement._information(self, tab=tab)
- try:
- position = self.read_attribute("position")
- pos = str(position.value)
- if position.quality != AttrQuality.ATTR_VALID:
- pos += " [" + QUALITY[position.quality] + "]"
- except DevFailed, df:
- if len(df.args):
- pos = df.args[0].desc
- else:
- e_info = sys.exc_info()[:2]
- pos = traceback.format_exception_only(*e_info)
- except:
- e_info = sys.exc_info()[:2]
- pos = traceback.format_exception_only(*e_info)
-
- msg.append(tab + "Position: " + str(pos))
- return msg
-
-
-class BaseChannelInfo(object):
-
- def __init__(self, data):
- # dict<str, obj>
- # channel data
- self.raw_data = data
- self.__dict__.update(data)
-
-
-class TangoChannelInfo(BaseChannelInfo):
-
- def __init__(self, data, info):
- BaseChannelInfo.__init__(self, data)
- # PyTango.AttributeInfoEx
- self.set_info(info)
-
- def has_info(self):
- return self.raw_info is not None
-
- def set_info(self, info):
- self.raw_info = info
-
- if info is None:
- return
-
- data = self.raw_data
-
- if 'data_type' not in data:
- self.data_type = FROM_TANGO_TO_STR_TYPE[info.data_type]
-
- if 'shape' not in data:
- shape = ()
- if info.data_format == AttrDataFormat.SPECTRUM:
- shape = (info.max_dim_x,)
- elif info.data_format == AttrDataFormat.IMAGE:
- shape = (info.max_dim_x, info.max_dim_y)
- self.shape = shape
- else:
- shape = self.shape
- self.shape = list(shape)
-
- def __getattr__(self, name):
- if self.has_info():
- return getattr(self.raw_info, name)
- cls_name = self.__class__.__name__
- raise AttributeError("'%s' has no attribute '%s'" % (cls_name, name))
-
-
-def getChannelConfigs(mgconfig, ctrls=None, units=None, sort=True):
- '''
- gets a list of channel configurations by flattening the controllers and
- units levels of the given measurement group configuration. It optionally
- filters to those channels matching given lists of controller and unit
- names.
-
- :param ctrls: (seq<str> or None) a sequence of strings to filter the
- controllers. If None given, all controllers will be used
- :param units: (seq<str>) a sequence of strings to filter the units. If
- None given, all controllers will be used
- :param sort: (bool) If True (default) the returned list will be sorted
- according to channel index (if given in channeldata) and
- then by channelname.
-
- :return: (list<tuple>) A list of channelname,channeldata pairs.
- '''
- chconfigs = []
- if not mgconfig: return []
- for ctrl_name, ctrl_data in mgconfig['controllers'].items():
- if ctrls is None or ctrl_name in ctrls:
- for unit_id, unit_data in ctrl_data['units'].items():
- if units is None or unit_id in units:
- for ch_name, ch_data in unit_data['channels'].items():
- ch_data.update({'_controller_name':ctrl_name, '_unit_id':unit_id}) #add controller and unit ids
- chconfigs.append((ch_name, ch_data))
- if sort:
- #sort the channel configs by index (primary sort) and then by channel name.
- chconfigs = sorted(chconfigs, key=lambda c:c[0]) #sort by channel_name
- chconfigs = sorted(chconfigs, key=lambda c:c[1].get('index', 1e16)) #sort by index (give a very large index for those which don't have it)
- return chconfigs
-
-
-class MGConfiguration(object):
-
- def __init__(self, mg, data):
- self._mg = weakref.ref(mg)
- if isinstance(data, (str, unicode)):
- data = CodecFactory().decode(('json', data), ensure_ascii=True)
- self.raw_data = data
- self.__dict__.update(data)
-
- # dict<str, dict>
- # where key is the channel name and value is the channel data in form
- # of a dict as receveid by the MG configuration attribute
- self.channels = channels = CaselessDict()
-
- for _, ctrl_data in self.controllers.items():
- for _, unit_data in ctrl_data['units'].items():
- for channel_name, channel_data in unit_data['channels'].items():
- channels[channel_name] = channel_data
-
- #####################
- #@todo: the for-loops above could be replaced by something like:
- #self.channels = channels = CaselessDict(getChannelConfigs(data,sort=False))
- #####################
-
- # seq<dict> each element is the channel data in form of a dict as
- # receveid by the MG configuration attribute. This seq is just a cache
- # ordered by channel index in the MG.
- self.channel_list = len(channels) * [None]
-
- for channel in channels.values():
- self.channel_list[channel['index']] = channel
-
- # dict<str, list[DeviceProxy, CaselessDict<str, dict>]>
- # where key is a device name and value is a list with two elements:
- # - A device proxy or None if there was an error building it
- # - A dict where keys are attribute names and value is a reference to
- # a dict representing channel data as received in raw data
- self.tango_dev_channels = None
-
- # Number of elements in tango_dev_channels in error (could not build
- # DeviceProxy, probably)
- self.tango_dev_channels_in_error = 0
-
- # dict<str, tuple<str, str, TangoChannelInfo>>
- # where key is a channel name and value is a tuple of three elements:
- # - device name
- # - attribute name
- # - attribute information or None if there was an error trying to get
- # the information
- self.tango_channels_info = None
-
- # Number of elements in tango_channels_info_in_error in error
- # (could not build attribute info, probably)
- self.tango_channels_info_in_error = 0
-
- # dict<str, dict>
- # where key is a channel name and data is a reference to a dict
- # representing channel data as received in raw data
- self.non_tango_channels = None
-
- self.initialized = False
-
- def _build(self):
- # internal channel structure that groups channels by tango device so
- # they can be read as a group minimizing this way the network requests
- self.tango_dev_channels = tg_dev_chs = CaselessDict()
- self.tango_dev_channels_in_error = 0
- self.tango_channels_info = tg_chs_info = CaselessDict()
- self.tango_channels_info_in_error = 0
- self.non_tango_channels = n_tg_chs = CaselessDict()
- self.cache = cache = {}
-
- tg_attr_validator = AttributeNameValidator()
- for channel_name, channel_data in self.channels.items():
- cache[channel_name] = None
- data_source = channel_data['source']
- #external = ctrl_name.startswith("__")
- params = tg_attr_validator.getParams(data_source)
- if params is None:
- # Handle NON tango channel
- n_tg_chs[channel_name] = channel_data
- else:
- # Handle tango channel
- dev_name = params['devicename'].lower()
- attr_name = params['attributename'].lower()
- host, port = params.get('host'), params.get('port')
- if host is not None and port is not None:
- dev_name = "{0}:{1}/{2}".format(host, port, dev_name)
- dev_data = tg_dev_chs.get(dev_name)
-
- if dev_data is None:
- # Build tango device
- dev = None
- try:
- dev = DeviceProxy(dev_name)
- except:
- self.tango_dev_channels_in_error += 1
- tg_dev_chs[dev_name] = dev_data = [ dev, CaselessDict() ]
- dev, attr_data = dev_data
- attr_data[attr_name] = channel_data
-
- # get attribute configuration
- attr_info = None
- if dev is None:
- self.tango_channels_info_in_error += 1
- else:
- try:
- tg_attr_info = dev.get_attribute_config_ex(attr_name)[0]
- except:
- tg_attr_info = \
- self._build_empty_tango_attr_info(channel_data)
- self.tango_channels_info_in_error += 1
- attr_info = TangoChannelInfo(channel_data, tg_attr_info)
-
- tg_chs_info[channel_name] = dev_name, attr_name, attr_info
-
- def _build_empty_tango_attr_info(self, channel_data):
- import PyTango
- ret = PyTango.AttributeInfoEx()
- ret.name = channel_data['name']
- ret.label = channel_data['label']
- return ret
-
- def prepare(self):
- # first time? build everything
- if self.tango_dev_channels is None:
- return self._build()
-
- # prepare missing tango devices
- if self.tango_dev_channels_in_error > 0:
- for dev_name, dev_data in self.tango_dev_channels.items():
- if dev_data[0] is None:
- try:
- dev_data[0] = DeviceProxy(dev_name)
- self.tango_dev_channels_in_error -= 1
- except:
- pass
-
- # prepare missing tango attribute configuration
- if self.tango_channels_info_in_error > 0:
- for _, attr_data in self.tango_channels_info.items():
- dev_name, attr_name, attr_info = attr_data
- if attr_info.has_info():
- continue
- dev = self.tango_dev_channels[dev_name]
- if dev is None:
- continue
- try:
- tg_attr_info = dev.get_attribute_config_ex(attr_name)[0]
- attr_info.set_info(tg_attr_info)
- self.tango_channels_info_in_error -= 1
- except:
- pass
-
- def getChannelInfo(self, channel_name):
- try:
- return self.tango_channels_info[channel_name]
- except:
- channel_name = channel_name.lower()
- for d_name, a_name, ch_info in self.tango_channels_info.values():
- if ch_info.name.lower() == channel_name:
- return d_name, a_name, ch_info
-
- def getChannelsInfo(self):
- self.prepare()
- ret = CaselessDict(self.tango_channels_info)
- ret.update(self.non_tango_channels)
- return ret
-
- def getChannelsInfoList(self):
- channels_info = self.getChannelsInfo()
- ret = len(channels_info) * [None]
- for _, (_, _, ch_info) in channels_info.items():
- ret[ch_info.index] = ch_info
- return ret
-
- def getCountersInfoList(self):
- channels_info = self.getChannelsInfoList()
- timer_name, idx = self.timer, -1
- for i, ch in enumerate(channels_info):
- if ch['full_name'] == timer_name:
- idx = i
- break
- if idx >= 0:
- channels_info.pop(idx)
- return channels_info
-
- def read(self, parallel=True):
- if parallel:
- return self._read_parallel()
- return self._read()
-
- def _read_parallel(self):
- self.prepare()
- ret = CaselessDict(self.cache)
- dev_replies = {}
-
- # deposit read requests
- for _, dev_data in self.tango_dev_channels.items():
- dev, attrs = dev_data
- if dev is None:
- continue
- try:
- dev_replies[dev] = dev.read_attributes_asynch(attrs.keys()), attrs
- except:
- dev_replies[dev] = None, attrs
-
- # gather all replies
- for dev, reply_data in dev_replies.items():
- reply, attrs = reply_data
- try:
- data = dev.read_attributes_reply(reply, 0)
- for data_item in data:
- channel_data = attrs[data_item.name]
- if data_item.has_failed:
- value = None
- else:
- value = data_item.value
- ret[channel_data['full_name']] = value
- except:
- for _, channel_data in attrs.items():
- ret[channel_data['full_name']] = None
-
- return ret
-
- def _read(self):
- self.prepare()
- ret = CaselessDict(self.cache)
- for _, dev_data in self.tango_dev_channels.items():
- dev, attrs = dev_data
- try:
- data = dev.read_attributes(attrs.keys())
- for data_item in data:
- channel_data = attrs[data_item.name]
- if data_item.has_failed:
- value = None
- else:
- value = data_item.value
- ret[channel_data['full_name']] = value
- except:
- for _, channel_data in attrs.items():
- ret[channel_data['full_name']] = None
- return ret
-
-class MeasurementGroup(PoolElement):
- """ Class encapsulating MeasurementGroup functionality."""
-
- def __init__(self, name, **kw):
- """PoolElement initialization."""
- self._configuration = None
- self._channels = None
- self._last_integ_time = None
- self.call__init__(PoolElement, name, **kw)
-
- cfg_attr = self.getAttribute('configuration')
- cfg_attr.addListener(self.on_configuration_changed)
-
- def _create_str_tuple(self):
- return self.getName(), self.getTimerName(), ", ".join(self.getChannelNames())
-
- def getConfigurationAttrEG(self):
- return self._getAttrEG('Configuration')
-
- def setConfiguration(self, configuration):
- codec = CodecFactory().getCodec('json')
- f, data = codec.encode(('', configuration))
- self.write_attribute('configuration', data)
-
- def _setConfiguration(self, data):
- self._configuration = MGConfiguration(self, data)
-
- def getConfiguration(self, force=False):
- if force or self._configuration is None:
- data = self.getConfigurationAttrEG().readValue(force=True)
- self._setConfiguration(data)
- return self._configuration
-
- def on_configuration_changed(self, evt_src, evt_type, evt_value):
- if evt_type not in CHANGE_EVT_TYPES:
- return
- self.info("Configuration changed")
- self._setConfiguration(evt_value.value)
-
- def getTimerName(self):
- return self.getTimer()['name']
-
- def getTimer(self):
- cfg = self.getConfiguration()
- return cfg.channels[cfg.timer]
-
- def getTimerValue(self):
- return self.getTimerName()
-
- def getMonitorName(self):
- return self.getMonitor()['name']
-
- def getMonitor(self):
- cfg = self.getConfiguration()
- return cfg.channels[cfg.monitor]
-
- def setTimer(self, timer_name):
- try:
- self.getChannel(timer_name)
- except KeyError:
- raise Exception("%s does not contain a channel named '%s'"
- % (str(self), timer_name))
- cfg = self.getConfiguration().raw_data
- cfg['timer'] = timer_name
- import json
- self.write_attribute("configuration", json.dumps(cfg))
-
- def getChannels(self):
- return self.getConfiguration().channel_list
-
- def getCounters(self):
- cfg = self.getConfiguration()
- return [ ch for ch in self.getChannels() if ch['full_name'] != cfg.timer ]
-
- def getChannelNames(self):
- return [ ch['name'] for ch in self.getChannels() ]
-
- def getCounterNames(self):
- return [ ch['name'] for ch in self.getCounters() ]
-
- def getChannelLabels(self):
- return [ ch['label'] for ch in self.getChannels() ]
-
- def getCounterLabels(self):
- return [ ch['label'] for ch in self.getCounters() ]
-
- def getChannel(self, name):
- return self.getConfiguration().channels[name]
-
- def getChannelInfo(self, name):
- return self.getConfiguration().getChannelInfo(name)
-
- def getChannelsInfo(self):
- return self.getConfiguration().getChannelsInfoList()
-
- def getCountersInfo(self):
- return self.getConfiguration().getCountersInfoList()
-
- def getValues(self, parallel=True):
- return self.getConfiguration().read(parallel=parallel)
-
- def getIntegrationTime(self):
- return self._getAttrValue('IntegrationTime')
-
- def getIntegrationTimeObj(self):
- return self._getAttrEG('IntegrationTime')
-
- def setIntegrationTime(self, ctime):
- self.getIntegrationTimeObj().write(ctime)
-
- def putIntegrationTime(self, ctime):
- if self._last_integ_time == ctime:
- return
- self._last_integ_time = ctime
- self.getIntegrationTimeObj().write(ctime)
-
- def _start(self, *args, **kwargs):
- self.Start()
-
- def go(self, *args, **kwargs):
- start_time = time.time()
- cfg = self.getConfiguration()
- cfg.prepare()
- duration = args[0]
- if duration is None or duration == 0:
- return self.getStateEG().readValue(), self.getValues()
- self.putIntegrationTime(duration)
- PoolElement.go(self, *args, **kwargs)
- ret = self.getStateEG().readValue(), self.getValues()
- self._total_go_time = time.time() - start_time
- return ret
-
- startCount = PoolElement.start
- waitCount = PoolElement.waitFinish
- count = go
- stopCount = PoolElement.abort
-
-
-class IORegister(PoolElement):
- """ Class encapsulating IORegister functionality."""
-
- def __init__(self, name, **kw):
- """IORegister initialization."""
- self.call__init__(PoolElement, name, **kw)
-
- def getValueObj(self):
- return self._getAttrEG('value')
-
- def readValue(self, force=False):
- return self._getAttrValue('value', force=force)
-
- def startWriteValue(self, new_value, timeout=None):
- try:
- self.getValueObj().write(new_value)
- self.final_val = new_value
- except DevFailed, err_traceback:
- for err in err_traceback:
- if err.reason == 'API_AttrNotAllowed':
- raise RuntimeError, '%s is already chaging' % self
- else:
- raise
-
- def waitWriteValue(self, timeout=None):
- pass
-
- def writeValue(self, new_value, timeout=None):
- self.startWriteValue(new_value, timeout=timeout)
- self.waitWriteValue(timeout=timeout)
- return self.getStateEG().readValue(), self.readValue()
-
- writeIORegister = writeIOR = writeValue
- readIORegister = readIOR = getValue = readValue
-
-
-class Instrument(BaseElement):
-
- def __init__(self, **kw):
- self.__dict__.update(kw)
-
- def getFullName(self):
- return self.full_name
-
- def getParentInstrument(self):
- return self.getPoolObj().getObj(self.parent_instrument)
-
- def getParentInstrumentName(self):
- return self.parent_instrument
-
- def getChildrenInstruments(self):
- raise NotImplementedError
- return self._children
-
- def getElements(self):
- raise NotImplementedError
- return self._elements
-
- def getType(self):
- return self.klass
-
- def getPoolObj(self):
- return self._pool_obj
-
-
-class Pool(TangoDevice, MoveableSource):
- """ Class encapsulating device Pool functionality."""
-
- def __init__(self, name, **kw):
- self.call__init__(TangoDevice, name, **kw)
- self.call__init__(MoveableSource)
-
- self._elements = BaseSardanaElementContainer()
- self.getAttribute("Elements").addListener(self.on_elements_changed)
-
- def getObject(self, element_info):
- elem_type = element_info.getType()
- data = element_info._data
- if elem_type in ('ControllerClass', 'ControllerLibrary', 'Instrument'):
- klass = globals()[elem_type]
- kwargs = dict(data)
- kwargs['_pool_data'] = data
- kwargs['_pool_obj'] = self
- return klass(**kwargs)
- obj = Factory().getDevice(element_info.full_name, _pool_obj=self,
- _pool_data=data)
- return obj
-
- def on_elements_changed(self, evt_src, evt_type, evt_value):
- if evt_type == TaurusEventType.Error:
- msg = evt_value
- if isinstance(msg, DevFailed):
- d = msg[0]
- # skip configuration errors
- if d.reason == "API_BadConfigurationProperty":
- return
- if d.reason in ("API_DeviceNotExported", "API_CantConnectToDevice"):
- msg = "Pool was shutdown or is inacessible"
- else:
- msg = "{0}: {1}".format(d.reason, d.desc)
- self.warning("Received elements error event %s", msg)
- self.debug(evt_value)
- return
- elif evt_type not in CHANGE_EVT_TYPES:
- return
- try:
- elems = CodecFactory().decode(evt_value.value, ensure_ascii=True)
- except:
- self.error("Could not decode element info")
- self.info("value: '%s'", evt_value.value)
- self.debug("Details:", exc_info=1)
- return
- elements = self.getElementsInfo()
- for element_data in elems.get('new', ()):
- element_data['manager'] = self
- element = BaseSardanaElement(**element_data)
- elements.addElement(element)
- for element_data in elems.get('del', ()):
- element = self.getElementInfo(element_data['name'])
- try:
- elements.removeElement(element)
- except:
- self.warning("Failed to remove %s", element_data)
-
- return elems
-
- def getElementsInfo(self):
- return self._elements
-
- def getElements(self):
- return self.getElementsInfo().getElements()
-
- def getElementInfo(self, name):
- return self.getElementsInfo().getElement(name)
-
- def getElementNamesOfType(self, elem_type):
- return self.getElementsInfo().getElementNamesOfType(elem_type)
-
- def getElementsOfType(self, elem_type):
- return self.getElementsInfo().getElementsOfType(elem_type)
-
- def getElementsWithInterface(self, interface):
- return self.getElementsInfo().getElementsWithInterface(interface)
-
- def getElementWithInterface(self, elem_name, interface):
- return self.getElementsInfo().getElementWithInterface(elem_name, interface)
-
- def getObj(self, name, elem_type=None):
- if elem_type is None:
- return self.getElementInfo(name)
- elif isinstance(elem_type, (str, unicode)):
- elem_types = elem_type,
- else:
- elem_types = elem_type
- name = name.lower()
- for e_type in elem_types:
- elems = self.getElementsOfType(e_type)
- for elem in elems.values():
- if elem.name.lower() == name:
- return elem
- elem = elems.get(name)
- if elem is not None:
- return elem
-
- def __repr__(self):
- return self.getNormalName()
-
- def __str__(self):
- return repr(self)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # MoveableSource interface
- #
-
- def getMoveable(self, names):
- """getMoveable(seq<string> names) -> Moveable
-
- Returns a moveable object that handles all the moveable items given in
- names."""
- # if simple motor just return it (if the pool has it)
- if isinstance(names, (str, unicode)):
- names = names,
-
- if len(names) == 1:
- name = names[0]
- return self.getObj(name, elem_type=MOVEABLE_TYPES)
-
- # find a motor group that contains elements
- moveable = self.__findMotorGroupWithElems(names)
-
- # if none exists create one
- if moveable is None:
- mgs = self.getElementsOfType('MotorGroup')
- i = 1
- pid = os.getpid()
- while True:
- name = "_mg_ms_{0}_{1}".format(pid, i)
- exists = False
- for mg in mgs.values():
- if mg.name == name:
- exists = True
- break
- if not exists:
- break
- i += 1
- moveable = self.createMotorGroup(name, names)
- return moveable
-
- def __findMotorGroupWithElems(self, names):
- names_lower = map(str.lower, names)
- len_names = len(names)
- mgs = self.getElementsOfType('MotorGroup')
- for mg in mgs.values():
- mg_elems = mg.elements
- if len(mg_elems) != len_names:
- continue
- for mg_elem, name in zip(mg_elems, names_lower):
- if mg_elem.lower() != name:
- break
- else:
- return mg
-
- #
- # End of MoveableSource interface
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def _wait_for_element_in_container(self, container, elem_name, timeout=0.5,
- contains=True):
- start = time.time()
- cond = True
- nap = 0.01
- if timeout:
- nap = timeout / 10.
- while cond:
- elem = container.getElement(elem_name)
- if contains:
- if elem is not None:
- return elem
- else:
- if elem is None:
- return True
- if timeout:
- dt = time.time() - start
- if dt > timeout:
- self.info("Timed out waiting for '%s' in container",
- elem_name)
- return
- time.sleep(nap)
-
- def createMotorGroup(self, mg_name, elements):
- params = [mg_name, ] + map(str, elements)
- self.debug('trying to create motor group for elements: %s', params)
- self.command_inout('CreateMotorGroup', params)
- elements_info = self.getElementsInfo()
- return self._wait_for_element_in_container(elements_info, mg_name)
-
- def createMeasurementGroup(self, mg_name, elements):
- params = [mg_name, ] + map(str, elements)
- self.debug('trying to create measurement group: %s', params)
- self.command_inout('CreateMeasurementGroup', params)
- elements_info = self.getElementsInfo()
- return self._wait_for_element_in_container(elements_info, mg_name)
-
- def deleteMeasurementGroup(self, name):
- return self.deleteElement(name)
-
- def createElement(self, name, ctrl, axis=None):
- ctrl_type = ctrl.types[0]
- if axis is None:
- axis = str(ctrl.getLastUsedAxis() + 1)
- else:
- axis = str(axis)
- cmd = "CreateElement"
- pars = ctrl_type, ctrl.name, axis, name
- self.command_inout(cmd, pars)
- elements_info = self.getElementsInfo()
- return self._wait_for_element_in_container(elements_info, name)
-
- def deleteElement(self, name):
- self.debug('trying to delete element: %s', name)
- self.command_inout('DeleteElement', name)
- elements_info = self.getElementsInfo()
- return self._wait_for_element_in_container(elements_info, name,
- contains=False)
-
- def createController(self, class_name, name, *props):
- ctrl_class = self.getObj(class_name, elem_type='ControllerClass')
- if ctrl_class is None:
- raise Exception("Controller class %s not found" % class_name)
- cmd = "CreateController"
- pars = [ctrl_class.types[0], ctrl_class.file_name, class_name, name]
- pars.extend(map(str, props))
- self.command_inout(cmd, pars)
- elements_info = self.getElementsInfo()
- return self._wait_for_element_in_container(elements_info, name)
-
- def deleteController(self, name):
- return self.deleteElement(name)
-
-
-def registerExtensions():
- factory = Factory()
- factory.registerDeviceClass("Pool", Pool)
-
- hw_type_names = [
- 'Controller',
- 'ComChannel', 'Motor', 'PseudoMotor',
- 'CTExpChannel', 'ZeroDExpChannel', 'OneDExpChannel', 'TwoDExpChannel',
- 'PseudoCounter', 'IORegister', 'MotorGroup', 'MeasurementGroup']
-
- hw_type_map = [ (name, globals()[name]) for name in hw_type_names ]
-
- for klass_name, klass in hw_type_map:
- factory.registerDeviceClass(klass_name, klass)
-
-def unregisterExtensions():
- factory = Factory()
- factory.unregisterDeviceClass("Pool")
-
- hw_type_names = [
- 'Controller',
- 'ComChannel', 'Motor', 'PseudoMotor',
- 'CTExpChannel', 'ZeroDExpChannel', 'OneDExpChannel', 'TwoDExpChannel',
- 'PseudoCounter', 'IORegister', 'MotorGroup', 'MeasurementGroup']
-
- for klass_name in hw_type_names:
- factory.unregisterDeviceClass(klass_name)
diff --git a/src/sardana/taurus/core/tango/sardana/sardana.py b/src/sardana/taurus/core/tango/sardana/sardana.py
deleted file mode 100644
index 7c245771..00000000
--- a/src/sardana/taurus/core/tango/sardana/sardana.py
+++ /dev/null
@@ -1,713 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""The sardana submodule. It contains specific part of sardana"""
-
-__all__ = ["BaseSardanaElement", "BaseSardanaElementContainer",
- "Pool", "MacroServer", "Door", "Sardana", "SardanaManager",
- "PoolElementType", "ControllerClassInfo", "ControllerInfo",
- "ChannelView", "PlotType", "Normalization", "AcqTriggerType",
- "AcqMode"]
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-__docformat__ = 'restructuredtext'
-
-import PyTango
-
-from taurus.core.util.enumeration import Enumeration
-from taurus.core.util.log import Logger
-from taurus.core.util.singleton import Singleton
-from taurus.core.util.containers import CaselessDict
-from taurus.core.util.codecs import CodecFactory
-
-PoolElementType = Enumeration("PoolElementType",
- ("0D", "1D", "2D", "Communication", "CounterTimer", "IORegister",
- "Motor", "PseudoCounter", "PseudoMotor"))
-
-ChannelView = Enumeration("ChannelView",
- ("Channel", "Enabled", "Output", "PlotType", "PlotAxes", "Timer",
- "Monitor", "Trigger", "Conditioning", "Normalization", "NXPath",
- "Shape", "DataType",
- "Unknown"))
-
-PlotType = Enumeration("PlotType", ("No", "Spectrum", "Image"))
-
-Normalization = Enumeration("Normalization", ("No", "Avg", "Integ"))
-
-#: an enumeration describing all possible acquisition trigger types
-AcqTriggerType = Enumeration("AcqTriggerType", (\
- "Software", # channel triggered by software - start and stop by software
- "Gate", # channel triggered by HW - start and stop by external
- "Unknown"))
-
-#: an enumeration describing all possible acquisition mode types
-AcqMode = Enumeration("AcqMode", (\
- "Timer",
- "Monitor",
- "Unknown"))
-
-
-class BaseSardanaElement(object):
- """Generic sardana element"""
-
- def __init__(self, *args, **kwargs):
- self._manager = kwargs.pop('manager')
- self.__dict__.update(kwargs)
- self._data = kwargs
- self._object = None
-
- def __repr__(self):
- return "{0}({1})".format(self.type, self.full_name)
-
- def __str__(self):
- return self.name
-
- def __getattr__(self, name):
- return getattr(self.getObj(), name)
-
- def __cmp__(self, elem):
- return cmp(self.name, elem.name)
-
- def getData(self):
- return self._data
-
- def getName(self):
- return self.name
-
- def getId(self):
- return self.full_name
-
- def getType(self):
- return self.getTypes()[0]
-
- def getTypes(self):
- elem_types = self.type
- if isinstance(elem_types, (str, unicode)):
- return [elem_types]
- return elem_types
-
- def serialize(self, *args, **kwargs):
- kwargs.update(self._data)
- return kwargs
-
- def str(self, *args, **kwargs):
- #TODO change and check which is the active protocol to serialize
- #acordingly
- return CodecFactory().encode(('json', self.serialize(*args, **kwargs)))
-
- def getObj(self):
- obj = self._object
- if obj is None:
- self._object = obj = self._manager.getObject(self)
- return obj
-
-
-
-class BaseSardanaElementContainer:
-
- def __init__(self):
- # dict<str, dict> where key is the type and value is:
- # dict<str, MacroServerElement> where key is the element full name
- # and value is the Element object
- self._type_elems_dict = CaselessDict()
-
- # dict<str, container> where key is the interface and value is the set
- # of elements which implement that interface
- self._interfaces_dict = {}
-
- def addElement(self, elem):
- elem_type = elem.getType()
- elem_full_name = elem.full_name
-
- #update type_elems
- type_elems = self._type_elems_dict.get(elem_type)
- if type_elems is None:
- self._type_elems_dict[elem_type] = type_elems = CaselessDict()
- type_elems[elem_full_name] = elem
-
- # update interfaces
- for interface in elem.interfaces:
- interface_elems = self._interfaces_dict.get(interface)
- if interface_elems is None:
- self._interfaces_dict[interface] = interface_elems = CaselessDict()
- interface_elems[elem_full_name] = elem
-
- def removeElement(self, e):
- elem_type = e.getType()
-
- # update type_elems
- type_elems = self._type_elems_dict.get(elem_type)
- if type_elems:
- del type_elems[e.full_name]
-
- # update interfaces
- for interface in e.interfaces:
- interface_elems = self._interfaces_dict.get(interface)
- del interface_elems[e.full_name]
-
- def removeElementsOfType(self, t):
- for elem in self.getElementsOfType(t):
- self.removeElement(elem)
-
- def getElementsOfType(self, t):
- elems = self._type_elems_dict.get(t, {})
- return elems
-
- def getElementNamesOfType(self, t):
- return [e.name for e in self.getElementsOfType(t).values()]
-
- def getElementsWithInterface(self, interface):
- elems = self._interfaces_dict.get(interface, {})
- return elems
-
- def getElementsWithInterfaces(self, interfaces):
- ret = CaselessDict()
- for interface in interfaces:
- ret.update(self.getElementsWithInterface(interface))
- return ret
-
- def getElementNamesWithInterface(self, interface):
- return [e.name for e in self.getElementsWithInterface(interface).values()]
-
- def hasElementName(self, elem_name):
- return self.getElement(elem_name) != None
-
- def getElement(self, elem_name):
- elem_name = elem_name.lower()
- for elems in self._type_elems_dict.values():
- elem = elems.get(elem_name) # full_name?
- if elem is not None:
- return elem
- for elem in elems.values():
- if elem.name.lower() == elem_name:
- return elem
-
- def getElementWithInterface(self, elem_name, interface):
- elem_name = elem_name.lower()
- elems = self._interfaces_dict.get(interface, {})
- if elem_name in elems:
- return elems[elem_name]
- for elem in elems.values():
- if elem.name.lower() == elem_name:
- return elem
-
- def getElements(self):
- ret = set()
- for elems in self._type_elems_dict.values():
- ret.update(elems.values())
- return ret
-
- def getInterfaces(self):
- return self._interfaces_dict
-
- def getTypes(self):
- return self._type_elems_dict
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class PropertyInfo():
- def __init__(self, name, type, format, default_value=None):
- self._name = name
- self._type = type
- self._format = format
- self._default_value = default_value
-
- def get_name(self):
- return self._name
-
- def get_type(self):
- return self._type
-
- def get_format(self):
- return self._format
-
- def get_default_value(self):
- return self._default_value
-
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class ControllerClassInfo(object):
-
- def __init__(self, name, type, library):
- self._name = name
- self._type = type
- self._library = library
-
- def get_max_elements(self):
- return 20
-
- def get_name(self):
- return self._name
-
- def get_model(self):
- # fake data ###############
- return "Model of " + self._name
-
- def get_icon(self):
- # fake data ###############
- import taurus.qt.qtgui.resource
-
- return taurus.qt.qtgui.resource.getIcon(":/designer/extra_motor.png")
-
- def get_organization(self):
- # fake data ###############
- return "Organization of " + self._name
-
- def get_description(self):
- #fake data############
- descr = "This is description of "
- for i in range(20):
- descr = descr + " and " + self._name
- ####################
- return descr
-
- def get_family(self):
- # fake data ###############
- return "Family of " + self._name
-
- def get_properties(self):
- properties = []
- # fake data ######################
- properties.append(PropertyInfo("my parameter", "string", "0D", "deviceName"))
- properties.append(PropertyInfo("asdsadasd", "integer", "0D", 5))
- properties.append(PropertyInfo("boollll0", "boolean", "0D", False))
- properties.append(PropertyInfo("boollll0", "boolean", "0D", True))
- properties.append(PropertyInfo("boollll0", "boolean", "0D", False))
- properties.append(PropertyInfo("number1", "float", "0D", 3.5))
- properties.append(PropertyInfo("string2", "string", "0D", "hehe"))
- properties.append(PropertyInfo("tableIntegerD1", "integer", "1D", [1, 2, 3]))
- properties.append(PropertyInfo("tablestringD1", "string", "1D", ["aaaa", "bbb", "ccc"]))
- properties.append(PropertyInfo("tablefloatD1", "float", "1D", [1.0, 2.5, 3.6]))
- properties.append(PropertyInfo("tablebooleanD1", "boolean", "1D", [True, False, True, False]))
- properties.append(PropertyInfo("tablebleintegerD1", "integer", "1D", [1, 2, 3]))
- properties.append(PropertyInfo("tablebooleanD2", "boolean", "2D", [ [True, False, True], [True, True, True], [False, False, False] ]))
- properties.append(PropertyInfo("tableinteger2", "integer", "2D", [ [1, 2, 3], [11, 22, 33], [-10, -20, -30] ]))
- properties.append(PropertyInfo("tablefloatD2", "float", "2D", [ [0.5, 0.6, 0.8], [0.4, 0.0, 0.333333], [-0.1111, 1, 123123.6] ]))
- properties.append(PropertyInfo("tablestringD2", "string", "2D", [ ["aaaa", "bbb", "ccc"], ["aaaa2", "bbb2", "ccc2"], ["aaaa3", "bbb3", "ccc3"] ]))
-
- return properties
-
- def get_controller_type(self):
- return self._type
-
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class ControllerInfo(object):
-
- def __init__(self, name, ctrl_class_info):
- self._name = name
- self._ctrl_class_info = ctrl_class_info
-
- def get_controller_class_info(self):
- return self._ctrl_class_info
-
- def get_controller_type(self):
- return self._ctrl_class_info.get_controller_type()
-
- def get_name(self):
- return self._name
-
- def get_max_elements(self):
- return self._ctrl_class_info.get_max_elements()
-
- def is_axis_free(self, axis):
- #fake data
- if axis == 3:
- return False
- else:
- return True
-
- def is_name_free(self, name):
- #fake data
- if name == "asd":
- return False
- else:
- return True
-
- def get_icon(self):
- return self._ctrl_class_info.get_icon()
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class Pool(object):
-
- def __init__(self, sardana, name, poolpath, version, alias=None, device_name=None):
- self._sardana = sardana
- self._name = name
- self._poolpath = poolpath
- self._version = version
- self._alias = alias
- self._device_name = device_name
-
- def starter_run(self, host, level=1):
- return True
-
- def get_name(self):
- return self._name
-
- def local_run(self):
- return True
-
- def get_element_types(self):
- return sorted(PoolElementType.keys())
-
- def get_controller_class_infos(self):
- #fake data ########################
- data = []
- for i in range(5):
- data.append(ControllerClassInfo("motorController" + str(i), PoolElementType.Motor, None))
- for i in range(5):
- data.append(ControllerClassInfo("counterTimerController" + str(i), PoolElementType.CounterTimer, None))
-
- return data
-
- def get_controller_infos(self):
- ctrl_classes = self.get_controller_class_infos()
- data = []
- for i in range(2):
- data.append(ControllerInfo("My_motor_ctrl_" + str(i), ctrl_classes[i]))
- for i in range(2):
- data.append(ControllerInfo("My_ct_ctrl_" + str(i), ctrl_classes[i + 5]))
- return data
-
- def create_controller(self, controller_class_info, name, properties):
- pass
-
- def create_element(self, controller_name, name, axis):
- pass
-
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class MacroServer(object):
-
- def __init__(self, sardana, name, macropath, pool_names, version, alias=None, device_name=None):
- self._sardana = sardana
- self._name = name
- self._macropath = macropath
- self._pool_names = pool_names
- self._version = version
- self._alias = alias
- self._device_name = device_name
- self._doors = []
-
- def create_door(self, alias, device_name):
- try:
- return self._create_door(alias, device_name)
- except:
- db = self.get_database()
- db.delete_device(device_name)
- raise
-
- def _create_door(self, alias, device_name):
- db = self.get_database()
- info = PyTango.DbDevInfo()
- info.name = device_name
- info._class = "Door"
- info.server = "MacroServer/" + self._name
- db.add_device(info)
- if alias:
- db.put_device_alias(device_name, alias)
- door = Door(alias=alias, device_name=device_name)
- self._doors.append(door)
- return door
-
- def remove_door(self, device_name):
- pass
-
- def starter_run(self, host, level=1):
- return True
-
- def local_run(self):
- return True
-
- def get_database(self):
- return self._sardana.get_database()
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class Door(object):
-
- def __init__(self, alias=None, device_name=None):
- self._name = alias
- self._device_name = device_name
-
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class Sardana(object):
-
- def __init__(self, sardana_db , name, device_name=None):
- self._sardana_db = sardana_db
- self._name = name
- self._device_name = device_name
- self._pools = []
- self._macroservers = []
- self._init()
-
- def _init(self):
- if not self._device_name:
- return
- self._pools = []
- self._macroservers = []
- dev_name = self._device_name
- db = self.get_database()
- cache = db.cache()
- dev_info = cache.devices()[dev_name]
- dev_class_name = dev_info.klass().name()
- if dev_class_name == "Pool":
- pass
- elif dev_class_name == "MacroServer":
- ms_dev_name = dev_name
- ms_prop_list = map(str.lower, db.get_device_property_list(ms_dev_name, "*"))
- ms_props = db.get_device_property(ms_dev_name, ms_prop_list)
- ms_name = dev_info.server().serverInstance()
- ms_alias = dev_info.alias()
- ms = MacroServer(self, ms_name, ms_props.get("macropath"), ms_props.get("poolnames"),
- ms_props.get("version"), ms_alias, ms_dev_name)
- self._macroservers.append(ms)
- for pool_dev_name in ms_props.get("poolnames", ()):
- pool_prop_list = map(str.lower, db.get_device_property_list(pool_dev_name, "*"))
- pool_props = db.get_device_property(pool_dev_name, pool_prop_list)
- pool_dev_info = cache.devices()[pool_dev_name]
- pool_name = pool_dev_info.server().serverInstance()
- pool_alias = pool_dev_info.alias()
- pool = Pool(self, pool_name, pool_props.get("poolpath"), pool_props.get("version"), pool_alias, pool_dev_name)
- self._pools.append(pool)
-
- def get_name(self):
- return self._name
-
- def set_device_name(self, device_name):
- self._device_name = device_name
- self._init()
-
- def get_device_name(self):
- return self._device_name
-
- def get_pools(self):
- return self._pools
-
- def get_macro_servers(self):
- return self._macro_servers
-
- def create_pool(self, name, poolpath, version, alias=None, device_name=None):
- try:
- return self._create_pool(name, poolpath, version, alias=alias, device_name=device_name)
- except:
- db = self.get_database()
- db.delete_device(device_name)
- raise
-
- def _create_pool(self, name, poolpath, version, alias=None, device_name=None):
- db = self.get_database()
- info = PyTango.DbDevInfo()
- info.name = device_name
- info._class = "Pool"
- info.server = "Pool/" + name
- db.add_device(info)
- if alias:
- db.put_device_alias(device_name, alias)
-
- db.put_device_property(device_name, {"PoolPath" : poolpath, "Version": version})
- pool = Pool(self, name, poolpath, version, alias=alias, device_name=device_name)
- self._pools.append(pool)
- db.cache().refresh()
- return pool
-
- def create_macroserver(self, name, macropath, pool_names, version, alias=None, device_name=None):
- try:
- return self._create_macroserver(name, macropath, pool_names, version, alias=alias, device_name=device_name)
- except:
- db = self.get_database()
- db.delete_device(device_name)
- raise
-
- def _create_macroserver(self, name, macropath, pool_names, version, alias=None, device_name=None):
- db = self.get_database()
- info = PyTango.DbDevInfo()
- info.name = device_name
- info._class = "MacroServer"
- info.server = "MacroServer/" + name
- db.add_device(info)
- if alias:
- db.put_device_alias(device_name, alias)
-
- db.put_device_property(device_name, {"MacroPath" : macropath, "Version": version, "PoolNames":pool_names})
- ms = MacroServer(self, name, macropath, pool_names, version, alias=alias, device_name=device_name)
- self._macroservers.append(ms)
- db.cache().refresh()
- return ms
-
- def remove_pool(self):
- pass
-
- def remove_macroserver(self):
- pass
-
- def get_database(self):
- return self._sardana_db.get_database()
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class DatabaseSardana(object):
- """A class containning all sardanas for a single database"""
-
- def __init__(self, db):
- assert(db is not None)
- self._db = db
- self.refresh()
-
- def refresh(self):
- self._sardanas = sardanas = {}
- services = self._db.get_service_list("Sardana/.*")
- for service, dev in services.items():
- service_type, service_instance = service.split("/", 1)
- try:
- sardanas[service_instance] = Sardana(self, service_instance, dev)
- except:
- pass
-
- def create_sardana(self, name, device_name):
- if self._sardanas.has_key(name):
- raise Exception("Sardana '%s' already exists" % name)
- self._db.register_service("Sardana", name, device_name)
- sardana = Sardana(self, name)
- self._sardanas[name] = sardana
- return sardana
-
- def remove_sardana(self, name):
- try:
- self._sardanas.pop(name)
- except KeyError:
- raise Exception("Sardana '%s' does NOT exist" % name)
- self._db.unregister_service("Sardana", name)
-
- def get_sardanas(self):
- return self._sardanas
-
- def get_sardana(self, name):
- return self._sardanas[name]
-
- def get_database(self):
- return self._db
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# T E M P O R A R Y I M P L E M E N T A T I O N
-#
-# THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-class SardanaManager(Singleton, Logger):
-
- def __init__(self):
- """ Initialization. Nothing to be done here for now."""
- pass
-
- def init(self, *args, **kwargs):
- """Singleton instance initialization.
- **For internal usage only**"""
- name = self.__class__.__name__
- self.call__init__(Logger, name)
- self._db_sardanas = {}
-
- def _get_db_sardana(self, db=None):
- if db is None:
- import taurus
- db = taurus.Database()
- db_sardana = self._db_sardanas.get(db)
- if db_sardana is None:
- db_sardana = DatabaseSardana(db)
- return db_sardana
-
- def create_sardana(self, name, device_name, db=None):
- return self._get_db_sardana(db).create_sardana(name, device_name)
-
- def remove_sardana(self, name, db=None):
- self._get_db_sardana(db).remove_sardana(name)
-
- def get_sardanas(self, db=None):
- return self._get_db_sardana(db).get_sardanas()
-
- def get_sardana(self, name, db=None):
- return self._get_db_sardana(db).get_sardana(name)
-
- def get_hosts(self):
- return ["localhost"] + ["controls%02d" % i for i in range(5)]
-
- def get_level_range(self):
- return 1, 200
-
- def has_localhost_starter(self):
- import socket
- return socket.gethostname() in self.get_hosts()
-
- @classmethod
- def get_default_pool_path(cls):
- pathList = []
- pathList.append("/homelocal/sicilia/lib/poolcontrollers")
- pathList.append("/homelocal/sicilia/lib/python/site-packages/poolcontrollers")
- return pathList
-
- @classmethod
- def get_default_ms_path(cls):
- pathList = []
- pathList.append("/homelocal/sicilia/lib/python/site-packages/macroserver/macros")
- return pathList
-
-
-
-
-
diff --git a/src/sardana/taurus/qt/__init__.py b/src/sardana/taurus/qt/__init__.py
deleted file mode 100644
index ca50553e..00000000
--- a/src/sardana/taurus/qt/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""""" \ No newline at end of file
diff --git a/src/sardana/taurus/qt/qtcore/__init__.py b/src/sardana/taurus/qt/qtcore/__init__.py
deleted file mode 100644
index ca50553e..00000000
--- a/src/sardana/taurus/qt/qtcore/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""""" \ No newline at end of file
diff --git a/src/sardana/taurus/qt/qtcore/tango/__init__.py b/src/sardana/taurus/qt/qtcore/tango/__init__.py
deleted file mode 100644
index ca50553e..00000000
--- a/src/sardana/taurus/qt/qtcore/tango/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""""" \ No newline at end of file
diff --git a/src/sardana/taurus/qt/qtcore/tango/sardana/__init__.py b/src/sardana/taurus/qt/qtcore/tango/sardana/__init__.py
deleted file mode 100644
index dea81f3f..00000000
--- a/src/sardana/taurus/qt/qtcore/tango/sardana/__init__.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-Sardana extension for taurus Qt
-"""
-
-__docformat__ = 'restructuredtext'
-
-
-def registerExtensions():
- from . import pool
- from . import macroserver
-
- pool.registerExtensions()
- macroserver.registerExtensions()
diff --git a/src/sardana/taurus/qt/qtcore/tango/sardana/macroserver.py b/src/sardana/taurus/qt/qtcore/tango/sardana/macroserver.py
deleted file mode 100644
index b0a780f0..00000000
--- a/src/sardana/taurus/qt/qtcore/tango/sardana/macroserver.py
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""MacroServer extension for taurus Qt"""
-
-__all__ = ["QDoor", "QMacroServer", "MacroServerMessageErrorHandler", "registerExtensions"]
-
-from taurus.core.taurusbasetypes import TaurusEventType
-from taurus.external.qt import Qt
-
-from sardana.taurus.core.tango.sardana.macroserver import BaseMacroServer, BaseDoor
-
-CHANGE_EVTS = TaurusEventType.Change, TaurusEventType.Periodic
-
-
-class QDoor(BaseDoor, Qt.QObject):
-
- __pyqtSignals__ = ["resultUpdated", "recordDataUpdated", "macroStatusUpdated"]
- __pyqtSignals__ += [ "%sUpdated" % l.lower() for l in BaseDoor.log_streams ]
-
- def __init__(self, name, qt_parent=None, **kw):
- self.call__init__wo_kw(Qt.QObject, qt_parent)
- self.call__init__(BaseDoor, name, **kw)
-
- def resultReceived(self, log_name, result):
- res = BaseDoor.resultReceived(self, log_name, result)
- self.emit(Qt.SIGNAL("resultUpdated"), res)
- return res
-
- def recordDataReceived(self, s, t, v):
- if t not in CHANGE_EVTS: return
- res = BaseDoor.recordDataReceived(self, s, t, v)
- self.emit(Qt.SIGNAL("recordDataUpdated"), res)
- return res
-
- def macroStatusReceived(self, s, t, v):
- res = BaseDoor.macroStatusReceived(self, s, t, v)
- if t == TaurusEventType.Error:
- macro = None
- else:
- macro = self.getRunningMacro()
- if macro is None: return
- self.emit(Qt.SIGNAL("macroStatusUpdated"), (macro, res))
- return res
-
- def logReceived(self, log_name, output):
- res = BaseDoor.logReceived(self, log_name, output)
- self.emit(Qt.SIGNAL("%sUpdated" % log_name.lower()), output)
- return res
-
-
-class QMacroServer(BaseMacroServer, Qt.QObject):
-
- def __init__(self, name, qt_parent=None, **kw):
- self.call__init__wo_kw(Qt.QObject, qt_parent)
- self.call__init__(BaseMacroServer, name, **kw)
-
- def typesChanged(self, s, t, v):
- res = BaseMacroServer.typesChanged(self, s, t, v)
- self.emit(Qt.SIGNAL("typesUpdated"))
- return res
-
- def elementsChanged(self, s, t, v):
- res = BaseMacroServer.elementsChanged(self, s, t, v)
- self.emit(Qt.SIGNAL("elementsUpdated"))
- return res
-
- def macrosChanged(self, s, t, v):
- res = BaseMacroServer.macrosChanged(self, s, t, v)
- self.emit(Qt.SIGNAL("macrosUpdated"))
- return res
-
- def on_elements_changed(self, s, t, v):
- ret = added, removed, changed = \
- BaseMacroServer.on_elements_changed(self, s, t, v)
-
- macros, elements = 0, 0
- for element in set.union(added, removed, changed):
- if "MacroCode" in element.interfaces:
- macros += 1
- elements += 1
- if elements and macros:
- break
- if elements:
- self.emit(Qt.SIGNAL("elementsChanged"))
- if macros:
- self.emit(Qt.SIGNAL("macrosUpdated"))
- return ret
-
- def on_environment_changed(self, s, t, v):
- ret = added, removed, changed = \
- BaseMacroServer.on_environment_changed(self, s, t, v)
-
- if added or removed or changed:
- self.emit(Qt.SIGNAL("environmentChanged"), ret)
- return ret
-
-
-# ugly access to qtgui level: in future find a better way to register error
-# handlers, maybe in TangoFactory & TaurusManager
-
-from taurus.qt.qtgui.panel import TaurusMessageErrorHandler
-
-class MacroServerMessageErrorHandler(TaurusMessageErrorHandler):
-
- def setError(self, err_type=None, err_value=None, err_traceback=None):
- """Translates the given error object into an HTML string and places it
- in the message panel
-
- :param error: an error object (typically an exception object)
- :type error: object"""
-
- msgbox = self._msgbox
- msgbox.setText(err_value)
- msg = "<html><body><pre>%s</pre></body></html>" % err_value
- msgbox.setDetailedHtml(msg)
-
- html_orig = """<html><head><style type="text/css">{style}</style></head><body>"""
- exc_info = "".join(err_traceback)
- style = ""
- try:
- import pygments.formatters
- import pygments.lexers
- except:
- pygments = None
- if pygments is not None:
- formatter = pygments.formatters.HtmlFormatter()
- style = formatter.get_style_defs()
- html = html_orig.format(style=style)
- if pygments is None:
- html += "<pre>%s</pre>" % exc_info
- else:
- formatter = pygments.formatters.HtmlFormatter()
- html += pygments.highlight(exc_info, pygments.lexers.PythonTracebackLexer(), formatter)
- html += "</body></html>"
- msgbox.setOriginHtml(html)
-
-
-def registerExtensions():
- """Registers the macroserver extensions in the :class:`taurus.core.tango.TangoFactory`"""
- import taurus
- factory = taurus.Factory()
- factory.registerDeviceClass('MacroServer', QMacroServer)
- factory.registerDeviceClass('Door', QDoor)
-
- # ugly access to qtgui level: in future find a better way to register error
- # handlers, maybe in TangoFactory & TaurusManager
- import sardana.taurus.core.tango.sardana.macro
- import taurus.qt.qtgui.panel
- MacroRunException = sardana.taurus.core.tango.sardana.macro.MacroRunException
- TaurusMessagePanel = taurus.qt.qtgui.panel.TaurusMessagePanel
-
- TaurusMessagePanel.registerErrorHandler(MacroRunException, MacroServerMessageErrorHandler)
diff --git a/src/sardana/taurus/qt/qtcore/tango/sardana/model.py b/src/sardana/taurus/qt/qtcore/tango/sardana/model.py
deleted file mode 100644
index 376f44ee..00000000
--- a/src/sardana/taurus/qt/qtcore/tango/sardana/model.py
+++ /dev/null
@@ -1,461 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a taurus text editor widget."""
-
-__all__ = ["SardanaBaseElementModel", "SardanaElementTypeModel",
- "SardanaElementPlainModel", "SardanaBaseProxyModel",
- "SardanaTypeProxyModel",
- "SardanaBaseTreeItem", "SardanaRootTreeItem",
- "SardanaElementTreeItem", "SardanaTypeTreeItem",
- "SardanaEnvironmentModel"]
-
-__docformat__ = 'restructuredtext'
-
-try:
- import pygments
- from pygments import highlight
- from pygments.formatters import HtmlFormatter
- from pygments.lexers import PythonLexer, PythonTracebackLexer
-except:
- pygments = None
-
-from taurus.core.taurusdevice import TaurusDevice
-from taurus.external.qt import Qt
-from taurus.core.util.enumeration import Enumeration
-from taurus.qt.qtcore.model import TaurusBaseTreeItem, TaurusBaseModel, \
- TaurusBaseProxyModel
-from taurus.qt.qtcore.mimetypes import TAURUS_MODEL_LIST_MIME_TYPE, \
- TAURUS_MODEL_MIME_TYPE
-
-_MOD, _CLS, _FNC, _TNG = ":/python-module.png", ":/class.png", ":/function.png", ":/tango.png"
-
-TYPE_MAP = {
- "ControllerLibrary" : ("Controller libraries", _MOD, "Controller library",),
- "ControllerClass" : ("Controller classes", _CLS, "Controller class",),
- "Controller" : ("Controllers", _TNG, "Controller",),
- "Motor" : ("Motors", _TNG, "Motor",),
- "PseudoMotor" : ("Pseudo motors", _TNG, "Pseudo Motor",),
- "CTExpChannel" : ("Counter/Timers", _TNG, "Counter/Timer experiment channel",),
- "CounterTimer" : ("Counter/Timers", _TNG, "Counter/Timer experiment channel",),
- "ZeroDExpChannel" : ("0D channels", _TNG, "0D experiment channel",),
- "OneDExpChannel" : ("1D channels", _TNG, "1D experiment channel",),
- "TwoDExpChannel" : ("2D channels", _TNG, "2D experiment channel",),
- "MotorGroup" : ("Motor groups", _TNG, "Motor group",),
- "MeasurementGroup" : ("Measurement groups", _TNG, "Measurement group",),
- "CommunicationChannel" : ("Communication channels", _TNG, "Communication channel",),
- "MacroLibrary" : ("Macro libraries", _MOD, "Macro library",),
- "MacroClass" : ("Macro classes", _CLS, "Macro class",),
- "Instrument" : ("Instruments", _TNG, "Instrument",),
- "MacroFunction" : ("Macro functions", _FNC, "Macro function",),
-}
-
-def getElementTypeLabel(t):
- return TYPE_MAP.get(t, (t,))[0]
-
-def getElementTypeIcon(t):
- import taurus.qt.qtgui.resource
- try:
- return taurus.qt.qtgui.resource.getIcon(TYPE_MAP.get(t, (None, _TNG))[1])
- except:
- return None
-
-def getElementTypeSize(t):
- return Qt.QSize(200, 24)
-
-def getElementTypeToolTip(t):
- return TYPE_MAP.get(t, (None, None, 'no information'))[2]
-
-
-class SardanaBaseTreeItem(TaurusBaseTreeItem):
- """A generic node"""
-
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- if index.column() > 0:
- return None
- return getElementTypeLabel(self._itemData)
-
- def role(self):
- """Returns the prefered role for the item.
- This implementation returns taurus.core.taurusbasetypes.TaurusElementType.Unknown
-
- This method should be able to return any kind of python object as long
- as the model that is used is compatible.
-
- :return: the role in form of element type"""
- return 'type'
-
-
-class SardanaRootTreeItem(SardanaBaseTreeItem):
- pass
-
-
-class SardanaTypeTreeItem(SardanaBaseTreeItem):
- pass
-
-
-class SardanaElementTreeItem(SardanaBaseTreeItem):
-
- def role(self):
- return self.itemData().type
-
- def data(self, index):
- column, model = index.column(), index.model()
- role = model.role(column, self.depth())
- obj = self.itemData()
- if role == "parent":
- if hasattr(obj, "klass"):
- return obj.klass
- if hasattr(obj, "module"):
- return obj.module
- if hasattr(obj, "controller"):
- return obj.controller
- if hasattr(obj, "parent"):
- return obj.parent
- return None
- return getattr(obj, role)
-
- def toolTip(self, index):
- if index.column() > 0:
- return self.data(index)
- obj = self.itemData()
- if hasattr(obj, "exc_info") and obj.exc_info is not None:
- html_orig = '<html><head><style type="text/css">{style}' \
- '</style></head><body>'
- formatter, style = None, ""
- if pygments is not None:
- formatter = HtmlFormatter()
- style = formatter.get_style_defs()
- txt = html_orig.format(style=style)
- if formatter is None:
- txt += "<pre>%s</pre>" % obj.exc_info
- else:
- txt += highlight(obj.exc_info, PythonTracebackLexer(),
- formatter)
- txt += "</body></html>"
- else:
- txt = "{0} {1}".format(getElementTypeToolTip(obj.type), obj.name)
- return txt
-
- def icon(self, index):
- if index.column() > 0:
- return None
- return getElementTypeIcon(self.itemData().type)
-
-
-class SardanaBaseElementModel(TaurusBaseModel):
-
- ColumnNames = ["Elements", "Controller/Module/Parent"]
- ColumnRoles = ('Root', 'type', 'name', 'name'), "parent"
-
- def __init__(self, parent=None, data=None):
- TaurusBaseModel.__init__(self, parent=parent, data=data)
- self.setSelectables(self.ColumnRoles[0])
-
- def setDataSource(self, data_source):
- old_ds = self.dataSource()
- if old_ds is not None:
- Qt.QObject.disconnect(old_ds, Qt.SIGNAL('elementsChanged'),
- self.on_elements_changed)
- if data_source is not None:
- Qt.QObject.connect(data_source, Qt.SIGNAL('elementsChanged'),
- self.on_elements_changed)
- TaurusBaseModel.setDataSource(self, data_source)
-
- def on_elements_changed(self):
- self.refresh()
-
- def createNewRootItem(self):
- return SardanaRootTreeItem(self, self.ColumnNames)
-
- def roleIcon(self, role):
- return getElementTypeIcon(role)
-
- def columnIcon(self, column):
- return self.roleIcon(self.role(column))
-
- def roleToolTip(self, role):
- return getElementTypeToolTip(role)
-
- def columnToolTip(self, column):
- return self.roleToolTip(self.role(column))
-
- def roleSize(self, role):
- return getElementTypeSize(role)
-
- def columnSize(self, column):
- role = self.role(column)
- s = self.roleSize(role)
- return s
-
- def mimeTypes(self):
- return "text/plain", TAURUS_MODEL_LIST_MIME_TYPE, TAURUS_MODEL_MIME_TYPE
-
- def mimeData(self, indexes):
- ret = Qt.QMimeData()
- data = []
- for index in indexes:
- if not index.isValid(): continue
- tree_item = index.internalPointer()
- mime_data_item = tree_item.mimeData(index)
- if mime_data_item is None:
- continue
- data.append(mime_data_item)
- ret.setData(TAURUS_MODEL_LIST_MIME_TYPE, "\r\n".join(data))
- ret.setText(", ".join(data))
- if len(data) == 1:
- ret.setData(TAURUS_MODEL_MIME_TYPE, str(data[0]))
- return ret
-
- def accept(self, element):
- return True
-
- def setupModelData(self, data):
- dev = self.dataSource()
- if dev is None:
- return
- self.ColumnNames[0] = dev.getSimpleName()
- info = dev.getElementsInfo()
- elements = info.getElements()
- root = self._rootItem
- type_nodes = {}
- parent_elements = {}
- child_elements = set()
- parent_types = "ControllerLibrary", "MacroLibrary", "Controller"
- child_types = "ControllerClass", "MacroClass", "MacroFunction", \
- "Motor", "CounterTimer", "PseudoMotor", "PseudoCounter", \
- "ZeroDExpChannel", "OneDExpChannel", "TwoDExpChannel"
-
- for element in elements:
- if not self.accept(element):
- continue
- element_type = element.type
- type_item = type_nodes.get(element_type)
- if type_item is None:
- type_item = SardanaTypeTreeItem(self, element_type, root)
- type_nodes[element_type] = type_item
- root.appendChild(type_item)
- element_item = SardanaElementTreeItem(self, element, type_item)
- type_item.appendChild(element_item)
- if element_type in parent_types:
- parent_elements[element.name] = element_item
- elif element_type in child_types:
- child_elements.add(element)
-
- for element in child_elements:
- try:
- parent_item = parent_elements[element.parent]
- except KeyError:
- self.warning("Error adding %s to parent %s (parent unknown)",
- element.name, element.parent)
- element_item = SardanaElementTreeItem(self, element, parent_item)
- parent_item.appendChild(element_item)
-
-
-class SardanaElementTypeModel(SardanaBaseElementModel):
- pass
-
-
-class SardanaElementPlainModel(SardanaBaseElementModel):
-
- ColumnNames = "Elements",
- ColumnRoles = ('Root', 'name',),
-
- def setupModelData(self, data):
- dev = self.dataSource()
- if dev is None:
- return
- info = dev.getElementsInfo()
- elements = info.getElements()
- root = self._rootItem
- skip_types = "ControllerLibrary", "MacroLibrary"
-
- for element in elements:
- element_type = element.type
- if element_type in skip_types:
- continue
- element_item = SardanaElementTreeItem(self, element, root)
- root.appendChild(element_item)
-
-
-class SardanaBaseProxyModel(TaurusBaseProxyModel):
-
- def filterAcceptsRow(self, sourceRow, sourceParent):
- sourceModel = self.sourceModel()
- idx = sourceModel.index(sourceRow, 0, sourceParent)
- treeItem = idx.internalPointer()
-
- if isinstance(treeItem, SardanaElementTreeItem):
- expr = self.filterRegExp()
- element = treeItem.itemData()
- return self.elementMatches(element, expr)
- return True
-
- def elementMatches(self, element, expr):
- name = element.name
- if Qt.QString(name).contains(expr):
- return True
- name = element.full_name
- if name is None:
- return False
- return Qt.QString(name).contains(expr)
-
-
-class SardanaTypeProxyModel(TaurusBaseProxyModel):
- """Sardana filter by element type"""
-
- def __init__(self, types=None, parent=None):
- TaurusBaseProxyModel.__init__(self, parent=parent)
- if types is None:
- types = ()
- self._types = types
-
- def filterAcceptsRow(self, sourceRow, sourceParent):
- sourceModel = self.sourceModel()
- idx = sourceModel.index(sourceRow, 0, sourceParent)
- treeItem = idx.internalPointer()
-
- if isinstance(treeItem, SardanaElementTreeItem):
- return treeItem.itemData().type in self._types
- return False
-
-
-class EnvironmentTreeItem(TaurusBaseTreeItem):
- """An environment node"""
-
- def role(self):
- return self.itemData().type
-
- def data(self, index):
- column, model = index.column(), index.model()
- role = model.role(column, self.depth())
- obj = self.itemData()
- if role == "key":
- return obj[0]
- elif role == "value":
- return obj[1]
- elif role == "datatype":
- return type(obj[1]).__name__
-
- def toolTip(self, index):
- return "environment '%s'" % self.itemData()[0]
-
- def icon(self, index):
- if index.column() > 0:
- return None
- return ":/class.png"
-
-
-class SardanaEnvironmentModel(TaurusBaseModel):
-
- ColumnNames = ["Environment", "Value", "Data Type"]
- ColumnRoles = ('Root', 'key'), 'value', 'datatype'
-
- def __init__(self, parent=None, data=None):
- TaurusBaseModel.__init__(self, parent=parent, data=data)
- self.setSelectables(self.ColumnRoles[0])
-
- def setDataSource(self, data_source):
- old_ds = self.dataSource()
- if old_ds is not None:
- Qt.QObject.disconnect(old_ds, Qt.SIGNAL('environmentChanged'),
- self.on_environment_changed)
- if data_source is not None:
- Qt.QObject.connect(data_source, Qt.SIGNAL('environmentChanged'),
- self.on_environment_changed)
- TaurusBaseModel.setDataSource(self, data_source)
-
- def on_environment_changed(self):
- self.refresh()
-
- def createNewRootItem(self):
- return SardanaRootTreeItem(self, self.ColumnNames)
-
- def roleIcon(self, role):
- return ":/tango.png"
- # return getElementTypeIcon(role)
-
- #def columnIcon(self, column):
- # return self.roleIcon(self.role(column))
-
- def roleToolTip(self, role):
- cr = self.ColumnRoles
- if role == cr[0][1]:
- return "Environment name"
- elif role == cr[1]:
- return "Environment value"
- elif role == cr[2]:
- return "Environment value data type"
-
- #def columnToolTip(self, column):
- # return self.roleToolTip(self.role(column))
-
- def roleSize(self, role):
- return Qt.QSize(200, 24)
-
- def columnSize(self, column):
- role = self.role(column)
- s = self.roleSize(role)
- return s
-
- def mimeTypes(self):
- return "text/plain", TAURUS_MODEL_LIST_MIME_TYPE, TAURUS_MODEL_MIME_TYPE
-
- def mimeData(self, indexes):
- ret = Qt.QMimeData()
- data = []
- for index in indexes:
- if not index.isValid(): continue
- tree_item = index.internalPointer()
- mime_data_item = tree_item.mimeData(index)
- if mime_data_item is None:
- continue
- data.append(mime_data_item)
- ret.setData(TAURUS_MODEL_LIST_MIME_TYPE, "\r\n".join(data))
- ret.setText(", ".join(data))
- if len(data) == 1:
- ret.setData(TAURUS_MODEL_MIME_TYPE, str(data[0]))
- return ret
-
- def accept(self, environment):
- return True
-
- def setupModelData(self, data):
- dev = self.dataSource()
- if dev is None:
- return
-
- env = dev.getEnvironment()
- root = self._rootItem
-
- for key, value in env.items():
- if not self.accept(key):
- continue
- env_item = EnvironmentTreeItem(self, (key, value), root)
- root.appendChild(env_item)
diff --git a/src/sardana/taurus/qt/qtcore/tango/sardana/pool.py b/src/sardana/taurus/qt/qtcore/tango/sardana/pool.py
deleted file mode 100644
index f53bab1d..00000000
--- a/src/sardana/taurus/qt/qtcore/tango/sardana/pool.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Device pool extension for taurus Qt"""
-
-__all__ = ["QPool", "QMeasurementGroup",
- "registerExtensions"]
-
-import json
-
-from taurus.external.qt import Qt
-
-from taurus.core.taurusbasetypes import TaurusEventType
-from taurus.core.tango import TangoDevice
-
-CHANGE_EVTS = TaurusEventType.Change, TaurusEventType.Periodic
-
-
-class QPool(Qt.QObject, TangoDevice):
-
- def __init__(self, name, qt_parent=None, **kw):
- self.call__init__wo_kw(Qt.QObject, qt_parent)
- self.call__init__(TangoDevice, name, **kw)
-
-
-class QMeasurementGroup(Qt.QObject, TangoDevice):
-
- def __init__(self, name, qt_parent=None, **kw):
- self.call__init__wo_kw(Qt.QObject, qt_parent)
- self.call__init__(TangoDevice, name, **kw)
-
- self._config = None
- configuration = self.getAttribute("Configuration")
- configuration.addListener(self._configurationChanged)
-
- def __getattr__(self, name):
- try:
- return Qt.QObject.__getattr__(self, name)
- except AttributeError:
- return TangoDevice.__getattr__(self, name)
-
- def _configurationChanged(self, s, t, v):
- if t == TaurusEventType.Config:
- return
- if TaurusEventType.Error:
- self._config = None
- else:
- self._config = json.loads(v.value)
- self.emit(Qt.SIGNAL("configurationChanged"))
-
- def getConfiguration(self, cache=True):
- if self._config is None or not cache:
- try:
- v = self.read_attribute("configuration")
- self._config = json.loads(v.value)
- except:
- self._config = None
- return self._config
-
- def setConfiguration(self, config):
- self.write_attribute("configuration", json.dumps(config))
-
-
-def registerExtensions():
- """Registers the pool extensions in the :class:`taurus.core.tango.TangoFactory`"""
- import taurus
- #import sardana.taurus.core.tango.sardana.pool
- #sardana.taurus.core.tango.sardana.pool.registerExtensions()
- factory = taurus.Factory()
- #factory.registerDeviceClass('Pool', QPool)
- factory.registerDeviceClass('MeasurementGroup', QMeasurementGroup)
diff --git a/src/sardana/taurus/qt/qtgui/__init__.py b/src/sardana/taurus/qt/qtgui/__init__.py
deleted file mode 100644
index ca50553e..00000000
--- a/src/sardana/taurus/qt/qtgui/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""""" \ No newline at end of file
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/__init__.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/__init__.py
deleted file mode 100644
index cea9d00b..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-__init__.py:
-"""
-from .macroexecutor import TaurusMacroExecutorWidget, TaurusMacroExecutor
-from .sequenceeditor import TaurusSequencerWidget, TaurusSequencer
-from .common import TaurusMacroConfigurationDialog
-from .macrodescriptionviewer import TaurusMacroDescriptionViewer
-from .dooroutput import DoorOutput, DoorDebug, DoorResult
-from .macrobutton import MacroButton, MacroButtonAbortDoor
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/common.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/common.py
deleted file mode 100644
index 51bea8b2..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/common.py
+++ /dev/null
@@ -1,340 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import PyTango
-
-import taurus
-from taurus.external.qt import Qt
-from taurus.core.taurusbasetypes import TaurusEventType
-from taurus.qt.qtgui.base import TaurusBaseWidget
-from taurus.qt.qtgui.input import TaurusAttrListComboBox
-from taurus.qt.qtgui.container import TaurusMainWindow
-from taurus.qt.qtgui.resource import getThemeIcon
-
-
-def str2bool(text):
- return text in ("True", "1")
-
-def standardPlotablesFilter(column_desc_dict):
- """This is a standard plotables filter emitted with "plotablesFilter" signal.
- Its purpose is to filterout point_nr columnf from scanline"""
- if column_desc_dict.get("label", None) == "point_nb":
- return False
- return True
-
-
-class MSAttrListComboBox(TaurusAttrListComboBox):
- _elementType = ''
-
- def handleEvent(self, evt_src, evt_type, evt_value):
- if evt_type in (TaurusEventType.Config, TaurusEventType.Error):
- return
- text = str(self.currentText())
- self.clear()
- parentModelObj = self.getParentModelObj()
- if parentModelObj == None:
- return
- items = parentModelObj.getElementNamesWithInterface(self._elementType)
- items.sort()
- self.addItems(items)
- if text in items:
- self.setCurrentText(text)
-
- def setCurrentText(self, text):
- idx = self.findText(text)
- self.setCurrentIndex(idx)
-
- def setElementType(self, elementType):
- self._elementType = elementType
-
- def getElementType(self):
- return self._elementType
-
- def resetElementType(self):
- self._elementType = MSAttrListComboBox._elementType
-
- elementType = Qt.pyqtProperty("QString", getElementType, setElementType, resetElementType)
-
-
-class MacroComboBox(Qt.QComboBox, TaurusBaseWidget):
- """ComboBox representing list of macros"""
-
-
- def __init__(self, parent=None):
- name = self.__class__.__name__
- self.call__init__wo_kw(Qt.QComboBox, parent)
- self.call__init__(TaurusBaseWidget, name)
- self.setSizeAdjustPolicy(Qt.QComboBox.AdjustToContentsOnFirstShow)
- self.setToolTip("Choose a macro name...")
-
- def setModel(self, model):
- if isinstance(model, Qt.QAbstractItemModel):
- Qt.QAbstractItemView.setModel(self, model)
- else:
- TaurusBaseWidget.setModel(self, model)
- self.__loadMacroNames()
-
- def parentModelChanged(self, parentmodel_name):
- TaurusBaseWidget.parentModelChanged(self, parentmodel_name)
- self.__loadMacroNames()
-
- def onMacrosUpdated(self):
- self.__loadMacroNames()
-
- def __loadMacroNames(self):
- self.clear()
- ms = self.getModelObj()
- if ms == None: return
- macros = ms.getElementsWithInterface('MacroCode')
- macroNames = [macro.name for macro in macros.values()]
- macroNames.sort()
- macroNames.insert(0, '') #adding blank item
- self.addItems(macroNames)
- self.updateStyle()
-
- def selectMacro(self, macroName):
- currentIdx = self.currentIndex()
- index = self.findText(macroName)
- self.setCurrentIndex(index)
- if currentIdx == index:
- self.emit(Qt.SIGNAL("currentIndexChanged(QString)"), macroName)
-
-
-class TaurusMacroConfigurationDialog(Qt.QDialog):
-
- def __init__(self, parent=None, initMacroServer=None, initDoor=None):
- Qt.QDialog.__init__(self, parent)
- self.initMacroServer = initMacroServer
- self.initDoor = initDoor
- configureAction = Qt.QAction(getThemeIcon("folder-open"), "Change custom macro editors paths", self)
- self.connect(configureAction, Qt.SIGNAL("triggered()"), self.onReloadMacroServers)
- configureAction.setToolTip("Change custom macro editors paths")
- configureAction.setShortcut("F11")
- self.refreshMacroServersAction = Qt.QAction(getThemeIcon("view-refresh"), "Reload macroservers", self)
- self.connect(self.refreshMacroServersAction, Qt.SIGNAL("triggered()"), self.onReloadMacroServers)
- self.refreshMacroServersAction.setToolTip("This will reload list of all macroservers from Tango DB")
- self.refreshMacroServersAction.setShortcut("F5")
- self.initComponents()
-
- def initComponents(self):
- self.setModal(True)
- macroServerLabel = Qt.QLabel("MacroServer:", self)
- self.macroServerComboBox = Qt.QComboBox()
- ms_stateIcons = self.__retriveMacroServersFromDB()
- self.__fillMacroServerComboBox(ms_stateIcons, self.macroServerComboBox)
- refreshMacroServersButton = Qt.QToolButton()
- refreshMacroServersButton.setDefaultAction(self.refreshMacroServersAction)
- doorLabel = Qt.QLabel("Door:", self)
- self.doorComboBox = TaurusAttrListComboBox(self)
- self.doorComboBox.setModel(self.macroServerComboBox.currentText() + "/doorList")
-
- self.buttonBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok |
- Qt.QDialogButtonBox.Cancel)
- gridLayout = Qt.QGridLayout()
- gridLayout.addWidget(macroServerLabel, 0, 0)
- gridLayout.addWidget(self.macroServerComboBox, 0, 1)
- gridLayout.addWidget(refreshMacroServersButton, 0, 2)
- gridLayout.addWidget(doorLabel, 1, 0)
- gridLayout.addWidget(self.doorComboBox, 1, 1)
-
- self.setLayout(Qt.QVBoxLayout())
- self.layout().addLayout(gridLayout)
- self.layout().addWidget(self.buttonBox)
- self.adjustSize()
-
- self.connect(self.buttonBox, Qt.SIGNAL("accepted()"), self, Qt.SLOT("accept()"))
- self.connect(self.buttonBox, Qt.SIGNAL("rejected()"), self, Qt.SLOT("reject()"))
- self.connect(self.macroServerComboBox, Qt.SIGNAL("currentIndexChanged(const QString&)"), self.onMacroServerComboBoxChanged)
- self.selectMacroServer(self.initMacroServer)
- self.selectDoor(self.initDoor)
-
- def accept(self):
- self.emit(Qt.SIGNAL("macroserverNameChanged"), str(self.macroServerComboBox.currentText()))
- self.emit(Qt.SIGNAL("doorNameChanged"), str(self.doorComboBox.currentText()))
- Qt.QDialog.accept(self)
-
- def __retriveMacroServersFromDB(self):
- ms_stateIcons = []
- db = taurus.Database()
- macroServerList = db.getValueObj().get_device_name('*', 'MacroServer')
- for macroServer in macroServerList:
- #state = Device(macroServer).getState()
- state = None
- try:
- state = PyTango.DeviceProxy(macroServer).state()
- except:
- pass
- icon = None
- if state == PyTango.DevState.ON:
- icon = Qt.QIcon(":/leds/images24/ledgreen.png")
- elif state == PyTango.DevState.FAULT:
- icon = Qt.QIcon(":/leds/images24/ledred.png")
- elif state == None:
- icon = Qt.QIcon(":/leds/images24/ledredoff.png")
- ms_stateIcons.append((macroServer, icon))
- return ms_stateIcons
-
- def onReloadMacroServers(self):
- ms_stateIcons = self.__retriveMacroServersFromDB()
- self.__fillMacroServerComboBox(ms_stateIcons, self.macroServerComboBox)
-
- def onMacroServerComboBoxChanged(self, macroServerName):
- self.doorComboBox.setModel(macroServerName + "/doorList")
- self.doorComboBox.fireEvent(self.doorComboBox, taurus.core.taurusbasetypes.TaurusEventType.Change, self.doorComboBox.getModelValueObj()) #fake event
-
- def onMacroServerNameChanged(self, macroServerName):
- self.__selectMacroServer(macroServerName)
-
- def onDoorNameChanged(self, doorName):
- self.__selectDoor(doorName)
-
- def __fillMacroServerComboBox(self, ms_stateIcons, comboBox):
- comboBox.clear()
- for ms_stateIcon in ms_stateIcons:
- macroServer = ms_stateIcon[0]
- icon = ms_stateIcon[1]
- comboBox.addItem(icon, macroServer)
-
- def selectDoor(self, doorName):
- if doorName is None:
- return
- #@todo: Change that it will be able to handle also full device names
- "/".join(doorName.split("/")[-3:])
- index = self.doorComboBox.findText(doorName)
- if index != -1:
- self.doorComboBox.setCurrentIndex(index)
-
- def selectMacroServer(self, macroServerName):
- if macroServerName is None:
- return
- #@todo: Change that it will be able to handle also full device names
- "/".join(macroServerName.split("/")[-3:])
- index = self.macroServerComboBox.findText(macroServerName)
- if index != -1:
- self.macroServerComboBox.setCurrentIndex(index)
-
-class MacroExecutionWindow(TaurusMainWindow):
-
- def __init__(self, parent=None, designMode=False):
- TaurusMainWindow.__init__(self, parent, designMode)
- self.statusBar().showMessage("")
- self.setModelInConfig(True)
- self._doorName = ""
- self.registerConfigProperty("doorName", "setDoorName", "doorName")
- self._customMacroEditorPaths = ""
- self.registerConfigProperty("customMacroEditorPaths", "setCustomMacroEditorPaths", "customMacroEditorPaths")
- self._qDoor = None
- self.setWindowIcon(Qt.QIcon(":/apps/preferences-system-session.svg"))
- toolBar = self.basicTaurusToolbar()
- toolBar.setIconSize(Qt.QSize(24, 24))
- self.configureAction = self.createConfigureAction()
- toolBar.addAction(self.configureAction)
- self.taurusMenu.addAction(self.configureAction)
- self.customMacroEditorsPathsAction = self.createCustomMacroEditorPathsAction()
- self.taurusMenu.addAction(self.customMacroEditorsPathsAction)
- self.addToolBar(toolBar)
- self.initComponents()
- self.splashScreen().finish(self)
- self.connect(self, Qt.SIGNAL("doorChanged"), self.onDoorChanged)
-
- def doorName(self):
- return self._doorName
-
- def setDoorName(self, doorName):
- self._doorName = doorName
-
- def onDoorChanged(self, doorName):
- self.setDoorName(doorName)
-
- def customMacroEditorPaths(self):
- return self._customMacroEditorPaths
-
- def setCustomMacroEditorPaths(self, customMacroEditorPaths):
- self._customMacroEditorPaths = customMacroEditorPaths
-# ParamEditorManager().parsePaths(customMacroEditorPaths)
-# ParamEditorManager().browsePaths()
-
- def onCustomMacroEditorPaths(self):
- paths = str(Qt.QInputDialog.getText(self,
- "Edition of custom macro editors paths",
- "Paths:", Qt.QLineEdit.Normal,
- str(self.customMacroEditorPaths()))[0])
- self.setCustomMacroEditorPaths(paths)
-
- def initComponents(self):
- pass
-
- def setModel(self, model):
- """Sets new model for application, and change window title witn new macroserver name."""
- TaurusMainWindow.setModel(self, model)
- self.setWindowTitle(Qt.QApplication.applicationName() + ": " + model)
-
- def createConfigureAction(self):
- configureAction = Qt.QAction(getThemeIcon("preferences-system-session"), "Change configuration", self)
- self.connect(configureAction, Qt.SIGNAL("triggered()"), self.changeConfiguration)
- configureAction.setToolTip("Configuring MacroServer and Door")
- configureAction.setShortcut("F10")
- return configureAction
-
- def createCustomMacroEditorPathsAction(self):
- configureAction = Qt.QAction(getThemeIcon("folder-open"), "Change custom macro editors paths", self)
- self.connect(configureAction, Qt.SIGNAL("triggered()"), self.onCustomMacroEditorPaths)
- configureAction.setToolTip("Change custom macro editors paths")
- configureAction.setShortcut("F11")
- return configureAction
-
- def changeConfiguration(self):
- """This method is used to change macroserver as a model of application.
- It shows dialog with list of all macroservers on tango host, if the user
- Cancel dialog it doesn't do anything."""
- dialog = TaurusMacroConfigurationDialog(self, self.modelName, self.doorName())
- if dialog.exec_():
- self.setModel(str(dialog.macroServerComboBox.currentText()))
- self.emit(Qt.SIGNAL("doorChanged"), str(dialog.doorComboBox.currentText()))
- else:
- return
-
- def onShortMessage(self, msg):
- ''' Slot to be called when there is a new short message. Currently, the only action
- taken when there is a new message is to display it in the main window status bar.
-
- :param msg: (str) the short descriptive message to be handled
- '''
- self.statusBar().showMessage(msg)
-
-def test_macrocombobox(ms_name):
- mcb = MacroComboBox()
- mcb.setModel(ms_name)
- mcb.show()
-
-if __name__ == "__main__":
- import sys
- from taurus.qt.qtgui.application import TaurusApplication
- app = TaurusApplication()
- args = app.get_command_line_args()
- ms_name = args[0]
- test_macrocombobox(ms_name)
- sys.exit(app.exec_())
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/dooroutput.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/dooroutput.py
deleted file mode 100644
index 1cc86f4a..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/dooroutput.py
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-dooroutput.py:
-"""
-
-import taurus.core
-from taurus.external.qt import Qt
-
-
-class DoorOutput(Qt.QPlainTextEdit):
- """Widget used for displaying changes of door's attributes: Output, Info, Warning and Error."""
-
- def __init__(self, parent=None):
- Qt.QTextEdit.__init__(self, parent)
- self.setReadOnly(True)
- self.setFont(Qt.QFont("Courier", 9))
- self.stopAction = Qt.QAction("Stop scrolling", self)
- self.stopAction.setCheckable(True)
- self.stopAction.setChecked(False)
- self._isStopped = False
-
- def onDoorOutputChanged(self, output):
- """call on output attribute changed"""
- txt = "<font color=\"Black\">"
- if output is None:
- return
- for line in output:
- txt += line.replace(' ', '&nbsp;') + "\n"
- txt += "</font>"
- self.appendHtmlText(txt)
-
- def onDoorInfoChanged(self, info):
- """call on info attribute changed"""
- txt = "<font color=\"Blue\">"
- if info is None:
- return
-
- for line in info:
- txt += line.replace(' ', '&nbsp;') + "\n"
- txt += "</font>"
- self.appendHtmlText(txt)
-
- def onDoorWarningChanged(self, warning):
- """call on warning attribute changed"""
- txt = "<font color=\"Orange\">"
- if warning is None:
- return
- for line in warning:
- txt += line.replace(' ', '&nbsp;') + "\n"
- txt += "</font>"
- self.appendHtmlText(txt)
-
- def onDoorErrorChanged(self, error):
- """call on error attribute changed"""
- txt = "<font color=\"Red\">"
- if error is None:
- return
- for line in error:
- txt += line.replace(' ', '&nbsp;') + "\n"
- txt += "</font>"
- self.appendHtmlText(txt)
-
- def appendHtmlText(self, text):
- self.appendHtml(text)
- if not self._isStopped:
- self.moveCursor(Qt.QTextCursor.End)
-
- def contextMenuEvent(self, event):
- menu = self.createStandardContextMenu()
- clearAction = Qt.QAction("Clear", menu)
- menu.addAction(clearAction)
- menu.addAction(self.stopAction)
- if not len(self.toPlainText()):
- clearAction.setEnabled(False)
-
- Qt.QObject.connect(clearAction, Qt.SIGNAL("triggered()"), self.clear)
- Qt.QObject.connect(self.stopAction, Qt.SIGNAL("toggled(bool)"), self.stopScrolling)
- menu.exec_(event.globalPos())
-
- def stopScrolling(self, stop):
- self._isStopped = stop
-
-class DoorDebug(Qt.QPlainTextEdit):
- """Widget used for displaying changes of door's Debug attribute."""
-
- def __init__(self, parent=None):
- Qt.QTextEdit.__init__(self, parent)
- self.setReadOnly(True)
- self.setFont(Qt.QFont("Courier", 9))
- self.stopAction = Qt.QAction("Stop scrolling", self)
- self.stopAction.setCheckable(True)
- self.stopAction.setChecked(False)
- self._isStopped = False
-
- def onDoorDebugChanged(self, debug):
- """call on debug attribute changed"""
- if debug is None:
- return
- for line in debug:
- self.appendPlainText(line)
-
- if not self._isStopped:
- self.moveCursor(Qt.QTextCursor.End)
-
- def contextMenuEvent(self, event):
- menu = self.createStandardContextMenu()
- clearAction = Qt.QAction("Clear", menu)
- menu.addAction(clearAction)
- menu.addAction(self.stopAction)
- if not len(self.toPlainText()):
- clearAction.setEnabled(False)
-
- Qt.QObject.connect(clearAction, Qt.SIGNAL("triggered()"), self.clear)
- Qt.QObject.connect(self.stopAction, Qt.SIGNAL("toggled(bool)"), self.stopScrolling)
- menu.exec_(event.globalPos())
-
- def stopScrolling(self, stop):
- self._isStopped = stop
-
-class DoorResult(Qt.QPlainTextEdit):
- """Widget used for displaying changes of door's Result attribute."""
-
- def __init__(self, parent=None):
- Qt.QTextEdit.__init__(self, parent)
- self.setReadOnly(True)
- self.setFont(Qt.QFont("Courier", 9))
-
- def onDoorResultChanged(self, result):
- """call on result attribute changed"""
- if result is None:
- return
- for line in result:
- self.appendPlainText(line)
- self.moveCursor(Qt.QTextCursor.End)
-
- def contextMenuEvent(self, event):
- menu = self.createStandardContextMenu()
- clearAction = Qt.QAction("Clear", menu)
- menu.addAction(clearAction)
- if not len(self.toPlainText()):
- clearAction.setEnabled(False)
-
- Qt.QObject.connect(clearAction, Qt.SIGNAL("triggered()"), self.clear)
- menu.exec_(event.globalPos())
-
-
-
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-# Door attributes listeners
-#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
-class DoorAttrListener(Qt.QObject):
-
- def __init__(self, attrName):
- Qt.QObject.__init__(self)
- self.attrName = attrName
- self.attrObj = None
-
- def setDoorName(self, doorName):
- if not self.attrObj is None:
- self.attrObj.removeListener(self)
- self.attrObj = taurus.Attribute(doorName, self.attrName)
- self.attrObj.addListener(self)
-
- def eventReceived(self, src, type, value):
- if (type == taurus.core.taurusbasetypes.TaurusEventType.Error or
- type == taurus.core.taurusbasetypes.TaurusEventType.Config):
- return
- self.emit(Qt.SIGNAL('door%sChanged' % self.attrName), value.value)
-
-if __name__ == "__main__":
- import sys
- import taurus
- from taurus.qt.qtgui.application import TaurusApplication
-
- app = TaurusApplication(sys.argv)
- args = app.get_command_line_args()
-
- doorOutput = DoorOutput()
- if len(args) == 1:
- door = taurus.Device(args[0])
- Qt.QObject.connect(door, Qt.SIGNAL("outputUpdated"), doorOutput.onDoorOutputChanged)
- Qt.QObject.connect(door, Qt.SIGNAL("infoUpdated"), doorOutput.onDoorInfoChanged)
- Qt.QObject.connect(door, Qt.SIGNAL("warningUpdated"), doorOutput.onDoorWarningChanged)
- Qt.QObject.connect(door, Qt.SIGNAL("errorUpdated"), doorOutput.onDoorErrorChanged)
- doorOutput.show()
- sys.exit(app.exec_())
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/__init__.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/__init__.py
deleted file mode 100644
index c0a7c5cf..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from favouriteseditor import FavouritesMacrosEditor
-from historyviewer import HistoryMacrosViewer
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/favouriteseditor.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/favouriteseditor.py
deleted file mode 100644
index 074171fd..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/favouriteseditor.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-favouriteseditor.py:
-"""
-import copy
-
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.container import TaurusWidget
-from taurus.qt.qtcore.configuration import BaseConfigurableClass
-from model import MacrosListModel
-
-class FavouritesMacrosEditor(TaurusWidget):
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.setObjectName(self.__class__.__name__)
- self.registerConfigProperty("toXmlString", "fromXmlString", "favourites")
- self.initComponents()
-
- def initComponents(self):
- self.setLayout(Qt.QHBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
-
- self.list = FavouritesMacrosList(self)
- self._model = MacrosListModel()
- self.list.setModel(self._model)
-
-# self.registerConfigDelegate(self.list)
- self.layout().addWidget(self.list)
-
- actionBar = self.createActionBar()
- self.layout().addLayout(actionBar)
-
- def createActionBar(self):
- layout = Qt.QVBoxLayout()
- layout.setContentsMargins(0, 0, 0, 0)
- deleteButton = Qt.QToolButton()
- deleteButton.setDefaultAction(self.list.removeAction)
- layout.addWidget(deleteButton)
- deleteAllButton = Qt.QToolButton()
- deleteAllButton.setDefaultAction(self.list.removeAllAction)
- layout.addWidget(deleteAllButton)
- moveUpButton = Qt.QToolButton()
- moveUpButton.setDefaultAction(self.list.moveUpAction)
- layout.addWidget(moveUpButton)
- moveDownButton = Qt.QToolButton()
- moveDownButton.setDefaultAction(self.list.moveDownAction)
- layout.addWidget(moveDownButton)
- spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
- layout.addItem(spacerItem)
- return layout
-
- def addMacro(self, macroNode):
- self.list.insertMacro(macroNode)
-
- def toXmlString(self):
- return self.list.toXmlString()
-
- def fromXmlString(self, xmlString):
- self.list.fromXmlString(xmlString)
- favouritesList = self.list.model().list
- macroServerObj = self.getModelObj()
- if macroServerObj is None:
- self.debug("MS IS NONE")
- return
-
- for macroNode in favouritesList:
- macroServerObj.fillMacroNodeAdditionalInfos(macroNode)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-
-
-class FavouritesMacrosList(Qt.QListView, BaseConfigurableClass):
-
- def __init__(self, parent):
- Qt.QListView.__init__(self, parent)
-
- self.setSelectionMode(Qt.QListView.ExtendedSelection)
-
- self.removeAction = Qt.QAction(Qt.QIcon(":/actions/list-remove.svg"), "Remove from favourites", self)
- self.connect(self.removeAction, Qt.SIGNAL("triggered()"), self.removeMacros)
- self.removeAction.setToolTip("Clicking this button will remov selected macros from favourites.")
-
- self.removeAllAction = Qt.QAction(Qt.QIcon(":/places/user-trash.svg"), "Remove all from favourites", self)
- self.connect(self.removeAllAction, Qt.SIGNAL("triggered()"), self.removeAllMacros)
- self.removeAllAction.setToolTip("Clicking this button will remove all macros from favourites.")
-
- self.moveUpAction = Qt.QAction(Qt.QIcon(":/actions/go-up.svg"), "Move up", self)
- self.connect(self.moveUpAction, Qt.SIGNAL("triggered()"), self.upMacro)
- self.moveUpAction.setToolTip("Clicking this button will move the macro up in the favourites hierarchy.")
-
- self.moveDownAction = Qt.QAction(Qt.QIcon(":/actions/go-down.svg"), "Move up", self)
- self.connect(self.moveDownAction, Qt.SIGNAL("triggered()"), self.downMacro)
- self.moveDownAction.setToolTip("Clicking this button will move the macro down in the favourites hierarchy.")
-
- self.disableActions()
-
- def currentChanged(self, current, previous):
- macro = copy.deepcopy(self.currentIndex().internalPointer())
- self.emit(Qt.SIGNAL("favouriteSelected"), macro)
- Qt.QListView.currentChanged(self, current, previous)
-
- def selectionChanged(self, old, new):
- macro = None
- if self.currentIndex().isValid():
- self.removeAllAction.setEnabled(True)
- self.isIndexSelected()
- else:
- self.disableActions()
- Qt.QListView.selectionChanged(self, old, new)
- if len(self.selectedIndexes()) > 1:
- self.moveUpAction.setEnabled(False)
- self.moveDownAction.setEnabled(False)
-
- def isIndexSelected(self):
- if len(self.selectedIndexes()) > 0:
- self.removeAction.setEnabled(True)
- self.moveUpAction.setEnabled(self.model().isUpRowAllowed(self.currentIndex()))
- self.moveDownAction.setEnabled(self.model().isDownRowAllowed(self.currentIndex()))
- else:
- self.removeAction.setEnabled(False)
- self.moveUpAction.setEnabled(False)
- self.moveDownAction.setEnabled(False)
-
- def mousePressEvent(self, e):
- clickedIndex = self.indexAt(e.pos())
- if clickedIndex.isValid():
- macro = copy.deepcopy(self.currentIndex().internalPointer())
- self.emit(Qt.SIGNAL("favouriteSelected"), macro)
- Qt.QListView.mousePressEvent(self, e)
-
- def disableActions(self):
- self.removeAction.setEnabled(False)
- self.removeAllAction.setEnabled(False)
- self.moveUpAction.setEnabled(False)
- self.moveDownAction.setEnabled(False)
-
- def insertMacro(self, macroNode):
- idx = self.model().insertRow(macroNode)
- self.setCurrentIndex(idx)
-
- def removeMacros(self):
- slist = sorted(self.selectedIndexes(), key=lambda index: index.row(), reverse=True)
- for index in slist:
- row = index.row()
- idx = self.model().removeRow(row)
- self.setCurrentIndex(idx)
-
- def removeAllMacros(self):
- self.selectAll()
- slist = sorted(self.selectedIndexes(), key=lambda index: index.row(), reverse=True)
- for index in slist:
- self.model().removeRow(index.row())
-
- def upMacro(self):
- row = self.currentIndex().row()
- idx = self.model().upRow(row)
- self.setCurrentIndex(idx)
-
- def downMacro(self):
- row = self.currentIndex().row()
- idx = self.model().downRow(row)
- self.setCurrentIndex(idx)
-
- def toXmlString(self):
- return self.model().toXmlString()
-
- def fromXmlString(self, xmlString):
- self.model().fromXmlString(xmlString)
-
-
-def test():
- import sys, taurus, time
- from taurus.qt.qtgui.application import TaurusApplication
-
- app = TaurusApplication(sys.argv)
-
- favouritesEditor = FavouritesMacrosEditor()
-
- args = app.get_command_line_args()
- favouritesEditor.setModel(args[0])
- time.sleep(1)
- macroNode = favouritesEditor.getModelObj().getMacroNodeObj(str(args[1]))
- favouritesEditor.addMacro(macroNode)
- favouritesEditor.show()
-
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- test()
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/historyviewer.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/historyviewer.py
deleted file mode 100644
index e89967a6..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/historyviewer.py
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-historyviewer.py:
-"""
-import copy
-
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.container import TaurusWidget
-from taurus.qt.qtcore.configuration import BaseConfigurableClass
-from model import MacrosListModel
-
-class HistoryMacrosViewer(TaurusWidget):
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.setObjectName(self.__class__.__name__)
- self.registerConfigProperty("toXmlString", "fromXmlString", "history")
- self.initComponents()
-
- def initComponents(self):
- self.setLayout(Qt.QHBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
-
- self.list = HistoryMacrosList(self)
- self._model = MacrosListModel()
- self.list.setModel(self._model)
-
-##### self.registerConfigDelegate(self.list)
- self.layout().addWidget(self.list)
-
- actionBar = self.createActionBar()
- self.layout().addLayout(actionBar)
-
- def createActionBar(self):
- layout = Qt.QVBoxLayout()
- layout.setContentsMargins(0, 0, 0, 0)
- deleteAllButton = Qt.QToolButton()
- deleteAllButton.setDefaultAction(self.list.removeAllAction)
- layout.addWidget(deleteAllButton)
- spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
- layout.addItem(spacerItem)
- return layout
-
- def listElementUp(self):
- indexPos = self.list.currentIndex()
- if indexPos.isValid() and indexPos.row() >= 1:
- self.list.setCurrentIndex(indexPos.sibling(indexPos.row() - 1, indexPos.column()))
- else:
- self.selectFirstElement()
-
- def listElementDown(self):
- indexPos = self.list.currentIndex()
- if indexPos.isValid() and indexPos.row() < self._model.rowCount() - 1:
- self.list.setCurrentIndex(indexPos.sibling(indexPos.row() + 1, indexPos.column()))
- elif indexPos.row() == self._model.rowCount() - 1:
- return
- else:
- self.selectFirstElement()
-
- def addMacro(self, macroNode):
- self.list.insertMacro(macroNode)
-
- def toXmlString(self):
- return self.list.toXmlString()
-
- def fromXmlString(self, xmlString):
- self.list.fromXmlString(xmlString)
- historyList = self.list.model().list
- macroServerObj = self.getModelObj()
- if macroServerObj is None:
- return
-
- for macroNode in historyList:
- macroServerObj.fillMacroNodeAdditionalInfos(macroNode)
-
- def selectFirstElement(self):
- self.list.removeAllAction.setEnabled(True)
- self.list.setCurrentIndex(self._model.index(0))
-
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-
-
-class HistoryMacrosList(Qt.QListView, BaseConfigurableClass):
-
- def __init__(self, parent):
- Qt.QListView.__init__(self, parent)
- self.setSelectionMode(Qt.QListView.SingleSelection)
- self.removeAllAction = Qt.QAction(Qt.QIcon(":/places/user-trash.svg"), "Remove all from history", self)
- self.connect(self.removeAllAction, Qt.SIGNAL("triggered()"), self.removeAllMacros)
- self.removeAllAction.setToolTip("Clicking this button will remove all macros from history.")
- self.removeAllAction.setEnabled(False)
-
- def currentChanged(self, current, previous):
- macro = copy.deepcopy(self.currentIndex().internalPointer())
- self.emit(Qt.SIGNAL("historySelected"), macro)
- Qt.QListView.currentChanged(self, current, previous)
-
- def mousePressEvent(self, e):
- clickedIndex = self.indexAt(e.pos())
- if clickedIndex.isValid():
- macro = copy.deepcopy(self.currentIndex().internalPointer())
- self.emit(Qt.SIGNAL("historySelected"), macro)
- self.removeAllAction.setEnabled(True)
- Qt.QListView.mousePressEvent(self, e)
-
- def focusInEvent(self, e):
- if self.model().rowCount() > 0:
- self.removeAllAction.setEnabled(True)
- else:
- self.removeAllAction.setEnabled(False)
-
- def insertMacro(self, macroNode):
- idx = self.model().insertRow(macroNode)
- self.setCurrentIndex(idx)
- self.removeAllAction.setEnabled(True)
-
- def removeAllMacros(self):
- self.selectAll()
- slist = sorted(self.selectedIndexes(), key=lambda index: index.row(), reverse=True)
- for index in slist:
- self.model().removeRow(index.row())
- self.removeAllAction.setEnabled(False)
-
- def toXmlString(self):
- return self.model().toXmlString()
-
- def fromXmlString(self, xmlString):
- self.model().fromXmlString(xmlString)
-
-
-def test():
- import sys, taurus, time
- from taurus.qt.qtgui.application import TaurusApplication
-
- app = TaurusApplication(sys.argv)
-
- historyViewer = HistoryMacrosViewer()
-
- args = app.get_command_line_args()
- historyViewer.setModel(args[0])
- time.sleep(1)
- macroNode = historyViewer.getModelObj().getMacroNodeObj(str(args[1]))
- historyViewer.addMacro(macroNode)
- historyViewer.show()
-
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- test()
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/model.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/model.py
deleted file mode 100644
index 0950c464..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/favouriteseditor/model.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-model.py:
-"""
-
-from taurus.external.qt import Qt
-from lxml import etree
-
-from sardana.taurus.core.tango.sardana import macro
-
-
-class MacrosListModel(Qt.QAbstractListModel):
-
- def __init__(self, parent=None):
- Qt.QAbstractListModel.__init__(self, parent)
- self.list = []
-
- def rowCount(self, parent=Qt.QModelIndex()):
- return len(self.list)
-
- def data(self, index, role):
- if index.isValid() and role == Qt.Qt.DisplayRole:
- macroNode = self.list[index.row()]
- return Qt.QVariant(self.list[index.row()].toSpockCommand())
- else:
- return Qt.QVariant()
-
- def index(self, row, column=0, parent=Qt.QModelIndex()):
- if self.rowCount():
- return self.createIndex(row, column, self.list[row])
- else:
- return Qt.QModelIndex()
-
- def insertRow(self, macroNode, row=0):
- self.beginInsertRows(Qt.QModelIndex(), row, row)
- self.list.insert(row, macroNode)
- self.endInsertRows()
- return self.index(row)
-
- def removeRow(self, row):
- self.beginRemoveRows(Qt.QModelIndex(), row, row)
- self.list.pop(row)
- self.endRemoveRows()
- if row == self.rowCount():
- row = row - 1
- return self.index(row)
-
- def isUpRowAllowed(self, index):
- return index.row() > 0
-
- def upRow(self, row):
- """This method move macro up and returns index with its new position"""
- macroNode = self.list[row]
- self.removeRow(row)
- return self.insertRow(macroNode, row - 1)
-
- def isDownRowAllowed(self, index):
- return index.row() < self.rowCount() - 1
-
- def downRow(self, row):
- """This method move macro down and returns index with its new position"""
- macroNode = self.list[row]
- self.removeRow(row)
- return self.insertRow(macroNode, row + 1)
-
- def toXmlString(self, pretty=False):
- listElement = etree.Element("list")
- for macroNode in self.list:
- listElement.append(macroNode.toXml(withId=False))
- xmlTree = etree.ElementTree(listElement)
- xmlString = etree.tostring(xmlTree, pretty_print=pretty)
- return xmlString
-
- def fromXmlString(self, xmlString):
- listElement = etree.fromstring(xmlString)
- for childElement in listElement.iterchildren("macro"):
- macroNode = macro.MacroNode()
- macroNode.fromXml(childElement)
- self.list.append(macroNode)
- self.reset()
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/globals.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/globals.py
deleted file mode 100644
index b69a8b44..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/globals.py
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-globals.py:
-"""
-
-ORGANIZATION_NAME = "Taurus"
-
-MACROEXECUTOR_APPLICATION_NAME = "macroexecutor"
-SEQUENCER_APPLICATION_NAME = "sequencer"
-
-SEQUENCES_DIRNAME = "Sequences"
-SEQUENCE_DEFAULT_FILENAME = "Untitled.xml"
-
-FAVOURITES_FILENAME = "favourite_macros.xml"
-
-MACROS_HISTORY_FILENAME = ".macros_history"
-MACROS_HISTORY_LENGHT = 5
-
-TITLE_MACROSERVER_DIALOG = "Choose MacroServer"
-TITLE_OUTPUT_DOCK_WIDGET = "Output"
-TITLE_SPOCK_DOCK_WIDGET = "Spock"
-TITLE_DEBUG_DOCK_WIDGET = "Debug"
-TITLE_RESULT_DOCK_WIDGET = "Result"
-TITLE_DESCRIPTION_DOCK_WIDGET = "Macro description"
-TITLE_SEQUENCE_EDITOR_DOCK_WIDGET = "Sequence editor"
-TITLE_MACRO_EXECUTOR_DOCK_WIDGET = "Macro executor"
-
-MENU_FILE = "File"
-MENU_FILE_CONFIGURATION = "Configuration"
-MENU_FILE_NEW = "New"
-MENU_FILE_OPEN = "Open..."
-MENU_FILE_SAVE = "Save"
-MENU_FILE_SAVEAS = "Save as..."
-MENU_FILE_QUIT = "Quit"
-
-MENU_CONTROL = "Control"
-MENU_CONTROL_PLAY_SEQUENCE = "Play sequence"
-MENU_CONTROL_PLAY_MACRO = "Play macro"
-MENU_CONTROL_PAUSE = "Pause"
-MENU_CONTROL_STOP = "Stop"
-
-MENU_FAVOURITES = "Add to favourites"
-
-MENU_VIEW = "View"
-
-MENU_SETTINGS = "Settings"
-MENU_SETTINGS_ONLYSCANS = "Only scan macros"
-
-TIP_MENU_FILE_CONFIGURATION = "Configuration"
-TIP_MENU_FILE_QUIT = "Quit application"
-TIP_MENU_FILE_NEW = "New sequence"
-TIP_MENU_FILE_OPEN = "Open sequence..."
-TIP_MENU_FILE_SAVE = "Save sequence"
-TIP_MENU_FILE_SAVEAS = "Save sequence as..."
-
-TIP_MENU_CONTROL_PLAY_SEQUENCE = "Play sequence"
-TIP_MENU_CONTROL_PLAY_MACRO = "Play macro"
-TIP_MENU_CONTROL_PAUSE = "Pause"
-TIP_MENU_CONTROL_STOP = "Stop"
-
-TIP_MENU_FAVOURITES = "Add to favourites"
-
-
-SHORTCUT_MENU_FILE_CONFIGURATION = "F2"
-SHORTCUT_MENU_FILE_NEW = "Ctrl+N"
-SHORTCUT_MENU_FILE_OPEN = "Ctrl+O"
-SHORTCUT_MENU_FILE_SAVE = "Ctrl+S"
-SHORTCUT_MENU_FILE_SAVEAS = "Ctrl+Shift+S"
-SHORTCUT_MENU_FILE_QUIT = "Ctrl+Q"
-
-SCAN_MACROS_FILTER = "scan"
-ALLOWS_HOOKS_FILTER = 'allowsHooks'
-
-
-PARAM_REPEAT = "ParamRepeat"
-
-PARAM_OBJECT = "Object"
-PARAM_MOTOR = "Motor"
-PARAM_PSEUDOMOTOR = "PseudoMotor"
-PARAM_MOVEABLE = "Moveable"
-PARAM_CONTROLLER_CLASS = "ControllerClass"
-PARAM_CONTROLLER = "Controller"
-PARAM_MOTOR_PARAM = "MotorParam"
-PARAM_MEASUREMENT_GROUP = "MeasurementGroup"
-PARAM_IO_REGISTER = "IORegister"
-PARAM_COMMUNICATION_CHANNEL = "ComChannel"
-PARAM_EXPERIMENTAL_CHANNEL = "ExpChannel"
-PARAM_MACRO_CODE = "MacroCode"
-PARAM_MACRO_CLASS = "MacroClass"
-PARAM_MACRO_FUNCTION = "MacroFunction"
-PARAM_MACRO_LIBRARY = "MacroLibrary"
-
-
-PARAM_STRING = "String"
-
-PARAM_FILENAME = "FileName"
-
-PARAM_FILENAME_2 = "Filename"
-
-PARAM_INTEGER = "Integer"
-
-PARAM_FLOAT = "Float"
-
-PARAM_FILEDIALOG = "File"
-
-PARAM_USERNAME = "User"
-
-PARAM_BOOLEAN = "Boolean"
-
-MAX_REPEATS = "max"
-MIN_REPEATS = "min"
-
-EDITOR_COMBOBOX_PARAMS = [PARAM_OBJECT,
- PARAM_MOTOR,
- PARAM_PSEUDOMOTOR,
- PARAM_MOVEABLE,
- PARAM_CONTROLLER_CLASS,
- PARAM_CONTROLLER,
- PARAM_MOTOR_PARAM,
- PARAM_MEASUREMENT_GROUP,
- PARAM_IO_REGISTER,
- PARAM_COMMUNICATION_CHANNEL,
- PARAM_EXPERIMENTAL_CHANNEL,
- PARAM_MACRO_CODE,
- PARAM_MACRO_CLASS,
- PARAM_MACRO_FUNCTION,
- PARAM_MACRO_LIBRARY]
-
-EDITOR_LINEEDIT_PARAMS = [PARAM_STRING,
- PARAM_FILENAME,
- PARAM_FILENAME_2,
- "Env"]
-
-EDITOR_SPINBOX_PARAMS = [PARAM_INTEGER]
-
-EDITOR_DOUBLESPINBOX_PARAMS = [PARAM_FLOAT]
-
-EDITOR_FILEDIALOG_PARAMS = [PARAM_FILEDIALOG]
-
-EDITOR_BOOLEAN_PARAMS = [PARAM_BOOLEAN]
-
-EDITOR_NONEDITABLE_PARAMS = [PARAM_USERNAME]
-
-TAG_MACRO = 'macro'
-TAG_PARAM = 'param'
-TAG_PARAMREPEAT = 'paramrepeat'
-TAG_REPEAT = 'repeat'
-TAG_PARAMS = 'params'
-TAG_SEQUENCE = 'sequence'
-TAG_ALLOWED_HOOK = 'allowedHook'
-TAG_HOOK = 'hookPlaces'
-
-ATTRIBUTE_NAME = 'name'
-ATTRIBUTE_VALUE = 'value'
-ATTRIBUTE_INDEX = 'nr'
-ATTRIBUTE_DESCRIPTION = 'description'
-ATTRIBUTE_DEFVALUE = 'defvalue'
-ATTRIBUTE_TYPE = 'type'
-ATTRIBUTE_ALLOWEDHOOKS = 'allowedHooks'
-ATTRIBUTE_HASPARAMS = 'hasParams'
-ATTRIBUTE_MIN = 'min'
-ATTRIBUTE_MAX = 'max'
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrobutton.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrobutton.py
deleted file mode 100644
index 4fb32d46..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrobutton.py
+++ /dev/null
@@ -1,423 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-This module provides a button for executing macros
-"""
-
-__all__ = ['MacroButton']
-
-import functools
-import uuid
-
-import PyTango
-
-import taurus
-from taurus.core import TaurusEventType, TaurusDevice
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.container import TaurusWidget
-from taurus.qt.qtgui.base import TaurusBaseWidget
-from taurus.qt.qtgui.button import TaurusCommandButton
-from taurus.qt.qtgui.dialog import ProtectTaurusMessageBox
-from taurus.core.util.colors import DEVICE_STATE_PALETTE
-from taurus.qt.qtgui.util.ui import UILoadable
-
-
-class DoorStateListener(Qt.QObject):
- '''A listener of Change and periodic events from a Door State attribute.
- It converts the received Tango events and emits a Qt signal
- '''
-
- __pyqtSignals__ = ["doorStateChanged"]
-
- def eventReceived(self, evt_src, evt_type, evt_value):
- if evt_type not in (TaurusEventType.Change, TaurusEventType.Periodic):
- return
- door_state = evt_value.value
- self.emit(Qt.SIGNAL('doorStateChanged'), door_state)
-
-
-@UILoadable(with_ui='ui')
-class MacroButton(TaurusWidget):
- ''' A button to execute/pause/stop macros. The model must be a valid door.
-
- .. todo:: Not implemented but will be needed: set an icon
-
- .. todo:: It may be useful to have all the streams from qdoor available
- somehow (right-click?)
- '''
-
- __pyqtSignals__ = ['statusUpdated', 'resultUpdated']
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.loadUi()
- self.door = None
- self.door_state_listener = None
- self.macro_name = ''
- self.macro_args = []
- self.macro_id = None
- self.running_macro = None
-
- self.ui.progress.setValue(0)
-
- self.ui.button.setCheckable(True)
- self.connect(self.ui.button, Qt.SIGNAL('clicked()'),
- self._onButtonClicked)
-
- def toggleProgress(self, visible):
- '''deprecated'''
- self.warning('toggleProgress is deprecated. Use showProgress')
- self.showProgress(visible)
-
- def showProgress(self, visible):
- '''Set whether the progress bar is shown
-
- :param visible: (bool) If True, the progress bar is shown. Otherwise it
- is hidden'''
- self.ui.progress.setVisible(visible)
-
- def setModel(self, model):
- '''
- reimplemented from :class:`TaurusWidget`. A door device name is
- expected as the model
- '''
- TaurusWidget.setModel(self, model)
- if self.door is not None:
- self.disconnect(self.door, Qt.SIGNAL('macroStatusUpdated'), self._statusUpdated)
- self.disconnect(self.door, Qt.SIGNAL('resultUpdated'), self._resultUpdated)
-
- # disable management of Door Tango States
- self.door.getAttribute('State').removeListener(self.door_state_listener)
- self.disconnect(self.door_state_listener, Qt.SIGNAL('doorStateChanged'), self._doorStateChanged)
- self.door_state_listener = None
-
- try: self.door = taurus.Device(model)
- except: return
-
- self.connect(self.door, Qt.SIGNAL('macroStatusUpdated'), self._statusUpdated)
- self.connect(self.door, Qt.SIGNAL('resultUpdated'), self._resultUpdated)
-
- # Manage Door Tango States
- self.door_state_listener = DoorStateListener()
- self.connect(self.door_state_listener, Qt.SIGNAL('doorStateChanged'), self._doorStateChanged)
- self.door.getAttribute('State').addListener(self.door_state_listener)
-
- def _doorStateChanged(self, state):
- '''slot called on door state changes'''
- color = '#' + DEVICE_STATE_PALETTE.hex(state)
- stylesheet = 'QFrame{border: 4px solid %s;}' % color
- self.ui.frame.setStyleSheet(stylesheet)
-
- # In case state is not ON, and macro not triggered by the button, disable it
- door_available = True
- if state not in [PyTango.DevState.ON, PyTango.DevState.ALARM] and not self.ui.button.isChecked():
- door_available = False
-
- self.ui.button.setEnabled(door_available)
- self.ui.progress.setEnabled(door_available)
-
-
- def _statusUpdated(self, *args):
- '''slot called on status changes'''
- # SHOULD SEE THE DOCUMENTATION ABOUT THE ARGS AND ALSO THE STATUS STATE MACHINE
- # ARGS FORMAT IS (GUESSING WITH PRINT STATEMENTS)
- # e.g. ((<sardana.taurus.core.tango.sardana.macro.Macro object at 0x7f29300bc210>, [{u'step': 100.0, u'state': u'stop', u'range': [0.0, 100.0], u'id': u'b226f5e8-c807-11e0-8abe-001d0969db5b'}]),)
- # ( (MacroObj, [status_dict, .?.]), .?.)
-
- # QUESTIONS: THIS MACRO OBJECT HAS ALOS STEP, RANGE, ...
- # AND ALSO THE STATUS DICT... WHICH SHOULD I USE?
-
- first_tuple = args[0]
- self.running_macro = first_tuple[0]
-
- status_dict = first_tuple[1][0]
- # KEYS RECEIVED FROM A 'SCAN' MACRO AND A 'TWICE' MACRO: IS IT GENERAL ?!?!?!
- macro_id = status_dict['id']
- # if macro id is unknown ignoring this signal
- if macro_id is None:
- return
- # check if we have launch this macro, otherwise ignore the signal
- if macro_id != str(self.macro_id):
- return
- state = status_dict['state']
- step = status_dict['step']
- step_range = status_dict['range']
-
- # Update progress bar
- self.ui.progress.setMinimum(step_range[0])
- self.ui.progress.setMaximum(step_range[1])
- self.ui.progress.setValue(step)
-
- if state in ['stop', 'abort', 'finish', 'alarm']:
- self.ui.button.setChecked(False)
-
- self.emit(Qt.SIGNAL('statusUpdated'), status_dict)
-
- def _resultUpdated(self, *args):
- '''slot called on result changes'''
- # ARGS APPEAR TO BE EMPTY... SHOULD THEY CONTAIN THE RESULT ?!?!?!
- # I have to rely on the 'macro object' received in the last status update
- if self.running_macro is None:
- return
- result = self.running_macro.getResult()
- self.emit(Qt.SIGNAL('resultUpdated'), result)
-
- def setText(self, text):
- '''set the button text
-
- :param text: (str) text for the button
- '''
- self.setButtonText(text)
-
- def setButtonText(self, text):
- '''same as :meth:`setText`
- '''
- # SHOULD ALSO BE POSSIBLE TO SET AN ICON
- self.ui.button.setText(text)
-
- def setMacroName(self, name):
- '''set the name of the macro to be executed
-
- :param name: (str) text for the button
- '''
- self.macro_name = str(name)
-
- def updateMacroArgument(self, index, value):
- '''change a given argument
-
- :param index: (int) positional index for this argument
- :param value: (str) value for this argument
- '''
- #make sure that the macro_args is at least as long as index
- while len(self.macro_args) < index + 1:
- self.macro_args.append('')
- #update the given argument
- self.macro_args[index] = str(value)
-
- def updateMacroArgumentFromSignal(self, index, obj, signal):
- '''deprecated'''
- msg = 'updateMacroArgumentFromSignal is deprecated. connectArgEditors'
- self.warning(msg)
- self.connect(obj, signal,
- functools.partial(self.updateMacroArgument, index))
-
- def connectArgEditors(self, signals):
- '''Associate signals to argument changes.
-
- :param signals: (seq<tuple>) An ordered sequence of (`obj`, `sig`)
- tuples , where `obj` is a parameter editor object and
- `sig` is a signature for a signal emitted by `obj` which
- provides the value of a parameter as its argument.
- Each (`obj`, `sig`) tuple is associated to parameter
- corresponding to its position in the `signals` sequence.
- '''
-
- for i,(obj,sig) in enumerate(signals):
- self.connect(obj, Qt.SIGNAL(sig),
- functools.partial(self.updateMacroArgument, i))
-
- def _onButtonClicked(self):
- if self.ui.button.isChecked():
- self.runMacro()
- else:
- self.abort()
-
- @ProtectTaurusMessageBox(msg='Error while executing the macro.')
- def runMacro(self):
- '''execute the macro with the current arguments'''
- if self.door is None:
- return
-
- # Thanks to gjover for the hint... :-D
- #macro_cmd = self.macro_name + ' ' + ' '.join(self.macro_args)
- self.macro_id = uuid.uuid1()
- macro_cmd_xml = '<macro name="%s" id="%s">\n' % \
- (self.macro_name, self.macro_id)
- for arg in self.macro_args:
- macro_cmd_xml += '<param value="%s"/>\n' % arg
- macro_cmd_xml += '</macro>'
- try:
- #self.door.runMacro(macro_cmd)
- self.door.runMacro(macro_cmd_xml)
- except Exception, e:
- self.ui.button.setChecked(False)
- raise e
-
- def abort(self):
- '''abort the macro.'''
- if self.door is None:
- return
- self.door.PauseMacro()
- # Since this could be done by error (impatient users clicking more than once)
- # we provide a warning message that does not make the process too slow
- # It may also be useful and 'ABORT' at TaurusApplication level (macros+motions+acquisitions)
- title = 'Aborting macro'
- message = 'The following macro is still running:\n\n'
- message += '%s %s\n\n' % (self.macro_name, ' '.join(self.macro_args))
- message += 'Are you sure you want to abort?\n'
- buttons = Qt.QMessageBox.Ok | Qt.QMessageBox.Cancel
- ans = Qt.QMessageBox.warning(self, title, message, buttons, Qt.QMessageBox.Ok)
- if ans == Qt.QMessageBox.Ok:
- self.door.abort(synch=True)
- else:
- self.ui.button.setChecked(True)
- self.door.ResumeMacro()
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- '''reimplemented from :class:`TaurusWidget`'''
- return {'container': False,
- 'group': 'Taurus Sardana',
- 'module': 'taurus.qt.qtgui.extra_macroexecutor',
- 'icon': ':/designer/pushbutton.png'}
-
-
-class MacroButtonAbortDoor(Qt.QPushButton, TaurusBaseWidget):
- '''Deprecated class. Instead use TaurusCommandButton.
- A button for aborting macros on a door
- '''
- #todo: why not inheriting from (TaurusBaseComponent, Qt.QPushButton)?
- def __init__(self, parent=None, designMode=False):
- name = self.__class__.__name__
- self.call__init__wo_kw(Qt.QPushButton, parent)
- self.call__init__(TaurusBaseWidget, name, designMode=designMode)
- self.warning('Deprecation warning: use TaurusCommandButton class ' +\
- 'instead of MacroButtonAbortDoor')
-
- self.setText('Abort')
- self.setToolTip('Abort Macro')
- self.connect(self, Qt.SIGNAL('clicked()'), self.abort)
-
- def getModelClass(self):
- '''reimplemented from :class:`TaurusBaseWidget`'''
- return TaurusDevice
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to abort the macro.')
- def abort(self):
- '''stops macros'''
- door = self.getModelObj()
- if door is not None:
- door.stopMacro()
-
-
-if __name__ == '__main__':
- import sys
- from taurus.qt.qtgui.application import TaurusApplication
- from taurus.core.util.argparse import get_taurus_parser
- from sardana.macroserver.macros.test import SarDemoEnv
-
- parser = get_taurus_parser()
- parser.set_usage("python macrobutton.py [door_name]")
- parser.set_description("Macro button for macro execution")
-
- app = TaurusApplication(app_name="macrobutton",
- app_version=taurus.Release.version)
-
- args = app.get_command_line_args()
-
- if len(args) < 1:
- parser.print_help(sys.stderr)
- sys.exit(1)
-
- door_name = args[0]
-
- w = Qt.QWidget()
- w.setLayout(Qt.QGridLayout())
-
- col = 0
- w.layout().addWidget(Qt.QLabel('macro name'), 0, col)
- macro_name = Qt.QLineEdit()
- w.layout().addWidget(macro_name, 1, col)
-
- _argEditors = []
- for a in range(5):
- col += 1
- w.layout().addWidget(Qt.QLabel('arg%d' % a), 0, col)
- argEdit = Qt.QLineEdit()
- w.layout().addWidget(argEdit, 1, col)
- _argEditors.append(argEdit)
-
-
- from sardana.taurus.qt.qtcore.tango.sardana.macroserver import registerExtensions
- registerExtensions()
- mb = MacroButton()
-
- mb.setModel(door_name)
-
- w.layout().addWidget(mb, 2, 0, 2, 7)
-
- w.layout().addWidget(Qt.QLabel('Result:'), 4, 0)
-
- result_label = Qt.QLabel()
- w.layout().addWidget(result_label, 4, 1, 1, 5)
-
- show_progress = Qt.QCheckBox('Progress')
- show_progress.setChecked(True)
- w.layout().addWidget(show_progress, 5, 0)
-
- mb_abort = TaurusCommandButton(command = 'StopMacro',
- icon=':/actions/media_playback_stop.svg')
- mb_abort.setModel(door_name)
-
- w.layout().addWidget(mb_abort, 5, 1)
-
- # Change macro name
- Qt.QObject.connect(macro_name, Qt.SIGNAL('textChanged(QString)'), mb.setMacroName)
- Qt.QObject.connect(macro_name, Qt.SIGNAL('textChanged(QString)'), mb.setButtonText)
-
- # connect the argument editors
- signals = [(e, 'textChanged(QString)') for e in _argEditors]
- mb.connectArgEditors(signals)
-
- def update_result(result):
- result_label.setText(str(result))
-
- def toggle_progress(showProgress):
- visible = show_progress.isChecked()
- mb.toggleProgress(visible)
-
- # Toggle progressbar
- Qt.QObject.connect(show_progress, Qt.SIGNAL('stateChanged(int)'), toggle_progress)
- # Update possible macro result
- Qt.QObject.connect(mb, Qt.SIGNAL('resultUpdated'), update_result)
-
- # Obtain a demo motor
- try:
- demo_motor_name = SarDemoEnv(door_name).getMotors()[0]
- except Exception, e:
- from taurus.core.util.log import warning, debug
- warning('It was unable to obtain a demo motor')
- debug('Details: %s' % e.message)
- demo_motor_name = ''
-
- # Since everything is now connected, the parameters will be updated
- macro_name.setText('ascan')
- macro_params = [demo_motor_name, '0', '1', '5', '.1']
- for e,v in zip(_argEditors, macro_params):
- e.setText(v)
-
- w.show()
- sys.exit(app.exec_())
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrodescriptionviewer.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrodescriptionviewer.py
deleted file mode 100644
index da505267..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macrodescriptionviewer.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-macrodescriptionviewer.py:
-"""
-
-import taurus.core
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.base import TaurusBaseWidget
-
-
-class TaurusMacroDescriptionViewer(Qt.QTextEdit, TaurusBaseWidget):
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- name = "TaurusMacroDescriptionView"
- self.call__init__wo_kw(Qt.QTextEdit, parent)
- self.call__init__(TaurusBaseWidget, name)
- self.setReadOnly(True)
- self.setFont(Qt.QFont("Courier", 9))
-
- def defineStyle(self):
- """ Defines the initial style for the widget """
- self.updateStyle()
-
- def getModelClass(self):
- return taurus.core.taurusdevice.TaurusDevice
-
- def updateStyle(self):
- self.update()
-
- def onMacroNameChanged(self, macroName):
- """Can be connected to an event emitted after macro name was changed.
- As an argument receives macroName and ask BaseMacroServer object
- about already prepared and stored in MacroInfoObj object macro description"""
- macroServer = self.getModelObj()
-
- if macroServer is None or macroName is None or macroName == "":
- self.setText("")
- return
-
- self.setText(str(macroServer.getMacroInfoObj(macroName).doc))
-
- def getFormatedToolTip(self, cache=True):
- """This method was overridden to get rid of the default tooltip of TaurusWidget"""
- return ""
-
-
- model = Qt.pyqtProperty("QString",
- TaurusBaseWidget.getModel,
- TaurusBaseWidget.setModel,
- TaurusBaseWidget.resetModel)
-
- useParentModel = Qt.pyqtProperty("bool",
- TaurusBaseWidget.getUseParentModel,
- TaurusBaseWidget.setUseParentModel,
- TaurusBaseWidget.resetUseParentModel)
-
-
-def test():
- import sys
- from sardana.taurus.core.tango.sardana.macroserver import registerExtensions
- registerExtensions()
- app = Qt.QApplication(sys.argv)
- taurusMacroDescriptionView = TaurusMacroDescriptionViewer(designMode=1)
- if len(sys.argv) != 2:
- taurusMacroDescriptionView.setModel("macroserver/zreszela/1")
- else:
- taurusMacroDescriptionView.setModel(sys.argv[1])
- taurusMacroDescriptionView.onMacroChanged("mv")
- taurusMacroDescriptionView.show()
- sys.exit(app.exec_())
-
-
-if __name__ == "__main__":
- test()
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroeditor.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroeditor.py
deleted file mode 100644
index 0ec20c26..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroeditor.py
+++ /dev/null
@@ -1,239 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from taurus.external.qt import Qt
-from PyQt4 import Qsci
-
-from taurus.qt.qtgui.resource import getThemeIcon
-
-
-class MacroEditor(Qsci.QsciScintilla):
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- Qsci.QsciScintilla.__init__(self, parent)
-
- self.textEdit = Qsci.QsciScintilla()
- self.textEdit.setAutoCompletionThreshold(1)
- self.textEdit.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
- self.textEdit.setAutoIndent(True)
- self.textEdit.setCallTipsStyle(Qsci.QsciScintilla.CallTipsContext)
- self.textEdit.setCallTipsVisible(0)
- self.pythonLexer = Qsci.QsciLexerPython(self.textEdit)
- self.api = Qsci.QsciAPIs(self.pythonLexer)
- self.api.add(Qt.QString("dupa(a,b)this is function dupa"))
- self.api.prepare()
- self.pythonLexer.setAPIs(self.api)
- self.textEdit.setLexer(self.pythonLexer)
-
- self.newAction = Qt.QAction(getThemeIcon("document-new"), "New", self)
- self.connect(self.newAction, Qt.SIGNAL("triggered()"), self.newFile)
- self.newAction.setToolTip("Create new file")
- self.newAction.setShortcut("Ctrl+N")
-
- self.openAction = Qt.QAction(getThemeIcon("document-open"), "Open", self)
- self.connect(self.openAction, Qt.SIGNAL("triggered()"), self.openFile)
- self.openAction.setToolTip("Open existing file")
- self.openAction.setShortcut("Ctrl+O")
-
- self.saveAction = Qt.QAction(getThemeIcon("document-save"), "Save", self)
- self.connect(self.saveAction, Qt.SIGNAL("triggered()"), self.saveFile)
- self.saveAction.setToolTip("Save document to disk")
- self.saveAction.setShortcut("Ctrl+S")
-
- self.saveAsAction = Qt.QAction(getThemeIcon("document-save-as"), "Save as...", self)
- self.connect(self.saveAsAction, Qt.SIGNAL("triggered()"), self.saveFile)
- self.saveAsAction.setToolTip("Save document under a new name")
-
- self.cutAction = Qt.QAction(getThemeIcon("edit-cut"), "Cut", self)
- self.connect(self.cutAction, Qt.SIGNAL("triggered()"), self.cut)
- self.cutAction.setToolTip("Cut current selection's contents to the clipboard")
- self.cutAction.setShortcut("Ctrl+X")
- self.cutAction.setEnabled(False)
-
- self.copyAction = Qt.QAction(getThemeIcon("edit-copy"), "Copy", self)
- self.connect(self.copyAction, Qt.SIGNAL("triggered()"), self.copy)
- self.copyAction.setToolTip("Copy current selection's contents to the clipboard")
- self.copyAction.setShortcut("Ctrl+C")
- self.copyAction.setEnabled(False)
-
- self.pasteAction = Qt.QAction(getThemeIcon("edit-paste"), "Paste", self)
- self.connect(self.pasteAction, Qt.SIGNAL("triggered()"), self.paste)
- self.pasteAction.setToolTip("Paste the clipboard's contents into the current selection")
- self.pasteAction.setShortcut("Ctrl+V")
-
- self.aboutAction = Qt.QAction("About", self)
- self.connect(self.aboutAction, Qt.SIGNAL("triggered()"), self.about)
- self.aboutAction.setToolTip("Show the application's About box")
-
- self.connect(self.textEdit, Qt.SIGNAL("copyAvailable(bool)"), self.cutAction.setEnabled)
- self.connect(self.textEdit, Qt.SIGNAL("copyAvailable(bool)"), self.copyAction.setEnabled)
-
- self.setCurrentFile("")
-
- def closeEvent(self, event):
- if self.maybeSave():
-# self.writeSettings()
- event.accept()
- else:
- event.ignore()
-
- def newFile(self):
- if self.maybeSave():
- self.textEdit.clear()
- self.setCurrentFile("")
-
- def openFile(self):
- if self.maybeSave():
- fileName = Qt.QFileDialog.getOpenFileName(self)
- if not fileName is None and file != "":
- self.loadFile(fileName)
-
- def saveFile(self):
- if self.curFile == "":
- return self.__saveAs()
- else:
- return self.__saveFile(self.curFile)
-
- def __saveAs(self):
- self.fileName = Qt.QFileDialog.getSaveFileName(self)
- if self.fileName == "":
- return False
- return self.__saveFile(self.fileName)
-
- def about(self):
- Qt.QMessageBox.about(self, "About MacroEditor", "The MacroEditor by Zbigniew Reszela")
-
- def documentWasModified(self):
- self.setWindowModified(self.textEdit.isModified())
-
- def createMenus(self):
- fileMenu = self.menuBar().addMenu("File")
- fileMenu.addAction(self.newAction)
- fileMenu.addAction(self.openAction)
- fileMenu.addAction(self.saveAction)
- fileMenu.addAction(self.saveAsAction)
-
- editMenu = self.menuBar().addMenu("Edit")
- editMenu.addAction(self.cutAction)
- editMenu.addAction(self.copyAction)
- editMenu.addAction(self.pasteAction)
-
- self.menuBar().addSeparator()
-
- helpMenu = self.menuBar().addMenu("&Help")
- helpMenu.addAction(self.aboutAction)
-
-# def createToolBars(self):
-# fileToolBar = self.addToolBar("File")
-# fileToolBar.setIconSize(Qt.QSize(36,36))
-# fileToolBar.addAction(self.newAction)
-# fileToolBar.addAction(self.openAction)
-# fileToolBar.addAction(self.saveAction)
-# fileToolBar.addAction(self.saveAsAction)
-#
-# editToolBar = self.addToolBar("Edit")
-# editToolBar.setIconSize(Qt.QSize(36,36))
-# editToolBar.addAction(self.cutAction)
-# editToolBar.addAction(self.copyAction)
-# editToolBar.addAction(self.pasteAction)
-
- def createStatusBar(self):
- self.statusBar().showMessage("Ready")
-
- def maybeSave(self):
- if self.textEdit.isModified():
- ret = Qt.QMessageBox.warning(self, "MacroEditor",
- "The document has been modified\nDo you want to save your changes?",
- Qt.QMessageBox.Yes | Qt.QMessageBox.Default,
- Qt.QMessageBox.No,
- Qt.QMessageBox.Cancel | Qt.QMessageBox.Escape)
- if ret == Qt.QMessageBox.Yes:
- return self.save()
- elif ret == Qt.QMessageBox.Cancel:
- return False
- return True
-
- def loadFile(self, fileName):
- try:
- fileHandle = open(fileName, 'r')
- except IOError, e:
- Qt.QMessageBox.warning(self, "MacroEditor", "Cannot read file %s:\n%s." % (fileName, e))
- return False
- fileContents = fileHandle.read()
- Qt.QApplication.setOverrideCursor(Qt.Qt.WaitCursor)
- self.textEdit.setText(fileContents)
- Qt.QApplication.restoreOverrideCursor()
-
- self.setCurrentFile(fileName)
- self.statusBar().showMessage("File loaded", 2000)
-
- def __saveFile(self, fileName):
- try:
- file = open(fileName, 'w')
- except IOError, e:
- Qt.QMessageBox.warning(self, "MacroEditor", "Cannot write file %s:\n%s." % (fileName, e))
- return False
- Qt.QApplication.setOverrideCursor(Qt.Qt.WaitCursor)
- file.write(self.textEdit.text())
- Qt.QApplication.restoreOverrideCursor()
- self.setCurrentFile(fileName)
- self.statusBar().showMessage(("File saved"), 2000)
- return True
-
- def setCurrentFile(self, fileName):
- self.curFile = fileName
- self.textEdit.setModified(False)
- self.setWindowModified(False)
-
- if self.curFile == "":
- shownName = "untitled.txt"
- else:
- shownName = self.strippedName(self.curFile)
- self.setWindowTitle("%s[*] - %s" % (shownName, "MacroExecutor"))
-
- def strippedName(self, fullFileName):
- return Qt.QFileInfo(fullFileName).fileName()
-
- def cut(self):
- pass
-
- def copy(self):
- pass
-
- def paste(self):
- pass
-
-
-def test():
- import sys
- app = Qt.QApplication(sys.argv)
- macroEditor = MacroEditor()
- macroEditor.show()
- sys.exit(app.exec_())
-
-
-if __name__ == "__main__":
- test()
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroexecutor.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroexecutor.py
deleted file mode 100644
index e073f0e5..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroexecutor.py
+++ /dev/null
@@ -1,997 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-sequenceeditor.py:
-"""
-
-import sys
-from copy import deepcopy
-
-import PyTango
-
-from taurus.external.qt import Qt
-from taurus import Device
-from taurus.qt.qtgui.container import TaurusWidget, TaurusMainWindow, TaurusBaseContainer
-from taurus.qt.qtgui.display import TaurusLed
-from taurus.qt.qtgui.dialog import TaurusMessageBox
-from taurus.qt.qtgui.resource import getIcon, getThemeIcon
-
-from sardana.taurus.core.tango.sardana import macro
-from sardana.taurus.core.tango.sardana.macro import MacroRunException
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor import ParamEditorManager, ParamEditorModel, StandardMacroParametersEditor
-
-from .favouriteseditor import FavouritesMacrosEditor, HistoryMacrosViewer
-from .common import MacroComboBox, MacroExecutionWindow, standardPlotablesFilter
-
-
-class MacroProgressBar(Qt.QProgressBar):
-
- def __init__(self, parent=None):
- Qt.QProgressBar.__init__(self, parent)
-
-class SpockCommandWidget(Qt.QLineEdit, TaurusBaseContainer):
- def __init__(self, name, parent=None, designMode=False):
- #self.newValue - is used as a flag to indicate whether a controlUp controlDown actions are used to iterate existing element or put new one
- #self.disableEditMode - flag, used to disable edition, when user enters name of the macro which is not valid (not allowed to edit in the yellow line)
- # switches off validation
- #disableSpockCommandUpdate - flag, it disables updates of the model when macro is edited by macroEditor
-
- Qt.QLineEdit.__init__(self, parent)
- TaurusBaseContainer.__init__(self, name, parent, designMode)
-
- self._model = None
- self.setFont(Qt.QFont("Courier", 9))
- palette = Qt.QPalette()
- palette.setColor(Qt.QPalette.Base, Qt.QColor('yellow'))
- self.setPalette(palette)
- self.currentIndex = Qt.QModelIndex()
- self.newValue = False
- self.disableSpockCommandUpdate = False
- self.disableEditMode = True
- self.setEnabled(False)
-
- self.setActions()
- self.connect(self, Qt.SIGNAL("textChanged(const QString &)"), self.textChanged)
- self.connect(self, Qt.SIGNAL("returnPressed()"), self.returnPressed)
-
- def setActions(self):
- self._downAction = Qt.QAction("downAction", self)
- self._upAction = Qt.QAction("upAction", self)
- self._ctrlDownAction = Qt.QAction("controlDownAction", self)
- self._ctrlUpAction = Qt.QAction("controlUpAction", self)
-
- self._ctrlDownAction.setShortcut(Qt.QKeySequence(Qt.Qt.CTRL + Qt.Qt.Key_Down))
- self._ctrlUpAction.setShortcut(Qt.QKeySequence(Qt.Qt.CTRL + Qt.Qt.Key_Up))
- self._downAction.setShortcuts([Qt.Qt.Key_Down])
- self._upAction.setShortcuts([Qt.Qt.Key_Up])
-
- self._ctrlDownAction.setShortcutContext (Qt.Qt.WidgetShortcut)
- self._ctrlUpAction.setShortcutContext (Qt.Qt.WidgetShortcut)
- self._downAction.setShortcutContext (Qt.Qt.WidgetShortcut)
- self._upAction.setShortcutContext (Qt.Qt.WidgetShortcut)
-
- self.addAction(self._ctrlDownAction)
- self.addAction(self._ctrlUpAction)
- self.addAction(self._downAction)
- self.addAction(self._upAction)
- self.connect(self._downAction, Qt.SIGNAL("triggered()"), self.downAction)
- self.connect(self._upAction, Qt.SIGNAL("triggered()"), self.upAction)
- self.connect(self._ctrlDownAction, Qt.SIGNAL("triggered()"), self.controlDownAction)
- self.connect(self._ctrlUpAction, Qt.SIGNAL("triggered()"), self.controlUpAction)
-
- def setCommand(self):
- command = self._model.toSpockCommand()
- command = command.replace("None", "").strip()
- if not self.disableSpockCommandUpdate:
- self.setText(command)
-
- def setModel(self, model):
- enable = bool(model)
- self.disableEditMode = not enable
- self.setEnabled(enable)
- self._model = model
- self.connect(self._model, Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.setCommand)
- self.connect(self._model, Qt.SIGNAL("modelReset()"), self.setCommand)
-
- def model(self):
- return self._model
-
- def getIndex(self, elementNumber=-1):
- #Returns QModelIndex of the required element (number of single parameter). If the elementNumber == -1 next single parameter index is returned.
- if elementNumber == -1:
- ix = self.currentIndex
- elementNumber = 1
- elif elementNumber == 0:
- return Qt.QModelIndex()
- else:
- ix = Qt.QModelIndex()
-
- (col, row, parentIdx) = (ix.column(), ix.row(), ix.parent())
- #to start from second column
- if col == -1 and row == -1:
- ix = self.forwardIdx(0, 1, ix)
- for i in range (0, elementNumber):
- #This condition in case we start tabbing with cursor on first column
- if col == 0:
- currentNode = self.model().nodeFromIndex(ix)
- if isinstance(currentNode, macro.SingleParamNode):
- nextIdx = self.forwardIdx(row, 1, parentIdx)
- else:
- nextIdx = self.forwardIdx(0, 1, ix)
- else:
- nextIdx = self.forwardIdx(row + 1, 1, parentIdx)
- #this condition in case there is no next index and we want to pass focus
- #to next widget in parent obj
- if nextIdx == "term":
- return Qt.QModelIndex()
- ix = nextIdx
- (col, row, parentIdx) = (ix.column(), ix.row(), ix.parent())
- return ix
-
- def forwardIdx(self, row, col, parentIdx):
- #This method is moving down the tree to get next SingleParamNode index.
- try:
- proposalIdx = self.model().index(row, col, parentIdx)
- except AssertionError:
-
- if parentIdx.row() == -1:
- return Qt.QModelIndex()
- grandParentIdx = parentIdx.parent()
- return self.forwardIdx(parentIdx.row() + 1, col, grandParentIdx)
-
- proposalNode = self.model().nodeFromIndex(proposalIdx)
-
- if isinstance(proposalNode, macro.SingleParamNode):
- return proposalIdx
- elif isinstance(proposalNode, macro.RepeatNode):
- return self.forwardIdx(0, 1, proposalIdx)
- elif isinstance(proposalNode, macro.RepeatParamNode):
- if len(proposalNode) > 0:
- return self.forwardIdx(0, 1, proposalIdx)
- else:
- return self.forwardIdx(row + 1, col, proposalIdx)
-
- elif not proposalIdx.isValid():
- proposalIdx = parentIdx.sibling(parentIdx.row() + 1, 0)
-
- if proposalIdx.isValid():
- proposalIdx = proposalIdx.child(0, 1)
- else:
- while not proposalIdx.isValid():
- parentIdx = parentIdx.parent()
- if not parentIdx.isValid():
-
- return Qt.QModelIndex()
- proposalIdx = parentIdx.sibling(parentIdx.row() + 1, 1)
-
- return proposalIdx
-
- def validateAllExpresion(self, secValidation=False):
- #This method is responsible for full validation of the macro. It is executed whenever the text is changed (when user edits values).
- #Validation starts with checking if the macro (name) is valid.
- #Next steps:
- #1. Validates every SingleParamNode and counts how many there are in the macro.
- #2. If there are more SingleParamNodes than entered values it will check if there is RepeatParamNode.
- # If there is RepeatParamNode it will check if its RepeatNodes can be deleted.
- #3. If there are more values entered than SingleParamNodes in macro it will check if there is RepeatParamNode.
- # If there is it will try to add new RepeatNode.
-
- if self.model() is None:
- raise RuntimeError('Door must be set in order to use the macroexecutor.')
-
- self.currentIndex = Qt.QModelIndex()
- mlist = str(self.text()).split()
- problems = []
- try:
- if str(mlist[0]) != str(self.model().root().name()):
- try:
- self.getModelObj().validateMacroName(str(mlist[0]))
- self.validateMacro(mlist[0])
- self.updateMacroEditor(mlist[0])
- if not secValidation:
- self.validateAllExpresion(True)
-
- except Exception as e:
- if self.disableEditMode:
- self.updateMacroEditor(mlist[0])
- raise Exception(e)
- message = e[0]
- #raise Exception(e)
- problems.append(message)
-
- except IndexError:
- problems.append("<b>Macro<\b> is missing!")
- self.setStyleSheet("")
- self.setToolTip('<br>'.join(problems))
- return
-
- self.currentIndex = Qt.QModelIndex()
- ix = self.getIndex()
- self.currentIndex = ix
- counter = 1
- while not ix == Qt.QModelIndex():
- try:
- propValue = mlist[counter]
- try:
- self.validateOneValue(propValue)
- self.model().setData(self.currentIndex, Qt.QVariant(propValue))
- except Exception as e:
- self.model().setData(self.currentIndex, Qt.QVariant('None'))
- txt = str(Qt.from_qvariant(ix.sibling(ix.row(), 0).data(), str))
- message = "<b>" + txt + "</b> " + e[0]
- problems.append(message)
- except IndexError:
- txt = str(Qt.from_qvariant(ix.sibling(ix.row(), 0).data(), str))
- problems.append("<b>" + txt + "</b> is missing!")
-
- data = str(Qt.from_qvariant(ix.data(), str))
- if data != 'None':
- self.model().setData(self.currentIndex, Qt.QVariant('None'))
- counter += 1
- ix = self.getIndex()
- self.currentIndex = ix
-
- if len(mlist) > counter: #if there are more values than parameters
- repeatNode = None
- for i in self.model().root().params():
- repeatNode = i
- if isinstance(repeatNode, macro.RepeatParamNode):
- index = self.findParamRepeat(i)
- self.currentIndex = self.model()._insertRow(index)
- nn = self.model().nodeFromIndex(self.currentIndex)
- self.emit(Qt.SIGNAL("expandTree"))
- ix = self.getIndex()
- if not secValidation:
- self.validateAllExpresion(True)
- return
-
- repeatNode = None
- if repeatNode == None:
- problems.append("Too many values.")
-
- elif counter - len(mlist) >= 1:
- repeatNode = None
- node = None
- for i in self.model().root().params():
- repeatNode = i
- if isinstance(repeatNode, macro.RepeatParamNode):
- index = self.findParamRepeat(i)
- node = self.model().nodeFromIndex(index)
- sub = len(node.child(0))
- break
- repeatNode = None
-
- if repeatNode is not None:
- while counter - len(mlist) > sub - 1:
- if len(node.children()) == 1 and node.isReachedMin():
- break
- self.model()._removeRow(index.child(len(node.children()) - 1, 0))
- counter -= sub
-
- if not secValidation:
- self.validateAllExpresion(True)
- return
-
- if len(problems) == 0:
- self.setStyleSheet('SpockCommandWidget {background-color: %s; color: %s; border: %s; border-radius: %s}' % ('yellow', 'black', '3px solid green', '5px'))
- self.setToolTip("")
- else:
- self.setStyleSheet("")
- self.setToolTip('<br>'.join(problems))
- return
-
- def findParamRepeat(self, repeatNode):
- #Method which finds index of given ParamRepeatNode in the macro.
- children = self.model().root().children()
- occ = children.count(repeatNode)
- idx = 0
- for i in range(0, occ):
- idx = children.index(repeatNode, idx)
- index = self.model().index(idx , 0, Qt.QModelIndex())
- return index
-
- def validateOneValue(self, value):
- #Validates value of a SingleParamNode of a currentIndex
- paramNode = deepcopy(self.model().nodeFromIndex(self.currentIndex))
- paramNode.setValue(value)
- return self.getModelObj().validateSingleParam(paramNode)
-
- def returnPressed(self):
- #SLOT called when return is pressed
- if self.toolTip() == "":
- self.emit(Qt.SIGNAL("pressedReturn"))
- else:
- raise Exception("Cannot start macro. Please correct following mistakes: <br>" + self.toolTip())
-
- def textChanged(self, strs):
- #SLOT called when QLineEdit text is changed
- if strs == "":
- self.updateMacroEditor("")
-
- if not self.disableEditMode and self.disableSpockCommandUpdate:
- self.validateAllExpresion()
- else:
- txt_parts = str(self.text()).split()
- if len(txt_parts) == 0:
- return
- try:
- if self.validateMacro(txt_parts[0]):
- self.validateAllExpresion()
- except:
- self.setToolTip("Read Mode")
-
- def validateMacro(self, value):
- #Method which ivestigates if the macro can be edited using yellow line.
- #It cannot be executed when: 1. there are more than 1 ParamRepeatNodes,
- #2. There is a ParamRepeatNode inside ParamRepeatNodem
- #3. After ParamRepeatNode there are other nodes
-
- macroNode = self.getModelObj().getMacroNodeObj(str(value))
- if macroNode is None: return False
- t = [child for child in macroNode.children() if isinstance(child, macro.RepeatParamNode)]
- if len(t) > 1:
- self.disableEditMode = True
- raise Exception('Macro <b> %s </b> cannot be edited using yellow line.<br>It contains more than 1 paramRepeat node. <br>Please use Macro Editor Widget to edit and execute this macro.' % str(value))
- elif len(t) == 1:
- if len([child for child in t[0].children() if isinstance(child, macro.RepeatParamNode)]) > 0:
- self.disableEditMode = True
- raise Exception('Macro <b> %s </b> cannot be edited using yellow line.<br>It contains paramRepeat node inside paramRepeat node. <br>Please use Macro Editor Widget to edit and execute this macro.' % str(value))
- else:
- if macroNode.children().index(t[0]) != len(macroNode.children()) - 1 :
- self.disableEditMode = True
- raise Exception('Macro <b> %s </b> cannot be edited using yellow line.<br>It contains paramRepeat node but not as a last parameter. <br>Please use Macro Editor Widget to edit and execute this macro.' % str(value))
- self.disableEditMode = False
- return True
-
- def downAction(self):
- #Goes down in the history list of executed macros.
- #self.disableSpockCommandUpdate flag is used to allow updating yellow line when model is changed. (when new row in history is chosen)
-
- self.disableSpockCommandUpdate = False
- self.emit(Qt.SIGNAL("elementDown"))
- text = str(self.text()).split()
- if len(text) > 0:
- self.validateMacro(text[0])
- self.disableSpockCommandUpdate = True
-
- def upAction(self):
- self.disableSpockCommandUpdate = False
- self.emit(Qt.SIGNAL("elementUp"))
- text = str(self.text()).split()
- if len(text) > 0:
- self.validateMacro(text[0])
- self.disableSpockCommandUpdate = True
-
- def controlDownAction(self):
- c = self.cursorPosition()
- newValue = False
- try:
- if self.text()[c] == " " and self.text()[c - 1] == " ":
- newValue = True
- except IndexError:
- if c == 0:
- newValue = True
- elif len(self.text()) == self.cursorPosition() and self.text()[c - 1] == " ":
- newValue = True
- try:
- txt = str(self.text())
- txt = txt[:txt.find(" ", c)]
- except IndexError:
- txt = str(self.text())[:c]
- elementsNum = txt.split()
-
- if newValue:
- self.insert("0")
- self.currentIndex = self.getIndex(len(elementsNum))
- if not self.currentIndex.isValid():
- if len(elementsNum) > 0:
- self.backspace()
- return
- value = self.prevValue("")
- self.backspace()
- self.insert(value)
- self.model().setData(self.currentIndex, Qt.QVariant(value))
- else:
- self.currentIndex = self.getIndex(len(elementsNum) - 1)
- if not self.currentIndex.isValid():
- if len(elementsNum) > 1:
- return
- value = self.prevValue(elementsNum[len(elementsNum) - 1])
- sel = self.measureSelection(self.cursorPosition())
- self.setSelection(sel[0], sel[1])
- c = c - (sel[1] - len(str(value)))
- self.insert(value)
- self.setCursorPosition(c)
- self.model().setData(self.currentIndex, Qt.QVariant(value))
-
- def controlUpAction(self):
- c = self.cursorPosition()
- newValue = False
- try:
- if self.text()[c] == " " and self.text()[c - 1] == " ":
- newValue = True
- except IndexError:
- if c == 0:
- newValue = True
- elif len(self.text()) == self.cursorPosition() and self.text()[c - 1] == " ":
- newValue = True
- try:
- txt = str(self.text())
- txt = txt[:txt.find(" ", c)]
- except IndexError:
- txt = str(self.text())[:c]
- elementsNum = txt.split()
-
- if newValue:
- self.insert("0")
- self.currentIndex = self.getIndex(len(elementsNum))
- if not self.currentIndex.isValid():
- if len(elementsNum) > 0:
- self.backspace()
- return
- value = self.nextValue("")
- self.backspace()
- self.insert(value)
- self.model().setData(self.currentIndex, Qt.QVariant(value))
- else:
- self.currentIndex = self.getIndex(len(elementsNum) - 1)
- if not self.currentIndex.isValid():
- if len(elementsNum) > 1:
- return
- value = self.nextValue(elementsNum[len(elementsNum) - 1])
- sel = self.measureSelection(self.cursorPosition())
- self.setSelection(sel[0], sel[1])
- c = c - (sel[1] - len(str(value)))
- self.insert(value)
- self.setCursorPosition(c)
- self.model().setData(self.currentIndex, Qt.QVariant(value))
-
- def getParamItems(self, index):
- #Returns list of items that can be chosen for the node corresponding to the given index. Used by {next,prev}Value methods
-
- node = self.model().nodeFromIndex(index)
- if isinstance(node, macro.MacroNode):
- return None
- type = node.type()
- ms = self.getParentModelObj()
- items = ms.getElementsWithInterface(type).keys()
- return items, type
-
- def nextValue(self, current):
- current = str(current)
- if self.currentIndex.isValid():
- items, type = self.getParamItems(self.currentIndex)
- items = sorted(items)
- else:
- items = self.getParentModelObj().getMacroStrList()
- items = sorted(items)
- type = "Macro"
-
- if type == "Float":
- value = float(current) + 0.1
- elif type == "Integer":
- value = int(current) + 1
- elif type == "Boolean":
- value = True
- else:
- try:
- textindex = items.index(current)
- value = items[textindex - 1]
- except:
- tmpitems = [s for s in items if s.startswith(current)]
- if len(tmpitems) > 0:
- value = tmpitems[0]
- else:
- value = items[0]
- return str(value)
-
- def prevValue(self, current):
- current = str(current)
- if self.currentIndex.isValid():
- items, type = self.getParamItems(self.currentIndex)
- items = sorted(items)
- else:
- items = self.getParentModelObj().getMacroStrList()
- items = sorted(items)
- type = "Macro"
-
- if type == "Float":
- value = float(current) - 0.1
- elif type == "Integer":
- value = int(current) - 1
- elif type == "Boolean":
- value = True
- else:
- try:
- textindex = items.index(current)
- value = items[textindex + 1]
- except:
- tmpitems = [s for s in items if s.startswith(current)]
- if len(tmpitems) > 0:
- value = tmpitems[0]
- else:
- value = items[0]
- return str(value)
-
- def updateMacroEditor(self, macroName):
- #I had to make the macroname lowered as macros in comboBox (with macros), has names with all letter low.
- #Because of that sometimes it was not loading macros in MacroEditor
- #TO FIX
- self.emit(Qt.SIGNAL("spockComboBox"), str(macroName).lower())
-
- def measureSelection(self, position):
- s = str(self.text()) + " "
- try:
- if s[position] == " ":
- position -= 1
- except IndexError:
- position -= 1
- end = s.find(' ', position)
- beg = s.rfind(' ', 0, position + 1)
- if end == -1:
- end = s.length() - 1
- return beg + 1, end - beg - 1 #returns the start and length of the value
-
- def focusInEvent(self, event):
- self.disableSpockCommandUpdate = True
- Qt.QLineEdit.focusInEvent(self, event)
-
- def focusOutEvent(self, event):
- self.disableSpockCommandUpdate = False
- Qt.QLineEdit.focusOutEvent(self, event)
-
-class TaurusMacroExecutorWidget(TaurusWidget):
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.setObjectName(self.__class__.__name__)
-
- self._doorName = ""
- self._macroId = None
- self.setLayout(Qt.QVBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
-
- self.addToFavouritesAction = Qt.QAction(getThemeIcon("software-update-available"), "Add to favourites", self)
- self.connect(self.addToFavouritesAction, Qt.SIGNAL("triggered()"), self.onAddToFavourites)
- self.addToFavouritesAction.setToolTip("Add to favourites")
- self.stopMacroAction = Qt.QAction(getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self)
- self.connect(self.stopMacroAction, Qt.SIGNAL("triggered()"), self.onStopMacro)
- self.stopMacroAction.setToolTip("Stop macro")
- self.pauseMacroAction = Qt.QAction(getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self)
- self.connect(self.pauseMacroAction, Qt.SIGNAL("triggered()"), self.onPauseMacro)
- self.pauseMacroAction.setToolTip("Pause macro")
- self.playMacroAction = Qt.QAction(getIcon(":/actions/media_playback_start.svg"), "Start macro", self)
- self.connect(self.playMacroAction, Qt.SIGNAL("triggered()"), self.onPlayMacro)
- self.playMacroAction.setToolTip("Start macro")
- actionsLayout = Qt.QHBoxLayout()
- actionsLayout.setContentsMargins(0, 0, 0, 0)
- addToFavouritsButton = Qt.QToolButton()
- addToFavouritsButton.setDefaultAction(self.addToFavouritesAction)
- self.addToFavouritesAction.setEnabled(False)
- actionsLayout.addWidget(addToFavouritsButton)
-
- self.macroComboBox = MacroComboBox(self)
- self.macroComboBox.setUseParentModel(True)
- self.macroComboBox.setModelColumn(0)
- actionsLayout.addWidget(self.macroComboBox)
- stopMacroButton = Qt.QToolButton()
- stopMacroButton.setDefaultAction(self.stopMacroAction)
- actionsLayout.addWidget(stopMacroButton)
- pauseMacroButton = Qt.QToolButton()
- pauseMacroButton.setDefaultAction(self.pauseMacroAction)
- actionsLayout.addWidget(pauseMacroButton)
- self.playMacroButton = Qt.QToolButton()
- self.playMacroButton.setDefaultAction(self.playMacroAction)
- actionsLayout.addWidget(self.playMacroButton)
- self.disableControlActions()
- self.doorStateLed = TaurusLed(self)
- actionsLayout.addWidget(self.doorStateLed)
- self.layout().addLayout(actionsLayout)
-
- splitter = Qt.QSplitter(self)
- self.layout().addWidget(splitter)
- splitter.setOrientation(Qt.Qt.Vertical)
-
- self._paramEditorModel = ParamEditorModel()
- self.stackedWidget = Qt.QStackedWidget()
- self.standardMacroParametersEditor = StandardMacroParametersEditor(self.stackedWidget)
- self.stackedWidget.addWidget(self.standardMacroParametersEditor)
- self.customMacroParametersEditor = None
- splitter.addWidget(self.stackedWidget)
-
- self._favouritesBuffer = None
- self.favouritesMacrosEditor = FavouritesMacrosEditor(self)
- self.registerConfigDelegate(self.favouritesMacrosEditor)
- self.favouritesMacrosEditor.setUseParentModel(True)
- self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus)
-
- self._historyBuffer = None
- self.historyMacrosViewer = HistoryMacrosViewer(self)
- self.registerConfigDelegate(self.historyMacrosViewer)
- self.historyMacrosViewer.setUseParentModel(True)
- self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus)
-
- self.tabMacroListsWidget = Qt.QTabWidget(self)
- self.tabMacroListsWidget.addTab(self.favouritesMacrosEditor, "Favourite list")
- self.tabMacroListsWidget.addTab(self.historyMacrosViewer, "History Viewer")
- splitter.addWidget(self.tabMacroListsWidget)
-
- self._isHistoryMacro = False
- self.macroProgressBar = MacroProgressBar(self)
- self.layout().addWidget(self.macroProgressBar)
-
- #spockCommandLabel = Qt.QLabel("Spock command:", self)
- #spockCommandLabel.setFont(Qt.QFont("Courier",9))
- self.spockCommand = SpockCommandWidget("Spock", self)
- self.spockCommand.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum)
- self.spockCommand.setUseParentModel(True)
- spockCommandLayout = Qt.QHBoxLayout()
- spockCommandLayout.setContentsMargins(0, 0, 0, 0)
- #spockCommandLayout.addWidget(spockCommandLabel)
- spockCommandLayout.addWidget(self.spockCommand)
- self.layout().addLayout(spockCommandLayout)
- self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged)
- self.connect(self.favouritesMacrosEditor.list, Qt.SIGNAL("favouriteSelected"), self.onFavouriteSelected)
- self.connect(self.historyMacrosViewer.list, Qt.SIGNAL("historySelected"), self.onHistorySelected)
-
- self.connect(self.spockCommand, Qt.SIGNAL("pressedReturn"), self.onPlayMacro)
- self.connect(self.spockCommand, Qt.SIGNAL("spockComboBox"), self.setComboBoxItem)
- self.connect(self.spockCommand, Qt.SIGNAL("elementUp"), self.setHistoryUp)
- self.connect(self.spockCommand, Qt.SIGNAL("elementDown"), self.setHistoryDown)
- self.connect(self.spockCommand, Qt.SIGNAL("setHistoryFocus"), self.setHistoryFocus)
- self.connect(self.spockCommand, Qt.SIGNAL("expandTree"), self.standardMacroParametersEditor.tree.expandAll)
-
- def macroId(self):
- return self._macroId
-
- def contextMenuEvent(self, event):
- menu = Qt.QMenu()
- action = menu.addAction(getThemeIcon("view-refresh"), "Check door state", self.checkDoorState)
- menu.exec_(event.globalPos())
-
- def checkDoorState(self):
- door = Device(self.doorName())
- doorState = door.state()
- if doorState == PyTango.DevState.RUNNING:
- self.playMacroAction.setEnabled(False)
- self.pauseMacroAction.setEnabled(True)
- self.stopMacroAction.setEnabled(True)
- elif doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM:
- self.playMacroAction.setEnabled(True)
- self.pauseMacroAction.setEnabled(False)
- self.stopMacroAction.setEnabled(False)
- elif doorState == PyTango.DevState.STANDBY:
- self.playMacroAction.setEnabled(True)
- self.pauseMacroAction.setEnabled(False)
- self.stopMacroAction.setEnabled(True)
-
- def setMacroId(self, macroId):
- self._macroId = macroId
-
- def doorName(self):
- return self._doorName
-
- def setDoorName(self, doorName):
- self._doorName = doorName
-
- def setFavouritesBuffer(self, favouritesMacro):
- self._favouritesBuffer = favouritesMacro
-
- #History Widget
- def setHistoryUp(self):
- self.setHistoryFocus()
- self.historyMacrosViewer.listElementUp()
-
- def setHistoryDown(self):
- self.setHistoryFocus()
- self.historyMacrosViewer.listElementDown()
-
- def setHistoryFocus(self):
- self.tabMacroListsWidget.setCurrentWidget(self.historyMacrosViewer)
- #self.historyMacrosViewer.setFocus()
-
- def historyBuffer(self):
- return self._historyBuffer
-
- def setHistoryBuffer(self, favouritesMacro):
- self._historyBuffer = favouritesMacro
-
- def favouritesBuffer(self):
- return self._favouritesBuffer
-
- def paramEditorModel(self):
- return self._paramEditorModel
-
- def setParamEditorModel(self, paramEditorModel):
- self._paramEditorModel = paramEditorModel
-
- def setComboBoxItem(self, macroName):
- self.macroComboBox.selectMacro(macroName)
-
- def onMacroComboBoxChanged(self, macroName):
- macroName = str(macroName)
- if macroName == "":
- macroName, macroNode = None, None
-# macroNode = macro.MacroNode(name="")
- self.playMacroAction.setEnabled(False)
- self.addToFavouritesAction.setEnabled(False)
- else:
- if self._isHistoryMacro:
- macroNode = self.historyBuffer()
- self.setHistoryBuffer(None)
- self.favouritesMacrosEditor.list.clearSelection()
- else:
- macroNode = self.favouritesBuffer()
- self.setFavouritesBuffer(None)
- self.historyMacrosViewer.list.clearSelection()
- self._isHistoryMacro = False
-
- if macroNode is None:
- macroNode = self.getModelObj().getMacroNodeObj(macroName)
-
- self.playMacroAction.setEnabled(True)
- self.addToFavouritesAction.setEnabled(True)
-
- self.paramEditorModel().setRoot(macroNode)
- self.spockCommand.setModel(self.paramEditorModel())
- if self.stackedWidget.count() == 2:
- self.stackedWidget.removeWidget(self.customMacroParametersEditor)
- self.customMacroParametersEditor.setParent(None)
- self.customMacroParametersEditor = ParamEditorManager().getMacroEditor(macroName, self.stackedWidget)
- if self.customMacroParametersEditor:
- self.customMacroParametersEditor.setModel(self.paramEditorModel())
- self.stackedWidget.addWidget(self.customMacroParametersEditor)
- self.stackedWidget.setCurrentWidget(self.customMacroParametersEditor)
- else:
- self.standardMacroParametersEditor.setModel(self.paramEditorModel())
-
- self.emit(Qt.SIGNAL("macroNameChanged"), macroName)
-
- def onFavouriteSelected(self, macroNode):
- self.setFavouritesBuffer(macroNode)
- name = ""
- if not macroNode is None:
- name = macroNode.name()
- self._isHistoryMacro = False
- self.macroComboBox.selectMacro(name)
-
- def onHistorySelected(self, macroNode):
- self.setHistoryBuffer(macroNode)
- name = ""
- if not macroNode is None:
- name = macroNode.name()
- self._isHistoryMacro = True
- self.macroComboBox.selectMacro(name)
-
- def onAddToFavourites(self):
- self.favouritesMacrosEditor.addMacro(deepcopy(self.paramEditorModel().root()))
-
- def addToHistory(self):
- self.historyMacrosViewer.addMacro(deepcopy(self.paramEditorModel().root()))
-
- def onDoorChanged(self, doorName):
- self.setDoorName(doorName)
- if self.doorName() == "":
- self.doorStateLed.setModel(None)
- return
- self.doorStateLed.setModel(self.doorName() + "/State")
- doorState = Device(doorName).state()
- if doorState == PyTango.DevState.ON:
- self.playMacroAction.setText("Start macro")
- self.playMacroAction.setToolTip("Start macro")
- elif doorState == PyTango.DevState.STANDBY:
- self.playMacroAction.setText("Resume macro")
- self.playMacroAction.setToolTip("Resume macro")
-
- def onPlayMacro(self):
- door = Device(self.doorName())
- doorState = door.state()
- if doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM:
- paramEditorModel = self.paramEditorModel()
- macroNode = paramEditorModel.root()
- id = macroNode.assignId()
- self.setMacroId(id)
- params, alerts = macroNode.toRun()
- xmlString = paramEditorModel.toXmlString()
- if len(alerts) > 0:
- Qt.QMessageBox.warning(self, "Macro parameters warning", alerts)
- return
- door.runMacro(xmlString)
- self.addToHistory()
-# door.runMacro(str(macroNode.name()), params)
- elif doorState == PyTango.DevState.STANDBY:
- door.command_inout("ResumeMacro")
- else:
- Qt.QMessageBox.warning(self, "Error while starting/resuming macro",
- "It was not possible to start/resume macro, because state of the door was different than ON/STANDBY")
-
- def onStopMacro(self):
- door = Device(self.doorName())
- doorState = door.state()
-
- if doorState in (PyTango.DevState.RUNNING, PyTango.DevState.STANDBY):
- door.command_inout("StopMacro")
- else:
- Qt.QMessageBox.warning(self, "Error while stopping macro",
- "It was not possible to stop macro, because state of the door was different than RUNNING or STANDBY")
-
- def onPauseMacro(self):
- door = Device(self.doorName())
- doorState = door.state()
-
- if doorState == PyTango.DevState.RUNNING:
- door.command_inout("PauseMacro")
- else:
- Qt.QMessageBox.warning(self, "Error while pausing macro",
- "It was not possible to pause macro, because state of the door was different than RUNNING")
-
- def onMacroStatusUpdated(self, data):
- macro = data[0]
- if macro is None: return
- data = data[1][0]
- state, range, step, id = data["state"], data["range"], data["step"], data["id"]
- if id is None: return
- id = int(id)
- if id != self.macroId(): return
- macroName = macro.name
- shortMessage = ""
- if state == "start":
- self.emit(Qt.SIGNAL("macroStarted"), "DoorOutput")
- self.macroProgressBar.setRange(range[0], range[1])
- self.playMacroAction.setEnabled(False)
- self.pauseMacroAction.setEnabled(True)
- self.stopMacroAction.setEnabled(True)
- self.emit(Qt.SIGNAL("plotablesFilterChanged"), None)
- self.emit(Qt.SIGNAL("plotablesFilterChanged"), standardPlotablesFilter)
- shortMessage = "Macro %s started." % macroName
- elif state == "pause":
- self.playMacroAction.setText("Resume macro")
- self.playMacroAction.setToolTip("Resume macro")
- self.playMacroAction.setEnabled(True)
- self.pauseMacroAction.setEnabled(False)
- shortMessage = "Macro %s paused." % macroName
- elif state == "resume":
- self.playMacroAction.setText("Start macro")
- self.playMacroAction.setToolTip("Start macro")
- self.playMacroAction.setEnabled(False)
- self.pauseMacroAction.setEnabled(True)
- shortMessage = "Macro %s resumed." % macroName
- elif state == "stop" or state == "finish":
- self.playMacroAction.setEnabled(True)
- self.pauseMacroAction.setEnabled(False)
- self.stopMacroAction.setEnabled(False)
- shortMessage = "Macro %s finished." % macroName
- elif state == "exception":
- self.playMacroAction.setEnabled(True)
- self.pauseMacroAction.setEnabled(False)
- self.stopMacroAction.setEnabled(False)
- shortMessage = "Macro %s error." % macroName
- exc_value, exc_stack = data['exc_value'], data['exc_stack']
- exceptionDialog = TaurusMessageBox(MacroRunException, exc_value, exc_stack)
- exceptionDialog.exec_()
- elif state == "abort":
- self.playMacroAction.setText("Start macro")
- self.playMacroAction.setToolTip("Start macro")
- self.playMacroAction.setEnabled(True)
- self.pauseMacroAction.setEnabled(False)
- self.stopMacroAction.setEnabled(False)
- shortMessage = "Macro %s stopped." % macroName
- elif state == "step":
- shortMessage = "Macro %s at %d %% of progress." % (macroName, step)
- self.emit(Qt.SIGNAL("shortMessageEmitted"), shortMessage)
- self.macroProgressBar.setValue(step)
-
- def disableControlActions(self):
- self.pauseMacroAction.setEnabled(False)
- self.stopMacroAction.setEnabled(False)
- self.playMacroAction.setEnabled(False)
-
- def setModel(self, model):
- oldModelObj = self.getModelObj()
- if oldModelObj is not None:
- self.disconnect(oldModelObj, Qt.SIGNAL("macrosUpdated"), self.macroComboBox.onMacrosUpdated)
- TaurusWidget.setModel(self, model)
- newModelObj = self.getModelObj()
- self.connect(newModelObj, Qt.SIGNAL("macrosUpdated"), self.macroComboBox.onMacrosUpdated)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return {'container': False,
- 'group': 'Taurus Sardana',
- 'module': 'taurus.qt.qtgui.extra_macroexecutor',
- 'icon': ':/designer/frame.png'}
-
-
-class TaurusMacroExecutor(MacroExecutionWindow):
-
- def __init__(self, parent=None, designMode=False):
- MacroExecutionWindow.__init__(self, parent, designMode)
-
- def initComponents(self):
- self.taurusMacroExecutorWidget = TaurusMacroExecutorWidget(self)
- self.registerConfigDelegate(self.taurusMacroExecutorWidget)
- self.taurusMacroExecutorWidget.setUseParentModel(True)
- self.setCentralWidget(self.taurusMacroExecutorWidget)
- self.connect(self.taurusMacroExecutorWidget, Qt.SIGNAL('shortMessageEmitted'), self.onShortMessage)
- self.statusBar().showMessage("MacroExecutor ready")
-
- def setCustomMacroEditorPaths(self, customMacroEditorPaths):
- MacroExecutionWindow.setCustomMacroEditorPaths(self, customMacroEditorPaths)
- ParamEditorManager().parsePaths(customMacroEditorPaths)
- ParamEditorManager().browsePaths()
-
- def loadSettings(self):
- TaurusMainWindow.loadSettings(self)
- self.emit(Qt.SIGNAL("doorChanged"), self.doorName())
-
- def onDoorChanged(self, doorName):
- MacroExecutionWindow.onDoorChanged(self, doorName)
- if self._qDoor:
- Qt.QObject.disconnect(self._qDoor, Qt.SIGNAL("macroStatusUpdated"), self.taurusMacroExecutorWidget.onMacroStatusUpdated)
- if doorName == "": return
- self._qDoor = Device(doorName)
- Qt.QObject.connect(self._qDoor, Qt.SIGNAL("macroStatusUpdated"), self.taurusMacroExecutorWidget.onMacroStatusUpdated)
- self.taurusMacroExecutorWidget.onDoorChanged(doorName)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-
-
-def createMacroExecutorWidget(args):
- macroExecutor = TaurusMacroExecutorWidget()
- macroExecutor.setModelInConfig(True)
- Qt.QObject.connect(macroExecutor, Qt.SIGNAL("doorChanged"), macroExecutor.onDoorChanged)
- if len(args) == 2:
- macroExecutor.setModel(args[0])
- macroExecutor.emit(Qt.SIGNAL('doorChanged'), args[1])
- return macroExecutor
-
-def createMacroExecutor(args):
- macroExecutor = TaurusMacroExecutor()
- macroExecutor.setModelInConfig(True)
- Qt.QObject.connect(macroExecutor, Qt.SIGNAL("doorChanged"), macroExecutor.onDoorChanged)
- if len(args) == 2:
- macroExecutor.setModel(args[0])
- macroExecutor.emit(Qt.SIGNAL('doorChanged'), args[1])
- macroExecutor.loadSettings()
- return macroExecutor
-
-def main():
- from taurus.qt.qtgui.application import TaurusApplication
- import taurus
-
- app = TaurusApplication(sys.argv, app_version=taurus.Release.version)
- args = app.get_command_line_args()
-
- app.setOrganizationName("Taurus")
- app.setApplicationName("macroexecutor")
- macroExecutor = createMacroExecutor(args)
- macroExecutor.show()
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/__init__.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/__init__.py
deleted file mode 100644
index fc9c991c..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-__init__.py:
-"""
-from macroparameterseditor import ParamEditorManager, StandardMacroParametersEditor
-from model import ParamEditorModel
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/__init__.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/__init__.py
deleted file mode 100644
index 141eb701..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from senv import SenvEditor
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/senv.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/senv.py
deleted file mode 100644
index dbe358d9..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/customeditors/senv.py
+++ /dev/null
@@ -1,374 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from taurus.external.qt import Qt
-from taurus import Database
-from taurus.core.taurusbasetypes import TaurusElementType
-from taurus.core.taurusdatabase import TaurusAttrInfo
-from taurus.qt.qtgui.input import TaurusAttrListComboBox
-from taurus.qt.qtgui.tree import TaurusDbTreeWidget
-from taurus.qt.qtgui.resource import getThemeIcon
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.macroparameterseditor import MacroParametersEditor
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.parameditors import LineEditParam, ParamBase, ComboBoxParam, CheckBoxParam, DirPathParam, MSAttrListComboBoxParam
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.model import ParamEditorModel
-from sardana.taurus.qt.qtgui.extra_macroexecutor.common import MSAttrListComboBox
-
-
-class SenvEditor(Qt.QWidget, MacroParametersEditor):
-
- def __init__(self, parent=None):
- Qt.QWidget.__init__(self, parent)
- MacroParametersEditor.__init__(self)
- self.valueWidget = None
-
- def initComponents(self):
- self.setLayout(Qt.QFormLayout())
-
- self.layout().addRow(Qt.QLabel("Setting environment variable:", self))
-
- self.nameComboBox = ComboBoxParam(self)
- self.nameComboBox.addItems(["ActiveMntGrp", "ExtraColumns", "JsonRecorder", "ScanFile", "ScanDir"])
- self.nameComboBox.setEditable(True)
- self.connect(self.nameComboBox, Qt.SIGNAL("currentIndexChanged(int)"), self.onNameComboBoxChanged)
- self.layout().addRow("name:", self.nameComboBox)
-
- nameIndex = self.model().index(0, 1, self.rootIndex())
- self.nameComboBox.setIndex(nameIndex)
-
- def setRootIndex(self, rootIndex):
- self._rootIndex = rootIndex
- self.initComponents()
-
- def rootIndex(self):
- return self._rootIndex
-
- def model(self):
- return self._model
-
- def setModel(self, model):
- self._model = model
- if isinstance(model, ParamEditorModel):
- self.setRootIndex(Qt.QModelIndex())
-
- def onNameComboBoxChanged(self, index):
- text = str(self.nameComboBox.currentText())
- if self.valueWidget is not None:
- label = self.layout().labelForField(self.valueWidget)
- if label is not None:
- self.layout().removeWidget(label)
- label.setParent(None)
- label = None
-
- self.layout().removeWidget(self.valueWidget)
- self.valueWidget.resetValue()
- self.valueWidget.setParent(None)
- self.valueWidget = None
-
- self.valueWidget, label = getSenvValueEditor(text, self)
-
- paramRepeatIndex = self.model().index(1, 0, self.rootIndex())
- repeatIndex = paramRepeatIndex.child(0, 0)
- valueIndex = repeatIndex.child(0, 1)
- self.valueWidget.setIndex(valueIndex)
-
- if label:
- self.layout().addRow(label, self.valueWidget)
- else:
- self.layout().addRow(self.valueWidget)
-
-def getSenvValueEditor(envName, parent):
- """Factory method, requires: string, and QWidget as a parent for returned editor.
- Factory returns a tuple of widget and a label for it.
-
- :return: (Qt.QWidget, str) """
- label = "value:"
- if envName == "ActiveMntGrp":
- editor = MSAttrListComboBoxParam(parent)
- editor.setUseParentModel(True)
- editor.setModel("/MeasurementGroupList")
- elif envName == "ExtraColumns":
- editor = ExtraColumnsEditor(parent)
- label = None
- elif envName == "JsonRecorder":
- editor = CheckBoxParam(parent)
- elif envName == "ScanDir":
- editor = DirPathParam(parent)
- elif envName == "ScanFile":
- editor = LineEditParam(parent)
- else:
- editor = LineEditParam(parent)
- return editor, label
-
-class ExtraColumnsEditor(ParamBase, Qt.QWidget):
-
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QWidget.__init__(self, parent)
- self.setLayout(Qt.QVBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
-
- addNewColumnButton = Qt.QPushButton(getThemeIcon("list-add") , "Add new column...", self)
- removeSelectedColumnsButton = Qt.QPushButton(getThemeIcon("list-remove") , "Remove selected...", self)
- buttonsLayout = Qt.QHBoxLayout()
- buttonsLayout.addWidget(addNewColumnButton)
- buttonsLayout.addWidget(removeSelectedColumnsButton)
- self.layout().addLayout(buttonsLayout)
-
- self.extraColumnsTable = ExtraColumnsTable(self)
- self.extraColumnsModel = ExtraColumnsModel()
- self.extraColumnsTable.setModel(self.extraColumnsModel)
- self.extraColumnsTable.setItemDelegate(ExtraColumnsDelegate(self.extraColumnsTable))
-
- self.layout().addWidget(self.extraColumnsTable)
-
- self.connect(addNewColumnButton, Qt.SIGNAL("clicked()"), self.onAddNewColumn)
- self.connect(removeSelectedColumnsButton, Qt.SIGNAL("clicked()"), self.onRemoveSelectedColumns)
- self.connect(self.extraColumnsModel, Qt.SIGNAL("dataChanged (const QModelIndex&,const QModelIndex&)"), self.onExtraColumnsChanged)
- self.connect(self.extraColumnsModel, Qt.SIGNAL("modelReset()"), self.onExtraColumnsChanged)
-
- def getValue(self):
- return repr(self.extraColumnsTable.model().columns())
-
- def setValue(self, value):
- try:
- columns = eval(value)
- except:
- columns = []
- self.extraColumnsTable.setColumns(columns)
-
- def onAddNewColumn(self):
- self.extraColumnsTable.insertRows()
- self.emit(Qt.SIGNAL("modelChanged()"))
-
- def onRemoveSelectedColumns(self):
- self.extraColumnsTable.removeRows()
- self.emit(Qt.SIGNAL("modelChanged()"))
-
- def onExtraColumnsChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
-
-class ExtraColumnsTable(Qt.QTableView):
-
- def __init__(self, parent):
- Qt.QTableView.__init__(self, parent)
- self.setSelectionBehavior(Qt.QAbstractItemView.SelectRows)
- self.setSelectionMode(Qt.QAbstractItemView.ExtendedSelection)
-
- def setColumns(self, columns):
- if columns == None: columns = []
- self.model().setColumns(columns)
- self.resizeColumnsToContents()
-
- def insertRows(self):
- self.model().insertRows(self.model().rowCount())
-
- def removeRows(self):
- rows = [index.row() for index in self.selectedIndexes()]
- rows = list(set(rows))
- rows.sort(reverse=True)
- for row in rows:
- self.model().removeRows(row)
-
-
-class ExtraColumnsDelegate(Qt.QItemDelegate):
-
- def __init__(self, parent=None):
- Qt.QItemDelegate.__init__(self, parent)
- db = Database()
- self.host = db.getNormalName()
-
- def createEditor(self, parent, option, index):
- if index.column() == 1:
- self.combo_attr_tree_widget = TaurusDbTreeWidget(perspective=TaurusElementType.Device)
- self.combo_attr_tree_widget.setModel(self.host)
- treeView = self.combo_attr_tree_widget.treeView()
- qmodel = self.combo_attr_tree_widget.getQModel()
- editor = Qt.QComboBox(parent)
- editor.setModel(qmodel)
- editor.setMaxVisibleItems(20)
- editor.setView(treeView)
- elif index.column() == 2:
- editor = MSAttrListComboBox(parent)
- editor.setUseParentModel(True)
- editor.setModel("/InstrumentList")
- else:
- editor = Qt.QItemDelegate.createEditor(self, parent, option, index)
- return editor
-
- def setEditorData(self, editor, index):
- if index.column() == 2:
- text = Qt.from_qvariant(index.model().data(index, Qt.Qt.DisplayRole), str)
- editor.setCurrentText(text)
- else:
- Qt.QItemDelegate.setEditorData(self, editor, index)
-
- def setModelData(self, editor, model, index):
- column = index.column()
- if column == 1:
- selectedItems = self.combo_attr_tree_widget.selectedItems()
- if not len(selectedItems) == 1: return
- taurusTreeAttributeItem = selectedItems[0]
- itemData = taurusTreeAttributeItem.itemData()
- if isinstance(itemData, TaurusAttrInfo):
- model.setData(index, Qt.QVariant(itemData.fullName()))
- elif column == 2:
- model.setData(index, Qt.QVariant(editor.currentText()))
- else:
- Qt.QItemDelegate.setModelData(self, editor, model, index)
-
- def sizeHint(self, option, index):
- if index.column() == 0:
- fm = option.fontMetrics
- text = Qt.from_qvariant(index.model().data(index, Qt.Qt.DisplayRole), str)
- document = Qt.QTextDocument()
- document.setDefaultFont(option.font)
- document.setHtml(text)
- size = Qt.QSize(document.idealWidth() + 5, fm.height())
- elif index.column() == 1:
- editor = self.createEditor(self.parent(), option, index)
- if editor is None:
- size = Qt.QItemDelegate.sizeHint(self, option, index)
- else:
- size = editor.sizeHint()
- editor.hide()
- editor.setParent(None)
-# editor.destroy()
- else:
- size = Qt.QItemDelegate.sizeHint(self, option, index)
- return size
-
-class ExtraColumnsModel(Qt.QAbstractTableModel):
-
-
- def __init__(self, columns=None):
- if columns is None: columns = []
- Qt.QAbstractItemModel.__init__(self)
- self.__columns = columns
-
- def setColumns(self, columns):
- self.__columns = columns
- self.reset()
-
- def columns(self):
- return self.__columns
-
- def rowCount(self, index=Qt.QModelIndex()):
- return len(self.__columns)
-
- def columnCount(self, index=Qt.QModelIndex()):
- return 3
-
- def data(self, index, role=Qt.Qt.DisplayRole):
- if not index.isValid() or not (0 <= index.row() < self.rowCount()):
- return Qt.QVariant()
- row = index.row()
- column = index.column()
- #Display Role
- if role == Qt.Qt.DisplayRole:
- if column == 0: return Qt.QVariant(Qt.QString(self.__columns[row]['label']))
- elif column == 1: return Qt.QVariant(Qt.QString(self.__columns[row]['model']))
- elif column == 2: return Qt.QVariant(Qt.QString(self.__columns[row]['instrument']))
- return Qt.QVariant()
-
- def headerData(self, section, orientation, role=Qt.Qt.DisplayRole):
- if role == Qt.Qt.TextAlignmentRole:
- if orientation == Qt.Qt.Horizontal:
- return Qt.QVariant(int(Qt.Qt.AlignLeft | Qt.Qt.AlignVCenter))
- return Qt.QVariant(int(Qt.Qt.AlignRight | Qt.Qt.AlignVCenter))
- if role != Qt.Qt.DisplayRole:
- return Qt.QVariant()
- #So this is DisplayRole...
- if orientation == Qt.Qt.Horizontal:
- if section == 0: return Qt.QVariant("Label")
- elif section == 1: return Qt.QVariant("Attribute")
- elif section == 2: return Qt.QVariant("Instrument")
- return Qt.QVariant()
- else:
- return Qt.QVariant(Qt.QString.number(section + 1))
-
- def flags(self, index):
- flags = Qt.Qt.ItemIsEnabled | Qt.Qt.ItemIsSelectable
- if index.isValid():
- column = index.column()
- if column in (0, 1, 2):
- flags |= Qt.Qt.ItemIsEditable
- return flags
-
- def setData(self, index, value=None, role=Qt.Qt.EditRole):
- if index.isValid() and (0 <= index.row() < self.rowCount()):
- row = index.row()
- column = index.column()
- value = Qt.from_qvariant(value, str)
- if column == 0: self.__columns[row]['label'] = value
- elif column == 1: self.__columns[row]['model'] = value
- elif column == 2: self.__columns[row]['instrument'] = value
- self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
- return True
- return False
-
- def insertRows(self, row, rows=1, parentindex=None):
- if parentindex is None: parentindex = Qt.QModelIndex()
- first = row
- last = row + rows - 1
- self.beginInsertRows(parentindex, first, last)
- for row in range(first, last + 1):
- self.insertRow(row)
- self.endInsertRows()
- return True
-
- def insertRow(self, row, parentIndex=None):
- self.__columns.insert(row, {'label':'', 'model':'', 'instrument':''})
-
- def removeRows(self, row, rows=1, parentindex=None):
- if parentindex is None: parentindex = Qt.QModelIndex()
- first = row
- last = row + rows - 1
- self.beginRemoveRows(parentindex, first, last)
- for row in range(first, last + 1):
- self.removeRow(row)
- self.endRemoveRows()
- return True
-
- def removeRow(self, row, parentIndex=None):
- self.__columns.pop(row)
-
-CUSTOM_EDITOR = SenvEditor
-
-if __name__ == "__main__":
- import sys
- import taurus
- from taurus.qt.qtgui.application import TaurusApplication
-
- app = TaurusApplication(sys.argv)
- args = app.get_command_line_args()
- editor = SenvEditor()
- macroServer = taurus.Device(args[0])
- macroInfoObj = macroServer.getMacroInfoObj("senv")
- macroNode = MacroNode()
- editor.setMacroNode(macroNode)
- editor.show()
-
- sys.exit(app.exec_())
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/delegate.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/delegate.py
deleted file mode 100644
index bdf357c2..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/delegate.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-delegate.py:
-"""
-
-from taurus.external.qt import Qt
-
-from sardana.taurus.qt.qtgui.extra_macroexecutor import globals
-from sardana.taurus.core.tango.sardana import macro
-
-from .parameditors import MSAttrListComboBoxParam, SpinBoxParam, \
- DoubleSpinBoxParam, LineEditParam, FileDialogParam, ComboBoxParam, ComboBoxBoolean
-
-class ParamEditorDelegate(Qt.QStyledItemDelegate):
-
- def __init__(self, parent=None):
- Qt.QStyledItemDelegate.__init__(self, parent)
-
- def createEditor(self, parent, option, index):
- if index.column() == 1:
- node = index.model().nodeFromIndex(index)
- if isinstance(node, macro.SingleParamNode):
- paramType = node.type()
- if paramType in globals.EDITOR_COMBOBOX_PARAMS:
- comboBox = MSAttrListComboBoxParam(parent, node)
- comboBox.setElementType(paramType)
-
- ##################
- # The setUseParentModel mechanism is not working
- # we do it manually here as a hack
- #comboBox.setUseParentModel(True)
- #comboBox.setModel('/elements')
- w = parent
- while w is not None:
- if hasattr(w, 'getModelName'):
- model = w.getModelName() + '/elements'
- break
- w = w.parent()
- comboBox.setModel(model)
- ###################
-
- return comboBox
- elif paramType in globals.EDITOR_SPINBOX_PARAMS:
- return SpinBoxParam(parent, node)
- elif paramType in globals.EDITOR_DOUBLESPINBOX_PARAMS:
- return DoubleSpinBoxParam(parent, node)
- elif paramType in globals.EDITOR_LINEEDIT_PARAMS:
- return LineEditParam(parent, node)
- elif paramType in globals.EDITOR_FILEDIALOG_PARAMS:
- return FileDialogParam(parent, node)
- elif paramType in globals.EDITOR_BOOLEAN_PARAMS:
- return ComboBoxBoolean(parent, node)
- return Qt.QStyledItemDelegate.createEditor(self, parent, option, index)
-
- def setEditorData(self, editor, index):
- if index.column() == 1:
- text = Qt.from_qvariant(index.model().data(index, Qt.Qt.DisplayRole), str)
- if text == "None" or text == "":
- Qt.QStyledItemDelegate.setEditorData(self, editor, index)
- else:
- editor.setValue(text)
-# node = index.model().nodeFromIndex(index)
-# paramType = node.type()
-# if paramType in globals.EDITOR_COMBOBOX_PARAMS :
-# editor.setValue(text)
-# elif paramType in globals.EDITOR_SPINBOX_PARAMS:
-# editor.setValue(int(text))
-# elif paramType in globals.EDITOR_DOUBLESPINBOX_PARAMS:
-# editor.setValue(float(text))
-# elif paramType in globals.EDITOR_LINEEDIT_PARAMS:
-# editor.setText(text)
-# elif paramType in globals.EDITOR_FILEDIALOG_PARAMS:
-# editor.filePath.setText(text)
- else:
- Qt.QStyledItemDelegate.setEditorData(self, editor, index)
-
- def setModelData(self, editor, model, index):
- if index.column() == 1:
- model.setData(index, Qt.QVariant(editor.getValue()))
- else:
- Qt.QStyledItemDelegate.setModelData(self, editor, model, index)
-
- def sizeHint(self, option, index):
- if index.column() == 0:
- fm = option.fontMetrics
- text = Qt.from_qvariant(index.model().data(index, Qt.Qt.DisplayRole), str)
- document = Qt.QTextDocument()
- document.setDefaultFont(option.font)
- document.setHtml(text)
- size = Qt.QSize(document.idealWidth() + 5, fm.height())
- elif index.column() == 1:
- editor = self.createEditor(self.parent(), option, index)
- if editor is None:
- size = Qt.QStyledItemDelegate.sizeHint(self, option, index)
- else:
- size = editor.sizeHint()
- editor.hide()
- editor.setParent(None)
-# editor.destroy()
- else:
- size = Qt.QStyledItemDelegate.sizeHint(self, option, index)
- return size
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/macroparameterseditor.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/macroparameterseditor.py
deleted file mode 100644
index fd5ca4fc..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/macroparameterseditor.py
+++ /dev/null
@@ -1,379 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-macroparameterseditor.py:
-"""
-import sys, inspect, glob
-
-from taurus.external.qt import Qt
-from taurus.core.util.singleton import Singleton
-from taurus.qt.qtgui.resource import getThemeIcon
-
-from sardana.taurus.core.tango.sardana import macro
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.delegate import ParamEditorDelegate
-
-
-class MacroParametersEditor(object):
-
- def __init__(self):
- pass
-# self._macroModel = None
-
-# def setMacroModel(self, model):
-# self._macroModel = model
-# self.connect(self._macroModel, Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.onDataChanged)
-# self.connect(self._macroModel, Qt.SIGNAL("modelReset()"), self.onModelReset)
-#
-# def onDataChanged(self):
-# pass
-#
-# def onModelReset(self):
-# self.onDataChanged()
-
-class StandardMacroParametersEditor(Qt.QWidget, MacroParametersEditor):
-
- def __init__(self, parent=None, macroNode=None):
- Qt.QWidget.__init__(self, parent)
- self.initComponents()
-
- def initComponents(self):
- self.setLayout(Qt.QHBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
-
- self.tree = MacroParametersTree(self)
- self.delegate = ParamEditorDelegate(self.tree)
- self.tree.setItemDelegate(self.delegate)
- self.tree.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Expanding)
- self.layout().addWidget(self.tree)
-
- actionLayout = Qt.QVBoxLayout()
- actionLayout.setContentsMargins(0, 0, 0, 0)
- addButton = Qt.QToolButton()
- addButton.setDefaultAction(self.tree.addAction)
- actionLayout.addWidget(addButton)
- deleteButton = Qt.QToolButton()
- deleteButton.setDefaultAction(self.tree.deleteAction)
- actionLayout.addWidget(deleteButton)
- moveUpButton = Qt.QToolButton()
- moveUpButton.setDefaultAction(self.tree.moveUpAction)
- actionLayout.addWidget(moveUpButton)
- moveDownButton = Qt.QToolButton()
- moveDownButton.setDefaultAction(self.tree.moveDownAction)
- actionLayout.addWidget(moveDownButton)
- spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
- actionLayout.addItem(spacerItem)
-
- self.layout().addLayout(actionLayout)
-
- def setModel(self, model):
- self.tree.setModel(model)
- self.tree.expandAll()
-
- def macroNode(self):
- return self.tree.macroNode()
-
- def setMacroNode(self, macroNode):
- self.tree.setMacroNode(macroNode)
-
-class MacroParametersTree(Qt.QTreeView):
-
- def __init__(self, parent=None, designMode=False):
- Qt.QTreeView.__init__(self, parent)
- self.setSelectionBehavior(Qt.QTreeView.SelectItems)
- self.setRootIsDecorated(False)
-# self.setTabKeyNavigation(True)
- self.setEditTriggers(Qt.QAbstractItemView.AllEditTriggers)
-
- self.addAction = Qt.QAction(getThemeIcon("list-add"), "Add new repetition", self)
- self.connect(self.addAction, Qt.SIGNAL("triggered()"), self.onAddRepeat)
- self.addAction.setToolTip("Clicking this button will add new repetition to current parameter.")
-
- self.deleteAction = Qt.QAction(getThemeIcon("list-remove"), "Remove repetition", self)
- self.connect(self.deleteAction, Qt.SIGNAL("triggered()"), self.onDelRepeat)
- self.deleteAction.setToolTip("Clicking this button will remove current repetition.")
-
- self.moveUpAction = Qt.QAction(getThemeIcon("go-up"), "Move up", self)
- self.connect(self.moveUpAction, Qt.SIGNAL("triggered()"), self.onUpRepeat)
- self.moveUpAction.setToolTip("Clicking this button will move current repetition up.")
-
- self.moveDownAction = Qt.QAction(getThemeIcon("go-down"), "Move down", self)
- self.connect(self.moveDownAction, Qt.SIGNAL("triggered()"), self.onDownRepeat)
- self.moveDownAction.setToolTip("Clicking this button will move current repetition down.")
-
- self.disableActions()
-
-
- def disableActions(self):
- self.addAction.setEnabled(False)
- self.deleteAction.setEnabled(False)
- self.moveUpAction.setEnabled(False)
- self.moveDownAction.setEnabled(False)
-
- def manageActions(self, currentIndex):
- self.disableActions()
- if currentIndex is None:
- return
- node = self.model().nodeFromIndex(currentIndex)
- if isinstance(node, macro.RepeatNode):
- self.deleteAction.setEnabled(not node.parent().isReachedMin())
- self.addAction.setEnabled(False)
- self.moveUpAction.setEnabled(node.isAllowedMoveUp())
- self.moveDownAction.setEnabled(node.isAllowedMoveDown())
- elif isinstance(node, macro.RepeatParamNode):
- self.addAction.setEnabled(not node.isReachedMax())
- self.deleteAction.setEnabled(False)
-
-
- def currentChanged(self, current, previous):
- self.manageActions(current)
- Qt.QTreeView.currentChanged(self, current, previous)
-
- #def focusInEvent(self, event):
- # reason = event.reason()
- # if (reason == Qt.Qt.TabFocusReason) | (reason == Qt.Qt.BacktabFocusReason):
- # if reason == Qt.Qt.TabFocusReason:
- # idx = self.forwardIdx(0, 1, Qt.QModelIndex())
- # elif reason == Qt.Qt.BacktabFocusReason:
- # idx = self.backwardIdx(len(self.root()) - 1, 1, Qt.QModelIndex())
- # self.setCurrentIndex(idx)
- # self.edit(idx)
- # else:
- # Qt.QTreeView.focusInEvent(self, event)
- #
- #def forwardIdx(self, row, col, parentIdx):
- # try:
- # proposalIdx = self.model().index(row, col, parentIdx)
- # except AssertionError:
- # if parentIdx.row() == -1:
- # return Qt.QModelIndex()
- # grandParentIdx = parentIdx.parent()
- # return self.forwardIdx(parentIdx.row() + 1, col, grandParentIdx)
- #
- # proposalNode = self.model().nodeFromIndex(proposalIdx)
- #
- # if isinstance(proposalNode, macro.SingleParamNode):
- # return proposalIdx
- # elif isinstance(proposalNode, macro.RepeatNode):
- # return self.forwardIdx(0, 1, proposalIdx)
- # elif isinstance(proposalNode, macro.RepeatParamNode):
- # if len(proposalNode) > 0:
- # return self.forwardIdx(0, 1, proposalIdx)
- # else:
- # return self.forwardIdx(row + 1, col, proposalIdx)
- # elif not proposalIdx.isValid():
- # proposalIdx = parentIdx.sibling(parentIdx.row()+1, 0)
- # if proposalIdx.isValid():
- # proposalIdx = proposalIdx.child(0,1)
- # else:
- # while not proposalIdx.isValid():
- # parentIdx = parentIdx.parent()
- # if not parentIdx.isValid():
- # return Qt.QModelIndex()
- # proposalIdx = parentIdx.sibling(parentIdx.row()+1, 1)
- #
- # return proposalIdx
- #
- # elif isinstance(proposalNode, macro.MacroNode):
- # ##self.model().setRoot(proposalNode)
- # return self.forwardIdx(0,1,proposalIdx)
- #
- #def backwardIdx(self, row, col, parentIdx):
- # try:
- # proposalIdx = self.model().index(row, col, parentIdx)
- # except AssertionError:
- # if parentIdx.row() == -1:
- # return Qt.QModelIndex()
- # grandParentIdx = parentIdx.parent()
- # return self.backwardIdx(parentIdx.row() - 1, col, grandParentIdx)
- # proposalNode = self.model().nodeFromIndex(proposalIdx)
- # if isinstance(proposalNode, macro.SingleParamNode):
- # return proposalIdx
- # elif isinstance(proposalNode, macro.RepeatNode):
- # return self.backwardIdx(self.model().rowCount(proposalIdx) - 1, 1, proposalIdx)
- # elif isinstance(proposalNode, macro.RepeatParamNode):
- # return self.backwardIdx(self.model().rowCount(proposalIdx) - 1, 1, proposalIdx)
- #
- # elif not proposalIdx.isValid():
- # proposalIdx = parentIdx.sibling(parentIdx.row()-1, 0)
- # if proposalIdx.isValid():
- # tempRow = 0
- # proposalIdx = proposalIdx.child(tempRow,1)
- # while proposalIdx.sibling(tempRow+1, 1).isValid():
- # proposalIdx = proposalIdx.sibling(tempRow+1, 1)
- # tempRow +=1
- # else:
- # while not proposalIdx.isValid():
- # parentIdx = parentIdx.parent()
- # if not parentIdx.isValid():
- # return Qt.QModelIndex()
- # proposalIdx = parentIdx.sibling(parentIdx.row()-1, 1)
- #
- # return proposalIdx
- #
- #def moveCursor (self, cursorAction, modifiers):
- # ix=self.currentIndex()
- # self.manageActions(ix)
- # (col, row, parentIdx)=(ix.column(), ix.row(), ix.parent())
- # #to start from second column
- # if col == -1 and row == -1:
- # if cursorAction == Qt.QAbstractItemView.MoveNext:
- # return self.forwardIdx(0, 1, parentIdx)
- # elif cursorAction == Qt.QAbstractItemView.MovePrevious:
- # return self.backwardIdx(self.model().rowCount(parentIdx) - 1, 1, parentIdx)
- # if (cursorAction == Qt.QAbstractItemView.MoveNext and
- # modifiers == Qt.Qt.NoModifier):
- # #This condition in case we start tabbing with cursor on first column
- # if col == 0:
- # currentNode = self.model().nodeFromIndex(ix)
- # if isinstance(currentNode, macro.SingleParamNode):
- # nextIdx = self.forwardIdx(row, 1, parentIdx)
- # else:
- # nextIdx = self.forwardIdx(0, 1, ix)
- # else:
- # nextIdx = self.forwardIdx(row + 1, 1, parentIdx)
- # #this condition in case there is no next index and we want to pass focus
- # #to next widget in parent obj
- #
- # if nextIdx == "term":
- # self.focusNextPrevChild(True)
- # return Qt.QModelIndex()
- #
- # if not nextIdx.isValid():
- # self.parent().focusNextChild()
- # #this condition in case the next index is valid and we want to
- # #refresh state of buttons
- # else:
- # self.manageActions(nextIdx)
- # return nextIdx
- #
- # elif (cursorAction == Qt.QAbstractItemView.MovePrevious and
- # modifiers == Qt.Qt.NoModifier):
- # backwardIdx = self.backwardIdx(row - 1, 1, parentIdx)
- # #this contion in case there is no previous index and we want to pass focus
- # #to previous widget in parent obj
- # if backwardIdx == "term":
- # self.focusNextPrevChild(False)
- # return Qt.QModelIndex()
- #
- # if not backwardIdx.isValid():
- # self.parent().focusPreviousChild()
- # else:
- # self.manageActions(backwardIdx)
- # return backwardIdx
- #
- #def expanded(self):
- # for column in range(self.model().columnCount(Qt.QModelIndex())):
- # self.resizeColumnToContents(column)
-
- def onAddRepeat(self):
- index = self.currentIndex()
- if isinstance(self.model(), Qt.QSortFilterProxyModel):
- sourceIndex = self.model().mapToSource(index)
- newSourceIndex = self.model()._insertRow(sourceIndex)
- newIndex = self.model().mapFromSource(newSourceIndex)
- else:
- newIndex = self.model()._insertRow(index)
- self.setCurrentIndex(newIndex)
- self.expandAll()
-
- def onDelRepeat(self):
- index = self.currentIndex()
- if isinstance(self.model(), Qt.QSortFilterProxyModel):
- index = self.model().mapToSource(index)
- self.model()._removeRow(index)
- self.expandAll()
-
- def onUpRepeat(self):
- index = self.currentIndex()
- if isinstance(self.model(), Qt.QSortFilterProxyModel):
- sourceIndex = self.model().mapToSource(index)
- newSourceIndex = self.model()._upRow(sourceIndex)
- newIndex = self.model().mapFromSource(newSourceIndex)
- else:
- newIndex = self.model()._upRow(index)
- self.setCurrentIndex(newIndex)
- self.expandAll()
-
- def onDownRepeat(self):
- index = self.currentIndex()
- if isinstance(self.model(), Qt.QSortFilterProxyModel):
- sourceIndex = self.model().mapToSource(index)
- newSourceIndex = self.model()._downRow(sourceIndex)
- newIndex = self.model().mapFromSource(newSourceIndex)
- else:
- newIndex = self.model()._downRow(index)
- self.setCurrentIndex(newIndex)
- self.expandAll()
-
-class ParamEditorManager(Singleton):
-
- def init(self):
- self._paths = []
- self._macroEditorsDict = {}
-
- def paths(self):
- return self._paths
-
- def setPaths(self, paths):
- self._paths = paths
-
- def appendPath(self, path):
- self._paths.append()
-
- def parsePaths(self, pathsString):
- self.setPaths(pathsString.split(":"))
-
- def browsePaths(self):
- for path in self.paths():
- modulePaths = glob.glob("%s/*.py" % path)
- if not modulePaths:
- continue
-
- sys.path.insert(0, path)
- for modulePath in modulePaths:
- if modulePath.endswith("__init__.py"):
- continue
- modulePathAsArray = modulePath.split("/")
- moduleFileName = modulePathAsArray[-1]
- moduleName = moduleFileName[:-3]
-
- try:
- module = __import__(moduleName)
- except ImportError:
- continue
- klass = getattr(module, "CUSTOM_EDITOR", None)
-# for name, klass in inspect.getmembers(module, inspect.isclass):
-# if issubclass(klass, MacroParametersEditor):
- self._macroEditorsDict[moduleName] = klass
-
- def getMacroEditor(self, macroName=None, parent=None):
- editorClass = self._macroEditorsDict.get(macroName, None)
- try:
- return editorClass(parent=parent)
- except:
- return None
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/model.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/model.py
deleted file mode 100644
index b023958f..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/model.py
+++ /dev/null
@@ -1,225 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-model.py:
-"""
-
-from lxml import etree
-
-from taurus.external.qt import Qt
-
-from sardana.taurus.core.tango.sardana import macro
-from sardana.taurus.qt.qtgui.extra_macroexecutor import globals
-
-
-class ParamEditorModel(Qt.QAbstractItemModel):
-
- def __init__(self, parent=None):
- Qt.QAbstractItemModel.__init__(self, parent)
- self.columns = 2
- self.setRoot()
- self.headers = ["Parameter", "Value"]
-
- def root(self):
- return self._root
-
- def setRoot(self, node=None):
- if node == None: node = macro.MacroNode()
- self._root = node
- self.reset()
-
- def flags(self, index):
- if index.column() == 0:
- return Qt.Qt.ItemIsEnabled | Qt.Qt.ItemIsSelectable
-
- node = self.nodeFromIndex(index)
-
- if (index.column() == 1 and
- isinstance(node, macro.SingleParamNode) and
- not node.type() in globals.EDITOR_NONEDITABLE_PARAMS):
- return Qt.Qt.ItemIsEnabled | Qt.Qt.ItemIsEditable
- return Qt.Qt.ItemIsEnabled
-
- def _insertRow(self, parentIndex, node=None, row=-1):
- parentNode = self.nodeFromIndex(parentIndex)
-
- if row == -1: row = len(parentNode)
-
- if node == None: node = parentNode.newRepeat()
-
- self.beginInsertRows(parentIndex, row, row)
- row = parentNode.insertChild(node, row)
- self.endInsertRows()
-
- return self.index(row, 0, parentIndex)
-
- def _removeRow(self, index):
- """This method is used remove macro (pased via index)"""
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- parentNode = self.nodeFromIndex(parentIndex)
- row = parentNode.rowOfChild(node)
- self.beginRemoveRows(parentIndex, row, row)
- parentNode.removeChild(node)
- self.endRemoveRows()
-
- def _upRow(self, index):
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- parentNode = self.nodeFromIndex(parentIndex)
- row = parentNode.rowOfChild(node)
- self._removeRow(index)
- newIndex = self._insertRow(parentIndex, node, row - 1)
- parentNode.arrangeIndexes()
- return newIndex
-
- def _downRow(self, index):
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- parentNode = self.nodeFromIndex(parentIndex)
- row = parentNode.rowOfChild(node)
- self._removeRow(index)
- newIndex = self._insertRow(parentIndex, node, row + 1)
- parentNode.arrangeIndexes()
- return newIndex
-
-
- def addRepeat(self, index, callReset=True):
- paramRepeatNode = self.nodeFromIndex(index)
- paramRepeatNode.addRepeat()
- if callReset:
- self.reset()
-
- def delRepeat(self, index, callReset=True):
- branchIndex = self.parent(index)
- branch = self.nodeFromIndex(branchIndex)
- child = self.nodeFromIndex(index)
- branch.removeChild(child)
- if callReset:
- self.reset()
-
- def upRepeat(self, index, callReset=True):
- branchIndex = self.parent(index)
- branch = self.nodeFromIndex(branchIndex)
- child = self.nodeFromIndex(index)
- branch.upChild(child)
- if callReset:
- self.reset()
-
- def downRepeat(self, index, callReset=True):
- branchIndex = self.parent(index)
- branch = self.nodeFromIndex(branchIndex)
- child = self.nodeFromIndex(index)
- branch.downChild(child)
- if callReset:
- self.reset()
-
- def rowCount(self, index):
- node = self.nodeFromIndex(index)
- if node is None or isinstance(node, macro.SingleParamNode):
- return 0
- return len(node)
-
- def columnCount(self, parent):
- return self.columns
-
- def data(self, index, role):
- if not index.isValid() or not (0 <= index.row() < self.rowCount(index.parent())):
- return Qt.QVariant()
-
- if role == Qt.Qt.DisplayRole:
- node = self.nodeFromIndex(index)
- if index.column() == 0:
- return Qt.QVariant(node.name())
- elif index.column() == 1:
- return Qt.QVariant(node.value())
-
- return Qt.QVariant()
-
-
- def setData (self, index, value, role=Qt.Qt.EditRole):
- node = self.nodeFromIndex(index)
-# if index.isValid() and 0 <= index.row() < len(node.parent()):
- if index.column() == 1:
- node.setValue(Qt.from_qvariant(value, str))
- self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
- return True
- return False
-
- def headerData(self, section, orientation, role):
- if orientation == Qt.Qt.Horizontal and role == Qt.Qt.DisplayRole:
- return Qt.QVariant(self.headers[section])
- return Qt.QVariant()
-
- def index(self, row, column, parent):
- if not parent.isValid():
- parentNode = self.root();
- else:
- parentNode = parent.internalPointer()
- childNode = parentNode.child(row)
- if childNode is None:
- return Qt.QModelIndex();
- else:
- return self.createIndex(row, column, childNode);
-
-
- def parent(self, child):
- node = self.nodeFromIndex(child)
- if node is None:
- return Qt.QModelIndex()
- parent = node.parent()
- if parent is None or isinstance(parent, macro.SequenceNode):
- return Qt.QModelIndex()
- grandparent = parent.parent()
- if grandparent is None:
- return Qt.QModelIndex()
- row = grandparent.rowOfChild(parent)
- return self.createIndex(row, 0, parent)
-
- def nodeFromIndex(self, index):
- if index.isValid():
- return index.internalPointer()
- else:
- return self.root()
-
- def toSpockCommand(self):
- """
- Converts root obj (MacroNode) to string representing spock command and returns it.
-
- :return: (etree.Element)
- """
-
- return self.root().toSpockCommand()
-
- def toXmlString(self):
- """
- Converts root obj (MacroNode) to xml string and returns it.
-
- :return: (etree.Element)
- """
-
- xmlElement = self.root().toXml()
- return etree.tostring(xmlElement)
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/parameditors.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/parameditors.py
deleted file mode 100644
index 22a9b9ea..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/macroparameterseditor/parameditors.py
+++ /dev/null
@@ -1,327 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-parameditors.py:
-"""
-
-import os
-
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.input import TaurusAttrListComboBox
-
-from sardana.taurus.qt.qtgui.extra_macroexecutor import globals
-from sardana.taurus.qt.qtgui.extra_macroexecutor.common import MSAttrListComboBox
-
-#@todo: replace by method from common module
-def str2bool(text):
- return text in ("True", "1")
-
-class ParamBase:
-
- def __init__(self, paramModel=None):
- self.setParamModel(paramModel)
-
- def paramModel(self):
- return self._paramModel
-
- def setParamModel(self, paramModel):
- self._paramModel = paramModel
-
- def resetValue(self):
- if self.paramModel() is not None:
- defValue = self.paramModel().defValue()
- self.setValue(defValue)
-
- def index(self):
- return self._index
-
- def setIndex(self, index):
- self._index = index
- paramModel = index.model().nodeFromIndex(index)
- self.setParamModel(paramModel)
- self.connect(self, Qt.SIGNAL("modelChanged()"), self.onModelChanged)
- self.setValue(paramModel.value())
-
- def onModelChanged(self):
- model = self.index().model()
- model.setData(self.index(), Qt.QVariant(self.getValue()))
-
-class ComboBoxBoolean(ParamBase, Qt.QComboBox):
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QComboBox.__init__(self, parent)
-
- self.addItems(['True', 'False'])
- self.connect(self, Qt.SIGNAL("currentIndexChanged(int)"), self.onCurrentIndexChanged)
-
- def getValue(self):
- return str(self.currentText())
-
- def setValue(self, value):
- currentIdx = self.currentIndex()
- idx = self.findText(value)
- if currentIdx == idx:
- self.emit(Qt.SIGNAL("currentIndexChanged(int)"), self.currentIndex())
- else:
- self.setCurrentIndex(idx)
-
- def onCurrentIndexChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
-class ComboBoxParam(ParamBase, Qt.QComboBox):
-
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QComboBox.__init__(self, parent)
- self.connect(self, Qt.SIGNAL("currentIndexChanged(int)"), self.onCurrentIndexChanged)
-
- def getValue(self):
- return str(self.currentText())
-
- def setValue(self, value):
- currentIdx = self.currentIndex()
- idx = self.findText(value)
- if currentIdx == idx:
- self.emit(Qt.SIGNAL("currentIndexChanged(int)"), self.currentIndex())
- else:
- self.setCurrentIndex(idx)
-
- def onCurrentIndexChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
-class MSAttrListComboBoxParam(ParamBase, MSAttrListComboBox):
-
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- MSAttrListComboBox.__init__(self, parent)
-# self.setUseParentModel(True)
-# self.setModel("/" + self.paramModel().type() + "List")
- self.connect(self, Qt.SIGNAL("currentIndexChanged(int)"), self.onCurrentIndexChanged)
-
- def getValue(self):
- return str(self.currentText())
-
- def setValue(self, value):
- self.setCurrentText(value)
-
- def onCurrentIndexChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
-
-class AttrListComboBoxParam(ParamBase, TaurusAttrListComboBox):
-
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- TaurusAttrListComboBox.__init__(self, parent)
- self.setModel("/" + self.paramModel().type() + "List")
-# self.setToolTip(self.paramModel().description())
-
-
- def handleEvent(self, src, type, value):
- self.clear()
- if src and value:
- lines = list(value.value)
- items = []
- if self.paramModel().type() == globals.PARAM_CONTROLLER_CLASS:
- for line in lines:
- items.append(line.split()[4])
- else:
- for line in lines:
- items.append(line.split()[0])
- items.sort()
- self.addItems(items)
- # self.updateStyle()
-
- def getValue(self):
- return str(self.currentText())
-
-# def resetValue(self):
-# self.setCurrentIndex(0)
-
-
-class LineEditParam(ParamBase, Qt.QLineEdit):
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QLineEdit.__init__(self, parent)
- self.connect(self, Qt.SIGNAL("textChanged(const QString&)"), self.onTextChanged)
-# self.setToolTip(self.paramModel().description())
-
- def onTextChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
-# def setDefaultValue(self):
-# defVal = self.paramModel().defValue()
-# if not (defVal == "None" or defVal == ""):
-# self.setText(defVal)
-
- def setValue(self, value):
- self.setText(value)
-
- def getValue(self):
- return str(self.text())
-
-# def resetValue(self):
-# self.setText("")
-# self.setDefaultValue()
-
-class CheckBoxParam(ParamBase, Qt.QCheckBox):
-
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QCheckBox.__init__(self, parent)
- self.connect(self, Qt.SIGNAL("stateChanged(int)"), self.onStateChanged)
-
- def getValue(self):
- return str(self.isChecked())
-
- def setValue(self, value):
- self.setChecked(str2bool(value))
-
- def onStateChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
-
-class SpinBoxParam(ParamBase, Qt.QSpinBox):
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QSpinBox.__init__(self, parent)
- self.setRange(-999999999, 999999999)
- self.setAccelerated(True)
-# self.setToolTip(self.paramModel().description())
-
- def getValue(self):
- return str(self.value())
-
- def setValue(self, value):
- Qt.QSpinBox.setValue(self, int(value))
-
-# def resetValue(self):
-# self.setValue(0)
-# self.setDefaultValue()
-
-class DoubleSpinBoxParam(ParamBase, Qt.QDoubleSpinBox):
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QDoubleSpinBox.__init__(self, parent)
- self.setRange(-999999999.999999, 999999999.999999)
- self.setAccelerated(True)
- self.setDecimals(6)
- self.setSingleStep(0.000001)
-# self.setToolTip(self.paramModel().description())
-
- def getValue(self):
- return str(self.value())
-
- def setValue(self, value):
- Qt.QDoubleSpinBox.setValue(self, float(value))
-
-# def setDefaultValue(self):
-# defVal = self.paramModel().defValue()
-# if not (defVal == "None" or defVal == ""):
-# defVal = defVal.lower()
-# try:
-# val = float(defVal)
-# self.setValue(val)
-# except Error, e:
-# pass
-#
-# def resetValue(self):
-# self.setValue(0.0)
-# self.setDefaultValue()
-
-class FileDialogParam(ParamBase, Qt.QWidget):
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QWidget.__init__(self, parent)
- self.setToolTip(self.paramModel().description())
- self.layout = Qt.QHBoxLayout(self)
- self.layout.setContentsMargins(0, 0, 0, 0)
- self.filePath = Qt.QLineEdit(self)
- self.layout.addWidget(self.filePath)
- self.button = Qt.QPushButton(self)
- self.button.setText("...")
- self.layout.addWidget(self.button)
-
- self.text = ""
-
- Qt.QObject.connect(self.button, Qt.SIGNAL("clicked()"), self._chooseAFile)
-
- def _chooseAFile(self):
- path = Qt.QFileDialog().getOpenFileName()
- self.filePath.setText(path)
-
- def _readFileContent(self, path):
- content = ""
- if not os.access(path, os.R_OK):
- return (False, content)
- file = open(path, "r")
- line = "nonempty"
- while(line != ""):
- line = file.readline()
- content = content + line
- file.close()
- return (True, content)
-
- def getValue(self):
- state, self.text = self._readFileContent(self.filePath.text())
- if state is False:
- self.filePath.setText("Error: couldn't read a file")
- return str(self.text)
-
- def setValue(self, value):
- self.filePath.setText(value)
-
-class DirPathParam(ParamBase, Qt.QWidget):
-
- def __init__(self, parent=None, paramModel=None):
- ParamBase.__init__(self, paramModel)
- Qt.QWidget.__init__(self, parent)
-
- self.layout = Qt.QHBoxLayout(self)
- self.layout.setContentsMargins(0, 0, 0, 0)
- self.dirPath = Qt.QLineEdit(self)
- self.layout.addWidget(self.dirPath)
- self.button = Qt.QPushButton(self)
- self.button.setText("...")
- self.layout.addWidget(self.button)
-
- self.connect(self.button, Qt.SIGNAL("clicked()"), self.__chooseDirPath)
- self.connect(self.dirPath, Qt.SIGNAL("textChanged(const QString&)"), self.onDirPathChanged)
-
- def onDirPathChanged(self):
- self.emit(Qt.SIGNAL("modelChanged()"))
-
- def __chooseDirPath(self):
- path = Qt.QFileDialog().getExistingDirectory()
- self.setValue(path)
-
- def getValue(self):
- return str(self.dirPath.text())
-
- def setValue(self, value):
- self.dirPath.setText(value)
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/scanplotter.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/scanplotter.py
deleted file mode 100644
index 6a353ac5..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/scanplotter.py
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-scanplotter.py:
- module containing the widget: scanplotter,
- to be used in the Taurus app "scanner.py"
-"""
-
-import taurus.core
-
-from taurus.external.qt import QtGui, Qwt5
-#from taurus.qt.Qt import *
-
-from taurus.core.util import dictFromSequence
-from taurus.core.util.containers import CaselessDict
-from taurus.core.util import eventfilters
-from taurus.qt.qtgui.plot import TaurusTrend
-
-
-class ScanPlotter(TaurusTrend):
-
- def __init__(self, parent=None, designMode=False):
-
- TaurusTrend.__init__(self, parent, designMode)
- self.setUseParentModel(False)
- self._plotables = CaselessDict()
- self._movingMotors = []
- self._macroNames = []
- self._doorName = None
-
- self.setMinimumSize(300, 200)
- self.setXIsTime(True)
- self.setAxisScale(Qwt5.QwtPlot.xBottom, 0, 60)
- self.setXDynScale(True)
-
- def onSequenceCleared(self):
- self._movingMotors = []
- self._macroNames = []
- self.populatePlotables()
-
- def onMacrosAdded(self, macroNames, motors):
- for macro in macroNames:
- self._macroNames.append(macro)
- self._movingMotors += motors
- self.populatePlotables()
-
- def onMacroEdited(self, oldMotors, newMotors):
- for motor in oldMotors:
- self._movingMotors.remove(motor)
- self._movingMotors += newMotors
- self.populatePlotables()
-
- def onMacrosDeleted(self, macroNames, motors):
- for macro in macroNames:
- self._macroNames.remove(macro)
- for motor in motors:
- self._movingMotors.remove(motor)
- self.populatePlotables()
-
- def onMacroStarted(self, macroName, motors):
- self._macroNames = [macroName]
- self._movingMotors = motors
- self.populatePlotables()
-
- def onMotorChanged(self, oldMotor, newMotor):
- if oldMotor in self._movingMotors:
- self._movingMotors.remove(oldMotor)
- self._movingMotors.append(newMotor)
- self.populatePlotables()
-
- def onMacroChanged(self, macroNode):
- if macroNode is None:
- self._macroNames = []
- self._movingMotors = []
-# return
- else:
- self._macroNames = [macroNode.name()]
- self._movingMotors = macroNode.allMotors()
- self.populatePlotables()
-
- def onDoorChanged(self, doorName):
- self._doorName = doorName
- self._movingMotors = []
- self.populatePlotables()
-
- def getPlotables(self, macronames=None, doorname=None, movingmotors=None):
- """returns a list of plotables for this scan given macro (channels and moving motors)"""
- plotables = []
- if macronames is None: macronames = list(set(self._macroNames))
- if doorname is None: doorname = self._doorName
- if movingmotors is None: movingmotors = list(set(self._movingMotors))
- if doorname is None or not len(macronames):
- return plotables
- door = taurus.Device(doorname)
-
-
- for macroname in macronames:
- env = dictFromSequence(door.getMacroEnv([macroname]))
- mntgrp_name = env.get("ActiveMntGrp")
- if mntgrp_name is None:
- continue
- mntgrp = taurus.Device(mntgrp_name)
- channels = mntgrp.getAttribute('Channels').read()
- channelsList = channels.value
- timer_name = mntgrp.getAttribute('Timer').read().value.lower()
- plotables += [('%s/%s_value' % (mntgrp_name, ch)).lower() for ch in channelsList if ch.lower() != timer_name]
-
- for m in movingmotors:
- if not (m is None or m == "" or m == "None"):
- plotables += ["%s/position" % m]
- return plotables
-
- def populatePlotables(self, plotables=None):
- ##@TODO: The name in the legend should be more descriptive: i.e. "dev/attr" instead of "attr" (this probably has to be changed for taurusplot in general )
- if plotables is None: plotables = self.getPlotables()
- self.setModel(plotables)
- self.curves_lock.acquire()
- try:
- for name in self.getTrendSetNames():
- ts = self.getTrendSet(name)
- ts.fireEvent(None, taurus.core.taurusbasetypes.TaurusEventType.Change, None)
- finally:
- self.curves_lock.release()
- self.setEventFilters([eventfilters.ONLY_VALID], plotables)
-
-if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- form = ScanPlotter()
- if len(sys.argv) < 4: raise ValueError('Syntax: ' + sys.argv[0] + ' macroname doorname plotable [anotherplotable...]')
- form._macroName = sys.argv[1]
- form._doorName = sys.argv[2]
- form.populatePlotables(sys.argv[3:])
- form.show()
- sys.exit(app.exec_())
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/__init__.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/__init__.py
deleted file mode 100644
index 8866e60f..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-__init__.py:
-"""
-
-from sequenceeditor import TaurusSequencer, TaurusSequencerWidget, main
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/delegate.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/delegate.py
deleted file mode 100644
index c8cbb7d0..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/delegate.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-delegate.py:
-"""
-
-from taurus.external.qt import Qt
-
-from sardana.taurus.core.tango.sardana import macro
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.parameditors import \
- AttrListComboBoxParam, SpinBoxParam, \
- DoubleSpinBoxParam, LineEditParam, FileDialogParam
-
-from sardana.taurus.qt.qtgui.extra_macroexecutor import globals
-
-class SequenceEditorDelegate(Qt.QItemDelegate):
-
- def __init__(self, parent=None):
- Qt.QItemDelegate.__init__(self, parent)
-
- def paint(self, painter, option, index):
- if index.column() == 2:
- macroNode = index.model().nodeFromIndex(index)
- opts = Qt.QStyleOptionProgressBarV2()
- opts.rect = option.rect
- range = macroNode.range()
- opts.minimum = range[0]
- opts.maximum = range[1]
- opts.textVisible = True
- percent = macroNode.progress()
- opts.progress = percent
-# opts.text = Qt.QString('Unavailable' if percent == 0 else '%d%%'%percent)
- opts.text = Qt.QString('%d%%' % percent)
-# opts.text = Qt.QString(percent)
- Qt.QApplication.style().drawControl(Qt.QStyle.CE_ProgressBar, opts, painter)
- else:
- Qt.QItemDelegate.paint(self, painter, option, index)
-
-
- def createEditor(self, parent, option, index):
- if index.column() == 3:
- return Qt.QCheckBox(parent)
- else:
- return Qt.QItemDelegate.createEditor(self, parent, option, index)
-
- def setEditorData(self, editor, index):
- node = index.model().mapToSource(index).internalPointer()
- if index.column() == 3: #and isinstance(node, MacroNode):
- editor.setChecked(node.isPause())
- else:
- Qt.QItemDelegate.setEditorData(self, editor, index)
-
- def setModelData(self, editor, model, index):
- if index.column() == 3:
- model.setData(index, Qt.QVariant(editor.isChecked()))
-
-class MacroParametersProxyDelegate(Qt.QItemDelegate):
-
- def __init__(self, parent=None):
- Qt.QItemDelegate.__init__(self, parent)
-
- def createEditor(self, parent, option, index):
- if index.column() == 1:
- node = index.model().nodeFromIndex(index)
- if isinstance(node, macro.SingleParamNode):
- paramType = node.type()
- if paramType in globals.EDITOR_COMBOBOX_PARAMS:
- comboBox = AttrListComboBoxParam(parent, node)
- comboBox.setUseParentModel(True)
- return comboBox
- elif paramType in globals.EDITOR_SPINBOX_PARAMS:
- return SpinBoxParam(parent, node)
- elif paramType in globals.EDITOR_DOUBLESPINBOX_PARAMS:
- return DoubleSpinBoxParam(parent, node)
- elif paramType in globals.EDITOR_LINEEDIT_PARAMS:
- return LineEditParam(parent, node)
- elif paramType in globals.EDITOR_FILEDIALOG_PARAMS:
- return FileDialogParam(parent, node)
- return Qt.QItemDelegate.createEditor(self, parent, option, index)
-
- def setEditorData(self, editor, index):
- if index.column() == 1:
- text = Qt.from_qvariant(index.model().data(index, Qt.Qt.DisplayRole), str)
- if text == "None" or text == "":
- pass
- else:
- node = index.model().mapToSource(index).internalPointer()
- paramType = node.type()
- if paramType in globals.EDITOR_COMBOBOX_PARAMS :
- i = editor.findText(text)
- if i == -1:
- i = 0
- else:
- editor.previous = text
- editor.setCurrentIndex(i)
- elif paramType in globals.EDITOR_SPINBOX_PARAMS:
- editor.setValue(int(text))
- elif paramType in globals.EDITOR_DOUBLESPINBOX_PARAMS:
- editor.setValue(float(text))
- elif paramType in globals.EDITOR_LINEEDIT_PARAMS:
- editor.setText(text)
- elif paramType in globals.EDITOR_FILEDIALOG_PARAMS:
- editor.filePath.setText(text)
- else:
- Qt.QItemDelegate.setEditorData(self, editor, index)
-
- def setModelData(self, editor, model, index):
- if index.column() == 1:
- model.setData(index, Qt.QVariant(editor.getValue()))
-
- def sizeHint(self, option, index):
- if index.column() == 0:
- fm = option.fontMetrics
- text = Qt.from_qvariant(index.model().data(index, Qt.Qt.DisplayRole), str)
- document = Qt.QTextDocument()
- document.setDefaultFont(option.font)
- document.setHtml(text)
- size = Qt.QSize(document.idealWidth() + 5, fm.height())
- elif index.column() == 1:
- editor = self.createEditor(self.parent(), option, index)
- if editor is None:
- size = Qt.QItemDelegate.sizeHint(self, option, index)
- else:
- size = editor.sizeHint()
- editor.hide()
- editor.setParent(None)
-# editor.destroy()
- else:
- size = Qt.QItemDelegate.sizeHint(self, option, index)
- return size
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/model.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/model.py
deleted file mode 100644
index 6c1ed692..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/model.py
+++ /dev/null
@@ -1,408 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-model.py:
-"""
-
-from lxml import etree
-
-from taurus.external.qt import Qt
-from sardana.taurus.core.tango.sardana import macro
-
-
-class MacroSequenceTreeModel(Qt.QAbstractItemModel):
-
- def __init__(self, parent=None):
- Qt.QAbstractItemModel.__init__(self, parent)
- self.columns = 4
- self.setRoot(macro.SequenceNode())
- self.headers = ["Macro", "Parameters", "Progress", "Pause"]
-
- def root(self):
- return self._root
-
- def setRoot(self, root):
- self._root = root
- self.reset()
-
- def clearSequence(self):
- self.setRoot(macro.SequenceNode())
-
- def isEmpty(self):
- return len(self.root()) == 0
-
- def flags(self, index):
- column = index.column()
- node = self.nodeFromIndex(index)
- flags = Qt.Qt.ItemIsEnabled
-
- if column == 0:
- flags |= Qt.Qt.ItemIsSelectable
-
- elif column == 1:
- if isinstance(node, macro.SingleParamNode) and \
- not node.type() == "User":
- flags |= Qt.Qt.ItemIsEditable
- else:
- flags |= Qt.Qt.ItemIsSelectable
-
- elif column == 2:
- flags |= Qt.Qt.ItemIsSelectable
-
- elif index.column() == 3:
- flags |= (Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsEditable)
-
- if isinstance(node, macro.MacroNode):
- flags |= Qt.Qt.ItemIsDragEnabled
- if node.isAllowedHooks():
- flags |= Qt.Qt.ItemIsDropEnabled
- return flags
-
- def _insertRow(self, parentIndex, node=None, row=-1):
- parentNode = self.nodeFromIndex(parentIndex)
-
- if row == -1: row = len(parentNode)
-
- if isinstance(parentNode, macro.RepeatParamNode):
- if node == None: node = parentNode.newRepeat()
-
- self.beginInsertRows(parentIndex, row, row)
- row = parentNode.insertChild(node, row)
- self.endInsertRows()
-
- return self.index(row, 0, parentIndex)
-
- def _removeRow(self, index):
- """This method is used remove macro (pased via index)"""
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- parentNode = self.nodeFromIndex(parentIndex)
- row = parentNode.rowOfChild(node)
- self.beginRemoveRows(parentIndex, row, row)
- parentNode.removeChild(node)
- self.endRemoveRows()
-
- def _upRow(self, index):
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- parentNode = self.nodeFromIndex(parentIndex)
- row = parentNode.rowOfChild(node)
- self._removeRow(index)
- newIndex = self._insertRow(parentIndex, node, row - 1)
- if isinstance(parentNode, macro.RepeatParamNode):
- parentNode.arrangeIndexes()
- return newIndex
-
- def _downRow(self, index):
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- parentNode = self.nodeFromIndex(parentIndex)
- row = parentNode.rowOfChild(node)
- self._removeRow(index)
- newIndex = self._insertRow(parentIndex, node, row + 1)
- if isinstance(parentNode, macro.RepeatParamNode):
- parentNode.arrangeIndexes()
- return newIndex
-
- def _leftRow(self, index):
- """This method is used to move selected macro (pased via index)
- to it's grandparent's hook list. In tree representation it basically move macro to the left"""
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- grandParentIndex = parentIndex.parent()
- self._removeRow(index)
- return self._insertRow(grandParentIndex, node)
-
- def _rightRow(self, index):
- """This method is used to move selected macro (pased via index)
- to it's grandparent's hook list. In tree representation it basically move macro to the left"""
- node = self.nodeFromIndex(index)
- parentIndex = index.parent()
- row = index.row()
- self._removeRow(index)
- newParentIndex = self.index(row, 0, parentIndex)
- return self._insertRow(newParentIndex, node)
-
- def rowCount(self, parent):
- branchNode = self.nodeFromIndex(parent)
- return len(branchNode)
-
- def columnCount(self, parent):
- return self.columns
-
- def data(self, index, role):
- if role == Qt.Qt.DisplayRole:
- node = self.nodeFromIndex(index)
- if index.column() == 0:
- return Qt.QVariant(node.name())
- elif index.column() == 1:
- return Qt.QVariant(node.value())
- elif index.column() == 2:
- if isinstance(node, macro.MacroNode):
- return Qt.QVariant(node.progress())
- elif role == Qt.Qt.DecorationRole:
- node = self.nodeFromIndex(index)
- if index.column() == 3:
- if isinstance(node, macro.MacroNode):
- if node.isPause():
- return Qt.QVariant(Qt.QIcon(":/actions/media-playback-pause.svg"))
- return Qt.QVariant()
-
- def setData (self, index, value, role=Qt.Qt.EditRole):
- node = self.nodeFromIndex(index)
- if index.column() == 1:
- if isinstance(node, macro.SingleParamNode):
- node.setValue(Qt.from_qvariant(value, str))
- self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
- while True:
- index = index.parent()
- node = self.nodeFromIndex(index)
- if isinstance(node, macro.MacroNode):
- self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index.sibling(index.row(), self.columnCount(index)))
- break
- elif index.column() == 2:
- progress = Qt.from_qvariant(value, float)
- node.setProgress(progress)
- self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
- elif index.column() == 3:
- node.setPause(Qt.from_qvariant(value, bool))
- self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
- return True
-
-
- def headerData(self, section, orientation, role):
- if orientation == Qt.Qt.Horizontal and role == Qt.Qt.DisplayRole:
- return Qt.QVariant(self.headers[section])
- return Qt.QVariant()
-
- def index(self, row, column, parent):
- assert self.root() is not None
- branchNode = self.nodeFromIndex(parent)
- assert branchNode is not None
- return self.createIndex(row, column, branchNode.child(row))
-
- def parent(self, child):
- node = self.nodeFromIndex(child)
- if node is None:
- return Qt.QModelIndex()
- parent = node.parent()
- if parent is None:
- return Qt.QModelIndex()
- grandparent = parent.parent()
- if grandparent is None:
- return Qt.QModelIndex()
- row = grandparent.rowOfChild(parent)
- assert row != -1
- return self.createIndex(row, 0, parent)
-
- def nodeFromIndex(self, index):
- if index.isValid():
- return index.internalPointer()
- else:
- return self.root()
-
- def toXmlString(self, pretty=False, withId=True):
- xmlSequence = self.root().toXml(withId=withId)
- xmlTree = etree.ElementTree(xmlSequence)
- xmlString = etree.tostring(xmlTree, pretty_print=pretty)
- return xmlString
-
- def fromXmlString(self, xmlString):
- xmlElement = etree.fromstring(xmlString)
- newRoot = macro.SequenceNode(None)
- newRoot.fromXml(xmlElement)
- self.setRoot(newRoot)
- self.reset()
- return newRoot
-
- def fromPlainText(self, text):
- newRoot = macro.SequenceNode(None)
- newRoot.fromPlainText(text)
- self.setRoot(newRoot)
- self.reset()
- return newRoot
-
- def assignIds(self):
- """
- Assigns ids for all macros present in the sequence. If certain macro
- already had an id, it stays without change. A list of all ids is returned
-
- :return: (list)
- """
- parentNode = self.root()
- return self.__assignIds(parentNode)
-
- def __assignIds(self, parentNode):
- ids = []
- for childNode in parentNode.children():
- if isinstance(childNode, macro.MacroNode):
- id = childNode.assignId()
- ids.append(id)
- ids.extend(self.__assignIds(childNode))
- return ids
-
- def firstMacroId(self):
- return self.root().child(0).id()
-
- def lastMacroId(self):
- root = self.root()
- return root.child(len(root.children()) - 1).id()
-
- def createIdIndexDictionary(self):
- parentIndex = Qt.QModelIndex()
- parentNode = self.root()
- return self.__createIdIndexDictionary(parentIndex, parentNode)
-
- def __createIdIndexDictionary(self, parentIndex, parentNode):
- d = {}
- for row, child in enumerate(parentNode.children()):
- if isinstance(child, macro.MacroNode):
- index = self.index(row, 0, parentIndex)
- d[child.id()] = index
- d.update(self.__createIdIndexDictionary(index, child))
- return d
-
-# def supportedDropActions(self):
-# return Qt.Qt.CopyAction | Qt.Qt.MoveAction
-
-# def mimeTypes(self):
-# types = Qt.QStringList()
-# types.append("text/xml")
-# return types
-
-# def mimeData(self, indexes):
-# mimeData = Qt.QMimeData()
-# encodedData = Qt.QByteArray()
-# stream = Qt.QDataStream(encodedData, Qt.QIODevice.WriteOnly)
-# doc = xml.dom.minidom.Document()
-# for i,index in enumerate(indexes):
-# if i % 2:
-# continue
-# text = self.nodeFromIndex(index).toXml(doc).toxml()
-# stream.writeString(text)
-#
-# mimeData.setData("text/xml", encodedData)
-# return mimeData
-#
-# def dropMimeData(self, data, action, row, column, parent):
-# if action == Qt.Qt.IgnoreAction:
-# return True
-# if not data.hasFormat("text/xml"):
-# return False
-#
-# encodedData = data.data("text/xml")
-# stream = Qt.QDataStream(encodedData, Qt.QIODevice.ReadOnly)
-# newItems = Qt.QStringList()
-# rows = 0
-#
-# while(not stream.atEnd()):
-# text = stream.readString()
-# newItems.append(text)
-# rows += 1
-#
-# sequence = self.nodeFromIndex(parent)
-#
-# for text in newItems:
-# macroNode = macro.MacroNode()
-# macroNode.fromDoc(xml.dom.minidom.parseString(text))
-# self.insertMacro(sequence, macroNode, row, False)
-# macros = [macro.name() for macro in macroNode.allMacros()]
-# if action == Qt.Qt.CopyAction:
-# self.emit(Qt.SIGNAL("macrosAdded"), macros, macroNode.allMotors())
-# self.emit(Qt.SIGNAL("dataChanged"))
-# return True
-
-
-class MacroSequenceProxyModel(Qt.QSortFilterProxyModel):
-
- def __init__(self, parent=None):
- Qt.QSortFilterProxyModel.__init__(self, parent)
- self.setDynamicSortFilter(True)
- self.headers = ["Macro", "Parameters", "Progress", "Pause"]
- self.columns = 4
-
- def __getattr__(self, name):
- return getattr(self.sourceModel(), name)
-
- def nodeFromIndex(self, index):
- sourceIndex = self.mapToSource(index)
- node = self.sourceModel().nodeFromIndex(sourceIndex)
- return node
-
- def createIdIndexDictionary(self):
- d = self.sourceModel().createIdIndexDictionary()
- for id, sourceIndex in d.iteritems():
- proxyIndex = self.mapFromSource(sourceIndex)
- d[id] = Qt.QPersistentModelIndex(proxyIndex)
- return d
-
- def filterAcceptsRow(self, row, parentIndex):
- child = self.sourceModel().index(row, 0, parentIndex)
- node = self.sourceModel().nodeFromIndex(child)
- return isinstance(node, macro.MacroNode)
-
-class MacroParametersProxyModel(Qt.QSortFilterProxyModel):
-
- def __init__(self, parent=None):
- Qt.QSortFilterProxyModel.__init__(self, parent)
- self.columns = 2
- self.headers = ["Parameter", "Value", "", "", "", ""]
- self._macroIndex = None
-
- def __getattr__(self, name):
- return getattr(self.sourceModel(), name)
-
- def headerData(self, section, orientation, role):
- if orientation == Qt.Qt.Horizontal and role == Qt.Qt.DisplayRole:
- return Qt.QVariant(self.headers[section])
- return Qt.QVariant()
-
- def nodeFromIndex(self, index):
- sourceIndex = self.mapToSource(index)
- node = self.sourceModel().nodeFromIndex(sourceIndex)
- return node
-
- def setMacroIndex(self, macroIndex):
- self._macroIndex = macroIndex
-
- def macroIndex(self):
- return self._macroIndex
-
- def columnCount(self, parent):
- return self.columns
-
- def filterAcceptsRow(self, row, parentIndex):
- if self.macroIndex() == None:
- return False
- if self.macroIndex() == parentIndex:
- child = self.sourceModel().index(row, 0, parentIndex)
- node = self.sourceModel().nodeFromIndex(child)
- if not isinstance(node, macro.ParamNode):
- return False
- return True
-
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/sequenceeditor.py b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/sequenceeditor.py
deleted file mode 100644
index 20700f13..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/sequenceeditor/sequenceeditor.py
+++ /dev/null
@@ -1,875 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-sequenceeditor.py:
-"""
-import os
-import sys
-
-from lxml import etree
-
-import PyTango
-
-from taurus import Device
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.container import TaurusMainWindow, TaurusWidget
-from taurus.qt.qtcore.configuration import BaseConfigurableClass
-from taurus.qt.qtgui.display import TaurusLed
-from taurus.qt.qtgui.dialog import TaurusMessageBox
-from taurus.qt.qtgui.resource import getIcon, getThemeIcon
-
-from sardana.taurus.qt.qtgui.extra_macroexecutor.common import MacroExecutionWindow, MacroComboBox, standardPlotablesFilter
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor import ParamEditorManager, StandardMacroParametersEditor
-from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.delegate import ParamEditorDelegate
-from sardana.taurus.core.tango.sardana.macro import MacroRunException, MacroNode
-from sardana.taurus.qt.qtgui.extra_macroexecutor import globals
-
-from .model import MacroSequenceTreeModel, MacroSequenceProxyModel, MacroParametersProxyModel
-from .delegate import SequenceEditorDelegate
-
-class HookAction(Qt.QAction):
-
- def __init__(self, text, parent, macroNode):
- Qt.QAction.__init__(self, text, parent)
- self.setCheckable(True)
- self.setMacroNode(macroNode)
- if text in self.macroNode().hookPlaces():
- self.setChecked(True)
- self.setToolTip("This macro will be executed as a %s" % text)
- self.connect(self, Qt.SIGNAL('toggled(bool)'), self.onToggle)
-
- def macroNode(self):
- return self._macroNode
-
- def setMacroNode(self, macroNode):
- self._macroNode = macroNode
-
- def onToggle(self, trueFalse):
- if trueFalse:
- self.macroNode().addHookPlace(str(self.text()))
- else:
- self.macroNode().removeHookPlace(str(self.text()))
-
-class MacroSequenceTree(Qt.QTreeView, BaseConfigurableClass):
-
- def __init__(self, parent=None):
- Qt.QTreeView.__init__(self, parent)
- BaseConfigurableClass.__init__(self)
- self._idIndexDict = {}
-
- self.setSelectionBehavior(Qt.QTreeView.SelectRows)
- self.setSelectionMode(Qt.QTreeView.SingleSelection)
- self.setRootIsDecorated(False)
-# self.setItemsExpandable(False)
- self.setDragEnabled(True)
- self.setAcceptDrops(True)
- self.setTabKeyNavigation(True)
- self.setEditTriggers(Qt.QAbstractItemView.EditKeyPressed | Qt.QAbstractItemView.CurrentChanged)
- self.setDropIndicatorShown(True)
-
- self.deleteAction = Qt.QAction(getThemeIcon("list-remove"), "Remove macro", self)
- self.connect(self.deleteAction, Qt.SIGNAL("triggered()"), self.deleteMacro)
- self.deleteAction.setToolTip("Clicking this button will remove current macro.")
-
- self.moveUpAction = Qt.QAction(getThemeIcon("go-up"), "Move up", self)
- self.connect(self.moveUpAction, Qt.SIGNAL("triggered()"), self.upMacro)
- self.moveUpAction.setToolTip("Clicking this button will move current macro up.")
-
- self.moveDownAction = Qt.QAction(getThemeIcon("go-down"), "Move down", self)
- self.connect(self.moveDownAction, Qt.SIGNAL("triggered()"), self.downMacro)
- self.moveDownAction.setToolTip("Clicking this button will move current macro down.")
-
- self.moveLeftAction = Qt.QAction(getThemeIcon("go-previous"), "Move left", self)
- self.connect(self.moveLeftAction, Qt.SIGNAL("triggered()"), self.leftMacro)
- self.moveLeftAction.setToolTip("Clicking this button will move current macro to the left.")
-
- self.moveRightAction = Qt.QAction(getThemeIcon("go-next"), "Move right", self)
- self.connect(self.moveRightAction, Qt.SIGNAL("triggered()"), self.rightMacro)
- self.moveRightAction.setToolTip("Clicking this button will move current macro to the right.")
-
- def disableActions(self):
- self.deleteAction.setEnabled(False)
- self.moveUpAction.setEnabled(False)
- self.moveDownAction.setEnabled(False)
- self.moveLeftAction.setEnabled(False)
- self.moveRightAction.setEnabled(False)
-
- def contextMenuEvent(self, event):
- contextMenu = Qt.QMenu()
- proxyIndex = self.indexAt(event.pos())
- node = self.model().nodeFromIndex(proxyIndex)
- #this is in case if we right click on an empty field of tree
- if not isinstance(node, MacroNode): return
- parentNode = node.parent()
- #this is in case if we right click on a top level macro
- if not isinstance(parentNode, MacroNode): return
- allowedHooks = parentNode.allowedHookPlaces()
- if allowedHooks:
- hookPlacesSubmenu = contextMenu.addMenu("Hook places")
- for allowedHook in allowedHooks:
- action = HookAction(allowedHook, self, node)
- hookPlacesSubmenu.addAction(action)
- contextMenu.exec_(event.globalPos())
-
-# def setHint(self, add):
-# action = self.sender()
-# hookText = action.text()
-# macroNode = action.macroNode()
-# if add:
-# macroNode.addHook(hookText)
-# else:
-# macroNode.removeHook(hookText)
-# pass
-
- def selectionChanged(self, selected, deselected):
- self.disableActions()
- macroName = None
- node, proxyIndex = self.selectedNodeAndIndex()
- if node is not None:
- macroName = node.name()
- self.deleteAction.setEnabled(True)
- self.moveUpAction.setEnabled(node.isAllowedMoveUp())
- self.moveDownAction.setEnabled(node.isAllowedMoveDown())
- self.moveLeftAction.setEnabled(node.isAllowedMoveLeft())
- self.moveRightAction.setEnabled(node.isAllowedMoveRight())
- sourceIndex = self.model().mapToSource(proxyIndex)
- self.emit(Qt.SIGNAL("macroChanged"), sourceIndex)
- self.emit(Qt.SIGNAL("macroNameChanged"), macroName)
-
- def expanded(self):
- for column in range(self.model().columnCount(Qt.QModelIndex())):
- self.resizeColumnToContents(column)
-
- def clearTree(self):
- self.model().clearSequence()
-
- def toXmlString(self, pretty=False, withId=True):
- return self.model().toXmlString(pretty=pretty, withId=withId)
-
- def fromXmlString(self, xmlString):
- newRoot = self.model().fromXmlString(xmlString)
- self.expandAll()
- self.expanded()
- return newRoot
-
- def fromPlainText(self, plainText):
- newRoot = self.model().fromPlainText(plainText)
- self.expandAll()
- self.expanded()
- return newRoot
-
- def root(self):
- return self.model().root()
-
- def setRoot(self, root):
- self.model().setRoot(root)
- self.model().reset()
-
- def addMacro(self, macroNode):
- node, proxyIndex = self.selectedNodeAndIndex()
- if node == None or not node.isAllowedHooks():
- proxyIndex = self.rootIndex()
- sourceIndex = self.model().mapToSource(proxyIndex)
- newSourceIndex = self.model()._insertRow(sourceIndex, macroNode)
- newProxyIndex = self.model().mapFromSource(newSourceIndex)
-# persistentProxyIndex = Qt.QPersistentModelIndex(newProxyIndex)
-# self._idIndexDict[macroNode.id()] = persistentProxyIndex
- self.setCurrentIndex(newProxyIndex)
- self.expandAll()
- self.expanded()
-
- def deleteMacro(self):
- node, proxyIndex = self.selectedNodeAndIndex()
- sourceIndex = self.model().mapToSource(proxyIndex)
- self.model()._removeRow(sourceIndex)
-# self._idIndexDict.pop(node.id())
- self.expandAll()
- self.expanded()
-
- def upMacro(self):
- node, proxyIndex = self.selectedNodeAndIndex()
- sourceIndex = self.model().mapToSource(proxyIndex)
- newSourceIndex = self.model()._upRow(sourceIndex)
- newProxyIndex = self.model().mapFromSource(newSourceIndex)
-# persistentProxyIndex = Qt.QPersistentModelIndex(newProxyIndex)
-# self._idIndexDict[node.id()] = persistentProxyIndex
- self.setCurrentIndex(newProxyIndex)
- self.expandAll()
-# self.expanded()
-
- def downMacro(self):
- node, proxyIndex = self.selectedNodeAndIndex()
- sourceIndex = self.model().mapToSource(proxyIndex)
- newSourceIndex = self.model()._downRow(sourceIndex)
- newProxyIndex = self.model().mapFromSource(newSourceIndex)
-# persistentProxyIndex = Qt.QPersistentModelIndex(newProxyIndex)
-# self._idIndexDict[node.id()] = persistentProxyIndex
- self.setCurrentIndex(newProxyIndex)
- self.expandAll()
-# self.expanded()
-
- def leftMacro(self):
- node, proxyIndex = self.selectedNodeAndIndex()
- sourceIndex = self.model().mapToSource(proxyIndex)
- newSourceIndex = self.model()._leftRow(sourceIndex)
- newProxyIndex = self.model().mapFromSource(newSourceIndex)
-# persistentProxyIndex = Qt.QPersistentModelIndex(newProxyIndex)
-# self._idIndexDict[node.id()] = persistentProxyIndex
- self.setCurrentIndex(newProxyIndex)
- self.expandAll()
- self.expanded()
-
- def rightMacro(self):
- node, proxyIndex = self.selectedNodeAndIndex()
- sourceIndex = self.model().mapToSource(proxyIndex)
- newSourceIndex = self.model()._rightRow(sourceIndex)
- newProxyIndex = self.model().mapFromSource(newSourceIndex)
-# persistentProxyIndex = Qt.QPersistentModelIndex(newProxyIndex)
-# self._idIndexDict[node.id()] = persistentProxyIndex
- self.setCurrentIndex(newProxyIndex)
- self.expandAll()
- self.expanded()
-
- def prepareMacroIds(self):
- model = self.model()
- ids = model.assignIds()
- firstId = model.firstMacroId()
- lastId = model.lastMacroId()
- return firstId, lastId, ids
-
- def prepareMacroProgresses(self):
- self._idIndexDict = self.model().createIdIndexDictionary()
- for macroId in self._idIndexDict.iterkeys():
- self.setProgressForMacro(macroId, 0)
-
- def setProgressForMacro(self, macroId, progress):
- persistentIndex = self._idIndexDict.get(macroId, None)
- if persistentIndex == None: return
- progressIndex = persistentIndex.sibling(persistentIndex.row(), 2)
- index = Qt.QModelIndex(progressIndex)
- self.model().setData(index, Qt.QVariant(progress))
-
- def setRangeForMacro(self, macroId, range):
- persistentIndex = self._idIndexDict.get(macroId, None)
- if persistentIndex == None: return
- index = Qt.QModelIndex(persistentIndex)
- node = self.model().nodeFromIndex(index)
- node.setRange(range)
-
- def selectedNodeAndIndex(self):
- """Returns a tuple with selected internal model node object and QModelIndex
- from current model."""
- for idx in self.selectedIndexes():
- if idx.column() == 0:
- node = self.model().nodeFromIndex(idx)
- break
- else:
- node, idx = None, None
- return node, idx
-
- def dropEvent(self, event):
- Qt.QTreeView.dropEvent(self, event)
- self.expandAll()
-
-
-class TaurusSequencerWidget(TaurusWidget):
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self._macroIds = [] #list representing all macros ids (all from sequence) currently executed
- self._sequencesPath = str(Qt.QDir.homePath())
- self._sequenceModel = MacroSequenceTreeModel()
-
- self.registerConfigProperty("sequencesPath", "setSequencesPath", "sequencesPath")
-
- self.setLayout(Qt.QVBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
- splitter = Qt.QSplitter()
- self.layout().addWidget(splitter)
- splitter.setOrientation(Qt.Qt.Vertical)
-
- sequenceEditor = TaurusWidget()
- splitter.addWidget(sequenceEditor)
- sequenceEditor.setUseParentModel(True)
- sequenceEditor.setLayout(Qt.QVBoxLayout())
- sequenceEditor.layout().setContentsMargins(0, 0, 0, 0)
-
- self.tree = MacroSequenceTree(sequenceEditor)
- self.sequenceProxyModel = MacroSequenceProxyModel()
- self.sequenceProxyModel.setSourceModel(self._sequenceModel)
- self.tree.setModel(self.sequenceProxyModel)
- self.tree.setItemDelegate(SequenceEditorDelegate(self.tree))
-
- actionsLayout = Qt.QHBoxLayout()
- actionsLayout.setContentsMargins(0, 0, 0, 0)
- self.newSequenceAction = Qt.QAction(getThemeIcon("document-new"), "New", self)
- self.connect(self.newSequenceAction, Qt.SIGNAL("triggered()"), self.onNewSequence)
- self.newSequenceAction.setToolTip("New sequence")
- self.newSequenceAction.setEnabled(False)
- newSequenceButton = Qt.QToolButton()
- newSequenceButton.setDefaultAction(self.newSequenceAction)
- actionsLayout.addWidget(newSequenceButton)
-
- self.openSequenceAction = Qt.QAction(getThemeIcon("document-open"), "Open...", self)
- self.connect(self.openSequenceAction, Qt.SIGNAL("triggered()"), self.onOpenSequence)
- self.openSequenceAction.setToolTip("Open sequence...")
- openSequenceButton = Qt.QToolButton()
- openSequenceButton.setDefaultAction(self.openSequenceAction)
- actionsLayout.addWidget(openSequenceButton)
-
- self.saveSequenceAction = Qt.QAction(getThemeIcon("document-save"), "Save...", self)
- self.connect(self.saveSequenceAction, Qt.SIGNAL("triggered()"), self.onSaveSequence)
- self.saveSequenceAction.setToolTip("Save sequence...")
- self.saveSequenceAction.setEnabled(False)
- saveSequenceButton = Qt.QToolButton()
- saveSequenceButton.setDefaultAction(self.saveSequenceAction)
- actionsLayout.addWidget(saveSequenceButton)
-
- self.stopSequenceAction = Qt.QAction(getIcon(":/actions/media_playback_stop.svg"), "Stop", self)
- self.connect(self.stopSequenceAction, Qt.SIGNAL("triggered()"), self.onStopSequence)
- self.stopSequenceAction.setToolTip("Stop sequence")
- stopSequenceButton = Qt.QToolButton()
- stopSequenceButton.setDefaultAction(self.stopSequenceAction)
- actionsLayout.addWidget(stopSequenceButton)
-
- self.pauseSequenceAction = Qt.QAction(getIcon(":/actions/media_playback_pause.svg"), "Pause", self)
- self.connect(self.pauseSequenceAction, Qt.SIGNAL("triggered()"), self.onPauseSequence)
- self.pauseSequenceAction.setToolTip("Pause sequence")
- pauseSequenceButton = Qt.QToolButton()
- pauseSequenceButton.setDefaultAction(self.pauseSequenceAction)
- actionsLayout.addWidget(pauseSequenceButton)
-
- self.playSequenceAction = Qt.QAction(getIcon(":/actions/media_playback_start.svg"), "Play", self)
- self.connect(self.playSequenceAction, Qt.SIGNAL("triggered()"), self.onPlaySequence)
- self.playSequenceAction.setToolTip("Play sequence")
- playSequenceButton = Qt.QToolButton()
- playSequenceButton.setDefaultAction(self.playSequenceAction)
- actionsLayout.addWidget(playSequenceButton)
-
- self.doorStateLed = TaurusLed(self)
- actionsLayout.addWidget(self.doorStateLed)
-
- #@todo this feature will be replaced by checkboxes in the sequence tree view
- #indicating clearing of the plot after execution
- self.fullSequencePlotCheckBox = Qt.QCheckBox("Full sequence plot", self)
- self.connect(self.fullSequencePlotCheckBox, Qt.SIGNAL("toggled(bool)"), self.setFullSequencePlot)
- self.fullSequencePlotCheckBox.setChecked(True)
- actionsLayout.addWidget(self.fullSequencePlotCheckBox)
-
- spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed)
- actionsLayout.addItem(spacerItem)
-
- sequenceEditor.layout().addLayout(actionsLayout)
-
- macroLayout = Qt.QHBoxLayout()
- macroLayout.setContentsMargins(0, 0, 0, 0)
- macroLabel = Qt.QLabel("Macro:")
- macroLayout.addWidget(macroLabel)
- self.macroComboBox = MacroComboBox(self)
- self.macroComboBox.setUseParentModel(True)
- self.macroComboBox.setModelColumn(0)
- self.macroComboBox.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum)
- macroLayout.addWidget(self.macroComboBox)
-
- self.addMacroAction = Qt.QAction(getThemeIcon("list-add"), "Add macro...", self)
- self.connect(self.addMacroAction, Qt.SIGNAL("triggered()"), self.onAdd)
- self.addMacroAction.setToolTip("Clicking this button will add selected macro")
- self.addMacroAction.setEnabled(False)
- addButton = Qt.QToolButton()
- addButton.setDefaultAction(self.addMacroAction)
- macroLayout.addWidget(addButton)
-
- sequenceEditor.layout().addLayout(macroLayout)
-
- sequenceLayout = Qt.QHBoxLayout()
- sequenceLayout.addWidget(self.tree)
-
- layout = Qt.QVBoxLayout()
- delButton = Qt.QToolButton()
- delButton.setDefaultAction(self.tree.deleteAction)
- delButton.setEnabled(False)
- layout.addWidget(delButton)
- upButton = Qt.QToolButton()
- upButton.setDefaultAction(self.tree.moveUpAction)
- upButton.setEnabled(False)
- layout.addWidget(upButton)
- downButton = Qt.QToolButton()
- downButton.setDefaultAction(self.tree.moveDownAction)
- downButton.setEnabled(False)
- layout.addWidget(downButton)
- leftButton = Qt.QToolButton()
- leftButton.setDefaultAction(self.tree.moveLeftAction)
- leftButton.setEnabled(False)
- layout.addWidget(leftButton)
- rightButton = Qt.QToolButton()
- rightButton.setDefaultAction(self.tree.moveRightAction)
- rightButton.setEnabled(False)
- layout.addWidget(rightButton)
- spacerItem = Qt.QSpacerItem(0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
- layout.addItem(spacerItem)
- sequenceLayout.addLayout(layout)
- sequenceEditor.layout().addLayout(sequenceLayout)
-
- self.parametersProxyModel = MacroParametersProxyModel()
- self.parametersProxyModel.setSourceModel(self._sequenceModel)
-
- self.stackedWidget = Qt.QStackedWidget()
- splitter.addWidget(self.stackedWidget)
- self.standardMacroParametersEditor = StandardMacroParametersEditor(self.stackedWidget)
- self.standardMacroParametersEditor.setModel(self.parametersProxyModel)
- self.standardMacroParametersEditor.tree.setItemDelegate(ParamEditorDelegate(self.standardMacroParametersEditor.tree))
- self.stackedWidget.addWidget(self.standardMacroParametersEditor)
- self.customMacroParametersEditor = None
-
- self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged)
- self.connect(self.tree, Qt.SIGNAL("macroChanged"), self.setMacroParametersRootIndex)
-
-
- def contextMenuEvent(self, event):
- menu = Qt.QMenu()
- action = menu.addAction(getThemeIcon("view-refresh"), "Check door state", self.checkDoorState)
- menu.exec_(event.globalPos())
-
- def checkDoorState(self):
- '''Method used by "Check door state" action (available in the context
- menu). It is a workaround for situations when the event notification
- about the macro status does not reach the sequencer widget.'''
-
- door = Device(self.doorName())
- doorState = door.state()
- if doorState == PyTango.DevState.RUNNING:
- self.playSequenceAction.setEnabled(False)
- self.pauseSequenceAction.setEnabled(True)
- self.stopSequenceAction.setEnabled(True)
- elif doorState in (PyTango.DevState.ON, PyTango.DevState.ALARM):
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(False)
- elif doorState == PyTango.DevState.STANDBY:
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(True)
-
-
- def doorName(self):
- return self._doorName
-
- def setDoorName(self, doorName):
- self._doorName = doorName
-
- def firstMacroId(self):
- return self._firstMacroId
-
- def setFirstMacroId(self, firstMacroId):
- self._firstMacroId = firstMacroId
-
- def lastMacroId(self):
- return self._lastMacroId
-
- def setLastMacroId(self, lastMacroId):
- self._lastMacroId = lastMacroId
-
- def macroIds(self):
- return self._macroIds
-
- def setMacroIds(self, macroIds):
- self._macroIds = macroIds
-
- def emitExecutionStarted(self):
- return self._emitExecutionStarted
-
- def setEmitExecutionStarted(self, yesNo):
- self._emitExecutionStarted = yesNo
-
- def sequencesPath(self):
- return self._sequencesPath
-
- def setSequencesPath(self, sequencesPath):
- self._sequencesPath = sequencesPath
-
- def isFullSequencePlot(self):
- return self._fullSequencePlot
-
- def setFullSequencePlot(self, fullSequencePlot):
- self._fullSequencePlot = fullSequencePlot
-
- def onNewSequence(self):
- if Qt.QMessageBox.question(self,
- "New sequence",
- "Do you want to save existing sequence?",
- Qt.QMessageBox.Yes,
- Qt.QMessageBox.No) == Qt.QMessageBox.Yes:
- self.onSaveSequence()
- self.tree.clearTree()
- self.newSequenceAction.setEnabled(False)
- self.saveSequenceAction.setEnabled(False)
- self.emit(Qt.SIGNAL("currentMacroChanged"), None)
-
- def onOpenSequence(self):
- if not self._sequenceModel.isEmpty():
- if Qt.QMessageBox.question(self,
- "Open sequence",
- "Do you want to save existing sequence?",
- Qt.QMessageBox.Yes,
- Qt.QMessageBox.No) == Qt.QMessageBox.Yes:
- self.onSaveSequence()
- self.tree.clearTree()
-
- sequencesPath = self.sequencesPath()
- fileName = str(Qt.QFileDialog.getOpenFileName(self,
- "Choose a sequence to open...",
- sequencesPath,
- "*"))
- if fileName == "": return
- #@todo: reset macroComboBox to index 0
- try:
- file = open(fileName, 'r')
- string = file.read()
- if fileName.endswith('.xml'):
- root = self.fromXmlString(string)
- else:
- root = self.fromPlainText(string)
- self._sequenceModel.setRoot(root)
- self.sequenceProxyModel.invalidateFilter()
- self.tree.expandAll()
- self.tree.expanded()
- self.parametersProxyModel.setMacroIndex(None)
- self.parametersProxyModel.invalidateFilter()
-
- if not self._sequenceModel.isEmpty():
- self.newSequenceAction.setEnabled(True)
- self.saveSequenceAction.setEnabled(True)
- self.playSequenceAction.setEnabled(True)
- except IOError:
- Qt.QMessageBox.warning(self, "Error while loading macros sequence", "There was a problem while reading from file: %s" % fileName)
- self.tree.clearTree()
- self.newSequenceAction.setEnabled(False)
- self.saveSequenceAction.setEnabled(False)
- except:
- self.tree.clearTree()
- self.playSequenceAction.setEnabled(False)
- self.newSequenceAction.setEnabled(False)
- self.saveSequenceAction.setEnabled(False)
- raise
- finally:
- if not file is None: file.close()
- self.setSequencesPath(str.join("/", fileName.rsplit("/")[:-1]))
-
- self.emit(Qt.SIGNAL("currentMacroChanged"), None)
-
- def onSaveSequence(self):
- sequencesPath = self.sequencesPath()
- if sequencesPath == "":
- sequencesPath = str(Qt.QDir.homePath())
-
- sequencesPath = os.path.join(sequencesPath, "Untitled.xml")
- fileName = str(Qt.QFileDialog.getSaveFileName(self,
- "Choose a sequence file name...",
- sequencesPath,
- "*.xml"))
- if fileName == "": return
- try:
- file = open(fileName, "w")
- file.write(self.tree.toXmlString(pretty=True, withId=False))
- self.setSequencesPath(str.join("/", fileName.rsplit("/")[:-1]))
- except Exception, e:
- Qt.QMessageBox.warning(self, "Error while saving macros sequence", "There was a problem while writing to the file: %s" % fileName)
- print e
- finally:
- if not file is None: file.close()
-
- def onPlaySequence(self):
- door = Device(self.doorName())
- doorState = door.state()
- if doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM:
- first, last, ids = self.tree.prepareMacroIds()
- self.setFirstMacroId(first)
- self.setLastMacroId(last)
- self.setMacroIds(ids)
- self.tree.prepareMacroProgresses()
- self.setEmitExecutionStarted(True)
- door.runMacro(self.tree.toXmlString())
- elif doorState == PyTango.DevState.STANDBY:
- door.command_inout("ResumeMacro")
- else:
- Qt.QMessageBox.warning(self, "Error while starting/resuming sequence",
- "It was not possible to start/resume sequence, because state of the door was different than ON/STANDBY")
-
- def onStopSequence(self):
- door = Device(self.doorName())
- doorState = door.state()
- if doorState in (PyTango.DevState.RUNNING, PyTango.DevState.STANDBY):
- door.command_inout("StopMacro")
- else:
- Qt.QMessageBox.warning(self, "Error while stopping sequence",
- "It was not possible to stop sequence, because state of the door was different than RUNNING or STANDBY")
-
- def onPauseSequence(self):
- door = Device(self.doorName())
- doorState = door.state()
- if doorState == PyTango.DevState.RUNNING:
- door.command_inout("PauseMacro")
- else:
- Qt.QMessageBox.warning(self, "Error while pausing sequence",
- "It was not possible to pause sequence, because state of the door was different than RUNNING")
-
- def onMacroStatusUpdated(self, data):
- macro = data[0]
- if macro is None: return
- data = data[1][0]
- state, range, step, id = str(data["state"]), data["range"], data["step"], data["id"]
- if id is None: return
- id = int(id)
- if not id in self.macroIds(): return
- macroName = macro.name
- shortMessage = ""
- if state == "start":
- #@todo: Check this signal because it doesn't work, emitExecutionStarted is not set!!!
- if self.emitExecutionStarted():
- self.emit(Qt.SIGNAL("macroStarted"), "DoorOutput")
- self.tree.setRangeForMacro(id, range)
- self.playSequenceAction.setEnabled(False)
- self.pauseSequenceAction.setEnabled(True)
- self.stopSequenceAction.setEnabled(True)
- if id == self.firstMacroId():
- self.emit(Qt.SIGNAL("plotablesFilterChanged"), None)
- self.emit(Qt.SIGNAL("plotablesFilterChanged"), standardPlotablesFilter)
- shortMessage = "Sequence started."
- elif not self.isFullSequencePlot():
- self.emit(Qt.SIGNAL("plotablesFilterChanged"), None)
- shortMessage += " Macro %s started." % macroName
- elif state == "pause":
- self.playSequenceAction.setText("Resume sequence")
- self.playSequenceAction.setToolTip("Resume sequence")
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- shortMessage = "Macro %s paused." % macroName
- elif state == "resume":
- self.playSequenceAction.setText("Start sequence")
- self.playSequenceAction.setToolTip("Start sequence")
- self.playSequenceAction.setEnabled(False)
- self.pauseSequenceAction.setEnabled(True)
- shortMessage = "Macro %s resumed." % macroName
- elif state == "stop" or state == "finish":
- shortMessage = "Macro %s finished." % macroName
- if id == self.lastMacroId():
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(False)
- shortMessage += " Sequence finished."
- elif state == 'exception':
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(False)
- shortMessage = "Macro %s error." % macroName
- exc_value, exc_stack = data['exc_value'], data['exc_stack']
- exceptionDialog = TaurusMessageBox(MacroRunException, exc_value, exc_stack)
- exceptionDialog.exec_()
- elif state == 'abort':
- self.playSequenceAction.setText("Start sequence")
- self.playSequenceAction.setToolTip("Start sequence")
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(False)
- shortMessage = "Macro %s stopped." % macroName
- elif state == "step":
- shortMessage = "Macro %s at %d %% of progress." % (macroName, step)
- self.emit(Qt.SIGNAL("shortMessageEmitted"), shortMessage)
- self.tree.setProgressForMacro(id, step)
-
- def onDoorChanged(self, doorName):
- self.setDoorName(doorName)
- if self.doorName() == "":
- self.doorStateLed.setModel(None)
- return
- self.doorStateLed.setModel(self.doorName() + "/State")
- doorState = Device(doorName).state()
- if doorState == PyTango.DevState.ON:
- self.playSequenceAction.setText("Start sequence")
- self.playSequenceAction.setToolTip("Start sequence")
- self.playSequenceAction.setEnabled(False)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(False)
- elif doorState == PyTango.DevState.STANDBY:
- self.playSequenceAction.setText("Resume sequence")
- self.playSequenceAction.setToolTip("Resume sequence")
- self.playSequenceAction.setEnabled(True)
- self.pauseSequenceAction.setEnabled(False)
- self.stopSequenceAction.setEnabled(True)
-
- def setMacroParametersRootIndex(self, sourceIndex):
- parametersModel = self.standardMacroParametersEditor.tree.model()
- parametersModel.setMacroIndex(sourceIndex)
- parametersModel.invalidateFilter()
- proxyIndex = parametersModel.mapFromSource(sourceIndex)
-
- macroNode = sourceIndex.internalPointer()
- macroName = macroNode.name()
-
- if self.stackedWidget.count() == 2:
- self.stackedWidget.removeWidget(self.customMacroParametersEditor)
- self.customMacroParametersEditor.setParent(None)
- self.customMacroParametersEditor = ParamEditorManager().getMacroEditor(macroName)
- if self.customMacroParametersEditor:
- self.customMacroParametersEditor.setModel(parametersModel)
- self.customMacroParametersEditor.setRootIndex(proxyIndex)
- self.stackedWidget.addWidget(self.customMacroParametersEditor)
- self.stackedWidget.setCurrentWidget(self.customMacroParametersEditor)
- else:
- self.standardMacroParametersEditor.tree.setRootIndex(proxyIndex)
- self.standardMacroParametersEditor.tree.expandAll()
-
- def onMacroComboBoxChanged(self):
- macroName = str(self.macroComboBox.currentText())
- if macroName == "":
- self.addMacroAction.setEnabled(False)
- else:
- self.addMacroAction.setEnabled(True)
- self.emit(Qt.SIGNAL("macroNameChanged"), macroName)
-
- def onAdd(self):
- macroName = str(self.macroComboBox.currentText())
- macroNode = self.getModelObj().getMacroNodeObj(macroName)
- self.tree.addMacro(macroNode)
- self.saveSequenceAction.setEnabled(True)
- self.playSequenceAction.setEnabled(True)
-
- def isEmptySequence(self):
- return len(self.tree.root()) == 0
-
- def isMacroSelected(self):
- return len(self.tree.selectedIndexes()) == 2
-
- def emptySequence(self):
- self.tree.clearTree()
- self.disableButtons()
- self.emit(Qt.SIGNAL("currentMacroChanged"), None)
- self.emit(Qt.SIGNAL("sequenceEmpty"))
-
- def fromXmlString(self, xmlString):
- newRoot = self.tree.fromXmlString(xmlString)
- macroServerObj = self.getModelObj()
- for macroNode in newRoot.allMacros():
- macroServerObj.fillMacroNodeAdditionalInfos(macroNode)
- return newRoot
-
- def fromPlainText(self, plainText):
- newRoot = self.tree.fromPlainText(plainText)
- macroServerObj = self.getModelObj()
- for macroNode in newRoot.allMacros():
- macroServerObj.recreateMacroNodeAndFillAdditionalInfos(macroNode)
- return newRoot
-
- def setModel(self, model):
- oldModelObj = self.getModelObj()
- if oldModelObj is not None:
- self.disconnect(oldModelObj, Qt.SIGNAL("macrosUpdated"), self.macroComboBox.onMacrosUpdated)
- TaurusWidget.setModel(self, model)
- newModelObj = self.getModelObj()
- self.connect(newModelObj, Qt.SIGNAL("macrosUpdated"), self.macroComboBox.onMacrosUpdated)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return {'container': False,
- 'group': 'Taurus Sardana',
- 'module': 'taurus.qt.qtgui.extra_macroexecutor',
- 'icon': ':/designer/frame.png'}
-
-
-class TaurusSequencer(MacroExecutionWindow):
-
- def __init__(self, parent=None, designMode=False):
- MacroExecutionWindow.__init__(self)
-
- def initComponents(self):
- #@todo: take care about storing model
- self.setModelInConfig(True)
- self.taurusSequencerWidget = TaurusSequencerWidget(self)
- self.taurusSequencerWidget.setUseParentModel(True)
- self.registerConfigDelegate(self.taurusSequencerWidget)
- self.setCentralWidget(self.taurusSequencerWidget)
- self.connect(self.taurusSequencerWidget, Qt.SIGNAL('shortMessageEmitted'), self.onShortMessage)
- self.statusBar().showMessage("Sequencer ready")
-
- def setCustomMacroEditorPaths(self, customMacroEditorPaths):
- MacroExecutionWindow.setCustomMacroEditorPaths(self, customMacroEditorPaths)
- ParamEditorManager().parsePaths(customMacroEditorPaths)
- ParamEditorManager().browsePaths()
-
- def loadSettings(self):
- TaurusMainWindow.loadSettings(self)
- self.emit(Qt.SIGNAL("doorChanged"), self.doorName())
-
- def onDoorChanged(self, doorName):
- MacroExecutionWindow.onDoorChanged(self, doorName)
- if self._qDoor:
- Qt.QObject.disconnect(self._qDoor, Qt.SIGNAL("macroStatusUpdated"), self.taurusSequencerWidget.onMacroStatusUpdated)
- if doorName == "": return
- self._qDoor = Device(doorName)
- Qt.QObject.connect(self._qDoor, Qt.SIGNAL("macroStatusUpdated"), self.taurusSequencerWidget.onMacroStatusUpdated)
- self.taurusSequencerWidget.onDoorChanged(doorName)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-
-
-def createSequencerWidget(args):
- sequencer = TaurusSequencerWidget()
- sequencer.setModelInConfig(True)
- Qt.QObject.connect(sequencer, Qt.SIGNAL("doorChanged"), sequencer.onDoorChanged)
- if len(args) == 2:
- sequencer.setModel(args[0])
- sequencer.emit(Qt.SIGNAL('doorChanged'), args[1])
- return sequencer
-
-def createSequencer(args):
- sequencer = TaurusSequencer()
- sequencer.setModelInConfig(True)
- Qt.QObject.connect(sequencer, Qt.SIGNAL("doorChanged"), sequencer.onDoorChanged)
- if len(args) == 2:
- sequencer.setModel(args[0])
- sequencer.emit(Qt.SIGNAL('doorChanged'), args[1])
- sequencer.loadSettings()
- return sequencer
-
-def main():
- from taurus.qt.qtgui.application import TaurusApplication
- import taurus
-# from rfoo.utils import rconsole
-# rconsole.spawn_server()
-
- app = TaurusApplication(sys.argv, app_version=taurus.Release.version)
- args = app.get_command_line_args()
-
- app.setOrganizationName(globals.ORGANIZATION_NAME)
- app.setApplicationName(globals.SEQUENCER_APPLICATION_NAME)
- sequencer = createSequencer(args)
- sequencer.show()
- sys.exit(app.exec_())
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/ui/MacroButton.ui b/src/sardana/taurus/qt/qtgui/extra_macroexecutor/ui/MacroButton.ui
deleted file mode 100644
index 600d533c..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_macroexecutor/ui/MacroButton.ui
+++ /dev/null
@@ -1,101 +0,0 @@
-<ui version="4.0" >
- <class>MacroButton</class>
- <widget class="TaurusWidget" name="MacroButton" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>106</width>
- <height>79</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Form</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>0</number>
- </property>
- <item row="0" column="0" >
- <widget class="QFrame" name="frame" >
- <property name="frameShape" >
- <enum>QFrame::Box</enum>
- </property>
- <property name="frameShadow" >
- <enum>QFrame::Plain</enum>
- </property>
- <property name="lineWidth" >
- <number>3</number>
- </property>
- <property name="midLineWidth" >
- <number>3</number>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>0</number>
- </property>
- <item row="0" column="0" >
- <widget class="QPushButton" name="button" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>PushButton</string>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoDefault" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QProgressBar" name="progress" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>10</height>
- </size>
- </property>
- <property name="font" >
- <font>
- <pointsize>6</pointsize>
- </font>
- </property>
- <property name="value" >
- <number>24</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusWidget</class>
- <extends>QWidget</extends>
- <header>taurus.qt.qtgui.container</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/__init__.py b/src/sardana/taurus/qt/qtgui/extra_pool/__init__.py
deleted file mode 100644
index d8db3513..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/__init__.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-__init__.py:
-"""
-
-from motor import TaurusMotorH, TaurusMotorH2, TaurusMotorV, TaurusMotorV2
-from poolmotor import PoolMotorSlim, LabelWidgetDragsDeviceAndAttribute
-from poolmotor import PoolMotorTV, PoolMotorTVLabelWidget, PoolMotorTVReadWidget, PoolMotorTVWriteWidget, PoolMotorTVUnitsWidget
-from poolmotor import PoolMotor
-from poolchannel import PoolChannel, PoolChannelTV
-from poolioregister import PoolIORegisterTV, PoolIORegisterReadWidget, PoolIORegisterWriteWidget, PoolIORegister, PoolIORegisterButtons
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/motor.py b/src/sardana/taurus/qt/qtgui/extra_pool/motor.py
deleted file mode 100644
index c5742cb5..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/motor.py
+++ /dev/null
@@ -1,1136 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-motor.py:
-"""
-
-
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.base import TaurusBaseWidget
-from taurus.qt.qtgui.util.ui import UILoadable
-
-
-def showDialogConfigureMotor(parent):
- Dialog = Qt.QDialog(parent)
- Dialog.resize((Qt.QSize(Qt.QRect(0, 0, 310, 309).size()).expandedTo(Dialog.minimumSizeHint())))
- motorV2 = TaurusMotorV2(Dialog)
- motorV2.setModel(parent.model)
- motorV2.setGeometry(Qt.QRect(10, 10, 291, 291))
- Dialog.show()
-
-
-@UILoadable(with_ui='ui')
-class TaurusMotorH(Qt.QWidget, TaurusBaseWidget):
-
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- self.call__init__wo_kw(Qt.QWidget, parent)
- self.call__init__(TaurusBaseWidget, str(self.objectName()), designMode=designMode)
- self.loadUi()
- Qt.QObject.connect(self.ui.config, Qt.SIGNAL("clicked()"), self.configureMotor)
-
- def sizeHint(self):
- return Qt.QSize(330, 50)
-
- def configureMotor(self):
- showDialogConfigureMotor(self.ui.TaurusGroupBox)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-# ret = TaurusBaseWidget.getQtDesignerPluginInfo()
-# ret['module'] = 'taurus.qt.qtgui.extra_pool'
-# ret['group'] = 'Taurus Sardana'
-# ret['icon'] = ':/designer/extra_pool.png'
-# return ret
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # QT properties
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- @Qt.pyqtSignature("getModel()")
- def getModel(self):
- return self.ui.TaurusGroupBox.getModel()
-
- @Qt.pyqtSignature("setModel(QString)")
- def setModel(self, model):
- self.ui.TaurusGroupBox.setModel(model)
-
- @Qt.pyqtSignature("resetModel()")
- def resetModel(self):
- self.ui.TaurusGroupBox.resetModel()
-
-
- @Qt.pyqtSignature("getShowText()")
- def getShowText(self):
- return self.ui.TaurusGroupBox.getShowText()
-
- @Qt.pyqtSignature("setShowText(bool)")
- def setShowText(self, showText):
- self.ui.TaurusGroupBox.setShowText(showText)
-
- @Qt.pyqtSignature("resetShowText()")
- def resetShowText(self):
- self.ui.TaurusGroupBox.resetShowText()
-
- model = Qt.pyqtProperty("QString", getModel, setModel, resetModel)
- showText = Qt.pyqtProperty("bool", getShowText, setShowText, resetShowText)
-
-
-@UILoadable(with_ui='ui')
-class TaurusMotorH2(Qt.QWidget, TaurusBaseWidget):
-
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- self.call__init__wo_kw(Qt.QWidget, parent)
- self.call__init__(TaurusBaseWidget, str(self.objectName()), designMode=designMode)
- self.loadUi()
- Qt.QObject.connect(self.ui.config, Qt.SIGNAL("clicked()"), self.configureMotor)
-
- def sizeHint(self):
- return Qt.QSize(215, 85)
-
- def configureMotor(self):
- showDialogConfigureMotor(self.ui.TaurusGroupBox)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-# ret = TaurusBaseWidget.getQtDesignerPluginInfo()
-# ret['module'] = 'taurus.qt.qtgui.extra_pool'
-# ret['group'] = 'Taurus Sardana'
-# ret['icon'] = ':/designer/extra_pool.png'
-# return ret
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # QT properties
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- @Qt.pyqtSignature("getModel()")
- def getModel(self):
- return self.ui.TaurusGroupBox.getModel()
-
- @Qt.pyqtSignature("setModel(QString)")
- def setModel(self, model):
- self.ui.TaurusGroupBox.setModel(model)
-
- @Qt.pyqtSignature("resetModel()")
- def resetModel(self):
- self.ui.TaurusGroupBox.resetModel()
-
-
- @Qt.pyqtSignature("getShowText()")
- def getShowText(self):
- return self.ui.TaurusGroupBox.getShowText()
-
- @Qt.pyqtSignature("setShowText(bool)")
- def setShowText(self, showText):
- self.ui.TaurusGroupBox.setShowText(showText)
-
- @Qt.pyqtSignature("resetShowText()")
- def resetShowText(self):
- self.ui.TaurusGroupBox.resetShowText()
-
-
- model = Qt.pyqtProperty("QString", getModel, setModel, resetModel)
- showText = Qt.pyqtProperty("bool", getShowText, setShowText, resetShowText)
-
-
-@UILoadable(with_ui='ui')
-class TaurusMotorV(Qt.QWidget, TaurusBaseWidget):
-
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- self.call__init__wo_kw(Qt.QWidget, parent)
- self.call__init__(TaurusBaseWidget, str(self.objectName()), designMode=designMode)
- self.loadUi()
- Qt.QObject.connect(self.ui.config, Qt.SIGNAL("clicked()"), self.configureMotor)
-
- def sizeHint(self):
- return Qt.QSize(120, 145)
-
- def configureMotor(self):
- showDialogConfigureMotor(self.ui.TaurusGroupBox)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-# ret = TaurusBaseWidget.getQtDesignerPluginInfo()
-# ret['module'] = 'taurus.qt.qtgui.extra_pool'
-# ret['group'] = 'Taurus Sardana'
-# ret['icon'] = ':/designer/extra_pool.png'
-# return ret
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # QT properties
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- @Qt.pyqtSignature("getModel()")
- def getModel(self):
- return self.ui.TaurusGroupBox.getModel()
-
- @Qt.pyqtSignature("setModel(QString)")
- def setModel(self, model):
- self.ui.TaurusGroupBox.setModel(model)
-
- @Qt.pyqtSignature("resetModel()")
- def resetModel(self):
- self.ui.TaurusGroupBox.resetModel()
-
-
- @Qt.pyqtSignature("getShowText()")
- def getShowText(self):
- return self.ui.TaurusGroupBox.getShowText()
-
- @Qt.pyqtSignature("setShowText(bool)")
- def setShowText(self, showText):
- self.ui.TaurusGroupBox.setShowText(showText)
-
- @Qt.pyqtSignature("resetShowText()")
- def resetShowText(self):
- self.ui.TaurusGroupBox.resetShowText()
-
-
- model = Qt.pyqtProperty("QString", getModel, setModel, resetModel)
- showText = Qt.pyqtProperty("bool", getShowText, setShowText, resetShowText)
-
-
-@UILoadable(with_ui='ui')
-class TaurusMotorV2(Qt.QWidget, TaurusBaseWidget):
-
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- self.call__init__wo_kw(Qt.QWidget, parent)
- self.call__init__(TaurusBaseWidget, str(self.objectName()), designMode=designMode)
- self.loadUi()
-
- def sizeHint(self):
- return Qt.QSize(300, 275)
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-# ret = TaurusBaseWidget.getQtDesignerPluginInfo()
-# ret['module'] = 'taurus.qt.qtgui.extra_pool'
-# ret['group'] = 'Taurus Sardana'
-# ret['icon'] = ':/designer/extra_pool.png'
-# return ret
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # QT properties
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- @Qt.pyqtSignature("getModel()")
- def getModel(self):
- return self.ui.TaurusGroupBox.getModel()
-
- @Qt.pyqtSignature("setModel(QString)")
- def setModel(self, model):
- self.ui.TaurusGroupBox.setModel(model)
-
- @Qt.pyqtSignature("resetModel()")
- def resetModel(self):
- self.ui.TaurusGroupBox.resetModel()
-
-
- @Qt.pyqtSignature("getShowText()")
- def getShowText(self):
- return self.ui.TaurusGroupBox.getShowText()
-
- @Qt.pyqtSignature("setShowText(bool)")
- def setShowText(self, showText):
- self.ui.TaurusGroupBox.setShowText(showText)
-
- @Qt.pyqtSignature("resetShowText()")
- def resetShowText(self):
- self.ui.TaurusGroupBox.resetShowText()
-
-
- model = Qt.pyqtProperty("QString", getModel, setModel, resetModel)
- showText = Qt.pyqtProperty("bool", getShowText, setShowText, resetShowText)
-
-
-###class TaurusMotorH2(Qt.QGroupBox, TaurusBaseWidget):
-###
-### def __init__(self, parent = None, designMode = False):
-### name = "TaurusMotorH2"
-### self._prefix = ''
-### self._suffix = ''
-###
-### self.call__init__wo_kw(Qt.QGroupBox, parent)
-### self.call__init__(TaurusBaseWidget, name, designMode = designMode)
-###
-### self.setObjectName(name)
-### self.defineStyle()
-###
-###
-### ## I CAN NOT INHERIT FROM TAUGROUPBOX !
-### ## SO ALL THE STUFFABOVE IS NECESSARY
-### ##
-### ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-### ##############################################################################
-### ##
-### #class TaurusMotorH2(TaurusGroupBox):
-### #def __init__(self, parent = None):
-### #self.call__init__wo_kw(TaurusGroupBox,parent)
-### #self.call__init__(TaurusGroupBox,str(self.objectName()))
-### self.setupUi()
-### self.retranslateUi()
-### self.connect(self.config,Qt.SIGNAL('clicked()'),self.configureMotor)
-###
-###
-### def configureMotor(self):
-### Dialog = Qt.QDialog(self)
-### Dialog.resize((Qt.QSize(Qt.QRect(0,0,310,309).size()).expandedTo(Dialog.minimumSizeHint())))
-### motorV2 = TaurusMotorV2(Dialog)
-### motorV2.setModel(self.model)
-### motorV2.setGeometry(Qt.QRect(10,10,291,291))
-### Dialog.show()
-###
-###
-###
-### def minimumSizeHint(self):
-### return Qt.QSize(211,80)
-###
-### def sizeHint(self):
-### return Qt.QSize(211,80)
-###
-###
-### def setupUi(self):
-###
-### self.gridlayout = Qt.QGridLayout(self)
-### self.gridlayout.setObjectName("gridlayout")
-###
-### self.vboxlayout = Qt.QVBoxLayout()
-### self.vboxlayout.setObjectName("vboxlayout")
-###
-### self.hboxlayout = Qt.QHBoxLayout()
-### self.hboxlayout.setObjectName("hboxlayout")
-###
-### self.taurusValueLabel_2 = TaurusValueLabel(self)
-### self.taurusValueLabel_2.setFrameShape(Qt.QFrame.NoFrame)
-### self.taurusValueLabel_2.setFrameShadow(Qt.QFrame.Plain)
-### self.taurusValueLabel_2.setShowQuality(False)
-### self.taurusValueLabel_2.setUseParentModel(True)
-### self.taurusValueLabel_2.setObjectName("taurusValueLabel_2")
-### self.hboxlayout.addWidget(self.taurusValueLabel_2)
-###
-### self.TaurusStateLed_17 = TaurusStateLed(self)
-### self.TaurusStateLed_17.setUseParentModel(True)
-### self.TaurusStateLed_17.setObjectName("TaurusStateLed_17")
-### self.hboxlayout.addWidget(self.TaurusStateLed_17)
-###
-### spacerItem = Qt.QSpacerItem(40,20,Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Minimum)
-### self.hboxlayout.addItem(spacerItem)
-###
-### self.TaurusLimitSwitch = TaurusLimitSwitch(self)
-### self.TaurusLimitSwitch.setUseParentModel(True)
-### self.TaurusLimitSwitch.setBoolIndex(2)
-### self.TaurusLimitSwitch.setObjectName("TaurusLimitSwitch")
-### self.hboxlayout.addWidget(self.TaurusLimitSwitch)
-###
-### self.label_3 = Qt.QLabel(self)
-### self.label_3.setAlignment(Qt.Qt.AlignCenter)
-### self.label_3.setObjectName("label_3")
-### self.hboxlayout.addWidget(self.label_3)
-###
-### self.TaurusLimitSwitch_2 = TaurusLimitSwitch(self)
-### self.TaurusLimitSwitch_2.setUseParentModel(True)
-### self.TaurusLimitSwitch_2.setBoolIndex(1)
-### self.TaurusLimitSwitch_2.setObjectName("TaurusLimitSwitch_2")
-### self.hboxlayout.addWidget(self.TaurusLimitSwitch_2)
-### self.vboxlayout.addLayout(self.hboxlayout)
-###
-### self.hboxlayout1 = Qt.QHBoxLayout()
-### self.hboxlayout1.setObjectName("hboxlayout1")
-###
-### self.TaurusValueLineEdit_21 = TaurusValueLineEdit(self)
-### self.TaurusValueLineEdit_21.setUseParentModel(True)
-### self.TaurusValueLineEdit_21.setObjectName("TaurusValueLineEdit_21")
-### self.hboxlayout1.addWidget(self.TaurusValueLineEdit_21)
-###
-### self.taurusValueLabel_21 = TaurusValueLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.taurusValueLabel_21.sizePolicy().hasHeightForWidth())
-### self.taurusValueLabel_21.setSizePolicy(sizePolicy)
-### self.taurusValueLabel_21.setUseParentModel(True)
-### self.taurusValueLabel_21.setObjectName("taurusValueLabel_21")
-### self.hboxlayout1.addWidget(self.taurusValueLabel_21)
-###
-### self.taurusConfigLabel_18 = TaurusConfigLabel(self)
-### self.taurusConfigLabel_18.setMaximumSize(Qt.QSize(27,22))
-### self.taurusConfigLabel_18.setUseParentModel(True)
-### self.taurusConfigLabel_18.setObjectName("taurusConfigLabel_18")
-### self.hboxlayout1.addWidget(self.taurusConfigLabel_18)
-###
-### self.config = Qt.QToolButton(self)
-### self.config.setObjectName("config")
-### self.hboxlayout1.addWidget(self.config)
-### self.vboxlayout.addLayout(self.hboxlayout1)
-### self.gridlayout.addLayout(self.vboxlayout,0,0,1,1)
-###
-###
-### def retranslateUi(self):
-### self.taurusValueLabel_2.setModel(Qt.QApplication.translate("Form", "/State", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusStateLed_17.setModel(Qt.QApplication.translate("Form", "/State", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch.setModel(Qt.QApplication.translate("Form", "/Limit_switches", None, Qt.QApplication.UnicodeUTF8))
-### self.label_3.setText(Qt.QApplication.translate("Form", "- lim +", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch_2.setModel(Qt.QApplication.translate("Form", "/Limit_switches", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusValueLineEdit_21.setModel(Qt.QApplication.translate("Form", "/Position", None, Qt.QApplication.UnicodeUTF8))
-### self.taurusValueLabel_21.setModel(Qt.QApplication.translate("Form", "/Position", None, Qt.QApplication.UnicodeUTF8))
-### self.taurusConfigLabel_18.setModel(Qt.QApplication.translate("Form", "/Position?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.config.setText(Qt.QApplication.translate("Form", "cfg", None, Qt.QApplication.UnicodeUTF8))
-###
-###
-### ##############################################################################
-### ## VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
-### ##
-### ## I CAN NOT INHERIT FROM TAUGROUPBOX !
-### ## SO ALL THE STUFF BELOW IS NECESSARY
-###
-###
-###
-### def defineStyle(self):
-### palette = Qt.QPalette()
-### self.setPalette(palette)
-### self.updateStyle()
-###
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-### # TaurusBaseWidget over writing
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-###
-### def getDisplayValue(self):
-### return (self._prefix or '') + TaurusBaseWidget.getDisplayValue(self) + (self._suffix or '')
-###
-### def isReadOnly(self):
-### return True
-###
-### def updateStyle(self):
-### if self.getShowQuality():
-### self.setAutoFillBackground(True)
-### #TODO: get quality/state from model and update accordingly
-### else:
-### self.setAutoFillBackground(False)
-### #TODO: restore colors
-### self.update()
-###
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-### # QT properties
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-###
-### def getPrefixText(self):
-### return self._prefix
-###
-### @Qt.pyqtSignature("setPrefixText(QString)")
-### def setPrefixText(self,prefix):
-### self._prefix = prefix
-### self.fireValueChanged()
-###
-### def getSuffixText(self):
-### return self._suffix
-###
-### @Qt.pyqtSignature("setSuffixText(QString)")
-### def setSuffixText(self,suffix):
-### self._suffix = suffix
-### self.fireValueChanged()
-###
-### model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
-### TaurusBaseWidget.setModel, TaurusBaseWidget.resetModel)
-### useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
-### TaurusBaseWidget.setUseParentModel,
-### TaurusBaseWidget.resetUseParentModel)
-### showQuality = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowQuality,
-### TaurusBaseWidget.setShowQuality,
-### TaurusBaseWidget.resetShowQuality)
-### showText = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowText,
-### TaurusBaseWidget.setShowText,
-### TaurusBaseWidget.resetShowText)
-### prefixText = Qt.pyqtProperty("QString", getPrefixText, setPrefixText,
-### doc="prefix text (optional)")
-### suffixText = Qt.pyqtProperty("QString", getSuffixText, setSuffixText,
-### doc="suffix text (optional)")
-###
-###
-###
-###
-###class TaurusMotorV(Qt.QGroupBox, TaurusBaseWidget):
-###
-### def __init__(self, parent = None):
-### name = "TaurusMotorV"
-### self._prefix = ''
-### self._suffix = ''
-###
-### self.call__init__wo_kw(Qt.QGroupBox, parent)
-### self.call__init__(TaurusBaseWidget, name)
-###
-### self.setObjectName(name)
-### self.defineStyle()
-###
-###
-### ## I CAN NOT INHERIT FROM TAUGROUPBOX !
-### ## SO ALL THE STUFFABOVE IS NECESSARY
-### ##
-### ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-### ##############################################################################
-### ##
-### #class TaurusMotorV(TaurusGroupBox):
-### #def __init__(self, parent = None):
-### #self.call__init__wo_kw(TaurusGroupBox,parent)
-### #self.call__init__(TaurusGroupBox,str(self.objectName()))
-### self.setupUi()
-### self.retranslateUi()
-### self.connect(self.config,Qt.SIGNAL('clicked()'),self.configureMotor)
-###
-###
-### def configureMotor(self):
-### Dialog = Qt.QDialog(self)
-### Dialog.resize((Qt.QSize(Qt.QRect(0,0,310,309).size()).expandedTo(Dialog.minimumSizeHint())))
-### motorV2 = TaurusMotorV2(Dialog)
-### motorV2.setModel(self.model)
-### motorV2.setGeometry(Qt.QRect(10,10,291,291))
-### Dialog.show()
-###
-###
-###
-###
-### def minimumSizeHint(self):
-### return Qt.QSize(150,128)
-###
-### def sizeHint(self):
-### return Qt.QSize(150,128)
-###
-### def setupUi(self):
-###
-### self.gridlayout = Qt.QGridLayout(self)
-### self.gridlayout.setObjectName("gridlayout")
-###
-### self.vboxlayout = Qt.QVBoxLayout()
-### self.vboxlayout.setObjectName("vboxlayout")
-###
-### self.hboxlayout = Qt.QHBoxLayout()
-### self.hboxlayout.setObjectName("hboxlayout")
-###
-### self.taurusValueLabel_2 = TaurusValueLabel(self)
-### self.taurusValueLabel_2.setFrameShape(Qt.QFrame.NoFrame)
-### self.taurusValueLabel_2.setFrameShadow(Qt.QFrame.Plain)
-### self.taurusValueLabel_2.setShowQuality(False)
-### self.taurusValueLabel_2.setUseParentModel(True)
-### self.taurusValueLabel_2.setObjectName("taurusValueLabel_2")
-### self.hboxlayout.addWidget(self.taurusValueLabel_2)
-###
-### self.TaurusStateLed_17 = TaurusStateLed(self)
-### self.TaurusStateLed_17.setUseParentModel(True)
-### self.TaurusStateLed_17.setObjectName("TaurusStateLed_17")
-### self.hboxlayout.addWidget(self.TaurusStateLed_17)
-### self.vboxlayout.addLayout(self.hboxlayout)
-###
-### self.hboxlayout1 = Qt.QHBoxLayout()
-### self.hboxlayout1.setObjectName("hboxlayout1")
-###
-### self.TaurusValueLineEdit_21 = TaurusValueLineEdit(self)
-### self.TaurusValueLineEdit_21.setUseParentModel(True)
-### self.TaurusValueLineEdit_21.setObjectName("TaurusValueLineEdit_21")
-### self.hboxlayout1.addWidget(self.TaurusValueLineEdit_21)
-###
-### self.config = Qt.QToolButton(self)
-### self.config.setObjectName("config")
-### self.hboxlayout1.addWidget(self.config)
-### self.vboxlayout.addLayout(self.hboxlayout1)
-###
-### self.hboxlayout2 = Qt.QHBoxLayout()
-### self.hboxlayout2.setObjectName("hboxlayout2")
-###
-### self.taurusValueLabel_21 = TaurusValueLabel(self)
-### self.taurusValueLabel_21.setUseParentModel(True)
-### self.taurusValueLabel_21.setObjectName("taurusValueLabel_21")
-### self.hboxlayout2.addWidget(self.taurusValueLabel_21)
-###
-### self.taurusConfigLabel_18 = TaurusConfigLabel(self)
-### self.taurusConfigLabel_18.setMaximumSize(Qt.QSize(27,22))
-### self.taurusConfigLabel_18.setUseParentModel(True)
-### self.taurusConfigLabel_18.setObjectName("taurusConfigLabel_18")
-### self.hboxlayout2.addWidget(self.taurusConfigLabel_18)
-### self.vboxlayout.addLayout(self.hboxlayout2)
-###
-### self.hboxlayout3 = Qt.QHBoxLayout()
-### self.hboxlayout3.setObjectName("hboxlayout3")
-###
-### self.TaurusLimitSwitch = TaurusLimitSwitch(self)
-### self.TaurusLimitSwitch.setUseParentModel(True)
-### self.TaurusLimitSwitch.setBoolIndex(2)
-### self.TaurusLimitSwitch.setObjectName("TaurusLimitSwitch")
-### self.hboxlayout3.addWidget(self.TaurusLimitSwitch)
-###
-### self.label_3 = Qt.QLabel(self)
-### self.label_3.setAlignment(Qt.Qt.AlignCenter)
-### self.label_3.setObjectName("label_3")
-### self.hboxlayout3.addWidget(self.label_3)
-###
-### self.TaurusLimitSwitch_2 = TaurusLimitSwitch(self)
-### self.TaurusLimitSwitch_2.setUseParentModel(True)
-### self.TaurusLimitSwitch_2.setBoolIndex(1)
-### self.TaurusLimitSwitch_2.setObjectName("TaurusLimitSwitch_2")
-### self.hboxlayout3.addWidget(self.TaurusLimitSwitch_2)
-### self.vboxlayout.addLayout(self.hboxlayout3)
-### self.gridlayout.addLayout(self.vboxlayout,0,0,1,1)
-###
-###
-### def retranslateUi(self):
-### self.taurusValueLabel_2.setModel(Qt.QApplication.translate("Form", "/State", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusStateLed_17.setModel(Qt.QApplication.translate("Form", "/State", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusValueLineEdit_21.setModel(Qt.QApplication.translate("Form", "/Position", None, Qt.QApplication.UnicodeUTF8))
-### self.config.setText(Qt.QApplication.translate("Form", "cfg", None, Qt.QApplication.UnicodeUTF8))
-### self.taurusValueLabel_21.setModel(Qt.QApplication.translate("Form", "/Position", None, Qt.QApplication.UnicodeUTF8))
-### self.taurusConfigLabel_18.setModel(Qt.QApplication.translate("Form", "/Position?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch.setModel(Qt.QApplication.translate("Form", "/Limit_switches", None, Qt.QApplication.UnicodeUTF8))
-### self.label_3.setText(Qt.QApplication.translate("Form", "- lim +", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch_2.setModel(Qt.QApplication.translate("Form", "/Limit_switches", None, Qt.QApplication.UnicodeUTF8))
-###
-### ##############################################################################
-### ## VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
-### ##
-### ## I CAN NOT INHERIT FROM TAUGROUPBOX !
-### ## SO ALL THE STUFF BELOW IS NECESSARY
-###
-###
-###
-### def defineStyle(self):
-### palette = Qt.QPalette()
-### self.setPalette(palette)
-### self.updateStyle()
-###
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-### # TaurusBaseWidget over writing
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-###
-### def getDisplayValue(self):
-### return (self._prefix or '') + TaurusBaseWidget.getDisplayValue(self) + (self._suffix or '')
-###
-### def isReadOnly(self):
-### return True
-###
-### def updateStyle(self):
-### if self.getShowQuality():
-### self.setAutoFillBackground(True)
-### #TODO: get quality/state from model and update accordingly
-### else:
-### self.setAutoFillBackground(False)
-### #TODO: restore colors
-### self.update()
-###
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-### # QT properties
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-###
-### def getPrefixText(self):
-### return self._prefix
-###
-### @Qt.pyqtSignature("setPrefixText(QString)")
-### def setPrefixText(self,prefix):
-### self._prefix = prefix
-### self.fireValueChanged()
-###
-### def getSuffixText(self):
-### return self._suffix
-###
-### @Qt.pyqtSignature("setSuffixText(QString)")
-### def setSuffixText(self,suffix):
-### self._suffix = suffix
-### self.fireValueChanged()
-###
-### model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
-### TaurusBaseWidget.setModel, TaurusBaseWidget.resetModel)
-### useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
-### TaurusBaseWidget.setUseParentModel,
-### TaurusBaseWidget.resetUseParentModel)
-### showQuality = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowQuality,
-### TaurusBaseWidget.setShowQuality,
-### TaurusBaseWidget.resetShowQuality)
-### showText = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowText,
-### TaurusBaseWidget.setShowText,
-### TaurusBaseWidget.resetShowText)
-### prefixText = Qt.pyqtProperty("QString", getPrefixText, setPrefixText,
-### doc="prefix text (optional)")
-### suffixText = Qt.pyqtProperty("QString", getSuffixText, setSuffixText,
-### doc="suffix text (optional)")
-###
-###
-###
-###class TaurusMotorV2(Qt.QGroupBox, TaurusBaseWidget):
-###
-### def __init__(self, parent = None):
-### name = "TaurusMotorV2"
-### self._prefix = ''
-### self._suffix = ''
-###
-### self.call__init__wo_kw(Qt.QGroupBox, parent)
-### self.call__init__(TaurusBaseWidget, name)
-###
-### self.setObjectName(name)
-### self.defineStyle()
-###
-###
-### ## I CAN NOT INHERIT FROM TAUGROUPBOX !
-### ## SO ALL THE STUFFABOVE IS NECESSARY
-### ##
-### ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-### ##############################################################################
-### ##
-### #class TaurusMotorV2(TaurusGroupBox):
-### #def __init__(self, parent = None):
-### #self.call__init__wo_kw(TaurusGroupBox,parent)
-### #self.call__init__(TaurusGroupBox,str(self.objectName()))
-### self.setupUi()
-### self.retranslateUi()
-###
-###
-### def minimumSizeHint(self):
-### return Qt.QSize(260,270)
-###
-### def sizeHint(self):
-### return Qt.QSize(260,270)
-###
-###
-### def setupUi(self):
-###
-### self.gridlayout = Qt.QGridLayout(self)
-### self.gridlayout.setObjectName("gridlayout")
-###
-### self.m1StateLed_2 = TaurusStateLed(self)
-### self.m1StateLed_2.setLedSize(24)
-### self.m1StateLed_2.setUseParentModel(True)
-### self.m1StateLed_2.setObjectName("m1StateLed_2")
-### self.gridlayout.addWidget(self.m1StateLed_2,0,0,1,1)
-###
-### self.taurusValueLabel = TaurusValueLabel(self)
-### self.taurusValueLabel.setFrameShape(Qt.QFrame.NoFrame)
-### self.taurusValueLabel.setFrameShadow(Qt.QFrame.Plain)
-### self.taurusValueLabel.setShowQuality(False)
-### self.taurusValueLabel.setUseParentModel(True)
-### self.taurusValueLabel.setObjectName("taurusValueLabel")
-### self.gridlayout.addWidget(self.taurusValueLabel,0,1,1,1)
-###
-### self.TaurusLimitSwitch = TaurusLimitSwitch(self)
-### self.TaurusLimitSwitch.setUseParentModel(True)
-### self.TaurusLimitSwitch.setBoolIndex(2)
-### self.TaurusLimitSwitch.setObjectName("TaurusLimitSwitch")
-### self.gridlayout.addWidget(self.TaurusLimitSwitch,0,3,1,1)
-###
-### self.TaurusLimitSwitch_2 = TaurusLimitSwitch(self)
-### self.TaurusLimitSwitch_2.setUseParentModel(True)
-### self.TaurusLimitSwitch_2.setBoolIndex(1)
-### self.TaurusLimitSwitch_2.setObjectName("TaurusLimitSwitch_2")
-### self.gridlayout.addWidget(self.TaurusLimitSwitch_2,0,4,1,1)
-###
-### self.m1PositionLabel_2 = TaurusConfigLabel(self)
-### self.m1PositionLabel_2.setUseParentModel(True)
-### self.m1PositionLabel_2.setObjectName("m1PositionLabel_2")
-### self.gridlayout.addWidget(self.m1PositionLabel_2,1,0,1,2)
-###
-### self.m1PositionEdit_2 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionEdit_2.sizePolicy().hasHeightForWidth())
-### self.m1PositionEdit_2.setSizePolicy(sizePolicy)
-### self.m1PositionEdit_2.setUseParentModel(True)
-### self.m1PositionEdit_2.setObjectName("m1PositionEdit_2")
-### self.gridlayout.addWidget(self.m1PositionEdit_2,1,2,1,1)
-###
-### self.m1Position_2 = TaurusValueLabel(self)
-### self.m1Position_2.setUseParentModel(True)
-### self.m1Position_2.setObjectName("m1Position_2")
-### self.gridlayout.addWidget(self.m1Position_2,1,3,1,2)
-###
-### self.m1PositionUnitLabel_2 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionUnitLabel_2.sizePolicy().hasHeightForWidth())
-### self.m1PositionUnitLabel_2.setSizePolicy(sizePolicy)
-### self.m1PositionUnitLabel_2.setUseParentModel(True)
-### self.m1PositionUnitLabel_2.setObjectName("m1PositionUnitLabel_2")
-### self.gridlayout.addWidget(self.m1PositionUnitLabel_2,1,5,1,1)
-###
-### self.m1VelocityLabel_2 = TaurusConfigLabel(self)
-### self.m1VelocityLabel_2.setUseParentModel(True)
-### self.m1VelocityLabel_2.setObjectName("m1VelocityLabel_2")
-### self.gridlayout.addWidget(self.m1VelocityLabel_2,2,0,1,2)
-###
-### self.m1VelocityEdit_2 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1VelocityEdit_2.sizePolicy().hasHeightForWidth())
-### self.m1VelocityEdit_2.setSizePolicy(sizePolicy)
-### self.m1VelocityEdit_2.setUseParentModel(True)
-### self.m1VelocityEdit_2.setObjectName("m1VelocityEdit_2")
-### self.gridlayout.addWidget(self.m1VelocityEdit_2,2,2,1,1)
-###
-### self.m1Velocity_2 = TaurusValueLabel(self)
-### self.m1Velocity_2.setUseParentModel(True)
-### self.m1Velocity_2.setObjectName("m1Velocity_2")
-### self.gridlayout.addWidget(self.m1Velocity_2,2,3,1,2)
-###
-### self.m1VelocityUnitLabel_2 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1VelocityUnitLabel_2.sizePolicy().hasHeightForWidth())
-### self.m1VelocityUnitLabel_2.setSizePolicy(sizePolicy)
-### self.m1VelocityUnitLabel_2.setUseParentModel(True)
-### self.m1VelocityUnitLabel_2.setObjectName("m1VelocityUnitLabel_2")
-### self.gridlayout.addWidget(self.m1VelocityUnitLabel_2,2,5,1,1)
-###
-### self.m1PositionLabel_4 = TaurusConfigLabel(self)
-### self.m1PositionLabel_4.setUseParentModel(True)
-### self.m1PositionLabel_4.setObjectName("m1PositionLabel_4")
-### self.gridlayout.addWidget(self.m1PositionLabel_4,3,0,1,2)
-###
-### self.m1PositionEdit_4 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionEdit_4.sizePolicy().hasHeightForWidth())
-### self.m1PositionEdit_4.setSizePolicy(sizePolicy)
-### self.m1PositionEdit_4.setUseParentModel(True)
-### self.m1PositionEdit_4.setObjectName("m1PositionEdit_4")
-### self.gridlayout.addWidget(self.m1PositionEdit_4,3,2,1,1)
-###
-### self.m1Position_4 = TaurusValueLabel(self)
-### self.m1Position_4.setUseParentModel(True)
-### self.m1Position_4.setObjectName("m1Position_4")
-### self.gridlayout.addWidget(self.m1Position_4,3,3,1,2)
-###
-### self.m1PositionUnitLabel_4 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionUnitLabel_4.sizePolicy().hasHeightForWidth())
-### self.m1PositionUnitLabel_4.setSizePolicy(sizePolicy)
-### self.m1PositionUnitLabel_4.setUseParentModel(True)
-### self.m1PositionUnitLabel_4.setObjectName("m1PositionUnitLabel_4")
-### self.gridlayout.addWidget(self.m1PositionUnitLabel_4,3,5,1,1)
-###
-### self.m1AccelerationLabel_2 = TaurusConfigLabel(self)
-### self.m1AccelerationLabel_2.setUseParentModel(True)
-### self.m1AccelerationLabel_2.setObjectName("m1AccelerationLabel_2")
-### self.gridlayout.addWidget(self.m1AccelerationLabel_2,4,0,1,2)
-###
-### self.m1AccelerationEdit_2 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1AccelerationEdit_2.sizePolicy().hasHeightForWidth())
-### self.m1AccelerationEdit_2.setSizePolicy(sizePolicy)
-### self.m1AccelerationEdit_2.setUseParentModel(True)
-### self.m1AccelerationEdit_2.setObjectName("m1AccelerationEdit_2")
-### self.gridlayout.addWidget(self.m1AccelerationEdit_2,4,2,1,1)
-###
-### self.m1Acceleration_2 = TaurusValueLabel(self)
-### self.m1Acceleration_2.setUseParentModel(True)
-### self.m1Acceleration_2.setObjectName("m1Acceleration_2")
-### self.gridlayout.addWidget(self.m1Acceleration_2,4,3,1,2)
-###
-### self.m1AccelerationUnitLabel_2 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1AccelerationUnitLabel_2.sizePolicy().hasHeightForWidth())
-### self.m1AccelerationUnitLabel_2.setSizePolicy(sizePolicy)
-### self.m1AccelerationUnitLabel_2.setUseParentModel(True)
-### self.m1AccelerationUnitLabel_2.setObjectName("m1AccelerationUnitLabel_2")
-### self.gridlayout.addWidget(self.m1AccelerationUnitLabel_2,4,5,1,1)
-###
-### self.m1PositionLabel_5 = TaurusConfigLabel(self)
-### self.m1PositionLabel_5.setUseParentModel(True)
-### self.m1PositionLabel_5.setObjectName("m1PositionLabel_5")
-### self.gridlayout.addWidget(self.m1PositionLabel_5,5,0,1,2)
-###
-### self.m1PositionEdit_5 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionEdit_5.sizePolicy().hasHeightForWidth())
-### self.m1PositionEdit_5.setSizePolicy(sizePolicy)
-### self.m1PositionEdit_5.setUseParentModel(True)
-### self.m1PositionEdit_5.setObjectName("m1PositionEdit_5")
-### self.gridlayout.addWidget(self.m1PositionEdit_5,5,2,1,1)
-###
-### self.m1Position_5 = TaurusValueLabel(self)
-### self.m1Position_5.setUseParentModel(True)
-### self.m1Position_5.setObjectName("m1Position_5")
-### self.gridlayout.addWidget(self.m1Position_5,5,3,1,2)
-###
-### self.m1PositionUnitLabel_5 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionUnitLabel_5.sizePolicy().hasHeightForWidth())
-### self.m1PositionUnitLabel_5.setSizePolicy(sizePolicy)
-### self.m1PositionUnitLabel_5.setUseParentModel(True)
-### self.m1PositionUnitLabel_5.setObjectName("m1PositionUnitLabel_5")
-### self.gridlayout.addWidget(self.m1PositionUnitLabel_5,5,5,1,1)
-###
-### self.m1DecelerationLabel_2 = TaurusConfigLabel(self)
-### self.m1DecelerationLabel_2.setUseParentModel(True)
-### self.m1DecelerationLabel_2.setObjectName("m1DecelerationLabel_2")
-### self.gridlayout.addWidget(self.m1DecelerationLabel_2,6,0,1,2)
-###
-### self.m1DecelerationEdit_2 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1DecelerationEdit_2.sizePolicy().hasHeightForWidth())
-### self.m1DecelerationEdit_2.setSizePolicy(sizePolicy)
-### self.m1DecelerationEdit_2.setUseParentModel(True)
-### self.m1DecelerationEdit_2.setObjectName("m1DecelerationEdit_2")
-### self.gridlayout.addWidget(self.m1DecelerationEdit_2,6,2,1,1)
-###
-### self.m1Deceleration_2 = TaurusValueLabel(self)
-### self.m1Deceleration_2.setUseParentModel(True)
-### self.m1Deceleration_2.setObjectName("m1Deceleration_2")
-### self.gridlayout.addWidget(self.m1Deceleration_2,6,3,1,2)
-###
-### self.m1DecelerationUnitLabel_2 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1DecelerationUnitLabel_2.sizePolicy().hasHeightForWidth())
-### self.m1DecelerationUnitLabel_2.setSizePolicy(sizePolicy)
-### self.m1DecelerationUnitLabel_2.setUseParentModel(True)
-### self.m1DecelerationUnitLabel_2.setObjectName("m1DecelerationUnitLabel_2")
-### self.gridlayout.addWidget(self.m1DecelerationUnitLabel_2,6,5,1,1)
-###
-### self.m1PositionLabel_6 = TaurusConfigLabel(self)
-### self.m1PositionLabel_6.setUseParentModel(True)
-### self.m1PositionLabel_6.setObjectName("m1PositionLabel_6")
-### self.gridlayout.addWidget(self.m1PositionLabel_6,7,0,1,2)
-###
-### self.m1PositionEdit_6 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionEdit_6.sizePolicy().hasHeightForWidth())
-### self.m1PositionEdit_6.setSizePolicy(sizePolicy)
-### self.m1PositionEdit_6.setUseParentModel(True)
-### self.m1PositionEdit_6.setObjectName("m1PositionEdit_6")
-### self.gridlayout.addWidget(self.m1PositionEdit_6,7,2,1,1)
-###
-### self.m1Position_6 = TaurusValueLabel(self)
-### self.m1Position_6.setUseParentModel(True)
-### self.m1Position_6.setObjectName("m1Position_6")
-### self.gridlayout.addWidget(self.m1Position_6,7,3,1,2)
-###
-### self.m1PositionUnitLabel_6 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1PositionUnitLabel_6.sizePolicy().hasHeightForWidth())
-### self.m1PositionUnitLabel_6.setSizePolicy(sizePolicy)
-### self.m1PositionUnitLabel_6.setUseParentModel(True)
-### self.m1PositionUnitLabel_6.setObjectName("m1PositionUnitLabel_6")
-### self.gridlayout.addWidget(self.m1PositionUnitLabel_6,7,5,1,1)
-###
-### self.m1StepPerUnitLabel_2 = TaurusConfigLabel(self)
-### self.m1StepPerUnitLabel_2.setUseParentModel(True)
-### self.m1StepPerUnitLabel_2.setObjectName("m1StepPerUnitLabel_2")
-### self.gridlayout.addWidget(self.m1StepPerUnitLabel_2,8,0,1,2)
-###
-### self.m1StepPerUnitEdit_2 = TaurusValueLineEdit(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed,Qt.QSizePolicy.Fixed)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1StepPerUnitEdit_2.sizePolicy().hasHeightForWidth())
-### self.m1StepPerUnitEdit_2.setSizePolicy(sizePolicy)
-### self.m1StepPerUnitEdit_2.setUseParentModel(True)
-### self.m1StepPerUnitEdit_2.setObjectName("m1StepPerUnitEdit_2")
-### self.gridlayout.addWidget(self.m1StepPerUnitEdit_2,8,2,1,1)
-###
-### self.m1StepPerUnit_2 = TaurusValueLabel(self)
-### self.m1StepPerUnit_2.setUseParentModel(True)
-### self.m1StepPerUnit_2.setObjectName("m1StepPerUnit_2")
-### self.gridlayout.addWidget(self.m1StepPerUnit_2,8,3,1,2)
-###
-### self.m1StepPerUnitUnitLabel_2 = TaurusConfigLabel(self)
-###
-### sizePolicy = Qt.QSizePolicy(Qt.QSizePolicy.Expanding,Qt.QSizePolicy.Preferred)
-### sizePolicy.setHorizontalStretch(0)
-### sizePolicy.setVerticalStretch(0)
-### sizePolicy.setHeightForWidth(self.m1StepPerUnitUnitLabel_2.sizePolicy().hasHeightForWidth())
-### self.m1StepPerUnitUnitLabel_2.setSizePolicy(sizePolicy)
-### self.m1StepPerUnitUnitLabel_2.setUseParentModel(True)
-### self.m1StepPerUnitUnitLabel_2.setObjectName("m1StepPerUnitUnitLabel_2")
-### self.gridlayout.addWidget(self.m1StepPerUnitUnitLabel_2,8,5,1,1)
-###
-###
-### def retranslateUi(self):
-### self.m1StateLed_2.setModel(Qt.QApplication.translate("Dialog", "/State", None, Qt.QApplication.UnicodeUTF8))
-### self.taurusValueLabel.setModel(Qt.QApplication.translate("Dialog", "/State", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch.setLedColor(Qt.QApplication.translate("Dialog", "ORANGE", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch.setModel(Qt.QApplication.translate("Dialog", "/Limit_switches", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch_2.setLedColor(Qt.QApplication.translate("Dialog", "ORANGE", None, Qt.QApplication.UnicodeUTF8))
-### self.TaurusLimitSwitch_2.setModel(Qt.QApplication.translate("Dialog", "/Limit_switches", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_2.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Position?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionEdit_2.setModel(Qt.QApplication.translate("Dialog", "/Position", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Position_2.setModel(Qt.QApplication.translate("Dialog", "/Position", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionUnitLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Position?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1VelocityLabel_2.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1VelocityLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Velocity?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1VelocityEdit_2.setModel(Qt.QApplication.translate("Dialog", "/Velocity", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Velocity_2.setModel(Qt.QApplication.translate("Dialog", "/Velocity", None, Qt.QApplication.UnicodeUTF8))
-### self.m1VelocityUnitLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Velocity?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_4.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_4.setModel(Qt.QApplication.translate("Dialog", "/Acceleration?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionEdit_4.setModel(Qt.QApplication.translate("Dialog", "/Acceleration", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Position_4.setModel(Qt.QApplication.translate("Dialog", "/Acceleration", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionUnitLabel_4.setModel(Qt.QApplication.translate("Dialog", "/Acceleration?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1AccelerationLabel_2.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1AccelerationLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Deceleration?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1AccelerationEdit_2.setModel(Qt.QApplication.translate("Dialog", "/Deceleration", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Acceleration_2.setModel(Qt.QApplication.translate("Dialog", "/Deceleration", None, Qt.QApplication.UnicodeUTF8))
-### self.m1AccelerationUnitLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Deceleration?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_5.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_5.setModel(Qt.QApplication.translate("Dialog", "/Offset?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionEdit_5.setModel(Qt.QApplication.translate("Dialog", "/Offset", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Position_5.setModel(Qt.QApplication.translate("Dialog", "/Offset", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionUnitLabel_5.setModel(Qt.QApplication.translate("Dialog", "/Offset?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1DecelerationLabel_2.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1DecelerationLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Base_rate?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1DecelerationEdit_2.setModel(Qt.QApplication.translate("Dialog", "/Base_rate", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Deceleration_2.setModel(Qt.QApplication.translate("Dialog", "/Base_rate", None, Qt.QApplication.UnicodeUTF8))
-### self.m1DecelerationUnitLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Base_rate?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_6.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionLabel_6.setModel(Qt.QApplication.translate("Dialog", "/Step_per_unit?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionEdit_6.setModel(Qt.QApplication.translate("Dialog", "/Step_per_unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1Position_6.setModel(Qt.QApplication.translate("Dialog", "/Step_per_unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1PositionUnitLabel_6.setModel(Qt.QApplication.translate("Dialog", "/Step_per_unit?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-### self.m1StepPerUnitLabel_2.setSuffixText(Qt.QApplication.translate("Dialog", ":", None, Qt.QApplication.UnicodeUTF8))
-### self.m1StepPerUnitLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Backlash?configuration=label", None, Qt.QApplication.UnicodeUTF8))
-### self.m1StepPerUnitEdit_2.setModel(Qt.QApplication.translate("Dialog", "/Backlash", None, Qt.QApplication.UnicodeUTF8))
-### self.m1StepPerUnit_2.setModel(Qt.QApplication.translate("Dialog", "/Backlash", None, Qt.QApplication.UnicodeUTF8))
-### self.m1StepPerUnitUnitLabel_2.setModel(Qt.QApplication.translate("Dialog", "/Backlash?configuration=unit", None, Qt.QApplication.UnicodeUTF8))
-###
-### ##############################################################################
-### ## VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
-### ##
-### ## I CAN NOT INHERIT FROM TAUGROUPBOX !
-### ## SO ALL THE STUFF BELOW IS NECESSARY
-###
-###
-###
-### def defineStyle(self):
-### palette = Qt.QPalette()
-### self.setPalette(palette)
-### self.updateStyle()
-###
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-### # TaurusBaseWidget over writing
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-###
-### def getDisplayValue(self):
-### return (self._prefix or '') + TaurusBaseWidget.getDisplayValue(self) + (self._suffix or '')
-###
-### def isReadOnly(self):
-### return True
-###
-### def updateStyle(self):
-### if self.getShowQuality():
-### self.setAutoFillBackground(True)
-### #TODO: get quality/state from model and update accordingly
-### else:
-### self.setAutoFillBackground(False)
-### #TODO: restore colors
-### self.update()
-###
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-### # QT properties
-### #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-###
-### def getPrefixText(self):
-### return self._prefix
-###
-### @Qt.pyqtSignature("setPrefixText(QString)")
-### def setPrefixText(self,prefix):
-### self._prefix = prefix
-### self.fireValueChanged()
-###
-### def getSuffixText(self):
-### return self._suffix
-###
-### @Qt.pyqtSignature("setSuffixText(QString)")
-### def setSuffixText(self,suffix):
-### self._suffix = suffix
-### self.fireValueChanged()
-###
-### model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
-### TaurusBaseWidget.setModel, TaurusBaseWidget.resetModel)
-### useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
-### TaurusBaseWidget.setUseParentModel,
-### TaurusBaseWidget.resetUseParentModel)
-### showQuality = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowQuality,
-### TaurusBaseWidget.setShowQuality,
-### TaurusBaseWidget.resetShowQuality)
-### showText = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowText,
-### TaurusBaseWidget.setShowText,
-### TaurusBaseWidget.resetShowText)
-### prefixText = Qt.pyqtProperty("QString", getPrefixText, setPrefixText,
-### doc="prefix text (optional)")
-### suffixText = Qt.pyqtProperty("QString", getSuffixText, setSuffixText,
-### doc="suffix text (optional)")
-###
-###
-###
-
-if __name__ == "__main__":
-
- import sys
- app = Qt.QApplication(sys.argv)
-
- form = TaurusMotorH()
- form.setModel(sys.argv[1])
-
- form.show()
- sys.exit(app.exec_())
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/poolchannel.py b/src/sardana/taurus/qt/qtgui/extra_pool/poolchannel.py
deleted file mode 100644
index acbc0e25..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/poolchannel.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-channelWidgets.py:
-"""
-
-__all__ = ["PoolChannel", "PoolChannelTV"]
-
-import taurus
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.panel import TaurusValue, TaurusDevButton
-from taurus.qt.qtgui.container import TaurusWidget
-from poolmotor import LabelWidgetDragsDeviceAndAttribute
-
-
-class _ParentDevButton(TaurusDevButton):
- '''A TaurusDevButton that receives an attribute name but sets
- the corresponding device as model. **For internal use only** '''
- def __init__(self, **kwargs):
- TaurusDevButton.__init__(self, **kwargs)
- self.setText('')
- self.setSizePolicy(Qt.QSizePolicy.Preferred, Qt.QSizePolicy.Maximum)
-
- def setModel(self, model):
- try: attr = taurus.Attribute(model)
- except: return
- dev = attr.getParentObj()
- devname = dev.getFullName()
- TaurusDevButton.setModel(self, devname)
-
-
-class PoolChannelTV(TaurusValue):
- ''' A widget that displays and controls a pool channel device.
- It differs from :class:`PoolChannel` in that it behaves as a TaurusValue
- (i.e., it allows its subwidgets to be aligned in columns in a TaurusForm)`
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusValue.__init__(self, parent=parent, designMode=designMode)
- self.setLabelWidgetClass("LabelWidgetDragsDeviceAndAttribute")
- self.setLabelConfig('dev_alias')
-
- def getDefaultExtraWidgetClass(self):
- return _ParentDevButton
-
- def setModel(self, model):
- if model is not None:
- model = "%s/value" % model #@todo: change this (it assumes tango naming!)
- TaurusValue.setModel(self, model)
-
- def showEvent(self, event):
- TaurusValue.showEvent(self, event)
- try: self.getModelObj().getParentObj().getAttribute('Value').enablePolling(force=True)
- except: pass
-
- def hideEvent(self, event):
- TaurusValue.hideEvent(self, event)
- try: self.getModelObj().getParentObj().getAttribute('Value').disablePolling()
- except: pass
-
-
-
-class PoolChannel(TaurusWidget):
- ''' A widget that displays and controls a pool channel device
-
- .. seealso:: :class:`PoolChannelTV`
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent)
-
- self.setLayout(Qt.QHBoxLayout())
-
- #put a widget with a TaurusValue
- w = Qt.QWidget()
- w.setLayout(Qt.QGridLayout())
- self._TaurusValue = TaurusValue(parent=w, designMode=designMode)
- self._TaurusValue.setLabelWidgetClass(LabelWidgetDragsDeviceAndAttribute)
- self._TaurusValue.setLabelConfig('dev_alias')
- self.layout().addWidget(w)
-
- #...and a dev button next to the widget
- self._devButton = TaurusDevButton(parent=self, designMode=designMode)
- self._devButton.setText('')
- self.layout().addWidget(self._devButton)
-
- self.connect(self, Qt.SIGNAL('modelChanged(const QString &)'), self._updateTaurusValue)
-
- def _updateTaurusValue(self):
- m = self.getModelName()
- self._TaurusValue.setModel("%s/value" % m)
- self._devButton.setModel(m)
-
-
-#if __name__ == '__main__':
-# import sys
-# app = Qt.QApplication(sys.argv)
-#
-# form = PoolChannel()
-#
-# #model = 'tango://controls02:10000/expchan/bl97_simucotictrl_1/1'
-# model = 'ct_cp1_1'
-# if len(sys.argv)>1:
-# model = sys.argv[1]
-# form.setModel(model)
-#
-#
-# form.show()
-# sys.exit(app.exec_())
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/poolioregister.py b/src/sardana/taurus/qt/qtgui/extra_pool/poolioregister.py
deleted file mode 100644
index 97d89b55..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/poolioregister.py
+++ /dev/null
@@ -1,302 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-poolioregister.py:
-"""
-
-__all__ = ["PoolIORegisterTV", "PoolIORegister", 'PoolIORegisterButtons']
-
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.display import TaurusLabel
-from taurus.core.util.eventfilters import EventValueMap
-from taurus.qt.qtgui.input import TaurusValueComboBox
-
-from taurus.qt.qtgui.panel import TaurusValue
-from taurus.qt.qtgui.container import TaurusWidget
-from taurus.qt.qtgui.util.ui import UILoadable
-from poolmotor import LabelWidgetDragsDeviceAndAttribute
-
-import taurus
-
-class PoolIORegisterReadWidget(TaurusLabel):
- ''' This class is intended to be used as a read widget of a TaurusValue with IORegister devices.
- After setting the model, it gets the Labels and creates a filter to show them instead of the values.
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusLabel.__init__(self, parent, designMode)
-
- def setModel(self, model):
- TaurusLabel.setModel(self, '%s/value' % model) #@todo: change this (it assumes tango naming!)
-
- try: ior_dev = taurus.Device(model)
- except: return
- labels = ior_dev.getAttribute('Labels').read().value
- labels_list = labels.split(' ')
-
- # Update the mapping
- self.readEventValueMap = EventValueMap()
- for label_and_value in labels_list:
- label, value = label_and_value.split(':')
- self.readEventValueMap[int(value)] = label
- # @TODO: Some day filters will work again...
- # until then, it is better to NOT have the filter
- # so at least we see a value and not '------'
- #self.setEventFilters([self.readEventValueMap])
-
- ##########################################################
- # FILTERS ARE NOT WORKING AS OF SVN:17541
- # SO I RE-IMPLEMENT getFormatedToolTip for this purpose
- ##########################################################
- def getFormatedToolTip(self, cache=True):
- taurus_label_tooltip = TaurusLabel.getFormatedToolTip(self, cache)
- try:
- display_value = int(self.getDisplayValue())
- extended_tooltip = ''
- value_keys = self.readEventValueMap.keys()
- value_keys.sort()
- for value in value_keys:
- label = self.readEventValueMap[value]
- value_label_info = '%d: %s' % (value, label)
- if value == display_value:
- value_label_info = '<B>* ' + value_label_info + ' *</B>'
- extended_tooltip += value_label_info + '<BR>'
- return taurus_label_tooltip + '<HR>' + extended_tooltip
- except:
- pass
- return taurus_label_tooltip
- ##########################################################
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-
-class PoolIORegisterWriteWidget(TaurusValueComboBox):
- ''' This class is intended to be used as a write widget of a TaurusValue with IORegister devices.
- After setting the model, it gets the Labels and populates the combobox. It has AutoApply set to True.
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusValueComboBox.__init__(self, parent, designMode)
- TaurusValueComboBox.setForcedApply(self, True)
-
- def setModel(self, model):
- TaurusValueComboBox.setModel(self, '%s/value' % model) #@todo: change this (it assumes tango naming!)
-
- try: ior_dev = taurus.Device(model)
- except: return
-
- labels = ior_dev.getAttribute('Labels').read().value
- labels_list = labels.split(' ')
-
- # Update the mapping
- self.writeValueNames = []
- for label_and_value in labels_list:
- label, value = label_and_value.split(':')
- self.writeValueNames.append((label, value))
-
- self.setValueNames(self.writeValueNames)
- @classmethod
- def getQtDesignerPluginInfo(cls):
- return None
-
-class PoolIORegisterTV(TaurusValue):
- ''' A widget that displays and controls a pool IORegister device. It
- behaves as a TaurusValue.
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusValue.__init__(self, parent=parent, designMode=designMode)
- self.setLabelWidgetClass("LabelWidgetDragsDeviceAndAttribute")
- self.setLabelConfig('dev_alias')
- self.setReadWidgetClass('PoolIORegisterReadWidget')
- self.setWriteWidgetClass('PoolIORegisterWriteWidget')
- self.ioreg_dev = None
-
- def setModel(self, model):
- TaurusValue.setModel(self, model)
- try: self.ioreg_dev = taurus.Device(model)
- except: return
-
- def showEvent(self, event):
- TaurusValue.showEvent(self, event)
- if self.ioreg_dev is not None:
- self.ioreg_dev.getAttribute('Value').enablePolling(force=True)
-
- def hideEvent(self, event):
- TaurusValue.hideEvent(self, event)
- if self.ioreg_dev is not None:
- self.ioreg_dev.getAttribute('Value').disablePolling()
-
-
-class PoolIORegister(TaurusWidget):
- ''' A widget that displays and controls a pool IORegister device.
- It reads the value and provides a combobox to write it.
- NOTE: It would be nice to provide 'ABORT' button if the device allows it.
- NOTE: It would be nice to set icons for each possible value label.
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
-
- self.ioreg_dev = None
-
- self.setLayout(Qt.QHBoxLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
- self.layout().setSpacing(0)
-
- self.alias_label = TaurusLabel()
- self.alias_label.setBgRole('state')
- self.layout().addWidget(self.alias_label)
-
- self.read_widget = PoolIORegisterReadWidget()
- self.layout().addWidget(self.read_widget)
-
- self.write_widget = PoolIORegisterWriteWidget()
- self.layout().addWidget(self.write_widget)
-
- def setModel(self, model):
- try: self.ioreg_dev = taurus.Device(model)
- except: return
-
- self.alias_label.setModel('%s/State?configuration=dev_alias' % model)
- self.read_widget.setModel(model)
- self.write_widget.setModel(model)
-
- def showEvent(self, event):
- TaurusWidget.showEvent(self, event)
- if self.ioreg_dev is not None:
- self.ioreg_dev.getAttribute('Value').enablePolling(force=True)
-
- def hideEvent(self, event):
- TaurusWidget.hideEvent(self, event)
- if self.ioreg_dev is not None:
- self.ioreg_dev.getAttribute('Value').disablePolling()
-
-
-@UILoadable(with_ui='ui')
-class PoolIORegisterButtons(TaurusWidget):
- ''' A widget that displays and controls a pool IORegister device.
- It reads the value and provides buttons to switch between values.
- NOTE: It would be nice to provide 'ABORT' button if the device allows it.
- NOTE: It would be nice to set icons for each possible value label.
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.loadUi()
-
- self.ioreg_dev = None
-
- self.alias_label = TaurusLabel()
- self.alias_label.setBgRole('state')
- self.value_label = PoolIORegisterReadWidget()
- self.button_value_dict = {}
-
- policy = self.value_label.sizePolicy()
- policy.setHorizontalPolicy(Qt.QSizePolicy.Expanding)
- self.value_label.setSizePolicy(policy)
-
- self.ui.lo_state_read.addWidget(self.alias_label)
- self.ui.lo_state_read.addWidget(self.value_label)
-
- def setModel(self, model):
- try: self.ioreg_dev = taurus.Device(model)
- except: return
-
- self.alias_label.setModel('%s/State?configuration=dev_alias' % model)
- self.value_label.setModel(model)
-
- # Empty previous buttons
- #self.ui.lo_buttons_write.
- for button in self.button_value_dict.keys():
- self.disconnect(button, Qt.SIGNAL('clicked'), self.writeValue)
- button.deleteLater()
- self.button_value_dict = {}
-
- labels = self.ioreg_dev.getAttribute('Labels').read().value
- labels_list = labels.split(' ')
- # Update the mapping
- for label_and_value in labels_list:
- label, value = label_and_value.split(':')
- button = Qt.QPushButton(label)
- self.button_value_dict[button] = value
- self.ui.lo_buttons_write.addWidget(button)
- self.connect(button, Qt.SIGNAL('clicked()'), self.writeValue)
-
- def writeValue(self):
- if self.ioreg_dev is None:
- return
- button = self.sender()
- value = self.button_value_dict[button]
- self.ioreg_dev.getAttribute('Value').write(value)
-
- def showEvent(self, event):
- TaurusWidget.showEvent(self, event)
- if self.ioreg_dev is not None:
- self.ioreg_dev.getAttribute('Value').enablePolling(force=True)
-
- def hideEvent(self, event):
- TaurusWidget.hideEvent(self, event)
- if self.ioreg_dev is not None:
- self.ioreg_dev.getAttribute('Value').disablePolling()
-
-
-
-def test_form():
- from taurus.qt.qtgui.panel import TaurusForm
- tgclass_map = {'IORegister':PoolIORegisterTV}
- form = TaurusForm()
- form.setCustomWidgetMap(tgclass_map)
- model = 'tango://controls02:10000/ioregister/gc_tgiorctrl/1'
- if len(sys.argv) > 1:
- model = sys.argv[1]
-
- form.setModel([model])
- form.show()
-
-def test_widget():
- w = PoolIORegister()
- model = 'tango://controls02:10000/ioregister/gc_tgiorctrl/1'
- if len(sys.argv) > 1:
- model = sys.argv[1]
-
- w.setModel(model)
- w.show()
-
-def test_buttons():
- w = PoolIORegisterButtons()
- model = 'tango://controls02:10000/ioregister/gc_tgiorctrl/1'
- if len(sys.argv) > 1:
- model = sys.argv[1]
-
- w.setModel(model)
- w.show()
-
-if __name__ == '__main__':
- import sys
- app = Qt.QApplication(sys.argv)
-
- #test_form()
- #test_widget()
- test_buttons()
-
- sys.exit(app.exec_())
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/poolmotor.py b/src/sardana/taurus/qt/qtgui/extra_pool/poolmotor.py
deleted file mode 100644
index 5fa59454..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/poolmotor.py
+++ /dev/null
@@ -1,1578 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-import sys
-import copy
-import PyTango
-import numpy
-
-from taurus.external.qt import Qt
-
-import taurus
-from taurus.core.util.colors import DEVICE_STATE_PALETTE
-from taurus.core.taurusbasetypes import TaurusEventType
-from taurus.core.taurusvalidator import DeviceNameValidator
-import taurus.qt.qtcore.mimetypes
-from taurus.qt.qtgui.base import TaurusBaseWritableWidget
-from taurus.qt.qtgui.compact import TaurusReadWriteSwitcher
-from taurus.qt.qtgui.dialog import ProtectTaurusMessageBox
-from taurus.qt.qtgui.base import TaurusBaseWidget
-from taurus.qt.qtgui.container import TaurusWidget
-from taurus.qt.qtgui.container import TaurusFrame
-from taurus.qt.qtgui.display import TaurusLabel
-from taurus.qt.qtgui.input import TaurusValueLineEdit
-from taurus.qt.qtgui.input import TaurusValueSpinBox
-from taurus.qt.qtgui.panel import DefaultLabelWidget
-from taurus.qt.qtgui.panel import DefaultUnitsWidget
-from taurus.qt.qtgui.panel import TaurusValue, TaurusAttrForm
-from taurus.qt.qtcore.mimetypes import TAURUS_DEV_MIME_TYPE, TAURUS_ATTR_MIME_TYPE
-from taurus.qt.qtgui.resource import getIcon
-from taurus.qt.qtgui.util.ui import UILoadable
-
-
-class LimitsListener(Qt.QObject):
- """
- A class that listens to changes on motor limits.
- If that is the case it emits a signal so the application
- can do whatever with it.
- """
- def __init__(self):
- Qt.QObject.__init__(self)
-
- def eventReceived(self, evt_src, evt_type, evt_value):
- if evt_type not in [TaurusEventType.Change, TaurusEventType.Periodic]:
- return
- limits = evt_value.value
- self.emit(Qt.SIGNAL('updateLimits(PyQt_PyObject)'), limits.tolist())
-
-class PoolMotorClient():
-
- maxint_in_32_bits = 2147483647
- def __init__(self):
- self.motor_dev = None
- self.has_limits = False
- self.has_encoder = False
-
- def setMotor(self, pool_motor_dev_name):
- # AT SOME POINT THIS WILL BE USING THE 'POOL' TAURUS EXTENSION
- # TO OPERATE THE MOTOR INSTEAD OF A 'TANGO' TAURUSDEVICE
- try:
- self.motor_dev = taurus.Device(pool_motor_dev_name)
- # IT IS IMPORTANT TO KNOW IF IT IS AN ICEPAP MOTOR, SO EXTRA FEATURES CAN BE PROVIDED
- # PENDING.
- self.has_limits = hasattr(self.motor_dev, 'Limit_Switches')
- self.has_encoder = hasattr(self.motor_dev, 'Encoder')
- except Exception, e:
- taurus.warning('Exception Creating Motor Device %s', str(e))
-
- def moveMotor(self, pos):
- #self.motor_dev['position'] = pos
- # Make use of Taurus operations (being logged)
- self.motor_dev.getAttribute('Position').write(pos)
-
- def moveInc(self, inc):
- self.moveMotor(self.motor_dev['position'].value + inc)
-
- def jogNeg(self):
- neg_limit = -((self.maxint_in_32_bits / 2) - 1)
- # THERE IS A BUG IN THE ICEPAP THAT DOES NOT ALLOW MOVE ABSOLUTE FURTHER THAN 32 BIT
- # SO IF THERE ARE STEPS PER UNIT, max_int HAS TO BE REDUCED
- if hasattr(self.motor_dev, 'step_per_unit'):
- neg_limit = neg_limit / self.motor_dev['step_per_unit'].value
- try:
- min_value = self.motor_dev.getAttribute('Position').getConfig().getValueObj().min_value
- neg_limit = float(min_value)
- except Exception:
- pass
- self.moveMotor(neg_limit)
-
- def jogPos(self):
- pos_limit = (self.maxint_in_32_bits / 2) - 1
- # THERE IS A BUG IN THE ICEPAP THAT DOES NOT ALLOW MOVE ABSOLUTE FURTHER THAN 32 BIT
- # SO IF THERE ARE STEPS PER UNIT, max_int HAS TO BE REDUCED
- if hasattr(self.motor_dev, 'step_per_unit'):
- pos_limit = pos_limit / self.motor_dev['step_per_unit'].value
- try:
- max_value = self.motor_dev.getAttribute('Position').getConfig().getValueObj().max_value
- pos_limit = float(max_value)
- except Exception:
- pass
- self.moveMotor(pos_limit)
-
- def goHome(self):
- pass
-
- def abort(self):
- self.motor_dev.abort()
-
-class LabelWidgetDragsDeviceAndAttribute(DefaultLabelWidget):
- """ Offer richer mime data with taurus-device, taurus-attribute, and plain-text. """
- def mouseMoveEvent(self, event):
- model = self.taurusValueBuddy().getModelName()
- mimeData = Qt.QMimeData()
- mimeData.setText(self.text())
- attr_name = model
- dev_name = model.rpartition('/')[0]
- mimeData.setData(TAURUS_DEV_MIME_TYPE, dev_name)
- mimeData.setData(TAURUS_ATTR_MIME_TYPE, attr_name)
-
- drag = Qt.QDrag(self)
- drag.setMimeData(mimeData)
- drag.setHotSpot(event.pos() - self.rect().topLeft())
- drag.start(Qt.Qt.CopyAction)
-
-class PoolMotorConfigurationForm(TaurusAttrForm):
-
- def __init__(self, parent=None, designMode=False):
- TaurusAttrForm.__init__(self, parent, designMode)
- self._form.setWithButtons(False)
-
- def getMotorControllerType(self):
- modelObj = self.getModelObj()
- modelNormalName = modelObj.getNormalName()
- poolDsId = modelObj.getHWObj().info().server_id
- db = taurus.Database()
- pool_devices = tuple(db.get_device_class_list(poolDsId).value_string)
- pool_dev_name = pool_devices[pool_devices.index('Pool') - 1]
- pool = taurus.Device(pool_dev_name)
- poolMotorInfos = pool["MotorList"].value
- for motorInfo in poolMotorInfos:
- # BE CAREFUL, THIS ONLY WORKS IF NOBODY CHANGES THE DEVICE NAME OF A MOTOR!!!
- # ALSO THERE COULD BE A CASE PROBLEM, BETTER DO COMPARISONS WITH .lower()
- #to better understand following actions
- #this is an example of one motor info record
- #'dummymotor10 (motor/dummymotorctrl/10) (dummymotorctrl/10) Motor',
- motorInfos = motorInfo.split()
- if modelNormalName.lower() == motorInfos[1][1:-1].lower():
- controllerName = motorInfos[2][1:-1].split("/")[0]
-
- poolControllerInfos = pool["ControllerList"].value
- for controllerInfo in poolControllerInfos:
- #to better understand following actions
- #this is an example of one controller info record
- #'dummymotorctrl (DummyMotorController.DummyMotorController/dummymotorctrl) - Motor Python ctrl (DummyMotorController.py)'
- controllerInfos = controllerInfo.split()
- if controllerName.lower() == controllerInfos[0].lower():
- controllerType = controllerInfos[1][1:-1].split("/")[0]
- return controllerType
-
- def getDisplayAttributes(self, controllerType):
- attributes = ['position',
- 'state',
- 'status',
- 'velocity',
- 'acceleration',
- 'base_rate',
- 'step_per_unit',
- 'dialposition',
- 'sign',
- 'offset',
- 'backlash']
-
- if controllerType == "IcePAPCtrl.IcepapController":
- attributes.insert(1, "encoder")
- attributes.extend(['frequency',
- 'poweron',
- 'closedloop',
- 'useencodersource',
- 'encodersource',
- 'encodersourceformula',
- 'statusstopcode',
- 'statusdisable',
- 'statusready',
- 'statuslim-',
- 'statuslim+',
- 'statushome'])
-
- elif controllerType == "PmacCtrl.PmacController":
- attributes.extend(["motoractivated",
- "negativeendlimitset",
- "positiveendlimitset",
- "handwheelenabled",
- "phasedmotor",
- "openloopmode",
- "runningdefine-timemove",
- "integrationmode",
- "dwellinprogress",
- "datablockerror",
- "desiredvelocityzero",
- "abortdeceleration",
- "blockrequest",
- "homesearchinprogress",
- "assignedtocoordinatesystem",
- "coordinatesystem",
- "amplifierenabled",
- "stoppedonpositionlimit",
- "homecomplete",
- "phasingsearcherror",
- "triggermove",
- "integratedfatalfollowingerror",
- "i2t_amplifierfaulterror",
- "backlashdirectionflag",
- "amplifierfaulterror",
- "fatalfollowingerror",
- "warningfollowingerror",
- "inposition",
- "motionprogramrunning"])
-
- elif controllerType == "TurboPmacCtrl.TurboPmacController":
- attributes.extend(["motoractivated",
- "negativeendlimitset",
- "positiveendlimitset",
- "extendedservoalgorithmenabled"
- "amplifierenabled",
- "openloopmode",
- "movetimeractive",
- "integrationmode",
- "dwellinprogress",
- "datablockerror",
- "desiredvelocityzero",
- "abortdeceleration",
- "blockrequest",
- "homesearchinprogress",
- "user-writtenphaseenable",
- "user-writtenservoenable",
- "alternatesource/destination",
- "phasedmotor",
- "followingoffsetmode",
- "followingenabled",
- "errortriger",
- "softwarepositioncapture",
- "integratorinvelocityloop",
- "alternatecommand-outputmode",
- "coordinatesystem",
- "coordinatedefinition",
- "assignedtocoordinatesystem",
- "foregroundinposition",
- "stoppedondesiredpositionlimit",
- "stoppedonpositionlimit",
- "homecomplete",
- "phasing_search/read_active",
- "triggermove",
- "integratedfatalfollowingerror",
- "i2t_amplifierfaulterror",
- "backlashdirectionflag",
- "amplifierfaulterror",
- "fatalfollowingerror",
- "warningfollowingerror",
- "inposition"])
- return attributes
-
- def setModel(self, modelName):
- TaurusAttrForm.setModel(self, modelName)
- controllerType = self.getMotorControllerType()
- attributes = self.getDisplayAttributes(controllerType)
- #self.setViewFilters([lambda a: a.name.lower() in attributes])
- self.setSortKey(lambda att: attributes.index(att.name.lower()) if att.name.lower() in attributes else 1)
-
-
-@UILoadable(with_ui='ui')
-class PoolMotorSlim(TaurusWidget, PoolMotorClient):
-
- __pyqtSignals__ = ("modelChanged(const QString &)",)
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent)
-
- #self.call__init__wo_kw(Qt.QWidget, parent)
- #self.call__init__(TaurusBaseWidget, str(self.objectName()), designMode=designMode)
- PoolMotorClient.__init__(self)
- self.loadUi()
-
- self.show_context_menu = True
-
- self.setAcceptDrops(True)
-
- if designMode:
- self.__setTaurusIcons()
- return
-
- # CREATE THE TaurusValue that can not be configured in the Designer
- self.taurus_value = TaurusValue(self.ui.taurusValueContainer)
-
- # Use a DragDevAndAttributeLabelWidget to provide a richer QMimeData content
- self.taurus_value.setLabelWidgetClass(LabelWidgetDragsDeviceAndAttribute)
-
- # Make the label to be the device alias
- self.taurus_value.setLabelConfig('dev_alias')
-
- self.taurus_value_enc = TaurusValue(self.ui.taurusValueContainer)
-
- # THIS WILL BE DONE IN THE DESIGNER
- # Config Button will launch a PoolMotorConfigurationForm
-# 19.08.2011 after discussion between cpascual, gcui and zreszela, Configuration Panel was rolled back to
-# standard TaurusAttrForm - list of all attributes alphabetically ordered
-# taurus_attr_form = PoolMotorConfigurationForm()
- taurus_attr_form = TaurusAttrForm()
-
- taurus_attr_form.setMinimumSize(Qt.QSize(470, 800))
- self.ui.btnCfg.setWidget(taurus_attr_form)
- self.ui.btnCfg.setUseParentModel(True)
-
- # ADD AN EVENT FILTER FOR THE STATUS LABEL IN ORDER TO PROVIDE JUST THE STRING FROM THE CONTROLLER (LAST LINE)
- def just_ctrl_status_line(evt_src, evt_type, evt_value):
- if evt_type not in [TaurusEventType.Change, TaurusEventType.Periodic]:
- return evt_src, evt_type, evt_value
- try:
- status = evt_value.value
- last_line = status.split('\n')[-1]
- new_evt_value = PyTango.DeviceAttribute(evt_value)
- new_evt_value.value = last_line
- return evt_src, evt_type, new_evt_value
- except:
- return evt_src, evt_type, evt_value
- self.ui.lblStatus.insertEventFilter(just_ctrl_status_line)
-
- # These buttons are just for showing if the limit is active or not
- self.ui.btnMin.setEnabled(False)
- self.ui.btnMax.setEnabled(False)
-
- # HOMING NOT IMPLMENTED YET
- self.ui.btnHome.setEnabled(False)
-
- # DEFAULT VISIBLE COMPONENTS
- self.toggleHideAll()
- self.toggleMoveAbsolute(True)
- self.toggleStopMove(True)
-
- # SET TAURUS ICONS
- self.__setTaurusIcons()
-
- self.ui.motorGroupBox.setContextMenuPolicy(Qt.Qt.CustomContextMenu)
- self.connect(self.ui.motorGroupBox, Qt.SIGNAL('customContextMenuRequested(QPoint)'), self.buildContextMenu)
-
- self.connect(self.ui.btnGoToNeg, Qt.SIGNAL('clicked()'), self.jogNeg)
- self.connect(self.ui.btnGoToNegPress, Qt.SIGNAL('pressed()'), self.jogNeg)
- self.connect(self.ui.btnGoToNegPress, Qt.SIGNAL('released()'), self.abort)
- self.connect(self.ui.btnGoToNegInc, Qt.SIGNAL('clicked()'), self.goToNegInc)
- self.connect(self.ui.btnGoToPos, Qt.SIGNAL('clicked()'), self.jogPos)
- self.connect(self.ui.btnGoToPosPress, Qt.SIGNAL('pressed()'), self.jogPos)
- self.connect(self.ui.btnGoToPosPress, Qt.SIGNAL('released()'), self.abort)
- self.connect(self.ui.btnGoToPosInc, Qt.SIGNAL('clicked()'), self.goToPosInc)
-
- self.connect(self.ui.btnHome, Qt.SIGNAL('clicked()'), self.goHome)
- self.connect(self.ui.btnStop, Qt.SIGNAL('clicked()'), self.abort)
-
- # ALSO UPDATE THE WIDGETS EVERYTIME THE FORM HAS TO BE SHOWN
- self.connect(self.ui.btnCfg, Qt.SIGNAL('clicked()'), taurus_attr_form._updateAttrWidgets)
- self.connect(self.ui.btnCfg, Qt.SIGNAL('clicked()'), self.buildBetterCfgDialogTitle)
-
- #################################################################################################################
- ########################################
- # LET TAURUS CONFIGURATION MECANISM SHINE!
- ########################################
- self.registerConfigProperty(self.ui.inc.isVisible, self.toggleMoveRelative, 'MoveRelative')
- self.registerConfigProperty(self.ui.btnGoToNegPress.isVisible, self.toggleMoveContinuous, 'MoveContinuous')
- self.registerConfigProperty(self.ui.btnGoToNeg.isVisible, self.toggleMoveToLimits, 'MoveToLimits')
- self.registerConfigProperty(self.ui.btnStop.isVisible, self.toggleStopMove, 'StopMove')
- self.registerConfigProperty(self.ui.btnHome.isVisible, self.toggleHoming, 'Homing')
- self.registerConfigProperty(self.ui.btnCfg.isVisible, self.toggleConfig, 'Config')
- self.registerConfigProperty(self.ui.lblStatus.isVisible, self.toggleStatus, 'Status')
- #################################################################################################################
-
- def __setTaurusIcons(self):
- self.ui.btnMin.setText('')
- self.ui.btnMin.setIcon(getIcon(':/actions/list-remove.svg'))
- self.ui.btnMax.setText('')
- self.ui.btnMax.setIcon(getIcon(':/actions/list-add.svg'))
-
- self.ui.btnGoToNeg.setText('')
- self.ui.btnGoToNeg.setIcon(getIcon(':/actions/media_skip_backward.svg'))
- self.ui.btnGoToNegPress.setText('')
- self.ui.btnGoToNegPress.setIcon(getIcon(':/actions/media_seek_backward.svg'))
- self.ui.btnGoToNegInc.setText('')
- self.ui.btnGoToNegInc.setIcon(getIcon(':/actions/media_playback_backward.svg'))
- self.ui.btnGoToPos.setText('')
- self.ui.btnGoToPos.setIcon(getIcon(':/actions/media_skip_forward.svg'))
- self.ui.btnGoToPosPress.setText('')
- self.ui.btnGoToPosPress.setIcon(getIcon(':/actions/media_seek_forward.svg'))
- self.ui.btnGoToPosInc.setText('')
- self.ui.btnGoToPosInc.setIcon(getIcon(':/actions/media_playback_start.svg'))
- self.ui.btnStop.setText('')
- self.ui.btnStop.setIcon(getIcon(':/actions/media_playback_stop.svg'))
- self.ui.btnHome.setText('')
- self.ui.btnHome.setIcon(getIcon(':/actions/go-home.svg'))
- self.ui.btnCfg.setText('')
- self.ui.btnCfg.setIcon(getIcon(':/categories/preferences-system.svg'))
- #################################################################################################################
-
-
-
- #@Qt.pyqtSlot(list)
- def updateLimits(self, limits):
- if isinstance(limits, dict): limits = limits["limits"]
- pos_lim = limits[1]
- pos_btnstylesheet = ''
- enabled = True
- if pos_lim:
- pos_btnstylesheet = 'QPushButton{%s}' % DEVICE_STATE_PALETTE.qtStyleSheet(PyTango.DevState.ALARM)
- enabled = False
- self.ui.btnMax.setStyleSheet(pos_btnstylesheet)
- self.ui.btnGoToPos.setEnabled(enabled)
- self.ui.btnGoToPosPress.setEnabled(enabled)
- self.ui.btnGoToPosInc.setEnabled(enabled)
-
-
- neg_lim = limits[2]
- neg_btnstylesheet = ''
- enabled = True
- if neg_lim:
- neg_btnstylesheet = 'QPushButton{%s}' % DEVICE_STATE_PALETTE.qtStyleSheet(PyTango.DevState.ALARM)
- enabled = False
- self.ui.btnMin.setStyleSheet(neg_btnstylesheet)
- self.ui.btnGoToNeg.setEnabled(enabled)
- self.ui.btnGoToNegPress.setEnabled(enabled)
- self.ui.btnGoToNegInc.setEnabled(enabled)
-
- #def sizeHint(self):
- # return Qt.QSize(300,30)
-
- def goToNegInc(self):
- self.moveInc(-1 * self.ui.inc.value())
-
- def goToPosInc(self):
- self.moveInc(self.ui.inc.value())
-
- def buildContextMenu(self, point):
- if not self.show_context_menu:
- return
- menu = Qt.QMenu(self)
-
- action_hide_all = Qt.QAction(self)
- action_hide_all.setText('Hide All')
- menu.addAction(action_hide_all)
-
- action_show_all = Qt.QAction(self)
- action_show_all.setText('Show All')
- menu.addAction(action_show_all)
-
- action_move_absolute = Qt.QAction(self)
- action_move_absolute.setText('Move Absolute')
- action_move_absolute.setCheckable(True)
- action_move_absolute.setChecked(self.taurus_value.writeWidget().isVisible())
- menu.addAction(action_move_absolute)
-
- action_move_relative = Qt.QAction(self)
- action_move_relative.setText('Move Relative')
- action_move_relative.setCheckable(True)
- action_move_relative.setChecked(self.ui.inc.isVisible())
- menu.addAction(action_move_relative)
-
- action_move_continuous = Qt.QAction(self)
- action_move_continuous.setText('Move Continuous')
- action_move_continuous.setCheckable(True)
- action_move_continuous.setChecked(self.ui.btnGoToNegPress.isVisible())
- menu.addAction(action_move_continuous)
-
- action_move_to_limits = Qt.QAction(self)
- action_move_to_limits.setText('Move to Limits')
- action_move_to_limits.setCheckable(True)
- action_move_to_limits.setChecked(self.ui.btnGoToNeg.isVisible())
- menu.addAction(action_move_to_limits)
-
- action_encoder = Qt.QAction(self)
- action_encoder.setText('Encoder Read')
- action_encoder.setCheckable(True)
- action_encoder.setChecked(self.taurus_value_enc.isVisible())
- if self.has_encoder:
- menu.addAction(action_encoder)
-
- action_stop_move = Qt.QAction(self)
- action_stop_move.setText('Stop Movement')
- action_stop_move.setCheckable(True)
- action_stop_move.setChecked(self.ui.btnStop.isVisible())
- menu.addAction(action_stop_move)
-
- action_homing = Qt.QAction(self)
- action_homing.setText('Homing')
- action_homing.setCheckable(True)
- action_homing.setChecked(self.ui.btnHome.isVisible())
- menu.addAction(action_homing)
-
- action_config = Qt.QAction(self)
- action_config.setText('Config')
- action_config.setCheckable(True)
- action_config.setChecked(self.ui.btnCfg.isVisible())
- menu.addAction(action_config)
-
- action_status = Qt.QAction(self)
- action_status.setText('Status')
- action_status.setCheckable(True)
- action_status.setChecked(self.ui.lblStatus.isVisible())
- menu.addAction(action_status)
-
- self.connect(action_hide_all, Qt.SIGNAL('triggered()'), self.toggleHideAll)
- self.connect(action_show_all, Qt.SIGNAL('triggered()'), self.toggleShowAll)
- self.connect(action_move_absolute, Qt.SIGNAL('toggled(bool)'), self.toggleMoveAbsolute)
- self.connect(action_move_relative, Qt.SIGNAL('toggled(bool)'), self.toggleMoveRelative)
- self.connect(action_move_continuous, Qt.SIGNAL('toggled(bool)'), self.toggleMoveContinuous)
- self.connect(action_move_to_limits, Qt.SIGNAL('toggled(bool)'), self.toggleMoveToLimits)
- self.connect(action_encoder, Qt.SIGNAL('toggled(bool)'), self.toggleEncoder)
- self.connect(action_stop_move, Qt.SIGNAL('toggled(bool)'), self.toggleStopMove)
- self.connect(action_homing, Qt.SIGNAL('toggled(bool)'), self.toggleHoming)
- self.connect(action_config, Qt.SIGNAL('toggled(bool)'), self.toggleConfig)
- self.connect(action_status, Qt.SIGNAL('toggled(bool)'), self.toggleStatus)
-
- menu.popup(self.cursor().pos())
-
- def toggleHideAll(self):
- self.toggleAll(False)
-
- def toggleShowAll(self):
- self.toggleAll(True)
-
- def toggleAll(self, visible):
- self.toggleMoveAbsolute(visible)
- self.toggleMoveRelative(visible)
- self.toggleMoveContinuous(visible)
- self.toggleMoveToLimits(visible)
- self.toggleEncoder(visible)
- self.toggleStopMove(visible)
- self.toggleHoming(visible)
- self.toggleConfig(visible)
- self.toggleStatus(visible)
-
- def toggleMoveAbsolute(self, visible):
- if self.taurus_value.writeWidget() is not None:
- self.taurus_value.writeWidget().setVisible(visible)
-
- def toggleMoveRelative(self, visible):
- self.ui.btnGoToNegInc.setVisible(visible)
- self.ui.inc.setVisible(visible)
- self.ui.btnGoToPosInc.setVisible(visible)
-
- def toggleMoveContinuous(self, visible):
- self.ui.btnGoToNegPress.setVisible(visible)
- self.ui.btnGoToPosPress.setVisible(visible)
-
- def toggleMoveToLimits(self, visible):
- self.ui.btnGoToNeg.setVisible(visible)
- self.ui.btnGoToPos.setVisible(visible)
-
- def toggleEncoder(self, visible):
- self.taurus_value_enc.setVisible(visible)
-
- def toggleStopMove(self, visible):
- self.ui.btnStop.setVisible(visible)
-
- def toggleHoming(self, visible):
- self.ui.btnHome.setVisible(visible)
-
- def toggleConfig(self, visible):
- self.ui.btnCfg.setVisible(visible)
-
- def toggleStatus(self, visible):
- self.ui.lblStatus.setVisible(visible)
-
- def dragEnterEvent(self, event):
- event.accept()
-
- def dropEvent(self, event):
- mimeData = event.mimeData()
- if mimeData.hasFormat(TAURUS_DEV_MIME_TYPE):
- model = str(mimeData.data(TAURUS_DEV_MIME_TYPE))
- elif mimeData.hasFormat(TAURUS_ATTR_MIME_TYPE):
- model = str(mimeData.data(TAURUS_ATTR_MIME_TYPE))
- else:
- model = str(mimeData.text())
- self.setModel(model)
-
- def keyPressEvent(self, key_event):
- if key_event.key() == Qt.Qt.Key_Escape:
- self.abort()
- key_event.accept()
- TaurusWidget.keyPressEvent(self, key_event)
-
- def buildBetterCfgDialogTitle(self):
- while self.ui.btnCfg._dialog is None:
- pass
- model = self.getModel()
- self.ui.btnCfg._dialog.setWindowTitle('%s config' % taurus.Factory().getDevice(model).getSimpleName())
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- ret = TaurusWidget.getQtDesignerPluginInfo()
- ret['module'] = 'taurus.qt.qtgui.extra_pool'
- ret['group'] = 'Taurus Sardana'
- ret['icon'] = ':/designer/extra_motor.png'
- ret['container'] = False
- return ret
-
- def showEvent(self, event):
- TaurusWidget.showEvent(self, event)
- try:
- self.motor_dev.getAttribute('Position').enablePolling(force=True)
- except AttributeError, e:
- self.debug('Error in showEvent: %s', repr(e))
-
-
- def hideEvent(self, event):
- TaurusWidget.hideEvent(self, event)
- try:
- self.motor_dev.getAttribute('Position').disablePolling()
- except AttributeError, e:
- self.debug('Error in hideEvent: %s', repr(e))
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # QT properties
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- @Qt.pyqtSignature("getModel()")
- def getModel(self):
- return self.ui.motorGroupBox.getModel()
-
- @Qt.pyqtSignature("setModel(QString)")
- def setModel(self, model):
- # DUE TO A BUG IN TAUGROUPBOX, WE NEED THE FULL MODEL NAME
- try:
- # In case the model is an attribute of a motor, get the device name
- if not DeviceNameValidator().isValid(model):
- model = model.rpartition('/')[0]
- model = taurus.Factory().getDevice(model).getFullName()
- self.setMotor(model)
- self.ui.motorGroupBox.setModel(model)
- self.ui.motorGroupBox.setEnabled(True)
-
- self.taurus_value.setModel(model + '/Position')
-
- # DUE TO A BUG IN TAURUSVALUE, THAT DO NOT USE PARENT MODEL WE NEED TO ALWAYS SET THE MODEL
- self.taurus_value.setUseParentModel(False)
-
- # THE FORCED APPLY HAS TO BE DONE AFTER THE MODEL IS SET, SO THE WRITEWIDGET IS AVAILABLE
- if self.taurus_value.writeWidget() is not None:
- self.taurus_value.writeWidget().setForcedApply(True)
-
- show_enc = self.taurus_value_enc.isVisible()
- if self.has_encoder:
- self.taurus_value_enc.setModel(model + '/Encoder')
- self.taurus_value_enc.setUseParentModel(False)
- self.taurus_value_enc.readWidget().setBgRole('none')
- else:
- self.taurus_value_enc.setModel(None)
- show_enc = False
- if not show_enc:
- self.toggleEncoder(False)
-
- try:
- self.unregisterConfigurableItem('MoveAbsolute')
- self.unregisterConfigurableItem('Encoder')
- except:
- pass
- self.registerConfigProperty(self.taurus_value.writeWidget().isVisible, self.toggleMoveAbsolute, 'MoveAbsolute')
- self.registerConfigProperty(self.taurus_value_enc.isVisible, self.toggleEncoder, 'Encoder')
-
-
- # SINCE TAURUSLAUNCHERBUTTON HAS NOT THIS PROPERTY IN THE
- # DESIGNER, WE MUST SET IT HERE
- self.ui.btnCfg.setUseParentModel(True)
-
- # CONFIGURE A LISTENER IN ORDER TO UPDATE LIMIT SWITCHES STATES
- self.limits_listener = LimitsListener()
- self.connect(self.limits_listener, Qt.SIGNAL('updateLimits(PyQt_PyObject)'), self.updateLimits)
- limits_visible = False
- if self.has_limits:
- limits_attribute = self.motor_dev.getAttribute('Limit_switches')
- limits_attribute.addListener(self.limits_listener)
- #self.updateLimits(limits_attribute.read().value)
- limits_visible = True
- self.ui.btnMin.setVisible(limits_visible)
- self.ui.btnMax.setVisible(limits_visible)
- except Exception, e:
- self.ui.motorGroupBox.setEnabled(False)
- self.info('Error setting model "%s". Reason: %s' % (model, repr(e)))
- self.traceback()
-
- @Qt.pyqtSignature("resetModel()")
- def resetModel(self):
- self.ui.motorGroupBox.resetModel()
-
- @Qt.pyqtSignature("getShowContextMenu()")
- def getShowContextMenu(self):
- return self.show_context_menu
-
- @Qt.pyqtSignature("setShowContextMenu(bool)")
- def setShowContextMenu(self, showContextMenu):
- self.show_context_menu = showContextMenu
-
- @Qt.pyqtSignature("resetShowContextMenu()")
- def resetShowContextMenu(self):
- self.show_context_menu = True
-
- @Qt.pyqtSignature("getStepSize()")
- def getStepSize(self):
- return self.ui.inc.value()
-
- @Qt.pyqtSignature("setStepSize(double)")
- def setStepSize(self, stepSize):
- self.ui.inc.setValue(stepSize)
-
- @Qt.pyqtSignature("resetStepSize()")
- def resetStepSize(self):
- self.setStepSize(1)
-
- @Qt.pyqtSignature("getStepSizeIncrement()")
- def getStepSizeIncrement(self):
- return self.ui.inc.singleStep()
-
- @Qt.pyqtSignature("setStepSizeIncrement(double)")
- def setStepSizeIncrement(self, stepSizeIncrement):
- self.ui.inc.setSingleStep(stepSizeIncrement)
-
- @Qt.pyqtSignature("resetStepSizeIncrement()")
- def resetStepSizeIncrement(self):
- self.setStepSizeIncrement(1)
-
- model = Qt.pyqtProperty("QString", getModel, setModel, resetModel)
- stepSize = Qt.pyqtProperty("double", getStepSize, setStepSize, resetStepSize)
- stepSizeIncrement = Qt.pyqtProperty("double", getStepSizeIncrement, setStepSizeIncrement, resetStepSizeIncrement)
-
-
-
-################################################################################################
-# NEW APPROACH TO OPERATE POOL MOTORS FROM A TAURUS FORM INHERITTING DIRECTLY FROM TaurusVALUE #
-# AND USING PARTICULAR CLASSES THAT KNOW THEY ARE PART OF A TAURUSVALUE AND CAN INTERACT #
-################################################################################################
-
-class TaurusAttributeListener(Qt.QObject):
- """
- A class that recieves events on tango attribute changes.
- If that is the case it emits a signal with the event's value.
- """
- def __init__(self):
- Qt.QObject.__init__(self)
-
- def eventReceived(self, evt_src, evt_type, evt_value):
- if evt_type not in [TaurusEventType.Change, TaurusEventType.Periodic]:
- return
- value = evt_value.value
- self.emit(Qt.SIGNAL('eventReceived'), value)
-
-
-##################################################
-# LABEL WIDGET #
-##################################################
-class PoolMotorTVLabelWidget(TaurusWidget):
- '''
- @TODO tooltip should be extended with status info
- @TODO context menu should be the lbl_alias extended
- @TODO default tooltip extended with the complete (multiline) status
- @TODO rightclick popup menu with actions: (1) switch user/expert view, (2) Config -all attributes-, (3) change motor
- For the (3), a drop event should accept if it is a device, and add it to the 'change-motor' list and select
- @TODO on the 'expert' row, it could be an ENABLE section with a button to set PowerOn to True/False
- '''
-
- layoutAlignment = Qt.Qt.AlignTop
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.setLayout(Qt.QGridLayout())
- self.layout().setMargin(0)
- self.layout().setSpacing(0)
-
- self.lbl_alias = DefaultLabelWidget(parent, designMode)
- self.lbl_alias.setBgRole('none')
- self.layout().addWidget(self.lbl_alias)
-
- self.btn_poweron = Qt.QPushButton()
- self.btn_poweron.setText('Set ON')
- self.layout().addWidget(self.btn_poweron)
-
- # Align everything on top
- self.layout().addItem(Qt.QSpacerItem(1, 1, Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Expanding))
-
- # I don't like this approach, there should be something like
- # self.lbl_alias.addAction(...)
- self.lbl_alias.contextMenuEvent = lambda(event): self.contextMenuEvent(event)
-
- # I' don't like this approach, there should be something like
- # self.lbl_alias.addToolTipCallback(self.calculate_extra_tooltip)
- self.lbl_alias.getFormatedToolTip = self.calculateExtendedTooltip
-
- # I' don't like this approach, there should be something like
- # self.lbl_alias.disableDrag() or self.lbl_alias.setDragEnabled(False)
- # or better, define if Attribute or Device or Both have to be included in the mimeData
- self.lbl_alias.mouseMoveEvent = self.mouseMoveEvent
-
- def setExpertView(self, expertView):
- btn_poweron_visible = expertView and self.taurusValueBuddy().hasPowerOn()
- self.btn_poweron.setVisible(btn_poweron_visible)
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to write PowerOn Attribute.')
- def setPowerOn(self):
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- poweron = (self.btn_poweron.text() == 'Set ON')
- motor_dev.getAttribute('PowerOn').write(poweron)
-
- def setModel(self, model):
- TaurusWidget.setModel(self, model)
- # Handle User/Expert view
- self.disconnect(self.taurusValueBuddy(), Qt.SIGNAL('expertViewChanged(bool)'), self.setExpertView)
- self.disconnect(self.btn_poweron, Qt.SIGNAL('clicked()'), self.setPowerOn)
- if model in (None, ''):
- return
- TaurusWidget.setModel(self, model + '/Status')
- self.lbl_alias.taurusValueBuddy = self.taurusValueBuddy
- self.lbl_alias.setModel(model)
-
- self.connect(self.taurusValueBuddy(), Qt.SIGNAL('expertViewChanged(bool)'), self.setExpertView)
- # Handle Power ON/OFF
- self.connect(self.btn_poweron, Qt.SIGNAL('clicked()'), self.setPowerOn)
- self.setExpertView(self.taurusValueBuddy()._expertView)
-
- def calculateExtendedTooltip(self, cache=False):
- default_label_widget_tooltip = DefaultLabelWidget.getFormatedToolTip(self.lbl_alias, cache)
- status_info = ''
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- status = motor_dev.getAttribute('Status').read().value
- # MAKE IT LOOK LIKE THE STANDARD TABLE FOR TAURUS TOOLTIPS
- status_lines = status.split('\n')
- status_info = '<TABLE width="500" border="0" cellpadding="1" cellspacing="0"><TR><TD WIDTH="80" ALIGN="RIGHT" VALIGN="MIDDLE"><B>Status:</B></TD><TD>' + status_lines[0] + '</TD></TR>'
- for status_extra_line in status_lines[1:]:
- status_info += '<TR><TD></TD><TD>' + status_extra_line + '</TD></TR>'
- status_info += '</TABLE>'
- return default_label_widget_tooltip + status_info
-
- def contextMenuEvent(self, event):
- # Overwrite the default taurus label behaviour
- menu = Qt.QMenu(self)
- action_expert_view = Qt.QAction(self)
- action_expert_view.setText('Expert View')
- action_expert_view.setCheckable(True)
- action_expert_view.setChecked(self.taurusValueBuddy()._expertView)
- menu.addAction(action_expert_view)
- self.connect(action_expert_view, Qt.SIGNAL('toggled(bool)'), self.taurusValueBuddy().setExpertView)
-
- action_tango_attributes = Qt.QAction(self)
- action_tango_attributes.setIcon(getIcon(':/categories/preferences-system.svg'))
- action_tango_attributes.setText('Tango Attributes')
- menu.addAction(action_tango_attributes)
- self.connect(action_tango_attributes, Qt.SIGNAL('triggered()'), self.taurusValueBuddy().showTangoAttributes)
-
- cm_action = menu.addAction("Compact")
- cm_action.setCheckable(True)
- cm_action.setChecked(self.taurusValueBuddy().isCompact())
- self.connect(cm_action, Qt.SIGNAL("toggled(bool)"), self.taurusValueBuddy().setCompact)
-
- menu.exec_(event.globalPos())
- event.accept()
-
- def mouseMoveEvent(self, event):
- model = self.lbl_alias.getModelName()
- mimeData = Qt.QMimeData()
- mimeData.setText(self.lbl_alias.text())
- dev_name = model.rpartition('/')[0]
- attr_name = dev_name + '/Position'
- mimeData.setData(TAURUS_DEV_MIME_TYPE, dev_name)
- mimeData.setData(TAURUS_ATTR_MIME_TYPE, attr_name)
-
- drag = Qt.QDrag(self)
- drag.setMimeData(mimeData)
- drag.setHotSpot(event.pos() - self.rect().topLeft())
- drag.start(Qt.Qt.CopyAction)
-
-##################################################
-# READ WIDGET #
-##################################################
-class PoolMotorTVReadWidget(TaurusWidget):
- '''
- @TODO on the 'expert' row, there should be an Indexer/Encoder radiobuttongroup to show units from raw dial/indx/enc
- @TODO TaurusLCD may be used but, now it does not display the sign, and color is WHITE...
- '''
-
- layoutAlignment = Qt.Qt.AlignTop
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
-
- self.setLayout(Qt.QGridLayout())
- self.layout().setMargin(0)
- self.layout().setSpacing(0)
-
- limits_layout = Qt.QHBoxLayout()
- limits_layout.setMargin(0)
- limits_layout.setSpacing(0)
-
- self.btn_lim_neg = Qt.QPushButton()
- self.btn_lim_neg.setToolTip('Negative Limit')
- #self.btn_lim_neg.setEnabled(False)
- self.prepare_button(self.btn_lim_neg)
- self.btn_lim_neg.setIcon(getIcon(':/actions/list-remove.svg'))
- limits_layout.addWidget(self.btn_lim_neg)
-
- self.btn_lim_pos = Qt.QPushButton()
- self.btn_lim_pos.setToolTip('Positive Limit')
- #self.btn_lim_pos.setEnabled(False)
- self.prepare_button(self.btn_lim_pos)
- self.btn_lim_pos.setIcon(getIcon(':/actions/list-add.svg'))
- limits_layout.addWidget(self.btn_lim_pos)
-
- self.layout().addLayout(limits_layout, 0, 0)
-
- self.lbl_read = TaurusLabel()
- self.lbl_read.setBgRole('quality')
- self.lbl_read.setSizePolicy(Qt.QSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed))
- self.layout().addWidget(self.lbl_read, 0, 1)
-
- # WITH A COMPACT VIEW, BETTER TO BE ABLE TO STOP!
- self.btn_stop = Qt.QPushButton()
- self.btn_stop.setToolTip('Stops the motor')
- self.prepare_button(self.btn_stop)
- self.btn_stop.setIcon(getIcon(':/actions/media_playback_stop.svg'))
- self.layout().addWidget(self.btn_stop, 0, 2)
-
- self.connect(self.btn_stop, Qt.SIGNAL('clicked()'), self.abort)
-
- # WITH COMPACT VIEW, WE NEED TO FORWARD DOUBLE CLICK EVENT
- self.lbl_read.installEventFilter(self)
-
- ## @TODO right now, no options here...
- #self.cb_expertRead = Qt.QComboBox()
- #self.cb_expertRead.addItems(['Enc'])
- #self.layout().addWidget(self.cb_expertRead, 1, 0)
-
- self.lbl_enc = Qt.QLabel('Encoder')
- self.layout().addWidget(self.lbl_enc, 1, 0)
-
- self.lbl_enc_read = TaurusLabel()
- self.lbl_enc_read.setBgRole('none')
- self.lbl_enc_read.setSizePolicy(Qt.QSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed))
- self.layout().addWidget(self.lbl_enc_read, 1, 1)
-
- # Align everything on top
- self.layout().addItem(Qt.QSpacerItem(1, 1, Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Expanding), 2, 0, 1, 2)
-
- # IN ORDER TO BEHAVE AS EXPECTED REGARDING THE 'COMPACT VIEW' FEATURE
- # WE NEED TO SET THE 'EXPERTVIEW' WITHOUT ACCESSING THE taurusValueBuddy WHICH IS STILL NOT LINKED
- # SO WE ASSUME 'expertview is FALSE' AND WE HAVE TO AVOID self.setExpertView :-(
- # WOULD BE NICE THAT THE taurusValueBuddy COULD EMIT THE PROPER SIGNAL...
- self.lbl_enc.setVisible(False)
- self.lbl_enc_read.setVisible(False)
-
- def eventFilter(self, obj, event):
- if event.type() == Qt.QEvent.MouseButtonDblClick:
- if isinstance(self.parent(), TaurusReadWriteSwitcher):
- self.parent().enterEdit()
- return True
- if obj is self.lbl_read:
- return self.lbl_read.eventFilter(obj, event)
- return True
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to abort the motion.')
- def abort(self):
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- motor_dev.abort()
-
- def setExpertView(self, expertView):
- self.lbl_enc.setVisible(False)
- self.lbl_enc_read.setVisible(False)
- if self.taurusValueBuddy().motor_dev is not None:
- hw_limits = self.taurusValueBuddy().hasHwLimits()
- self.btn_lim_neg.setEnabled(hw_limits)
- self.btn_lim_pos.setEnabled(hw_limits)
-
- if expertView and self.taurusValueBuddy().motor_dev is not None:
- encoder = self.taurusValueBuddy().hasEncoder()
- self.lbl_enc.setVisible(encoder)
- self.lbl_enc_read.setVisible(encoder)
-
- def prepare_button(self, btn):
- btn_policy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed)
- btn_policy.setHorizontalStretch(0)
- btn_policy.setVerticalStretch(0)
- btn.setSizePolicy(btn_policy)
- btn.setMinimumSize(25, 25)
- btn.setMaximumSize(25, 25)
- btn.setText('')
-
- def setModel(self, model):
- if hasattr(self, 'taurusValueBuddy'):
- self.disconnect(self.taurusValueBuddy(), Qt.SIGNAL('expertViewChanged(bool)'), self.setExpertView)
- if model in (None, ''):
- TaurusWidget.setModel(self, model)
- self.lbl_read.setModel(model)
- self.lbl_enc_read.setModel(model)
- return
- TaurusWidget.setModel(self, model + '/Position')
- self.lbl_read.setModel(model + '/Position')
- self.lbl_enc_read.setModel(model + '/Encoder')
- # Handle User/Expert view
- self.setExpertView(self.taurusValueBuddy()._expertView)
- self.connect(self.taurusValueBuddy(), Qt.SIGNAL('expertViewChanged(bool)'), self.setExpertView)
-
-##################################################
-# WRITE WIDGET #
-##################################################
-class PoolMotorTVWriteWidget(TaurusWidget):
-
- layoutAlignment = Qt.Qt.AlignTop
-
- def __init__(self, parent=None, designMode=False):
- TaurusWidget.__init__(self, parent, designMode)
- self.setLayout(Qt.QGridLayout())
- self.layout().setMargin(0)
- self.layout().setSpacing(0)
-
- self.le_write_absolute = TaurusValueLineEdit()
- self.layout().addWidget(self.le_write_absolute, 0, 0)
-
- self.qw_write_relative = Qt.QWidget()
- self.qw_write_relative.setLayout(Qt.QHBoxLayout())
- self.qw_write_relative.layout().setMargin(0)
- self.qw_write_relative.layout().setSpacing(0)
-
- self.cb_step = Qt.QComboBox()
- self.cb_step.setSizePolicy(Qt.QSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed))
- self.cb_step.setEditable(True)
- self.cb_step.lineEdit().setValidator(Qt.QDoubleValidator(self))
- self.cb_step.lineEdit().setAlignment(Qt.Qt.AlignRight)
- self.cb_step.addItem('1')
- self.qw_write_relative.layout().addWidget(self.cb_step)
-
- self.btn_step_down = Qt.QPushButton()
- self.btn_step_down.setToolTip('Decrements motor position')
- self.prepare_button(self.btn_step_down)
- self.btn_step_down.setIcon(getIcon(':/actions/media_playback_backward.svg'))
- self.qw_write_relative.layout().addWidget(self.btn_step_down)
-
- self.btn_step_up = Qt.QPushButton()
- self.btn_step_up.setToolTip('Increments motor position')
- self.prepare_button(self.btn_step_up)
- self.btn_step_up.setIcon(getIcon(':/actions/media_playback_start.svg'))
- self.qw_write_relative.layout().addWidget(self.btn_step_up)
-
- self.layout().addWidget(self.qw_write_relative, 0, 0)
-
- self.cbAbsoluteRelative = Qt.QComboBox()
- self.connect(self.cbAbsoluteRelative, Qt.SIGNAL('currentIndexChanged(QString)'), self.cbAbsoluteRelativeChanged)
- self.cbAbsoluteRelative.addItems(['Abs', 'Rel'])
- self.layout().addWidget(self.cbAbsoluteRelative, 0, 1)
-
- # WITH THE COMPACCT VIEW FEATURE, BETTER TO HAVE IT IN THE READ WIDGET
- # WOULD BE BETTER AS AN 'EXTRA WIDGET' (SOME DAY...)
- #self.btn_stop = Qt.QPushButton()
- #self.btn_stop.setToolTip('Stops the motor')
- #self.prepare_button(self.btn_stop)
- #self.btn_stop.setIcon(getIcon(':/actions/media_playback_stop.svg'))
- #self.layout().addWidget(self.btn_stop, 0, 2)
-
- btns_layout = Qt.QHBoxLayout()
- btns_layout.setMargin(0)
- btns_layout.setSpacing(0)
-
- btns_layout.addItem(Qt.QSpacerItem(1, 1, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum))
-
- self.btn_to_neg = Qt.QPushButton()
- self.btn_to_neg.setToolTip('Moves the motor towards the Negative Software Limit')
- self.prepare_button(self.btn_to_neg)
- self.btn_to_neg.setIcon(getIcon(':/actions/media_skip_backward.svg'))
- btns_layout.addWidget(self.btn_to_neg)
-
- self.btn_to_neg_press = Qt.QPushButton()
- self.btn_to_neg_press.setToolTip('Moves the motor (while pressed) towards the Negative Software Limit')
- self.prepare_button(self.btn_to_neg_press)
- self.btn_to_neg_press.setIcon(getIcon(':/actions/media_seek_backward.svg'))
- btns_layout.addWidget(self.btn_to_neg_press)
-
- self.btn_to_pos_press = Qt.QPushButton()
- self.prepare_button(self.btn_to_pos_press)
- self.btn_to_pos_press.setToolTip('Moves the motor (while pressed) towards the Positive Software Limit')
- self.btn_to_pos_press.setIcon(getIcon(':/actions/media_seek_forward.svg'))
- btns_layout.addWidget(self.btn_to_pos_press)
-
- self.btn_to_pos = Qt.QPushButton()
- self.btn_to_pos.setToolTip('Moves the motor towards the Positive Software Limit')
- self.prepare_button(self.btn_to_pos)
- self.btn_to_pos.setIcon(getIcon(':/actions/media_skip_forward.svg'))
- btns_layout.addWidget(self.btn_to_pos)
-
- btns_layout.addItem(Qt.QSpacerItem(1, 1, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum))
-
- self.layout().addLayout(btns_layout, 1, 0, 1, 3)
-
- self.connect(self.btn_step_down, Qt.SIGNAL('clicked()'), self.stepDown)
- self.connect(self.btn_step_up, Qt.SIGNAL('clicked()'), self.stepUp)
- ###self.connect(self.btn_stop, Qt.SIGNAL('clicked()'), self.abort)
- self.connect(self.btn_to_neg, Qt.SIGNAL('clicked()'), self.goNegative)
- self.connect(self.btn_to_neg_press, Qt.SIGNAL('pressed()'), self.goNegative)
- self.connect(self.btn_to_neg_press, Qt.SIGNAL('released()'), self.abort)
- self.connect(self.btn_to_pos, Qt.SIGNAL('clicked()'), self.goPositive)
- self.connect(self.btn_to_pos_press, Qt.SIGNAL('pressed()'), self.goPositive)
- self.connect(self.btn_to_pos_press, Qt.SIGNAL('released()'), self.abort)
-
- # Align everything on top
- self.layout().addItem(Qt.QSpacerItem(1, 1, Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Expanding), 2, 0, 1, 3)
-
- # IN ORDER TO BEHAVE AS EXPECTED REGARDING THE 'COMPACT VIEW' FEATURE
- # WE NEED TO SET THE 'EXPERTVIEW' WITHOUT ACCESSING THE taurusValueBuddy WHICH IS STILL NOT LINKED
- # SO WE ASSUME 'expertview is FALSE' AND WE HAVE TO AVOID self.setExpertView :-(
- # WOULD BE NICE THAT THE taurusValueBuddy COULD EMIT THE PROPER SIGNAL...
- self.btn_to_neg.setVisible(False)
- self.btn_to_neg_press.setVisible(False)
- self.btn_to_pos.setVisible(False)
- self.btn_to_pos_press.setVisible(False)
-
- # IN EXPERT VIEW, WE HAVE TO FORWARD THE ''editingFinished()' SIGNAL FROM TaurusValueLineEdit TO Switcher
- self.connect(self.le_write_absolute, Qt.SIGNAL(TaurusBaseWritableWidget.appliedSignalSignature), self.emitEditingFinished)
- self.connect(self.btn_step_down, Qt.SIGNAL("clicked()"), self.emitEditingFinished)
- self.connect(self.btn_step_up, Qt.SIGNAL("clicked()"), self.emitEditingFinished)
- self.connect(self.btn_to_neg, Qt.SIGNAL("clicked()"), self.emitEditingFinished)
- self.connect(self.btn_to_pos, Qt.SIGNAL("clicked()"), self.emitEditingFinished)
-
- # list of widgets used for edition
- editingWidgets = (self.le_write_absolute, self.cbAbsoluteRelative,
- self.cb_step, self.btn_step_down,
- self.btn_step_up, self.btn_to_neg,
- self.btn_to_pos, self.btn_to_neg_press,
- self.btn_to_pos_press)
-
- for w in editingWidgets:
- w.installEventFilter(self)
-
- def eventFilter(self, obj, event):
- '''reimplemented to intercept events from the subwidgets'''
- if obj in (self.btn_to_neg_press, self.btn_to_pos_press):
- if event.type() == Qt.QEvent.MouseButtonRelease:
- self.emitEditingFinished()
- # emit editingFinished when focus out to a non-editing widget
- if event.type() == Qt.QEvent.FocusOut:
- focused = Qt.qApp.focusWidget()
- focusInChild = focused in self.findChildren(focused.__class__)
- if not focusInChild:
- self.emitEditingFinished()
- return False
-
- def cbAbsoluteRelativeChanged(self, abs_rel_option):
- abs_visible = abs_rel_option == 'Abs'
- rel_visible = abs_rel_option == 'Rel'
- self.le_write_absolute.setVisible(abs_visible)
- self.qw_write_relative.setVisible(rel_visible)
-
- def stepDown(self):
- self.goRelative(-1)
-
- def stepUp(self):
- self.goRelative(+1)
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to move the motor.')
- def goRelative(self, direction):
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- increment = direction * float(self.cb_step.currentText())
- position = float(motor_dev.getAttribute('Position').read().value)
- target_position = position + increment
- motor_dev.getAttribute('Position').write(target_position)
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to move the motor.')
- def goNegative(self):
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- min_value = float(motor_dev.getAttribute('Position').min_value)
- motor_dev.getAttribute('Position').write(min_value)
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to move the motor.')
- def goPositive(self):
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- max_value = float(motor_dev.getAttribute('Position').max_value)
- motor_dev.getAttribute('Position').write(max_value)
-
- @ProtectTaurusMessageBox(msg='An error occurred trying to abort the motion.')
- def abort(self):
- motor_dev = self.taurusValueBuddy().motor_dev
- if motor_dev is not None:
- motor_dev.abort()
-
- def prepare_button(self, btn):
- btn_policy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed)
- btn_policy.setHorizontalStretch(0)
- btn_policy.setVerticalStretch(0)
- btn.setSizePolicy(btn_policy)
- btn.setMinimumSize(25, 25)
- btn.setMaximumSize(25, 25)
- btn.setText('')
-
- def setExpertView(self, expertView):
- self.btn_to_neg.setVisible(expertView)
- self.btn_to_neg_press.setVisible(expertView)
-
- self.btn_to_pos.setVisible(expertView)
- self.btn_to_pos_press.setVisible(expertView)
-
- if expertView and self.taurusValueBuddy().motor_dev is not None:
- neg_sw_limit_enabled = self.taurusValueBuddy().motor_dev.getAttribute('Position').min_value.lower() != 'not specified'
- self.btn_to_neg.setEnabled(neg_sw_limit_enabled)
- self.btn_to_neg_press.setEnabled(neg_sw_limit_enabled)
-
- pos_sw_limit_enabled = self.taurusValueBuddy().motor_dev.getAttribute('Position').max_value.lower() != 'not specified'
- self.btn_to_pos.setEnabled(pos_sw_limit_enabled)
- self.btn_to_pos_press.setEnabled(pos_sw_limit_enabled)
-
- def setModel(self, model):
- if hasattr(self, 'taurusValueBuddy'):
- self.disconnect(self.taurusValueBuddy(), Qt.SIGNAL('expertViewChanged(bool)'), self.setExpertView)
- if model in (None, ''):
- TaurusWidget.setModel(self, model)
- self.le_write_absolute.setModel(model)
- return
- TaurusWidget.setModel(self, model + '/Position')
- self.le_write_absolute.setModel(model + '/Position')
-
- # Handle User/Expert View
- self.setExpertView(self.taurusValueBuddy()._expertView)
- self.connect(self.taurusValueBuddy(), Qt.SIGNAL('expertViewChanged(bool)'), self.setExpertView)
-
-
- def keyPressEvent(self, key_event):
- if key_event.key() == Qt.Qt.Key_Escape:
- self.abort()
- key_event.accept()
- TaurusWidget.keyPressEvent(self, key_event)
-
- def emitEditingFinished(self):
- self.emit(Qt.SIGNAL(TaurusBaseWritableWidget.appliedSignalSignature))
-
-
-##################################################
-# UNITS WIDGET #
-##################################################
-class PoolMotorTVUnitsWidget(DefaultUnitsWidget):
-
- layoutAlignment = Qt.Qt.AlignTop
-
- def __init__(self, parent=None, designMode=False):
- DefaultUnitsWidget.__init__(self, parent, designMode)
-
- def setModel(self, model):
- if model in (None,''):
- DefaultUnitsWidget.setModel(self, model)
- return
- DefaultUnitsWidget.setModel(self, model + '/Position')
-
-##################################################
-# TV MOTOR WIDGET #
-##################################################
-
-class PoolMotorTV(TaurusValue):
- ''' A widget that displays and controls a pool Motor device. It
- behaves as a TaurusValue.
- @TODO the view mode should be stored in the configuration
- @TODO the motor list should be stored in the configuration
- @TODO the selected radiobuttons (dial/indx/enc) and (abs/rel) should be stored in configuration
- @TODO it would be nice if the neg/pos limits could react also when software limits are 'active'
- @TODO expert view for read widget should include signals (indexer/encoder/inpos)...
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusValue.__init__(self, parent=parent, designMode=designMode)
- self.setLabelWidgetClass('PoolMotorTVLabelWidget')
- self.setReadWidgetClass('PoolMotorTVReadWidget')
- self.setWriteWidgetClass('PoolMotorTVWriteWidget')
- self.setUnitsWidgetClass('PoolMotorTVUnitsWidget')
-
- self.setLabelConfig('dev_alias')
-
- self.motor_dev = None
- self._expertView = False
- self.limits_listener = None
- self.poweron_listener = None
- self.status_listener = None
- self.position_listener = None
- self.setExpertView(False)
-
- def setExpertView(self, expertView):
- self._expertView = expertView
- self.emit(Qt.SIGNAL('expertViewChanged(bool)'), expertView)
-
- def minimumHeight(self):
- return None #@todo: UGLY HACK to avoid subwidgets being forced to minimumheight=20
-
- def setModel(self, model):
- TaurusValue.setModel(self, model)
- try:
- # disconnect signals
- if self.limits_listener is not None:
- self.disconnect(self.limits_listener, Qt.SIGNAL('eventReceived'), self.updateLimits)
- if self.poweron_listener is not None:
- self.disconnect(self.poweron_listener, Qt.SIGNAL('eventReceived'), self.updatePowerOn)
- if self.status_listener is not None:
- self.disconnect(self.status_listener, Qt.SIGNAL('eventReceived'), self.updateStatus)
- if self.position_listener is not None:
- self.disconnect(self.position_listener, Qt.SIGNAL('eventReceived'), self.updatePosition)
-
- #remove listeners
- if self.motor_dev is not None:
- if self.hasHwLimits():
- self.motor_dev.getAttribute('Limit_Switches').removeListener(self.limits_listener)
- if self.hasPowerOn():
- self.motor_dev.getAttribute('PowerOn').removeListener(self.poweron_listener)
- self.motor_dev.getAttribute('Status').removeListener(self.status_listener)
- self.motor_dev.getAttribute('Position').removeListener(self.position_listener)
-
- if model == '' or model is None:
- self.motor_dev = None
- return
-
- self.motor_dev = taurus.Device(model)
-
- # CONFIGURE A LISTENER IN ORDER TO UPDATE LIMIT SWITCHES STATES
- self.limits_listener = TaurusAttributeListener()
- if self.hasHwLimits():
- self.connect(self.limits_listener, Qt.SIGNAL('eventReceived'), self.updateLimits)
- self.motor_dev.getAttribute('Limit_Switches').addListener(self.limits_listener)
-
- # CONFIGURE AN EVENT RECEIVER IN ORDER TO PROVIDE POWERON <- True/False EXPERT OPERATION
- self.poweron_listener = TaurusAttributeListener()
- if self.hasPowerOn():
- self.connect(self.poweron_listener, Qt.SIGNAL('eventReceived'), self.updatePowerOn)
- self.motor_dev.getAttribute('PowerOn').addListener(self.poweron_listener)
-
- # CONFIGURE AN EVENT RECEIVER IN ORDER TO UPDATED STATUS TOOLTIP
- self.status_listener = TaurusAttributeListener()
- self.connect(self.status_listener, Qt.SIGNAL('eventReceived'), self.updateStatus)
- self.motor_dev.getAttribute('Status').addListener(self.status_listener)
-
- # CONFIGURE AN EVENT RECEIVER IN ORDER TO ACTIVATE LIMIT BUTTONS ON SOFTWARE LIMITS
- self.position_listener = TaurusAttributeListener()
- self.connect(self.position_listener, Qt.SIGNAL('eventReceived'), self.updatePosition)
- self.motor_dev.getAttribute('Position').addListener(self.position_listener)
-
- self.motor_dev.getAttribute('Position').enablePolling(force=True)
-
- self.setExpertView(self._expertView)
- except Exception, e:
- self.warning("Exception caught while setting model: %s", repr(e))
- self.motor_dev = None
- return
-
- def hasPowerOn(self):
- try: return hasattr(self.motor_dev, 'PowerOn')
- except: return False
-
- def hasHwLimits(self):
- try: return hasattr(self.motor_dev, 'Limit_Switches')
- except: return False
-
- def updateLimits(self, limits, position=None):
- if isinstance(limits, dict): limits = limits["limits"]
- limits = list(limits)
- HOME = 0
- POS = 1
- NEG = 2
-
- # Check also if the software limit is 'active'
- if self.motor_dev is not None:
- position_attribute = self.motor_dev.getAttribute('Position')
- if position is None:
- position = position_attribute.read().value
- max_value_str = position_attribute.max_value
- min_value_str = position_attribute.min_value
- try:
- max_value = float(max_value_str)
- limits[POS] = limits[POS] or (position >= max_value)
- except:
- pass
- try:
- min_value = float(min_value_str)
- limits[NEG] = limits[NEG] or (position <= min_value)
- except:
- pass
-
- pos_lim = limits[POS]
-
- pos_btnstylesheet = ''
- enabled = True
- if pos_lim:
- pos_btnstylesheet = 'QPushButton{%s}' % DEVICE_STATE_PALETTE.qtStyleSheet(PyTango.DevState.ALARM)
- enabled = False
- self.readWidget(followCompact=True).btn_lim_pos.setStyleSheet(pos_btnstylesheet)
-
- self.writeWidget(followCompact=True).btn_step_up.setEnabled(enabled)
- self.writeWidget(followCompact=True).btn_step_up.setStyleSheet(pos_btnstylesheet)
- enabled = enabled and self.motor_dev.getAttribute('Position').max_value.lower() != 'not specified'
- self.writeWidget(followCompact=True).btn_to_pos.setEnabled(enabled)
- self.writeWidget(followCompact=True).btn_to_pos_press.setEnabled(enabled)
-
- neg_lim = limits[NEG]
- neg_btnstylesheet = ''
- enabled = True
- if neg_lim:
- neg_btnstylesheet = 'QPushButton{%s}' % DEVICE_STATE_PALETTE.qtStyleSheet(PyTango.DevState.ALARM)
- enabled = False
- self.readWidget(followCompact=True).btn_lim_neg.setStyleSheet(neg_btnstylesheet)
-
- self.writeWidget(followCompact=True).btn_step_down.setEnabled(enabled)
- self.writeWidget(followCompact=True).btn_step_down.setStyleSheet(neg_btnstylesheet)
- enabled = enabled and self.motor_dev.getAttribute('Position').min_value.lower() != 'not specified'
- self.writeWidget(followCompact=True).btn_to_neg.setEnabled(enabled)
- self.writeWidget(followCompact=True).btn_to_neg_press.setEnabled(enabled)
-
- def updatePowerOn(self, poweron):
- btn_text = 'Set ON'
- if poweron:
- btn_text = 'Set OFF'
- self.labelWidget().btn_poweron.setText(btn_text)
-
-
- def updateStatus(self, status):
- # SHOULD THERE BE A BETTER METHOD FOR THIS UPDATE?
- # IF THIS IS NOT DONE, THE TOOLTIP IS NOT CALCULATED EVERY TIME
- # TaurusLabel.updateStyle DIDN'T WORK, SO I HAD TO GO DEEPER TO THE CONTROLLER...
- #self.labelWidget().lbl_alias.updateStyle()
- self.labelWidget().lbl_alias.controllerUpdate()
-
- def updatePosition(self, position):
- # we do not need the position for nothing...
- # we just want to check if any software limit is 'active'
- # and updateLimits takes care of it
- if self.motor_dev is not None:
- limit_switches = [False, False, False]
- if self.hasHwLimits():
- limit_switches = self.motor_dev.getAttribute('Limit_switches').read().value
- #print "update limits", limit_switches
- self.updateLimits(limit_switches, position=position)
-
- def hasEncoder(self):
- try: return hasattr(self.motor_dev, 'Encoder')
- except: return False
-
- def showTangoAttributes(self):
- model = self.getModel()
- taurus_attr_form = TaurusAttrForm()
- taurus_attr_form.setMinimumSize(Qt.QSize(555, 800))
- taurus_attr_form.setModel(model)
- taurus_attr_form.setWindowTitle('%s Tango Attributes' % taurus.Factory().getDevice(model).getSimpleName())
- taurus_attr_form.show()
-
-
-
- ### def showEvent(self, event):
- ### TaurusValue.showEvent(self, event)
- ### if self.motor_dev is not None:
- ### self.motor_dev.getAttribute('Position').enablePolling(force=True)
- ###
- ### def hideEvent(self, event):
- ### TaurusValue.hideEvent(self, event)
- ### if self.motor_dev is not None:
- ### self.motor_dev.getAttribute('Position').disablePolling()
-
-###################################################
-# A SIMPLER WIDGET THAT MAY BE USED OUTSIDE FORMS #
-###################################################
-
-class PoolMotor(TaurusFrame):
- ''' A widget that displays and controls a pool Motor device.
- '''
- def __init__(self, parent=None, designMode=False):
- TaurusFrame.__init__(self, parent, designMode)
-
- self.setLayout(Qt.QGridLayout())
- self.layout().setContentsMargins(0, 0, 0, 0)
- self.layout().setSpacing(0)
-
- self.setFrameShape(Qt.QFrame.Box)
-
- self.pool_motor_tv = PoolMotorTV(self)
-
- def setModel(self, model):
- self.pool_motor_tv.setModel(model)
- try: self.motor_dev = taurus.Device(model)
- except: return
-
-def main():
-
- import sys
- import taurus.qt.qtgui.application
- import taurus.core.util.argparse
- from taurus.qt.qtgui.panel import TaurusForm
-
- parser = taurus.core.util.argparse.get_taurus_parser()
- parser.usage = "%prog [options] [<motor1> [<motor2>] ...]"
-
- app = taurus.qt.qtgui.application.TaurusApplication(cmd_line_parser=parser)
- args = app.get_command_line_args()
-
- #models = ['tango://controls02:10000/motor/gcipap10ctrl/8']
- models = ['motor/motctrl13/3']
-
- if len(args) > 0:
- models = args
-
- w = Qt.QWidget()
- w.setLayout(Qt.QVBoxLayout())
-
- tests = []
- #tests.append(1)
- tests.append(2)
- #tests.append(3)
- #tests.append(4)
-
- # 1) Test PoolMotorSlim motor widget
- form_pms = TaurusForm()
- pms_widget_class = 'taurus.qt.qtgui.extra_pool.PoolMotorSlim'
- pms_tgclass_map = {'SimuMotor':(pms_widget_class, (), {}),
- 'Motor':(pms_widget_class, (), {}),
- 'PseudoMotor':(pms_widget_class, (), {})}
- form_pms.setCustomWidgetMap(pms_tgclass_map)
- if 1 in tests:
- form_pms.setModel(models)
- w.layout().addWidget(form_pms)
-
- # 2) Test PoolMotorTV motor widget
- form_tv = TaurusForm()
- form_tv.setModifiableByUser(True)
- tv_widget_class = 'taurus.qt.qtgui.extra_pool.PoolMotorTV'
- tv_tgclass_map = {'SimuMotor':(tv_widget_class, (), {}),
- 'Motor':(tv_widget_class, (), {}),
- 'PseudoMotor':(tv_widget_class, (), {})}
- form_tv.setCustomWidgetMap(tv_tgclass_map)
-
- if 2 in tests:
- form_tv.setModel(models)
- w.layout().addWidget(form_tv)
- form_tv.setCompact(True)
-
- # 3) Test Stand-Alone PoolMotor widget
- # New approach would be to let PoolMotorTV live outside a TaurusForm.... but inside a GridLayout
- # Carlos already said this is not a good approach but...
- if 3 in tests:
- for motor in models:
- motor_widget = PoolMotor()
- motor_widget.setModel(motor)
- w.layout().addWidget(motor_widget)
-
- # 4) Test Stand-Alone PoolMotorSlim widget
- if 4 in tests:
- for motor in models:
- motor_widget = PoolMotorSlim()
- motor_widget.setModel(motor)
- w.layout().addWidget(motor_widget)
-
- w.show()
-
- sys.exit(app.exec_())
-
-if __name__ == '__main__':
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperature.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperature.ui
deleted file mode 100644
index d7719dbc..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperature.ui
+++ /dev/null
@@ -1,211 +0,0 @@
-<ui version="4.0">
- <class>AppleiiPLCTemperature</class>
- <widget class="QWidget" name="AppleiiPLCTemperature">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>238</width>
- <height>30</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="TaurusGroupBox">
- <property name="showText">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusBoolLed" name="TemperatureInterlock">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="ledColor">
- <string>RED</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="TaurusConfigLabel" name="TemperatureLabel">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="prefixText">
- <string/>
- </property>
- <property name="model">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusValueLabel" name="TemperatureValue">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusConfigLabel" name="TemperatureUnits">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="prefixText">
- <string/>
- </property>
- <property name="model">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="TemperatureConfiguration">
- <property name="text">
- <string>Cfg</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusBoolLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusConfigLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperatureAlarms.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperatureAlarms.ui
deleted file mode 100644
index 8742bb4b..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/AppleiiPLCTemperatureAlarms.ui
+++ /dev/null
@@ -1,255 +0,0 @@
-<ui version="4.0">
- <class>AppleiiPLCTemperatureAlarms</class>
- <widget class="QWidget" name="AppleiiPLCTemperatureAlarms">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>275</width>
- <height>191</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="TaurusGroupBox">
- <property name="showText">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Alarm Up</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="TaurusValueLineEdit" name="AlarmUp">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="Line" name="line">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Warning Up</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="TaurusValueLineEdit" name="WarningUp">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="showQuality">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="Line" name="line_2">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="TaurusConfigLabel" name="TemperatureLabel">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>20</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="TaurusValueLabel" name="TemperatureValue">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Warning Down</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="TaurusValueLineEdit" name="WarningDown">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="Line" name="line_4">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Alarm Down</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="TaurusValueLineEdit" name="AlarmDown">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="Line" name="line_5">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QPushButton" name="ApplyButton">
- <property name="text">
- <string>Apply</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusValueLineEdit</class>
- <extends>QLineEdit</extends>
- <header>taurus.qt.qtgui.input</header>
- </customwidget>
- <customwidget>
- <class>TaurusConfigLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolIORegisterButtons.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolIORegisterButtons.ui
deleted file mode 100644
index 886be11e..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolIORegisterButtons.ui
+++ /dev/null
@@ -1,56 +0,0 @@
-<ui version="4.0" >
- <class>PoolIORegisterButtons</class>
- <widget class="TaurusWidget" name="PoolIORegisterButtons" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>172</width>
- <height>52</height>
- </rect>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle" >
- <string>Form</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>0</number>
- </property>
- <item row="0" column="0" >
- <layout class="QHBoxLayout" name="lo_state_read" >
- <property name="spacing" >
- <number>0</number>
- </property>
- <property name="sizeConstraint" >
- <enum>QLayout::SetMinimumSize</enum>
- </property>
- </layout>
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" name="lo_buttons_write" >
- <property name="spacing" >
- <number>0</number>
- </property>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusWidget</class>
- <extends>QWidget</extends>
- <header>taurus.qt.qtgui.container</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolMotorSlim.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolMotorSlim.ui
deleted file mode 100644
index 6c6141b4..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/PoolMotorSlim.ui
+++ /dev/null
@@ -1,380 +0,0 @@
-<ui version="4.0">
- <class>PoolMotorSlim</class>
- <widget class="TaurusWidget" name="PoolMotorSlim">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>487</width>
- <height>61</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="motorGroupBox">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="showText" stdset="0">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QWidget" native="1" name="taurusValueContainer">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="btnMin">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Maximum" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Negative limit</string>
- </property>
- <property name="text">
- <string>-</string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnGoToNeg">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Maximum" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Moves the motor towards negative limit</string>
- </property>
- <property name="text">
- <string>|&lt;</string>
- </property>
- <property name="default">
- <bool>false</bool>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnGoToNegPress">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Maximum" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Moves the motor towards negative limit while pressed</string>
- </property>
- <property name="text">
- <string>&#171;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnGoToNegInc">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Maximum" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Decrements motor position &lt;inc&gt; units</string>
- </property>
- <property name="text">
- <string>&lt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="inc">
- <property name="maximumSize">
- <size>
- <width>80</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="maximum">
- <double>10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.000000000000000</double>
- </property>
- <property name="value">
- <double>1.000000000000000</double>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnGoToPosInc">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Increments motor position &lt;inc&gt; units</string>
- </property>
- <property name="text">
- <string>&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnGoToPosPress">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Moves the motor towards positive limit while pressed</string>
- </property>
- <property name="text">
- <string>&#187;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnGoToPos">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Moves the motor towards positive limit</string>
- </property>
- <property name="text">
- <string>&gt;|</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnMax">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Positive limit</string>
- </property>
- <property name="text">
- <string>+</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="2">
- <widget class="QPushButton" name="btnStop">
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Stops the motor</string>
- </property>
- <property name="text">
- <string>S</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QPushButton" name="btnHome">
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Goes Home</string>
- </property>
- <property name="text">
- <string>H</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="TaurusLauncherButton" name="btnCfg">
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Configures the motor</string>
- </property>
- <property name="text">
- <string>Cfg</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="5">
- <widget class="TaurusValueLabel" name="lblStatus">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="styleSheet">
- <string notr="true">TauValueLabel {
- border-style: outset;
- border-width: 2px;
- border-color: rgba(255,255,255,128);
- background-color: transparent; color:black; }</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="model" stdset="0">
- <string>/Status</string>
- </property>
- <property name="useParentModel" stdset="0">
- <bool>true</bool>
- </property>
- <property name="showQuality" stdset="0">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusWidget</class>
- <extends>QWidget</extends>
- <header>taurus.qt.qtgui.container</header>
- </customwidget>
- <customwidget>
- <class>TaurusLauncherButton</class>
- <extends>QPushButton</extends>
- <header>taurus.qt.qtgui.button</header>
- </customwidget>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH.ui
deleted file mode 100644
index efbd6e35..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH.ui
+++ /dev/null
@@ -1,226 +0,0 @@
-<ui version="4.0">
- <class>TaurusMotorH</class>
- <widget class="QWidget" name="TaurusMotorH">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>392</width>
- <height>48</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="TaurusGroupBox">
- <property name="showText">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusValueLabel" name="labelState">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="showQuality">
- <bool>false</bool>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusStateLed" name="ledState">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusValueLineEdit" name="positionWrite">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusValueLabel" name="positionRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusConfigLabel" name="positionUnits">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="prefixText">
- <string/>
- </property>
- <property name="model">
- <string>/Position?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="config">
- <property name="text">
- <string>cfg</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusBoolLed" name="limitN">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="limitLabel">
- <property name="text">
- <string>- lim +</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusBoolLed" name="limitP">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>1</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusStateLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusBoolLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLineEdit</class>
- <extends>QLineEdit</extends>
- <header>taurus.qt.qtgui.input</header>
- </customwidget>
- <customwidget>
- <class>TaurusConfigLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH2.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH2.ui
deleted file mode 100644
index be73d2e6..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorH2.ui
+++ /dev/null
@@ -1,235 +0,0 @@
-<ui version="4.0">
- <class>TaurusMotorH2</class>
- <widget class="QWidget" name="TaurusMotorH2">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>212</width>
- <height>82</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="TaurusGroupBox">
- <property name="showText">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <layout class="QVBoxLayout">
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusValueLabel" name="labelState">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="showQuality">
- <bool>false</bool>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusStateLed" name="ledState">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="TaurusBoolLed" name="limitN">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="limitLabel">
- <property name="text">
- <string>- lim +</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusBoolLed" name="limitP">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>1</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusValueLineEdit" name="positionWrite">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusValueLabel" name="positionRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusConfigLabel" name="positionUnits">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>24</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="prefixText">
- <string/>
- </property>
- <property name="model">
- <string>/Position?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="config">
- <property name="text">
- <string>cfg</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusStateLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusBoolLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLineEdit</class>
- <extends>QLineEdit</extends>
- <header>taurus.qt.qtgui.input</header>
- </customwidget>
- <customwidget>
- <class>TaurusConfigLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV.ui
deleted file mode 100644
index 3c807612..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV.ui
+++ /dev/null
@@ -1,224 +0,0 @@
-<ui version="4.0">
- <class>TaurusMotorV</class>
- <widget class="QWidget" name="TaurusMotorV">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>120</width>
- <height>144</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="TaurusGroupBox">
- <property name="showText">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <layout class="QVBoxLayout">
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusValueLabel" name="labelState">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="showQuality">
- <bool>false</bool>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusStateLed" name="ledState">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusValueLineEdit" name="positionWrite">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="config">
- <property name="text">
- <string>cfg</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusValueLabel" name="positionRead">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusConfigLabel" name="positionUnits">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>24</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="prefixText">
- <string/>
- </property>
- <property name="model">
- <string>/Position?configuration=unit</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="TaurusBoolLed" name="limitN">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="limitLabel">
- <property name="text">
- <string>- lim +</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusBoolLed" name="limitP">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>1</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusStateLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusBoolLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLineEdit</class>
- <extends>QLineEdit</extends>
- <header>taurus.qt.qtgui.input</header>
- </customwidget>
- <customwidget>
- <class>TaurusConfigLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV2.ui b/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV2.ui
deleted file mode 100644
index f68c1ca1..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_pool/ui/TaurusMotorV2.ui
+++ /dev/null
@@ -1,882 +0,0 @@
-<ui version="4.0">
- <class>TaurusMotorV2</class>
- <widget class="QDialog" name="TaurusMotorV2">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>297</width>
- <height>272</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>0</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="TaurusGroupBox" name="TaurusGroupBox">
- <property name="showText">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="TaurusStateLed" name="ledState">
- <property name="ledSize">
- <number>24</number>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="TaurusValueLabel" name="labelState">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="showQuality">
- <bool>false</bool>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/State</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <layout class="QHBoxLayout">
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="TaurusBoolLed" name="limitN">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="ledColor">
- <string>ORANGE</string>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="limitLabel">
- <property name="text">
- <string>- lim +</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="4">
- <widget class="TaurusBoolLed" name="limitP">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="ledColor">
- <string>ORANGE</string>
- </property>
- <property name="model">
- <string>/Limit_switches</string>
- </property>
- <property name="boolIndex">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="positionLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Position?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="TaurusValueLineEdit" name="positionWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="TaurusValueLabel" name="positionRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position</string>
- </property>
- <property name="buddy">
- <cstring/>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="TaurusConfigLabel" name="positionUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Position?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="velocityLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Velocity?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="TaurusValueLineEdit" name="velocityWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Velocity</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="TaurusValueLabel" name="velocityRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Velocity</string>
- </property>
- <property name="buddy">
- <cstring/>
- </property>
- </widget>
- </item>
- <item row="2" column="4">
- <widget class="TaurusConfigLabel" name="velocityUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Velocity?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="accelLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Acceleration?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="TaurusValueLineEdit" name="accelWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Acceleration</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="TaurusValueLabel" name="accelRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Acceleration</string>
- </property>
- <property name="buddy">
- <cstring/>
- </property>
- </widget>
- </item>
- <item row="3" column="4">
- <widget class="TaurusConfigLabel" name="accelUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Acceleration?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="decelLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Deceleration?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="TaurusValueLineEdit" name="decelWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Deceleration</string>
- </property>
- </widget>
- </item>
- <item row="4" column="3">
- <widget class="TaurusValueLabel" name="decelRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Deceleration</string>
- </property>
- <property name="buddy">
- <cstring/>
- </property>
- </widget>
- </item>
- <item row="4" column="4">
- <widget class="TaurusConfigLabel" name="decelUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Deceleration?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="offsetLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Offset?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="TaurusValueLineEdit" name="offsetWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Offset</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="TaurusValueLabel" name="offsetRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Offset</string>
- </property>
- <property name="buddy">
- <cstring/>
- </property>
- </widget>
- </item>
- <item row="5" column="4">
- <widget class="TaurusConfigLabel" name="offsetUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Offset?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="baseRateLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Base_rate?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="6" column="2">
- <widget class="TaurusValueLineEdit" name="baseRateWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Base_rate</string>
- </property>
- </widget>
- </item>
- <item row="6" column="3">
- <widget class="TaurusValueLabel" name="baseRateRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Base_rate</string>
- </property>
- </widget>
- </item>
- <item row="6" column="4">
- <widget class="TaurusConfigLabel" name="baseRateUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Base_rate?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="stepsUnitLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Step_per_unit?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="7" column="2">
- <widget class="TaurusValueLineEdit" name="stepsUnitsWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Step_per_unit</string>
- </property>
- </widget>
- </item>
- <item row="7" column="3">
- <widget class="TaurusValueLabel" name="stepsUnitRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Step_per_unit</string>
- </property>
- <property name="buddy">
- <cstring/>
- </property>
- </widget>
- </item>
- <item row="7" column="4">
- <widget class="TaurusConfigLabel" name="stepsUnitUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Step_per_unit?configuration=unit</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0" colspan="2">
- <widget class="TaurusConfigLabel" name="backlashLabel">
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="suffixText">
- <string>:</string>
- </property>
- <property name="model">
- <string>/Backlash?configuration=label</string>
- </property>
- </widget>
- </item>
- <item row="8" column="2">
- <widget class="TaurusValueLineEdit" name="backlashWrite">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Backlash</string>
- </property>
- </widget>
- </item>
- <item row="8" column="3">
- <widget class="TaurusValueLabel" name="backlashRead">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Backlash</string>
- </property>
- </widget>
- </item>
- <item row="8" column="4">
- <widget class="TaurusConfigLabel" name="backlashUnits">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="useParentModel">
- <bool>true</bool>
- </property>
- <property name="model">
- <string>/Backlash?configuration=unit</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusGroupBox</class>
- <extends>QGroupBox</extends>
- <header>taurus.qt.qtgui.container</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>TaurusStateLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusBoolLed</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLineEdit</class>
- <extends>QLineEdit</extends>
- <header>taurus.qt.qtgui.input</header>
- </customwidget>
- <customwidget>
- <class>TaurusConfigLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- <customwidget>
- <class>TaurusValueLabel</class>
- <extends>QLabel</extends>
- <header>taurus.qt.qtgui.display</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/__init__.py b/src/sardana/taurus/qt/qtgui/extra_sardana/__init__.py
deleted file mode 100644
index e5f31d23..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/__init__.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package contains a collection of taurus widgets designed to connect
-to sardana"""
-
-__docformat__ = 'restructuredtext'
-
-from .measurementgroup import *
-from .expdescription import *
-from .elementtree import *
-
-try:
- from .sardanaeditor import *
-except:
- from taurus.qt.qtgui.display import create_taurus_fallback as __create
- SardanaEditor = __create("SardanaEditor")
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/cmdline.py b/src/sardana/taurus/qt/qtgui/extra_sardana/cmdline.py
deleted file mode 100644
index e07f463f..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/cmdline.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This package contains a collection of taurus widgets designed to connect
-to sardana"""
-
-__docformat__ = 'restructuredtext'
-
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.resource import getIcon, getThemeIcon
-
-
-class CommandLineHistory(list):
- pass
-
-class CommandLine(Qt.QComboBox):
-
- def __init__(self, qt_parent=None, designMode=False):
- Qt.QComboBox.__init__(self, qt_parent)
- self.setEditable(True)
- self.setFrame(False)
-
-class TaurusCommandLineWidget(Qt.QWidget):
-
- def __init__(self, qt_parent=None, designMode=False):
- Qt.QWidget.__init__(self, qt_parent)
-
- self._history = CommandLineHistory()
-
- l = Qt.QHBoxLayout()
- self.setLayout(l)
- l.setContentsMargins(0, 0, 0, 0)
- l.setSpacing(0)
-
- self._detailsButton = Qt.QToolButton()
- self._detailsButton.setText("...")
-
- self._cmdLine = Qt.QComboBox()
- self._cmdLine.setEditable(True)
-
- self._applyButton = Qt.QToolButton()
- self._applyButton.setIcon(getIcon(":/actions/media_playback_start.svg"))
-
- self._stopButton = Qt.QToolButton()
- self._stopButton.setIcon(getIcon(":/actions/media_playback_stop.svg"))
-
- self._clearButton = Qt.QToolButton()
- self._clearButton.setIcon(getThemeIcon("edit-clear"))
-
- l.addWidget(self._detailsButton, 0)
- l.addWidget(self._cmdLine, 1)
- l.addWidget(self._applyButton, 0)
- l.addWidget(self._stopButton, 0)
- l.addWidget(self._clearButton, 0)
-
-
-
- def run(self):
- pass
-
-def demo():
- pass
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- import taurus.core.util.argparse
- parser = taurus.core.util.argparse.get_taurus_parser()
- app = Application(sys.argv, cmd_line_parser=parser,
- app_name="Taurus command line demo", app_version="1.0",
- org_domain="Taurus", org_name="Tango community")
-
- w = TaurusCommandLineWidget()
- w.show()
-
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == '__main__':
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/controllertree.py b/src/sardana/taurus/qt/qtgui/extra_sardana/controllertree.py
deleted file mode 100644
index ed38336b..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/controllertree.py
+++ /dev/null
@@ -1,344 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a taurus text editor widget."""
-
-__all__ = ["ControllerClassTreeWidget", "ControllerClassSelectionDialog"]
-
-__docformat__ = 'restructuredtext'
-
-import sys
-import os
-
-import taurus.core
-from taurus.core.util.enumeration import Enumeration
-from taurus.external.qt import Qt
-from taurus.qt.qtcore.mimetypes import TAURUS_MODEL_MIME_TYPE, TAURUS_MODEL_LIST_MIME_TYPE
-from taurus.qt.qtcore.model import TaurusBaseTreeItem, TaurusBaseModel, TaurusBaseProxyModel
-from taurus.qt.qtgui.tree import TaurusBaseTreeWidget
-from taurus.qt.qtgui.resource import getThemeIcon, getIcon
-
-PoolControllerView = Enumeration("PoolControllerView", ("ControllerModule", "ControllerClass", "Unknown"))
-
-def getElementTypeIcon(t):
- if t == PoolControllerView.ControllerModule:
- return getIcon(":/python-file.png")
- elif t == PoolControllerView.ControllerClass:
- return getIcon(":/python.png")
- return getIcon(":/tango.png")
-
-def getElementTypeSize(t):
- return Qt.QSize(200, 24)
-
-def getElementTypeToolTip(t):
- """Wrapper to prevent loading qtgui when this module is imported"""
- if t == PoolControllerView.ControllerModule:
- return "Controller module"
- elif t == PoolControllerView.ControllerClass:
- return "Controller class"
-
-
-class ControllerBaseTreeItem(TaurusBaseTreeItem):
- """A generic node"""
-
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- return self._itemData
-
- def role(self):
- """Returns the prefered role for the item.
- This implementation returns taurus.core.taurusbasetypes.TaurusElementType.Unknown
-
- This method should be able to return any kind of python object as long
- as the model that is used is compatible.
-
- :return: (PoolControllerView) the role in form of element type"""
- return PoolControllerView.Unknown
-
-
-class ControllerModuleTreeItem(ControllerBaseTreeItem):
-
- def role(self):
- return PoolControllerView.ControllerModule
-
- def toolTip(self):
- return "The controller module '%s'" % self.display()
-
- def icon(self):
- return getIcon(":/python-file.png")
-
-
-class ControllerTreeItem(ControllerBaseTreeItem):
-
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- return self._itemData.name
-
- def role(self):
- return PoolControllerView.ControllerClass
-
- def toolTip(self):
- return self._itemData.doc
-
- def icon(self):
- return getIcon(":/python.png")
-
-
-class ControllerBaseModel(TaurusBaseModel):
-
- ColumnNames = "Controllers",
- ColumnRoles = (PoolControllerView.ControllerModule, PoolControllerView.ControllerModule, PoolControllerView.ControllerClass),
-
- def setDataSource(self, pool):
- if self._data_src is not None:
- Qt.QObject.disconnect(self._data_src, Qt.SIGNAL('controllerClassesUpdated'), self.controllerClassesUpdated)
- if pool is not None:
- Qt.QObject.connect(pool, Qt.SIGNAL('controllerClassesUpdated'), self.controllerClassesUpdated)
- TaurusBaseModel.setDataSource(self, pool)
-
- def controllerClassesUpdated(self):
- self.refresh()
-
- def createNewRootItem(self):
- return ControllerBaseTreeItem(self, self.ColumnNames)
-
- def roleIcon(self, role):
- return getElementTypeIcon(role)
-
- def columnIcon(self, column):
- return self.roleIcon(self.role(column))
-
- def roleToolTip(self, role):
- return getElementTypeToolTip(role)
-
- def columnToolTip(self, column):
- return self.roleToolTip(self.role(column))
-
- def roleSize(self, role):
- return getElementTypeSize(role)
-
- def columnSize(self, column):
- role = self.role(column)
- s = self.roleSize(role)
- return s
-
- def mimeTypes(self):
- return ["text/plain", TAURUS_MODEL_LIST_MIME_TYPE, TAURUS_MODEL_MIME_TYPE]
-
- def mimeData(self, indexes):
- ret = Qt.QMimeData()
- data = []
- for index in indexes:
- if not index.isValid(): continue
- tree_item = index.internalPointer()
- mime_data_item = tree_item.mimeData(index)
- if mime_data_item is None:
- continue
- data.append(mime_data_item)
- ret.setData(TAURUS_MODEL_LIST_MIME_TYPE, "\r\n".join(data))
- ret.setText(", ".join(data))
- if len(data) == 1:
- ret.setData(TAURUS_MODEL_MIME_TYPE, str(data[0]))
- return ret
-
- def pyData(self, index, role):
- if not index.isValid():
- return None
-
- item = index.internalPointer()
- row, column, depth = index.row(), index.column(), item.depth()
- item_role = self.role(column, depth)
-
- ret = None
- if role == Qt.Qt.DisplayRole:
- ret = Qt.QString(item.data(index))
- elif role == Qt.Qt.DecorationRole:
- ret = item.icon()
- elif role == Qt.Qt.ToolTipRole:
- ret = item.toolTip()
- #elif role == Qt.Qt.SizeHintRole:
- # ret = self.columnSize(column)
- elif role == Qt.Qt.FontRole:
- ret = self.DftFont
- return ret
-
- def setupModelData(self, data):
- pool = self.dataSource()
- if pool is None:
- return
- root = self._rootItem
- ctrl_modules = {}
- # TODO
- #ctrl_class_dict = pool.getControllerClasses()
- #for ctrl_class_name, ctrl_class in ctrl_class_dict.items():
- # module_name = ctrl_class.module_name
- # moduleNode = ctrl_modules.get(module_name)
- # if moduleNode is None:
- # moduleNode = ControllerModuleTreeItem(self, module_name, root)
- # root.appendChild(moduleNode)
- # ctrl_modules[module_name] = moduleNode
- # ctrlNode = ControllerTreeItem(self, ctrl_class, moduleNode)
- # moduleNode.appendChild(ctrlNode)
-
-
-class ControllerModuleModel(ControllerBaseModel):
- pass
-
-
-class PlainControllerModel(ControllerBaseModel):
-
- ColumnNames = "Controller classes",
- ColumnRoles = (PoolControllerView.ControllerClass, PoolControllerView.ControllerClass),
-
- def setupModelData(self, data):
- pool = self.dataSource()
- if pool is None:
- return
- root = self._rootItem
- # TODO
- #ctrl_class_dict = pool.getControllerClasses()
- #ctrl_classes = ctrl_class_dict.keys()
- #ctrl_classes.sort()
- #self.debug("Found %d controller classes", len(ctrl_classes))
- #for ctrl_class_name in ctrl_classes:
- # ctrl_class = ctrl_class_dict[ctrl_class_name]
- # ctrlNode = ControllerTreeItem(self, ctrl_class, root)
- # root.appendChild(ctrlNode)
-
-
-class ControllerBaseModelProxy(TaurusBaseProxyModel):
- pass
-
-
-class ControllerModuleModelProxy(ControllerBaseModelProxy):
- pass
-
-
-class PlainControllerModelProxy(ControllerBaseModelProxy):
- pass
-
-
-class ControllerClassTreeWidget(TaurusBaseTreeWidget):
-
- KnownPerspectives = { PoolControllerView.ControllerModule : {
- "label" : "By module",
- "icon" : ":/python-file.png",
- "tooltip" : "View by controller module",
- "model" : [ControllerModuleModelProxy, ControllerModuleModel],
- },
- PoolControllerView.ControllerClass : {
- "label" : "By controller",
- "icon" : ":/python.png",
- "tooltip" : "View by controller class",
- "model" : [PlainControllerModelProxy, PlainControllerModel],
- }
- }
- DftPerspective = PoolControllerView.ControllerModule
-
- def getModelClass(self):
- return taurus.core.taurusdevice.TaurusDevice
-
-
-class ControllerClassSelectionDialog(Qt.QDialog):
-
- def __init__(self, parent=None, designMode=False, model_name=None, perspective=None):
- Qt.QDialog.__init__(self, parent)
-
- self.setWindowTitle("Controller Class Selection Dialog")
-
- layout = Qt.QVBoxLayout()
- layout.setContentsMargins(0, 0, 0, 0)
- self.setLayout(layout)
- self._panel = ControllerClassTreeWidget(parent=self,
- perspective=perspective,
- designMode=designMode,
- with_navigation_bar=False)
- self._panel.setModel(model_name)
- self.setWindowIcon(getElementTypeIcon(self._panel.perspective()))
- self._buttonBox = Qt.QDialogButtonBox(self)
- bts = Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel
- self._buttonBox.setStandardButtons(bts)
- layout.addWidget(self._panel)
- layout.addWidget(self._buttonBox)
- self.connect(self._buttonBox, Qt.SIGNAL("accepted()"), self.accept)
- self.connect(self._buttonBox, Qt.SIGNAL("rejected()"), self.reject)
-
- def selectedItems(self):
- return self._panel.selectedItems()
-
- def getSelectedMacros(self):
- return [ i.itemData() for i in self.selectedItems() ]
-
-
-def main_ControllerClassSelecionDialog(pool, perspective=PoolControllerView.ControllerClass):
- w = ControllerClassSelectionDialog(model_name=pool, perspective=perspective)
-
- if w.result() == Qt.QDialog.Accepted:
- print w.getSelectedMacros()
- return w
-
-def main_ControllerClassTreeWidget(pool, perspective=PoolControllerView.ControllerClass):
- w = ControllerClassTreeWidget(perspective=perspective, with_navigation_bar=False)
- w.setModel(pool)
- w.show()
- return w
-
-def demo(poolname="Pool_BL98"):
- """ControllerClassTreeWidget"""
- w = main_ControllerClassSelecionDialog(poolname, PoolControllerView.ControllerClass)
- return w
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- app = Application(app_name="Pool controller class tree demo", app_version="1.0",
- org_domain="Taurus", org_name="Tango community")
-
- args = app.get_command_line_args()
- if len(args) == 1:
- w = demo(poolname=args[0])
- else:
- w = demo()
-
- w.show()
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/elementtree.py b/src/sardana/taurus/qt/qtgui/extra_sardana/elementtree.py
deleted file mode 100644
index 82fa4307..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/elementtree.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a taurus text editor widget."""
-
-__all__ = ["SardanaElementTreeWidget"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.taurusdevice import TaurusDevice
-from taurus.qt.qtgui.tree import TaurusBaseTreeWidget
-
-from sardana.taurus.qt.qtcore.tango.sardana.model import \
- SardanaBaseProxyModel, SardanaElementTypeModel
-
-
-class SardanaElementTreeWidget(TaurusBaseTreeWidget):
-
- KnownPerspectives = { "Type" : {
- "label" : "By type",
- "icon" : ":/python-file.png",
- "tooltip" : "View elements by type",
- "model" : [SardanaBaseProxyModel, SardanaElementTypeModel],
- },
- }
- DftPerspective = "Type"
-
- def getModelClass(self):
- return TaurusDevice
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- ret = TaurusBaseTreeWidget.getQtDesignerPluginInfo()
- ret['module'] = 'taurus.qt.qtgui.extra_sardana'
- ret['group'] = 'Taurus Sardana'
- ret['icon'] = ":/designer/listview.png"
- return ret
-
-
-def main_SardanaTreeWidget(device):
- w = SardanaElementTreeWidget(with_navigation_bar=True)
- w.setWindowTitle("Sardana browser - " + device)
- w.setModel(device)
- w.setMinimumSize(400, 800)
- w.show()
- return w
-
-def demo(device="V3"):
- """"""
- w = main_SardanaTreeWidget(device)
- return w
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- app = Application(app_name="Pool element tree demo", app_version="1.0",
- org_domain="Taurus", org_name="Tango community")
-
- args = app.get_command_line_args()
- if len(args) == 1:
- w = demo(device=args[0])
- else:
- w = demo()
-
- w.show()
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/environment.py b/src/sardana/taurus/qt/qtgui/extra_sardana/environment.py
deleted file mode 100644
index c3b194f2..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/environment.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a taurus environment widgets."""
-
-__all__ = ["SardanaEnvironmentTreeWidget"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.taurusdevice import TaurusDevice
-from taurus.external.qt import Qt
-from taurus.qt.qtgui.tree import TaurusBaseTreeWidget
-
-from sardana.taurus.qt.qtcore.tango.sardana.model import SardanaEnvironmentModel
-
-
-class SardanaEnvironmentTreeWidget(TaurusBaseTreeWidget):
-
- KnownPerspectives = { "Type" : {
- "label" : "By key",
- "icon" : ":/python-file.png",
- "tooltip" : "View elements by key",
- "model" : [SardanaEnvironmentModel],
- },
- }
- DftPerspective = "Type"
-
- def getModelClass(self):
- return TaurusDevice
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- ret = TaurusBaseTreeWidget.getQtDesignerPluginInfo()
- ret['module'] = 'taurus.qt.qtgui.extra_sardana'
- ret['group'] = 'Taurus Sardana'
- ret['icon'] = ":/designer/listview.png"
- return ret
-
-
-def main_SardanaTreeWidget(device):
- w = SardanaEnvironmentTreeWidget(with_navigation_bar=True)
- w.setWindowTitle("Sardana browser - " + device)
- w.setModel(device)
- w.setMinimumSize(400, 800)
- w.show()
- return w
-
-def demo(device="V3"):
- """"""
- w = main_SardanaTreeWidget(device)
- return w
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- app = Application(app_name="Sardana environment tree demo", app_version="1.0",
- org_domain="Taurus", org_name="Tango community")
-
- args = app.get_command_line_args()
- if len(args) == 1:
- w = demo(device=args[0])
- else:
- w = demo()
-
- w.show()
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == "__main__":
- main()
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/expdescription.py b/src/sardana/taurus/qt/qtgui/extra_sardana/expdescription.py
deleted file mode 100644
index 3e90c8b1..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/expdescription.py
+++ /dev/null
@@ -1,425 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module provides widget for configuring the data acquisition and display of an experiment"""
-
-__all__ = ["ExpDescriptionEditor"]
-
-from taurus.external.qt import Qt
-import copy
-import taurus
-import taurus.core
-from taurus.qt.qtgui.base import TaurusBaseWidget
-from taurus.qt.qtgui import resource
-
-from sardana.taurus.qt.qtcore.tango.sardana.model import SardanaBaseProxyModel, SardanaTypeTreeItem
-from taurus.qt.qtgui.util.ui import UILoadable
-
-## Using a plain model and filtering and checking 'Acquirable' in item.itemData().interfaces is more elegant, but things don't get properly sorted...
-#from taurus.qt.qtcore.tango.sardana.model import SardanaElementPlainModel
-
-class SardanaAcquirableProxyModel(SardanaBaseProxyModel):
-# ALLOWED_TYPES = 'Acquirable'
-#
-# def filterAcceptsRow(self, sourceRow, sourceParent):
-# sourceModel = self.sourceModel()
-# idx = sourceModel.index(sourceRow, 0, sourceParent)
-# item = idx.internalPointer()
-# return 'Acquirable' in item.itemData().interfaces
-
-# ALLOWED_TYPES = ['Motor', 'CTExpChannel', 'ZeroDExpChannel', 'OneDExpChannel',
-# 'TwoDExpChannel', 'ComChannel', 'IORegister', 'PseudoMotor',
-# 'PseudoCounter']
-
- from sardana.sardanadefs import ElementType, TYPE_ACQUIRABLE_ELEMENTS
- ALLOWED_TYPES = [ElementType[t] for t in TYPE_ACQUIRABLE_ELEMENTS]
-
- def filterAcceptsRow(self, sourceRow, sourceParent):
- sourceModel = self.sourceModel()
- idx = sourceModel.index(sourceRow, 0, sourceParent)
- treeItem = idx.internalPointer()
- if isinstance(treeItem, SardanaTypeTreeItem):
- return treeItem.itemData() in self.ALLOWED_TYPES
- return True
-
-
-@UILoadable(with_ui='ui')
-class ExpDescriptionEditor(Qt.QWidget, TaurusBaseWidget):
- '''
- A widget for editing the configuration of a experiment (measurement groups,
- plot and storage parameters, etc).
-
- It receives a Sardana Door name as its model and gets/sets the configuration
- using the `ExperimentConfiguration` environmental variable for that Door.
- '''
- def __init__(self, parent=None, door=None, plotsButton=True):
- Qt.QWidget.__init__(self, parent)
- TaurusBaseWidget.__init__(self, 'ExpDescriptionEditor')
- self.loadUi()
- self.ui.buttonBox.setStandardButtons(Qt.QDialogButtonBox.Reset | Qt.QDialogButtonBox.Apply)
- newperspectivesDict = copy.deepcopy(self.ui.sardanaElementTree.KnownPerspectives)
- #newperspectivesDict[self.ui.sardanaElementTree.DftPerspective]['model'] = [SardanaAcquirableProxyModel, SardanaElementPlainModel]
- newperspectivesDict[self.ui.sardanaElementTree.DftPerspective]['model'][0] = SardanaAcquirableProxyModel
- self.ui.sardanaElementTree.KnownPerspectives = newperspectivesDict #assign a copy because if just a key of this class memberwas modified, all instances of this class would be affected
- self.ui.sardanaElementTree._setPerspective(self.ui.sardanaElementTree.DftPerspective)
-
- self._localConfig = None
- self._originalConfiguration = None
- self._dirty = False
- self._dirtyMntGrps = set()
-
- self.connect(self.ui.activeMntGrpCB, Qt.SIGNAL('activated (QString)'), self.changeActiveMntGrp)
- self.connect(self.ui.createMntGrpBT, Qt.SIGNAL('clicked ()'), self.createMntGrp)
- self.connect(self.ui.deleteMntGrpBT, Qt.SIGNAL('clicked ()'), self.deleteMntGrp)
- self.connect(self.ui.compressionCB, Qt.SIGNAL('currentIndexChanged (int)'), self.onCompressionCBChanged)
- self.connect(self.ui.pathLE, Qt.SIGNAL('textEdited (QString)'), self.onPathLEEdited)
- self.connect(self.ui.filenameLE, Qt.SIGNAL('textEdited (QString)'), self.onFilenameLEEdited)
- self.connect(self.ui.channelEditor.getQModel(), Qt.SIGNAL('dataChanged (QModelIndex, QModelIndex)'), self._updateButtonBox)
- self.connect(self.ui.channelEditor.getQModel(), Qt.SIGNAL('modelReset ()'), self._updateButtonBox)
- self.connect(self.ui.preScanList, Qt.SIGNAL('dataChanged'), self.onPreScanSnapshotChanged)
- self.connect(self.ui.choosePathBT, Qt.SIGNAL('clicked ()'), self.onChooseScanDirButtonClicked)
-
- self.__plotManager = None
- icon = resource.getIcon(":/actions/view.svg")
- self.togglePlotsAction = Qt.QAction(icon, "Show/Hide plots", self)
- self.togglePlotsAction.setCheckable(True)
- self.togglePlotsAction.setChecked(False)
- self.togglePlotsAction.setEnabled(plotsButton)
- self.addAction(self.togglePlotsAction)
- self.connect(self.togglePlotsAction, Qt.SIGNAL("toggled(bool)"),
- self.onPlotsButtonToggled)
- self.ui.plotsButton.setDefaultAction(self.togglePlotsAction)
-
- if door is not None:
- self.setModel(door)
- self.connect(self.ui.buttonBox, Qt.SIGNAL("clicked(QAbstractButton *)"), self.onDialogButtonClicked)
-
- #Taurus Configuration properties and delegates
- self.registerConfigDelegate(self.ui.channelEditor)
-
- def getModelClass(self):
- '''reimplemented from :class:`TaurusBaseWidget`'''
- return taurus.core.taurusdevice.TaurusDevice
-
- def onChooseScanDirButtonClicked(self):
- ret = Qt.QFileDialog.getExistingDirectory (self, 'Choose directory for saving files', self.ui.pathLE.text())
- if ret:
- self.ui.pathLE.setText(ret)
- self.ui.pathLE.emit(Qt.SIGNAL('textEdited (QString)'), ret)
-
- def onDialogButtonClicked(self, button):
- role = self.ui.buttonBox.buttonRole(button)
- if role == Qt.QDialogButtonBox.ApplyRole:
- self.writeExperimentConfiguration(ask=False)
- elif role == Qt.QDialogButtonBox.ResetRole:
- self._reloadConf()
-
- def closeEvent(self, event):
- '''This event handler receives widget close events'''
- if self.isDataChanged():
- self.writeExperimentConfiguration(ask=True)
- Qt.QWidget.closeEvent(self, event)
-
- def setModel(self, model):
- '''reimplemented from :class:`TaurusBaseWidget`'''
- TaurusBaseWidget.setModel(self, model)
- self._reloadConf(force=True)
- #set the model of some child widgets
- door = self.getModelObj()
- if door is None: return
- tghost = taurus.Database().getNormalName() #@todo: get the tghost from the door model instead
- msname = door.macro_server.getFullName()
- self.ui.taurusModelTree.setModel(tghost)
- self.ui.sardanaElementTree.setModel(msname)
-
- def _reloadConf(self, force=False):
- if not force and self.isDataChanged():
- op = Qt.QMessageBox.question(self, "Reload info from door",
- "If you reload, all current experiment configuration changes will be lost. Reload?",
- Qt.QMessageBox.Yes | Qt.QMessageBox.Cancel)
- if op != Qt.QMessageBox.Yes:
- return
- door = self.getModelObj()
- if door is None: return
- conf = door.getExperimentConfiguration()
- self._originalConfiguration = copy.deepcopy(conf)
- self.setLocalConfig(conf)
- self._setDirty(False)
- self._dirtyMntGrps = set()
- #set a list of available channels
- avail_channels = {}
- for ch_info in door.macro_server.getExpChannelElements().values():
- avail_channels[ch_info.full_name] = ch_info.getData()
- self.ui.channelEditor.getQModel().setAvailableChannels(avail_channels)
-
- def _setDirty(self, dirty):
- self._dirty = dirty
- self._updateButtonBox()
-
- def isDataChanged(self):
- """Tells if the local data has been modified since it was last refreshed
-
- :return: (bool) True if he local data has been modified since it was last refreshed
- """
- return bool(self._dirty or self.ui.channelEditor.getQModel().isDataChanged() or self._dirtyMntGrps)
-
- def _updateButtonBox(self, *args, **kwargs):
- self.ui.buttonBox.setEnabled(self.isDataChanged())
-
- def getLocalConfig(self):
- return self._localConfig
-
- def setLocalConfig(self, conf):
- '''gets a ExpDescription dictionary and sets up the widget'''
-
- self._localConfig = conf
-
- #set the Channel Editor
- activeMntGrpName = self._localConfig['ActiveMntGrp'] or ''
- if activeMntGrpName in self._localConfig['MntGrpConfigs']:
- mgconfig = self._localConfig['MntGrpConfigs'][activeMntGrpName]
- self.ui.channelEditor.getQModel().setDataSource(mgconfig)
-
- #set the measurement group ComboBox
- self.ui.activeMntGrpCB.clear()
- self.ui.activeMntGrpCB.addItems(sorted(self._localConfig['MntGrpConfigs'].keys()))
- idx = self.ui.activeMntGrpCB.findText(activeMntGrpName)
- self.ui.activeMntGrpCB.setCurrentIndex(idx)
-
- #set the system snapshot list
- psl = self._localConfig.get('PreScanSnapshot') #I get it before clearing because clear() changes the _localConfig
- self.ui.preScanList.clear()
- self.ui.preScanList.addModels(psl)
-
- #other settings
- self.ui.filenameLE.setText(", ".join(self._localConfig['ScanFile']))
- self.ui.pathLE.setText(self._localConfig['ScanDir'] or '')
- self.ui.compressionCB.setCurrentIndex(self._localConfig['DataCompressionRank'] + 1)
-
- def writeExperimentConfiguration(self, ask=True):
- '''sends the current local configuration to the door
-
- :param ask: (bool) If True (default) prompts the user before saving.
- '''
-
- if ask:
- op = Qt.QMessageBox.question(self, "Save configuration?",
- 'Do you want to save the current configuration?\n(if not, any changes will be lost)',
- Qt.QMessageBox.Yes | Qt.QMessageBox.No)
- if op != Qt.QMessageBox.Yes:
- return False
-
- conf = self.getLocalConfig()
-
- #make sure that no empty measurement groups are written
- for mgname, mgconfig in conf.get('MntGrpConfigs', {}).items():
- if mgconfig is not None and not mgconfig.get('controllers'):
- Qt.QMessageBox.information(self, "Empty Measurement group",
- "The measurement group '%s' is empty. Fill it (or delete it) before applying" % mgname,
- Qt.QMessageBox.Ok)
- self.changeActiveMntGrp(mgname)
- return False
-
- #check if the currently displayed mntgrp is changed
- if self.ui.channelEditor.getQModel().isDataChanged():
- self._dirtyMntGrps.add(self._localConfig['ActiveMntGrp'])
-
- door = self.getModelObj()
- door.setExperimentConfiguration(conf, mnt_grps=self._dirtyMntGrps)
- self._originalConfiguration = copy.deepcopy(conf)
- self._dirtyMntGrps = set()
- self.ui.channelEditor.getQModel().setDataChanged(False)
- self._setDirty(False)
- self.emit(Qt.SIGNAL('experimentConfigurationChanged'), copy.deepcopy(conf))
- return True
-
- def changeActiveMntGrp(self, activeMntGrpName):
- activeMntGrpName = str(activeMntGrpName)
- if self._localConfig is None:
- return
- if activeMntGrpName == self._localConfig['ActiveMntGrp']:
- return #nothing changed
- if activeMntGrpName not in self._localConfig['MntGrpConfigs']:
- raise KeyError('Unknown measurement group "%s"' % activeMntGrpName)
-
- #add the previous measurement group to the list of "dirty" groups if something was changed
- if self.ui.channelEditor.getQModel().isDataChanged():
- self._dirtyMntGrps.add(self._localConfig['ActiveMntGrp'])
-
- self._localConfig['ActiveMntGrp'] = activeMntGrpName
-
- i = self.ui.activeMntGrpCB.findText(activeMntGrpName, Qt.Qt.MatchExactly)
- self.ui.activeMntGrpCB.setCurrentIndex(i)
- mgconfig = self._localConfig['MntGrpConfigs'][activeMntGrpName]
- self.ui.channelEditor.getQModel().setDataSource(mgconfig)
- self._setDirty(True)
-
- def createMntGrp(self):
- '''creates a new Measurement Group'''
-
- if self._localConfig is None:
- return
-
- mntGrpName, ok = Qt.QInputDialog.getText(self, "New Measurement Group",
- "Enter a name for the new measurement Group")
- if not ok: return
- mntGrpName = str(mntGrpName)
-
- #check that the given name is not an existing pool element
- ms = self.getModelObj().macro_server
- poolElementNames = [v.name for v in ms.getElementsWithInterface("PoolElement").values()]
- while mntGrpName in poolElementNames:
- Qt.QMessageBox.warning(self, "Cannot create Measurement group",
- "The name '%s' already is used for another pool element. Please Choose a different one." % mntGrpName,
- Qt.QMessageBox.Ok)
- mntGrpName, ok = Qt.QInputDialog.getText(self, "New Measurement Group",
- "Enter a name for the new measurement Group",
- Qt.QLineEdit.Normal,
- mntGrpName)
- if not ok: return
- mntGrpName = str(mntGrpName)
-
- #check that the measurement group is not already in the localConfig
- if mntGrpName in self._localConfig['MntGrpConfigs']:
- Qt.QMessageBox.warning(self, "%s already exists" % mntGrpName,
- 'A measurement group named "%s" already exists. A new one will not be created' % mntGrpName)
- return
-
- #add an empty configuration dictionary to the local config
- mgconfig = {'label': mntGrpName, 'controllers':{} }
- self._localConfig['MntGrpConfigs'][mntGrpName] = mgconfig
- #add the new measurement group to the list of "dirty" groups
- self._dirtyMntGrps.add(mntGrpName)
- #add the name to the combobox
- self.ui.activeMntGrpCB.addItem(mntGrpName)
- #make it the Active MntGrp
- self.changeActiveMntGrp(mntGrpName)
-
- def deleteMntGrp(self):
- '''creates a new Measurement Group'''
- activeMntGrpName = str(self.ui.activeMntGrpCB.currentText())
- op = Qt.QMessageBox.question(self, "Delete Measurement Group",
- "Remove the measurement group '%s'?" % activeMntGrpName,
- Qt.QMessageBox.Yes | Qt.QMessageBox.Cancel)
- if op != Qt.QMessageBox.Yes:
- return
- currentIndex = self.ui.activeMntGrpCB.currentIndex()
- if self._localConfig is None:
- return
- if activeMntGrpName not in self._localConfig['MntGrpConfigs']:
- raise KeyError('Unknown measurement group "%s"' % activeMntGrpName)
-
- #add the current measurement group to the list of "dirty" groups
- self._dirtyMntGrps.add(activeMntGrpName)
-
- self._localConfig['MntGrpConfigs'][activeMntGrpName] = None
- self.ui.activeMntGrpCB.setCurrentIndex(-1)
- self.ui.activeMntGrpCB.removeItem(currentIndex)
- self.ui.channelEditor.getQModel().setDataSource({})
- self._setDirty(True)
-
- def onCompressionCBChanged(self, idx):
- if self._localConfig is None: return
- self._localConfig['DataCompressionRank'] = idx - 1
- self._setDirty(True)
-
- def onPathLEEdited(self, text):
- self._localConfig['ScanDir'] = str(text)
- self._setDirty(True)
-
- def onFilenameLEEdited(self, text):
- self._localConfig['ScanFile'] = [v.strip() for v in str(text).split(',')]
- self._setDirty(True)
-
- def onPreScanSnapshotChanged(self, items):
- door = self.getModelObj()
- ms = door.macro_server
- preScanList = []
- for e in items:
- nfo = ms.getElementInfo(e.src)
- if nfo is None:
- preScanList.append((e.src, e.display))
- else:
- preScanList.append((nfo.full_name, nfo.name))
- self._localConfig['PreScanSnapshot'] = preScanList
- self._setDirty(True)
-
- def onPlotsButtonToggled(self, checked):
- if checked:
- from taurus.qt.qtgui.taurusgui.macrolistener import \
- DynamicPlotManager
- self.__plotManager = DynamicPlotManager(self)
- self.__plotManager.setModel(self.getModelName())
- self.connect(self, Qt.SIGNAL('experimentConfigurationChanged'),
- self.__plotManager.onExpConfChanged)
- else:
- self.disconnect(self, Qt.SIGNAL('experimentConfigurationChanged'),
- self.__plotManager.onExpConfChanged)
- self.__plotManager.removePanels()
- self.__plotManager.setModel(None)
- self.__plotManager = None
-
-
-def demo(model=None):
- """Experiment configuration"""
- #w = main_ChannelEditor()
- w = ExpDescriptionEditor()
- if model is None:
- from sardana.taurus.qt.qtgui.extra_macroexecutor import \
- TaurusMacroConfigurationDialog
- dialog = TaurusMacroConfigurationDialog(w)
- accept = dialog.exec_()
- if accept:
- model = str(dialog.doorComboBox.currentText())
- if model is not None:
- w.setModel(model)
- return w
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- app = Application(app_name="Exp. Description demo", app_version="1.0",
- org_domain="Sardana", org_name="Tango community")
-
- args = app.get_command_line_args()
- if len(args) == 1:
- w = demo(model=args[0])
- else:
- w = demo()
- w.show()
-
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/macrotree.py b/src/sardana/taurus/qt/qtgui/extra_sardana/macrotree.py
deleted file mode 100644
index f0909657..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/macrotree.py
+++ /dev/null
@@ -1,319 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a taurus text editor widget."""
-
-__all__ = ["MacroTreeWidget", "MacroSelectionDialog"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.taurusdevice import TaurusDevice
-from taurus.core.util.enumeration import Enumeration
-from taurus.external.qt import Qt
-from taurus.qt.qtcore.mimetypes import TAURUS_MODEL_MIME_TYPE, \
- TAURUS_MODEL_LIST_MIME_TYPE
-from taurus.qt.qtcore.model import TaurusBaseTreeItem, TaurusBaseModel, \
- TaurusBaseProxyModel
-from taurus.qt.qtgui.tree import TaurusBaseTreeWidget
-from taurus.qt.qtgui.resource import getIcon
-
-from sardana.taurus.core.tango.sardana.macro import MacroInfo
-
-
-MacroView = Enumeration("MacroView", ("MacroModule", "Macro", "Unknown"))
-
-def getElementTypeIcon(t):
- if t == MacroView.MacroModule:
- return getIcon(":/python-file.png")
- elif t == MacroView.Macro:
- return getIcon(":/python.png")
- return getIcon(":/tango.png")
-
-def getElementTypeSize(t):
- return Qt.QSize(200, 24)
-
-def getElementTypeToolTip(t):
- """Wrapper to prevent loading qtgui when this module is imported"""
- if t == MacroView.MacroModule:
- return "Macro module"
- elif t == MacroView.Macro:
- return "Macro item"
- return "Unknown"
-
-
-class MacroTreeBaseItem(TaurusBaseTreeItem):
- """A generic node"""
-
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- return self._itemData
-
- def role(self):
- """Returns the prefered role for the item.
- This implementation returns taurus.core.taurusbasetypes.TaurusElementType.Unknown
-
- This method should be able to return any kind of python object as long
- as the model that is used is compatible.
-
- :return: (MacroView) the role in form of element type"""
- return MacroView.Unknown
-
-
-class MacroModuleTreeItem(MacroTreeBaseItem):
-
- def role(self):
- return MacroView.MacroModule
-
- def toolTip(self, index):
- return "The macro module '%s'" % self.display()
-
- def icon(self, index):
- return getIcon(":/python-file.png")
-
-
-class MacroTreeItem(MacroTreeBaseItem):
-
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- return self._itemData.name
-
- def role(self):
- return MacroView.Macro
-
- def toolTip(self, index):
- return self._itemData.doc
-
- def icon(self, index):
- return getIcon(":/python.png")
-
-
-class MacroBaseModel(TaurusBaseModel):
-
- ColumnNames = "Macros",
- ColumnRoles = (MacroView.MacroModule, MacroView.MacroModule, MacroView.Macro),
-
- def setDataSource(self, ms):
- if self._data_src is not None:
- Qt.QObject.disconnect(self._data_src, Qt.SIGNAL('macrosUpdated'), self.macrosUpdated)
- if ms is not None:
- Qt.QObject.connect(ms, Qt.SIGNAL('macrosUpdated'), self.macrosUpdated)
- TaurusBaseModel.setDataSource(self, ms)
-
- def macrosUpdated(self):
- self.refresh()
-
- def createNewRootItem(self):
- return MacroTreeBaseItem(self, self.ColumnNames)
-
- def roleIcon(self, role):
- return getElementTypeIcon(role)
-
- def columnIcon(self, column):
- return self.roleIcon(self.role(column))
-
- def roleToolTip(self, role):
- return getElementTypeToolTip(role)
-
- def columnToolTip(self, column):
- return self.roleToolTip(self.role(column))
-
- def roleSize(self, role):
- return getElementTypeSize(role)
-
- def columnSize(self, column):
- role = self.role(column)
- s = self.roleSize(role)
- return s
-
- def mimeTypes(self):
- return ["text/plain", TAURUS_MODEL_LIST_MIME_TYPE, TAURUS_MODEL_MIME_TYPE]
-
- def mimeData(self, indexes):
- ret = Qt.QMimeData()
- data = []
- for index in indexes:
- if not index.isValid(): continue
- tree_item = index.internalPointer()
- mime_data_item = tree_item.mimeData(index)
- if mime_data_item is None:
- continue
- data.append(mime_data_item)
- ret.setData(TAURUS_MODEL_LIST_MIME_TYPE, "\r\n".join(data))
- ret.setText(", ".join(data))
- if len(data) == 1:
- ret.setData(TAURUS_MODEL_MIME_TYPE, str(data[0]))
- return ret
-
-
-
- def setupModelData(self, data):
- ms = self.dataSource()
- if ms is None:
- return
- root = self._rootItem
- macro_modules = {}
- macro_dict = ms.getMacros()
- for macro_name, macro in macro_dict.items():
- module_name = macro.module
- moduleNode = macro_modules.get(module_name)
- if moduleNode is None:
- moduleNode = MacroModuleTreeItem(self, module_name, root)
- root.appendChild(moduleNode)
- macro_modules[module_name] = moduleNode
- macroNode = MacroTreeItem(self, macro, moduleNode)
- moduleNode.appendChild(macroNode)
-
-
-class MacroModuleModel(MacroBaseModel):
- pass
-
-
-class MacroPlainMacroModel(MacroBaseModel):
-
- ColumnNames = "Macros",
- ColumnRoles = (MacroView.Macro, MacroView.Macro),
-
- def setupModelData(self, data):
- ms = self.dataSource()
- if ms is None:
- return
- root = self._rootItem
- macro_dict = ms.getMacros()
- macros = macro_dict.keys()
- macros.sort()
- self.debug("Found %d macros", len(macros))
- for macro_name in macros:
- macro = macro_dict[macro_name]
- macroNode = MacroTreeItem(self, macro, root)
- root.appendChild(macroNode)
-
-
-class MacroBaseModelProxy(TaurusBaseProxyModel):
- pass
-
-
-class MacroModuleModelProxy(MacroBaseModelProxy):
- pass
-
-
-class MacroPlainMacroModelProxy(MacroBaseModelProxy):
- pass
-
-
-class MacroTreeWidget(TaurusBaseTreeWidget):
-
- KnownPerspectives = { MacroView.MacroModule : {
- "label" : "By module",
- "icon" : ":/python-file.png",
- "tooltip" : "View by macro module",
- "model" : [MacroModuleModelProxy, MacroModuleModel],
- },
- MacroView.Macro : {
- "label" : "By macro",
- "icon" : ":/python.png",
- "tooltip" : "View by macro",
- "model" : [MacroPlainMacroModelProxy, MacroPlainMacroModel],
- }
- }
- DftPerspective = MacroView.MacroModule
-
- def getModelClass(self):
- return TaurusDevice
-
-
-class MacroSelectionDialog(Qt.QDialog):
-
- def __init__(self, parent=None, designMode=False, model_name=None, perspective=None):
- Qt.QDialog.__init__(self, parent)
-
- self.setWindowTitle("Macro Selection Dialog")
-
- layout = Qt.QVBoxLayout()
- layout.setContentsMargins(0, 0, 0, 0)
- self.setLayout(layout)
- self._panel = MacroTreeWidget(parent=self, perspective=perspective,
- designMode=designMode,
- with_navigation_bar=False)
- self._panel.setModel(model_name)
- self.setWindowIcon(getElementTypeIcon(self._panel.perspective()))
- self._buttonBox = Qt.QDialogButtonBox(self)
- bts = Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel
- self._buttonBox.setStandardButtons(bts)
- layout.addWidget(self._panel)
- layout.addWidget(self._buttonBox)
- self.connect(self._buttonBox, Qt.SIGNAL("accepted()"), self.accept)
- self.connect(self._buttonBox, Qt.SIGNAL("rejected()"), self.reject)
-
- def selectedItems(self):
- return self._panel.selectedItems()
-
- def getSelectedMacros(self):
- return [ i.itemData() for i in self.selectedItems() ]
-
-
-def main_MacroSelecionDialog(ms, perspective=MacroView.MacroModule):
- w = MacroSelectionDialog(model_name=ms, perspective=perspective)
-
- if w.result() == Qt.QDialog.Accepted:
- print w.getSelectedMacros()
- return w
-
-def main_MacroTreeWidget(ms, perspective=MacroView.MacroModule):
- w = MacroTreeWidget(perspective=perspective, with_navigation_bar=False)
- w.setModel(ms)
- w.show()
- return w
-
-def demo():
- """MacroTreeWidget"""
- w = main_MacroSelecionDialog("MS_BL98", MacroView.Macro)
- return w
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- app = Application(app_name="MacroServer macro tree demo", app_version="1.0",
- org_domain="Taurus", org_name="Tango community")
- w = demo()
- w.show()
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py b/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py
deleted file mode 100644
index 23fb8dfc..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/measurementgroup.py
+++ /dev/null
@@ -1,980 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module provides a base widget that can be used to display a taurus
-model in a table widget"""
-
-__all__ = ["MntGrpChannelEditor"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.core.taurusdevice import TaurusDevice
-from taurus.external.qt import Qt
-from taurus.qt.qtcore.model import TaurusBaseTreeItem, TaurusBaseModel
-from taurus.qt.qtgui.model import EditorToolBar
-from taurus.qt.qtgui.resource import getIcon, getThemeIcon
-from taurus.qt.qtgui.table import TaurusBaseTableWidget
-from taurus.qt.qtgui.panel import TaurusModelChooser
-from taurus.core.taurusbasetypes import TaurusElementType
-
-from sardana.taurus.core.tango.sardana import ChannelView, PlotType, \
- Normalization, AcqTriggerType
-from sardana.taurus.core.tango.sardana.pool import getChannelConfigs
-
-#===============================================================================
-# some dummydict for developing the "Experimental Configuration widget"
-# This block is to be removed and the dictionaries will be defined and
-# initialized in Sardana's Door code
-
-
-# dict <str, obj> with (at least) keys:
-# - 'timer' : the timer channel name / timer channel id
-# - 'monitor' : the monitor channel name / monitor channel id
-# - 'controllers' : dict<Controller, dict> where:
-# - key: ctrl
-# - value: dict<str, dict> with (at least) keys:
-# - 'units': dict<str, dict> with (at least) keys:
-# - 'id' : the unit ID inside the controller
-# - 'timer' : the timer channel name / timer channel id
-# - 'monitor' : the monitor channel name / monitor channel id
-# - 'trigger_type' : a value from AcqTriggerType enum
-# - 'channels' where value is a dict<str, obj> with (at least) keys:
-# - 'index' : int indicating the position of the channel in the measurement group
-# - 'id' : the channel name ( channel id )
-# optional keys:
-# - 'enabled' : True/False (default is True)
-# any hints:
-# - 'output' : True/False (default is True)
-# - 'plot_type' : a value from PlotType enum
-# - 'plot_axes' : list<str> 'where str is channel name/'step#/'index#' (default is [])
-# - 'label' : prefered label (default is channel name)
-# - 'scale' : <float, float> with min/max (defaults to channel
-# range if it is defined
-# - 'plot_color' : int representing RGB
-# optional keys:
-# - 'label' : measurement group label (defaults to measurement group name)
-# - 'description' : measurement group description
-
-
-#===============================================================================
-DEFAULT_STRING_LENGTH = 80 #just an arbitrary value to use as default string length...
-
-def createChannelDict(channel, index=None, **kwargs):
- from taurus.core.tango import FROM_TANGO_TO_STR_TYPE
- import PyTango
- import numpy
-
- if isinstance(channel, (str, unicode)):
- #@fixme: to make things uglier, I lazily assume Tango attribute namin
- dev_name, attr_name = channel.rsplit('/', 1)
- name = attr_name
- try:
- dev = PyTango.DeviceProxy(dev_name)
- db = dev.get_device_db()
- try:
- alias = db.get_alias(dev.name())
- except:
- # no alias...
- alias = dev.name()
- label = alias + "/" + attr_name
- except:
- label = channel
- full_name = channel
- source = channel
- else:
- name = channel['name']
- label = name
- full_name = channel['full_name']
- source = channel['source']
-
- ret = {
- 'name' : name,
- 'label': label,
- 'full_name': full_name,
- 'enabled': True, # bool. Whether this channel is enabled (if not enabled, it won't be used for output or plot)
- 'output': True, # bool. Whether to show output in the stdout
- 'data_type':'float64',
- 'data_units': 'No unit',
-# 'timer': '', #should contain a channel name
-# 'monitor': '', #should contain a channel name
-# 'trigger': '', #should contain a channel name
- 'conditioning': '', #this is a python expresion to be evaluated for conditioning the data. The data for this channel can be referred as 'x' and data from other channels can be referred by channel name
- 'normalization': Normalization.No, # one of the Normalization enumeration members
- 'nexus_path': '', #string indicating the location of the data of this channel within the nexus tree
- }
-
- #If the channel is a Tango one, try to guess data_type, shape and data_units
- attrproxy = attrconf = value = None
- dtype = shape = None
- try:
- attrproxy = PyTango.AttributeProxy(source)
- attrconf = attrproxy.get_config()
- # avoid trying to read for scalars. We know that their shape must be ()
- if attrconf.data_format != PyTango.AttrDataFormat.SCALAR:
- value = attrproxy.read().value
- except Exception, e:
- print str(e)
-
- if value is not None:
- shape = list(numpy.shape(value))
- dtype = getattr(value, 'dtype', numpy.dtype(type(value))).name
- ret['data_units'] = attrconf.unit
- elif attrconf is not None:
- if attrconf.data_format == PyTango.AttrDataFormat.SCALAR:
- shape = []
- else:
- shape = [n for n in (attrconf.max_dim_x, attrconf.max_dim_y) if n > 0]
- dtype = FROM_TANGO_TO_STR_TYPE[attrconf.data_type]
- ret['data_units'] = attrconf.unit
-
- if dtype is not None:
-# if dtype.startswith('str'):
-# dtype='char'
-# shape = list(shape)+[DEFAULT_STRING_LENGTH]
-# elif dtype == 'bool':
-# dtype='int8'
- ret['data_type'] = dtype
- if shape is not None:
- ret['shape'] = shape
-
- #now overwrite using the arguments
- ret.update(kwargs)
-
- #Calculate the index
- if index is not None:
- ret['index'] = index #an integer used for ordering the channel in this measurement group
-
- #Choose a default plot_type for the channel
- if 'plot_type' not in ret:
- default_plot_type = {0:PlotType.Spectrum, 2:PlotType.Image, None:PlotType.No}
- try: rank = len(ret['shape'])
- except KeyError:
- rank = None #if shape is not known, use the default plot_type
- ret['plot_type'] = default_plot_type.get(rank, PlotType.No)
-
- #And a default value for plot_axes
- if 'plot_axes' not in ret:
- default_axes = {PlotType.No:[], PlotType.Spectrum:['<mov>'], PlotType.Image:['<idx>', '<idx>']}
- ret['plot_axes'] = default_axes[ret['plot_type']] # a string defining a colon-separated list of axis names. An axis can be a channel name or "<idx>". This shares the syntax of the NeXus @axes attribute
-
- return ret
-
-
-
-def getElementTypeIcon(t):
- if t == ChannelView.Channel:
- return getIcon(":/actions/system-shutdown.svg")
- elif t == ChannelView.Enabled:
- return getIcon(":/status/true.svg")
- elif t == ChannelView.Output:
- return getThemeIcon("utilities-terminal")
- elif t == ChannelView.PlotType:
- return getIcon(":/apps/utilities-system-monitor.svg")
- elif t == ChannelView.PlotAxes:
- return getIcon(":/apps/utilities-system-monitor.svg")
- elif t == ChannelView.Timer:
- return getIcon(":/status/flag-green-clock.svg")
- elif t == ChannelView.Monitor:
- return getIcon(":/status/flag-green.svg")
- elif t == ChannelView.Trigger:
- return getIcon(":/actions/system-shutdown.svg")
- elif t == ChannelView.NXPath:
- return getThemeIcon("document-save-as")
-
- return getIcon(":/tango.png")
-
-
-def getElementTypeSize(t):
- if t == ChannelView.Channel:
- return Qt.QSize(200, 24)
- elif t == ChannelView.Enabled:
- return Qt.QSize(50, 24)
- elif t == ChannelView.Output:
- return Qt.QSize(50, 24)
- elif t == ChannelView.PlotType:
- return Qt.QSize(50, 24)
- return Qt.QSize(50, 24)
-
-
-def getElementTypeToolTip(t):
- """Wrapper to prevent loading qtgui when this module is imported"""
- if t == ChannelView.Channel:
- return "Channel"
- elif t == ChannelView.Enabled:
- return "Channel active or not"
- elif t == ChannelView.Output:
- return "Channel output active or not"
- elif t == ChannelView.Shape:
- return "Shape of the data (using numpy convention). For example, a scalar will have shape=(), a spectrum of 10 elements will have shape=(10,) and an image of 20x30 will be shape=(20,30)"
- elif t == ChannelView.DataType:
- return "Type of data for storing (valid types are: char, float32, float64, [u]int{8|16|32|64})",
- elif t == ChannelView.PlotType:
- return "Plot type for this channel "
- elif t == ChannelView.PlotAxes:
- return "Independent variables to be used in the plot of this channel"
- elif t == ChannelView.Timer:
- return "The channel to be used as the timer"
- elif t == ChannelView.Monitor:
- return "The channel to be used as a monitor for stopping the acquisition"
- elif t == ChannelView.Trigger:
- return "The channel to be used for triggering the acquisition"
- elif t == ChannelView.Conditioning:
- return "An expression to evaluate on the data when displaying it"
- elif t == ChannelView.Normalization:
- return "Normalization mode for the data"
- elif t == ChannelView.NXPath:
- return "Location of the data of this channel within the NeXus tree"
- return "Unknown"
-
-
-class BaseMntGrpChannelItem(TaurusBaseTreeItem):
- """ """
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- return self._itemData
-
- def role(self):
- """Returns the prefered role for the item.
- This implementation returns ChannelView.Unknown
-
- This method should be able to return any kind of python object as long
- as the model that is used is compatible.
-
- :return: (MacroView) the role in form of element type"""
- return ChannelView.Unknown
-
-
-class MntGrpChannelItem(BaseMntGrpChannelItem):
-
- itemdata_keys_map = {ChannelView.Channel:'label',
- ChannelView.Enabled:'enabled',
- ChannelView.Output:'output',
- ChannelView.Shape:'shape',
- ChannelView.DataType:'data_type',
- ChannelView.PlotType:'plot_type',
- ChannelView.PlotAxes:'plot_axes',
-# ChannelView.Timer:'timer',
-# ChannelView.Monitor:'monitor',
-# ChannelView.Trigger:'trigger',
- ChannelView.Conditioning:'conditioning',
- ChannelView.Normalization:'normalization',
- ChannelView.NXPath:'nexus_path'
- }
-
- def data(self, index):
- """Returns the data of this node for the given index
-
- :return: (object) the data for the given index
- """
- taurus_role = index.model().role(index.column())
- ch_name, ch_data = self.itemData()
- key = self.itemdata_keys_map[taurus_role]
- ret = ch_data[key]
- if taurus_role == ChannelView.PlotType:
- ret = PlotType[ret]
- elif taurus_role == ChannelView.Normalization:
- ret = Normalization[ret]
- elif taurus_role == ChannelView.PlotAxes:
- ret = ":".join(ret)
- elif taurus_role == ChannelView.Shape:
- ret = str(ret)
- return ret
-
- def setData(self, index, qvalue):
- taurus_role = index.model().role(index.column())
- str_value = Qt.from_qvariant(qvalue, str)
- if taurus_role in (ChannelView.Channel, ChannelView.Conditioning,
- ChannelView.NXPath, ChannelView.DataType) :
- data = str_value
- elif taurus_role in (ChannelView.Enabled, ChannelView.Output) :
- data = Qt.from_qvariant(qvalue, bool)
- elif taurus_role == ChannelView.PlotType:
- data = PlotType[str_value]
- elif taurus_role == ChannelView.Normalization:
- data = Normalization[str_value]
- elif taurus_role == ChannelView.PlotAxes:
- data = [a for a in str_value.split(':')]
- elif taurus_role == ChannelView.Shape:
- s = str_value
- try:
- data = eval(s, {}, {})
- if not isinstance(data, (tuple, list)):
- raise ValueError
- except:
- from taurus.core.util.log import Logger
- Logger(self.__class__.__name__).error('Invalid shape %s', s)
- data = ()
- else:
- raise NotImplementedError('Unknown role')
- ch_name, ch_data = self.itemData()
- key = self.itemdata_keys_map[taurus_role]
- ch_data[key] = data
-
- def role(self):
- return ChannelView.Channel
-
- def toolTip(self, index):
- return "Channel " + self._itemData[0]
-
- def icon(self, index):
- taurus_role = index.model().role(index.column())
- if taurus_role == ChannelView.Channel:
- return getIcon(":/actions/system-shutdown.svg")
-
-
-class MntGrpUnitItem(TaurusBaseTreeItem):
- pass
-
-
-class BaseMntGrpChannelModel(TaurusBaseModel):
- ColumnNames = ("Channel", "enabled", "output", "Shape", "Data Type", "Plot Type", "Plot Axes", "Timer",
- "Monitor", "Trigger", "Conditioning", "Normalization", "NeXus Path")
- ColumnRoles = ((ChannelView.Channel, ChannelView.Channel), ChannelView.Enabled,
- ChannelView.Output, ChannelView.Shape, ChannelView.DataType, ChannelView.PlotType,
- ChannelView.PlotAxes, ChannelView.Timer, ChannelView.Monitor,
- ChannelView.Trigger, ChannelView.Conditioning,
- ChannelView.Normalization, ChannelView.NXPath)
- DftFont = Qt.QFont()
-
- _availableChannels = {}
- data_keys_map = {ChannelView.Timer:'timer',
- ChannelView.Monitor:'monitor',
- ChannelView.Trigger:'trigger_type',
- }
-
- def __init__(self, parent=None, data=None):
- TaurusBaseModel.__init__(self, parent=parent, data=data)
- self._mgconfig = None
- self._dirty = False
-
- def setAvailableChannels(self, cdict):
- self._availableChannels = cdict
-
- def getAvailableChannels(self):
- return self._availableChannels
-
- def createNewRootItem(self):
- return BaseMntGrpChannelItem(self, self.ColumnNames)
-
- def roleIcon(self, taurus_role):
- return getElementTypeIcon(taurus_role)
-
- def roleSize(self, taurus_role):
- return getElementTypeSize(taurus_role)
-
- def roleToolTip(self, taurus_role):
- return getElementTypeToolTip(taurus_role)
-
- def getPyData(self, ctrlname=None, unitid=None, chname=None, key=None):
- '''
- If controller name, unitid and channel name are given, it returns the dictionary with the channel info.
- If only controller name and unit id are given, it returns the dictionary with the unit info.
- If only controller name is given, it returns the dictionary with the controller info.
-
- Note that it will raise a KeyError exception if any of the keys are not
- found or if chname is given without providing the unit id
- '''
- if ctrlname is None:
- raise ValueError('controller name must be passed')
- if unitid is None:
- return self._mgconfig['controllers'][ctrlname]
- elif chname is None:
- return self._mgconfig['controllers'][ctrlname]['units'][unitid]
- else:
- return self._mgconfig['controllers'][ctrlname]['units'][unitid]['channels'][chname]
-
- def setupModelData(self, mgconfig):
- if mgconfig is None:
- return
- root = self._rootItem #@The root could eventually be changed for each unit or controller
- channelNodes = [MntGrpChannelItem(self, chcfg, root) for chcfg in getChannelConfigs(mgconfig)]
- for ch in channelNodes:
- root.appendChild(ch)
- self.updateMntGrpChannelIndex(root=root)
- #store the whole config object for accessing the info that is not at the channel level
- self._mgconfig = mgconfig
-
- def setDataSource(self, data_src):
- self._dirty = False
- TaurusBaseModel.setDataSource(self, data_src)
-
- def updateMntGrpChannelIndex(self, root=None):
- '''
- assigns the MeasurementGroup index (the internal order in the MG)
- according to the order in the QModel
- '''
- if root is None:
- root = self._rootItem
- for row in range(root.childCount()):
- chname, chdata = root.child(row).itemData()
- chdata['index'] = row
-
- def flags(self, index):
- flags = TaurusBaseModel.flags(self, index)
- taurus_role = self.role(index.column())
- if taurus_role == ChannelView.Channel: #channel column is not editable
- return flags
- elif taurus_role == ChannelView.Trigger:
- ch_name, ch_data = index.internalPointer().itemData()
- if not ch_data['_controller_name'].startswith("__"):
- ch_info = self.getAvailableChannels()[ch_name]
- #only timer/monitor columns of counter timers are editable
- if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- flags |= Qt.Qt.ItemIsEditable
- elif taurus_role in (ChannelView.Timer, ChannelView.Monitor):
- ch_name, ch_data = index.internalPointer().itemData()
- if not ch_data['_controller_name'].startswith("__"):
- #ch_info = self.getAvailableChannels()[ch_name]
- #if 'CTExpChannel' == ch_info['type']: #only timer/monitor columns of counter timers are editable
- # flags |= Qt.Qt.ItemIsEditable
- flags |= Qt.Qt.ItemIsEditable
- else:
- flags |= Qt.Qt.ItemIsEditable
- return flags
-
- def data(self, index, role=Qt.Qt.DisplayRole):
- """Reimplemented from :meth:`TaurusBaseModel.data`
-
- :return: (object) the data for the given index
- """
- #Try with the normal TaurusBaseModel item-oriented approach
- try:
- return TaurusBaseModel.data(self, index, role=role)
- except:
- pass
- #For those things which are inter-item, we handle them here
- taurus_role = self.role(index.column())
- if taurus_role == ChannelView.Trigger:
- ch_name, ch_data = index.internalPointer().itemData()
- unitdict = self.getPyData(ctrlname=ch_data['_controller_name'], unitid=ch_data['_unit_id'])
- key = self.data_keys_map[taurus_role]
- return Qt.QVariant(AcqTriggerType[unitdict.get(key, None)])
- elif taurus_role in (ChannelView.Timer, ChannelView.Monitor):
- ch_name, ch_data = index.internalPointer().itemData()
- ctrlname = ch_data['_controller_name']
- if ctrlname.startswith("__"):
- return Qt.QVariant()
- ch_info = self.getAvailableChannels()[ch_name]
- if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- unitdict = self.getPyData(ctrlname=ctrlname, unitid=ch_data['_unit_id'])
- key = self.data_keys_map[taurus_role]
- master_full_name = unitdict.get(key, None)
- else:
- key = taurus_role == ChannelView.Timer and 'timer' or 'monitor'
- master_full_name = self._mgconfig.get(key, None)
- if master_full_name is None:
- return Qt.QVariant()
- else:
- master_info = self.getAvailableChannels()[master_full_name]
- return Qt.QVariant(master_info['name'])
-
- return Qt.QVariant()
-
- def setData(self, index, qvalue, role=Qt.Qt.EditRole):
- #For those things which are at the unit level, we handle them here
- taurus_role = self.role(index.column())
- if taurus_role in (ChannelView.Timer, ChannelView.Monitor, ChannelView.Trigger):
- ch_name, ch_data = index.internalPointer().itemData()
- ch_info = self.getAvailableChannels()[ch_name]
- unit_data = self.getPyData(ctrlname=ch_data['_controller_name'], unitid=ch_data['_unit_id'])
- key = self.data_keys_map[taurus_role]
- data = Qt.from_qvariant(qvalue, str)
-
- self._dirty = True
- self.beginResetModel()
- is_settable = ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel')
- if taurus_role == ChannelView.Trigger:
- data = AcqTriggerType[data]
- if is_settable:
- unit_data[key] = data
- else:
- if is_settable:
- if unit_data[key] == self._mgconfig[key]:
- self._mgconfig[key] = data
- unit_data[key] = data
- else:
- self._mgconfig[key] = data
- self.endResetModel()
- return True
- #for the rest, we use the regular TaurusBaseModel item-oriented approach
- #ret = self._setData(index, qvalue, role) #@todo we do not use _setData because it is not Qt4.4-compatible
- item = index.internalPointer()
- item.setData(index, qvalue)
- self._dirty = True
- self.emit(Qt.SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"),
- index, index)
- return True
-
- def addChannel(self, chname=None, chinfo=None, ctrlname=None, unitname=None, external=False): #@todo: Very inefficient implementation. We should use {begin|end}InsertRows
-
- if chname is None:
- chname = chinfo['full_name']
- chname = str(chname)
- if ctrlname is None:
- desc = self.getAvailableChannels()[chname]
- ctrlname = desc['controller']
- if unitname is None:
- desc = self.getAvailableChannels()[chname]
- unitname = desc.get('unit', '0') #@fixme: at the moment of writing, the unit info cannot be obtained from desc
-
- #update the internal data
- self.beginResetModel() #we are altering the internal data here, so we need to protect it
- ctrlsdict = self.dataSource()['controllers']
- if not ctrlsdict.has_key(ctrlname): ctrlsdict[ctrlname] = {'units':{}}
- unitsdict = ctrlsdict[ctrlname]['units']
- if not unitsdict.has_key(unitname):
- unitsdict[unitname] = unit = {'channels':{}}
- if not external and chinfo['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- unit['timer'] = chname
- unit['monitor'] = chname
- unit['trigger_type'] = AcqTriggerType.Software
- channelsdict = unitsdict[unitname]['channels']
- if channelsdict.has_key(chname):
- self.error('Channel "%s" is already in the measurement group. It will not be added again' % chname)
- return
-
- self._dirty = True
- if external:
- channelsdict[chname] = createChannelDict(chname)
- else:
- channelsdict[chname] = createChannelDict(chinfo)
- self.endResetModel() #we are altering the internal data here, so we need to protect it
- self.refresh() #note that another reset will be done here...
-
- #import pprint
- #pprint.pprint(self.dataSource())
-
- def removeChannels(self, chnames): #@todo: Very inefficient implementation. We should use {begin|end}InsertRows
- #update the internal data
- self._dirty = True
- self.beginResetModel() #we are altering the internal data here, so we need to protect it
- for chname in chnames:
- avail_channels = self.getAvailableChannels()
- if chname in avail_channels:
- desc = self.getAvailableChannels()[chname]
- ctrlname = desc['controller']
- unitname = desc.get('unit', '0') #@fixme: at the moment of writing, the unit info cannot be obtained from desc
- else:
- #@todo: This assumes that if it is not in the list of avail_channels, it must be an external tango channel
- ctrlname = '__tango__'
- unitname = '0'
- try:
- self.dataSource()['controllers'][ctrlname]['units'][unitname]['channels'].pop(chname)
- try:
- if not self.dataSource()['controllers'][ctrlname]['units'][unitname]['channels']:
- self.dataSource()['controllers'][ctrlname]['units'].pop(unitname)
- if not self.dataSource()['controllers'][ctrlname]['units']:
- self.dataSource()['controllers'].pop(ctrlname)
- except:
- self.error('error cleaning the data source dictionary')
- except:
- self.error('cannot find "%s" for removing' % chname)
-
- self.endResetModel() #we are altering the internal data here, so we need to protect it
- self.refresh() #note that another reset will be done here...
-
- def swapChannels(self, root, row1, row2): #@todo: Very inefficient implementation. We should use {begin|end}MoveRows
- self._dirty = True
- n1, d1 = root.child(row1).itemData()
- n2, d2 = root.child(row2).itemData()
- d1['index'], d2['index'] = d2['index'], d1['index']
- self.debug("swapping %s with %s" % (n1, n2))
- self.refresh()
-
- def isDataChanged(self):
- return self._dirty
-
- def setDataChanged(self, datachanged):
- self._dirty = datachanged
-
-class MntGrpChannelModel(BaseMntGrpChannelModel):
- '''A BaseMntGrpChannelModel that communicates with a MntGrp device for setting and reading the configuration
- '''
-
- def setDataSource(self, mg):
- if self._data_src is not None:
- Qt.QObject.disconnect(self._data_src, Qt.SIGNAL('configurationChanged'), self.configurationChanged)
- if mg is not None:
- Qt.QObject.connect(mg, Qt.SIGNAL('configurationChanged'), self.configurationChanged)
- BaseMntGrpChannelModel.setDataSource(self, mg)
-
- def configurationChanged(self):
- self.refresh()
-
- def setupModelData(self, mg):
- if mg is None:
- return
- BaseMntGrpChannelModel.setupModelData(self, self.getSourceData())
-
- def writeSourceData(self):
- mg = self.dataSource()
- if mg is not None and self._mgconfig is not None:
- mg.setConfiguration(self._mgconfig)
-
- def getSourceData(self):
- """Gets data from the dataSource"""
- mg = self.dataSource()
- if mg is not None:
- return mg.getConfiguration()
-
- def getLocalData(self):
- """Gets the local data (may be different from the one in the data source
- since it may have been modified by the user)"""
- return self._mgconfig
-
-
-class AxesSelector(Qt.QWidget):
- def __init__(self, parent, n=0, choices=None):
- '''Shows n comboboxes populated with choices. If n is 0, it just shows a LineEdit instead'''
- Qt.QWidget.__init__(self, parent)
- self._n = n
- self._CBs = []
- self._LE = None
- l = Qt.QHBoxLayout(self)
- if self._n == 0:
- self._LE = Qt.QLineEdit()
- l.addWidget(self._LE)
- else:
- for i in range(n):
- cb = Qt.QComboBox()
- l.addWidget(cb)
- self._CBs.append(cb)
- if choices is not None:
- self.setChoices(choices)
-
- def setChoices(self, choices):
- for cb in self._CBs:
- cb.addItems(choices)
-
- def text(self):
- return ":".join(self.getCurrentChoices())
-
- def getCurrentChoices(self):
- if self._LE is None:
- return [str(cb.currentText()) for cb in self._CBs]
- else:
- return [str(self._LE.text())]
-
- def setCurrentChoices(self, choice):
- if self._LE is None:
- texts = str(choice).split(':')
- for t, cb in zip(texts[:len(self._CBs)], self._CBs):
- cb.setCurrentIndex(max(0, cb.findText(t)))
- else:
- self._LE.setText(str(choice))
-
-
-class ChannelDelegate(Qt.QStyledItemDelegate):
- def createEditor(self, parent, option, index):
- model = index.model()
- taurus_role = model.role(index.column())
- if taurus_role in (ChannelView.Channel, ChannelView.PlotType, ChannelView.Normalization,
- ChannelView.Timer, ChannelView.Monitor, ChannelView.Trigger):
- ret = Qt.QComboBox(parent)
- elif taurus_role == ChannelView.PlotAxes:
- item = index.internalPointer()
- ptype = item.itemData()[1]['plot_type']
- if ptype == PlotType.Spectrum:
- n = 1
- elif ptype == PlotType.Image:
- n = 2
- else:
- return None
- ret = AxesSelector(parent, n=n)
- else:
- ret = Qt.QStyledItemDelegate.createEditor(self, parent, option, index)
- ret.setAutoFillBackground(True)
- return ret
-
- def setEditorData(self, editor, index):
- model = index.model()
- dataSource = model.dataSource()
- taurus_role = model.role(index.column())
- if taurus_role == ChannelView.PlotType:
- editor.addItems(PlotType.keys())
- current = Qt.from_qvariant(model.data(index), str)
- editor.setCurrentIndex(editor.findText(current))
- elif taurus_role == ChannelView.Normalization:
- editor.addItems(Normalization.keys())
- current = Qt.from_qvariant(model.data(index), str)
- editor.setCurrentIndex(editor.findText(current))
- elif taurus_role in (ChannelView.Timer, ChannelView.Monitor):
- key = taurus_role == ChannelView.Timer and 'timer' or 'monitor'
- ch_name, ch_data = index.internalPointer().itemData()
- ctrl_filterlist = [ch_data['_controller_name']]
- ctrl_dict = getChannelConfigs(dataSource, ctrls=ctrl_filterlist)
- all_channels = model.getAvailableChannels()
- # if it is a timer capable type of element
- if all_channels[ch_name]['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- for full_name, channel_data in ctrl_dict:
- editor.addItem(channel_data['name'], Qt.QVariant(full_name))
- current = Qt.from_qvariant(model.data(index), str)
- editor.setCurrentIndex(editor.findText(current))
- else:
- for ctrl_data in dataSource['controllers'].values():
- for unit_data in ctrl_data['units'].values():
- if key in unit_data:
- channel = all_channels[unit_data[key]]
- editor.addItem(channel['name'], Qt.QVariant(channel['full_name']))
- current = dataSource.get(key) # current global timer/monitor
- editor.setCurrentIndex(editor.findData(Qt.QVariant(current)))
- elif taurus_role == ChannelView.Trigger:
- editor.addItems(AcqTriggerType.keys())
- current = Qt.from_qvariant(model.data(index), str)
- editor.setCurrentIndex(editor.findText(current))
- elif taurus_role == ChannelView.PlotAxes:
- selectables = ['<idx>', '<mov>'] + [n for n, d in getChannelConfigs(dataSource)]
- editor.setChoices(selectables)
- current = Qt.from_qvariant(model.data(index), str)
- editor.setCurrentChoices(current)
- else:
- Qt.QStyledItemDelegate.setEditorData(self, editor, index)
-
- def setModelData(self, editor, model, index):
- taurus_role = model.role(index.column())
- dataSource = model.dataSource()
- if taurus_role in (ChannelView.Channel, ChannelView.PlotType, ChannelView.Normalization):
- data = Qt.QVariant(editor.currentText())
- model.setData(index, data)
- elif taurus_role == ChannelView.Trigger:
- old_value = Qt.from_qvariant(model.data(index), str)
- new_value = str(editor.currentText())
- if new_value == old_value:
- return
- ch_name, ch_data = index.internalPointer().itemData()
- channels = getChannelConfigs(dataSource, ctrls=[ch_data['_controller_name']], units=[ch_data['_unit_id']])
- affected = [d['name'] for n, d in channels]
- if len(affected) > 1:
- op = Qt.QMessageBox.question(editor, "Caution: multiple channels affected",
- "This change will also affect the following channels:\n- %s \nContinue?" % "\n- ".join(affected),
- Qt.QMessageBox.Yes | Qt.QMessageBox.Cancel)
- if op != Qt.QMessageBox.Yes:
- return
- data = Qt.QVariant(new_value)
- model.setData(index, data)
- elif taurus_role in (ChannelView.Timer, ChannelView.Monitor):
- key = taurus_role == ChannelView.Timer and 'timer' or 'monitor'
- old_value = Qt.from_qvariant(model.data(index), str)
- new_value = str(editor.currentText())
- if new_value == old_value:
- return
- ch_name, ch_data = index.internalPointer().itemData()
- all_channels = model.getAvailableChannels()
- # if it is a timer capable type of element
- ch_info = all_channels[ch_name]
- selected_master = editor.itemData(editor.currentIndex())
- if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- affected = []
- unit_data = model.getPyData(ctrlname=ch_data['_controller_name'], unitid=ch_data['_unit_id'])
- channels = getChannelConfigs(dataSource, ctrls=[ch_data['_controller_name']], units=[ch_data['_unit_id']])
- for n, d in channels:
- affected.append(d['name'])
- # if old timer/monitor was also the global, then non
- # timerable/monitorable channels must be changed
- if unit_data[key] == dataSource.get(key):
- for n, d in getChannelConfigs(dataSource):
- if d['_controller_name'].startswith("__"):
- continue
- ch_info = all_channels[n]
- if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- continue
- affected.append(d['name'])
-
- if len(affected) > 1:
- op = Qt.QMessageBox.question(editor, "Caution: multiple channels affected",
- "This change will also affect the following channels:\n- %s \nContinue?" % "\n- ".join(affected),
- Qt.QMessageBox.Yes | Qt.QMessageBox.Cancel)
- if op != Qt.QMessageBox.Yes:
- return
- else:
- affected = []
- channels = getChannelConfigs(dataSource)
- for n, d in channels:
- if d['_controller_name'].startswith("__"):
- continue
- ch_info = all_channels[n]
- if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
- continue
- affected.append(d['name'])
- if len(affected) > 1:
- op = Qt.QMessageBox.question(editor, "Caution: multiple channels affected",
- "This change will also affect the following channels:\n- %s \nContinue?" % "\n- ".join(affected),
- Qt.QMessageBox.Yes | Qt.QMessageBox.Cancel)
- if op != Qt.QMessageBox.Yes:
- return
- model.setData(index, selected_master)
- elif taurus_role == ChannelView.PlotAxes:
- data = Qt.QVariant(editor.text())
- model.setData(index, data)
- else:
- Qt.QStyledItemDelegate.setModelData(self, editor, model, index)
-
-
-class MntGrpChannelEditor(TaurusBaseTableWidget):
- """
- """
-
- KnownPerspectives = {
- "Channel" : {
- "label" : "Channels",
- "icon" : ":/actions/system-shutdown.svg",
- "tooltip" : "View by channel",
- "model" : [BaseMntGrpChannelModel, ],
- },
- }
-
- DftPerspective = "Channel"
- _simpleViewColumns = (ChannelView.Channel, ChannelView.Output, ChannelView.Shape, ChannelView.PlotType, ChannelView.PlotAxes)
- _simpleView = False
-
- def __init__(self, parent=None, designMode=False, with_filter_widget=True, perspective=None):
- TaurusBaseTableWidget.__init__(self, parent=parent, designMode=designMode,
- with_filter_widget=with_filter_widget,
- perspective=perspective, proxy=None)
- self.setContextMenuPolicy(Qt.Qt.ActionsContextMenu)
- self._simpleViewAction = Qt.QAction("Simple View", self)
- self._simpleViewAction.setCheckable(True)
- self.connect(self._simpleViewAction, Qt.SIGNAL("toggled(bool)"), self.setSimpleView)
- self.addAction(self._simpleViewAction)
- self.registerConfigProperty(self.isSimpleView, self.setSimpleView, "simpleView")
-
- def isSimpleView(self):
- return self._simpleView
-
- def setSimpleView(self, simpleview):
- if simpleview == self.isSimpleView():
- return
- columnRoles = list(self.getQModel().ColumnRoles)
- columnRoles[0] = columnRoles[0][-1] #account for the fact that the first element is a tuple instead of a role
- columnIndexes = [columnRoles.index(r) for r in self._simpleViewColumns]
- for i in range(self.getQModel().columnCount()):
- hide = simpleview and (i not in columnIndexes)
- self.tableView().setColumnHidden(i, hide)
- self._simpleView = simpleview
- self._simpleViewAction.setChecked(simpleview)
-
- def resetSimpleView(self):
- self.setSimpleView(False)
-
- def createViewWidget(self):
- tableView = TaurusBaseTableWidget.createViewWidget(self)
- self._delegate = ChannelDelegate(self)
- #self._delegate.setItemEditorFactory(Qt.QItemEditorFactory()) #This causes a segfault when calling ChannelDelegate.createEditor
- tableView.setItemDelegate(self._delegate)
- tableView.setSortingEnabled(False)
- self.connect(self._editorBar, Qt.SIGNAL("addTriggered"), self.addChannel)
- self.connect(self._editorBar, Qt.SIGNAL("removeTriggered"), self.removeChannels)
- self.connect(self._editorBar, Qt.SIGNAL("moveUpTriggered"), self.moveUpChannel)
- self.connect(self._editorBar, Qt.SIGNAL("moveDownTriggered"), self.moveDownChannel)
- return tableView
-
- def createToolArea(self):
- ta = TaurusBaseTableWidget.createToolArea(self)
- e_bar = self._editorBar = EditorToolBar(self, self)
- ta.append(e_bar)
- return ta
-
- def getModelClass(self):
- return TaurusDevice
-
- def addChannel(self, channel=None):
- qmodel = self.getQModel()
- dataSource = qmodel.dataSource()
- if channel is None:
- shown = [n for n, d in getChannelConfigs(dataSource)]
- avail_channels = qmodel.getAvailableChannels()
- clist = [ ch_info['name'] for ch_name, ch_info in avail_channels.items()
- if ch_name not in shown ]
- clist = sorted(clist) + ['(Other...)']
- chname, ok = Qt.QInputDialog.getItem(self, "New Channel", "Choose channel:", clist, 0, False)
- if not ok:
- return
- chname = str(chname)
- if chname == '(Other...)':
- models, ok = TaurusModelChooser.modelChooserDlg(parent=self, singleModel=False, windowTitle='Choose source of data',
- selectables=[TaurusElementType.Attribute])
- if not ok:
- return
- for m in models:
- qmodel.addChannel(chname=m, ctrlname='__tango__', unitname='0', external=True)
- else:
- for ch_info in avail_channels.values():
- if ch_info['name'] == chname:
- qmodel.addChannel(chinfo=ch_info)
-
- def removeChannels(self, channels=None):
- if channels is None:
- channels = self.selectedItems()
- chnames = [ch.itemData()[0] for ch in channels]
- self.getQModel().removeChannels(chnames)
-
- def moveUpChannel(self, channel=None):
- if channel is None:
- channels = self.selectedItems()
- if len(channels) != 1:
- return
- channel = channels[0]
- parent = channel.parent()
- row = channel.row()
- if row < 1:
- return
-
- model = self.getQModel()
- model.swapChannels(parent, row, row - 1)
- idx = model.index(row - 1, 0)
- self.viewWidget().setCurrentIndex(idx)
-
- def moveDownChannel(self, channel=None):
- if channel is None:
- channels = self.selectedItems()
- if len(channels) != 1:
- return
- channel = channels[0]
- parent = channel.parent()
- row = channel.row()
- if row >= parent.childCount() - 1:
- return
- model = self.getQModel()
- self.getQModel().swapChannels(parent, row, row + 1)
- idx = model.index(row + 1, 0)
- self.viewWidget().setCurrentIndex(idx)
-
- def getLocalConfig(self):
- return self.getQModel().getLocalData()
-
- @classmethod
- def getQtDesignerPluginInfo(cls):
- ret = TaurusBaseTableWidget.getQtDesignerPluginInfo()
- ret['module'] = 'taurus.qt.qtgui.extra_sardana'
- ret['group'] = 'Taurus Sardana'
- ret['icon'] = ":/designer/table.png"
- return ret
-
- simpleView = Qt.pyqtProperty("bool", isSimpleView, setSimpleView, resetSimpleView)
-
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/sardanabasewizard.py b/src/sardana/taurus/qt/qtgui/extra_sardana/sardanabasewizard.py
deleted file mode 100644
index 3fb402a8..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/sardanabasewizard.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains sardana base wizard classes."""
-
-__all__ = ["SardanaBaseWizard"]
-
-__docformat__ = 'restructuredtext'
-
-from taurus.external.qt import Qt
-
-
-class SardanaBasePage(Qt.QWizardPage):
-
- def __init__(self, parent=None):
- Qt.QWizardPage.__init__(self, parent)
- self._item_funcs = {}
-
- def __setitem__(self, name, value):
- self._item_funcs[name] = value
-
- def __getitem__(self, name):
- return self._item_funcs[name]
-
- def getPanelWidget(self):
- return self._panel
-
-
-class SardanaBaseWizard(Qt.QWizard):
-
- def __init__(self, parent=None):
- Qt.QWizard.__init__(self, parent)
- self._item_funcs = {}
- self._pages = {}
-
- def __setitem__(self, name, value):
- self._item_funcs[name] = value
-
- def __getitem__(self, name):
- for id in self.getPages():
- p = self.page(id)
- if isinstance(p, SardanaBasePage):
- try:
- return p[name]()
- except Exception, e:
- pass
- return self._item_funcs[name]()
- return None
-
- def addPage(self, page):
- id = Qt.QWizard.addPage(self, page)
- self._pages[id] = page
-
- def setPage(self, id, page):
- Qt.QWizard.setPage(self, id, page)
- self._pages[id] = page
-
- def getPages(self):
- return self._pages
-
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/sardanaeditor.py b/src/sardana/taurus/qt/qtgui/extra_sardana/sardanaeditor.py
deleted file mode 100644
index c03e6905..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/sardanaeditor.py
+++ /dev/null
@@ -1,557 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains a taurus text editor widget."""
-
-__all__ = ["SardanaEditor"]
-
-__docformat__ = 'restructuredtext'
-
-import os
-import os.path as osp
-import tempfile
-import shutil
-import functools
-
-from taurus.external.qt import Qt
-
-from taurus.qt.qtgui.base import TaurusBaseWidget
-from taurus.qt.qtgui.editor import TaurusBaseEditor
-from taurus.qt.qtgui.util import ActionFactory
-from taurus.qt.qtgui.dialog import ProtectTaurusMessageBox
-from macrotree import MacroSelectionDialog
-from elementtree import SardanaElementTreeWidget
-
-from sardana.taurus.qt.qtcore.tango.sardana.model import SardanaBaseProxyModel, \
- SardanaElementTypeModel, SardanaTypeTreeItem, SardanaRootTreeItem
-
-from sardanabasewizard import SardanaBaseWizard, SardanaBasePage
-
-_MACRO_LIB_TEMPLATE = """#!/usr/bin/env python
-{copyright}
-# don't forget to place every new macro here!
-__all__ = []
-
-__docformat__ = 'restructuredtext'
-
-{non_sardana_imports}
-from sardana.macroserver.macro import macro, Macro, Type
-{sardana_imports}
-# Place your code here!
-
-"""
-
-_MACRO_CLASS_TEMPLATE = """
-
-class {macro_name}(Macro):
- \"\"\"{macro_name} description.\"\"\"
-
- # uncomment the following lines as necessary. Otherwise you may delete them
- #param_def = []
- #result_def = []
- #hints = {}
- #env = (,)
-
- # uncomment the following lines if need prepare. Otherwise you may delete them
- #def prepare(self):
- # pass
-
- def run(self):
- pass
-
-"""
-
-_MACRO_FUNCTION_TEMPLATE = """
-
-@macro()
-def {macro_name}(self):
- self.output("Running {macro_name}...")
-
-"""
-
-class NewElementWizard(SardanaBaseWizard):
- pass
-
-
-class ChooseElementTypePage(SardanaBasePage):
-
- def __init__(self, parent=None):
- SardanaBasePage.__init__(self, parent)
-
- self.setTitle('Please select type of element you wish to create')
- layout = Qt.QVBoxLayout()
- self.setLayout(layout)
-
-
-class SardanaLibProxyModel(SardanaBaseProxyModel):
-
- ALLOWED_TYPES = 'MacroLibrary', #'ControllerLibrary',
-
- def filterAcceptsRow(self, sourceRow, sourceParent):
- sourceModel = self.sourceModel()
- idx = sourceModel.index(sourceRow, 0, sourceParent)
- treeItem = idx.internalPointer()
-
- if isinstance(treeItem, SardanaRootTreeItem):
- return True
- if isinstance(treeItem, SardanaTypeTreeItem):
- return treeItem.itemData() in self.ALLOWED_TYPES
- return True
-
-
-class SardanaLibTreeWidget(SardanaElementTreeWidget):
-
- KnownPerspectives = { "Type" : {
- "label" : "By lib",
- "icon" : ":/python-package.png",
- "tooltip" : "View elements by library",
- "model" : [SardanaLibProxyModel, SardanaElementTypeModel],
- },
- }
- DftPerspective = "Type"
-
-
-class SardanaEditor(TaurusBaseEditor, TaurusBaseWidget):
-
- def __init__(self, parent=None, designMode=None):
- name = self.__class__.__name__
- self._base_tmp_dir = None
- self._tmp_dir = None
- self._is_filesystem_prepared = False
- self.call__init__wo_kw(TaurusBaseEditor, parent)
- self.call__init__(TaurusBaseWidget, name, designMode=designMode)
- self._elementTree = elementTree = \
- SardanaLibTreeWidget(self, with_navigation_bar=False,
- with_filter_widget=False,)
- elementTree.treeView().setColumnHidden(1, True)
- self.connect(self._elementTree, Qt.SIGNAL("itemDoubleClicked"),
- self.on_element_clicked)
- self.insertWidget(0, self._elementTree)
- self.setAutoTooltip(False)
-
- def setTemporaryDirectory(self, tmp_dir):
- self._base_tmp_dir = tmp_dir
- self._is_filesystem_prepared = False
-
- def getTemporaryDirectory(self):
- return self._base_tmp_dir
-
- def createMenuActions(self):
- af = ActionFactory()
- on_save = functools.partial(self.on_save, apply=False)
- on_save_apply = functools.partial(self.on_save, apply=True)
-
- self.new_action = af.createAction(self, "New...",
- icon='document-new', tip="Create a new macro or controller class",
- triggered=self.on_new, shortcut=Qt.QKeySequence.New)
- self.open_action = af.createAction(self, "Open...",
- icon='document-open', tip="Open macro(s) or controller(s)",
- triggered=self.on_open, shortcut=Qt.QKeySequence.Open)
- self.save_action = af.createAction(self, "Save",
- icon='document-save', tip="Save the current selected item",
- triggered=on_save)
- self.save_and_apply_action = af.createAction(self, "Save && apply",
- triggered=on_save_apply, icon='document-save',
- tip="Save the current selected item and apply the new code",
- shortcut=Qt.QKeySequence.Save)
- self.revert_action = af.createAction(self, "Revert",
- icon='edit-undo', tip="Revert the current selected item code",
- triggered=self.on_revert)
-
- io_actions = [self.new_action, self.open_action, self.save_action,
- self.revert_action]
- actions = [self.new_action, self.open_action, self.save_action,
- self.save_and_apply_action, self.revert_action]
- return actions, io_actions
-
- def register_editorstack(self, editorstack):
- TaurusBaseEditor.register_editorstack(self, editorstack)
- self.connect(editorstack, Qt.SIGNAL('refresh_save_all_action()'),
- self.refresh_save_and_apply_action)
-
- def refresh_save_and_apply_action(self):
- self.save_and_apply_action.setEnabled(self.save_action.isEnabled())
-
- def on_element_clicked(self, item, item_column):
- item_data = item.itemData()
- interfaces = item_data.interfaces
- if 'MacroCode' in interfaces:
- self.open_macros([item_data])
- elif 'MacroLibrary' in interfaces:
- self.open_macro_libraries([item_data])
-
- @ProtectTaurusMessageBox(title="A error occured trying to create a class")
- def on_new(self):
-
- elem_types = "Macro function", "Macro class", "Macro library", \
- "Motor controller class", "Counter/Timer controller class", \
- "Pseudo motor controller class"
-
- msg = "Please select type of element you wish to create"
- elem_type, ok = Qt.QInputDialog.getItem(self, "New", msg, elem_types,
- current=0, editable=False)
- if not ok:
- return
-
- idx = elem_types.index(elem_type)
- if idx == 0:
- return self.new_macro_function()
- elif idx == 1:
- return self.new_macro_class()
- elif idx == 2:
- return self.new_macro_library()
- raise NotImplementedError("Sorry! Not implemented yet.")
-
- def new_macro(self, template):
- macro_server = self.getModelObj()
-
- msg = "Please select the library where you want to place the new macro"
-
- macro_libraries = macro_server.getElementsOfType("MacroLibrary")
- macro_lib_names = macro_libraries.keys()
- macro_lib_names.sort()
- macro_lib_name, ok = Qt.QInputDialog.getItem(self, "Macro library", msg,
- macro_lib_names, current=0, editable=False)
- if not ok:
- return
- macro_lib_name = str(macro_lib_name)
- macro_lib = macro_libraries[macro_lib_name]
-
- fname, path = macro_lib.file_path, macro_lib.path
- fname = fname[fname.index(osp.sep) + 1:] # transform into relative path
- local_filename = osp.join(self._tmp_dir, fname)
-
- msg = "Please give new macro name"
-
- macros = macro_lib.elements
- valid = False
- while not valid:
- macro_name, ok = Qt.QInputDialog.getText(self, "Macro name", msg)
- if not ok:
- return
- if macro_name in macros:
- res = Qt.QMessageBox.information(self, "Macro already exists",
- "A macro named '%s' already exists in '%s'.\n"
- "Please give a different macro name"
- % (macro_name, macro_lib_name),
- Qt.QMessageBox.Ok | Qt.QMessageBox.Cancel, Qt.QMessageBox.Ok)
- if res == Qt.QMessageBox.Cancel:
- return
- continue
- valid = True
-
- pars = dict(macro_name=macro_name)
- code = template.format(**pars)
-
- editorstack = self.editorStack()
- idx = editorstack.has_filename(local_filename)
- if idx is None:
- if not self._prepare_path(path):
- raise Exception("Error trying to prepare path for %s", path)
- self.debug("Creating local file %s...", local_filename)
- fname, lib_code, line = macro_server.GetMacroCode((macro_lib_name,))
- fd = file(local_filename, "w")
- fd.write(lib_code)
- fd.close()
- self.debug("Loading local file %s...", local_filename)
- self.load(local_filename, goto=None)
- else:
- pass
- editorstack.set_current_filename(local_filename)
- editor = editorstack.get_current_editor()
- editor.set_cursor_position(editor.get_position("eof"))
- editor.append(code)
- return macro_lib, macro_name
-
- def new_macro_class(self):
- macro_info = self.new_macro(_MACRO_CLASS_TEMPLATE)
- if macro_info is None:
- return
- macro_lib, macro_name = macro_info
-
- def new_macro_function(self):
- macro_info = self.new_macro(_MACRO_FUNCTION_TEMPLATE)
- if macro_info is None:
- return
- macro_lib, macro_name = macro_info
-
- def new_macro_library(self):
- ms = self.getModelObj()
- ms_path = ms.getMacroPathObj()
- directory, ok = Qt.QInputDialog.getItem(self, "New macro module",
- "Select the directory where you want the new macro module to " \
- "be placed",
- ms_path.macro_path, current=0, editable=False)
- if not ok:
- return
- directory = str(directory)
- ok = 0
- while not ok:
- mod, ok = Qt.QInputDialog.getText(self, "New macro module",
- "Module name:", Qt.QLineEdit.Normal, "")
- if not ok:
- return
- mod = str(mod)
- m, ext = osp.splitext(mod)
- if len(ext):
- if ext != ".py" :
- Qt.QMessageBox.critical(self, "Wrong extension",
- "When given, file extension<b> MUST</b> be <code>.py</code>.")
- ok = 0
- continue
- else:
- mod = mod + ".py"
- self._prepare_path(directory)
- filename = osp.join(directory, mod)
- rel_filename = filename[filename.index(osp.sep) + 1:] # transform into relative path
- local_filename = osp.join(self._tmp_dir, rel_filename)
- f = file(local_filename, "w")
-
- #TODO: ask for additional imports
- #TODO: check if door environment has copyright variable
-
- pars = dict(copyright="", non_sardana_imports="",
- sardana_imports="")
- code = _MACRO_LIB_TEMPLATE.format(**pars)
- f.write(code)
- f.close()
- self.editorStack().load(local_filename)
-
- @ProtectTaurusMessageBox(title="An error occured trying to open a macro class")
- def on_open(self):
- ms = self.getModelObj()
- ms_tree = MacroSelectionDialog(self, model_name=ms.getNormalName())
- ms_tree.exec_()
- if ms_tree.result() != Qt.QDialog.Accepted:
- return
- self.open_macros(ms_tree.getSelectedMacros())
-
- @ProtectTaurusMessageBox(title="An error occured trying to open macro(s)")
- def open_macros(self, macros):
- editorstack = self.editorStack()
-
- all_any = Qt.QMessageBox.YesToAll, Qt.QMessageBox.NoToAll
- yes_any = Qt.QMessageBox.Yes, Qt.QMessageBox.YesToAll
- no_any = Qt.QMessageBox.No, Qt.QMessageBox.NoToAll
-
- last_answer = Qt.QMessageBox.No
- for macro_info in macros:
- name, fname = macro_info.name, macro_info.file_path
- module = macro_info.module
- fname = fname[fname.index(osp.sep) + 1:] # transform into relative path
- local_filename = osp.join(self._tmp_dir, fname)
-
- idx = editorstack.has_filename(local_filename)
- if idx is not None and last_answer not in all_any:
- last_answer = Qt.QMessageBox.question(self,
- "Macro file '{0}' already opened".format(module),
- "All changes to <b>{0}</b> will be lost."
- "<br>Do you want to revert file from the server ignoring "
- "any possible changes you (may) have made?".format(module),
- Qt.QMessageBox.Yes | Qt.QMessageBox.YesToAll | \
- Qt.QMessageBox.No | Qt.QMessageBox.NoToAll,
- Qt.QMessageBox.No)
-
- if idx is None or last_answer in yes_any:
- if not self._prepare_path(macro_info.path):
- Qt.QMessageBox.warning(self,
- "Error trying to prepare '{0}'".format(module),
- "An error occured trying to prepare '{0}'".format(module),
- Qt.QMessageBox.Ok, Qt.QMessageBox.Ok)
- continue
- _, code, line = self.get_macro_code(module, name)
- line = int(line)
- self.debug("Creating local file %s...", local_filename)
- fd = file(local_filename, "w")
- fd.write(code)
- fd.close()
- if idx is None:
- self.debug("Loading local file %s...", local_filename)
- self.load(local_filename, goto=line)
- else:
- self.debug("Reloading local file %s...", local_filename)
- self.reload(idx, filename=local_filename, goto=line)
- elif last_answer in no_any:
- self.set_current_filename(local_filename)
-
- @ProtectTaurusMessageBox(title="An error occured trying to open macro(s)")
- def open_macro_libraries(self, macro_libraries):
- editorstack = self.editorStack()
-
- all_any = Qt.QMessageBox.YesToAll, Qt.QMessageBox.NoToAll
- yes_any = Qt.QMessageBox.Yes, Qt.QMessageBox.YesToAll
- no_any = Qt.QMessageBox.No, Qt.QMessageBox.NoToAll
-
- last_answer = Qt.QMessageBox.No
- for macro_library in macro_libraries:
- name, fname = macro_library.name, macro_library.file_path
- module = macro_library.module
- fname = fname[fname.index(osp.sep) + 1:] # transform into relative path
- local_filename = osp.join(self._tmp_dir, fname)
-
- idx = editorstack.has_filename(local_filename)
- if idx is not None and last_answer not in all_any:
- last_answer = Qt.QMessageBox.question(self,
- "Macro file '{0}' already opened".format(module),
- "All changes to <b>{0}</b> will be lost."
- "<br>Do you want to revert file from the server ignoring "
- "any possible changes you (may) have made?".format(module),
- Qt.QMessageBox.Yes | Qt.QMessageBox.YesToAll | \
- Qt.QMessageBox.No | Qt.QMessageBox.NoToAll,
- Qt.QMessageBox.No)
-
- if idx is None or last_answer in yes_any:
- if not self._prepare_path(macro_library.path):
- Qt.QMessageBox.warning(self,
- "Error trying to prepare '{0}'".format(module),
- "An error occured trying to prepare '{0}'".format(module),
- Qt.QMessageBox.Ok, Qt.QMessageBox.Ok)
- continue
- _, code, line = self.get_macro_code(module)
- line = int(line)
- self.debug("Creating local file %s...", local_filename)
- fd = file(local_filename, "w")
- fd.write(code)
- fd.close()
- if idx is None:
- self.debug("Loading local file %s...", local_filename)
- self.load(local_filename, goto=line)
- else:
- self.debug("Reloading local file %s...", local_filename)
- self.reload(idx, filename=local_filename, goto=line)
- elif last_answer in no_any:
- self.set_current_filename(local_filename)
-
- @ProtectTaurusMessageBox(msg="A error occured trying to save")
- def on_save(self, apply=True):
- editorstack = self.editorStack()
- # Save the currently edited file
- if not editorstack.get_stack_count():
- return
- index = editorstack.get_stack_index()
- res = editorstack.save(index=index)
- file_info = editorstack.data[index]
- if not res:
- return
- local_filename = file_info.filename
- fd = file(local_filename, "r")
- code = fd.read()
- fd.close()
- remote_filename = local_filename[len(self._tmp_dir):]
- self.set_macro_code(remote_filename, code, apply)
-
- def on_revert(self):
- self.editorStack().revert()
-
- def reload_macro_lib(self, module_name):
- pass
-
- def set_macro_code(self, filename, code, apply=True):
- ms = self.getModelObj()
- if apply:
- apply = "true"
- else:
- apply = "false"
- return ms.SetMacroCode((filename, code, apply))
-
- def get_macro_code(self, module_name, macro_name=None):
- ms = self.getModelObj()
- pars = [ module_name ]
- if macro_name is not None:
- pars.append(macro_name)
- return ms.GetMacroCode(pars)
-
- def setModel(self, model_name):
- TaurusBaseWidget.setModel(self, model_name)
- self._elementTree.setModel(model_name)
- self._is_filesystem_prepared = False
- self.prepare_filesystem()
-
- def _prepare_path(self, p):
- if not self.prepare_filesystem():
- return False
- p = p[p.index(osp.sep) + 1:] # transform into relative path
- p = osp.join(self._tmp_dir, p)
- if not osp.exists(p):
- os.makedirs(p)
- return True
-
- def prepare_filesystem(self):
- """Prepares a temporary directory to store the macro files locally"""
- if self._is_filesystem_prepared:
- return True
- ms = self.getModelObj()
- if ms is None:
- self.warning("Could not prepare local filesystem to store macros")
- return False
- ms_name = ms.getSimpleName().replace('/', '_')
- self._tmp_dir = tempfile.mkdtemp(prefix=ms_name, dir=self._base_tmp_dir)
- self._is_filesystem_prepared = True
- return True
-
- def closeEvent(self, event):
- if self._is_filesystem_prepared:
- shutil.rmtree(self._tmp_dir)
- TaurusBaseEditor.closeEvent(self, event)
-
-
-def demo(model_name="MS_BL98"):
- test = SardanaEditor()
- test.resize(1000, 800)
- #test.load(__file__)
- test.setModel(model_name)
- test.show()
- return test
-
-def main():
- import sys
- import taurus.qt.qtgui.application
- Application = taurus.qt.qtgui.application.TaurusApplication
-
- app = Application.instance()
- owns_app = app is None
-
- if owns_app:
- import taurus.core.util.argparse
- parser = taurus.core.util.argparse.get_taurus_parser()
- parser.usage = "%prog [options] <macro server name>"
- app = Application(sys.argv, cmd_line_parser=parser,
- app_name="Macro editor demo", app_version="1.0",
- org_domain="Sardana", org_name="Tango community")
-
- args = app.get_command_line_args()
-
- if len(args) == 0:
- parser.error("must give a macroserver device name")
- else:
- w = demo(args[0])
-
- if owns_app:
- sys.exit(app.exec_())
- else:
- return w
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/startup.py b/src/sardana/taurus/qt/qtgui/extra_sardana/startup.py
deleted file mode 100644
index 0de637ad..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/startup.py
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This file is executed by the python interpreter running as subprocess of
-SpockShell"""
-
-__docformat__ = 'restructuredtext'
-
-
-import sys
-
-def __run_pythonstartup_script():
- import os
- filename = os.environ.get('PYTHONSTARTUP')
- if filename and os.path.isfile(filename):
- execfile(filename)
-
-def __run_init_commands():
- import os
- return os.environ.get('PYTHONINITCOMMANDS')
-
-def __remove_from_syspath__():
- """Remove this module's path from sys.path"""
- import os.path as osp
- try:
- sys.path.remove(osp.dirname(__file__))
- except ValueError:
- pass
-
-
-class UserModuleDeleter(object):
- """
- User Module Deleter (UMD) aims at deleting user modules
- to force Python to deeply reload them during import
-
- pathlist [list]: blacklist in terms of module path
- namelist [list]: blacklist in terms of module name
- """
- def __init__(self, namelist=None, pathlist=None):
- if namelist is None:
- namelist = []
- self.namelist = namelist + ['sitecustomize', 'spyderlib', 'spyderplugins']
- if pathlist is None:
- pathlist = []
- self.pathlist = pathlist
- self.previous_modules = sys.modules.keys()
-
- def is_module_blacklisted(self, modname, modpath):
- for path in [sys.prefix] + self.pathlist:
- if modpath.startswith(path):
- return True
- else:
- return set(modname.split('.')) & set(self.namelist)
-
- def run(self, verbose=False):
- """
- Del user modules to force Python to deeply reload them
-
- Do not del modules which are considered as system modules, i.e.
- modules installed in subdirectories of Python interpreter's binary
- Do not del C modules
- """
- log = []
- for modname, module in sys.modules.items():
- if modname not in self.previous_modules:
- modpath = getattr(module, '__file__', None)
- if modpath is None:
- # *module* is a C module that is statically linked into the
- # interpreter. There is no way to know its path, so we
- # choose to ignore it.
- continue
- if not self.is_module_blacklisted(modname, modpath):
- log.append(modname)
- del sys.modules[modname]
- if verbose and log:
- print "\x1b[4;33m%s\x1b[24m%s\x1b[0m" % ("UMD has deleted",
- ": " + ", ".join(log))
-
-__umd__ = None
-
-def runfile(filename, args=None, wdir=None):
- """
- Run filename
- args: command line arguments (string)
- wdir: working directory
- """
- global __umd__
- import os
- if os.environ.get("UMD_ENABLED", "").lower() == "true":
- if __umd__ is None:
- namelist = os.environ.get("UMD_NAMELIST", None)
- if namelist is not None:
- namelist = namelist.split(',')
- __umd__ = UserModuleDeleter(namelist=namelist)
- else:
- verbose = os.environ.get("UMD_VERBOSE", "").lower() == "true"
- __umd__.run(verbose=verbose)
- if args is not None and not isinstance(args, basestring):
- raise TypeError("expected a character buffer object")
- glbs = globals()
- if '__ipythonshell__' in glbs:
- glbs = glbs['__ipythonshell__'].IP.user_ns
- glbs['__file__'] = filename
- sys.argv = [filename]
- if args is not None:
- for arg in args.split():
- sys.argv.append(arg)
- if wdir is not None:
- os.chdir(wdir)
- execfile(filename, glbs)
- sys.argv = ['']
- glbs.pop('__file__')
-
-
-def debugfile(filename, args=None, wdir=None):
- """
- Debug filename
- args: command line arguments (string)
- wdir: working directory
- """
- import pdb
- debugger = pdb.Pdb()
- filename = debugger.canonic(filename)
- debugger._wait_for_mainpyfile = 1
- debugger.mainpyfile = filename
- debugger._user_requested_quit = 0
- debugger.run("runfile(%r, args=%r, wdir=%r)" % (filename, args, wdir))
-
-
-if __name__ == "__main__":
- __remove_from_syspath__()
-
- __commands__ = __run_init_commands()
- if __commands__:
- for command in __commands__.split(';'):
- exec command
- else:
- __run_pythonstartup_script()
-
- for _name in ['__run_pythonstartup_script', '__run_init_commands',
- '__create_banner', '__commands__', 'command', '__file__',
- '__remove_sys_argv__'] + ['_name']:
- if _name in locals():
- locals().pop(_name)
-
- __doc__ = ''
- __name__ = '__main__'
-
- import os
- if os.name == 'nt':
- # Windows platforms: monkey-patching *pyreadline* module
- # to make IPython work in a remote process
- import pyreadline
- pyreadline.unicode_helper.pyreadline_codepage = "ascii"
- pyreadline.GetOutputFile = lambda: None
- from sardana.spock.genutils import start, mainloop
-
- __ipythonshell__ = start(user_ns={'runfile': runfile,
- 'debugfile': debugfile})
- __ipythonshell__.IP.stdin_encoding = os.environ['SPYDER_ENCODING']
-
- mainloop(shell=__ipythonshell__)
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/ui/ExpDescriptionEditor.ui b/src/sardana/taurus/qt/qtgui/extra_sardana/ui/ExpDescriptionEditor.ui
deleted file mode 100644
index 20640919..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/ui/ExpDescriptionEditor.ui
+++ /dev/null
@@ -1,282 +0,0 @@
-<ui version="4.0" >
- <class>ExpDescriptionEditor</class>
- <widget class="QWidget" name="ExpDescriptionEditor" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>733</width>
- <height>411</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Experiment Configuration</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3" >
- <item>
- <widget class="QTabWidget" name="tabWidget" >
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <widget class="QWidget" name="mntGrpTab" >
- <attribute name="title" >
- <string>Measurement Group</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Active Measurement Group</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="activeMntGrpCB" >
- <property name="toolTip" >
- <string>Selects the active Measurement Group</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="createMntGrpBT" >
- <property name="toolTip" >
- <string>Create a new Measurement Group</string>
- </property>
- <property name="text" >
- <string>+</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="deleteMntGrpBT" >
- <property name="toolTip" >
- <string>Delete the current Measurement Group</string>
- </property>
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="plotsButton" >
- <property name="toolTip" >
- <string>If checked, the configured plots are shown</string>
- </property>
- <property name="text" >
- <string>plots</string>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="MntGrpChannelEditor" name="channelEditor" />
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2" >
- <attribute name="title" >
- <string>Snapshot Group</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_6" >
- <item>
- <widget class="QSplitter" name="splitter" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <widget class="QTabWidget" name="tabWidget_2" >
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_4" >
- <attribute name="title" >
- <string>Sardana Elements</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_5" >
- <item>
- <widget class="SardanaElementTreeWidget" name="sardanaElementTree" />
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab" >
- <attribute name="title" >
- <string>External (Tango)</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_4" >
- <item>
- <widget class="TaurusModelSelectorTree" name="taurusModelTree" />
- </item>
- </layout>
- </widget>
- </widget>
- <widget class="QWidget" name="layoutWidget" >
- <layout class="QVBoxLayout" name="verticalLayout_2" >
- <item>
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>(Drag elements from the above selectors and drop them at the bottom list)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TaurusModelList" name="preScanList" />
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_3" >
- <attribute name="title" >
- <string>Storage</string>
- </attribute>
- <layout class="QFormLayout" name="formLayout" >
- <property name="fieldGrowthPolicy" >
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="toolTip" >
- <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
-p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">comma separated list of file names in which to store the results of the scans. Use .h5 extension for NeXus files (preferred) and .dat for spec format (note: SPEC format is &lt;span style=" font-weight:600;">not &lt;/span>supported)&lt;/p>&lt;/body>&lt;/html></string>
- </property>
- <property name="text" >
- <string>File Name(s)</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="filenameLE" >
- <property name="toolTip" >
- <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
-p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">comma separated list of file names in which to store the results of the scans. Use .h5 extension for NeXus files (preferred) and .dat for spec format (note: SPEC format is &lt;span style=" font-weight:600;">not &lt;/span>supported)&lt;/p>&lt;/body>&lt;/html></string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Path</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <widget class="QWidget" native="1" name="widget" >
- <layout class="QHBoxLayout" name="horizontalLayout_2" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QLineEdit" name="pathLE" />
- </item>
- <item>
- <widget class="QToolButton" name="choosePathBT" >
- <property name="text" >
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Data compression</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1" >
- <widget class="QComboBox" name="compressionCB" >
- <item>
- <property name="text" >
- <string>nowhere</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>for all datasets</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>for datasets of rank 1 or more</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>for datasets of rank 2 or more</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>for datasets of rank 3 or more</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="standardButtons" >
- <set>QDialogButtonBox::NoButton</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>TaurusModelList</class>
- <extends>QListView</extends>
- <header>taurus.qt.qtgui.panel</header>
- </customwidget>
- <customwidget>
- <class>TaurusModelSelectorTree</class>
- <extends>TaurusWidget</extends>
- <header>taurus.qt.qtgui.panel</header>
- </customwidget>
- <customwidget>
- <class>SardanaElementTreeWidget</class>
- <extends>QMainWindow</extends>
- <header>sardana.taurus.qt.qtgui.extra_sardana</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>MntGrpChannelEditor</class>
- <extends>QMainWindow</extends>
- <header>sardana.taurus.qt.qtgui.extra_sardana</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sardana/taurus/qt/qtgui/extra_sardana/ui/__init__.py b/src/sardana/taurus/qt/qtgui/extra_sardana/ui/__init__.py
deleted file mode 100644
index c058d0cb..00000000
--- a/src/sardana/taurus/qt/qtgui/extra_sardana/ui/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
diff --git a/src/sardana/test/__init__.py b/src/sardana/test/__init__.py
deleted file mode 100644
index 7e819af4..00000000
--- a/src/sardana/test/__init__.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-
-Sardana includes a framework allowing to test its features.
-This framework is aimed to be used with the objective of finding bugs and
-promote test driven development. \n
-
-This Framework is the outcome of the Sardana Enhancement Proposal 5 (SEP5). Its
-documentation is located here:
-http://sourceforge.net/p/sardana/wiki/SEP5/ \n
-
-Ideally, each bug found should be accompanied by a test revealing the bug.
-That eases the process of correcting bugs. \n
-
-The objective of the Sardana Test Framework is not to provide a test for
-every piece of code, but rather to ease collaborations and allow people
-from other institutions to provide their own test classes. \n
-
-At the moment the Sardana testing is focused on Unit Tests, but in the future
-the objective is to extend it to integration and system tests as well. \n
-
-In order to run all the tests provided by Sardana test framework, at a given
-moment, just go to 'sardana/src/sardana/test' and execute: \n
-python testsuite.py
-
-Sardana Test Framework is based on 'unittest'. This means that each of the
-Sardana python test classes inherits from unittest.TestCase. \n
-
-Each of the Sardana Tests has to be acompanied by a documentation that is
-written in the module, class and method docstrings; as well as in the assert
-methods. \n
-
-All tests have to be written in folders named 'test/'. \n
-
-Sardana Test Framework provides tools for testing macros. These tools comes
-from: \n
-* sardana/src/sardana/macroserver/macros/test/base.py
-* sardana/src/sardana/macroserver/macros/test/macroexecutor.py
-* sardana/src/sardana/macroserver/macros/test/sardemoenv.py
-* sardana/src/sardana/tango/macroserver/test/macroexecutor.py
-
-Tests of macros are done using the motors and experimental channels created
-by Sardana demo. \n
-
-base.py provides the mean of executing macros and test the function Run and
-Stop for each macro. Macro test classes can inherit from RunMacroTestCase,
-RunStopMacroTestCase or BaseMacroTestCase. \n
-
-Macros as 'lsm' inherits from RunMacroTestCase as it is interesting to test
-if the macros can be executed. The test methods can override the function
-macro_runs() that is defined in the class RunMacroTestCase. \n
-
-However, scan macros inherits from RunStopMacroTestCase as it is interesting
-to test both: if the macros can be executed and if they can be aborted. \n
-
-Another capacity provided by the Framework is the option to execute the
-same test method with many different macro input parameters. These is done
-by the help of a decorator inserted at the beginning of the test function.
-One decorator has to be used for each set of macro input parameters. Examples
-of the decorator usage can be seen in: test_scan.py \n
-
-If new tests of scan macros or list macros have to be added, that can be
-done in test_scan.py or in test_list.py where a useful base class is
-provided. \n
-
-
-Examples of Sardana tests using tools of Sardana Test Framework are: \n
-* sardana/src/sardana/test/test_sardanavalue.py
-* sardana/src/sardana/test/test_parameter.py
-* sardana/src/sardana/macroserver/macros/test_ct.py
-* sardana/src/sardana/macroserver/macros/test_list.py
-* sardana/src/sardana/macroserver/macros/test_wm.py
-
-"""
diff --git a/src/sardana/test/test_sardanavalue.py b/src/sardana/test/test_sardanavalue.py
deleted file mode 100644
index 4188db00..00000000
--- a/src/sardana/test/test_sardanavalue.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""Unit tests for sardanavalue module"""
-
-from taurus.external import unittest
-from sardana.sardanavalue import SardanaValue
-
-
-class SardanaValueTestCase(unittest.TestCase):
-
- """Instantiating in different ways a Sardana Value and perform some
- verifications.
- """
-
- def testInstanceCreation(self):
- """
- Instantiate in different ways a SardanaValue object.
- """
- sar_val = SardanaValue()
- self.assertIsInstance(sar_val, SardanaValue, 'Instantiation of an ' +
- 'object SardanaValue without arguments does not work')
-
- sar_val1 = SardanaValue(value=9)
- self.assertIsInstance(sar_val1, SardanaValue, 'Instantiation of an ' +
- 'object SardanaValue with the value argument does not work')
-
- sar_val2 = SardanaValue(value=8, exc_info=None,
- timestamp='09:30', dtype='int', dformat='int')
-
- self.assertIsInstance(sar_val2, SardanaValue, 'Instantiation of an ' +
- 'object SardanaValue with arguments and exc_info equal None, ' +
- 'does not work.')
-
- sar_val3 = SardanaValue(value=7, exc_info='exception_info',
- timestamp='09:30', dtype='int', dformat='int')
-
- self.assertIsInstance(sar_val3, SardanaValue, 'Instantiation of an ' +
- 'object SardanaValue with arguments and exc_info ' +
- 'different of None, does not work.')
-
- def testSardanaValueWithExceptionInfo(self):
- """Verify the creation of SardanaValue when exc_info != None.
- Verify that 'Error' is contained in the returned string.
- """
- val = 4
- sar_val = SardanaValue(value=val, exc_info='exception_info')
- representation = repr(sar_val)
-
- self.assertEqual(sar_val.error, True,
- 'The error attribute should be True.')
-
- self.assertRegexpMatches(representation, ".*<Error>.*",
- 'The SardanaValue representation does not contain <Error>.')
-
- def testSardanaValueWithNoExceptionInfo(self):
- """Verify the creation of SardanaValue when exc_info is not specified
- and we give a value as argument of the SardanaValue constructor.
- SardanaValue representation shall contain its value.
- """
- value = 5
- sar_val = SardanaValue(value=value)
- returned_string = sar_val.__repr__()
-
- self.assertRegexpMatches(returned_string, repr(value),
- 'The SardanaValue representation does not contain its value')
-
- self.assertEqual(sar_val.error, False,
- 'The error attribute should be False')
diff --git a/src/sardana/test/testsuite.py b/src/sardana/test/testsuite.py
deleted file mode 100644
index 028fe248..00000000
--- a/src/sardana/test/testsuite.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-This module defines the test suite for the whole Sardana package
-Usage::
-
- from taurus.test import testsuite
- testsuite.run()
-
-"""
-
-__docformat__ = 'restructuredtext'
-
-import os
-from taurus.external import unittest
-import sardana
-
-
-def run(disableLogger=True):
- '''Runs all tests for the taurus package'''
- # discover all tests within the sardana/src directory
- loader = unittest.defaultTestLoader
- suite = loader.discover(os.path.dirname(sardana.__file__))
- # use the basic text test runner that outputs to sys.stderr
- runner = unittest.TextTestRunner(descriptions=True, verbosity=2)
- # run the test suite
- runner.run(suite)
-
-if __name__ == '__main__':
- run()
diff --git a/src/sardana/tools/config/FODS_TO_SAR.xslt b/src/sardana/tools/config/FODS_TO_SAR.xslt
deleted file mode 100644
index d100d9cb..00000000
--- a/src/sardana/tools/config/FODS_TO_SAR.xslt
+++ /dev/null
@@ -1,821 +0,0 @@
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
- <xsl:output method="xml" indent="yes"/>
-
- <xsl:template match="/">
- <xsl:apply-templates select="/office:document/office:body/office:spreadsheet" />
- </xsl:template>
-
- <xsl:template match="/office:document/office:body/office:spreadsheet">
- <xsl:variable name="SarCode">
- <xsl:value-of select="table:table[@table:name='Global']/table:table-row[1]/table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:variable name="SarName">
- <xsl:value-of select="table:table[@table:name='Global']/table:table-row[2]/table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:variable name="SarDesc">
- <xsl:value-of select="table:table[@table:name='Global']/table:table-row[3]/table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:element name="Sardana">
- <xsl:attribute name="name">
- <xsl:value-of select="$SarCode"/>
- </xsl:attribute>
- <xsl:attribute name="longName">
- <xsl:value-of select="$SarName"/>
- </xsl:attribute>
- <Description><xsl:value-of select="$SarDesc"/></Description>
- <xsl:apply-templates select="table:table"/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="table:table[@table:name='Global']"/>
- <xsl:template match="table:table[@table:name='Motors']"/>
- <xsl:template match="table:table[@table:name='IORegisters']"/>
- <xsl:template match="table:table[@table:name='Channels']"/>
- <xsl:template match="table:table[@table:name='CommunicationChannels']"/>
- <xsl:template match="table:table[@table:name='Doors']"/>
- <xsl:template match="table:table[@table:name='Controllers']"/>
- <xsl:template match="table:table[@table:name='Parameters']"/>
- <xsl:template match="table:table[@table:name='Acquisition']"/>
- <xsl:template match="table:table[@table:name='Instruments']"/>
-
- <xsl:template match="table:table[@table:name='Servers']">
- <xsl:for-each select="table:table-row">
- <xsl:variable name="serverType">
- <xsl:value-of select="table:table-cell[1]/text:p"/>
- </xsl:variable>
- <xsl:if test="string-length($serverType) and $serverType != 'Type'">
- <xsl:variable name="tangoHost">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:variable name="serverName">
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:variable>
- <xsl:variable name="desc">
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:variable>
- <xsl:variable name="name">
- <xsl:value-of select="table:table-cell[5]/text:p"/>
- </xsl:variable>
- <xsl:variable name="deviceName">
- <xsl:value-of select="table:table-cell[6]/text:p"/>
- </xsl:variable>
-
- <xsl:element name="{$serverType}Server">
- <xsl:if test="string-length($tangoHost)">
- <xsl:attribute name="tangoHost">
- <xsl:value-of select="$tangoHost"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="serverName">
- <xsl:value-of select="$serverName"/>
- </xsl:attribute>
- <xsl:element name="Description">
- <xsl:value-of select="$desc"/>
- </xsl:element>
-
- <xsl:element name="{$serverType}">
- <xsl:attribute name="name">
- <xsl:value-of select="$name"/>
- </xsl:attribute>
- <xsl:attribute name="deviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:attribute>
- <xsl:element name="Description">
- <xsl:value-of select="$desc"/>
- </xsl:element>
-
- <xsl:choose>
- <xsl:when test="$serverType = 'Pool'">
- <xsl:element name="Property">
- <xsl:attribute name="name">PoolPath</xsl:attribute>
- <xsl:for-each select="table:table-cell[7]/text:p">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="."/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">:</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:element>
-
- <xsl:element name="Property">
- <xsl:attribute name="name">Version</xsl:attribute>
- <xsl:element name="Item">0.3.0</xsl:element>
- </xsl:element>
-
- <xsl:call-template name="Set-Pool">
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:with-param>
- </xsl:call-template>
-
- </xsl:when>
-
- <xsl:when test="$serverType = 'MacroServer'">
- <xsl:variable name="pools">
- <xsl:value-of select="table:table-cell[8]/text:p"/>
- </xsl:variable>
-
- <xsl:element name="Property">
- <xsl:attribute name="name">MacroPath</xsl:attribute>
- <xsl:for-each select="table:table-cell[7]/text:p">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="."/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">:</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:element>
-
- <xsl:call-template name="Set-MacroServer">
- <xsl:with-param name="serverName">
- <xsl:value-of select="$serverName"/>
- </xsl:with-param>
- <xsl:with-param name="deviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:with-param>
- <xsl:with-param name="pools">
- <xsl:value-of select="$pools"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
-
- </xsl:choose>
-
- </xsl:element>
-
- <xsl:choose>
- <xsl:when test="$serverType = 'MacroServer'">
- <xsl:call-template name="Set-MacroServer-Doors">
- <xsl:with-param name="serverName" select="$serverName">
- <xsl:value-of select="$serverName"/>
- </xsl:with-param>
- <xsl:with-param name="deviceName" select="$deviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
-
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-MacroServer">
- <xsl:param name="serverName"/>
- <xsl:param name="deviceName"/>
- <xsl:param name="pools"/>
- <xsl:element name="Property">
- <xsl:attribute name="name">PoolNames</xsl:attribute>
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="$pools"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- </xsl:template>
-
- <xsl:template name="Set-MacroServer-Doors">
- <xsl:param name="serverName"/>
- <xsl:param name="deviceName"/>
- <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table[@table:name='Doors']/table:table-row">
- <xsl:variable name="doorServer">
- <xsl:value-of select="table:table-cell[1]/text:p"/>
- </xsl:variable>
- <xsl:variable name="doorMacroServer">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:if test="$doorServer = $serverName and $doorMacroServer = $deviceName">
- <xsl:variable name="desc">
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:variable>
- <xsl:variable name="name">
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:variable>
- <xsl:variable name="deviceName">
- <xsl:value-of select="table:table-cell[5]/text:p"/>
- </xsl:variable>
-
- <xsl:element name="Door">
- <xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
- <xsl:attribute name="deviceName"><xsl:value-of select="$deviceName"/></xsl:attribute>
- <xsl:element name="Description"><xsl:value-of select="$desc"/></xsl:element>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Pool">
- <xsl:param name="poolDeviceName"/>
-
- <xsl:call-template name="Set-Pool-Instruments">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- </xsl:call-template>
-
- <!-- Find controllers -->
- <xsl:call-template name="Set-Pool-Controllers">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- </xsl:call-template>
-
- <!-- Find measurement groups -->
- <xsl:call-template name="Set-Pool-MeasurementGroups">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-IORegisters">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">IORegisters</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Motors">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Motors</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-PseudoMotors">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Motors">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Counters">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-0D">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-1D">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-2D">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Communication">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">CommunicationChannels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-PseudoCounters">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Instruments">
- <xsl:param name="poolDeviceName"/>
-
- <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table[@table:name='Instruments']/table:table-row">
- <xsl:variable name="instrumentPool">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:if test="$instrumentPool = $poolDeviceName">
-
- <xsl:variable name="instrumentName">
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:variable>
- <xsl:variable name="instrumentClass">
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:variable>
- <Instrument name="{$instrumentName}" class="{$instrumentClass}" />
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Controllers">
- <xsl:param name="poolDeviceName"/>
-
- <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table[@table:name='Controllers']/table:table-row">
- <xsl:variable name="ctrlPool">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:if test="$ctrlPool = $poolDeviceName">
-
- <xsl:variable name="ctrlType">
- <xsl:value-of select="table:table-cell[1]/text:p"/>
- </xsl:variable>
- <xsl:variable name="ctrlName">
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:variable>
- <xsl:variable name="ctrlLib">
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:variable>
- <xsl:variable name="ctrlClass">
- <xsl:value-of select="table:table-cell[5]/text:p"/>
- </xsl:variable>
-
- <Controller type="{$ctrlType}" name="{$ctrlName}"
- lib="{$ctrlLib}" class="{$ctrlClass}">
- <xsl:for-each select="table:table-cell[6]/text:p">
- <xsl:call-template name="Set-CtrlProperty">
- <xsl:with-param name="list">
- <xsl:value-of select="."/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="separator">:</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
-
- <xsl:choose>
- <xsl:when test="$ctrlType = 'Motor'">
- <xsl:call-template name="Set-Pool-Ctrl-Motors">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="$ctrlType = 'IORegister'">
- <xsl:call-template name="Set-Pool-Ctrl-IORegisters">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'CounterTimer'">
- <xsl:call-template name="Set-Pool-Ctrl-Counters">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'ZeroDExpChannel'">
- <xsl:call-template name="Set-Pool-Ctrl-0D">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'OneDExpChannel'">
- <xsl:call-template name="Set-Pool-Ctrl-1D">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'TwoDExpChannel'">
- <xsl:call-template name="Set-Pool-Ctrl-2D">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'Communication'">
- <xsl:call-template name="Set-Pool-Ctrl-Communication">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'PseudoMotor'">
- <xsl:for-each select="table:table-cell[7]/text:p">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="."/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="tag">Motor</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- <xsl:call-template name="Set-Pool-Ctrl-PseudoMotors">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'PseudoCounter'">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="table:table-cell[7]/text:p"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="tag">Channel</xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="Set-Pool-Ctrl-PseudoCounters">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise></xsl:otherwise>
- </xsl:choose>
- </Controller>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Elements">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:param name="sheet"/>
- <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table[@table:name=$sheet]/table:table-row">
- <xsl:variable name="pool">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
-
- <xsl:variable name="ctrl">
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:variable>
- <xsl:variable name="type">
- <xsl:value-of select="table:table-cell[1]/text:p"/>
- </xsl:variable>
- <xsl:if test="$pool = $poolDeviceName and $ctrl = $ctrlName">
- <xsl:variable name="name">
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:variable>
- <xsl:variable name="deviceName">
- <xsl:value-of select="table:table-cell[5]/text:p"/>
- </xsl:variable>
- <xsl:variable name="axis">
- <xsl:value-of select="table:table-cell[6]/text:p"/>
- </xsl:variable>
- <xsl:variable name="instrument">
- <xsl:value-of select="table:table-cell[7]/text:p"/>
- </xsl:variable>
- <xsl:variable name="desc">
- <xsl:value-of select="table:table-cell[8]/text:p"/>
- </xsl:variable>
-
- <xsl:element name="{$type}">
- <xsl:attribute name="name">
- <xsl:value-of select="$name"/>
- </xsl:attribute>
- <xsl:attribute name="deviceName">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($deviceName))">
- <xsl:value-of select="$deviceName"/>
- </xsl:when>
- <xsl:otherwise>Automatic</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="axis">
- <xsl:value-of select="$axis"/>
- </xsl:attribute>
- <xsl:if test="$instrument != 'None'">
- <xsl:element name="InstrumentRef">
- <xsl:value-of select="$instrument"/>
- </xsl:element>
- </xsl:if>
- <xsl:if test="string-length($desc)">
- <xsl:element name="Description">
- <xsl:value-of select="$desc"/>
- </xsl:element>
- </xsl:if>
- <xsl:for-each select="table:table-cell[9]/text:p">
- <xsl:call-template name="Set-Attributes">
- <xsl:with-param name="list">
- <xsl:value-of select="."/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="separator">:</xsl:with-param>
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$poolDeviceName"/>
- </xsl:with-param>
- <xsl:with-param name="devAlias">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- <xsl:call-template name="Set-Attributes-Config">
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$poolDeviceName"/>
- </xsl:with-param>
- <xsl:with-param name="devAlias">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Pool-MeasurementGroups">
- <xsl:param name="poolDeviceName"/>
- <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table[@table:name='Acquisition']/table:table-row">
- <xsl:variable name="currentPool">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
- <xsl:if test="$currentPool = $poolDeviceName">
- <xsl:variable name="mgName">
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:variable>
- <xsl:variable name="mgDeviceName">
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:variable>
- <xsl:variable name="mgElements">
- <xsl:value-of select="table:table-cell[5]/text:p"/>
- </xsl:variable>
- <xsl:variable name="mgDescription">
- <xsl:value-of select="table:table-cell[6]/text:p"/>
- </xsl:variable>
- <xsl:element name="MeasurementGroup">
- <xsl:attribute name="name"><xsl:value-of select="$mgName"/></xsl:attribute>
- <xsl:attribute name="deviceName"><xsl:value-of select="$mgDeviceName"/></xsl:attribute>
- <xsl:for-each select="table:table-cell[5]/text:p">
- <xsl:call-template name="Set-MeasurementGroupElements">
- <xsl:with-param name="list">
- <xsl:value-of select="."/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- <xsl:element name="Description">
- <xsl:value-of select="$mgDescription"/>
- </xsl:element>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-MeasurementGroupElements">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:element name="ChannelRef">
- <xsl:attribute name="name" >
- <xsl:value-of select="$first"/>
- </xsl:attribute>
- </xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-MeasurementGroupElements">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter">
- <xsl:value-of select="$delimiter"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="Set-CtrlProperty">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:param name="separator"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="string-length(normalize-space($list))">
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="string-length($newlist)">
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:variable name="propname" select="substring-before($first, $separator)"/>
- <xsl:variable name="propval" select="substring-after($first, $separator)"/>
-
- <xsl:element name="Property">
- <xsl:attribute name="name">
- <xsl:value-of select="$propname"/>
- </xsl:attribute>
- <xsl:element name="Item">
- <xsl:value-of select="$propval"/>
- </xsl:element>
- </xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-CtrlProperty">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter" select="$delimiter"/>
- <xsl:with-param name="separator" select="$separator"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="Set-Property">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:param name="tag"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:if test="$first">
- <xsl:element name="{$tag}"><xsl:value-of select="$first"/></xsl:element>
- </xsl:if>
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter">
- <xsl:value-of select="$delimiter"/>
- </xsl:with-param>
- <xsl:with-param name="tag" select="$tag"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="Set-Attributes-Config">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="devAlias"/>
- <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table[@table:name='Parameters']/table:table-row">
- <xsl:variable name="currPool">
- <xsl:value-of select="table:table-cell[1]/text:p"/>
- </xsl:variable>
- <xsl:variable name="currDev">
- <xsl:value-of select="table:table-cell[2]/text:p"/>
- </xsl:variable>
-
- <xsl:if test="$currPool = $poolDeviceName and $currDev = $devAlias">
- <xsl:element name="Attribute">
- <xsl:attribute name="name" >
- <xsl:value-of select="table:table-cell[3]/text:p"/>
- </xsl:attribute>
- <xsl:element name="Configuration">
- <xsl:element name="Display">
- <xsl:attribute name="label" >
- <xsl:value-of select="table:table-cell[4]/text:p"/>
- </xsl:attribute>
- <xsl:attribute name="format" >
- <xsl:value-of select="table:table-cell[5]/text:p"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Units">
- <xsl:attribute name="unit" >
- <xsl:value-of select="table:table-cell[12]/text:p"/>
- </xsl:attribute>
- <xsl:attribute name="display_unit" >
- <xsl:value-of select="table:table-cell[12]/text:p"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Range">
- <xsl:attribute name="min" >
- <xsl:value-of select="table:table-cell[6]/text:p"/>
- </xsl:attribute>
- <xsl:attribute name="max" >
- <xsl:value-of select="table:table-cell[11]/text:p"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Alarms">
- <xsl:attribute name="min_alarm" >
- <xsl:value-of select="table:table-cell[7]/text:p"/>
- </xsl:attribute>
- <xsl:attribute name="min_warning" >
- <xsl:value-of select="table:table-cell[8]/text:p"/>
- </xsl:attribute>
- <xsl:attribute name="max_warning" >
- <xsl:value-of select="table:table-cell[9]/text:p"/>
- </xsl:attribute>
- <xsl:attribute name="max_alarm" >
- <xsl:value-of select="table:table-cell[10]/text:p"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:element>
- <xsl:if test="table:table-cell[13]/text:p != '-1'">
- <xsl:element name="Polling">
- <xsl:attribute name="polled" >True</xsl:attribute>
- <xsl:attribute name="period" >
- <xsl:value-of select="table:table-cell[13]/text:p"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <xsl:if test="table:table-cell[14]/text:p != 'Automatic'">
- <xsl:element name="Events">
- <xsl:element name="ChangeEvent">
- <xsl:choose>
- <xsl:when test="contains(table:table-cell[14]/text:p, '%')">
- <xsl:attribute name="relative">
- <xsl:value-of select="table:table-cell[14]/text:p"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="absolute">
- <xsl:value-of select="table:table-cell[14]/text:p"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:element>
- </xsl:if>
- <xsl:element name="Description">
- <xsl:value-of select="table:table-cell[15]/text:p"/>
- </xsl:element>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Attributes">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:param name="separator"/>
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="devAlias"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="string-length(normalize-space($list))">
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="string-length($newlist)">
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:variable name="attrname" select="substring-before($first, $separator)"/>
- <xsl:variable name="attrval" select="substring-after($first, $separator)"/>
-
- <xsl:element name="Attribute">
- <xsl:attribute name="name">
- <xsl:value-of select="$attrname"/>
- </xsl:attribute>
- <xsl:element name="Value">
- <xsl:value-of select="$attrval"/>
- </xsl:element>
- </xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-Attributes">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter" select="$delimiter"/>
- <xsl:with-param name="separator" select="$separator"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/src/sardana/tools/config/SAR_TO_FODS.xslt b/src/sardana/tools/config/SAR_TO_FODS.xslt
deleted file mode 100644
index 66213939..00000000
--- a/src/sardana/tools/config/SAR_TO_FODS.xslt
+++ /dev/null
@@ -1,798 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
- <xsl:output method="xml" indent="yes"/>
-
- <xsl:template match="/Sardana">
- <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
- xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
- xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
- xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
- xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
- xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
- xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
- xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
- xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
- xmlns:math="http://www.w3.org/1998/Math/MathML"
- xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
- xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
- xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
- xmlns:ooo="http://openoffice.org/2004/office"
- xmlns:ooow="http://openoffice.org/2004/writer"
- xmlns:oooc="http://openoffice.org/2004/calc"
- xmlns:dom="http://www.w3.org/2001/xml-events"
- xmlns:xforms="http://www.w3.org/2002/xforms"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:rpt="http://openoffice.org/2005/report"
- xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
- xmlns:rdfa="http://docs.oasis-open.org/opendocument/meta/rdfa#"
- xmlns:field="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:field:1.0"
- xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
- office:version="1.2"
- office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
- <office:styles>
- <style:default-style style:family="table-cell">
- <style:table-cell-properties style:decimal-places="2"/>
- <style:paragraph-properties style:tab-stop-distance="0.5in"/>
- <style:text-properties fo:font-size="8pt"
- style:font-name="Liberation Sans" fo:language="en" fo:country="US"
- style:font-size-asian="8pt"
- style:font-name-asian="DejaVu Sans"
- style:language-asian="zxx"
- style:country-asian="none"
- style:font-size-complex="8pt"
- style:font-name-complex="DejaVu Sans"
- style:language-complex="zxx"
- style:country-complex="none"/>
- </style:default-style>
- <style:style style:name="Default" style:family="table-cell"/>
- </office:styles>
- <office:automatic-styles>
- <style:style style:name="globalcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="5in"/>
- </style:style>
- <style:style style:name="typecol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.2in"/>
- </style:style>
- <style:style style:name="servcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.1in"/>
- </style:style>
- <style:style style:name="poolcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.2in"/>
- </style:style>
- <style:style style:name="mscol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.2in"/>
- </style:style>
- <style:style style:name="ctrlcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="2.2in"/>
- </style:style>
- <style:style style:name="namecol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="2in"/>
- </style:style>
- <style:style style:name="smallnamecol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.2in"/>
- </style:style>
- <style:style style:name="devnamecol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.6in"/>
- </style:style>
- <style:style style:name="axiscol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="0.4in"/>
- </style:style>
- <style:style style:name="desccol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.5in"/>
- </style:style>
- <style:style style:name="attrcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="2in"/>
- </style:style>
- <style:style style:name="pathcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="3in"/>
- </style:style>
- <style:style style:name="hostcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1.2in"/>
- </style:style>
- <style:style style:name="confcol" style:family="table-column">
- <style:table-column-properties fo:break-before="auto" style:column-width="1in"/>
- </style:style>
-
- <style:style style:name="row1" style:family="table-row">
- <style:table-row-properties style:row-height="0.1445in" fo:break-before="auto"
- style:use-optimal-row-height="true"/>
- </style:style>
-
- <style:style style:name="header1" style:family="table-cell" style:parent-style-name="Default">
- <style:text-properties fo:font-size="8pt"
- fo:font-style="italic"
- fo:font-weight="bold"
- style:font-size-asian="8pt"
- style:font-style-asian="italic"
- style:font-weight-asian="bold"
- style:font-size-complex="8pt"
- style:font-style-complex="italic"
- style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="cell1" style:family="table-cell" style:parent-style-name="Default">
- <style:text-properties fo:font-size="8pt" style:font-size-asian="8pt" style:font-size-complex="8pt"/>
- </style:style>
- </office:automatic-styles>
- <office:body>
- <office:spreadsheet>
- <xsl:call-template name="Set-Global"/>
- <xsl:call-template name="Set-Servers"/>
- <xsl:call-template name="Set-Doors"/>
- <xsl:call-template name="Set-Controllers"/>
- <xsl:call-template name="Set-Motors"/>
- <xsl:call-template name="Set-IORegisters"/>
- <xsl:call-template name="Set-Channels"/>
- <xsl:call-template name="Set-CommunicationChannels"/>
- <xsl:call-template name="Set-MeasurementGroups"/>
- <xsl:call-template name="Set-Parameters"/>
- </office:spreadsheet>
- </office:body>
- </office:document>
- </xsl:template>
-
- <xsl:template name="Set-Parameters">
- <table:table table:name="Parameters" table:default-cell-style-name="Default">
- <table:table-column table:style-name="poolcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="confcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="desccol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Pool</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Element</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Parameter</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Label</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Format</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Min Value</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Min Alarm</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Min Warning</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Max Warning</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Max Alarm</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Max Value</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Unit</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Polling Period</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Change Event</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Description</text:p>
- </table:table-cell>
- </table:table-row>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="Controller">
- <xsl:for-each select="Motor">
- <xsl:variable name="element"><xsl:value-of select="@name"/></xsl:variable>
- <xsl:for-each select="Attribute[Configuration]">
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="$pool"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="$element"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Display/@label"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Display/@format"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Range/@min"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Alarms/@min_alarm"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Alarms/@min_warning"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Alarms/@max_warning"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Alarms/@max_alarm"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Range/@max"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Configuration/Units/@unit"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p>
- <xsl:choose>
- <xsl:when test="Polling/@polled = 'True' or Polling/@polled = 'Yes'">
- <xsl:value-of select="Polling/@period"/>
- </xsl:when>
- <xsl:otherwise>-1</xsl:otherwise>
- </xsl:choose>
- </text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p>
- <xsl:choose>
- <xsl:when test="Events/ChangeEvent/@absolute">
- <xsl:value-of select="Events/ChangeEvent/@absolute"/>
- </xsl:when>
- <xsl:when test="Events/ChangeEvent/@relative">
- <xsl:value-of select="Events/ChangeEvent/@relative"/>
- </xsl:when>
- <xsl:otherwise></xsl:otherwise>
- </xsl:choose>
- </text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell1">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- </table:table-row>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-MeasurementGroups">
- <table:table table:name="Acquisition" table:default-cell-style-name="Default">
- <table:table-column table:style-name="typecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="poolcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="namecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="devnamecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="attrcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="desccol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Type</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Pool</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>DeviceName</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Channels</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Description</text:p>
- </table:table-cell>
- </table:table-row>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="MeasurementGroup">
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string">
- <text:p>MeasurementGroup</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$pool"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@deviceName"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:for-each select="ChannelRef">
- <text:p><xsl:value-of select="@name"/></text:p>
- </xsl:for-each>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- </table:table-row>
- </xsl:for-each>
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-CommunicationChannels">
- <table:table table:name="CommunicationChannels" table:default-cell-style-name="Default">
- <xsl:call-template name="Set-Element-Header"/>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="Controller[@type = 'Communication']">
- <xsl:for-each select="CommunicationChannel">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">CommunicationChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Channels">
- <table:table table:name="Channels">
- <xsl:call-template name="Set-Element-Header"/>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="Controller[@type = 'CounterTimer']">
- <xsl:for-each select="CounterTimer">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">CounterTimer</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
-
- <xsl:for-each select="Controller[@type = 'ZeroDExpChannel']">
- <xsl:for-each select="ZeroDExpChannel">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">ZeroDExpChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
-
- <xsl:for-each select="Controller[@type = 'OneDExpChannel']">
- <xsl:for-each select="OneDExpChannel">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">OneDExpChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
-
- <xsl:for-each select="Controller[@type = 'TwoDExpChannel']">
- <xsl:for-each select="TwoDExpChannel">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">TwoDExpChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
-
- <xsl:for-each select="Controller[@type = 'PseudoCounter']">
- <xsl:for-each select="PseudoCounter">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">PseudoCounter</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
-
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-IORegisters">
- <table:table table:name="IORegisters" table:default-cell-style-name="Default">
- <xsl:call-template name="Set-Element-Header"/>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="Controller[@type = 'IORegister']">
- <xsl:for-each select="IORegister">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">IORegister</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Motors">
- <table:table table:name="Motors" table:default-cell-style-name="Default">
- <xsl:call-template name="Set-Element-Header"/>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="Controller[@type = 'Motor']">
- <xsl:for-each select="Motor">
- <xsl:call-template name="Set-Element">
- <xsl:with-param name="pool"><xsl:value-of select="$pool"/></xsl:with-param>
- <xsl:with-param name="ctrl"><xsl:value-of select="@name"/></xsl:with-param>
- <xsl:with-param name="type">Motor</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Controllers">
- <table:table table:name="Controllers" table:default-cell-style-name="Default">
- <table:table-column table:style-name="typecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="poolcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="namecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="namecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="namecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="attrcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="attrcol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Type</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Pool</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>File</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Class</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Properties</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Elements</text:p>
- </table:table-cell>
- </table:table-row>
-
- <xsl:for-each select="PoolServer/Pool">
- <xsl:variable name="pool"><xsl:value-of select="@deviceName"/></xsl:variable>
- <xsl:for-each select="Controller">
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@type"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$pool"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@lib"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@class"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:for-each select="Property">
- <text:p><xsl:value-of select="@name"/>:<xsl:value-of select="Item"/></text:p>
- </xsl:for-each>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:choose>
- <xsl:when test="@type = 'PseudoMotor'">
- <xsl:for-each select="Motor">
- <text:p><xsl:value-of select="."/></text:p>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="@type = 'PseudoCounter'">
- <xsl:for-each select="Channel">
- <text:p><xsl:value-of select="."/></text:p>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <text:p></text:p>
- </xsl:otherwise>
- </xsl:choose>
- </table:table-cell>
- </table:table-row>
- </xsl:for-each>
- </xsl:for-each>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Doors">
- <table:table table:name="Doors" table:default-cell-style-name="Default">
- <table:table-column table:style-name="servcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="mscol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="desccol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="namecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="devnamecol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Server</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>MacroServer</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Description</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Tango Name</text:p>
- </table:table-cell>
- </table:table-row>
- <table:table-row table:style-name="row1">
- <xsl:for-each select="MacroServerServer">
- <xsl:variable name="server"><xsl:value-of select="@serverName"/></xsl:variable>
- <xsl:variable name="ms"><xsl:value-of select="MacroServer/@deviceName"/></xsl:variable>
- <xsl:for-each select="Door">
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$server"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$ms"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@deviceName"/></text:p>
- </table:table-cell>
- </xsl:for-each>
- </xsl:for-each>
- </table:table-row>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Servers">
- <table:table table:name="Servers" table:default-cell-style-name="Default">
- <table:table-column table:style-name="typecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="hostcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="servcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="desccol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="smallnamecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="devnamecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="pathcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="attrcol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Type</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Host</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Server</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Description</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Tango Name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Path</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Pools</text:p>
- </table:table-cell>
- </table:table-row>
-
- <xsl:for-each select="PoolServer">
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string">
- <text:p>Pool</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@tangoHost"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@serverName"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Pool/@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Pool/@deviceName"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:for-each select="Pool/Property[@name='PoolPath']/Item">
- <text:p><xsl:value-of select="."/></text:p>
- </xsl:for-each>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p></text:p>
- </table:table-cell>
- </table:table-row>
- </xsl:for-each>
-
- <xsl:for-each select="MacroServerServer">
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string">
- <text:p>Pool</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@tangoHost"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@serverName"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="MacroServer/@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="MacroServer/@deviceName"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:for-each select="MacroServer/Property[@name='MacroPath']/Item">
- <text:p><xsl:value-of select="."/></text:p>
- </xsl:for-each>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:for-each select="MacroServer/Property[@name='PoolNames']/Item">
- <text:p><xsl:value-of select="."/></text:p>
- </xsl:for-each>
- </table:table-cell>
- </table:table-row>
- </xsl:for-each>
-
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Global">
- <table:table table:name="Global" table:default-cell-style-name="Default">
- <table:table-column table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="globalcol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>code</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@name"/></text:p>
- </table:table-cell>
- </table:table-row>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@longName"/></text:p>
- </table:table-cell>
- </table:table-row>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>description</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- </table:table-row>
- </table:table>
- </xsl:template>
-
- <xsl:template name="Set-Element">
- <xsl:param name="type"/>
- <xsl:param name="pool"/>
- <xsl:param name="ctrl"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$type"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$pool"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="$ctrl"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@name"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@deviceName"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="@axis"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <text:p><xsl:value-of select="Description"/></text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string">
- <xsl:for-each select="Attribute">
- <xsl:if test="Value">
- <text:p><xsl:value-of select="@name"/>:<xsl:value-of select="Value"/></text:p>
- </xsl:if>
- </xsl:for-each>
- </table:table-cell>
- </table:table-row>
- </xsl:template>
-
- <xsl:template name="Set-Element-Header">
- <table:table-column table:style-name="typecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="poolcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="ctrlcol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="namecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="devnamecol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="axiscol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="desccol" table:default-cell-style-name="cell1"/>
- <table:table-column table:style-name="attrcol" table:default-cell-style-name="cell1"/>
- <table:table-row table:style-name="row1">
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Type</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Pool</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Controller</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Name</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>DeviceName</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Axis</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Description</text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="header1">
- <text:p>Attributes</text:p>
- </table:table-cell>
- </table:table-row>
- </xsl:template>
-</xsl:stylesheet> \ No newline at end of file
diff --git a/src/sardana/tools/config/XLS_TO_SAR.xslt b/src/sardana/tools/config/XLS_TO_SAR.xslt
deleted file mode 100644
index cc0f1dd2..00000000
--- a/src/sardana/tools/config/XLS_TO_SAR.xslt
+++ /dev/null
@@ -1,878 +0,0 @@
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:wb="urn:schemas-microsoft-com:office:spreadsheet"
- xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
- <xsl:output method="xml" indent="yes"/>
-
- <xsl:template match="/">
- <xsl:apply-templates select="wb:Workbook" />
- </xsl:template>
-
- <xsl:template match="wb:Workbook">
- <xsl:variable name="SarCode">
- <xsl:value-of select="ss:Worksheet[@ss:Name='Global']/ss:Table/ss:Row[1]/ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="SarName">
- <xsl:value-of select="ss:Worksheet[@ss:Name='Global']/ss:Table/ss:Row[2]/ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="SarDesc">
- <xsl:value-of select="ss:Worksheet[@ss:Name='Global']/ss:Table/ss:Row[3]/ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:element name="Sardana">
- <xsl:attribute name="name">
- <xsl:value-of select="$SarCode"/>
- </xsl:attribute>
- <xsl:attribute name="longName">
- <xsl:value-of select="$SarName"/>
- </xsl:attribute>
- <Description><xsl:value-of select="$SarDesc"/></Description>
- <xsl:apply-templates select="ss:Worksheet"/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="ss:Worksheet[@ss:Name='Servers']">
- <xsl:for-each select="ss:Table/ss:Row">
- <xsl:variable name="serverType">
- <xsl:value-of select="ss:Cell[1]/ss:Data"/>
- </xsl:variable>
- <xsl:if test="$serverType != 'Type'">
-
- <xsl:variable name="tangoHost">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="serverName">
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="desc">
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="name">
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="deviceName">
- <xsl:value-of select="ss:Cell[6]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="path">
- <xsl:value-of select="ss:Cell[7]/ss:Data"/>
- </xsl:variable>
-
- <!-- Server element -->
- <xsl:element name="{$serverType}Server">
- <xsl:if test="string-length($tangoHost)">
- <xsl:attribute name="tangoHost">
- <xsl:value-of select="$tangoHost"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="serverName">
- <xsl:value-of select="$serverName"/>
- </xsl:attribute>
- <xsl:element name="Description">
- <xsl:value-of select="$desc"/>
- </xsl:element>
-
- <!-- Element -->
- <xsl:element name="{$serverType}">
- <xsl:attribute name="name">
- <xsl:value-of select="$name"/>
- </xsl:attribute>
- <xsl:attribute name="deviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:attribute>
- <xsl:element name="Description">
- <xsl:value-of select="$desc"/>
- </xsl:element>
-
- <!-- Particular for each server -->
- <xsl:choose>
- <xsl:when test="$serverType = 'Pool'">
- <xsl:element name="Property">
- <xsl:attribute name="name">PoolPath</xsl:attribute>
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="$path"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">:</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- <xsl:element name="Property">
- <xsl:attribute name="name">Version</xsl:attribute>
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">0.3.0
- </xsl:with-param>
- <xsl:with-param name="delimiter">:</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- <xsl:call-template name="Set-Pool">
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$serverType = 'MacroServer'">
- <xsl:variable name="pools">
- <xsl:value-of select="ss:Cell[8]/ss:Data"/>
- </xsl:variable>
- <xsl:element name="Property">
- <xsl:attribute name="name">MacroPath</xsl:attribute>
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="$path"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">:</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- <xsl:call-template name="Set-MacroServer">
- <xsl:with-param name="serverName">
- <xsl:value-of select="$serverName"/>
- </xsl:with-param>
- <xsl:with-param name="deviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:with-param>
- <xsl:with-param name="pools">
- <xsl:value-of select="$pools"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:element>
-
-
- <!-- Particular for each server -->
- <xsl:choose>
- <xsl:when test="$serverType = 'MacroServer'">
- <xsl:call-template name="Set-MacroServer-Doors">
- <xsl:with-param name="serverName" select="$serverName">
- <xsl:value-of select="$serverName"/>
- </xsl:with-param>
- <xsl:with-param name="deviceName" select="$deviceName">
- <xsl:value-of select="$deviceName"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="ss:Worksheet[@ss:Name='Global']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='Motors']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='IORegisters']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='Channels']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='CommunicationChannels']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='Doors']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='Controllers']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='Parameters']"/>
- <xsl:template match="ss:Worksheet[@ss:Name='Acquisition']"/>
-
- <xsl:template name="Set-Pool">
- <xsl:param name="poolDeviceName"/>
- <!-- Find controllers -->
- <xsl:call-template name="Set-Pool-Controllers">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- </xsl:call-template>
- <!-- Find measurement groups -->
- <xsl:call-template name="Set-Pool-MeasurementGroups">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- </xsl:call-template>
-
- </xsl:template>
-
- <xsl:template name="Set-Pool-MeasurementGroups">
- <xsl:param name="poolDeviceName"/>
-
- <xsl:for-each select="/wb:Workbook/ss:Worksheet[@ss:Name='Acquisition']/ss:Table/ss:Row">
- <xsl:variable name="currentPool">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:if test="$currentPool = $poolDeviceName">
-
- <xsl:variable name="mgName">
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="mgDeviceName">
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="mgElements">
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="mgDescription">
- <xsl:value-of select="ss:Cell[6]/ss:Data"/>
- </xsl:variable>
- <MeasurementGroup name="{$mgName}" deviceName="{$mgDeviceName}">
- <xsl:call-template name="Set-MeasurementGroupElements">
- <xsl:with-param name="list">
- <xsl:value-of select="$mgElements"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- </xsl:call-template>
- <xsl:element name="Description">
- <xsl:value-of select="$mgDescription"/>
- </xsl:element>
- </MeasurementGroup>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Motors">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Motors</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-IORegisters">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">IORegisters</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-PseudoMotors">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Motors">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Counters">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-0D">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-1D">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-2D">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Communication">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">CommunicationChannels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-PseudoCounters">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:call-template name="Set-Pool-Ctrl-Elements">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- <xsl:with-param name="sheet">Channels</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Ctrl-Elements">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="ctrlName"/>
- <xsl:param name="sheet"/>
-
- <xsl:for-each select="/wb:Workbook/ss:Worksheet[@ss:Name=$sheet]/ss:Table/ss:Row">
- <xsl:variable name="pool">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="ctrl">
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="type">
- <xsl:value-of select="ss:Cell[1]/ss:Data"/>
- </xsl:variable>
- <xsl:if test="$pool = $poolDeviceName and $ctrl = $ctrlName">
- <xsl:variable name="name">
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="deviceName">
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="axis">
- <xsl:value-of select="ss:Cell[6]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="desc">
- <xsl:value-of select="ss:Cell[7]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="attributes">
- <xsl:value-of select="ss:Cell[8]/ss:Data"/>
- </xsl:variable>
-
- <xsl:element name="{$type}">
- <xsl:attribute name="name">
- <xsl:value-of select="$name"/>
- </xsl:attribute>
- <xsl:attribute name="deviceName">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($deviceName))">
- <xsl:value-of select="$deviceName"/>
- </xsl:when>
- <xsl:otherwise>Automatic</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="axis">
- <xsl:value-of select="$axis"/>
- </xsl:attribute>
- <xsl:element name="Description">
- <xsl:value-of select="$desc"/>
- </xsl:element>
- <xsl:call-template name="Set-Attributes">
- <xsl:with-param name="list">
- <xsl:value-of select="$attributes"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="separator">:</xsl:with-param>
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$poolDeviceName"/>
- </xsl:with-param>
- <xsl:with-param name="devAlias">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="Set-Attributes-Config">
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$poolDeviceName"/>
- </xsl:with-param>
- <xsl:with-param name="devAlias">
- <xsl:value-of select="$name"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Pool-Controllers">
- <xsl:param name="poolDeviceName"/>
-
- <xsl:for-each select="/wb:Workbook/ss:Worksheet[@ss:Name='Controllers']/ss:Table/ss:Row">
- <xsl:variable name="ctrlPool">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:if test="$ctrlPool = $poolDeviceName">
-
- <xsl:variable name="ctrlType">
- <xsl:value-of select="ss:Cell[1]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="ctrlName">
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="ctrlLib">
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="ctrlClass">
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:variable>
-
- <Controller type="{$ctrlType}" name="{$ctrlName}"
- lib="{$ctrlLib}" class="{$ctrlClass}">
- <!-- Properties are the 6th column if the Cell tag does not have the Index != 6.
- If it does it means that the Properties column is empty and it refers to the next non empty column-->
- <xsl:if test="not(ss:Cell[6][@ss:Index]) or ss:Cell[6][@ss:Index]='6'">
- <xsl:call-template name="Set-CtrlProperty">
- <xsl:with-param name="list">
- <xsl:value-of select="ss:Cell[6]/ss:Data"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="separator">:</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="$ctrlType = 'Motor'">
- <xsl:call-template name="Set-Pool-Ctrl-Motors">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'IORegister'">
- <xsl:call-template name="Set-Pool-Ctrl-IORegisters">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'CounterTimer'">
- <xsl:call-template name="Set-Pool-Ctrl-Counters">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'ZeroDExpChannel'">
- <xsl:call-template name="Set-Pool-Ctrl-0D">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'OneDExpChannel'">
- <xsl:call-template name="Set-Pool-Ctrl-1D">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'TwoDExpChannel'">
- <xsl:call-template name="Set-Pool-Ctrl-2D">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'Communication'">
- <xsl:call-template name="Set-Pool-Ctrl-Communication">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'PseudoMotor'">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:choose>
- <xsl:when test="ss:Cell[@ss:Index='7']">
- <xsl:value-of select="ss:Cell[@ss:Index='7']/ss:Data"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="ss:Cell[7]/ss:Data"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="tag">Motor</xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="Set-Pool-Ctrl-PseudoMotors">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ctrlType = 'PseudoCounter'">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:choose>
- <xsl:when test="ss:Cell[@ss:Index='7']">
- <xsl:value-of select="ss:Cell[@ss:Index='7']/ss:Data"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="ss:Cell[7]/ss:Data"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="tag">Channel</xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="Set-Pool-Ctrl-PseudoCounters">
- <xsl:with-param name="poolDeviceName" select="$poolDeviceName"/>
- <xsl:with-param name="ctrlName" select="$ctrlName"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </Controller>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-MeasurementGroupElements">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:element name="ChannelRef">
- <xsl:attribute name="name" >
- <xsl:value-of select="$first"/>
- </xsl:attribute>
- </xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-MeasurementGroupElements">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter">
- <xsl:value-of select="$delimiter"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="Set-MacroServer">
- <xsl:param name="serverName"/>
- <xsl:param name="deviceName"/>
- <xsl:param name="pools"/>
- <xsl:element name="Property">
- <xsl:attribute name="name">PoolNames</xsl:attribute>
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list">
- <xsl:value-of select="$pools"/>
- </xsl:with-param>
- <xsl:with-param name="delimiter">;</xsl:with-param>
- <xsl:with-param name="tag">Item</xsl:with-param>
- </xsl:call-template>
- </xsl:element>
- </xsl:template>
-
- <xsl:template name="Set-MacroServer-Doors">
- <xsl:param name="serverName"/>
- <xsl:param name="deviceName"/>
- <xsl:for-each select="/wb:Workbook/ss:Worksheet[@ss:Name='Doors']/ss:Table/ss:Row">
- <xsl:variable name="doorServer">
- <xsl:value-of select="ss:Cell[1]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="doorMacroServer">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:if test="$doorServer = $serverName and $doorMacroServer = $deviceName">
- <xsl:variable name="desc">
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="name">
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="deviceName">
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:variable>
-
- <xsl:element name="Door">
- <xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
- <xsl:attribute name="deviceName"><xsl:value-of select="$deviceName"/></xsl:attribute>
- <xsl:element name="Description"><xsl:value-of select="$desc"/></xsl:element>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Attributes">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:param name="separator"/>
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="devAlias"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="string-length(normalize-space($list))">
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="string-length($newlist)">
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:variable name="attrname" select="substring-before($first, $separator)"/>
- <xsl:variable name="attrval" select="substring-after($first, $separator)"/>
-
- <xsl:element name="Attribute">
- <xsl:attribute name="name">
- <xsl:value-of select="$attrname"/>
- </xsl:attribute>
- <xsl:element name="Value">
- <xsl:value-of select="$attrval"/>
- </xsl:element>
- <!--
- <xsl:call-template name="Set-Attribute-Config">
- <xsl:with-param name="poolDeviceName">
- <xsl:value-of select="$poolDeviceName"/>
- </xsl:with-param>
- <xsl:with-param name="devAlias">
- <xsl:value-of select="$devAlias"/>
- </xsl:with-param>
- <xsl:with-param name="attrName">
- <xsl:value-of select="$attrname"/>
- </xsl:with-param>
- </xsl:call-template>
- -->
- </xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-Attributes">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter" select="$delimiter"/>
- <xsl:with-param name="separator" select="$separator"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="Set-Attributes-Config">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="devAlias"/>
- <xsl:for-each select="/wb:Workbook/ss:Worksheet[@ss:Name='Parameters']/ss:Table/ss:Row">
- <xsl:variable name="currPool">
- <xsl:value-of select="ss:Cell[1]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="currDev">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
-
- <xsl:if test="$currPool = $poolDeviceName and $currDev = $devAlias">
- <xsl:element name="Attribute">
- <xsl:attribute name="name" >
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:attribute>
- <xsl:element name="Configuration">
- <xsl:element name="Display">
- <xsl:attribute name="label" >
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="format" >
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Units">
- <xsl:attribute name="unit" >
- <xsl:value-of select="ss:Cell[12]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="display_unit" >
- <xsl:value-of select="ss:Cell[12]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Range">
- <xsl:attribute name="min" >
- <xsl:value-of select="ss:Cell[6]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="max" >
- <xsl:value-of select="ss:Cell[11]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Alarms">
- <xsl:attribute name="min_alarm" >
- <xsl:value-of select="ss:Cell[7]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="min_warning" >
- <xsl:value-of select="ss:Cell[8]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="max_warning" >
- <xsl:value-of select="ss:Cell[9]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="max_alarm" >
- <xsl:value-of select="ss:Cell[10]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:element>
- <xsl:if test="ss:Cell[13]/ss:Data != '-1'">
- <xsl:element name="Polling">
- <xsl:attribute name="polled" >True</xsl:attribute>
- <xsl:attribute name="period" >
- <xsl:value-of select="ss:Cell[13]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <xsl:if test="ss:Cell[14]/ss:Data != 'Automatic'">
- <xsl:element name="Events">
- <xsl:element name="ChangeEvent">
- <xsl:choose>
- <xsl:when test="contains(ss:Cell[14]/ss:Data, '%')">
- <xsl:attribute name="relative">
- <xsl:value-of select="ss:Cell[14]/ss:Data"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="absolute">
- <xsl:value-of select="ss:Cell[14]/ss:Data"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:element>
- </xsl:if>
- <xsl:element name="Description">
- <xsl:value-of select="ss:Cell[15]/ss:Data"/>
- </xsl:element>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-Attribute-Config">
- <xsl:param name="poolDeviceName"/>
- <xsl:param name="devAlias"/>
- <xsl:param name="attrName"/>
- <xsl:for-each select="/wb:Workbook/ss:Worksheet[@ss:Name='Parameters']/ss:Table/ss:Row">
- <xsl:variable name="currPool">
- <xsl:value-of select="ss:Cell[1]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="currDev">
- <xsl:value-of select="ss:Cell[2]/ss:Data"/>
- </xsl:variable>
- <xsl:variable name="currAttr">
- <xsl:value-of select="ss:Cell[3]/ss:Data"/>
- </xsl:variable>
-
- <xsl:if test="$currPool = $poolDeviceName and $currDev = $devAlias and $currAttr = $attrName">
- <xsl:element name="Configuration">
- <xsl:element name="Display">
- <xsl:attribute name="label" >
- <xsl:value-of select="ss:Cell[4]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="format" >
- <xsl:value-of select="ss:Cell[5]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Units">
- <xsl:attribute name="unit" >
- <xsl:value-of select="ss:Cell[12]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="display_unit" >
- <xsl:value-of select="ss:Cell[12]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Range">
- <xsl:attribute name="min" >
- <xsl:value-of select="ss:Cell[6]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="max" >
- <xsl:value-of select="ss:Cell[11]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Alarms">
- <xsl:attribute name="min_alarm" >
- <xsl:value-of select="ss:Cell[7]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="min_warning" >
- <xsl:value-of select="ss:Cell[8]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="max_warning" >
- <xsl:value-of select="ss:Cell[9]/ss:Data"/>
- </xsl:attribute>
- <xsl:attribute name="max_alarm" >
- <xsl:value-of select="ss:Cell[10]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:element name="Description">
- <xsl:value-of select="ss:Cell[13]/ss:Data"/>
- </xsl:element>
- </xsl:element>
- <xsl:if test="ss:Cell[14]/ss:Data">
- <xsl:element name="Polling">
- <xsl:attribute name="polled" >True</xsl:attribute>
- <xsl:attribute name="period" >
- <xsl:value-of select="ss:Cell[14]/ss:Data"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="Set-CtrlProperty">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:param name="separator"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="string-length(normalize-space($list))">
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="string-length($newlist)">
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:variable name="propname" select="substring-before($first, $separator)"/>
- <xsl:variable name="propval" select="substring-after($first, $separator)"/>
-
- <xsl:element name="Property">
- <xsl:attribute name="name">
- <xsl:value-of select="$propname"/>
- </xsl:attribute>
- <xsl:element name="Item">
- <xsl:value-of select="$propval"/>
- </xsl:element>
- </xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-CtrlProperty">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter" select="$delimiter"/>
- <xsl:with-param name="separator" select="$separator"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="Set-Property">
- <xsl:param name="list"/>
- <xsl:param name="delimiter"/>
- <xsl:param name="tag"/>
- <xsl:variable name="newlist">
- <xsl:choose>
- <xsl:when test="contains($list, $delimiter)">
- <xsl:value-of select="normalize-space($list)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="first" select="substring-before($newlist, $delimiter)"/>
- <xsl:variable name="remaining" select="substring-after($newlist, $delimiter)"/>
-
- <xsl:element name="{$tag}"><xsl:value-of select="$first"/></xsl:element>
-
- <xsl:if test="$remaining">
- <xsl:call-template name="Set-Property">
- <xsl:with-param name="list" select="$remaining"/>
- <xsl:with-param name="delimiter">
- <xsl:value-of select="$delimiter"/>
- </xsl:with-param>
- <xsl:with-param name="tag" select="$tag"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/src/sardana/tools/config/fods_to_sar.py b/src/sardana/tools/config/fods_to_sar.py
deleted file mode 100644
index 9685f26e..00000000
--- a/src/sardana/tools/config/fods_to_sar.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-
-""" The sardana transformation tool.
- Syntax:
- python fods_to_sar.py <file.fods>
-
- This tool outputs a sardana XML file from an FODS XML file.
-
- file.xml must be a valid XML file comming from an OpenOffice spreadsheet in FODS format.
-"""
-
-
-import sys, os, types
-from lxml import etree
-
-def transform(f):
- directory = os.path.dirname(os.path.abspath(__file__))
- xslt_filename = os.path.join(directory, "FODS_TO_SAR.xslt")
-
- t = etree.XSLT(etree.parse(xslt_filename))
- if type(f) in types.StringTypes:
- doc = etree.parse(f)
- else:
- doc = f
- return t(doc)
-
-def main():
- if len(sys.argv) < 2:
- print __doc__
- sys.exit(1)
-
- filename = sys.argv[1]
- t = transform(filename)
- print etree.tostring(t, pretty_print=True)
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/tools/config/get_pool_config.py b/src/sardana/tools/config/get_pool_config.py
deleted file mode 100644
index 95b67b40..00000000
--- a/src/sardana/tools/config/get_pool_config.py
+++ /dev/null
@@ -1,158 +0,0 @@
-import PyTango
-import taurus
-import csv
-import sys
-
-def checkPoolElements(pool):
- pool_dev = taurus.Device(pool)
-
- # GET CONTROLLER CLASSES
- pool_ctrl_classes = {}
- for info in pool_dev['ControllerClassList'].value:
- ctrl_class, library_path, ctrl_type = info.split()
- pool_ctrl_classes[ctrl_class] = (library_path, ctrl_type)
-
- # GET CONTROLLERS INFO
- pool_controllers_by_type = {'Motor': [],
- 'PseudoMotor': [],
- 'IORegister': [],
- 'CounterTimer': [],
- 'PseudoCounter': [],
- 'ZeroDExpChannel': []}
- pool_controllers = {}
- for info in pool_dev['ControllerList'].value:
- info_splitted = info.split()
- ctrl_name = info_splitted[0]
- ctrl_library = info_splitted[-1].replace('(','').replace(')','')
- ctrl_class = info_splitted[1].rsplit('.')[1].split('/')[0]
- ctrl_type = ''
- try:
- ctrl_type = pool_ctrl_classes[ctrl_class][1]
- pool_controllers_by_type[ctrl_type].append(ctrl_name)
- except:
- pass
- ctrl_properties = {}
- ctrl_elements = []
- ctrl_pool_elements = []
- for prop in pool_dev.get_property_list(ctrl_name+'/*'):
- prop_name = prop.split('/')[1]
- prop_value = pool_dev.get_property(prop)[prop]
- ctrl_properties[prop_name] = ' '.join(prop_value)
- pool_controllers[ctrl_name] = {}
- pool_controllers[ctrl_name]['type'] = ctrl_type
- pool_controllers[ctrl_name]['name'] = ctrl_name
- pool_controllers[ctrl_name]['file'] = ctrl_library
- pool_controllers[ctrl_name]['class'] = ctrl_class
- pool_controllers[ctrl_name]['properties'] = ctrl_properties
- pool_controllers[ctrl_name]['elements'] = ctrl_elements
- pool_controllers[ctrl_name]['ctrl_pool_elements'] = ctrl_pool_elements
-
- for ctrl_type, controllers in pool_controllers_by_type.iteritems():
- if len(controllers) == 0:
- continue
-
- print '\n'
- print '----------------------------------------------------------------'
- print len(controllers), ctrl_type, 'CONTROLLERS FOR POOL '+pool
- print '----------------------------------------------------------------'
-
- for ctrl in controllers:
- details = pool_controllers[ctrl]
- ###print 'Controller',ctrl,':'
- ###for k, v in details.iteritems():
- ### if k == 'ctrl_pool_elements':
- ### print '\tElements count:\t'+str(len(v))
- ### print '\t'+k+':\t'+str(v)
- ###
- ###pool_controllers[ctrl_name]['type'] = ctrl_type
- ###pool_controllers[ctrl_name]['name'] = ctrl_name
- ###pool_controllers[ctrl_name]['file'] = ctrl_library
- ###pool_controllers[ctrl_name]['class'] = ctrl_class
- ###pool_controllers[ctrl_name]['properties'] = ctrl_properties
- ###pool_controllers[ctrl_name]['elements'] = ctrl_elements
- ###pool_controllers[ctrl_name]['ctrl_pool_elements'] = ctrl_pool_elements
-
- pool_elements_summary = '('+str(len(details['ctrl_pool_elements']))+')'
- print '{type}\t{name}\t{file}\t{class}\t{properties}\t{elements}'.format(**details), pool_elements_summary
-
-
- pool_elements = {}
- pool_elements['ExpChannels'] = pool_dev['ExpChannelList'].value or []
- pool_elements['Motors'] = pool_dev['MotorList'].value or []
- pool_elements['IORegs'] = pool_dev['IORegisterList'].value or []
- pool_instruments = pool_dev['InstrumentList'].value or []
-
- print '\n'
- print '----------------------------------------------------------------'
- print len(pool_instruments),'INSTRUMENTS FOR POOL '+pool
- print '----------------------------------------------------------------'
- print pool_instruments
-
- # CHECK ELEMENTS WITHOUT INSTRUMENT
- for element_type in pool_elements.keys():
- elements = pool_elements[element_type]
- elements_with_no_instrument = []
- for info in elements:
- info_splitted = info.split()
- alias = info_splitted[0]
- dev_name = info_splitted[1]
- ctrl_name, ctrl_axis = info_splitted[2].replace('(','').replace(')','').split('/')
- specific_element_type = info_splitted[3]
-
- pool_controllers[ctrl_name]['ctrl_pool_elements'].append(alias)
- if specific_element_type in ['PseudoMotor', 'PseudoCounter']:
- if len(pool_controllers[ctrl_name]['elements']) == 0:
- pool_controllers[ctrl_name]['elements'] = ' '.join(info_splitted[4:])
-
- element_dev = taurus.Device(alias)
- if element_dev['Instrument'].value == '':
- elements_with_no_instrument.append(alias)
- if len(elements_with_no_instrument) > 0:
- print '\n***',element_type,'with no Instrument:',elements_with_no_instrument,'***'
-
- print '\n'
- print '----------------------------------------------------------------'
- print 'ELEMENTS FOR POOL '+pool
- print '----------------------------------------------------------------'
- for element_type in pool_elements.keys():
- elements = pool_elements[element_type]
- print element_type+':',len(elements)
-
- print '\n'
- print '----------------------------------------------------------------'
- print 'ELEMENTS MEMORIZED ATTRIBUTES AND ATTRIBUTE CONFIGURATIONS FOR POOL '+pool
- print '----------------------------------------------------------------'
- db = taurus.Database()
- for element_type in pool_elements.keys():
- elements = pool_elements[element_type]
- for info in elements:
- info_splitted = info.split()
- alias = info_splitted[0]
- dev_name = info_splitted[1]
- ctrl_name, ctrl_axis = info_splitted[2].replace('(','').replace(')','').split('/')
- specific_element_type = info_splitted[3]
- element_dev = taurus.Device(alias)
- for attr, attr_dict in db.get_device_attribute_property(element_dev.getNormalName(), element_dev.get_attribute_list()).iteritems():
- if len(attr_dict) > 0:
- print specific_element_type, alias, attr, attr_dict
- else:
- if attr.lower() in ['position', 'value']:
- print '***',specific_element_type, alias, attr, 'NO MEMORIZED ATTRIBUTES OR ATTRIBUTE CONFIGURATIONS ***'
-
-
-
-
-if __name__ == '__main__':
- if len(sys.argv) != 2 or sys.argv[1] == '?':
- print '----------------------------------------'
- print 'Invalid number of arguments.'
- print ''
- print 'Example of usage:'
- print ' python get_pool_config pool'
- print ''
- print ' where pool is the name of the pool'
- print '----------------------------------------'
-
-
- pool = sys.argv[1]
- checkPoolElements(pool)
diff --git a/src/sardana/tools/config/pexpect23.py b/src/sardana/tools/config/pexpect23.py
deleted file mode 100644
index 67c6389f..00000000
--- a/src/sardana/tools/config/pexpect23.py
+++ /dev/null
@@ -1,1845 +0,0 @@
-"""Pexpect is a Python module for spawning child applications and controlling
-them automatically. Pexpect can be used for automating interactive applications
-such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
-scripts for duplicating software package installations on different servers. It
-can be used for automated software testing. Pexpect is in the spirit of Don
-Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python
-require TCL and Expect or require C extensions to be compiled. Pexpect does not
-use C, Expect, or TCL extensions. It should work on any platform that supports
-the standard Python pty module. The Pexpect interface focuses on ease of use so
-that simple tasks are easy.
-
-There are two main interfaces to Pexpect -- the function, run() and the class,
-spawn. You can call the run() function to execute a command and return the
-output. This is a handy replacement for os.system().
-
-For example::
-
- pexpect.run('ls -la')
-
-The more powerful interface is the spawn class. You can use this to spawn an
-external child command and then interact with the child by sending lines and
-expecting responses.
-
-For example::
-
- child = pexpect.spawn('scp foo myname@host.example.com:.')
- child.expect ('Password:')
- child.sendline (mypassword)
-
-This works even for commands that ask for passwords or other input outside of
-the normal stdio streams.
-
-Credits: Noah Spurrier, Richard Holden, Marco Molteni, Kimberley Burchett,
-Robert Stone, Hartmut Goebel, Chad Schroeder, Erick Tryzelaar, Dave Kirby, Ids
-vander Molen, George Todd, Noel Taylor, Nicolas D. Cesar, Alexander Gattin,
-Geoffrey Marshall, Francisco Lourenco, Glen Mabey, Karthik Gurusamy, Fernando
-Perez, Corey Minyard, Jon Cohen, Guillaume Chazarain, Andrew Ryan, Nick
-Craig-Wood, Andrew Stone, Jorgen Grahn (Let me know if I forgot anyone.)
-
-Free, open source, and all that good stuff.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-Pexpect Copyright (c) 2008 Noah Spurrier
-http://pexpect.sourceforge.net/
-
-$Id: pexpect.py 507 2007-12-27 02:40:52Z noah $
-"""
-
-try:
- import os, sys, time
- import select
- import string
- import re
- import struct
- import resource
- import types
- import pty
- import tty
- import termios
- import fcntl
- import errno
- import traceback
- import signal
-except ImportError, e:
- raise ImportError (str(e) + """
-
-A critical module was not found. Probably this operating system does not
-support it. Pexpect is intended for UNIX-like operating systems.""")
-
-__version__ = '2.3'
-__revision__ = '$Revision: 399 $'
-__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which',
- 'split_command_line', '__version__', '__revision__']
-
-# Exception classes used by this module.
-class ExceptionPexpect(Exception):
-
- """Base class for all exceptions raised by this module.
- """
-
- def __init__(self, value):
-
- self.value = value
-
- def __str__(self):
-
- return str(self.value)
-
- def get_trace(self):
-
- """This returns an abbreviated stack trace with lines that only concern
- the caller. In other words, the stack trace inside the Pexpect module
- is not included. """
-
- tblist = traceback.extract_tb(sys.exc_info()[2])
- #tblist = filter(self.__filter_not_pexpect, tblist)
- tblist = [item for item in tblist if self.__filter_not_pexpect(item)]
- tblist = traceback.format_list(tblist)
- return ''.join(tblist)
-
- def __filter_not_pexpect(self, trace_list_item):
-
- """This returns True if list item 0 the string 'pexpect.py' in it. """
-
- if trace_list_item[0].find('pexpect.py') == -1:
- return True
- else:
- return False
-
-class EOF(ExceptionPexpect):
-
- """Raised when EOF is read from a child. This usually means the child has exited."""
-
-class TIMEOUT(ExceptionPexpect):
-
- """Raised when a read time exceeds the timeout. """
-
-##class TIMEOUT_PATTERN(TIMEOUT):
-## """Raised when the pattern match time exceeds the timeout.
-## This is different than a read TIMEOUT because the child process may
-## give output, thus never give a TIMEOUT, but the output
-## may never match a pattern.
-## """
-##class MAXBUFFER(ExceptionPexpect):
-## """Raised when a scan buffer fills before matching an expected pattern."""
-
-def run (command, timeout=-1, withexitstatus=False, events=None, extra_args=None, logfile=None, cwd=None, env=None):
-
- """
- This function runs the given command; waits for it to finish; then
- returns all output as a string. STDERR is included in output. If the full
- path to the command is not given then the path is searched.
-
- Note that lines are terminated by CR/LF (\\r\\n) combination even on
- UNIX-like systems because this is the standard for pseudo ttys. If you set
- 'withexitstatus' to true, then run will return a tuple of (command_output,
- exitstatus). If 'withexitstatus' is false then this returns just
- command_output.
-
- The run() function can often be used instead of creating a spawn instance.
- For example, the following code uses spawn::
-
- from pexpect import *
- child = spawn('scp foo myname@host.example.com:.')
- child.expect ('(?i)password')
- child.sendline (mypassword)
-
- The previous code can be replace with the following::
-
- from pexpect import *
- run ('scp foo myname@host.example.com:.', events={'(?i)password': mypassword})
-
- Examples
- ========
-
- Start the apache daemon on the local machine::
-
- from pexpect import *
- run ("/usr/local/apache/bin/apachectl start")
-
- Check in a file using SVN::
-
- from pexpect import *
- run ("svn ci -m 'automatic commit' my_file.py")
-
- Run a command and capture exit status::
-
- from pexpect import *
- (command_output, exitstatus) = run ('ls -l /bin', withexitstatus=1)
-
- Tricky Examples
- ===============
-
- The following will run SSH and execute 'ls -l' on the remote machine. The
- password 'secret' will be sent if the '(?i)password' pattern is ever seen::
-
- run ("ssh username@machine.example.com 'ls -l'", events={'(?i)password':'secret\\n'})
-
- This will start mencoder to rip a video from DVD. This will also display
- progress ticks every 5 seconds as it runs. For example::
-
- from pexpect import *
- def print_ticks(d):
- print d['event_count'],
- run ("mencoder dvd://1 -o video.avi -oac copy -ovc copy", events={TIMEOUT:print_ticks}, timeout=5)
-
- The 'events' argument should be a dictionary of patterns and responses.
- Whenever one of the patterns is seen in the command out run() will send the
- associated response string. Note that you should put newlines in your
- string if Enter is necessary. The responses may also contain callback
- functions. Any callback is function that takes a dictionary as an argument.
- The dictionary contains all the locals from the run() function, so you can
- access the child spawn object or any other variable defined in run()
- (event_count, child, and extra_args are the most useful). A callback may
- return True to stop the current run process otherwise run() continues until
- the next event. A callback may also return a string which will be sent to
- the child. 'extra_args' is not used by directly run(). It provides a way to
- pass data to a callback function through run() through the locals
- dictionary passed to a callback. """
-
- if timeout == -1:
- child = spawn(command, maxread=2000, logfile=logfile, cwd=cwd, env=env)
- else:
- child = spawn(command, timeout=timeout, maxread=2000, logfile=logfile, cwd=cwd, env=env)
- if events is not None:
- patterns = events.keys()
- responses = events.values()
- else:
- patterns=None # We assume that EOF or TIMEOUT will save us.
- responses=None
- child_result_list = []
- event_count = 0
- while 1:
- try:
- index = child.expect (patterns)
- if type(child.after) in types.StringTypes:
- child_result_list.append(child.before + child.after)
- else: # child.after may have been a TIMEOUT or EOF, so don't cat those.
- child_result_list.append(child.before)
- if type(responses[index]) in types.StringTypes:
- child.send(responses[index])
- elif type(responses[index]) is types.FunctionType:
- callback_result = responses[index](locals())
- sys.stdout.flush()
- if type(callback_result) in types.StringTypes:
- child.send(callback_result)
- elif callback_result:
- break
- else:
- raise TypeError ('The callback must be a string or function type.')
- event_count = event_count + 1
- except TIMEOUT, e:
- child_result_list.append(child.before)
- break
- except EOF, e:
- child_result_list.append(child.before)
- break
- child_result = ''.join(child_result_list)
- if withexitstatus:
- child.close()
- return (child_result, child.exitstatus)
- else:
- return child_result
-
-class spawn (object):
-
- """This is the main class interface for Pexpect. Use this class to start
- and control child applications. """
-
- def __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None):
-
- """This is the constructor. The command parameter may be a string that
- includes a command and any arguments to the command. For example::
-
- child = pexpect.spawn ('/usr/bin/ftp')
- child = pexpect.spawn ('/usr/bin/ssh user@example.com')
- child = pexpect.spawn ('ls -latr /tmp')
-
- You may also construct it with a list of arguments like so::
-
- child = pexpect.spawn ('/usr/bin/ftp', [])
- child = pexpect.spawn ('/usr/bin/ssh', ['user@example.com'])
- child = pexpect.spawn ('ls', ['-latr', '/tmp'])
-
- After this the child application will be created and will be ready to
- talk to. For normal use, see expect() and send() and sendline().
-
- Remember that Pexpect does NOT interpret shell meta characters such as
- redirect, pipe, or wild cards (>, |, or *). This is a common mistake.
- If you want to run a command and pipe it through another command then
- you must also start a shell. For example::
-
- child = pexpect.spawn('/bin/bash -c "ls -l | grep LOG > log_list.txt"')
- child.expect(pexpect.EOF)
-
- The second form of spawn (where you pass a list of arguments) is useful
- in situations where you wish to spawn a command and pass it its own
- argument list. This can make syntax more clear. For example, the
- following is equivalent to the previous example::
-
- shell_cmd = 'ls -l | grep LOG > log_list.txt'
- child = pexpect.spawn('/bin/bash', ['-c', shell_cmd])
- child.expect(pexpect.EOF)
-
- The maxread attribute sets the read buffer size. This is maximum number
- of bytes that Pexpect will try to read from a TTY at one time. Setting
- the maxread size to 1 will turn off buffering. Setting the maxread
- value higher may help performance in cases where large amounts of
- output are read back from the child. This feature is useful in
- conjunction with searchwindowsize.
-
- The searchwindowsize attribute sets the how far back in the incomming
- seach buffer Pexpect will search for pattern matches. Every time
- Pexpect reads some data from the child it will append the data to the
- incomming buffer. The default is to search from the beginning of the
- imcomming buffer each time new data is read from the child. But this is
- very inefficient if you are running a command that generates a large
- amount of data where you want to match The searchwindowsize does not
- effect the size of the incomming data buffer. You will still have
- access to the full buffer after expect() returns.
-
- The logfile member turns on or off logging. All input and output will
- be copied to the given file object. Set logfile to None to stop
- logging. This is the default. Set logfile to sys.stdout to echo
- everything to standard output. The logfile is flushed after each write.
-
- Example log input and output to a file::
-
- child = pexpect.spawn('some_command')
- fout = file('mylog.txt','w')
- child.logfile = fout
-
- Example log to stdout::
-
- child = pexpect.spawn('some_command')
- child.logfile = sys.stdout
-
- The logfile_read and logfile_send members can be used to separately log
- the input from the child and output sent to the child. Sometimes you
- don't want to see everything you write to the child. You only want to
- log what the child sends back. For example::
-
- child = pexpect.spawn('some_command')
- child.logfile_read = sys.stdout
-
- To separately log output sent to the child use logfile_send::
-
- self.logfile_send = fout
-
- The delaybeforesend helps overcome a weird behavior that many users
- were experiencing. The typical problem was that a user would expect() a
- "Password:" prompt and then immediately call sendline() to send the
- password. The user would then see that their password was echoed back
- to them. Passwords don't normally echo. The problem is caused by the
- fact that most applications print out the "Password" prompt and then
- turn off stdin echo, but if you send your password before the
- application turned off echo, then you get your password echoed.
- Normally this wouldn't be a problem when interacting with a human at a
- real keyboard. If you introduce a slight delay just before writing then
- this seems to clear up the problem. This was such a common problem for
- many users that I decided that the default pexpect behavior should be
- to sleep just before writing to the child application. 1/20th of a
- second (50 ms) seems to be enough to clear up the problem. You can set
- delaybeforesend to 0 to return to the old behavior. Most Linux machines
- don't like this to be below 0.03. I don't know why.
-
- Note that spawn is clever about finding commands on your path.
- It uses the same logic that "which" uses to find executables.
-
- If you wish to get the exit status of the child you must call the
- close() method. The exit or signal status of the child will be stored
- in self.exitstatus or self.signalstatus. If the child exited normally
- then exitstatus will store the exit return code and signalstatus will
- be None. If the child was terminated abnormally with a signal then
- signalstatus will store the signal value and exitstatus will be None.
- If you need more detail you can also read the self.status member which
- stores the status returned by os.waitpid. You can interpret this using
- os.WIFEXITED/os.WEXITSTATUS or os.WIFSIGNALED/os.TERMSIG. """
-
- self.STDIN_FILENO = pty.STDIN_FILENO
- self.STDOUT_FILENO = pty.STDOUT_FILENO
- self.STDERR_FILENO = pty.STDERR_FILENO
- self.stdin = sys.stdin
- self.stdout = sys.stdout
- self.stderr = sys.stderr
-
- self.searcher = None
- self.ignorecase = False
- self.before = None
- self.after = None
- self.match = None
- self.match_index = None
- self.terminated = True
- self.exitstatus = None
- self.signalstatus = None
- self.status = None # status returned by os.waitpid
- self.flag_eof = False
- self.pid = None
- self.child_fd = -1 # initially closed
- self.timeout = timeout
- self.delimiter = EOF
- self.logfile = logfile
- self.logfile_read = None # input from child (read_nonblocking)
- self.logfile_send = None # output to send (send, sendline)
- self.maxread = maxread # max bytes to read at one time into buffer
- self.buffer = '' # This is the read buffer. See maxread.
- self.searchwindowsize = searchwindowsize # Anything before searchwindowsize point is preserved, but not searched.
- # Most Linux machines don't like delaybeforesend to be below 0.03 (30 ms).
- self.delaybeforesend = 0.05 # Sets sleep time used just before sending data to child. Time in seconds.
- self.delayafterclose = 0.1 # Sets delay in close() method to allow kernel time to update process status. Time in seconds.
- self.delayafterterminate = 0.1 # Sets delay in terminate() method to allow kernel time to update process status. Time in seconds.
- self.softspace = False # File-like object.
- self.name = '<' + repr(self) + '>' # File-like object.
- self.encoding = None # File-like object.
- self.closed = True # File-like object.
- self.cwd = cwd
- self.env = env
- self.__irix_hack = (sys.platform.lower().find('irix')>=0) # This flags if we are running on irix
- # Solaris uses internal __fork_pty(). All others use pty.fork().
- if (sys.platform.lower().find('solaris')>=0) or (sys.platform.lower().find('sunos5')>=0):
- self.use_native_pty_fork = False
- else:
- self.use_native_pty_fork = True
-
-
- # allow dummy instances for subclasses that may not use command or args.
- if command is None:
- self.command = None
- self.args = None
- self.name = '<pexpect factory incomplete>'
- else:
- self._spawn (command, args)
-
- def __del__(self):
-
- """This makes sure that no system resources are left open. Python only
- garbage collects Python objects. OS file descriptors are not Python
- objects, so they must be handled explicitly. If the child file
- descriptor was opened outside of this class (passed to the constructor)
- then this does not close it. """
-
- if not self.closed:
- # It is possible for __del__ methods to execute during the
- # teardown of the Python VM itself. Thus self.close() may
- # trigger an exception because os.close may be None.
- # -- Fernando Perez
- try:
- self.close()
- except AttributeError:
- pass
-
- def __str__(self):
-
- """This returns a human-readable string that represents the state of
- the object. """
-
- s = []
- s.append(repr(self))
- s.append('version: ' + __version__ + ' (' + __revision__ + ')')
- s.append('command: ' + str(self.command))
- s.append('args: ' + str(self.args))
- s.append('searcher: ' + str(self.searcher))
- s.append('buffer (last 100 chars): ' + str(self.buffer)[-100:])
- s.append('before (last 100 chars): ' + str(self.before)[-100:])
- s.append('after: ' + str(self.after))
- s.append('match: ' + str(self.match))
- s.append('match_index: ' + str(self.match_index))
- s.append('exitstatus: ' + str(self.exitstatus))
- s.append('flag_eof: ' + str(self.flag_eof))
- s.append('pid: ' + str(self.pid))
- s.append('child_fd: ' + str(self.child_fd))
- s.append('closed: ' + str(self.closed))
- s.append('timeout: ' + str(self.timeout))
- s.append('delimiter: ' + str(self.delimiter))
- s.append('logfile: ' + str(self.logfile))
- s.append('logfile_read: ' + str(self.logfile_read))
- s.append('logfile_send: ' + str(self.logfile_send))
- s.append('maxread: ' + str(self.maxread))
- s.append('ignorecase: ' + str(self.ignorecase))
- s.append('searchwindowsize: ' + str(self.searchwindowsize))
- s.append('delaybeforesend: ' + str(self.delaybeforesend))
- s.append('delayafterclose: ' + str(self.delayafterclose))
- s.append('delayafterterminate: ' + str(self.delayafterterminate))
- return '\n'.join(s)
-
- def _spawn(self,command,args=[]):
-
- """This starts the given command in a child process. This does all the
- fork/exec type of stuff for a pty. This is called by __init__. If args
- is empty then command will be parsed (split on spaces) and args will be
- set to parsed arguments. """
-
- # The pid and child_fd of this object get set by this method.
- # Note that it is difficult for this method to fail.
- # You cannot detect if the child process cannot start.
- # So the only way you can tell if the child process started
- # or not is to try to read from the file descriptor. If you get
- # EOF immediately then it means that the child is already dead.
- # That may not necessarily be bad because you may haved spawned a child
- # that performs some task; creates no stdout output; and then dies.
-
- # If command is an int type then it may represent a file descriptor.
- if type(command) == type(0):
- raise ExceptionPexpect ('Command is an int type. If this is a file descriptor then maybe you want to use fdpexpect.fdspawn which takes an existing file descriptor instead of a command string.')
-
- if type (args) != type([]):
- raise TypeError ('The argument, args, must be a list.')
-
- if args == []:
- self.args = split_command_line(command)
- self.command = self.args[0]
- else:
- self.args = args[:] # work with a copy
- self.args.insert (0, command)
- self.command = command
-
- command_with_path = which(self.command)
- if command_with_path is None:
- raise ExceptionPexpect ('The command was not found or was not executable: %s.' % self.command)
- self.command = command_with_path
- self.args[0] = self.command
-
- self.name = '<' + ' '.join (self.args) + '>'
-
- assert self.pid is None, 'The pid member should be None.'
- assert self.command is not None, 'The command member should not be None.'
-
- if self.use_native_pty_fork:
- try:
- self.pid, self.child_fd = pty.fork()
- except OSError, e:
- raise ExceptionPexpect('Error! pty.fork() failed: ' + str(e))
- else: # Use internal __fork_pty
- self.pid, self.child_fd = self.__fork_pty()
-
- if self.pid == 0: # Child
- try:
- self.child_fd = sys.stdout.fileno() # used by setwinsize()
- self.setwinsize(24, 80)
- except:
- # Some platforms do not like setwinsize (Cygwin).
- # This will cause problem when running applications that
- # are very picky about window size.
- # This is a serious limitation, but not a show stopper.
- pass
- # Do not allow child to inherit open file descriptors from parent.
- max_fd = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
- for i in range (3, max_fd):
- try:
- os.close (i)
- except OSError:
- pass
-
- # I don't know why this works, but ignoring SIGHUP fixes a
- # problem when trying to start a Java daemon with sudo
- # (specifically, Tomcat).
- signal.signal(signal.SIGHUP, signal.SIG_IGN)
-
- if self.cwd is not None:
- os.chdir(self.cwd)
- if self.env is None:
- os.execv(self.command, self.args)
- else:
- os.execvpe(self.command, self.args, self.env)
-
- # Parent
- self.terminated = False
- self.closed = False
-
- def __fork_pty(self):
-
- """This implements a substitute for the forkpty system call. This
- should be more portable than the pty.fork() function. Specifically,
- this should work on Solaris.
-
- Modified 10.06.05 by Geoff Marshall: Implemented __fork_pty() method to
- resolve the issue with Python's pty.fork() not supporting Solaris,
- particularly ssh. Based on patch to posixmodule.c authored by Noah
- Spurrier::
-
- http://mail.python.org/pipermail/python-dev/2003-May/035281.html
-
- """
-
- parent_fd, child_fd = os.openpty()
- if parent_fd < 0 or child_fd < 0:
- raise ExceptionPexpect, "Error! Could not open pty with os.openpty()."
-
- pid = os.fork()
- if pid < 0:
- raise ExceptionPexpect, "Error! Failed os.fork()."
- elif pid == 0:
- # Child.
- os.close(parent_fd)
- self.__pty_make_controlling_tty(child_fd)
-
- os.dup2(child_fd, 0)
- os.dup2(child_fd, 1)
- os.dup2(child_fd, 2)
-
- if child_fd > 2:
- os.close(child_fd)
- else:
- # Parent.
- os.close(child_fd)
-
- return pid, parent_fd
-
- def __pty_make_controlling_tty(self, tty_fd):
-
- """This makes the pseudo-terminal the controlling tty. This should be
- more portable than the pty.fork() function. Specifically, this should
- work on Solaris. """
-
- child_name = os.ttyname(tty_fd)
-
- # Disconnect from controlling tty if still connected.
- fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY);
- if fd >= 0:
- os.close(fd)
-
- os.setsid()
-
- # Verify we are disconnected from controlling tty
- try:
- fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY);
- if fd >= 0:
- os.close(fd)
- raise ExceptionPexpect, "Error! We are not disconnected from a controlling tty."
- except:
- # Good! We are disconnected from a controlling tty.
- pass
-
- # Verify we can open child pty.
- fd = os.open(child_name, os.O_RDWR);
- if fd < 0:
- raise ExceptionPexpect, "Error! Could not open child pty, " + child_name
- else:
- os.close(fd)
-
- # Verify we now have a controlling tty.
- fd = os.open("/dev/tty", os.O_WRONLY)
- if fd < 0:
- raise ExceptionPexpect, "Error! Could not open controlling tty, /dev/tty"
- else:
- os.close(fd)
-
- def fileno (self): # File-like object.
-
- """This returns the file descriptor of the pty for the child.
- """
-
- return self.child_fd
-
- def close (self, force=True): # File-like object.
-
- """This closes the connection with the child application. Note that
- calling close() more than once is valid. This emulates standard Python
- behavior with files. Set force to True if you want to make sure that
- the child is terminated (SIGKILL is sent if the child ignores SIGHUP
- and SIGINT). """
-
- if not self.closed:
- self.flush()
- os.close (self.child_fd)
- time.sleep(self.delayafterclose) # Give kernel time to update process status.
- if self.isalive():
- if not self.terminate(force):
- raise ExceptionPexpect ('close() could not terminate the child using terminate()')
- self.child_fd = -1
- self.closed = True
- #self.pid = None
-
- def flush (self): # File-like object.
-
- """This does nothing. It is here to support the interface for a
- File-like object. """
-
- pass
-
- def isatty (self): # File-like object.
-
- """This returns True if the file descriptor is open and connected to a
- tty(-like) device, else False. """
-
- return os.isatty(self.child_fd)
-
- def waitnoecho (self, timeout=-1):
-
- """This waits until the terminal ECHO flag is set False. This returns
- True if the echo mode is off. This returns False if the ECHO flag was
- not set False before the timeout. This can be used to detect when the
- child is waiting for a password. Usually a child application will turn
- off echo mode when it is waiting for the user to enter a password. For
- example, instead of expecting the "password:" prompt you can wait for
- the child to set ECHO off::
-
- p = pexpect.spawn ('ssh user@example.com')
- p.waitnoecho()
- p.sendline(mypassword)
-
- If timeout is None then this method to block forever until ECHO flag is
- False.
-
- """
-
- if timeout == -1:
- timeout = self.timeout
- if timeout is not None:
- end_time = time.time() + timeout
- while True:
- if not self.getecho():
- return True
- if timeout < 0 and timeout is not None:
- return False
- if timeout is not None:
- timeout = end_time - time.time()
- time.sleep(0.1)
-
- def getecho (self):
-
- """This returns the terminal echo mode. This returns True if echo is
- on or False if echo is off. Child applications that are expecting you
- to enter a password often set ECHO False. See waitnoecho(). """
-
- attr = termios.tcgetattr(self.child_fd)
- if attr[3] & termios.ECHO:
- return True
- return False
-
- def setecho (self, state):
-
- """This sets the terminal echo mode on or off. Note that anything the
- child sent before the echo will be lost, so you should be sure that
- your input buffer is empty before you call setecho(). For example, the
- following will work as expected::
-
- p = pexpect.spawn('cat')
- p.sendline ('1234') # We will see this twice (once from tty echo and again from cat).
- p.expect (['1234'])
- p.expect (['1234'])
- p.setecho(False) # Turn off tty echo
- p.sendline ('abcd') # We will set this only once (echoed by cat).
- p.sendline ('wxyz') # We will set this only once (echoed by cat)
- p.expect (['abcd'])
- p.expect (['wxyz'])
-
- The following WILL NOT WORK because the lines sent before the setecho
- will be lost::
-
- p = pexpect.spawn('cat')
- p.sendline ('1234') # We will see this twice (once from tty echo and again from cat).
- p.setecho(False) # Turn off tty echo
- p.sendline ('abcd') # We will set this only once (echoed by cat).
- p.sendline ('wxyz') # We will set this only once (echoed by cat)
- p.expect (['1234'])
- p.expect (['1234'])
- p.expect (['abcd'])
- p.expect (['wxyz'])
- """
-
- self.child_fd
- attr = termios.tcgetattr(self.child_fd)
- if state:
- attr[3] = attr[3] | termios.ECHO
- else:
- attr[3] = attr[3] & ~termios.ECHO
- # I tried TCSADRAIN and TCSAFLUSH, but these were inconsistent
- # and blocked on some platforms. TCSADRAIN is probably ideal if it worked.
- termios.tcsetattr(self.child_fd, termios.TCSANOW, attr)
-
- def read_nonblocking (self, size = 1, timeout = -1):
-
- """This reads at most size characters from the child application. It
- includes a timeout. If the read does not complete within the timeout
- period then a TIMEOUT exception is raised. If the end of file is read
- then an EOF exception will be raised. If a log file was set using
- setlog() then all data will also be written to the log file.
-
- If timeout is None then the read may block indefinitely. If timeout is -1
- then the self.timeout value is used. If timeout is 0 then the child is
- polled and if there was no data immediately ready then this will raise
- a TIMEOUT exception.
-
- The timeout refers only to the amount of time to read at least one
- character. This is not effected by the 'size' parameter, so if you call
- read_nonblocking(size=100, timeout=30) and only one character is
- available right away then one character will be returned immediately.
- It will not wait for 30 seconds for another 99 characters to come in.
-
- This is a wrapper around os.read(). It uses select.select() to
- implement the timeout. """
-
- if self.closed:
- raise ValueError ('I/O operation on closed file in read_nonblocking().')
-
- if timeout == -1:
- timeout = self.timeout
-
- # Note that some systems such as Solaris do not give an EOF when
- # the child dies. In fact, you can still try to read
- # from the child_fd -- it will block forever or until TIMEOUT.
- # For this case, I test isalive() before doing any reading.
- # If isalive() is false, then I pretend that this is the same as EOF.
- if not self.isalive():
- r,w,e = self.__select([self.child_fd], [], [], 0) # timeout of 0 means "poll"
- if not r:
- self.flag_eof = True
- raise EOF ('End Of File (EOF) in read_nonblocking(). Braindead platform.')
- elif self.__irix_hack:
- # This is a hack for Irix. It seems that Irix requires a long delay before checking isalive.
- # This adds a 2 second delay, but only when the child is terminated.
- r, w, e = self.__select([self.child_fd], [], [], 2)
- if not r and not self.isalive():
- self.flag_eof = True
- raise EOF ('End Of File (EOF) in read_nonblocking(). Pokey platform.')
-
- r,w,e = self.__select([self.child_fd], [], [], timeout)
-
- if not r:
- if not self.isalive():
- # Some platforms, such as Irix, will claim that their processes are alive;
- # then timeout on the select; and then finally admit that they are not alive.
- self.flag_eof = True
- raise EOF ('End of File (EOF) in read_nonblocking(). Very pokey platform.')
- else:
- raise TIMEOUT ('Timeout exceeded in read_nonblocking().')
-
- if self.child_fd in r:
- try:
- s = os.read(self.child_fd, size)
- except OSError, e: # Linux does this
- self.flag_eof = True
- raise EOF ('End Of File (EOF) in read_nonblocking(). Exception style platform.')
- if s == '': # BSD style
- self.flag_eof = True
- raise EOF ('End Of File (EOF) in read_nonblocking(). Empty string style platform.')
-
- if self.logfile is not None:
- self.logfile.write (s)
- self.logfile.flush()
- if self.logfile_read is not None:
- self.logfile_read.write (s)
- self.logfile_read.flush()
-
- return s
-
- raise ExceptionPexpect ('Reached an unexpected state in read_nonblocking().')
-
- def read (self, size = -1): # File-like object.
-
- """This reads at most "size" bytes from the file (less if the read hits
- EOF before obtaining size bytes). If the size argument is negative or
- omitted, read all data until EOF is reached. The bytes are returned as
- a string object. An empty string is returned when EOF is encountered
- immediately. """
-
- if size == 0:
- return ''
- if size < 0:
- self.expect (self.delimiter) # delimiter default is EOF
- return self.before
-
- # I could have done this more directly by not using expect(), but
- # I deliberately decided to couple read() to expect() so that
- # I would catch any bugs early and ensure consistant behavior.
- # It's a little less efficient, but there is less for me to
- # worry about if I have to later modify read() or expect().
- # Note, it's OK if size==-1 in the regex. That just means it
- # will never match anything in which case we stop only on EOF.
- cre = re.compile('.{%d}' % size, re.DOTALL)
- index = self.expect ([cre, self.delimiter]) # delimiter default is EOF
- if index == 0:
- return self.after ### self.before should be ''. Should I assert this?
- return self.before
-
- def readline (self, size = -1): # File-like object.
-
- """This reads and returns one entire line. A trailing newline is kept
- in the string, but may be absent when a file ends with an incomplete
- line. Note: This readline() looks for a \\r\\n pair even on UNIX
- because this is what the pseudo tty device returns. So contrary to what
- you may expect you will receive the newline as \\r\\n. An empty string
- is returned when EOF is hit immediately. Currently, the size argument is
- mostly ignored, so this behavior is not standard for a file-like
- object. If size is 0 then an empty string is returned. """
-
- if size == 0:
- return ''
- index = self.expect (['\r\n', self.delimiter]) # delimiter default is EOF
- if index == 0:
- return self.before + '\r\n'
- else:
- return self.before
-
- def __iter__ (self): # File-like object.
-
- """This is to support iterators over a file-like object.
- """
-
- return self
-
- def next (self): # File-like object.
-
- """This is to support iterators over a file-like object.
- """
-
- result = self.readline()
- if result == "":
- raise StopIteration
- return result
-
- def readlines (self, sizehint = -1): # File-like object.
-
- """This reads until EOF using readline() and returns a list containing
- the lines thus read. The optional "sizehint" argument is ignored. """
-
- lines = []
- while True:
- line = self.readline()
- if not line:
- break
- lines.append(line)
- return lines
-
- def write(self, s): # File-like object.
-
- """This is similar to send() except that there is no return value.
- """
-
- self.send (s)
-
- def writelines (self, sequence): # File-like object.
-
- """This calls write() for each element in the sequence. The sequence
- can be any iterable object producing strings, typically a list of
- strings. This does not add line separators There is no return value.
- """
-
- for s in sequence:
- self.write (s)
-
- def send(self, s):
-
- """This sends a string to the child process. This returns the number of
- bytes written. If a log file was set then the data is also written to
- the log. """
-
- time.sleep(self.delaybeforesend)
- if self.logfile is not None:
- self.logfile.write (s)
- self.logfile.flush()
- if self.logfile_send is not None:
- self.logfile_send.write (s)
- self.logfile_send.flush()
- c = os.write(self.child_fd, s)
- return c
-
- def sendline(self, s=''):
-
- """This is like send(), but it adds a line feed (os.linesep). This
- returns the number of bytes written. """
-
- n = self.send(s)
- n = n + self.send (os.linesep)
- return n
-
- def sendcontrol(self, char):
-
- """This sends a control character to the child such as Ctrl-C or
- Ctrl-D. For example, to send a Ctrl-G (ASCII 7)::
-
- child.sendcontrol('g')
-
- See also, sendintr() and sendeof().
- """
-
- char = char.lower()
- a = ord(char)
- if a>=97 and a<=122:
- a = a - ord('a') + 1
- return self.send (chr(a))
- d = {'@':0, '`':0,
- '[':27, '{':27,
- '\\':28, '|':28,
- ']':29, '}': 29,
- '^':30, '~':30,
- '_':31,
- '?':127}
- if char not in d:
- return 0
- return self.send (chr(d[char]))
-
- def sendeof(self):
-
- """This sends an EOF to the child. This sends a character which causes
- the pending parent output buffer to be sent to the waiting child
- program without waiting for end-of-line. If it is the first character
- of the line, the read() in the user program returns 0, which signifies
- end-of-file. This means to work as expected a sendeof() has to be
- called at the beginning of a line. This method does not send a newline.
- It is the responsibility of the caller to ensure the eof is sent at the
- beginning of a line. """
-
- ### Hmmm... how do I send an EOF?
- ###C if ((m = write(pty, *buf, p - *buf)) < 0)
- ###C return (errno == EWOULDBLOCK) ? n : -1;
- #fd = sys.stdin.fileno()
- #old = termios.tcgetattr(fd) # remember current state
- #attr = termios.tcgetattr(fd)
- #attr[3] = attr[3] | termios.ICANON # ICANON must be set to recognize EOF
- #try: # use try/finally to ensure state gets restored
- # termios.tcsetattr(fd, termios.TCSADRAIN, attr)
- # if hasattr(termios, 'CEOF'):
- # os.write (self.child_fd, '%c' % termios.CEOF)
- # else:
- # # Silly platform does not define CEOF so assume CTRL-D
- # os.write (self.child_fd, '%c' % 4)
- #finally: # restore state
- # termios.tcsetattr(fd, termios.TCSADRAIN, old)
- if hasattr(termios, 'VEOF'):
- char = termios.tcgetattr(self.child_fd)[6][termios.VEOF]
- else:
- # platform does not define VEOF so assume CTRL-D
- char = chr(4)
- self.send(char)
-
- def sendintr(self):
-
- """This sends a SIGINT to the child. It does not require
- the SIGINT to be the first character on a line. """
-
- if hasattr(termios, 'VINTR'):
- char = termios.tcgetattr(self.child_fd)[6][termios.VINTR]
- else:
- # platform does not define VINTR so assume CTRL-C
- char = chr(3)
- self.send (char)
-
- def eof (self):
-
- """This returns True if the EOF exception was ever raised.
- """
-
- return self.flag_eof
-
- def terminate(self, force=False):
-
- """This forces a child process to terminate. It starts nicely with
- SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
- returns True if the child was terminated. This returns False if the
- child could not be terminated. """
-
- if not self.isalive():
- return True
- try:
- self.kill(signal.SIGHUP)
- time.sleep(self.delayafterterminate)
- if not self.isalive():
- return True
- self.kill(signal.SIGCONT)
- time.sleep(self.delayafterterminate)
- if not self.isalive():
- return True
- self.kill(signal.SIGINT)
- time.sleep(self.delayafterterminate)
- if not self.isalive():
- return True
- if force:
- self.kill(signal.SIGKILL)
- time.sleep(self.delayafterterminate)
- if not self.isalive():
- return True
- else:
- return False
- return False
- except OSError, e:
- # I think there are kernel timing issues that sometimes cause
- # this to happen. I think isalive() reports True, but the
- # process is dead to the kernel.
- # Make one last attempt to see if the kernel is up to date.
- time.sleep(self.delayafterterminate)
- if not self.isalive():
- return True
- else:
- return False
-
- def wait(self):
-
- """This waits until the child exits. This is a blocking call. This will
- not read any data from the child, so this will block forever if the
- child has unread output and has terminated. In other words, the child
- may have printed output then called exit(); but, technically, the child
- is still alive until its output is read. """
-
- if self.isalive():
- pid, status = os.waitpid(self.pid, 0)
- else:
- raise ExceptionPexpect ('Cannot wait for dead child process.')
- self.exitstatus = os.WEXITSTATUS(status)
- if os.WIFEXITED (status):
- self.status = status
- self.exitstatus = os.WEXITSTATUS(status)
- self.signalstatus = None
- self.terminated = True
- elif os.WIFSIGNALED (status):
- self.status = status
- self.exitstatus = None
- self.signalstatus = os.WTERMSIG(status)
- self.terminated = True
- elif os.WIFSTOPPED (status):
- raise ExceptionPexpect ('Wait was called for a child process that is stopped. This is not supported. Is some other process attempting job control with our child pid?')
- return self.exitstatus
-
- def isalive(self):
-
- """This tests if the child process is running or not. This is
- non-blocking. If the child was terminated then this will read the
- exitstatus or signalstatus of the child. This returns True if the child
- process appears to be running or False if not. It can take literally
- SECONDS for Solaris to return the right status. """
-
- if self.terminated:
- return False
-
- if self.flag_eof:
- # This is for Linux, which requires the blocking form of waitpid to get
- # status of a defunct process. This is super-lame. The flag_eof would have
- # been set in read_nonblocking(), so this should be safe.
- waitpid_options = 0
- else:
- waitpid_options = os.WNOHANG
-
- try:
- pid, status = os.waitpid(self.pid, waitpid_options)
- except OSError, e: # No child processes
- if e[0] == errno.ECHILD:
- raise ExceptionPexpect ('isalive() encountered condition where "terminated" is 0, but there was no child process. Did someone else call waitpid() on our process?')
- else:
- raise e
-
- # I have to do this twice for Solaris. I can't even believe that I figured this out...
- # If waitpid() returns 0 it means that no child process wishes to
- # report, and the value of status is undefined.
- if pid == 0:
- try:
- pid, status = os.waitpid(self.pid, waitpid_options) ### os.WNOHANG) # Solaris!
- except OSError, e: # This should never happen...
- if e[0] == errno.ECHILD:
- raise ExceptionPexpect ('isalive() encountered condition that should never happen. There was no child process. Did someone else call waitpid() on our process?')
- else:
- raise e
-
- # If pid is still 0 after two calls to waitpid() then
- # the process really is alive. This seems to work on all platforms, except
- # for Irix which seems to require a blocking call on waitpid or select, so I let read_nonblocking
- # take care of this situation (unfortunately, this requires waiting through the timeout).
- if pid == 0:
- return True
-
- if pid == 0:
- return True
-
- if os.WIFEXITED (status):
- self.status = status
- self.exitstatus = os.WEXITSTATUS(status)
- self.signalstatus = None
- self.terminated = True
- elif os.WIFSIGNALED (status):
- self.status = status
- self.exitstatus = None
- self.signalstatus = os.WTERMSIG(status)
- self.terminated = True
- elif os.WIFSTOPPED (status):
- raise ExceptionPexpect ('isalive() encountered condition where child process is stopped. This is not supported. Is some other process attempting job control with our child pid?')
- return False
-
- def kill(self, sig):
-
- """This sends the given signal to the child application. In keeping
- with UNIX tradition it has a misleading name. It does not necessarily
- kill the child unless you send the right signal. """
-
- # Same as os.kill, but the pid is given for you.
- if self.isalive():
- os.kill(self.pid, sig)
-
- def compile_pattern_list(self, patterns):
-
- """This compiles a pattern-string or a list of pattern-strings.
- Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of
- those. Patterns may also be None which results in an empty list (you
- might do this if waiting for an EOF or TIMEOUT condition without
- expecting any pattern).
-
- This is used by expect() when calling expect_list(). Thus expect() is
- nothing more than::
-
- cpl = self.compile_pattern_list(pl)
- return self.expect_list(cpl, timeout)
-
- If you are using expect() within a loop it may be more
- efficient to compile the patterns first and then call expect_list().
- This avoid calls in a loop to compile_pattern_list()::
-
- cpl = self.compile_pattern_list(my_pattern)
- while some_condition:
- ...
- i = self.expect_list(clp, timeout)
- ...
- """
-
- if patterns is None:
- return []
- if type(patterns) is not types.ListType:
- patterns = [patterns]
-
- compile_flags = re.DOTALL # Allow dot to match \n
- if self.ignorecase:
- compile_flags = compile_flags | re.IGNORECASE
- compiled_pattern_list = []
- for p in patterns:
- if type(p) in types.StringTypes:
- compiled_pattern_list.append(re.compile(p, compile_flags))
- elif p is EOF:
- compiled_pattern_list.append(EOF)
- elif p is TIMEOUT:
- compiled_pattern_list.append(TIMEOUT)
- elif type(p) is type(re.compile('')):
- compiled_pattern_list.append(p)
- else:
- raise TypeError ('Argument must be one of StringTypes, EOF, TIMEOUT, SRE_Pattern, or a list of those type. %s' % str(type(p)))
-
- return compiled_pattern_list
-
- def expect(self, pattern, timeout = -1, searchwindowsize=None):
-
- """This seeks through the stream until a pattern is matched. The
- pattern is overloaded and may take several types. The pattern can be a
- StringType, EOF, a compiled re, or a list of any of those types.
- Strings will be compiled to re types. This returns the index into the
- pattern list. If the pattern was not a list this returns index 0 on a
- successful match. This may raise exceptions for EOF or TIMEOUT. To
- avoid the EOF or TIMEOUT exceptions add EOF or TIMEOUT to the pattern
- list. That will cause expect to match an EOF or TIMEOUT condition
- instead of raising an exception.
-
- If you pass a list of patterns and more than one matches, the first match
- in the stream is chosen. If more than one pattern matches at that point,
- the leftmost in the pattern list is chosen. For example::
-
- # the input is 'foobar'
- index = p.expect (['bar', 'foo', 'foobar'])
- # returns 1 ('foo') even though 'foobar' is a "better" match
-
- Please note, however, that buffering can affect this behavior, since
- input arrives in unpredictable chunks. For example::
-
- # the input is 'foobar'
- index = p.expect (['foobar', 'foo'])
- # returns 0 ('foobar') if all input is available at once,
- # but returs 1 ('foo') if parts of the final 'bar' arrive late
-
- After a match is found the instance attributes 'before', 'after' and
- 'match' will be set. You can see all the data read before the match in
- 'before'. You can see the data that was matched in 'after'. The
- re.MatchObject used in the re match will be in 'match'. If an error
- occurred then 'before' will be set to all the data read so far and
- 'after' and 'match' will be None.
-
- If timeout is -1 then timeout will be set to the self.timeout value.
-
- A list entry may be EOF or TIMEOUT instead of a string. This will
- catch these exceptions and return the index of the list entry instead
- of raising the exception. The attribute 'after' will be set to the
- exception type. The attribute 'match' will be None. This allows you to
- write code like this::
-
- index = p.expect (['good', 'bad', pexpect.EOF, pexpect.TIMEOUT])
- if index == 0:
- do_something()
- elif index == 1:
- do_something_else()
- elif index == 2:
- do_some_other_thing()
- elif index == 3:
- do_something_completely_different()
-
- instead of code like this::
-
- try:
- index = p.expect (['good', 'bad'])
- if index == 0:
- do_something()
- elif index == 1:
- do_something_else()
- except EOF:
- do_some_other_thing()
- except TIMEOUT:
- do_something_completely_different()
-
- These two forms are equivalent. It all depends on what you want. You
- can also just expect the EOF if you are waiting for all output of a
- child to finish. For example::
-
- p = pexpect.spawn('/bin/ls')
- p.expect (pexpect.EOF)
- print p.before
-
- If you are trying to optimize for speed then see expect_list().
- """
-
- compiled_pattern_list = self.compile_pattern_list(pattern)
- return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
-
- def expect_list(self, pattern_list, timeout = -1, searchwindowsize = -1):
-
- """This takes a list of compiled regular expressions and returns the
- index into the pattern_list that matched the child output. The list may
- also contain EOF or TIMEOUT (which are not compiled regular
- expressions). This method is similar to the expect() method except that
- expect_list() does not recompile the pattern list on every call. This
- may help if you are trying to optimize for speed, otherwise just use
- the expect() method. This is called by expect(). If timeout==-1 then
- the self.timeout value is used. If searchwindowsize==-1 then the
- self.searchwindowsize value is used. """
-
- return self.expect_loop(searcher_re(pattern_list), timeout, searchwindowsize)
-
- def expect_exact(self, pattern_list, timeout = -1, searchwindowsize = -1):
-
- """This is similar to expect(), but uses plain string matching instead
- of compiled regular expressions in 'pattern_list'. The 'pattern_list'
- may be a string; a list or other sequence of strings; or TIMEOUT and
- EOF.
-
- This call might be faster than expect() for two reasons: string
- searching is faster than RE matching and it is possible to limit the
- search to just the end of the input buffer.
-
- This method is also useful when you don't want to have to worry about
- escaping regular expression characters that you want to match."""
-
- if type(pattern_list) in types.StringTypes or pattern_list in (TIMEOUT, EOF):
- pattern_list = [pattern_list]
- return self.expect_loop(searcher_string(pattern_list), timeout, searchwindowsize)
-
- def expect_loop(self, searcher, timeout = -1, searchwindowsize = -1):
-
- """This is the common loop used inside expect. The 'searcher' should be
- an instance of searcher_re or searcher_string, which describes how and what
- to search for in the input.
-
- See expect() for other arguments, return value and exceptions. """
-
- self.searcher = searcher
-
- if timeout == -1:
- timeout = self.timeout
- if timeout is not None:
- end_time = time.time() + timeout
- if searchwindowsize == -1:
- searchwindowsize = self.searchwindowsize
-
- try:
- incoming = self.buffer
- freshlen = len(incoming)
- while True: # Keep reading until exception or return.
- index = searcher.search(incoming, freshlen, searchwindowsize)
- if index >= 0:
- self.buffer = incoming[searcher.end : ]
- self.before = incoming[ : searcher.start]
- self.after = incoming[searcher.start : searcher.end]
- self.match = searcher.match
- self.match_index = index
- return self.match_index
- # No match at this point
- if timeout < 0 and timeout is not None:
- raise TIMEOUT ('Timeout exceeded in expect_any().')
- # Still have time left, so read more data
- c = self.read_nonblocking (self.maxread, timeout)
- freshlen = len(c)
- time.sleep (0.0001)
- incoming = incoming + c
- if timeout is not None:
- timeout = end_time - time.time()
- except EOF, e:
- self.buffer = ''
- self.before = incoming
- self.after = EOF
- index = searcher.eof_index
- if index >= 0:
- self.match = EOF
- self.match_index = index
- return self.match_index
- else:
- self.match = None
- self.match_index = None
- raise EOF (str(e) + '\n' + str(self))
- except TIMEOUT, e:
- self.buffer = incoming
- self.before = incoming
- self.after = TIMEOUT
- index = searcher.timeout_index
- if index >= 0:
- self.match = TIMEOUT
- self.match_index = index
- return self.match_index
- else:
- self.match = None
- self.match_index = None
- raise TIMEOUT (str(e) + '\n' + str(self))
- except:
- self.before = incoming
- self.after = None
- self.match = None
- self.match_index = None
- raise
-
- def getwinsize(self):
-
- """This returns the terminal window size of the child tty. The return
- value is a tuple of (rows, cols). """
-
- TIOCGWINSZ = getattr(termios, 'TIOCGWINSZ', 1074295912L)
- s = struct.pack('HHHH', 0, 0, 0, 0)
- x = fcntl.ioctl(self.fileno(), TIOCGWINSZ, s)
- return struct.unpack('HHHH', x)[0:2]
-
- def setwinsize(self, r, c):
-
- """This sets the terminal window size of the child tty. This will cause
- a SIGWINCH signal to be sent to the child. This does not change the
- physical window size. It changes the size reported to TTY-aware
- applications like vi or curses -- applications that respond to the
- SIGWINCH signal. """
-
- # Check for buggy platforms. Some Python versions on some platforms
- # (notably OSF1 Alpha and RedHat 7.1) truncate the value for
- # termios.TIOCSWINSZ. It is not clear why this happens.
- # These platforms don't seem to handle the signed int very well;
- # yet other platforms like OpenBSD have a large negative value for
- # TIOCSWINSZ and they don't have a truncate problem.
- # Newer versions of Linux have totally different values for TIOCSWINSZ.
- # Note that this fix is a hack.
- TIOCSWINSZ = getattr(termios, 'TIOCSWINSZ', -2146929561)
- if TIOCSWINSZ == 2148037735L: # L is not required in Python >= 2.2.
- TIOCSWINSZ = -2146929561 # Same bits, but with sign.
- # Note, assume ws_xpixel and ws_ypixel are zero.
- s = struct.pack('HHHH', r, c, 0, 0)
- fcntl.ioctl(self.fileno(), TIOCSWINSZ, s)
-
- def interact(self, escape_character = chr(29), input_filter = None, output_filter = None):
-
- """This gives control of the child process to the interactive user (the
- human at the keyboard). Keystrokes are sent to the child process, and
- the stdout and stderr output of the child process is printed. This
- simply echos the child stdout and child stderr to the real stdout and
- it echos the real stdin to the child stdin. When the user types the
- escape_character this method will stop. The default for
- escape_character is ^]. This should not be confused with ASCII 27 --
- the ESC character. ASCII 29 was chosen for historical merit because
- this is the character used by 'telnet' as the escape character. The
- escape_character will not be sent to the child process.
-
- You may pass in optional input and output filter functions. These
- functions should take a string and return a string. The output_filter
- will be passed all the output from the child process. The input_filter
- will be passed all the keyboard input from the user. The input_filter
- is run BEFORE the check for the escape_character.
-
- Note that if you change the window size of the parent the SIGWINCH
- signal will not be passed through to the child. If you want the child
- window size to change when the parent's window size changes then do
- something like the following example::
-
- import pexpect, struct, fcntl, termios, signal, sys
- def sigwinch_passthrough (sig, data):
- s = struct.pack("HHHH", 0, 0, 0, 0)
- a = struct.unpack('hhhh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ , s))
- global p
- p.setwinsize(a[0],a[1])
- p = pexpect.spawn('/bin/bash') # Note this is global and used in sigwinch_passthrough.
- signal.signal(signal.SIGWINCH, sigwinch_passthrough)
- p.interact()
- """
-
- # Flush the buffer.
- self.stdout.write (self.buffer)
- self.stdout.flush()
- self.buffer = ''
- mode = tty.tcgetattr(self.STDIN_FILENO)
- tty.setraw(self.STDIN_FILENO)
- try:
- self.__interact_copy(escape_character, input_filter, output_filter)
- finally:
- tty.tcsetattr(self.STDIN_FILENO, tty.TCSAFLUSH, mode)
-
- def __interact_writen(self, fd, data):
-
- """This is used by the interact() method.
- """
-
- while data != '' and self.isalive():
- n = os.write(fd, data)
- data = data[n:]
-
- def __interact_read(self, fd):
-
- """This is used by the interact() method.
- """
-
- return os.read(fd, 1000)
-
- def __interact_copy(self, escape_character = None, input_filter = None, output_filter = None):
-
- """This is used by the interact() method.
- """
-
- while self.isalive():
- r,w,e = self.__select([self.child_fd, self.STDIN_FILENO], [], [])
- if self.child_fd in r:
- data = self.__interact_read(self.child_fd)
- if output_filter: data = output_filter(data)
- if self.logfile is not None:
- self.logfile.write (data)
- self.logfile.flush()
- os.write(self.STDOUT_FILENO, data)
- if self.STDIN_FILENO in r:
- data = self.__interact_read(self.STDIN_FILENO)
- if input_filter: data = input_filter(data)
- i = data.rfind(escape_character)
- if i != -1:
- data = data[:i]
- self.__interact_writen(self.child_fd, data)
- break
- self.__interact_writen(self.child_fd, data)
-
- def __select (self, iwtd, owtd, ewtd, timeout=None):
-
- """This is a wrapper around select.select() that ignores signals. If
- select.select raises a select.error exception and errno is an EINTR
- error then it is ignored. Mainly this is used to ignore sigwinch
- (terminal resize). """
-
- # if select() is interrupted by a signal (errno==EINTR) then
- # we loop back and enter the select() again.
- if timeout is not None:
- end_time = time.time() + timeout
- while True:
- try:
- return select.select (iwtd, owtd, ewtd, timeout)
- except select.error, e:
- if e[0] == errno.EINTR:
- # if we loop back we have to subtract the amount of time we already waited.
- if timeout is not None:
- timeout = end_time - time.time()
- if timeout < 0:
- return ([],[],[])
- else: # something else caused the select.error, so this really is an exception
- raise
-
-##############################################################################
-# The following methods are no longer supported or allowed.
-
- def setmaxread (self, maxread):
-
- """This method is no longer supported or allowed. I don't like getters
- and setters without a good reason. """
-
- raise ExceptionPexpect ('This method is no longer supported or allowed. Just assign a value to the maxread member variable.')
-
- def setlog (self, fileobject):
-
- """This method is no longer supported or allowed.
- """
-
- raise ExceptionPexpect ('This method is no longer supported or allowed. Just assign a value to the logfile member variable.')
-
-##############################################################################
-# End of spawn class
-##############################################################################
-
-class searcher_string (object):
-
- """This is a plain string search helper for the spawn.expect_any() method.
-
- Attributes:
-
- eof_index - index of EOF, or -1
- timeout_index - index of TIMEOUT, or -1
-
- After a successful match by the search() method the following attributes
- are available:
-
- start - index into the buffer, first byte of match
- end - index into the buffer, first byte after match
- match - the matching string itself
- """
-
- def __init__(self, strings):
-
- """This creates an instance of searcher_string. This argument 'strings'
- may be a list; a sequence of strings; or the EOF or TIMEOUT types. """
-
- self.eof_index = -1
- self.timeout_index = -1
- self._strings = []
- for n, s in zip(range(len(strings)), strings):
- if s is EOF:
- self.eof_index = n
- continue
- if s is TIMEOUT:
- self.timeout_index = n
- continue
- self._strings.append((n, s))
-
- def __str__(self):
-
- """This returns a human-readable string that represents the state of
- the object."""
-
- ss = [ (ns[0],' %d: "%s"' % ns) for ns in self._strings ]
- ss.append((-1,'searcher_string:'))
- if self.eof_index >= 0:
- ss.append ((self.eof_index,' %d: EOF' % self.eof_index))
- if self.timeout_index >= 0:
- ss.append ((self.timeout_index,' %d: TIMEOUT' % self.timeout_index))
- ss.sort()
- ss = zip(*ss)[1]
- return '\n'.join(ss)
-
- def search(self, buffer, freshlen, searchwindowsize=None):
-
- """This searches 'buffer' for the first occurence of one of the search
- strings. 'freshlen' must indicate the number of bytes at the end of
- 'buffer' which have not been searched before. It helps to avoid
- searching the same, possibly big, buffer over and over again.
-
- See class spawn for the 'searchwindowsize' argument.
-
- If there is a match this returns the index of that string, and sets
- 'start', 'end' and 'match'. Otherwise, this returns -1. """
-
- absurd_match = len(buffer)
- first_match = absurd_match
-
- # 'freshlen' helps a lot here. Further optimizations could
- # possibly include:
- #
- # using something like the Boyer-Moore Fast String Searching
- # Algorithm; pre-compiling the search through a list of
- # strings into something that can scan the input once to
- # search for all N strings; realize that if we search for
- # ['bar', 'baz'] and the input is '...foo' we need not bother
- # rescanning until we've read three more bytes.
- #
- # Sadly, I don't know enough about this interesting topic. /grahn
-
- for index, s in self._strings:
- if searchwindowsize is None:
- # the match, if any, can only be in the fresh data,
- # or at the very end of the old data
- offset = -(freshlen+len(s))
- else:
- # better obey searchwindowsize
- offset = -searchwindowsize
- n = buffer.find(s, offset)
- if n >= 0 and n < first_match:
- first_match = n
- best_index, best_match = index, s
- if first_match == absurd_match:
- return -1
- self.match = best_match
- self.start = first_match
- self.end = self.start + len(self.match)
- return best_index
-
-class searcher_re (object):
-
- """This is regular expression string search helper for the
- spawn.expect_any() method.
-
- Attributes:
-
- eof_index - index of EOF, or -1
- timeout_index - index of TIMEOUT, or -1
-
- After a successful match by the search() method the following attributes
- are available:
-
- start - index into the buffer, first byte of match
- end - index into the buffer, first byte after match
- match - the re.match object returned by a succesful re.search
-
- """
-
- def __init__(self, patterns):
-
- """This creates an instance that searches for 'patterns' Where
- 'patterns' may be a list or other sequence of compiled regular
- expressions, or the EOF or TIMEOUT types."""
-
- self.eof_index = -1
- self.timeout_index = -1
- self._searches = []
- for n, s in zip(range(len(patterns)), patterns):
- if s is EOF:
- self.eof_index = n
- continue
- if s is TIMEOUT:
- self.timeout_index = n
- continue
- self._searches.append((n, s))
-
- def __str__(self):
-
- """This returns a human-readable string that represents the state of
- the object."""
-
- ss = [ (n,' %d: re.compile("%s")' % (n,str(s.pattern))) for n,s in self._searches]
- ss.append((-1,'searcher_re:'))
- if self.eof_index >= 0:
- ss.append ((self.eof_index,' %d: EOF' % self.eof_index))
- if self.timeout_index >= 0:
- ss.append ((self.timeout_index,' %d: TIMEOUT' % self.timeout_index))
- ss.sort()
- ss = zip(*ss)[1]
- return '\n'.join(ss)
-
- def search(self, buffer, freshlen, searchwindowsize=None):
-
- """This searches 'buffer' for the first occurence of one of the regular
- expressions. 'freshlen' must indicate the number of bytes at the end of
- 'buffer' which have not been searched before.
-
- See class spawn for the 'searchwindowsize' argument.
-
- If there is a match this returns the index of that string, and sets
- 'start', 'end' and 'match'. Otherwise, returns -1."""
-
- absurd_match = len(buffer)
- first_match = absurd_match
- # 'freshlen' doesn't help here -- we cannot predict the
- # length of a match, and the re module provides no help.
- if searchwindowsize is None:
- searchstart = 0
- else:
- searchstart = max(0, len(buffer)-searchwindowsize)
- for index, s in self._searches:
- match = s.search(buffer, searchstart)
- if match is None:
- continue
- n = match.start()
- if n < first_match:
- first_match = n
- the_match = match
- best_index = index
- if first_match == absurd_match:
- return -1
- self.start = first_match
- self.match = the_match
- self.end = self.match.end()
- return best_index
-
-def which (filename):
-
- """This takes a given filename; tries to find it in the environment path;
- then checks if it is executable. This returns the full path to the filename
- if found and executable. Otherwise this returns None."""
-
- # Special case where filename already contains a path.
- if os.path.dirname(filename) != '':
- if os.access (filename, os.X_OK):
- return filename
-
- if not os.environ.has_key('PATH') or os.environ['PATH'] == '':
- p = os.defpath
- else:
- p = os.environ['PATH']
-
- # Oddly enough this was the one line that made Pexpect
- # incompatible with Python 1.5.2.
- #pathlist = p.split (os.pathsep)
- pathlist = string.split (p, os.pathsep)
-
- for path in pathlist:
- f = os.path.join(path, filename)
- if os.access(f, os.X_OK):
- return f
- return None
-
-def split_command_line(command_line):
-
- """This splits a command line into a list of arguments. It splits arguments
- on spaces, but handles embedded quotes, doublequotes, and escaped
- characters. It's impossible to do this with a regular expression, so I
- wrote a little state machine to parse the command line. """
-
- arg_list = []
- arg = ''
-
- # Constants to name the states we can be in.
- state_basic = 0
- state_esc = 1
- state_singlequote = 2
- state_doublequote = 3
- state_whitespace = 4 # The state of consuming whitespace between commands.
- state = state_basic
-
- for c in command_line:
- if state == state_basic or state == state_whitespace:
- if c == '\\': # Escape the next character
- state = state_esc
- elif c == r"'": # Handle single quote
- state = state_singlequote
- elif c == r'"': # Handle double quote
- state = state_doublequote
- elif c.isspace():
- # Add arg to arg_list if we aren't in the middle of whitespace.
- if state == state_whitespace:
- None # Do nothing.
- else:
- arg_list.append(arg)
- arg = ''
- state = state_whitespace
- else:
- arg = arg + c
- state = state_basic
- elif state == state_esc:
- arg = arg + c
- state = state_basic
- elif state == state_singlequote:
- if c == r"'":
- state = state_basic
- else:
- arg = arg + c
- elif state == state_doublequote:
- if c == r'"':
- state = state_basic
- else:
- arg = arg + c
-
- if arg != '':
- arg_list.append(arg)
- return arg_list
-
-# vi:ts=4:sw=4:expandtab:ft=python:
diff --git a/src/sardana/tools/config/sar_to_fods.py b/src/sardana/tools/config/sar_to_fods.py
deleted file mode 100644
index 41915570..00000000
--- a/src/sardana/tools/config/sar_to_fods.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python
-
-import sys,types
-from lxml import etree
-
-def transform(f):
- t = etree.XSLT(etree.parse("SAR_TO_FODS.xslt"))
- if type(f) in types.StringTypes:
- doc = etree.parse(f)
- else:
- doc = f
- return t(doc)
-
-def main():
- filename = sys.argv[1]
- t = transform(filename)
- print etree.tostring(t, pretty_print=True)
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/tools/config/sardana.py b/src/sardana/tools/config/sardana.py
deleted file mode 100644
index 6dc0338a..00000000
--- a/src/sardana/tools/config/sardana.py
+++ /dev/null
@@ -1,1788 +0,0 @@
-#!/usr/bin/env python
-
-""" The sardana execution tool.
- Syntax:
- python sardana.py [-v] [-l] [--simulation=<mode>] [--cleanup=<True|False>] <file.xml>
-
- This tool creates and executes a sardana system from the given file.
-
- file.xml can be either:
- - a valid XML file coming from an EXCEL spreadsheet.
- - a valid XML file from the sardana schema.
-
- -v prints an output of the generated XML file and exits
- -l if given, this parameter activates logging
-
- --simulation=<mode> supported modes are 'Basic', 'Best' or 'Off'. Default mode is Best.
- Basic mode will create Dummy* controllers on the Pool
- Best mode will create Simu* controllers and Simu like device servers
- Off mode will create the original controllers on the Pool
- WARNING: Any other string will deactivate simulation mode and use REAL mode
-
- --cleanup=<True|False> either or not to perform a cleanup at the end. Default
- is True.
- If cleanup is True the database will be cleaned at
- shutdown time.
- Valid True values are: 'yes', 'Yes', 'true', 'True', 'y', 'Y', '1'
- Any other value will be interpreted as False
-"""
-
-import PyTango
-import sys
-import os
-import time, datetime
-import exceptions
-import imp
-import traceback
-import logging
-import types, operator
-import json
-
-from taurus.core.util.codecs import CodecFactory
-
-LOG = logging.getLogger()
-
-try:
- from lxml import etree
- LOG.info("Using lxml XML library")
-except ImportError:
- try:
- # Python 2.5
- import xml.etree.cElementTree as etree
- LOG.info("Using python native cElemenTree XML library")
- except ImportError:
- try:
- # Python 2.5
- import xml.etree.ElementTree as etree
- LOG.info("Using python native ElemenTree XML library")
- except ImportError:
- try:
- # normal cElementTree install
- import cElementTree as etree
- LOG.info("Using python normal cElemenTree XML library")
- except ImportError:
- try:
- # normal ElementTree install
- import elementtree.ElementTree as etree
- LOG.info("Using python normal ElemenTree XML library")
- except ImportError:
- LOG.critical("Could not find any suitable XML library")
- sys.exit(1)
-
-try:
- import pexpect
-except:
- try:
- import pexpect23 as pexpect
- print "[WARNING]: pexpect module not found. Using local pexpect 2.3"
- except Exception, e:
- print e
- print "The Sardana requires pexpect python module which was not found."
- print "This module can be found at http://www.noah.org/wiki/Pexpect"
- sys.exit(2)
-
-
-SAR_NS = 'http://sardana.cells.es/client/framework/config'
-
-class Process:
-
- ReadyMsg = "Ready to accept request"
- AlreadyRunning = "This server is already running, exiting!"
- MaxStartupTime = 30
- MaxShutdownTime = 30
-
- def __init__(self, executable, args, name="Process", instance=None, logfile=None, env=None):
- self._start_time = -1
- self._stop_time = -1
- self._process = None
- self._exec = executable
- self._args = args
- self._name = name
- self._instance = instance
- self._env = env
- self._logfile = logfile
-
- def o(self, m):
- sys.stdout.write(m)
- sys.stdout.flush()
-
- def on(self, m=''):
- self.o(m)
- sys.stdout.write('\n')
- sys.stdout.flush()
-
- def getInstance(self):
- return self._instance
-
- def start(self):
- raise RuntimeException("Not allowed to 'start' abstract Process")
-
- def stop(self):
- raise RuntimeException("Not allowed to 'stop' abstract Process")
-
- def getMaxStartupTime(self):
- return Process.MaxStartupTime
-
- def getMaxShutdownTime(self):
- return Process.MaxShutdownTime
-
-class PEProcess(Process):
-
- def __init__(self, executable, args, name="PEProcess", instance=None, logfile=None, env=None):
- Process.__init__(self, executable, args, name, instance, logfile, env)
-
- def start(self):
- self._start_time = datetime.datetime.now()
- self.o("Starting '%s %s' (%s, %s)... " % (self._name, self._instance, self._exec, self._args))
- try:
- self._process = pexpect.spawn(self._exec, args=self._args, logfile=self._logfile, env=self._env)
- #self.o("%s, %s, %s" % (self._exec, self._args, self._logfile))
- #self._process.logfile = sys.stderr
-
- idx = self._process.expect([Process.ReadyMsg, Process.AlreadyRunning,
- pexpect.EOF, pexpect.TIMEOUT],
- timeout=self.getMaxStartupTime())
- except Exception, e:
- self.on("[FAILED]")
- raise e
-
- if idx == 0:
- started = datetime.datetime.now()
- dt = started - self._start_time
- self.on("(took %s) [DONE]" % str(dt))
- return
-
- self.on("[FAILED]")
-
- if idx == 1:
- raise Exception("%s %s already running" % (self._name, self._instance))
- elif idx == 2:
- raise Exception("%s %s terminated unexpectedly" % (self._name, self._instance))
- elif idx == 3:
- raise Exception("%s %s startup time exceeded" % (self._name, self._instance))
-
- def terminate(self):
- if self._process is None:
- raise Exception("No process")
- return self._process.terminate()
-
- def kill(self):
- if not self._process is None:
- self._process.close()
- res = self._process.terminate(force=True)
- self._process = None
- self.on("[DONE]")
- return
-
- def stop(self, max_shutdown_time=None):
- """Stops"""
- self._stop_time = datetime.datetime.now()
- self.o("Stopping '%s %s'... " % (self._name, self._instance))
-
- try:
-
- max_shutdown_time = max_shutdown_time or self.getMaxShutdownTime()
-
- if self._process is None:
- self.on(" (no process) [DONE]")
- return
-
- if not self._process.isalive():
- self.on(" (already dead) [DONE]")
- return
-
- try:
- res = self.terminate()
- idx = self._process.expect(['Exiting', 'Exited', pexpect.EOF, pexpect.TIMEOUT],
- timeout=max_shutdown_time)
- except Exception, e:
- self.on("[FAILED]")
- raise e
-
- if idx == 0:
- self.o(".")
- elif idx == 1:
- self.on(" (terminated before expected: Exited) [DONE]")
- return
- elif idx == 2:
- self.on(" (terminated before expected: EOF) [DONE]")
- return
- elif idx == 3:
- self.o(" (shutdown time exceeded). Forcing... ")
- self.kill()
- return
-
- try:
- idx = self._process.expect(['Exited', pexpect.EOF, pexpect.TIMEOUT],
- timeout=5)
- except Exception, e:
- self.on("[FAILED]")
- raise e
-
- if idx == 0:
- self.o(".")
- elif idx == 1:
- self.on(" (terminated before expected: EOF) [DONE]")
- elif idx == 2:
- self.on(" (shutdown time exceeded) [DONE]")
- self.kill()
- return
-
- try:
- idx = self._process.expect([pexpect.EOF, pexpect.TIMEOUT],
- timeout=5)
- except Exception, e:
- self.on("[FAILED]")
- raise e
-
- if idx == 0:
- runtime = self._stop_time - self._start_time
- stopped = datetime.datetime.now() - self._stop_time
- self.on(". (ran for %s ;took %s) [DONE]" % (str(runtime), str(stopped)))
- elif idx == 1:
- self.o(" (shutdown time exceeded). Forcing... ")
- self.kill()
-
- except KeyboardInterrupt, ki:
- self.o("(Ctrl-C during stop). Forcing... ")
- self.kill()
-
- def run(self, timeout=0):
- if not self._process:
- return
- try:
- res = self._process.read_nonblocking(size=10000, timeout=timeout)
-
- #self.on(" \t[READ %s.%s] {%s}" % (self._name, self._instance, res))
-
- except pexpect.TIMEOUT:
- # no data was available. Don't worry: it just means that in the mean
- # time no data was sent to the output/err by the daemon
- pass
- except pexpect.EOF:
- # The process terminated. Maybe to something about it in the future
- self.on("%s %s terminated before expected: (EOF)" % (self._name, self._instance))
- self._process = None
-
-
-class PEDeviceServerProcess(PEProcess):
-
- def __init__(self, executable, args, name="PEDeviceServerProcess", instance=None, db=None, logfile=None):
- db = db or PyTango.Database()
- env = os.environ.copy()
- env["TANGO_HOST"] = "%s:%s" % (db.get_db_host(), db.get_db_port())
- PEProcess.__init__(self, executable, args, name, instance, logfile, env)
-
- def getServerName(self):
- return os.path.splitext(os.path.basename(self._exec))[0]
-
- def terminate(self):
- tango_host_port = self._env['TANGO_HOST']
- dserver_device_name = "%s/dserver/%s/%s" % (tango_host_port, self.getServerName(), self._instance)
- dserver_device = PyTango.DeviceProxy(dserver_device_name)
- dserver_device.command_inout("Kill")
- PEProcess.terminate(self)
-
-class PEPythonDeviceServerProcess(PEDeviceServerProcess):
-
- def getServerName(self):
- return os.path.splitext(os.path.basename(self._args[0]))[0]
-
-
-class PESimuMotorProcess(PEPythonDeviceServerProcess):
-
- def __init__(self, instname, db=None, logfile=None):
- name = "Motor Simulator"
- # Make sure the python device server code is reachable
- try:
- f, fname, desc = imp.find_module('SimuMotorCtrl')
- if f: f.close()
- f, path, desc = imp.find_module('SimuMotor')
- if f: f.close()
- except exceptions.ImportError, e:
- msg = "Could not find %s executable.\n" \
- "Make sure PYTHONPATH points to the directory(ies) where " \
- "SimuMotorCtrl.py and SimuMotor.py files are installed" % name
- raise Exception(msg)
-
- fname = os.path.join(fname, 'SimuMotorCtrl.py')
-
- PEDeviceServerProcess.__init__(self, "/usr/bin/python", [fname, instname], name, instname, db, logfile)
-
-
-class PESimuCounterTimerProcess(PEPythonDeviceServerProcess):
-
- def __init__(self, instname, db=None, logfile=None):
- name = "Counter/Timer Simulator"
- # Make sure the python device server code is reachable
- try:
- f, fname, desc = imp.find_module('SimuCoTiCtrl')
- if f: f.close()
- except exceptions.ImportError, e:
- msg = "Could not find %s executable.\n" \
- "Make sure PYTHONPATH points to the directory(ies) where " \
- "SimuCoTiCtrl.py file is installed" % name
- raise Exception(msg)
-
- fname = os.path.join(fname, 'SimuCoTiCtrl.py')
-
- PEDeviceServerProcess.__init__(self, "/usr/bin/python", [fname, instname], name, instname, db, logfile)
-
-
-class PEPySignalSimulatorProcess(PEPythonDeviceServerProcess):
-
- def __init__(self, instname, db=None, logfile=None):
- name = "PySignal Simulator"
- # Make sure the python device server code is reachable
- try:
- f, fname, desc = imp.find_module('PySignalSimulator')
- if f: f.close()
- except exceptions.ImportError, e:
- msg = "Could not find %s executable.\n" \
- "Make sure PYTHONPATH points to the directory where " \
- "PySignalSimulator.py is installed" % name
- raise Exception(msg)
-
- fname = os.path.join(fname, 'PySignalSimulator.py')
-
- PEDeviceServerProcess.__init__(self, "/usr/bin/python", [fname, instname], name, instname, db, logfile)
-
-
-class PEDevicePoolProcess(PEDeviceServerProcess):
-
- def __init__(self, instname, db=None, logfile=None):
- name = "Device Pool"
- ex = None
- for path in os.getenv("PATH").split(":"):
- path = os.path.join(path, "Pool")
- if os.path.exists(path):
- ex = path
- break
-
- if ex is None:
- raise Exception("Could not find %s executable" % name)
-
- args = [instname, "--log-level=info"]
- PEDeviceServerProcess.__init__(self, ex, args, name, instname, db, logfile)
-
-
-class PEMacroServerProcess(PEDeviceServerProcess):
-
- def __init__(self, instname, db=None, logfile=None):
- name = "Macro Server"
-
- ex = None
- for path in os.getenv("PATH").split(":"):
- path = os.path.join(path, "MacroServer")
- if os.path.exists(path):
- ex = path
- break
-
- if ex is None:
- raise Exception("Could not find %s executable" % name)
-
- args = [instname, "--log-level=info"]
- PEDeviceServerProcess.__init__(self, ex, args, name, instname, db, logfile)
-
-
-SimuMotorProcess = PESimuMotorProcess
-SimuCounterTimerProcess = PESimuCounterTimerProcess
-PySignalSimulatorProcess = PEPySignalSimulatorProcess
-DevicePoolProcess = PEDevicePoolProcess
-MacroServerProcess = PEMacroServerProcess
-
-#____________________________________________________________________TangoServer
-class TangoServer:
-
- klassName = "DeviceServer"
-
- def __init__(self, servNode, bl, createProc=False, log=False):
- if servNode is None:
- raise Exception("No XML data")
-
- self._bl = bl
- self._node = servNode
-
- self._tghost = servNode.get("tangoHost") or None
- self._db = bl.getTangoDB(self._tghost)
-
- self._complete_name = servNode.get("serverName")
- self.on("Preparing %s" % self._complete_name)
- self._klass_name, self._inst_name = self._complete_name.split("/")
-
-
- ##########################################################################
- # To prevent some disaster, just make sure the user knows that the
- # hostname where the server will be deleted and created.
- server_host = self._db.get_db_host()
- server_port = self._db.get_db_port()
- server_tango_host = server_host + ':' + server_port
- pytango_tango_host = PyTango.ApiUtil.get_env_var('TANGO_HOST')
- pytango_host, pytango_port = pytango_tango_host.split(':')
- # Using socket to get ip addresses because one of the two hostnames could have domain
- import socket
- server_host_ip = socket.gethostbyname_ex(server_host)[2][0]
- pytango_host_ip = socket.gethostbyname_ex(pytango_host)[2][0]
- if (server_host_ip != pytango_host_ip) or (server_port != pytango_port):
- print '\t!!! WARNING !!! %s TANGO_HOST is not the PyTango default. You may erase the WRONG sardana definition.' % self._complete_name
- print '\tServer: %s PyTango: %s' % (server_tango_host , pytango_tango_host)
- ans = raw_input('\tDo you _really_ want to continue? [y|N] ')
- if ans.lower() not in ['y', 'yes']:
- raise Exception('User cancelled the creation of %s server' % self._complete_name)
- ##########################################################################
-
- ##########################################################################
- # Before erasing the content in the database, we will also create a backup
- # of all the tango devices's properties and memorized attributes "a-la jive".
- # There's an script called jive-save-config that given the parameters
- # <server_name> and <file_name> it saves the config into the specified file the
- # same way you can right-click an instance within jive and select the
- # option 'Save server data'.
- try:
- config_file_name = self._klass_name + '-' + self._inst_name + '-' + time.strftime('%Y%m%d_%H%M%S') + '.jive'
- cmd = 'TANGO_HOST=%s jive-save-config %s %s &>/dev/null' % (server_tango_host, self._complete_name, config_file_name)
- os.system(cmd)
- print 'There is a backup of the deleted server config in: %s' % config_file_name
- except:
- pass
- ##########################################################################
-
-
- if self.klassName != self._klass_name:
- raise Exception("Node name differs from expeced '%s' != '%s'" % (self._klass_name, self.klassName))
-
- if log:
- self._logfile = open("Log_%s_%s" % (self.klassName, self._inst_name), "w")
- else:
- self._logfile = None
-
- if createProc == True:
- self._proc = self._createProcess()
- else:
- self._proc = None
-
- def o(self, m):
- sys.stdout.write(m)
- sys.stdout.flush()
-
- def on(self, m=''):
- self.o(m)
- sys.stdout.write('\n')
- sys.stdout.flush()
-
- def setUp(self):
- """Default setUp."""
- self.prepare()
- self.start()
-
- def tearDown(self):
- """Default tearDown."""
- self.stop()
- self.cleanUp()
-
- def prepare(self):
- """Prepares everything to be run"""
- if not self._proc:
- self._proc = self._createProcess()
-
- # Cleanup the database
- self.deleteServerFromDB()
-
- # Create a new instance in database
- self.createServerInDB()
-
- def deleteServerFromDB(self):
- db = self._db
- server_name = self._klass_name.lower()
- server_instance = self._inst_name.lower()
- server = self._complete_name.lower()
- servers = [ s.lower() for s in db.get_server_list(server_name + '/*') ]
- if server in servers:
- devices = db.get_device_name(server, '*')
-
- for d in devices:
- if not d.startswith('dserver'):
- props = db.get_device_property_list(d, '*')
- db.delete_device_property(d, props)
- db.delete_device(d)
-
- db.delete_server(server)
-
- def createServerInDB(self):
- for devNodeName in self.getDeviceNodeNames():
-
- nodes = self._node.findall(devNodeName)
- for node in nodes:
-
- dev_name = node.get("deviceName")
- if not dev_name:
- raise Exception("%s does not have valid deviceName" % self._node)
-
- # Create the device in the database
- info = PyTango.DbDevInfo()
- info.name = dev_name
- info._class = devNodeName
- info.server = self._complete_name
- self._db.add_device(info)
-
- alias = node.get("name")
- if alias:
- self._db.put_device_alias(dev_name, alias)
-
- props = node.findall("Property")
- if props:
- self._putDeviceProps(dev_name, props)
-
- def getDeviceNodeNames(self):
- return [self._klass_name]
-
- def start(self):
- """Default start"""
- self._proc.start()
-
- def stop(self):
- """Default stop"""
- self._proc.stop()
-
- def cleanUp(self):
- """Clean up"""
- self.deleteServerFromDB()
-
- def run(self, step=True, timeout=0):
- """Run"""
- while 1:
- self._proc.run(timeout=timeout)
- if step: return
-
- def _createProcess(self):
- raise Exception("Must overwrite in subclass")
-
- def _putDeviceProps(self, dev_name, prop_node_list):
- props = {}
- for p_node in prop_node_list:
- prop_name = p_node.get("name")
- data = []
-
- i_nodes = p_node.findall("Item")
- if len(i_nodes) > 0:
- for i_node in i_nodes:
- data.append(i_node.text)
- else:
- data.append(p_node.text)
- props[prop_name] = data
-
- if props:
- self._db.put_device_property(dev_name, props)
-
- def getInstanceName(self):
- return self._inst_name
-
- def __str__(self):
- return self._complete_name
-
-
-class SimuMotorServer(TangoServer):
-
- klassName = "SimuMotorCtrl"
-
- def _createProcess(self):
- return SimuMotorProcess(self._inst_name, self._db, logfile=self._logfile)
-
- def getDeviceNodeNames(self):
- return TangoServer.getDeviceNodeNames(self) + ["SimuMotor"]
-
-
-class SimuCounterTimerServer(TangoServer):
-
- klassName = "SimuCoTiCtrl"
-
- def _createProcess(self):
- return SimuCounterTimerProcess(self._inst_name, self._db, logfile=self._logfile)
-
- def getDeviceNodeNames(self):
- return TangoServer.getDeviceNodeNames(self) + ["SimuCounter"]
-
-
-class PySignalSimulatorServer(TangoServer):
- klassName = "PySignalSimulator"
-
- def _createProcess(self):
- return PySignalSimulatorProcess(self._inst_name, self._db, logfile=self._logfile)
-
-
-class DevicePoolServer(TangoServer):
-
- klassName = "Pool"
-
- def _createProcess(self):
- self.dev_count = 0
- return DevicePoolProcess(self._inst_name, self._db, logfile=self._logfile)
-
- def _putDeviceProps(self, dev_name, prop_node_list):
- TangoServer._putDeviceProps(self, dev_name, prop_node_list)
-
- def start(self):
- """Default start"""
- self._proc.start()
- self.loadPool()
-
- def stop(self):
- """Default stop"""
- max_shutdown_time = self.dev_count * 0.2 + 10
- self._proc.stop(max_shutdown_time)
-
- def _item_node_to_value(self, attr_info, node):
- v = node.text or [i.text or [ j.text for j in i.findall("Item") ] for i in node.findall("Item")]
- return PyTango.seqStr_2_obj(v, attr_info.data_type, attr_info.data_format)
-
- def handle_attributes(self, dev_name, node):
- attrs = node.findall('Attribute')
- if not len(attrs):
- return
- # Take into account the possibility to have the device in another Tango Host...
- dev_name = self._tghost + '/' + dev_name
- dev = PyTango.DeviceProxy(dev_name)
- tango_attrs = dev.attribute_list_query_ex()
- tango_attrs_map = {}
- for attr in tango_attrs:
- tango_attrs_map[attr.name.lower()] = attr
-
- for attr in attrs:
- name = attr.get("name").lower()
- tango_attr = tango_attrs_map.get(name)
- if tango_attr:
- attr_info = dev.get_attribute_config_ex(name)[0]
- v_node = attr.find("Value")
- if not v_node is None:
- v = self._item_node_to_value(tango_attr, v_node)
- try:
- dev.write_attribute(name, v)
- except Exception, ex:
- print 'SOME PROBLEMS SETTING ATTRIBUTE VALUE FOR DEVICE', dev_name, 'ATTRIBUTE', tango_attr.name, 'VALUE', str(v)
- print 'EXCEPTION:', ex
-
- c_node = attr.find("Configuration")
- if not c_node is None:
- disp_node = c_node.find("Display")
- if not disp_node is None:
- attr_info.label = disp_node.get("label") or attr_info.label
- attr_info.format = disp_node.get("format") or attr_info.format
- units_node = c_node.find("Units")
- if not units_node is None:
- attr_info.unit = units_node.get("unit") or attr_info.unit
- attr_info.display_unit = units_node.get("display_unit") or attr_info.display_unit
- attr_info.standard_unit = units_node.get("standard_unit") or attr_info.standard_unit
- range_node = c_node.find("Range")
- if not range_node is None:
- attr_info.min_value = range_node.get("min") or attr_info.min_value
- attr_info.max_value = range_node.get("max") or attr_info.max_value
- alarms_node = c_node.find("Alarms")
- if not alarms_node is None:
- attr_info.alarms.min_warning = alarms_node.get("min_warning") or attr_info.alarms.min_warning
- attr_info.alarms.max_warning = alarms_node.get("max_warning") or attr_info.alarms.max_warning
- attr_info.alarms.min_alarm = alarms_node.get("min_alarm") or attr_info.alarms.min_alarm
- attr_info.alarms.max_alarm = alarms_node.get("max_alarm") or attr_info.alarms.max_alarm
-
- e_node = attr.find("Events")
- if not e_node is None:
- ch_node = e_node.find("ChangeEvent")
- if not ch_node is None:
- attr_info.events.ch_event.abs_change = ch_node.get("absolute") or attr_info.events.ch_event.abs_change
- rel = ch_node.get("relative")
- if rel:
- rel = rel.rstrip('%')
- attr_info.events.ch_event.rel_change = rel
-
- p_node = attr.find("Polling")
- if not p_node is None:
- polled = p_node.get("polled") or 'False'
- polled = not (polled.lower() in ('false', 'no', 'n', '0'))
- if polled:
- try:
- period = int(p_node.get("period") or 0)
- dev.poll_attribute(name, period)
- except:
- print dev_name, tango_attr.name
-
- try:
- dev.set_attribute_config(attr_info)
- except Exception, e:
- print 'COULD NOT SET THE FOLLOWING CONFIG FOR DEVICE', dev_name, 'ATTR', tango_attr.name
- print 'ATTRIBUTE INFO:', attr_info
- print 'EXCEPTION:', e
-
- intrument_node = node.find("InstrumentRef")
- if not intrument_node is None:
- try:
- value = intrument_node.text.strip()
- dev.write_attribute('Instrument', value)
- except Exception, ex:
- print 'SOME PROBLEMS SETTING INSTRUMENT VALUE FOR DEVICE', dev_name, 'VALUE', value
- print 'EXCEPTION:', ex
-
-
- def loadPool(self):
- start_load_time = datetime.datetime.now()
- self.on(" Loading 'Device Pool %s'..." % self._inst_name)
-
- try:
- tgHost = self._node.get("tangoHost") or \
- ("%s:%s" % (self._db.get_db_host(), self._db.get_db_port()))
-
- pool = self._node.find(self.klassName)
-
- pool_dev_name = "%s/%s" % (tgHost, pool.get("deviceName"))
-
- pool_dp = PyTango.DeviceProxy(pool_dev_name)
-
- factory = CodecFactory()
- elements = factory.decode(pool_dp.elements, ensure_ascii='True')['new']
-
- ctrl_classes_info = {}
- for elem in elements:
- if elem['type'] != 'ControllerClass':
- continue
- ctrl_classes_info[elem['name']] = elem
-
- count = 0
- # Setup instruments
- instruments = pool.xpath("Instrument")
- self.o(" Creating instruments ")
- for instrument in instruments:
- try:
- name = instrument.get("name")
- if name.startswith('#'):
- self.o("x")
- continue
- if name.startswith('REAL'):
- self.o('R')
- else:
- self.o(".")
- kclass = instrument.get("class")
- pars = name, kclass
- pool_dp.command_inout("CreateInstrument", pars)
- count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type != 'PseudoMotor' and @type != 'PseudoCounter']")
- self.o(" Creating controllers ")
- count = 0
- self.dev_count = 0
- for ctrl in ctrls:
- try:
- name = ctrl.get("name")
- # skip controllers which name starts with '#'
- if name.startswith('#'):
- self.o("x")
- continue
- if name.startswith('REAL'):
- self.o('R')
- else:
- self.o(".")
- type = ctrl.get("type")
- if type == 'CounterTimer':
- type = 'CTExpChannel'
- lib = ctrl.get("lib")
- kclass = ctrl.get("class")
- pars = [type, lib, kclass, name]
- props = ctrl.findall("Property")
- for p in props:
- pars.append(p.get("name"))
- pars.append(p.text or '\n'.join([i.text for i in p.findall("Item")]))
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateController", pars)
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type = 'Motor']")
- self.o(" Creating motors ")
- count = 0
- for ctrl in ctrls:
- name = ctrl.get("name")
- elems = ctrl.findall("Motor")
- # skip motor creation for controllers which name starts with '#'
- if name.startswith('#'):
- elems = []
- for e in elems:
- try:
- axis = e.get("axis")
- aliasName = e.get("name")
- deviceName = e.get("deviceName") or ""
- # skip motor creation for alias starting with '#'
- if aliasName.startswith('#'):
- self.o('x')
- continue
- self.o(".")
- #pars = [ [axis], [ aliasName, name ] ]
- pars = "Motor", name, axis, aliasName
- if deviceName.count('/') == 2:
- pars.append(deviceName)
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateElement", pars)
-
- self.handle_attributes(aliasName, e)
-
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type = 'CounterTimer']")
- self.o(" Creating Counter/Timers ")
- count = 0
- for ctrl in ctrls:
- name = ctrl.get("name")
- elems = ctrl.findall("CounterTimer")
- # skip counter/timers creation for controllers which name starts with '#'
- if name.startswith('#'):
- elems = []
- for e in elems:
- try:
- axis = e.get("axis")
- aliasName = e.get("name")
- deviceName = e.get("deviceName") or ""
- # skip counter/timers creation for alias starting with '#'
- if aliasName.startswith('#'):
- self.o('x')
- continue
- self.o(".")
- pars = "CTExpChannel", name, axis, aliasName
- if deviceName.count('/') == 2:
- pars.append(deviceName)
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateElement", pars)
-
- self.handle_attributes(aliasName, e)
-
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type = 'ZeroDExpChannel']")
- self.o(" Creating 0Ds ")
- count = 0
- for ctrl in ctrls:
- name = ctrl.get("name")
- elems = ctrl.findall("ZeroDExpChannel")
- # skip 0Ds creation for controllers which name starts with '#'
- if name.startswith('#'):
- elems = []
- for e in elems:
- try:
- axis = e.get("axis")
- aliasName = e.get("name")
- deviceName = e.get("deviceName") or ""
- # skip 0Ds creation for alias starting with '#'
- if aliasName.startswith('#'):
- self.o('x')
- continue
- self.o(".")
- pars = "ZeroDExpChannel", name, axis, aliasName
- if deviceName.count('/') == 2:
- pars.append(deviceName)
- pars = map(str.strip, pars)
- try:
- pool_dp.command_inout("CreateElement", pars)
-
- self.handle_attributes(aliasName, e)
-
- except PyTango.DevFailed, df:
- self.on("Exception creating %s: %s" % (aliasName, str(df)))
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type = 'OneDExpChannel']")
- self.o(" Creating 1Ds ")
- count = 0
- for ctrl in ctrls:
- name = ctrl.get("name")
- elems = ctrl.findall("OneDExpChannel")
- # skip 1Ds creation for controllers which name starts with '#'
- if name.startswith('#'):
- elems = []
- for e in elems:
- try:
- axis = e.get("axis")
- aliasName = e.get("name")
- deviceName = e.get("deviceName") or ""
- # skip 1Ds creation for alias starting with '#'
- if aliasName.startswith('#'):
- self.o('x')
- continue
- self.o(".")
- pars = "OneDExpChannel", name, axis, aliasName
- if deviceName.count('/') == 2:
- pars.append(deviceName)
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateElement", pars)
-
- self.handle_attributes(aliasName, e)
-
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type = 'TwoDExpChannel']")
- self.o(" Creating 2Ds ")
- count = 0
- for ctrl in ctrls:
- name = ctrl.get("name")
- elems = ctrl.findall("TwoDExpChannel")
- # skip 2Ds creation for controllers which name starts with '#'
- if name.startswith('#'):
- elems = []
- for e in elems:
- try:
- axis = e.get("axis")
- aliasName = e.get("name")
- deviceName = e.get("deviceName") or ""
- # skip 2Ds creation for alias starting with '#'
- if aliasName.startswith('#'):
- self.o('x')
- continue
- self.o(".")
- pars = "TwoDExpChannel", name, axis, aliasName
- if deviceName.count('/') == 2:
- pars.append(deviceName)
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateElement", pars)
-
- self.handle_attributes(aliasName, e)
-
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- ctrls = pool.xpath("Controller[@type = 'IORegister']")
- self.o(" Creating IORegisters ")
- count = 0
- for ctrl in ctrls:
- name = ctrl.get("name")
- elems = ctrl.findall("IORegister")
- # skip IORegisters creation for controllers which name starts with '#'
- if name.startswith('#'):
- elems = []
- for e in elems:
- try:
- axis = e.get("axis")
- aliasName = e.get("name")
- deviceName = e.get("deviceName") or ""
- # skip IORegisters creation for alias starting with '#'
- if aliasName.startswith('#'):
- self.o('x')
- continue
- self.o(".")
- pars = "IORegister", name, axis, aliasName
- if deviceName.count('/') == 2:
- pars.append(deviceName)
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateElement", pars)
-
- self.handle_attributes(aliasName, e)
-
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- #-------------------------------------------------
- # add controllers that depend on physical elements
- #-------------------------------------------------
- ctrls = pool.xpath("Controller[@type = 'PseudoMotor']")
-
- self.o(" Creating Pseudo Motors ")
- pm_ctrl_count = 0
- pm_count = 0
- for ctrl in ctrls:
- try:
- name = ctrl.get("name")
- # skip controllers which name starts with '#'
- if name.startswith('#'):
- self.o("x")
- continue
- self.o(".")
- type = ctrl.get("type")
- lib = ctrl.get("lib")
- kclass = ctrl.get("class")
-
- ctrl_class_info = ctrl_classes_info[kclass]
- motor_roles = ctrl_class_info['motor_roles']
- pseudo_motor_roles = ctrl_class_info['pseudo_motor_roles']
- pars = [type, lib, kclass, name]
-
- for i, e in enumerate(ctrl.findall("Motor")):
- pars.append("%s=%s" % (motor_roles[i], e.text))
-
- for i, e in enumerate(ctrl.findall("PseudoMotor")):
- pars.append("%s=%s" % (pseudo_motor_roles[i], e.get('name')))
-
- pm_count += len(ctrl.findall("PseudoMotor"))
- self.dev_count += pm_count
-
- props = ctrl.findall("Property")
-
- for p in props:
- pars.append(p.get("name"))
- pars.append(p.text or '\n'.join([i.text for i in p.findall("Item")]))
-
- pars = map(str.strip, pars)
-
- pool_dp.command_inout("CreateController", pars)
- pm_ctrl_count += 1
-
- for e in ctrl.findall('PseudoMotor'):
- self.handle_attributes(e.get("name"), e)
-
- self.run(step=True) # to flush any output generated by the pool
- except:
- self.on("[FAILED]")
- print ctrl_class_info
- raise
- self.on(" (%d ctrls; %d pmotors) [DONE]" % (pm_ctrl_count, pm_count))
-
-
-
- ctrls = pool.xpath("Controller[@type = 'PseudoCounter']")
-
- self.o(" Creating Pseudo Counters ")
- pc_ctrl_count = 0
- pc_count = 0
- for ctrl in ctrls:
- try:
- name = ctrl.get("name")
- # skip controllers which name starts with '#'
- if name.startswith('#'):
- self.o("x")
- continue
- self.o(".")
- type = ctrl.get("type")
- lib = ctrl.get("lib")
- kclass = ctrl.get("class")
-
- ctrl_class_info = ctrl_classes_info[kclass]
- counter_roles = ctrl_class_info['counter_roles']
- pseudo_counter_roles = ctrl_class_info['pseudo_counter_roles']
-
- pars = [type, lib, kclass, name]
-
- for i, e in enumerate(ctrl.findall("Channel")):
- pars.append("%s=%s" % (counter_roles[i], e.text))
-
- for i, e in enumerate(ctrl.findall("PseudoCounter")):
- pars.append("%s=%s" % (pseudo_counter_roles[i], e.get('name')))
-
- pc_count += len(ctrl.findall("PseudoCounter"))
- self.dev_count += pc_count
-
- props = ctrl.findall("Property")
-
- for p in props:
- pars.append(p.get("name"))
- pars.append(p.text or '\n'.join([i.text for i in p.findall("Item")]))
-
- pars = map(str.strip, pars)
-
- pool_dp.command_inout("CreateController", pars)
- pc_ctrl_count += 1
-
- for e in ctrl.findall('PseudoCounter'):
- self.handle_attributes(e.get("name"), e)
-
- self.run(step=True) # to flush any output generated by the pool
- except:
- self.on("[FAILED]")
- raise
- self.on("(%d ctrls; %d pcounters) [DONE]" % (pc_ctrl_count, pc_count))
-
- measurement_groups = pool.findall("MeasurementGroup")
- self.o(" Creating Measurement Groups ")
- count = 0
- for mg in measurement_groups:
- try:
- aliasName = mg.get("name")
- # skip measurementgroups which name starts with '#'
- if aliasName.startswith('#'):
- self.o("x")
- continue
- self.o(".")
-
- channels = mg.findall("ChannelRef")
- pars = [ aliasName ]
- for channel in channels:
- pars.append(channel.get("name"))
- pars = map(str.strip, pars)
- pool_dp.command_inout("CreateMeasurementGroup", pars)
-
- self.handle_attributes(aliasName, mg)
-
- self.run(step=True) # to flush any output generated by the pool
- count += 1
- self.dev_count += 1
- except:
- self.on("[FAILED]")
- raise
- self.on(" (%d) [DONE]" % count)
-
- end_load_time = datetime.datetime.now()
- dt = end_load_time - start_load_time
- self.on(" Loading 'Device Pool %s'... (took %s) [DONE]" % (self._inst_name, str(dt)))
- except:
- self.on(" Loading 'Device Pool %s'... [FAILED]" % self._inst_name)
- raise
-
-
-class MacroServerServer(TangoServer):
-
- klassName = "MacroServer"
-
- def _createProcess(self):
- return MacroServerProcess(self._inst_name, self._db, logfile=self._logfile)
-
- def getDeviceNodeNames(self):
- return TangoServer.getDeviceNodeNames(self) + ["Door"]
-
- def start(self):
- try:
- TangoServer.start(self)
- except:
- pass
-
-
-class Sardana:
- """Generic Sardana system"""
-
- SimulationModes = {
- "Basic" : { "Motor" : ("DummyMotorController.py", "DummyMotorController"),
- "CounterTimer" : ("DummyCounterTimerController.py", "DummyCounterTimerController"),
- "ZeroDExpChannel" : ("DummyZeroDController.py", "DummyZeroDController"),
- "OneDExpChannel" : ("Dummy1DController.py", "'Dummy1DController"),
- "TwoDExpChannel" : ("Dummy2DController.py", "'Dummy2DController"),
- "IORegister" : ("DummyIORController.py", "DummyIORController") },
- "Best" : { "Motor" : ("SimuMotCtrl.py", "SimuMotorController"),
- "CounterTimer" : ("SimuCTCtrl.py", "SimuCoTiController"),
- "ZeroDExpChannel" : ("Simu0DCtrl.py", "Simu0DController"),
- "OneDExpChannel" : ("Simu1DCtrl.py", "Simu1DController"),
- "TwoDExpChannel" : ("Simu2DCtrl.py", "Simu2DController"),
- "IORegister" : ("SimuIOCtrl.py", "SimuIOController"), },
- "Off" : { "Motor" : (None, None),
- "CounterTimer" : (None, None),
- "ZeroDExpChannel" : (None, None),
- "OneDExpChannel" : (None, None),
- "TwoDExpChannel" : (None, None),
- "IORegister" : (None, None) },
- }
-
- def __init__(self, source, simulation="Best", cleanup=True, log=False):
-
- if type(source) in types.StringTypes:
- self._filename = source
- self._xmldoc = None
- else:
- self._xmldoc = source
- self._filename = self._xmldoc.docinfo.URL
- self._cleanup = cleanup
- self._dft_tg_db = None
- self._tg_dbs = {}
- self._simulation = simulation
- self._log = log
-
- def o(self, m):
- sys.stdout.write(m)
- sys.stdout.flush()
-
- def on(self, m=''):
- self.o(m)
- sys.stdout.write('\n')
- sys.stdout.flush()
-
- def getTangoDB(self, id=None):
- if id is None:
- if self._dft_tg_db is None:
- db = PyTango.Database()
- self._dft_tg_db = db
- dft_host = "%s:%s" % (db.get_db_host(), db.get_db_port())
- self._tg_dbs[dft_host] = db
- return self._dft_tg_db
-
- db = self._tg_dbs.get(id)
- if not db is None:
- return db
- try:
- id = str(id)
- host, port = id.split(":")
- port = int(port)
- db = PyTango.Database(host, port)
- self._tg_dbs[id] = db
- return db
- except:
- return None
-
- def setUp(self):
- """Default setUp."""
- self.prepare()
- self.start()
-
- def tearDown(self):
- """Default tearDown."""
- self.stop()
- if self._cleanup:
- self.cleanUp()
-
- def _preprocess(self):
- start_pp_time = datetime.datetime.now()
- self.o("Preprocessing input... ")
-
- try:
- if not self.SimulationModes.has_key(self._simulation):
- return
-
- motSimNb = 0
- ctSimNb = 0
- zeroDSimNb = 0
- oneDSimNb = 0
- twoDSimNb = 0
- ioSimNb = 0
- pySigSimNb = 0
-
- sarName = self._sarNode.get("name")
- simType = self.SimulationModes.get(self._simulation)
- poolservers = self._sarNode.findall("PoolServer")
-
- SimuMotorLib, SimuMotorClass = simType["Motor"]
- SimuCoTiLib, SimuCoTiClass = simType["CounterTimer"]
- Simu0DLib, Simu0DClass = simType["ZeroDExpChannel"]
- Simu1DLib, Simu1DClass = simType["OneDExpChannel"]
- Simu2DLib, Simu2DClass = simType["TwoDExpChannel"]
- SimuIOLib, SimuIOClass = simType["IORegister"]
-
- simuMotorLibs = [ mode["Motor"][0] for mode in self.SimulationModes.values()]
- simuCoTiLibs = [ mode["CounterTimer"][0] for mode in self.SimulationModes.values()]
- simu0DLibs = [ mode["ZeroDExpChannel"][0] for mode in self.SimulationModes.values()]
- simu1DLibs = [ mode["OneDExpChannel"][0] for mode in self.SimulationModes.values()]
- simu2DLibs = [ mode["TwoDExpChannel"][0] for mode in self.SimulationModes.values()]
- simuIOLibs = [ mode["IORegister"][0] for mode in self.SimulationModes.values()]
-
- for poolserver in poolservers:
- simuMotorList = []
- pool = poolserver.find("Pool")
-
- # Process Motor controllers
- motctrls = pool.xpath("Controller[@type = 'Motor']")
- needsServerNumber = len(motctrls) > 1
- for ctrl in motctrls:
- lib = ctrl.get("lib")
- klass = ctrl.get("class")
-
- if self._simulation == "Off" or lib in simuMotorLibs or ctrl.get('name').startswith('REAL'):
- continue
-
- motSimNb += 1
-
- if self._simulation == "Best":
- # add a SimuMotorServer node to the Sardana node
- simuServer = etree.SubElement(self._sarNode, "SimuMotorServer")
- tgHost = poolserver.get("tangoHost")
- if tgHost:
- simuServer.set("tangoHost", tgHost)
- serverName = "SimuMotorCtrl/%s" % sarName
- if needsServerNumber:
- serverName += "%03d" % motSimNb
- simuServer.set("serverName", serverName)
-
- simuMotCtrl = etree.SubElement(simuServer, "SimuMotorCtrl")
- simuMotCtrlName = "%s/simumotctrl/%03d" % (sarName, motSimNb)
- simuMotCtrl.set("deviceName", simuMotCtrlName)
- maxError = etree.SubElement(simuMotCtrl, "Property")
- maxError.set("name", "MaxError")
- maxErrorV = etree.SubElement(maxError, "Item")
- maxErrorV.text = "0.0"
-
- for m in ctrl.findall("Motor"):
- m_nb = int(m.get('axis'))
- simuMotor = etree.SubElement(simuServer, "SimuMotor")
- devName = "%s/simumotctrl%03d/%03d" % (sarName, motSimNb, m_nb)
- simuMotor.set("deviceName", devName)
- simuMotor.set("class", "SimuMotor")
- simuMotorList.append(simuMotor)
-
- # change the pool XML nodes to refer to simulator lib
- # instead of real lib
- map(ctrl.remove, ctrl.findall("Property"))
- ctrl.set("lib", SimuMotorLib)
- ctrl.set("class", SimuMotorClass)
-
- if self._simulation == "Best":
- devName = etree.SubElement(ctrl, "Property")
- devName.set("name", "DevName")
- devNameV = etree.SubElement(devName, "Item")
- devNameV.text = simuMotCtrlName
-
- # Process CounterTimer controllers
- ctctrls = pool.xpath("Controller[@type = 'CounterTimer' and " \
- "@lib != '%s' and @class != '%s']" \
- % ("UxTimerCtrl.la", "UnixTimer"))
- needsServerNumber = len(ctctrls) > 1
- for ctrl in ctctrls:
- lib = ctrl.get("lib")
- klass = ctrl.get("class")
-
- if self._simulation == "Off" or lib in simuCoTiLibs or ctrl.get('name').startswith('REAL'):
- continue
-
- ctSimNb += 1
-
- if self._simulation == "Best":
- # add a SimuCoTiServer node to the Sardana node
- simuServer = etree.SubElement(self._sarNode, "SimuCoTiServer")
- tghost = poolserver.get("tangoHost")
- if tghost:
- simuServer.set("tangoHost", tgHost)
- serverName = "SimuCoTiCtrl/%s" % sarName
- if needsServerNumber:
- serverName += "%03d" % ctSimNb
- simuServer.set("serverName", serverName)
-
- simuCoTiCtrl = etree.SubElement(simuServer, "SimuCoTiCtrl")
- simuCoTiCtrlName = "%s/simuctctrl/%03d" % (sarName, ctSimNb)
- simuCoTiCtrl.set("deviceName", simuCoTiCtrlName)
-
- motRef = 0
- for ct in ctrl.findall("CounterTimer"):
- ct_nb = int(ct.get('axis'))
- simuCounter = etree.SubElement(simuServer, "SimuCounter")
- devName = "%s/simuctctrl%03d/%03d" % (sarName, ctSimNb, ct_nb)
- simuCounter.set("deviceName", devName)
- simuCounter.set("class", "SimuCounter")
- pAverage = etree.SubElement(simuCounter, "Property")
- pAverage.set("name", "Average")
- pAverage.set("type", "DevDouble")
- pAverage.text = "50.0"
-
- pMax = etree.SubElement(simuCounter, "Property")
- pMax.set("name", "Max")
- pMax.set("type", "DevDouble")
- pMax.text = "500.0"
-
- pSigma = etree.SubElement(simuCounter, "Property")
- pSigma.set("name", "Sigma")
- pSigma.set("type", "DevDouble")
- pSigma.text = "250.0"
-
- if simuMotorList:
- pMotorName = etree.SubElement(simuCounter, "Property")
- pMotorName.set("name", "MotorName")
- pMotorName.set("type", "DevString")
- pMotorName.text = simuMotorList[motRef].get("deviceName")
- if motRef == len(simuMotorList) - 1:
- motRef = 0
- else:
- motRef += 1
-
- # change the pool XML nodes to refer to simulator lib
- # instead of real lib
- map(ctrl.remove, ctrl.findall("Property"))
- ctrl.set("lib", SimuCoTiLib)
- ctrl.set("class", SimuCoTiClass)
- if self._simulation == "Best":
- devName = etree.SubElement(ctrl, "Property")
- devName.set("name", "DevName")
- devNameV = etree.SubElement(devName, "Item")
- devNameV.text = simuCoTiCtrlName
-
- pySigSimNode = None
-
- # Process 0D controllers
- zerodctrls = pool.xpath("Controller[@type = 'ZeroDExpChannel']")
- for ctrl in zerodctrls:
- lib = ctrl.get("lib")
- klass = ctrl.get("class")
-
- if self._simulation == "Off" or lib in simu0DLibs or ctrl.get('name').startswith('REAL'):
- continue
-
- zeroDSimNb += 1
- pySigSimNb += 1
-
- if self._simulation == "Best":
- if pySigSimNode is None:
- # add a PySignalSimulator node to the Sardana node
- pySigSimNode = etree.SubElement(self._sarNode, "PySignalSimulatorServer")
- tghost = poolserver.get("tangoHost")
- if tghost:
- pySigSimNode.set("tangoHost", tgHost)
- serverName = "PySignalSimulator/%s" % sarName
- pySigSimNode.set("serverName", serverName)
-
- simu0DCtrl = etree.SubElement(pySigSimNode, "PySignalSimulator")
- simu0DCtrlName = "%s/PySignalSimulator/%03d" % (sarName, pySigSimNb)
- simu0DCtrl.set("deviceName", simu0DCtrlName)
-
- zerods = ctrl.findall("ZeroDExpChannel")
-
- if len(zerods) > 0:
- pSimAttributes = etree.SubElement(simu0DCtrl, "Property")
- pSimAttributes.set("name", "DynamicAttributes")
- pSimAttributes.set("type", "DevVarStringArray")
- simAttrTempl = "zerod%03d=float(100.0+10.0*random())"
- for i in xrange(len(zerods)):
- pSimAttributeItem = etree.SubElement(pSimAttributes, "Item")
- pSimAttributeItem.text = simAttrTempl % (i + 1)
-
- # change the pool XML nodes to refer to simulator lib
- # instead of real lib
- map(ctrl.remove, ctrl.findall("Property"))
- ctrl.set("lib", Simu0DLib)
- ctrl.set("class", Simu0DClass)
- if self._simulation == "Best":
- attributeNames = etree.SubElement(ctrl, "Property")
- attributeNames.set("name", "AttributeNames")
- simAttrTempl = "%s/zerod%%03d" % simu0DCtrlName
- for i in xrange(len(zerods)):
- attributeNameItem = etree.SubElement(attributeNames, "Item")
- attributeNameItem.text = simAttrTempl % (i + 1)
-
- # Process 1D controllers
- onedctrls = pool.xpath("Controller[@type = 'OneDExpChannel']")
- for ctrl in onedctrls:
- lib = ctrl.get("lib")
- klass = ctrl.get("class")
-
- if self._simulation == "Off" or lib in simu1DLibs or ctrl.get('name').startswith('REAL'):
- continue
-
- oneDSimNb += 1
- pySigSimNb += 1
-
- if self._simulation == "Best":
- if pySigSimNode is None:
- # add a PySignalSimulator node to the Sardana node
- pySigSimNode = etree.SubElement(self._sarNode, "PySignalSimulatorServer")
- tghost = poolserver.get("tangoHost")
- if tghost:
- pySigSimNode.set("tangoHost", tgHost)
- serverName = "PySignalSimulator/%s" % sarName
- pySigSimNode.set("serverName", serverName)
-
- simu1DCtrl = etree.SubElement(pySigSimNode, "PySignalSimulator")
- simu1DCtrlName = "%s/PySignalSimulator/%03d" % (sarName, pySigSimNb)
- simu1DCtrl.set("deviceName", simu1DCtrlName)
-
- onedds = ctrl.findall("OneDExpChannel")
-
- if len(onedds) > 0:
- pSimAttributes = etree.SubElement(simu1DCtrl, "Property")
- pSimAttributes.set("name", "DynamicAttributes")
- pSimAttributes.set("type", "DevVarStringArray")
-
- simAttrTempl = "oned%03d=DevVarLongArray([10*sin(0.01*x) for x in xrange(100)])"
- for i in xrange(len(oneds)):
- pSimAttributeItem = etree.SubElement(pSimAttributes, "Item")
- pSimAttributeItem.text = simAttrTempl % (i + 1)
-
- # change the pool XML nodes to refer to simulator lib
- # instead of real lib
- map(ctrl.remove, ctrl.findall("Property"))
- ctrl.set("lib", Simu1DLib)
- ctrl.set("class", Simu1DClass)
- if self._simulation == "Best":
- attributeNames = etree.SubElement(ctrl, "Property")
- attributeNames.set("name", "AttributeNames")
- attributeNamesV = etree.SubElement(attributeNames, "Item")
- simAttrTempl = "%s/oned%%03d" % simu1DCtrlName
- for i in xrange(len(oneds)):
- attributeNameItem = etree.SubElement(attributeNames, "Item")
- attributeNameItem.text = simAttrTempl % (i + 1)
-
- # Process IORegister controllers
- ioctrls = pool.xpath("Controller[@type = 'IORegister']")
- for ctrl in ioctrls:
- lib = ctrl.get("lib")
- klass = ctrl.get("class")
-
- if self._simulation == "Off" or lib in simuIOLibs or ctrl.get('name').startswith('REAL'):
- continue
-
- ioSimNb += 1
- pySigSimNb += 1
-
- if self._simulation == "Best":
- if pySigSimNode is None:
- # add a PySignalSimulator node to the Sardana node
- pySigSimNode = etree.SubElement(self._sarNode, "PySignalSimulatorServer")
- tghost = poolserver.get("tangoHost")
- if tghost:
- pySigSimNode.set("tangoHost", tgHost)
- serverName = "PySignalSimulator/%s" % sarName
- pySigSimNode.set("serverName", serverName)
-
- simuIOCtrl = etree.SubElement(pySigSimNode, "PySignalSimulator")
- simuIOCtrlName = "%s/PySignalSimulator/%03d" % (sarName, pySigSimNb)
- simuIOCtrl.set("deviceName", simuIOCtrlName)
-
- iors = ctrl.findall("IORegister")
-
- if len(iors) > 0:
- pSimAttributes = etree.SubElement(simuIOCtrl, "Property")
- pSimAttributes.set("name", "DynamicAttributes")
- pSimAttributes.set("type", "DevVarStringArray")
-
- simAttrTempl = "ior%03d=int(READ and VAR('ior%03d') or WRITE and VAR('ior%03d',VALUE))"
- for i in xrange(len(iors)):
- pSimAttributeItem = etree.SubElement(pSimAttributes, "Item")
- pSimAttributeItem.text = simAttrTempl % ((i + 1), (i + 1), (i + 1))
-
- # change the pool XML nodes to refer to simulator lib
- # instead of real lib
- map(ctrl.remove, ctrl.findall("Property"))
- ctrl.set("lib", SimuIOLib)
- ctrl.set("class", SimuIOClass)
- if self._simulation == "Best":
- attributeNames = etree.SubElement(ctrl, "Property")
- attributeNames.set("name", "AttributeNames")
- simAttrTempl = "%s/ior%%03d" % simuIOCtrlName
- for i in xrange(len(iors)):
- attributeNameItem = etree.SubElement(attributeNames, "Item")
- attributeNameItem.text = simAttrTempl % (i + 1)
-
- end_pp_time = datetime.datetime.now()
- dt = end_pp_time - start_pp_time
- self.on("(took %s) [DONE]" % str(dt))
- except:
- self.on("[FAILED]")
- raise
-
- def prepare(self):
- """Prepares everything to be run"""
- if not self._xmldoc:
- self._xmldoc = etree.parse(self._filename)
-
- self._sarNode = self._xmldoc.getroot()
-
- sarNodeName = "Sardana"
-
- if self._sarNode.tag != sarNodeName:
- raise Exception("<Sardana> root node not found in %s" % self._filename)
-
- self._preprocess()
-
- self.prepareMotorSimulators()
- self.prepareCounterTimerSimulators()
- self.prepareSignalSimulators()
- self.prepareDevicePools()
- self.prepareMSs()
- self.prepareServices()
-
- def prepareServices(self):
- sarName = self._sarNode.get("name")
- macro_servers = self._sarNode.findall("MacroServerServer/MacroServer")
- db = self.getTangoDB()
-
- if len(macro_servers) > 0:
- ms_dev_name = macro_servers[0].get("deviceName")
- db.register_service("Sardana", sarName, ms_dev_name)
- self._service = sarName, ms_dev_name
- return
-
- pools = self._sarNode.findall("Pool")
- if len(pools) > 0:
- pool_dev_name = pools[0].get("deviceName")
- db.register_service("Sardana", sarName, pool_dev_name)
- self._service = sarName, pool_dev_name
- return
-
- def prepareMotorSimulators(self):
- servNodes = self._sarNode.findall("SimuMotorServer")
-
- self._motorSims = {}
-
- for servNode in servNodes:
- serv = SimuMotorServer(servNode, self, log=self._log)
- serv.prepare()
- self._motorSims[serv.getInstanceName()] = serv
-
- def prepareCounterTimerSimulators(self):
- servNodes = self._sarNode.findall("SimuCoTiServer")
-
- self._coTiSims = {}
-
- for servNode in servNodes:
- serv = SimuCounterTimerServer(servNode, self, log=self._log)
- serv.prepare()
- self._coTiSims[serv.getInstanceName()] = serv
-
- def prepareSignalSimulators(self):
- servNodes = self._sarNode.findall("PySignalSimulatorServer")
-
- self._signalSims = {}
-
- for servNode in servNodes:
- serv = PySignalSimulatorServer(servNode, self, log=self._log)
- serv.prepare()
- self._signalSims[serv.getInstanceName()] = serv
-
- def prepareDevicePools(self):
- servNodes = self._sarNode.findall("PoolServer")
-
- self._devicePools = {}
-
- for servNode in servNodes:
- serv = DevicePoolServer(servNode, self, log=self._log)
- serv.prepare()
- self._devicePools[serv.getInstanceName()] = serv
-
- def prepareMSs(self):
- servNodes = self._sarNode.findall("MacroServer")
-
- self._macServs = {}
-
- for servNode in servNodes:
- serv = MacroServerServer(servNode, self, log=self._log)
- serv.prepare()
- self._macServs[serv.getInstanceName()] = serv
-
- def _getServsShutdownOrder(self):
- servs = self._macServs.values()
- servs += self._devicePools.values()
- servs += self._signalSims.values()
- servs += self._coTiSims.values()
- servs += self._motorSims.values()
- return servs
-
- def _getServsStartupOrder(self):
- servs = self._motorSims.values()
- servs += self._coTiSims.values()
- servs += self._signalSims.values()
- servs += self._devicePools.values()
- servs += self._macServs.values()
- return servs
-
- def cleanUp(self):
- for s in self._getServsShutdownOrder():
- s.cleanUp()
-
- if hasattr(self, '_service') and not self._service is None:
- db = self.getTangoDB()
- db.unregister_service("Sardana", self._service[0])
-
- def start(self):
- """Default startup. Starts Simulators, Device Pool and MacroServer"""
-
- for s in self._getServsStartupOrder():
- s.start()
-
- def stop(self):
- """Default stop."""
-
- for s in self._getServsShutdownOrder():
- s.stop()
-
- def run(self):
- servs = self._getServsStartupOrder()
- self.o("Running ")
- count = 0
- while 1:
- count += 1
- if count % 10 == 0:
- self.o(":")
- for p in servs:
- p.run(step=True, timeout=0.1)
-
- def getDoc(self):
- return self._xmldoc
-
- def getRoot(self):
- return self._sarNode
-
-
-if __name__ == "__main__":
- import getopt
-
- try:
- opts, pargs = getopt.getopt(sys.argv[1:], 'vl', ['simulation=', 'cleanup='])
- except Exception, e:
- print "ERROR:", str(e)
- print
- print __doc__
- sys.exit(3)
-
- if not len(pargs):
- print "ERROR: Please provide XML filename"
- print
- sys.exit(3)
-
- filename = pargs[0]
-
- simulation = "Best"
- cleanup = True
- just_output_and_exit = False
- activate_logging = False
-
- for opt, value in opts:
- if opt == '-l':
- activate_logging = True
- elif opt == '--simulation':
- simulation = value
- elif opt == '--cleanup':
- cleanup = value in ('yes', 'Yes', 'true', 'True', 'y', 'Y', '1')
- elif opt == '-v':
- just_output_and_exit = True
- else:
- print __doc__
- sys.exit(3)
-
- try:
- import to_sar
- sar_doc = to_sar.transform(filename)
- except Exception, e:
- print 'Sorry, but some problems found when trying to convert to SARDANA xml:'
- print str(e)
-
- sardana = Sardana(sar_doc, simulation=simulation, log=activate_logging, cleanup=cleanup)
-
- if just_output_and_exit:
- sardana.prepare()
- print etree.tostring(sardana.getRoot(), pretty_print=True)
- sys.exit(0)
-
- try:
- sardana.setUp()
- print "Ready!"
- sardana.run()
- except KeyboardInterrupt, e:
- print "User pressed Ctrl+C..."
- except Exception, e:
- traceback.print_exc()
-
- print "Shutting down!"
- sardana.tearDown()
-
diff --git a/src/sardana/tools/config/sardana.xsd b/src/sardana/tools/config/sardana.xsd
deleted file mode 100644
index 1d32df39..00000000
--- a/src/sardana/tools/config/sardana.xsd
+++ /dev/null
@@ -1,234 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema version="1.0" attributeFormDefault="unqualified" elementFormDefault="qualified"
- targetNamespace="http://sardana.cells.es/client/framework/config"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:tango="http://tango.org/config"
- xmlns:sardana="http://sardana.cells.es/client/framework/config">
-
- <xs:import namespace="http://tango.org/config"/>
-
- <xs:element name="Sardana" type="sardana:Sardana"/>
-
- <xs:complexType name="Sardana">
- <xs:sequence>
- <xs:element type="sardana:PoolServer" name="PoolServer" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:MacroServerServer" name="MacroServerServer" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:Simulators" name="Simulators" minOccurs="0" maxOccurs="1"/>
- <xs:element type="tango:Description" name="Description" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="name" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="Simulators">
- <xs:sequence>
- <xs:element type="sardana:DeviceServer" name="DeviceServer" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="ReferenceType">
- <xs:attribute type="xs:string" name="name" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="Role">
- <xs:attribute type="xs:string" name="role" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="Library">
- <xs:sequence>
- <xs:element type="sardana:LibElement" name="LibElement" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="LibElement" mixed="true">
- <xs:sequence>
- <xs:element type="xs:string" name="Description" minOccurs="0"/>
- <xs:element type="sardana:Role" name="MotorRole" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:Role" name="PseudoMotorRole" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="tango:Property" name="Property" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="type" use="required"/>
- <xs:attribute type="xs:string" name="name" use="required"/>
- <xs:attribute type="xs:string" name="alias" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="PoolServer">
- <xs:complexContent>
- <xs:extension base="tango:DeviceServer"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="Pool">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- <xs:sequence>
- <xs:element type="sardana:Library" name="Library" minOccurs="0" maxOccurs="1" />
- <xs:element type="sardana:Controller" name="Controller" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:MotorGroup" name="MotorGroup" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:MeasurementGroup" name="MeasurementGroup" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="Controller" mixed="true">
- <xs:sequence>
- <xs:element type="tango:Property" name="Property" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:Motor" name="Motor" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:PseudoMotor" name="PseudoMotor" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:ExpChannel" name="CTExpChannel" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:ExpChannel" name="ZeroDExpChannel" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:ExpChannel" name="OneDExpChannel" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:ExpChannel" name="TwoDExpChannel" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="sardana:IORegister" name="IORegister" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="type" use="required"/>
- <xs:attribute type="xs:string" name="name" use="required"/>
- <xs:attribute type="xs:string" name="lib" use="required"/>
- <xs:attribute type="xs:string" name="class" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="ControllerRef">
- <xs:complexContent>
- <xs:extension base="sardana:ReferenceType">
- <xs:attribute type="xs:int" name="index" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="Motor">
- <xs:complexContent>
- <xs:extension base="tango:Device"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="PseudoMotor">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- <xs:sequence>
- <xs:element type="sardana:ReferenceType" name="LibRef" minOccurs="1" maxOccurs="1" />
- <xs:element type="sardana:ReferenceType" name="MotorRef" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="role" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="MotorGroup">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element type="sardana:ReferenceType" name="MotorRef" />
- <xs:element type="sardana:ReferenceType" name="PseudoMotorRef"/>
- <xs:element type="sardana:ReferenceType" name="MotorGroupRef" />
- </xs:choice>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="ExpChannel">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- <xs:sequence>
- <xs:element type="sardana:ControllerRef" name="ControllerRef" minOccurs="1" maxOccurs="1"/>
- </xs:sequence>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="IORegister">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- <xs:sequence>
- <xs:element type="sardana:ControllerRef" name="ControllerRef" minOccurs="1" maxOccurs="1"/>
- </xs:sequence>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="MeasurementGroup">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element type="sardana:ReferenceType" name="ChannelRef"/>
- </xs:choice>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <!-- Macro server -->
-
- <xs:complexType name="MacroServerServer">
- <xs:complexContent>
- <xs:extension base="tango:DeviceServer"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="DoorServer">
- <xs:complexContent>
- <xs:extension base="tango:DeviceServer"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="MacroServer">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="Door">
- <xs:complexContent>
- <xs:extension base="tango:Device">
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="SimuMotorServer">
- <xs:complexContent>
- <xs:extension base="tango:DeviceServer"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="SimuMotorCtrl">
- <xs:complexContent>
- <xs:extension base="tango:Device"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="SimuMotor">
- <xs:complexContent>
- <xs:extension base="tango:Device"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="SimuCoTiServer">
- <xs:complexContent>
- <xs:extension base="tango:DeviceServer"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="SimuCoTiCtrl">
- <xs:complexContent>
- <xs:extension base="tango:Device"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="SimuCounter">
- <xs:complexContent>
- <xs:extension base="tango:Device"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="PySignalSimulatorServer">
- <xs:complexContent>
- <xs:extension base="tango:DeviceServer"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="PySignalSimulator">
- <xs:complexContent>
- <xs:extension base="tango:Device"/>
- </xs:complexContent>
- </xs:complexType>
-
-</xs:schema>
diff --git a/src/sardana/tools/config/tango.xsd b/src/sardana/tools/config/tango.xsd
deleted file mode 100644
index d74b4fd4..00000000
--- a/src/sardana/tools/config/tango.xsd
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema version="1.0" attributeFormDefault="unqualified" elementFormDefault="qualified"
- targetNamespace="http://tango.org/config"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:tango="http://tango.org/config">
-
- <xs:simpleType name="TangoHost">
- <xs:restriction base="xs:string">
- <xs:pattern value="[a-zA-Z0-9_\.]+\:{1}[0-9]+"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ServerName">
- <xs:restriction base="xs:string">
- <xs:pattern value="[a-zA-Z0-9_\.]+\/{1}[a-zA-Z0-9_\.]+"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="DeviceName">
- <xs:restriction base="xs:string">
- <xs:pattern value="[a-zA-Z0-9_\.]+\/{1}[a-zA-Z0-9_\.]+\/{1}[a-zA-Z0-9_\.]+"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="DeviceServer">
- <xs:sequence>
- <xs:element type="tango:Device" name="Device" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute type="tango:TangoHost" name="tangoHost" use="optional"/>
- <xs:attribute type="tango:ServerName" name="serverName" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="Device">
- <xs:sequence>
- <xs:element type="tango:Property" name="Property" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="tango:PollConfig" name="Polling" minOccurs="0" maxOccurs="1" />
- <xs:element type="tango:Logging" name="Logging" minOccurs="0" maxOccurs="1" />
- <xs:element type="tango:Attribute" name="Attribute" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="tango:Command" name="Command" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="tango:Description" name="Description" minOccurs="0" maxOccurs="1" />
- </xs:sequence>
- <xs:attribute type="tango:DeviceName" name="deviceName" use="required"/>
- <xs:attribute type="xs:string" name="alias" use="optional"/>
- <xs:attribute type="xs:string" name="class" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="Description" />
-
- <xs:complexType name="Property">
- <xs:sequence>
- <xs:element type="xs:string" name="Item" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="name" use="required"/>
- <xs:attribute type="xs:string" name="type" use="optional"/>
- <xs:attribute type="xs:string" name="description" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="PollConfig">
- <xs:attribute type="xs:string" name="oldfactor" use="optional"/>
- <xs:attribute type="xs:string" name="ringdepth" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="Attribute" mixed="true">
- <xs:sequence>
- <xs:element type="tango:AttrValue" name="Value" minOccurs="0" maxOccurs="1" />
- <xs:element type="tango:Property" name="Property" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="tango:Polling" name="Polling" minOccurs="0" maxOccurs="1" />
- <xs:element type="tango:AttrEvents" name="Events" minOccurs="0" maxOccurs="1" />
- <xs:element type="tango:AttrConfiguration" name="Configuration" minOccurs="0" maxOccurs="1" />
- </xs:sequence>
- <xs:attribute type="xs:string" name="name" use="required"/>
- <xs:attribute type="xs:string" name="type" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="Logging">
- <xs:sequence>
- <xs:element type="xs:string" name="LoggingTarget" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element type="xs:string" name="CurrentLoggingTarget" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="level" use="optional"/>
- <xs:attribute type="xs:string" name="current_level" use="optional"/>
- <xs:attribute type="xs:string" name="RFT" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="Command" mixed="true">
- <xs:sequence>
- <xs:element type="tango:Polling" name="Polling" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute type="xs:string" name="name" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="AttrValue" mixed="true">
- <xs:sequence>
- <xs:element type="tango:Item" name="Item" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="Item" mixed="true">
- <xs:sequence>
- <xs:element type="tango:Item" name="Item" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="Polling" mixed="true">
- <xs:attribute type="xs:boolean" name="polled" use="optional"/>
- <xs:attribute type="xs:int" name="period" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrEvents" mixed="true">
- <xs:sequence>
- <xs:element type="tango:AttrChangeEvent" name="ChangeEvent" minOccurs="0" maxOccurs="1"/>
- <xs:element type="tango:AttrArchiveEvent" name="ArchiveEvent" minOccurs="0" maxOccurs="1"/>
- <xs:element type="tango:AttrPeriodicEvent" name="PeriodicEvent" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="AttrChangeEvent" mixed="true">
- <xs:attribute type="xs:string" name="absolute" use="optional"/>
- <xs:attribute type="xs:string" name="relative" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrArchiveEvent" mixed="true">
- <xs:attribute type="xs:string" name="absolute" use="optional"/>
- <xs:attribute type="xs:string" name="relative" use="optional"/>
- <xs:attribute type="xs:string" name="period" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrPeriodicEvent" mixed="true">
- <xs:attribute type="xs:string" name="period" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrConfiguration" mixed="true">
- <xs:sequence>
- <xs:element type="tango:AttrDisplay" name="Display" minOccurs="0" maxOccurs="1"/>
- <xs:element type="tango:AttrUnits" name="Units" minOccurs="0" maxOccurs="1"/>
- <xs:element type="tango:AttrRange" name="Range" minOccurs="0" maxOccurs="1"/>
- <xs:element type="tango:AttrAlarms" name="Alarms" minOccurs="0" maxOccurs="1"/>
- <xs:element type="xs:string" name="Description" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="AttrDisplay" mixed="true">
- <xs:attribute type="xs:string" name="label" use="optional"/>
- <xs:attribute type="xs:string" name="format" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrUnits" mixed="true">
- <xs:attribute type="xs:string" name="unit" use="optional"/>
- <xs:attribute type="xs:string" name="display_unit" use="optional"/>
- <xs:attribute type="xs:string" name="standard_unit" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrRange" mixed="true">
- <xs:attribute type="xs:string" name="min" use="optional"/>
- <xs:attribute type="xs:string" name="max" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="AttrAlarms" mixed="true">
- <xs:attribute type="xs:string" name="min_alarm" use="optional"/>
- <xs:attribute type="xs:string" name="max_alarm" use="optional"/>
- <xs:attribute type="xs:string" name="min_warning" use="optional"/>
- <xs:attribute type="xs:string" name="max_warning" use="optional"/>
- <xs:attribute type="xs:string" name="delta_t" use="optional"/>
- <xs:attribute type="xs:string" name="delta_val" use="optional"/>
- </xs:complexType>
-</xs:schema>
diff --git a/src/sardana/tools/config/to_sar.py b/src/sardana/tools/config/to_sar.py
deleted file mode 100644
index f3c5eada..00000000
--- a/src/sardana/tools/config/to_sar.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-
-import sys, types
-from lxml import etree
-
-SAR_NS = 'http://sardana.cells.es/client/framework/config'
-
-def transform(f):
- if type(f) in types.StringTypes:
- doc = etree.parse(f)
- else:
- doc = f
-
- root = doc.getroot()
-
- if (root.nsmap.get(None) == SAR_NS) or root.tag.endswith("Sardana"):
- return doc
-
- # it is either a EXCEL XML or a Flat ODS
- if root.nsmap.get('ss'):
- import xls_to_sar
- t = xls_to_sar.transform
- else:
- import fods_to_sar
- t = fods_to_sar.transform
- return t(doc)
-
-def main():
- filename = sys.argv[1]
- t = transform(filename)
- print etree.tostring(t, pretty_print=True)
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/tools/config/xls_to_sar.py b/src/sardana/tools/config/xls_to_sar.py
deleted file mode 100644
index 0224da30..00000000
--- a/src/sardana/tools/config/xls_to_sar.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-
-""" The sardana transformation tool.
- Syntax:
- python xls_to_sar.py <file.xml>
-
- This tool outputs a sardana XML file from an Excel XML file.
-
- file.xml must be a valid XML file comming from an EXCEL spreadsheet.
-"""
-
-
-import sys, os, types
-from lxml import etree
-
-def transform(f):
- directory = os.path.dirname(os.path.abspath(__file__))
- xslt_filename = os.path.join(directory, "XLS_TO_SAR.xslt")
-
- t = etree.XSLT(etree.parse(xslt_filename))
- if type(f) in types.StringTypes:
- doc = etree.parse(f)
- else:
- doc = f
- return t(doc)
-
-def main():
- if len(sys.argv) < 2:
- print __doc__
- sys.exit(1)
-
- filename = sys.argv[1]
- t = transform(filename)
- print etree.tostring(t, pretty_print=True)
-
-if __name__ == "__main__":
- main()
diff --git a/src/sardana/util/__init__.py b/src/sardana/util/__init__.py
deleted file mode 100644
index 3aedf9ff..00000000
--- a/src/sardana/util/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module provides the sardana utilities"""
-
diff --git a/src/sardana/util/deepreload.py b/src/sardana/util/deepreload.py
deleted file mode 100644
index 670e308c..00000000
--- a/src/sardana/util/deepreload.py
+++ /dev/null
@@ -1,366 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""
-A module to change reload() so that it acts recursively.
-To enable it type::
-
- import __builtin__, deepreload
- __builtin__.reload = deepreload.reload
-
-You can then disable it with::
-
- __builtin__.reload = deepreload.original_reload
-
-Alternatively, you can add a dreload builtin alongside normal reload with::
-
- __builtin__.dreload = deepreload.reload
-
-This code is almost entirely based on knee.py, which is a Python
-re-implementation of hierarchical module import.
-"""
-
-import __builtin__
-from contextlib import contextmanager
-import imp
-import sys
-
-from types import ModuleType
-from warnings import warn
-
-original_import = __builtin__.__import__
-
-
-class DeepReload(object):
-
- def __enter__(self):
- __builtin__.reload = reload
-
- def __exit__(self, etype, evalue, etraceback):
- __builtin__.reload = original_reload
-
-
-@contextmanager
-def replace_import_hook(new_import):
- saved_import = __builtin__.__import__
- __builtin__.__import__ = new_import
- try:
- yield
- finally:
- __builtin__.__import__ = saved_import
-
-def get_parent(globals, level):
- """
- parent, name = get_parent(globals, level)
-
- Return the package that an import is being performed in. If globals comes
- from the module foo.bar.bat (not itself a package), this returns the
- sys.modules entry for foo.bar. If globals is from a package's __init__.py,
- the package's entry in sys.modules is returned.
-
- If globals doesn't come from a package or a module in a package, or a
- corresponding entry is not found in sys.modules, None is returned.
- """
- orig_level = level
-
- if not level or not isinstance(globals, dict):
- return None, ''
-
- pkgname = globals.get('__package__', None)
-
- if pkgname is not None:
- # __package__ is set, so use it
- if not hasattr(pkgname, 'rindex'):
- raise ValueError('__package__ set to non-string')
- if len(pkgname) == 0:
- if level > 0:
- raise ValueError('Attempted relative import in non-package')
- return None, ''
- name = pkgname
- else:
- # __package__ not set, so figure it out and set it
- if '__name__' not in globals:
- return None, ''
- modname = globals['__name__']
-
- if '__path__' in globals:
- # __path__ is set, so modname is already the package name
- globals['__package__'] = name = modname
- else:
- # Normal module, so work out the package name if any
- lastdot = modname.rfind('.')
- if lastdot < 0 and level > 0:
- raise ValueError("Attempted relative import in non-package")
- if lastdot < 0:
- globals['__package__'] = None
- return None, ''
- globals['__package__'] = name = modname[:lastdot]
-
- dot = len(name)
- for x in xrange(level, 1, -1):
- try:
- dot = name.rindex('.', 0, dot)
- except ValueError:
- raise ValueError("attempted relative import beyond top-level "
- "package")
- name = name[:dot]
-
- try:
- parent = sys.modules[name]
- except:
- if orig_level < 1:
- warn("Parent module '%.200s' not found while handling absolute "
- "import" % name)
- parent = None
- else:
- raise SystemError("Parent module '%.200s' not loaded, cannot "
- "perform relative import" % name)
-
- # We expect, but can't guarantee, if parent != None, that:
- # - parent.__name__ == name
- # - parent.__dict__ is globals
- # If this is violated... Who cares?
- return parent, name
-
-def load_next(mod, altmod, name, buf):
- """
- mod, name, buf = load_next(mod, altmod, name, buf)
-
- altmod is either None or same as mod
- """
-
- if len(name) == 0:
- # completely empty module name should only happen in
- # 'from . import' (or '__import__("")')
- return mod, None, buf
-
- dot = name.find('.')
- if dot == 0:
- raise ValueError('Empty module name')
-
- if dot < 0:
- subname = name
- next = None
- else:
- subname = name[:dot]
- next = name[dot+1:]
-
- if buf != '':
- buf += '.'
- buf += subname
-
- result = import_submodule(mod, subname, buf)
- if result is None and mod != altmod:
- result = import_submodule(altmod, subname, subname)
- if result is not None:
- buf = subname
-
- if result is None:
- raise ImportError("No module named %.200s" % name)
-
- return result, next, buf
-
-# Need to keep track of what we've already reloaded to prevent cyclic evil
-found_now = {}
-
-def import_submodule(mod, subname, fullname):
- """m = import_submodule(mod, subname, fullname)"""
- # Require:
- # if mod == None: subname == fullname
- # else: mod.__name__ + "." + subname == fullname
-
- global found_now
- if fullname in found_now and fullname in sys.modules:
- m = sys.modules[fullname]
- else:
- print 'Reloading', fullname
- found_now[fullname] = 1
- oldm = sys.modules.get(fullname, None)
-
- if mod is None:
- path = None
- elif hasattr(mod, '__path__'):
- path = mod.__path__
- else:
- return None
-
- try:
- # This appears to be necessary on Python 3, because imp.find_module()
- # tries to import standard libraries (like io) itself, and we don't
- # want them to be processed by our deep_import_hook.
- with replace_import_hook(original_import):
- fp, filename, stuff = imp.find_module(subname, path)
- except ImportError:
- return None
-
- try:
- m = imp.load_module(fullname, fp, filename, stuff)
- except:
- # load_module probably removed name from modules because of
- # the error. Put back the original module object.
- if oldm:
- sys.modules[fullname] = oldm
- raise
- finally:
- if fp: fp.close()
-
- add_submodule(mod, m, fullname, subname)
-
- return m
-
-def add_submodule(mod, submod, fullname, subname):
- """mod.{subname} = submod"""
- if mod is None:
- return #Nothing to do here.
-
- if submod is None:
- submod = sys.modules[fullname]
-
- setattr(mod, subname, submod)
-
- return
-
-def ensure_fromlist(mod, fromlist, buf, recursive):
- """Handle 'from module import a, b, c' imports."""
- if not hasattr(mod, '__path__'):
- return
- for item in fromlist:
- if not hasattr(item, 'rindex'):
- raise TypeError("Item in ``from list'' not a string")
- if item == '*':
- if recursive:
- continue # avoid endless recursion
- try:
- all = mod.__all__
- except AttributeError:
- pass
- else:
- ret = ensure_fromlist(mod, all, buf, 1)
- if not ret:
- return 0
- elif not hasattr(mod, item):
- import_submodule(mod, item, buf + '.' + item)
-
-def deep_import_hook(name, globals=None, locals=None, fromlist=None, level=-1):
- """Replacement for __import__()"""
- parent, buf = get_parent(globals, level)
-
- head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
-
- tail = head
- while name:
- tail, name, buf = load_next(tail, tail, name, buf)
-
- # If tail is None, both get_parent and load_next found
- # an empty module name: someone called __import__("") or
- # doctored faulty bytecode
- if tail is None:
- raise ValueError('Empty module name')
-
- if not fromlist:
- return head
-
- ensure_fromlist(tail, fromlist, buf, 0)
- return tail
-
-modules_reloading = {}
-
-def deep_reload_hook(m):
- """Replacement for reload()."""
- if not isinstance(m, ModuleType):
- raise TypeError("reload() argument must be module")
-
- name = m.__name__
-
- if name not in sys.modules:
- raise ImportError("reload(): module %.200s not in sys.modules" % name)
-
- global modules_reloading
- try:
- return modules_reloading[name]
- except:
- modules_reloading[name] = m
-
- dot = name.rfind('.')
- if dot < 0:
- subname = name
- path = None
- else:
- try:
- parent = sys.modules[name[:dot]]
- except KeyError:
- modules_reloading.clear()
- raise ImportError("reload(): parent %.200s not in sys.modules" % name[:dot])
- subname = name[dot+1:]
- path = getattr(parent, "__path__", None)
-
- try:
- # This appears to be necessary on Python 3, because imp.find_module()
- # tries to import standard libraries (like io) itself, and we don't
- # want them to be processed by our deep_import_hook.
- with replace_import_hook(original_import):
- fp, filename, stuff = imp.find_module(subname, path)
- finally:
- modules_reloading.clear()
-
- try:
- newm = imp.load_module(name, fp, filename, stuff)
- except:
- # load_module probably removed name from modules because of
- # the error. Put back the original module object.
- sys.modules[name] = m
- raise
- finally:
- if fp: fp.close()
-
- modules_reloading.clear()
- return newm
-
-# Save the original hooks
-try:
- original_reload = __builtin__.reload
-except AttributeError:
- original_reload = imp.reload # Python 3
-
-# Replacement for reload()
-def reload(module, exclude=['sys', 'os.path', '__builtin__', '__main__']):
- """Recursively reload all modules used in the given module. Optionally
- takes a list of modules to exclude from reloading. The default exclude
- list contains sys, __main__, and __builtin__, to prevent, e.g., resetting
- display, exception, and io hooks.
- """
- global found_now
- for i in exclude:
- found_now[i] = 1
- try:
- with replace_import_hook(deep_import_hook):
- ret = deep_reload_hook(module)
- finally:
- found_now = {}
- return ret
-
-# Uncomment the following to automatically activate deep reloading whenever
-# this module is imported
-#__builtin__.reload = reload
diff --git a/src/sardana/util/motion/__init__.py b/src/sardana/util/motion/__init__.py
deleted file mode 100644
index 15173d06..00000000
--- a/src/sardana/util/motion/__init__.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This is the main device pool module"""
-
-__all__ = ["MotionPath", "Motion", "BaseMotor", "Motor"]
-
-__docformat__ = 'restructuredtext'
-
-from .motion import MotionPath, Motion, BaseMotor, Motor
diff --git a/src/sardana/util/motion/motion.py b/src/sardana/util/motion/motion.py
deleted file mode 100644
index f491e8b5..00000000
--- a/src/sardana/util/motion/motion.py
+++ /dev/null
@@ -1,696 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-"""This module contains the definition for a simulated motor"""
-
-__all__ = ["MotionPath", "Motion", "BaseMotor", "Motor", "DemoMotor"]
-
-__docformat__ = 'restructuredtext'
-
-import time
-from math import pow, sqrt
-
-
-class MotionPath(object):
- """Active motion path description"""
-
- #: True if motion in positive direction or False otherwise
- positive_displacement = True
-
- #: True if motion is not long enough to reach maximum velocity or False
- #: otherwise
- small_motion = False
-
- #: position where maximum velocity will be reached
- max_vel_pos = -1
-
- #: necessary displacement to reach maximum velocity
- displacement_reach_max_vel = 0
-
- #: necessary diplacement to reach minimum velocity
- displacement_reach_min_vel = 0
-
- #: maximum velocity possible
- max_vel = 0
-
- #: displacement at maximum velocity
- at_max_vel_displacement = -1
-
- #: time to reach maximum velocity
- max_vel_time = -1
-
- #: time to reach minimum velocity
- min_vel_time = -1
-
- #: time at maximum velocity
- at_max_vel_time = -1
-
- #: time the motion will take
- duration = -1
-
- def __init__(self, motor,
- initial_user_pos,
- final_user_pos,
- active_time=None):
- """MotionPath constructor - creates and calculates
- motion path parameters.
- :param initial_user_pos: position at which constant vel
- should be reached
- :param final_user_pos: position at which deceleration should
- start
- :param active_time: if passed, will fix the constant velocity
- (abs(final_user_pos - initial_user_pos)/active_time)
- otherwise motor constant velocity
- will be selected as high as possible"""
- self.motor = motor
- self.initial_user_pos = initial_user_pos
- self.final_user_pos = final_user_pos
- self.active_time = active_time
- self._calculateMotionPath()
-
- def setInitialUserPos(self, initial_user_pos):
- self.initial_user_pos = initial_user_pos
- self._calculateMotionPath()
-
- def setFinalUserPos(self, final_user_pos):
- self.final_user_pos = final_user_pos
- self._calculateMotionPath()
-
- def _calculateMotionPath(self):
- motor = self.motor
- initial_user_pos = self.initial_user_pos
- final_user_pos = self.final_user_pos
-
- initial_pos = initial_user_pos * motor.step_per_unit
- final_pos = final_user_pos * motor.step_per_unit
-
- displacement = abs(final_pos - initial_pos)
-
- # in this case active_time forces that the user range
- # correspond to the constant velocity
- # and
- if self.active_time != None:
- velocity = displacement / self.active_time
- self.motor.setMaxVelocity(velocity)
- sign = final_pos > initial_pos and 1 or -1
- accel_time = motor.getAccelerationTime()
- decel_time = motor.getDecelerationTime()
- base_vel = motor.getMinVelocity()
- accel_displacement = accel_time * 0.5 * (velocity + base_vel)
- decel_displacement = decel_time * 0.5 * (velocity + base_vel)
- initial_pos -= sign * accel_displacement
- final_pos += sign * decel_displacement
- displacement = abs(final_pos - initial_pos)
- self.initial_user_pos = initial_pos
- self.final_user_pos = final_pos
-
- if displacement == 0:
- positive_displacement = False
- small_motion = True
-
- accel = 0
- decel = 0
-
- displacement_reach_max_vel = 0
- displacement_reach_min_vel = 0
- max_vel = 0
- min_vel = 0
- max_vel_pos = initial_pos
- at_max_vel_displacement = 0
- max_vel_time = 0
- min_vel_time = 0
- at_max_vel_time = 0
- duration = 0
- else:
- positive_displacement = final_pos > initial_pos
-
- displmnt_not_cnst = motor.displacement_reach_max_vel + motor.displacement_reach_min_vel
- small_motion = displacement < displmnt_not_cnst
-
- if positive_displacement:
- accel = motor.accel
- decel = motor.decel
- else:
- accel = -motor.accel
- decel = -motor.decel
-
- if not small_motion:
- # necessary displacement to reach maximum velocity
- displacement_reach_max_vel = motor.displacement_reach_max_vel
- # necessary diplacement to reach minimum velocity
- displacement_reach_min_vel = motor.displacement_reach_min_vel
-
- if positive_displacement:
- max_vel = motor.max_vel
- min_vel = motor.min_vel
- # position where maximum velocity will be reached
- max_vel_pos = initial_pos + displacement_reach_max_vel
- else:
- max_vel = -motor.max_vel
- min_vel = -motor.min_vel
- # position where maximum velocity will be reached
- max_vel_pos = initial_pos - displacement_reach_max_vel
-
- # displacement at maximum velocity
- at_max_vel_displacement = displacement - (displacement_reach_max_vel + displacement_reach_min_vel)
-
- else: # Small movement
- # position where maximum velocity will be reached
- max_vel_pos = initial_pos * accel - final_pos * decel
- max_vel_pos /= accel - decel
-
- # necessary displacement to reach maximum velocity
- displacement_reach_max_vel = abs(max_vel_pos - initial_pos)
-
- # necessary diplacement to reach minimum velocity
- displacement_reach_min_vel = abs(final_pos - max_vel_pos)
-
- # maximum velocity possible
- cnst = 2 * accel * decel * displacement / (decel - accel)
- max_vel_2 = pow(motor.min_vel, 2) + cnst
-
- max_vel = sqrt(abs(max_vel_2))
-
- if positive_displacement:
- min_vel = motor.min_vel
- else:
- max_vel = -max_vel
- min_vel = -motor.min_vel
-
- # displacement at maximum velocity
- at_max_vel_displacement = 0.0
-
- delta_vel = abs(max_vel - min_vel)
-
- # time to reach maximum velocity
- if accel == 0 or delta_vel == float('inf'):
- max_vel_time = 0
- else:
- max_vel_time = abs(delta_vel / accel)
-
- # time to reach minimum velocity
- if decel == 0 or delta_vel == float('inf'):
- min_vel_time = 0
- else:
- min_vel_time = abs(delta_vel / decel)
-
- # time at maximum velocity
- if abs(max_vel) == float('inf'):
- at_max_vel_time = 0
- else:
- at_max_vel_time = abs(at_max_vel_displacement / max_vel)
-
- # time the motion will take
- duration = max_vel_time + at_max_vel_time + min_vel_time
-
- self.initial_pos = initial_pos
- self.final_pos = final_pos
- self.displacement = displacement
-
- self.positive_displacement = positive_displacement
- self.small_motion = small_motion
-
- self.accel = accel
- self.decel = decel
-
- self.displacement_reach_max_vel = displacement_reach_max_vel
- self.displacement_reach_min_vel = displacement_reach_min_vel
- self.max_vel = abs(max_vel) #velocity must be a positive value
- self.min_vel = abs(min_vel)
- self.max_vel_pos = max_vel_pos
- self.at_max_vel_displacement = at_max_vel_displacement
- self.max_vel_time = max_vel_time
- self.min_vel_time = min_vel_time
- self.at_max_vel_time = at_max_vel_time
- self.duration = duration
-
- def info(self):
- print "Small movement =", self.small_motion
- print "length =", self.displacement
- print "position where maximum velocity will be reached =", self.max_vel_pos
- print "necessary displacement to reach maximum velocity =", self.displacement_reach_max_vel
- print "necessary displacement to stop from maximum velocity =", self.displacement_reach_min_vel
- print "maximum velocity possible =", self.max_vel
- print "time at top velocity =", self.at_max_vel_time
- print "displacement at top velocity =", self.at_max_vel_displacement
- print "time to reach maximum velocity =", self.max_vel_time
- print "time to reach minimum velocity =", self.min_vel_time
- print "time the motion will take =", self.duration
- print ""
- print "For long movements (where top vel is possible), necessary displacement to reach maximum velocity =", self.displacement_reach_max_vel
- print "For long movements (where top vel is possible), necessary displacement to stop from maximum velocity =", self.displacement_reach_min_vel
-
-
-class Motion(object):
- """Active motion description"""
-
- #: instant this motion started
- start_instant = -1
-
- #: instant when maximum velocity should be reached
- max_vel_instant = -1
-
- #: instant when should start decelerating
- min_vel_instant = -1
-
- #: instant the motion will end
- final_instant = -1
-
- def __init__(self, motor, initial_user_pos, final_user_pos, start_instant=None):
- self.motion_path = mp = MotionPath(motor, initial_user_pos, final_user_pos)
- start_instant = start_instant or time.time()
-
- max_vel_instant = start_instant + mp.max_vel_time
- min_vel_instant = max_vel_instant + mp.at_max_vel_time
- final_instant = start_instant + mp.duration
-
- self.start_instant = start_instant
- self.max_vel_instant = max_vel_instant
- self.min_vel_instant = min_vel_instant
- self.final_instant = final_instant
-
- assert(final_instant >= start_instant)
- assert(start_instant <= max_vel_instant)
- assert(final_instant >= min_vel_instant)
-
- if self.motion_path.small_motion:
- assert(max_vel_instant == min_vel_instant)
- else:
- assert(max_vel_instant <= min_vel_instant)
-
- def __getattr__(self, name):
- return getattr(self.motion_path, name)
-
-
-class BaseMotor(object):
-
- # base velocity (<units length>/s)
- min_vel = 0
-
- # top velocity (<units length>/s)
- max_vel = float('+inf')
-
- # acceleration time (s)
- accel_time = 0
-
- # deceleration time (s)
- decel_time = 0
-
- # acceleration (<units length>/s^2)
- accel = float('+inf')
-
- # acceleration (<units length>/s^2)
- decel = float('+inf')
-
- #: steps per unit
- step_per_unit = 1
-
- #: lower limit switch position
- lower_ls = float('-inf')
-
- #: upper limit switch position
- upper_ls = float('+inf')
-
- #: True if motor is powered or False otherwise
- power = True
-
- #: True if motor is enabled or False otherwise
- enabled = True
-
- #: necessary displacement to reach maximum velocity from minimum velocity
- displacement_reach_max_vel = 0
-
- #: necessary displacement to reach minimum velocity from maximum velocity
- displacement_reach_min_vel = 0
-
- #: internal member describing current motion
- current_motion = None
-
- current_position = float('nan')
-
- def __init__(self):
- pass
-
- def setMinVelocity(self, vi):
- pass
-
- def getMinVelocity(self):
- return self.min_vel
-
- def setMaxVelocity(self, vf):
- pass
-
- def getMaxVelocity(self):
- return self.max_vel
-
- def setAccelerationTime(self, at):
- """Sets the time to go from minimum velocity to maximum velocity in seconds"""
- pass
-
- def getAccelerationTime(self):
- return self.accel_time
-
- def setDecelerationTime(self, dt):
- """Sets the time to go from maximum velocity to minimum velocity in seconds"""
- pass
-
- def getDecelerationTime(self):
- return self.decel_time
-
- def setAcceleration(self, a):
- """Sets the acceleration in ms^-2"""
- pass
-
- def setDeceleration(self, d):
- """Sets the deceleration in ms^-2"""
- pass
-
- def getStepPerUnit(self):
- return self.step_per_unit
-
- def setStepPerUnit(self, spu):
- self.step_per_unit = spu
-
- def startMotion(self, initial_user_pos, final_user_pos, start_instant=None):
-
- if not self.power:
- raise Exception("Motor is powered off")
-
- if self.isInMotion():
- raise Exception("Already in motion")
-
- initial_pos = initial_user_pos * self.step_per_unit
- final_pos = final_user_pos * self.step_per_unit
-
- if initial_pos == final_pos:
- return
-
- motion = Motion(self, initial_user_pos, final_user_pos, start_instant)
- motion_path = motion.motion_path
-
- self.current_position = motion.initial_pos
- self.current_motion = motion
-
- def abortMotion(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- if not self.current_motion:
- return self.current_position
-
- self.current_position = self.getCurrentPosition(curr_instant)
- self.current_motion = None
- return self.current_position
-
- def isInMotion(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- #we call getCurrentPosition because inside it updates the current_motion flag
- self.getCurrentPosition(curr_instant)
- return self.current_motion is not None
-
- def setCurrentPosition(self, curr_pos):
- self.current_position = curr_pos
-
- def getCurrentPosition(self, curr_instant=None):
- curr_instant = curr_instant or time.time()
- pos = None
- if self.current_motion:
- motion = self.current_motion
- # if motion should be ended...
- if curr_instant >= motion.final_instant:
- self.current_motion = None
- pos = motion.final_pos
- else:
- pos = motion.initial_pos
- if curr_instant > motion.min_vel_instant:
- if motion.positive_displacement:
- pos += motion.displacement_reach_max_vel
- pos += motion.at_max_vel_displacement
- else:
- pos -= motion.displacement_reach_max_vel
- pos -= motion.at_max_vel_displacement
- dt = curr_instant - motion.min_vel_instant
- pos += motion.max_vel * dt + 0.5 * motion.decel * pow(dt, 2)
- elif curr_instant > motion.max_vel_instant:
- if motion.positive_displacement:
- pos += motion.displacement_reach_max_vel
- else:
- pos -= motion.displacement_reach_max_vel
- dt = curr_instant - motion.max_vel_instant
- pos += motion.max_vel * dt
- else:
- dt = curr_instant - motion.start_instant
- pos += motion.min_vel * dt + 0.5 * motion.accel * pow(dt, 2)
- else:
- pos = self.current_position
- if pos <= self.lower_ls:
- pos = self.lower_ls
- self.current_motion = None
- elif pos >= self.upper_ls:
- pos = self.upper_ls
- self.current_motion = None
- self.current_position = pos
- return pos
-
- def setCurrentUserPosition(self, user_pos):
- self.setCurrentPosition(user_pos * self.step_per_unit)
-
- def getCurrentUserPosition(self, curr_instant=None):
- return self.getCurrentPosition(curr_instant=curr_instant) / self.step_per_unit
-
- def hitLowerLimit(self):
- user_pos = self.current_position / self.step_per_unit
- return user_pos <= self.lower_ls
-
- def hitUpperLimit(self):
- user_pos = self.current_position / self.step_per_unit
- return user_pos >= self.upper_ls
-
- def getLowerLimitSwitch(self):
- return self.lower_ls
-
- def setLowerLimitSwitch(self, user_lower_ls):
- self.lower_ls = user_lower_ls
-
- def getUpperLimitSwitch(self):
- return self.upper_ls
-
- def setUpperLimitSwitch(self, user_upper_ls):
- self.upper_ls = user_upper_ls
-
- def turnOn(self):
- self.power = True
-
- def turnOff(self):
- self.power = False
-
- def isTurnedOn(self):
- return self.power
-
- def hasPower(self):
- return self.power
-
- def setPower(self, power):
- self.power = power
-
- def info(self):
- if self.current_motion is not None:
- print self.current_motion.info()
-
-
-class Motor(BaseMotor):
- """The motor definition"""
-
- def __init__(self, min_vel=None, max_vel=None, accel_time=None, decel_time=None):
- super(Motor, self).__init__()
-
- if min_vel is not None:
- self.setMinVelocity(min_vel)
- if max_vel is not None:
- self.setMaxVelocity(max_vel)
- if accel_time is not None:
- self.setAccelerationTime(accel_time)
- if decel_time is not None:
- self.setDecelerationTime(decel_time)
-
- self.__recalculate_acc_constants()
-
- def setMinVelocity(self, vi):
- """ Sets the minimum velocity in ms^-1. A.k.a. base rate"""
- vi = float(vi)
- if vi < 0:
- raise Exception("Minimum velocity must be >= 0")
-
- self.min_vel = vi
-
- #TODO: consult this solution with others
- if self.max_vel < self.min_vel:
- pass
- #self.max_vel = self.min_vel (original version)
-
- # force recalculation of accelerations
- if self.accel_time >= 0:
- self.setAccelerationTime(self.accel_time)
- if self.decel_time >= 0:
- self.setDecelerationTime(self.decel_time)
-
- def getMinVelocity(self):
- return self.min_vel
-
- def setMaxVelocity(self, vf):
- """ Sets the maximum velocity in ms^-1."""
- vf = float(vf)
- if vf <= 0:
- raise Exception("Maximum velocity must be > 0")
-
- self.max_vel = vf
-
- #TODO: consult this solution with others
- if self.min_vel > self.max_vel:
- pass
- #self.min_vel = self.max_vel #accel set to zero (original version)
- #self.setMinVelocity(0) another solution could be to set it to 0
-
- # force recalculation of accelerations
- if self.accel_time >= 0:
- self.setAccelerationTime(self.accel_time)
- if self.decel_time >= 0:
- self.setDecelerationTime(self.decel_time)
-
- def getMaxVelocity(self):
- return self.max_vel
-
- def setAccelerationTime(self, at):
- """Sets the time to go from minimum velocity to maximum velocity in seconds"""
- at = float(at)
- if at < 0:
- raise Exception("Acceleration time must be >= 0")
-
- self.accel_time = at
- try:
- self.accel = (self.max_vel - self.min_vel) / at
- except ZeroDivisionError:
- self.accel = float('inf')
-
- self.__recalculate_acc_constants()
-
-
- def getAccelerationTime(self):
- return self.accel_time
-
- def setDecelerationTime(self, dt):
- """Sets the time to go from maximum velocity to minimum velocity in seconds"""
- dt = float(dt)
- if dt < 0:
- raise Exception("Deceleration time must be >= 0")
-
- self.decel_time = dt
- try:
- self.decel = (self.min_vel - self.max_vel) / dt
- except ZeroDivisionError:
- self.decel = float('inf')
-
- self.__recalculate_acc_constants()
-
- def getDecelerationTime(self):
- return self.decel_time
-
- def setAcceleration(self, a):
- """Sets the acceleration in ms^-2"""
- a = float(a)
- if a < 0:
- raise Exception("Acceleration must be >= 0")
-
- self.accel = float(a)
-
- if a > 0:
- self.accel_time = (self.max_vel - self.min_vel) / a
- else:
- self.accel_time = float('INF')
-
- self.__recalculate_acc_constants()
-
- def setDeceleration(self, d):
- """Sets the deceleration in ms^-2"""
- d = float(d)
- if d > 0:
- raise Exception("Deceleration must be <= 0")
-
- self.decel = d
-
- if d < 0:
- self.decel_time = (self.min_vel - self.max_vel) / d
- else:
- self.decel_time = float('INF')
-
- self.__recalculate_acc_constants()
-
- def __recalculate_acc_constants(self):
- """precomputations assuming maximum speed can be reached in a motion"""
-
- if self.accel_time == 0:
- self.displacement_reach_max_vel = 0.0
- else:
- self.displacement_reach_max_vel = 0.5 * self.accel * pow(self.accel_time, 2)
- self.displacement_reach_max_vel += self.min_vel * self.accel_time
-
- if self.decel_time == 0:
- self.displacement_reach_min_vel = 0.0
- else:
- self.displacement_reach_min_vel = 0.5 * self.decel * pow(self.decel_time, 2)
- self.displacement_reach_min_vel += self.max_vel * self.decel_time
-
- @staticmethod
- def fromMotor(motor):
- try:
- import sardana.taurus.core.tango.sardana.pool
- if isinstance(motor, sardana.taurus.core.tango.sardana.pool.PoolElement):
- min_vel = motor.getBaseRate()
- max_vel = motor.getVelocity()
- accel_time = motor.getAcceleration()
- decel_time = motor.getDeceleration()
- return Motor(min_vel=min_vel, max_vel=max_vel,
- accel_time=accel_time, decel_time=decel_time)
- except Exception, e :
- print e
- return Motor._fromTangoMotor(motor)
-
- @staticmethod
- def _fromTangoMotor(motor):
- import PyTango
- attrs = "base_rate", "velocity", "acceleration", "deceleration"
- attr_values = motor.read_attributes(attrs)
- v = []
- for attr_value in attr_values:
- if attr_value.has_failed:
- raise PyTango.DevFailed(*attr_value.get_err_stack())
- v.append(attr_value.value)
- return Motor(min_vel=v[0], max_vel=v[1], accel_time=v[2], decel_time=v[3])
-
-
-
-class DemoMotor(Motor):
-
- def __init__(self):
- super(DemoMotor, self).__init__(2, 100, 2, 2)
- self.setCurrentPosition(0)
diff --git a/src/sardana/util/tree.py b/src/sardana/util/tree.py
deleted file mode 100644
index 3fdb33ff..00000000
--- a/src/sardana/util/tree.py
+++ /dev/null
@@ -1,28 +0,0 @@
-class BaseNode:
- """BaseNode, stores reference to data."""
-
- def __init__(self, data):
- self.data = data
-
-class BranchNode(BaseNode):
- """BranchNode, apart of reference to data, stores a list of
- children Nodes."""
- def __init__(self, data):
- BaseNode.__init__(self, data)
- self.children = []
-
- def addChild(self, child):
- self.children.append(child)
-
-class LeafNode(BaseNode):
- """LeafMode, just stores reference to data."""
- def __init__(self, data):
- BaseNode.__init__(self, data)
-
-class Tree:
- """Base tree class, stores reference to root Node object"""
- def __init__(self, root):
- self._root = root
-
- def root(self):
- return self._root \ No newline at end of file
diff --git a/src/sardana/util/wrap.py b/src/sardana/util/wrap.py
deleted file mode 100644
index 0bb1bd68..00000000
--- a/src/sardana/util/wrap.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Sardana
-##
-## http://www.sardana-controls.org/
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Sardana is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Sardana is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Sardana. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-""""""
-
-__all__ = ["wraps", "wrapped", "is_wrapping", "is_wrapped"]
-
-import weakref
-from functools import wraps as _wraps
-
-__WRAPPED = "__wrapped__"
-__WRAPPER = "__wrapper__"
-
-def wraps(wrapped, *args, **kwargs):
- """A wrap decorator which stores in the returned function a reference to
- the wrapped function (in member '__wrapped__')"""
- wrapper = _wraps(wrapped, *args, **kwargs)
- setattr(wrapper, __WRAPPED, weakref.ref(wrapped))
- setattr(wrapped, __WRAPPER, weakref.ref(wrapper))
- return wrapper
-
-def is_wrapping(wrapper):
- """Determines if the given callable is a wrapper for another callable"""
- return hasattr(wrapper, __WRAPPED)
-
-def is_wrapped(wrapped):
- """Determines if the given callable is being wrapped by another callable"""
- return hasattr(wrapped, __WRAPPER)
-
-def wrapped(wrapper, recursive=True):
- """Returns the wrapped function around the given wrapper. If the given
- callable is not "wrapping" any function, the wrapper itself is returned"""
- if is_wrapping(wrapper):
- _wrapped = wrapper.__wrapped__()
- else:
- return wrapper
-
- if recursive:
- return wrapped(_wrapped)
- return _wrapped
-
diff --git a/taurus/taurus.bmp b/taurus.bmp
index bc46819c..bc46819c 100644
--- a/taurus/taurus.bmp
+++ b/taurus.bmp
Binary files differ
diff --git a/taurus/taurus.png b/taurus.png
index 03e8d22d..03e8d22d 100644
--- a/taurus/taurus.png
+++ b/taurus.png
Binary files differ
diff --git a/taurus/taurus.svg b/taurus.svg
index 23c140ea..23c140ea 100644
--- a/taurus/taurus.svg
+++ b/taurus.svg
diff --git a/taurus/.gitignore b/taurus/.gitignore
deleted file mode 100644
index 96b0b415..00000000
--- a/taurus/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-MANIFEST
-/dist
-*.pyc
-*.qrc
-*.rcc
-/build/
-/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_lextab.py
-/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_yacctab.py
-parser.out
-parsetab.py
-/setup.cfg
-doc/~thumbnails.zip
diff --git a/taurus/MANIFEST.in b/taurus/MANIFEST.in
deleted file mode 100644
index d2bdb148..00000000
--- a/taurus/MANIFEST.in
+++ /dev/null
@@ -1,10 +0,0 @@
-graft doc
-graft lib/taurus
-graft scripts
-graft tests
-global-exclude *.pyc .cvsignore .svnignore .ropeproject .gitignore jdraw_lextab.py jdraw_yacctab.py
-recursive-exclude lib/taurus/qt/qtgui/resource *.rcc *.qrc qrc_*.py
-include LICENSE.txt
-include taurus.bmp
-include taurus.png
-include taurus.svg \ No newline at end of file
diff --git a/taurus/doc/source/_static/default.css b/taurus/doc/source/_static/default.css
deleted file mode 100644
index db3b1205..00000000
--- a/taurus/doc/source/_static/default.css
+++ /dev/null
@@ -1,323 +0,0 @@
-/**
- * Sphinx stylesheet -- sphinxdoc theme
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
- */
-
-@import url("basic.css");
-
-/* -- page layout ----------------------------------------------------------- */
-
-body {
- font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
- 'Verdana', sans-serif;
- font-size: 14px;
- letter-spacing: -0.01em;
- line-height: 150%;
- text-align: center;
- background-color: #BFD1D4;
- color: black;
- padding: 0;
- border: 1px solid #aaa;
-
- margin: 0px 40px 0px 40px;
- min-width: 740px;
-}
-
-div.document {
- background-color: white;
- text-align: left;
- background-image: url(contents.png);
- background-repeat: repeat-x;
-}
-
-div.bodywrapper {
- margin: 0 240px 0 0;
- border-right: 1px solid #ccc;
-}
-
-div.body {
- margin: 0;
- padding: 0.5em 20px 20px 20px;
-}
-
-div.related {
- font-size: 12px;
-}
-
-div.related ul {
- background-image: url(navigation.png);
- height: 2em;
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
-}
-
-div.related ul li {
- margin: 0;
- padding: 0;
- height: 2em;
- float: left;
-}
-
-div.related ul li.right {
- float: right;
- margin-right: 5px;
-}
-
-div.related ul li a {
- margin: 0;
- padding: 0 5px 0 5px;
- line-height: 1.75em;
- color: #EE9816;
-}
-
-div.related ul li a:hover {
- color: #3CA8E7;
-}
-
-div.sphinxsidebarwrapper {
- padding: 0;
-}
-
-div.sphinxsidebar {
- margin: 0;
- padding: 0.5em 15px 15px 0;
- width: 210px;
- float: right;
- font-size: 1em;
- text-align: left;
-}
-
-div.sphinxsidebar h3, div.sphinxsidebar h4 {
- margin: 1em 0 0.5em 0;
- font-size: 1em;
- padding: 0.1em 0 0.1em 0.5em;
- color: white;
- border: 1px solid #86989B;
- background-color: #AFC1C4;
-}
-
-div.sphinxsidebar h3 a {
- color: white;
-}
-
-div.sphinxsidebar ul {
- padding-left: 1.5em;
- margin-top: 7px;
- padding: 0;
- line-height: 130%;
-}
-
-div.sphinxsidebar ul ul {
- margin-left: 20px;
-}
-
-div.footer {
- background-color: #E3EFF1;
- color: #86989B;
- padding: 3px 8px 3px 0;
- clear: both;
- font-size: 0.8em;
- text-align: right;
-}
-
-div.footer a {
- color: #86989B;
- text-decoration: underline;
-}
-
-/* -- body styles ----------------------------------------------------------- */
-
-p {
- margin: 0.8em 0 0.5em 0;
-}
-
-a {
- color: #CA7900;
- text-decoration: none;
-}
-
-a:hover {
- color: #2491CF;
-}
-
-div.body a {
- text-decoration: underline;
-}
-
-h1 {
- margin: 0;
- padding: 0.7em 0 0.3em 0;
- font-size: 1.5em;
- color: #11557C;
-}
-
-h2 {
- margin: 1.3em 0 0.2em 0;
- font-size: 1.35em;
- padding: 0;
-}
-
-h3 {
- margin: 1em 0 -0.3em 0;
- font-size: 1.2em;
-}
-
-div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
- color: black!important;
-}
-
-h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
- display: none;
- margin: 0 0 0 0.3em;
- padding: 0 0.2em 0 0.2em;
- color: #aaa!important;
-}
-
-h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
-h5:hover a.anchor, h6:hover a.anchor {
- display: inline;
-}
-
-h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
-h5 a.anchor:hover, h6 a.anchor:hover {
- color: #777;
- background-color: #eee;
-}
-
-a.headerlink {
- color: #c60f0f!important;
- font-size: 1em;
- margin-left: 6px;
- padding: 0 4px 0 4px;
- text-decoration: none!important;
-}
-
-a.headerlink:hover {
- background-color: #ccc;
- color: white!important;
-}
-
-cite, code, tt {
- font-family: 'Consolas', 'Deja Vu Sans Mono',
- 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.01em;
-}
-
-tt {
- background-color: #f2f2f2;
- border-bottom: 1px solid #ddd;
- color: #333;
-}
-
-tt.descname, tt.descclassname, tt.xref {
- border: 0;
-}
-
-hr {
- border: 1px solid #abc;
- margin: 2em;
-}
-
-a tt {
- border: 0;
- color: #CA7900;
-}
-
-a tt:hover {
- color: #2491CF;
-}
-
-pre {
- font-family: 'Consolas', 'Deja Vu Sans Mono',
- 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.015em;
- line-height: 120%;
- padding: 0.5em;
- border: 1px solid #ccc;
- background-color: #f8f8f8;
-}
-
-pre a {
- color: inherit;
- text-decoration: underline;
-}
-
-td.linenos pre {
- padding: 0.5em 0;
-}
-
-div.quotebar {
- background-color: #f8f8f8;
- max-width: 250px;
- float: right;
- padding: 2px 7px;
- border: 1px solid #ccc;
-}
-
-div.topic {
- background-color: #f8f8f8;
-}
-
-table {
- border-collapse: collapse;
- margin: 0 -0.5em 0 -0.5em;
-}
-
-table td, table th {
- padding: 0.2em 0.5em 0.2em 0.5em;
-}
-
-div.admonition, div.warning {
- font-size: 0.9em;
- margin: 1em 0 1em 0;
- border: 1px solid #86989B;
- background-color: #f7f7f7;
- padding: 0;
-}
-
-div.admonition p, div.warning p {
- margin: 0.5em 1em 0.5em 1em;
- padding: 0;
-}
-
-div.admonition pre, div.warning pre {
- margin: 0.4em 1em 0.4em 1em;
-}
-
-div.admonition p.admonition-title,
-div.warning p.admonition-title {
- margin: 0;
- padding: 0.1em 0 0.1em 0.5em;
- color: white;
- border-bottom: 1px solid #86989B;
- font-weight: bold;
- background-color: #AFC1C4;
-}
-
-div.warning {
- border: 1px solid #940000;
-}
-
-div.warning p.admonition-title {
- background-color: #CF0000;
- border-bottom-color: #940000;
-}
-
-div.admonition ul, div.admonition ol,
-div.warning ul, div.warning ol {
- margin: 0.1em 0.5em 0.5em 3em;
- padding: 0;
-}
-
-div.versioninfo {
- margin: 1em 0 0 0;
- border: 1px solid #ccc;
- background-color: #DDEAF0;
- padding: 8px;
- line-height: 1.3em;
- font-size: 0.9em;
-} \ No newline at end of file
diff --git a/taurus/doc/source/_static/logo.png b/taurus/doc/source/_static/logo.png
deleted file mode 100644
index eeab13bb..00000000
--- a/taurus/doc/source/_static/logo.png
+++ /dev/null
Binary files differ
diff --git a/taurus/doc/source/_templates/layout.html b/taurus/doc/source/_templates/layout.html
deleted file mode 100644
index 1eb19403..00000000
--- a/taurus/doc/source/_templates/layout.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{% extends "sphinxdoc/layout.html" %}
-
-{% block rootrellink %}
- <li><a href="http://taurus-scada.org">home</a>|&nbsp;</li>
- <li><a href="http://sourceforge.net/projects/sardana/">project</a>|&nbsp;</li>
- <li><a href="https://pypi.python.org/pypi/taurus">download</a>|&nbsp;</li>
- <li><a href="http://taurus.readthedocs.org">documentation </a> &raquo;</li>
-{% endblock %}
-
-{% block relbar1 %}
-<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
- <table cellpading='0' cellspacing='0' width='100%'>
- <tr>
- <td align='left'>
- <a href="{{ pathto('index') }}">
- <img src="{{ pathto("_static/logo.png", 1) }}" border="0" alt="taurus"/>
- </a>
- </td>
- <td align='right'>
- <img src="{{ pathto("_static/taurus_codelogo01.png", 1) }}" border="0" alt="taurus"/>
- </td>
- </tr>
- </table>
-</div>
-{{ super() }}
-{% endblock %}
-
-
diff --git a/taurus/doc/source/conf.py b/taurus/doc/source/conf.py
deleted file mode 100644
index 1a6f7f1a..00000000
--- a/taurus/doc/source/conf.py
+++ /dev/null
@@ -1,327 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-##############################################################################
-##
-## This file is part of Taurus
-##
-## http://taurus-scada.org
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Taurus is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Taurus is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-import sys, os
-
-
-# declare some useful absolute paths
-_this_dir = os.path.dirname(os.path.abspath(__file__))
-_setup_dir = os.path.abspath(os.path.join(_this_dir, os.path.pardir,
- os.path.pardir))
-_lib_dir = os.path.join(_setup_dir, 'lib')
-_doc_dir = os.path.join(_setup_dir, 'doc')
-_api_dir = os.path.join(_doc_dir, 'source', 'devel', 'api')
-_mock_path = os.path.join(_doc_dir, 'mock.zip')
-
-
-# append mock dir to the sys path (mocks will be used if needed)
-sys.path.append(_mock_path)
-
-# Import code from src distribution
-sys.path.insert(0, os.path.abspath(_lib_dir))
-
-import taurus
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.append(os.path.abspath('sphinxext'))
-
-# -- RTD hack -----------------------------------------------------------------
-# This code is to allow RTD to build the catalog and the api
-# it has no effect on local builds
-
-on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
-if on_rtd:
- # unfortunately, RTD installs sardana instead of taurus
- # and it fails because of the PyTango mocked version
- # fix the PyTango mock so that rtd can install sardana
- import PyTango
- if not isinstance(PyTango.Release.version_info, tuple):
- PyTango.Release.version_info=(999, 99, 9, 'mock', 0)
-
- import imp
-
- def _build_catalog():
- #import setup.py as a module
- name = 'setup'
- data = imp.find_module(name, [_setup_dir])
- setupmod = imp.load_module(name, *data)
- catalog = setupmod.build_catalog()
- #build
- fname = os.path.join(_doc_dir, 'source', 'devel', 'catalog.html')
- catalog.fname = fname
- catalog.builder_target_dir = _this_dir
- catalog.thumbnails_source = os.path.join(_doc_dir, 'thumbnails.zip')
- catalog.verbose = True
- catalog.out = sys.stdout
- catalog.run()
-
- def _build_doc_api():
- #import auto_rst4api from the doc dir
- name = 'auto_rst4api'
- data = imp.find_module(name, [_doc_dir])
- auto_rst4api = imp.load_module(name, *data)
- API_Creator = auto_rst4api.Auto_rst4API_Creator
- # prepare api creator
- excl = ['_[^\.]*[^_]', '.*.extra_sardana', '.*.extra_pool',
- '.*.extra_macroexecutor', 'taurus.external']
- rstCreator = API_Creator(exclude_patterns=excl,
- templatespath=_doc_dir,
- overwrite_old=True,
- verbose=True)
- # clean previously existing rst files
- rstCreator.cleanAutogenerated(_api_dir)
- # generate api
- import taurus
- r = rstCreator.documentModule('taurus', _api_dir)
- # report
- print("Auto Creation of API docs Finished with %i warnings:" % len(r))
- for i in r:
- print(i)
-
- #build the api and the catalog
- _build_catalog()
- _build_doc_api()
-
-# ------------------------------------------------------------------------------
-
-
-# -- General configuration -----------------------------------------------------
-
-#autosummary_generate = True
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.pngmath',
- 'sphinx.ext.autosummary',
- 'sphinx.ext.autodoc',
- 'sphinx.ext.doctest',
- 'sphinx.ext.graphviz',
- 'sphinx.ext.inheritance_diagram',
- 'sphinx.ext.intersphinx',
- 'sphinx.ext.todo',
- 'sphinx.ext.viewcode',
- 'taurusextension']
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'taurus'
-copyright = u'2011, ALBA - CELLS, Creative Commons Attribution-Share Alike 3.0'
-copyright = u"""Except where otherwise noted, content on this site is
-licensed under a Creative Commons Attribution 3.0 License"""
-
-#Ideally we would like to put the following html code for copyright... but how?
-'''<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/es/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/es/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Taurus Documentation</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">CELLS - ALBA</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/es/">Creative Commons Attribution-Share Alike 3.0 Spain License</a>.'''
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '.'.join(taurus.Release.version.split('.')[:2])
-# The full version, including alpha/beta/rc tags.
-release = taurus.Release.version
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-#unused_docs = []
-
-# List of directories, relative to source directory, that shouldn't be searched
-# for source files.
-exclude_trees = []
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-add_module_names = False
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. Major themes that come with
-# Sphinx are currently 'default' and 'sphinxdoc'.
-#html_theme = 'default'
-html_theme = 'default'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = []
-#html_theme_path = ['themes']
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_use_modindex = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'taurusdoc'
-
-
-# -- Options for LaTeX output --------------------------------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
- ('index', 'taurus.tex', u'taurus Documentation',
- u'taurus team', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_use_modindex = True
-
-todo_include_todos = True
-
-# -- Options for Graphviz -----------------------------------------------------
-
-inheritance_node_attrs = dict(shape='box', fontcolor='black',
- height=0.5,
- color='dodgerblue1', style='rounded')
-
-inheritance_graph_attrs = dict(rankdir="UD", ratio='compress')
-
-#inheritance_graph_attrs = dict(rankdir="LR", size='"6.0, 8.0"',
-# fontsize=14, ratio='compress')
-
-# -- Options for reference to other documentation ------------------------------
-
-intersphinx_mapping = {
- 'http://docs.python.org/dev': None,
- 'http://docs.scipy.org/doc/scipy/reference' : None,
- 'http://docs.scipy.org/doc/numpy' : None,
- 'http://www.esrf.fr/computing/cs/tango/tango_doc/kernel_doc/pytango/latest/': None,
- 'http://pyqt.sourceforge.net/Docs/PyQt4/' : None,
-}
-
diff --git a/taurus/doc/source/devel/index.rst b/taurus/doc/source/devel/index.rst
deleted file mode 100644
index e22109f1..00000000
--- a/taurus/doc/source/devel/index.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-.. _developers-guide-index:
-
-=================
-Developer's Guide
-=================
-
-.. toctree::
- :maxdepth: 2
-
- tau to taurus migration guide <tau2taurus_migration_guide>
- Development guidelines <coding_guide>
- Color guide <color_guide>
- Icon guide <icon_guide>
- Designer tutorial <designer_tutorial>
- Core tutorial <core_tutorial>
- Widget tutorial <widget_tutorial>
- Popup menu tutorial <popupmenu_tutorial>
- API <api/taurus>
- All Classes <api/taurus_AllClasses.rst>
- Examples <examples>
- \ No newline at end of file
diff --git a/taurus/doc/source/docs.rst b/taurus/doc/source/docs.rst
deleted file mode 100644
index ad00e5b2..00000000
--- a/taurus/doc/source/docs.rst
+++ /dev/null
@@ -1,22 +0,0 @@
-
-.. currentmodule:: taurus
-
-.. _docs:
-
-====================
-Taurus documentation
-====================
-Taurus is a free, open source, multi-platform pure Python module for creating
-and supporting Graphical User Interfaces for experiment control and data
-acquisition.
-
-.. toctree::
- :maxdepth: 2
-
- users/index.rst
- devel/index.rst
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
diff --git a/taurus/doc/source/index.rst b/taurus/doc/source/index.rst
deleted file mode 100644
index 3621b97a..00000000
--- a/taurus/doc/source/index.rst
+++ /dev/null
@@ -1,68 +0,0 @@
-
-Welcome to Taurus's Home Page!
-=============================================
-
- |image1| |image2| |image3|
-
-
-
-Taurus is a python framework for control and data acquisition CLIs and GUIs
-in scientific/industrial environments.
-It supports multiple control systems or data sources: Tango_, EPICS_, spec...
-New control system libraries can be integrated through plugins.
-
-For non-programmers: Taurus allows the creation of fully-featured GUI (with
-forms, plots, synoptics, etc) from scratch in a few minutes using a "wizard",
-which can also be customized and expanded by drag-and-dropping elements
-around at execution time.
-
-For programmers: Taurus gives full control to more advanced users to create
-and customize CLIs and GUIs programmatically using Python and a very simple
-and economical API which abstracts data sources as "models".
-
-Of course, Taurus is Free Software (under LGPL). You can download it from PyPi_,
-access its Documentation_ or get support from its community and the latest code
-from the `project page <http://sourceforge.net/projects/sardana>`_.
-
-Projects related to Taurus
----------------------------
-
-- Taurus uses PyQt_ for the GUIs (Pyside_ support planned)
-- Tango_ is supported vis PyTango_
-- Taurus is part of the Sardana_ suite
-
-
-.. |image1| image:: _static/taurusform_example02.png
- :align: middle
- :height: 180
-
-.. |image2| image:: _static/taurusplot03.png
- :align: middle
- :height: 180
-
-.. |image3| image:: _static/taurus_tree01.png
- :align: middle
- :height: 180
-
-
-.. toctree::
- :hidden:
-
- Home Page <http://taurus-scada.org>
- Project Page <http://sourceforge.net/projects/sardana>
- Download from PyPI <http://pypi.python.org/pypi/taurus>
- docs
-
-:Last Update: |today|
-
-
-.. _Tango: http://www.tango-controls.org/
-.. _PyTango: http://packages.python.org/PyTango/
-.. _EPICS: http://www.aps.anl.gov/epics/
-.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/
-.. _Sardana: http://sardana-controls.org
-.. _PySide: http://pyside.org
-.. _LGPL: http://www.gnu.org/licenses/lgpl.html
-.. _PyPi: http://pypi.python.org/pypi/taurus
-.. _Documentation: http://taurus.readthedocs.org
-
diff --git a/taurus/doc/source/users/index.rst b/taurus/doc/source/users/index.rst
deleted file mode 100644
index ada2cee2..00000000
--- a/taurus/doc/source/users/index.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-.. _users-guide-index:
-
-============
-User's Guide
-============
-
-.. toctree::
- :maxdepth: 3
-
- Introduction <introduction>
- Getting started <getting_started>
- User's Interface <ui/index>
- Screenshots <screenshots>
-
diff --git a/taurus/doc/source/users/screenshots.rst b/taurus/doc/source/users/screenshots.rst
deleted file mode 100644
index f0291f44..00000000
--- a/taurus/doc/source/users/screenshots.rst
+++ /dev/null
@@ -1,56 +0,0 @@
-
-.. highlight:: python
- :linenothreshold: 4
-
-.. _screenshots:
-
-===========
-Screenshots
-===========
-
-Here you will find a host of example figures.
-
-.. figure:: /_static/label01.png
- :align: center
-
- Display attribute value
-
-.. figure:: /_static/label02.png
- :align: center
-
- Display attribute value with label
-
-.. figure:: /_static/label03.png
- :align: center
-
- Display attribute value with label & unit
-
-.. figure:: /_static/edit01.png
- :align: center
-
- Interactively display attribute
-
-.. figure:: /_static/edit02.png
- :align: center
-
- Interactively display attribute with spinbox
-
-.. figure:: /_static/edit03.png
- :align: center
-
- Interactively display attribute with wheel
-
-.. figure:: /_static/taurusvalue01.png
- :align: center
-
- The standard attribute display widget
-
-.. figure:: /_static/forms01.png
- :align: center
-
- Using forms
-
-.. figure:: /_static/forms02.png
- :align: center
-
- Customized form \ No newline at end of file
diff --git a/taurus/makedist.sh b/taurus/makedist.sh
deleted file mode 100755
index df4f9615..00000000
--- a/taurus/makedist.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-#############################################################################
-## This file is part of Taurus, a Tango User Interface Library
-##
-## http://www.tango-controls.org/static/taurus/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Taurus is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Taurus is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
-##
-#############################################################################
-
-# Note: this is a helper script for creating the distribution packages
-# It is meant for internal taurus distribution managers use so do not expect
-# in an arbitrary system (i.e. do not cry about bugs in this script)
-
-#Create distribution packages
-rm -rf build
-#create windows installable
-python setup.py bdist_wininst --plat-name win install --no-doc install_scripts --wrappers --ignore-shebang build --no-doc
-#create source tarball (without docs)
-rm -rf build
-python setup.py sdist
diff --git a/taurus/setup.py b/taurus/setup.py
deleted file mode 100644
index fd6958bd..00000000
--- a/taurus/setup.py
+++ /dev/null
@@ -1,1090 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-##
-## This file is part of Taurus
-##
-## http://taurus-scada.org
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## Taurus is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Taurus is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
-##
-##############################################################################
-
-from __future__ import print_function
-
-import os
-import sys
-import copy
-import shutil
-import imp
-import StringIO
-
-from distutils import log
-from distutils.core import setup, Command
-from distutils.command.build import build as dftbuild
-from distutils.command.install import install as dftinstall
-from distutils.command.install_lib import install_lib as dftinstall_lib
-from distutils.command.install_scripts import install_scripts as dftinstall_scripts
-
-try:
- import sphinx
- import sphinx.util.console
- sphinx.util.console.color_terminal = lambda : False
-except:
- sphinx = None
-
-def abspath(*path):
- """A method to determine absolute path for a given relative path to the
- directory where this setup.py script is located"""
- setup_dir = os.path.dirname(os.path.abspath(__file__))
- return os.path.join(setup_dir, *path)
-
-def get_release_info():
- name = "release"
- release_dir = abspath('lib', 'taurus', 'core')
- data = imp.find_module(name, [release_dir])
- release = imp.load_module(name, *data)
- return release
-
-Release = get_release_info()
-
-author = Release.authors['Tiago']
-maintainer = Release.authors['Pascual-Izarra']
-
-package_dir = { 'taurus' : abspath('lib', 'taurus') }
-
-packages = [
- 'taurus',
- 'taurus.test',
-
- 'taurus.external',
- 'taurus.external.argparse',
- 'taurus.external.enum',
- 'taurus.external.ordereddict',
- 'taurus.external.pint',
- 'taurus.external.qt',
- 'taurus.external.unittest',
- 'taurus.external.test',
-
- 'taurus.core',
- 'taurus.core.util',
- 'taurus.core.util.argparse',
- 'taurus.core.util.decorator',
- 'taurus.core.util.report',
- 'taurus.core.utils', # old, deprecated: maintain for compatibility
-
- 'taurus.core.resource',
-
- 'taurus.core.simulation',
-
- 'taurus.core.evaluation',
-
- 'taurus.core.tango',
- 'taurus.core.tango.img',
-
- 'taurus.console',
- 'taurus.console.util',
-
- 'taurus.qt',
-
- 'taurus.qt.qtcore',
- 'taurus.qt.qtcore.communication',
- 'taurus.qt.qtcore.configuration',
- 'taurus.qt.qtcore.mimetypes',
- 'taurus.qt.qtcore.model',
- 'taurus.qt.qtcore.tango',
-
- 'taurus.qt.qtcore.util',
-
- 'taurus.qt.qtdesigner',
- 'taurus.qt.qtdesigner.taurusplugin',
-
- 'taurus.qt.qtgui',
- 'taurus.qt.qtgui.test',
- 'taurus.qt.qtgui.application',
- 'taurus.qt.qtgui.base',
- 'taurus.qt.qtgui.button',
- 'taurus.qt.qtgui.button.test',
- 'taurus.qt.qtgui.button.test.res',
- 'taurus.qt.qtgui.compact',
-# 'taurus.qt.qtgui.console',
- 'taurus.qt.qtgui.container',
- 'taurus.qt.qtgui.dialog',
- 'taurus.qt.qtgui.display',
- 'taurus.qt.qtgui.display.test',
- 'taurus.qt.qtgui.display.demo',
- 'taurus.qt.qtgui.editor',
- 'taurus.qt.qtgui.gauge',
- 'taurus.qt.qtgui.gauge.demo',
- 'taurus.qt.qtgui.graphic',
- 'taurus.qt.qtgui.graphic.jdraw',
- 'taurus.qt.qtgui.graphic.jdraw.test.res',
- 'taurus.qt.qtgui.help',
- 'taurus.qt.qtgui.image',
- 'taurus.qt.qtgui.input',
- 'taurus.qt.qtgui.model',
- 'taurus.qt.qtgui.panel',
- 'taurus.qt.qtgui.panel.test',
- 'taurus.qt.qtgui.panel.report',
- 'taurus.qt.qtgui.plot',
- 'taurus.qt.qtgui.resource',
-# 'taurus.qt.qtgui.shell',
- 'taurus.qt.qtgui.style',
- 'taurus.qt.qtgui.table',
- 'taurus.qt.qtgui.taurusgui',
- 'taurus.qt.qtgui.taurusgui.conf',
- 'taurus.qt.qtgui.tree',
- 'taurus.qt.qtgui.ui',
- 'taurus.qt.qtgui.util',
- 'taurus.qt.qtgui.util.test',
- 'taurus.qt.qtgui.util.test.test_ui',
- 'taurus.qt.uic',
-]
-
-extra_packages = [
- 'taurus.qt.qtgui.extra_nexus',
- 'taurus.qt.qtgui.extra_xterm',
- 'taurus.qt.qtgui.extra_guiqwt',
-
- 'taurus.qt.qtgui.taurusgui.conf.tgconf_example01',
- 'taurus.qt.qtgui.taurusgui.conf.tgconf_macrogui',
-
- #For backwards compat. They may be removed later on:
- 'taurus.qt.qtgui.extra_macroexecutor',
- 'taurus.qt.qtgui.extra_sardana',
- 'taurus.qt.qtgui.extra_pool',
-]
-
-provides = [
- 'taurus',
- 'taurus.core',
- 'taurus.qt',
-]
-
-requires = [
- 'numpy (>=1.1)',
- 'PyTango (>=7.1)',
- 'PyQt4 (>=4.4)',
- 'PyQt4.Qwt5 (>=5.2.0)', # plotting
- 'ply (>=2.3)', # jdraw parser
- 'lxml (>=2.1)', # tau2taurus, taurusuic4
- 'spyder (>=2.2)', # shell, editor
-]
-
-package_data = {
- 'taurus.core.epics' : ['__taurus_plugin__'],
- 'taurus.core.evaluation' : ['__taurus_plugin__'],
- 'taurus.core.resource' : ['__taurus_plugin__'],
- 'taurus.core.simulation' : ['__taurus_plugin__'],
- 'taurus.core.tango' : ['__taurus_plugin__'],
-
- 'taurus.qt.qtgui.resource' : ['*.rcc'],
- 'taurus.qt.qtgui.util' : ['tauruswidget_template',
- 'tauruswidget_qtdesignerplugin_template'],
- 'taurus.qt.uic' : ['pyuic4/*'],
- 'taurus.qt.qtgui.taurusgui.conf.tgconf_example01' : ['images/*'],
- 'taurus.qt.qtgui.button.test' : ['res/*'],
- 'taurus.qt.qtgui.graphic.jdraw.test' : ['res/*'],
-
- 'taurus.qt.qtgui.help': ['ui/*.ui'],
- 'taurus.qt.qtgui.panel.report': ['ui/*.ui'],
- 'taurus.qt.qtgui.panel': ['ui/*.ui'],
- 'taurus.qt.qtgui.plot': ['ui/*.ui'],
- 'taurus.qt.qtgui.taurusgui': ['ui/*.ui'],
- 'taurus.qt.qtgui.extra_guiqwt': ['ui/*.ui'],
- 'taurus.qt.qtgui.util.test.test_ui' : ['ui/*.ui', 'ui/mywidget2/*.ui'],
-}
-
-
-# The files listed here will be made executable when installed.
-# The file names are relative to the dir containing setup.py
-# Note: They must also be listed in packages or package_data
-executable_data = [
- 'taurus/qt/qtgui/button/test/res/Timeout',
-]
-
-# check if local implementations of enum and pint are here (debian removes them
-# before running setup to avoid license issues)
-if os.path.isdir(abspath('lib', 'taurus', 'external', 'enum', 'enum')):
- packages.append('taurus.external.enum.enum')
-if os.path.isdir(abspath('lib', 'taurus', 'external', 'pint', 'pint')):
- packages.append('taurus.external.pint.pint')
- package_data['taurus.external.pint.pint'] = ['*.txt']
-
-
-def get_script_files():
- scripts_dir = abspath('scripts')
- scripts = []
- for item in os.listdir(scripts_dir):
- # avoid hidden files
- if item.startswith("."):
- continue
- abs_item = os.path.join(scripts_dir, item)
- # avoid non files
- if not os.path.isfile(abs_item):
- continue
- # avoid files that have any extension
- if len(os.path.splitext(abs_item)[1]) > 0:
- continue
- scripts.append('scripts/' + item)
- return scripts
-
-scripts = get_script_files()
-
-data_files = [
-]
-
-classifiers = [
- 'Development Status :: 3 - Alpha',
- 'Environment :: Console',
- 'Environment :: X11 Applications :: Qt',
- 'Environment :: Win32 (MS Windows)',
- 'Intended Audience :: Developers',
- 'Intended Audience :: Science/Research',
- 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
- 'Operating System :: Microsoft :: Windows',
- 'Operating System :: POSIX',
- 'Operating System :: POSIX :: Linux',
- 'Operating System :: Unix',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Topic :: Scientific/Engineering',
- 'Topic :: Software Development :: Libraries',
- 'Topic :: Software Development :: User Interfaces',
- 'Topic :: Software Development :: Widget Sets',
-]
-
-
-class build_resources(Command):
-
- description = "\"build\" Qt resource files"
- user_options = [('logo=', None, "alternative logo file (default is taurus.png)")]
- AllowedExt = ('svg', 'png', 'jpg', 'jpeg', 'gif')
-
- def initialize_options (self):
- self.resource_dir = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource')
- self.taurus = os.path.join(self.resource_dir, 'taurus.png')
- self.logo = None #os.path.join(self.resource_dir,'taurus.png')
- if self.distribution.verbose:
- self.out = sys.stdout
- else:
- self.out = StringIO.StringIO()
-
- def finalize_options (self):
- if self.logo is None:
- build = self.get_finalized_command('build')
- if build:
- self.logo = build.logo
- if self.logo is None:
- self.logo = self.taurus
- if not os.path.isabs(self.logo):
- self.logo = os.path.abspath(self.logo)
- self.logo = os.path.realpath(self.logo)
-
- if os.name == 'nt':
- try:
- self.QTDIR = os.environ["QTDIR"]
- self.rcc_exec = self.rcc_exec = os.path.join(self.QTDIR, 'bin', 'rcc')
- except KeyError:
- msg = "Cannot find QT installation. " \
- "You should set the env. variable QTDIR " \
- "pointing to the Qt C++ installation directory"
- if build.with_tango_icons:
- msg += ". Skipping creation of rcc files"
- print (msg, file=self.out, end='')
- self.rcc_exec = None
- else:
- msg += " or allow skipping creation of the rcc files by " \
- "passing --with-tango-icons parameter to the build command"
- raise Exception(msg)
- else:
- self.rcc_exec = 'rcc'
-
- def run(self):
- orig_dir = os.path.abspath(os.curdir)
- os.chdir(self.resource_dir)
- try:
- cur_dir = os.path.abspath(os.curdir)
-
- result = self._build_general_res()
- result2 = self._build_res(cur_dir)
-
- result[0].extend(result2[0])
- result[1].extend(result2[1])
- finally:
- os.chdir(orig_dir)
-
- def _build_general_res(self):
- qrc_filename = 'general.qrc'
- rcc_filename = 'qrc_general.rcc'
- out = self.out
- print("Generating %s... " % qrc_filename, file=out, end='')
- out.flush()
- f = file(qrc_filename, 'w')
- try:
- logo_relpath = os.path.relpath(self.logo)
- taurus_relpath = os.path.relpath(self.taurus)
- f.write('<RCC>\n <qresource>\n')
- f.write(' <file alias="logo.png">%s</file>\n' % logo_relpath)
- f.write(' <file alias="taurus.png">%s</file>\n' % taurus_relpath)
- f.write(' </qresource>\n')
- f.write('</RCC>\n')
- except Exception, e:
- print("[FAILED]\nDescription:\n%s" % str(e), file=out)
- raise e
- finally:
- f.close()
- print("[DONE]", file=out)
-
- # Generate binary rcc file
-
- if self.rcc_exec:
- print("Generating %s... " % rcc_filename, file=out, end='')
- out.flush()
- cmd = '%s -binary %s -o %s' % (self.rcc_exec, qrc_filename, rcc_filename)
- if os.system(cmd):
- print("[FAILED]", file=out)
- else:
- print("[DONE]", file=out)
-
- return [ [qrc_filename], [rcc_filename]]
-
- def _build_res(self, abs_dir, bases=list()):
- """Builds the resources in the abs_dir recursively.
- The result is a list of 2 items:
- - a list of generated qrc files
- - a list of generated rcc files
- """
- result = [[], []]
- res_name = os.path.basename(abs_dir)
- local_elems, local_bases = [], copy.copy(bases)
- local_bases.append(res_name)
- out = self.out
- for elem in os.listdir(abs_dir):
- if elem.startswith('.'): continue
- abs_elem = os.path.abspath(os.path.join(abs_dir, elem))
- if os.path.isdir(abs_elem):
- ret = self._build_res(abs_elem, local_bases)
- result[0].extend(ret[0])
- result[1].extend(ret[1])
- elif os.path.splitext(abs_elem)[1][1:].lower() in build_resources.AllowedExt:
- local_elems.append(elem)
-
- if local_elems and local_bases[1:]:
- base_dir = os.path.join(*local_bases[1:])
- base_filename = "_".join(local_bases[1:])
- base_filename = base_filename.replace('-', '_')
- qrc_filename = base_filename + ".qrc"
- rcc_filename = 'qrc_' + base_filename + ".rcc"
-
- # Generate qrc file
- print("Generating %s... " % qrc_filename, file=out, end='')
- out.flush()
- f = file(qrc_filename, 'w')
- try:
- qres_prefix = ""
- if len(local_bases) > 2:
- qres_prefix = "/" + "/".join(local_bases[2:])
- f.write('<RCC>\n <qresource prefix="%s">\n' % qres_prefix)
- else:
- f.write('<RCC>\n <qresource>\n')
- qres_prefix = ":" + qres_prefix
- qres_prefix += "/"
- for elem in local_elems:
- rel_elem = os.path.join(base_dir, elem)
- f.write(' <file alias="%s">%s</file>\n' % (elem, rel_elem))
- f.write(' </qresource>\n</RCC>')
- except Exception, e:
- print("[FAILED]\nDescription:\n%s" % str(e), file=out)
- raise e
- finally:
- f.close()
- result[0].append(qrc_filename)
- print("[DONE]", file=out)
-
- # Generate binary rcc file
- if self.rcc_exec:
- print("Generating %s... " % rcc_filename, file=out, end='')
- out.flush()
- cmd = '%s -binary %s -o %s' % (self.rcc_exec, qrc_filename, rcc_filename)
- if os.system(cmd):
- print("[FAILED]", file=out)
- else:
- result[1].append(rcc_filename)
- print("[DONE]", file=out)
-
- return result
-
-
-class build(dftbuild):
-
- user_options = dftbuild.user_options + \
- [('logo=', None, "alternative logo file (default is taurus.png)"),
- ('with-extra-widgets', None, "distribute extra widgets"),
- ('no-doc', None, "do not build documentation"),
- ('with-tango-icons', None, "add Tango icons too (not just *.rcc files)")]
-
- boolean_options = dftbuild.boolean_options + ['with-extra-widgets', 'no-doc']
-
- def initialize_options (self):
- dftbuild.initialize_options(self)
- self.logo = None
- self.doc_fmt = None
- self.no_doc = None
- self.with_tango_icons = None
- self.with_extra_widgets = True
-
- def finalize_options (self):
- dftbuild.finalize_options(self)
- if self.logo is None:
- self.logo = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource', 'taurus.png')
-
- def run(self):
- self.build_package_data()
- self.build_jdraw()
- dftbuild.run(self)
-
- def build_package_data(self):
- packages = self.distribution.packages
- package_data = self.distribution.package_data
- if self.with_extra_widgets:
- packages.extend(extra_packages)
- resource_package_data = self.get_extra_resource_package_data()
- package_data['taurus.qt.qtgui.resource'].extend(resource_package_data)
-
- def build_jdraw(self):
- print("Building jdraw grammar...", end='')
- taurus_dir = abspath('lib')
- sys.path.insert(0, taurus_dir)
- try:
- from taurus.qt.qtgui.graphic.jdraw import jdraw_parser
- jdraw_parser.new_parser()
- print(" [DONE]")
- except:
- print("[ERROR]")
- finally:
- sys.path.pop(0)
-
- def has_doc(self):
- if self.no_doc:
- return False
- if not sphinx:
- print("Sphinx not available: Documentation will not be build!")
- return False
- return os.path.isdir(abspath('doc'))
-
- def has_resources(self):
- return os.path.isdir(abspath('lib', 'taurus', 'qt', 'qtgui', 'resource'))
-
- def get_extra_resource_package_data(self):
- data = []
- import PyQt4.Qt
- if self.with_tango_icons or not hasattr(PyQt4.Qt.QIcon, "fromTheme"):
- tango_icons_dir = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource',
- 'tango-icons')
- for tango_icon_item in os.listdir(tango_icons_dir):
- if tango_icon_item.startswith("."):
- continue
- abs_item = os.path.join(tango_icons_dir, tango_icon_item)
- if not os.path.isdir(abs_item):
- continue
- data.append('tango-icons/%s/*' % tango_icon_item)
- return data
-
- sub_commands = [('build_resources', has_resources)] + \
- dftbuild.sub_commands + \
- [('build_doc', has_doc)]
-
-
-class install_man(Command):
-
- user_options = [
- ('install-dir=', 'd', 'base directory for installing man page files')]
-
- def initialize_options(self):
- self.install_dir = None
-
- def finalize_options(self):
- self.set_undefined_options('install',
- ('install_man', 'install_dir'))
-
- def run(self):
- src_man_dir = abspath('doc', 'man')
- man_elems = os.listdir(src_man_dir)
- man_pages = []
- for f in man_elems:
- f = os.path.join(src_man_dir, f)
- if not os.path.isfile(f): continue
- if not f.endswith(".1"): continue
- man_pages.append(f)
-
- install_dir = os.path.join(self.install_dir, 'man1')
-
- if not os.path.isdir(install_dir):
- os.makedirs(install_dir)
-
- for man_page in man_pages:
- self.copy_file(man_page, install_dir)
-
-
-class install_html(Command):
-
- user_options = [
- ('install-dir=', 'd', 'base directory for installing HTML documentation files')]
-
- def initialize_options(self):
- self.install_dir = None
-
- def finalize_options(self):
- self.set_undefined_options('install',
- ('install_html', 'install_dir'))
-
- def run(self):
- build_doc = self.get_finalized_command('build_doc')
- src_html_dir = abspath(build_doc.build_dir, 'html')
- self.copy_tree(src_html_dir, self.install_dir)
-
-
-class install_scripts(dftinstall_scripts):
- '''Customization to create .bat wrappers for the scripts
- when installing on windows.
- Adapted from a recipe by Matthew Brett (who licensed it under CC0):
- https://github.com/matthew-brett/myscripter/blob/master/setup.py
- See rationale in:
- http://matthew-brett.github.io/pydagogue/installing_scripts.html
- '''
-
- user_options = list(dftinstall_scripts.user_options)
- user_options.extend(
- [
- ('wrappers', None, 'Install .bat wrappers for windows (enabled by default on windows)'),
- ('ignore-shebang', None, 'Use "python" as the interpreter in .bat wrappers (instead of using the interpreter found in the shebang line of the scripts). Note: this only affects to windows .bat wrappers!'),
- ])
-
-
- BAT_TEMPLATE_SHEBANG = \
-r"""@echo off
-REM wrapper to use shebang first line of {FNAME}
-set mypath=%~dp0
-set pyscript="%mypath%{FNAME}"
-set /p line1=<%pyscript%
-if "%line1:~0,2%" == "#!" (goto :goodstart)
-echo First line of %pyscript% does not start with "#!"
-exit /b 1
-:goodstart
-set py_exe=%line1:~2%
-call %py_exe% %pyscript% %*
-"""
- BAT_TEMPLATE_PATH = \
-r"""@echo off
-REM wrapper to launch {FNAME}
-set mypath=%~dp0
-set pyscript="%mypath%{FNAME}"
-set py_exe="python"
-call %py_exe% %pyscript% %*
-"""
-
- def initialize_options(self):
- self.ignore_shebang = None
- self.wrappers = (os.name == "nt")
- dftinstall_scripts.initialize_options(self)
-
- def run(self):
- dftinstall_scripts.run(self)
- if self.wrappers:
- for filepath in self.get_outputs():
- # If we can find an executable name in the #! top line of the script
- # file, make .bat wrapper for script.
- with open(filepath, 'rt') as fobj:
- first_line = fobj.readline()
- if not (first_line.startswith('#!') and
- 'python' in first_line.lower()):
- print("No #!python executable found, skipping .bat wrapper")
- continue
- pth, fname = os.path.split(filepath)
- froot, ext = os.path.splitext(fname)
- bat_file = os.path.join(pth, froot + '.bat')
- if self.ignore_shebang:
- template = self.BAT_TEMPLATE_PATH
- else:
- template = self.BAT_TEMPLATE_SHEBANG
- bat_contents = template.replace('{FNAME}', fname)
- print("Making %s wrapper for %s" % (bat_file, filepath))
- if self.dry_run:
- continue
- with open(bat_file, 'wt') as fobj:
- fobj.write(bat_contents)
-
-
-class install_lib(dftinstall_lib):
- def run(self):
- dftinstall_lib.run(self)
- # Set the executable bits (owner, group, and world) on
- # all executable_data
- exe_ouput = [os.path.join(self.install_dir,f) for f in executable_data]
- if os.name == 'posix':
- for fn in self.get_outputs():
- if fn in exe_ouput:
- if self.dry_run:
- log.info("changing mode of %s", fn)
- else:
- mode = ((os.stat(fn).st_mode) | 0555) & 07777
- log.info("changing mode of %s to %o", fn, mode)
- os.chmod(fn, mode)
-
-
-class install(dftinstall):
-
- user_options = list(dftinstall.user_options)
- user_options.extend([
- ('install-man=', None, 'installation directory for Unix man pages'),
- ('install-html=', None, "installation directory for HTML documentation"),
- ('no-doc', None, "do not install HTML documentation")])
-
- def initialize_options(self):
- self.install_man = None
- self.install_html = None
- self.no_doc = None
- dftinstall.initialize_options(self)
-
- def finalize_options(self):
-
- # We do a hack here. We cannot trust the 'install_base' value because it
- # is not always the final target. For example, in unix, the install_base
- # is '/usr' and all other install_* are directly relative to it. However,
- # in unix-local (like ubuntu) install_base is still '/usr' but, for
- # example, install_data, is '$install_base/local' which breaks everything.
- #
- # The hack consists in using install_data instead of install_base since
- # install_data seems to be, in practice, the proper install_base on all
- # different systems.
-
- dftinstall.finalize_options(self)
- if os.name != "posix":
- if self.install_man is not None:
- self.warn("install-man option ignored on this platform")
- self.install_man = None
- else:
- if self.install_man is None:
- self.install_man = os.path.join(self.install_data, 'share', 'man')
- if self.install_html is None:
- self.install_html = os.path.join(self.install_data, 'share', 'doc', 'taurus', 'html')
- if self.no_doc is None:
- self.no_doc = False
- self.dump_dirs("Installation directories")
-
- def expand_dirs(self):
- dftinstall.expand_dirs(self)
- self._expand_attrs(['install_man'])
-
- def has_man(self):
- return os.name == "posix"
-
- def has_html(self):
- if self.no_doc:
- return False
- return sphinx is not None
-
- sub_commands = list(dftinstall.sub_commands)
- sub_commands.append(('install_man', has_man))
- sub_commands.append(('install_html', has_html))
-
-
-cmdclass = { 'build' : build,
- 'build_resources' : build_resources,
- 'install' : install,
- 'install_lib': install_lib,
- 'install_man' : install_man,
- 'install_html' : install_html,
- 'install_scripts' : install_scripts}
-
-if sphinx:
- from sphinx.setup_command import BuildDoc
-
- class build_catalog(object):
- '''builds an html catalog of icons. It links to png thumbnails that are
- created in the _static dir
- '''
-
- AllowedExt = build_resources.AllowedExt
-
- HTML_IL = '<tr height="30">' \
- '<td width="30" align="center">' \
- '<img width="24" src="{thumbnail}"' \
- ' alt="{res_relpath}"/></td>' \
- '<td width="400">{qres_prefix}{icon_name}</td>' \
- '<td width="400">{res_relpath}</td>' \
- '<td width="200">{theme}</td></tr>\n'
- HTML_T = '<table border="1" cellspacing="0" cellpadding="2">\n' \
- '<th colspan="4">Resource: "%s" Directory: "%s"</th>\n' \
- '<tr><th>Preview</th><th>Resouce</th><th>File name</th>' \
- '<th>Theme</th></tr>\n'
-
- def run(self):
- self.resource_dir = abspath('lib', 'taurus', 'qt', 'qtgui',
- 'resource')
- pngs_dir = os.path.abspath(os.path.join(self.builder_target_dir,
- '_static',
- 'icon_thumbnails') )
- devel_dir = os.path.abspath(os.path.join(self.builder_target_dir,
- 'devel') )
- self.thumbnails_relpath = os.path.relpath(pngs_dir, devel_dir)
-
- orig_dir = os.path.abspath(os.curdir)
- os.chdir(self.resource_dir)
-
- # create temporary catalog file (to be removed at end of build_doc)
- catalog = file(self.fname, 'w')
- catalog.write("<html><head>\n<title>taurus Icon Catalog</title>\n" \
- "<style>table { border-collapse: collapse; }</style>\n</head>\n<body>\n")
-
- try:
- cur_dir = os.path.abspath(os.curdir)
-
- result = self._build_general_res()
- result2 = self._build_res(cur_dir)
-
- result[0].extend(result2[0])
- result[1].extend(result2[1])
-
- catalog.write("<h1>Index</h1>\n<ul>")
- for anchor in result[1]:
- catalog.write("<li>%s</li>\n" % anchor)
- catalog.write("</ul>\n")
- catalog.writelines(result[0])
- finally:
- catalog.write("""</body></html>""")
- catalog.close()
- os.chdir(orig_dir)
-
- #make thumbnails
- try:
- if self.thumbnails_source == 'wand':
- from wand.image import Image
- def transform(ifname, ofname):
- with Image(filename=ifname) as img:
- img.transform(resize='24x')
- img.save(filename=ofname)
- return True
- return False
- elif self.thumbnails_source == 'qt':
- import PyQt4.Qt
- if PyQt4.Qt.qApp.instance() is None:
- self.app = PyQt4.Qt.QApplication([])
- from PyQt4 import Qt
- def transform(ifname, ofname):
- pixmap = Qt.QPixmap(ifname)
- p = pixmap.scaledToWidth(24, Qt.Qt.SmoothTransformation)
- return p.save(ofname)
- else:
- if not os.path.isabs(self.thumbnails_source):
- m = 'Absolute path required for Thumbnails dir or zip'
- raise ValueError(m)
- shutil.rmtree(pngs_dir, ignore_errors=True)
- if self.thumbnails_source.lower().endswith('.zip'):
- from zipfile import ZipFile
- zfile = ZipFile(self.thumbnails_source)
- zfile.extractall(pngs_dir)
- else:
- shutil.copytree(self.thumbnails_source, pngs_dir)
- def transform(ifname, ofname):
- #just check if the required thumbnail exists
- return os.path.isfile(ofname)
-
- print("\tCreating PNG thumbnails for icon catalog")
- os.path.walk(self.resource_dir, self._make_thumbnails,
- (self.resource_dir, pngs_dir, transform) )
- # create a zipped file for the thumbnails
- fname = abspath('doc', '~thumbnails.zip')
- if os.path.isfile(fname):
- os.remove(fname)
- self._zipdir(pngs_dir, fname)
-
- except ImportError, e:
- print("\tCannot create PNG thumbnails for icon catalog: %s" %
- repr(e))
-
- @staticmethod
- def _make_thumbnails(arg, dirname, fnames):
- '''create thumbnails. To be called by a walker'''
- resource, target, transform = arg
- relpath = os.path.relpath(dirname, start=resource)
- path = os.path.join(target, relpath)
- if not os.path.isdir(path):
- os.makedirs(path)
- for fname in fnames:
- fbase, f_ext = os.path.splitext(fname)
- if f_ext[1:] in build_catalog.AllowedExt:
- full_source_fname = os.path.join(dirname, fname)
- target_fname = fbase + ".png"
- full_target_fname = os.path.join(path, target_fname)
- if not os.path.isfile(full_target_fname):
- ok = transform(full_source_fname, full_target_fname)
- print(ok and "[OK]" or "[FAIL]", full_source_fname,
- '->', full_target_fname)
-
- @staticmethod
- def _zipdir(basedir, archivename):
- '''function to zip the contents of basedir into archivename.
- Adapted from: http://stackoverflow.com/questions/296499
- '''
- from zipfile import ZipFile, ZIP_DEFLATED
- from contextlib import closing
- assert os.path.isdir(basedir)
- with closing(ZipFile(archivename, "w", ZIP_DEFLATED)) as z:
- for root, dirs, files in os.walk(basedir):
- #NOTE: ignore empty directories
- for fn in files:
- absfn = os.path.join(root, fn)
- zfn = absfn[len(basedir)+len(os.sep):]
- z.write(absfn, zfn)
-
- def getThemeIcon(self, resource):
- try:
- import PyQt4.Qt
- if not hasattr(PyQt4.Qt.QIcon, "hasThemeIcon"):
- return "Unknown"
- i = resource.rfind("/")
- if i >= 0: resource = resource[i + 1:]
- i = resource.rfind(".")
- if i >= 0: resource = resource[:i]
- if PyQt4.Qt.QIcon.hasThemeIcon(resource):
- return resource
- return "No"
- except:
- return "Unknown"
-
- def _build_general_res(self):
- out = self.out
- html = '<h2><a name="_base">Base icons</a></h2>\n'
- html += self.HTML_T % (':/', '')
- anchor = '<a href="#_base">Base icons</a>'
- try:
- taurus_relpath = 'taurus.png'
- png_relpath = os.path.join(self.thumbnails_relpath,
- taurus_relpath)
- html += self.HTML_IL.format(thumbnail=png_relpath,
- res_relpath=taurus_relpath,
- qres_prefix=":/",
- icon_name=taurus_relpath,
- theme=self.getThemeIcon("taurus.png")
- )
- except Exception, e:
- print("[FAILED]\nDescription:\n%s" % str(e), file=out)
- import traceback
- traceback.print_exc()
- raise e
- finally:
- html += '</table>\n'
-
- return [ [html], [anchor] ]
-
- def _build_res(self, abs_dir, bases=list()):
- """Builds the resources in the abs_dir recursively.
- The result is a list of 5 items:
- - a list of HTML strings
- - a list of HTML anchors
- """
- result = [[], []]
- res_name = os.path.basename(abs_dir)
- local_elems, local_bases = [], copy.copy(bases)
- local_bases.append(res_name)
- out = self.out
- for elem in os.listdir(abs_dir):
- if elem.startswith('.'): continue
- abs_elem = os.path.abspath(os.path.join(abs_dir, elem))
- if os.path.isdir(abs_elem):
- ret = self._build_res(abs_elem, local_bases)
- result[0].extend(ret[0])
- result[1].extend(ret[1])
- elif os.path.splitext(abs_elem)[1][1:].lower() in build_resources.AllowedExt:
- local_elems.append(elem)
-
- if local_elems and local_bases[1:]:
- base_dir = os.path.join(*local_bases[1:])
- base_filename = "_".join(local_bases[1:])
- base_filename = base_filename.replace('-', '_')
-
- html = ''
- anchor = ''
- try:
- qres_prefix = ""
- if len(local_bases) > 2:
- qres_prefix = "/" + "/".join(local_bases[2:])
- qres_prefix = ":" + qres_prefix
- qres_prefix += "/"
-
- html += '<h2><a name="%s">%s (%s)</a></h2>\n' % (base_dir, qres_prefix, base_dir)
- html += self.HTML_T % (qres_prefix , base_dir)
- anchor = '<a href="#%s">%s (%s)</a>' % (base_dir, base_dir, qres_prefix)
- for elem in local_elems:
- rel_elem = os.path.join(base_dir, elem)
- base_elem, _ = os.path.splitext(rel_elem)
- png_relpath = os.path.join(self.thumbnails_relpath,
- base_elem + ".png")
- html += self.HTML_IL.format(thumbnail=png_relpath,
- res_relpath=rel_elem,
- qres_prefix=qres_prefix,
- icon_name=rel_elem,
- theme=self.getThemeIcon(elem)
- )
- except Exception, e:
- print("[FAILED]\nDescription:\n%s" % str(e), file=out)
- raise e
- finally:
- html += '</table>\n'
- result[0].append(html)
- result[1].append(anchor)
- return result
-
-
- class build_doc(BuildDoc):
- user_options = BuildDoc.user_options + \
- [('thumbnails-source=', None,
- ('Source for catalog thumbnails. Use "qt" for ' +
- 'transforming the icons in the resource dir using ' +
- 'QPixmap (this is the default). Use "wand" to ' +
- 'transform using the wand module. Or provide an ' +
- 'absolute path to either a dir or a zipfile ' +
- 'containing a tree of pre-transformed thumbnails') ),
- ('skip-api', None, 'skip api doc creation'),
- ('skip-catalog', None, 'skip icon catalog creation')
- ]
- boolean_options = BuildDoc.boolean_options + ['skip-api',
- 'skip-catalog'
- ]
-
- def initialize_options (self):
- BuildDoc.initialize_options(self)
- self.thumbnails_source = 'qt'
- self.skip_api = False
- self.skip_catalog = False
-
- def run(self):
- try:
- return self.doit()
- except Exception, e:
- self.warn("Failed to build doc. Reason: %s" % str(e))
-
- def _build_doc_api(self, api_dir, doc_dir):
- if self.skip_api:
- return
-
- #import auto_rst4api from the doc dir
- name = 'auto_rst4api'
- data = imp.find_module(name, [doc_dir])
- auto_rst4api = imp.load_module(name, *data)
- API_Creator = auto_rst4api.Auto_rst4API_Creator
-
- # prepare api creator
- excl = ['_[^\.]*[^_]', '.*.extra_sardana', '.*.extra_pool',
- '.*.extra_macroexecutor', 'taurus.external']
- rstCreator = API_Creator(exclude_patterns=excl,
- templatespath=doc_dir,
- overwrite_old=True,
- verbose=self.distribution.verbose)
- # clean previously existing rst files
- rstCreator.cleanAutogenerated(api_dir)
-
- # generate api
- # IMPORTANT: 'taurus' here is already the one from source, since we went
- # through doc/conf.py already and inserted the lib dir in the
- # path
- import taurus
- r = rstCreator.documentModule('taurus', api_dir)
-
- # report
- print("Auto Creation of API docs Finished with %i warnings:" % len(r))
- for i in r:
- print(i)
-
- def _build_catalog(self, fname):
- if self.skip_catalog:
- return
- catalog = build_catalog()
- catalog.fname = fname
- catalog.builder_target_dir = self.builder_target_dir
- catalog.thumbnails_source = self.thumbnails_source
- catalog.verbose = self.distribution.verbose
- catalog.out = self.out
- catalog.run()
-
- def doit(self):
- if self.distribution.verbose:
- self.out = sys.stdout
- else:
- self.out = StringIO.StringIO()
-
- _catalog_file = abspath('doc', 'source', 'devel', 'catalog.html')
- _api_dir = abspath('doc', 'source', 'devel', 'api')
- _lib_dir = abspath('lib')
- _doc_dir = abspath('doc')
- _mock_path = os.path.join(_doc_dir, 'mock.zip')
- # append mock dir to the sys path (mocks will be used if needed)
- sys.path.append(_mock_path)
- # Import taurus from src distribution
- sys.path.insert(0, os.path.abspath(_lib_dir))
-
- try:
- for cmd_name in self.get_sub_commands():
- self.run_command(cmd_name)
- self._build_doc_api(_api_dir, _doc_dir)
- self._build_catalog(_catalog_file)
- BuildDoc.run(self)
- finally:
- sys.path.pop(0)
- print('Removing temporary api dir: ', _api_dir)
- shutil.rmtree(_api_dir, ignore_errors=True)
- print('Removing temporary catalog file', _catalog_file)
- try:
- os.remove(_catalog_file)
- except:
- pass
-
- cmdclass['build_doc'] = build_doc
-
-
-
-def main():
- setup(name='taurus',
- version=Release.version,
- description=Release.description,
- long_description=Release.long_description,
- author=author[0],
- author_email=author[1],
- maintainer=maintainer[0],
- maintainer_email=maintainer[1],
- url=Release.url,
- download_url=Release.download_url,
- platforms=Release.platforms,
- license=Release.license,
- packages=packages,
- package_dir=package_dir,
- classifiers=classifiers,
- package_data=package_data,
- data_files=data_files,
- scripts=scripts,
- provides=provides,
- keywords=Release.keywords,
- requires=requires,
- cmdclass=cmdclass)
-
-if __name__ == "__main__":
- try:
- main()
- print("Setup finished")
- except Exception as e:
- print("A error occured: %s\n\nSetup aborted" % str(e))
diff --git a/test/HTMLTestRunner.py b/test/HTMLTestRunner.py
deleted file mode 100644
index 16570915..00000000
--- a/test/HTMLTestRunner.py
+++ /dev/null
@@ -1,774 +0,0 @@
-"""
-A TestRunner for use with the Python unit testing framework. It
-generates a HTML report to show the result at a glance.
-
-The simplest way to use this is to invoke its main method. E.g.
-
- from taurus.external import unittest
- import HTMLTestRunner
-
- ... define your tests ...
-
- if __name__ == '__main__':
- HTMLTestRunner.main()
-
-
-For more customization options, instantiates a HTMLTestRunner object.
-HTMLTestRunner is a counterpart to unittest's TextTestRunner. E.g.
-
- # output to a file
- fp = file('my_report.html', 'wb')
- runner = HTMLTestRunner.HTMLTestRunner(
- stream=fp,
- title='My unit test',
- description='This demonstrates the report output by HTMLTestRunner.'
- )
-
- # Use an external stylesheet.
- # See the Template_mixin class for more customizable options
- runner.STYLESHEET_TMPL = '<link rel="stylesheet" href="my_stylesheet.css" type="text/css">'
-
- # run the test
- runner.run(my_test_suite)
-
-
-------------------------------------------------------------------------
-Copyright (c) 2004-2006, Wai Yip Tung
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-* Neither the name Wai Yip Tung nor the names of its contributors may be
- used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""
-
-# URL: http://tungwaiyip.info/software/HTMLTestRunner.html
-
-__author__ = "Wai Yip Tung"
-__version__ = "0.8.1"
-
-
-"""
-Changes in 0.8.1
-* Thank you for Wolfgang Borgert's patch.
-* Validated XHTML.
-* Added description of test classes and test cases.
-
-Changes in 0.8.0
-* Define Template_mixin class for customization.
-* Workaround a IE 6 bug that it does not treat <script> block as CDATA.
-
-Changes in 0.7.1
-* Back port to Python 2.3. Thank you Frank Horowitz.
-* Fix missing scroll bars in detail log. Thank you Podi.
-"""
-
-# TODO: color stderr
-# TODO: simplify javascript using ,ore than 1 class in the class attribute?
-
-import datetime
-import StringIO
-import sys
-import time
-from taurus.external import unittest
-from xml.sax import saxutils
-
-
-# ------------------------------------------------------------------------
-# The redirectors below is used to capture output during testing. Output
-# sent to sys.stdout and sys.stderr are automatically captured. However
-# in some cases sys.stdout is already cached before HTMLTestRunner is
-# invoked (e.g. calling logging.basicConfig). In order to capture those
-# output, use the redirectors for the cached stream.
-#
-# e.g.
-# >>> logging.basicConfig(stream=HTMLTestRunner.stdout_redirector)
-# >>>
-
-class OutputRedirector(object):
- """ Wrapper to redirect stdout or stderr """
- def __init__(self, fp):
- self.fp = fp
-
- def write(self, s):
- self.fp.write(s)
-
- def writelines(self, lines):
- self.fp.writelines(lines)
-
- def flush(self):
- self.fp.flush()
-
-stdout_redirector = OutputRedirector(sys.stdout)
-stderr_redirector = OutputRedirector(sys.stderr)
-
-
-
-# ----------------------------------------------------------------------
-# Template
-
-class Template_mixin(object):
- """
- Define a HTML template for report customerization and generation.
-
- Overall structure of an HTML report
-
- HTML
- +------------------------+
- |<html> |
- | <head> |
- | |
- | STYLESHEET |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | </head> |
- | |
- | <body> |
- | |
- | HEADING |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | REPORT |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | ENDING |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | </body> |
- |</html> |
- +------------------------+
- """
-
- STATUS = {
- 0: 'pass',
- 1: 'fail',
- 2: 'error',
- }
-
- DEFAULT_TITLE = 'Unit Test Report'
- DEFAULT_DESCRIPTION = ''
-
- # ------------------------------------------------------------------------
- # HTML Template
-
- HTML_TMPL = r"""<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>%(title)s</title>
- <meta name="generator" content="%(generator)s"/>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- %(stylesheet)s
-</head>
-<body>
-<script language="javascript" type="text/javascript"><!--
-output_list = Array();
-
-/* level - 0:Summary; 1:Failed; 2:All */
-function showCase(level) {
- trs = document.getElementsByTagName("tr");
- for (var i = 0; i < trs.length; i++) {
- tr = trs[i];
- id = tr.id;
- if (id.substr(0,2) == 'ft') {
- if (level < 1) {
- tr.className = 'hiddenRow';
- }
- else {
- tr.className = '';
- }
- }
- if (id.substr(0,2) == 'pt') {
- if (level > 1) {
- tr.className = '';
- }
- else {
- tr.className = 'hiddenRow';
- }
- }
- }
-}
-
-function showClassDetail(cid, count) {
- var id_list = Array(count);
- var toHide = 1;
- for (var i = 0; i < count; i++) {
- tid0 = 't' + cid.substr(1) + '.' + (i+1);
- tid = 'f' + tid0;
- tr = document.getElementById(tid);
- if (!tr) {
- tid = 'p' + tid0;
- tr = document.getElementById(tid);
- }
- id_list[i] = tid;
- if (tr.className) {
- toHide = 0;
- }
- }
- for (var i = 0; i < count; i++) {
- tid = id_list[i];
- if (toHide) {
- document.getElementById(tid).className = 'hiddenRow';
- }
- else {
- document.getElementById(tid).className = '';
- }
- }
-}
-
-function html_escape(s) {
- s = s.replace(/&/g,'&amp;');
- s = s.replace(/</g,'&lt;');
- s = s.replace(/>/g,'&gt;');
- return s;
-}
-
-function showOutput(id, name) {
- var w = window.open("", //url
- name,
- "resizable,scrollbars,status,width=800,height=450");
- d = w.document;
- d.write("<pre>");
- d.write(html_escape(output_list[id]));
- d.write("\n");
- d.write("<a href='javascript:window.close()'>close</a>\n");
- d.write("</pre>\n");
- d.close();
-}
---></script>
-
-%(heading)s
-%(report)s
-%(ending)s
-
-</body>
-</html>
-"""
- # variables: (title, generator, stylesheet, heading, report, ending)
-
-
- # ------------------------------------------------------------------------
- # Stylesheet
- #
- # alternatively use a <link> for external style sheet, e.g.
- # <link rel="stylesheet" href="$url" type="text/css">
-
- STYLESHEET_TMPL = """
-<style type="text/css" media="screen">
-body { font-family: verdana, arial, helvetica, sans-serif; font-size: 80%; }
-table { font-size: 100%; }
-pre { }
-
-/* -- heading ---------------------------------------------------------------------- */
-h1 {
-}
-.heading {
- margin-top: 0ex;
- margin-bottom: 1ex;
-}
-
-.heading .attribute {
- margin-top: 1ex;
- margin-bottom: 0;
-}
-
-.heading .description {
- margin-top: 4ex;
- margin-bottom: 6ex;
-}
-
-/* -- report ------------------------------------------------------------------------ */
-#show_detail_line {
- margin-top: 3ex;
- margin-bottom: 1ex;
-}
-#result_table {
- width: 80%;
- border-collapse: collapse;
- border: medium solid #777;
-}
-#header_row {
- font-weight: bold;
- color: white;
- background-color: #777;
-}
-#result_table td {
- border: thin solid #777;
- padding: 2px;
-}
-#total_row { font-weight: bold; }
-.passClass { background-color: #6c6; }
-.failClass { background-color: #c60; }
-.errorClass { background-color: #c00; }
-.passCase { color: #6c6; }
-.failCase { color: #c60; font-weight: bold; }
-.errorCase { color: #c00; font-weight: bold; }
-.hiddenRow { display: none; }
-.testcase { margin-left: 2em; }
-
-
-/* -- ending ---------------------------------------------------------------------- */
-#ending {
-}
-
-</style>
-"""
-
-
-
- # ------------------------------------------------------------------------
- # Heading
- #
-
- HEADING_TMPL = """<div class='heading'>
-<h1>%(title)s</h1>
-%(parameters)s
-<p class='description'>%(description)s</p>
-</div>
-
-""" # variables: (title, parameters, description)
-
- HEADING_ATTRIBUTE_TMPL = """<p class='attribute'><strong>%(name)s:</strong> %(value)s</p>
-""" # variables: (name, value)
-
-
-
- # ------------------------------------------------------------------------
- # Report
- #
-
- REPORT_TMPL = """
-<p id='show_detail_line'>Show
-<a href='javascript:showCase(0)'>Summary</a>
-<a href='javascript:showCase(1)'>Failed</a>
-<a href='javascript:showCase(2)'>All</a>
-</p>
-<table id='result_table'>
-<colgroup>
-<col align='left' />
-<col align='right' />
-<col align='right' />
-<col align='right' />
-<col align='right' />
-<col align='right' />
-</colgroup>
-<tr id='header_row'>
- <td>Test Group/Test case</td>
- <td>Count</td>
- <td>Pass</td>
- <td>Fail</td>
- <td>Error</td>
- <td>View</td>
-</tr>
-%(test_list)s
-<tr id='total_row'>
- <td>Total</td>
- <td>%(count)s</td>
- <td>%(Pass)s</td>
- <td>%(fail)s</td>
- <td>%(error)s</td>
- <td>&nbsp;</td>
-</tr>
-</table>
-""" # variables: (test_list, count, Pass, fail, error)
-
- REPORT_CLASS_TMPL = r"""
-<tr class='%(style)s'>
- <td>%(desc)s</td>
- <td>%(count)s</td>
- <td>%(Pass)s</td>
- <td>%(fail)s</td>
- <td>%(error)s</td>
- <td><a href="javascript:showClassDetail('%(cid)s',%(count)s)">Detail</a></td>
-</tr>
-""" # variables: (style, desc, count, Pass, fail, error, cid)
-
-
- REPORT_TEST_WITH_OUTPUT_TMPL = r"""
-<tr id='%(tid)s' class='%(Class)s'>
- <td class='%(style)s'><div class='testcase'>%(desc)s</div></td>
- <td colspan='5' align='center'><a href="javascript:showOutput('%(tid)s', '%(desc)s')">%(status)s</a>%(script)s</td>
-</tr>
-""" # variables: (tid, Class, style, desc, status)
-
-
- REPORT_TEST_NO_OUTPUT_TMPL = r"""
-<tr id='%(tid)s' class='%(Class)s'>
- <td class='%(style)s'><div class='testcase'>%(desc)s</div></td>
- <td colspan='5' align='center'>%(status)s</td>
-</tr>
-""" # variables: (tid, Class, style, desc, status)
-
-
- REPORT_TEST_OUTPUT_TMPL = r"""
-<script language="javascript" type="text/javascript">output_list['%(id)s'] = '%(output)s';</script>
-""" # variables: (id, output)
-
-
-
- # ------------------------------------------------------------------------
- # ENDING
- #
-
- ENDING_TMPL = """<div id='ending'>&nbsp;</div>"""
-
-# -------------------- The end of the Template class -------------------
-
-
-
-def jsEscapeString(s):
- """ Escape s for use as a Javascript String """
- return s.replace('\\','\\\\') \
- .replace('\r', '\\r') \
- .replace('\n', '\\n') \
- .replace('"', '\\"') \
- .replace("'", "\\'") \
- .replace("&", '\\x26') \
- .replace("<", '\\x3C') \
- .replace(">", '\\x3E')
- # Note: non-ascii unicode characters do not need to be encoded
- # Note: previously we encode < as &lt;, etc. However IE6 fail to treat <script> block as CDATA.
-
-
-TestResult = unittest.TestResult
-
-class _TestResult(TestResult):
- # note: _TestResult is a pure representation of results.
- # It lacks the output and reporting ability compares to unittest._TextTestResult.
-
- def __init__(self, verbosity=1):
- TestResult.__init__(self)
- self.stdout0 = None
- self.stderr0 = None
- self.success_count = 0
- self.failure_count = 0
- self.error_count = 0
- self.verbosity = verbosity
-
- # result is a list of result in 4 tuple
- # (
- # result code (0: success; 1: fail; 2: error),
- # TestCase object,
- # Test output (byte string),
- # stack trace,
- # )
- self.result = []
-
-
- def startTest(self, test):
- TestResult.startTest(self, test)
- # just one buffer for both stdout and stderr
- self.outputBuffer = StringIO.StringIO()
- stdout_redirector.fp = self.outputBuffer
- stderr_redirector.fp = self.outputBuffer
- self.stdout0 = sys.stdout
- self.stderr0 = sys.stderr
- sys.stdout = stdout_redirector
- sys.stderr = stderr_redirector
-
-
- def complete_output(self):
- """
- Disconnect output redirection and return buffer.
- Safe to call multiple times.
- """
- if self.stdout0:
- sys.stdout = self.stdout0
- sys.stderr = self.stderr0
- self.stdout0 = None
- self.stderr0 = None
- return self.outputBuffer.getvalue()
-
-
- def stopTest(self, test):
- # Usually one of addSuccess, addError or addFailure would have been called.
- # But there are some path in unittest that would bypass this.
- # We must disconnect stdout in stopTest(), which is guaranteed to be called.
- self.complete_output()
-
-
- def addSuccess(self, test):
- self.success_count += 1
- TestResult.addSuccess(self, test)
- output = self.complete_output()
- self.result.append((0, test, output, ''))
- if self.verbosity > 1:
- sys.stderr.write('ok ')
- sys.stderr.write(str(test))
- sys.stderr.write('\n')
- else:
- sys.stderr.write('.')
-
- def addError(self, test, err):
- self.error_count += 1
- TestResult.addError(self, test, err)
- _, _exc_str = self.errors[-1]
- output = self.complete_output()
- self.result.append((2, test, output, _exc_str))
- if self.verbosity > 1:
- sys.stderr.write('E ')
- sys.stderr.write(str(test))
- sys.stderr.write('\n')
- else:
- sys.stderr.write('E')
-
- def addFailure(self, test, err):
- self.failure_count += 1
- TestResult.addFailure(self, test, err)
- _, _exc_str = self.failures[-1]
- output = self.complete_output()
- self.result.append((1, test, output, _exc_str))
- if self.verbosity > 1:
- sys.stderr.write('F ')
- sys.stderr.write(str(test))
- sys.stderr.write('\n')
- else:
- sys.stderr.write('F')
-
-
-class HTMLTestRunner(Template_mixin):
- """
- """
- def __init__(self, stream=sys.stdout, verbosity=1, title=None, description=None):
- self.stream = stream
- self.verbosity = verbosity
- if title is None:
- self.title = self.DEFAULT_TITLE
- else:
- self.title = title
- if description is None:
- self.description = self.DEFAULT_DESCRIPTION
- else:
- self.description = description
-
- self.startTime = datetime.datetime.now()
-
-
- def run(self, test):
- "Run the given test case or test suite."
- result = _TestResult(self.verbosity)
- test(result)
- self.stopTime = datetime.datetime.now()
- self.generateReport(test, result)
- print >>sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime)
- return result
-
-
- def sortResult(self, result_list):
- # unittest does not seems to run in any particular order.
- # Here at least we want to group them together by class.
- rmap = {}
- classes = []
- for n,t,o,e in result_list:
- cls = t.__class__
- if not rmap.has_key(cls):
- rmap[cls] = []
- classes.append(cls)
- rmap[cls].append((n,t,o,e))
- r = [(cls, rmap[cls]) for cls in classes]
- return r
-
-
- def getReportAttributes(self, result):
- """
- Return report attributes as a list of (name, value).
- Override this to add custom attributes.
- """
- startTime = str(self.startTime)[:19]
- duration = str(self.stopTime - self.startTime)
- status = []
- if result.success_count: status.append('Pass %s' % result.success_count)
- if result.failure_count: status.append('Failure %s' % result.failure_count)
- if result.error_count: status.append('Error %s' % result.error_count )
- if status:
- status = ' '.join(status)
- else:
- status = 'none'
- return [
- ('Start Time', startTime),
- ('Duration', duration),
- ('Status', status),
- ]
-
-
- def generateReport(self, test, result):
- report_attrs = self.getReportAttributes(result)
- generator = 'HTMLTestRunner %s' % __version__
- stylesheet = self._generate_stylesheet()
- heading = self._generate_heading(report_attrs)
- report = self._generate_report(result)
- ending = self._generate_ending()
- output = self.HTML_TMPL % dict(
- title = saxutils.escape(self.title),
- generator = generator,
- stylesheet = stylesheet,
- heading = heading,
- report = report,
- ending = ending,
- )
- self.stream.write(output.encode('utf8'))
-
-
- def _generate_stylesheet(self):
- return self.STYLESHEET_TMPL
-
-
- def _generate_heading(self, report_attrs):
- a_lines = []
- for name, value in report_attrs:
- line = self.HEADING_ATTRIBUTE_TMPL % dict(
- name = saxutils.escape(name),
- value = saxutils.escape(value),
- )
- a_lines.append(line)
- heading = self.HEADING_TMPL % dict(
- title = saxutils.escape(self.title),
- parameters = ''.join(a_lines),
- description = saxutils.escape(self.description),
- )
- return heading
-
-
- def _generate_report(self, result):
- rows = []
- sortedResult = self.sortResult(result.result)
- for cid, (cls, cls_results) in enumerate(sortedResult):
- # subtotal for a class
- np = nf = ne = 0
- for n,t,o,e in cls_results:
- if n == 0: np += 1
- elif n == 1: nf += 1
- else: ne += 1
-
- # format class description
- if cls.__module__ == "__main__":
- name = cls.__name__
- else:
- name = "%s.%s" % (cls.__module__, cls.__name__)
- doc = cls.__doc__ and cls.__doc__.split("\n")[0] or ""
- desc = doc and '%s: %s' % (name, doc) or name
-
- row = self.REPORT_CLASS_TMPL % dict(
- style = ne > 0 and 'errorClass' or nf > 0 and 'failClass' or 'passClass',
- desc = desc,
- count = np+nf+ne,
- Pass = np,
- fail = nf,
- error = ne,
- cid = 'c%s' % (cid+1),
- )
- rows.append(row)
-
- for tid, (n,t,o,e) in enumerate(cls_results):
- self._generate_report_test(rows, cid, tid, n, t, o, e)
-
- report = self.REPORT_TMPL % dict(
- test_list = ''.join(rows),
- count = str(result.success_count+result.failure_count+result.error_count),
- Pass = str(result.success_count),
- fail = str(result.failure_count),
- error = str(result.error_count),
- )
- return report
-
-
- def _generate_report_test(self, rows, cid, tid, n, t, o, e):
- # e.g. 'pt1.1', 'ft1.1', etc
- has_output = bool(o or e)
- tid = (n == 0 and 'p' or 'f') + 't%s.%s' % (cid+1,tid+1)
- name = t.id().split('.')[-1]
- doc = t.shortDescription() or ""
- desc = doc and ('%s: %s' % (name, doc)) or name
- tmpl = has_output and self.REPORT_TEST_WITH_OUTPUT_TMPL or self.REPORT_TEST_NO_OUTPUT_TMPL
-
- # o and e should be byte string because they are collected from stdout and stderr?
- if isinstance(o,str):
- # TODO: some problem with 'string_escape': it escape \n and mess up formating
- # uo = unicode(o.encode('string_escape'))
- uo = o.decode('latin-1')
- else:
- uo = o
- if isinstance(e,str):
- # TODO: some problem with 'string_escape': it escape \n and mess up formating
- # ue = unicode(e.encode('string_escape'))
- ue = e.decode('latin-1')
- else:
- ue = e
-
- script = self.REPORT_TEST_OUTPUT_TMPL % dict(
- id = tid,
- output = jsEscapeString(uo+ue),
- )
-
- row = tmpl % dict(
- tid = tid,
- Class = (n == 0 and 'hiddenRow' or 'none'),
- style = n == 2 and 'errorCase' or (n == 1 and 'failCase' or 'none'),
- desc = desc,
- script = script,
- status = self.STATUS[n],
- )
- rows.append(row)
- if not has_output:
- return
-
- def _generate_ending(self):
- return self.ENDING_TMPL
-
-
-##############################################################################
-# Facilities for running tests from the command line
-##############################################################################
-
-# Note: Reuse unittest.TestProgram to launch test. In the future we may
-# build our own launcher to support more specific command line
-# parameters like test title, CSS, etc.
-class TestProgram(unittest.TestProgram):
- """
- A variation of the unittest.TestProgram. Please refer to the base
- class for command line parameters.
- """
- def runTests(self):
- # Pick HTMLTestRunner as the default test runner.
- # base class's testRunner parameter is not useful because it means
- # we have to instantiate HTMLTestRunner before we know self.verbosity.
- if self.testRunner is None:
- self.testRunner = HTMLTestRunner(verbosity=self.verbosity)
- unittest.TestProgram.runTests(self)
-
-main = TestProgram
-
-##############################################################################
-# Executing this module from the command line
-##############################################################################
-
-if __name__ == "__main__":
- main(module=None)
diff --git a/test/go.py b/test/go.py
deleted file mode 100644
index 95a6b238..00000000
--- a/test/go.py
+++ /dev/null
@@ -1,20 +0,0 @@
-
-import poolunittest
-import pool
-import HTMLTestRunner
-
-def go(test_output):
- test_output_file = file(test_output, 'wb')
- runner = HTMLTestRunner.HTMLTestRunner(
- stream=test_output_file,
- title='Device Pool Unit Test',
- description='Device Pool Unit Test package',
- verbosity=2)
-
- super_suite = poolunittest.PoolTestSuite()
- super_suite.addTest(pool.suite())
- runner.run(super_suite)
-
-if __name__ == "__main__":
- test_output = "test_result.html"
- go(test_output) \ No newline at end of file
diff --git a/test/pool.py b/test/pool.py
deleted file mode 100644
index 4b5d54ce..00000000
--- a/test/pool.py
+++ /dev/null
@@ -1,1022 +0,0 @@
-"""
- Pool Test cases like start, stop and kill the device server, checking for
- emptyness, checking creation of elements with wrong arguments
-"""
-
-import os
-from taurus.external import unittest
-import poolunittest
-import HTMLTestRunner
-import time
-import PyTango
-
-class EmptyPoolTestCase(poolunittest.PoolTestCase):
- """Start, Stop, Kill and check emptyness of Device Pool"""
-
- EmptyStartStopStates = [PyTango.DevState.ON, PyTango.DevState.UNKNOWN]
-
- def setUp(self):
- poolunittest.PoolTestCase.setUp(self)
- self.pool_state_cb = poolunittest.DefaultTangoEventCallBack()
- self.pool_state_cb_id = self.pool_dp.subscribe_event("state",
- PyTango.EventType.CHANGE,
- self.pool_state_cb,[])
-
- def tearDown(self):
- if not self.pool_state_cb_id is None:
- try:
- self.pool_dp.unsubscribe_event(self.pool_state_cb_id)
- self.pool_state_cb_id = None
- except:
- pass
- self.pool_state_cb = None
- poolunittest.PoolTestCase.tearDown(self)
-
- def testStartStopWithKill(self):
- """Start & stop(kill) an empty Device Pool"""
-
- # Pool was started by setUp
-
- self.assertEqual(self.pool_dp.state(), PyTango.DevState.ON)
-
- self.stopPool()
-
- evt_values = self.pool_state_cb.getEventValues()
- self.assertEqual(evt_values, self.EmptyStartStopStates,
- "State Event list(%s) does not match expected" % evt_values)
-
- def testStartStopWithAdminKill(self):
- """Start & stop(admin device kill) an empty Device Pool"""
-
- # Pool was started by setUp
-
- self.assertEqual(self.pool_dp.state(), PyTango.DevState.ON)
-
- self.pool_admin_dp = PyTango.DeviceProxy("dserver/Pool/%s" % self.pool_ds_instance)
-
- self.pool_admin_dp.command_inout("Kill")
-
- self.waitPoolStop()
-
- evt_values = self.pool_state_cb.getEventValues()
- self.assertEqual(evt_values, self.EmptyStartStopStates,
- "State Event list(%s) does not match expected" % evt_values)
-
- def testPing(self):
- """Empty Device Pool ping()"""
-
- ret = self.pool_dp.ping()
- self.assert_(ret > 0, "ping returned %d" % ret)
-
-
- def testLists(self):
- """Empty pool 'XList' attributes"""
- lst_attrs = [ attr.name for attr in self.pool_dp.attribute_list_query_ex()
- if attr.name.endswith('List') and attr.name.find("ControllerClass") == -1 ]
-
- for attr in lst_attrs:
- self.check_empty_attribute(self.pool_dp, attr)
-
-
-class ControllerTestCase(poolunittest.PoolTestCase):
- """Test ControllerClassList, wrong controller creation"""
-
- def testCtrlClasslist(self):
- """ControllerClassList attribute"""
-
- ctrls = self.pool_dp.read_attribute("ControllerClasslist")
-
- v = ctrls.value
-
- len_v = len(v)
-
- self.assertNotEqual(len_v,0,"Controller class list is empty")
-
- self.assert_(len_v>=13,"Insufficient number of Controller classes found." \
- "Found %d. Should have at least 5")
-
- pool_path = self.getPoolPath()
- test_path = pool_path[1]
- cpp_path = pool_path[2]
- py_path = pool_path[3]
-
- ctrl = "Type: Motor - Class: SimuMotorController - File: %s/SimuMotorCtrl.la" % cpp_path
- self.assert_(ctrl in v, "SimuMotor controller not found")
-
- ctrl = "Type: CounterTimer - Class: UnixTimer - File: %s/UxTimerCtrl.la" % cpp_path
- self.assert_(ctrl in v, "Unix Timer controller not found")
-
- ctrl = "Type: CounterTimer - Class: SimuCoTiController - File: %s/SimuCTCtrl.py" % py_path
- self.assert_(ctrl in v, "SimuCoTi controller not found")
-
- ctrl = "Type: ZeroDExpChannel - Class: SimuZeroDController - File: %s/SimuZeroDCtrl.la" % cpp_path
- self.assert_(ctrl in v, "Simu0D controller not found")
-
- ctrl = "Type: PseudoMotor - Class: Slit - File: %s/PseudoMotorLib.py" % py_path
- self.assert_(ctrl in v, "Pseudo Motor controller not found")
-
- ctrl = "Type: Communication - Class: DummyCommunicationController - File: %s/DummyCommunicationController.py" % py_path
- self.assert_(ctrl in v, "DummyCommunication controller not found")
-
- ctrl = "Type: Motor - Class: FirePapController - File: %s/FirePapCtrl.py" % test_path
- self.assert_(ctrl in v, "FirePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl_init.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl_mis_extra.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl_mis_feat.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl_prop.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl_stat1.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: Motor - Class: IcePapController - File: %s/WaterPapCtrl_stat2.py" % test_path
- self.assert_(ctrl in v, "IcePap controller not found")
-
- ctrl = "Type: ZeroDExpChannel - Class: ElecMeterController - File: %s/ElecMeter.py" % test_path
- self.assert_(ctrl in v, "ElecMeter controller not found")
-
- ctrl = "Type: ZeroDExpChannel - Class: ElecMeterController - File: %s/ElecMeter_init.py" % test_path
- self.assert_(ctrl in v, "ElecMeter controller not found")
-
-
-class MotorControllerTestCase(poolunittest.PoolTestCase):
- """Test motor controller creation, deletion, listing"""
-
- def needsMotorSimulator(self):
- return True
-
- def testCreateMotorControllerWrongArguments(self):
- """Create Motor controller with wrong arguments"""
-
- p = self.pool_dp
- self.wrong_argument(self.pool_dp, "CreateController",
- ["a","b","c"], "Pool_WrongArgumentNumber")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["Motor","a/b","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["Motor","a/b.truc","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["Motor","a","b","x"], "Pool_FileUnsupportedType")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Motor","a.py","b","x"], "Pool_ControllerNotFound")
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Motor","a.la","b","x"], "Pool_ControllerNotFound")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Motor","WaterPapCtrl.py","b","x"],
- "Pool_CantLocatePythonClass")
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Motor","WaterPapCtrl_mis.py","IcePapController","x"],
- "Pool_PythonMethodNotFound")
-
- self.wrong_argument(p,"CreateController",
- ["Motor","FirePapCtrl.py","FirePapController","third"],
- "Pool_MissingPropertyValue")
-
- def testCreateDeleteMotorController(self):
- """Create/Delete Motor controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","first_mot_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x,1)
- self.assertEqual(ctrl_list.value[0],
- "first_mot_ctrl (WaterPapCtrl.IcePapController/first_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
-
- p.command_inout("DeleteController","first_mot_ctrl")
- self.check_empty_attribute(p,"ControllerList")
-
- def testDeleteInexistingMotorController(self):
- """Try to delete inexisting motor controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","first_mot_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x,1)
- self.assertEqual(ctrl_list.value[0],
- "first_mot_ctrl (WaterPapCtrl.IcePapController/first_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
-
- self.wrong_argument(p,"DeleteController","Aaaa","Pool_ControllerNotFound")
-
- p.command_inout("DeleteController","first_mot_ctrl")
- self.check_empty_attribute(p,"ControllerList")
-
- def testDeleteMotorControllerWithMotors(self):
- """Try to delete a motor controller with motors"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","first_mot_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x,1)
- self.assertEqual(ctrl_list.value[0],
- "first_mot_ctrl (WaterPapCtrl.IcePapController/first_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
-
- p.command_inout("CreateMotor", ([0], ["first_mot","first_mot_ctrl"]))
-
- self.wrong_argument(p, "DeleteController", "first_mot_ctrl",
- "Pool_CantDeleteController")
-
- p.command_inout("DeleteMotor","first_mot")
-
- p.command_inout("DeleteController","first_mot_ctrl")
- self.check_empty_attribute(p,"ControllerList")
-
- def testCreateSameMotorControllerTwice(self):
- """Try to create same motor controller twice"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","first_mot_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x,1)
- self.assertEqual(ctrl_list.value[0],
- "first_mot_ctrl (WaterPapCtrl.IcePapController/first_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
-
- self.wrong_argument(p, "CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","first_mot_ctrl"],
- "Pool_ControllerAlreadyCreated")
-
- p.command_inout("DeleteController","first_mot_ctrl")
- self.check_empty_attribute(p,"ControllerList")
-
- def testCreateDeleteTwoMotorControllers(self):
- """Create/Delete two motor controllers"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","first_mot_ctrl"])
- p.command_inout("CreateController",
- ["Motor","WaterPapCtrl.py","IcePapController","second_mot_ctrl"])
-
- # Check controller list attribute
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x,2)
- self.assertEqual(ctrl_list.value[0],
- "first_mot_ctrl (WaterPapCtrl.IcePapController/first_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
- self.assertEqual(ctrl_list.value[1],
- "second_mot_ctrl (WaterPapCtrl.IcePapController/second_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
-
- # Delete one controller and check controller list attribute
- p.command_inout("DeleteController","second_mot_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x,1)
- self.assertEqual(ctrl_list.value[0],
- "first_mot_ctrl (WaterPapCtrl.IcePapController/first_mot_ctrl) - Motor Python ctrl (WaterPapCtrl.py)")
-
- p.command_inout("DeleteController","first_mot_ctrl")
- self.check_empty_attribute(p,"ControllerList")
-
- def testCreateMotorControllersWithMaxDevice(self):
- """Create a motor controller defining its mandatory MaxDevice property """
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor","FirePapCtrl.py","FirePapController",
- "third","MaxDevice","8"])
- p.command_inout("DeleteController","third")
- self.check_empty_attribute(p,"ControllerList")
-
-
-class CounterTimerControllerTestCase(poolunittest.PoolTestCase):
- """Test CounterTimer controller creation, deletion, listing"""
-
- # The CounterTimer simulator needs the motor simulator to work so the motor
- # simulator becomes a requirement
- def needsMotorSimulator(self):
- return True
-
- def needsCounterTimerSimulator(self):
- return True
-
- def testCreateCounterTimerControllerWrongArguments(self):
- """Create CounterTimer controller with wrong arguments"""
-
- p = self.pool_dp
- self.wrong_argument(self.pool_dp, "CreateController",
- ["a","b","c"], "Pool_WrongArgumentNumber")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["CounterTimer","a/b","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["CounterTimer","a/b.truc","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["CounterTimer","a","b","x"], "Pool_FileUnsupportedType")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["CounterTimer","a.py","b","x"], "Pool_ControllerNotFound")
- self.wrong_argument(self.pool_dp,"CreateController",
- ["CounterTimer","a.la","b","x"], "Pool_ControllerNotFound")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["CounterTimer","Vct6Ctrl.py","b","x"],
- "Pool_CantLocatePythonClass")
-
- self.wrong_argument(p,"CreateController",
- ["CounterTimer","Vct6Ctrl.py","Vct6Controller",
- "first_ct_ctrl"],
- "Pool_MissingPropertyValue")
-
- def testCreateDeleteCounterTimerController(self):
- """Create/Delete CounterTimer controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "first_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_ct_ctrl (Vct6Ctrl.Vct6Controller/first_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
-
- p.command_inout("DeleteController", "first_ct_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testDeleteInexistingCounterTimerController(self):
- """Try to delete inexisting CounterTimer controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "first_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_ct_ctrl (Vct6Ctrl.Vct6Controller/first_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
-
- self.wrong_argument(p,"DeleteController", "Aaaa",
- "Pool_ControllerNotFound")
-
- p.command_inout("DeleteController", "first_ct_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testDeleteCounterTimerControllerWithCounters(self):
- """Try to delete a CounterTimer controller with counters"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "first_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x,1)
- self.assertEqual(ctrl_list.value[0],
- "first_ct_ctrl (Vct6Ctrl.Vct6Controller/first_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
-
- p.command_inout("CreateExpChannel", ([0], ["first_ct","first_ct_ctrl"]))
-
- self.wrong_argument(p, "DeleteController", "first_ct_ctrl",
- "Pool_CantDeleteController")
-
- p.command_inout("DeleteExpChannel", "first_ct")
-
- p.command_inout("DeleteController", "first_ct_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testCreateSameCounterTimerControllerTwice(self):
- """Try to create same CounterTimer controller twice"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "first_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_ct_ctrl (Vct6Ctrl.Vct6Controller/first_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
-
- self.wrong_argument(p,"CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "first_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name],
- "Pool_ControllerAlreadyCreated")
-
- p.command_inout("DeleteController", "first_ct_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testCreateDeleteTwoCounterTimerControllers(self):
- """Create/Delete two CounterTimer controllers"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "first_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name])
- p.command_inout("CreateController",
- ["CounterTimer", "Vct6Ctrl.py", "Vct6Controller",
- "second_ct_ctrl", "CtrlDevName",
- self.ctsim_ctrl_dev_name])
-
- # Check controller list attribute
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_ct_ctrl (Vct6Ctrl.Vct6Controller/first_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
- self.assertEqual(ctrl_list.value[1],
- "second_ct_ctrl (Vct6Ctrl.Vct6Controller/second_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
-
- # Delete one controller and check controller list attribute
- p.command_inout("DeleteController", "second_ct_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_ct_ctrl (Vct6Ctrl.Vct6Controller/first_ct_ctrl) - CounterTimer Python ctrl (Vct6Ctrl.py)")
-
- self.pool_dp.command_inout("DeleteController", "first_ct_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
-
-class ZeroDControllerTestCase(poolunittest.PoolTestCase):
- """Test 0D controller creation, deletion, listing"""
-
- def testCreate0DControllerWrongArguments(self):
- """Create 0D controller with wrong arguments"""
-
- p = self.pool_dp
- self.wrong_argument(self.pool_dp, "CreateController",
- ["a","b","c"], "Pool_WrongArgumentNumber")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["ZeroDExpChannel","a/b","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["ZeroDExpChannel","a/b.truc","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["ZeroDExpChannel","a","b","x"], "Pool_FileUnsupportedType")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["ZeroDExpChannel","a.py","b","x"], "Pool_ControllerNotFound")
- self.wrong_argument(self.pool_dp,"CreateController",
- ["ZeroDExpChannel","a.la","b","x"], "Pool_ControllerNotFound")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["ZeroDExpChannel","ElecMeter.py","b","x"],
- "Pool_CantLocatePythonClass")
-
- def testCreateDelete0DController(self):
- """Create/Delete 0D controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "first_0d_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_0d_ctrl (ElecMeter.ElecMeterController/first_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
-
- p.command_inout("DeleteController", "first_0d_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testDeleteInexisting0DController(self):
- """Try to delete inexisting 0D controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "first_0d_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_0d_ctrl (ElecMeter.ElecMeterController/first_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
-
- self.wrong_argument(p, "DeleteController", "Aaaa",
- "Pool_ControllerNotFound")
-
- p.command_inout("DeleteController", "first_0d_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testDelete0DControllerWithChannels(self):
- """Try to delete a 0D controller with channels"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "first_0d_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_0d_ctrl (ElecMeter.ElecMeterController/first_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
-
- p.command_inout("CreateExpChannel", ([0], ["first_0d","first_0d_ctrl"]))
-
- self.wrong_argument(p, "DeleteController", "first_0d_ctrl",
- "Pool_CantDeleteController")
-
- p.command_inout("DeleteExpChannel","first_0d")
-
- p.command_inout("DeleteController", "first_0d_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testCreateSame0DControllerTwice(self):
- """Try create same 0D controller twice"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "first_0d_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_0d_ctrl (ElecMeter.ElecMeterController/first_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
-
- self.wrong_argument(p, "CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "first_0d_ctrl"],
- "Pool_ControllerAlreadyCreated")
-
- p.command_inout("DeleteController", "first_0d_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testCreateDeleteTwo0DControllers(self):
- """Create/Delete two 0D controllers"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "first_0d_ctrl"])
- p = self.pool_dp
- p.command_inout("CreateController",
- ["ZeroDExpChannel", "ElecMeter.py",
- "ElecMeterController", "second_0d_ctrl"])
-
- # Check controller list attribute
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_0d_ctrl (ElecMeter.ElecMeterController/first_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
- self.assertEqual(ctrl_list.value[1],
- "second_0d_ctrl (ElecMeter.ElecMeterController/second_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
-
- # Delete one controller and check controller list attribute
- p.command_inout("DeleteController", "second_0d_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_0d_ctrl (ElecMeter.ElecMeterController/first_0d_ctrl) - ZeroDExpChannel Python ctrl (ElecMeter.py)")
-
- self.pool_dp.command_inout("DeleteController", "first_0d_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
-
-class CommunicationControllerTestCase(poolunittest.PoolTestCase):
- """Test communication controller creation, deletion, listing"""
-
- def testCreateCommunicationControllerWrongArguments(self):
- """Create Communication controller with wrong arguments"""
-
- p = self.pool_dp
- self.wrong_argument(self.pool_dp, "CreateController",
- ["a","b","c"], "Pool_WrongArgumentNumber")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["Communication","a/b","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["Communication","a/b.truc","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["Communication","a","b","x"], "Pool_FileUnsupportedType")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Communication","a.py","b","x"], "Pool_ControllerNotFound")
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Communication","a.la","b","x"], "Pool_ControllerNotFound")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["Communication","DummyCommunicationController.py","b","x"],
- "Pool_CantLocatePythonClass")
-
- def testCreateDeleteCommunicationController(self):
- """Create/Delete Communication controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "first_com_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_com_ctrl (DummyCommunicationController.DummyCommunicationController/first_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
-
- p.command_inout("DeleteController", "first_com_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testDeleteInexistingCommunicationController(self):
- """Try to delete inexisting Communication controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "first_com_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_com_ctrl (DummyCommunicationController.DummyCommunicationController/first_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
-
- self.wrong_argument(p, "DeleteController", "Aaaa",
- "Pool_ControllerNotFound")
-
- p.command_inout("DeleteController", "first_com_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testDeleteCommunicationControllerWithChannels(self):
- """Try to delete a Communication controller with channels"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "first_com_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_com_ctrl (DummyCommunicationController.DummyCommunicationController/first_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
-
- p.command_inout("CreateComChannel", ([0], ["first_comch","first_com_ctrl"]))
-
- self.wrong_argument(p, "DeleteController", "first_com_ctrl",
- "Pool_CantDeleteController")
-
- p.command_inout("DeleteComChannel","first_comch")
-
- p.command_inout("DeleteController", "first_com_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testCreateSameCommunicationControllerTwice(self):
- """Try create same Communication controller twice"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "first_com_ctrl"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_com_ctrl (DummyCommunicationController.DummyCommunicationController/first_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
-
- self.wrong_argument(p, "CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "first_com_ctrl"],
- "Pool_ControllerAlreadyCreated")
-
- p.command_inout("DeleteController", "first_com_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
- def testCreateDeleteTwoCommunicationControllers(self):
- """Create/Delete two Communication controllers"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "first_com_ctrl"])
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Communication", "DummyCommunicationController.py",
- "DummyCommunicationController", "second_com_ctrl"])
-
- # Check controller list attribute
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_com_ctrl (DummyCommunicationController.DummyCommunicationController/first_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
- self.assertEqual(ctrl_list.value[1],
- "second_com_ctrl (DummyCommunicationController.DummyCommunicationController/second_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
-
- # Delete one controller and check controller list attribute
- p.command_inout("DeleteController", "second_com_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_com_ctrl (DummyCommunicationController.DummyCommunicationController/first_com_ctrl) - Communication Python ctrl (DummyCommunicationController.py)")
-
- self.pool_dp.command_inout("DeleteController", "first_com_ctrl")
- self.check_empty_attribute(p, "ControllerList")
-
-
-class PseudoMotorControllerTestCase(poolunittest.PoolTestCase):
- """Test PseudoMotor controller creation, deletion, listing"""
-
- def needsMotorSimulator(self):
- return True
-
- def setUp(self):
- poolunittest.PoolTestCase.setUp(self)
- p = self.pool_dp
- p.command_inout("CreateController",
- ["Motor", "SimuMotorCtrl.la", "SimuMotorController",
- "first_simumot_ctrl",
- "DevName", self.motsim_ctrl_dev_name])
-
- p.command_inout("CreateMotor", ([0], ["first_simu_mot","first_simumot_ctrl"]))
- p.command_inout("CreateMotor", ([1], ["second_simu_mot","first_simumot_ctrl"]))
-
- def tearDown(self):
- p = self.pool_dp
-
- p.command_inout("DeleteMotor", "first_simu_mot")
- p.command_inout("DeleteMotor", "second_simu_mot")
- p.command_inout("DeleteController", "first_simumot_ctrl")
- poolunittest.PoolTestCase.tearDown(self)
-
- def testCreatePseudoMotorControllerWrongArguments(self):
- """Create Pseudo Motor controller with wrong arguments"""
-
- p = self.pool_dp
- self.wrong_argument(self.pool_dp, "CreateController",
- ["a","b","c"], "Pool_WrongArgumentNumber")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["PseudoMotor","a/b","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["PseudoMotor","a/b.truc","ctrl","inst"], "Pool_FileUnsupportedType")
- self.wrong_argument(self.pool_dp, "CreateController",
- ["PseudoMotor","a","b","x"], "Pool_FileUnsupportedType")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["PseudoMotor","a.py","b","x"], "Pool_ControllerNotFound")
- self.wrong_argument(self.pool_dp,"CreateController",
- ["PseudoMotor","a.la","b","x"], "Pool_ControllerNotFound")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["PseudoMotor","PseudoMotorLib.py","b","x"],
- "Pool_CantLocatePythonClass")
-
- self.wrong_argument(self.pool_dp,"CreateController",
- ["PseudoMotor","PseudoMotorLib.py","b","x"],
- "Pool_CantLocatePythonClass")
-
- self.wrong_argument(p,"CreateController",
- ["PseudoMotor", "PseudoMotorLib.py","Slit",
- "first_slit_ctrl",
- "inexisting_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"],
- "Pool_MotorNotDefined")
-
- self.wrong_argument(p,"CreateController",
- ["PseudoMotor", "PseudoMotorLib.py","Slit",
- "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot"],
- "Pool_WrongArgumentNumber")
-
- def testCreateDeletePseudoMotorController(self):
- """Create/Delete PseudoMotor controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
- self.assertEqual(ctrl_list.value[1],
- "first_slit_ctrl (PseudoMotorLib.Slit/first_slit_ctrl) - PseudoMotor Python ctrl (PseudoMotorLib.py)")
-
- p.command_inout("DeletePseudoMotor", "first_gap_mot")
- p.command_inout("DeletePseudoMotor", "first_offset_mot")
-
- p.command_inout("DeleteController", "first_slit_ctrl")
-
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
-
- def testDeleteInexistingPseudoMotorController(self):
- """Try to delete inexisting PseudoMotor controller"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"])
-
- self.wrong_argument(p, "DeleteController", "Aaaa",
- "Pool_ControllerNotFound")
-
- p.command_inout("DeletePseudoMotor", "first_gap_mot")
- p.command_inout("DeletePseudoMotor", "first_offset_mot")
-
- p.command_inout("DeleteController", "first_slit_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
-
- def testDeletePseudoMotorControllerWithPseudoMotors(self):
- """Try to delete a PseudoMotor controller with pseudo motors"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
- self.assertEqual(ctrl_list.value[1],
- "first_slit_ctrl (PseudoMotorLib.Slit/first_slit_ctrl) - PseudoMotor Python ctrl (PseudoMotorLib.py)")
-
- self.wrong_argument(p, "DeleteController", "first_slit_ctrl",
- "Pool_CantDeleteController")
-
- self.wrong_argument(p, "DeleteMotor", "first_simu_mot",
- "Pool_CantDeleteMotor")
- self.wrong_argument(p, "DeleteMotor", "second_simu_mot",
- "Pool_CantDeleteMotor")
-
- p.command_inout("DeletePseudoMotor", "first_gap_mot")
- p.command_inout("DeletePseudoMotor", "first_offset_mot")
-
- p.command_inout("DeleteController", "first_slit_ctrl")
-
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
-
- def testCreateSamePseudoMotorControllerTwice(self):
- """Try create same PseudoMotor controller twice"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"])
-
- ctrl_list = p.read_attribute("ControllerList")
-
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
- self.assertEqual(ctrl_list.value[1],
- "first_slit_ctrl (PseudoMotorLib.Slit/first_slit_ctrl) - PseudoMotor Python ctrl (PseudoMotorLib.py)")
-
- self.wrong_argument(p, "CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"],
- "Pool_ControllerAlreadyCreated")
-
- p.command_inout("DeletePseudoMotor", "first_gap_mot")
- p.command_inout("DeletePseudoMotor", "first_offset_mot")
-
- p.command_inout("DeleteController", "first_slit_ctrl")
-
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
-
- def testCreateDeleteTwoPseudoMotorControllers(self):
- """Create/Delete two PseudoMotor controllers"""
-
- p = self.pool_dp
- p.command_inout("CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "first_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "first_offset_mot"])
-
- #
- # Repeating pseudo motor names is an error
- #
- self.wrong_argument(p,"CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "second_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "first_gap_mot", "second_offset_mot"],
- "Pool_PseudoMotorAlreadyCreated")
-
- p.command_inout("CreateController",
- ["PseudoMotor", "PseudoMotorLib.py",
- "Slit", "second_slit_ctrl",
- "first_simu_mot", "second_simu_mot",
- "second_gap_mot", "second_offset_mot"])
-
- # Check controller list attribute
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 3)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
- self.assertEqual(ctrl_list.value[1],
- "first_slit_ctrl (PseudoMotorLib.Slit/first_slit_ctrl) - PseudoMotor Python ctrl (PseudoMotorLib.py)")
- self.assertEqual(ctrl_list.value[2],
- "second_slit_ctrl (PseudoMotorLib.Slit/second_slit_ctrl) - PseudoMotor Python ctrl (PseudoMotorLib.py)")
-
- # Delete one controller and check controller list attribute
- p.command_inout("DeletePseudoMotor", "second_gap_mot")
- p.command_inout("DeletePseudoMotor", "second_offset_mot")
-
- p.command_inout("DeleteController", "second_slit_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 2)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
- self.assertEqual(ctrl_list.value[1],
- "first_slit_ctrl (PseudoMotorLib.Slit/first_slit_ctrl) - PseudoMotor Python ctrl (PseudoMotorLib.py)")
-
- p.command_inout("DeletePseudoMotor", "first_gap_mot")
- p.command_inout("DeletePseudoMotor", "first_offset_mot")
-
- self.pool_dp.command_inout("DeleteController", "first_slit_ctrl")
- ctrl_list = p.read_attribute("ControllerList")
- self.assertEqual(ctrl_list.dim_x, 1)
- self.assertEqual(ctrl_list.value[0],
- "first_simumot_ctrl (SimuMotorCtrl.SimuMotorController/first_simumot_ctrl) - Motor Cpp ctrl (SimuMotorCtrl.la)")
-
-def suite():
- s = poolunittest.PoolTestSuite()
-
- empty_pool_suite = unittest.makeSuite(EmptyPoolTestCase, 'test')
- ctrl_pool_suite = unittest.makeSuite(ControllerTestCase, 'test')
- mot_ctrl_pool_suite = unittest.makeSuite(MotorControllerTestCase, 'test')
- ct_ctrl_pool_suite = unittest.makeSuite(CounterTimerControllerTestCase, 'test')
- zd_ctrl_pool_suite = unittest.makeSuite(ZeroDControllerTestCase, 'test')
- com_ctrl_pool_suite = unittest.makeSuite(CommunicationControllerTestCase, 'test')
- pm_ctrl_pool_suite = unittest.makeSuite(PseudoMotorControllerTestCase, 'test')
-
- s.addTest(empty_pool_suite)
- s.addTest(ctrl_pool_suite)
- s.addTest(mot_ctrl_pool_suite)
- s.addTest(ct_ctrl_pool_suite)
- s.addTest(zd_ctrl_pool_suite)
- s.addTest(com_ctrl_pool_suite)
- s.addTest(pm_ctrl_pool_suite)
-
- return s
-
-def m1():
- unittest.main()
-
-def m2(test_output):
- test_output_file = open(test_output, "w")
- runner = poolunittest.PoolTestRunner(verbosity=2, stream=test_output_file)
- unittest.main(testRunner=runner, testLoader=poolunittest.PoolTestLoader())
-
-def m3(test_output):
- test_output_file = file(test_output, 'wb')
- runner = HTMLTestRunner.HTMLTestRunner(
- stream=test_output_file,
- title='Device Pool Unit Test',
- description='Device Pool Unit Test package',
- verbosity=2)
- runner.run(suite())
-
-if __name__ == "__main__":
- test_output = "test_result.html"
- m3(test_output)
- \ No newline at end of file
diff --git a/test/poolunittest.py b/test/poolunittest.py
deleted file mode 100644
index 1b446045..00000000
--- a/test/poolunittest.py
+++ /dev/null
@@ -1,981 +0,0 @@
-""" An extension to the original PyUnit providing specific Device Pool test
- utilities """
-
-from taurus.external import unittest
-import PyTango
-import sys
-import os
-import user
-import subprocess
-import time
-import signal
-import exceptions
-import imp
-
-try:
- import pexpect
-except:
- print "The Pool Unit test requires pexpect python module which was not found."
- print "This module can be found at http://www.noah.org/wiki/Pexpect"
- sys.exit(-1)
-
-class DefaultTangoEventCallBack:
-
- def __init__(self):
- self.evt_list = []
- self.cb_executed = 0
- self.cb_error = 0
- self.verbose = False
-
- def push_event(self,event):
- self.cb_executed += 1
- self.evt_list.append(event)
- if event.err:
- self.cb_error += 1
- elif self.verbose:
- sys.stderr.write("%s\n" % str(event.attr_value.value))
- sys.stderr.flush()
-
- def getEventValues(self):
- ret = []
- for e in self.evt_list:
- if e.err:
- ret.append(None)
- else:
- ret.append(e.attr_value.value)
- return ret
-
-class PoolTestCase(unittest.TestCase):
- """An extension to the original PyUnit TestCase providing specific methods
- for DevicePool tests"""
-
- ReadyMsg = "Ready to accept request"
- AlreadyRunning = "This server is already running, exiting!"
- PoolExecNotFound = "No such file or directory"
- PoolReadyMsg = ReadyMsg
- PoolAlreadyRunning = AlreadyRunning
- PoolMaxStartupTime = 10
- PoolMaxShutdownTime = 10
-
- MotorSimulatorReadyMsg = ReadyMsg
- MotorSimulatorAlreadyRunning = AlreadyRunning
- MotorSimulatorMaxStartupTime = 10
- MotorSimulatorMaxShutdownTime = 10
-
- CounterTimerSimulatorReadyMsg = ReadyMsg
- CounterTimerSimulatorAlreadyRunning = AlreadyRunning
- CounterTimerSimulatorMaxStartupTime = 10
- CounterTimerSimulatorMaxShutdownTime = 10
-
- def check_empty_attribute(self, dev, att_name):
- """ check_empty_attribute(PyTango.DeviceProxy dev, string att_name) -> None
-
- Reads the given attribute from the given device and checks that the
- received value is empty.
-
- Paramaters:
- dev: a PyTango.DeviceProxy
- att_name: a string containing the attribute name
- """
- try:
- c_list = dev.read_attribute(att_name)
- if len(c_list.value) != 0:
- self.assert_(False, "The %s attribute is not empty !! It contains: %s" % (att_name,c_list.value))
- except PyTango.DevFailed,e:
- except_value = sys.exc_info()[1]
- self.assertEqual(except_value[0]["reason"],"API_EmptyDeviceAttribute")
- self.assertEqual(except_value[0]["desc"],"cannot extract, no data in DeviceAttribute object ")
-
- def attribute_error(self, dev, att_name, err, pr = False):
- """ attribute_error(PyTango.DeviceProxy dev, string att_name, string err, bool pr = False)
-
- Reads the given attribute from the given device and checks that this
- operation generates a PyTango.DevFailed exception with its 'reason'
- being equal to the given err string. If pr is set to True then the
- exception description is sent to the output.
- """
- try:
- c_list = dev.read_attribute(att_name)
- self.assert_(False, "The %s attribute is not in fault!!" % (att_name))
- except PyTango.DevFailed,e:
- except_value = sys.exc_info()[1]
- if pr == True:
- self._printException(except_value)
- self.assertEqual(except_value[0]["reason"], err)
-
- def wr_attribute_error(self, dev, att_val, err, pr = False):
- """ wr_attribute_error(PyTango.DeviceProxy dev, PyTango.AttributeValue att_value, string err, bool pr = False)
-
- Writes the given attribute from the given device with the given
- value and checks that this operation generates a PyTango.DevFailed
- exception with its 'reason' being equal to the given err string.
- If pr is set to True then the exception description is sent to the
- output.
- """
- try:
- dev.write_attribute(att_val)
- self.assert_(False,"The %s attribute is not in fault!!" % (att_val.name))
- except PyTango.DevFailed,e:
- except_value = sys.exc_info()[1]
- if pr == True:
- self._printException(except_value)
- self.assertEqual(except_value[0]["reason"], err)
-
- def wrong_argument(self, dev, cmd_name, arg_list, err, pr = False):
- """ wrong_argument(PyTango.DeviceProxy dev, string cmd_name, list arg_list, string err, bool pr = False)
-
- Executes the given command with the given arguments on the given
- device and expects a PyTango.DevFailed exception to be raised with
- its 'reason' being equal to the given err string.
- If pr is set to True then the exception description is sent to the
- output.
- """
- try:
- dev.command_inout(cmd_name, arg_list)
- self.assert_(False,"The %s command succeed with wrong arguments!!" % (cmd_name))
- except PyTango.DevFailed,e:
- except_value = sys.exc_info()[1]
- if pr == True:
- self._printException(except_value)
- self.assertEqual(except_value[0]["reason"], err)
-
- def _write_attribute(self, dev, att_name, att_val):
- """ _write_attribute(PyTango.DeviceProxy dev, string att_name, object attr_val)
-
- Writes the given attribute from the given device with the given
- value.
- """
- val = PyTango.AttributeValue()
- val.name = att_name
- val.value = att_val
- dev.write_attribute(val)
-
- def _printException(self, except_value):
- print "\nERROR desc"
- print "origin =",except_value[0]["origin"]
- print "desc =",except_value[0]["desc"]
- print "origin =",except_value[0]['origin']
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Default setup. Overwrite this methods in each test scenario when necessary
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- def getPoolPath(self):
- """getPoolPath() -> list<string>
- """
- lib_root = os.path.abspath(os.path.join(self.pool_bin_dir,"..","lib"))
-
- pydir = os.path.join(lib_root, "python")
- if not os.path.exists(pydir):
- pydir += "%d.%d" % (sys.version_info[0],sys.version_info[1])
-
- test_ctrl_dir = os.path.abspath(os.path.curdir)
- test_ctrl_dir = os.path.join(test_ctrl_dir,"test_ctrl")
-
- return [os.path.join(lib_root, "pool"),
- test_ctrl_dir,
- os.path.join(lib_root,"poolcontrollers"),
- os.path.join(pydir,"site-packages")]
-
- def getMotorControllerSimulatorMaxError(self):
- return 0
-
- def getMotorSimulators(self):
- return 10 * ({ "properties" : {"_Velocity" : ['5.0'],
- "_Acceleration" : ['2.0'],
- "_Deceleration" : ['2.0'],
- "_Base_rate" : ['0.01'] },
- },)
-
- def getCounterTimerSimulators(self):
- ret = []
- for i in xrange(10):
- mot_name = "%s/simmot/test%03d" % (self.username, i+1)
- ret.append({ "properties" : {"Average" : ['1.0'],
- "Sigma" : ['250.0'],
- "MotorName" : [mot_name] },
- },)
- return ret
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Generic methods
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def deleteFromDB(self, server_name, server_instance):
- server_name = server_name.lower()
- server_instance = server_instance.lower()
- server = server_name + '/' + server_instance
- servers = [ s.lower() for s in self.tango_db.get_server_list(server_name + '/*') ]
- if server in servers:
- devices = self.tango_db.get_device_name(server, '*')
-
- for d in devices:
- if not d.startswith('dserver'):
- props = self.tango_db.get_device_property_list(d, '*')
- self.tango_db.delete_device_property(d, props)
- self.tango_db.delete_device(d)
-
- self.tango_db.delete_server(server)
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Test requirements. Overwrite as necessary
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def needsPool(self):
- return True
-
- def needsMotorSimulator(self):
- return False
-
- def needsCounterTimerSimulator(self):
- return False
-
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
- # Pre and Post test methods
- #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
-
- def setUp(self):
- """Default setUp."""
- self.prepare()
- self.start()
-
- def tearDown(self):
- """Default tearDown."""
- self.stop()
- self.cleanUp()
-
- def start(self):
- """Default startup. Starts Simulators and Device Pool"""
- self.startMotorSimulator()
- self.startCounterTimerSimulator()
- self.startPool()
-
- def stop(self):
- """Default stop. Stops Simulators and Device Pool"""
- self.stopPool()
- self.stopCounterTimerSimulator()
- self.stopMotorSimulator()
-
- def prepare(self):
- """Prepares everything to be run"""
- self.tango_db = PyTango.Database()
- self.username = os.getlogin()
- self.common_ds_instance = self.username + "_test"
- self.prepareMotorSimulator()
- self.prepareCounterTimerSimulator()
- self.prepareDevicePool()
-
- def cleanUp(self):
- """Cleans the Database"""
- self.deletePoolFromDB()
- self.deleteCounterTimerSimulatorFromDB()
- self.deleteMotorSimulatorFromDB()
-
- def prepareMotorSimulator(self):
- """Prepare the Motor Simulator local variables and registers in the Database"""
-
- if not self.needsMotorSimulator():
- return
-
- self.motsim_ds_instance = self.common_ds_instance
- self.motsim_ctrl_dev_name = self.username + "/simmotctrl/test"
- self.motsim_process = None
- self.motsim_start_time = -1
- self.motsim_stopt_time = -1
- self.motsim_exec = None
-
- # Make sure the python device server code is reachable
- try:
- f, self.motsim_exec, desc = imp.find_module('SimuMotorCtrl')
- f.close()
- f, path, desc = imp.find_module('SimuMotor')
- f.close()
- except exceptions.ImportError, e:
- self.assert_(False, e.message)
-
- # Cleanup the database
- self.deleteMotorSimulatorFromDB()
-
- # Create a new instance in database
- self.createMotorSimulatorInDB()
-
- def createMotorSimulatorInDB(self):
- """Registers the Motor Simulator in the Database"""
-
- if not self.needsMotorSimulator():
- return
-
- # Create the motor controller simulator
- ctrl_server_info = PyTango.DbDevInfo()
- ctrl_server_info.name = self.motsim_ctrl_dev_name
- ctrl_server_info._class = 'SimuMotorCtrl'
- ctrl_server_info.server = 'SimuMotorCtrl/' + self.motsim_ds_instance
- self.tango_db.add_device(ctrl_server_info)
-
- # Add the MaxError property
- props = { 'MaxError': [str(self.getMotorControllerSimulatorMaxError())] }
- self.tango_db.put_device_property(ctrl_server_info.name, props)
-
- # Create the motor simulators
- mots = self.getMotorSimulators()
-
- mot_idx = 1
- for mot in mots:
- mot_info = PyTango.DbDevInfo()
- mot_info.name = "%s/simmot/test%03d" % (self.username, mot_idx)
- mot_info._class = 'SimuMotor'
- mot_info.server = 'SimuMotorCtrl/' + self.motsim_ds_instance
- self.tango_db.add_device(mot_info)
- self.tango_db.put_device_property(mot_info.name, mot['properties'])
- mot_idx += 1
-
- def deleteMotorSimulatorFromDB(self):
- """Unregisters the Motor Simulator from the Database"""
-
- if not self.needsMotorSimulator():
- return
-
- self.deleteFromDB('SimuMotorCtrl', self.motsim_ds_instance)
-
- def prepareCounterTimerSimulator(self):
- """Prepare the Counter Timer Simulator local variables and registers in the Database"""
-
- if not self.needsCounterTimerSimulator():
- return
-
- self.ctsim_ds_instance = self.common_ds_instance
- self.ctsim_ctrl_dev_name = self.username + "/simctctrl/test"
- self.ctsim_process = None
- self.ctsim_start_time = -1
- self.ctsim_stopt_time = -1
- self.ctsim_exec = None
-
- # Make sure the python device server code is reachable
- try:
- f, self.ctsim_exec, desc = imp.find_module('SimuCoTiCtrl')
- f.close()
- f, path, desc = imp.find_module('SimuCounter')
- f.close()
- except exceptions.ImportError, e:
- self.assert_(False, e.message)
-
- self.ctsim_exec = self.ctsim_exec
-
- # Cleanup the database
- self.deleteCounterTimerSimulatorFromDB()
-
- # Create a new instance in database
- self.createCounterTimerSimulatorInDB()
-
- def createCounterTimerSimulatorInDB(self):
- """Registers the Counter Timer Simulator in the Database"""
-
- if not self.needsCounterTimerSimulator():
- return
-
- # Create the motor controller simulator
- ctrl_server_info = PyTango.DbDevInfo()
- ctrl_server_info.name = self.ctsim_ctrl_dev_name
- ctrl_server_info._class = 'SimuCoTiCtrl'
- ctrl_server_info.server = 'SimuCoTiCtrl/' + self.ctsim_ds_instance
- self.tango_db.add_device(ctrl_server_info)
-
- # Create the counter timer simulators
- cts = self.getCounterTimerSimulators()
-
- ct_idx = 1
- for ct in cts:
- ct_info = PyTango.DbDevInfo()
- ct_info.name = "%s/simct/test%03d" % (self.username, ct_idx)
- ct_info._class = 'SimuCounter'
- ct_info.server = 'SimuCoTiCtrl/' + self.ctsim_ds_instance
- self.tango_db.add_device(ct_info)
- self.tango_db.put_device_property(ct_info.name, ct['properties'])
- ct_idx += 1
-
- def deleteCounterTimerSimulatorFromDB(self):
- """Unregisters the Counter Timer Simulator from the Database"""
-
- if not self.needsCounterTimerSimulator():
- return
-
- self.deleteFromDB('SimuCoTiCtrl', self.ctsim_ds_instance)
-
- def prepareDevicePool(self):
- """Prepare the Device Pool local variables and registers in the Database"""
-
- if not self.needsPool():
- return
-
- self.pool_ds_instance = self.common_ds_instance
- self.pool_dev_name = self.username + "/pool/test"
- self.pool_process = None
- self.pool_start_time = -1
- self.pool_stopt_time = -1
- self.pool_exec = None
-
- for path in os.getenv("PATH").split(":"):
- path = os.path.join(path,"Pool")
- if os.path.exists(path):
- self.pool_exec = path
- break
-
- self.failIf(self.pool_exec is None, "Could not find Pool executable. Make sure it is in the PATH")
-
- self.pool_bin_dir = os.path.dirname(self.pool_exec)
-
- self.deletePoolFromDB()
-
- self.createPoolInDB()
-
- self.pool_dp = PyTango.DeviceProxy(self.pool_dev_name)
-
- def createPoolInDB(self):
- """Registers the Device Pool in the Database"""
-
- if not self.needsPool():
- return
-
- # Create the device pool in the database
- pool_server_info = PyTango.DbDevInfo()
- pool_server_info.name = self.pool_dev_name
- pool_server_info._class = 'Pool'
- pool_server_info.server = 'Pool/' + self.pool_ds_instance
- self.tango_db.add_device(pool_server_info)
-
- # Add the PoolPath property
- props = { 'PoolPath': self.getPoolPath() }
- self.tango_db.put_device_property(pool_server_info.name, props)
-
- def deletePoolFromDB(self):
- """Unregisters the Device Pool from the Database"""
-
- if not self.needsPool():
- return
-
- self.pool_dp = None
-
- self.deleteFromDB('Pool', self.pool_ds_instance)
-
- def waitPoolStop(self):
- """Waits for the Device Pool process (if any) to stop orderly."""
- if self.pool_process is None:
- return 0
-
- idx = self.pool_process.expect(["Exiting",
- pexpect.EOF,
- pexpect.TIMEOUT],
- timeout=PoolTestCase.PoolMaxShutdownTime)
- if idx == 0:
- pass
- elif idx == 1:
- self.assert_(False, "Device Pool terminated unexpectedly (before 'Exiting')")
- elif idx == 2:
- self.assert_(False, "Device Pool shutdown time exceeded")
-
- idx = self.pool_process.expect(["Exited",
- pexpect.EOF,
- pexpect.TIMEOUT],
- timeout=PoolTestCase.PoolMaxShutdownTime)
- if idx == 0:
- pass
- elif idx == 1:
- self.assert_(False, "Device Pool terminated unexpectedly (before 'Exited')")
- elif idx == 2:
- self.assert_(False, "Device Pool shutdown time exceeded")
-
- try:
- ret = self.pool_process.wait()
- self.pool_process = None
- except:
- #if the process has already terminated before the call to wait()
- ret = self.pool_process.exitstatus
- self.pool_process = None
-
- self.failUnless(ret==0, "Device Pool terminated with exitcode = %d"%ret)
-
- return ret
-
- def startPool(self):
- """Starts the Device pool"""
-
- if not self.needsPool():
- return
-
- self.pool_process = pexpect.spawn(self.pool_exec,
- args = [self.pool_ds_instance])
- # make sure the device pool sends events
- self.pool_process.delayafterterminate = 2
-
- idx = self.pool_process.expect([PoolTestCase.PoolReadyMsg,
- PoolTestCase.PoolAlreadyRunning,
- pexpect.EOF,
- pexpect.TIMEOUT],
- timeout=PoolTestCase.PoolMaxStartupTime)
-
- if idx == 0:
- return
- elif idx == 1:
- self.assert_(False, PoolTestCase.PoolAlreadyRunning)
- elif idx == 2:
- self.assert_(False, "Device Pool terminated unexpectedly")
- elif idx == 3:
- self.assert_(False, "Device Pool startup time exceeded")
-
- def stopPool(self):
- """Stops the Device Pool"""
-
- if not self.needsPool():
- return
-
- if self.pool_process is None:
- return
-
- if not self.pool_process.isalive():
- return
-
- self.pool_process.terminate()
- if self.pool_process.isalive():
- # flush any existing output
- self.pool_process.close()
- if not self.pool_process.isalive():
- ret = self.pool_process.exitstatus
- self.failUnless(ret==0, "Device Pool terminated with exitcode = %d"%ret)
- return
- else:
- ret = self.pool_process.exitstatus
- self.failUnless(ret==0, "Device Pool terminated with exitcode = %d"%ret)
- return
-
- self.pool_process.terminate(force=True)
- if not self.pool_process.isalive():
- self.assert_(False, "Device Pool hangs: Forced to do a SIGKILL")
-
- self.assert_(False, "Device Pool hangs EVEN with SIGKILL")
-
- def startMotorSimulator(self):
- """Starts the Motor Simulator"""
-
- if not self.needsMotorSimulator():
- return
-
- self.motsim_process = pexpect.spawn("python",
- args = [self.motsim_exec,
- self.motsim_ds_instance])
-
- idx = self.motsim_process.expect([PoolTestCase.MotorSimulatorReadyMsg,
- PoolTestCase.MotorSimulatorAlreadyRunning,
- pexpect.EOF,
- pexpect.TIMEOUT],
- timeout=PoolTestCase.MotorSimulatorMaxStartupTime)
-
- if idx == 0:
- return
- elif idx == 1:
- self.assert_(False, PoolTestCase.MotorSimulatorAlreadyRunning)
- elif idx == 2:
- self.assert_(False, "Motor Simulator terminated unexpectedly")
- elif idx == 3:
- self.assert_(False, "Motor Simulator startup time exceeded")
-
- def stopMotorSimulator(self):
- """Stops the Motor Simulator"""
-
- if not self.needsMotorSimulator():
- return
-
- if self.motsim_process is None:
- return
-
- if not self.motsim_process.isalive():
- return
-
- self.motsim_process.terminate()
-
- if self.motsim_process.isalive():
- # flush any existing output
- self.motsim_process.close()
- if not self.motsim_process.isalive():
- return
- else:
- return
-
- self.motsim_process.terminate(force=True)
- if not self.motsim_process.isalive():
- self.assert_(False, "Motor Simulator hangs: Forced to do a SIGKILL")
-
- self.assert_(False, "Motor Simulator hangs EVEN with SIGKILL")
-
- def startCounterTimerSimulator(self):
- """Starts the Counter Timer Simulator"""
-
- if not self.needsCounterTimerSimulator():
- return
-
- self.ctsim_process = pexpect.spawn("python",
- args = [self.ctsim_exec,
- self.ctsim_ds_instance])
-
- idx = self.ctsim_process.expect([PoolTestCase.CounterTimerSimulatorReadyMsg,
- PoolTestCase.CounterTimerSimulatorAlreadyRunning,
- pexpect.EOF,
- pexpect.TIMEOUT],
- timeout=PoolTestCase.CounterTimerSimulatorMaxStartupTime)
-
- if idx == 0:
- return
- elif idx == 1:
- self.assert_(False, PoolTestCase.CounterTimerAlreadyRunning)
- elif idx == 2:
- self.assert_(False, "Counter Timer Simulator terminated unexpectedly")
- elif idx == 3:
- self.assert_(False, "Counter Timer Simulator startup time exceeded")
-
- def stopCounterTimerSimulator(self):
- """Stops the Counter Timer Simulator"""
-
- if not self.needsCounterTimerSimulator():
- return
-
- if self.ctsim_process is None:
- return
-
- if not self.ctsim_process.isalive():
- return
-
- self.ctsim_process.terminate()
-
- if self.ctsim_process.isalive():
- # flush any existing output
- self.ctsim_process.close()
- if not self.ctsim_process.isalive():
- return
- else:
- return
-
- self.ctsim_process.terminate(force=True)
- if not self.ctsim_process.isalive():
- self.assert_(False, "Counter Timer Simulator hangs: Forced to do a SIGKILL")
-
- self.assert_(False, "Counter Timer Simulator hangs EVEN with SIGKILL")
-
- def startPool_PopenStyle(self):
- """Starts the Device pool"""
-
- try:
- self.pool_process = subprocess.Popen([self.pool_exec,
- self.pool_ds_instance],
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- except exceptions.OSError,e:
- if e.strerror == PoolTestCase.PoolExecNotFound:
- self.assert_(False, "Could not find Pool executable. Make sure it is in the PATH")
- else:
- raise
-
- self.failIf(self.pool_process.stdout is None,
- "Was not able to grab Pool output")
-
- self.pool_start_time = time.time()
- while 1:
- delta_time = time.time() - self.pool_start_time
-
- self.failIf(delta_time >= PoolTestCase.PoolMaxStartupTime,
- "Pool startup time exceeded")
-
- line = self.pool_process.stdout.readline()
-
- if line.count(PoolTestCase.PoolReadyMsg) > 0:
- break
-
- self.failIfEqual(line, PoolTestCase.PoolAlreadyRunning,
- PoolTestCase.PoolAlreadyRunning)
-
- def stopPool_PopenStyle(self):
- """Stops the Device Pool"""
-
- self.pool_stop_time = time.time()
- if self.pool_process is None:
- return
-
- if self.pool_process.poll() is None:
- os.kill(self.pool_process.pid,signal.SIGINT)
-
- while self.pool_process.poll() is None:
- delta_time = time.time() - self.pool_stop_time
-
- if delta_time > PoolTestCase.PoolMaxShutdownTime:
- os.kill(self.pool_process.pid,signal.SIGKILL)
- self.assert_(False, "Pool hangs: Forced to do a kill -9")
-
- time.sleep(0.2)
-
- self.failUnlessEqual(self.pool_process.returncode, 0,
- "Pool exited with code %d" % self.pool_process.returncode)
- self.pool_process = None
-
- def startMotorSimulator_PopenStyle(self):
- """Starts the Motor Simulator"""
- self.motsim_process = subprocess.Popen(["python",
- self.motsim_exec,
- self.motsim_ds_instance],
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
- bufsize=0)
-
- self.failIf(self.motsim_process.stdout is None,
- "Was not able to grab Motor Simulator output")
-
- self.motsim_start_time = time.time()
- while 1:
- delta_time = time.time() - self.motsim_start_time
-
- self.failIf(delta_time >= PoolTestCase.MotorSimulatorMaxStartupTime,
- "Motor Simulator startup time exceeded")
-
- line = self.motsim_process.stdout.readline()
- sys.stderr.write(line)
- sys.stderr.flush()
-
- if line.count(PoolTestCase.MotorSimulatorReadyMsg) > 0:
- break
-
- self.failIfEqual(line, PoolTestCase.MotorSimulatorAlreadyRunning,
- PoolTestCase.MotorSimulatorAlreadyRunning)
-
- def stopMotorSimulator_PopenStyle(self):
- """Stops the Motor Simulator"""
-
- self.motsim_stop_time = time.time()
- if self.motsim_process is None:
- return
-
- os.kill(self.motsim_process.pid,signal.SIGINT)
-
- while self.motsim_process.poll() is None:
- delta_time = time.time() - self.motsim_stop_time
-
- if delta_time > PoolTestCase.MotorSimulatorMaxShutdownTime:
- os.kill(self.motsim_process.pid,signal.SIGKILL)
- self.assert_(False, "MotorSimulator hangs: Forced to do a kill -9")
-
- time.sleep(0.2)
-
- self.failUnlessEqual(self.motsim_process.returncode, 0,
- "MotorSimulator exited with code %d" % self.motsim_process.returncode)
- self.motsim_process = None
-
- def startCounterTimerSimulator_PopenStyle(self):
- """Starts the CounterTimer Simulator"""
-
- self.ctsim_process = subprocess.Popen(["python",
- self.ctsim_exec,
- self.ctsim_ds_instance],
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
-
- self.failIf(self.ctsim_process.stdout is None,
- "Was not able to grab CounterTimer Simulator output")
-
- self.ctsim_start_time = time.time()
- while 1:
- delta_time = time.time() - self.ctsim_start_time
-
- self.failIf(delta_time >= PoolTestCase.CounterTimerSimulatorMaxStartupTime,
- "CounterTimer Simulator startup time exceeded")
-
- line = self.ctsim_process.stdout.readline()
-
- if line.count(PoolTestCase.CounterTimerSimulatorReadyMsg) > 0:
- break
-
- self.failIfEqual(line, PoolTestCase.CounterTimerSimulatorAlreadyRunning,
- PoolTestCase.CounterTimerSimulatorAlreadyRunning)
- self.motsim_process = None
-
- def stopCounterTimerSimulator_PopenStyle(self):
- """Stops the CounterTimer Simulator"""
-
- self.ctsim_stop_time = time.time()
- if self.ctsim_process is None:
- return
-
- os.kill(self.ctsim_process.pid, signal.SIGINT)
-
- while self.ctsim_process.poll() is None:
- delta_time = time.time() - self.ctsim_stop_time
-
- if delta_time > PoolTestCase.CounterTimerSimulatorMaxShutdownTime:
- os.kill(self.ctsim_process.pid, signal.SIGKILL)
- self.assert_(False, "CounterTimerSimulator hangs: Forced to do a kill -9")
-
- time.sleep(0.2)
-
- self.failUnlessEqual(self.ctsim_process.returncode, 0,
- "MotorSimulator exited with code %d" % self.ctsim_process.returncode)
- self.ctsim_process = None
-
-
-class PoolTestResult(unittest.TestResult):
- """A test result class that can print formatted text results to a stream.
- """
-
- style = 'test'
- descStyle = 'testDescription'
- startedStyle = 'testStarted'
- successStyle = 'testSuccess'
- errorStyle = 'testError'
- failureStyle = 'testFailure'
-
- def __init__(self, stream, descriptions, verbosity):
- unittest.TestResult.__init__(self)
- self.stream = stream
- self.showAll = verbosity > 1
- self.dots = verbosity == 1
- self.descriptions = descriptions
- self.testsSucceeded = 0
-
- def getDescription(self, test):
- if self.descriptions:
- return test.shortDescription() or str(test)
- else:
- return str(test)
-
- def startTest(self, test):
- unittest.TestResult.startTest(self, test)
- s = self.stream
- desc = self.getDescription(test)
- descId = "desc%d" % self.testsRun
- statusId = "status%d" % self.testsRun
- s.write("<TR class='%s'>" \
- "<TD id='%s' class='%s'>%s</TD>" \
- "<TD id='%s' class='%s'>STARTED</TD>" %
- (self.style, descId, self.descStyle, desc,
- statusId, self.startedStyle))
- s.flush()
-
- def _addFinished(self):
- s = self.stream
- s.seek(-25,1)
- s.write("testFinished'>FINISHED</TD>")
- s.flush()
-
- def addSuccess(self, test):
- unittest.TestResult.addSuccess(self, test)
- self.testsSucceeded += 1
- s = self.stream
- resultId = "result%d" % self.testsRun
- self._addFinished()
- s.write("<TD id='%s' class='%s'>ok</TD>\n" % (resultId, self.successStyle))
- s.flush()
-
- def addError(self, test, err):
- unittest.TestResult.addError(self, test, err)
- s = self.stream
- resultId = "result%d" % self.testsRun
- self._addFinished()
- s.write("<TD id='%s' class='%s'>ERROR</TD>\n" % (resultId, self.errorStyle))
- s.flush()
-
- def addFailure(self, test, err):
- unittest.TestResult.addFailure(self, test, err)
- s = self.stream
- resultId = "result%d" % self.testsRun
- self._addFinished()
- s.write("<TD id='%s' class='%s'>FAIL</TD>\n" % (resultId, self.failureStyle))
- s.flush()
-
- def printErrors(self):
- s = self.stream
- s.write("<p><table class='test'>")
- s.write("<caption class='test'>Errors & Failures details</caption>")
- self.printErrorList("Errors", self.errors)
- self.printErrorList("Failures", self.failures)
- s.write("</table></p>")
-
- def printErrorList(self, flavour, errors):
- s = self.stream
- s.write("<tr><td class='summary%s'>%s</td></tr>" % (flavour, flavour))
- for test, err in errors:
- s.write("<tr><td class='summaryDescription'>%s</td></tr>" % self.getDescription(test))
- err = err.replace('<','&lt;').replace('>','&gt;').replace('\n','<br/>')
- s.write("<tr><td class='summaryDetails'>%s</td></tr>" % err)
-
-class PoolTestSuite(unittest.TestSuite):
- """A Pool Test Suite"""
- pass
-
-class PoolTestLoader(unittest.TestLoader):
- """A Pool Test Loader"""
- pass
-
-class PoolTestRunner(unittest.TextTestRunner):
- """A test runner class that displays results HTML.
- """
- css = "test.css"
-
- def _makeResult(self):
- return PoolTestResult(self.stream, self.descriptions, self.verbosity)
-
- def printHeader(self,t):
- s = self.stream
- time_str = time.ctime(t)
- s.write("<html><head><title>Pool test</title>\n" \
- "<meta http-equiv='refresh' content='2'>\n" \
- "<link rel='stylesheet' href='%s' type='text/css'/>\n" \
- "</head>\n<body>" \
- "<p><table class='info'>" \
- "<caption class='test'>Environment Summary</caption>" \
- "<tr><td>Start time:</td><td>%s</td></tr>" \
- "<tr><td>User name:</td><td>%s</td></tr>" \
- "<tr><td>uname:</td><td>%s</td></tr>" \
- "<tr><td>python:</td><td>%s</td></tr>" \
- "<tr><td>PyTango:</td><td>%s (%s)</td></tr>" \
- "</table></p>" \
- "<p><table class='test'>" \
- "<caption class='test'>Test Summary</caption>\n" \
- "<tr><th>Test</th><th width=100>Status</th><th width=100>Result</th></tr>\n" %
- (self.css,time_str, os.getlogin(), str(os.uname()),
- sys.version, PyTango.Release.version, PyTango.Release.version_description ) )
-
- s.flush()
-
- def run(self, test):
- "Run the given test case or test suite."
-
- result = self._makeResult()
-
- startTime = time.time()
- self.printHeader(startTime)
- test(result)
- stopTime = time.time()
-
- timeTaken = stopTime - startTime
-
- #result.printErrors()
- #self.stream.writeln(result.separator2)
- run = result.testsRun
-
- self.stream.write("<tr><td/><td class='testSummary' colspan='2'>" \
- "Ran %d test%s in %.3fs</td></tr>" %
- (run, run != 1 and "s" or "", timeTaken))
-
- failed, errored = map(len, (result.failures, result.errors))
- succeeded = result.testsSucceeded
-
- self.stream.write("<tr><td/><td colspan='2'>" \
- "<table><tr>" \
- "<td class='testsFailed'>%03d FAILED</td>"\
- "<td class='testsError'>%03d ERRORS</td>"\
- "<td class='testsSucceeded'>%03d SUCCEEDED</td>"\
- "</tr></table>\n" % (failed, errored, succeeded))
- self.stream.write("</table></p>")
-
- result.printErrors()
-
- self.stream.write("</body></html>")
- self.stream.flush()
- return result
-
-
-if __name__ == "__main__":
- unittest.main() \ No newline at end of file
diff --git a/test/setenv.sh b/test/setenv.sh
deleted file mode 100644
index fa7309c3..00000000
--- a/test/setenv.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-export PATH=/home/tiago/local/bin:$PATH
-export PYTHONPATH=/home/tiago/workspace/SimuMotor:/home/tiago/workspace/SimuMotorCtrl:/home/tiago/workspace/SimuCounter:/home/tiago/workspace/SimuCoTiCtrl:$PYTHONPATH
diff --git a/test/test.css b/test/test.css
deleted file mode 100644
index cb17890e..00000000
--- a/test/test.css
+++ /dev/null
@@ -1,43 +0,0 @@
-
-table.test {
- border-width: 3px;
- border-style: outset ;
- border-color: #BDBDBD;
- border-spacing: 2px;
- background-color: white;
- width : 100%;
- -moz-border-radius:9px; }
-
-table.info {
- border-width: 3px;
- border-style: outset ;
- border-color: #BDBDBD;
- border-spacing: 2px;
- background-color: white;
- width : 100%;
- -moz-border-radius:9px; }
-
-caption.test { height: 26px;
- background-color: #BDBDBD;
- color: white;
- border-style: outset;
- border-width: 2px;
- border-color: #BDBDBD;
- -moz-border-radius: 6px;}
-
-td.testDescription { height: 30px; background-color: white; color : black; }
-td.testStarted { height: 30px; width : 100px; background-color: white; color : black; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:inset; }
-td.testFinished { height: 30px; width : 100px; background-color: white; color : black; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; }
-td.testSuccess { height: 30px; width : 100px; background-color: green; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:green;}
-td.testError { height: 30px; width : 100px; background-color: orange; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:orange;}
-td.testFailure { height: 30px; width : 100px; background-color: red; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:red;}
-td.testSummary { height: 30px; width : 100px; background-color: #BDBDBD; color : black; -moz-border-radius: 6px; border-width:2px; border-style:outset; }
-
-td.testsSucceeded { background-color: green; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:green; }
-td.testsError { background-color: orange; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:orange; }
-td.testsFailed { background-color: red; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:red; }
-
-td.summaryErrors { background-color: orange; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:orange; }
-td.summaryFailures { background-color: red; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:red; }
-td.summaryDescription { background-color: blue; color : white; text-align : center; -moz-border-radius: 6px; border-width:2px; border-style:outset; border-color:blue; }
-td.summaryDetails { } \ No newline at end of file
diff --git a/test/test_ctrl/ElecMeter.py b/test/test_ctrl/ElecMeter.py
deleted file mode 100644
index 20835ee7..00000000
--- a/test/test_ctrl/ElecMeter.py
+++ /dev/null
@@ -1,98 +0,0 @@
-import PyTango
-import ZeroDController
-import time
-
-class ElecMeterController(ZeroDController.ZeroDController):
- "This class is the Tango Sardana Zero D controller for an Electrometer"
-
- ctrl_extra_attributes = {'Py0D_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Py0D_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'},
- 'Py0D_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}}
-
-# class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}}
-
- MaxDevice = 1
-
- def __init__(self,inst,props):
- ZeroDController.ZeroDController.__init__(self,inst,props)
- print "PYTHON -> ZeroDController ctor for instance",inst
-# raise NameError,"Ouuups"
-
- self.ct_name = "ZeroDController/" + self.inst_name
-# self.simu_ctrl = None
-# self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName)
-# self.started = False
-
-# try:
-# self.simu_ctrl.ping()
-# except:
-# self.simu_ctrl = None
-# raise
-
-
- def AddDevice(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In AddDevice method for index",ind
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In DeleteDevice method for index",ind
-
- def StateOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In StateOne method for index",ind
-# if self.simu_ctrl != None:
-# if self.started == True:
-# now = time.time()
-# delta_t = now - self.start_time
-# print "delta_t =",delta_t
-# if delta_t > 2.0:
-# self.simu_ctrl.command_inout("Stop",self.wantedCT[0])
-# self.started = False
-# sta = self.simu_ctrl.command_inout("GetCounterState",ind)
-# print "State in controller =",sta
-# tup = (sta,"Status error string from controller")
-# else:
-# raise RuntimeError,"Ctrl Tango's proxy null!!!"
- tup = (PyTango.DevState.ON,"Status error string from controller")
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadOne method for index",ind
-
- def ReadAll(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In ReadOne method for index",ind
-# if self.simu_ctrl != None:
-# return self.simu_ctrl.command_inout("GetCounterValue",ind)
-# else:
-# raise RuntimeError,"Ctrl Tango's proxy null!!!"
- return 1.234
-
- def GetExtraAttributePar(self,ind,name):
- print "PYTHON -> ZeroDController/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name
- if name == "Py0D_extra_1":
- return 88.99
-
- if name == "Py0D_extra_2":
- return 33
- return 2233
-
- def SetExtraAttributePar(self,ind,name,value):
- print "PYTHON -> ZeroDController/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def __del__(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": Aarrrrrg, I am dying"
-
-
-if __name__ == "__main__":
- obj = ZeroDController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/ElecMeter_init.py b/test/test_ctrl/ElecMeter_init.py
deleted file mode 100644
index a990a38f..00000000
--- a/test/test_ctrl/ElecMeter_init.py
+++ /dev/null
@@ -1,105 +0,0 @@
-import PyTango
-import ZeroDController
-import time
-
-nb_call = 0
-
-class ElecMeterController(ZeroDController.ZeroDController):
- "This class is the Tango Sardana Zero D controller for an Electrometer"
-
- ctrl_extra_attributes = {'Py0D_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Py0D_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'},
- 'Py0D_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}}
-
-# class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}}
-
- MaxDevice = 1
-
- def __init__(self,inst,props):
- ZeroDController.ZeroDController.__init__(self,inst,props)
- print "PYTHON -> ZeroDController ctor for instance",inst
-
- global nb_call
-
- if nb_call <= 1:
- nb_call = nb_call + 1
- raise NameError,"Aille Aille Aille"
-
- self.ct_name = "ZeroDController/" + self.inst_name
-# self.simu_ctrl = None
-# self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName)
-# self.started = False
-
-# try:
-# self.simu_ctrl.ping()
-# except:
-# self.simu_ctrl = None
-# raise
-
-
- def AddDevice(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In AddDevice method for index",ind
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In DeleteDevice method for index",ind
-
- def StateOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In StateOne method for index",ind
-# if self.simu_ctrl != None:
-# if self.started == True:
-# now = time.time()
-# delta_t = now - self.start_time
-# print "delta_t =",delta_t
-# if delta_t > 2.0:
-# self.simu_ctrl.command_inout("Stop",self.wantedCT[0])
-# self.started = False
-# sta = self.simu_ctrl.command_inout("GetCounterState",ind)
-# print "State in controller =",sta
-# tup = (sta,"Status error string from controller")
-# else:
-# raise RuntimeError,"Ctrl Tango's proxy null!!!"
- tup = (PyTango.DevState.ON,"Status error string from controller")
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadOne method for index",ind
-
- def ReadAll(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In ReadOne method for index",ind
-# if self.simu_ctrl != None:
-# return self.simu_ctrl.command_inout("GetCounterValue",ind)
-# else:
-# raise RuntimeError,"Ctrl Tango's proxy null!!!"
- return 1.234
-
- def GetExtraAttributePar(self,ind,name):
- print "PYTHON -> ZeroDController/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name
- if name == "Py0D_extra_1":
- return 88.99
-
- if name == "Py0D_extra_2":
- return 33
- return 2233
-
- def SetExtraAttributePar(self,ind,name,value):
- print "PYTHON -> ZeroDController/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def __del__(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": Aarrrrrg, I am dying"
-
-
-if __name__ == "__main__":
- obj = ZeroDController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/ElecMeter_syn.py b/test/test_ctrl/ElecMeter_syn.py
deleted file mode 100644
index ad0dc963..00000000
--- a/test/test_ctrl/ElecMeter_syn.py
+++ /dev/null
@@ -1,98 +0,0 @@
-import PyTango
-import ZeroDController
-import time
-
-class ElecMeterController(ZeroDController.ZeroDController):
- "This class is the Tango Sardana Zero D controller for an Electrometer"
-
- ctrl_extra_attributes = {'Py0D_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Py0D_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'},
- 'Py0D_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}}
-
-# class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}}
-
- MaxDevice = 1
-
- def __init__(self,inst,props):
- ZeroDController.ZeroDController.__init__(self,inst,props)
- print "PYTHON -> ZeroDController ctor for instance",inst
-# raise NameError,"Ouuups"
-
- self.ct_name = "ZeroDController/" + self.inst_name
-# self.simu_ctrl = None
-# self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName)
-# self.started = False
-
-# try:
-# self.simu_ctrl.ping()
-# except:
-# self.simu_ctrl = None
-# raise
-
-
- def AddDevice(self,ind)
- print "PYTHON -> ZeroDController/",self.inst_name,": In AddDevice method for index",ind
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In DeleteDevice method for index",ind
-
- def StateOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In StateOne method for index",ind
-# if self.simu_ctrl != None:
-# if self.started == True:
-# now = time.time()
-# delta_t = now - self.start_time
-# print "delta_t =",delta_t
-# if delta_t > 2.0:
-# self.simu_ctrl.command_inout("Stop",self.wantedCT[0])
-# self.started = False
-# sta = self.simu_ctrl.command_inout("GetCounterState",ind)
-# print "State in controller =",sta
-# tup = (sta,"Status error string from controller")
-# else:
-# raise RuntimeError,"Ctrl Tango's proxy null!!!"
- tup = (PyTango.DevState.ON,"Status error string from controller")
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In PreReadOne method for index",ind
-
- def ReadAll(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,ind):
- print "PYTHON -> ZeroDController/",self.inst_name,": In ReadOne method for index",ind
-# if self.simu_ctrl != None:
-# return self.simu_ctrl.command_inout("GetCounterValue",ind)
-# else:
-# raise RuntimeError,"Ctrl Tango's proxy null!!!"
- return 1.234
-
- def GetExtraAttributePar(self,ind,name):
- print "PYTHON -> ZeroDController/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name
- if name == "Py0D_extra_1":
- return 88.99
-
- if name == "Py0D_extra_2":
- return 33
- return 2233
-
- def SetExtraAttributePar(self,ind,name,value):
- print "PYTHON -> ZeroDController/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def __del__(self):
- print "PYTHON -> ZeroDController/",self.inst_name,": Aarrrrrg, I am dying"
-
-
-if __name__ == "__main__":
- obj = ZeroDController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/FirePapCtrl.py b/test/test_ctrl/FirePapCtrl.py
deleted file mode 100644
index d3585a8f..00000000
--- a/test/test_ctrl/FirePapCtrl.py
+++ /dev/null
@@ -1,130 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class FirePapController(MotorController.MotorController):
- def __init__(self,inst,props):
- print "PYTHON -> FirePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
-
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "FirePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> FirePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> FirePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> FirePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> FirePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> FirePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> FirePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> FirePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> FirePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> FirePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> FirePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> FirePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> FirePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> FirePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> FirePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Firepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from FirePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> FirePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/Vct6Ctrl.py b/test/test_ctrl/Vct6Ctrl.py
deleted file mode 100644
index 4d17fe9a..00000000
--- a/test/test_ctrl/Vct6Ctrl.py
+++ /dev/null
@@ -1,146 +0,0 @@
-import PyTango
-import CounterTimerController
-import time
-
-class Vct6Controller(CounterTimerController.CounterTimerController):
- "This class is the Tango Sardana CounterTimer controller for the VCT6"
-
- ctrl_extra_attributes = {'PyCT_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'PyCT_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'},
- 'PyCT_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}}
-
- class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}}
-
- MaxDevice = 6
-
- def __init__(self,inst,props):
- CounterTimerController.CounterTimerController.__init__(self,inst,props)
- print "PYTHON -> Vct6Controller ctor for instance",inst
-# raise NameError,"Ouuups"
-
- self.ct_name = "Vct6Controller/" + self.inst_name
- self.simu_ctrl = None
- self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName)
- self.started = False
-
- self.dft_PyCT_extra_1 = 88.99
- self.dft_PyCT_extra_2 = 33
- self.dft_PyCT_extra_3 = True
-
- self.PyCT_extra_1 = []
- self.PyCT_extra_2 = []
- self.PyCT_extra_3 = []
-
- try:
- self.simu_ctrl.ping()
- except:
- self.simu_ctrl = None
- raise
-
-
- def AddDevice(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In AddDevice method for index",ind
- self.PyCT_extra_1.append(self.dft_PyCT_extra_1)
- self.PyCT_extra_2.append(self.dft_PyCT_extra_2)
- self.PyCT_extra_3.append(self.dft_PyCT_extra_3)
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In DeleteDevice method for index",ind
-
- def StateOne(self,ind):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In StateOne method for index",ind
- if self.simu_ctrl != None:
- if self.started == True:
- now = time.time()
- delta_t = now - self.start_time
- print "delta_t =",delta_t
- if delta_t > 2.0:
- for index in self.wantedCT:
- self.simu_ctrl.command_inout("Stop",index)
- self.started = False
- sta = self.simu_ctrl.command_inout("GetCounterState",ind)
- #print "State in controller =",sta
- tup = (sta,"Status error string from controller")
- else:
- raise RuntimeError,"Ctrl Tango's proxy null!!!"
- return tup
-
- def PreReadAll(self):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadAll method"
- pass
-
-
- def PreReadOne(self,ind):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadOne method for index",ind
- pass
-
- def ReadAll(self):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadAll method"
- pass
-
- def ReadOne(self,ind):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadOne method for index",ind
- pass
- if self.simu_ctrl != None:
- return self.simu_ctrl.command_inout("GetCounterValue",ind)
- else:
- raise RuntimeError,"Ctrl Tango's proxy null!!!"
-
- def AbortOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In AbortOne method for index",ind
- if self.simu_ctrl != None:
- self.simu_ctrl.command_inout("Stop",ind)
- self.started = False
- else:
- raise RuntimeError,"Ctrl Tango's proxy null!!!"
-
- def PreStartAllCT(self):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In PreStartAllCT method"
- self.wantedCT = []
-
- def StartOneCT(self,ind):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In StartOneCT method for index",ind
- self.wantedCT.append(ind)
-
- def StartAllCT(self):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In StartAllCT method"
- for index in self.wantedCT:
- self.simu_ctrl.command_inout("Start",index)
- self.started = True
- self.start_time = time.time()
-
- def LoadOne(self,ind,value):
- #print "PYTHON -> Vct6Controller/",self.inst_name,": In LoadOne method for index",ind," with value",value
- if self.simu_ctrl != None:
- self.simu_ctrl.command_inout("Clear",ind)
- else:
- raise RuntimeError,"Ctrl Tango's proxy null!!!"
-
- def GetExtraAttributePar(self,ind,name):
- if name == "PyCT_extra_1":
- return self.PyCT_extra_1[ind]
- if name == "PyCT_extra_2":
- return self.PyCT_extra_2[ind]
- return self.PyCT_extra_3[ind]
-
- def SetExtraAttributePar(self,ind,name,value):
- if name == "PyCT_extra_1":
- self.PyCT_extra_1[ind] = value
- elif name == "PyCT_extra_2":
- self.PyCT_extra_2[ind] = value
- else:
- self.PyCT_extra_3[ind] = value
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def __del__(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": Aarrrrrg, I am dying"
-
-
-if __name__ == "__main__":
- obj = Vct6Controller('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/Vct6Ctrl_init.py b/test/test_ctrl/Vct6Ctrl_init.py
deleted file mode 100644
index 45dee8b2..00000000
--- a/test/test_ctrl/Vct6Ctrl_init.py
+++ /dev/null
@@ -1,97 +0,0 @@
-import PyTango
-import CounterTimerController
-
-nb_call = 0
-
-class Vct6Controller(CounterTimerController.CounterTimerController):
- "This class is the Tango Sardana CounterTimer controller for the VCT6"
-
- ctrl_extra_attributes = {'PyCT_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'PyCT_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'},
- 'PyCT_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}}
-
- class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}}
-
- MaxDevice = 6
-
- def __init__(self,inst,props):
- CounterTimerController.CounterTimerController.__init__(self,inst,props)
- print "PYTHON -> Vct6Controller ctor for instance",inst
-
- global nb_call
-
- if nb_call <= 1:
- nb_call = nb_call + 1
- raise NameError,"Ouuups"
-
- self.ct_name = "Vct6Controller/" + self.inst_name
- self.simu_ctrl = None
- self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName)
-
- try:
- self.simu_ctrl.ping()
- except:
- self.simu_ctrl = None
- raise
-
-
- def AddDevice(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In AddDevice method for index",ind
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In DeleteDevice method for index",ind
-
- def StateOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In StateOne method for index",ind
- if self.simu_ctrl != None:
- sta = self.simu_ctrl.command_inout("GetCounterState",ind)
- print "State in controller =",sta
- tup = (sta,"Status error string from controller")
- else:
- raise RuntimeError,"Ctrl Tango's proxy null!!!"
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadOne method for index",ind
-
- def ReadAll(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadOne method for index",ind
- return 123
-
- def GetExtraAttributePar(self,ind,name):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name
- if name == "PyCT_extra_1":
- return 88.99
-
- if name == "PyCT_extra_2":
- return 33
- return 2233
-
- def SetExtraAttributePar(self,ind,name,value):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def StartOneCT(self,ind):
- print "In StartOneCT"
-
- def LoadAll():
- print "In LoadAll"
-
- def __del__(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": Aarrrrrg, I am dying"
-
-
-if __name__ == "__main__":
- obj = Vct6Controller('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/Vct6Ctrl_syn.py b/test/test_ctrl/Vct6Ctrl_syn.py
deleted file mode 100644
index 87069717..00000000
--- a/test/test_ctrl/Vct6Ctrl_syn.py
+++ /dev/null
@@ -1,84 +0,0 @@
-import PyTango
-import CounterTimerController
-
-class Vct6Controller(CounterTimerController.CounterTimerController):
- "This class is the Tango Sardana CounterTimer controller for the VCT6"
-
- ctrl_extra_attributes = {'PyCT_extra_1':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'PyCT_extra_2':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'},
- 'PyCT_extra_3':{'Type':'PyTango.DevBoolean','R/W Type':'PyTango.READ'}}
-
- class_prop = {'CtrlDevName':{'Type':'PyTango.DevString','Description':'The ctrl simulator Tango device name'}}
-
- MaxDevice = 6
-
- def __init__(self,inst,props):
- CounterTimerController.CounterTimerController.__init__(self,inst,props)
- print "PYTHON -> Vct6Controller ctor for instance",inst
-# raise NameError,"Ouuups"
-
- self.ct_name = "Vct6Controller/" + self.inst_name
- self.simu_ctrl = None
- self.simu_ctrl = PyTango.DeviceProxy(self.CtrlDevName)
-
- try
- self.simu_ctrl.ping()
- except:
- self.simu_ctrl = None
- raise
-
-
- def AddDevice(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In AddDevice method for index",ind
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In DeleteDevice method for index",ind
-
- def StateOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In StateOne method for index",ind
- if self.simu_ctrl != None:
- sta = self.simu_ctrl.command_inout("GetCounterState",ind)
- print "State in controller =",sta
- tup = (sta,"Status error string from controller")
- else:
- raise RuntimeError,"Ctrl Tango's proxy null!!!"
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In PreReadOne method for index",ind
-
- def ReadAll(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,ind):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In ReadOne method for index",ind
- return 123
-
- def GetExtraAttributePar(self,ind,name):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In GetExtraFeaturePar method for index",ind," name=",name
- if name == "PyCT_extra_1":
- return 88.99
-
- if name == "PyCT_extra_2":
- return 33
- return 2233
-
- def SetExtraAttributePar(self,ind,name,value):
- print "PYTHON -> Vct6Controller/",self.inst_name,": In SetExtraFeaturePar method for index",ind," name=",name," value=",value
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def __del__(self):
- print "PYTHON -> Vct6Controller/",self.inst_name,": Aarrrrrg, I am dying"
-
-
-if __name__ == "__main__":
- obj = Vct6Controller('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl.py b/test/test_ctrl/WaterPapCtrl.py
deleted file mode 100644
index ffc95303..00000000
--- a/test/test_ctrl/WaterPapCtrl.py
+++ /dev/null
@@ -1,162 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
- "This class is the Tango Sardana motor controller for the ICEPAP"
-
- ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}}
-# 'Aaa':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'}}
-
- ctrl_features = ['Encoder','Home_speed','Home_acceleration']
-
- MaxDevice = 10
-
- def __init__(self,inst,props):
- MotorController.MotorController.__init__(self,inst,props)
- print "PYTHON -> IcePapController ctor for instance",inst
-
- self.home_speed = 0.0
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def GetExtraAttributePar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetExtraFeaturePar method for axis",axis," name=",name
- return 2233
-
- def SetExtraAttributePar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetExtraFeaturePar method for axis",axis," name=",name," value=",value
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def SendToCtrl(self,in_data):
- print "Received value =",in_data
- return "Adios"
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_init.py b/test/test_ctrl/WaterPapCtrl_init.py
deleted file mode 100644
index 176d7c5e..00000000
--- a/test/test_ctrl/WaterPapCtrl_init.py
+++ /dev/null
@@ -1,148 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-nb_call = 0
-
-class IcePapController(MotorController.MotorController):
-
- MaxDevice = 4
-
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
- global nb_call
-
- if nb_call <= 1:
- nb_call = nb_call + 1
- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.settimeout(self.timeout)
- self.sock.connect((self.host, self.port))
- self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_mis.py b/test/test_ctrl/WaterPapCtrl_mis.py
deleted file mode 100644
index a0323eb1..00000000
--- a/test/test_ctrl/WaterPapCtrl_mis.py
+++ /dev/null
@@ -1,134 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_mis_extra.py b/test/test_ctrl/WaterPapCtrl_mis_extra.py
deleted file mode 100644
index ad9f9b9b..00000000
--- a/test/test_ctrl/WaterPapCtrl_mis_extra.py
+++ /dev/null
@@ -1,144 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
-
- ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}}
- MaxDevice = 12
-
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_mis_feat.py b/test/test_ctrl/WaterPapCtrl_mis_feat.py
deleted file mode 100644
index 284166f9..00000000
--- a/test/test_ctrl/WaterPapCtrl_mis_feat.py
+++ /dev/null
@@ -1,147 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
-
- ctrl_features = ['Encoder','CanDoBacklash']
-
- ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}}
-
- MaxDevice = 11
-
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_prop.py b/test/test_ctrl/WaterPapCtrl_prop.py
deleted file mode 100644
index 1cbee513..00000000
--- a/test/test_ctrl/WaterPapCtrl_prop.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
- "This class is the Tango Sardana motor controller for the ICEPAP with properties"
-
- ctrl_features = ['Encoder','Home_speed','Home_acceleration']
-
- class_prop = {'A_Class_Prop':{'Type':'PyTango.DevLong','Description':'A class property','DefaultValue':20},
- 'Another_Class_Prop':{'Type':'PyTango.DevDouble','Description':'Bla bla bla','DefaultValue':2.345},
- 'Host':{'Type':'PyTango.DevString','Description':'The host name'},
- 'Port':{'Type':'PyTango.DevLong','Description':'The port number'}}
-
- ctrl_extra_attributes = {'First_extra':{'Type':'PyTango.DevDouble','R/W Type':'PyTango.READ_WRITE'},
- 'Second_extra':{'Type':'PyTango.DevLong','R/W Type':'PyTango.READ'}}
- MaxDevice = 22
-
- def __init__(self,inst,props):
- MotorController.MotorController.__init__(self,inst,props)
- print "PYTHON -> IcePapController ctor for instance",inst
-
- self.home_speed = 0.0
- self.nb_call = 0;
- self.timeout = 3
-
- print "PYTHON -> IcePap on",self.Host," and port",self.Port," with timeout = ",self.timeout
- print "PYTHON -> Connected to", self.Host, " on port", self.Port
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def GetExtraAttributePar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetExtraAttributePar method for axis",axis," name=",name
- return 2233
-
- def SetExtraAttributePar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetExtraAttributePar method for axis",axis," name=",name," value=",value
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-if __name__ == "__main__":
- obj = IcePapController('test')
diff --git a/test/test_ctrl/WaterPapCtrl_stat1.py b/test/test_ctrl/WaterPapCtrl_stat1.py
deleted file mode 100644
index 352c6ca4..00000000
--- a/test/test_ctrl/WaterPapCtrl_stat1.py
+++ /dev/null
@@ -1,142 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
-
- MaxDevice = 6
-
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.FAULT,0,"Hola tio")
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_stat2.py b/test/test_ctrl/WaterPapCtrl_stat2.py
deleted file mode 100644
index 5c3ef17e..00000000
--- a/test/test_ctrl/WaterPapCtrl_stat2.py
+++ /dev/null
@@ -1,142 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
-
- MaxDevice = 7
-
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0:
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.FAULT,0,"Hola mujeres de Barcelona")
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)
diff --git a/test/test_ctrl/WaterPapCtrl_syn.py b/test/test_ctrl/WaterPapCtrl_syn.py
deleted file mode 100644
index 45a2351d..00000000
--- a/test/test_ctrl/WaterPapCtrl_syn.py
+++ /dev/null
@@ -1,139 +0,0 @@
-import PyTango
-import socket
-import MotorController
-
-class IcePapController(MotorController.MotorController):
- def __init__(self,inst,props):
- print "PYTHON -> IcePapController ctor for instance",inst
- MotorController.MotorController.__init__(self,inst,props)
- self.nb_call = 0;
- self.socket_connected = False;
- self.db = PyTango.Database()
- self.ct_name = "IcePapController/" + self.inst_name
-
-#
-# Get controller properties
-#
-
- prop_list = ['host','port','timeout']
- prop = self.db.get_property(self.ct_name,prop_list)
-
- if len(prop["host"]) != 0
- self.host = prop["host"][0]
- else:
- print "Property host not defined for controller",self.ct_name
- self.host = "nada"
-
- if len(prop["port"]) != 0:
- self.port = int(prop["port"][0])
- else:
- print "Property port not defined for controller",self.ct_name
- self.port = 0
-
- if len(prop["timeout"]) != 0:
- self.timeout = int(prop["timeout"][0])
- else:
- print "Property timeout not defined for controller",self.ct_name
- self.timeout = 3
-
- #
- # Connect to the icepap
- #
-
- print "PYTHON -> IcePap on",self.host," and port",self.port," with timeout = ",self.timeout
-
-# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-# self.sock.settimeout(self.timeout)
-# self.sock.connect(("icepap", self.port))
-# self.socket_connected = True
-
- print "PYTHON -> Connected to", self.host, " on port", self.port
-
-#
-# Check that the Icepap is OK
-#
-
-# ans = self.IceWriteRead("?ID")
-
-
- def AddDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In AddDevice method for axis",axis
-# raise RuntimeError,"Hola la la"
-
- def DeleteDevice(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In DeleteDevice method for axis",axis
-
- def StateOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In StateOne method for axis",axis
- tup = (PyTango.DevState.ON,0)
- return tup
-
- def PreReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadAll method"
-
- def PreReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreReadOne method for axis",axis
-
- def ReadAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadAll method"
-
- def ReadOne(self,axis):
- print "PYTHON -> IcePapController/",self.inst_name,": In ReadOne method for axis",axis
- return 123
-
- def PreStartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartAll method"
-
- def PreStartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In PreStartOne method for axis",axis," with pos",pos
- return True
-
- def StartOne(self,axis,pos):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartOne method for axis",axis," with pos",pos
-
- def StartAll(self):
- print "PYTHON -> IcePapController/",self.inst_name,": In StartAll method"
-
- def SetPar(self,axis,name,value):
- print "PYTHON -> IcePapController/",self.inst_name,": In SetPar method for axis",axis," name=",name," value=",value
-
- def GetPar(self,axis,name):
- print "PYTHON -> IcePapController/",self.inst_name,": In GetPar method for axis",axis," name=",name
- return 12.34
-
- def IceWrite(self,data):
- data = data + "\n"
- byteSent = self.sock.send(data)
- print "PYTHON -> Sent", byteSent, "bytes to icepap"
-
- def IceWriteRead(self,data):
- self.IceWrite(data)
- byteReceived = self.sock.recv(1024)
- print "PYTHON -> Icepap answered:",byteReceived
- return byteReceived
-
- def IceResetFifo(self):
- self.IceWrite("fiforst")
-
- def IceCheckError(self,ice_answer):
- if (ice_answer.find("ERROR") != -1):
- new_ans = self.IceWriteRead("?ERR 1")
- print "Error from IcePap =",new_ans
-
- def __del__(self):
- print "PYTHON -> IcePapController/",self.inst_name,": Aarrrrrg, I am dying"
-
-#
-# Reset IcePap FIFO
-#
-
- if (self.socket_connected == True):
- print "PYTHON -> Closing connection"
- self.IceResetFifo()
- self.sock.close()
-
-
-if __name__ == "__main__":
- obj = IcePapController('test')
-# obj.AddDevice(2)
-# obj.DeleteDevice(2)