def saveTheme(self): settings = QSettings(self._editingTheme, QSettings.IniFormat) self._themeData["Name"] = self.txtThemeName.text() for key in self._themeData: settings.setValue(key, self._themeData[key]) settings.sync() self.populatesThemesList() self.themeStack.setCurrentIndex(0) self._editingTheme = None
def newTheme(self): path = writablePath("resources/themes") name = self.tr("newtheme") if os.path.exists(os.path.join(path, "{}.theme".format(name))): i = 1 while os.path.exists(os.path.join(path, "{}_{}.theme".format(name, i))): i += 1 name = os.path.join(path, "{}_{}.theme".format(name, i)) else: name = os.path.join(path, "{}.theme".format(name)) settings = QSettings(name, QSettings.IniFormat) settings.setValue("Name", self.tr("New theme")) settings.sync() self.populatesThemesList()