ctkAbstractPythonManager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 #ifndef __ctkAbstractPythonManager_h
00022 #define __ctkAbstractPythonManager_h
00023 
00024 // Qt includes
00025 #include <QObject>
00026 #include <QList>
00027 #include <QStringList>
00028 
00029 // CTK includes
00030 #include "CTKScriptingPythonCoreExport.h"
00031 
00032 class PythonQtObjectPtr;
00033 
00034 class CTK_SCRIPTING_PYTHON_CORE_EXPORT ctkAbstractPythonManager : public QObject
00035 {
00036   Q_OBJECT
00037 
00038 public:
00039   typedef QObject Superclass;
00040   ctkAbstractPythonManager(QObject* _parent=NULL);
00041   ~ctkAbstractPythonManager();
00042 
00043   PythonQtObjectPtr mainContext();
00044   void addObjectToPythonMain(const QString& name, QObject* obj);
00045   void registerPythonQtDecorator(QObject* decorator);
00046   void registerClassForPythonQt(const QMetaObject* metaobject);
00047   void registerCPPClassForPythonQt(const char* name);
00048 
00052   QVariant executeString(const QString& code);
00053 
00057   QVariant getVariable(const QString& varName);
00058 
00061   void executeFile(const QString& filename);
00062 
00063 signals:
00064 
00068   void pythonInitialized();
00069 
00070 protected slots:
00071   void printStderr(const QString&);
00072   void printStdout(const QString&);
00073 
00074 protected:
00075 
00076   void initPythonQt();
00077 
00078   virtual QStringList     pythonPaths();
00079   virtual void            preInitialization();
00080 
00081 };
00082 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines