From f76e80c5fae108d29ba87a495cd92a1f185c1da2 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 1 Aug 2012 15:45:10 +0200 Subject: Sort resources from highest priority to lowest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Previously it was from lowest to highest - Add the “Priority:” info to the “i” key in the roster --- src/contact.py | 2 +- src/tabs.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/contact.py b/src/contact.py index 3de2f496..3a8e38ab 100644 --- a/src/contact.py +++ b/src/contact.py @@ -148,7 +148,7 @@ class Contact(object): def get_resources(self): """Return all resources, sorted by priority """ compare_resources = lambda x: x.priority - return sorted(self.resources, key=compare_resources) + return sorted(self.resources, key=compare_resources, reverse=True) def get_highest_priority_resource(self): """Return the resource with the highest priority""" diff --git a/src/tabs.py b/src/tabs.py index 4d52a285..7a9affb8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -2424,10 +2424,11 @@ class RosterInfoTab(Tab): res.status if res else '',) elif isinstance(selected_row, Resource): res = selected_row - msg = 'Resource: %s (%s)\nCurrent status: %s' % ( + msg = 'Resource: %s (%s)\nCurrent status: %s\nPriority: %s' % ( res.jid, res.presence, - res.status,) + res.status, + res.priority) elif isinstance(selected_row, RosterGroup): rg = selected_row msg = 'Group: %s [%s/%s] contacts online' % ( -- cgit v1.2.3