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


Python Renderers类代码示例

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


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

示例1: clear

 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,代码行数:7,代码来源:AdiumTextBox.py

示例2: show_tooltip

    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,代码行数:29,代码来源:Tooltips.py

示例3: compare_contacts

    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,代码行数:31,代码来源:ContactList.py

示例4: pyNotification

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,代码行数:7,代码来源:PyNotification.py

示例5: _on_drag_data_get

    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,代码行数:28,代码来源:ContactList.py

示例6: ThemeNotification

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,代码行数:27,代码来源:ThemeNotification.py

示例7: gtkNotification

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,代码行数:34,代码来源:GtkNotification.py

示例8: update_window

 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,代码行数:7,代码来源:ConversationManager.py

示例9: update_information

 def update_information(self):
     '''update the information of the contact'''
     if self.contact:
         self.nick.set_markup(Renderers.msnplus_to_list(gobject.markup_escape_text(self.contact.display_name)))
         self.mail.set_markup(self.contact.account)
         self.message.set_markup(Renderers.msnplus_to_list(gobject.markup_escape_text(self.contact.message)))
         self.status.set_from_file(
             gui.theme.status_icons[self.contact.status])
         if (self.contact.picture):
             self.image.set_from_file(self.contact.picture)
         else:
             self.image.set_from_file(gui.theme.user)
         if (self.contact.blocked):
             self.blocked.set_markup(_('Yes'))
         else:
             self.blocked.set_markup(_('No'))
开发者ID:erikkll,项目名称:emesene,代码行数:16,代码来源:ContactInformation.py

示例10: _on_switch_page

 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,代码行数:8,代码来源:ConversationManager.py

示例11: update_window

 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,代码行数:9,代码来源:ConversationManager.py

示例12: add_message

    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,代码行数:44,代码来源:AdiumTextBox.py

示例13: show_tooltip

    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,代码行数:21,代码来源:Tooltips.py

示例14: _on_message

    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,代码行数:15,代码来源:MessagingMenu.py

示例15: __append_contact

    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,代码行数:15,代码来源:TrayIcon.py


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