Commit b388acd3 authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

Now after edition, the user and group list is updated

parent a8b22088
2005-07-19 Bruno coudoin <bruno.coudoin@free.fr>
Now after edition, the user and group list is updated
* src/boards/python/admin/__init__.py:
* src/boards/python/admin/class_edit.py:
* src/boards/python/admin/class_list.py:
* src/boards/python/admin/group_edit.py:
* src/boards/python/admin/group_list.py:
* src/boards/python/admin/group_user_list.py:
2005-07-19 Yves Combe <yves@ycombe.net>
fix Makefile.am in src/boards/python/admin/.
......
__all__ = ["users", "profile"]
__all__ = ["users", "profile","boards","groups"]
......@@ -25,6 +25,8 @@ from gettext import gettext as _
# Database
from pysqlite2 import dbapi2 as sqlite
import user_list
import constants
# User List Management
......@@ -38,7 +40,9 @@ import constants
class ClassEdit(gtk.Window):
counter = 1
def __init__(self, db_connect, db_cursor, class_id, class_name):
def __init__(self, db_connect, db_cursor,
class_id, class_name,
list_user):
# Create the toplevel window
gtk.Window.__init__(self)
......@@ -47,6 +51,10 @@ class ClassEdit(gtk.Window):
self.class_id = class_id
# A pointer to the user_list class
# Will be called to refresh the list when edit is done
self.list_user = list_user
self.set_title(_("Class Edition"))
self.set_border_width(8)
self.set_default_size(320, 350)
......@@ -266,5 +274,6 @@ class ClassEdit(gtk.Window):
# Done, can quit this dialog
#
def close(self, button):
self.list_user.reload(self.class_id)
self.destroy()
......@@ -60,7 +60,7 @@ class Class_list:
# Class Management
# ---------------
frame = gtk.Frame(_("User"))
frame = gtk.Frame(_("Classes") + " / " + _("Users") )
frame.show()
# create tree model
......@@ -127,12 +127,12 @@ class Class_list:
top_box.add(user_hbox)
list_user = user_list.User_list(user_hbox,
self.con, self.cur)
self.list_user = user_list.User_list(user_hbox,
self.con, self.cur)
# Missing callbacks
selection = treeview_class.get_selection()
selection.connect('changed', self.class_changed_cb, list_user)
selection.connect('changed', self.class_changed_cb, self.list_user)
# Pack it all
......@@ -184,7 +184,7 @@ class Class_list:
renderer = gtk.CellRendererText()
renderer.connect("edited", self.on_cell_class_edited, model)
renderer.set_data("column", COLUMN_NAME)
column = gtk.TreeViewColumn(_('Name'), renderer,
column = gtk.TreeViewColumn(_('Class'), renderer,
text=COLUMN_NAME,
editable=COLUMN_CLASS_EDITABLE)
column.set_sort_column_id(COLUMN_NAME)
......@@ -282,7 +282,9 @@ class Class_list:
path = model.get_path(iter)[0]
class_id = model.get_value(iter, COLUMN_CLASSID)
class_name = model.get_value(iter, COLUMN_NAME)
class_edit.ClassEdit(self.con, self.cur, class_id, class_name)
class_edit.ClassEdit(self.con, self.cur,
class_id, class_name,
self.list_user)
else:
# Tell the user to select a class first
......
......@@ -22,6 +22,8 @@ import gtk
import gobject
from gettext import gettext as _
import group_user_list
import constants
# Database
......@@ -40,7 +42,8 @@ class GroupEdit(gtk.Window):
def __init__(self, db_connect, db_cursor,
class_id, class_name,
group_id, group_name):
group_id, group_name,
group_user):
# Create the toplevel window
gtk.Window.__init__(self)
......@@ -50,6 +53,10 @@ class GroupEdit(gtk.Window):
self.group_id = group_id
self.class_id = class_id
# A pointer to the group_user_list class
# Will be called to refresh the list when edit is done
self.group_user = group_user
self.set_title(_("Group Edition"))
self.set_border_width(8)
......@@ -300,5 +307,6 @@ class GroupEdit(gtk.Window):
# Done, can quit this dialog
#
def close(self, button):
self.group_user.reload(self.group_id)
self.destroy()
......@@ -161,14 +161,14 @@ class Group_list:
user_hbox.show()
top_box.add(user_hbox)
group_user = group_user_list.Group_user_list(user_hbox,
self.con, self.cur,
self.current_group_id)
self.group_user = group_user_list.Group_user_list(user_hbox,
self.con, self.cur,
self.current_group_id)
# Missing callbacks
self.combo_class.connect('changed', self.class_changed_cb)
selection = treeview_group.get_selection()
selection.connect('changed', self.group_changed_cb, group_user)
selection.connect('changed', self.group_changed_cb, self.group_user)
# Pack it all
self.rootitem.add(
......@@ -332,7 +332,8 @@ class Group_list:
group_name = model.get_value(iter, COLUMN_NAME)
group_edit.GroupEdit(self.con, self.cur,
self.current_class_id, self.get_active_text(self.combo_class),
group_id, group_name)
group_id, group_name,
self.group_user)
else:
# Tell the user to select a group first
......@@ -343,6 +344,7 @@ class Group_list:
dialog.run()
dialog.destroy()
def group_changed_cb(self, selection, group_user):
print "group_changed_cb"
model, iter = selection.get_selected()
......@@ -352,10 +354,7 @@ class Group_list:
self.current_group_id = model.get_value(iter, COLUMN_GROUPID)
group_user.reload(self.current_group_id)
print "current group_id = " + str(self.current_group_id)
def class_changed_cb(self, combobox):
print "class_changed_cb"
self.current_class_id = self.class_list[combobox.get_active()]
self.reload_group()
print "current class_id = " + str(self.current_class_id)
......@@ -92,6 +92,10 @@ class Group_user_list:
# User Management
# -------------------
# clear all data in the list
def clear(self):
self.model.clear()
# Retrieve data from the database for the given group_id
def reload(self, group_id):
print "Reloading group_user_list for group_id=" + str(group_id)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment