示例#1
0
    def search(self, e=None):
        if not pref('search.buddylist.enabled', True):
            if e is not None: e.Skip()
            return

        key, backspace = self._interpret_char_event(e)

        def size_like(img, i):
            img = img.ResizedSmaller(max(i.Width, i.Height)).PIL
            return img.ResizeCanvas(i.Width, i.Height).WXB

        icon = skin.get('StatusPanel.SearchIcon')
        self.ForceTextFieldBackground = True
        self.cbutton.SetIcon(size_like(icon, self._button_icon))
        self.DropDownButton.SetIcon(skin.get('StatusPanel.CancelSearchIcon'))
        self.searching = True
        if not hasattr(self, 'search_timer'):
            self.search_timer = wx.PyTimer(self.on_search_timer)
        self.search_timer.Start(500)

        self.display.TypeField()

        # emulate a keypress if one started the search
        self.TextField.ChangeValue(profile.blist.search_string)

        if key is not None:
            self.TextField.AppendText(key)
        if backspace:
            # emulate a backspace
            size = self.TextField.LastPosition
            self.TextField.Remove(size-1, size)

        self.OnActivateSearch()
示例#2
0
文件: umenu.py 项目: sgricci/digsby
    def UpdateSkin(self):

        # no specific skinkey means look it up in MenuBar.MenuSkin
        mbskin = skin.get('MenuBar', None)

        if "wxMac" in wx.PlatformInfo or not mbskin or mbskin.get(
                'menuskin', None) is None or mbskin.get(
                    'mode', 'skin').lower() == 'native':
            self.skin = S(native=True)
            native = True
        else:
            self.skin = skin.get(mbskin.menuskin)
            native = False
            self.skin.native = False

        if not native and not hasattr(self, 'popup'):
            # create a PopupWindow child for displaying a skinned menu
            self.popup = MenuPopupWindow(self.Window, self)
        elif not native:
            # since UpdateSkin is called on UMenus separately and does not descend the widget tree,
            # do it manually here.
            self.popup.UpdateSkin()
            self.popup.vlist.UpdateSkin()
        elif native:
            if hasattr(self, 'popup'):
                # destroy the skinned PopupWindow if we're in native mode
                self.popup.Destroy()
                del self.popup
示例#3
0
    def on_call_fire(self, opts, id=None, buttons=None, onclick=None):
        from common import fire, pref
        from gui import skin

        # stringify keys, so that they can be keywords.
        # also turn dicts into storages
        opts = to_storage(dict((str(k), v) for k, v in opts.iteritems()))

        if pref('twitter.popups.user_icons', default=True):
            from gui.browser.webkit.imageloader import LazyWebKitImage
            twitter_icon = skin.get('serviceicons.twitter', None)
            for tweet in opts.tweets:
                tweet.icon = LazyWebKitImage(tweet.user.profile_image_url,
                                             twitter_icon)

        def buttons_cb(item):
            if hasattr(item.tweet, 'sender_id'):
                return self.direct_buttons
            else:
                return self.tweet_buttons

        opts.update(onclick=onclick or self.on_popup_click,
                    popupid='twitter20_' + self.username +
                    str(opts.get('popupid_postfix', '')),
                    buttons=buttons or buttons_cb,
                    max_lines=10)

        if pref('twitter.popups.mark_as_read', default=True):
            opts.update(mark_as_read=self.mark_as_read)

        opts.update(badge=skin.get('serviceicons.twitter', None))

        fire(**opts)
示例#4
0
    def UpdateSkin(self):

        # no specific skinkey means look it up in MenuBar.MenuSkin
        mbskin = skin.get('MenuBar', None)

        if "wxMac" in wx.PlatformInfo or not mbskin or mbskin.get('menuskin', None) is None or mbskin.get('mode', 'skin').lower() == 'native':
            self.skin = S(native = True)
            native = True
        else:
            self.skin = skin.get(mbskin.menuskin)
            native = False
            self.skin.native = False

        if not native and not hasattr(self, 'popup'):
            # create a PopupWindow child for displaying a skinned menu
            self.popup = MenuPopupWindow(self.Window, self)
        elif not native:
            # since UpdateSkin is called on UMenus separately and does not descend the widget tree,
            # do it manually here.
            self.popup.UpdateSkin()
            self.popup.vlist.UpdateSkin()
        elif native:
            if hasattr(self, 'popup'):
                # destroy the skinned PopupWindow if we're in native mode
                self.popup.Destroy()
                del self.popup
示例#5
0
    def __init__(self,
                 parent,
                 label='',
                 callapsedicon=None,
                 expandedicon=None):
        SimplePanel.__init__(self, parent)

        self.callapsedicon = callapsedicon or skin.get(
            'AppDefaults.icons.chevroncolapsed')
        self.expandedicon = expandedicon or skin.get(
            'AppDefaults.icons.chevronexpanded')
        self.Label = label
        self._expanded = False

        self.CalcSize()

        self.isdown = False

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)
        Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        Bind(wx.EVT_LEFT_DCLICK, self.OnDClick)
        Bind(wx.EVT_ENTER_WINDOW, self.OnMouseIn)
        Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseOut)
示例#6
0
    def search(self, e=None):
        if not pref('search.buddylist.enabled', True):
            if e is not None: e.Skip()
            return

        key, backspace = self._interpret_char_event(e)

        def size_like(img, i):
            img = img.ResizedSmaller(max(i.Width, i.Height)).PIL
            return img.ResizeCanvas(i.Width, i.Height).WXB

        icon = skin.get('StatusPanel.SearchIcon')
        self.ForceTextFieldBackground = True
        self.cbutton.SetIcon(size_like(icon, self._button_icon))
        self.DropDownButton.SetIcon(skin.get('StatusPanel.CancelSearchIcon'))
        self.searching = True
        if not hasattr(self, 'search_timer'):
            self.search_timer = wx.PyTimer(self.on_search_timer)
        self.search_timer.Start(500)

        self.display.TypeField()

        # emulate a keypress if one started the search
        self.TextField.ChangeValue(profile.blist.search_string)

        if key is not None:
            self.TextField.AppendText(key)
        if backspace:
            # emulate a backspace
            size = self.TextField.LastPosition
            self.TextField.Remove(size - 1, size)

        self.OnActivateSearch()
示例#7
0
    def UpdateSkin(self):
        Renderer.UpdateSkin(self)
        s = self.skin

        s.margins          = skin.get('BuddiesPanel.GroupMargins')
        s.padding          = skin.get('BuddiesPanel.GroupPadding', lambda: Point(4,4))

        # Expanded/Collapsed icons next to group names
        g = lambda k, default = sentinel: skin.get('BuddiesPanel.GroupIcons.' + k, default)
        s.expanded         = g('Expanded',         lambda: None)
        s.expandedhover    = g('ExpandedHover',    lambda: s.expanded)
        s.expandedselected = g('ExpandedSelected', lambda: s.expanded)

        s.collapsed         = g('Collapsed',         lambda: None)
        s.collapsedhover    = g('CollapsedHover',    s.collapsed)
        s.collapsedselected = g('CollapsedSelected', s.collapsed)

        # Group backgrounds (default to Buddy backgrounds if not specified)
        g = lambda k, default: skin.get('BuddiesPanel.Backgrounds.' + k, default)
        s.bg         = g('Group',         lambda: g('Buddy'))
        s.hoverbg    = g('GroupHover',    lambda: g('BuddyHover'))
        s.selectedbg = g('GroupSelected', lambda: g('BuddySelected'))

        # Group font colors (default to Buddy font colors if not specified)
        f = s.fontcolors
        g = lambda k, default: skin.get('BuddiesPanel.FontColors.' + k, default)
        f.group         = g('Group',         lambda: g('Buddy',         lambda: syscol(wx.SYS_COLOUR_WINDOWTEXT)))
        f.grouphover    = g('GroupHover',    lambda: g('BuddyHover',    lambda: syscol(wx.SYS_COLOUR_WINDOWTEXT)))
        f.groupselected = g('GroupSelected', lambda: g('BuddySelected', lambda: syscol(wx.SYS_COLOUR_HIGHLIGHTTEXT)))

        self.calcsizes()
示例#8
0
    def on_call_fire(self, opts, id=None, buttons=None, onclick=None):
        from common import fire, pref
        from gui import skin

        # stringify keys, so that they can be keywords.
        # also turn dicts into storages
        opts = to_storage(dict((str(k), v)
                    for k, v in opts.iteritems()))

        if pref('twitter.popups.user_icons', default=True):
            from gui.browser.webkit.imageloader import LazyWebKitImage
            twitter_icon = skin.get('serviceicons.twitter', None)
            for tweet in opts.tweets:
                tweet.icon = LazyWebKitImage(tweet.user.profile_image_url, twitter_icon)

        def buttons_cb(item):
            if hasattr(item.tweet, 'sender_id'):
                return self.direct_buttons
            else:
                return self.tweet_buttons

        opts.update(onclick=onclick or self.on_popup_click,
                    popupid='twitter20_' + self.username + str(opts.get('popupid_postfix', '')),
                    buttons=buttons or buttons_cb,
                    max_lines=10)

        if pref('twitter.popups.mark_as_read', default=True):
            opts.update(mark_as_read=self.mark_as_read)

        opts.update(badge=skin.get('serviceicons.twitter', None))

        fire(**opts)
示例#9
0
    def UpdateSkin(self):
        """
            The usual update skin
        """
        key = self.skinkey
        s = lambda k,d=None: skin.get('%s.%s'%(key,k),d)

        self.bg             = s('backgrounds.account',lambda: SkinColor(wx.WHITE))
        self.majorfont      = s('Fonts.Account', default_font)
        self.minorfont      = s('Fonts.StateAndLink',default_font)
        self.linkfont       =  CopyFont(self.minorfont, underline=True)
        self.majorfc        = s('FontColors.Account', wx.BLACK)
        self.statefc        = s('FontColors.State',lambda: wx.Colour(125,125,125))
        self.linkfc         = s('FontColors.Link', wx.BLUE)
        self.closeicon      =  [None]*3
        self.closeicon[0]   = s('Icons.Close',skin.get('AppDefaults.removeicon')).ResizedSmaller(16)
        self.closeicon[1]   = s('Icons.CloseHover',self.closeicon[0]).ResizedSmaller(16)
        self.closeicon[2]   = s('Icons.CloseDown',self.closeicon[1]).ResizedSmaller(16)
        self.liconsize      = s('ServiceIconSize',16)
        self.padding        = s('Padding',lambda: wx.Point(3,3))


        self.stateicon = self.account.statusicon.ResizedSmaller(16)

        self.licon = self.account.serviceicon.Resized(self.liconsize)

        if self.initover:
            self.CalcLayout()
示例#10
0
    def UpdateSkin(self):
        self.padding    = wx.Point(4, 4)

        self.headerfont = skin.get('infobox.fonts.header',lambda: default_font())
        self.linkfont   = CopyFont(skin.get('infobox.fonts.link',lambda: default_font()), underline=True)
        self.elinkfont  = CopyFont(self.linkfont, weight=wx.FONTWEIGHT_BOLD)
        self.headerfc=skin.get('infobox.fontcolors.navbarheader', lambda: wx.BLACK)
        self.linkfc=skin.get('infobox.fontcolors.navbarlink', lambda: wx.BLUE)

        linkposx = self.padding[0]*2 + 16
        linkposy = self.headerfont.Height+2*self.padding[1]
        self.linkage.SetPosition((linkposx,linkposy))


        for link in self.linkage:
            link.NormalColour=link.HoverColour=link.VisitedColour=self.linkfc
            link.Font=self.linkfont
        self.linkage.Layout()


        elink = self.extralinkage
        if elink:
            elink.NormalColour = elink.HoverColour = elink.VisitedColour = self.linkfc
            elink.Font = self.elinkfont

            elink.Size = elink.BestSize
            elinkposx = self.Size.width - self.padding[0] - elink.BestSize.width
            elink.SetPosition((elinkposx, linkposy))


        self.bg   = skin.get('infobox.backgrounds.header', lambda: SkinColor(wx.Color(225, 255, 225)))
#        self.sep  = skin.get('infobox.longseparatorimage', None)
        self.Size = self.MinSize = wx.Size(-1, self.headerfont.Height + self.linkfont.Height + self.padding.y * 4)# + self.sep.Size.height
示例#11
0
    def UpdateSkin(self):
        """
            The usual update skin
        """
        key = self.skinkey
        s = lambda k, d=None: skin.get('%s.%s' % (key, k), d)

        self.bg = s('backgrounds.account', lambda: SkinColor(wx.WHITE))
        self.majorfont = s('Fonts.Account', default_font)
        self.minorfont = s('Fonts.StateAndLink', default_font)
        self.linkfont = CopyFont(self.minorfont, underline=True)
        self.majorfc = s('FontColors.Account', wx.BLACK)
        self.statefc = s('FontColors.State', lambda: wx.Colour(125, 125, 125))
        self.linkfc = s('FontColors.Link', wx.BLUE)
        self.closeicon = [None] * 3
        self.closeicon[0] = s(
            'Icons.Close',
            skin.get('AppDefaults.removeicon')).ResizedSmaller(16)
        self.closeicon[1] = s('Icons.CloseHover',
                              self.closeicon[0]).ResizedSmaller(16)
        self.closeicon[2] = s('Icons.CloseDown',
                              self.closeicon[1]).ResizedSmaller(16)
        self.liconsize = s('ServiceIconSize', 16)
        self.padding = s('Padding', lambda: wx.Point(3, 3))

        self.stateicon = self.account.statusicon.ResizedSmaller(16)

        self.licon = self.account.serviceicon.Resized(self.liconsize)

        if self.initover:
            self.CalcLayout()
示例#12
0
    def UpdateSkin(self):
        Renderer.UpdateSkin(self)
        s = self.skin
        self.skin.margins = skin.get('BuddiesPanel.BuddyMargins')

        f, g = s.fontcolors, lambda k, default: skin.get('BuddiesPanel.FontColors.' + k, default)
        f.details = g('IdleTime',      lambda: syscol(wx.SYS_COLOUR_GRAYTEXT))

        self.calcsizes()
示例#13
0
    def ShowSearchHint(self):
        self.searchHintShown = True

        def size_like(img, i):
            img = img.ResizedSmaller(max(i.Width, i.Height)).PIL
            return img.ResizeCanvas(i.Width, i.Height).WXB

        self.cbutton.SetIcon(size_like(skin.get('StatusPanel.SearchIcon'), self._button_icon))
        self.DropDownButton.SetIcon(skin.get('StatusPanel.CancelSearchIcon'))
        self.display.DisplayLabel = _("Press 'Ctrl+F' to Search List")
示例#14
0
    def UpdateSkin(self):
        self.dragimgs = S(bar = skin.get('BuddiesPanel.Dragimages.Bar'), #TODO: stretch?
                          box = skin.get('BuddiesPanel.Dragimages.Box'))

        for renderer in self.renderers.itervalues():
            renderer.UpdateSkin()

        bg = skin.get('BuddiesPanel.Backgrounds.List', lambda: SkinColor(wx.WHITE))
        self.SetBackground(bg)

        self.RefreshAll()
示例#15
0
    def ShowSearchHint(self):
        self.searchHintShown = True

        def size_like(img, i):
            img = img.ResizedSmaller(max(i.Width, i.Height)).PIL
            return img.ResizeCanvas(i.Width, i.Height).WXB

        self.cbutton.SetIcon(
            size_like(skin.get('StatusPanel.SearchIcon'), self._button_icon))
        self.DropDownButton.SetIcon(skin.get('StatusPanel.CancelSearchIcon'))
        self.display.DisplayLabel = _("Press 'Ctrl+F' to Search List")
示例#16
0
    def UpdateSkin(self):
        key = self.tabskin = self.skinkey
        g = lambda k, default=sentinel: skin.get(key + "." + k, default)
        sg = lambda k, default=sentinel: skin.get("side" + key + "." + k, default)

        elems = (
            ("spacing", "spacing", 2),
            ("bg", "backgrounds.bar"),
            ("dropmarkerimage", "dropmarker.image"),
            #                 ('dropmarkeroverlay', 'dropmarker.overlay', 0),
            ("dropmarkeroffset", "dropmarker.offset", 0),
            ("closebuttonskin", "closebuttonskin", ""),
            ("closeicon", "icons.close", None),
            ("scrollbuttonskin", "scrollbuttonskin", ""),
            ("lefticon", "icons.left", ""),
            ("righticon", "icons.right", ""),
            ("upicon", "icons.up", ""),
            ("downicon", "icons.down", ""),
        )

        for elem in elems:
            setattr(self, "top" + elem[0], g(*elem[1:]))
            setattr(self, "side" + elem[0], sg(elem[1], getattr(self, "top" + elem[0])))
            setattr(self, elem[0], getattr(self, ("side" if self.side_tabs else "top") + elem[0]))

        if hasattr(self, "dropmarker"):
            self.dropmarker.SetImage(self.dropmarkerimage)
            self.dropmarker.SetRotation((self.side_tabs and not self.dropmarkerimage))

        navi = getattr(self, "navi", None)
        if navi is not None:
            self.cdownb.SetSkinKey(self.scrollbuttonskin)
            self.cupb.SetSkinKey(self.scrollbuttonskin)
            self.cdownb.SetIcon(self.downicon)
            self.cupb.SetIcon(self.upicon)

            self.navi.closebutton.SetSkinKey(self.closebuttonskin)

            self.navi.closebutton.SetIcon(self.closeicon)

            scrollskin = self.scrollbuttonskin

            navi.prevb.SetSkinKey(scrollskin)
            navi.nextb.SetSkinKey(scrollskin)
            navi.upb.SetSkinKey(scrollskin)
            navi.downb.SetSkinKey(scrollskin)

            navi.prevb.SetIcon(self.lefticon)
            navi.nextb.SetIcon(self.righticon)
            navi.upb.SetIcon(self.upicon)
            navi.downb.SetIcon(self.downicon)

        wx.CallAfter(self.Generate)
示例#17
0
    def UpdateSkin(self):
        key = self.tabskin = self.skinkey
        g   = lambda k, default = sentinel: skin.get(key + '.' + k, default)
        sg   = lambda k, default = sentinel: skin.get('side' + key + '.' + k, default)

        elems = (('spacing', 'spacing',          2),
                 ('bg', 'backgrounds.bar'),
                 ('dropmarkerimage', 'dropmarker.image'),
#                 ('dropmarkeroverlay', 'dropmarker.overlay', 0),
                 ('dropmarkeroffset', 'dropmarker.offset', 0),
                 ('closebuttonskin', 'closebuttonskin', ''),
                 ('closeicon', 'icons.close', None),
                 ('scrollbuttonskin', 'scrollbuttonskin', ''),
                 ('lefticon', 'icons.left', ''),
                 ('righticon', 'icons.right', ''),
                 ('upicon', 'icons.up', ''),
                 ('downicon', 'icons.down', ''))

        for elem in elems:
            setattr(self, 'top' + elem[0], g(*elem[1:]))
            setattr(self, 'side' + elem[0], sg(elem[1],getattr(self,'top' + elem[0])))
            setattr(self, elem[0], getattr(self, ('side' if self.side_tabs else 'top') + elem[0]))


        if hasattr(self,'dropmarker'):
            self.dropmarker.SetImage(self.dropmarkerimage)
            self.dropmarker.SetRotation((self.side_tabs and not self.dropmarkerimage))

        navi = getattr(self, 'navi', None)
        if navi is not None:
            self.cdownb.SetSkinKey(self.scrollbuttonskin)
            self.cupb.SetSkinKey(self.scrollbuttonskin)
            self.cdownb.SetIcon(self.downicon)
            self.cupb.SetIcon(self.upicon)

            self.navi.closebutton.SetSkinKey(self.closebuttonskin)

            self.navi.closebutton.SetIcon(self.closeicon)

            scrollskin = self.scrollbuttonskin

            navi.prevb.SetSkinKey(scrollskin)
            navi.nextb.SetSkinKey(scrollskin)
            navi.upb.SetSkinKey(scrollskin)
            navi.downb.SetSkinKey(scrollskin)

            navi.prevb.SetIcon(self.lefticon)
            navi.nextb.SetIcon(self.righticon)
            navi.upb.SetIcon(self.upicon)
            navi.downb.SetIcon(self.downicon)

        wx.CallAfter(self.Generate)
示例#18
0
    def UpdateSkin(self):
        self.dragimgs = S(
            bar=skin.get('BuddiesPanel.Dragimages.Bar'),  #TODO: stretch?
            box=skin.get('BuddiesPanel.Dragimages.Box'))

        for renderer in self.renderers.itervalues():
            renderer.UpdateSkin()

        bg = skin.get('BuddiesPanel.Backgrounds.List',
                      lambda: SkinColor(wx.WHITE))
        self.SetBackground(bg)

        self.RefreshAll()
示例#19
0
    def UpdateSkin(self):
        Renderer.UpdateSkin(self)
        s = self.skin
        self.skin.margins = skin.get('BuddiesPanel.BuddyMargins')

        f, g = s.fontcolors, lambda k, default: skin.get('BuddiesPanel.FontColors.' + k, default)
        f.buddy            = g('Buddy',         lambda: syscol(wx.SYS_COLOUR_WINDOWTEXT))
        f.buddyoffline     = g('BuddyOffline',  lambda: syscol(wx.SYS_COLOUR_GRAYTEXT))
        f.buddyselected    = g('BuddySelected', lambda: syscol(wx.SYS_COLOUR_HIGHLIGHTTEXT))
        f.buddyhover       = g('BuddyHover',    lambda: f.buddy)
        f.details          = g('IdleTime',      lambda: syscol(wx.SYS_COLOUR_GRAYTEXT))

        self.calcsizes()
示例#20
0
    def newsfeed_popups(self, filter_old=True):
        log.info("doing newsfeed popups")
        s = self.connection.last_stream
        old_ids = self.old_stream_ids if filter_old else ()
        feed = s["posts"]
        new_posts = []
        for post in feed:
            if post["post_id"] in old_ids:
                log.info("post %r is old", post["post_id"])
                break
            source = post.get("source_id")
            actor = post.get("actor_id")
            viewer = post.get("viewer_id")
            try:
                do_add = source and viewer and int(source) != int(viewer) and int(actor) != int(viewer)
            except ValueError:
                do_add = True
            if do_add:
                new_posts.append(post)
            else:
                log.info("filtered message %s because it came from this account", post["post_id"])

        options = dict(buttons=self.get_popup_buttons)

        if new_posts:
            from gui import skin

            if common.pref("facebook.popups.user_icons", default=True):
                from gui.browser.webkit.imageloader import LazyWebKitImage

                default_icon = skin.get("serviceicons.facebook", None)
                for post in new_posts:
                    try:
                        url = s.profiles[int(post["actor_id"])].pic_square
                    except Exception:
                        traceback.print_exc()
                    else:
                        post.icon = LazyWebKitImage(url, default_icon)

            fire(
                "facebook.newsfeed",
                profiles=s["profiles"],
                posts=new_posts,
                popupid="%d.facebook" % id(self),
                update="paged",
                badge=skin.get("serviceicons.facebook", None),
                scrape_clean=string_helpers.scrape_clean,
                onclick=self.on_popup_click_post,
                **options
            )
        self.old_stream_ids = set(self.connection.last_stream["post_ids"])
示例#21
0
    def UpdateSkin(self):
        'Updates local skin references'

        size = skin.get('emotibox.emoticonspace', 24)
        self.Size = wx.Size(size, size)
        esize = skin.get('emotibox.maxemoticonsize', 16)
        self.normalbg = skin.get('emotibox.backgrounds.emoticon', None)
        self.hoverbg = skin.get('emotibox.backgrounds.hover', None)

        emote = self.emote
        if emote is not None:
            self.bitmap = emote.ResizedSmaller(esize)
        else:
            self.bitmap = None
示例#22
0
    def BuildToolBar(self):
        """
        Create the toolbar for the native IM window frame.
        """
        toolbar = self.frame.CreateToolBar()

        s = lambda name, d=None: skin.get(
            'AppDefaults.FormattingBar.%s' % name, d)
        icons = s('icons').get
        actionIcons = skin.get('ActionsBar.Icons')

        iconsize = (24, 24)
        eicon = icons('emote').Resized(iconsize)

        toolbar.AddLabelTool(actionIDs.BuddyOptions, "Buddy",
                             wx.EmptyBitmap(32, 32))
        toolbar.AddLabelTool(actionIDs.Files, "Files",
                             getattr(actionIcons, 'files').Resized(iconsize))
        toolbar.AddSeparator()

        app = wx.GetApp()
        for attr, title, tooltip in capabilitiesbar.buttons:
            if attr in ["files", "sms", "video"]:
                continue
            baricon = getattr(actionIcons, attr).Resized(iconsize)
            buttonID = buttonIDs[attr]
            toolbar.AddLabelTool(buttonID, title, baricon)
            app.AddHandlerForID(buttonID, self.OnModeClicked)

        toolbar.AddSeparator()
        toolbar.AddLabelTool(actionIDs.SetFont, "Font",
                             getattr(actionIcons, "font").Resized(iconsize))
        toolbar.AddLabelTool(
            actionIDs.SetBackgroundColor, "Bg Color",
            getattr(actionIcons, "background").Resized(iconsize))
        toolbar.AddLabelTool(actionIDs.ChooseEmoticon, "Emoticon", eicon)

        toolbar.AddSeparator()

        toolbar.AddLabelTool(
            actionIDs.AddContact, "Add Contact",
            getattr(actionIcons, "addcontact").Resized(iconsize))
        toolbar.AddLabelTool(
            actionIDs.ViewPastChats, "View Past Chats",
            getattr(actionIcons, "viewpastchats").Resized(iconsize))
        toolbar.AddLabelTool(
            actionIDs.AlertMeWhen, "Alert Me When",
            getattr(actionIcons, "alertmewhen").Resized(iconsize))

        toolbar.Realize()
示例#23
0
    def after():
        from gui import skin
        TASKS = [
            action('globalstatus', _('Set your status on multiple networks'),
                   _('Set Global Status'), skin.get('icons.globalstatus',
                                                    None)),
            action('newim', _('Open the New IM window'), _('New IM...'),
                   skin.get('AppDefaults.UnreadMessageIcon', None)),
            action('prefsdialog', _('Open the Digsby Preferences window'),
                   _('Preferences...')),
        ]

        if SHOW_STATUS_ITEMS:
            TASKS.append(None)  # separator
            TASKS.extend(jumplist_status_items(profile.status))

        # Exit Digsby
        TASKS.append(None)
        TASKS.append(
            action('exit', _('Close all windows and exit'), _('Exit Digsby'),
                   skin.get('AppDefaults.JumpListCloseIcon', None)))

        jumplist = [
            (u'', TASKS),
        ]

        if TOP_BUDDIES_ENABLED:
            logging = logging_enabled()

            if logging and log_sizes is not None:
                buddies = [
                    buddy_item(buddy)
                    for buddy in log_sizes[:MAX_BUDDIES_IN_LOGSIZE_LIST]
                    if not buddy.__class__.__name__ == 'OfflineBuddy'
                ]
            else:
                buddies = [
                    action(
                        funccall('prefsdialog', tabname='text_conversations'),
                        _('Opens the Preferences Window where you can enable logging'
                          ), _('Enable Chat Logs'))
                ]

            jumplist.append((u'Top Buddies (by log size)', buddies))

        success = cgui.SetUpJumpList(APP_ID, jumplist)

        # clear jumplist on shutdown
        register_shutdown_hook()
示例#24
0
    def UpdateSkin(self):
        ICON_SKINPATH = 'AppDefaults.notificationicons'
        ni = self.NotificationInfo
        appdefaults = skin.get(ICON_SKINPATH)

        all_icons = {}
        for key in appdefaults.keys():
            all_icons[key] = skin.get(ICON_SKINPATH + '.' + key)

        for k in ni:
            iconpath = ni[k].get('notification_icon', None)
            if iconpath is not None:
                all_icons[k] = iconpath

        self.icons = all_icons
示例#25
0
    def newsfeed_popups(self, filter_old=True):
        log.info('doing newsfeed popups')
        s = self.connection.last_stream
        old_ids = self.old_stream_ids if filter_old else ()
        feed = s['posts']
        new_posts = []
        for post in feed:
            if post['post_id'] in old_ids:
                log.info('post %r is old', post['post_id'])
                break
            source = post.get('source_id')
            actor  = post.get('actor_id')
            viewer = post.get('viewer_id')
            try:
                do_add = source and viewer and int(source) != int(viewer) and int(actor) != int(viewer)
            except ValueError:
                do_add = True
            if do_add:
                new_posts.append(post)
            else:
                log.info('filtered message %s because it came from this account', post['post_id'])

        options = dict(buttons=self.get_popup_buttons)

        if new_posts:
            from gui import skin
            if common.pref('facebook.popups.user_icons', default=True):
                from gui.browser.webkit.imageloader import LazyWebKitImage
                default_icon = skin.get('serviceicons.facebook', None)
                for post in new_posts:
                    try:
                        url = s.profiles[int(post['actor_id'])].pic_square
                    except Exception:
                        traceback.print_exc()
                    else:
                        post.icon = LazyWebKitImage(url, default_icon)

            fire(
                'facebook.newsfeed',
                profiles = s['profiles'],
                posts=new_posts,
                popupid='%d.facebook' % id(self),
                update='paged',
                badge=skin.get('serviceicons.facebook', None),
                scrape_clean=string_helpers.scrape_clean,
                onclick = self.on_popup_click_post, **options
            )
        self.old_stream_ids = set(self.connection.last_stream['post_ids'])
示例#26
0
 def icon(self):
     icon = skin.get(self.icon_skinpath, None)
     if icon is not None:
         if len(self) > 0:
             return icon.Resized(32)
         else:
             return icon.Resized(20)
示例#27
0
def get_no_icon(with_transparency = False):
    'Return the icon used for buddies with no icons.'

    global _cached_noicon
    global _registered_noicon_hook

    if not _registered_noicon_hook:
        _registered_noicon_hook = True
        import hooks
        hooks.register('skin.set.pre', _on_skin_change)

    try:
        return _cached_noicon[int(with_transparency)]
    except TypeError:
        pass

    img = _load_noicon()
    imgnoalpha = img.copy()

    try:
        # Transparency is specifed in a skin value like "66%"...
        alpha = skin.get('BuddiesPanel.BuddyIcons.NoIconAlpha', '75%').strip().rstrip('%')
        alpha_opacity = float(alpha) / 100.0
    except:
        alpha_opacity = DEFAULT_NOICON_OPACITY

    pil_setalpha(img, alpha_opacity) # Lighten the alpha channel somewhat


    _cached_noicon = (imgnoalpha, img)

    return _cached_noicon[int(with_transparency)]
示例#28
0
    def UpdateSkin(self):
        """
            Updates all the local skin references
        """
        key = self.skinkey

        s = lambda k, default = sentinel: skin.get(key + '.' + k, default)

        mode = try_this(lambda: str(s('mode', '')), '')
        if config.platformName != "mac" and key and mode.lower() != 'native':
            self.native=False

            self.repeat   = try_this(lambda: str(s('style',  '')).lower(), '') == 'repeat'
            self.padding  = s('padding', 0)
            self.Font     = s('font', lambda: default_font())

            self.bg       = s('backgrounds.normal', None)
            self.fg       = s('backgrounds.fill',   lambda: SkinColor(wx.BLUE))

            self.normalfc = s('fontcolors.normal', wx.BLACK)
            self.fillfc   = s('fontcolors.fill',   wx.WHITE)

        else:
            self.native   = True

        self.OnSize()
示例#29
0
    def UpdateSkin(self):
        """
            Updates all the local skin references
        """
        key = self.skinkey

        s = lambda k, default=sentinel: skin.get(key + '.' + k, default)

        mode = try_this(lambda: str(s('mode', '')), '')
        if config.platformName != "mac" and key and mode.lower() != 'native':
            self.native = False

            self.repeat = try_this(lambda: str(s('style', '')).lower(),
                                   '') == 'repeat'
            self.padding = s('padding', 0)
            self.Font = s('font', lambda: default_font())

            self.bg = s('backgrounds.normal', None)
            self.fg = s('backgrounds.fill', lambda: SkinColor(wx.BLUE))

            self.normalfc = s('fontcolors.normal', wx.BLACK)
            self.fillfc = s('fontcolors.fill', wx.WHITE)

        else:
            self.native = True

        self.OnSize()
示例#30
0
 def icon(self):
     icon = skin.get(self.icon_skinpath, None)
     if icon is not None:
         if len(self) > 0:
             return icon.Resized(32)
         else:
             return icon.Resized(20)
示例#31
0
    def __init__(self, parent, callback=None):
        sc.SizedDialog.__init__(self,
                                parent,
                                -1,
                                _('Submit Bug Report - Digsby'),
                                size=(590, 600),
                                style=wx.DEFAULT_DIALOG_STYLE
                                | wx.RESIZE_BORDER)
        self.SetFrameIcon(skin.get('appdefaults.taskbaricon'))

        self.panel = BugReportPanel(self.GetContentsPane(), callback)
        self.panel.SetSizerProps(expand=True, proportion=1)
        self.callback = callback

        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))

        # rename OK Button
        button = self.FindWindowById(wx.ID_OK, self)
        if button:
            button.SetLabel(_("Submit"))

        if callback is not None:
            self.Bind(wx.EVT_BUTTON, self.OnButton)

        self.Fit()
        self.MinSize = self.Size
示例#32
0
    def UpdateSkin(self):
        Renderer.UpdateSkin(self)

        self.drawseqs = {}
        self._lastcalc = []

        s, g = self.skin, skin.get

        self.statusicons = g('statusicons')

        s.margins          = g('BuddiesPanel.BuddyMargins')
        s.icon_frame      = g('BuddiesPanel.BuddyIcons.Frame', None)
        s.icon_frame_size = Margins(g('BuddiesPanel.BuddyIcons.FrameSize', (0, 0, 0, 0)))

        s.round_corners = try_this(lambda: int(g('BuddiesPanel.BuddyIcons.Rounded', 1)), 1)

        f, g = s.fontcolors, lambda k, default: skin.get('BuddiesPanel.FontColors.' + k, default)
        f.buddy            = g('Buddy',         lambda: syscol(wx.SYS_COLOUR_WINDOWTEXT))
        f.buddyoffline     = g('BuddyOffline',  lambda: syscol(wx.SYS_COLOUR_GRAYTEXT))
        f.buddyselected    = g('BuddySelected', lambda: syscol(wx.SYS_COLOUR_HIGHLIGHTTEXT))
        f.buddyhover       = g('BuddyHover',    lambda: f.buddy)

        f.status           = g('Status',         lambda: f.buddy)
        f.statushover      = g('StatusHover',    lambda: f.buddyhover)
        f.statusselected   = g('StatusSelected', lambda: f.buddyselected)

        f.idletime         = g('IdleTime',         lambda: syscol(wx.SYS_COLOUR_GRAYTEXT))
        f.idletimehover    = g('IdleTimeHover',    lambda: syscol(wx.SYS_COLOUR_GRAYTEXT))
        f.idletimeselected = g('IdleTimeSelected', lambda: syscol(wx.SYS_COLOUR_HIGHLIGHTTEXT))

        # icons to be drawn
        self.calcsizes()
示例#33
0
    def __init__(self, name, status = None, protocol = 'aim', capabilities=None):
        Observable.__init__(self)
        self.remote_alias = self.name = name

        self.mockprofile       = getattr(MockProfiles,name,'')
        self.buddy             = Storage()
        self.buddy.name        = name
        self.buddy.nice_name   = name
        self.buddy.profile     = self.mockprofile
        self.icon              = skin.get('BuddiesPanel.BuddyIcons.NoIcon')
        self.icon_path         = self.icon.path
        self.icon = self.icon.PIL
        self.id                = 5
        self.status_message    = random.choice(status_messages)
        self.sightly_status    = self.status_orb = self.status = status if status else random.choice(statuses)
        self.buddy.away        = self.status=='away'

        self.protocol          = MockProtocol(protocol)
        self.protocol.icq      = random.choice([True, False])
        self.protocol.username = self.protocol.name

        self.mockcaps          = capabilities if capabilities else [caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM, caps.PICTURES, caps.SMS]
        self.online_time       = None
        self.buddy.protocol    = self.protocol
        self.caps              = self.mockcaps
示例#34
0
def get_buddy_icon_path(buddy):
    icon = _geticon(buddy)

    if icon is None:
        return skin.get('BuddiesPanel.BuddyIcons.NoIcon').path
    else:
        return buddy.icon_path
示例#35
0
    def UpdateSkin(self):
        from gui import skin

        skinkey = self.skinkey

        native = self.native = not skinkey

        if not native:
            self.bg = skin.get(skinkey+".background")
            self.itemskin = skin.get(skinkey+".itemskin")

            for child in self.Children:
                if isinstance(child,UberButton):
                    child.SetSkinKey(self.itemskin)

        self.Refresh(False)
示例#36
0
        def image(self):
            if hasattr(self.xfer, 'icon'):
                return self.xfer.icon.Resized(self.Parent.filetype_icon_size)

            # use wxIcon.ForFileType to look up the system icon for a filetype
            fname = self.xfer.filepath if self.xfer.filepath is not None else self.xfer.name

            icon = None
            try:
                ext = path(fname).ext
                icons = self.Parent.filetype_icons

                if ext not in icons:
                    icons[ext] = None # only check for the filetype icon once
                    with traceguard:
                        icon = wx.Icon.ForFileType(ext)
                        if icon is not None and icon.IsOk():
                            icons[ext] = icon.WXB

                icon = icons.get(ext)
            except Exception:
                print_exc()

            if not icon:
                icon = skin.get(FILEXFER_ICON).Resized(self.Parent.filetype_icon_size)

            return icon
示例#37
0
    def __init__(self, parent, panel, size = wx.DefaultSize):
#        wx.Panel.__init__(self, parent, size=size)
        SimplePanel.__init__(self, parent)
        self.Show(False)

        do(self.Bind(event, method) for (event,method) in (
            (wx.EVT_CLOSE, self.OnClose),
        ))

        panel.Reparent(self)
        self.Sizer=wx.BoxSizer(wx.VERTICAL)
        self.Sizer.Add(panel, 1, wx.EXPAND)
        #panel.Show(True)

        self.panel=panel

        self.name  = getattr(panel, 'name', getattr(panel, 'Title', u''))

        from gui import skin
        self.icon  = skin.get('BuddiesPanel.BuddyIcons.NoIcon').WXB

        self.nicon = None
        self.notified = False

        self.tab = None

        panel.update_icon()
        panel.update_title()
示例#38
0
def MakeAccountItems():
    logdir = logger.get_default_logging_dir()

    protodirs = logdir.dirs()

    accts = {}
    for protodir in protodirs:
        accts[protodir.name] = [dir.name for dir in protodir.dirs()]

    items = []
    for proto in sorted(accts):
        try:
            protoicon = skin.get('serviceicons.'+proto,None).ResizedSmaller(16)
        except Exception:
            continue

        for acct in accts[proto]:
            items.append(SimpleMenuItem([protoicon,acct], id = {'logdir':logdir,
                                                                'proto':proto,
                                                                'acct': acct}))

    # group chat at bottom
    icon = _group_chat_icon().Resized(16)
    items.append(SimpleMenuItem([icon, _('Group Chats')], id = {
        'proto': 'group',
    }))

    return items
示例#39
0
    def __init__(self, parent):
        wx.PopupTransientWindow.__init__(self, parent)

        events = [(wx.EVT_PAINT, self.OnPaint)]
        [self.Bind(event, method) for (event, method) in events]

        self.skin = skin.get('colorpicker')

        colors = [(0, 0, 0), (0, 0, 128), (0, 0, 255), (0, 128, 0),
                  (0, 128, 128), (0, 255, 0), (0, 255, 255), (128, 0, 0),
                  (128, 0, 128), (128, 128, 0), (128, 128, 128), (255, 0, 0),
                  (255, 0, 255), (255, 255, 0), (255, 255, 255),
                  (192, 192, 192)]

        padding = 5
        size = 28
        cx = padding
        cy = padding

        self.swashes = []
        count = 0
        for color in colors:
            self.swashes.append(ColorBlock(self, color, (cx, cy),
                                           (size, size)))
            cx += size + padding
            count += 1
            if count == 4:
                cx = padding
                cy += size + padding
                count = 0

        self.SetSize((cy, cy))
示例#40
0
    def __init__(self, parent = None, sp = None, sp_info = None):
        self.new = sp is None

        if sp_info is None:
            if sp is None:
                raise Exception()

            sp_info = SP.get_meta_service_provider(sp.provider_id)

        self.sp = sp
        self.sp_info = sp_info

        self.component_names = list(x.component_type for x in SP.get_meta_components_for_provider(self.sp_info.provider_id)) + ['provider']
        self.component_names.sort(key = lambda x: ("provider", "im", "email", "social").index(x))

        title = self.hook("digsby.services.edit.title", self.sp, self.sp_info)

        wx.Dialog.__init__(self, parent, title = title)

        self.SetFrameIcon(skin.get("serviceprovidericons.%s" % self.sp_info.provider_id))

        self.construct()
        self.layout()
        self.bind_events()
        self.DoValidate()

        self.Fit()
示例#41
0
    def __init__(self, parent, name, content_panel=None, use_skin=True, **kws):
        if parent is not None and not isinstance(parent, wx.Window):
            raise TypeError(
                "first argument to Skindow __init__ is a wxWindow parent")

        wx.Frame.__init__(self,
                          parent,
                          style=self.framestyles[use_skin],
                          **kws)

        self.margins = skin.get('%s.content' % name)
        self.content_pane = wx.Panel(self)
        self.sizer = wx.BoxSizer()
        self.content_pane.SetSizer(self.sizer)

        if not isinstance(name, (str, unicode)):
            raise TypeError('second argument name must be a string')
        self.name = name

        self.skin_events = [
            (wx.EVT_SIZE, self.on_size),
            (wx.EVT_PAINT, self.on_paint),
            (wx.EVT_LEFT_UP, self.OnLeftUp),
            (wx.EVT_LEFT_DOWN, self.on_left_down),
            (wx.EVT_MOTION, self.on_motion),
            (wx.EVT_ERASE_BACKGROUND, lambda e: None),  # reduce flickering
        ]

        self.Bind(wx.EVT_CLOSE, lambda e: self.Destroy())

        self.set_skinned(use_skin)
示例#42
0
    def __init__(self, parent, name, content_panel = None, use_skin = True, **kws ):
        if parent is not None and not isinstance(parent, wx.Window):
            raise TypeError("first argument to Skindow __init__ is a wxWindow parent")

        wx.Frame.__init__( self, parent, style = self.framestyles[use_skin], **kws )

        self.margins = skin.get('%s.content' % name)
        self.content_pane = wx.Panel(self)
        self.sizer = wx.BoxSizer()
        self.content_pane.SetSizer(self.sizer)

        if not isinstance(name, (str, unicode)):
            raise TypeError('second argument name must be a string')
        self.name = name

        self.skin_events = [
            ( wx.EVT_SIZE, self.on_size ),
            ( wx.EVT_PAINT, self.on_paint ),
            ( wx.EVT_LEFT_UP, self.OnLeftUp ),
            ( wx.EVT_LEFT_DOWN, self.on_left_down ),
            ( wx.EVT_MOTION, self.on_motion ),
            ( wx.EVT_ERASE_BACKGROUND, lambda e: None ), # reduce flickering
        ]

        self.Bind(wx.EVT_CLOSE, lambda e: self.Destroy())

        self.set_skinned(use_skin)
示例#43
0
    def Draw(self, dc, rect, selected, obj, depth, expanded, index, hover):
        s = self.skin
        icon = skin.get('appdefaults.search.icons.' + obj.searchengine.name, None)

        rect = rect.AddMargins(wx.Rect(*s.margins))

        if icon is not None:
            dc.DrawBitmap(icon, rect.x, rect.VCenter(icon), True)
            rect = rect.Subtract(left = icon.Width + self.icon_horizontal_padding)

        dc.SetFont(self.mainfont)

        if selected: fg = s.fontcolors.buddyselected
        elif hover:  fg = s.fontcolors.buddyhover
        else:        fg = s.fontcolors.buddy
        dc.TextForeground = fg

        # draw search engine name
        text = obj.searchengine.gui_name + ': '
        w, h, desc, __ = dc.GetFullTextExtent(text)
        dc.DrawLabel(text, rect, ALIGN_LEFT | ALIGN_CENTER_VERTICAL)
        rect = rect.Subtract(left = w)

        # draw search string
        dc.TextForeground = s.fontcolors.details
        text = obj.searchstring
        dc.DrawTruncatedText(text, rect, ALIGN_LEFT | ALIGN_CENTER_VERTICAL)
示例#44
0
    def __init__(self, parent=None, sp=None, sp_info=None):
        self.new = sp is None

        if sp_info is None:
            if sp is None:
                raise Exception()

            sp_info = SP.get_meta_service_provider(sp.provider_id)

        self.sp = sp
        self.sp_info = sp_info

        self.component_names = list(
            x.component_type for x in SP.get_meta_components_for_provider(
                self.sp_info.provider_id)) + ['provider']
        self.component_names.sort(
            key=lambda x: ("provider", "im", "email", "social").index(x))

        title = self.hook("digsby.services.edit.title", self.sp, self.sp_info)

        wx.Dialog.__init__(self, parent, title=title)

        self.SetFrameIcon(
            skin.get("serviceprovidericons.%s" % self.sp_info.provider_id))

        self.construct()
        self.layout()
        self.bind_events()
        self.DoValidate()

        self.Fit()
示例#45
0
    def set_hidden_messages(self, n):
        '''
        n can be

         -1: show bubble with no count, and no flashing
          0: show just the digsby head
         >0: flash between digsby head and bubble with count, which is n
        '''

        status = profile.status
        digsby_head = self.status_tray_icon(status)

        if pref(UNREADPREF + 'flash_only_count', False):
            from gui import skin
            message_icon = skin.get('AppDefaults.TaskbarIcon')
        else:
            message_icon = None

        if n == -1:
            icons = [generate_hidden_message_icon(None)]
        elif n == 0:
            icons = [digsby_head]
        else:
            count = n if pref(UNREADPREF + 'show_count', True) else None
            unread_icon = generate_hidden_message_icon(count, message_icon)
            icons = [digsby_head, unread_icon]

        intervalms = pref(UNREADPREF + 'flash_interval_ms', default=1000)

        self.icons = [to_icon(i) for i in icons]
        self.delays = [intervalms] * len(self.icons)
        self.UpdateAnimation(status_tooltip(status))
示例#46
0
    def __init__(self,parent):
        wx.PopupTransientWindow.__init__(self,parent)

        events=[
            (wx.EVT_PAINT,self.OnPaint)
        ]
        [self.Bind(event,method) for (event,method) in events]

        self.skin = skin.get('colorpicker')

        colors=[
            (0,0,0),(0,0,128),(0,0,255),(0,128,0),
            (0,128,128),(0,255,0),(0,255,255),(128,0,0),
            (128,0,128),(128,128,0),(128,128,128),(255,0,0),
            (255,0,255),(255,255,0),(255,255,255),(192,192,192)
        ]

        padding=5
        size=28
        cx=padding
        cy=padding

        self.swashes=[]
        count=0
        for color in colors:
            self.swashes.append(ColorBlock(self,color,(cx,cy),(size,size)))
            cx+=size+padding
            count+=1
            if count==4:
                cx=padding
                cy+=size+padding
                count=0

        self.SetSize((cy,cy))
示例#47
0
    def UpdateSkin(self):
        s = lambda name, d = None: skin.get('%sFormattingBar.%s' % ('AppDefaults.' if self.UseAppDefaultSkin else '',name),d)

        iconsize = self.iconsize = s('iconsize')

        icons = s('icons').get

        bicon   = self.bicon   =             icons('bold').Resized(iconsize)
        iicon   = self.iicon   =           icons('italic').Resized(iconsize)
        uicon   = self.uicon   =        icons('underline').Resized(iconsize)
        fcicon  = self.fcicon  =  icons('foregroundcolor').Resized(iconsize)
        bcicon  = self.bcicon  =  icons('backgroundcolor').Resized(iconsize)
        eicon   = self.eicon   =            icons('emote').Resized(iconsize)

        fontddwidth = self.fontddwidth = s('FontDropDownWidth')
        sizeddwidth = self.sizeddwidth = s('SizeDropDownWidth')
        menuskin    = self.menuskin    = s('MenuSkin', None)
        toolbarskin = self.toolbarskin = s('toolbarskin', None)

        if self.initover and getattr(self, 'formatbar', None) is not None:
            self.formatbar.SetSkinKey(toolbarskin)
            # new font drop down does not have SetMinWidth
            # self.fontdd.SetMinWidth(fontddwidth)
            self.bsize.SetStaticWidth(sizeddwidth)
            self.msize.SetWidth(sizeddwidth)
            self.bbold.SetIcon(bicon)
            self.bitalic.SetIcon(iicon)
            self.bunderline.SetIcon(uicon)
            self.bcolor.SetIcon(fcicon)
            self.bbgcolor.SetIcon(bcicon)
            self.bemote.SetIcon(eicon)

        wx.CallAfter(self.Layout)
示例#48
0
    def set_hidden_messages(self, n):
        '''
        n can be

         -1: show bubble with no count, and no flashing
          0: show just the digsby head
         >0: flash between digsby head and bubble with count, which is n
        '''

        status = profile.status
        digsby_head = self.status_tray_icon(status)

        if pref(UNREADPREF + 'flash_only_count', False):
            from gui import skin
            message_icon = skin.get('AppDefaults.TaskbarIcon')
        else:
            message_icon = None

        if n == -1:
            icons = [generate_hidden_message_icon(None)]
        elif n == 0:
            icons = [digsby_head]
        else:
            count = n if pref(UNREADPREF + 'show_count', True) else None
            unread_icon = generate_hidden_message_icon(count, message_icon)
            icons = [digsby_head, unread_icon]

        intervalms = pref(UNREADPREF + 'flash_interval_ms', default=1000)

        self.icons = [to_icon(i) for i in icons]
        self.delays = [intervalms] * len(self.icons)
        self.UpdateAnimation(status_tooltip(status))