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
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2013-03-12 12:05:32 +01:00
|
|
|
#include "pythoneditor.h"
|
2013-01-14 23:11:10 +04:00
|
|
|
#include "pythoneditorconstants.h"
|
|
|
|
|
#include "pythoneditorplugin.h"
|
2014-08-20 15:05:32 +02:00
|
|
|
#include "tools/pythonindenter.h"
|
|
|
|
|
#include "tools/pythonhighlighter.h"
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2014-08-20 15:05:32 +02:00
|
|
|
#include <texteditor/texteditoractionhandler.h>
|
2013-01-14 23:11:10 +04:00
|
|
|
#include <texteditor/texteditorconstants.h>
|
2014-09-26 09:14:03 +02:00
|
|
|
#include <texteditor/textdocument.h>
|
2014-08-20 15:05:32 +02:00
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2014-08-20 15:05:32 +02:00
|
|
|
using namespace TextEditor;
|
|
|
|
|
|
2013-01-14 23:11:10 +04:00
|
|
|
namespace PythonEditor {
|
2013-08-23 13:41:17 +02:00
|
|
|
namespace Internal {
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2014-08-20 15:05:32 +02:00
|
|
|
PythonEditorFactory::PythonEditorFactory()
|
|
|
|
|
{
|
|
|
|
|
setId(Constants::C_PYTHONEDITOR_ID);
|
2016-05-30 13:45:25 +09:00
|
|
|
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::C_EDITOR_DISPLAY_NAME));
|
2014-08-20 15:05:32 +02:00
|
|
|
addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
|
|
|
|
|
|
2014-08-22 12:14:18 +02:00
|
|
|
setEditorActionHandlers(TextEditorActionHandler::Format
|
|
|
|
|
| TextEditorActionHandler::UnCommentSelection
|
|
|
|
|
| TextEditorActionHandler::UnCollapseAll);
|
|
|
|
|
|
2014-09-22 18:43:31 +02:00
|
|
|
setDocumentCreator([]() { return new TextDocument(Constants::C_PYTHONEDITOR_ID); });
|
2014-08-22 12:14:18 +02:00
|
|
|
setIndenterCreator([]() { return new PythonIndenter; });
|
|
|
|
|
setSyntaxHighlighterCreator([]() { return new PythonHighlighter; });
|
2014-09-01 16:16:44 +02:00
|
|
|
setCommentStyle(Utils::CommentDefinition::HashStyle);
|
2014-10-15 00:36:39 +02:00
|
|
|
setParenthesesMatchingEnabled(true);
|
|
|
|
|
setMarksVisible(true);
|
|
|
|
|
setCodeFoldingSupported(true);
|
2013-01-14 23:11:10 +04:00
|
|
|
}
|
|
|
|
|
|
2013-08-23 13:41:17 +02:00
|
|
|
} // namespace Internal
|
2013-01-14 23:11:10 +04:00
|
|
|
} // namespace PythonEditor
|