def save(self, name, download, url):
d = Gtk.FileChooserDialog("{}: {}".format(_("Save as"), name), self,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT))
d.set_current_name(name)
d.set_default_size(int(width), int(height))
response = d.run()
if response == Gtk.ResponseType.ACCEPT:
f = rtags(d.get_filename())
if os.path.exists(f):
if self.do_decision(f): download.set_allow_overwrite(True)
else:
download.cancel()
d.destroy()
return True
download.set_destination("file://{}".format(f))
elif response == Gtk.ResponseType.CANCEL\
or response == Gtk.ResponseType.DELETE_EVENT: download.cancel()
d.destroy()
评论列表
文章目录