pathchooser.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:poseidon 作者: sidus-dev 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号