def __init__(self,parent,ct,debug): MyDebug.__init__(self,debug) wx.Menu.__init__(self,"") self.parent = parent self.ct = ct _tmpREmenuflag[0] = -2 rulesmenu = [] if parent.parent.topparent.eventdata.has_key('rules'): menul = {} i = -1 for r in parent.parent.topparent.eventdata['rules']: i = i + 1 for k in reccodemap.keys(): if k == r[1]: if not menul.has_key(k): menul[k] = [] menul[k].append(('REMpopup%s'%i,{'menu':r[3]})) exec """\ def tmpfun(evt): global _tmpREmenuflag _tmpREmenuflag[0] = %s self.On%s = tmpfun """%(i,'%sREMpopup%s'%(r[1],i)) break for k in menul.keys(): rulesmenu.append((k,{'menu':reccodemenulabel[k],'submenu':menul[k]})) buildmenus(self,rulesmenu+_recordeditormenu,self,verbose = debug,popup=1)
def __init__(self,parent,row,debug): MyDebug.__init__(self,debug) wx.Menu.__init__(self,"Class Menu") self.parent = parent self.row = row if row == -1: buildmenus(self,classtablelabelmenu[:2],self,verbose = 1) else: buildmenus(self,classtablelabelmenu,self,verbose = 1)
def __init__(self, parent, row, debug): MyDebug.__init__(self, debug) wx.Menu.__init__(self, "Class Menu") self.parent = parent self.row = row if row == -1: buildmenus(self, classtablelabelmenu[:2], self, verbose=1) else: buildmenus(self, classtablelabelmenu, self, verbose=1)
def __init__(self, parent, row, debug): MyDebug.__init__(self, debug) wx.Menu.__init__(self, "Data Menu") self.parent = parent self.row = row if row == -1: _datatablelabelm1menu[3][1]['check'] = self.parent.table.enableedit buildmenus(self, _datatablelabelm1menu, self, verbose=debug) else: buildmenus(self, _datatablelabelmenu, self, verbose=debug)
def __init__(self,parent,row,debug): MyDebug.__init__(self,debug) wx.Menu.__init__(self,"Data Menu") self.parent = parent self.row = row if row == -1: _datatablelabelm1menu[3][1]['check'] = self.parent.table.enableedit buildmenus(self,_datatablelabelm1menu,self,verbose = debug) else: buildmenus(self,_datatablelabelmenu,self,verbose = debug)
def __init__(self,parent,menutmpl,debug): global _tmpmenuflag _tmpmenuflag[0] = -1 MyDebug.__init__(self,debug) wx.Menu.__init__(self,"") i = -1 for item in menutmpl: i = i + 1 exec """def tmpfun(evt):\n global _tmpmenuflag\n _tmpmenuflag[0] = %s\n"""%(i) setattr(self,'On%s'%(item[0]),tmpfun) buildmenus(self,menutmpl,self,verbose = debug)
def __init__(self, parent, menutmpl, debug): global _tmpmenuflag _tmpmenuflag[0] = -1 MyDebug.__init__(self, debug) wx.Menu.__init__(self, "") i = -1 for item in menutmpl: i = i + 1 exec """def tmpfun(evt):\n global _tmpmenuflag\n _tmpmenuflag[0] = %s\n""" % ( i) setattr(self, 'On%s' % (item[0]), tmpfun) buildmenus(self, menutmpl, self, verbose=debug)
def __init__(self,parent,id,debug): MyDebug.__init__(self,debug) wx.Menu.__init__(self,"") ri,k=parent.idmap[id] cl,heat,racedata = parent.race[ri] self.race=racedata[k] self.parent = parent enableonoff = [] i = -1 for r in self.race: i = i + 1 if r[0]>0: do = 'off' else: do = 'on' if len(r)==2: val = '%s'%r[1] elif len(r)==3: val = '%s:%s'%(r[1],r[2]) #enableonoff.append(('Item%s'%i,{'menu':'set %s %s'%(val,do)})) if do=='off': enableonoff.append(('Item%s'%i,{'menu':'disable lap %s'%(val)})) else: enableonoff.append(('Item%s'%i,{'menu':'enable lap %s'%(val)})) exec 'self.OnEnableOnOffItem%s = lambda evt,i=%s,self=self:self.OnEnableOnOff(evt,i)'%(i,i) timerbutmenu = [] if enableonoff: timerbutmenu.append ( ('EnableOnOff',{'menu':'Edit lap', #'%s'%k, 'submenu':enableonoff, })) if istclass(cl): if self.race: exec 'self.OnResetTime = lambda evt,ri=ri,k=k,self=self:self.OnResetTimeApply(evt,ri,k)' timerbutmenu.append(('ResetTime',{'menu':'Erase Data' })) t = 0 laptimes = [] for m in self.race: if abs (m[0]) in [1,2]: t = t + m[1] if m[0]<0: continue laptimes.append (t) if laptimes: timerbutmenu.append (()) last_t = 0 for t in laptimes: timerbutmenu.append (('LapTimes', {'menu':'%s s' % (t-last_t)})) last_t = t if not timerbutmenu: if self.race or getattr(self.parent, 'inittimes', None): timerbutmenu.append(('_tmp',{'menu':'Has not crossed finish line' })) else: timerbutmenu.append(('_tmp',{'menu':'Has not started' })) buildmenus(self,timerbutmenu,self,verbose = debug, popup=True)