gedit-intelligent-text-completion
gedit-intelligent-text-completion copied to clipboard
Can't load plugin on gedit 3.4.2
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
(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)
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