|
|
| (One intermediate revision by one other user not shown) |
| Line 1: |
Line 1: |
| − | There are multiple mechanisms to add scripting into Avogadro. This initial article is aimed at expressing the pros and cons of the different approaches.
| + | #redirect [[:Category:Scripting]] |
| − | | |
| − | Some key goals:
| |
| − | * Run shell scripts to submit jobs to clusters and handle interfacing Avogadro with other external programs.
| |
| − | * Embed scripts inside Avogadro
| |
| − | * Extensibility of the Avogadro library (i.e., scripting modules as extensions, tools, rendering engines, etc.)
| |
| − | | |
| − | === SWIG ===
| |
| − | | |
| − | [http://www.swig.org/ SWIG Website]
| |
| − | | |
| − | '''Pros:''' Already used for Open Babel. Automatically generates bindings from the headers. Allows multiple languages (Python, Perl, Ruby, Java, etc.)
| |
| − | | |
| − | '''Cons:''' No intrinsic support for Qt.
| |
| − | | |
| − | === SIP ===
| |
| − | | |
| − | [http://www.riverbankcomputing.co.uk/sip/index.php SIP Website]
| |
| − | | |
| − | '''Pros:''' Direct integration with [http://www.riverbankcomputing.co.uk/pyqt/index.php PyQt]. Makes it easy to both embed and extend Avogadro.
| |
| − | | |
| − | '''Cons:''' Requires manual writing of interface files based on headers. Limited to Python only (i.e., no Ruby, no Java...)
| |
| − | | |
| − | === Kross ===
| |
| − | | |
| − | [http://kross.dipe.org/ Kross Website] | |
| − | | |
| − | '''Pros:''' Directly interrogates meta-object system. Easily allows embedded scripts. Allows JavaScript, Perl, Ruby...
| |
| − | | |
| − | '''Cons:''' Doesn't allow extensibility. Currently only KDE, although plans exist to allow running in Qt-only applications.
| |
| − | | |
| − | === PythonQt ===
| |
| − | | |
| − | [http://pythonqt.sourceforge.net/ PythonQt Website] | |
| − | | |
| − | '''Pros:''' Directly interrogates meta-object system. Easily allows embedded scripts.
| |
| − | | |
| − | '''Cons:''' Python only. Doesn't allow extensibility
| |
| − | | |
| − | === QtScript ===
| |
| − | | |
| − | [http://doc.trolltech.com/4.3/qtscript.html QtScript Website]
| |
| − | | |
| − | '''Pros:''' Directly integrated into Qt. No dependencies. Directly interrogates meta-object system. Easily embeds scripts.
| |
| − | | |
| − | '''Cons:''' JavaScript only. Doesn't allow extensibility (i.e., creating new object classes).
| |
| − | | |
| − | == Summary ==
| |
| − | | |
| − | If we want to quickly allow embedding scripts into Avogadro, I think Kross or PythonQt is the best solution. It requires very little work on our part and immediately opens all QObject classes to scripting. From what I understand, Kross is now ready to rely only on Qt4.
| |
| − | | |
| − | However, I think we will ultimately want to allow extensibility of libavogadro in Python and other languages. For example, this would allow QMForge (which uses PyQt) to embed libavogadro. This would imply use of SIP.
| |
| − | | |
| − | Neither approach is exclusive. We can add Kross support now and build up SIP files as the API of libavogadro matures. This would allow Python, Ruby, and other scripts embedded in Avogadro, and Python extension of libavogadro classes.
| |
| − | | |
| − | One last point -- Kross is only aware of QObject-derived classes (i.e., via moc). So we should think carefully about what classes and methods we should expose to scripting. Open Babel offers some SWIG-based wrappers, and this will hopefully operate cleanly with whatever approach we choose here.
| |
| − | | |
| − | [[Category:Developer]]
| |