def __init__( self, parent, id ):
wx.Panel.__init__( self, parent )
self.ScoreServer = parent.ScoreServer
self.Match = self.ScoreServer.Match
self.MechList = self.ScoreServer.Match.MechList
# Create a MatchTimeText
self.MatchTimerText = MatchTimerText( self, -1, self.Match )
self.MatchTimerText.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.BOLD))
# Create a Sizer, NameText, and HPText for each Mech in the match.
self.MechSizer = []
self.MechNameText = []
self.MechHPText = []
for m in xrange(len(self.MechList)):
self.MechSizer.append( wx.BoxSizer( wx.HORIZONTAL ) )
self.MechNameText.append( wx.StaticText( self, -1, self.MechList[m].Name ) )
self.MechHPText.append( MechHPText( self, -1, self.ScoreServer, self.MechList[m] ) )
self.MechNameText[m].SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.BOLD))
self.MechHPText[m].SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.BOLD))
# Create an overall sizer for the panel.
self.Sizer = wx.BoxSizer( wx.VERTICAL )
# Add TimerText to the panel's sizer.
self.Sizer.Add( self.MatchTimerText, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER, border=10 )
self.Sizer.Add( wx.StaticLine( self ), 0, wx.ALL|wx.EXPAND, 5 )
# Add all Mech Sizers to the panel's sizer
for m in xrange(len(self.MechList)):
# Insert a "VS" static text between teams if this is not a FFA match.
if self.Match.MatchType != MWScore.MATCH_FFA:
if self.MechList[m].Team != self.MechList[m-1].Team and m != 0:
vstext = wx.StaticText(self, -1, "VS")
vstext.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.BOLD))
self.Sizer.Add( vstext, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER, border=10 )
self.MechSizer[m].Add( self.MechNameText[m], proportion=0, flag=wx.RIGHT, border=10 )
self.MechSizer[m].Add( self.MechHPText[m], proportion=0, flag=wx.LEFT, border=10 )
self.Sizer.Add( self.MechSizer[m], proportion=0, flag=wx.ALL|wx.ALIGN_CENTER, border=10 )
# Set panel's sizer and fit.
self.SetSizer( self.Sizer )
self.Sizer.Fit( parent )
# Refresh the TimeText and all instances of MechHPText
评论列表
文章目录