Back to index

gcompris  8.2.2
Public Member Functions | Public Attributes | Private Member Functions
admin.group_user_list.Group_user_list Class Reference

List of all members.

Public Member Functions

def __init__
def clear
def reload
def add_user_in_model

Public Attributes

 cur
 con
 group_id
 model

Private Member Functions

def __create_model
def __add_columns

Detailed Description

GCompris Group User List Table

Definition at line 46 of file group_user_list.py.


Constructor & Destructor Documentation

def admin.group_user_list.Group_user_list.__init__ (   self,
  container,
  db_connect,
  db_cursor,
  group_id 
)

Definition at line 52 of file group_user_list.py.

00052 
00053   def __init__(self, container, db_connect, db_cursor, group_id):
00054 
00055       self.cur = db_cursor
00056       self.con = db_connect
00057 
00058       # The group_id to work on
00059       self.group_id = group_id
00060 
00061       # ---------------
00062       # User Group Management
00063       # ---------------
00064 
00065       # create tree model
00066       self.model = self.__create_model()
00067 
00068       self.reload(self.group_id)
00069 
00070       # Create the table
00071       sw = gtk.ScrolledWindow()
00072       sw.show()
00073       sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
00074       sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
00075 
00076       # create tree view
00077       treeview_group = gtk.TreeView(self.model)
00078       treeview_group.show()
00079       treeview_group.set_rules_hint(True)
00080       treeview_group.set_search_column(COLUMN_FIRSTNAME)
00081       treeview_group.get_selection().set_mode(gtk.SELECTION_NONE)
00082 
00083       sw.add(treeview_group)
00084 
00085       # add columns to the tree view
00086       self.__add_columns(treeview_group)
00087 
00088       container.pack_start(sw)
00089 


Member Function Documentation

def admin.group_user_list.Group_user_list.__add_columns (   self,
  treeview 
) [private]

Definition at line 135 of file group_user_list.py.

00135 
00136   def __add_columns(self, treeview):
00137 
00138     model = treeview.get_model()
00139 
00140     # Total column lengh must be 400
00141 
00142     # columns for login
00143     renderer = gtk.CellRendererText()
00144     renderer.set_data("column", COLUMN_LOGIN)
00145     column = gtk.TreeViewColumn(_('Login'), renderer,
00146                                 text=COLUMN_LOGIN)
00147     column.set_sort_column_id(COLUMN_LOGIN)
00148     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00149     column.set_fixed_width(constants.COLUMN_WIDTH_LOGIN)
00150     treeview.append_column(column)
00151 
00152     # columns for first name
00153     renderer = gtk.CellRendererText()
00154     renderer.set_data("column", COLUMN_FIRSTNAME)
00155     column = gtk.TreeViewColumn(_('First Name'), renderer,
00156                                 text=COLUMN_FIRSTNAME)
00157     column.set_sort_column_id(COLUMN_FIRSTNAME)
00158     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00159     column.set_fixed_width(constants.COLUMN_WIDTH_FIRSTNAME)
00160     treeview.append_column(column)
00161 
00162     # column for last name
00163     renderer = gtk.CellRendererText()
00164     renderer.set_data("column", COLUMN_LASTNAME)
00165     column = gtk.TreeViewColumn(_('Last Name'), renderer,
00166                                 text=COLUMN_LASTNAME)
00167     column.set_sort_column_id(COLUMN_LASTNAME)
00168     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00169     column.set_fixed_width(constants.COLUMN_WIDTH_LASTNAME)
00170     treeview.append_column(column)
00171 
00172     # column for birth date
00173     renderer = gtk.CellRendererText()
00174     renderer.set_data("column", COLUMN_BIRTHDATE)
00175     column = gtk.TreeViewColumn(_('Birth Date'), renderer,
00176                                 text=COLUMN_BIRTHDATE)
00177     column.set_sort_column_id(COLUMN_BIRTHDATE)
00178     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00179     column.set_fixed_width(constants.COLUMN_WIDTH_BIRTHDATE)
00180     treeview.append_column(column)
00181 
00182 
00183 
00184 

Definition at line 124 of file group_user_list.py.

00124 
00125   def __create_model(self):
00126     model = gtk.ListStore(
00127       gobject.TYPE_INT,
00128       gobject.TYPE_STRING,
00129       gobject.TYPE_STRING,
00130       gobject.TYPE_STRING,
00131       gobject.TYPE_STRING)
00132 
00133     return model
00134 

def admin.group_user_list.Group_user_list.add_user_in_model (   self,
  model,
  user 
)

Definition at line 112 of file group_user_list.py.

00112 
00113   def add_user_in_model(self, model, user):
00114     iter = model.append()
00115     model.set (iter,
00116                COLUMN_USERID,    user[COLUMN_USERID],
00117                COLUMN_LOGIN,     user[COLUMN_LOGIN],
00118                COLUMN_FIRSTNAME, user[COLUMN_FIRSTNAME],
00119                COLUMN_LASTNAME,  user[COLUMN_LASTNAME],
00120                COLUMN_BIRTHDATE, user[COLUMN_BIRTHDATE]
00121                )
00122 
00123 

Here is the caller graph for this function:

Definition at line 95 of file group_user_list.py.

00095 
00096   def clear(self):
00097       self.model.clear()

def admin.group_user_list.Group_user_list.reload (   self,
  group_id 
)

Definition at line 99 of file group_user_list.py.

00099 
00100   def reload(self, group_id):
00101       self.group_id = group_id
00102 
00103       # Remove all entries in the list
00104       self.model.clear()
00105 
00106       self.cur.execute('SELECT DISTINCT users.user_id,login,firstname,lastname,birthdate FROM users,list_users_in_groups WHERE list_users_in_groups.group_id=? AND list_users_in_groups.user_id=users.user_id ORDER BY login', (self.group_id,));
00107       users = self.cur.fetchall()
00108       for user in users:
00109         self.add_user_in_model(self.model, user)
00110 

Here is the call graph for this function:


Member Data Documentation

Definition at line 55 of file group_user_list.py.

Definition at line 54 of file group_user_list.py.

Definition at line 58 of file group_user_list.py.

Definition at line 65 of file group_user_list.py.


The documentation for this class was generated from the following file: