예제 #1
0
  def config_start(self, profile):
    # keep profile in mind
    # profile can be Py_None
    self.configuring_profile = profile

    # init with default values
    self.config_dict = self.init_config()

    #get the configured values for that profile
    self.config_dict.update(gcompris.get_conf(profile, self.gcomprisBoard))

    # Init configuration window:
    # all the configuration functions will use it
    # all the configuration functions returns values for their key in
    # the dict passed to the apply_callback
    # the returned value is the main GtkVBox of the window,
    #we can add what you want in it.

    bconf = gcompris.configuration_window ( \
      _('<b>{config}</b> configuration\n for profile <b>{profile}</b>').format( \
                        config='Pythontest',
                        # This is the name of the Default user profile
                        profile=profile.name if profile else _("Default")),
      self.ok_callback
      )

    # toggle box
    control_line = gcompris.boolean_box(bconf, _('Disable line drawing in circle'),
                                        'disable_line',
                                        eval(self.config_dict['disable_line'])
                                        )
    # sample of control in python
    control_line.connect("toggled", self.color_disable)

    # combo box
    self.color_choice = \
       gcompris.combo_box(bconf, _('Color of the line'),
                          self.config_colors_list,
                          'color_line',
                          self.config_dict['color_line']
                          )
    self.color_choice.set_sensitive(not eval(self.config_dict['disable_line']))

    gcompris.separator(bconf)

    #spin button for int
    self.distance_box = \
       gcompris.spin_int(bconf, _('Distance between circles'),
                         'distance_circle',
                         20,
                         200,
                         20,
                         eval(self.config_dict['distance_circle'])
                         )

    gcompris.separator(bconf)

    #radio buttons for circle or rectangle
    patterns = { 'circle': _('Use circles'),
                 'rectangle': _('Use rectangles')
                 }

    # FIXME radio button makes the configuration unstable
    #       the problem is perhaps in the C code but since
    #       no one use it, let's forget it for now.
    # gcompris.radio_buttons(bconf, _('Choice of pattern'),
    #                        'pattern',
    #                        patterns,
    #                        self.config_dict['pattern']
    #                        )

    print "List of locales shown in gcompris.combo_locale :"
    print gcompris.get_locales_list()

    gcompris.separator(bconf)

    gcompris.combo_locales(bconf, self.config_dict['locale'])

    gcompris.separator(bconf)

    print "List of locales shown in gcompris.combo_locales_asset :"
    locales_purple = gcompris.get_locales_asset_list( "purple.ogg" )
    print locales_purple

    gcompris.combo_locales_asset(bconf, _("Select sound locale"),
                                 self.config_dict['locale_sound'],
                                 "voices/$LOCALE/colors/red.ogg")
예제 #2
0
  def config_start(self, profile):
    # keep profile in mind
    # profile can be Py_None
    self.configuring_profile = profile

    # init with default values
    self.config_dict = self.init_config()

    #get the configured values for that profile
    self.config_dict.update(gcompris.get_conf(profile, self.gcomprisBoard))

    # Init configuration window:
    # all the configuration functions will use it
    # all the configuration functions returns values for their key in
    # the dict passed to the apply_callback
    # the returned value is the main GtkVBox of the window,
    #we can add what you want in it.

    bconf = gcompris.configuration_window ( \
      _('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Pythontest', profile.name ),
      self.ok_callback
      )

    # toggle box
    control_line = gcompris.boolean_box(bconf, _('Disable line drawing in circle'),
                                        'disable_line',
                                        eval(self.config_dict['disable_line'])
                                        )
    # sample of control in python
    control_line.connect("toggled", self.color_disable)

    # combo box
    self.color_choice = \
       gcompris.combo_box(bconf, _('Color of the line'),
                          self.config_colors_list,
                          'color_line',
                          self.config_dict['color_line']
                          )
    self.color_choice.set_sensitive(not eval(self.config_dict['disable_line']))

    gcompris.separator(bconf)

    #spin button for int
    self.distance_box = \
       gcompris.spin_int(bconf, _('Distance between circles'),
                         'distance_circle',
                         20,
                         200,
                         20,
                         eval(self.config_dict['distance_circle'])
                         )

    gcompris.separator(bconf)

    #radio buttons for circle or rectangle
    patterns = { 'circle': _('Use circles'),
                 'rectangle': _('Use rectangles')
                 }

    gcompris.radio_buttons(bconf, _('Choice of pattern'),
                           'pattern',
                           patterns,
                           self.config_dict['pattern']
                           )

    print "List of locales shown in gcompris.combo_locale :"
    print gcompris.get_locales_list()

    gcompris.separator(bconf)

    gcompris.combo_locales(bconf, self.config_dict['locale'])

    gcompris.separator(bconf)

    print "List of locales shown in gcompris.combo_locales_asset :"
    locales_purple = gcompris.get_locales_asset_list( "gcompris colors", None, "audio/x-ogg", "purple.ogg")
    print locales_purple

    label = gtk.Label()
    label.set_markup('<i>-- unused, but here for test --</i>')
    label.props.visibility = goocanvas.ITEM_VISIBLE
#    self.main_vbox.pack_start (label, False, False, 8)

    gcompris.combo_locales_asset(bconf, _("Select sound locale"),
                                 self.config_dict['locale_sound'],
                                 "voices/$LOCALE/colors/red.ogg" )

    print gcompris.utils.get_asset_file ("gcompris colors", None, "audio/x-ogg", "purple.ogg")
    print gcompris.utils.get_asset_file_locale ("gcompris colors", None, "audio/x-ogg", "purple.ogg", None)
    for lang in locales_purple:
      print gcompris.utils.get_asset_file_locale ("gcompris colors", None, "audio/x-ogg", "purple.ogg", lang)