Back to index

gcompris  8.2.2
Public Member Functions | Public Attributes | Private Member Functions
admin.board_list.Board_list Class Reference

List of all members.

Public Member Functions

def __init__
def get_board_by_name
def get_board_from_menu
def add_boards_in_model
def pixbuf_at_height
def board_acive_cb
def update_selected
def dict_from_list
def changed_cb
def update_active
def get_boards_out_by_profile
def pixbuf_configurable
def preference_clicked
def row_selected
def configure_board
def select_all_boards
def update_all
def filter_boards
def filter_close
def create_arrow_button
def update_arrows_active
def arrow_clicked
def filter_apply
def board_filter
def blank
def update_parent
def check_parent_active
def update_child
def locales
def locales_sound
def ok_callback
def get_configured
def login_configure
def wordlist

Public Attributes

 frame
 cur
 con
 profiles_list
 default_profile_id
 out_dict
 difficulty
 active_profile
 model
 button_configure
 button_filter
 button_select_all
 button_unselect_all
 button_locales
 button_locales_sound
 button_wordlist
 button_login
 board_dict
 boards_list
 selected_board
 stars
 arrows
 main_vbox
 already_conf

Private Member Functions

def __create_model
def __add_columns

Detailed Description

GCompris Boards List Table

Definition at line 39 of file board_list.py.


Constructor & Destructor Documentation

def admin.board_list.Board_list.__init__ (   self,
  db_connect,
  db_cursor,
  frame 
)

Definition at line 44 of file board_list.py.

00044 
00045   def __init__(self, db_connect, db_cursor, frame):
00046 
00047       self.frame = frame
00048       self.cur = db_cursor
00049       self.con = db_connect
00050 
00051       # ---------------
00052       # Boards Management
00053       # ---------------
00054 
00055 
00056       # Create the profiles Combo
00057       self.profiles_list = gcompris.admin.get_profiles_list()
00058 
00059       # Get default pofile id.
00060       self.cur.execute('SELECT profile_id FROM informations;')
00061       self.con.commit()
00062 
00063       self.default_profile_id = self.cur.fetchall()[0][0]
00064 
00065       self.out_dict = self.get_boards_out_by_profile()
00066 
00067       self.difficulty = [1, 6]
00068 
00069       #print out_dict
00070 
00071       # Main box is vertical
00072       top_box = gtk.VBox(False, 8)
00073       top_box.show()
00074       self.frame.add(top_box)
00075 
00076       box1 = gtk.HBox(False, 8)
00077       box1.show()
00078 
00079       box2 = gtk.HBox(False, 8)
00080       box2.show()
00081 
00082       box3 = gtk.VBox(False, 8)
00083       box3.show()
00084 
00085       top_box.pack_start(box1, False, False, 0)
00086       top_box.pack_start(box2, True, True, 0)
00087 
00088       box2.pack_end(box3, False, False, 0)
00089 
00090       label = gtk.Label(_('Select a profile:'))
00091       label.show()
00092       box1.pack_start(label,False, False, 0)
00093 
00094       combobox = gtk.combo_box_new_text()
00095       combobox.show()
00096       box1.pack_start(combobox, False, False, 0)
00097 
00098       i = 0
00099       for profile in self.profiles_list:
00100         combobox.append_text(profile.name)
00101         if profile.profile_id == self.default_profile_id:
00102           combobox.set_active(self.profiles_list.index(profile))
00103 
00104       self.active_profile = self.profiles_list[combobox.get_active()]
00105       print 'Active profile is now', self.active_profile.name
00106 
00107       # Create the table
00108       sw = gtk.ScrolledWindow()
00109       sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
00110 #      sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
00111       sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
00112 
00113       # create tree model
00114       self.model = self.__create_model()
00115 
00116       # update the combobox
00117       combobox.connect('changed', self.changed_cb)
00118 
00119       # create tree view
00120       treeview = gtk.TreeView(self.model)
00121       treeview.set_rules_hint(True)
00122       treeview.set_search_column(COLUMN_BOARDNAME)
00123 
00124       sw.add(treeview)
00125 
00126       # Some constants for the layout
00127       #but_height = hgap * 2
00128       #but_width  = hgap * 6
00129 
00130       box2.pack_start(sw, True, True, 0)
00131 
00132       sw.show()
00133       treeview.show()
00134 
00135       # add columns to the tree view
00136       self.__add_columns(treeview)
00137 
00138       # Add buttons
00139 
00140       self.button_configure = gtk.Button(stock=gtk.STOCK_PREFERENCES)
00141       self.button_configure.connect("clicked", self.configure_board)
00142       self.button_configure.show()
00143       box3.pack_start(self.button_configure, False, False, 0)
00144       self.button_configure.set_sensitive(False)
00145 
00146       self.button_filter = gtk.Button(_('Filter'))
00147       self.button_filter.connect("clicked", self.filter_boards)
00148       self.button_filter.show()
00149       box3.pack_start(self.button_filter, False, False, 0)
00150 
00151       self.button_select_all = gtk.Button(_('Select all'))
00152       self.button_select_all.connect("clicked", self.select_all_boards, True)
00153       self.button_select_all.show()
00154       box3.pack_start(self.button_select_all, False, False, 0)
00155 
00156       self.button_unselect_all = gtk.Button(_('Unselect all'))
00157       self.button_unselect_all.connect("clicked", self.select_all_boards, False)
00158       self.button_unselect_all.show()
00159       box3.pack_start(self.button_unselect_all, False, False, 0)
00160 
00161       self.button_locales = gtk.Button(_('Locales'))
00162       self.button_locales.connect("clicked", self.locales)
00163       self.button_locales.show()
00164       box3.pack_end(self.button_locales, False, False, 0)
00165 
00166       self.button_locales_sound = gtk.Button(_('Locales sound'))
00167       self.button_locales_sound.connect("clicked", self.locales_sound)
00168       self.button_locales_sound.show()
00169       box3.pack_end(self.button_locales_sound, False, False, 0)
00170 
00171       self.button_wordlist = gtk.Button(_('Wordlist'))
00172       self.button_wordlist.connect("clicked", self.wordlist)
00173       self.button_wordlist.show()
00174       box3.pack_end(self.button_wordlist, False, False, 0)
00175       #not ready yet
00176       self.button_wordlist.set_sensitive(False)
00177 
00178       self.button_login = gtk.Button(_('Login'))
00179       self.button_login.connect("clicked", self.login_configure)
00180       self.button_login.show()
00181       box3.pack_end(self.button_login, False, False, 0)
00182 


Member Function Documentation

def admin.board_list.Board_list.__add_columns (   self,
  treeview 
) [private]

Definition at line 271 of file board_list.py.

00271 
00272   def __add_columns(self, treeview):
00273 
00274     model = treeview.get_model()
00275 
00276     # Render for Board name with icon.
00277     cell_board_icon = gtk.CellRendererPixbuf()
00278 
00279     cell_board_title = gtk.CellRendererText()
00280 
00281     cell_active_board = gtk.CellRendererToggle()
00282     cell_active_board.set_property('activatable', True)
00283     cell_active_board.connect( 'toggled', self.board_acive_cb, model )
00284 
00285     cell_board_configure = gtk.CellRendererPixbuf()
00286 
00287 #    columns for Board name
00288 #    column_pref = gtk.TreeViewColumn(_('Conf'))
00289 #    image = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU)
00290 #    image.show()
00291 #    column_pref.set_widget(image)
00292 
00293     column_active = gtk.TreeViewColumn(_('Active'))
00294     column_title = gtk.TreeViewColumn(_('Board title'))
00295     column_title.pack_start(cell_board_icon, False)
00296     column_active.pack_start(cell_board_configure, False)
00297     column_title.pack_start(cell_board_title, True)
00298     column_active.pack_start(cell_active_board, False)
00299 
00300     treeview.append_column(column_active)
00301     treeview.append_column(column_title)
00302 
00303     column_title.add_attribute(cell_board_icon, 'pixbuf', 0)
00304     column_title.add_attribute(cell_board_title, 'text', 1)
00305     column_active.add_attribute(cell_active_board, 'active', 2)
00306     column_active.set_attributes(cell_board_configure, stock_id=4)
00307 
00308     treeview.connect("cursor-changed", self.row_selected, model)

Here is the call graph for this function:

Definition at line 255 of file board_list.py.

00255 
00256   def __create_model(self):
00257     model = gtk.TreeStore(
00258       gtk.gdk.Pixbuf,
00259       gobject.TYPE_STRING,
00260       gobject.TYPE_BOOLEAN,
00261       gobject.TYPE_STRING,
00262       gobject.TYPE_STRING,
00263       )
00264 
00265     self.boards_list = gcompris.admin.get_boards_list()
00266 
00267     self.add_boards_in_model(model, self.boards_list)
00268 
00269     return model
00270 

def admin.board_list.Board_list.add_boards_in_model (   self,
  model,
  boards_list 
)

Definition at line 206 of file board_list.py.

00206 
00207   def add_boards_in_model(self, model, boards_list):
00208     root_menu = '/'
00209     root = self.get_board_by_name(root_menu, boards_list)
00210     boards_list.remove(root)
00211     menu_list = [[ None,  root ]]
00212 
00213     list = menu_list[:]
00214     while len(list) > 0:
00215       menu = list.pop(0)[1]
00216       list_board = self.get_board_from_menu(menu, boards_list)
00217       menu_list = menu_list + list_board
00218 
00219       for board_cell in list_board:
00220         if board_cell[1].type == 'menu':
00221           list.append(board_cell)
00222 
00223 
00224     row_dict = {}
00225     self.board_dict = {}
00226     height = 24
00227 
00228     for board_cell in menu_list:
00229       self.board_dict['%s/%s' % (board_cell[1].section,board_cell[1].name)] = board_cell[1]
00230 
00231 
00232       if  board_cell[0] == None:
00233         row_dict[''] =  \
00234                      model.append(None,
00235                                   [self.pixbuf_at_height('gcompris/misc/tuxplane.png', height),
00236                                    _('Main menu') + '\n' + '/',
00237                                    not board_cell[1].board_id in self.out_dict[self.active_profile.profile_id],
00238                                    '%s/%s' % (board_cell[1].section,board_cell[1].name), self.pixbuf_configurable(board_cell[1])])
00239 
00240       else:
00241         row_dict['%s/%s' % (board_cell[1].section,board_cell[1].name)] = \
00242                          model.append(row_dict[board_cell[1].section],
00243                                       [self.pixbuf_at_height(board_cell[1].icon_name, height),
00244                                        _(board_cell[1].title) + '\n' + '%s/%s' % (board_cell[1].section,board_cell[1].name),
00245                                        not board_cell[1].board_id in self.out_dict[self.active_profile.profile_id],
00246                                        '%s/%s' % (board_cell[1].section,board_cell[1].name), self.pixbuf_configurable(board_cell[1])])
00247 

Here is the call graph for this function:

def admin.board_list.Board_list.arrow_clicked (   self,
  arrow,
  i 
)

Definition at line 528 of file board_list.py.

00528 
00529   def arrow_clicked(self, arrow, i):
00530     if i < 3:
00531       value = 0
00532       limits = [1, self.difficulty[1]]
00533     else:
00534       value = 1
00535       limits = [self.difficulty[0], 6]
00536 
00537     if (i % 2 == 0):
00538       if self.difficulty[value] == limits[1]:
00539         return
00540       else:
00541         self.difficulty[value] = self.difficulty[value] + 1
00542     else:
00543       if self.difficulty[value] == limits[0]:
00544         return
00545       else:
00546         self.difficulty[value] = self.difficulty[value] - 1
00547 
00548     self.update_arrows_active()

Here is the call graph for this function:

def admin.board_list.Board_list.blank (   self,
  model,
  path,
  iter 
)

Definition at line 568 of file board_list.py.

00568 
00569   def blank(self,  model, path, iter):
00570     model[path][2] = False

Here is the caller graph for this function:

def admin.board_list.Board_list.board_acive_cb (   self,
  cell,
  path,
  model 
)

Definition at line 309 of file board_list.py.

00309 
00310   def board_acive_cb(self, cell, path, model):
00311     model[path][2] = not model[path][2]
00312 
00313     if model[path][2]:
00314       self.update_parent(model[path].parent)
00315     else:
00316       self.check_parent_active(model[path].parent)
00317 
00318     try:
00319       self.update_child(model[path].iterchildren().next(), model[path][2])
00320     except StopIteration:
00321       pass
00322 
00323     self.update_selected(model, path)

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.board_filter (   self,
  model,
  path,
  iter 
)

Definition at line 554 of file board_list.py.

00554 
00555   def board_filter(self,  model, path, iter):
00556     if self.board_dict[model[path][3]].type != "menu":
00557       model[path][2] = ( eval(self.board_dict[model[path][3]].difficulty) \
00558                          in range( self.difficulty[0],
00559                                    self.difficulty[1]+1))
00560 
00561     print self.board_dict[model[path][3]].name, self.board_dict[model[path][3]].difficulty, self.difficulty, model[path][2]
00562 
00563     if model[path][2]:
00564       self.update_parent(model[path].parent)
00565 
00566     self.update_selected( model, path)

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.changed_cb (   self,
  combobox 
)

Definition at line 354 of file board_list.py.

00354 
00355   def changed_cb(self, combobox):
00356     index = combobox.get_active()
00357     if(index<0):
00358       return
00359     self.active_profile = self.profiles_list[index]
00360 
00361     print 'Active profile is now', self.active_profile.name
00362 
00363     self.model.foreach(self.update_active)

Here is the call graph for this function:

Definition at line 586 of file board_list.py.

00586 
00587   def check_parent_active( self, row):
00588     if row == None:
00589       return
00590 
00591     # should never appends
00592     if not row[2]:
00593       return
00594 
00595     child = row.iterchildren().next()
00596     select = False
00597 
00598     while child != None:
00599       if child[2]:
00600         select = True
00601         break
00602       child = child.next
00603 
00604     if not select:
00605       row[2] = False
00606       self.check_parent_active(row.parent)
00607       self.update_selected(row.model, row.path)

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.configure_board (   self,
  button 
)

Definition at line 392 of file board_list.py.

00392 
00393   def configure_board(self, button):
00394     gcompris.admin.board_config_start(self.selected_board,
00395                                       self.active_profile)
00396     #unused
00397     #gcompris.admin.board_config_stop(self.selected_board)

def admin.board_list.Board_list.create_arrow_button (   self,
  arrow_type,
  shadow_type 
)

Definition at line 489 of file board_list.py.

00489 
00490   def create_arrow_button(self, arrow_type, shadow_type):
00491     button = gtk.Button();
00492     arrow = gtk.Arrow(arrow_type, shadow_type);
00493     button.add(arrow)
00494     button.show()
00495     arrow.show()
00496     return button

def admin.board_list.Board_list.dict_from_list (   self,
  list 
)

Definition at line 343 of file board_list.py.

00343 
00344   def dict_from_list(self, list):
00345     dict = {}
00346 
00347     for profile in  self.profiles_list:
00348       dict[profile.profile_id] = []
00349 
00350     for l in list:
00351       dict[l[1]].append(l[0])
00352 
00353     return dict

Here is the caller graph for this function:

def admin.board_list.Board_list.filter_apply (   self,
  button 
)

Definition at line 549 of file board_list.py.

00549 
00550   def filter_apply(self, button):
00551     self.model.foreach(self.blank)
00552     self.model.foreach(self.board_filter)

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.filter_boards (   self,
  button 
)

Definition at line 407 of file board_list.py.

00407 
00408   def filter_boards(self, button):
00409     window = gtk.Window()
00410     window.set_title(_("Filter Boards difficulty for profile %s") % (self.active_profile.name))
00411     window.set_border_width(8)
00412     window.set_default_size(320, 350)
00413     window.set_transient_for(self.frame.get_toplevel())
00414     window.set_modal(True)
00415     window.show()
00416 
00417     button_close = gtk.Button(stock=gtk.STOCK_CLOSE)
00418     button_close.connect("clicked", self.filter_close, window)
00419     button_close.show()
00420 
00421     button_apply = gtk.Button(stock=gtk.STOCK_APPLY)
00422     button_apply.connect("clicked", self.filter_apply)
00423     button_apply.show()
00424 
00425     main_box = gtk.VBox(False, 8)
00426     main_box.show()
00427     window.add(main_box)
00428 
00429     box_bottom = gtk.HBox(False, 0)
00430     box_bottom.show()
00431     main_box.pack_end(box_bottom, False, False, 0)
00432 
00433     sep = gtk.HSeparator()
00434     sep.show()
00435     main_box.pack_end(sep, False, False, 8)
00436 
00437     box_bottom.pack_end(button_close, False, False, 0)
00438     box_bottom.pack_start(button_apply, False, False, 0)
00439 
00440     label = gtk.Label()
00441     label.set_markup(_("<span size='x-large'> Select the difficulty range \nfor profile <b>%s</b></span>") % self.active_profile.name)
00442     label.show()
00443     label.set_line_wrap(True)
00444     label.set_justify(gtk.JUSTIFY_CENTER)
00445     main_box.pack_start(label, False, False, 0)
00446 
00447     symbols_box = gtk.HBox(False, 0)
00448     symbols_box.show()
00449     main_box.pack_start(symbols_box, False, False, 0)
00450 
00451     arrows_box = gtk.HBox(False, 0)
00452     arrows_box.show()
00453     main_box.pack_start(arrows_box, False, False, 0)
00454 
00455     self.stars = {}
00456 
00457     for i in range(1,7):
00458       box = gtk.VBox(False, 8)
00459       box.show()
00460       symbols_box.pack_start(box, True, False, 0)
00461       self.stars[i] = gtk.Image()
00462       self.stars[i].set_from_pixbuf(gcompris.skin.load_pixmap('difficulty_star%d.png' % (i)))
00463       self.stars[i].show()
00464       box.pack_start(self.stars[i], False, False, 0)
00465       i_label = gtk.Label()
00466       i_label.set_markup("<span size='x-large'><b>%d</b></span>" % i)
00467       i_label.show()
00468       box.pack_start(i_label, False, False, 0)
00469 
00470     self.arrows = {}
00471 
00472     self.arrows[1] = self.create_arrow_button(gtk.ARROW_LEFT, gtk.SHADOW_IN)
00473     self.arrows[2] = self.create_arrow_button(gtk.ARROW_RIGHT, gtk.SHADOW_IN)
00474     self.arrows[3] = self.create_arrow_button(gtk.ARROW_LEFT, gtk.SHADOW_IN)
00475     self.arrows[4] = self.create_arrow_button(gtk.ARROW_RIGHT, gtk.SHADOW_IN)
00476 
00477     arrows_box.pack_start(self.arrows[1], False, False, 3)
00478     arrows_box.pack_start(self.arrows[2], False, False, 3)
00479     arrows_box.pack_end(self.arrows[4], False, False, 3)
00480     arrows_box.pack_end(self.arrows[3], False, False, 3)
00481 
00482     for i in range (1,5):
00483       self.arrows[i].connect("clicked", self.arrow_clicked, i)
00484 
00485     self.update_arrows_active()

Here is the call graph for this function:

def admin.board_list.Board_list.filter_close (   self,
  button,
  window 
)

Definition at line 486 of file board_list.py.

00486 
00487   def filter_close(self, button, window):
00488     window.destroy()

Here is the caller graph for this function:

def admin.board_list.Board_list.get_board_by_name (   self,
  name,
  list 
)

Definition at line 188 of file board_list.py.

00188 
00189   def get_board_by_name(self, name, list):
00190     for board in list:
00191       if (board.section + '/' + board.name) == name:
00192         return board
00193     return None

Here is the caller graph for this function:

def admin.board_list.Board_list.get_board_from_menu (   self,
  menu,
  list 
)

Definition at line 194 of file board_list.py.

00194 
00195   def get_board_from_menu(self, menu, list):
00196     if menu.name =='':
00197       section = ''
00198     else:
00199       section = menu.section + '/' + menu.name
00200     return_list = []
00201     for board in list:
00202       if board.section == section:
00203         return_list.append([section, board])
00204 
00205     return return_list

Here is the caller graph for this function:

Definition at line 367 of file board_list.py.

00367 
00368   def get_boards_out_by_profile(self):
00369     # Grab the user data
00370     self.cur.execute('select board_id, out_id from activities_out')
00371 
00372     return self.dict_from_list(self.cur.fetchall())

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.get_configured (   self,
  profile,
  key,
  if_not 
)

Definition at line 677 of file board_list.py.

00677 
00678   def get_configured(self, profile, key, if_not):
00679     self.cur.execute('select conf_value from board_profile_conf where profile_id=%d and board_id=-1 and conf_key =\'%s\' ' % (profile.profile_id, key))
00680 
00681     value = self.cur.fetchall()
00682 
00683     try:
00684       s = self.already_conf
00685     except:
00686       self.already_conf = []
00687 
00688     if len(value)==1:
00689       self.already_conf.append(key)
00690       return value[0][0]
00691     else:
00692       return if_not
00693 

Here is the caller graph for this function:

def admin.board_list.Board_list.locales (   self,
  button 
)

Definition at line 628 of file board_list.py.

00628 
00629   def locales(self, button):
00630     conf_locales = self.get_configured(self.active_profile, 'locale', 'NULL')
00631     self.main_vbox = gcompris.configuration_window ( \
00632       _('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Locale', self.active_profile.name ),
00633       self.ok_callback
00634       )
00635 
00636     label = gtk.Label()
00637     label.set_line_wrap(True)
00638     label.set_markup('Choose the default locale used by localizable boards for profile %s' % self.active_profile.name)
00639     label.show()
00640     self.main_vbox.pack_start (label, False, False, 8)
00641 
00642     gcompris.separator()
00643 
00644     gcompris.combo_locales( conf_locales)

Here is the call graph for this function:

def admin.board_list.Board_list.locales_sound (   self,
  button 
)

Definition at line 645 of file board_list.py.

00645 
00646   def locales_sound(self, button):
00647 
00648     conf_locales = self.get_configured(self.active_profile, 'locale_sound', 'NULL')
00649     self.main_vbox = gcompris.configuration_window ( \
00650       _('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Locale sound', self.active_profile.name ),
00651       self.ok_callback
00652       )
00653 
00654     label = gtk.Label()
00655     label.set_line_wrap(True)
00656     label.set_markup('Choose the default locale for <b>sounds</b> used by localizable boards for profile %s' % self.active_profile.name)
00657     label.show()
00658     self.main_vbox.pack_start (label, False, False, 8)
00659 
00660     gcompris.separator()
00661 
00662     gcompris.combo_locales_asset( _("Select sound locale"),
00663                                   conf_locales,
00664                                   "sounds/$LOCALE/colors/purple.ogg" )
00665 

Here is the call graph for this function:

def admin.board_list.Board_list.login_configure (   self,
  button 
)

Definition at line 694 of file board_list.py.

00694 
00695   def login_configure(self, button):
00696     print "__login configure__"
00697     board_log = self.get_board_by_name('/login/login', self.boards_list)
00698     print board_log.name, board_log.is_configurable
00699     gcompris.admin.board_config_start(board_log,
00700                                       self.active_profile)
00701 
00702 

Here is the call graph for this function:

def admin.board_list.Board_list.ok_callback (   self,
  dict 
)

Definition at line 666 of file board_list.py.

00666 
00667   def ok_callback(self, dict):
00668 
00669     for key, value in dict.iteritems():
00670       if key in self.already_conf:
00671         req = 'UPDATE board_profile_conf SET conf_value=\'%s\' WHERE profile_id=%d AND board_id=-1 AND conf_key=\'%s\'' % (value, self.active_profile.profile_id, key)
00672       else:
00673         req = 'INSERT INTO board_profile_conf (profile_id, board_id, conf_key, conf_value) VALUES (%d, -1, \'%s\', \'%s\')' % (self.active_profile.profile_id, key, value)
00674 
00675       self.cur.execute(req)
00676       self.con.commit()

Here is the caller graph for this function:

def admin.board_list.Board_list.pixbuf_at_height (   self,
  file,
  height 
)

Definition at line 248 of file board_list.py.

00248 
00249   def pixbuf_at_height(self,file, height):
00250     pixbuf = gcompris.utils.load_pixmap(file)
00251     width = pixbuf.get_width()* height / pixbuf.get_height()
00252     del pixbuf
00253     pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(gcompris.DATA_DIR + '/' + file, width, height)
00254     return pixbuf

Definition at line 373 of file board_list.py.

00373 
00374   def pixbuf_configurable(self, board):
00375     if board.is_configurable and board.type != "menu":
00376       return gtk.STOCK_PREFERENCES
00377     else:
00378       return None

def admin.board_list.Board_list.preference_clicked (   self,
  widget,
  event,
  board 
)

Definition at line 379 of file board_list.py.

00379 
00380   def preference_clicked(self, widget, event, board):
00381     print 'preference', board.title

def admin.board_list.Board_list.row_selected (   self,
  treeview,
  model 
)

Definition at line 382 of file board_list.py.

00382 
00383   def row_selected(self, treeview,  model):
00384     path = model.get_path(treeview.get_selection().get_selected()[1])
00385     print "Row selected:", model[path][3]
00386 
00387     self.selected_board = self.board_dict[model[path][3]]
00388     if self.selected_board.is_configurable:
00389       self.button_configure.set_sensitive(True)
00390     else:
00391       self.button_configure.set_sensitive(False)

Here is the caller graph for this function:

def admin.board_list.Board_list.select_all_boards (   self,
  button,
  Value 
)

Definition at line 398 of file board_list.py.

00398 
00399   def select_all_boards(self, button, Value):
00400     self.model.foreach(self.update_all, Value)

Here is the call graph for this function:

def admin.board_list.Board_list.update_active (   self,
  model,
  path,
  iter 
)

Definition at line 364 of file board_list.py.

00364 
00365   def update_active(self, model, path, iter):
00366     model[path][2] = not self.board_dict[model[path][3]].board_id in self.out_dict[self.active_profile.profile_id]

Here is the caller graph for this function:

def admin.board_list.Board_list.update_all (   self,
  model,
  path,
  iter,
  Value 
)

Definition at line 401 of file board_list.py.

00401 
00402   def update_all(self, model, path, iter, Value):
00403     model[path][2] = Value
00404 
00405     self.update_selected( model, path)
00406 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 497 of file board_list.py.

00497 
00498   def update_arrows_active(self):
00499     if self.difficulty[0] == 1:
00500       self.arrows[1].set_sensitive(False)
00501     else:
00502       self.arrows[1].set_sensitive(True)
00503 
00504     if self.difficulty[1] == 6:
00505       self.arrows[4].set_sensitive(False)
00506     else:
00507       self.arrows[4].set_sensitive(True)
00508 
00509     if self.difficulty[1] == 1:
00510       self.arrows[3].set_sensitive(False)
00511     else:
00512       self.arrows[3].set_sensitive(True)
00513 
00514     if self.difficulty[0] == 6:
00515       self.arrows[2].set_sensitive(False)
00516     else:
00517       self.arrows[2].set_sensitive(True)
00518 
00519     if self.difficulty[0] == self.difficulty[1]:
00520       self.arrows[2].set_sensitive(False)
00521       self.arrows[3].set_sensitive(False)
00522 
00523     for i in range(1,7):
00524       if i in range( self.difficulty[0], self.difficulty[1]+1):
00525         self.stars[i].set_sensitive(True)
00526       else:
00527         self.stars[i].set_sensitive(False)

Here is the caller graph for this function:

def admin.board_list.Board_list.update_child (   self,
  row,
  value 
)

Definition at line 609 of file board_list.py.

00609 
00610   def update_child( self, row, value):
00611     if row[2] == value:
00612       return
00613 
00614     row[2] = value
00615 
00616     try:
00617       self.update_child(row.iterchildren().next(), value)
00618     except StopIteration:
00619       pass
00620 
00621     if row.next != None:
00622       self.update_child(row.next, value)
00623 
00624     self.update_selected(row.model, row.path)

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.update_parent (   self,
  row 
)

Definition at line 572 of file board_list.py.

00572 
00573   def update_parent( self, row):
00574     if row == None:
00575       return
00576 
00577     if row[2]:
00578       return
00579 
00580     row[2] = True
00581 
00582     self.update_parent( row.parent)
00583 
00584     self.update_selected(row.model, row.path)

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.update_selected (   self,
  model,
  path 
)

Definition at line 324 of file board_list.py.

00324 
00325   def update_selected(self, model, path):
00326     if model[path][2]:
00327       self.cur.execute('DELETE FROM activities_out WHERE board_id=%d AND out_id=%d' % (
00328         self.board_dict[model[path][3]].board_id,
00329                                                                                        self.active_profile.profile_id
00330         ))
00331     else:
00332       self.cur.execute('INSERT INTO activities_out (board_id, out_id) VALUES (%d, %d)' % (
00333         self.board_dict[model[path][3]].board_id,
00334         self.active_profile.profile_id
00335         ))
00336 
00337     self.con.commit()
00338 
00339     # update infos
00340     self.out_dict = self.get_boards_out_by_profile()
00341 
00342     return

Here is the call graph for this function:

Here is the caller graph for this function:

def admin.board_list.Board_list.wordlist (   self,
  button 
)

Definition at line 703 of file board_list.py.

00703 
00704   def wordlist(self, button):
00705     import wordlist
00706     wordlist.Words_list(self.con, self.cur, self.active_profile)

Member Data Documentation

Definition at line 103 of file board_list.py.

Definition at line 685 of file board_list.py.

Definition at line 469 of file board_list.py.

Definition at line 224 of file board_list.py.

Definition at line 264 of file board_list.py.

Definition at line 139 of file board_list.py.

Definition at line 145 of file board_list.py.

Definition at line 160 of file board_list.py.

Definition at line 165 of file board_list.py.

Definition at line 177 of file board_list.py.

Definition at line 150 of file board_list.py.

Definition at line 155 of file board_list.py.

Definition at line 170 of file board_list.py.

Definition at line 48 of file board_list.py.

Definition at line 47 of file board_list.py.

Definition at line 62 of file board_list.py.

Definition at line 66 of file board_list.py.

Definition at line 46 of file board_list.py.

Definition at line 630 of file board_list.py.

Definition at line 113 of file board_list.py.

Definition at line 64 of file board_list.py.

Definition at line 56 of file board_list.py.

Definition at line 386 of file board_list.py.

Definition at line 454 of file board_list.py.


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