3
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
# This is the base Class for all Administration modules.
28
from gettext import gettext as _
31
"""GCompris Administrative Module"""
33
def __init__(self, canvas, module_name, module_label):
34
self.module_name = module_name
35
self.module_label = module_label
38
self.selector_color = 0xC5D2DDFFL
39
self.outline_color = 0XD8B09AFFL
40
self.module_panel_ofset = 3
42
# Return the position it must have in the administration menu
43
# The smaller number is the highest.
44
# By default, return 999 to let the module be low
48
def init(self, index, select_area, callback):
49
print("Gcompris_administration init panel.")
53
x = select_area[0] + (select_area[2] - select_area[0]) / 2
54
y1 = select_area[1] + height * index + 2
55
y2 = select_area[1] + height * (index + 1) + 1
57
# Create our rootitem. We put each canvas item in it so at the end we
58
# only have to kill it. The canvas deletes all the items it contains automaticaly.
60
self.root_select_item = self.canvas.add(
61
gnomecanvas.CanvasGroup,
66
self.select_item = self.root_select_item.add(
67
gnomecanvas.CanvasRect,
73
outline_color="white",
76
self.select_item.connect("event", callback, self)
79
print "config_" + self.module_name + ".png"
80
print gcompris.skin.image_to_skin("config_" +
83
item = self.root_select_item.add(
84
gnomecanvas.CanvasPixbuf,
85
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("config_" +
90
anchor=gtk.ANCHOR_CENTER,
92
item.connect("event", callback, self)
96
item = self.root_select_item.add (
97
gnomecanvas.CanvasText,
98
text=_(self.module_label),
99
font=gcompris.skin.get_font("gcompris/tiny"),
104
item.connect("event", callback, self)
107
def get_module_name(self):
108
return self.module_name
111
self.select_item.set(
112
fill_color_rgba=self.selector_color,
113
outline_color_rgba=self.outline_color
117
self.select_item.set(
119
outline_color="white"