Code:
# Create a row - enough for the max players in a Pitboss game
rowNum = 0
for rowNum in range(gc.getMAX_CIV_PLAYERS()):
# Create the border box
border = wx.StaticBox(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_PLAYER", (rowNum+1, ))), (0,(rowNum*30)))
# Create the layout mgr
rowSizer = wx.StaticBoxSizer(border, wx.HORIZONTAL)
CyPitboss().consoleOut("slow... "+str(rowNum))
# Get the info struct
playerData = PB.getPlayerSetupData(rowNum)
# Slot status dropdown
itemSizer = wx.BoxSizer(wx.VERTICAL)
txt = wx.StaticText(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_WHO", ())))
dropDown = wx.Choice(playerPanel, rowNum, (-1,-1), choices=slotStatusList)
dropDown.SetSelection(playerData.iWho)
itemSizer.Add(txt)
itemSizer.Add(dropDown)
rowSizer.Add(itemSizer, 0, wx.TOP, 3)
self.whoArray.append(dropDown)
self.Bind(wx.EVT_CHOICE, self.OnPlayerChoice, dropDown)
# Civ dropdown
itemSizer = wx.BoxSizer(wx.VERTICAL)
txt = wx.StaticText(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_CIV", ())))
dropDown = wx.Choice(playerPanel, rowNum, (-1,-1), choices=civList)
dropDown.SetSelection(playerData.iCiv+1)
itemSizer.Add(txt)
itemSizer.Add(dropDown)
rowSizer.Add(itemSizer, 0, wx.TOP, 3)
self.civArray.append(dropDown)
self.Bind(wx.EVT_CHOICE, self.OnPlayerChoice, dropDown)
# Leader dropdown
itemSizer = wx.BoxSizer(wx.VERTICAL)
txt = wx.StaticText(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_LEADER", ())))
dropDown = wx.Choice(playerPanel, rowNum, (-1,-1), choices=leaderList)
dropDown.SetSelection(playerData.iLeader+1)
itemSizer.Add(txt)
itemSizer.Add(dropDown)
rowSizer.Add(itemSizer, 0, wx.TOP, 3)
self.leaderArray.append(dropDown)
self.Bind(wx.EVT_CHOICE, self.OnPlayerChoice, dropDown)
# Team dropdown
itemSizer = wx.BoxSizer(wx.VERTICAL)
txt = wx.StaticText(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_TEAM", ())))
dropDown = wx.Choice(playerPanel, rowNum, (-1,-1), choices=teamList)
dropDown.SetSelection(playerData.iTeam)
itemSizer.Add(txt)
itemSizer.Add(dropDown)
rowSizer.Add(itemSizer, 0, wx.TOP, 3)
self.teamArray.append(dropDown)
self.Bind(wx.EVT_CHOICE, self.OnPlayerChoice, dropDown)
# Difficulty dropdown
itemSizer = wx.BoxSizer(wx.VERTICAL)
txt = wx.StaticText(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_DIFFICULTY", ())))
dropDown = wx.Choice(playerPanel, rowNum, (-1,-1), choices=diffList)
dropDown.SetSelection(playerData.iDifficulty)
itemSizer.Add(txt)
itemSizer.Add(dropDown)
rowSizer.Add(itemSizer, 0, wx.TOP, 3)
self.diffArray.append(dropDown)
self.Bind(wx.EVT_CHOICE, self.OnPlayerChoice, dropDown)
# Ready status
itemSizer = wx.BoxSizer(wx.VERTICAL)
txt = wx.StaticText(playerPanel, -1, (localText.getText("TXT_KEY_PITBOSS_STATUS", ())))
statusTxt = wx.StaticText(playerPanel, rowNum, playerData.getStatusText())
itemSizer.Add(txt)
itemSizer.Add(statusTxt)
rowSizer.Add(itemSizer, 0, wx.ALL, 5)
self.statusArray.append(statusTxt)
# Add row to page Sizer
panelSizer.Add(rowSizer, 0, wx.ALL, 5)
playerPanel.SetSizer(panelSizer)
playerPanel.SetAutoLayout(1)
playerPanel.SetupScrolling()
self.pageSizer.Add(playerPanel, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)