gedit-intelligent-text-completion icon indicating copy to clipboard operation
gedit-intelligent-text-completion copied to clipboard

Can't load plugin on gedit 3.4.2

Open draggett opened this issue 10 years ago • 1 comments

On Debian Wheezy, trying to activate the plugin fails with following error:

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed import gobject._gobject Traceback (most recent call last): File "/home/dsr/.local/share/gedit/plugins/intelligent_text_completion.py", line 18, in class IntelligentTextCompletionPlugin(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable): TypeError: Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

(gedit:11432): libpeas-WARNING **: Error loading plugin 'intelligent_text_completion'

Line 18 is:

class IntelligentTextCompletionPlugin(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable): window = GObject.property(type=Gedit.Window)

draggett avatar Aug 07 '14 14:08 draggett

According to the error, there is a metaclass conflict. However, if you just follow the official tutorial, this combination of classes should work.

Can you try the following plugin code?

example_plugin.py:

from gi.repository import Gtk, GObject, Gedit, PeasGtk

class ExamplePyPlugin(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable):
    __gtype_name__ = "ExamplePyPlugin"

    window = GObject.property(type=Gedit.Window)

    def __init__(self):
        GObject.Object.__init__(self)

    def do_activate(self):
        pass

    def do_deactivate(self):
        pass

    def do_update_state(self):
        pass

    def do_create_configure_widget(self):
        widget = Gtk.Label("A configuration widget goes here.")
        return widget

example_plugin.plugin:

[Plugin]
Loader=python3
Module=example_plugin
IAge=3
Name=Example plugin
Description=A Python plugin example
Authors=Jens Nyman

jensmotum avatar Aug 16 '14 08:08 jensmotum