Commit 98aa40a3 authored by Christoph Cullmann's avatar Christoph Cullmann 🍨
Browse files

add skeleton python plugin

I think it makes sense to start the work on an interpreter
inside a plugin

that did work in the past for the old python scripting,
too
parent 93cb9ee6
ecm_set_disabled_deprecation_versions(
QT 5.15
KF 5.90
)
function (kate_add_plugin name)
kcoreaddons_add_plugin(${name} INSTALL_NAMESPACE "ktexteditor")
endfunction()
......@@ -10,6 +5,16 @@ endfunction()
# Most plugins will need to link against KF5TextEditor to have access to its plugin interface.
find_package(KF5TextEditor ${KF5_DEP_VERSION} QUIET REQUIRED)
# python plugin
if (BUILD_PYTHON_BINDINDS)
ecm_optional_add_subdirectory(python)
endif()
ecm_set_disabled_deprecation_versions(
QT 5.15
KF 5.90
)
ecm_optional_add_subdirectory(backtracebrowser)
ecm_optional_add_subdirectory(close-except-like) # Close all documents except this one (or similar).
ecm_optional_add_subdirectory(colorpicker) # Inline color preview/picker
......
kate_add_plugin(katepythonplugin)
target_compile_definitions(katepythonplugin PRIVATE TRANSLATION_DOMAIN="katepythonplugin")
target_link_libraries(
katepythonplugin
PRIVATE
KF5::I18n
KF5::TextEditor
)
target_sources(
katepythonplugin
PRIVATE
katepythonplugin.cpp
plugin.qrc
)
#! /bin/sh
$XGETTEXT *.cpp -o $podir/katecloseexceptplugin.pot
/*
*
* SPDX-FileCopyrightText: 2022 Christoph Cullmann <cullmann@kde.org>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "katepythonplugin.h"
#include <KPluginFactory>
K_PLUGIN_FACTORY_WITH_JSON(KatePythonPluginFactory, "katepythonplugin.json", registerPlugin<KatePythonPlugin>();)
KatePythonPlugin::KatePythonPlugin(QObject *application, const QList<QVariant> &)
: KTextEditor::Plugin(application)
{
}
QObject *KatePythonPlugin::createView(KTextEditor::MainWindow *)
{
return nullptr;
}
#include "katepythonplugin.moc"
/*
*
* SPDX-FileCopyrightText: 2022 Christoph Cullmann <cullmann@kde.org>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef KATE_PYTHON_PLUGIN
#define KATE_PYTHON_PLUGIN
#include <QVariant>
#include <KTextEditor/Plugin>
class KatePythonPlugin : public KTextEditor::Plugin
{
Q_OBJECT
public:
KatePythonPlugin(QObject * = nullptr, const QList<QVariant> & = QList<QVariant>());
~KatePythonPlugin() = default;
QObject *createView(KTextEditor::MainWindow *) override;
};
#endif // __SRC__CLOSE_EXCEPT_PLUGIN_H__
{
"KPlugin": {
"Description": "Plugin that allows Python scripting for Kate",
"Name": "Python Scripting",
"ServiceTypes": [
"KTextEditor/Plugin"
]
}
}
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/kxmlgui5/katecloseexceptplugin">
<file>ui.rc</file>
</qresource>
</RCC>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="katecloseexcept" library="katecloseexceptplugin" version="4" translationDomain="katecloseexceptplugin">
<MenuBar>
<Menu name="file">
<text>&amp;File</text>
<Action name="file_close_except" group="close_merge"/>
<Action name="file_close_like" group="close_merge"/>
</Menu>
</MenuBar>
</gui>
<!-- kate: space-indent on; indent-width 4; replace-tabs on; -->
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment