pathchooser.py 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号