~ml-launchpad/ubuntu/natty/gcompris/fix-for-777349

« back to all changes in this revision

Viewing changes to src/administration-activity/admin/module_users.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Gariepy, Marc Gariepy, Stephane Graber
  • Date: 2010-01-04 17:42:49 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20100104174249-7bupatd9dtxyhvs4
Tags: 9.0-0ubuntu1
[Marc Gariepy]
* New upstream release (9.0).
* Remove cache.c from POTFILES to avoid FTBFS
* Remove unneeded rm in debian/rules (file no longer exists upstream)

[Stephane Graber]
* Bump Debian standards to 3.8.3
* Add patch system (dpatch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#  gcompris - module_users
 
2
#
 
3
# Copyright (C) 2005, 2008 Bruno Coudoin and Yves Combe
 
4
#
 
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.
 
9
#
 
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.
 
14
#
 
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/>.
 
17
#
 
18
 
 
19
import goocanvas
 
20
import gcompris
 
21
import gcompris.utils
 
22
import gcompris.skin
 
23
import gtk
 
24
import gtk.gdk
 
25
import gobject
 
26
from gcompris import gcompris_gettext as _
 
27
 
 
28
# Database
 
29
from pysqlite2 import dbapi2 as sqlite
 
30
 
 
31
import module
 
32
import class_list
 
33
 
 
34
class Users(module.Module):
 
35
  """Administrating GCompris Users"""
 
36
 
 
37
 
 
38
  def __init__(self, canvas):
 
39
      module.Module.__init__(self, canvas, "users", _("Classes") + " / " + _("Users") )
 
40
 
 
41
  # Return the position it must have in the administration menu
 
42
  # The smaller number is the highest.
 
43
  def position(self):
 
44
    return 0
 
45
 
 
46
 
 
47
  def start(self, area):
 
48
      # Connect to our database
 
49
      self.con = sqlite.connect(gcompris.get_database())
 
50
      self.cur = self.con.cursor()
 
51
 
 
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(
 
55
          parent = self.canvas,
 
56
          )
 
57
 
 
58
      # Call our parent start
 
59
      module.Module.start(self)
 
60
 
 
61
      frame = gtk.Frame(_("Classes") + " / " + _("Users") )
 
62
      frame.show()
 
63
 
 
64
      goocanvas.Widget(
 
65
        parent = self.rootitem,
 
66
        widget=frame,
 
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,
 
71
        anchor=gtk.ANCHOR_NW)
 
72
 
 
73
 
 
74
      class_list.Class_list(frame, self.con, self.cur)
 
75
 
 
76
 
 
77
  def stop(self):
 
78
    module.Module.stop(self)
 
79
 
 
80
    # Remove the root item removes all the others inside it
 
81
    self.rootitem.remove()
 
82
 
 
83
    # Close the database
 
84
    self.cur.close()
 
85
    self.con.close()