Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/infopanel.py
blob: 9e7e16d2b444e8a68fbea980fae87490ef67cdc0 (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
import hippo
import pango
from sugar.graphics import style

class InfoPanel(hippo.CanvasBox):
    def __init__(self):
        hippo.CanvasBox.__init__(self, spacing=4, padding=5,
                orientation=hippo.ORIENTATION_VERTICAL)
        self.status_box = hippo.CanvasBox(spacing=4, padding=5,
                orientation=hippo.ORIENTATION_VERTICAL)
        self.append(self.status_box)
        self.score_box = hippo.CanvasBox(spacing=4, padding=5,
                orientation=hippo.ORIENTATION_VERTICAL)
        self.append(self.score_box)

    def show(self, text):
        textwidget = hippo.CanvasText(text=text,
            font_desc=pango.FontDescription('Sans 10'),
            color=style.COLOR_WHITE.get_int(),
            xalign=hippo.ALIGNMENT_CENTER)
        self.status_box.remove_all()
        self.status_box.append(textwidget)
        
    def show_score(self,  text):
        textwidget = hippo.CanvasText(text=text,
            font_desc=pango.FontDescription('Sans 10'),
            color=style.COLOR_WHITE.get_int(),
            xalign=hippo.ALIGNMENT_CENTER)
        self.score_box.remove_all()
        self.score_box.append(textwidget)