예제 #1
0
파일: Dialog.py 프로젝트: Mankeke/emesene
        def select_color_cb(button, window, callback, response, color_sel):
            '''callback called on button selection'''

            if response == stock.ACCEPT:
                window.hide()
                gtk_color = color_sel.get_current_color()
                color = e3.Color(gtk_color.red, gtk_color.green,
                                 gtk_color.blue)
                callback(color)

            window.hide()
예제 #2
0
파일: Utils.py 프로젝트: socceroh/emesene
def qfont_to_style(qfont, color=None):

    font = unicode(qfont.family())

    font_italic = qfont.italic()
    font_bold = qfont.bold()

    font_underline = qfont.underline()
    font_strike = qfont.strikeOut()

    font_size = qfont.pointSize()
    if font_size < 6 or font_size > 32:
        font_size = 10

    if color is None:
        color = e3.Color(0, 0, 0)

    return e3.Style(font, color, font_bold, font_italic, font_underline,
                    font_strike, font_size)
예제 #3
0
def pango_font_description_to_style(fdesc):
    '''receives a pango.FontDescription and returns a e3.Style'''
    font = fdesc.get_family()

    font_italic = False
    if fdesc.get_style() != pango.STYLE_NORMAL:
        font_italic = True

    font_bold = False
    if fdesc.get_weight() == pango.WEIGHT_BOLD or \
     fdesc.get_weight() == pango.WEIGHT_ULTRABOLD or \
     fdesc.get_weight() == pango.WEIGHT_HEAVY:
        font_bold = True

    font_underline = False
    font_strike = False

    font_size = fdesc.get_size() / pango.SCALE
    if font_size < 6 or font_size > 32:
        font_size = 10

    return e3.Style(font, e3.Color(0, 0, 0), font_bold,
        font_italic, font_underline, font_strike, font_size)