[kupfer] plugin.apt_tools: Provide package information action
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.apt_tools: Provide package information action
- Date: Tue, 27 Oct 2009 00:01:30 +0000 (UTC)
commit a3b29bf01db750179902c0e5e2a271d76b1e8aed
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Oct 26 01:35:25 2009 +0100
plugin.apt_tools: Provide package information action
kupfer/plugin/apt_tools.py | 50 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/apt_tools.py b/kupfer/plugin/apt_tools.py
new file mode 100644
index 0000000..54b7b15
--- /dev/null
+++ b/kupfer/plugin/apt_tools.py
@@ -0,0 +1,50 @@
+import subprocess
+
+import glib
+import gtk
+
+from kupfer.objects import Action
+from kupfer.objects import TextLeaf
+from kupfer import task, uiutils
+
+
+__kupfer_name__ = _("APT Package Tools")
+__kupfer_sources__ = ()
+__kupfer_text_sources__ = ()
+__kupfer_actions__ = ("ShowPackageInfo", )
+__description__ = _("Interface with the package manager APT")
+__version__ = ""
+__author__ = ("VCoolio <martinkoelewijn gmail com>, "
+ "Ulrik Sverdrup <ulrik sverdrup gmail com>")
+
+
+class InfoTask(task.ThreadTask):
+ def __init__(self, text):
+ super(InfoTask, self).__init__()
+ self.text = text
+ def thread_do(self):
+ P = subprocess.PIPE
+ apt = subprocess.Popen("aptitude show '%s'" % self.text, shell=True,
+ stdout=P, stderr=P)
+ acp = subprocess.Popen("apt-cache policy '%s'" % self.text, shell=True,
+ stdout=P, stderr=P)
+ apt_out, apt_err = apt.communicate()
+ acp_out, acp_err = acp.communicate()
+ self.info = "%s%s%s\n\n%s" % (apt_err, acp_err, apt_out, acp_out)
+ def thread_finish(self):
+ uiutils.show_text_result(self.info, title=_("Show Package Information"))
+
+class ShowPackageInfo (Action):
+ def __init__(self):
+ Action.__init__(self, _("Show Package Information"))
+
+ def is_async(self):
+ return True
+ def activate(self, leaf):
+ return InfoTask(leaf.object)
+
+ def get_icon_name(self):
+ return "synaptic"
+ def item_types(self):
+ yield TextLeaf
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]