console: status bar improvements

- Arrow to show flow order
- Hook statusbar up to focus change to fix some update issues
This commit is contained in:
Aldo Cortesi 2016-10-30 18:25:33 +13:00
parent f08b57fb9b
commit 5975cc8301
2 changed files with 16 additions and 5 deletions

View File

@ -123,10 +123,14 @@ if urwid.util.detected_encoding:
SYMBOL_REPLAY = u"\u21ba"
SYMBOL_RETURN = u"\u2190"
SYMBOL_MARK = u"\u25cf"
SYMBOL_UP = u"\u21E7"
SYMBOL_DOWN = u"\u21E9"
else:
SYMBOL_REPLAY = u"[r]"
SYMBOL_RETURN = u"<-"
SYMBOL_MARK = "[m]"
SYMBOL_UP = "^"
SYMBOL_DOWN = " "
# Save file to disk

View File

@ -119,12 +119,13 @@ class StatusBar(urwid.WidgetWrap):
self.helptext = helptext
self.ib = urwid.WidgetWrap(urwid.Text(""))
super().__init__(urwid.Pile([self.ib, self.master.ab]))
signals.update_settings.connect(self.sig_update_settings)
signals.flowlist_change.connect(self.sig_update_settings)
master.options.changed.connect(self.sig_update_settings)
signals.update_settings.connect(self.sig_update)
signals.flowlist_change.connect(self.sig_update)
master.options.changed.connect(self.sig_update)
master.view.focus.sig_change.connect(self.sig_update)
self.redraw()
def sig_update_settings(self, sender, updated=None):
def sig_update(self, sender, updated=None):
self.redraw()
def keypress(self, *args, **kwargs):
@ -229,8 +230,14 @@ class StatusBar(urwid.WidgetWrap):
offset = 0
else:
offset = self.master.view.focus.index + 1
if self.master.options.order_reversed:
arrow = common.SYMBOL_UP
else:
arrow = common.SYMBOL_DOWN
t = [
('heading', ("[%s/%s]" % (offset, fc)).ljust(9))
('heading', ("%s [%s/%s]" % (arrow, offset, fc)).ljust(11)),
]
if self.master.server.bound: