[pytango] 309/483: prepare doc for 8.1.1

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit 1ebc92326813d9a829cd40311596fbd8cc64643b
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Thu Nov 21 16:22:14 2013 +0000

    prepare doc for 8.1.1
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@24329 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 doc/_static/banner2.png      | Bin 53657 -> 0 bytes
 doc/_static/slideshow.js     |  16 ++--
 doc/_templates/index.html    | 161 ++++++++++++++++++++++++++++---
 doc/client/miscellaneous.rst |   5 +-
 doc/conf.py                  |  11 +++
 doc/quicktour.rst            |   8 +-
 doc/revision.rst             |   2 +
 doc/server/server.rst        | 223 ++-----------------------------------------
 8 files changed, 186 insertions(+), 240 deletions(-)

diff --git a/doc/_static/banner2.png b/doc/_static/banner2.png
deleted file mode 100644
index c60e785..0000000
Binary files a/doc/_static/banner2.png and /dev/null differ
diff --git a/doc/_static/slideshow.js b/doc/_static/slideshow.js
index d920f56..1b920c3 100644
--- a/doc/_static/slideshow.js
+++ b/doc/_static/slideshow.js
@@ -1,20 +1,22 @@
 $(document).ready(function() 
 {
+    // Constants to be redefined
     var FADE_TIME = 250;
     var IMAGE_TIME = 5000;
+
     var curr_index = 0;
-    var images = $("#gallery img");
-    images.hide()
-    if (images.length > 0)
+    var elements = $("#gallery").children();
+    elements.hide()
+    if (elements.length > 0)
     { 
-	images.eq(0).show();
+	elements.eq(0).show();
     }
     var slideshow_timer = setInterval(switch_image, IMAGE_TIME);
     
     function switch_image()
     {
 	old_index = curr_index;
-	if (curr_index < (images.length-1)) {
+	if (curr_index < (elements.length-1)) {
 	    curr_index += 1; 
 	}
 	else {
@@ -25,7 +27,7 @@ $(document).ready(function()
     
     function show_hide(show_index, hide_index)
     {
-	images.eq(hide_index).fadeOut(FADE_TIME);
-	images.eq(show_index).delay(FADE_TIME+100).fadeIn(FADE_TIME);
+	elements.eq(hide_index).fadeOut(FADE_TIME);
+	elements.eq(show_index).delay(FADE_TIME+100).fadeIn(FADE_TIME);
     }
 });
diff --git a/doc/_templates/index.html b/doc/_templates/index.html
index 822d4cf..1ed166b 100644
--- a/doc/_templates/index.html
+++ b/doc/_templates/index.html
@@ -1,10 +1,7 @@
 {% extends "layout.html" %}
 {% set title = 'PyTango documentation' %}
-{% set script_files = script_files + ["_static/galleria/galleria-1.3.2.js",
-                                      "_static/galleria_index.js",
-                                      "_static/galleria/themes/classic/galleria.classic.min.js"] %}
-{% set css_files = css_files + ["_static/galleria/themes/classic/galleria.classic.css",
-                                "_static/galleria_index.css"] %}
+
+{% set script_files = script_files + ["_static/slideshow.js"] %}
 
 {% block body %}
 
@@ -18,19 +15,159 @@
   of this in pure python.
 </p>
 
-<div class="galleria"/>
+<div id="gallery" style="width:780px; height:525px; margin:auto;">
+
+  <!-- 1st snap -->
+  <img src="_static/banner1.png" />
+  <!-- 2nd snap -->
+  <img src="_static/banner2.png" />
+
+  <!-- 3rd snap -->
+  <table style="width:100%;"><tr>
+  <td>
+
+<div class="highlight-python"><div class="highlight"><pre>
+<span class="c"># ----------------- server ------------------</span>
+
+<span class="kn">import</span> <span class="nn">time</span>
+
+<span class="kn">from</span> <span class="nn">PyTango.server</span> <span class="kn">import</span> <span class="n">server_run</span>
+<span class="kn">from</span> <span class="nn">PyTango.server</span> <span class="kn">import</span> <span class="n">Device</span><span class="p">,</span> <span class="n">DeviceMeta</span>
+<span class="kn">from</span> <span class="nn">PyTango.server</span> <span class="kn">import</span> <span class="n">attribute</span><span class="p">,</span> <span class="n">command</span>
+
+
+<span class="k">class</span> <span class="nc">Clock</span><span class="p">(</span><span class="n">Device</span><span class="p">):</span>
+    <span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">DeviceMeta</span>
+
+    <span class="n">time</span> <span class="o">=</span> <span class="n">attribute</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">read_time</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+
+    <span class="nd">@command</span><span class="p">(</span><span class="n">dtype_in</span><span class="o">=</span><span class="nb">str</span><span class="p">,</span> <span class="n">dtype_out</span><span class="o">=</span><span class="nb">str</span><span class="p">)</span>
+    <span class="k">def</span> <span class="nf">strftime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tformat</span><span class="p">):</span>
+        <span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="n">tformat</span><span class="p">)</span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span>
+    <span class="n">server_run</span><span class="p">((</span><span class="n">Clock</span><span class="p">,))</span>
+</pre></div>
+</div>
+
+  </td>
+  <td>
+
+<div class="highlight-python"><div class="highlight"><pre>
+<span class="c">$ # ---------------- client -----------------</span>
+
+<span class="n">$ python</span>
+
+<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">PyTango</span> <span class="kn">import</span> <span class="n">DeviceProxy</span>
+
+<span class="gp">>>> </span><span class="n">clock</span> <span class="o">=</span> <span class="n">DeviceProxy</span><span class="p">(</span><span class="s">"my/first/clock"</span><span class="p">)</span>
+
+<span class="gp">>>> </span><span class="n">clock</span><span class="o">.</span><span class="n">time</span>
+<span class="go">1384447223.774121</span>
+
+<span class="gp">>>> </span><span class="n">clock</span><span class="o">.</span><span class="n">read_attribute</span><span class="p">(</span><span class="s">"time"</span><span class="p">)</span><span class="o">.</span><span class="n">value</span>
+<span class="go">1384447252.037578</span>
+
+<span class="gp">>>> </span><span class="n">clock</span><span class="o">.</span><span class="n">command_inout</span><span class="p">(</span><span class="s">"strftime"</span><span class="p">,</span>
+<span class="gp">... </span>                    <span class="s">"%H:%M:%S"</span><span class="p">)</span>
+<span class="go">'17:41:50'</span>
+
+<span class="gp">>>> </span><span class="n">clock</span><span class="o">.</span><span class="n">status</span><span class="p">()</span>
+<span class="go">The device is in UNKNOWN state.</span>
+
 
-<script>
-  Galleria.run(".galleria", config);
-</script>
+
+</pre></div>
+</div>
+
+  </td>
+  </tr></table>
+
+  <!-- 4th snap -->
+  <table style="width:100%;"><tr>
+  <td>
+
+<div class="highlight-python"><div class="highlight"><pre>
+<span class="gp">>>> </span><span class="c"># ---------- gevent client -----------</span>
+<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">PyTango.gevent</span> <span class="kn">import</span> <span class="n">DeviceProxy</span>
+
+<span class="gp">>>> </span><span class="n">dev</span> <span class="o">=</span> <span class="n">DeviceProxy</span><span class="p">(</span><span class="s">"sys/tg_test/1"</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="n">dev</span><span class="o">.</span><span class="n">get_green_mode</span><span class="p">()</span>
+<span class="go">PyTango.GreenMode.Gevent</span>
+
+<span class="gp">>>> </span><span class="c"># Synchronous but green!</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">dev</span><span class="o">.</span><span class="n">state</span><span class="p">())</span>
+<span class="go">RUNNING</span>
+
+<span class="gp">>>> </span><span class="c"># Asynchronous</span>
+<span class="gp">>>> </span><span class="n">res</span> <span class="o">=</span> <span class="n">dev</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="n">wait</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
+<span class="go"><gevent.event.AsyncResult at 0x1a74050></span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">get</span><span class="p">())</span>
+<span class="go">RUNNING</span>
+
+<span class="gp">>>> </span><span class="c"># Synchronous, but green!</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">dev</span><span class="o">.</span><span class="n">long_scalar</span><span class="p">)</span>
+<span class="go">832</span>
+
+<span class="gp">>>> </span><span class="c"># Asynchronous</span>
+<span class="gp">>>> </span><span class="n">res</span> <span class="o">=</span> <span class="n">dev</span><span class="o">.</span><span class="n">read_attribute</span><span class="p">(</span><span class="s">"long_scalar"</span><span class="p">,</span>
+<span class="gp">... </span>                         <span class="n">wait</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
+<span class="go"><gevent.event.AsyncResult at 0x1a9f54></span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">get</span><span class="p">())</span>
+<span class="go">126</span>
+</pre></div>
+</div>
+
+  </td>
+  <td>
+
+<div class="highlight-python"><div class="highlight"><pre>
+<span class="gp">>>> </span><span class="c"># ----- concurrent.futures client -----</span>
+<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">PyTango.futures</span> <span class="kn">import</span> <span class="n">DeviceProxy</span>
+
+<span class="gp">>>> </span><span class="n">dev</span> <span class="o">=</span> <span class="n">DeviceProxy</span><span class="p">(</span><span class="s">"sys/tg_test/1"</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="n">dev</span><span class="o">.</span><span class="n">get_green_mode</span><span class="p">()</span>
+<span class="go">PyTango.GreenMode.Futures</span>
+
+<span class="gp">>>> </span><span class="c"># Synchronous</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">dev</span><span class="o">.</span><span class="n">state</span><span class="p">())</span>
+<span class="go">RUNNING</span>
+
+<span class="gp">>>> </span><span class="c"># Asynchronous</span>
+<span class="gp">>>> </span><span class="n">res</span> <span class="o">=</span> <span class="n">dev</span><span class="o">.</span><span class="n">state</span><span class="p">(</span><span class="n">wait</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
+<span class="go"><Future at 0x34a9e51 state=pending></span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">result</span><span class="p">())</span>
+<span class="go">RUNNING</span>
+
+<span class="gp">>>> </span><span class="c"># Synchronous</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">dev</span><span class="o">.</span><span class="n">long_scalar</span><span class="p">)</span>
+<span class="go">832</span>
+
+<span class="gp">>>> </span><span class="c"># Asynchronous</span>
+<span class="gp">>>> </span><span class="n">res</span> <span class="o">=</span> <span class="n">dev</span><span class="o">.</span><span class="n">read_attribute</span><span class="p">(</span><span class="s">"long_scalar"</span><span class="p">,</span>
+<span class="gp">... </span>                         <span class="n">wait</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
+<span class="go"><Future at 0x5d8a17b state=pending></span>
+<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">result</span><span class="p">())</span>
+<span class="go">126</span>
+</pre></div>
+</div>
+
+  </td>
+  </tr></table>
+
+</div>
 
 <p>
     Check out the <a class="reference internal" href="start.html#getting-started"><em>getting started guide</em></a>
     to learn how to build and/or install PyTango and after that the <a class="reference internal" href="quicktour.html#quick-tour"><em>quick tour</em></a>
     can help you with the first steps in the PyTango world.
-</p>
-
-<p>
     If you need help understanding what Tango itself really is, you can check the
     <a class="reference external" href="http://www.tango-controls.org/">Tango</a>
     homepage where you will find plenty of documentation, FAQ and tutorials.
diff --git a/doc/client/miscellaneous.rst b/doc/client/miscellaneous.rst
index 599f635..66c183e 100644
--- a/doc/client/miscellaneous.rst
+++ b/doc/client/miscellaneous.rst
@@ -12,7 +12,7 @@ module. The :obj:`~PyTango.GreenMode.Futures` uses the standard python module
 :mod:`concurrent.futures`.
 
 You can set the PyTango green mode at a global level. Set the environment
-variable :envvar:`PYTANGO_GREEN_MODE` to either gevent or futures
+variable :envvar:`PYTANGO_GREEN_MODE` to either gevent_ or futures
 (case incensitive). If this environment variable is not defined the PyTango
 global green mode defaults to *Synchronous*.
 
@@ -21,6 +21,8 @@ in a green cooperative way. If the work is found to be useful, the same can
 be implemented in the future for :class:`AttributeProxy` and even 
 to :class:`Database`.
 
+
+
 You can also change the active global green mode at any time in your program::
 
     >>> from PyTango import DeviceProxy, GreenMode
@@ -427,3 +429,4 @@ See :class:`DeviceAttribute`.
     :members:
 
 See :class:`DeviceData`.
+
diff --git a/doc/conf.py b/doc/conf.py
index d911a31..3028e2d 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -19,6 +19,8 @@ import PyTango
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.append(os.path.abspath('sphinxext'))
 
+needs_sphinx = "1.0"
+
 # -- General configuration -----------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
@@ -228,6 +230,15 @@ latex_show_urls = 'footnote'
 # If false, no module index is generated.
 #latex_use_modindex = True
 
+# -- Options for RST -----------------------------------------------------------
+
+rst_epilog = """\
+.. _Tango: http://www.tango-controls.org/
+.. _IPython: http://ipython.org/
+.. _numpy: http://www.numpy.org/
+.. _gevent: http://www.gevent.org/
+"""
+
 # -- Options for reference to other documentation ------------------------------
 
 intersphinx_mapping = {
diff --git a/doc/quicktour.rst b/doc/quicktour.rst
index 5b7432c..1ed0cbc 100644
--- a/doc/quicktour.rst
+++ b/doc/quicktour.rst
@@ -14,7 +14,7 @@ Quick tour on the client side
 Check PyTango version
 ~~~~~~~~~~~~~~~~~~~~~
 
-Start an ipython tango console with::
+Start an IPython_ tango console with::
 
     $ itango
 
@@ -177,9 +177,9 @@ structures.
         
 .. note::
     notice that the command returns a list of two elements. The first element is
-    a :class:`numpy.ndarray` (assuming PyTango is compiled with numpy support).
+    a :class:`numpy.ndarray` (assuming PyTango is compiled with numpy_ support).
     This is because PyTango does a best effort to convert all numeric array types
-    to numpy arrays.
+    to numpy_ arrays.
     
 Reading and writing attributes
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -500,5 +500,3 @@ The following code is the complete device server code::
 
     Quick tour (original) <quicktour_old>
     
-.. _IPython: http://ipython.org/
-.. _numpy: http://www.numpy.org/
diff --git a/doc/revision.rst b/doc/revision.rst
index 4f3bb2a..49d48a3 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -90,6 +90,8 @@ Version history
 |          | - `573: [pytango] python3 error with unregistered device <https://sourceforge.net/p/tango-cs/bugs/573/>`_                                                         |
 |          | - `611: URGENT fail to write attribute with PyTango 8.0.3 <https://sourceforge.net/p/tango-cs/bugs/611/>`_                                                        |
 |          | - `612: [pytango][8.0.3] failed to build from source on s390 <https://sourceforge.net/p/tango-cs/bugs/612/>`_                                                     |
+|          | - `622: PyTango broken when running on Ubuntu 13 <https://sourceforge.net/p/tango-cs/bugs/622/>`_                                                                 |
+|          | - `628: Problem in installing PyTango 8.0.3 on Scientific Linux 6 <https://sourceforge.net/p/tango-cs/bugs/628/>`_                                                |
 +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | 8.1.0    | *SKIPPED*                                                                                                                                                         |
 +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
diff --git a/doc/server/server.rst b/doc/server/server.rst
index 782cd47..2eb660b 100644
--- a/doc/server/server.rst
+++ b/doc/server/server.rst
@@ -3,18 +3,18 @@
 
 .. _pytango-hlapi:
 
-HLAPI
-=====
+High Level API
+==============
 
 This module provides a high level device server API. It implements
 :ref:`TEP1 <pytango-TEP1>`. It exposes an easier API for developing a Tango
 device server.
 
-Here is an example on how to write a *Clock* device server using the
+Here is a simple example on how to write a *Clock* device server using the
 high level API::
     
     import time
-    from PyTango import server_run
+    from PyTango.server import server_run
     from PyTango.server import Device, DeviceMeta
     from PyTango.server import attribute, command   
 
@@ -33,8 +33,8 @@ high level API::
     if __name__ == "__main__":
         server_run((Clock,))
 
-Here is an example on how to write a *PowerSupply* device server using the
-high level API. The example contains:
+Here is a more complete  example on how to write a *PowerSupply* device server
+using the high level API. The example contains:
 
 #. a read-only double scalar attribute called *voltage*
 #. a read/write double scalar expert attribute *current*
@@ -64,8 +64,8 @@ high level API. The example contains:
                             unit="A",
                             format="8.4f",
 			    min_value=0.0, max_value=8.5,
-			    min_alarm=0.001, max_alarm=8.4,
-			    min_warning=0.1, max_warning=8.0,
+			    min_alarm=0.1, max_alarm=8.4,
+			    min_warning=0.5, max_warning=8.0,
                             fget="get_current",
                             fset="set_current",
                             doc="the power supply current")
@@ -85,214 +85,7 @@ high level API. The example contains:
         def get_current(self):
             return 2.3456, time(), AttrQuality.ATTR_WARNING
      
-        def set_current(self, value):
-            new_current = self.current.get_write_value()
-            print new_current
 
-	def get_noise(self):
-	    import numpy.random
-	    return numpy.random.random_sample((1024, 1024))
-        
-        @command(din_type=(float,))
-        def go(self, array):
-            self.info_stream("Going..." + str(array))
-
-        @command(din_type=float, din_doc="initial current",
-                 dout_type=bool, dout_doc="number of ramps")
-        def ramp(self, value):
-            self.info_stream("Ramping on %f..." % value)
-            return True
-
-    def main():
-        server_run((PowerSupply,))
-
-    if __name__ == "__main__":
-        main()
-
-
-Appendix
---------
-
-Here is the summary of features which this module exposes and are not available
-on the low level :mod:`PyTango` server API:
-
-#. Automatic inheritance from the latest :class:`~PyTango.DeviceImpl`
-#. default implementation of :meth:`Device.__init__`
-   calls :meth:`Device.init_device`. Around 90% of the
-   different device classes which inherit from low level
-   :class:`~PyTango.DeviceImpl` only implement `__init__` to call their
-   `init_device`
-#. has a default implementation of :meth:`Device.init_device`
-   which calls :meth:`Device.get_device_properties`. Again,
-   90% of existing device classes do that
-#. Automatically creates a hidden :class:`~PyTango.DeviceClass` class 
-#. recognizes :func:`attribute` members and automatically 
-   registers them as tango attributes in the hidden
-   :class:`~PyTango.DeviceClass`
-#. recognizes :func:`command` decorated functions and
-   automatically registers them as tango commands in the hidden
-   :class:`~PyTango.DeviceClass`
-#. recognizes :func:`device_property` members and
-   automatically registers them as tango device properties in the hidden
-   :class:`~PyTango.DeviceClass`
-#. recognizes :func:`class_property` members and
-   automatically registers them as tango class properties in the hidden
-   :class:`~PyTango.DeviceClass`
-#. read and write attribute methods don't need :class:`~PyTango.Attribute`
-   parameter. Access to :class:`~PyTango.Attribute` object is with simple::
-   
-       self.<attr name>
-       
-#. read attribute methods can set attribute return value with::
-       
-       def read_voltage(self):
-           return value
-       
-       # or 
-       
-       def read_voltage(self):
-           self.voltage = value
-       
-   instead of::
-   
-       def read_voltage(self, attr):
-           attr.set_value(value)
-
-:class:`Device` works very well in conjuction with:
-
-#. :func:`attribute`
-#. :class:`command`
-#. :meth:`device_property`
-#. :meth:`class_property`
-#. :meth:`~PyTango.server_run`
-
-Here is an example of a PowerSupply device with:
-
-#. a read-only double scalar `voltage` attribute
-#. a read/write double scalar `current` attribute
-#. a `ramp` command
-#. a `host` device property
-
-.. code-block:: python
-    :linenos:
-
-    from time import time
-        
-    from PyTango import AttrQuality, DebugIt, server_run
-    from PyTango.server import Device, DeviceMeta
-    from PyTango.server import attribute, command, device_property
-
-    class PowerSupply(Device):
-        __metaclass__ = DeviceMeta
-        
-        voltage = attribute()        
-
-        current = attribute(label="Current", unit="A",
-                            fread="read_current",
-                            fwrite="write_current")
-        
-        host = device_property()
-        
-        def read_voltage(self):
-            return 10.0
-            
-        def read_current(self):
-            return 2.5, time(), AttrQuality.ON
-        
-        @DebugIt()
-        def write_current(self):
-            new_current = self.current.get_write_value()
-        
-        @command
-        def ramp(self):
-            self.info_stream("Ramping on " + self.host + "...")
-
-    def main():
-        classes = PowerSupply,
-        server_run(classes)
-    
-    if __name__ == "__main__":
-        main()
-
-And here is the equivalent code using the low-level API:
-
-.. code-block:: python
-    :linenos:
-
-    import sys
-    import time
-
-    import PyTango
-
-    class PowerSupply(PyTango.Device_4Impl):
-
-        def __init__(self, devclass, name):
-            PyTango.Device_4Impl.__init__(self, devclass, name)
-            self.init_device()
-        
-        def init_device(self):
-            self.get_device_properties()
-        
-        def read_voltage(self, attr):
-            attr.set_value(10.0)
-            
-        def read_current(self, attr):
-            attr.set_value_date_quality(2.5, time.time(), PyTango.AttrQuality.ON)
-        
-        @PyTango.DebugIt()
-        def write_current(self, attr):
-            new_current = attr.get_write_value()
-        
-        def ramp(self):
-            self.info_stream("Ramping on " + self.host + "...")
-
-
-    class PowerSupplyClass(PyTango.DeviceClass):
-        
-        class_property_list = {}
-
-        device_property_list = {
-            'host':
-                [PyTango.DevString, "host of power supply", "localhost"],
-        }
-
-        cmd_list = {
-            'ramp':
-                [ [PyTango.DevVoid, "nothing"],
-                  [PyTango.DevVoid, "nothing"] ],
-        }
-
-        attr_list = {
-            'voltage':
-                [[PyTango.DevDouble,
-                PyTango.SCALAR,
-                PyTango.READ]],
-            'current':
-                [[PyTango.DevDouble,
-                PyTango.SCALAR,
-                PyTango.READ_WRITE], 
-                { 'label' : 'Current', 'unit' : 'A' }],
-        }
-        
-
-    def main():
-        try:
-            py = PyTango.Util(sys.argv)
-            py.add_class(PowerSupplyClass,PowerSupply,'PowerSupply')
-
-            U = PyTango.Util.instance()
-            U.server_init()
-            U.server_run()
-
-        except PyTango.DevFailed,e:
-            print '-------> Received a DevFailed exception:',e
-        except Exception,e:
-            print '-------> An unforeseen exception occured....',e
-
-    if __name__ == "__main__":
-        main()
-        
-       
 *Pretty cool, uh?*
 
 API

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list