From: <bi...@us...> - 2008-07-28 20:48:39
|
Revision: 10336 http://amsn.svn.sourceforge.net/amsn/?rev=10336&view=rev Author: billiob Date: 2008-07-28 20:48:46 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Image.py in efl now supports multiple images (usefull to put an emblem on a dp) Image in efl is now an evas SmartObject Modified Paths: -------------- trunk/amsn2/amsn2/core/amsn.py trunk/amsn2/amsn2/core/views/contactview.py trunk/amsn2/amsn2/gui/front_ends/efl/constants.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/themes/default/edc/contact.edc trunk/amsn2/amsn2/themes/default.edj Added Paths: ----------- trunk/amsn2/amsn2/themes/default/images/contact_list/ trunk/amsn2/amsn2/themes/default/images/contact_list/away_emblem.png trunk/amsn2/amsn2/themes/default/images/contact_list/blocked_emblem.png trunk/amsn2/amsn2/themes/default/images/contact_list/busy_emblem.png trunk/amsn2/amsn2/themes/default/images/contact_list/nopic.png trunk/amsn2/amsn2/themes/default/images/contact_list/notinlist_emblem.png trunk/amsn2/amsn2/themes/default/images/contact_list/plain_emblem.png Modified: trunk/amsn2/amsn2/core/amsn.py =================================================================== --- trunk/amsn2/amsn2/core/amsn.py 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/core/amsn.py 2008-07-28 20:48:46 UTC (rev 10336) @@ -150,7 +150,7 @@ groupV = GroupView.getGroup(group.id if group else 0) groupV.icon = None # TODO : expanded/collapsed icon groupV.name = StringView() # TODO : default color from skin/settings - groupV.name.appendText(group.name if group else "No Group") # TODO : prase or translation + groupV.name.appendText(group.name if group else "No Group") # TODO : parse or translation groupV.name.appendText("(" + str(active) + "/" + str(total) + ")") return groupV @@ -159,6 +159,8 @@ contactV = ContactView.getContact(contact.id) contactV.icon = self._gui.gui.Image(self, self._main) contactV.icon.loadFromResource("buddy_" + self.p2s[contact.presence]) + contactV.dp = self._gui.gui.Image(self, self._main) + contactV.dp.loadFromResource("default_dp") contactV.name = StringView() # TODO : default colors contactV.name.openTag("nickname") contactV.name.appendText(contact.display_name) # TODO parse Modified: trunk/amsn2/amsn2/core/views/contactview.py =================================================================== --- trunk/amsn2/amsn2/core/views/contactview.py 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/core/views/contactview.py 2008-07-28 20:48:46 UTC (rev 10336) @@ -4,6 +4,7 @@ def __init__(self, uid): BaseUIView.__init__(self, uid) self.dp = None + self.emblem = None @staticmethod def getContact(uid): Modified: trunk/amsn2/amsn2/gui/front_ends/efl/constants.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/constants.py 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/gui/front_ends/efl/constants.py 2008-07-28 20:48:46 UTC (rev 10336) @@ -8,3 +8,5 @@ TITLE = "aMSN 2" WM_NAME = "aMSN2" WM_CLASS = "main" + +DP_IN_CL = True Modified: trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/gui/front_ends/efl/contact_list.py 2008-07-28 20:48:46 UTC (rev 10336) @@ -80,40 +80,34 @@ self.contacts = {} def contact_updated(self, contact): + #TODO : clean :) self.contacts[contact.uid].\ part_text_set("contact_data", contact.name.toString()) + + if DP_IN_CL: + # add the dp + # Remove the current dp + obj_swallowed = self.contacts[contact.uid].\ + part_swallow_get("buddy_icon") + if obj_swallowed is not None: + # Delete ? + obj_swallowed.hide() + #add emblem on dp + #shouldn't be done there, but in the core... + contact.dp.addFromResource("emblem_busy") #yeah, everyone is busy!! + self.contacts[contact.uid].\ + part_swallow("buddy_icon", contact.dp) + else: + # add the buddy icon + # Remove the current icon + obj_swallowed = self.contacts[contact.uid].\ + part_swallow_get("buddy_icon") + if obj_swallowed is not None: + # Delete ? + obj_swallowed.hide() + self.contacts[contact.uid].\ + part_swallow("buddy_icon", contact.icon) - # add the buddy icon - print contact.icon._img.file_get() - part_size = self.contacts[contact.uid].\ - part_size_get("buddy_icon") - print part_size - # Remove the current icon - obj_swallowed = self.contacts[contact.uid].\ - part_swallow_get("buddy_icon") - if obj_swallowed is not None: - # Delete ? - obj_swallowed.hide() - contact.icon._img.size_set(part_size[0], part_size[1]) - contact.icon._img.fill_set(0,0, part_size[0], part_size[1]) - self.contacts[contact.uid].\ - part_swallow("buddy_icon", contact.icon._img) - - """ - status = "" - found = False - for x in contact.name._elements: - if x.getType() == StringView.OPEN_TAG_ELEMENT and \ - x.getValue() == "status": - found = True - if found and x.getType() == StringView.TEXT_ELEMENT: - status += x.getValue() - if x.getType() == StringView.CLOSE_TAG_ELEMENT and \ - x.getValue() == "status": - found = False - if status != "": - self.contacts[contact.uid].signal_emit("state_changed", status.strip("()")) - """ def add_contact(self, contact): new_contact = edje.Edje(self.evas_obj.evas, file=THEME_FILE, @@ -127,9 +121,11 @@ return new_contact def show(self): + print "show", self.size self.update_widget(self.size[0], self.size[1]) def hide(self): + print "hide" ,self.size self.update_widget(self.size[0], self.size[1]) def clip_set(self, obj): Modified: trunk/amsn2/amsn2/gui/front_ends/efl/image.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/image.py 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/gui/front_ends/efl/image.py 2008-07-28 20:48:46 UTC (rev 10336) @@ -5,34 +5,97 @@ from amsn2.gui import base -class Image(base.Image): +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 + evas.SmartObject.__init__(self, self._evas.evas) + + self._skin = self._amsn_core._skin_manager.skin - self._img = self._evas.evas.Image() + self._imgs = [ self._evas.evas.Image() ] def loadFromFile(self, filename): print "loading image %s" % filename try: - self._img.file_set(filename) + self._imgs[1:] = [] + self._imgs[0].file_set(filename) except evas.EvasLoadError, e: print "EvasLoadError: %s" % (e,) #TODO : raise ImgLoadError ? def loadFromEET(self, (eetfile, key)): print "eetfile = %s, key = %s" % (eetfile, key) - self._img.file_set(eetfile, key) + try: + self._imgs[1:] = [] + self._imgs[0].file_set(eetfile, key) + except evas.EvasLoadError, e: + print "EvasLoadError: %s" % (e,) + #TODO : raise ImgLoadError ? def loadFromResource(self, resource_name): - (type, value) = self._skin.getKey(resource_name) + res = self._skin.getKey(resource_name) + if res is not None: + (type, value) = res + try: + loadMethod = getattr(self, "loadFrom%s" % type) + except AttributeError, e: + print "From loadFromResource in efl/image.py:\n\t(type, value) = (%s, %s)\n\tAttributeError: %s" % (type, value, e) + else: + loadMethod(value) + + def addFromFile(self, filename): + print "loading image %s" % filename try: - loadMethod = getattr(self, "loadFrom%s" % type) - except AttributeError, e: - print "From loadFromResource in efl/image.py:\n\t(type, value) = (%s, %s)\n\tAttributeError: %s" % (type, value, e) - else: - loadMethod(value) + self._imgs.append(self._evas.evas.Image()) + self._imgs[-1].file_set(filename) + except evas.EvasLoadError, e: + print "EvasLoadError: %s" % (e,) + #TODO : raise ImgLoadError ? + def addFromResource(self, resource_name): + res = self._skin.getKey(resource_name) + if res is not None: + (type, value) = res + try: + addMethod = getattr(self, "addFrom%s" % type) + except AttributeError, e: + print "From addFromResource in efl/image.py:\n\t(type, value) = (%s, %s)\n\tAttributeError: %s" % (type, value, e) + else: + addMethod(value) + + + + + + def show(self): + print "show", self.size + for img in self._imgs: + img.show() + + def hide(self): + print "hide", self.size + for img in self._imgs: + img.hide() + + def resize(self, w, h): + for img in self._imgs: + img.size_set(w, h) + img.fill_set(0,0,w,h) + + def clip_set(self, obj): + for img in self._imgs: + img.clip_set(obj) + + def clip_unset(self): + for img in self._imgs: + img.clip_unset() + + def move(self, x, y): + for img in self._imgs: + img.move(x ,y) + + Modified: trunk/amsn2/amsn2/gui/front_ends/efl/skins.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/efl/skins.py 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/gui/front_ends/efl/skins.py 2008-07-28 20:48:46 UTC (rev 10336) @@ -19,6 +19,10 @@ self.setKey("buddy_online", ("File", "amsn2/themes/default/images/online.png")) self.setKey("buddy_phone", ("File", "amsn2/themes/default/images/busy.png")) + self.setKey("default_dp", ("File", "amsn2/themes/default/images/contact_list/nopic.png")) + + self.setKey("emblem_busy", ("File", "amsn2/themes/default/images/contact_list/busy_emblem.png")) + def getKey(self, key, default = None): try: Modified: trunk/amsn2/amsn2/themes/default/edc/contact.edc =================================================================== --- trunk/amsn2/amsn2/themes/default/edc/contact.edc 2008-07-28 20:13:09 UTC (rev 10335) +++ trunk/amsn2/amsn2/themes/default/edc/contact.edc 2008-07-28 20:48:46 UTC (rev 10336) @@ -15,7 +15,7 @@ mouse_events: 0; description { state: "default" 0.0; - min: 24 24; + min: 0 0; max: 24 24; rel1 { relative: 0.0 0.0; @@ -35,7 +35,7 @@ rel1 { relative: 0.0 0.0; - offset: 24 0; + offset: 25 0; } rel2 { relative: 1.0 1.0; Property changes on: trunk/amsn2/amsn2/themes/default/images/contact_list/away_emblem.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/amsn2/amsn2/themes/default/images/contact_list/blocked_emblem.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/amsn2/amsn2/themes/default/images/contact_list/busy_emblem.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/amsn2/amsn2/themes/default/images/contact_list/nopic.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/amsn2/amsn2/themes/default/images/contact_list/notinlist_emblem.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/amsn2/amsn2/themes/default/images/contact_list/plain_emblem.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |