gui.py 文件源码

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

项目:fomod-designer 作者: GandaG 项目源码 文件源码
def open_path(self, path):
        """
        Method used to open a path in the main window - closes the intro window and show the main.

        :param path: The path to open.
        """
        main_window = MainFrame()
        self_center = self.mapToGlobal(self.rect().center())
        main_center = main_window.mapToGlobal(main_window.rect().center())
        main_window.move(self_center - main_center)
        main_window.open(path)
        main_window.show()
        self.close()
        if self.settings_dict["General"]["tutorial_advanced"]:
            main_window.setEnabled(False)
            tutorial = loadUi(join(cur_folder, "resources/templates/tutorial_advanced.ui"))
            tutorial.frame_node.resize(main_window.node_tree_view.size())
            tutorial.frame_node.move(
                main_window.node_tree_view.mapTo(main_window, main_window.node_tree_view.pos())
            )
            tutorial.frame_preview.resize(main_window.tabWidget.size())
            tutorial.frame_preview.move(
                main_window.tabWidget.mapTo(main_window, main_window.tabWidget.pos())
            )
            tutorial.frame_prop.resize(main_window.dockWidgetContents.size())
            tutorial.frame_prop.move(
                main_window.dockWidgetContents.mapTo(main_window, main_window.dockWidgetContents.pos())
            )
            tutorial.frame_child.resize(main_window.dockWidgetContents_3.size())
            tutorial.frame_child.move(
                main_window.dockWidgetContents_3.mapTo(main_window, main_window.dockWidgetContents_3.pos())
            )
            tutorial.button_exit.clicked.connect(lambda: main_window.setEnabled(True))
            tutorial.button_exit.clicked.connect(tutorial.close)
            tutorial.setParent(main_window)
            tutorial.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog)
            tutorial.setAttribute(Qt.WA_TranslucentBackground)
            main_center = main_window.mapToGlobal(main_window.rect().center())
            tutorial_center = tutorial.mapToGlobal(tutorial.rect().center())
            tutorial.move(main_center - tutorial_center)
            tutorial.setEnabled(True)
            tutorial.exec_()
            self.settings_dict["General"]["tutorial_advanced"] = False

        self.settings_dict["General"]["show_intro"] = not self.check_intro.isChecked()
        self.settings_dict["General"]["show_advanced"] = self.check_advanced.isChecked()
        makedirs(join(expanduser("~"), ".fomod"), exist_ok=True)
        with open(join(expanduser("~"), ".fomod", ".designer"), "w") as configfile:
            set_encoder_options("json", indent=4)
            configfile.write(encode(self.settings_dict))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号