コード例 #1
0
  def start(self):
    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.bar_location(300,-1,0.6)
    gcompris.bar_set_level(self.gcomprisBoard)

    #REPEAT ICON
    pixmap = gcompris.utils.load_svg("braille_alphabets/target.svg")
    gcompris.bar_set_repeat_icon(pixmap)
    gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
    gcompris.bar_location(300,-1,0.7)

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.root = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())
    #To create a group item for horizontal and vertical text
    self.horizontalTextRoot = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())
    self.verticalTextRoot = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())

    #Display the sublevel
    gcompris.score.start(gcompris.score.STYLE_NOTE, 530, 460,
                         self.gcomprisBoard.number_of_sublevel)
    gcompris.score.set(self.gcomprisBoard.sublevel)

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "braille_fun/hillside.svg")

    self.display_game(self.gcomprisBoard.level)
コード例 #2
0
ファイル: intro_gravity.py プロジェクト: GNOME/gcompris
  def game(self):
    self.game_completed = False

    self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item())

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                           "intro_gravity/background.png")

    # Load planet on the left (saturn) and it's slider
    planet_left = Fixed_planet(self.rootitem,
                                    70, 200, "saturn.png")
    Slider(self.rootitem, self, 20, 200, planet_left)

    # Planet on right (neptune) and it's slider
    planet_right = Fixed_planet(self.rootitem,
                                     680, 200, "neptune.png")
    Slider(self.rootitem, self, 780, 200, planet_right)

    # Load the tux_ship
    self.ship_instance = Spaceship(self, self.rootitem,
                              gcompris.BOARD_WIDTH/2.0, 200,
                              self.gcomprisBoard.level,
                              planet_left,
                              planet_right)
    # Set the buttons we want in the bar
    gcompris.bar_set(0)
    gcompris.bar_location(2,-1,0.5)

    # Message button
    self.message = Message(self.rootitem, 400, 320, 20, self.tuto_event)

    self.tuto_step = 0
    self.tutorial(self.tuto_step)
コード例 #3
0
    def set_sublevel(self, sublevel=1):
        """Start of the game at sublevel number sublevel of level n"""

        if self.MAX != 0:
            self.end()

        #Creation of canvas group use by the activity
        self.ROOT = \
        goocanvas.Group(
          parent = self.gcomprisBoard.canvas.get_root_item(),
          )

        #Setting of the first background image of the level
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                self.data[sublevel - 1].img1)

        #Initialisation of sub-elements in list
        self.POINT = []
        self.actu = 0

        #Display actual sublevel and number of sublevel of this level
        self.gcomprisBoard.sublevel = sublevel
        self.gcomprisBoard.number_of_sublevel = len(self.data)

        #Display of score
        gcompris.score.start(gcompris.score.STYLE_NOTE, 10, 485,
                             self.gcomprisBoard.number_of_sublevel)
        gcompris.score.set(self.gcomprisBoard.sublevel)

        #Set point number 0 from which the draw start. This point is equal to first one.
        self.MAX = len(self.data[sublevel - 1].points)
        self.POINT.append(
            self.point(self.data[sublevel - 1].points[0][0],
                       self.data[sublevel - 1].points[0][1]))
        self.POINT[0].props.visibility = goocanvas.ITEM_INVISIBLE

        #Data loading from global data and display of points and numbers
        i = self.MAX
        prev_point = None
        for i in range(0, self.MAX):
            diameter = 0
            if self.gcomprisBoard.level == 1:
                diameter = 45
            elif self.gcomprisBoard.level == 2:
                diameter = 30
            else:
                diameter = 20

            point = self.point(self.data[sublevel - 1].points[i][0],
                               self.data[sublevel - 1].points[i][1], diameter)
            self.POINT.append(point)
            self.POINT[i + 1].connect('button_press_event', self.action, i + 1)

            # Setting of display level to prevent covering a point with another point which
            # cause an impossibility to select it.
            self.POINT[i + 1].lower(prev_point)
            prev_point = self.POINT[i + 1]

        #Setting color of the first point to blue instead of green
        self.POINT[1].set_properties(fill_color_rgba=0x003DF5D0)
コード例 #4
0
    def action(self, objet, truc, idpt):
        """Action to do at each step during normal execution of the game"""
        if truc.type == gtk.gdk.BUTTON_PRESS:
            if idpt == (
                    self.actu + 1
            ):  #Action to execute if the selected point is the following of previous one
                xd, yd, xa, ya = self.POINT[(idpt - 1)].x, self.POINT[(
                    idpt - 1)].y, self.POINT[idpt].x, self.POINT[idpt].y
                item = self.ROOT.add(gnomecanvas.CanvasLine,
                                     points=(xd, yd, xa, ya),
                                     fill_color='black',
                                     width_units=1.5)

                if idpt == 2:  # Always raise the first point
                    self.POINT[self.MAX].raise_to_top()
                    self.TEXT[self.MAX].raise_to_top()

                self.POINT[idpt].hide()
                self.TEXT[idpt].hide()
                if idpt == self.MAX:  #Action to execute if all points have been selected in good way
                    gcompris.set_background(
                        self.ROOT,
                        self.data[self.gcomprisBoard.sublevel][0][2])
                    self.gamewon = 1
                    self.timeout = gobject.timeout_add(
                        1500, self.lauch_bonus
                    )  # The level is complete -> Bonus display

                else:  #Action to execute if the selected point isn't the last one of this level
                    #self.POINT[(idpt+1)].set(fill_color='blue') #Set color in blue to next point. Too easy ???
                    self.actu = self.actu + 1  #self.actu update to set it at actual value of selected point
コード例 #5
0
    def game(self):
        self.game_completed = False

        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        # Set a background image
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "intro_gravity/background.png")

        # Load planet on the left (saturn) and it's slider
        planet_left = Fixed_planet(self.rootitem, 70, 200, "saturn.png")
        Slider(self.rootitem, self, 20, 200, planet_left)

        # Planet on right (neptune) and it's slider
        planet_right = Fixed_planet(self.rootitem, 680, 200, "neptune.png")
        Slider(self.rootitem, self, 780, 200, planet_right)

        # Load the tux_ship
        self.ship_instance = Spaceship(self, self.rootitem,
                                       gcompris.BOARD_WIDTH / 2.0, 200,
                                       self.gcomprisBoard.level, planet_left,
                                       planet_right)
        # Set the buttons we want in the bar
        gcompris.bar_set(0)
        gcompris.bar_location(2, -1, 0.5)

        # Message button
        self.message = Message(self.rootitem, 400, 320, 20, self.tuto_event)

        self.tuto_step = 0
        self.tutorial(self.tuto_step)
コード例 #6
0
  def start(self):
    # Set the buttons we want in the bar
    gcompris.bar_set (0)

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "louis_braille/background.svgz")

    #Initialize variables
    self.won = 0
    self.counter = 0
    self.gamewon = 0
    self.item = 0

    self.groupitem_array = []
    self.coorditem_array = []

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.

    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())


    self.read_data()
    self.display_game(self.gcomprisBoard.level)
コード例 #7
0
  def start(self):
    print "intro_gravity start"

    # Set the buttons we want in the bar
    gcompris.bar_set(0)


    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())
    
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),"intro_gravity/solar_system.svgz")

    svghandle = gcompris.utils.load_svg("intro_gravity/solar_system.svgz")
    self.selection = goocanvas.Svg(
      parent = self.rootitem,
      svg_handle = svghandle,
      svg_id = "#selected"
      )
      
    self.selection.connect("button_press_event", self.game)
    gcompris.utils.item_focus_init(self.selection, None)
    
    self.text = goocanvas.Text(parent=self.rootitem,
      x = 400,
      y = 400,
      fill_color = "yellow",
      font = gcompris.skin.get_font("gcompris/title"),
      text = _("The Solar System"))
コード例 #8
0
  def dicey_dicey1(self):
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "dicey_dicey/dice_area.svg")
      goocanvas.Text(parent = self.rootitem,
                     x=300.0,
                     y=358.0,
                     text = _("Choose an operator to indicate the question mark"),
                     anchor = gtk.ANCHOR_CENTER,
                     font='SANS 12')

      #Display operator images
      self.cell = []
      for index in range(4):
          Item = goocanvas.Image(parent = self.rootitem,
                         pixbuf = gcompris.utils.load_pixmap("dicey_dicey/cube.svg"),
                         x=48 * (2*index + 5),
                         y=380
                         )
          self.cell.append(Item)

          gcompris.utils.item_focus_init(Item,None)
          if(SYMBOL[index] == '+'):
              COLOR_LIST = PLUS_COLOR_ON
              self.braille_math_symbol(index,COLOR_LIST)
          elif(SYMBOL[index] == '_'):
              COLOR_LIST = MINUS_COLOR_ON
              self.braille_math_symbol(index,COLOR_LIST)
          elif(SYMBOL[index] == '*'):
              COLOR_LIST = MULT_COLOR_ON
              self.braille_math_symbol(index,COLOR_LIST)
          elif(SYMBOL[index] == '/'):
              COLOR_LIST = DIV_COLOR_ON
              self.braille_math_symbol(index,COLOR_LIST)
      for index in range(4):
          self.cell[index].connect("button_press_event",self.symbol_identify,index)
コード例 #9
0
  def action(self, objet, target, truc, idpt):
    """Action to do at each step during normal execution of the game"""
    if truc.type == gtk.gdk.BUTTON_PRESS :
      if idpt == (self.actu+1): #Action to execute if the selected point is the following of previous one
        xd,yd,xa,ya = self.POINT[(idpt-1)].x, self.POINT[(idpt-1)].y, self.POINT[idpt].x, self.POINT[idpt].y
        goocanvas.Polyline(
          parent = self.ROOT,
          points = goocanvas.Points([(xd,yd), (xa,ya)]),
          fill_color = 'black',
          line_cap = cairo.LINE_CAP_ROUND,
          line_width = 2)

        if idpt == 2: # Always raise the first point
          self.POINT[self.MAX].raise_(None)

        objet.props.visibility = goocanvas.ITEM_INVISIBLE
        if idpt==self.MAX : #Action to exectute if all points have been selected in good way
          gcompris.set_background(self.ROOT,
                                  self.data[self.gcomprisBoard.sublevel][0][2])
          self.gamewon = 1
          gcompris.bar_hide(True)
          self.timeout = gobject.timeout_add(1500, self.lauch_bonus) # The level is complete -> Bonus display

        else : # Action to execute if the selected point isn''t the last one of this level
          # Set color in blue to next point. Too easy ???
          self.POINT[(idpt+1)].set_properties(fill_color_rgba=0x003DF5D0)
          self.actu = self.actu+1 #self.actu update to set it at actual value of selected point
コード例 #10
0
ファイル: MorseLearn.py プロジェクト: pcakapratibha/morse
  def start(self):
   
    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL)

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "morse/morse.png")
    
    self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item())
    
    for i in ascii_uppercase:
      if i < "E":
        rect = MorseDes(self.rootitem,self.xaxis1,self.yaxis,100,True,False,"rectangle",self.on,self.off,"brown","black",i,"A")
        self.xaxis1 = self.xaxis1 + self.space

      if "E" < i and i <= "J":
        rect = MorseDes(self.rootitem,self.xaxis2,self.yaxis+70,100,True,False,"rectangle",self.on,self.off,"brown","black",i,"B")
        self.xaxis2 = self.xaxis2 + self.space
    self.w = gtk.Button ("Start Animation")
    self.rootitem.add_child(self.w)

    gcompris.bar_set(0)
    gcompris.bar_location(5,-1, 0.6)
    gcompris.bar_set_level(self.gcomprisBoard)
コード例 #11
0
ファイル: drawnumber.py プロジェクト: laya/gcompris-1
    def action(self, objet, target, truc, idpt):
        """Action to do at each step during normal execution of the game"""
        if truc.type == gtk.gdk.BUTTON_PRESS:
            if idpt == (
                    self.actu + 1
            ):  #Action to execute if the selected point is the following of previous one
                xd, yd, xa, ya = self.POINT[(idpt - 1)].x, self.POINT[(
                    idpt - 1)].y, self.POINT[idpt].x, self.POINT[idpt].y
                item = goocanvas.Polyline(parent=self.ROOT,
                                          points=goocanvas.Points([(xd, yd),
                                                                   (xa, ya)]),
                                          stroke_color='black',
                                          line_cap=cairo.LINE_CAP_ROUND,
                                          line_width=1.5)

                if idpt == 2:  # Always raise the first point
                    self.POINT[self.MAX].raise_(None)
                    self.TEXT[self.MAX].raise_(None)

                self.POINT[idpt].props.visibility = goocanvas.ITEM_INVISIBLE
                self.TEXT[idpt].props.visibility = goocanvas.ITEM_INVISIBLE
                if idpt == self.MAX:  #Action to execute if all points have been selected in good way
                    gcompris.set_background(
                        self.ROOT,
                        self.data[self.gcomprisBoard.sublevel - 1].img2)
                    self.gamewon = 1
                    gcompris.bar_hide(True)
                    self.timeout = gobject.timeout_add(
                        1500, self.lauch_bonus
                    )  # The level is complete -> Bonus display

                else:  #Action to execute if the selected point isn''t the last one of this level
                    #Set color in blue to next point. Too easy ???
                    #self.POINT[(idpt+1)].set_properties(fill_color_rgba=0x003DF5F0)
                    self.actu = self.actu + 1  #self.actu update to set it at actual value of selected point
コード例 #12
0
ファイル: algorithm.py プロジェクト: GNOME/gcompris
  def start(self):
    gcompris.bar_set (0)
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "algorithm/scenery5_background.png")
    self.gcomprisBoard.level=1
    self.gcomprisBoard.sublevel=1
    self.gcomprisBoard.number_of_sublevel=5
    self.gcomprisBoard.maxlevel = 1

    self.symbollist = ["algorithm/apple.png",
                       "algorithm/strawberry.png",
                       "algorithm/peer.png",
                       "algorithm/football.png",
                       "algorithm/cerise.png",
                       "algorithm/egg.png",
                       "algorithm/glass.png",
                       "algorithm/eggpot.png"]
    self.pixlist = []
    for i in range (len(self.symbollist)):
     pixbuf2 = gcompris.utils.load_pixmap(self.symbollist [i])
     h2 = 60
     w2 = pixbuf2.get_width()*h2/pixbuf2.get_height()
     self.pixlist.append (pixbuf2.scale_simple(w2, h2, gtk.gdk.
      INTERP_BILINEAR))
     del pixbuf2
    self.display_current_level()
コード例 #13
0
    def start(self):
        self.board_paused = False
        self.game_start = False
        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains
        # automaticaly.
        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())
        land_rootitem = goocanvas.Group(parent=self.rootitem)

        # Set a background image
        level = str(self.gcomprisBoard.level)
        image = 'land_safe/background' + level + '.jpg'
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                image)

        #Set the land
        image = 'land_safe/land' + str(level) + '.png'
        pixbuf = gcompris.utils.load_pixmap(image)
        land = goocanvas.Image(parent=land_rootitem,
                               pixbuf=pixbuf,
                               x=-550,
                               y=gcompris.BOARD_HEIGHT - 125)
        land.lower(None)

        # Text for Gravity
        gravity = str(0.58 * self.gcomprisBoard.level)
        text = _('Gravity: %s') % (gravity)
        gravity_text = goocanvas.Text(parent=self.rootitem,
                                      x=760,
                                      y=50,
                                      fill_color="white",
                                      anchor=gtk.ANCHOR_E,
                                      alignment=pango.ALIGN_CENTER,
                                      text=_(text))
        bounds = gravity_text.get_bounds()
        gap = 20

        gravity_back = goocanvas.Rect(parent=self.rootitem,
                                      radius_x=6,
                                      radius_y=6,
                                      x=bounds.x1 - gap,
                                      y=bounds.y1 - gap,
                                      width=bounds.x2 - bounds.x1 + gap * 2,
                                      height=bounds.y2 - bounds.y1 + gap * 2,
                                      stroke_color_rgba=0xFFFFFFFFL,
                                      fill_color_rgba=0xCCCCCC44L)

        # Load spaceship
        self.space_ship = Spaceship(self, self.rootitem, land_rootitem,
                                    self.gcomprisBoard.level)

        gcompris.bar_set_level(self.gcomprisBoard)

        # Set the buttons we want in the bar
        gcompris.bar_set(gcompris.BAR_LEVEL)
        gcompris.bar_location(2, -1, 0.5)

        self.ready_button(self.rootitem)
コード例 #14
0
ファイル: drawnumber.py プロジェクト: MkPereira/gcompris
  def set_sublevel(self,sublevel=1) :
    """Start of the game at sublevel number sublevel of level n"""
    if self.MAX!=0 :
      self.end()

    # Setting of the first background image of the sublevel
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            self.data[sublevel-1].img1)

    # Creation of canvas group use by the activity
    self.ROOT = \
      goocanvas.Group(
        parent = self.gcomprisBoard.canvas.get_root_item(),
      )

    #Initialisation of sub-elements in list
    self.POINT=[]
    self.TEXT=[]
    self.actu=0

    #Display actual sublevel and number of sublevel of this level
    self.gcomprisBoard.sublevel = sublevel
    self.gcomprisBoard.number_of_sublevel = len(self.data)
    #Display of score
    gcompris.score.start(gcompris.score.STYLE_NOTE, 10, 485,
                         self.gcomprisBoard.number_of_sublevel)
    gcompris.score.set(self.gcomprisBoard.sublevel)

    # Set point number 0 from which the draw start. This point is equal to first one.
    self.POINT.append( self.point(self.data[sublevel-1].points[0][0],
                                  self.data[sublevel-1].points[0][1]) )
    self.POINT[0].props.visibility = goocanvas.ITEM_INVISIBLE
    self.TEXT.append(None)
    self.MAX = len( self.data[sublevel-1].points )

    # Data loading from global data and display of points and numbers
    prev_text = None
    prev_point = None
    for i in range(0, self.MAX):
      point = self.point(self.data[sublevel-1].points[i][0],
                         self.data[sublevel-1].points[i][1])
      self.POINT.append( point )
      self.POINT[i+1].connect('button_press_event', self.action, i+1)

      text = self.text(i + 1,
                       self.data[sublevel-1].points[i][0],
                       self.data[sublevel-1].points[i][1])
      self.TEXT.append( text )
      self.TEXT[i+1].connect('button_press_event', self.action, i+1)

      # Setting of display level to prevent covering a point with another point which
      # cause an impossibility to select it.
      self.TEXT[i+1].lower(prev_point)
      prev_text = self.TEXT[i+1]
      self.POINT[i+1].lower(prev_text)
      prev_point = self.POINT[i+1]

    #Setting color of the first point to blue instead of green
    self.POINT[1].set_properties(fill_color_rgba=0x003DF5D0)
コード例 #15
0
  def set_sublevel(self,sublevel=1):
    """Start of the game at sublevel number sublevel of level n"""

    if self.MAX!=0 :
      self.end()

    #Creation of canvas group use by the activity
    self.ROOT=self.gcomprisBoard.canvas.root().add(
      gnomecanvas.CanvasGroup,
      x=0.0,
      y=0.0
      )

    #Setting of the first background image of the level
    gcompris.set_background(self.gcomprisBoard.canvas.root(),
                            self.data[sublevel][0][1])

    #Initialisation of sub-elements in list
    self.POINT=[0]
    self.actu=0

    #Display actual sublevel and number of sublevel of this level
    self.gcomprisBoard.sublevel=sublevel
    self.gcomprisBoard.number_of_sublevel=len(self.data)
    #Display of score
    gcompris.score.start(gcompris.score.STYLE_NOTE, 10, 485,self.gcomprisBoard.number_of_sublevel)
    gcompris.score.set(self.gcomprisBoard.sublevel)

    #Set point number 0 from which the draw start. This point is equal to first one.
    self.MAX=self.data[sublevel][0][0]
    self.POINT[0]=self.point(0,self.data[sublevel][self.MAX][0],self.data[sublevel][self.MAX][1],30)
    self.POINT[0].hide()

    #Data loading from global data and display of points and numbers
    i=self.MAX
    while(i>0):
      if self.gcomprisBoard.level==1 :
        self.POINT.append(self.point(idpt=(self.MAX-i+1),
                                     x=self.data[sublevel][i][0],
                                     y=self.data[sublevel][i][1],d=45))
      elif self.gcomprisBoard.level==2 :
        self.POINT.append(self.point(idpt=(self.MAX-i+1),
                                     x=self.data[sublevel][i][0],
                                     y=self.data[sublevel][i][1],d=30))
      else :
        self.POINT.append(self.point(idpt=(self.MAX-i+1),
                                     x=self.data[sublevel][i][0],
                                     y=self.data[sublevel][i][1],d=20))

      self.POINT[(self.MAX-i+1)].connect('event',self.action,(self.MAX-i+1))

      #Setting of display level to prevent from covert a point with another
      #point which cause an impossibility to select it.
      self.POINT[(self.MAX-i+1)].lower(300-(self.MAX-i+1))
      i=i-1

    #Setting color of the first point to blue instead of green
    self.POINT[1].set(fill_color='blue')
コード例 #16
0
ファイル: land_safe.py プロジェクト: jamesthechamp/GCompris
    def start(self):
        self.board_paused = False
        self.game_start = False
        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains
        # automaticaly.
        self.rootitem = goocanvas.Group(parent=self.gcomprisBoard.canvas.get_root_item())
        land_rootitem = goocanvas.Group(parent=self.rootitem)

        # Set a background image
        level = str(self.gcomprisBoard.level)
        image = "land_safe/background" + level + ".jpg"
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(), image)

        # Set the land
        image = "land_safe/land" + str(level) + ".png"
        pixbuf = gcompris.utils.load_pixmap(image)
        land = goocanvas.Image(parent=land_rootitem, pixbuf=pixbuf, x=-550, y=gcompris.BOARD_HEIGHT - 125)
        land.lower(None)

        # Text for Gravity
        gravity = str(0.58 * self.gcomprisBoard.level)
        text = _("Gravity: %s") % (gravity)
        gravity_text = goocanvas.Text(
            parent=self.rootitem,
            x=760,
            y=50,
            fill_color="white",
            font=gcompris.skin.get_font("gcompris/board/small"),
            anchor=gtk.ANCHOR_E,
            alignment=pango.ALIGN_CENTER,
            text=_(text),
        )
        bounds = gravity_text.get_bounds()
        gap = 20

        gravity_back = goocanvas.Rect(
            parent=self.rootitem,
            radius_x=6,
            radius_y=6,
            x=bounds.x1 - gap,
            y=bounds.y1 - gap,
            width=bounds.x2 - bounds.x1 + gap * 2,
            height=bounds.y2 - bounds.y1 + gap * 2,
            stroke_color_rgba=0xFFFFFFFFL,
            fill_color_rgba=0xCCCCCC44L,
        )

        # Load spaceship
        self.space_ship = Spaceship(self, self.rootitem, land_rootitem, self.gcomprisBoard.level)

        gcompris.bar_set_level(self.gcomprisBoard)

        # Set the buttons we want in the bar
        gcompris.bar_set(gcompris.BAR_LEVEL)
        gcompris.bar_location(2, -1, 0.5)

        self.ready_button(self.rootitem)
コード例 #17
0
ファイル: encryption.py プロジェクト: laya/GCompris
 def base_setup(self):
   gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(), "encryption/background.jpg")
   gcompris.bar_set(gcompris.BAR_LEVEL)
   gcompris.bar_set_level(self.gcomprisBoard)
   gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
   gcompris.bar_location(630, -1, 0.5)
   p = key_value(self.rootitem, self.VALUE)
   self.display_arrow()
   self.display_images(p.get_pair())
コード例 #18
0
  def newGame(self):
    self.cleanup()

    width_ref = 256

    scale = self.scales[self.gcomprisBoard.sublevel-1]

    self.last_played = -1
    self.finished_sublevel = False
    self.game_won = False
    self.list_win = self.calculate_win_places()


    # Create root item canvas for the board
    self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item())

    # background
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            backgrounds[self.gcomprisBoard.level - 1])

    self.profbutton.set_prof(profs[self.gcomprisBoard.level - 1])

    for i in range(self.board_size[self.gcomprisBoard.sublevel-1]):
      self.holes.append(self.hole(self,
                                  self.rootitem,
                                  i * width_ref * scale,
                                  gcompris.BOARD_HEIGHT - 140, i,
                                  self.board_size[self.gcomprisBoard.sublevel-1],
                                  scale))

    for i in range(self.number_balls[self.gcomprisBoard.sublevel-1][1]):
      self.balls.append(self.ball(self.rootitem,
                                  i * width_ref * scale + 150,
                                  gcompris.BOARD_HEIGHT - 200,
                                  scale,
                                  self.pixmap_blue_ball))
      self.balls.append(self.ball(self.rootitem,
                                  i * width_ref * scale +150,
                                  gcompris.BOARD_HEIGHT-90,
                                  scale,
                                  self.pixmap_green_ball))

    self.answer.set_number_of_balls(self.number_balls[self.gcomprisBoard.sublevel-1])

    # The OK Button
    item = goocanvas.Svg(parent = self.rootitem,
                         svg_handle = gcompris.skin.svg_get(),
                         svg_id = "#OK"
                         )
    item.translate(item.get_bounds().x1 * -1
                   + gcompris.BOARD_WIDTH - (item.get_bounds().x2 - item.get_bounds().x1) - 10,
                   item.get_bounds().y1 * -1
                   + gcompris.BOARD_HEIGHT - 230)

    item.connect("button_press_event", self.ok_event)
    gcompris.utils.item_focus_init(item, None)
コード例 #19
0
  def start(self):

    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.bar_location(-1,-1,0.8)
    # Set a background image
    gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())

    #set background
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "dice_area.svg")

    gcompris.score.start(gcompris.score.STYLE_NOTE, 570, 490,
                         self.gcomprisBoard.number_of_sublevel)
    gcompris.bar_set_level(self.gcomprisBoard)
    gcompris.score.set(self.gcomprisBoard.sublevel)

    #Display title of activity
    goocanvas.Text(parent = self.rootitem,
                   x=400.0,
                   y=100.0,
                   text="Dicey - Dicey",
                   fill_color="black",
                   anchor = gtk.ANCHOR_CENTER,
                   alignment = pango.ALIGN_CENTER,
                   font = 'SANS 20'
                   )
    goocanvas.Text(parent = self.rootitem,
                   x=280.0,
                   y=200.0,
                   text="___",
                   anchor = gtk.ANCHOR_CENTER,
                   font='SANS 25')
    goocanvas.Text(parent = self.rootitem,
                   x=520.0,y=200.0,
                   text="=",
                   anchor = gtk.ANCHOR_CENTER,
                   font='SANS 25')
    goocanvas.Text(parent = self.rootitem,
                   x=650.0,y=300.0,
                   text="___",
                   anchor = gtk.ANCHOR_CENTER,
                   font='SANS 25')
    goocanvas.Text(parent = self.rootitem,
                   x=350.0,y=352.0,
                   text="Choose an operator to begin",
                   anchor = gtk.ANCHOR_CENTER,
                   font='SANS 15')
    self.display_function(self.gcomprisBoard.level)
コード例 #20
0
ファイル: intro_gravity.py プロジェクト: serah/GCompris
  def game(self):
    self.game_completed = False

    self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item())

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                           "intro_gravity/background.svg")

    # Load planet on the left (saturn) and it's slider
    planet_left = Fixed_planet(self.rootitem,
                                    70, 200, "saturn.png")
    Slider(self.rootitem, 20, 200, planet_left)

    # Planet on right (neptune) and it's slider
    planet_right = Fixed_planet(self.rootitem,
                                     680, 200, "neptune.png")
    Slider(self.rootitem, 780, 200, planet_right)

    # Load the tux_ship
    self.ship_instance = Spaceship(self, self.rootitem,
                              gcompris.BOARD_WIDTH/2.0, 200,
                              self.gcomprisBoard.level,
                              planet_left,
                              planet_right)
    # Set the buttons we want in the bar
    gcompris.bar_set(0)
    gcompris.bar_location(2,-1,0.5)

    # Ready button
    self.ready_text = goocanvas.Text(
      parent = self.rootitem,
      x = 395,
      y = 100,
      fill_color = "white",
      anchor = gtk.ANCHOR_CENTER,
      alignment = pango.ALIGN_CENTER,
      text = _("I'm ready") )
    self.ready_text.connect('button_press_event', self.ready_event, False)
    bounds = self.ready_text.get_bounds()
    gap = 20

    self.ready_back = goocanvas.Rect(
      parent = self.rootitem,
      radius_x = 6,
      radius_y = 6,
      x = bounds.x1 - gap,
      y = bounds.y1 - gap,
      width = bounds.x2 - bounds.x1 + gap * 2,
      height = bounds.y2 - bounds.y1 + gap * 2,
      stroke_color_rgba = 0xFFFFFFFFL,
      fill_color_rgba = 0xCCCCCC44L)
    gcompris.utils.item_focus_init(self.ready_back, None)
    gcompris.utils.item_focus_init(self.ready_text, self.ready_back)
    self.ready_back.connect('button_press_event', self.ready_event)
コード例 #21
0
 def start(self):
   self.gcomprisBoard.level=1
   self.gcomprisBoard.maxlevel=9
   self.gcomprisBoard.sublevel=1
   self.gcomprisBoard.number_of_sublevel=1
   gcompris.bar_set(gcompris.BAR_LEVEL)
   gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                           "hexagon/background.svgz")
   gcompris.bar_set_level(self.gcomprisBoard)
   gcompris.bar_location(-1, -1, 0.8)
   self.set_level(1)
   self.game_start()
コード例 #22
0
 def start(self):
   gcompris.bar_set (0)
   gcompris.set_background(self.gcomprisBoard.canvas.root(),
                           gcompris.skin.image_to_skin("gcompris-bg.jpg"))
   self.rootitem = self.gcomprisBoard.canvas.root().add(
    gnomecanvas.CanvasGroup,
    x=0.0,
    y=0.0
    )
   self.paint_skin()
   self.random_catx = random.randrange(21)
   self.random_caty = random.randrange(15)
コード例 #23
0
ファイル: melody.py プロジェクト: MkPereira/gcompris
  def display_current_level(self):

    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            self.melodylist[self.theme][0]['background'])
    gcompris.bar_set_level(self.gcomprisBoard)

    gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains automaticaly.
    self.rootitem = goocanvas.Group(parent =  self.gcomprisBoard.canvas.get_root_item())

    # Put the theme switcher button
    self.switch_item =goocanvas.Image(
      parent = self.rootitem,
      pixbuf = gcompris.utils.load_pixmap("melody/switch.png"),
      x=10,
      y=10
      )
    self.switch_item.connect("button_press_event", self.switch_item_event)
    # This item is clickeable and it must be seen
    gcompris.utils.item_focus_init(self.switch_item, None)


    # Put the sound buttons
    self.sound_list = self.melodylist[self.theme][1]

    for i in self.sound_list:
      self.sound_item =goocanvas.Image(
        parent = self.rootitem,
        pixbuf = gcompris.utils.load_pixmap(i['image']),
        x=i['x'],
        y=i['y']
        )
      self.sound_item.connect("button_press_event", self.sound_item_event, i)
      # This item is clickeable and it must be seen
      gcompris.utils.item_focus_init(self.sound_item, None)


    self.bang_item = goocanvas.Image(
      parent = self.rootitem,
      pixbuf = gcompris.utils.load_pixmap(self.melodylist[self.theme][0]['hittool']),
      )
    self.bang_item.props.visibility = goocanvas.ITEM_INVISIBLE

    self.hitofset_x = self.melodylist[self.theme][0]['hitofset_x']
    self.hitofset_y = self.melodylist[self.theme][0]['hitofset_y']

    self.waitOK(self.rootitem)
コード例 #24
0
    def start(self):

        self.gcomprisBoard.level = 1
        self.gcomprisBoard.maxlevel = 4
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 1

        gcompris.bar_set(gcompris.BAR_OK | gcompris.BAR_LEVEL)

        gcompris.bar_set_level(self.gcomprisBoard)

        gcompris.set_background(self.gcomprisBoard.canvas.root(),
                                "guessnumber/cave.png")

        self.display_game()
コード例 #25
0
ファイル: mosaic.py プロジェクト: GNOME/gcompris
  def start(self):

    self.gcomprisBoard.level=1
    self.gcomprisBoard.maxlevel=6
    self.gcomprisBoard.sublevel=1
    self.gcomprisBoard.number_of_sublevel=1

    gcompris.bar_set(gcompris.BAR_LEVEL)

    gcompris.bar_set_level(self.gcomprisBoard)

    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "mosaic/mosaic_bg.svgz")

    self.display_game()
コード例 #26
0
    def start(self):

        self.gcomprisBoard.level = 1
        self.gcomprisBoard.maxlevel = 6
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 1

        gcompris.bar_set(gcompris.BAR_LEVEL)

        gcompris.bar_set_level(self.gcomprisBoard)

        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "mosaic/mosaic_bg.svgz")

        self.display_game()
コード例 #27
0
ファイル: ballcatch.py プロジェクト: laya/gcompris-1
    def next_level(self):

        # Set the level in the control bar
        gcompris.bar_set_level(self.gcomprisBoard)
        self.init_balloon()
        self.left_continue = True
        self.right_continue = True
        self.counter_left = 0
        self.counter_right = 0
        if self.timer_inc:
            gobject.source_remove(self.timer_inc)
        self.timer_inc = 0

        if (self.gcomprisBoard.level == 1):
            self.timerinc = 900
            gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                    "ballcatch/beach1.svgz")
        elif (self.gcomprisBoard.level == 2):
            self.timerinc = 350
        elif (self.gcomprisBoard.level == 3):
            self.timerinc = 300
            gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                    "ballcatch/beach2.svgz")
        elif (self.gcomprisBoard.level == 4):
            self.timerinc = 200
        elif (self.gcomprisBoard.level == 5):
            self.timerinc = 150
            gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                    "ballcatch/beach3.svgz")
        elif (self.gcomprisBoard.level == 6):
            self.timerinc = 100
        elif (self.gcomprisBoard.level == 7):
            self.timerinc = 60
            gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                    "ballcatch/beach4.svgz")
        elif (self.gcomprisBoard.level == 8):
            self.timerinc = 30
        elif (self.gcomprisBoard.level == 9):
            gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                    "ballcatch/beach4.svgz")
            self.timerinc = 15

        if (self.timerinc < 1):
            self.timerinc = 1

        # Restart the timer
        self.timer_inc = gobject.timeout_add(self.timerinc,
                                             self.timer_inc_display)
コード例 #28
0
ファイル: melody.py プロジェクト: laya/gcompris-1
    def display_current_level(self):

        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                self.melodylist[self.theme][0]['background'])
        gcompris.bar_set_level(self.gcomprisBoard)

        gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)

        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains automaticaly.
        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        # Put the theme switcher button
        self.switch_item = goocanvas.Image(
            parent=self.rootitem,
            pixbuf=gcompris.utils.load_pixmap("melody/switch.png"),
            x=10,
            y=10)
        self.switch_item.connect("button_press_event", self.switch_item_event)
        # This item is clickeable and it must be seen
        gcompris.utils.item_focus_init(self.switch_item, None)

        # Put the sound buttons
        self.sound_list = self.melodylist[self.theme][1]

        for i in self.sound_list:
            self.sound_item = goocanvas.Image(
                parent=self.rootitem,
                pixbuf=gcompris.utils.load_pixmap(i['image']),
                x=i['x'],
                y=i['y'])
            self.sound_item.connect("button_press_event",
                                    self.sound_item_event, i)
            # This item is clickeable and it must be seen
            gcompris.utils.item_focus_init(self.sound_item, None)

        self.bang_item = goocanvas.Image(
            parent=self.rootitem,
            pixbuf=gcompris.utils.load_pixmap(
                self.melodylist[self.theme][0]['hittool']),
        )
        self.bang_item.props.visibility = goocanvas.ITEM_INVISIBLE

        self.hitofset_x = self.melodylist[self.theme][0]['hitofset_x']
        self.hitofset_y = self.melodylist[self.theme][0]['hitofset_y']

        self.waitOK(self.rootitem)
コード例 #29
0
  def start(self):

    self.gcomprisBoard.level=1
    self.gcomprisBoard.maxlevel=4
    self.gcomprisBoard.sublevel=1
    self.gcomprisBoard.number_of_sublevel=1

    gcompris.bar_set(gcompris.BAR_LEVEL)

    gcompris.bar_set_level(self.gcomprisBoard)
    gcompris.bar_location(gcompris.BOARD_WIDTH - 160, -1, 0.7)

    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "guessnumber/cave.png")

    self.display_game()
コード例 #30
0
ファイル: color_mix.py プロジェクト: mouri11/GCompris-gtk
  def start(self):
    self.lost = False
    gcompris.bar_set_level(self.gcomprisBoard)

    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.bar_location(2, -1, 0.5)

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            'color_mix/background.jpg')

    text = goocanvas.Text(
      parent = self.rootitem,
      x = 250,
      y = 80,
      fill_color = "black",
      font = gcompris.skin.get_font("gcompris/subtitle"),
      anchor = gtk.ANCHOR_CENTER,
      width = 150,
      alignment = pango.ALIGN_CENTER,
      text = _("Match the color"))

    # Set the points for the sliders
    c_points = goocanvas.Points( [(242, 210), (130, 175)] )
    m_points = goocanvas.Points( [(390, 352), (390, 470)] )
    y_points = goocanvas.Points( [(548, 208), (665, 175)] )

    colors = Colors(self, self.rootitem, self.gcomprisBoard.level, 255)

    # Pass the points of the buttons and slider for the color tubes
    color1_tube = Color_tubes(self.rootitem, colors, 'cyan_tube.png',
                              1, 80, 120, c_points, 242, 210, 130, 175,
                              self.gcomprisBoard.level, -1)
    color2_tube = Color_tubes(self.rootitem, colors, 'magenta_tube.png',
                              2, 350, 290, m_points, 390, 352, 390, 470,
                              self.gcomprisBoard.level, -1)
    color3_tube = Color_tubes(self.rootitem, colors, 'yellow_tube.png',
                              3, 460, 120, y_points, 548, 208, 665, 175,
                              self.gcomprisBoard.level, -1)
コード例 #31
0
ファイル: color_mix.py プロジェクト: Goumez/GCompris
  def start(self):
    self.lost = False
    gcompris.bar_set_level(self.gcomprisBoard)

    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.bar_location(2, -1, 0.5)

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            'color_mix/background.jpg')

    text = goocanvas.Text(
      parent = self.rootitem,
      x = 250,
      y = 80,
      fill_color = "black",
      font = gcompris.skin.get_font("gcompris/subtitle"),
      anchor = gtk.ANCHOR_CENTER,
      width = 150,
      alignment = pango.ALIGN_CENTER,
      text = _("Match the color "))

    # Set the points for the sliders
    c_points = goocanvas.Points( [(242, 210), (130, 175)] )
    m_points = goocanvas.Points( [(390, 352), (390, 470)] )
    y_points = goocanvas.Points( [(548, 208), (665, 175)] )

    colors = Colors(self, self.rootitem, self.gcomprisBoard.level, 255)

    # Pass the points of the buttons and slider for the color tubes
    color1_tube = Color_tubes(self.rootitem, colors, 'cyan_tube.png',
                              1, 80, 120, c_points, 242, 210, 130, 175,
                              self.gcomprisBoard.level, -1)
    color2_tube = Color_tubes(self.rootitem, colors, 'magenta_tube.png',
                              2, 350, 290, m_points, 390, 352, 390, 470,
                              self.gcomprisBoard.level, -1)
    color3_tube = Color_tubes(self.rootitem, colors, 'yellow_tube.png',
                              3, 460, 120, y_points, 548, 208, 665, 175,
                              self.gcomprisBoard.level, -1)
コード例 #32
0
 def repeat(self):
   if(self.mapActive):
         self.rootitem.props.visibility = goocanvas.ITEM_INVISIBLE
         gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                           "braille_fun/hillside.svg")
         self.root.props.visibility = goocanvas.ITEM_VISIBLE
         self.horizontalTextRoot.props.visibility = goocanvas.ITEM_VISIBLE
         self.verticalTextRoot.props.visibility = goocanvas.ITEM_VISIBLE
         self.mapActive = False
   else :
         self.root.props.visibility = goocanvas.ITEM_INVISIBLE
         self.horizontalTextRoot.props.visibility = goocanvas.ITEM_INVISIBLE
         self.verticalTextRoot.props.visibility = goocanvas.ITEM_INVISIBLE
         self.rootitem = goocanvas.Group(parent=
                                  self.gcomprisBoard.canvas.get_root_item())
         gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
         map_obj = BrailleMap(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
         self.mapActive = True
コード例 #33
0
 def display_function(self,level):
     if(level == 1 or level == 2 or level == 3):
         self.dicey_dicey()
         self.calculate(level)
         gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                           "dicey_dicey/dice.svg")
         ok = goocanvas.Svg(parent = self.rootitem,
                        svg_handle = gcompris.skin.svg_get(),
                        svg_id = "#OK",
                        tooltip = _("Click to confirm your selection of dots")
                        )
         ok.translate(40,-30)
         ok.connect("button_press_event", self.ok_event,level)
         gcompris.utils.item_focus_init(ok, None)
     elif(level == 4 or level == 5 or level == 6):
         self.dicey_dicey()
         self.dicey_dicey1()
         self.calculate(level)
コード例 #34
0
ファイル: color_mix_light.py プロジェクト: GNOME/gcompris
  def start(self):
    gcompris.bar_set_level(self.gcomprisBoard)

    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.bar_location(2, -1, 0.5)

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            'color_mix/background.jpg')

    text = goocanvas.Text(
      parent = self.rootitem,
      x = 250,
      y = 80,
      fill_color = "black",
      font = gcompris.skin.get_font("gcompris/subtitle"),
      anchor = gtk.ANCHOR_CENTER,
      alignment = pango.ALIGN_CENTER,
      text = _("Match the \n color "))

    # Set the points for the sliders
    r_points = goocanvas.Points( [(242, 212), (130, 177)] )
    b_points = goocanvas.Points( [(548, 213), (665, 177)] )
    m_points = goocanvas.Points( [(390, 372), (390, 490)] )

    colors = Colors(self, self.rootitem, self.gcomprisBoard.level, 0)

    # Pass the points of the buttons and slider for the color tubes
    red_tube = Color_tubes(self.rootitem, colors, 'torch_red.png',
                           1, 90, 115, r_points, 232, 210, 120, 175,
                           self.gcomprisBoard.level, 1)
    green_tube = Color_tubes(self.rootitem, colors, 'torch_green.png',
                             2, 265, 265, m_points, 390, 372, 390, 490,
                             self.gcomprisBoard.level, 1)
    blue_tube = Color_tubes(self.rootitem, colors, 'torch_blue.png',
                            3, 462, 115, b_points, 554, 210, 672, 175,
                            self.gcomprisBoard.level, 1)
コード例 #35
0
ファイル: followline.py プロジェクト: GNOME/gcompris
  def start(self):
    self.saved_policy = gcompris.sound.policy_get()
    gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)

    self.gcomprisBoard.level=1
    self.gcomprisBoard.maxlevel=9
    self.gcomprisBoard.sublevel=1
    self.gcomprisBoard.number_of_sublevel=1
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "followline/followline.svgz")
    self.gcomprisBoard.canvas.get_root_item().connect("motion_notify_event",
                                                      self.loosing_item_motion)
    self.gcomprisBoard.canvas.get_root_item().connect("button_press_event",
                                                      self.loosing_item_click)

    gcompris.bar_set_level(self.gcomprisBoard)

    self.init_board()
コード例 #36
0
ファイル: ballcatch.py プロジェクト: laya/GCompris
  def next_level(self):

    # Set the level in the control bar
    gcompris.bar_set_level(self.gcomprisBoard);
    self.init_balloon()
    self.left_continue  = True
    self.right_continue = True
    self.counter_left  = 0
    self.counter_right = 0
    if self.timer_inc:
      gobject.source_remove(self.timer_inc)
    self.timer_inc = 0

    if(self.gcomprisBoard.level == 1):
      self.timerinc = 900
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),"ballcatch/beach1.svgz")
    elif(self.gcomprisBoard.level == 2):
      self.timerinc = 350
    elif(self.gcomprisBoard.level == 3):
      self.timerinc = 300
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),"ballcatch/beach2.svgz")
    elif(self.gcomprisBoard.level == 4):
      self.timerinc = 200
    elif(self.gcomprisBoard.level == 5):
      self.timerinc = 150
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),"ballcatch/beach3.svgz")
    elif(self.gcomprisBoard.level == 6):
      self.timerinc = 100
    elif(self.gcomprisBoard.level == 7):
      self.timerinc = 60
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),"ballcatch/beach4.svgz")
    elif(self.gcomprisBoard.level == 8):
      self.timerinc = 30
    elif(self.gcomprisBoard.level == 9):
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),"ballcatch/beach4.svgz")
      self.timerinc = 15

    if(self.timerinc<1):
      self.timerinc = 1

    # Restart the timer
    self.timer_inc  = gobject.timeout_add(self.timerinc,
                                          self.timer_inc_display)
コード例 #37
0
    def start(self):
        self.saved_policy = gcompris.sound.policy_get()
        gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)

        self.gcomprisBoard.level = 1
        self.gcomprisBoard.maxlevel = 9
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 1
        gcompris.bar_set(gcompris.BAR_LEVEL)
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "followline/followline.svgz")
        self.gcomprisBoard.canvas.get_root_item().connect(
            "motion_notify_event", self.loosing_item_motion)
        self.gcomprisBoard.canvas.get_root_item().connect(
            "button_press_event", self.loosing_item_click)

        gcompris.bar_set_level(self.gcomprisBoard)

        self.init_board()
コード例 #38
0
  def braille_cell(self, level):
      if (level == 6):
          self.letter = "number"
      else :
          self.letter = "alphabet"

      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "braille_alphabets/mosaic.svgz")

      #Translators : Do not translate the token {letter}
      goocanvas.Text(parent = self.rootitem,
                     x = 100,
                     y = 200,
                     text=_("Click on the dots in braille cell area to produce letter {letter}").format(letter = self.random_letter),
                     fill_color="black",
                     font='SANS 15')

      goocanvas.Text(parent=self.rootitem,
                      x=160.0, y=250.0,
                     text=_("Braille Cell"),
                     fill_color="black",
                     font='Sans BOLD')
      BrailleChar(self.rootitem, 150, 270, 120, '',COLOR_ON ,COLOR_OFF,CIRCLE_FILL,CIRCLE_STROKE,
                   False,True,False,callback = self.letter_change , braille_letter = self.letter)
      for i in range(2):
          for j in range(3):
                  goocanvas.Text(parent=self.rootitem,
                                 text=(str(j + 1 + i * 3)),
                                 font='Sans 20',
                                 fill_color="black",
                                 x=i * 120 + 140,
                                 y=j * 45 + 290)

      # OK Button
      ok = goocanvas.Svg(parent = self.rootitem,
                         svg_handle = gcompris.skin.svg_get(),
                         svg_id = "#OK",
                         tooltip = _("Click to confirm your selection of dots")
                         )
      ok.translate( -165,-155)

      ok.connect("button_press_event", self.ok_event)
      gcompris.utils.item_focus_init(ok, None)
コード例 #39
0
ファイル: louis_braille.py プロジェクト: insidevivek/GCompris
  def start(self):
    # Set the buttons we want in the bar
    gcompris.bar_set (0)

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "louis_braille/background.svgz")

    #Initialize variables
    self.won = 0
    self.counter = 0
    self.gamewon = 0
    self.item = 0

    self.groupitem_array = []
    self.coorditem_array = []

    self.read_data()
    self.display_story()
コード例 #40
0
  def game(self,a,b,c):
    gcompris.utils.item_focus_remove(self.selection, None)
    self.text.remove()
    goocanvas.Text(
      parent = self.rootitem,
      x=400.0,
      y=100.0,
      text=_("Mass is directly proportional to gravitational force"),
      font = gcompris.skin.get_font("gcompris/subtitle"),
      fill_color="red",
      anchor = gtk.ANCHOR_CENTER,
      alignment = pango.ALIGN_CENTER
      )

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                           "intro_gravity/background.svg")

    pixbuf = gcompris.utils.load_pixmap("intro_gravity/uranus.png")
    self.mid_planet = goocanvas.Image(
      parent = self.rootitem,
      pixbuf = pixbuf,
      height = 50,
      width = 50,
      x = 375,
      y = 220)


    self.pixbuf_saturn = gcompris.utils.load_pixmap("intro_gravity/saturn.png")
    self.saturn_x = 30
    self.saturn_y = 170
    self.saturn_size = 110
    self.planet_load_saturn(self.saturn_size,self.saturn_x,self.saturn_y)
    
    self.pixbuf_neptune = gcompris.utils.load_pixmap("intro_gravity/neptune.png")
    self.neptune_x = 630
    self.neptune_y = 170
    self.neptune_size= 120
    self.planet_load_neptune(self.neptune_size,self.neptune_x,self.neptune_y)
   
    self.neptune.connect("button_press_event",self.increase_neptune)
    self.saturn.connect("button_press_event",self.increase_saturn)
コード例 #41
0
    def newGame(self):
        self.cleanup()

        width_ref = 256

        scale = self.scales[self.gcomprisBoard.sublevel - 1]

        self.last_played = -1
        self.finished_sublevel = False
        self.game_won = False
        self.list_win = self.calculate_win_places()

        # Create root item canvas for the board
        self.rootitem = self.gcomprisBoard.canvas.root().add(
            gnomecanvas.CanvasGroup, x=0, y=0)

        # background
        gcompris.set_background(self.gcomprisBoard.canvas.root(),
                                backgrounds[self.gcomprisBoard.level - 1])

        self.profbutton.set_prof(profs[self.gcomprisBoard.level - 1])

        for i in range(self.board_size[self.gcomprisBoard.sublevel - 1]):
            self.holes.append(
                self.hole(self, self.rootitem, i * width_ref * scale,
                          gcompris.BOARD_HEIGHT - 120, i,
                          self.board_size[self.gcomprisBoard.sublevel - 1],
                          scale))

        for i in range(self.number_balls[self.gcomprisBoard.sublevel - 1][1]):
            self.balls.append(
                self.ball(self.rootitem, i * width_ref * scale + 150,
                          gcompris.BOARD_HEIGHT - 160, scale,
                          self.pixmap_blue_ball))
            self.balls.append(
                self.ball(self.rootitem, i * width_ref * scale + 150,
                          gcompris.BOARD_HEIGHT - 70, scale,
                          self.pixmap_green_ball))

        self.answer.set_number_of_balls(
            self.number_balls[self.gcomprisBoard.sublevel - 1])
コード例 #42
0
ファイル: computer_parts.py プロジェクト: laya/GCompris
  def start(self):
    print "computer_parts start"

    self.part = None

    # Set the buttons we want in the bar
    gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)

    # Set a background image
    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "computer_parts/background.jpeg")


    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains
    # automaticaly.
    self.rootitem = goocanvas.Group(parent =
                                    self.gcomprisBoard.canvas.get_root_item())

    self.read_data()
    self.render_level()
コード例 #43
0
ファイル: login.py プロジェクト: mouri11/GCompris-gtk
  def start(self):
    self.gcomprisBoard.level=1
    self.gcomprisBoard.maxlevel=1
    self.gcomprisBoard.sublevel=1
    self.gcomprisBoard.number_of_sublevel=1
    gcompris.bar_set(gcompris.BAR_REPEAT|gcompris.BAR_CONFIG)

    gcompris.bar_set_level(self.gcomprisBoard)

    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            backgrounds[self.gcomprisBoard.level-1])

    # Get the default profile
    self.Prop = gcompris.get_properties()

    if not self.Prop:
      return

    # init config to default values
    self.config_dict = self.init_config()

    # change configured values
    self.config_dict.update(gcompris.get_board_conf())

    # Create and Initialize the rootitem.
    self.init_rootitem(self.Prop)

    # Get the user list
    users = []
    if self.Prop.profile:
      for group_id in self.Prop.profile.group_ids:
        users.extend( gcompris.admin.get_users_from_group(group_id))

    self.users = self.check_unique_id(users)

    if eval(self.config_dict['entry_text']):
      self.entry_text()
    else:
      self.display_user_by_letter(self.users, "")
コード例 #44
0
    def start(self):
        self.reseted = False
        # Set the buttons we want in the bar
        gcompris.bar_set(gcompris.BAR_LEVEL)
        gcompris.bar_location(300, -1, 0.6)
        gcompris.bar_set_level(self.gcomprisBoard)

        #REPEAT ICON
        pixmap = gcompris.utils.load_svg("braille_alphabets/target.svg")
        gcompris.bar_set_repeat_icon(pixmap)
        gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT_ICON)
        gcompris.bar_location(300, -1, 0.7)

        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains
        # automaticaly.
        self.root = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())
        #To create a group item for horizontal and vertical text
        self.horizontalTextRoot = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())
        self.verticalTextRoot = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        # The root item for the help
        self.map_rootitem = \
            goocanvas.Group( parent = self.gcomprisBoard.canvas.get_root_item() )
        BrailleMap(self.map_rootitem, self.move_back)
        self.map_rootitem.props.visibility = goocanvas.ITEM_INVISIBLE

        # Display the sublevel
        gcompris.score.start(gcompris.score.STYLE_NOTE, 530, 460,
                             self.gcomprisBoard.number_of_sublevel)

        # Set a background image
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "braille_fun/hillside.svg")

        self.display_game(self.gcomprisBoard.level)
コード例 #45
0
  def braille_cell(self):
      gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                            "mosaic.svgz")

      goocanvas.Text(parent = self.rootitem,
                     x = 100,
                     y = 200,
                     text="Click on the dots in braille cell area to produce letter"
                      + ' '+str(self.random_letter),
                     fill_color="blue",
                     font='SANS 15')

      goocanvas.Text(parent=self.rootitem,
                      x=160.0, y=250.0,
                     text=_("Braille Cell"),
                     fill_color="blue",
                     font='Sans BOLD')
      BrailleChar(self.rootitem, 150, 270, 120, '',on ,off,circle_fill,circle_stroke,
                   False,True,False,callback = self.letter_change)
      for i in range(2):
          for j in range(3):
                  goocanvas.Text(parent=self.rootitem,
                                 text=(str(j + 1 + i * 3)),
                                 font='Sans 20',
                                 fill_color="blue",
                                 x=i * 120 + 140,
                                 y=j * 45 + 290)

      #OK Button
      ok = goocanvas.Svg(parent = self.rootitem,
                         svg_handle = gcompris.skin.svg_get(),
                         svg_id = "#OK",
                         tooltip = "Click to confirm your selection of dots"
                         )
      ok.translate(30,-185)

      ok.connect("button_press_event", self.ok_event)
      gcompris.utils.item_focus_init(ok, None)
コード例 #46
0
ファイル: algorithm.py プロジェクト: laya/gcompris-1
    def start(self):
        gcompris.bar_set(0)
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "algorithm/scenery5_background.png")
        self.gcomprisBoard.level = 1
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 5
        self.gcomprisBoard.maxlevel = 1

        self.symbollist = [
            "algorithm/apple.png", "algorithm/strawberry.png",
            "algorithm/peer.png", "algorithm/football.png",
            "algorithm/cerise.png", "algorithm/egg.png", "algorithm/glass.png",
            "algorithm/eggpot.png"
        ]
        self.pixlist = []
        for i in range(len(self.symbollist)):
            pixbuf2 = gcompris.utils.load_pixmap(self.symbollist[i])
            h2 = 60
            w2 = pixbuf2.get_width() * h2 / pixbuf2.get_height()
            self.pixlist.append(
                pixbuf2.scale_simple(w2, h2, gtk.gdk.INTERP_BILINEAR))
            del pixbuf2
        self.display_current_level()
コード例 #47
0
    def start(self):
        self.saved_policy = gcompris.sound.policy_get()
        gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)

        self.gcomprisBoard.level = 1
        self.gcomprisBoard.maxlevel = 9
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 1
        gcompris.bar_set(gcompris.BAR_LEVEL)
        self.background_item = gcompris.set_background(
            self.gcomprisBoard.canvas.root(), "followline/followline.png")
        self.background_item_connect_id = self.background_item.connect(
            "event", self.loosing_item_event)

        gcompris.bar_set_level(self.gcomprisBoard)

        self.init_board()

        print("Gcompris_followline start.")
コード例 #48
0
ファイル: braille_alphabets.py プロジェクト: laya/gcompris-1
    def display_level(self, level):

        if self.rootitem:
            self.rootitem.remove()

        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())
        self.map_rootitem.raise_(None)

        if (level == 1):
            gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                    "braille_alphabets/braille_tux.svgz")
            goocanvas.Text(parent=self.rootitem,
                           x=385,
                           y=100,
                           fill_color="black",
                           font=gcompris.skin.get_font("gcompris/title"),
                           anchor=gtk.ANCHOR_CENTER,
                           text=_("Braille : Unlocking the Code"))
            # Braille Intro
            text = _(
                "The Braille system is a method that is used by blind people to read and write."
            )
            # Braille Description
            text += "\n" + \
                _("Each Braille character, or cell, is made up of six dot positions, arranged in "
                  "a rectangle containing two columns of three dots each. As seen on the left, each dot "
                  "is referenced by a number from 1 to 6.")
            goocanvas.Text(parent=self.rootitem,
                           x=490,
                           y=280,
                           fill_color="black",
                           font=gcompris.skin.get_font("gcompris/medium"),
                           width=395,
                           anchor=gtk.ANCHOR_CENTER,
                           text=text)

            # TUX svghandle
            svghandle = gcompris.utils.load_svg(
                "braille_alphabets/braille_tux.svgz")
            self.tuxitem = goocanvas.Svg(parent=self.rootitem,
                                         svg_handle=svghandle,
                                         svg_id="#TUX-5",
                                         tooltip=_("I am braille TUX"))
            self.tuxitem.connect("button_press_event", self.next_level)
            gcompris.utils.item_focus_init(self.tuxitem, None)

            goocanvas.Text(parent=self.rootitem,
                           x=445,
                           y=475,
                           fill_color="black",
                           font=gcompris.skin.get_font("gcompris/board/tiny"),
                           anchor=gtk.ANCHOR_CENTER,
                           width=355,
                           text=_(
                               "When you are ready, click on "
                               "me and try reproducing Braille characters."))
        elif (level == 2):
            self.show_play_button()
            chars = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
            self.gcomprisBoard.number_of_sublevel = len(chars)
            if self.gcomprisBoard.sublevel == 1:
                self.chars_shuffled = list(chars)
                random.shuffle(self.chars_shuffled)
            self.board_tile(chars)
            self.random_letter = self.chars_shuffled[
                self.gcomprisBoard.sublevel - 1]
            self.braille_cell(level)

        elif (level == 3):
            self.show_play_button()
            chars = ['K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T']
            self.gcomprisBoard.number_of_sublevel = len(chars)
            if self.gcomprisBoard.sublevel == 1:
                self.chars_shuffled = list(chars)
                random.shuffle(self.chars_shuffled)
            self.board_tile(chars)
            self.random_letter = self.chars_shuffled[
                self.gcomprisBoard.sublevel - 1]
            self.braille_cell(level)

        elif (level == 4):
            self.show_play_button()
            chars = ['U', 'V', 'X', 'Y', 'Z', 'W']
            self.gcomprisBoard.number_of_sublevel = len(chars)
            if self.gcomprisBoard.sublevel == 1:
                self.chars_shuffled = list(chars)
                random.shuffle(self.chars_shuffled)
            self.board_tile(chars)
            self.random_letter = self.chars_shuffled[
                self.gcomprisBoard.sublevel - 1]
            self.braille_cell(level)

        elif (level == 5):
            self.show_play_button()
            chars = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
            self.gcomprisBoard.number_of_sublevel = len(chars)
            if self.gcomprisBoard.sublevel == 1:
                self.chars_shuffled = list(chars)
                random.shuffle(self.chars_shuffled)
            self.board_number()
            self.random_letter = self.chars_shuffled[
                self.gcomprisBoard.sublevel - 1]
            self.braille_cell(level)
コード例 #49
0
ファイル: findit.py プロジェクト: laya/gcompris-1
    def play(self, datasetlevel):
        # Set a background image if it has changed
        if self.current_background != datasetlevel.background:
            gcompris.set_background(
                self.gcomprisBoard.canvas.get_root_item(), gcompris.DATA_DIR +
                '/' + self.gcomprisBoard.name + "/" + datasetlevel.background)
            self.current_background = datasetlevel.background

        if self.rootitem:
            self.rootitem.remove()
        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains
        # automaticaly.
        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        # Get a random question
        self.datasetlevel = datasetlevel
        datasetlevel.sort_objects()
        #datasetlevel.dump()
        self.current_question = -1
        self.question_lost = []

        self.question_text_item = goocanvas.Text(
            parent=self.rootitem,
            text="",
            font=gcompris.skin.get_font(datasetlevel.question_font),
            x=datasetlevel.question_position[0],
            y=datasetlevel.question_position[1],
            fill_color_rgba=datasetlevel.question_color,
            anchor=gtk.ANCHOR_CENTER,
            alignment=pango.ALIGN_CENTER)

        x = datasetlevel.object_area_xywh[0]
        y = datasetlevel.object_area_xywh[1]
        w = datasetlevel.object_area_xywh[2]
        h = datasetlevel.object_area_xywh[3]
        # Display the area into which we will display the objects
        if datasetlevel.object_area_fill or datasetlevel.object_area_stroke:
            goocanvas.Rect(parent=self.rootitem,
                           x=x,
                           y=y,
                           width=w,
                           height=h,
                           fill_color_rgba=datasetlevel.object_area_fill,
                           stroke_color_rgba=datasetlevel.object_area_stroke,
                           radius_x=datasetlevel.object_area_radius_x,
                           radius_y=datasetlevel.object_area_radius_x,
                           line_width=datasetlevel.object_area_line_width)

        gap = datasetlevel.gap
        ix = x
        iy = y
        y_max = 0
        for object_source in datasetlevel.objects:
            item = object_source.create_item(self.rootitem,
                                             self.gcomprisBoard.name, 0, 0)
            bounds = item.get_bounds()
            width = bounds.x2 - bounds.x1
            height = bounds.y2 - bounds.y1
            # Manage line wrapping
            if ix + width + gap > x + w:
                ix = x
                iy += y_max + gap
            item.props.x = ix
            item.props.y = iy
            item.connect("button_press_event", self.item_event, object_source)
            # This item is clickeable and it must be seen
            gcompris.utils.item_focus_init(item, None)
            ix += width + gap
            y_max = max(y_max, height)

        # The OK Button
        item = goocanvas.Svg(parent=self.rootitem,
                             svg_handle=gcompris.skin.svg_get(),
                             svg_id="#OK")
        zoom = 1
        item.translate(
            (item.get_bounds().x1 * -1) + datasetlevel.ok_position[0] / zoom,
            (item.get_bounds().y1 * -1) + datasetlevel.ok_position[1] / zoom)
        item.scale(zoom, zoom)
        item.connect("button_press_event", self.ok_event, None)
        gcompris.utils.item_focus_init(item, None)

        self.datasetlevel.sort_objects()
        self.object_target = self.get_next_question()

        if not self.first_run:
            self.display_question(self.datasetlevel, self.object_target)
        else:
            text, rect = textBox(_('I am Ready'),
                                 400,
                                 250,
                                 self.rootitem,
                                 fill_color_rgba=0x666666CCL,
                                 stroke_color_rgba=0x000000FFL)
            gcompris.utils.item_focus_init(rect, None)
            rect.connect("button_press_event", self.first_run_event, text,
                         rect)
コード例 #50
0
    def start(self):
        self.saved_policy = gcompris.sound.policy_get()
        gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)
        gcompris.sound.pause()

        # init config to default values
        self.config_dict = self.init_config()

        # change configured values
        self.config_dict.update(gcompris.get_board_conf())

        if self.config_dict.has_key('locale_sound'):
            gcompris.set_locale(self.config_dict['locale_sound'])

        # Set the buttons we want in the bar
        handle = gcompris.utils.load_svg("lang/repeat.svg")
        gcompris.bar_set_repeat_icon(handle)
        gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT_ICON
                         | gcompris.BAR_CONFIG)

        # Set a background image
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "lang/background.svgz")

        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains
        # automaticaly.
        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        self.langLib = LangLib(gcompris.DATA_DIR + "/lang/words.xml")
        self.chapters = self.langLib.getChapters()
        self.currentExercise = None
        self.currentExerciseModes = []

        if self.gcomprisBoard.mode == "":
            gcompris.utils.dialog(
                "ERROR, missing 'mode' in the xml menu to specify the chapter",
                None)
            return
        self.currentChapterName = self.gcomprisBoard.mode

        # Manage levels (a level is a lesson in the lang model)
        self.gcomprisBoard.level = 1
        try:
            self.gcomprisBoard.maxlevel = \
                len ( self.chapters.getChapters()[self.currentChapterName].getLessons() )
        except:
            gcompris.utils.dialog(
                "ERROR, missing chapter '" + self.currentChapterName + "'",
                None)
            return

        if self.gcomprisBoard.maxlevel == 0:
            gcompris.utils.dialog(
                _("ERROR, we found no words in this language.") + " " +
                _("Please consider contributing a voice set."), None)
            return

        if not (gcompris.get_properties().fx):
            gcompris.utils.dialog(
                _("Error: This activity cannot be \
played with the\nsound effects disabled.\nGo to the configuration \
dialogue to\nenable the sound."), None)

        gcompris.bar_set_level(self.gcomprisBoard)

        readyButton = TextButton(400, 255,
                                 ' ' * 20 + _('I am Ready') + ' ' * 20,
                                 self.rootitem, 0x11AA11FFL)
        readyButton.getBackground().connect("button_press_event",
                                            self.ready_event, readyButton)

        self.pause(1)
コード例 #51
0
    def start(self):
        self.gcomprisBoard.level = 1
        self.gcomprisBoard.maxlevel = 1
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 1

        # The basic tick for object moves
        self.timerinc = 50

        # The tick for the boat is variable
        self.boat_timerinc = self.timerinc

        # Need to manage the timers to quit properly
        self.boat_timer = 0
        self.sun_timer = 0
        self.vapor_timer = 0
        self.cloud_timer = 0
        self.waterlevel_timer = 0

        gcompris.bar_set(0)
        gcompris.set_background(self.gcomprisBoard.canvas.root(),
                                "watercycle/background.png")
        gcompris.bar_set_level(self.gcomprisBoard)

        gcompris.sound.play_ogg("sounds/Harbor1.wav", "sounds/Harbor3.wav")

        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains automaticaly.
        self.rootitem = self.gcomprisBoard.canvas.root().add(
            gnomecanvas.CanvasGroup, x=0.0, y=0.0)

        # Take care, the items are stacked on each other in the order you add them.
        # If you need, you can reorder them later with raise and lower functions.

        # The River
        self.riveritem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/riverempty.png"),
            x=150.0,
            y=50.0)
        self.riverfull = 0

        # The bad water
        self.badwateritem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/badwater_off.png"),
            x=360.0,
            y=292.0)

        # The clean water
        self.cleanwateritem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/cleanwater_off.png"),
            x=470.0,
            y=130.0)
        self.cleanwaterstatus = 0

        # The Sun
        self.sunitem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/sun.png"),
            x=10.0,
            y=70.0)
        self.sunitem.connect("event", self.sun_item_event)
        # This item is clickeable and it must be seen
        self.sunitem.connect("event", gcompris.utils.item_event_focus)
        self.sun_direction = -1
        self.sun_on = 0

        # The sun mask object to simulate the see
        self.rootitem.add(gnomecanvas.CanvasRect,
                          x1=10.0,
                          y1=89.0,
                          x2=90.0,
                          y2=155.0,
                          fill_color_rgba=0x0099FFFFL,
                          width_units=0.0)

        # The Snow
        self.snowitem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/snow.png"),
            x=180.0,
            y=3.0)
        self.snowitem.hide()

        # The rain
        self.rainitem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/rain.png"),
            x=40.0,
            y=70.0)
        self.rainitem.hide()
        self.rain_on = 0

        # The cloud
        self.clouditem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/cloud.png"),
            x=10.0,
            y=10.0)
        self.clouditem.hide()
        self.clouditem.connect("event", self.cloud_item_event)
        # This item is clickeable and it must be seen
        self.clouditem.connect("event", gcompris.utils.item_event_focus)
        self.cloud_on = 0

        # The vapor
        self.vaporitem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/vapor.png"),
            x=35.0,
            y=150.0)
        self.vaporitem.hide()

        # The Waterpump
        self.waterpumpitem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/waterpump.png"),
            x=165.0,
            y=120.0)
        self.waterpumpitem.connect("event", self.waterpump_item_event)
        # This item is clickeable and it must be seen
        self.waterpumpitem.connect("event", gcompris.utils.item_event_focus)
        self.waterpump_on = 0

        # The pump water
        self.pumpwateritem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/pumpwater_off.png"),
            x=270.0,
            y=133.0)

        # The WaterCleaning
        self.watercleaningitem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/watercleaning.png"),
            x=520.0,
            y=380.0)
        self.watercleaningitem.connect("event", self.watercleaning_item_event)
        # This item is clickeable and it must be seen
        self.watercleaningitem.connect("event",
                                       gcompris.utils.item_event_focus)
        self.watercleaning_on = 0

        # The tuxboat
        self.tuxboatitem = gcompris.anim.CanvasItem(
            gcompris.anim.Animation("watercycle/tuxboat.txt"), self.rootitem)
        numstates = self.tuxboatitem.num_states

        self.tuxboatcanvas = self.tuxboatitem.gnomecanvas
        self.tuxboatcanvas.set(x=-100.0, y=430.0)

        # Tux in the shower (without water)
        self.tuxshoweritem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/minitux.png"),
            x=569.0,
            y=239.0)
        self.tuxshoweritem.hide()
        self.tuxisinshower = 0

        # Tux in the shower with the water
        self.tuxshowerwateritem = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/showerwater.png"),
            x=561.0,
            y=231.0)
        self.tuxshowerwateritem.hide()

        # The shower itself
        self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/shower.png"),
            x=560.0,
            y=283.0)

        # The shower on/off button (I need to get the 2 buttons to manage the focus)
        self.showerbuttonitem_on = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/shower_on.png"),
            x=622.0,
            y=260.0)
        self.showerbuttonitem_on.connect("event", self.showerbutton_item_event)
        # This item is clickeable and it must be seen
        self.showerbuttonitem_on.connect("event",
                                         gcompris.utils.item_event_focus)
        self.showerbuttonitem_on.hide()
        self.showerbutton = 0

        self.showerbuttonitem_off = self.rootitem.add(
            gnomecanvas.CanvasPixbuf,
            pixbuf=gcompris.utils.load_pixmap("watercycle/shower_off.png"),
            x=622.0,
            y=260.0)
        self.showerbuttonitem_off.connect("event",
                                          self.showerbutton_item_event)
        # This item is clickeable and it must be seen
        self.showerbuttonitem_off.connect("event",
                                          gcompris.utils.item_event_focus)

        # The level of water in the castle
        self.waterlevel_max = 65
        self.waterlevel_min = 85
        self.waterlevel = self.waterlevel_min
        self.waterlevel_timer = gobject.timeout_add(1000,
                                                    self.update_waterlevel)

        self.waterlevel_item = self.rootitem.add(gnomecanvas.CanvasLine,
                                                 points=(655, self.waterlevel,
                                                         655,
                                                         self.waterlevel_min),
                                                 fill_color_rgba=0x0033FFFFL,
                                                 width_units=20.0)

        # Some item ordering
        self.rainitem.raise_to_top()
        self.clouditem.raise_to_top()

        # Ready GO
        self.move_boat()

        print("Gcompris_watercycle start.")
コード例 #52
0
    def start(self):
        self.board.level = 1
        self.board.maxlevel = self.levelset.numlevels
        self.board.sublevel = 1
        self.board.number_of_sublevel = self.levelset.num_sublevels
        self.trog_wait = 1900

        gcompris.bar_set(0)
        gcompris.set_background(self.board.canvas.root(), gcompris.skin.image_to_skin("gcompris-bg.jpg"))
        gcompris.bar_set_level(self.board)

        pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_reload.png"))
        if(pixmap):
            gcompris.bar_set_repeat_icon(pixmap)
            gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT_ICON)
        else:
            gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT)

        # create our rootitem. We put each canvas item here so at the end we only
        # need to destroy the rootitem
        self.rootitem = self.board.canvas.root().add(gnomecanvas.CanvasGroup,
                                                     x=0.0,
                                                     y=0.0)

        # draw the board on top of the background
        for i in range(0,self.width+1):
            self.rootitem.add(gnomecanvas.CanvasLine,
                              points = (i*self.sw + self.left, self.top,
                                        i*self.sw + self.left, self.scrh),
                              fill_color_rgba = 0x000000FFL,
                              width_units = 3.0)
        for i in range(0,self.height+1):
            self.rootitem.add(gnomecanvas.CanvasLine,
                              points = (self.left, self.top + i*self.sh,
                                        self.scrw, self.top + i*self.sh),
                              fill_color_rgba = 0x000000FFL,
                              width_units = 3.0)

        # munchers and troggles
        self.players = []
        self.muncher = Muncher()
        self.troggles = [Troggle(), Troggle(), Troggle()]

        self.players[:] = self.troggles
        self.players.append(self.muncher)

        # create the squares
        self.squares = []
        for i in range(0, self.width):
            tmp = []
            for j in range(0, self.height):
                s = Square(self.left + self.sw*i + self.sw/2, self.top + self.sh*j + self.sh/2)
                s.pic.raise_to_top()
                tmp.append( s )
            self.squares.append(tmp)

        # so that the troggles get clipped to the board area
        self.rootitem.add(gnomecanvas.CanvasRect,
                          x1=0, y1=0,
                          x2=self.scrw, y2=self.top,
                          fill_color_rgba = 0xFFFFFFFFL)
        self.rootitem.add(gnomecanvas.CanvasRect,
                          x1=0, y1=0,
                          x2=self.left, y2=self.scrh,
                          fill_color_rgba = 0xFFFFFFFFL)

        # the board title
        self.title = self.rootitem.add(gnomecanvas.CanvasText,
                                       text = "",
                                       font = gcompris.skin.get_font("gcompris/board/title bold"),
                                       x = self.scrw/2,
                                       y = self.top/2)

        # the message
        self.message_back = self.rootitem.add(gnomecanvas.CanvasRect,
                                        x1=0, y1=0, x2=1, y2=1,
                                        fill_color_rgba = 0x60F06060L)
        self.message = self.rootitem.add(gnomecanvas.CanvasText,
                                        text = "",
                                        justification = gtk.JUSTIFY_CENTER,
                                        font = gcompris.skin.get_font("gcompris/board/title bold"),
                                        x = self.scrw/2,
                                        y = self.scrh/2)
        self.message.hide()

        # the trogwarning
        self.trogwarning = self.rootitem.add(gnomecanvas.CanvasText,
                                        text = _("T\nR\nO\nG\nG\nL\nE"),
                                        justification = gtk.JUSTIFY_CENTER,
                                        font = gcompris.skin.get_font("gcompris/board/title bold"),
                                        x = self.left/2,
                                        y = self.scrh/2)
        self.trogwarning.hide()
        self.trogwarning_num = 0

        # the spare life
        self.muncher.spare.gnomecanvas.raise_to_top()

        self.startGame()
コード例 #53
0
ファイル: braille_alphabets.py プロジェクト: laya/gcompris-1
    def braille_cell(self, level):
        self.play_letter(self.random_letter)

        # Translators : Do not translate the token {letter}
        message = _("Click on the dots in braille cell area to produce the "
                    "letter {letter}.").format(letter=self.random_letter)

        self.letter = "alphabet"
        if (level == 3):
            message += "\n" + _(
                "Look at the Braille character map and observe how "
                "similar the first and second line are.")
        elif (level == 4):
            message += "\n" + _(
                "Again, similar as the first line but take care, "
                "the 'W' letter was added afterwards.")
        elif (level == 5):
            message += "\n" + _(
                "This is easy, numbers are the same as letters "
                "from A to J.")
            self.letter = "number"

        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "braille_alphabets/mosaic.svgz")

        goocanvas.Text(parent=self.rootitem,
                       x=400,
                       y=200,
                       text=message,
                       fill_color="black",
                       font=gcompris.skin.get_font("gcompris/board/medium"),
                       width=780,
                       anchor=gtk.ANCHOR_CENTER,
                       alignment=pango.ALIGN_CENTER)

        goocanvas.Text(
            parent=self.rootitem,
            x=160.0,
            y=250.0,
            text=_("Braille Cell"),
            fill_color="black",
            font=gcompris.skin.get_font("gcompris/board/medium bold"))

        BrailleChar(self.rootitem,
                    150,
                    270,
                    120,
                    '',
                    COLOR_ON,
                    COLOR_OFF,
                    CIRCLE_FILL,
                    CIRCLE_STROKE,
                    False,
                    True,
                    False,
                    callback=self.letter_change,
                    braille_letter=self.letter)

        for i in range(2):
            for j in range(3):
                goocanvas.Text(
                    parent=self.rootitem,
                    text=(str(j + 1 + i * 3)),
                    font=gcompris.skin.get_font("gcompris/board/big"),
                    fill_color="black",
                    x=i * 120 + 140,
                    y=j * 45 + 290)

        # OK Button
        ok = goocanvas.Svg(
            parent=self.rootitem,
            svg_handle=gcompris.skin.svg_get(),
            svg_id="#OK",
            tooltip=_("Click to confirm your selection of dots"))
        ok.translate(-165, -155)

        ok.connect("button_press_event", self.ok_event)
        gcompris.utils.item_focus_init(ok, None)
コード例 #54
0
ファイル: ballcatch.py プロジェクト: laya/gcompris-1
    def start(self):
        self.gcomprisBoard.level = 1
        self.gcomprisBoard.maxlevel = 9
        self.gcomprisBoard.sublevel = 1
        self.gcomprisBoard.number_of_sublevel = 1
        gcompris.bar_set(gcompris.BAR_LEVEL)
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "ballcatch/beach1.svgz")
        gcompris.bar_set_level(self.gcomprisBoard)
        gcompris.bar_location(gcompris.BOARD_WIDTH - 190, -1, 0.7)

        self.ballinc = 20  # Event loop timer for the ball move
        self.timer_diff = 0  # Store the time diff between left and right key

        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains automaticaly.
        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        # The instructions
        self.instruction = goocanvas.Text(
            parent=self.rootitem,
            x=600.0,
            y=300.0,
            width=250,
            text=_("Press the two shift keys at the same time,"
                   " to make the ball go in a straight line."),
            fill_color="black",
            font=gcompris.skin.get_font("gcompris/board/medium"),
            anchor=gtk.ANCHOR_CENTER,
            alignment=pango.ALIGN_CENTER)

        # Tux
        goocanvas.Image(parent=self.rootitem,
                        pixbuf=gcompris.utils.load_pixmap("ballcatch/tux.svg"),
                        x=gcompris.BOARD_WIDTH / 2 - 60,
                        y=135.0)

        # Balloon
        self.balloon_item = goocanvas.Ellipse(parent=self.rootitem, )
        self.init_balloon()

        # The Left Hand
        goocanvas.Image(
            parent=self.rootitem,
            pixbuf=gcompris.utils.load_pixmap("ballcatch/hand.svg"),
            x=gcompris.BOARD_WIDTH / 2 - 150.0,
            y=gcompris.BOARD_HEIGHT - 150)

        # The Right Hand (invert the left hand)
        item = goocanvas.Image(
            parent=self.rootitem,
            pixbuf=gcompris.utils.load_pixmap("ballcatch/hand.svg"),
        )
        item.set_transform(
            cairo.Matrix(-1, 0, 0, 1, gcompris.BOARD_WIDTH / 2 + 100.0,
                         gcompris.BOARD_HEIGHT - 150))

        # The Left Shift KEY
        self.leftkey = goocanvas.Image(
            parent=self.rootitem,
            pixbuf=gcompris.utils.load_pixmap("ballcatch/shift_key.svg"),
            x=gcompris.BOARD_WIDTH / 2 - 240.0,
            y=gcompris.BOARD_HEIGHT - 80)

        # The Right Shift KEY
        self.rightkey = goocanvas.Image(
            parent=self.rootitem,
            pixbuf=gcompris.utils.load_pixmap("ballcatch/shift_key.svg"),
            x=gcompris.BOARD_WIDTH / 2 + 100.0,
            y=gcompris.BOARD_HEIGHT - 80)

        # The basic tick for object moves
        self.timerinc = 1000

        self.left_continue = True
        self.right_continue = True

        self.counter_left = 0
        self.counter_right = 0

        self.timer_inc = gobject.timeout_add(self.timerinc,
                                             self.timer_inc_display)
コード例 #55
0
    def start(self):
        self.saved_policy = gcompris.sound.policy_get()
        gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT)
        gcompris.sound.pause()

        # init config to default values
        self.config_dict = self.init_config()

        # change configured values
        self.config_dict.update(gcompris.get_board_conf())

        if self.config_dict.has_key('locale_sound'):
            gcompris.set_locale(self.config_dict['locale_sound'])

        # Set the buttons we want in the bar
        handle = gcompris.utils.load_svg("lang/repeat.svg")
        gcompris.bar_set_repeat_icon(handle)
        gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT_ICON
                         | gcompris.BAR_CONFIG)
        gcompris.bar_location(gcompris.BOARD_WIDTH / 2 - 100, -1, 0.6)

        # Set a background image
        gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
                                "lang/background.svgz")

        # Create our rootitem. We put each canvas item in it so at the end we
        # only have to kill it. The canvas deletes all the items it contains
        # automaticaly.
        self.rootitem = goocanvas.Group(
            parent=self.gcomprisBoard.canvas.get_root_item())

        self.langLib = LangLib(gcompris.DATA_DIR + "/lang/words.xml")
        self.chapters = self.langLib.getChapters()

        if self.gcomprisBoard.mode == "":
            gcompris.utils.dialog(
                "ERROR, missing 'mode' in the xml menu to specify the chapter",
                None)
            return
        self.currentChapterName = self.gcomprisBoard.mode

        # Manage levels (a level is a lesson in the lang model)
        self.gcomprisBoard.level = 1
        try:
            self.gcomprisBoard.maxlevel = \
                len ( self.chapters.getChapters()[self.currentChapterName].getLessons() )
        except:
            gcompris.utils.dialog(
                "ERROR, missing chapter '" + self.currentChapterName + "'",
                None)
            return

        if self.gcomprisBoard.maxlevel == 0:
            gcompris.utils.dialog(
                _("ERROR, we found no words in this language.") + " " +
                _("Please consider contributing a voice set."), None)
            return

        gcompris.bar_set_level(self.gcomprisBoard)

        self.currentExerciseModes = []
        self.currentExercise = None
        self.currentLesson = self.langLib.getLesson(
            self.currentChapterName, self.gcomprisBoard.level - 1)
        self.displayLesson(self.currentLesson)
        self.pause(0)
コード例 #56
0
  def start(self):
    self.gcomprisBoard.level=1
    self.gcomprisBoard.maxlevel=9
    self.gcomprisBoard.sublevel=1
    self.gcomprisBoard.number_of_sublevel=1
    gcompris.bar_set(gcompris.BAR_LEVEL)
    gcompris.set_background(self.gcomprisBoard.canvas.root(),"ballcatch/beach1.png")
    gcompris.bar_set_level(self.gcomprisBoard)


    self.ballinc    = 20        # Event loop timer for the ball move
    self.timer_diff = 0         # Store the time diff between left and right key

    # Create our rootitem. We put each canvas item in it so at the end we
    # only have to kill it. The canvas deletes all the items it contains automaticaly.
    self.rootitem = self.gcomprisBoard.canvas.root().add(
      gnomecanvas.CanvasGroup,
      x=0.0,
      y=0.0
      )

    # Tux
    self.lefthand = self.rootitem.add(
      gnomecanvas.CanvasPixbuf,
      pixbuf = gcompris.utils.load_pixmap("ballcatch/tux.png"),
      x=gcompris.BOARD_WIDTH/2 - 60,
      y=135.0
      )

    # Balloon
    self.balloon_item = self.rootitem.add(
      gnomecanvas.CanvasEllipse,
      x1=0.0,
      y1=0.0,
      x2=0.0,
      y2=0.0
      )
    self.init_balloon()

    # The Left Hand
    self.lefthand = self.rootitem.add(
      gnomecanvas.CanvasPixbuf,
      pixbuf = gcompris.utils.load_pixmap("ballcatch/hand.png"),
      x=gcompris.BOARD_WIDTH/2-150.0,
      y=gcompris.BOARD_HEIGHT - 150
      )

    # The Right Hand
    item = self.lefthand = self.rootitem.add(
      gnomecanvas.CanvasPixbuf,
      pixbuf = gcompris.utils.load_pixmap("ballcatch/hand.png"),
      x=gcompris.BOARD_WIDTH/2+100.0,
      y=gcompris.BOARD_HEIGHT - 150.0
      )
    bounds = self.get_bounds(item)
    (cx, cy) = ( (bounds[2]+bounds[0])/2 , (bounds[3]+bounds[1])/2)
    mat = ( -1, 0, 0, 1, 2*cx, 0)
    item.affine_relative(mat)

    # The Left Shift KEY
    self.leftkey = self.rootitem.add(
      gnomecanvas.CanvasPixbuf,
      pixbuf = gcompris.utils.load_pixmap("ballcatch/shift_key.png"),
      x=gcompris.BOARD_WIDTH/2-240.0,
      y=gcompris.BOARD_HEIGHT - 80
      )

    # The Right Shift KEY
    self.rightkey = self.rootitem.add(
      gnomecanvas.CanvasPixbuf,
      pixbuf = gcompris.utils.load_pixmap("ballcatch/shift_key.png"),
      x=gcompris.BOARD_WIDTH/2+100.0,
      y=gcompris.BOARD_HEIGHT - 80
      )

    # The basic tick for object moves
    self.timerinc = 1000

    self.left_continue  = True
    self.right_continue = True

    self.counter_left  = 0
    self.counter_right = 0

    self.timer_inc  = gobject.timeout_add(self.timerinc,
                                          self.timer_inc_display)