Title: Development of Tango Client Applications in Python
1Development of Tango Client Applications in Python
- Tiago Coutinho and Josep Ribas
2Outline
- PyTauico
- Goals of PyTauico
- Software Architecture
- PyTauiwi
- Custom tango widgets in QtDesigner
- Application development
- Example
- Current Status
- Future Work
- Conclusions
3Goals of PyTauico
- PyTauico Python Tango User Interface Core
- Add Python and PyTango as an option for client
applications - Abstraction layer for PyTango Client Applications
- Simplify the application development using
PyTango - Reduce development time in Python
- Standarize PyTango client applications
- Improve performance of applications
- Efficient management of Devices and Attributes
4Architecture
CORBA
Tango
PyTango
PyTauico
5Architecture (II)
- Device and Attribute Factories
- PyTango accessed through DeviceProxy
- Model and Listener
- Polling management
6Listeners
Device Server
Motor ltltsupgtgt
Tango
PyTauico
Listener ltltCheckBoxSimgtgt
Listener ltltLineEditPosgtgt
Listener ltltLineEditAccgtgt
Listener ltltLineEditSimgtgt
Device ltltsupgtgt
Attribute ltltPositiongtgt
Attribute ltltAccelerationgtgt
Attribute ltltSimulationgtgt
AttributeFactory
DeviceFactory
7PyTauiwi
- Python Tango User Interface Widgets
- PyQt4 layer for PyTauico
- QtDesigner as a main tool.
- Provide a set of widgets for application
development - Standarize the look and feel
- Extensible
- Easy development of new widgets
- Complex widgets as a subset of basic widgets
CORBA
Tango
PyTango
PyTauico
PyQT4
PyTauiwi
8Custom Widgets for PyTango
- PyQt4.2
- Full range of standard Qt widgets
- All the power of Qt, but exploit it with the
simplicity of Python. - QtDesigner. Graphical User Interface Designer.
- Own pure Python custom widgets
- All the signals, slots and properties defined in
Python are accessible in Designer's user
interface.
9Custom Widget Development
- Design the widget using QtDesigner
- Convert Design into Python Code using pyuic4
- Implement widget functionality
- Inherit from tauico model
- Add Widget Properties, Signals and Slots
- Implement the connection with PyTauico.
- Defining the Widget's Plugin Interface
- Describes our custom widget and tells Qt Designer
how to instantiate it.
10Custom Widget development (II)
- Our widget is a Listener in the PyTauico Layer.
- Widget Code must include.
- A property defining the Tango attribute or device
name. - Subscription management to PyTauico Device or
attribute objects. - Implementation of the eventReceived() function
defined in the TauicoListener abstract class. - How the widget shows to the user the received
events. - Add signals and slots to the widget.
- Define the interaction of the widget with the
other components.
from PyQt4 import QtCore, QtGui, Qt import
PyTauico class PyStateLabel(QtGui.QLabel,
PyTauico.TauicoListener) ...
def getDevice(self) return self._device
_at_QtCore.pyqtSignature("setDevice(QString)")
def setDevice(self, devname) self.dev
devfactory.getDevice(self._device) self.attr
self.dev.subscribeAttribute(self._device"/State",
self) self.setState(str(self.attr.read()
.value)) Device QtCore.pyqtProperty("QSt
ring", getDevice, setDevice)
def eventReceived(self, EventSource, EventType,
EventValue) self.emit(QtCore.SIGNAL('chan
geText(QString)'), str(EventValue.value))
_at_QtCore.pyqtSignature("setState(QString)")
def setState(self, value) self.setText(value)
self.changeColor(value)
11Application Development
- Design your application design using QtDesigner
using the PyTauwi widgets. - Covert yout application to python code.
- Implement extra functionalities like widget
interconnection. - Enjoy it.
12Example. Libera UI
13Current Status
- PyTauico Layer
- Basic support for devices and attributes.
- Events for attributes
- Basic polling
- Core factory components
- Efficient object management (Devices and
Attributes) - Basic widget interface defined.
- PyTauwi Layer
- Basic widgets for testing.
14Future work
- Documentation
- Guidelines for developing widgets
- Define widgets interface
- Error tracking
- Deal with tango exceptions
- Polling lists
- Widget for choosing polling periods for
attributes - Commnads
- Polling for Void commands
- Properties
- Multiple DB connection.
- Add the DB on the device name.
- Extend the widget library.
15Conclusions
- PyTango and PyQt4.
- Mixing the power of Qt with the Python simplicity
- A good use for PyTango
- Abstraction layer
- Fast and easy development of python client
applications - Extensible.
- Possibility to create more complex and dedicated
widgets. (A widget that represents a motor) - Use other Python GUI technologies. (wxPython, )
16Acknowledgments
17PyTauico
Listener ltltLineEditPosgtgt
Listener ltltLineEditAccgtgt
Listener ltltLineEditSimgtgt
AttributeFactory
Attribute ltltPositiongtgt
Attribute ltltAccelerationgtgt
Attribute ltltSimulationgtgt
PollingTimer ltlt3sgtgt
PollingTimer ltlt10sgtgt
T2
T1