Esempio n. 1
0
class GroupView:
    def __init__(self, core, amsn_group):
        self.uid = amsn_group.id
        self.contact_ids = set(amsn_group.contacts)
        self.icon = ImageView() # TODO: expanded/collapsed icon
        self.name = StringView() # TODO: default color from skin/settings

        self.name.append_text(amsn_group.name.decode('utf-8')) #TODO: parse for smileys
        active = len(amsn_group.contacts_online)

        #self.name.append_text(name) #TODO: parse for smileys
        #active = 0
        #for cid in contact_ids:
        #    contact = core._contactlist_manager.get_contact(cid)
        #    if str(contact.status) != core.p2s['FLN']:
        #        active = active + 1

        total = len(self.contact_ids)
        self.name.append_text("(" + str(active) + "/" + str(total) + ")")

        self.on_click = None #TODO: collapse, expand
        self.on_double_click = None
        self.on_right_click_popup_menu = GroupPopupMenu(core, amsn_group)
        self.tooltip = None
        self.context_menu = None


    #TODO: @roproperty: context_menu, tooltip

    def __repr__(self):
        return "<GroupView {uid='%s', name='%s', contact_ids=%s}>" \
                % (self.uid, self.name, repr(self.contact_ids))
    def __init__(self, core, amsn_group):
        """
        @type core: L{amsn2.core.amsn.aMSNCore}
        @type amsn_group: L{amsn2.core.contactlist_manager.aMSNBaseGroup}
        """
        self.uid = amsn_group.id
        self.contact_ids = set(amsn_group.contacts)
        self.icon = ImageView()  # TODO: expanded/collapsed icon
        self.name = StringView()  # TODO: default color from skin/settings

        self.name.append_text(
            amsn_group.name.decode('utf-8'))  #TODO: parse for smileys
        active = len(amsn_group.contacts_online)

        #self.name.append_text(name) #TODO: parse for smileys
        #active = 0
        #for cid in contact_ids:
        #    contact = core._contactlist_manager.get_contact(cid)
        #    if str(contact.status) != core.p2s['FLN']:
        #        active = active + 1

        total = len(self.contact_ids)
        self.name.append_text("(" + str(active) + "/" + str(total) + ")")

        self.on_click = None  #TODO: collapse, expand
        self.on_double_click = None
        self.on_right_click_popup_menu = GroupPopupMenu(core, amsn_group)
        self.tooltip = None
        self.context_menu = None
Esempio n. 3
0
    def __init__(self, core, amsn_group):
        """
        @type core: L{amsn2.core.amsn.aMSNCore}
        @type amsn_group: L{amsn2.core.contactlist_manager.aMSNBaseGroup}
        """
        self.uid = amsn_group.id
        self.contact_ids = set(amsn_group.contacts)
        self.icon = ImageView() # TODO: expanded/collapsed icon
        self.name = StringView() # TODO: default color from skin/settings

        self.name.append_text(amsn_group.name.decode('utf-8')) #TODO: parse for smileys
        active = len(amsn_group.contacts_online)

        #self.name.append_text(name) #TODO: parse for smileys
        #active = 0
        #for cid in contact_ids:
        #    contact = core._contactlist_manager.get_contact(cid)
        #    if str(contact.status) != core.p2s['FLN']:
        #        active = active + 1

        total = len(self.contact_ids)
        self.name.append_text("(" + str(active) + "/" + str(total) + ")")

        self.on_click = None #TODO: collapse, expand
        self.on_double_click = None
        self.on_right_click_popup_menu = GroupPopupMenu(core, amsn_group)
        self.tooltip = None
        self.context_menu = None
Esempio n. 4
0
    def __init__(self, core, email):
        """
        @type core: L{amsn2.core.amsn.aMSNCore}
        @type email: str
        """
        self._core = core
        self.email = email
        self.password = None
        self.nick = StringView()
        self.psm = StringView()
        self.presence = core.Presence.ONLINE
        self.dp = ImageView()

        self.save = False
        self.save_password = False
        self.autologin = False

        self.preferred_ui = None
        self.preferred_backend = 'defaultbackend'
    def __init__(self, core, amsn_contact):
        """
        @type core: L{amsn2.core.amsn.aMSNCore}
        @type amsn_contact: L{amsn2.core.amsn.aMSNContact}
        """

        self.uid = amsn_contact.uid

        self.account = amsn_contact.account
        #self.contact = amsn_contact # Usefull at least if we want to reload the ContactPopupMenu

        self.status = amsn_contact.status
        self.icon = amsn_contact.icon
        #TODO: apply emblem on dp
        self.dp = amsn_contact.dp.clone()
        self.dp.append_imageview(amsn_contact.emblem)
        self.name = StringView()  # TODO : default colors
        self.name.open_tag("nickname")
        self.name.append_stringview(amsn_contact.nickname)  # TODO parse
        self.name.close_tag("nickname")
        self.name.append_text(" ")
        self.name.open_tag("status")
        self.name.append_text("(")
        self.name.append_stringview(amsn_contact.status)
        self.name.append_text(")")
        self.name.close_tag("status")
        self.name.append_text(" ")
        self.name.open_tag("psm")
        self.name.set_italic()
        self.name.append_stringview(amsn_contact.personal_message)
        self.name.unset_italic()
        self.name.close_tag("psm")

        def start_conversation_cb(c_uid):
            core._conversation_manager.new_conversation([c_uid])

        self.on_click = start_conversation_cb
        self.on_double_click = None
        self.on_right_click_popup_menu = ContactPopupMenu(core, amsn_contact)
        self.tooltip = None
        self.context_menu = None
Esempio n. 6
0
    def __init__(self, core, amsn_contact):
        """
        @type core: aMSNCore
        @type amsn_contact: aMSNContact
        """

        self.uid = amsn_contact.uid

        self.account = amsn_contact.account
        #self.contact = amsn_contact # Usefull at least if we want to reload the ContactPopupMenu

        self.status = amsn_contact.status
        self.icon = amsn_contact.icon
        #TODO: apply emblem on dp
        self.dp = amsn_contact.dp.clone()
        self.dp.append_imageview(amsn_contact.emblem)
        self.name = StringView() # TODO : default colors
        self.name.open_tag("nickname")
        self.name.append_stringview(amsn_contact.nickname) # TODO parse
        self.name.close_tag("nickname")
        self.name.append_text(" ")
        self.name.open_tag("status")
        self.name.append_text("(")
        self.name.append_stringview(amsn_contact.status)
        self.name.append_text(")")
        self.name.close_tag("status")
        self.name.append_text(" ")
        self.name.open_tag("psm")
        self.name.set_italic()
        self.name.append_stringview(amsn_contact.personal_message)
        self.name.unset_italic()
        self.name.close_tag("psm")

        def start_conversation_cb(c_uid):
            core._conversation_manager.new_conversation([c_uid])
        self.on_click = start_conversation_cb
        self.on_double_click = None
        self.on_right_click_popup_menu = ContactPopupMenu(core, amsn_contact)
        self.tooltip = None
        self.context_menu = None