source: calamares/trunk/fuentes/src/libcalamares/PythonHelper.h @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.1 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef CALAMARES_PYTHONJOBHELPER_H
20#define CALAMARES_PYTHONJOBHELPER_H
21
22#include "PythonJob.h"
23
24#include <QStringList>
25
26#undef slots
27#include <boost/python/dict.hpp>
28#include <boost/python/list.hpp>
29#include <boost/python/object.hpp>
30
31namespace CalamaresPython
32{
33
34boost::python::object   variantToPyObject( const QVariant& variant );
35QVariant                variantFromPyObject( const boost::python::object& pyObject );
36
37boost::python::list     variantListToPyList( const QVariantList& variantList );
38QVariantList            variantListFromPyList( const boost::python::list& pyList );
39
40boost::python::dict     variantMapToPyDict( const QVariantMap& variantMap );
41QVariantMap             variantMapFromPyDict( const boost::python::dict& pyDict );
42
43boost::python::dict     variantHashToPyDict( const QVariantHash& variantHash );
44QVariantHash            variantHashFromPyDict( const boost::python::dict& pyDict );
45
46
47class Helper : public QObject
48{
49    Q_OBJECT
50public:
51    virtual ~Helper();
52
53    boost::python::dict createCleanNamespace();
54
55    QString handleLastError();
56
57private:
58    friend Helper* Calamares::PythonJob::helper();
59    explicit Helper( QObject* parent = nullptr );
60    static Helper* s_instance;
61
62    boost::python::object m_mainModule;
63    boost::python::object m_mainNamespace;
64
65    QStringList m_pythonPaths;
66};
67
68} // namespace Calamares
69
70#endif // CALAMARES_PYTHONJOBHELPER_H
Note: See TracBrowser for help on using the repository browser.