Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not running in 3.36.1 #13

Open
joshp23 opened this issue Apr 25, 2020 · 6 comments
Open

not running in 3.36.1 #13

joshp23 opened this issue Apr 25, 2020 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@joshp23
Copy link
Collaborator

joshp23 commented Apr 25, 2020

After upgrading to Ubuntu 20.04 and attempting to run the plugin with Gedit launched from terminal, the following error occurs:

  File "/home/joshp/.local/share/gedit/plugins/markdownpreview/markdownpreview.py", line 76, in menu_button_handler
    self.attach_to_view()
  File "/home/joshp/.local/share/gedit/plugins/markdownpreview/markdownpreview.py", line 89, in attach_to_view
    self.toggle_preview(None, None, view)
  File "/home/joshp/.local/share/gedit/plugins/markdownpreview/markdownpreview.py", line 100, in toggle_preview
    self.enable_preview(view)
  File "/home/joshp/.local/share/gedit/plugins/markdownpreview/markdownpreview.py", line 118, in enable_preview
    box.pack_end(webview, True, True, 0)
AttributeError: 'GeditViewFrame' object has no attribute 'pack_end'
@joshp23 joshp23 added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Apr 25, 2020
@aliva
Copy link
Owner

aliva commented Apr 25, 2020

so the plugin tries to get scroll window (the widget which contains the code)

before 3.36 parent of this scrolledwindow was a GtkBox which I could simply add web-view to it in a hacky way.

the whole process was something like this:

scrolledwindow = self.get_scrolledwindow(view)
box = scrolledwindow.get_parent()
box.pack_end(webview, True, True, 0)

but now the box doesn't exist anymore and instead of the box there is a GeditViewFrame which is based on GtkOverlay (useless to us)

As the result the current hacky way to patch webview doesn't work anymore and we have to find a new hacky way to bring it back, which won't be easy

@joshp23
Copy link
Collaborator Author

joshp23 commented Apr 25, 2020

Would replicating and mirroring the left side pane code work?

@joshp23
Copy link
Collaborator Author

joshp23 commented Apr 25, 2020

Or, is it even possible to hook into gedit appropriately for that to be an option?

@aliva
Copy link
Owner

aliva commented Apr 27, 2020

Sadly it's out of my GTK knowledge to work further on it.

@aliva aliva added the help wanted Extra attention is needed label Apr 27, 2020
@aliva
Copy link
Owner

aliva commented Apr 27, 2020

Hi @swilmet sorry to grab you into this conversation but do you have any suggestion for us?

@ghost
Copy link

ghost commented Apr 29, 2020

There is GeditTab (subclass of GtkBox, vertical) which contains a GeditViewFrame (subclass of GtkOverlay, and GtkOverlay is a subclass of GtkBin so it can contain only one child widget). The GeditViewFrame contains the GtkScrolledWindow which contains the GeditView. Note that the GeditTab can contain also a GtkInfoBar above the GeditViewFrame.

It's possible to re-parent a widget by increasing the ref count on it, call gtk_container_remove(), add for example a GtkGrid, add the widget to the GtkGrid and then add the GtkGrid to the parent container.

I know that there is a plugin that restores the overview/minimap on the right side of the scrolled window, maybe the same code can be used to pack something on the right side: https://github.com/johnfactotum/gedit-restore-minimap
But I see that there is an issue with that plugin when an infobar is shown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants