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

Support for gedit 3.14 #3

Open
nashamri opened this issue Oct 30, 2014 · 16 comments
Open

Support for gedit 3.14 #3

nashamri opened this issue Oct 30, 2014 · 16 comments

Comments

@nashamri
Copy link

The plugin doesn't work under gedit 3.14

Traceback (most recent call last):
  File "/home/nasser/.local/share/gedit/plugins/markdown-preview/__init__.py", line 113, in do_activate
    self.addMarkdownPreviewTab()
  File "/home/nasser/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in addMarkdownPreviewTab
    panel.add_item(self.scrolledWindow, "MarkdownPreview", _("Markdown Preview"), image)
AttributeError: 'Stack' object has no attribute 'add_item'
Traceback (most recent call last):
  File "/home/nasser/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
    self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
  File "/home/nasser/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
    self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
  File "/home/nasser/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
    self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
  File "/home/nasser/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
    self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
@nashamri
Copy link
Author

After looking around it seems that the GeditPanel was present in gedit 3.10.4 but not present in 3.12.2

@mashu
Copy link

mashu commented Nov 7, 2014

Can the markdown preview plugin be rewritten for gedit 3.14 ? Syntax highlighting is already there, but previow in side panel would be useful.

@fyksen
Copy link

fyksen commented Dec 7, 2014

Would love to see this!

@bbabel
Copy link

bbabel commented Mar 12, 2015

Yes, there's no point in a markdown plug-in if it doesn't have support for the last version of gedit. Would be great to have this fixed.

@bbabel
Copy link

bbabel commented Mar 26, 2015

I assume it won't work in the just released gedit 3.16... Just great!

@nielsmde
Copy link

I've looked into this issue yesterday and I think i figured out the problem.

There are actually two things that need to be rewritten. The easy one is the side-panel. Since gedit 3.12 the panels are represented as GStack which just has slightly different methods of adding widgets, e.g. GStack.add_titled().

The second issue is about the menu entries. UIManager is deprecated since 3.10 and therefore Gedit.window has no method get_ui_manager() anymore. The new way of adding menu items is described here. In short: you need a class that implements Gedit.AppActivatable that can add menu items.

I will try to fix this issue and submit a pull request hopefully the next days.

nielsmde added a commit to nielsmde/gedit-markdown that referenced this issue Aug 24, 2015
resolves jpfleury#3

The panels are represented as GtkStack since 3.10, which uses `add_titled(widget, name, title)` to insert new widgets.
nielsmde added a commit to nielsmde/gedit-markdown that referenced this issue Aug 24, 2015
This should fix jpfleury#3

Since 3.10 menu items can't be added via UIManager anymore (deprecated).
The *new* way is to have a seperate class of type `Gedit.AppActivatable`
that uses its own method `self.extend_menu(extension_point)` to get an
instance of `Gedit.MenuExtension` and extend the menu via this object.

The actions still have to be added to the window instance in the
original `Gedit.WindowActivatable` class. They can be added directly
to the window with `window.add_action(action)`.

The actions have to be of type `Gio.Action`. For now I used two
`Gio.SimpleAction` intead of action groups, but the old action groups
are defined for compatibility with the rest of the code.

I'm not sure if action groups are necessary, if so the window also has a
method `window.insert_action_group(Gio.ActionGroup)` that could be used.
But the implementation of `Gio` action groups is different to the `Gtk`
action groups.
nielsmde added a commit to nielsmde/gedit-markdown that referenced this issue Aug 24, 2015
This should fix jpfleury#3

Since 3.10 menu items can't be added via UIManager anymore (deprecated).
The *new* way is to have a seperate class of type `Gedit.AppActivatable`
that uses its own method `self.extend_menu(extension_point)` to get an
instance of `Gedit.MenuExtension` and extend the menu via this object.

The actions still have to be added to the window instance in the
original
`Gedit.WindowActivatable` class. They can be added directly to the
window with `window.add_action(action)`.

The actions have to be of type `Gio.Action`. For now I used two
`Gio.SimpleAction`
intead of action groups, but the old action groups are defined for
compatibility
with the rest of the code.

I'm not sure if action groups are necessary, if so the window also has a
method `window.insert_action_group(Gio.ActionGroup)` that could be used.
But the implementation of `Gio` action groups is different to the `Gtk`
action groups.
nielsmde added a commit to nielsmde/gedit-markdown that referenced this issue Aug 24, 2015
This should fix jpfleury#3

Since 3.10 menu items can't be added via UIManager anymore (deprecated).
The *new* way is to have a seperate class of type `Gedit.AppActivatable`
that uses its own method `self.extend_menu(extension_point)` to get an
instance of `Gedit.MenuExtension` and extend the menu via this object.

The actions still have to be added to the window instance in the
original
`Gedit.WindowActivatable` class. They can be added directly to the
window with `window.add_action(action)`.

The actions have to be of type `Gio.Action`. For now I used two
`Gio.SimpleAction`
intead of action groups, but the old action groups are defined for
compatibility
with the rest of the code.

I'm not sure if action groups are necessary, if so the window also has a
method `window.insert_action_group(Gio.ActionGroup)` that could be used.
But the implementation of `Gio` action groups is different to the `Gtk`
action groups.
@ljoets
Copy link

ljoets commented Nov 11, 2015

Hi !
I just tried last version on Gedit 3.14 (Debian Jessie distro), and it still not works.
Did you solved the problem ?
Thanks ;-)

@whbruce
Copy link

whbruce commented Jan 5, 2016

@nielsmde - thanks for the fix!

@Rat-S
Copy link

Rat-S commented Mar 6, 2016

Unfortunately, it still doesn't work with Gedit 3.18

@nielsmde
Copy link

nielsmde commented Mar 6, 2016

Which branch did you try out? Master or my patches version?

The pull request #9 for the fix is apparently still open. Hence,at the moment the fixed code is only available in this branch.

@whbruce
Copy link

whbruce commented Mar 7, 2016

@nielsmde. I used the version on your fork and wanted others to know it was there.

@nielsmde
Copy link

nielsmde commented Mar 8, 2016

That I got, my question was directed at @Rat-S, who wrote that it is still not working for him.

@lahmann
Copy link

lahmann commented Oct 21, 2016

@nielsmde I just tried your branch with gedit 3.18.3 (Fedora 23) -- unfortunately it does not work:

Traceback (most recent call last):
  File "/home/user/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
    self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'

@techping
Copy link

techping commented Jan 9, 2017

@nielsmde Thanks your pull,it successfully work with my gedit 3.18

@iurisegtovich
Copy link

thanks @nielsmde
I just re-installed from your fork "https://github.com/nielsmde/gedit-markdown/archive/master.zip" and it works in my 3.18 too

@darkdragon-001
Copy link

Please note my fork (based on @nielsmde's work): https://github.com/darkdragon-001/gedit-markdown/

Please test the latest release. Pull requests are always welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests