Back to index

gcompris  8.2.2
Public Member Functions | Public Attributes | Private Member Functions
admin.profile_group_list.Profile_group_list Class Reference

List of all members.

Public Member Functions

def __init__
def clear
def reload
def add_group_in_model

Public Attributes

 cur
 con
 profile_id
 model

Private Member Functions

def __create_model
def __add_columns

Detailed Description

GCompris Profile Group List Table

Definition at line 45 of file profile_group_list.py.


Constructor & Destructor Documentation

def admin.profile_group_list.Profile_group_list.__init__ (   self,
  container,
  db_connect,
  db_cursor,
  profile_id 
)

Definition at line 51 of file profile_group_list.py.

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


Member Function Documentation

def admin.profile_group_list.Profile_group_list.__add_columns (   self,
  treeview 
) [private]

Definition at line 135 of file profile_group_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 class name
00143     renderer = gtk.CellRendererText()
00144     renderer.set_data("column", COLUMN_CLASSNAME)
00145     column = gtk.TreeViewColumn(_('Class'), renderer,
00146                                 text=COLUMN_CLASSNAME)
00147     column.set_sort_column_id(COLUMN_CLASSNAME)
00148     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00149     column.set_fixed_width(constants.COLUMN_WIDTH_CLASSNAME)
00150     treeview.append_column(column)
00151 
00152     # columns for name
00153     renderer = gtk.CellRendererText()
00154     renderer.set_data("column", COLUMN_GROUPNAME)
00155     column = gtk.TreeViewColumn(_('Group'), renderer,
00156                                 text=COLUMN_GROUPNAME)
00157     column.set_sort_column_id(COLUMN_GROUPNAME)
00158     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00159     column.set_fixed_width(constants.COLUMN_WIDTH_GROUPNAME)
00160     treeview.append_column(column)
00161 
00162     # columns for description
00163     renderer = gtk.CellRendererText()
00164     renderer.set_data("column", COLUMN_DESCRIPTION)
00165     column = gtk.TreeViewColumn(_('Description'), renderer,
00166                                 text=COLUMN_DESCRIPTION)
00167     column.set_sort_column_id(COLUMN_DESCRIPTION)
00168     column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
00169     column.set_fixed_width(constants.COLUMN_WIDTH_GROUPDESCRIPTION)
00170     treeview.append_column(column)
00171 
00172 

Definition at line 125 of file profile_group_list.py.

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

Definition at line 114 of file profile_group_list.py.

00114 
00115   def add_group_in_model(self, model, group):
00116     iter = model.append()
00117     model.set (iter,
00118                COLUMN_GROUPID,     group[COLUMN_GROUPID],
00119                COLUMN_CLASSNAME,   group[COLUMN_CLASSNAME],
00120                COLUMN_GROUPNAME,   group[COLUMN_GROUPNAME],
00121                COLUMN_DESCRIPTION, group[COLUMN_DESCRIPTION],
00122                )
00123 
00124 

Here is the caller graph for this function:

Definition at line 93 of file profile_group_list.py.

00093 
00094   def clear(self):
00095       self.model.clear()

def admin.profile_group_list.Profile_group_list.reload (   self,
  profile_id 
)

Definition at line 97 of file profile_group_list.py.

00097 
00098   def reload(self, profile_id):
00099 
00100       self.profile_id = profile_id
00101 
00102       # Remove all entries in the list
00103       self.model.clear()
00104 
00105       self.cur.execute('SELECT DISTINCT groups.group_id,class.name,groups.name,groups.description FROM groups,list_groups_in_profiles,class WHERE list_groups_in_profiles.profile_id=? AND list_groups_in_profiles.group_id=groups.group_id AND class.class_id=groups.class_id ORDER BY class.name,groups.name',
00106                        (self.profile_id, ))
00107 
00108       groups = self.cur.fetchall()
00109       for group in groups:
00110         self.add_group_in_model(self.model, group)
00111 
00112 

Here is the call graph for this function:


Member Data Documentation

Definition at line 54 of file profile_group_list.py.

Definition at line 53 of file profile_group_list.py.

Definition at line 64 of file profile_group_list.py.

Definition at line 57 of file profile_group_list.py.


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