diff options
author | Blake DeMarcy <ofunknowndescent@gmail.com> | 2017-04-07 17:40:30 -0500 |
---|---|---|
committer | Blake DeMarcy <ofunknowndescent@gmail.com> | 2017-04-07 17:40:30 -0500 |
commit | 2cd7c5d37cb6c68de9e449d4b7a731744ff3407f (patch) | |
tree | 8b4e0219ba646b33ebfa5761929c37249e2a06af /clients/urwid/main.py | |
parent | b6e5ad80e9ca5aa71bec0afba3f69979a154c02d (diff) | |
download | bbj-2cd7c5d37cb6c68de9e449d4b7a731744ff3407f.tar.gz |
a little bit of reply polish
Diffstat (limited to 'clients/urwid/main.py')
-rw-r--r-- | clients/urwid/main.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/clients/urwid/main.py b/clients/urwid/main.py index 575dad4..98d2f89 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -47,7 +47,8 @@ colors = [ editors = ["nano", "emacs", "vim", "micro", "ed", "joe"] # defaults to internal editor, integrates the above as well default_prefs = { - "editor": False, + # well, it WILL default to the internal editor when I write it =) + "editor": "vim", "dramatic_exit": True } @@ -125,9 +126,15 @@ class App(object): return elif self.loop.widget.focus_position == "body": self.loop.widget.focus_position = "footer" + focus = "[focused on editor]" else: self.loop.widget.focus_position = "body" - + focus = "[focused on thread]" + if self.window_split: + control = ("" if self.prefs["editor"] else " [F3]Send") + self.loop.widget.footer[0].set_text( + "[F1]Abort [F2]Swap%s %s" % (control, focus) + ) def readable_delta(self, modified): @@ -285,13 +292,10 @@ class App(object): elif self.mode == "thread": self.window_split=True self.set_header('Replying to "{}"', self.thread["title"]) - self.loop.widget.footer = urwid.BoxAdapter( - urwid.Frame( - urwid.LineBox(editor("thread_reply", thread_id=self.thread["thread_id"])), - footer=urwid.AttrMap(urwid.Text("[F1]Abort [F2]Swap [F3]Send"), "bar") - ) - , - 20) + self.loop.widget.footer = urwid.Pile([ + urwid.AttrMap(urwid.Text(""), "bar"), + urwid.BoxAdapter(urwid.LineBox(editor("thread_reply", thread_id=self.thread["thread_id"])), 15), + ]) self.switch_editor() @@ -341,7 +345,7 @@ class ExternalEditor(urwid.Terminal): env.update({"LANG": "POSIX"}) command = ["bash", "-c", "{} {}; echo Press any key to kill this window...".format( app.prefs["editor"], self.path)] - super(ExternalEditor, self).__init__(command, env, app.loop) + super(ExternalEditor, self).__init__(command, env, app.loop, "f1") def keypress(self, size, key): @@ -355,6 +359,7 @@ class ExternalEditor(urwid.Terminal): elif key not in ["f1", "f2"]: return super(ExternalEditor, self).keypress(size, key) + elif key == "f1": self.terminate() app.close_editor() |