Exemplo n.º 1
0
    def revar(name=None, first=False):
        from common import pref
        if name is None:
            name = pref(PFX + 'theme')

        themes = get_themes()
        found = None
        for theme in themes:
            if theme.theme_name == name:
                found = theme

        if found is None:
            found = themes[0] if themes else None

        if found is not None:
            vars = found.variants
            if vars:
                vchoices = [((v, v) if v is not None else
                             (None, found.novariant_name)) for v in vars]
            else:
                vchoices = [(None, found.novariant_name)]
        else:
            vchoices = []
            vars = []

        p.Freeze()
        vsizer.Clear(True)

        if not first:
            mark_pref(PFX + 'variant', found.variant or '')
        choice = Choice(PFX + 'variant', vchoices, '')(p)

        vsizer.Add(choice, 1, EXPAND)
        if not vars:
            #choice.SetSelection(vars.index(found.variant))
            choice.Enable(False)

        if found is not None:
            allow_colors = found.allow_text_colors if found is not None else True
            allow_header = bool(found.header)
        else:
            allow_colors = True
            allow_header = True

        # "Show Message Colors" checkbox is disabled and unchecked if the theme does not
        # support colors.
        colors_checkbox.Enable(allow_colors)
        colors_checkbox.SetValue(allow_colors
                                 and pref(PFX + 'show_message_colors'))

        header_check.Enable(allow_header)
        header_check.SetValue(allow_header and pref(PFX + 'show_header'))

        sz.Layout()
        p.Thaw()
Exemplo n.º 2
0
    def revar(name = None, first = False):
        from common import pref
        if name is None:
            name = pref(PFX + 'theme')

        themes = get_themes()
        found = None
        for theme in themes:
            if theme.theme_name == name:
                found = theme

        if found is None:
            found = themes[0] if themes else None

        if found is not None:
            vars = found.variants
            if vars: vchoices = [((v, v) if v is not None else (None, found.novariant_name)) for v in vars]
            else:    vchoices = [(None, found.novariant_name)]
        else:
            vchoices = []
            vars = []

        p.Freeze()
        vsizer.Clear(True)

        if not first:
            mark_pref(PFX + 'variant', found.variant or '')
        choice = Choice(PFX + 'variant',  vchoices, '')(p)

        vsizer.Add(choice, 1, EXPAND)
        if not vars:
            #choice.SetSelection(vars.index(found.variant))
            choice.Enable(False)

        if found is not None:
            allow_colors = found.allow_text_colors if found is not None else True
            allow_header = bool(found.header)
        else:
            allow_colors = True
            allow_header = True

        # "Show Message Colors" checkbox is disabled and unchecked if the theme does not
        # support colors.
        colors_checkbox.Enable(allow_colors)
        colors_checkbox.SetValue(allow_colors and pref(PFX + 'show_message_colors'))

        header_check.Enable(allow_header)
        header_check.SetValue(allow_header and pref(PFX + 'show_header'))

        sz.Layout()
        p.Thaw()
Exemplo n.º 3
0
def conversation_sizer(p, panel):
    from gui.imwin.styles import get_themes

    themes = get_themes()

    theme_choices    = [(s.theme_name, s.theme_name) for s in themes]
#    icon_choices     = [('none','None')]
#    variant_choices  = [('red_green','Red - Green')]
#    emoticon_choices = [(s.lower(), '%s Emoticons' % s) for s in
#                        'Digsby Yahoo AIM Adium'.split()]

    sz = BoxSizer(wx.HORIZONTAL)
    combosizer = wx.FlexGridSizer(2,2, vgap = 5, hgap = 5)
    vsizer = BoxSizer(VERTICAL)

    checksizer = BoxSizer(wx.VERTICAL)

    PFX = 'appearance.conversations.'

    header_check = Check(PFX + 'show_header', _('Show header'),
                         callback = lambda val: panel.msgarea.show_header(val))(p)


    checksizer.Add(header_check,         0, BOTTOM,5)
    checksizer.Add(Check(PFX + 'show_message_fonts',    _('Show message fonts'))(p),  0, BOTTOM,5)

    colors_checkbox = Check(PFX + 'show_message_colors',   _('Show message colors'))(p)
    checksizer.Add(colors_checkbox, 0, BOTTOM,5)
    def combo(*a, **k):
        choice = Choice(*a, **k)(p)
        combosizer.Add(choice, 1, EXPAND)
        return choice

    combosizer.Add(wx.StaticText(p,-1, _('Theme:')),0,ALIGN_CENTER_VERTICAL)
    combo(PFX + 'theme',     theme_choices,   '', callback = lambda pref, value: wx.CallAfter(revar, value))
    combosizer.Add(wx.StaticText(p,-1, _('Variant:')),0,ALIGN_CENTER_VERTICAL)
    combosizer.AddGrowableCol(1,1)

    def revar(name = None, first = False):
        from common import pref
        if name is None:
            name = pref(PFX + 'theme')

        themes = get_themes()
        found = None
        for theme in themes:
            if theme.theme_name == name:
                found = theme

        if found is None:
            found = themes[0] if themes else None

        if found is not None:
            vars = found.variants
            if vars: vchoices = [((v, v) if v is not None else (None, found.novariant_name)) for v in vars]
            else:    vchoices = [(None, found.novariant_name)]
        else:
            vchoices = []
            vars = []

        p.Freeze()
        vsizer.Clear(True)

        if not first:
            mark_pref(PFX + 'variant', found.variant or '')
        choice = Choice(PFX + 'variant',  vchoices, '')(p)

        vsizer.Add(choice, 1, EXPAND)
        if not vars:
            #choice.SetSelection(vars.index(found.variant))
            choice.Enable(False)

        if found is not None:
            allow_colors = found.allow_text_colors if found is not None else True
            allow_header = bool(found.header)
        else:
            allow_colors = True
            allow_header = True

        # "Show Message Colors" checkbox is disabled and unchecked if the theme does not
        # support colors.
        colors_checkbox.Enable(allow_colors)
        colors_checkbox.SetValue(allow_colors and pref(PFX + 'show_message_colors'))

        header_check.Enable(allow_header)
        header_check.SetValue(allow_header and pref(PFX + 'show_header'))

        sz.Layout()
        p.Thaw()

    revar(first = True)

    sz.Add(combosizer,1,wx.EXPAND)
    sz.Add(checksizer,0,wx.LEFT,10)
    combosizer.Add(vsizer,1,wx.EXPAND)
    return sz
Exemplo n.º 4
0
def conversation_sizer(p, panel):
    from gui.imwin.styles import get_themes

    themes = get_themes()

    theme_choices = [(s.theme_name, s.theme_name) for s in themes]
    #    icon_choices     = [('none','None')]
    #    variant_choices  = [('red_green','Red - Green')]
    #    emoticon_choices = [(s.lower(), '%s Emoticons' % s) for s in
    #                        'Digsby Yahoo AIM Adium'.split()]

    sz = BoxSizer(wx.HORIZONTAL)
    combosizer = wx.FlexGridSizer(2, 2, vgap=5, hgap=5)
    vsizer = BoxSizer(VERTICAL)

    checksizer = BoxSizer(wx.VERTICAL)

    PFX = 'appearance.conversations.'

    header_check = Check(
        PFX + 'show_header',
        _('Show header'),
        callback=lambda val: panel.msgarea.show_header(val))(p)

    checksizer.Add(header_check, 0, BOTTOM, 5)
    checksizer.Add(
        Check(PFX + 'show_message_fonts', _('Show message fonts'))(p), 0,
        BOTTOM, 5)

    colors_checkbox = Check(PFX + 'show_message_colors',
                            _('Show message colors'))(p)
    checksizer.Add(colors_checkbox, 0, BOTTOM, 5)

    def combo(*a, **k):
        choice = Choice(*a, **k)(p)
        combosizer.Add(choice, 1, EXPAND)
        return choice

    combosizer.Add(wx.StaticText(p, -1, _('Theme:')), 0, ALIGN_CENTER_VERTICAL)
    combo(PFX + 'theme',
          theme_choices,
          '',
          callback=lambda pref, value: wx.CallAfter(revar, value))
    combosizer.Add(wx.StaticText(p, -1, _('Variant:')), 0,
                   ALIGN_CENTER_VERTICAL)
    combosizer.AddGrowableCol(1, 1)

    def revar(name=None, first=False):
        from common import pref
        if name is None:
            name = pref(PFX + 'theme')

        themes = get_themes()
        found = None
        for theme in themes:
            if theme.theme_name == name:
                found = theme

        if found is None:
            found = themes[0] if themes else None

        if found is not None:
            vars = found.variants
            if vars:
                vchoices = [((v, v) if v is not None else
                             (None, found.novariant_name)) for v in vars]
            else:
                vchoices = [(None, found.novariant_name)]
        else:
            vchoices = []
            vars = []

        p.Freeze()
        vsizer.Clear(True)

        if not first:
            mark_pref(PFX + 'variant', found.variant or '')
        choice = Choice(PFX + 'variant', vchoices, '')(p)

        vsizer.Add(choice, 1, EXPAND)
        if not vars:
            #choice.SetSelection(vars.index(found.variant))
            choice.Enable(False)

        if found is not None:
            allow_colors = found.allow_text_colors if found is not None else True
            allow_header = bool(found.header)
        else:
            allow_colors = True
            allow_header = True

        # "Show Message Colors" checkbox is disabled and unchecked if the theme does not
        # support colors.
        colors_checkbox.Enable(allow_colors)
        colors_checkbox.SetValue(allow_colors
                                 and pref(PFX + 'show_message_colors'))

        header_check.Enable(allow_header)
        header_check.SetValue(allow_header and pref(PFX + 'show_header'))

        sz.Layout()
        p.Thaw()

    revar(first=True)

    sz.Add(combosizer, 1, wx.EXPAND)
    sz.Add(checksizer, 0, wx.LEFT, 10)
    combosizer.Add(vsizer, 1, wx.EXPAND)
    return sz