1. Arne Babenhauserheide
  2. fungus

Commits

Arne Babenhauserheide  committed 056d601

cleanup

  • Participants
  • Parent commits a4cd8dd
  • Branches default

Comments (0)

Files changed (1)

File code_swarm.py

View file
     """
     def __init__(self, track = []): 
 	#: Internal data with time to play. Source for self.get_data()
-	self._data = None # [(time_to_play, item, related_item)]
+	self._data = None # [(time_to_play, date, item, related_item)]
 	# for codeswarms: item = author, related_item = file. 
 	#: The time when the data property was last accessed. 
 	self.last_access_time = None
 		# only the mail addresses
 		all_recipients = [addr for name, addr in getaddresses(tos + ccs + resent_tos + resent_ccs)]
 		
+                subject = mail.get("Subject")
+                
 		# turn the mail into a set of simply tuples and append these to the data
 		for to in all_recipients: 
 		    if EMAIL_WITHOUT_HOST: 
 	multiplier = time_to_play / (self.max_timestamp - first_date)
 	# Normalize all dates, so they begin at 0 and extend for "time" seconds. 
 	data = [((date - first_date)*multiplier, date, fro, to) for date, fro, to in data]
-	# and sort the data in place
-	data.sort()
+        # and sort the data in place
+        data.sort()
 	
 	# If we want to track only one, we split the communication - and if we want to be recursive, we also track all contacts. 
 	if self.track: 
 	"""@return: current changes which should be displayed at once."""
 	if self._data is None: 
 	    return self.random_data()
-	else: 
+        elif not self._data:
+            print "no more data"
+            return self._data
+	else:
 	    # If data was never accessed before, set the current time for last access. 
 	    if self.last_access_time is None: 
 		self.last_access_time = time()
 	    # increase the time up to which we want to show the data
 	    self.time_delta += time() - self.last_access_time
 	    # Update the last access time
-	    # get all datapoints up to the 
+	    self.last_access_time = time()
+
+	    # get all datapoints up to the time delta
 	    data = [(date, fro, to) for reltime, date, fro, to in self._data if reltime <= self.time_delta]
 	    # remove all these datapoints from the private data. 
 	    self._data = [(reltime, date, fro, to) for reltime, date, fro, to in self._data if reltime > self.time_delta]
-	    
-	    self.last_access_time = time()
+
 	    return data
 	    
 	    
 	self.path = None
 	
 	#: The default time in seconds we want a code_swarm to last
-	self.time = 180
+	self.time = 60
 	
 	#: Some pre-shutdown wait time. The number of frames the scene will still run. 
 	self.countdown = None