file_chooser.py 文件源码

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

项目:Ebook-Viewer 作者: michaldaniel 项目源码 文件源码
def show_dialog(self, importing=False):
        """
        Displays FileChooserDialog with ePub file filters and returns Gtk.ResponseType and filename string
        :return (response, filename):
        """
        dialog = Gtk.FileChooserDialog(_("Please choose a file"), self, Gtk.FileChooserAction.OPEN,
                                       (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))

        # Always start in user dir
        dialog.set_current_folder(path.expanduser("~"))

        # Add filters so only .epub files show
        # TODO: Filter list for all conversion supported ebooks
        self.__add_filters(dialog, importing)

        response = dialog.run()
        filename = dialog.get_filename()
        dialog.destroy()

        return response, filename
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号