Пример #1
0
	def loadDefault(self):
		animset = eWindowAnimationSet.create()
		animset.setKey(eWindowAnimationManager.KEY_DISABLED)
		animset.setName(_("Disable Animations"))
		eWindowAnimationManager.setAnimationSet(animset)
		f = resolveFilename(SCOPE_SKIN, "animations.xml")
		if fileExists(f):
			self.fromXML(filesource=f)
Пример #2
0
	def loadDefault(self):
		animset = eWindowAnimationSet.create()
		animset.setKey(eWindowAnimationManager.KEY_DISABLED)
		animset.setName(_("Disable Animations"))
		eWindowAnimationManager.setAnimationSet(animset)
		f = resolveFilename(SCOPE_SKIN, "animations.xml")
		if fileExists(f):
			self.fromXML(filesource=f)
Пример #3
0
	def fromXML(self, filesource=None, xml=None):
		if filesource:
			root = ET.parse(filesource).getroot()
		else:
			root = ET.fromstring(xml)
		for animation in root:
			try:
				attrib = animation.attrib
				key = attrib["key"]
				name = _(attrib.get("title", key))
				internal = "internal" in attrib
				duration = int(attrib.get("duration", 0))
				alpha = pos = size = matrix = 0
				alpha_hide = pos_hide = size_hide = rotate_hide = 0

				for item in animation:
					if item.tag == "alpha":
						alpha = self._buildFloatAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "position":
						pos = self._buildPointAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "size":
						size = self._buildSizeAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "rotate":
						matrix = self._buildMatrixAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "alpha_hide":
						alpha_hide = self._buildFloatAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "position_hide":
						pos_hide = self._buildPointAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "size_hide":
						size_hide = self._buildSizeAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "rotate_hide":
						rotate_hide = self._buildMatrixAnimation(item, duration, self._buildInterpolator(attrib))

				if alpha or pos or size or matrix or alpha_hide or pos_hide or size_hide or rotate_hide:
					animset = eWindowAnimationSet.create()
					animset.setKey(key)
					animset.setName(name)
					animset.setInternal(internal)
					if alpha:
						animset.setAlpha(alpha)
					if pos:
						animset.setPos(pos)
					if size:
						animset.setSize(size)
					if matrix:
						animset.setMatrix(matrix)
					if alpha_hide:
						animset.setAlphaReverse(alpha_hide)
					if pos_hide:
						animset.setPosReverse(pos_hide)
					if size_hide:
						animset.setSizeReverse(size_hide)
					if rotate_hide:
						animset.setMatrixReverse(rotate_hide)
					eWindowAnimationManager.setAnimationSet(animset)

			except Exception as ex:
				Log.w("FAILED to parse an xml defined animation! %s: %s\n%s" %(animation.tag, animation.attrib, ex))
Пример #4
0
	def fromXML(self, filesource=None, xml=None):
		if filesource:
			root = ET.parse(filesource).getroot()
		else:
			root = ET.fromstring(xml)
		for animation in root:
			try:
				attrib = animation.attrib
				key = attrib["key"]
				name = _(attrib.get("title", key))
				internal = "internal" in attrib
				duration = int(attrib.get("duration", 0))
				alpha = pos = size = matrix = 0
				alpha_hide = pos_hide = size_hide = rotate_hide = 0

				for item in animation:
					if item.tag == "alpha":
						alpha = self._buildFloatAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "position":
						pos = self._buildPointAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "size":
						size = self._buildSizeAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "rotate":
						matrix = self._buildMatrixAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "alpha_hide":
						alpha_hide = self._buildFloatAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "position_hide":
						pos_hide = self._buildPointAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "size_hide":
						size_hide = self._buildSizeAnimation(item, duration, self._buildInterpolator(attrib))
					elif item.tag == "rotate_hide":
						rotate_hide = self._buildMatrixAnimation(item, duration, self._buildInterpolator(attrib))

				if alpha or pos or size or matrix or alpha_hide or pos_hide or size_hide or rotate_hide:
					animset = eWindowAnimationSet.create()
					animset.setKey(key)
					animset.setName(name)
					animset.setInternal(internal)
					if alpha:
						animset.setAlpha(alpha)
					if pos:
						animset.setPos(pos)
					if size:
						animset.setSize(size)
					if matrix:
						animset.setMatrix(matrix)
					if alpha_hide:
						animset.setAlphaReverse(alpha_hide)
					if pos_hide:
						animset.setPosReverse(pos_hide)
					if size_hide:
						animset.setSizeReverse(size_hide)
					if rotate_hide:
						animset.setMatrixReverse(rotate_hide)
					eWindowAnimationManager.setAnimationSet(animset)

			except Exception as ex:
				Log.w("FAILED to parse an xml defined animation! %s: %s\n%s" %(animation.tag, animation.attrib, ex))
Пример #5
0
	def _setupAnimation(self, *args):
		animset = eWindowAnimationSet.create()
		animset.setKey(PhotoScreensaver.ANIMATION_KEY_FADE)
		animset.setName("Slow wallpaper fade")
		animset.setInternal(True)
		interpolator = eLinearInterpolator.create()
		duration = int(config.plugins.screensaver.photo.speed.value) * 1000
		animset.setAlpha(eFloatAnimation.create(duration, 0.0, 1.0, False, interpolator))
		eWindowAnimationManager.setAnimationSet(animset)
		self._pixmap.setupAnimation()
	def _setupAnimation(self, *args):
		animset = eWindowAnimationSet.create()
		animset.setKey(PhotoScreensaver.ANIMATION_KEY_FADE)
		animset.setName("Slow wallpaper fade")
		animset.setInternal(True)
		interpolator = eLinearInterpolator.create()
		duration = int(config.plugins.screensaver.photo.speed.value) * 1000
		animset.setAlpha(eFloatAnimation.create(duration, 0.0, 1.0, False, interpolator))
		eWindowAnimationManager.setAnimationSet(animset)
		self._pixmap.setupAnimation()