def __init__(self, endpoint, **params):
self.file_descriptor, self.path = tempfile.mkstemp()
with open(self.path, "w") as _:
if params.get("init_body"):
init_body = params.pop("init_body")
else:
init_body = ""
_.write(init_body)
self.endpoint = endpoint
self.params = params
env = os.environ
# barring this, programs will happily spit out unicode chars which
# urwid+python3 seem to choke on. This seems to be a bug on urwid's
# behalf. Users who take issue to programs trying to supress unicode
# should use the options menu to switch to Overthrow mode.
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, app.prefs["edit_escapes"]["abort"])
urwid.connect_signal(self, "closed", self.exterminate)
评论列表
文章目录