1
# gcompris - module_users
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 _
29
from pysqlite2 import dbapi2 as sqlite
34
class Users(module.Module):
35
"""Administrating GCompris Users"""
38
def __init__(self, canvas):
39
module.Module.__init__(self, canvas, "users", _("Classes") + " / " + _("Users") )
41
# Return the position it must have in the administration menu
42
# The smaller number is the highest.
47
def start(self, area):
48
# Connect to our database
49
self.con = sqlite.connect(gcompris.get_database())
50
self.cur = self.con.cursor()
52
# Create our rootitem. We put each canvas item in it so at the end we
53
# only have to kill it. The canvas deletes all the items it contains automaticaly.
54
self.rootitem = goocanvas.Group(
58
# Call our parent start
59
module.Module.start(self)
61
frame = gtk.Frame(_("Classes") + " / " + _("Users") )
65
parent = self.rootitem,
67
x=area[0]+self.module_panel_ofset,
68
y=area[1]+self.module_panel_ofset,
69
width=area[2]-area[0]-2*self.module_panel_ofset,
70
height=area[3]-area[1]-2*self.module_panel_ofset,
74
class_list.Class_list(frame, self.con, self.cur)
78
module.Module.stop(self)
80
# Remove the root item removes all the others inside it
81
self.rootitem.remove()