nncli

NextCloud Notes Command Line Interface
git clone git://git.danielmoch.com/nncli.git
Log | Files | Refs | LICENSE

commit c51c577f12c673d13eb45064158c2525ca26e3e1
parent 4fcc43e1bcf3bb4b720189ee1b72c9ab92989e8b
Author: Eric Davis <edavis@insanum.com>
Date:   Thu, 26 Jun 2014 21:21:41 -0700

enhanced each view's status bar info

Diffstat:
Msncli.py | 96++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 68 insertions(+), 28 deletions(-)

diff --git a/sncli.py b/sncli.py @@ -322,14 +322,20 @@ def __init__(self): def update_status(self): if self.status_location in [ 'header', 'footer' ]: - self.status = \ + status_title = \ urwid.AttrMap(urwid.Text( - [ - u' ' + - str(self.listbox.focus_position + 1) + - u'/' + - str(len(self.listbox.body.positions())), - ]), + u'Simplenote', + wrap='clip'), + 'status_bar') + status_index = \ + ('pack', urwid.AttrMap(urwid.Text( + u' ' + + str(self.listbox.focus_position + 1) + + u'/' + + str(len(self.listbox.body.positions()))), + 'status_bar')) + self.status = \ + urwid.AttrMap(urwid.Columns([ status_title, status_index ]), 'status_bar') self.contents[self.status_location] = ( self.status, None ) else: @@ -374,14 +380,36 @@ def __init__(self, nl_focus_index, tabstop): def update_status(self): if self.status_location in [ 'header', 'footer' ]: - self.status = \ + t = time.localtime(float(self.note['modifydate'])) + mod_time = time.strftime('%a, %d %b %Y %H:%M:%S', t) + tags = '%s' % ','.join(self.note['tags']) + status_title = \ urwid.AttrMap(urwid.Text( - [ - u' ' + - str(self.listbox.focus_position + 1) + - u'/' + - str(len(self.listbox.body.positions())), - ]), + u'Title: ' + + utils.get_note_title(self.note), + wrap='clip'), + 'status_bar') + status_index = \ + ('pack', urwid.AttrMap(urwid.Text( + u' ' + + str(self.listbox.focus_position + 1) + + u'/' + + str(len(self.listbox.body.positions()))), + 'status_bar')) + status_date = \ + urwid.AttrMap(urwid.Text( + u'Date: ' + + mod_time, + wrap='clip'), + 'status_bar') + status_tags = \ + ('pack', urwid.AttrMap(urwid.Text( + u'[' + tags + u']'), + 'status_bar')) + pile_top = urwid.Columns([ status_title, status_index ]) + pile_bottom = urwid.Columns([ status_date, status_tags ]) + self.status = \ + urwid.AttrMap(urwid.Pile([ pile_top, pile_bottom ]), 'status_bar') self.contents[self.status_location] = ( self.status, None ) else: @@ -434,14 +462,20 @@ def __init__(self): def update_status(self): if self.status_location in [ 'header', 'footer' ]: - self.status = \ + status_title = \ urwid.AttrMap(urwid.Text( - [ - u' ' + - str(self.listbox.focus_position + 1) + - u'/' + - str(len(self.listbox.body.positions())), - ]), + u'Sync Log', + wrap='clip'), + 'status_bar') + status_index = \ + ('pack', urwid.AttrMap(urwid.Text( + u' ' + + str(self.listbox.focus_position + 1) + + u'/' + + str(len(self.listbox.body.positions()))), + 'status_bar')) + self.status = \ + urwid.AttrMap(urwid.Columns([ status_title, status_index ]), 'status_bar') self.contents[self.status_location] = ( self.status, None ) else: @@ -506,14 +540,20 @@ def __init__(self): def update_status(self): if self.status_location in [ 'header', 'footer' ]: - self.status = \ + status_title = \ urwid.AttrMap(urwid.Text( - [ - u' ' + - str(self.listbox.focus_position + 1) + - u'/' + - str(len(self.listbox.body.positions())), - ]), + u'Help', + wrap='clip'), + 'status_bar') + status_index = \ + ('pack', urwid.AttrMap(urwid.Text( + u' ' + + str(self.listbox.focus_position + 1) + + u'/' + + str(len(self.listbox.body.positions()))), + 'status_bar')) + self.status = \ + urwid.AttrMap(urwid.Columns([ status_title, status_index ]), 'status_bar') self.contents[self.status_location] = ( self.status, None ) else: