示例#1
0
def updateChar():
    #Updates character's stats.
    nameBox = CE_Dialog.findChild(QtGui.QLineEdit, "nameBox")
    id = window.charList.currentIndex()
    name = str(window.charList.currentText())
    newkey = str(nameBox.text())

    dataFiles.replaceInDict(dataFiles.Characters, name, newkey)

    #Go through all attributes, using the AllAttributes array, which holds all attributes which should be updated. Matched by name.
    for attr in dataFiles.AllAttributes:
        try:
            spinBox = CE_Dialog.findChild(QtGui.QDoubleSpinBox,
                                          "SB_CharAttr_" + attr)
            dataFiles.Characters[str(name)][attr] = spinBox.value()
        except:
            log("ERROR settings attribute " + str(attr))

    window.charList.insertItem(id, newkey)
    window.charList.removeItem(id + 1)
    window.char2List.insertItem(id, newkey)
    window.char2List.removeItem(id + 1)

    window.charList.setCurrentIndex(id)
    log("Character updated.")
示例#2
0
def setItemStats():
    name = str(window.charList.currentText())
    itemName = str(inventoryDialog.inventoryList.currentItem().text())
    newName = str(inventoryDialog.nameBox.text())
    dataFiles.Characters = dataFiles.Characters.copy()


    dataFiles.Characters[name]['inventory'][itemName]['Durability'] = inventoryDialog.durabilityBox.value()
    for x, ch in enumerate(sorted(dataFiles.AllItemAttributes)):
        for i, attr, in enumerate(sorted(dataFiles.AllItemAttributes[ch])):
            spinBox = inventoryDialog.findChild(QtGui.QDoubleSpinBox, "SB_"+ch+"_Attr_"+attr)
            dataFiles.Characters[name]['inventory'][itemName][ch][attr]=spinBox.value()

    if newName != itemName:
        log ("Renaming...")
        dataFiles.replaceInDict(dataFiles.Characters[name]['inventory'], str(itemName), str(newName))
        inventoryDialog.inventoryList.currentItem().setText(newName)
示例#3
0
def setItemStats():
    name = str(window.charList.currentText())
    itemName = str(inventoryDialog.inventoryList.currentItem().text())
    newName = str(inventoryDialog.nameBox.text())
    dataFiles.Characters = dataFiles.Characters.copy()

    dataFiles.Characters[name]['inventory'][itemName][
        'Durability'] = inventoryDialog.durabilityBox.value()
    for x, ch in enumerate(sorted(dataFiles.AllItemAttributes)):
        for i, attr, in enumerate(sorted(dataFiles.AllItemAttributes[ch])):
            spinBox = inventoryDialog.findChild(QtGui.QDoubleSpinBox,
                                                "SB_" + ch + "_Attr_" + attr)
            dataFiles.Characters[name]['inventory'][itemName][ch][
                attr] = spinBox.value()

    if newName != itemName:
        log("Renaming...")
        dataFiles.replaceInDict(dataFiles.Characters[name]['inventory'],
                                str(itemName), str(newName))
        inventoryDialog.inventoryList.currentItem().setText(newName)
    log("Item stats set: " + name + " - " + itemName)
示例#4
0
def updateChar():
    #Updates character's stats.
    nameBox = CE_Dialog.findChild(QtGui.QLineEdit, "nameBox")
    id = window.charList.currentIndex()
    name = str(window.charList.currentText())
    newkey = str(nameBox.text())

    dataFiles.replaceInDict(dataFiles.Characters, name, newkey)

    #Go through all attributes, using the AllAttributes array, which holds all attributes which should be updated. Matched by name.
    for attr in dataFiles.AllAttributes:
        try:
            spinBox = CE_Dialog.findChild(QtGui.QDoubleSpinBox, "SB_CharAttr_"+attr)
            dataFiles.Characters[str(name)][attr]=spinBox.value()
        except:
            log ("ERROR settings attribute "+str(attr))

    window.charList.insertItem(id,newkey)
    window.charList.removeItem(id+1)
    window.char2List.insertItem(id,newkey)
    window.char2List.removeItem(id+1)

    window.charList.setCurrentIndex(id)
    log ("Character updated.")
示例#5
0
def updateChar():
    nameBox = CE_Dialog.findChild(QtGui.QLineEdit, "nameBox")
    id = window.charList.currentIndex()
    name = str(window.charList.currentText())
    newkey = str(nameBox.text())



    dataFiles.replaceInDict(dataFiles.Characters, name, newkey)

    #Characters[nameBox.text()] = Characters.pop[str(name)]
    for attr in dataFiles.AllAttributes:
        spinBox = CE_Dialog.findChild(QtGui.QDoubleSpinBox, "SB_CharAttr_"+attr)
        try:
            dataFiles.Characters[str(name)][attr]=spinBox.value()
        except:
            pass

    window.charList.insertItem(id,newkey)
    window.charList.removeItem(id+1)
    window.char2List.insertItem(id,newkey)
    window.char2List.removeItem(id+1)

    window.charList.setCurrentIndex(id)