From d54218f28ab2e22564959bb346dcc203d9b3d890 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Tue, 8 May 2012 10:37:39 +0100 Subject: [PATCH] Added "Explain this decision" menu item --- zeroinstall/0launch-gui/impl_list.py | 10 ++++++++++ zeroinstall/0launch-gui/properties.py | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/zeroinstall/0launch-gui/impl_list.py b/zeroinstall/0launch-gui/impl_list.py index 5f8817f..d246bf8 100644 --- a/zeroinstall/0launch-gui/impl_list.py +++ b/zeroinstall/0launch-gui/impl_list.py @@ -5,6 +5,7 @@ import gtk, gobject, os, pango from zeroinstall import _ from zeroinstall.injector import model, writer from zeroinstall import support +from zeroinstall.gtkui import gtkutils import utils def _build_stability_menu(policy, impl): @@ -141,10 +142,19 @@ class ImplementationList: item.show() menu.append(item) + item = gtk.MenuItem(_('Explain this decision')) + item.connect('activate', lambda item: self.show_explaination(impl)) + item.show() + menu.append(item) + menu.popup(None, None, None, bev.button, bev.time) self.tree_view.connect('button-press-event', button_press) + def show_explaination(self, impl): + reason = self.policy.solver.justify_decision(self.policy.requirements, self.interface, impl) + gtkutils.show_message_box(self.tree_view.get_toplevel(), reason, gtk.MESSAGE_INFO) + def get_selection(self): return self.tree_view.get_selection() diff --git a/zeroinstall/0launch-gui/properties.py b/zeroinstall/0launch-gui/properties.py index 30d4f4f..b9e4e1a 100644 --- a/zeroinstall/0launch-gui/properties.py +++ b/zeroinstall/0launch-gui/properties.py @@ -510,7 +510,11 @@ is provided by your distribution's package manager, not by Zero Install. \ In off-line mode, only cached implementations are considered for use. Arch indicates what kind of computer system the implementation is for, or 'any' \ -if it works with all types of system.""") + '\n'), +if it works with all types of system. + +If you want to know why a particular version wasn't chosen, right-click over it \ +and choose "Explain this decision" from the popup menu. +""") + '\n'), (_('Sort order'), '\n' + _("""The implementations are ordered by version number (highest first), with the \ currently selected one in bold. This is the "best" usable version. -- 2.11.4.GIT