posted on: 2010-09-19 11:08:54
Eye of Gnome (eog) is an image viewer for Gnome, it is the default view with ubuntu. Gimp is an image editor, this plugin allows you to open gimp with the current image from eog.
>Eye of Gnome (eog) is an image viewer for Gnome, it is the default viewer for ubuntu. Gimp is an image editor, this plugin allows you to open gimp with the current image from eog.
At the eog main page you can find a short example on writing plugins for eog. I have written this plugin based on the python consol plugin that comes with eog.
If you are just interested in the plugin, eog plugin. Though the plugin is a little outdated because there is an 'open with' in the file menu.
First thing you need to create is a eog plugin file, I've named mine "gimplauch.eog-plugin"
[Eog Plugin] Loader=python Module=pythongimp IAge=2 Name=Launch Gimp Description=Python console for Eye of GNOME Icon=about Authors=Matt Copyright=NA Website=http://orangepalantir.org
Then you need the plugin itself, mine has been named "pythongimp.py"
#!/usr/bin/env python import gtk import eog from console import PythonConsole import subprocess ui_str = """ <ui> <menubar name="MainMenu"> <menu name="ToolsMenu" action="Tools"> <separator/> <menuitem name="LaunchGimp" action="LaunchGimp"/> <separator/> </menu> </menubar> </ui> """ class LaunchGimpPlugin(eog.Plugin): def __init__(self): eog.Plugin.__init__(self) self.console_window = None def activate(self, window): data = dict() ui_manager = window.get_ui_manager() data['group'] = gtk.ActionGroup('LaunchGimp') data['group'].add_actions([('LaunchGimp', None, 'L_aunch Gimp', None, None, self.launch_cb)], window) ui_manager.insert_action_group(data['group'], 0) data['ui_id'] = ui_manager.add_ui_from_string(ui_str) window.set_data('LaunchGimpPluginInfo', data) window.connect('delete-event', self.self_deactivate) def deactivate(self, window): data = window.get_data('LaunchGimpPluginInfo') ui_manager = window.get_ui_manager() if(data): ui_manager.remove_ui(data['ui_id']) ui_manager.remove_action_group(data['group']) ui_manager.ensure_update() window.set_data("LaunchGimpPluginInfo", None) def launch_cb(self,action, window): img = window.get_image() if(img): f = img.get_file() subprocess.Popen(["gimp",f.get_path()]) def self_deactivate(self, window, event): self.deactivate(window)
Comments
admin
2011-12-13 21:31:01
Ok I will update this shortly to be used with Gnome 3.
hmm
2014-02-16 10:17:06
Great example. Thanks.