main_tk_replicator.py 文件源码

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

项目:qal 作者: OptimalBPM 项目源码 文件源码
def on_save_json(self, *args):
        """Triggered when save-button is clicked.
        Displays a save dialog, fetches GUI data into merge, and saves as JSON into the selected file."""
        self.notify_task('Saving..', 0)
        _filename = filedialog.asksaveasfilename(initialfile= self.filename, defaultextension=".json",
                                                 filetypes=[('JSON files', '.json'), ('all files', '.*')],
                                                 title="Choose location")
        if _filename:
            self._gui_to_merge()
            self.notify_task('Saving(Generating JS)..', 0)
            _json = self.merge.as_json()
            self.notify_task('Saving(Writing file)..', 50)
            with open (_filename, "w") as _f:
                json.dump(_json, fp=_f, sort_keys=True, indent=4)

            self.notify_task('Saving..done.', 100)
        else:
            self.notify_task('Saving cancelled.', 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号