3

I'm attempting a port of the abandoned Gedit plugin codecompletion to Python 3.

In the original code a Python 2 package is called:

import gtksourceview2 as gsv

and it is then inherited by a class to, presumably, perform completion:

class JSONProvider(gobject.GObject, gsv.CompletionProvider):
    MARK_NAME = 'JSONProviderCompletionMark'

    def __init__(self, plugin):
        gobject.GObject.__init__(self)
        ...

I've never used GtkSourceView or its completion functionality, so it's unclear what the inheritance is fulfilling. What is the equivalent gtksourceview2 (or 3) module in Python 3?

venzen
  • 1,119
  • 10
  • 13

1 Answers1

5

The equivalent would be

from gi.repository import GtkSource
ptomato
  • 56,175
  • 13
  • 112
  • 165
  • Thanks @ptomato. I'm giving it some time but your suggestion imports in Py3 and seems the accepted answer... thing is, why is this arcane knowledge? I could not find your straight-fwd answer via searchengine or SE - at all - at the time of posting. – venzen Jul 15 '16 at 12:26
  • [Here's](http://lazka.github.io/pgi-docs/index.html) the documentation; typing "gtksource" there should take you straight to it. I have no idea why it's so ungoogleable. – ptomato Jul 16 '16 at 05:42