Upload
jodie-edwards
View
213
Download
1
Embed Size (px)
Citation preview
Dessy, 17 september 2007 Tango Meeting
Development of Tango Client Applications in Python
Tiago Coutinho and Josep Ribas
Tango MeetingDessy, 17 september 2007
Outline
PyTauico Goals of PyTauico Software Architecture
PyTauiwi Custom tango widgets in QtDesigner Application development Example
Current Status Future Work Conclusions
Tango MeetingDessy, 17 september 2007
Goals 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
Tango MeetingDessy, 17 september 2007
PyTango
Tango
PyTauico
'IPyTauico'
IPython
PyTauiwi
PyQT4
'WxTango'
WxPython
CORBA
Architecture
Tango MeetingDessy, 17 september 2007
Architecture (II)
Device and Attribute Factories
PyTango accessed through DeviceProxy
Model and Listener
Polling management
Tango MeetingDessy, 17 september 2007
PyTauico
Device<<sup>>
Attribute<<Position>>
Attribute<<Acceleration>>
Attribute<<Simulation>>
Listener<<LineEditPos>>
Listener<<LineEditAcc>>
Listener<<LineEditSim>>
Listener<<CheckBoxSim>>
AttributeFactoryDeviceFactory
Tango
Device ServerMotor
<<sup>>
Listeners
Tango MeetingDessy, 17 september 2007
PyTauiwi
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
PyTango
Tango
PyTauico
CORBA
PyTauiwi
PyQT4
Tango MeetingDessy, 17 september 2007
Custom 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.
Tango MeetingDessy, 17 september 2007
Custom Widget Development
1. Design the widget using QtDesigner
2. Convert Design into Python Code using pyuic4
3. Implement widget functionality1. Inherit from tauico model2. Add Widget Properties, Signals and
Slots3. Implement the connection with
PyTauico.
4. Defining the Widget's Plugin Interface Describes our custom widget and tells
Qt Designer how to instantiate it.
Tango MeetingDessy, 17 september 2007
Custom 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
@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("QString", getDevice, setDevice)
def eventReceived(self, EventSource, EventType, EventValue):
self.emit(QtCore.SIGNAL('changeText(QString)'), str(EventValue.value))
@QtCore.pyqtSignature("setState(QString)")
def setState(self, value):
self.setText(value)
self.changeColor(value)
Tango MeetingDessy, 17 september 2007
Application Development
1. Design your application design using QtDesigner using the PyTauwi widgets.
2. Covert yout application to python code.3. Implement extra functionalities like
widget interconnection.4. Enjoy it.
Tango MeetingDessy, 17 september 2007
Example. Libera UI
Tango MeetingDessy, 17 september 2007
Current 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.
Tango MeetingDessy, 17 september 2007
Future 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.
Tango MeetingDessy, 17 september 2007
Conclusions
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,
…)
Tango MeetingDessy, 17 september 2007
Acknowledgments
Fulvio Becheri