[kupfer] plugin.image: Autorotate action
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.image: Autorotate action
- Date: Wed, 16 Sep 2009 14:22:38 +0000 (UTC)
commit 2a8c3ab1f436b950637a86af91d670e5508fd380
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Sep 15 16:28:13 2009 +0200
plugin.image: Autorotate action
kupfer/plugin/image.py | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/image.py b/kupfer/plugin/image.py
index 9ac42f6..f4c6113 100644
--- a/kupfer/plugin/image.py
+++ b/kupfer/plugin/image.py
@@ -13,6 +13,7 @@ __kupfer_actions__ = (
"Scale",
"Rotate90",
"Rotate270",
+ "Autorotate",
)
__description__ = _("Image transformation tools")
__version__ = ""
@@ -117,3 +118,27 @@ class Rotate270 (RotateBase):
def get_icon_name(self):
return "object-rotate-left"
+class Autorotate (Action):
+ def __init__(self):
+ Action.__init__(self, _("Autorotate"))
+
+ def has_result(self):
+ return True
+
+ def activate(self, leaf, obj=None):
+ fpath = leaf.object
+ dirname = os_path.dirname(fpath)
+ cmdline = "jhead -autorot '%s'" % fpath
+ utils.launch_commandline(cmdline)
+
+ def item_types(self):
+ yield FileLeaf
+
+ def valid_for_item(self, item):
+ # FIXME: Make this detection smarter
+ root, ext = os_path.splitext(item.object)
+ return ext.lower() in (".jpeg", ".jpg")
+
+ def get_description(self):
+ return _("Rotate JPEG image (in-place) according to its EXIF metadata")
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]