Example #1
0
    def paint(e):
        dc = wx.AutoBufferedPaintDC(f)
        dc.SetPen(wx.TRANSPARENT_PEN)
        dc.SetBrush(wx.BLACK_BRUSH)
        dc.DrawRectangleRect(f.ClientRect)

        dc.DrawBitmap(icons.gmail, 0, 0, True)
        dc.DrawBitmap(draw_tiny_text(icons.gmail, 'test').WXB, 0, 40, True)
Example #2
0
def generate_hidden_message_icon(nummessages, icon = None):
    from gui import skin

    if icon is None:
        icon = skin.get('AppDefaults.UnreadMessageIcon')

    size = native_taskbar_icon_size()
    icon = icon.PIL.ResizedSmaller(size).ResizeCanvas(size, size)

    if nummessages is not None:
        icon = draw_tiny_text(icon, str(nummessages))

    return icon
Example #3
0
def generate_hidden_message_icon(nummessages, icon=None):
    from gui import skin

    if icon is None:
        icon = skin.get('AppDefaults.UnreadMessageIcon')

    size = native_taskbar_icon_size()
    icon = icon.PIL.ResizedSmaller(size).ResizeCanvas(size, size)

    if nummessages is not None:
        icon = draw_tiny_text(icon, str(nummessages))

    return icon
Example #4
0
def im_badge(specific_page=None):
    '''typing status and unread count badge for Win7 taskbar'''

    imwins = []

    typing_statuses = dict(
        (s, i) for i, s in enumerate([None, 'typed', 'typing']))
    max_typing = None
    unread_count = 0
    needs_bubbles = False

    if specific_page is None:
        for imframe in all_imframes():
            notified_wins = set(tab.page.panel
                                for tab in imframe.eventHandler.notifiedtabs)

            for page in imframe.notebook.Pages():
                imwin = page.panel
                if typing_statuses[imwin.typing] > typing_statuses[max_typing]:
                    max_typing = imwin.typing

                if imwin in notified_wins:
                    unread_count += 1
    else:
        max_typing = specific_page.typing
        needs_bubbles = specific_page.Notified

    bubble_icon = None
    if max_typing is not None:
        bubble_icon = skin.get('statusicons.' + max_typing, None)
    if bubble_icon is None and (unread_count or
                                (specific_page is not None and needs_bubbles)):
        bubble_icon = skin.get('AppDefaults.UnreadMessageIcon', None)
    if bubble_icon is not None:
        bubble_icon = bubble_icon.PIL.ResizeCanvas(16, 16)
    if unread_count:
        if bubble_icon is None:
            bubble_icon = Image.new('RGBA', (16, 16))
        bubble_icon = draw_tiny_text(bubble_icon, str(unread_count))
    if specific_page is None and bubble_icon is not None:
        bubble_icon = bubble_icon.WXB

    return bubble_icon
Example #5
0
    def on_account_updated(self, obj=None, attr=None, old=None, new=None):
        obj_or_event = obj
        if not self or getattr(self, '_destroyed', False):
            return

        acct  = self.acct
        count = self.count_string

        if acct.enabled:
            # todo: remove this lame way figure out icon size
            icon = acct.icon.PIL.Resized(self._IconSize)

            if self.should_show_count() and count:
                # place text in the corner
                icon = draw_tiny_text(icon, str(count)).WX

            if pref('trayicons.email.gray_on_empty', True) and count in (0, 'X') and should_grey(acct):
                icon = icon.WXB.Greyed

            self.SetIcon(icon, self.Tooltip)
Example #6
0
    def on_account_updated(self, obj=None, attr=None, old=None, new=None):
        obj_or_event = obj
        if not self or getattr(self, '_destroyed', False):
            return

        acct = self.acct
        count = self.count_string

        if acct.enabled:
            # todo: remove this lame way figure out icon size
            icon = acct.icon.PIL.Resized(self._IconSize)

            if self.should_show_count() and count:
                # place text in the corner
                icon = draw_tiny_text(icon, str(count)).WX

            if pref('trayicons.email.gray_on_empty',
                    True) and count in (0, 'X') and should_grey(acct):
                icon = icon.WXB.Greyed

            self.SetIcon(icon, self.Tooltip)
Example #7
0
def im_badge(specific_page=None):
    '''typing status and unread count badge for Win7 taskbar'''

    imwins = []

    typing_statuses = dict((s, i) for i, s in enumerate([None, 'typed', 'typing']))
    max_typing = None
    unread_count = 0
    needs_bubbles = False

    if specific_page is None:
        for imframe in all_imframes():
            notified_wins = set(tab.page.panel for tab in imframe.eventHandler.notifiedtabs)

            for page in imframe.notebook.Pages():
                imwin = page.panel
                if typing_statuses[imwin.typing] > typing_statuses[max_typing]:
                    max_typing = imwin.typing

                if imwin in notified_wins:
                    unread_count += 1
    else:
        max_typing = specific_page.typing
        needs_bubbles = specific_page.Notified

    bubble_icon = None
    if max_typing is not None:
        bubble_icon = skin.get('statusicons.' + max_typing, None)
    if bubble_icon is None and (unread_count or (specific_page is not None and needs_bubbles)):
        bubble_icon = skin.get('AppDefaults.UnreadMessageIcon', None)
    if bubble_icon is not None:
        bubble_icon = bubble_icon.PIL.ResizeCanvas(16, 16)
    if unread_count:
        if bubble_icon is None:
            bubble_icon = Image.new('RGBA', (16, 16))
        bubble_icon = draw_tiny_text(bubble_icon, str(unread_count))
    if specific_page is None and bubble_icon is not None:
        bubble_icon = bubble_icon.WXB

    return bubble_icon