Example #1
0
def StyleFromPref(prefname):

    try:
        stylepref = pref(prefname)

        if isinstance(stylepref, basestring):
            style = dict(Font=makeFont(stylepref))
        else:
            style = dict(stylepref)
    except Exception:
        print_exc()
        style = {}

    if type(style['Font']) is tuple:
        try:
            font = TupleToFont(style['Font'])
        except Exception:
            print_exc()
            font = try_this(lambda: makeFont('Arial 10'), default_font())
    else:
        font = style['Font']
    fgc = try_this(lambda: wx.Colour(*style['TextColour']),
                   None) or wx.BLACK  #@UndefinedVariable
    bgc = try_this(lambda: wx.Colour(*style['BackgroundColour']),
                   None) or wx.WHITE  #@UndefinedVariable

    return wx.TextAttr(fgc, bgc, font)
Example #2
0
def StyleFromPref(prefname):

    try:
        stylepref = pref(prefname)

        if isinstance(stylepref, basestring):
            style = dict(Font = makeFont(stylepref))
        else:
            style = dict(stylepref)
    except Exception:
        print_exc()
        style = {}

    if type(style['Font']) is tuple:
        try:
            font = TupleToFont(style['Font'])
        except Exception:
            print_exc()
            font = try_this(lambda: makeFont('Arial 10'), default_font())
    else:
        font = style['Font']
    fgc  = try_this(lambda: wx.Colour(*style['TextColour']), None) or wx.BLACK #@UndefinedVariable
    bgc  = try_this(lambda: wx.Colour(*style['BackgroundColour']), None) or wx.WHITE #@UndefinedVariable

    return wx.TextAttr(fgc, bgc, font)
Example #3
0
 def HeaderFont(self):
     try:
         return self._headerfont
     except AttributeError:
         if not wxMac:
             PrefPanel._headerfont = makeFont('arial 8 bold')
         else:
             PrefPanel._headerfont = makeFont('9 bold')
         return self._headerfont
Example #4
0
 def HeaderFont(self):
     try:
         return self._headerfont
     except AttributeError:
         if not wxMac:
             PrefPanel._headerfont = makeFont('arial 8 bold')
         else:
             PrefPanel._headerfont = makeFont('9 bold')
         return self._headerfont
Example #5
0
def load_pref_style(prefname):

    try:
        stylepref = pref(prefname)

        if isinstance(stylepref, basestring):
            style = Storage(Font = makeFont(stylepref))
        else:
            style = Storage(stylepref)
    except Exception:
        print_exc()
        style = {}

    if type(style.Font) is tuple:
        try:
            font = tuple_to_font(style.Font)
        except Exception:
            print_exc()
            font = default_msg_font()
    else:
        font = style.Font
    fgc  = try_this(lambda: wx.Colour(*style.TextColour), None) or wx.BLACK
    bgc  = try_this(lambda: wx.Colour(*style.BackgroundColour), None) or wx.WHITE

    return font, fgc, bgc
Example #6
0
def test_skinparsing():
    cols = 'AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL, CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY, FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW, INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN, MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN, MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE, MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE, NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED, SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW, YELLOW GREEN'
    cols = filter(lambda s: s.find(' ') == -1, cols.split(', '))

    import random
    random.shuffle(cols)

    f = wx.Frame(None,
                 style=wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE)

    font = makeFont("comic sans ms 35 bold italic underlined")
    popupshadow = 'popup.png 14 14 -18 -18'
    #bb = ['white border black', popupshadow, 'actions/bulb.png', 'actions/email.png']
    #bb = popupshadow
    bb = 'white border black'
    brush = makeBrush(bb)  #'vertical red black 40% border dashed 5px')
    g = [
        makeBrush('%s %s' % tuple(cols[c:c + 2]))
        for c in xrange(0,
                        len(cols) - 2, 2)
    ]

    #g = [makeBrush(c) for c in cols]

    def paint(e):
        dc = wx.AutoBufferedPaintDC(f)
        dc.Pen = wx.TRANSPARENT_PEN
        dc.Brush = wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE))

        dc.DrawRectangleRect(f.ClientRect)
        dc.Font = font
        dc.SetTextForeground(wx.WHITE)

        r = f.ClientRect
        r.Deflate(17, 17)
        brush.Draw(dc, r)

        dc.DrawText('Digskin', 0, 0)

    f.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
    f.Bind(wx.EVT_PAINT, paint)

    f.Sizer = wx.BoxSizer(wx.HORIZONTAL)
    f.Sizer.AddStretchSpacer(1)
    return f
Example #7
0
def test_skinparsing():
    cols = 'AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL, CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY, FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW, INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN, MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN, MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE, MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE, NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED, SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW, YELLOW GREEN'
    cols = filter(lambda s: s.find(' ') == -1, cols.split(', '))

    import random
    random.shuffle(cols)

    f = wx.Frame(None, style = wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE)

    font  = makeFont("comic sans ms 35 bold italic underlined")
    popupshadow = 'popup.png 14 14 -18 -18'
    #bb = ['white border black', popupshadow, 'actions/bulb.png', 'actions/email.png']
    #bb = popupshadow
    bb = 'white border black'
    brush = makeBrush(bb)#'vertical red black 40% border dashed 5px')
    g     = [makeBrush('%s %s' % tuple(cols[c:c+2])) for c in xrange(0, len(cols)-2, 2)]
    #g = [makeBrush(c) for c in cols]

    def paint(e):
        dc = wx.AutoBufferedPaintDC(f)
        dc.Pen = wx.TRANSPARENT_PEN
        dc.Brush = wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE))

        dc.DrawRectangleRect(f.ClientRect)
        dc.Font = font
        dc.SetTextForeground(wx.WHITE)

        r = f.ClientRect
        r.Deflate(17, 17)
        brush.Draw(dc, r)

        dc.DrawText('Digskin', 0, 0)

    f.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
    f.Bind(wx.EVT_PAINT, paint)


    f.Sizer = wx.BoxSizer(wx.HORIZONTAL)
    f.Sizer.AddStretchSpacer(1)
    return f
Example #8
0
def r_font(v):
    return makeFont(v)
Example #9
0
def default_msg_font():
    return try_this(lambda: makeFont('Arial 10'), default_font())
Example #10
0
def r_font(v):
    return makeFont(v)