def clearCharacters(self): if promptYesNo('Really clear all characters?') == 16384: self.characters = [] self.characterSelector.clear() jsondump(self.dump(), ospath.join(CHAR_DIR, "autosave.rgc")) self.updateDeleteButton() self.setCharacterPreview()
def saveSession(): filename = promptSaveFile(translate('views', 'Save Game Session'), translate('views', 'Random Game files (*.rgg)'), MAP_DIR) if not filename: return jsondump(GlobalState.session.dump(), checkFileExtension(filename, ".rgg"))
def deleteCharacter(self): if self.hasCharacters(): self.characters.pop(self.characterSelector.currentIndex()) self.characterSelector.removeItem( self.characterSelector.currentIndex()) jsondump(self.dump(), ospath.join(CHAR_DIR, "autosave.rgc")) self.updateDeleteButton()
def removeCurrentMacro(self): if self.diceArea.item(self.currentMacro) != self.diceArea.currentItem( ): #This SHOULD, probably, only occur if there are two items and the first is deleted. Probably. self.diceArea.takeItem(0) return self.diceArea.takeItem(self.currentMacro) jsondump(self.dump(), ospath.join(SAVE_DIR, "dice.rgd"))
def newCharacter(self): dialog = newCharacterDialog() def accept(): valid = dialog.is_valid() if not valid: showErrorMessage(dialog.error) return valid if dialog.exec_(self.parentWidget(), accept): newchardat = dialog.save() newchar = ICChar(*newchardat) self.characterSelector.addItem(newchar.id) self.characters.append(newchar) jsondump(self.dump(), ospath.join(CHAR_DIR, "autosave.rgc")) self.characterSelector.setCurrentIndex( self.characterSelector.count() - 1) self.updateDeleteButton() self.setCharacterPreview()
def _newChar(self, char): self.characterSelector.addItem(char.id) self.characters.append(char) jsondump(self.dump(), ospath.join(CHAR_DIR, "autosave.rgc"))
def autosaveSession(): jsondump(GlobalState.session.dump(), ospath.join(MAP_DIR, "autosave.rgg"))
def addMacro(self, mac, macname): self.macros.append( QListWidgetItem(QIcon('data/dice.png'), macname + ': ' + mac)) self.diceArea.addItem(self.macros[len(self.macros) - 1]) jsondump(self.dump(), ospath.join(SAVE_DIR, "dice.rgd"))