[kupfer] plugin.fileactions: Add action CreateArchiveIn
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.fileactions: Add action CreateArchiveIn
- Date: Sun, 23 Aug 2009 11:27:50 +0000 (UTC)
commit cda6205d5e71b5c4aba67d612293e2bea42419fc
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sat Aug 22 04:05:49 2009 +0200
plugin.fileactions: Add action CreateArchiveIn
kupfer/plugin/fileactions.py | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/fileactions.py b/kupfer/plugin/fileactions.py
index 3db70e0..ea73122 100644
--- a/kupfer/plugin/fileactions.py
+++ b/kupfer/plugin/fileactions.py
@@ -5,6 +5,7 @@ from os import path as os_path
from kupfer.objects import Action, FileLeaf
from kupfer import utils, pretty, task
+from kupfer import plugin_support
__kupfer_name__ = _("File Actions")
@@ -15,7 +16,8 @@ __kupfer_actions__ = (
"MoveTo",
"CopyTo",
"UnpackHere",
- "CreateArchive"
+ "CreateArchive",
+ "CreateArchiveIn",
)
__description__ = _("More file actions")
__version__ = ""
@@ -151,3 +153,29 @@ class CreateArchive (Action):
yield FileLeaf
def get_description(self):
return _("Create a compressed archive from folder")
+
+class CreateArchiveIn (Action):
+ def __init__(self):
+ Action.__init__(self, _("Create Archive In..."))
+ def activate(self, leaf, iobj):
+ archive_type = ".tar.gz"
+ dirpath = iobj.object
+ basename = os_path.basename(leaf.object)
+ archive_path = \
+ utils.get_destpath_in_directory(dirpath, basename, archive_type)
+ utils.launch_commandline("file-roller --add-to='%s' '%s'" %
+ (archive_path, leaf.object))
+
+ def valid_for_item(self, item):
+ # FIXME: Only for directories right now
+ return item.is_dir()
+ def item_types(self):
+ yield FileLeaf
+ def requires_object(self):
+ return True
+ def object_types(self):
+ yield FileLeaf
+ def valid_object(self, obj, for_item=None):
+ return utils.is_directory_writable(obj.object)
+ def get_description(self):
+ return _("Create a compressed archive from folder")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]