2013-01-14 23:11:10 +04:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-01-14 23:11:10 +04:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2013-01-14 23:11:10 +04:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2013-01-14 23:11:10 +04:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
#include "pythonplugin.h"
|
2019-07-22 14:39:01 +02:00
|
|
|
|
2022-03-30 14:42:33 +02:00
|
|
|
#include "pysidebuildconfiguration.h"
|
2014-08-20 15:05:32 +02:00
|
|
|
#include "pythoneditor.h"
|
2019-07-22 14:39:01 +02:00
|
|
|
#include "pythonproject.h"
|
2019-07-05 09:40:31 +02:00
|
|
|
#include "pythonsettings.h"
|
2019-07-22 14:39:01 +02:00
|
|
|
#include "pythonrunconfiguration.h"
|
2013-01-14 23:11:10 +04:00
|
|
|
|
|
|
|
|
#include <coreplugin/fileiconprovider.h>
|
2015-06-09 15:19:54 +02:00
|
|
|
|
2018-03-06 15:28:06 +01:00
|
|
|
#include <projectexplorer/buildtargetinfo.h>
|
2015-06-09 15:19:54 +02:00
|
|
|
#include <projectexplorer/localenvironmentaspect.h>
|
2022-06-22 15:43:33 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2017-03-03 18:16:34 +01:00
|
|
|
#include <projectexplorer/projectmanager.h>
|
2019-07-22 14:39:01 +02:00
|
|
|
#include <projectexplorer/runcontrol.h>
|
2018-03-29 15:29:17 +02:00
|
|
|
#include <projectexplorer/taskhub.h>
|
2015-06-09 15:19:54 +02:00
|
|
|
|
2019-07-22 14:39:01 +02:00
|
|
|
#include <utils/theme/theme.h>
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2015-06-09 15:19:54 +02:00
|
|
|
using namespace ProjectExplorer;
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
namespace Python {
|
2013-08-23 13:41:17 +02:00
|
|
|
namespace Internal {
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2019-10-18 10:31:14 +02:00
|
|
|
static PythonPlugin *m_instance = nullptr;
|
|
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
class PythonPluginPrivate
|
2013-01-14 23:11:10 +04:00
|
|
|
{
|
2018-02-06 12:46:02 +01:00
|
|
|
public:
|
|
|
|
|
PythonEditorFactory editorFactory;
|
2019-08-06 10:57:59 +02:00
|
|
|
PythonOutputFormatterFactory outputFormatterFactory;
|
2018-02-06 12:46:02 +01:00
|
|
|
PythonRunConfigurationFactory runConfigFactory;
|
2022-03-30 14:42:33 +02:00
|
|
|
PySideBuildStepFactory buildStepFactory;
|
|
|
|
|
PySideBuildConfigurationFactory buildConfigFactory;
|
2019-08-06 10:57:59 +02:00
|
|
|
|
2019-08-07 18:05:15 +02:00
|
|
|
RunWorkerFactory runWorkerFactory{
|
|
|
|
|
RunWorkerFactory::make<SimpleTargetRunner>(),
|
|
|
|
|
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
2020-06-12 07:50:52 +02:00
|
|
|
{runConfigFactory.runConfigurationId()}
|
2019-08-07 18:05:15 +02:00
|
|
|
};
|
2018-02-06 12:46:02 +01:00
|
|
|
};
|
|
|
|
|
|
2019-10-18 10:31:14 +02:00
|
|
|
PythonPlugin::PythonPlugin()
|
|
|
|
|
{
|
|
|
|
|
m_instance = this;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
PythonPlugin::~PythonPlugin()
|
2013-01-14 23:11:10 +04:00
|
|
|
{
|
2019-10-18 10:31:14 +02:00
|
|
|
m_instance = nullptr;
|
2018-04-26 17:42:07 +02:00
|
|
|
delete d;
|
2013-01-14 23:11:10 +04:00
|
|
|
}
|
|
|
|
|
|
2019-10-18 10:31:14 +02:00
|
|
|
PythonPlugin *PythonPlugin::instance()
|
|
|
|
|
{
|
|
|
|
|
return m_instance;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
bool PythonPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
2013-01-14 23:11:10 +04:00
|
|
|
{
|
|
|
|
|
Q_UNUSED(arguments)
|
2015-02-04 09:32:46 +01:00
|
|
|
Q_UNUSED(errorMessage)
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
d = new PythonPluginPrivate;
|
2017-03-03 18:16:34 +01:00
|
|
|
|
2018-02-06 12:46:02 +01:00
|
|
|
ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
|
2017-06-19 13:27:59 +02:00
|
|
|
|
2019-07-05 09:40:31 +02:00
|
|
|
PythonSettings::init();
|
|
|
|
|
|
2016-11-07 18:42:19 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
void PythonPlugin::extensionsInitialized()
|
2016-11-07 18:42:19 +01:00
|
|
|
{
|
2013-01-14 23:11:10 +04:00
|
|
|
// Add MIME overlay icons (these icons displayed at Project dock panel)
|
2019-07-22 14:39:01 +02:00
|
|
|
QString imageFile = Utils::creatorTheme()->imageFile(Utils::Theme::IconOverlayPro,
|
2021-12-13 15:30:21 +01:00
|
|
|
::Constants::FILEOVERLAY_PY);
|
2019-07-22 14:39:01 +02:00
|
|
|
Core::FileIconProvider::registerIconOverlayForSuffix(imageFile, "py");
|
2018-03-29 15:29:17 +02:00
|
|
|
|
2018-04-06 09:54:14 +02:00
|
|
|
TaskHub::addCategory(PythonErrorTaskCategory, "Python", true);
|
2013-01-14 23:11:10 +04:00
|
|
|
}
|
|
|
|
|
|
2013-08-23 13:41:17 +02:00
|
|
|
} // namespace Internal
|
2019-07-15 12:50:29 +02:00
|
|
|
} // namespace Python
|