kate Package

kate Package

Namespace for Kate application interfaces.

This namespace contains interfaces for plugin developers for the Kate application.

class kate.__init__.Configuration(root)[source]

Configuration objects provide plugin-specific configuration dictionary.

In other words, each plugin uses kate.configuration and the class automatically creates a plugin-specific dictionary to support it.

The config is saved and loaded from disk automatically for minimal user hassle. Just go ahead and use kate.configuration as a persistent dictionary. Do not instantiate your own Configuration object; use kate.configuration instead.

Use a string key. Any Python type that can be pickled is can be used as a value – dictionaries, lists, numbers, strings, sets, and so on.

get(key, default=None)[source]
exception kate.__init__.NoActiveView[source]

Bases: exceptions.Exception

kate.__init__.action(text, icon=None, shortcut=None, menu=None)[source]

Decorator that adds an action to the menu bar. When the item is fired, your function is called. Optional shortcuts, menu to place the action in, and icon can be specified.

  • text - The text associated with the action (used as the menu

    item label, etc).

  • shortcut - The shortcut to fire this action or None if there is no

    shortcut. Must be a string such as ‘Ctrl+1’ or a QKeySequence instance. By default no shortcut is set (by passing None)

  • icon - An icon to associate with this action. It is shown

    alongside text in the menu bar and in toolbars as required. Pass a string to use KDE’s image loading system or a QPixmap or QIcon to use any custom icon. None (the default) sets no icon.

  • menu - The menu under which to place this item. Must be a

    string such as ‘tools’ or ‘settings’, or None to not place it in any menu.

The docstring for your action will be used to provide “help” text.

NOTE: Kate may need to be restarted for this decorator to take effect, or to remove all traces of the plugin on removal.


The document for the currently active view. Throws NoActiveView if no active view available.


The currently active view. Access its KTextEditor.Document by calling document() on it (or by using kate.activeDocument()). This is a shortcut for kate.application.activeMainWindow().activeView()

kate.__init__.application = <PyKate4.kate.Application object at 0x2e169e0>

Global accessor to the application object. Equivalent to Kate::application().

Returns: application object.

class kate.__init__.catchAllHandler(f)[source]

Bases: object

Standard error handling for plugin actions.


The central widget that holds the tab bar and the editor. This is a shortcut for kate.application.activeMainWindow().centralWidget()

kate.__init__.configPage(name, fullName, icon)[source]

Decorator that adds a configPage into Kate’s settings dialog. When the item is fired, your function is called.

  • name - The text associated with the configPage in the list of

    config pages.

  • fullName - The title of the configPage when selected.

  • icon - An icon to associate with this configPage. Pass a string

    to use KDE’s image loading system or a QPixmap or QIcon to use any custom icon.

NOTE: Kate may need to be restarted for this decorator to take effect, or to remove all traces of the plugin on removal.

kate.__init__.configuration = {}

Configuration for this plugin.

kate.__init__.documentManager = <PyKate4.kate.DocumentManager object at 0x2e16a70>

Global accessor to the document manager object. Equivalent to Kate::documentManager().

Returns: document manager object.


Give the editing section focus

kate.__init__.globalConfiguration = {'color_tools': {'insertColor:lastUsedColor': 'white'}, 'python_console_classic': {'ps1': u'>>>', 'floatColour': <PyQt4.QtGui.QColor object at 0x30b0c90>, 'promptColour': <PyQt4.QtGui.QColor object at 0x6ca59f0>, 'nameColour': <PyQt4.QtGui.QColor object at 0x30b0de0>, 'helpColour': <PyQt4.QtGui.QColor object at 0x30b0bb0>, 'integerColour': <PyQt4.QtGui.QColor object at 0x30b0d00>, 'ps2': u'...', 'stringColour': <PyQt4.QtGui.QColor object at 0x30b0d70>, 'font': u'monospace,12,-1,5,50,0,0,0,0,0', 'exceptionColour': <PyQt4.QtGui.QColor object at 0x30b0c20>}, 'commentar': {'commentStartPos': 60}}

Configuration for all plugins.

This can also be used by one plugin to access another plugin’s configurations.


The function will be called when Kate has loaded completely: when all other enabled plugins have been loaded into memory, the configuration has been initiated, etc.


The interface to the main window currently showing. Calling window() on the interface window gives you the actual QWidget-derived main window, which is what the mainWindow() function returns


The QWidget-derived main Kate window currently showing. A shortcut around kate.application.activeMainWindow().window().

The Kate API differentiates between the interface main window and the actual widget main window. If you need to access the Kate.MainWindow for the methods it provides (e.g createToolView), then use the mainInterfaceWindow function


Return a list of each module function decorated with @action.

The returned object is [ { function, ( text, icon, shortcut, menu), help }... ].


Return a list of each module function decorated with @configPage.

The returned object is [ { function, callable, ( name, fullName, icon ) }... ].


Fetch HTML documentation on some module.


Test whether an object is alive; that is, whether the pointer to the object still exists.


The list of plugin directories.


The list of available plugins.


Deprecated. Use globalConfiguration instead.


The function will be called when Pate is being unloaded from memory. Clean up any widgets that you have added to the interface (toolviews etc).


Calls the function when the view changes. To access the new active view, use kate.activeView()


Calls the function when a new view is created, passing the view as a parameter

gui Module

Useful widgets

class kate.gui.FunctionIntervalTimer(parent, interval, func, *args)[source]

Bases: PyQt4.QtCore.QTimer

class kate.gui.PassivePopupLabel(parent, message, maxTextWidth=None, minTextWidth=None)[source]

Bases: PyQt4.QtGui.QLabel

class kate.gui.TimeoutPassivePopup(parent, message, timeout=5, icon=None, maxTextWidth=200, minTextWidth=None)[source]

Bases: PyQt4.QtGui.QFrame

popups = {}
class kate.gui.VerticalProgressWidget(parent)[source]

Bases: PyQt4.QtGui.QFrame

Brush = <PyQt4.QtGui.QBrush object at 0x2fddbb0>
kate.gui.popup(message, timeout, icon=None, maxTextWidth=None, minTextWidth=None, parent=None)[source]
kate.gui.setBackgroundColor(widget, color)[source]

Utility function to set the background color of a QWidget

kate.gui.slideInFromBottomRight(widget, step=5, interval=20, offsetRight=0, offsetBottom=0)[source]
kate.gui.slideOutFromBottomRight(widget, step=5, interval=20, offsetRight=0, offsetBottom=0)[source]

Table Of Contents

Previous topic

Welcome to the Kate Pâté Plugin API documentation!

Next topic

libkatepate Package

This Page