2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
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"
|
|
|
|
|
#include "pythonrunconfiguration.h"
|
2023-03-07 13:00:44 +01:00
|
|
|
#include "pythonsettings.h"
|
|
|
|
|
#include "pythonwizardpage.h"
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2018-03-06 15:28:06 +01:00
|
|
|
#include <projectexplorer/buildtargetinfo.h>
|
2023-03-07 13:00:44 +01:00
|
|
|
#include <projectexplorer/jsonwizard/jsonwizardfactory.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>
|
2018-03-29 15:29:17 +02:00
|
|
|
#include <projectexplorer/taskhub.h>
|
2015-06-09 15:19:54 +02:00
|
|
|
|
2022-05-31 11:16:44 +02:00
|
|
|
#include <utils/fsengine/fileiconprovider.h>
|
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;
|
2023-04-04 13:39:56 +02:00
|
|
|
using namespace Utils;
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2023-01-06 13:56:00 +01:00
|
|
|
namespace Python::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;
|
2023-01-06 13:56:00 +01:00
|
|
|
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
|
2022-11-16 15:07:36 +01:00
|
|
|
PythonSettings settings;
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-20 12:28:36 +01:00
|
|
|
void PythonPlugin::initialize()
|
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);
|
2023-03-22 10:05:10 +01:00
|
|
|
ProjectManager::registerProjectType<PythonProject>(PythonMimeTypeLegacy);
|
2023-03-07 13:00:44 +01:00
|
|
|
JsonWizardFactory::registerPageFactory(new PythonWizardPageFactory);
|
2016-11-07 18:42:19 +01:00
|
|
|
}
|
|
|
|
|
|
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)
|
2023-04-04 13:39:56 +02:00
|
|
|
const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro,
|
|
|
|
|
::Constants::FILEOVERLAY_PY);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2023-01-06 13:56:00 +01:00
|
|
|
} // Python::Internal
|