def onDeactivate(self):
		"""
		event handler called when the visualization mode is about to be deactivated
		"""
		if not self.dataUnit:
			return
		if self.dataUnit and self.dataUnit.getDataSource(): 
			settings = self.dataUnit.getSettings()
			if self.annotationsEnabled:
				self.saveAnnotations()
				print "\n\n*** Saving annotations"
				scripting.storeSettingsToCache(self.dataUnit.getFileName() + "_" + self.dataUnit.getName() + "_annotations", [settings])
				self.dataUnit.getSettings().set("Annotations", [])
Example #2
0
	def cacheSettings(self):
		"""
		Store the settings of the dataunit in a cache from which they can be
					 later retrieved at will
		"""
		# It is possible we do not have dataunit if the task was closed for example, because of
		# different dimensions of the dataunits
		if not self.dataUnit:
			return
		sources = self.dataUnit.getSourceDataUnits()
		#print "SOURCES=",sources
		settings = [x.getSettings() for x in sources]
		settings.insert(0, self.dataUnit.getSettings())
		Logging.info("Storing to cache with key %s" % str(self.dataUnit.getCacheKey()), kw = "caching")
		#for i,settingx in enumerate(settings[1:]):
		#	 
		#	 tf=settingx.get("IntensityTransferFunction")
		scripting.storeSettingsToCache(self.dataUnit.getCacheKey(), settings)
		for i in sources:
			i.resetSettings()