Jendrik Seipp committed 485f317

Add files

Comments (0)

Files changed (3)

+Export plugin for Eye of GNOME
+This plugin adds a export menu button and the keyboard shortcut "E" to EOG.
+When pressed, the current image will be copied into the directory
+§HOME/exported-images. This allows you to browse your images comfortably in EOG
+and then copy some of them into a separate folder. From there you can e.g.
+zip and upload them somewhere or put them on a USB stick for printing.
+Installation: Copy all files into $HOME/.config/eog/plugins
+Usage: In EOG go to Edit->Preferences->Plugins and enable the Export plugin.
+Description=Export the current image to a separate directory
+Authors=Jendrik Seipp <>
+Copyright=Copyright © 2012 Jendrik Seipp
+# -*- coding: utf-8 -*-
+# -- export plugin for eog
+# Copyright (c) 2012  Jendrik Seipp (
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import os
+import shutil
+from gi.repository import GObject, Eog, Gtk
+ui_str = """
+    <menubar name="MainMenu">
+        <menu name="ToolsMenu" action="Tools">
+            <separator/>
+            <menuitem name="Export" action="Export"/>
+            <separator/>
+        </menu>
+    </menubar>
+class HelloWorldPlugin(GObject.Object, Eog.WindowActivatable):
+    window =
+    def __init__(self):
+        GObject.Object.__init__(self)
+    def do_activate(self):
+        print 'Activating export plugin'
+        ui_manager = self.window.get_ui_manager()
+        self.action_group = Gtk.ActionGroup('Export')
+        self.action_group.add_actions([('Export', None,
+                _('_Export'), "E", None, self.export_cb)], self.window)
+        ui_manager.insert_action_group(self.action_group, 0)
+        self.ui_id = ui_manager.add_ui_from_string(ui_str)
+        self.export_dir = os.path.join(os.path.expanduser('~'), 'exported-images')
+        # Create directory if it doesn't exist.
+        try:
+            os.makedirs(self.export_dir)
+        except OSError:
+            pass
+        print 'Exporting to %s' % self.export_dir
+    def do_deactivate(self):
+        print 'Export plugin deactivated'
+    def export_cb(self, action, window):
+        # Get path to current image.
+        src = window.get_image().get_file().get_path()
+        name = os.path.basename(src)
+        dest = os.path.join(self.export_dir, name)
+        shutil.copy2(src, dest)
+        print 'Copied %s to %s' % (name, self.export_dir)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.