def __init__(self, avatar, motion, motion_name, tracksFile, parent, id): # the MotionTracks are based on the wxPython VListBox print "list constructor" wx.VListBox.__init__(self, parent, id) print "after parent constructor" self.distancemeasure = None # the Motion tracks will control time in Piavca, not # the piavca timer Piavca.Core.getCore().setAutoTimeOff() self.showfootplants = 0 self.SetTime(0) self.playing = 0 # the avatar the motion is played on self.avatar = avatar # the motion being analysed self.motion = motion self.motion_name = motion_name self.motiongraph = None # play the motion on the avatar self.avatar.playMotionDirect(motion) # set up the parameters of the tracks self.track_height = 20 self.name_length = 60 self.track_length = Track.TimeToPosition(motion.getMotionLength()) print "track length", self.track_length, "motionlength", motion.getMotionLength( ) self.selectedTrack = None # read in a specification of which tracks to use self.ReadTracks(tracksFile) # the last track that the user interacted with # (for undoing) self.LastClickedTrack = None # the size of the window windowlength = self.GetLength() windowheight = self.GetHeight() self.SetSize(wx.Size(windowlength, windowheight)) print "end of list constructor" print "item count", self.GetItemCount() # start without any Principal Components #self.pcs = ComponentAnalysis.ComponentAnalysis() self.pcs = None try: self.pcs = Piavca.PCAMotion() except: pass
def OnDrawBackground(self, dc, rect, item): #print "drawing background", item if item == self.selectedTrack: dc.SetBrush(wx.Brush("orange")) else: dc.SetBrush(wx.Brush("white")) dc.DrawRectangle(rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()) dc.SetBrush(wx.Brush("blue")) dc.DrawRectangle( Track.TimeToPosition(self.time) + self.name_length, rect.GetTop(), 5, rect.GetHeight())