kopia lustrzana https://github.com/ihabunek/toot
Use context for writing to file
rodzic
61990822e5
commit
c7f9f06f72
|
@ -42,9 +42,8 @@ class StatusSource(urwid.Padding):
|
|||
def save_json(self):
|
||||
filename = self.filename_edit.get_text()[0][10:] # skip "Filename: "
|
||||
if filename:
|
||||
f = open(filename, "w")
|
||||
f.write(self.source)
|
||||
f.close()
|
||||
with open(filename, "w") as f:
|
||||
f.write(self.source)
|
||||
self.status_text.set_text(("footer_message", f"Saved to {filename}"))
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue