160 likes | 317 Views
Development of Tango Client Applications in Python. Tiago Coutinho and Josep Ribas. Outline. PyTauico Goals of PyTauico Software Architecture PyTauiwi Custom tango widgets in QtDesigner Application development Example Current Status Future Work Conclusions. Goals of PyTauico.
E N D
Development of Tango Client Applications in Python Tiago Coutinho and Josep Ribas Tango Meeting
Outline • PyTauico • Goals of PyTauico • Software Architecture • PyTauiwi • Custom tango widgets in QtDesigner • Application development • Example • Current Status • Future Work • Conclusions Tango Meeting
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 Meeting
Architecture WxPython IPython PyQT4 'WxTango' 'IPyTauico' PyTauiwi CORBA Tango PyTango PyTauico Tango Meeting
Architecture (II) • Device and Attribute Factories • PyTango accessed through DeviceProxy • Model and Listener • Polling management Tango Meeting
Listeners Device Server Motor <<sup>> Tango PyTauico Listener <<CheckBoxSim>> Listener <<LineEditPos>> Listener <<LineEditAcc>> Listener <<LineEditSim>> Device <<sup>> Attribute <<Position>> Attribute <<Acceleration>> Attribute <<Simulation>> DeviceFactory AttributeFactory Tango Meeting
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 CORBA Tango PyTango PyQT4 PyTauico PyTauiwi Tango Meeting
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 Meeting
Custom 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. Tango Meeting
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 Meeting
Application 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. Tango Meeting
Example. Libera UI Tango Meeting
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 Meeting
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 Meeting
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 Meeting
Acknowledgments • Fulvio Becheri Tango Meeting