1
# gcompris - module_profiles.py
3
# Copyright (C) 2005, 2008 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 3 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, see <http://www.gnu.org/licenses/>.
26
from gcompris import gcompris_gettext as _
32
from pysqlite2 import dbapi2 as sqlite
34
class Profiles(module.Module):
35
"""Administrating GCompris Profiles"""
38
def __init__(self, canvas):
39
module.Module.__init__(self, canvas, "profiles", _("Profiles"))
41
# Return the position it must have in the administration menu
42
# The smaller number is the highest.
46
def start(self, area):
47
# Connect to our database
48
self.con = sqlite.connect(gcompris.get_database())
49
self.cur = self.con.cursor()
51
# Create our rootitem. We put each canvas item in it so at the end we
52
# only have to kill it. The canvas deletes all the items it contains automaticaly.
54
self.rootitem = goocanvas.Group(
58
module.Module.start(self)
60
frame = gtk.Frame(_("Profiles"))
64
parent = self.rootitem,
66
x=area[0]+self.module_panel_ofset,
67
y=area[1]+self.module_panel_ofset,
68
width=area[2]-area[0]-2*self.module_panel_ofset,
69
height=area[3]-area[1]-2*self.module_panel_ofset,
72
profile_list.Profile_list(frame, self.con, self.cur)
75
module.Module.stop(self)
77
# Remove the root item removes all the others inside it
78
self.rootitem.remove()