a little bit of reply polish
parent
b6e5ad80e9
commit
2cd7c5d37c
|
@ -47,7 +47,8 @@ colors = [
|
||||||
editors = ["nano", "emacs", "vim", "micro", "ed", "joe"]
|
editors = ["nano", "emacs", "vim", "micro", "ed", "joe"]
|
||||||
# defaults to internal editor, integrates the above as well
|
# defaults to internal editor, integrates the above as well
|
||||||
default_prefs = {
|
default_prefs = {
|
||||||
"editor": False,
|
# well, it WILL default to the internal editor when I write it =)
|
||||||
|
"editor": "vim",
|
||||||
"dramatic_exit": True
|
"dramatic_exit": True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +126,15 @@ class App(object):
|
||||||
return
|
return
|
||||||
elif self.loop.widget.focus_position == "body":
|
elif self.loop.widget.focus_position == "body":
|
||||||
self.loop.widget.focus_position = "footer"
|
self.loop.widget.focus_position = "footer"
|
||||||
|
focus = "[focused on editor]"
|
||||||
else:
|
else:
|
||||||
self.loop.widget.focus_position = "body"
|
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):
|
def readable_delta(self, modified):
|
||||||
|
@ -285,13 +292,10 @@ class App(object):
|
||||||
elif self.mode == "thread":
|
elif self.mode == "thread":
|
||||||
self.window_split=True
|
self.window_split=True
|
||||||
self.set_header('Replying to "{}"', self.thread["title"])
|
self.set_header('Replying to "{}"', self.thread["title"])
|
||||||
self.loop.widget.footer = urwid.BoxAdapter(
|
self.loop.widget.footer = urwid.Pile([
|
||||||
urwid.Frame(
|
urwid.AttrMap(urwid.Text(""), "bar"),
|
||||||
urwid.LineBox(editor("thread_reply", thread_id=self.thread["thread_id"])),
|
urwid.BoxAdapter(urwid.LineBox(editor("thread_reply", thread_id=self.thread["thread_id"])), 15),
|
||||||
footer=urwid.AttrMap(urwid.Text("[F1]Abort [F2]Swap [F3]Send"), "bar")
|
])
|
||||||
)
|
|
||||||
,
|
|
||||||
20)
|
|
||||||
self.switch_editor()
|
self.switch_editor()
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +345,7 @@ class ExternalEditor(urwid.Terminal):
|
||||||
env.update({"LANG": "POSIX"})
|
env.update({"LANG": "POSIX"})
|
||||||
command = ["bash", "-c", "{} {}; echo Press any key to kill this window...".format(
|
command = ["bash", "-c", "{} {}; echo Press any key to kill this window...".format(
|
||||||
app.prefs["editor"], self.path)]
|
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):
|
def keypress(self, size, key):
|
||||||
|
@ -355,6 +359,7 @@ class ExternalEditor(urwid.Terminal):
|
||||||
|
|
||||||
elif key not in ["f1", "f2"]:
|
elif key not in ["f1", "f2"]:
|
||||||
return super(ExternalEditor, self).keypress(size, key)
|
return super(ExternalEditor, self).keypress(size, key)
|
||||||
|
|
||||||
elif key == "f1":
|
elif key == "f1":
|
||||||
self.terminate()
|
self.terminate()
|
||||||
app.close_editor()
|
app.close_editor()
|
||||||
|
|
Loading…
Reference in New Issue