示例#1
0
    def UpdateSkin(self):
        mode = self.SplitMode

        if mode == wx.SPLIT_HORIZONTAL:
            splitskin = skinget('HorizontalSizerBar', None)
        else:
            splitskin = skinget('VerticalSizerBar', None)
            if splitskin is None:
                splitskin = skinget('HorizontalSizerBar', None)

        if splitskin is None or (isinstance(splitskin, basestring) and splitskin.lower().strip() == 'native') or not hasattr(splitskin, 'get'):
            self.SetSashSize(-1)
            self.SetNative(True)
            return

        try:    sash_size = int(splitskin.thickness)
        except: sash_size = -1

        syscol = GetColour(SYS_COLOUR_WINDOW)

        bgs = splitskin.get('backgrounds', {})

        normal = bgs.get('normal', syscol)
        active = bgs.get('active', syscol)
        hover  = bgs.get('hover',  syscol)

        if not isinstance(normal, Colour): normal = syscol
        if not isinstance(active, Colour): active = syscol
        if not isinstance(hover,  Colour): hover  = syscol

        self.SetSashSize(sash_size)
        self.SetSplitterColors(normal, active, hover)
        self.SetNative(False)
示例#2
0
    def UpdateSkin(self):
        UControl.UpdateSkin(self)

        if skinget('Button.Native', False):
            self.Native = True
        else:
            self.bgs = skinget('Button.Backgrounds')
            self.ChooseBG()

        font = skinget('Button.Font', None)
        if isinstance(font, wx.Font): self.Font = font
示例#3
0
    def __init__(self, parent = None):
        wx.Frame.__init__(self, parent, -1, _('Digsby Announcement'), size = (400, 330))
        self.SetFrameIcon(skinget('AppDefaults.TaskbarIcon'))

        self.message_area = MessageArea(self, header_enabled = False, prevent_align_to_bottom=True)
        self.inited = False
        self.CenterOnScreen()
示例#4
0
    def setup_from_accts(self):
        # add an "Add" menu containing each email account type
        self.addList = addList = SimpleMenu(self.fromcombo.menu, 'simplemenu')
        for emailtype in emailprotocols.keys():
            addList.Append([
                skinget('serviceicons.%s' % emailtype).Resized(16),
                protocols[emailtype].name
            ],
                           method=lambda item, emailtype=emailtype:
                           add_email_account(emailtype))

        # link to creating an email account
        from gui.pref import prefsdialog
        self.accounts_item = SimpleMenuItem(
            _('Accounts...'), method=lambda *a: prefsdialog.show('accounts'))

        # watch the email list for changes
        pass

        self._obs_link = profile.emailaccounts.add_list_observer(
            self.on_email_accounts_changed, self.on_email_accounts_changed,
            'enabled')

        self.tocombo.Bind(EVT_WINDOW_DESTROY, lambda e:
                          (e.Skip(), self.unregister_observers()))
示例#5
0
def main2():
    a = testapp('../../..')
    f = wx.Frame(None)

    from gui.skin import get as skinget
    icons = skinget('serviceicons')

    services = 'digsby aim icq jabber gtalk yahoo'.split()

    f.imgsize = 0

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

        drawbitmap = dc.DrawBitmap

        sizes = [(32, 32), (16, 16), (100, 100)]

        diff = f.imgsize

        y = 0
        for size in sizes:
            x = 0
            for srv in services:
                icon = icons[srv].Resized((size[0] + diff, size[1] + diff))
                drawbitmap(icon, x, y, True)
                x += size[0] + diff
            y += size[1] + diff

    f.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
    f.Bind(wx.EVT_PAINT, paint)

    sl = wx.Slider(f, minValue = -10, maxValue = 50, value = 0)

    def onslide(e):
        f.imgsize = sl.Value
        f.Refresh()
        f.SetTitle(str(sl.Value))


    sl.Bind(wx.EVT_SLIDER, onslide)

    f.Sizer = s = wx.BoxSizer(wx.VERTICAL)
    s.AddStretchSpacer(1)
    s.Add(sl, 0, wx.EXPAND)

    f.Show()
    a.MainLoop()
示例#6
0
    def UpdateSkin(self):
        mode = self.SplitMode

        if mode == wx.SPLIT_HORIZONTAL:
            splitskin = skinget('HorizontalSizerBar', None)
        else:
            splitskin = skinget('VerticalSizerBar', None)
            if splitskin is None:
                splitskin = skinget('HorizontalSizerBar', None)

        if splitskin is None or (isinstance(splitskin, basestring)
                                 and splitskin.lower().strip()
                                 == 'native') or not hasattr(splitskin, 'get'):
            self.SetSashSize(-1)
            self.SetNative(True)
            return

        try:
            sash_size = int(splitskin.thickness)
        except:
            sash_size = -1

        syscol = GetColour(SYS_COLOUR_WINDOW)

        bgs = splitskin.get('backgrounds', {})

        normal = bgs.get('normal', syscol)
        active = bgs.get('active', syscol)
        hover = bgs.get('hover', syscol)

        if not isinstance(normal, Colour): normal = syscol
        if not isinstance(active, Colour): active = syscol
        if not isinstance(hover, Colour): hover = syscol

        self.SetSashSize(sash_size)
        self.SetSplitterColors(normal, active, hover)
        self.SetNative(False)
示例#7
0
    def setup_from_accts(self):
        # add an "Add" menu containing each email account type
        self.addList = addList = SimpleMenu(self.fromcombo.menu, 'simplemenu')
        for emailtype in emailprotocols.keys():
            addList.Append([skinget('serviceicons.%s' % emailtype).Resized(16),
                            protocols[emailtype].name],
                            method = lambda item, emailtype=emailtype: add_email_account(emailtype))

        # link to creating an email account
        from gui.pref import prefsdialog
        self.accounts_item = SimpleMenuItem(_('Accounts...'), method = lambda *a: prefsdialog.show('accounts'))

        # watch the email list for changes
        pass

        self._obs_link = profile.emailaccounts.add_list_observer(self.on_email_accounts_changed, self.on_email_accounts_changed, 'enabled')

        self.tocombo.Bind(EVT_WINDOW_DESTROY, lambda e: (e.Skip(), self.unregister_observers()))
示例#8
0
def main():
    a = testapp('../../..')
    f = wx.Frame(None, style = wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE)

    from gui.skin import get as skinget
    icons = skinget('serviceicons')

    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)


    f.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
    f.Bind(wx.EVT_PAINT, paint)
    f.Show()

    a.MainLoop()
示例#9
0
 def UpdateSkin(self):
     self.typing_icons = {
         'typing': skinget('statusicons.typing'),
         'typed':  skinget('statusicons.typed'),
     }
     wx.CallAfter(wx.CallAfter, self.Layout)
示例#10
0
        self.From = self.capsbar.cfrom

        for delegate_name, attrs in self.delegation.iteritems():
            delegate = getattr(self, delegate_name)
            for attr in attrs:
                setattr(self, attr, getattr(delegate, attr))



    delegation = {'capsbar': ('GetButton',)}

    ToFromShown = property(lambda self: self.capsbar.ToFromShown)

def budicon(bud):
    from gui.buddylist.renderers import get_buddy_icon
    return get_buddy_icon(bud, round_size = False, meta_lookup=True)


icons = dict(buddy =   budicon,
             status =  lambda bud: skinget('statusicons.' + bud.status_orb),
             service = lambda bud: bud.serviceicon)

# maps "modes" to the GUI panels they use
modectrls = {'info':  'infopanel',
             'im':    'messagepanel',
             'email': 'emailpanel',
             'sms':   'messagepanel'}

MSGSPLIT_FLAGS = wx.SP_NOBORDER | wx.SP_LIVE_UPDATE

示例#11
0
def buddy_menucontent(buddy):
    return [skinget("statusicons.%s"  % buddy.status_orb),
            buddy.serviceicon.Resized(tofromIconSize()), buddy.nice_name]
示例#12
0
        self.fromcombo.SetItems(items)


        if accts:
            try:                i = accts.index(getattr(self, 'acct', None))
            except ValueError:  i = 0

            sel(fitems[i], accts[i])
        else:
            self.fromcombo.ChangeValue('')
            self.OnEmailAccountChanged(None)




tofromIconSize = lambda: int(skinget('capabilities.tofrom.iconsize', 16))


def buddy_menucontent(buddy):
    return [skinget("statusicons.%s"  % buddy.status_orb),
            buddy.serviceicon.Resized(tofromIconSize()), buddy.nice_name]

def buddy_menu_item(buddy):
    'Return a menu item object for a "To" buddy.'

    return SimpleMenuItem(buddy_menucontent(buddy))

def account_menucontent(acct):
    'Returns the menu content for a "from" account.'

    return [acct.serviceicon.Resized(tofromIconSize()),
示例#13
0
def buddy_menucontent(buddy):
    return [
        skinget("statusicons.%s" % buddy.status_orb),
        buddy.serviceicon.Resized(tofromIconSize()), buddy.nice_name
    ]
示例#14
0
        self.fromcombo.SetCallbacks(None, None)
        self.fromcombo.SetItems(items)

        if accts:
            try:
                i = accts.index(getattr(self, 'acct', None))
            except ValueError:
                i = 0

            sel(fitems[i], accts[i])
        else:
            self.fromcombo.ChangeValue('')
            self.OnEmailAccountChanged(None)


tofromIconSize = lambda: int(skinget('capabilities.tofrom.iconsize', 16))


def buddy_menucontent(buddy):
    return [
        skinget("statusicons.%s" % buddy.status_orb),
        buddy.serviceicon.Resized(tofromIconSize()), buddy.nice_name
    ]


def buddy_menu_item(buddy):
    'Return a menu item object for a "To" buddy.'

    return SimpleMenuItem(buddy_menucontent(buddy))

示例#15
0
    def UpdateSkin(self):
        self.skin = skinget(self.skinkey)

        self.Padding = wx.Size(*skinget(self.skinkey + '.Padding', (0, 0)))
        self.SetMargins(skinget(self.skinkey + '.Margins', lambda: Margins((0, 0, 0, 0))))