Use short titles in breadcrumbs

When possible, try to shorten the screen title to the shortest
length possible while still being descriptive enough to help
the user navigate.

Also, make the space for the ellipses available for use for
titles that do not need them.

Change-Id: I82e08ac60451e81c2e5a51f8595fb19234f23859
This commit is contained in:
James E. Blair 2016-04-24 09:40:53 -07:00
parent a6689f9e15
commit 37ef05652d
3 changed files with 10 additions and 2 deletions

View File

@ -148,9 +148,11 @@ class BreadCrumbBar(urwid.WidgetWrap):
super(BreadCrumbBar, self).__init__(self.display_widget)
def _get_breadcrumb_text(self, screen):
title = getattr(screen, 'title', str(screen))
title = getattr(screen, 'short_title', None)
if not title:
title = getattr(screen, 'title', str(screen))
text = "%s %s" % (BreadCrumbBar.BREADCRUMB_SYMBOL, title)
if len(text) > 20:
if len(text) > 23:
text = "%s..." % text[:20]
return urwid.Text(text, wrap='clip')

View File

@ -256,6 +256,10 @@ class ChangeListView(urwid.WidgetWrap):
self.title = u'Unreviewed changes in %s' % self.query_desc
else:
self.title = u'All changes in %s' % self.query_desc
self.short_title = self.query_desc
if '/' in self.short_title and ' ' not in self.short_title:
i = self.short_title.rfind('/')
self.short_title = self.short_title[i+1:]
self.app.status.update(title=self.title)
categories = set()
for change in change_list:

View File

@ -315,10 +315,12 @@ class ProjectListView(urwid.WidgetWrap):
def refresh(self):
if self.subscribed:
self.title = u'Subscribed projects'
self.short_title = self.title[:]
if self.unreviewed:
self.title += u' with unreviewed changes'
else:
self.title = u'All projects'
self.short_title = self.title[:]
self.app.status.update(title=self.title)
with self.app.db.getSession() as session:
i = 0