2

I successfully downgraded to gedit 3.10.4 so that I could continue to use the rgedit plugin. While gedit appears to open and the rgedit menu appears, the rgedit buttons are not added to the toolbar and the plugin is unable to open terminal tabs. The plugin is written in python, which I do not know much about.

How can I get gedit to recognize the python code for this plugin, especially the configurable preferences?


Edit2: I have decided this issue is not a problem in the code but possibly with the python version (16.04 came with v3.5.1). I might try installing 3.4 and see where that gets me.


Starting gedit from the terminal intially gave an error about using require_version for Vte, so I added to the top of the file:

import gi
gi.require_version('Vte', '2.91')

Now that error is gone, but the terminal gives me this one:

Traceback (most recent call last):
  File "/home/jon/.local/share/gedit/plugins/RCtrl.py", line 2321, in on_create_new_R_tab
    self.createRGeditTerminal(profile)
  File "/home/jon/.local/share/gedit/plugins/RCtrl.py", line 2807, in createRGeditTerminal
    self.R_widget = RGeditTerminal(self._plugin)
  File "/home/jon/.local/share/gedit/plugins/RCtrl.py", line 231, in __init__
    self.reconfigure_vte(self._vte,1)
  File "/home/jon/.local/share/gedit/plugins/RCtrl.py", line 321, in reconfigure_vte
    _vteN.set_colors(fg, bg, palette)
TypeError: argument foreground: Expected Gdk.RGBA, but got gi.overrides.Gdk.Color

The code for the relevant block in RCtrl.py (~line 300):

    # colors
    _vteN.ensure_style()
    style = _vteN.get_style()

    if self._plugin.prefs['foreground'+str(tab_number)] == None:
        fg = style.text[Gtk.StateType.NORMAL]
    else:
        fg = Gdk.color_parse(self._plugin.prefs['foreground'+str(tab_number)])

    if self._plugin.prefs['background'+str(tab_number)] == None:
        bg = style.base[Gtk.StateType.NORMAL]
    else:
        bg = Gdk.color_parse(self._plugin.prefs['background'+str(tab_number)])

    palette = []
    if isinstance(fg,tuple):
        fg = fg[1]
    if isinstance(bg,tuple):
        bg = bg[1]
    _vteN.set_colors(fg, bg, palette)

I can hard-code the fg and bg as Gdk.RGBA values as Gdk.RGBA(0.0, 0.0, 0.0, 1.0) and Gdk.RGBA(1.0, 1.0, 1.0, 1.0), but it seems the real problem is that the entire prefs attribute is not found. I think that around line 2980 it is defined thusly:

class RCtrlPlugin(GObject.Object, Gedit.WindowActivatable):
    __gtype_name__ = "RCtrlPlugin"

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

    # The plugin preferences:
    prefs = {...[removed for simplicity]...}

The prefs are set to default values unless a user changes them in an interactive point-click window, which I can display but seems to still be unrecognized by gedit or python3 or ???.
Has anyone else successfully got this running?

jkatz
  • 21
  • 3

0 Answers0