aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-20 00:09:58 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-20 00:10:11 +0100
commitd0f8088176b96b41bb7fe5911b9a224883b4b9f1 (patch)
tree2495aa0984e6174c62e5162ede66b9116c86a0cd /patches
parent3936ddc576d7e896f5894902bcb19a045709fd6f (diff)
downloadNix-d0f8088176b96b41bb7fe5911b9a224883b4b9f1.tar.gz
Nix-d0f8088176b96b41bb7fe5911b9a224883b4b9f1.tar.zst
Nix-d0f8088176b96b41bb7fe5911b9a224883b4b9f1.zip
Add note taking applications
Diffstat (limited to 'patches')
-rw-r--r--patches/terminal_velocity_fix_build.patch15
-rw-r--r--patches/terminal_velocity_sort_found_notes.patch67
2 files changed, 82 insertions, 0 deletions
diff --git a/patches/terminal_velocity_fix_build.patch b/patches/terminal_velocity_fix_build.patch
new file mode 100644
index 0000000..5c7f716
--- /dev/null
+++ b/patches/terminal_velocity_fix_build.patch
@@ -0,0 +1,15 @@
1diff --git a/setup.py b/setup.py
2index 84a99e9..a783dff 100644
3--- a/setup.py
4+++ b/setup.py
5@@ -1,7 +1,9 @@
6 from setuptools import setup
7 from m2r import parse_from_file
8 import restructuredtext_lint
9-from mister_bump import bump
10+
11+def bump():
12+ return "0.2.0"
13
14 # Parser README.md into reStructuredText format
15 rst_readme = parse_from_file('README.md')
diff --git a/patches/terminal_velocity_sort_found_notes.patch b/patches/terminal_velocity_sort_found_notes.patch
new file mode 100644
index 0000000..8296d54
--- /dev/null
+++ b/patches/terminal_velocity_sort_found_notes.patch
@@ -0,0 +1,67 @@
1diff --git a/terminal_velocity/terminal_velocity.py b/terminal_velocity/terminal_velocity.py
2index db2eb05..bb77dc6 100755
3--- a/terminal_velocity/terminal_velocity.py
4+++ b/terminal_velocity/terminal_velocity.py
5@@ -75,6 +75,10 @@ the default default will be used"""
6 default=defaults.get("log_file", "~/.tvlog"),
7 help="the file to log to (default: %(default)s)")
8
9+ parser.add_argument("-s", "--sort", dest="sort", action="store",
10+ default=defaults.get("sort", "date"),
11+ help="the note sorting rules. Possible values: date, title (default: %(default)s)")
12+
13 parser.add_argument("-p", "--print-config", dest="print_config",
14 action="store_true", default=False,
15 help="print your configuration settings then exit")
16@@ -120,7 +124,7 @@ the default default will be used"""
17 try:
18 urwid_ui.launch(notes_dir=args.notes_dir, editor=args.editor,
19 extension=args.extension, extensions=args.extensions,
20- exclude=args.exclude)
21+ exclude=args.exclude, sort=args.sort)
22 except KeyboardInterrupt:
23 # Silence KeyboardInterrupt tracebacks on ctrl-c.
24 sys.exit()
25diff --git a/terminal_velocity/urwid_ui.py b/terminal_velocity/urwid_ui.py
26index 34cf4f6..caebcb9 100644
27--- a/terminal_velocity/urwid_ui.py
28+++ b/terminal_velocity/urwid_ui.py
29@@ -237,11 +237,12 @@ class NoteFilterListBox(urwid.ListBox):
30 class MainFrame(urwid.Frame):
31 """The topmost urwid widget."""
32
33- def __init__(self, notes_dir, editor, extension, extensions, exclude=None):
34+ def __init__(self, notes_dir, editor, extension, extensions, exclude=None, sort="date"):
35
36 self.editor = editor
37 self.notebook = notebook.PlainTextNoteBook(notes_dir, extension,
38 extensions, exclude=exclude)
39+ self.sort = sort
40
41 # Don't filter the note list when the text in the search box changes.
42 self.suppress_filter = False
43@@ -408,7 +409,10 @@ class MainFrame(urwid.Frame):
44
45 # Sort the notes.
46 # TODO: Support different sort orderings.
47- matching_notes.sort(key=lambda x: x.mtime, reverse=True)
48+ if self.sort == "title":
49+ matching_notes.sort(key=lambda x: x.title)
50+ else:
51+ matching_notes.sort(key=lambda x: x.mtime, reverse=True)
52
53 # Tell the list box to show only the matching notes.
54 self.list_box.filter(matching_notes)
55@@ -433,10 +437,10 @@ class MainFrame(urwid.Frame):
56 self.selected_note = note
57
58
59-def launch(notes_dir, editor, extension, extensions, exclude=None):
60+def launch(notes_dir, editor, extension, extensions, exclude=None, sort="date"):
61 """Launch the user interface."""
62
63- frame = MainFrame(notes_dir, editor, extension, extensions, exclude=exclude)
64+ frame = MainFrame(notes_dir, editor, extension, extensions, exclude=exclude, sort=sort)
65 loop = urwid.MainLoop(frame, palette)
66 frame.loop = loop
67 loop.run()