summaryrefslogtreecommitdiff
path: root/src/plugins/pythoneditor
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2014-10-22 12:24:55 +0200
committerTobias Hunger <tobias.hunger@theqtcompany.com>2014-10-24 13:38:33 +0200
commitb159d740fa32c505856e2acba22ed82c3333ed73 (patch)
treeed5f553f26d7159657676e518db93d6a6361ebeb /src/plugins/pythoneditor
parentb9a7cfcaa1f058c6d6b123c6d9abaa9da92d9f5a (diff)
downloadqt-creator-b159d740fa32c505856e2acba22ed82c3333ed73.tar.gz
JsonWizard: Replace Python class wizard with a JsonWizard
* Remove Qt4 support. * Remove some UI options that did not do anything in the original wizard Change-Id: I9647cbc6cd0958a02df5b2fe480b9c8069249521 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/pythoneditor')
-rw-r--r--src/plugins/pythoneditor/pythoneditor.pro8
-rw-r--r--src/plugins/pythoneditor/pythoneditor.qbs12
-rw-r--r--src/plugins/pythoneditor/pythoneditorconstants.h19
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp4
-rw-r--r--src/plugins/pythoneditor/wizard/pythonclassnamepage.cpp101
-rw-r--r--src/plugins/pythoneditor/wizard/pythonclassnamepage.h66
-rw-r--r--src/plugins/pythoneditor/wizard/pythonclasswizard.cpp116
-rw-r--r--src/plugins/pythoneditor/wizard/pythonclasswizard.h64
-rw-r--r--src/plugins/pythoneditor/wizard/pythonclasswizarddialog.cpp80
-rw-r--r--src/plugins/pythoneditor/wizard/pythonclasswizarddialog.h76
-rw-r--r--src/plugins/pythoneditor/wizard/pythonsourcegenerator.cpp213
-rw-r--r--src/plugins/pythoneditor/wizard/pythonsourcegenerator.h77
12 files changed, 0 insertions, 836 deletions
diff --git a/src/plugins/pythoneditor/pythoneditor.pro b/src/plugins/pythoneditor/pythoneditor.pro
index ed88a36625..f758f758b1 100644
--- a/src/plugins/pythoneditor/pythoneditor.pro
+++ b/src/plugins/pythoneditor/pythoneditor.pro
@@ -10,10 +10,6 @@ HEADERS += \
pythoneditorplugin.h \
pythoneditor.h \
pythoneditorconstants.h \
- wizard/pythonclasswizard.h \
- wizard/pythonclassnamepage.h \
- wizard/pythonclasswizarddialog.h \
- wizard/pythonsourcegenerator.h \
tools/pythonhighlighter.h \
tools/pythonindenter.h \
tools/lexical/pythonformattoken.h \
@@ -23,10 +19,6 @@ HEADERS += \
SOURCES += \
pythoneditorplugin.cpp \
pythoneditor.cpp \
- wizard/pythonclasswizarddialog.cpp \
- wizard/pythonclasswizard.cpp \
- wizard/pythonclassnamepage.cpp \
- wizard/pythonsourcegenerator.cpp \
tools/pythonhighlighter.cpp \
tools/pythonindenter.cpp \
tools/lexical/pythonscanner.cpp
diff --git a/src/plugins/pythoneditor/pythoneditor.qbs b/src/plugins/pythoneditor/pythoneditor.qbs
index d11b299d38..ffd924b6da 100644
--- a/src/plugins/pythoneditor/pythoneditor.qbs
+++ b/src/plugins/pythoneditor/pythoneditor.qbs
@@ -34,16 +34,4 @@ QtcPlugin {
"pythonindenter.cpp", "pythonindenter.h"
]
}
-
- Group {
- name: "Wizard"
- prefix: "wizard/"
- files: [
- "pythonclassnamepage.cpp", "pythonclassnamepage.h",
- "pythonclasswizard.h", "pythonclasswizard.cpp",
- "pythonclasswizarddialog.h", "pythonclasswizarddialog.cpp",
- "pythonsourcegenerator.h", "pythonsourcegenerator.cpp"
- ]
- }
}
-
diff --git a/src/plugins/pythoneditor/pythoneditorconstants.h b/src/plugins/pythoneditor/pythoneditorconstants.h
index abf76ccbb8..55bccfc4f9 100644
--- a/src/plugins/pythoneditor/pythoneditorconstants.h
+++ b/src/plugins/pythoneditor/pythoneditorconstants.h
@@ -41,25 +41,6 @@ const char C_EDITOR_DISPLAY_NAME[] =
QT_TRANSLATE_NOOP("OpenWith::Editors", "Python Editor");
/*******************************************************************************
- * File creation wizard
- ******************************************************************************/
-const char C_PY_WIZARD_CATEGORY[] = "U.Python";
-const char C_PY_EXTENSION[] = ".py";
-const char C_PY_DISPLAY_CATEGORY[] = "Python";
-
- // class
-const char C_PY_CLASS_WIZARD_ID[] = "P.PyClass";
-const char EN_PY_CLASS_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("PythonEditor::ClassWizard", "Python class");
-const char EN_PY_CLASS_DESCRIPTION[] =
- QT_TRANSLATE_NOOP("PythonEditor::ClassWizard", "Creates new Python class");
-
- // For future: boost binding
-const char C_PY_CPPMODULE_WIZARD_ID[] = "F.PyCppModule";
-const char EN_PY_CPPMODULE_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("PythonEditor::ClassWizard", "C++ module for Python");
-const char EN_PY_CPPMODULE_DESCRIPTION[] =
- QT_TRANSLATE_NOOP("PythonEditor::ClassWizard", "Creates C++/Boost file with bindings for Python");
-
-/*******************************************************************************
* MIME type
******************************************************************************/
const char C_PY_MIMETYPE[] = "text/x-python";
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index 9df7bd48d9..b4cf5eae6a 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -31,7 +31,6 @@
#include "pythoneditorplugin.h"
#include "pythoneditor.h"
#include "pythoneditorconstants.h"
-#include "wizard/pythonclasswizard.h"
#include "tools/pythonhighlighter.h"
#include <coreplugin/icore.h>
@@ -222,9 +221,6 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
if (!icon.isNull())
Core::FileIconProvider::registerIconOverlayForMimeType(icon, C_PY_MIMETYPE);
- // Add Python files and classes creation dialogs
- addAutoReleasedObject(new ClassWizard);
-
return true;
}
diff --git a/src/plugins/pythoneditor/wizard/pythonclassnamepage.cpp b/src/plugins/pythoneditor/wizard/pythonclassnamepage.cpp
deleted file mode 100644
index cd5fda454e..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonclassnamepage.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "pythonclassnamepage.h"
-#include "../pythoneditorconstants.h"
-
-#include <utils/wizard.h>
-
-#include <coreplugin/icore.h>
-#include <coreplugin/mimedatabase.h>
-#include <utils/newclasswidget.h>
-
-#include <QVBoxLayout>
-
-namespace PythonEditor {
-namespace Internal {
-
-ClassNamePage::ClassNamePage(QWidget *parent)
- : QWizardPage(parent)
- , m_isValid(false)
-{
- setTitle(tr("Enter Class Name"));
- setSubTitle(tr("The source file name will be derived from the class name"));
-
- m_newClassWidget.reset(new Utils::NewClassWidget);
- // Order, set extensions first before suggested name is derived
- m_newClassWidget->setClassTypeComboVisible(true);
- m_newClassWidget->setBaseClassChoices(QStringList()
- << QString()
- << QLatin1String("QObject")
- << QLatin1String("QWidget")
- << QLatin1String("QMainWindow")
- << QLatin1String("QDeclarativeItem"));
-
- m_newClassWidget->setBaseClassEditable(true);
- m_newClassWidget->setFormInputVisible(false);
- m_newClassWidget->setHeaderInputVisible(false);
- m_newClassWidget->setNamespacesEnabled(true);
- m_newClassWidget->setBaseClassInputVisible(true);
- m_newClassWidget->setNamesDelimiter(QLatin1String("."));
- m_newClassWidget->setAllowDirectories(true);
-
- connect(m_newClassWidget.data(), SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
-
- QVBoxLayout *pageLayout = new QVBoxLayout(this);
- pageLayout->addWidget(m_newClassWidget.data());
- QSpacerItem *vSpacer = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding);
- pageLayout->addItem(vSpacer);
-
- initParameters();
-
- setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Details"));
-}
-
-ClassNamePage::~ClassNamePage()
-{
-}
-
-void ClassNamePage::initParameters()
-{
- m_newClassWidget->setSourceExtension(QLatin1String(Constants::C_PY_EXTENSION));
-}
-
-void ClassNamePage::slotValidChanged()
-{
- const bool validNow = m_newClassWidget->isValid();
- if (m_isValid != validNow) {
- m_isValid = validNow;
- emit completeChanged();
- }
-}
-
-} // namespace Internal
-} // namespace PythonEditor
diff --git a/src/plugins/pythoneditor/wizard/pythonclassnamepage.h b/src/plugins/pythoneditor/wizard/pythonclassnamepage.h
deleted file mode 100644
index 976c3a2e21..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonclassnamepage.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef PYTHONEDITOR_CLASSNAMEPAGE_H
-#define PYTHONEDITOR_CLASSNAMEPAGE_H
-
-#include <QWizardPage>
-#include <QScopedPointer>
-
-namespace Utils { class NewClassWidget; }
-
-namespace PythonEditor {
-namespace Internal {
-
-class ClassNamePage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- explicit ClassNamePage(QWidget *parent = 0);
- virtual ~ClassNamePage();
-
- bool isComplete() const { return m_isValid; }
- Utils::NewClassWidget *newClassWidget() const { return m_newClassWidget.data(); }
-
-private slots:
- void slotValidChanged();
-
-private:
- void initParameters();
-
- QScopedPointer<Utils::NewClassWidget> m_newClassWidget;
- bool m_isValid;
-};
-
-} // namespace Internal
-} // namespace PythonEditor
-
-#endif // PYTHONEDITOR_CLASSNAMEPAGE_H
diff --git a/src/plugins/pythoneditor/wizard/pythonclasswizard.cpp b/src/plugins/pythoneditor/wizard/pythonclasswizard.cpp
deleted file mode 100644
index 23866a6f88..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonclasswizard.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "pythonclasswizard.h"
-#include "pythonclasswizarddialog.h"
-#include "pythonclassnamepage.h"
-#include "pythonsourcegenerator.h"
-#include "../pythoneditorconstants.h"
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/session.h>
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/project.h>
-#include <projectexplorer/target.h>
-#include <qtsupport/qtkitinformation.h>
-#include <qtsupport/baseqtversion.h>
-
-using namespace ProjectExplorer;
-
-namespace PythonEditor {
-namespace Internal {
-
-ClassWizard::ClassWizard()
-{
- setWizardKind(Core::IWizardFactory::FileWizard);
- setId(QLatin1String(Constants::C_PY_CLASS_WIZARD_ID));
- setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
- setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
- setDisplayName(ClassWizard::tr(Constants::EN_PY_CLASS_DISPLAY_NAME));
- setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
-}
-
-Core::BaseFileWizard *ClassWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
-{
- ClassWizardDialog *wizard = new ClassWizardDialog(parent);
- foreach (QWizardPage *p, parameters.extensionPages())
- wizard->addPage(p);
- wizard->setPath(parameters.defaultPath());
- wizard->setExtraValues(parameters.extraValues());
- return wizard;
-}
-
-Core::GeneratedFiles ClassWizard::generateFiles(const QWizard *w,
- QString *errorMessage) const
-{
- Q_UNUSED(errorMessage);
-
- const ClassWizardDialog *wizard = qobject_cast<const ClassWizardDialog *>(w);
- const ClassWizardParameters params = wizard->parameters();
-
- const QString fileName = Core::BaseFileWizardFactory::buildFileName(
- params.path, params.fileName, QLatin1String(Constants::C_PY_EXTENSION));
- Core::GeneratedFile sourceFile(fileName);
-
- SourceGenerator generator;
- generator.setPythonQtBinding(SourceGenerator::PySide);
- Kit *kit = kitForWizard(wizard);
- if (kit) {
- QtSupport::BaseQtVersion *baseVersion = QtSupport::QtKitInformation::qtVersion(kit);
- if (baseVersion && baseVersion->qtVersion().majorVersion == 5)
- generator.setPythonQtVersion(SourceGenerator::Qt5);
- else
- generator.setPythonQtVersion(SourceGenerator::Qt4);
- }
-
- QString sourceContent = generator.generateClass(
- params.className, params.baseClass, params.classType
- );
-
- sourceFile.setContents(sourceContent);
- sourceFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
- return Core::GeneratedFiles() << sourceFile;
-}
-
-Kit *ClassWizard::kitForWizard(const ClassWizardDialog *wizard) const
-{
- const QString key = QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE);
- const QString nodePath = wizard->extraValues().value(key).toString();
-
- // projectForFile doesn't find project if project file path passed
- Node *node = SessionManager::nodeForFile(nodePath);
- Project *proj = SessionManager::projectForNode(node);
- if (proj && proj->activeTarget())
- return proj->activeTarget()->kit();
-
- return KitManager::defaultKit();
-}
-
-} // namespace Internal
-} // namespace PythonEditor
diff --git a/src/plugins/pythoneditor/wizard/pythonclasswizard.h b/src/plugins/pythoneditor/wizard/pythonclasswizard.h
deleted file mode 100644
index be7ba2af89..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonclasswizard.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef PYTHONEDITOR_CLASSWIZARD_H
-#define PYTHONEDITOR_CLASSWIZARD_H
-
-#include <coreplugin/basefilewizardfactory.h>
-#include <utils/wizard.h>
-
-namespace Utils { class NewClassWidget; }
-namespace ProjectExplorer { class Kit; }
-
-namespace PythonEditor {
-namespace Internal {
-
-class ClassWizardDialog;
-
-class ClassWizard : public Core::BaseFileWizardFactory
-{
- Q_OBJECT
-
-public:
- ClassWizard();
-
-private:
- Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
-
- Core::GeneratedFiles generateFiles(const QWizard *w,
- QString *errorMessage) const;
-
- ProjectExplorer::Kit *kitForWizard(const ClassWizardDialog *wizard) const;
-};
-
-} // namespace Internal
-} // namespace PythonEditor
-
-#endif // PYTHONEDITOR_CLASSWIZARD_H
diff --git a/src/plugins/pythoneditor/wizard/pythonclasswizarddialog.cpp b/src/plugins/pythoneditor/wizard/pythonclasswizarddialog.cpp
deleted file mode 100644
index 8c54cade54..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonclasswizarddialog.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "pythonclasswizarddialog.h"
-#include "pythonclassnamepage.h"
-
-#include <utils/newclasswidget.h>
-
-namespace PythonEditor {
-namespace Internal {
-
-ClassWizardDialog::ClassWizardDialog(QWidget *parent) :
- Core::BaseFileWizard(parent),
- m_classNamePage(new ClassNamePage(this))
-{
- setWindowTitle(tr("Python Class Wizard"));
- addPage(m_classNamePage.data());
-}
-
-ClassWizardDialog::~ClassWizardDialog()
-{
-}
-
-ClassWizardParameters ClassWizardDialog::parameters() const
-{
- ClassWizardParameters p;
- const Utils::NewClassWidget *ncw = m_classNamePage->newClassWidget();
- p.className = ncw->className();
- p.fileName = ncw->sourceFileName();
- p.baseClass = ncw->baseClassName();
- p.path = ncw->path();
- p.classType = ncw->classType();
-
- return p;
-}
-
-void ClassWizardDialog::setExtraValues(const QVariantMap &extraValues)
-{
- m_extraValues = extraValues;
-}
-
-const QVariantMap &ClassWizardDialog::extraValues() const
-{
- return m_extraValues;
-}
-
-void ClassWizardDialog::setPath(const QString &path)
-{
- m_classNamePage->newClassWidget()->setPath(path);
-}
-
-} // namespace Internal
-} // namespace PythonEditor
diff --git a/src/plugins/pythoneditor/wizard/pythonclasswizarddialog.h b/src/plugins/pythoneditor/wizard/pythonclasswizarddialog.h
deleted file mode 100644
index 3c478004ea..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonclasswizarddialog.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef PYTHONEDITOR_CLASSWIZARDDIALOG_H
-#define PYTHONEDITOR_CLASSWIZARDDIALOG_H
-
-#include <coreplugin/basefilewizard.h>
-
-#include <utils/newclasswidget.h>
-#include <QScopedPointer>
-#include <QVariantMap>
-
-namespace PythonEditor {
-namespace Internal {
-
-class ClassNamePage;
-
-class ClassWizardParameters
-{
-public:
- QString className;
- QString fileName;
- QString path;
- QString baseClass;
- Utils::NewClassWidget::ClassType classType;
-};
-
-class ClassWizardDialog : public Core::BaseFileWizard
-{
- Q_OBJECT
-public:
- explicit ClassWizardDialog(QWidget *parent = 0);
- virtual ~ClassWizardDialog();
-
- void setPath(const QString &path);
- ClassWizardParameters parameters() const;
-
- void setExtraValues(const QVariantMap &extraValues);
- const QVariantMap &extraValues() const;
-
-private:
- QScopedPointer<ClassNamePage> m_classNamePage;
- QVariantMap m_extraValues;
-};
-
-} // namespace Internal
-} // namespace PythonEditor
-
-#endif // PYTHONEDITOR_CLASSWIZARDDIALOG_H
diff --git a/src/plugins/pythoneditor/wizard/pythonsourcegenerator.cpp b/src/plugins/pythoneditor/wizard/pythonsourcegenerator.cpp
deleted file mode 100644
index 6dcfaaf59a..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonsourcegenerator.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "pythonsourcegenerator.h"
-#include <QSet>
-
-namespace PythonEditor {
-namespace Internal {
-
-static const char BASH_RUN_HEADER[] = "#!/usr/bin/env python\n";
-static const char ENCODING_HEADER[] = "# -*- coding: utf-8 -*-\n";
-
-SourceGenerator::SourceGenerator()
- : m_pythonQtBinding(PySide)
- , m_pythonQtVersion(Qt4)
-{
-}
-
-SourceGenerator::~SourceGenerator()
-{
-}
-
-void SourceGenerator::setPythonQtBinding(QtBinding binding)
-{
- m_pythonQtBinding = binding;
-}
-
-void SourceGenerator::setPythonQtVersion(SourceGenerator::QtVersion version)
-{
- m_pythonQtVersion = version;
-}
-
-QString SourceGenerator::generateClass(const QString &className,
- const QString &baseClass,
- Utils::NewClassWidget::ClassType classType) const
-{
- QSet<QString> modules;
- bool hasUserBaseClass = !baseClass.isEmpty();
- // heuristic
- bool wasInheritedFromQt = hasUserBaseClass && (baseClass.at(0) == QLatin1Char('Q'));
-
- QString actualBase = baseClass;
-
- switch (classType) {
- case Utils::NewClassWidget::NoClassType:
- break;
- case Utils::NewClassWidget::SharedDataClass:
- case Utils::NewClassWidget::ClassInheritsQQuickItem:
- break;
- case Utils::NewClassWidget::ClassInheritsQObject:
- wasInheritedFromQt = true;
- modules.insert(QLatin1String("QtCore"));
- if (!hasUserBaseClass)
- actualBase = QLatin1String("QtCore.QObject");
- break;
-
- case Utils::NewClassWidget::ClassInheritsQWidget:
- wasInheritedFromQt = true;
- modules.insert(QLatin1String("QtCore"));
- modules.insert(moduleForQWidget());
- if (!hasUserBaseClass)
- actualBase = moduleForQWidget() + QLatin1String(".QWidget");
- break;
-
- case Utils::NewClassWidget::ClassInheritsQDeclarativeItem:
- wasInheritedFromQt = true;
- modules.insert(QLatin1String("QtCore"));
- modules.insert(QLatin1String("QtDeclarative"));
- if (!hasUserBaseClass)
- actualBase = QLatin1String("QtDeclarative.QDeclarativeItem");
- break;
- }
-
- QString nonQtModule; // empty
- if (hasUserBaseClass) {
- int dotIndex = baseClass.lastIndexOf(QLatin1Char('.'));
- if (dotIndex != -1) {
- if (wasInheritedFromQt)
- modules.insert(baseClass.left(dotIndex));
- else
- nonQtModule = baseClass.left(dotIndex);
- }
- }
-
- QString ret;
- ret.reserve(1024);
- ret += QLatin1String(ENCODING_HEADER);
- ret += QLatin1Char('\n');
-
- if (!modules.isEmpty()) {
- ret += qtModulesImport(modules);
- ret += QLatin1Char('\n');
- }
-
- if (!nonQtModule.isEmpty())
- ret += QString::fromLatin1("import %1\n\n").arg(nonQtModule);
-
- if (actualBase.isEmpty())
- ret += QString::fromLatin1("class %1:\n").arg(className);
- else
- ret += QString::fromLatin1("class %1(%2):\n").arg(className).arg(actualBase);
-
- ret += QLatin1String(" def __init__(self):\n");
- if (wasInheritedFromQt)
- ret += QString::fromLatin1(" %1.__init__(self)\n").arg(actualBase);
- ret += QLatin1String(" pass\n");
-
- return ret;
-}
-
-/**
-* @brief Generates main file of PyQt/PySide application
-*
-* Class MainWindow should be defined in 'mainwindow' module.
-* @param windowTitle Title for created window instance
-*/
-QString SourceGenerator::generateQtMain(const QString &windowTitle) const
-{
- QSet<QString> qtModules;
- qtModules.insert(QLatin1String("QtCore"));
- qtModules.insert(moduleForQWidget());
-
- QString ret;
- ret.reserve(1024);
- ret += QLatin1String(BASH_RUN_HEADER);
- ret += QLatin1String(ENCODING_HEADER);
- ret += QLatin1Char('\n');
- ret += QLatin1String("import sys\n");
- ret += qtModulesImport(qtModules);
- ret += QLatin1String("from mainwindow import MainWindow\n");
- ret += QLatin1Char('\n');
-
- ret += QString::fromLatin1(
- "if __name__ == \'__main__\':\n"
- " app = %1.QApplication(sys.argv)\n"
- " win = MainWindow()\n"
- " win.setWindowTitle(u\'%2\')\n"
- " win.show()\n"
- " app.exec_()\n"
- ).arg(moduleForQWidget()).arg(windowTitle);
-
- return ret;
-}
-
-QString SourceGenerator::qtModulesImport(const QSet<QString> &modules) const
-{
- QString slotsImport;
- if (modules.contains(QLatin1String("QtCore")))
- slotsImport = QLatin1String(" from PyQt4.QtCore import pyqtSlot as Slot\n");
-
- QLatin1String defaultBinding("PySide");
- QLatin1String fallbackBinding("PyQt4");
- if (m_pythonQtBinding == PyQt)
- qSwap(defaultBinding, fallbackBinding);
-
- QString ret;
- ret.reserve(256);
- ret += QLatin1String("try:\n");
- if (m_pythonQtBinding == PyQt)
- ret += slotsImport;
- foreach (const QString &name, modules)
- ret += QString::fromLatin1(" from %1 import %2\n")
- .arg(defaultBinding)
- .arg(name);
-
- ret += QLatin1String("except:\n");
- if (m_pythonQtBinding != PyQt)
- ret += slotsImport;
- foreach (const QString &name, modules)
- ret += QString::fromLatin1(" from %1 import %2\n")
- .arg(fallbackBinding)
- .arg(name);
-
- return ret;
-}
-
-QString SourceGenerator::moduleForQWidget() const
-{
- if (m_pythonQtVersion == Qt4)
- return QLatin1String("QtGui");
- else
- return QLatin1String("QtWidgets");
-}
-
-} // namespace Internal
-} // namespace PythonEditor
diff --git a/src/plugins/pythoneditor/wizard/pythonsourcegenerator.h b/src/plugins/pythoneditor/wizard/pythonsourcegenerator.h
deleted file mode 100644
index ad6cb678cd..0000000000
--- a/src/plugins/pythoneditor/wizard/pythonsourcegenerator.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef PYTHON_SOURCEGENERATOR_H
-#define PYTHON_SOURCEGENERATOR_H
-
-#include <utils/newclasswidget.h>
-#include <QSet>
-#include <QString>
-
-namespace PythonEditor {
-namespace Internal {
-
-class SourceGenerator
-{
-public:
- enum QtBinding {
- PySide,
- PyQt
- };
-
- enum QtVersion {
- Qt4,
- Qt5
- };
-
- SourceGenerator();
- ~SourceGenerator();
-
- void setPythonQtBinding(QtBinding binding);
- void setPythonQtVersion(QtVersion version);
-
- QString generateClass(const QString &className,
- const QString &baseClass,
- Utils::NewClassWidget::ClassType classType) const;
-
- QString generateQtMain(const QString &windowTitle) const;
-
-private:
- QString qtModulesImport(const QSet<QString> &modules) const;
- QString moduleForQWidget() const;
-
- QtBinding m_pythonQtBinding;
- QtVersion m_pythonQtVersion;
-};
-
-} // namespace Internal
-} // namespace PythonEditor
-
-#endif // PYTHON_SOURCEGENERATOR_H