def start(self): # Set a background image gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item()) #Boolean variable declaration self.mapActive = False #CONSTANT Declarations self.board_paused = 0 self.timerAnim = 0 self.counter = 0 self.gamewon = 0 self.score_player_a = 0 self.score_player_b = 0 self.tile_counter = 0 self.rectangle_counter = 0 #REPEAT ICON pixmap = gcompris.utils.load_svg("braille_alphabets/target.svg") gcompris.bar_set_repeat_icon(pixmap) gcompris.bar_set(gcompris.BAR_REPEAT_ICON) gcompris.bar_location(320,-1,0.8) # 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()) self.lotto_board()
def start(self): gcompris.bar_set(gcompris.BAR_ABOUT) #temporary, until it does not support levels gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item()) self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item()) self.ball_radius=20 #if number of tries is exceeded, then a game goes over - temporary unused self.tries=4 #Select a random color. The chosen one is the darkest shade. #Depending on its priority, the ball will be lighter or equal shade as choosen one self.starting_color = [ randint(60, 255) for i in range(3) ] #a message below destroys aesthetics of activity '''self.instruction = goocanvas.Text( parent = self.rootitem, x = 600.0, y = 300.0, width = 250, text = _("Type the numbers of balls," " begin from the lightest."), fill_color = "black", anchor = gtk.ANCHOR_CENTER, alignment = pango.ALIGN_CENTER ) ''' self.draw_all_balls()
def start(self): self.recordedHits = [] self.saved_policy = gcompris.sound.policy_get() gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT) gcompris.sound.pause() # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) # 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()) self.display_level(self.gcomprisBoard.level) 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) readyButton = TextButton(400, 455, ' ' * 20 + _('I am Ready') + ' ' * 20, self.rootitem, 0x11AA11FFL) readyButton.getBackground().connect("button_press_event", self.ready_event, readyButton)
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.sublevel=1 self.gcomprisBoard.number_of_sublevel=1 # pause the bg music #print "pause sound" gcompris.sound.pause() self.timers = [] self.solution = [] self.kidstry = [] self.in_repeat = 0 self.theme = 0 # # This list contains the 'theme' for each melody level. # self.melodylist = \ [ # xylophon [ {'theme': "xylofon", 'background': "melody/xylofon_background.svg", 'hittool': "melody/xylofon_cursor.png", 'hitofset_x': 50, 'hitofset_y': 50}, [ {'x': 150.0, 'y': 101.0, 'image': "melody/xylofon_son1.svg", 'sound': "melody/xylofon_son1.ogg"}, {'x': 284.0, 'y': 118.0, 'image': "melody/xylofon_son2.svg", 'sound': "melody/xylofon_son2.ogg"}, {'x': 412.0, 'y': 140.0, 'image': "melody/xylofon_son3.svg", 'sound': "melody/xylofon_son3.ogg"}, {'x': 546.0, 'y': 157.0, 'image': "melody/xylofon_son4.svg", 'sound': "melody/xylofon_son4.ogg"} ] ], # guitar [ {'theme': "guitar", 'background': "melody/guitar_background.svg", 'hittool': "melody/guitar_cursor.svg", 'hitofset_x': 400, 'hitofset_y': -5}, [ {'x': 0, 'y': 170.0, 'image': "melody/guitar_son1.png", 'sound': "melody/guitar_son1.ogg"}, {'x': 0, 'y': 230.0, 'image': "melody/guitar_son2.png", 'sound': "melody/guitar_son2.ogg"}, {'x': 0, 'y': 290.0, 'image': "melody/guitar_son3.png", 'sound': "melody/guitar_son3.ogg"}, {'x': 0, 'y': 350.0, 'image': "melody/guitar_son4.png", 'sound': "melody/guitar_son4.ogg"} ] ], # Kitchen [ {'theme': "tachos", 'background': "melody/tachos_background.jpg", 'hittool': "melody/tachos_cursor.png", 'hitofset_x': 50, 'hitofset_y': 50}, [ {'x': 150.0, 'y': 50.0, 'image': "melody/tachos_son1.png", 'sound': "melody/tachos_son1.ogg"}, {'x': 550.0, 'y': 50.0, 'image': "melody/tachos_son2.png", 'sound': "melody/tachos_son2.ogg"}, {'x': 150.0, 'y': 250.0, 'image': "melody/tachos_son3.png", 'sound': "melody/tachos_son3.ogg"}, {'x': 550.0, 'y': 250.0, 'image': "melody/tachos_son4.png", 'sound': "melody/tachos_son4.ogg"} ] ] ] self.maxtheme = len(self.melodylist)-1 self.gcomprisBoard.maxlevel = 9 gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT) self.pause(1); self.display_current_level() Prop = gcompris.get_properties() if(not Prop.fx): gcompris.utils.dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialogue to\nenable the sound"), stop_board)
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)
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)
def start(self): # 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.backitem = goocanvas.Group(parent=self.gcomprisBoard.canvas.get_root_item()) svghandle = gcompris.utils.load_svg("hangman/back.svgz") goocanvas.Svg(parent=self.backitem, svg_handle=svghandle, pointer_events=goocanvas.EVENTS_NONE) # 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.backitem) self.wordlist = gcompris.get_wordlist("wordsgame/default-$LOCALE.xml") if not self.wordlist: # Fallback to english self.wordlist = gcompris.get_wordlist("wordsgame/default-en.xml") if not self.wordlist: gcompris.utils.dialog(_("Could not find the list of words."), stop_board) return self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = self.wordlist.number_of_level * 3 self.gcomprisBoard.sublevel = 1 self.gcomprisBoard.number_of_sublevel = 10 # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_location(gcompris.BOARD_WIDTH - 160, -1, 0.6) # Set a background image gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item()) self.display_level()
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"))
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)
def start(self): # GCompris initialisation self.gcomprisBoard.level=1 self.gcomprisBoard.maxlevel=1 self.gcomprisBoard.sublevel=0 self.gcomprisBoard.number_of_sublevel=0 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()) self.doc = Document(self) # initialisation self.draw_tools() self.draw_animtools() self.doc.timeline.draw() if self.gcomprisBoard.mode == 'draw': self.doc.timeline.hide() self.color_rootitem = goocanvas.Group( parent = self.gcomprisBoard.canvas.get_root_item()) self.color = Color(self.color_rootitem, self.drawing_area) self.color.draw() self.draw_drawing_area() self.draw_playing_area() gcompris.bar_set(0) gcompris.bar_location(10, -1, 0.6)
def start(self): self.running = True self.saved_policy = gcompris.sound.policy_get() gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT) gcompris.sound.pause() # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) # 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()) self.display_level(self.gcomprisBoard.level) 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) readyButton = TextButton(400, 455, ' ' * 20 + _('I am Ready') + ' ' * 20, self.rootitem, 0x11AA11FFL) readyButton.getBackground().connect("button_press_event", self.ready_event, readyButton)
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)
def start(self): # 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.game_complete = False self.rootitem = goocanvas.Group(parent=self.gcomprisBoard.canvas.get_root_item()) self.background = goocanvas.Image( parent=self.rootitem, pixbuf=gcompris.utils.load_pixmap("place_your_satellite/background.jpg"), x=1, y=1 ) image = "place_your_satellite/planet" + str(self.gcomprisBoard.level) + ".png" self.planet = goocanvas.Image( parent=self.rootitem, pixbuf=gcompris.utils.load_pixmap(image), x=gcompris.BOARD_WIDTH / 2 - 50 - (self.gcomprisBoard.level * 10), y=gcompris.BOARD_HEIGHT / 2 - 50 - (self.gcomprisBoard.level * 10), ) self.instructions( _("Click anywhere on the screen to place the satellite " "at a distance from the planet.") + "\n" + _("Then click on the satellite and drag a line that sets " "the speed of the satellite") ) self.message = Message(self.rootitem, 400, 50, 20) self.distanceIndicator = Message(self.rootitem, 400, 480, 5) self.satellite = Satellite(self, self.rootitem, self.gcomprisBoard.level) self.speed = Speed(self.satellite, self.rootitem) # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_REPEAT | gcompris.BAR_LEVEL) gcompris.bar_location(2, -1, 0.5) gcompris.bar_set_level(self.gcomprisBoard)
def start(self): # 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.game_complete = False self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item()) self.background = goocanvas.Image( parent = self.rootitem, pixbuf = gcompris.utils.load_pixmap( "place_your_satellite/background.jpg"), x = 1, y = 1) image = "place_your_satellite/planet" + str(self.gcomprisBoard.level) +\ ".png" self.planet = goocanvas.Image( parent = self.rootitem, pixbuf = gcompris.utils.load_pixmap(image), x = gcompris.BOARD_WIDTH/2 - 50 - (self.gcomprisBoard.level * 10), y = gcompris.BOARD_HEIGHT/2 - 50 - (self.gcomprisBoard.level * 10)) self.instructions() self.satellite = Satellite(self, self.rootitem, self.gcomprisBoard.level) self.speed = Speed(self.satellite, self.rootitem) # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_REPEAT | gcompris.BAR_LEVEL) gcompris.bar_location(2,-1,0.5) gcompris.bar_set_level(self.gcomprisBoard)
def start(self): print "pythontemplate start" # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) # 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()) goocanvas.Text( parent = self.rootitem, x=400.0, y=100.0, text=_("This is the first plugin in GCompris coded in the Python\n" "Programming language."), fill_color="black", anchor = gtk.ANCHOR_CENTER, alignment = pango.ALIGN_CENTER )
def start(self): # load pixmaps for the ui. # 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_OK | gcompris.BAR_REPEAT_ICON) else: gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_OK | gcompris.BAR_REPEAT) gcompris.bar_set_level(self.gcomprisBoard) # Create persistent over levels root item canvas for the board self.rootitem_p = self.gcomprisBoard.canvas.root().add( gnomecanvas.CanvasGroup, x=0, y=0) self.profbutton = self.prof_button(self, self.rootitem_p, profs[self.gcomprisBoard.level - 1]) self.answer = self.answer_button( self.rootitem_p, self.scales[self.gcomprisBoard.sublevel - 1], self.pixmap_green_ball, self.number_balls[self.gcomprisBoard.sublevel - 1]) # self.newGame()
def start(self): # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_location(300,-1,0.8) # Set a background image gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item()) #Boolean variable declaration self.mapActive = False #REPEAT ICON gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON) gcompris.bar_location(300,-1,0.6) # 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.bar_set_level(self.gcomprisBoard) #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' ) self.display_function(self.gcomprisBoard.level)
def start(self): # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(275, -1, 0.8) self.saved_policy = gcompris.sound.policy_get() gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT) gcompris.sound.pause() # 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()) self.display_level(self.gcomprisBoard.level) 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)
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()
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)
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)
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)
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())
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)
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)
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_default_background(self.gcomprisBoard.canvas.get_root_item()) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(-1, -1, 0.8) self.set_level(1) self.game_start()
def start(self): #definition of attributs self.MAX = 0 self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = 3 #self.data[0] #Display and configuration of menu bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) #Start of level 1 self.set_level()
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)
def start(self): # 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.root = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item()) #Creating a Red Border goocanvas.Rect( parent = self.root, x = 10, y = 10, width = 780, height = 500, stroke_color = "dark red", line_width=40) # 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 gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON) gcompris.bar_location(300,-1,0.7) goocanvas.Text( parent = self.root, x=400.0, y=50.0, text=_("Braille these Objects"), fill_color="black", anchor = gtk.ANCHOR_CENTER, alignment = pango.ALIGN_CENTER, font = 'SANS 20' ) goocanvas.Text( parent = self.root, x=320.0, y=100.0, text=_("Category : "), fill_color="black", anchor = gtk.ANCHOR_CENTER, alignment = pango.ALIGN_CENTER, font = 'SANS 15' ) self.read_data() self.display_game(self.gcomprisBoard.level)
def start(self): #definition of attributs self.MAX=0 self.gcomprisBoard.level=1 self.load_activity() self.gcomprisBoard.maxlevel = len(self.data_activity) #Display and configuration of menu bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(gcompris.BOARD_WIDTH - 160, -1, 0.7) #Start of level 1 self.set_level()
def start(self): #definition of attributs self.MAX = 0 self.gcomprisBoard.level = 1 self.load_activity() self.gcomprisBoard.maxlevel = len(self.data_activity) #Display and configuration of menu bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(gcompris.BOARD_WIDTH - 190, -1, 0.7) #Start of level 1 self.set_level()
def start(self): # 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.backitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item()) svghandle = gcompris.utils.load_svg("hangman/back.svgz") goocanvas.Svg( parent = self.backitem, svg_handle = svghandle, pointer_events = goocanvas.EVENTS_NONE ) # 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.backitem) # Get the name of the language for the current locale self.wordlist = None try: self.language = gcompris.gcompris_gettext( gcompris.get_locale_name(gcompris.get_locale()) ) self.wordlist = gcompris.get_wordlist("wordsgame/default-$LOCALE.xml") except: pass if not self.wordlist: # Fallback to english self.wordlist = gcompris.get_wordlist("wordsgame/default-en.xml") self.language = _("English") if not self.wordlist: gcompris.utils.dialog(_("Could not find the list of words."), stop_board) return; self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = self.wordlist.number_of_level * 3 self.gcomprisBoard.sublevel = 1 self.gcomprisBoard.number_of_sublevel = 10 # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_location(gcompris.BOARD_WIDTH - 160, -1, 0.6) # Set a background image gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item()) self.display_level()
def start(self): print "lang start" self.saved_policy = gcompris.sound.policy_get() gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT) # init config to default values self.config_dict = self.init_config() print "init self.config_dict :", self.config_dict # change configured values print "gcompris.get_board_conf() : ", gcompris.get_board_conf() self.config_dict.update(gcompris.get_board_conf()) print "self.config_dict final :", self.config_dict if self.config_dict.has_key('locale_sound'): gcompris.set_locale(self.config_dict['locale_sound']) # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT | gcompris.BAR_CONFIG) gcompris.bar_location(gcompris.BOARD_WIDTH / 2 - 100, -1, 0.6) # 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()) self.langLib = LangLib(gcompris.DATA_DIR + "/lang/lang.xml") self.chapters = self.langLib.getChapters() # FIXME Do not manage Chapter yet self.currentChapterId = 0 # Manage levels (a level is a lesson in the lang model) self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = \ len ( self.chapters.getChapters()[self.currentChapterId].getLessons() ) gcompris.bar_set_level(self.gcomprisBoard) self.currentExercise = None self.currentLesson = self.langLib.getLesson( self.currentChapterId, self.gcomprisBoard.level - 1) self.displayLesson(self.currentLesson)
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()
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()
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()
def start(self): # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) 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(20, -1, 0.6) # 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.board_upper(self.gcomprisBoard.level)
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()
def start(self): print "lang start" self.saved_policy = gcompris.sound.policy_get() gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT) # init config to default values self.config_dict = self.init_config() print "init self.config_dict :", self.config_dict # change configured values print "gcompris.get_board_conf() : ", gcompris.get_board_conf() self.config_dict.update(gcompris.get_board_conf()) print "self.config_dict final :", self.config_dict if self.config_dict.has_key('locale_sound'): gcompris.set_locale(self.config_dict['locale_sound']) # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT|gcompris.BAR_CONFIG) gcompris.bar_location(gcompris.BOARD_WIDTH / 2 - 100, -1, 0.6) # 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()) self.langLib = LangLib(gcompris.DATA_DIR + "/lang/lang.xml") self.chapters = self.langLib.getChapters() # FIXME Do not manage Chapter yet self.currentChapterId = 0 # Manage levels (a level is a lesson in the lang model) self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = \ len ( self.chapters.getChapters()[self.currentChapterId].getLessons() ) gcompris.bar_set_level(self.gcomprisBoard) self.currentExercise = None self.currentLesson = self.langLib.getLesson(self.currentChapterId, self.gcomprisBoard.level - 1) self.displayLesson( self.currentLesson )
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)
def start(self): self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = 4 self.gcomprisBoard.sublevel = 1 self.gcomprisBoard.number_of_sublevel = 1 self.board_paused = False 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_OK | gcompris.BAR_LEVEL | gcompris.BAR_REPEAT_ICON) else: gcompris.bar_set(gcompris.BAR_OK | gcompris.BAR_LEVEL | gcompris.BAR_REPEAT) gcompris.bar_set_level(self.gcomprisBoard) # 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) pixmap = gcompris.utils.load_pixmap( gcompris.skin.image_to_skin("gcompris-bg.jpg")) item = self.rootitem.add( gnomecanvas.CanvasPixbuf, pixbuf=pixmap, x=0, y=0, ) item.connect("event", self.ruler_item_event) self.display_sea_area() self.root_weather_item = self.rootitem.add(gnomecanvas.CanvasGroup, x=0.0, y=0.0) # Display the weather now self.display_weather() # And finaly the players boats self.init_boats()
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)
def start(self): # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) 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(20, -1, 0.6) # 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 self.rootitem = None self.display_level(self.gcomprisBoard.level)
def start(self): # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) 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(20, -1, 0.6) # 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 self.rootitem = None self.display_level(self.gcomprisBoard.level)
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)
def start(self): self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = 4 self.gcomprisBoard.sublevel = 1 self.gcomprisBoard.number_of_sublevel = 1 self.board_paused = 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()) gcompris.set_default_background( self.gcomprisBoard.canvas.get_root_item()) self.display_sea_area() self.root_weather_item = goocanvas.Group(parent=self.rootitem) # Display the weather now self.display_weather() # And finaly the players boats self.init_boats() gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT) # The OK Button item = goocanvas.Svg(parent=self.rootitem, svg_handle=gcompris.skin.svg_get(), svg_id="#OK") zoom = 0.7 item.translate( (item.get_bounds().x1 * -1) + (gcompris.BOARD_WIDTH / 2 + 25) / zoom, (item.get_bounds().y1 * -1) + (gcompris.BOARD_HEIGHT - 135) / zoom) item.scale(zoom, zoom) item.connect("button_press_event", self.ok_event) gcompris.utils.item_focus_init(item, None) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(gcompris.BOARD_WIDTH / 2 - 105, -1, 0.6)
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()
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.")
def start(self): print "computer_simulation start" # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(gcompris.BOARD_WIDTH - 190, -1, 0.7) # 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()) self.display_game()
def start(self): # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_LEVEL) if self.read_data(): data = self.dataset.get_level(1, 1) if not data: return if self.gcomprisBoard.mode == "nobackgroundmusic": # pause the bg music gcompris.sound.pause() self.gcomprisBoard.level = 1 self.gcomprisBoard.maxlevel = self.dataset.number_of_level() self.gcomprisBoard.sublevel = 1 gcompris.bar_set(gcompris.BAR_LEVEL | gcompris.BAR_REPEAT) gcompris.bar_set_level(self.gcomprisBoard) gcompris.sound.policy_set(gcompris.sound.PLAY_AND_INTERRUPT) self.first_run = True self.play(data)
def start(self): # GCompris initialisation self.gcomprisBoard.level=1 self.gcomprisBoard.maxlevel=1 self.gcomprisBoard.sublevel=0 self.gcomprisBoard.number_of_sublevel=0 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()) self.doc = Document(self) # initialisation self.draw_tools() self.draw_animtools() self.doc.timeline.draw() if self.gcomprisBoard.mode == 'draw': self.doc.timeline.hide() self.color_rootitem = goocanvas.Group( parent = self.gcomprisBoard.canvas.get_root_item()) self.color = Color(self.color_rootitem, self.drawing_area) self.color.draw() self.draw_drawing_area() self.draw_playing_area() gcompris.bar_set(gcompris.BAR_JOURNAL) gcompris.bar_location(10, -1, 0.6) if gcompris.sugar_detected(): journal_file = gcompris.sugar_load() if journal_file: fles.doc.file_to_anim(journal_file)
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, "")
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)
def start(self): # 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.game_complete = False self.rootitem = goocanvas.Group( parent=self.gcomprisBoard.canvas.get_root_item()) self.background = goocanvas.Image( parent=self.rootitem, pixbuf=gcompris.utils.load_pixmap( "place_your_satellite/background.jpg"), x=1, y=1) image = "place_your_satellite/planet" + str(self.gcomprisBoard.level) +\ ".png" self.planet = goocanvas.Image( parent=self.rootitem, pixbuf=gcompris.utils.load_pixmap(image), x=gcompris.BOARD_WIDTH / 2 - 50 - (self.gcomprisBoard.level * 10), y=gcompris.BOARD_HEIGHT / 2 - 50 - (self.gcomprisBoard.level * 10)) self.instructions( _('Click anywhere on the screen to place the satellite ' 'at a distance from the planet.') + "\n" + _('Then click on the satellite and drag a line that sets ' 'the speed of the satellite')) self.message = Message(self.rootitem, 400, 50, 20) self.distanceIndicator = Message(self.rootitem, 400, 480, 5) self.satellite = Satellite(self, self.rootitem, self.gcomprisBoard.level) self.speed = Speed(self.satellite, self.rootitem) # Set the buttons we want in the bar gcompris.bar_set(gcompris.BAR_REPEAT | gcompris.BAR_LEVEL) gcompris.bar_location(2, -1, 0.5) gcompris.bar_set_level(self.gcomprisBoard)
def start(self): # load pixmaps for the ui. # gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT) gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_location(10, -1, 0.7) # Create persistent over levels root item canvas for the board self.rootitem_p = goocanvas.Group( parent = self.gcomprisBoard.canvas.get_root_item() ) self.profbutton = self.prof_button(self, self.rootitem_p, profs[self.gcomprisBoard.level - 1]) self.answer = self.answer_button(self.rootitem_p, self.scales[self.gcomprisBoard.sublevel-1], self.pixmap_green_ball, self.number_balls[self.gcomprisBoard.sublevel-1]) # self.newGame()
def start(self): # Set a background image gcompris.set_default_background( self.gcomprisBoard.canvas.get_root_item()) #Boolean variable declaration self.mapActive = False #CONSTANT Declarations self.board_paused = 0 self.timerAnim = 0 self.counter = 0 self.gamewon = 0 self.score_player_a = 0 self.score_player_b = 0 self.tile_counter = 0 self.rectangle_counter = 0 #REPEAT ICON pixmap = gcompris.utils.load_svg("braille_alphabets/target.svg") gcompris.bar_set_repeat_icon(pixmap) gcompris.bar_set(gcompris.BAR_REPEAT_ICON) gcompris.bar_location(320, -1, 0.8) # 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()) self.lotto_board() # 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
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()