Exemplo n.º 1
0
 def populateTwoColSizer(self, cardName, wrestler):
     """Populate a TwoColSizer using a wrestler module as the source"""
     choiceCtrls = getattr(self, cardName).choiceControls
     itemList = getattr(wrestler, cardName[0].upper() + cardName[1:])
     idx = 0
     for item in itemList:
         choiceCtrls[idx].SetStringSelection(convertToString(item))
         idx += 1
Exemplo n.º 2
0
    def populateMoveList(self, cardName, wrestler):
        """Populate a MoveList using a wrestler module as the source"""
        moveItems = getattr(self, cardName).moveItems
        if cardName not in ("specialtyCard", "ropesCard"):          
            itemList = getattr(wrestler, cardName[0].upper() + cardName[1:])
        elif cardName == "specialtyCard":
            specDict = getattr(wrestler,
                               (cardName[0].upper() + cardName[1:])[:-4])
            itemList = specDict.values()[0]
        else:
            cardName = cardName[:-4]
            itemList = getattr(wrestler, cardName[0].upper() + cardName[1:])
            
        idx = 0
        for item in itemList:
            if item.has_key("MOVE_NAME"):
                moveItems[idx]["MOVE_NAME_CTRL"].SetValue(item["MOVE_NAME"])

            if item.has_key("MOVE_POINTS"):
                points = str(item["MOVE_POINTS"])
                moveItems[idx]["MOVE_POINT_CTRL"].SetValue(points)

            moveType = convertToString(item["MOVE_TYPE"])
            if moveType:  # Process (S), (XX), (DQ), P/A, *
                if moveType != "(S)" or \
                       (moveType == "(S)" and cardName != "specialtyCard"):
                    ctrl = moveItems[idx]["MOVE_TYPE_CTRL"]
                    ctrl.SetStringSelection(moveType)
                    if moveType in ("(DQ)", "(S)"):
                        # No points ahould be entered for DQ and (S)
                        moveItems[idx]["MOVE_POINT_CTRL"].Enable(0)
            elif item["MOVE_NAME"] == "ROPES":
                moveItems[idx]["MOVE_TYPE_CTRL"].SetStringSelection("ROPES")
                moveItems[idx]["MOVE_NAME_CTRL"].Enable(0)
                moveItems[idx]["MOVE_POINT_CTRL"].Enable(0)
            elif item["MOVE_NAME"] == "NA":
                moveItems[idx]["MOVE_TYPE_CTRL"].SetStringSelection("NA")
                moveItems[idx]["MOVE_NAME_CTRL"].Enable(0)
                moveItems[idx]["MOVE_POINT_CTRL"].Enable(0)
                
            idx += 1