def force_save(self, content, name):
d = Gtk.FileChooserDialog("{}: {}".format(_("Save as"), name), self,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
d.set_current_name(name)
d.set_default_size(int(width), int(height))
response = d.run()
if response == Gtk.ResponseType.OK:
if os.path.exists(d.get_filename()):
if self.do_decision(name): pass
else:
d.destroy()
return True
with open(d.get_filename(), 'w') as f:
f.write(content)
f.close()
d.destroy()
评论列表
文章目录