コード例 #1
0
 def update_information(self):
     '''update the information of the contact'''
     if self.contact:
         if self.contact.display_name == self.contact.nick:
             self.nick.set_markup(
                 Renderers.msnplus_to_list(
                     gobject.markup_escape_text(self.contact.display_name)))
         else:
             self.nick.set_markup(
                 Renderers.msnplus_to_list(
                     gobject.markup_escape_text(self.contact.nick + ' (' +
                                                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.image_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.image_theme.user)
         if (self.contact.blocked):
             self.blocked.set_markup(_('Yes'))
         else:
             self.blocked.set_markup(_('No'))
コード例 #2
0
ファイル: ContactList.py プロジェクト: WayneSan/emesene
    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
コード例 #3
0
ファイル: Tooltips.py プロジェクト: 19MiRkO91/emesene
    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
コード例 #4
0
ファイル: AdiumTextBox.py プロジェクト: EchoUSB/emesene
 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)
コード例 #5
0
ファイル: AdiumTextBox.py プロジェクト: pedrolinhares/emesene
 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)
コード例 #6
0
    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.user_def_image)

        if bool(obj.blocked):
            pixbufblock = utils.gtk_pixbuf_load(gui.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
コード例 #7
0
    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

        return 0
コード例 #8
0
def pyNotification(title, text, picturePath=None,const=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()
コード例 #9
0
ファイル: TextField.py プロジェクト: pedrolinhares/emesene
    def __init__(self, text, empty_text, allow_empty):
        '''class constructor, text is the text to show, empty_text is the
        text to display when no text is entered, allow_empty is a boolean
        that indicates if the user can enter an empty string'''
        gtk.VBox.__init__(self)

        self.entry = gtk.Entry()
        self.label = Renderers.SmileyLabel()
        #self.label.set_ellipsize(pango.ELLIPSIZE_END)
        self.button = gtk.Button()
        self.button.set_alignment(0.0, 0.5)
        self.button.set_relief(gtk.RELIEF_NONE)

        self._enabled = True

        self._text = text
        self.empty_text = empty_text
        self.allow_empty = allow_empty

        self.pack_start(self.button, True, True)
        self.pack_start(self.entry, True, True)

        self.button.add(self.label)
        self.text = self._text or self.empty_text

        self.button.connect('clicked', self.on_button_clicked)
        self.entry.connect('activate', self.on_entry_activate)
        self.entry.connect('focus-out-event', self._on_focus_out)
        self.entry.connect('key-press-event', self._on_key_press)
コード例 #10
0
    def __init__(self, text, on_tab_menu, on_close_clicked, conversation,
                 mozilla_like):
        '''constructor'''
        gtk.HBox.__init__(self)
        self.set_border_width(0)
        self.set_spacing(4)

        self.mozilla_like = mozilla_like
        self.image = gtk.Image()
        self.label = Renderers.SmileyLabel()
        self.label.set_ellipsize(True)
        self.label.set_text(text)
        self.close = TinyButton.TinyButton(gtk.STOCK_CLOSE)
        self.close.set_tooltip_text(_('Close Tab (Ctrl+W)'))
        self.close.connect('clicked', on_close_clicked, conversation)

        if CLOSE_ON_LEFT:
            self.pack_start(self.close, False, False, 0)
            self.pack_start(self.image, False, False, 0)
            self.pack_start(self.label, True, True, 0)
        else:
            self.pack_start(self.image, False, False, 0)
            self.pack_start(self.label, True, True, 0)
            self.pack_start(self.close, False, False, 0)

        self.image.show()
        self.label.show()
        self.close.show()
コード例 #11
0
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])
コード例 #12
0
ファイル: ConversationManager.py プロジェクト: Zincr0/emesene
 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)
コード例 #13
0
ファイル: PyNotification.py プロジェクト: EchoUSB/emesene
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()
コード例 #14
0
ファイル: ContactList.py プロジェクト: akikara/emesene
    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)
                )
コード例 #15
0
ファイル: TextField.py プロジェクト: pedrolinhares/emesene
 def _set_text(self, value):
     '''set the value of text'''
     self._text = value
     self.label.set_markup(
         Renderers.msnplus_to_list(
             gobject.markup_escape_text(self._text or self.empty_text)))
     self.entry.set_text(self._text)
コード例 #16
0
ファイル: ContactInformation.py プロジェクト: erikkll/emesene
 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'))
コード例 #17
0
ファイル: GtkNotification.py プロジェクト: CelticHarp/emesene
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])
コード例 #18
0
    def __init__(self, session, members):
        '''constructor'''
        gtk.HBox.__init__(self)
        self.set_border_width(2)
        self._information = Renderers.SmileyLabel()

        self.eventBox = gtk.EventBox()
        self.eventBox.set_visible_window(False)
        self.eventBox.add(self._information)
        self.eventBox.connect('button-press-event', self.on_clicked)

        self.pack_start(self.eventBox, True, True)

        self.session = session
        self.members = members

        self.menu = gtk.Menu()
        copynick = gtk.ImageMenuItem(_('Copy nick to clipboard'))
        copynick.set_image(gtk.image_new_from_stock(gtk.STOCK_COPY, gtk.ICON_SIZE_MENU))
        copypm = gtk.ImageMenuItem(_('Copy personal message to clipboard'))
        copypm.set_image(gtk.image_new_from_stock(gtk.STOCK_COPY, gtk.ICON_SIZE_MENU))
        copymail = gtk.ImageMenuItem(_('Copy mail to clipboard'))
        copymail.set_image(gtk.image_new_from_stock(gtk.STOCK_COPY, gtk.ICON_SIZE_MENU))
        self.menu.append(copynick)
        self.menu.append(copypm)
        self.menu.append(copymail)
        copynick.connect('activate', self.copy_nick)
        copypm.connect('activate', self.copy_pm)
        copymail.connect('activate', self.copy_mail)
        copynick.show()
        copypm.show()
        copymail.show()
コード例 #19
0
    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))
コード例 #20
0
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()
コード例 #21
0
 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)
コード例 #22
0
 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)
コード例 #23
0
ファイル: AdiumTextBox.py プロジェクト: Lagg3r/emesene
    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)
コード例 #24
0
 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)
コード例 #25
0
ファイル: Tooltips.py プロジェクト: andreskru/emesene
    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
コード例 #26
0
ファイル: AdiumTextBox.py プロジェクト: pedrolinhares/emesene
    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)
        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 \
               self.last_incoming_nickname != msg.display_name: # fix for groups.im
                msg.first = True

            html = self.theme.format_incoming(msg, style, cedict, cedir)
            self.last_incoming = True
            self.last_incoming_account = msg.sender
            self.last_incoming_nickname = msg.display_name
        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.first:
            function = "appendMessage('" + html + "')"
        else:
            function = "appendNextMessage('" + html + "')"

        self.append(function)
コード例 #27
0
ファイル: MessagingMenu.py プロジェクト: zhichao/emesene
    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)
コード例 #28
0
    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)
コード例 #29
0
ファイル: TrayIcon.py プロジェクト: VirtualSilence/emesene
    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)
コード例 #30
0
    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)
コード例 #31
0
    def __init__(self, session, account):
        '''constructor'''
        gtk.VBox.__init__(self)
        self.set_border_width(2)

        self.session = session
        if self.session:
            self.contact = self.session.contacts.get(account)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)

        self.model = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
        self.list = gtk.TreeView(self.model)
        column = gtk.TreeViewColumn()
        column.set_expand(False)
        column1 = gtk.TreeViewColumn()
        column1.set_expand(False)
        column2 = gtk.TreeViewColumn()
        column2.set_expand(True)

        crt = Renderers.CellRendererPlus()
        crt_timestamp = gtk.CellRendererText()
        crt.set_property('ellipsize', pango.ELLIPSIZE_END)
        pbr = gtk.CellRendererPixbuf()

        self.list.append_column(column)
        self.list.append_column(column1)
        self.list.append_column(column2)
        self.list.set_headers_visible(False)

        column.pack_start(pbr, False)
        column1.pack_start(crt_timestamp, False)
        column2.pack_start(crt, True)

        column.add_attribute(pbr, 'pixbuf', 0)
        column1.add_attribute(crt_timestamp, 'text', 1)
        column2.add_attribute(crt, 'markup', 2)

        scroll.add(self.list)

        self.pack_start(scroll, True, True)
コード例 #32
0
    def __init__(self, text, on_tab_menu, on_close_clicked, conversation,
                 mozilla_like):
        '''constructor'''
        gtk.HBox.__init__(self)
        self.set_border_width(0)
        self.set_spacing(4)

        self.session = conversation.session
        self.mozilla_like = mozilla_like
        self.image = gtk.Image()
        self.label = Renderers.SmileyLabel()
        self.label.set_ellipsize(True)
        self.label.set_text(text)
        self.close = TinyButton.TinyButton(gtk.STOCK_CLOSE)
        self.close.set_tooltip_text(_('Close Tab (Ctrl+W)'))
        self.close.connect('clicked', on_close_clicked, conversation)

        if CLOSE_ON_LEFT:
            self.pack_start(self.close, False, False, 0)
            self.pack_start(self.image, False, False, 0)
            self.pack_start(self.label, True, True, 0)
        else:
            self.pack_start(self.image, False, False, 0)
            self.pack_start(self.label, True, True, 0)
            self.pack_start(self.close, False, False, 0)

        if self.session.config.i_tab_position > 1:
            self.set_orientation(gtk.ORIENTATION_VERTICAL)
            self.label.set_angle(90)
        else:
            self.set_orientation(gtk.ORIENTATION_HORIZONTAL)
            self.label.set_angle(0)

        self.session.config.subscribe(self.on_tab_position_change,
                                      'i_tab_position')

        self.image.show()
        self.label.show()
コード例 #33
0
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()
コード例 #34
0
ファイル: TextField.py プロジェクト: jamonardo/emesene
 def _set_text(self, value):
     '''set the value of text'''
     self._text = value
     self.label.set_markup(Renderers.msnplus_to_list(gobject.markup_escape_text(self._text)))
     self.entry.set_text(self._text)
コード例 #35
0
 def set_text(self, text):
     '''set the text of the label'''
     self.label.set_markup(
         Renderers.msnplus_to_list(gobject.markup_escape_text(text)))
     if self.mozilla_like:
         self.set_size_request(235, 18)  # Empiric measures.
コード例 #36
0
def GrowlNotification(title, text, picture_path=None, const=None,
                   callback=None, tooltip=None):
        title = Renderers.msnplus_to_plain_text(title)
        subprocess.call(['/usr/local/bin/growlnotify', '-n', 'emesene', '-a', 'emesene', '-t', title, '-m', text])
コード例 #37
0
ファイル: TabWidget.py プロジェクト: Rohedin/emesene
 def set_text(self, text):
     '''set the text of the label'''
     self.label.set_markup(Renderers.msnplus_to_list(gobject.markup_escape_text(text)))
     self.set_size_request(235, 18) # Firefox-like, at least here.
コード例 #38
0
ファイル: Header.py プロジェクト: ammarabdulsalam/emesene
 def _set_information(self, lines):
     '''set the text on the information, lines is a tuple of size 3 with 3
     strings that will be replaced on the template'''
     self._information.set_markup(Renderers.msnplus_to_list(Header.INFO_TPL % lines))
コード例 #39
0
ファイル: TabWidget.py プロジェクト: abranches/emesene
 def set_text(self, text):
     '''set the text of the label'''
     self.label.set_markup(Renderers.msnplus_to_list(gobject.markup_escape_text(text)))
     if self.mozilla_like:
         self.set_size_request(235, 18) # Empiric measures.
コード例 #40
0
 def _set_information(self, lines):
     '''set the text on the information, lines is a tuple of size 3 with 3
     strings that will be replaced on the template'''
     self._information.set_markup(Renderers.msnplus_to_list(Header.INFO_TPL % lines))
コード例 #41
0
ファイル: AdiumTextBox.py プロジェクト: Lagg3r/emesene
 def information(self, formatter, contact, message):
     '''add an information message to the widget'''
     msg = gui.Message.from_information(contact, message)
     msg.message = Renderers.msnplus_to_plain_text(msg.message)
     self.view.add_message(msg, None, None, None)
コード例 #42
0
    def __init__(self, session, account):
        '''constructor'''
        gtk.VBox.__init__(self)
        self.set_border_width(2)

        self.session = session
        if self.session:
            self.contact = self.session.contacts.get(account)
        else:
            self.contact = None

        self.nick = Renderers.SmileyLabel()
        self.nick.set_alignment(0.0, 0.5)
        self.nick.set_ellipsize(pango.ELLIPSIZE_END)
        self.mail = gtk.Label()
        self.mail.set_alignment(0.0, 0.5)
        self.mail.set_ellipsize(pango.ELLIPSIZE_END)
        self.message = Renderers.SmileyLabel()
        self.message.set_ellipsize(pango.ELLIPSIZE_END)
        self.message.set_alignment(0.0, 0.5)
        self.status = gtk.Image()
        self.status.set_alignment(0.0, 0.5)
        self.image = gtk.Image()
        image_align = gtk.Alignment(0.5, 0.5)
        image_align.add(self.image)
        self.blocked = gtk.Label()
        self.blocked.set_alignment(0.0, 0.5)
        self.blocked.set_ellipsize(pango.ELLIPSIZE_END)

        table = gtk.Table(4, 2, False)
        table.set_border_width(20)
        table.set_row_spacings(10)
        table.set_col_spacings(10)

        l_image = gtk.Label(_('Image'))
        l_image.set_alignment(0.0, 0.5)
        l_nick = gtk.Label(_('Nick'))
        l_nick.set_alignment(0.0, 0.5)
        l_mail = gtk.Label(_('E-Mail'))
        l_mail.set_alignment(0.0, 0.5)
        l_status = gtk.Label(_('Status'))
        l_status.set_alignment(0.0, 0.5)
        l_message = gtk.Label(_('Message'))
        l_message.set_alignment(0.0, 0.5)
        l_blocked = gtk.Label(_('Blocked'))
        l_blocked.set_alignment(0.0, 0.5)

        table.attach(l_nick, 0, 1, 0, 1, 0)
        table.attach(self.nick, 1, 2, 0, 1)
        table.attach(l_mail, 0, 1, 1, 2, 0)
        table.attach(self.mail, 1, 2, 1, 2)
        table.attach(l_status, 0, 1, 2, 3, 0)
        table.attach(self.status, 1, 2, 2, 3)
        table.attach(l_message, 0, 1, 3, 4, 0)
        table.attach(self.message, 1, 2, 3, 4)
        table.attach(l_blocked, 0, 1, 4, 5, 0)
        table.attach(self.blocked, 1, 2, 4, 5)

        hbox = gtk.HBox(False, 0)
        self.set_border_width(15)
        hbox.pack_start(image_align, False, False)
        hbox.pack_start(table, True, True)

        self.pack_start(hbox, False, False)

        self.update_information()