source: calamares/trunk/fuentes/src/libcalamaresui/modulesystem/PythonJobModule.cpp @ 7538

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

sync with github

File size: 1.8 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#include "PythonJobModule.h"
20
21#include "PythonJob.h"
22
23#include <QDir>
24
25
26namespace Calamares {
27
28
29Module::Type
30PythonJobModule::type() const
31{
32    return Job;
33}
34
35
36Module::Interface
37PythonJobModule::interface() const
38{
39    return PythonInterface;
40}
41
42
43void
44PythonJobModule::loadSelf()
45{
46    if ( m_loaded )
47        return;
48
49    m_job = Calamares::job_ptr( new PythonJob( m_scriptFileName,
50                                               m_workingPath,
51                                               m_configurationMap ) );
52    m_loaded = true;
53}
54
55
56JobList
57PythonJobModule::jobs() const
58{
59    return JobList() << m_job;
60}
61
62
63void
64PythonJobModule::initFrom( const QVariantMap& moduleDescriptor )
65{
66    Module::initFrom( moduleDescriptor );
67    QDir directory( location() );
68    m_workingPath = directory.absolutePath();
69
70    if ( !moduleDescriptor.value( "script" ).toString().isEmpty() )
71    {
72        m_scriptFileName = moduleDescriptor.value( "script" ).toString();
73    }
74}
75
76
77PythonJobModule::PythonJobModule()
78    : Module()
79{}
80
81
82PythonJobModule::~PythonJobModule()
83{}
84
85
86} // namespace Calamares
Note: See TracBrowser for help on using the repository browser.