def GetLastLevel(self): """ Returns the last loaded level """ if not self.custom: return setting('LastLevel') name = 'LastLevel_' + self.name stg = setting(name) # Use the default if there are no settings for this yet if stg is None: return setting('LastLevel') else: return stg
def GetGamePath(self): """ Returns the game path """ if not self.custom: return str(setting('GamePath')) name = 'GamePath_' + self.name setname = setting(name) # Use the default if there are no settings for this yet if setname is None: return str(setting('GamePath')) else: return str(setname)
def SetAppStyle(styleKey=''): """ Set the application window color """ # Change the color if applicable if globals.theme.color( 'ui') is not None and not globals.theme.forceStyleSheet: globals.app.setPalette(QtGui.QPalette(globals.theme.color('ui'))) # Change the style if not styleKey: styleKey = setting('uiStyle', "Fusion") style = QtWidgets.QStyleFactory.create(styleKey) globals.app.setStyle(style) # Apply the style sheet, if exists if globals.theme.styleSheet: globals.app.setStyleSheet(globals.theme.styleSheet) # Manually set the background color if globals.theme.forceUiColor and not globals.theme.forceStyleSheet: color = globals.theme.color('ui').getRgb() bgColor = "#%02x%02x%02x" % tuple(map(lambda x: x // 2, color[:3])) globals.app.setStyleSheet(""" QListView, QTreeWidget, QLineEdit, QDoubleSpinBox, QSpinBox, QTextEdit{ background-color: %s; }""" % bgColor)
def LoadTheme(): """ Loads the theme """ id = setting('Theme') if id is None: id = 'Classic' print('THEME ID: ' + str(id)) globals.theme = MiyamotoTheme(id)
def GetGamePaths(self): """ Returns game paths of this gamedef and its bases """ mainpath = str(setting('GamePath')) if not self.custom: return [ mainpath, ] name = 'GamePath_' + self.name stg = setting(name) if self.base is None: return [mainpath, stg] else: paths = self.base.GetGamePaths() paths.append(stg) return paths
def LoadTranslation(): """ Loads the translation """ name = setting('Translation') eng = (None, 'None', 'English', '', 0) if name in eng: globals.trans = MiyamotoTranslation(None) else: globals.trans = MiyamotoTranslation(name) if globals.generateStringsXML: globals.trans.generateXML()
def __init__(self): super().__init__() self.setTitle("Objects Path (optional)") self.setSubTitle("Choose the folder containing object folders") self.requireFinish = False self.isValidPathMethod = isValidObjectsPath path = setting('ObjPath') if path: self.pathLineEdit.setText(path)
def isValidObjectsPath(path='ug'): if path == 'ug': path = setting('ObjPath') if not (path and os.path.isdir(path)): return False folders = os.listdir(path) for folder in folders: folderPath = os.path.join(path, folder) if not os.path.isdir(folderPath): continue files = [ file for file in os.listdir(folderPath) if file[-5:] == ".json" ] for file in files: filePath = os.path.join(folderPath, file) if not os.path.isfile(filePath): continue with open(filePath) as inf: jsonData = json.load(inf) if not ("colls" in jsonData and "meta" in jsonData and "objlyt" in jsonData and "img" in jsonData and "nml" in jsonData): continue found = True for f in ["colls", "meta", "objlyt", "img", "nml"]: if not os.path.isfile(os.path.join(folderPath, jsonData[f])): found = False break if found: return True return False