From: <bi...@us...> - 2008-09-28 15:52:13
|
Revision: 10527 http://amsn.svn.sourceforge.net/amsn/?rev=10527&view=rev Author: billiob Date: 2008-09-28 15:52:01 +0000 (Sun, 28 Sep 2008) Log Message: ----------- [EFL] add support for ImageView Modified Paths: -------------- trunk/amsn2/amsn2/gui/front_ends/efl/__init__.py trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py trunk/amsn2/amsn2/gui/front_ends/efl/image.py trunk/amsn2/amsn2/gui/front_ends/efl/skins.py trunk/amsn2/amsn2/gui/front_ends/efl/splash.py Modified: trunk/amsn2/amsn2/gui/front_ends/efl/__init__.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/__init__.py 2008-09-28 15:51:41 UTC (rev 10526) +++ trunk/amsn2/amsn2/gui/front_ends/efl/__init__.py 2008-09-28 15:52:01 UTC (rev 10527) @@ -23,7 +23,7 @@ imp.find_module("etk") gui.GUIManager.registerFrontEnd("efl", sys.modules[__name__]) - + except ImportError: pass - + Modified: trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py 2008-09-28 15:51:41 UTC (rev 10526) +++ trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py 2008-09-28 15:52:01 UTC (rev 10527) @@ -1,5 +1,6 @@ from constants import * +from image import * import evas import edje import ecore @@ -12,9 +13,10 @@ class aMSNContactListWindow(base.aMSNContactListWindow): def __init__(self, amsn_core, parent): - self._amsn_core = amsn_core + self._core = amsn_core self._evas = parent._evas self._parent = parent + self._skin = amsn_core._skin_manager.skin self._clwidget = aMSNContactListWidget(amsn_core, self) parent.setChild(self._clwidget) self._clwidget.show() @@ -37,8 +39,9 @@ class aMSNContactListWidget(etk.ScrolledView, base.aMSNContactListWidget): def __init__(self, amsn_core, parent): - self._amsn_core = amsn_core + self._core = amsn_core self._evas = parent._evas + self._skin = parent._skin self._etk_evas_object = etk.EvasObject() etk.ScrolledView.__init__(self) @@ -109,6 +112,7 @@ self.evas_obj = ecanvas self.contacts = {} self._parent = parent + self._skin = parent._skin self._callback = cb def contact_updated(self, contact): @@ -124,12 +128,11 @@ if obj_swallowed is not None: # Delete ? obj_swallowed.hide() + dp = Image(self._skin, self.evas_obj, contact.dp) #add emblem on dp - #shouldn't be done there, but in the core... - contact.dp.append("Skin","emblem_busy") #yeah, everyone is busy!! - contact.dp.repeat_events = True + dp.appendView(contact.emblem) self.contacts[contact.uid].\ - part_swallow("buddy_icon", contact.dp) + part_swallow("buddy_icon", dp) else: # add the buddy icon # Remove the current icon @@ -138,8 +141,9 @@ if obj_swallowed is not None: # Delete ? obj_swallowed.hide() + icon = Image(self._skin, self.evas_obj, contact.icon) self.contacts[contact.uid].\ - part_swallow("buddy_icon", contact.icon) + part_swallow("buddy_icon", icon) def add_contact(self, contact): @@ -211,6 +215,7 @@ def __init__(self, parent, evas_obj, group, ccb = None): self.evas_obj = evas_obj self._parent = parent + self._skin = parent._skin self.expanded = True self.group = group self._edje = edje.Edje.__init__(self, self.evas_obj, file=THEME_FILE, group="group_item") @@ -266,6 +271,7 @@ self.evas_obj = ecanvas self.group_items = [] self._parent = parent + self._skin = parent._skin self._ccb = ccb def add_group(self, group): Modified: trunk/amsn2/amsn2/gui/front_ends/efl/image.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/image.py 2008-09-28 15:51:41 UTC (rev 10526) +++ trunk/amsn2/amsn2/gui/front_ends/efl/image.py 2008-09-28 15:52:01 UTC (rev 10527) @@ -1,63 +1,75 @@ - import evas import ecore import ecore.evas -from amsn2.gui import base +from amsn2.core.views import imageview -class Image(evas.SmartObject, base.Image): - def __init__(self, amsn_core, window): - self._amsn_core = amsn_core - self._amsn_gui = self._amsn_core.getMainWindow() - self._evas = self._amsn_gui._evas +class Image(evas.SmartObject): + def __init__(self, skin, canvas, view=None): + self._evas = canvas evas.SmartObject.__init__(self, self._evas) - - self._skin = self._amsn_core._skin_manager.skin + self._skin = skin self._imgs = [] self.propagate_events = True + if view is not None: + self.load(view) + ####################################################### #Public methods - def load(self, resource_type, value): + def load(self, view): for img in self._imgs: self.member_del(img) - self._imgs = [ self._evas.Image() ] - self.member_add(self._imgs[0]) - try: - loadMethod = getattr(self, "_loadFrom%s" % resource_type) - except AttributeError, e: - print "From load in efl/image.py:\n\t(resource_type, value) = (%s, %s)\n\tAttributeError: %s" % (resource_type, value, e) - else: - loadMethod(value) - - def append(self, resource_type, value): - img = self._evas.Image() - self.member_add(img) - self._imgs.append(img) - try: - loadMethod = getattr(self, "_loadFrom%s" % resource_type) - except AttributeError, e: - print "From append in efl/image.py:\n\t(resource_type, value) = (%s, %s)\n\tAttributeError: %s" % (resource_type, value, e) - else: - loadMethod(value, pos=-1) + self._imgs = [] - def prepend(self, resource_type, value): - img = self._evas.Image() - self.member_add(img) - self._imgs.insert(0, img) - try: - loadMethod = getattr(self, "_loadFrom%s" % resource_type) - except AttributeError, e: - print "From prepend in efl/image.py:\n\t(resource_type, value) = (%s, %s)\n\tAttributeError: %s" % (resource_type, value, e) - else: - loadMethod(value, pos=0) + for (resource_type, value) in view.imgs: + self._imgs.append(self._evas.Image()) + self.member_add(self._imgs[-1]) + try: + loadMethod = getattr(self, "_loadFrom%s" % resource_type) + except AttributeError, e: + print "From load in efl/image.py:\n\t(resource_type, value) = (%s, %s)\n\tAttributeError: %s" % (resource_type, value, e) + else: + loadMethod(value, -1) + def appendView(self, view): + for (resource_type, value) in view.imgs: + img = self._evas.Image() + self.member_add(img) + self._imgs.append(img) + try: + loadMethod = getattr(self, "_loadFrom%s" % resource_type) + except AttributeError, e: + print "From append in efl/image.py:\n\t(resource_type, value) = (%s, %s)\n\tAttributeError: %s" % (resource_type, value, e) + else: + loadMethod(value, pos=-1) + def appendImage(self, image): + for i in image._imgs: + self._imgs.append(i) + self.member_add(i) + def prependView(self, resource_type, value): + for (resource_type, value) in view.imgs.reverse(): + img = self._evas.Image() + self.member_add(img) + self._imgs.insert(0, img) + try: + loadMethod = getattr(self, "_loadFrom%s" % resource_type) + except AttributeError, e: + print "From prepend in efl/image.py:\n\t(resource_type, value) = (%s, %s)\n\tAttributeError: %s" % (resource_type, value, e) + else: + loadMethod(value, pos=0) + + def prependImage(self, image): + for i in image._imgs.reverse(): + self._imgs.insert(0,i) + self.member_add(i) + def _loadFromFile(self, filename, pos=0): try: self._imgs[pos].file_set(filename) @@ -80,8 +92,8 @@ print "From _loadFromSkin in efl/image.py:\n\t(type, value) = (%s, %s)\n\tAttributeError: %s" % (type, value, e) else: loadMethod(value, pos) - + #TODO: append, prepend :s ####################################################### # Need to overwritre some evas.SmartObject methods: Modified: trunk/amsn2/amsn2/gui/front_ends/efl/skins.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/skins.py 2008-09-28 15:51:41 UTC (rev 10526) +++ trunk/amsn2/amsn2/gui/front_ends/efl/skins.py 2008-09-28 15:52:01 UTC (rev 10527) @@ -23,13 +23,13 @@ self.setKey("emblem_busy", ("File", "amsn2/themes/default/images/contact_list/busy_emblem.png")) - + def getKey(self, key, default = None): try: return self._dict[key] except KeyError: return default - + def setKey(self, key, value): self._dict[key] = value Modified: trunk/amsn2/amsn2/gui/front_ends/efl/splash.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/splash.py 2008-09-28 15:51:41 UTC (rev 10526) +++ trunk/amsn2/amsn2/gui/front_ends/efl/splash.py 2008-09-28 15:52:01 UTC (rev 10527) @@ -7,12 +7,12 @@ def show(self): pass - + def hide(self): pass - + def setText(self, text): pass - + def setImage(self, image): pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |