From 2cd7c5d37cb6c68de9e449d4b7a731744ff3407f Mon Sep 17 00:00:00 2001 From: Blake DeMarcy Date: Fri, 7 Apr 2017 17:40:30 -0500 Subject: [PATCH] a little bit of reply polish --- clients/urwid/main.py | 25 +++++++++++++++---------- 1 file 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()