diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2009-07-05 02:55:10 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2009-07-05 02:55:10 +0200 |
commit | 07201291ae3a145e4b7c66253370b2acd9206db1 (patch) | |
tree | ff03534826637132443a9c44d05852b6dd4186ba /plugins | |
parent | ccbffddc8d4d0b983536ceb46cabf1c698cc5e78 (diff) | |
download | portato-07201291ae3a145e4b7c66253370b2acd9206db1.tar.gz portato-07201291ae3a145e4b7c66253370b2acd9206db1.tar.bz2 portato-07201291ae3a145e4b7c66253370b2acd9206db1.zip |
Add package_details.py to show Changelog and other tabs
Diffstat (limited to '')
-rw-r--r-- | plugins/package_details.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/plugins/package_details.py b/plugins/package_details.py new file mode 100644 index 0000000..2ae9f56 --- /dev/null +++ b/plugins/package_details.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/package_details.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2006-2009 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann <necoro@necoro.net> + +import gtk +import os +from portato.gui.views import HighlightView + +class Detail (WidgetPlugin): + __author__ = "René 'Necoro' Neumann" + _view_ = None + old_pkg = None + + def init(self): + self.add_call("update_table", self._update, type = "after") + + def widget_init (self): + self.add_widget("Package Notebook", (self._widget_, self._widget_name_)) + + if self._old_pkg is not None: + self._update(self._old_pkg) + + def _update (self, pkg, page = None): + if self._view_ is not None: + if page is None: + force = False + else: + force = page == self._view_.get_parent() + + self._view_.update(pkg, force = force) + self._old_pkg = None + else: + self._old_pkg = pkg + +class ScrolledDetail (Detail): + + def widget_init (self): + self._widget_ = gtk.ScrolledWindow() + self._widget_.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + if self._view_ is not None: + self._widget_.add(self._view_) + + Detail.widget_init(self) + self._widget_.show_all() + +class ChangelogDetail (ScrolledDetail): + __description__ = "Shows the Changelog of a package" + _widget_name_ = "Changelog" + + def widget_init (self): + self._view_ = HighlightView(lambda p: os.path.join(p.get_package_path(), "ChangeLog"), ["changelog"]) + ScrolledDetail.widget_init(self) + +register(ChangelogDetail) |