Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/services/console/label.py
blob: 3418eea2147573061aac30c186562145259bb4d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright (C) 2007, Eduardo Silva (edsiper@gmail.com).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import gtk
import pango

class Label(gtk.Label):
    TITLE = 0
    DESCRIPTION = 1
    
    def __init__(self, text, font_type):
        gtk.Label.__init__(self)
        
        self.set_text(text)
        self.set_alignment(0.0, 0.5)

        s = {
            self.TITLE: self._set_title_font,
            self.DESCRIPTION: self._set_description_font
        }[font_type]()
        
    def _set_title_font(self):
        font = pango.FontDescription('Sans 12')
        font.set_weight(pango.WEIGHT_NORMAL)
        self.modify_font(font)

    def _set_description_font(self):
        font = pango.FontDescription('Sans 8')
        font.set_weight(pango.WEIGHT_NORMAL)
        self.modify_font(font)

class Style:
    
    def set_title_font(self, object):
        font = pango.FontDescription('Sans 20')
        font.set_weight(pango.WEIGHT_NORMAL)
        object.modify_font(font)