nncli

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

commit 1af3e7da8323693e622b5ffbf803daddf17ffd97
parent e544771db37edc1908b0a60fdcc7ad6b23f7550b
Author: Eric Davis <edavis@insanum.com>
Date:   Thu, 10 Jul 2014 15:11:39 -0700

new keybind commands for sorting the note list via date or alpha

Diffstat:
Msncli.py | 12++++++++++++
Mview_titles.py | 5+++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/sncli.py b/sncli.py @@ -620,6 +620,18 @@ def gui_frame_keypress(self, size, key): self.view_titles.update_note_list(None) self.gui_body_set(self.view_titles) + elif key == self.config.get_keybind('sort_date'): + if self.gui_body_get().__class__ != view_titles.ViewTitles: + return key + + self.view_titles.sort_note_list('date') + + elif key == self.config.get_keybind('sort_alpha'): + if self.gui_body_get().__class__ != view_titles.ViewTitles: + return key + + self.view_titles.sort_note_list('alpha') + else: return lb.keypress(size, key) diff --git a/view_titles.py b/view_titles.py @@ -25,6 +25,11 @@ def update_note_list(self, search_string): else: self.focus_position = 0 + def sort_note_list(self, sort_mode): + self.ndb.filtered_notes_sort(self.note_list, sort_mode) + self.body[:] = \ + urwid.SimpleFocusListWalker(self.get_note_titles()) + def format_title(self, note): """ Various formatting tags are supporting for dynamically building