Disclaimer: It’s the first time I ask a question specifically on gedit plugin development here. If this is not the right place, I apologize. If there is a better place to ask such a question, please let me know!
I’m working on a plugin for gedit,
gedit-reST-plugin, which renders a document in either gedit’s bottom panel or the side panel. Which location is used is at the user’s discretion (via the plugin’s preferences).
Displaying content and adding the container window to either the bottom panel or the side panel works reliably. What I can’t get to work is to remove the container from one panel and add add it to the other.
When the preferences dialog is created, the instance gets a reference of the parent window passed. I want to use that later to conveniently access instance members.
When the user changes the display target, I invoke the methods of the parent reference to remove and re-add the panel. Interestingly, at that occasion when I call the
_parentreference’s methods the instance members are
Nonefor some reason even though they were initialized earlier.
Traceback (most recent call last): File "/home/peter/.local/share/gedit/plugins/reST/config.py", line 90, in on_button_toggled self._parent.do_deactivate() File "/home/peter/.local/share/gedit/plugins/reST/__init__.py", line 66, in do_deactivate self.html_container.clear_view() AttributeError: 'NoneType' object has no attribute 'clear_view'
Can someone spot what I do wrong?
How do I remove the container correctly and/or move it to the other panel?