コード例 #1
0
	def refresh( self, num = None, t = None ):
		if num:
			self.num = num
		
		with Model.LockRace() as race:
			isShown = self.advancePhotoLabel.IsShown()
			if race and race.enableVideoBuffer:
				self.advancePhoto.SetValue( getattr(race, 'advancePhotoMilliseconds', Model.Race.advancePhotoMillisecondsDefault) )
				doShow = True
			else:
				doShow = False
				
			if isShown != doShow:
				self.advancePhotoLabel.Show( doShow )
				self.advancePhoto.Show( doShow )
				self.Layout()

			if race is None:
				self.clear()
				return
				
			# Automatically refresh the screen only if the rider showing has last been updated.
			if num is None and t is None and race.isRunning():
				tLast, rLast = race.getLastKnownTimeRider()
				if rLast and rLast.num != self.num:
					return
					
		if Utils.mainWin and Utils.mainWin.fileName:
			dir = getPhotoDirName( Utils.mainWin.fileName )
		else:
			dir = TestDir
		
		if self.num == self.ShowAllPhotos:
			self.thumbs._scrolled.filePrefix = ''
		else:
			self.thumbs._scrolled.filePrefix = 'bib-%04d' % self.num
		
		if Utils.mainWin:
			ResetPhotoInfoCache( Utils.mainWin.fileName )
		
		if os.path.isdir(dir):
			self.thumbs.ShowDir( dir )
		else:
			self.clear()
			return
		
		itemCount = self.thumbs.GetItemCount()
		if not itemCount:
			self.clear()
			return
		
		if self.num is not None and t is not None:
			# Select the photo specified by the time.
			fnameMatch = os.path.splitext(GetPhotoFName(num, t))[0]
			print fnameMatch
			for i in xrange(itemCount):
				print self.thumbs.GetItem(i).GetFileName()
				if self.thumbs.GetItem(i).GetFileName().startswith(fnameMatch):
					break
			self.thumbs.SetSelection( i )
		else:
			self.thumbs.SetSelection( self.thumbs.GetItemCount() - 1 )
			
		self.OnSelChanged()
コード例 #2
0
	def OnLauchFileBrowser( self, event ):
		if Utils.mainWin and Utils.mainWin.fileName:
			dir = getPhotoDirName( Utils.mainWin.fileName )
		else:
			dir = TestDir
		LaunchFileBrowser( dir )