Пример #1
0
        def __setSimpleData():
            u = UserUtil()
            self.mainWindow.UserName.setText(u.userName)

            def getModName(path):
                temp = path.split('/')
                return temp[len(temp) - 1]

            tempPathX = currentProPath()
            if tempPathX != "":
                modName = getModName(tempPathX)
                self.mainWindow.ModName.setText(modName)
                self.mainWindow.ModeAndPath.setText(modName + "(" + tempPathX +
                                                    ")")
            else:
                self.mainWindow.ModName.setText("未打开工作Mod文件夹")
                return
            PackageInfo = {}
            with open(tempPathX + "/PackageInfo.json",
                      mode="r",
                      encoding="utf-8") as f:
                try:
                    PackageInfo = json.loads(f.read())
                except:
                    pass
            tempGamePath = GamePath
            if len(GamePath) > 30:
                tempGamePath = GamePath[:14] + '...' + GamePath[-14:]
            self.mainWindow.GamePath.setText(tempGamePath)
            self.mainWindow.GamePath.setToolTip(GamePath)
            self.mainWindow.description.setText(
                PackageInfo.get("description", "未设置mod介绍,写点什么吧"))

            self.mainWindow.recentProjectList.clear()
            for projectPath in u.getRecentProjectPathList():
                temp = tempPathX.split('/')
                self.mainWindow.ModName.setText(temp[len(temp) - 1])
                self.mainWindow.ModeAndPath.setText(temp[len(temp) - 1] + "(" +
                                                    tempPathX + ")")

                item = QListWidgetItem(QIcon(projectPath + "/icon.png"),
                                       getModName(projectPath),
                                       self.mainWindow.recentProjectList)
                item.modPath = projectPath
                self.mainWindow.recentProjectList.addItem(item)

            self.CTL.clearAllTab()