changeset 334:a9482d3d989e

PyChan fixes: * DummyImage is gone for good. * Renamed GuiImage.source annotation used in PyChan. * Fixed a bug in an error path.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 24 Aug 2009 14:47:23 +0000
parents fee958103d58
children 162662bf5c8a
files engine/extensions/pychan/properties.py engine/extensions/pychan/widgets/common.py
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/engine/extensions/pychan/properties.py	Mon Aug 24 14:41:52 2009 +0000
+++ b/engine/extensions/pychan/properties.py	Mon Aug 24 14:47:23 2009 +0000
@@ -91,14 +91,14 @@
 			# we just let the NotFound exception trickle here.
 			# depedning on complains we can catch and print a warning.
 			image_info["image"] = get_manager().loadImage(image)
-			image_info["image"]._source = image
+			image_info["image"].source = image
 			self._getSetter(obj)(image_info["image"])
 
 		elif isinstance(image,fife.GuiImage):
 			# FIXME - this trickery with the hidden annotation
 			# with an _source attribute isn't really clean.
 			# Is it even necessary
-			image_info["source"] = getattr(image,"_source","")
+			image_info["source"] = getattr(image,"source","")
 			image_info["image"] = image
 			if image_info["source"]:
 				image_info["image"] = get_manager().loadImage(image)
@@ -106,7 +106,7 @@
 		else:
 			attribute_name = "%s.%s" % (obj.__class__.__name__,self.name)
 			error_message = "%s only accepts GuiImage and python strings, not '%s'"
-			raise RuntimeError(error_message % (attribute_name, repr(source)))
+			raise RuntimeError(error_message % (attribute_name, repr(image)))
 		
 		setattr(obj, self.prop_name, image_info)
 
@@ -115,5 +115,6 @@
 		image = d.get("image",None)
 		if not image:
 			image = fife.GuiImage()
+			image.source = ""
 		return image
 
--- a/engine/extensions/pychan/widgets/common.py	Mon Aug 24 14:41:52 2009 +0000
+++ b/engine/extensions/pychan/widgets/common.py	Mon Aug 24 14:47:23 2009 +0000
@@ -69,6 +69,3 @@
 	from layout import LayoutBase
 	return isinstance(widget,LayoutBase)
 
-class DummyImage(object):
-	def getWidth(self): return 0
-	def getHeight(self): return 0