#157 In response to "Problem with snippet - ID: 3500429"


Sorry, but I don't seem to find a way to respond to any bug, so I've decided to just start a new one (sorry for any inconvenience).

So, I encountered the same problem as Problem with snippet - ID: 3500429 (https://sourceforge.net/tracker/?func=detail&aid=3500429&group_id=204144&atid=988428). It seems that at least in Ubuntu there's something wrong with the gedit package, it's missing the Gedit.py file.

So I've just
"apt-get source gedit"
and then
"sudo cp gedit-{ver}/gedit/Gedit.py /usr/share/pyshared/gi/overrides/Gedit.py"
after that
"sudo ln -s /usr/share/pyshared/gi/overrides/Gedit.py /usr/lib/python{ver}/dist-packages/gi/overrides/Gedit.py"

But then, the Gedit Latex Plugin gave another kind of error:
Traceback (most recent call last):
File "/usr/lib/gedit/plugins/latex/action.py", line 60, in <lambda>
self._handler = self._internal_action.connect("activate", lambda gtk_action, action: action.activate(window_context), self)
File "/usr/lib/gedit/plugins/latex/latex/actions.py", line 59, in activate
context.active_editor.insert(LaTeXSource(self.snippet_source, self.packages))
File "/usr/lib/gedit/plugins/latex/latex/editor.py", line 132, in insert
Editor.insert(self, source.source)
File "/usr/lib/gedit/plugins/latex/editor.py", line 313, in insert
SnippetManager().insert_at_cursor(self, str(source))
File "/usr/lib/gedit/plugins/latex/snippetmanager.py", line 52, in insert_at_cursor
self.insert(editor, iter, text)
File "/usr/lib/gedit/plugins/latex/snippetmanager.py", line 38, in insert
snippet=text, iter=iter, view=view)
File "/usr/lib/python2.7/dist-packages/gi/overrides/Gedit.py", line 27, in send
msg = self.create(object_path, method, **kwargs)
File "/usr/lib/python2.7/dist-packages/gi/overrides/Gedit.py", line 18, in create
return GObject.new(tp, **kwargs)
TypeError: gobject `snippets+windowactivatable+Activate' doesn't support property `snippet'

To fix this, I just went to the snippetmanager.py file and commented out the error producing part:
def insert(self, editor, iter, text):
view = editor.tab_decorator.tab.get_view()
#window = view.get_toplevel()
#bus = window.get_message_bus()

#if bus.is_registered('/plugins/snippets', 'parse-and-activate'):
# bus.send('/plugins/snippets', 'parse-and-activate',
# snippet=text, iter=iter, view=view)
# LOG.info("Inserted using snippets plugin")
buf = view.get_buffer()

buf.insert(iter, text)
LOG.info("Inserted without snippets plugin")

Until a better way of doing this is found, I'll stick with this one.

Hope this helps you guys.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks