当前位置: 首页>>代码示例>>Python>>正文


Python Renderers.msnplus_to_plain_text方法代码示例

本文整理汇总了Python中Renderers.msnplus_to_plain_text方法的典型用法代码示例。如果您正苦于以下问题:Python Renderers.msnplus_to_plain_text方法的具体用法?Python Renderers.msnplus_to_plain_text怎么用?Python Renderers.msnplus_to_plain_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Renderers的用法示例。


在下文中一共展示了Renderers.msnplus_to_plain_text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clear

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
 def clear(self, source="", target="", target_display="",
         source_img="", target_img=""):
     '''clear the content'''
     self._texts = []
     self.loaded = False
     self.view.clear(source, Renderers.msnplus_to_plain_text(target), Renderers.msnplus_to_plain_text(target_display),
         source_img, target_img)
开发者ID:EchoUSB,项目名称:emesene,代码行数:9,代码来源:AdiumTextBox.py

示例2: show_tooltip

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def show_tooltip(self, view, origCoords, path_array, obj):
        ''' shows the tooltip of an e3.Contact '''
        self.tag = -1

        text = xml.sax.saxutils.escape(Renderers.msnplus_to_plain_text(obj.display_name)) 
        text += '\n<span size="small">' + xml.sax.saxutils.escape(Renderers.msnplus_to_plain_text(obj.message)) + '</span>'
        text += '\n' + self.data_string % (\
            obj.account, obj.status_string, self.yes_no[bool(obj.blocked)])

        self.label.set_markup(text)

        # Sets tooltip image
        if obj.picture!="":
            pixbuf = utils.gtk_pixbuf_load(obj.picture, (96,96))
        else:
            pixbuf = utils.gtk_pixbuf_load(gui.theme.image_theme.user_def_image)

        if bool(obj.blocked):
            pixbufblock=utils.gtk_pixbuf_load(gui.theme.image_theme.blocked_overlay_big)
            utils.simple_images_overlap(pixbuf,pixbufblock,-pixbufblock.props.width,-pixbufblock.props.width)

        self.image.set_from_pixbuf(pixbuf)
        self.image.show()

        # set the location of the tooltip
        x, y = self.computePosition(origCoords, view.window)
        self.move(x, y)
        self.show()
        return False
开发者ID:19MiRkO91,项目名称:emesene,代码行数:31,代码来源:Tooltips.py

示例3: compare_contacts

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def compare_contacts(self, contact1, contact2, order1=0, order2=0):
        '''compare two contacts and return 1 if contact1 should go first, 0
        if equal and -1 if contact2 should go first, use order1 and order2 to
        override the group sorting (the user can set the values on these to
        have custom ordering)'''

        override = cmp(order2, order1)

        if override != 0:
            return override

        if self.order_by_name:
            return cmp(Renderers.msnplus_to_plain_text(contact1.display_name), \
                       Renderers.msnplus_to_plain_text(contact2.display_name))

        result = cmp(e3.status.ORDERED.index(contact1.status),
            e3.status.ORDERED.index(contact2.status))

        if result != 0:
            return result

        if self.order_by_status:
            return cmp(contact1.display_name, contact2.display_name)

        if len(contact1.groups) == 0:
            if len(contact2.groups) == 0:
                return cmp(contact1.display_name, contact2.display_name)
            else:
                return -1
        elif len(contact2.groups) == 0:
            return 1
开发者ID:WayneSan,项目名称:emesene,代码行数:33,代码来源:ContactList.py

示例4: pyNotification

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
def pyNotification(title, text, picturePath=None, const=None, callback=None, tootltip=None):
    if (const=='message-im'):
        #In this case title is contact nick
        title = Renderers.msnplus_to_plain_text(title)
    n = pynotify.Notification(title, text, picturePath)
    n.set_hint_string("append", "allowed")
    n.show()
开发者ID:EchoUSB,项目名称:emesene,代码行数:9,代码来源:PyNotification.py

示例5: ThemeNotification

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
def ThemeNotification(title, text, picture_path=None, const=None,
                      callback=None, tooltip=None):

    def picture_factory(picture, const_value):
        ''' decides which theme picture to use '''

        if picture:
            if(picture[:7]=="file://"):
                return picture
        if const_value == 'mail-received':
            return "file://" + gui.theme.image_theme.email
        elif const_value == 'file-transf-completed':
            return "file://" + gui.theme.image_theme.transfer_success
        elif const_value == 'file-transf-canceled':
            return "file://" + gui.theme.image_theme.transfer_unsuccess
        elif const_value == 'message-im':
            return "file://" + gui.theme.image_theme.user_def_imagetool
        else:
            return "file://" + gui.theme.image_theme.user_def_imagetool

    if const == 'message-im':
        #In this case title is contact nick
        title = Renderers.msnplus_to_plain_text(title)
    notification = pynotify.Notification(title, text,
                            picture_factory(picture_path, const))
    notification.set_hint_string("append", "allowed")
    notification.show()
开发者ID:19MiRkO91,项目名称:emesene,代码行数:29,代码来源:ThemeNotification.py

示例6: _on_drag_data_get

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def _on_drag_data_get(self, widget, context, selection, target_id, etime):
        if self.is_contact_selected():
            account = self.get_contact_selected().account
            display_name = self.get_contact_selected().display_name

            if selection.target == "text/html":
                formatter = gui.base.Plus.MsnPlusMarkupMohrtutchy()  # - colors
                formatter.isHtml = True

                display_name = formatter.replaceMarkup(display_name)
                display_name = gui.base.Plus.parse_emotes(display_name)  # - emotes

                for x in range(len(display_name)):
                    if type(display_name[x]) is dict:
                        display_name[x] = '<img src="file://%s" alt="%s">' % (
                            display_name[x]["src"],
                            display_name[x]["alt"],
                        )

                selection.set(
                    selection.target,
                    8,
                    u'{0} &lt;<a href="mailto:{1}">{1}</a>&gt;'.format("".join(display_name), account),
                )
            elif selection.target == "text/plain":
                selection.set(
                    selection.target, 8, u"%s <%s>" % (Renderers.msnplus_to_plain_text(display_name), account)
                )
开发者ID:akikara,项目名称:emesene,代码行数:30,代码来源:ContactList.py

示例7: update_window

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
 def update_window(self, text, icon, index):
     ''' updates the window's border and item on taskbar
         with given text and icon '''
     if self.get_current_page() == index:
         win = self.get_parent() # gtk.Window, not a nice hack.
         win.set_title(Renderers.msnplus_to_plain_text(text))
         win.set_icon(icon)
开发者ID:Zincr0,项目名称:emesene,代码行数:9,代码来源:ConversationManager.py

示例8: gtkNotification

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
def gtkNotification(title, text, picturePath=None, const=None, callback=None):
    global actual_notification
    global queue

    # TODO: we can have an option to use a queue or show notifications
    # like the oldNotification plugin of emesene1.6 (WLM-like)

    if (const=='message-im'):
        #In this case title is contact nick
        title = Renderers.msnplus_to_plain_text(title)

    if actual_notification is None:
        actual_notification = Notification(title, text, picturePath, callback)
        actual_notification.show()
    else:
        # Append text to the actual notification
        if actual_notification._title == title:
            actual_notification.append_text(text)
        else:
            found = False
            auxqueue = list()
            for _title, _text, _picturePath, _callback in queue:
                if _title == title:
                    _text = _text + "\n" + text
                    found = True
                auxqueue.append([_title,_text,_picturePath, _callback])

            if found:
                # append text to another notification
                del queue
                queue = auxqueue
            else:
                # or queue a new notification
                queue.append([title, text, picturePath, callback])
开发者ID:CelticHarp,项目名称:emesene,代码行数:36,代码来源:GtkNotification.py

示例9: _on_switch_page

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
 def _on_switch_page(self, notebook, page, page_num):
     '''called when the user changes the tab'''
     page = self.get_nth_page(page_num)
     self.session.add_event(e3.Event.EVENT_MESSAGE_READ, page_num)
     self.set_message_waiting(page, False)
     parent = self.get_parent()
     parent.set_title(Renderers.msnplus_to_plain_text(page.text))
     parent.set_icon(page.icon)
开发者ID:SWOriginal,项目名称:emesene,代码行数:10,代码来源:ConversationManager.py

示例10: update_window

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
 def update_window(self, text, icon, index):
     """ updates the window's border and item on taskbar
         with given text and icon """
     if self.get_current_page() == index or index == (self.get_current_page() + self.get_n_pages()):
         win = self.get_parent()  # gtk.Window, not a nice hack.
         if win is None:
             return
         win.set_title(Renderers.msnplus_to_plain_text(text))
         win.set_icon(icon)
开发者ID:zhichao,项目名称:emesene,代码行数:11,代码来源:ConversationManager.py

示例11: add_message

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def add_message(self, msg, style=None, cedict={}, cedir=None):
        '''add a message to the conversation'''

        msg.alias = Renderers.msnplus_to_plain_text(msg.alias)
        msg.display_name = Renderers.msnplus_to_plain_text(msg.display_name)
        b_nick_check = bool(self.last_incoming_nickname != msg.display_name)
        if b_nick_check:
            self.last_incoming_nickname = msg.display_name
        if(len(msg.alias) > DISPLAY_NAME_LIMIT):
            msg.alias = msg.alias[0:DISPLAY_NAME_LIMIT] + "..."
        if(len(msg.display_name) > DISPLAY_NAME_LIMIT):
            msg.display_name = msg.display_name[0:DISPLAY_NAME_LIMIT] + "..."

        if msg.incoming:
            if self.last_incoming is None:
                self.last_incoming = False

            msg.first = not self.last_incoming

            if self.last_incoming_account != msg.sender or b_nick_check:
                msg.first = True

            html = self.theme.format_incoming(msg, style, cedict, cedir)
            self.last_incoming = True
            self.last_incoming_account = msg.sender
        else:
            if self.last_incoming is None:
                self.last_incoming = True

            msg.first = self.last_incoming

            html = self.theme.format_outgoing(msg, style, cedict, cedir)
            self.last_incoming = False

        if msg.type == "status":
            self.last_incoming = None
            msg.first = True

        if msg.first:
            function = "appendMessage('" + html + "')"
        else:
            function = "appendNextMessage('" + html + "')"

        self.append(function)
开发者ID:Lagg3r,项目名称:emesene,代码行数:46,代码来源:AdiumTextBox.py

示例12: show_tooltip

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def show_tooltip(self, view, origCoords, path_array, obj):
        ''' shows the tooltip of an e3.Contact '''
        self.tag = -1

        text = xml.sax.saxutils.escape(Renderers.msnplus_to_plain_text(obj.nick)) 
        text += '\n' + xml.sax.saxutils.escape(Renderers.msnplus_to_plain_text(obj.message))
        text += '\n' + self.data_string % (\
            obj.account, self.yes_no[bool(obj.blocked)])

        self.label.set_markup(text)

        # Sets tooltip image
        pixbuf = utils.safe_gtk_pixbuf_load(obj.picture, (96,96))
        self.image.set_from_pixbuf(pixbuf)
        self.image.show()

        # set the location of the tooltip
        x, y = self.computePosition(origCoords, view.window)
        self.move(x, y)
        self.show()
        return False
开发者ID:andreskru,项目名称:emesene,代码行数:23,代码来源:Tooltips.py

示例13: _on_message

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def _on_message(self, cid, account, msgobj, cedict=None):
        """
        This is fired when a new message arrives to a user.
        """
        contact = self.handler.session.contacts.get(account)

        if cid not in self.indicator_dict.values():
            conv_manager = self._get_conversation_manager(cid, account)

            if conv_manager:
                conv = conv_manager.conversations[cid]

                if not (conv_manager.is_active() and conv.members == [account]):

                    self._create_indicator("im", Renderers.msnplus_to_plain_text(contact.nick), account, cid=cid)
开发者ID:zhichao,项目名称:emesene,代码行数:17,代码来源:MessagingMenu.py

示例14: __append_contact

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
    def __append_contact(self, contact):
        """
        appends a contact to our submenu
        """
        #item = gtk.ImageMenuItem()
        item = gtk.MenuItem()
        item.set_label(Renderers.msnplus_to_plain_text(contact.nick))
        #pict = self.__get_contact_pixbuf_or_default(contact)
        #item.set_image(pict)
        item.connect('activate', self._on_contact_clicked)    
        self.item_to_contacts[item] = contact
        self.contacts_to_item[contact.account] = item

        item.show()
        self.add(item)
开发者ID:VirtualSilence,项目名称:emesene,代码行数:17,代码来源:TrayIcon.py

示例15: themeNotification

# 需要导入模块: import Renderers [as 别名]
# 或者: from Renderers import msnplus_to_plain_text [as 别名]
def themeNotification(title, text, picturePath=None,const=None):
    
    def pictureFactory(picture,constValue):

        if(picture):
            if(picture[:7]=="file://"):
                return picture
        if(constValue=='mail-received'):
            return "file://" + gui.theme.email
        elif(constValue=='file-transf-completed'):
            return "file://" + gui.theme.transfer_success
        elif(constValue=='file-transf-canceled'):
            return "file://" + gui.theme.transfer_unsuccess
        elif(constValue=='message-im'):
            return "file://" + gui.theme.user_def_imagetool
        else:
            return "file://" + gui.theme.user_def_imagetool

    if (const=='message-im'):
        #In this case title is contact nick
        title = Renderers.msnplus_to_plain_text(title)
    n = pynotify.Notification(title, text, pictureFactory(picturePath,const)) 
    n.set_hint_string("append", "allowed")
    n.show()
开发者ID:CelticHarp,项目名称:emesene,代码行数:26,代码来源:ThemeNotification.py


注:本文中的Renderers.msnplus_to_plain_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。