def _setup_first_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('forest-4-3.png'), self.media_path('forest-16-9.png')) scene.add_widget( ActiveImage(self.media_path('left-bug.gif'), hover=self.media_path('left-bug-hover.gif')), Placement(0.03, 0.1), Placement(0.05, 0.2), [self._bug_zapped, scene, 'left-bug'], name='left-bug') scene.add_widget( ActiveImage(self.media_path('middle-bug.gif'), hover=self.media_path('middle-bug-hover.gif')), Placement(0.47, 0.45), Placement(0.47, 0.49), [self._bug_zapped, scene, 'middle-bug'], name='middle-bug') scene.add_widget( ActiveImage(self.media_path('right-bug.gif'), hover=self.media_path('right-bug-hover.gif')), Placement(0.9, 0.05), Placement(0.955, 0.04), [self._bug_zapped, scene, 'right-bug'], name='right-bug') self._place_judoka_into_scene(scene) return scene
def _setup_first_scene(self): scene = Scene() scene.set_background(self.media_path('space-1-bg-4-3.png'), self.media_path('space-1-bg-16-9.png')) scene.add_widget( Gtk.Image.new_from_file(self.media_path('spaceman.png')), Placement(0.9, 0.9, 0.65), Placement(0.9, 0.9, 0.75)) copy = [ 'Let\'s connect to the web!', '', 'Get started by clicking', 'the WiFi console!' ] sb = SpeechBubble(text='\n'.join(copy), source=SpeechBubble.BOTTOM, scale=scene.scale_factor) scene.add_widget(sb, Placement(0.955, 0.55), Placement(0.94, 0.46)) scene.add_widget( ActiveImage(self.media_path('console.gif'), hover=self.media_path('console-hover.gif')), Placement(0.35, 0.925, 0.8), Placement(0.367, 0.888), self.second_scene) # Commeted out hint # scene.schedule(20, self._show_console_hint, scene, sb) return scene
def _setup_third_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path("blueprint-bg-4-3.png"), common_media_path("blueprint-bg-16-9.png")) overworld_img = "overworld-zoom.gif" if scene.ratio == Scene.RATIO_4_3: overworld_img = "overworld-zoom-small.gif" scene.add_widget( Gtk.Image.new_from_file(self.media_path(overworld_img)), Placement(0.85, 0.4, 0), Placement(0.8, 0.4, 0) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("intro-gif-2.gif")), Placement(0.1, 0.62, 0), Placement(0.18, 0.61, 0), ) copy = ["Kano is a world where", "anything is possible!", "Judokas can make and play", "using code powers."] scene.add_widget( SpeechBubble(text="\n".join(copy), source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.12, 0.13, 0), Placement(0.16, 0.21, 0), ) scene.add_widget( NextButton(), Placement(0.5, 0.92, 0), Placement(0.5, 0.92, 0), self.fourth_scene, key=Gdk.KEY_space ) return scene
def _setup_first_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('quests-4-3.png'), self.media_path('quests-16-9.png')) # Character path in the home directory character_path = os.path.join(os.path.expanduser("~"), ".character-content/character.png") scene.add_widget(Gtk.Image.new_from_file(character_path), Placement(0.08, 0.9, 0.7), Placement(0.12, 0.9, 0.7)) scene.add_widget( Gtk.Image.new_from_file(self.media_path('judoka.png')), Placement(0.6, 0.4, 1.0), Placement(0.62, 0.2, 1.0)) scene.add_widget( SpeechBubble( text= "You did it! Now you know how\nto control your computer.\nThis was the first of many\nquests you'll find in the\nWorld of Kano", source=SpeechBubble.RIGHT, scale=scene.scale_factor), Placement(0.22, 0.27), Placement(0.35, 0.18)) scene.add_widget(NextButton(), Placement(0.3, 0.5, 0), Placement(0.37, 0.43, 0), self.second_scene, key=Gdk.KEY_space) return scene
def _setup_second_scene(self): scene = Scene() scene.set_background(self.media_path('quests-4-3.png'), self.media_path('quests-16-9.png')) # Character path in the home directory character_path = os.path.join(os.path.expanduser("~"), ".character-content/character.png") scene.add_widget(Gtk.Image.new_from_file(character_path), Placement(0.08, 0.9, 0.7), Placement(0.12, 0.9, 0.7)) scene.add_widget(Gtk.Image.new_from_file(self.media_path('shine.gif')), Placement(0.52, 0.31, 1.0), Placement(0.553, 0.2, 1.0)) scene.add_widget( Gtk.Image.new_from_file(self.media_path('judoka.png')), Placement(0.6, 0.4, 1.0), Placement(0.62, 0.2, 1.0), self.third_scene) copy = [ 'Click on my scroll to find', 'out more and start the', 'next adventure...' ] scene.add_widget( SpeechBubble(text='\n'.join(copy), source=SpeechBubble.RIGHT, scale=scene.scale_factor), Placement(0.22, 0.27), Placement(0.35, 0.18)) return scene
def _setup_first_scene(self): scene = Scene() scene.set_background(self.media_path('scene-1600x1200.png'), self.media_path('scene-1920x1080.png')) self._first_scene = scene scene.add_widget( SpeechBubble( text="Let's dress up your\ncharacter!", source=SpeechBubble.BOTTOM, scale=scene.scale_factor ), Placement(0.9, 0.4), Placement(0.85, 0.45) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("tailor-judoka.png")), Placement(0.85, 0.8, 0.85), Placement(0.8, 0.9, 0.85) ) scene.add_widget( ActiveImage(self.media_path("outline.gif"), hover=self.media_path("outline-hover.png")), Placement(0.5, 0.7, 0.95), Placement(0.45, 0.72, 0.95), self._char_creator_window ) return scene
def _setup_first_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('forest-4-3.png'), self.media_path('forest-16-9.png')) scene.add_widget( ActiveImage(self.media_path('left-bug.gif'), hover=self.media_path('left-bug-hover.gif')), Placement(0.03, 0.1), Placement(0.05, 0.2), [self._bug_zapped, scene, 'left-bug'], name='left-bug' ) scene.add_widget( ActiveImage(self.media_path('middle-bug.gif'), hover=self.media_path('middle-bug-hover.gif')), Placement(0.47, 0.45), Placement(0.47, 0.49), [self._bug_zapped, scene, 'middle-bug'], name='middle-bug' ) scene.add_widget( ActiveImage(self.media_path('right-bug.gif'), hover=self.media_path('right-bug-hover.gif')), Placement(0.9, 0.05), Placement(0.955, 0.04), [self._bug_zapped, scene, 'right-bug'], name='right-bug' ) self._place_judoka_into_scene(scene) return scene
def _setup_fourth_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path("blueprint-bg-4-3.png"), common_media_path("blueprint-bg-16-9.png")) overworld_img = "overworld.png" if scene.ratio == Scene.RATIO_4_3: overworld_img = "overworld-small.png" scene.add_widget( Gtk.Image.new_from_file(self.media_path(overworld_img)), Placement(0.85, 0.4, 0), Placement(0.8, 0.4, 0) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("intro-gif-3.gif")), Placement(0.075, 0.5, 0), Placement(0.18, 0.60, 0), ) copy = ["Ready to go? Jump on in!"] scene.add_widget( SpeechBubble(text="\n".join(copy), source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.125, 0.13, 0), Placement(0.176, 0.25, 0), ) scene.add_widget( NextButton(), Placement(0.5, 0.92, 0), Placement(0.5, 0.92, 0), self.next_stage, key=Gdk.KEY_space ) return scene
def _setup_first_scene(self): scene = Scene() scene.set_background(self.media_path('scene-1600x1200.png'), self.media_path('scene-1920x1080.png')) self._first_scene = scene scene.add_widget( SpeechBubble(text="Let's dress up your\ncharacter!", source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.9, 0.4), Placement(0.85, 0.45)) scene.add_widget( Gtk.Image.new_from_file(self.media_path("tailor-judoka.png")), Placement(0.85, 0.8, 0.85), Placement(0.8, 0.9, 0.85)) scene.add_widget( ActiveImage(self.media_path("outline.gif"), hover=self.media_path("outline-hover.png")), Placement(0.5, 0.7, 0.95), Placement(0.45, 0.72, 0.95), self._char_creator_window) return scene
def _setup_second_scene(self): self._ctl.main_window.get_window().set_cursor(None) scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('scene-1600x1200.png'), self.media_path('scene-1920x1080.png')) # Need to get the character at this point. char_path = os.path.join(os.path.expanduser("~"), ".character-content/character.png") scene.add_widget(Gtk.Image.new_from_file(char_path), Placement(0.5, 0.65, 0.69), Placement(0.45, 0.65, 0.69)) scene.add_widget( Gtk.Image.new_from_file(self.media_path("tailor-judoka.png")), Placement(0.85, 0.8, 0.85), Placement(0.85, 0.8, 0.85)) scene.add_widget( SpeechBubble(text="You look amazing!", source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.9, 0.4), Placement(0.9, 0.4)) scene.add_profile_icon() scene.add_widget(NextButton(), Placement(0.5, 0.95, 0), Placement(0.45, 0.95, 0), self.next_stage, key=Gdk.KEY_space) return scene
def _setup_base_temple_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('blocks-scene-incomplete-1600x1200.png'), self.media_path('blocks-scene-incomplete-1920x1080.png')) scene.add_profile_icon() scene.add_widget( Gtk.Image.new_from_file(self.media_path("boulder.png")), Placement(0.65, 0.47), Placement(0.63, 0.44) ) scene.add_widget( scene.get_user_character_image(), Placement(0.22, 0.55, 0.52), Placement(0.22, 0.6, 0.52) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("mage-doka.png")), Placement(0.8, 0.55), Placement(0.8, 0.6) ) return scene
def _setup_second_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('cliff-file-1600x1200.png'), self.media_path('cliff-file-1920x1080.png')) scene.add_widget( SpeechBubble(text='Thanks!', source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.845, 0.08), Placement(0.895, 0.1)) scene.add_widget( Gtk.Image.new_from_file(self.media_path('cliff-judoka.png')), Placement(0.85, 0.3, 0.92), Placement(0.9, 0.35, 0.96)) #scene.add_widget( # NextButton(), # Placement(0.5, 0.7, 0), # Placement(0.5, 0.7, 0), # self._ctl.next_stage # # key=Gdk.KEY_space #) scene.schedule(3, self._ctl.next_stage) return scene
def _setup_disconnected_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('space-1-bg-4-3.png'), self.media_path('space-1-bg-16-9.png')) scene.add_widget( Gtk.Image.new_from_file(self.media_path('spaceman.png')), Placement(0.9, 0.9, 0.65), Placement(0.9, 0.9, 0.75)) scene.add_widget( Gtk.Image.new_from_file(self.media_path('console.gif')), Placement(0.35, 0.925, 0.8), Placement(0.367, 0.888), self.second_scene) copy = [ 'Oh no, the connection failed!', 'But we can still play.', ] scene.add_widget( SpeechBubble(text='\n'.join(copy), source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.97, 0.57), Placement(0.95, 0.46)) scene.add_widget(NextButton(), Placement(0.5, 0.99, 0), Placement(0.45, 0.99, 0), self.next_stage) scene.schedule(20, self._show_rocket_hint, scene) return scene
def _setup_second_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('cliff-file-1600x1200.png'), self.media_path('cliff-file-1920x1080.png')) scene.add_widget( SpeechBubble(text='Thanks!', source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.845, 0.08), Placement(0.895, 0.1) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('cliff-judoka.png')), Placement(0.85, 0.3, 0.92), Placement(0.9, 0.35, 0.96) ) #scene.add_widget( # NextButton(), # Placement(0.5, 0.7, 0), # Placement(0.5, 0.7, 0), # self._ctl.next_stage # # key=Gdk.KEY_space #) scene.schedule(3, self._ctl.next_stage) return scene
def _setup_second_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path("blueprint-bg-4-3.png"), common_media_path("blueprint-bg-16-9.png")) copy = [ "Well done! You brought your", "Kano to life! I'm Judoka and I", "will be your guide through the", "world of Kano.", ] scene.add_widget( SpeechBubble(text="\n".join(copy), source=SpeechBubble.LEFT, scale=scene.scale_factor), Placement(0.72, 0.35), Placement(0.655, 0.3), ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("intro-gif-1.gif")), Placement(0.33, 0.4, 0), Placement(0.405, 0.4, 0), ) scene.add_widget( NextButton(), Placement(0.5, 0.85, 0), Placement(0.5, 0.8, 0), self.third_scene, key=Gdk.KEY_space ) return scene
def _setup_first_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) # Grey overlay #blur = Gtk.EventBox() #blur.get_style_context().add_class("blur") #screen = Gdk.Screen.get_default() #width = screen.get_width() #height = screen.get_height() #blur.set_size_request(width, height) # This currently blocks the emergency exit button #scene.add_widget( # blur, # Placement(0, 0, 0), # Placement(0, 0, 0), #) # No longer in use. # click_label = Gtk.Label("CLICK") # click_label.get_style_context().add_class("intro_label") # move_label = Gtk.Label("MOVE") # move_label.get_style_context().add_class("intro_label") # hbox = Gtk.Box() # hbox.pack_start(click_label, False, False, 0) # hbox.pack_end(move_label, False, False, 0) # click_label.set_margin_left(30) # move_label.set_margin_right(30) # Create the keyboard and pack it before putting it in the grab_label = Gtk.Label("Click NEXT to start") grab_label.get_style_context().add_class("big_intro_label") keyboard_gif = Gtk.Image.new_from_file( self.media_path("KeyboardClick.gif") ) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.pack_start(grab_label, False, False, 0) vbox.pack_start(keyboard_gif, False, False, 20) scene.add_widget( vbox, Placement(0.5, 0.5, 0), Placement(0.5, 0.5, 0) ) scene.add_widget( NextButton(), Placement(0.5, 0.75, 0), Placement(0.5, 0.75, 0), self.next_stage ) scene.schedule(60, self._show_hint, scene) return scene
def _setup_third_scene(self): scene = Scene() scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) scene.add_widget(Scroll(self), Placement(0.5, 0.5, 0.0), Placement(0.5, 0.5, 0.0)) return scene
def _setup_first_scene(self): scene = Scene() scene.set_background(self.media_path('cliff-file-1600x1200.png'), self.media_path('cliff-file-1920x1080.png')) char_pixbuf = GdkPixbuf.Pixbuf.new_from_file( self.media_path('judoka-clicked.png') ) char_pixbuf = scene.scale_pixbuf_to_scene(char_pixbuf, 0.92, 0.96) judoka = Gtk.Image.new_from_file(self.media_path('cliff-judoka.png')) judoka = scene.scale_image_to_scene(judoka, 0.92, 0.96) speechbubble = SpeechBubble( text='Click on me,\nhold down the mouse button,\nand drag me across!', source=SpeechBubble.LEFT, source_align=0.0, scale=scene.scale_factor ) keyboard = Gtk.Image.new_from_file(self.media_path('Keyboard-Drag.gif')) drag_source = DragSource(judoka, char_pixbuf, speechbubble, keyboard) # Send the second cb to the scene drop_area = DropArea(self.second_scene) drop_area.set_size_request( 0.35 * SCREEN_WIDTH, 0.5 * SCREEN_HEIGHT ) scene.add_widget( keyboard, Placement(0.5, 1, 0), Placement(0.5, 1, 0) ) scene.add_widget( speechbubble, Placement(0.34, 0.23), Placement(0.4, 0.23), name='speech' ) scene.add_widget( drag_source, Placement(0.15, 0.25), Placement(0.25, 0.25) ) scene.add_widget( drop_area, Placement(1, 0), Placement(1, 0) ) scene.schedule(40, self._scene_1_hint, speechbubble) return scene
def _setup_third_scene(self): scene = Scene() scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) scene.add_widget( Scroll(self), Placement(0.5, 0.5, 0.0), Placement(0.5, 0.5, 0.0) ) return scene
def _setup_second_scene(self): scene = Scene() scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) # scene.add_profile_icon() scene.add_widget( WifiConsole(self, self.connected_scene, self.next_stage), Placement(0.5, 0.5, 0.0), Placement(0.5, 0.5, 0.0)) return scene
def _setup_fifth_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('blocks-scene-complete-1600x1200.png'), self.media_path('blocks-scene-complete-1920x1080.png')) scene.add_profile_icon() # Move boulder scene.add_widget( Gtk.Image.new_from_file(self.media_path("boulder.png")), Placement(0.8, 0.44), Placement(0.8, 0.44) ) scene.add_widget( scene.get_user_character_image(), Placement(0.22, 0.55, 0.52), Placement(0.22, 0.6, 0.52) ) scene.add_widget( SpeechBubble( text="Awesome, now we can escape!", source=SpeechBubble.BOTTOM, source_align=0.5, scale=scene.scale_factor ), Placement(0.85, 0.25, 0), Placement(0.85, 0.25, 0) ) # Change mage face? scene.add_widget( Gtk.Image.new_from_file(self.media_path("mage-doka.png")), Placement(0.8, 0.55), Placement(0.8, 0.6) ) scene.add_widget( NextButton(), Placement(0.5, 0.8, 0), Placement(0.5, 0.87, 0), self.next_stage, key=Gdk.KEY_space ) return scene
def _setup_third_scene(self): scene = Scene() scene.set_background(common_media_path("blueprint-bg-4-3.png"), common_media_path("blueprint-bg-16-9.png")) scene.add_profile_icon() # Altar scene.add_widget(Gtk.Image.new_from_file(self.media_path('altar-incomplete.png')), Placement(0.5, 0.5, 1), Placement(0.5, 0.5, 1)) # Block image for drag source block_image = scene.scale_image_to_scene( Gtk.Image.new_from_file(self.media_path("kano-block.png")), 1, 1 ) block_pixbuf = scene.scale_pixbuf_to_scene( GdkPixbuf.Pixbuf.new_from_file(self.media_path("kano-block.png")), 1, 1 ) block_drag_source = DragSource(block_image, block_pixbuf) scene.add_widget( block_drag_source, Placement(0.5, 0.68, 0), Placement(0.5, 0.68, 0) ) # Block drop area drop_area = DropArea(self.fourth_scene) drop_area_width = scene.get_width() * 0.24 drop_area_height = scene.get_height() * 0.08 drop_area.set_size_request(drop_area_width, drop_area_height) scene.add_widget( drop_area, Placement(0.505, 0.47, 0), Placement(0.505, 0.47, 0) ) return scene
def _setup_second_scene(self): scene = Scene() scene.set_background(self.media_path('quests-4-3.png'), self.media_path('quests-16-9.png')) # Character path in the home directory character_path = os.path.join( os.path.expanduser("~"), ".character-content/character.png" ) scene.add_widget( Gtk.Image.new_from_file(character_path), Placement(0.08, 0.9, 0.7), Placement(0.12, 0.9, 0.7) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('shine.gif')), Placement(0.52, 0.31, 1.0), Placement(0.553, 0.2, 1.0) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('judoka.png')), Placement(0.6, 0.4, 1.0), Placement(0.62, 0.2, 1.0), self.third_scene ) copy = [ 'Click on my scroll to find', 'out more and start the', 'next adventure...' ] scene.add_widget( SpeechBubble( text='\n'.join(copy), source=SpeechBubble.RIGHT, scale=scene.scale_factor ), Placement(0.22, 0.27), Placement(0.35, 0.18) ) return scene
def _setup_first_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path("blueprint-bg-4-3.png"), common_media_path("blueprint-bg-16-9.png")) # Grey overlay # blur = Gtk.EventBox() # blur.get_style_context().add_class("blur") # screen = Gdk.Screen.get_default() # width = screen.get_width() # height = screen.get_height() # blur.set_size_request(width, height) # This currently blocks the emergency exit button # scene.add_widget( # blur, # Placement(0, 0, 0), # Placement(0, 0, 0), # ) # No longer in use. # click_label = Gtk.Label("CLICK") # click_label.get_style_context().add_class("intro_label") # move_label = Gtk.Label("MOVE") # move_label.get_style_context().add_class("intro_label") # hbox = Gtk.Box() # hbox.pack_start(click_label, False, False, 0) # hbox.pack_end(move_label, False, False, 0) # click_label.set_margin_left(30) # move_label.set_margin_right(30) # Create the keyboard and pack it before putting it in the grab_label = Gtk.Label("Click NEXT to start") grab_label.get_style_context().add_class("big_intro_label") keyboard_gif = Gtk.Image.new_from_file(self.media_path("KeyboardClick.gif")) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.pack_start(grab_label, False, False, 0) vbox.pack_start(keyboard_gif, False, False, 20) scene.add_widget(vbox, Placement(0.5, 0.5, 0), Placement(0.5, 0.5, 0)) scene.add_widget(NextButton(), Placement(0.5, 0.75, 0), Placement(0.5, 0.75, 0), self.next_stage) scene.schedule(60, self._show_hint, scene) return scene
def _setup_third_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) overworld_img = 'overworld-zoom.gif' if scene.ratio == Scene.RATIO_4_3: overworld_img = 'overworld-zoom-small.gif' scene.add_widget( Gtk.Image.new_from_file(self.media_path(overworld_img)), Placement(0.85, 0.4, 0), Placement(0.8, 0.4, 0), ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('intro-gif-2.gif')), Placement(0.1, 0.62, 0), Placement(0.18, 0.61, 0), ) copy = [ "Kano is a world where", "anything is possible!", "Judokas can make and play", "using code powers." ] scene.add_widget( SpeechBubble( text='\n'.join(copy), source=SpeechBubble.BOTTOM, scale=scene.scale_factor ), Placement(0.12, 0.13, 0), Placement(0.16, 0.21, 0), ) scene.add_widget( NextButton(), Placement(0.5, 0.92, 0), Placement(0.5, 0.92, 0), self.fourth_scene, key=Gdk.KEY_space ) return scene
def _setup_second_scene(self): self._ctl.main_window.get_window().set_cursor(None) scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('scene-1600x1200.png'), self.media_path('scene-1920x1080.png')) # Need to get the character at this point. char_path = os.path.join( os.path.expanduser("~"), ".character-content/character.png" ) scene.add_widget( Gtk.Image.new_from_file(char_path), Placement(0.5, 0.65, 0.69), Placement(0.45, 0.65, 0.69) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("tailor-judoka.png")), Placement(0.85, 0.8, 0.85), Placement(0.85, 0.8, 0.85) ) scene.add_widget( SpeechBubble( text="You look amazing!", source=SpeechBubble.BOTTOM, scale=scene.scale_factor ), Placement(0.9, 0.4), Placement(0.9, 0.4) ) scene.add_profile_icon() scene.add_widget( NextButton(), Placement(0.5, 0.95, 0), Placement(0.45, 0.95, 0), self.next_stage, key=Gdk.KEY_space ) return scene
def _setup_first_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('quests-4-3.png'), self.media_path('quests-16-9.png')) # Character path in the home directory character_path = os.path.join( os.path.expanduser("~"), ".character-content/character.png" ) scene.add_widget( Gtk.Image.new_from_file(character_path), Placement(0.08, 0.9, 0.7), Placement(0.12, 0.9, 0.7) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('judoka.png')), Placement(0.6, 0.4, 1.0), Placement(0.62, 0.2, 1.0) ) scene.add_widget( SpeechBubble( text="You did it! Now you know how\nto control your computer.\nThis was the first of many\nquests you'll find in the\nWorld of Kano", source=SpeechBubble.RIGHT, scale=scene.scale_factor ), Placement(0.22, 0.27), Placement(0.35, 0.18) ) scene.add_widget( NextButton(), Placement(0.3, 0.5, 0), Placement(0.37, 0.43, 0), self.second_scene, key=Gdk.KEY_space ) return scene
def _setup_first_scene(self): scene = Scene() scene.set_background(self.media_path('cliff-file-1600x1200.png'), self.media_path('cliff-file-1920x1080.png')) char_pixbuf = GdkPixbuf.Pixbuf.new_from_file( self.media_path('judoka-clicked.png')) char_pixbuf = scene.scale_pixbuf_to_scene(char_pixbuf, 0.92, 0.96) judoka = Gtk.Image.new_from_file(self.media_path('cliff-judoka.png')) judoka = scene.scale_image_to_scene(judoka, 0.92, 0.96) speechbubble = SpeechBubble( text= 'Click on me,\nhold down the mouse button,\nand drag me across!', source=SpeechBubble.LEFT, source_align=0.0, scale=scene.scale_factor) keyboard = Gtk.Image.new_from_file( self.media_path('Keyboard-Drag.gif')) drag_source = DragSource(judoka, char_pixbuf, speechbubble, keyboard) # Send the second cb to the scene drop_area = DropArea(self.second_scene) drop_area.set_size_request(0.35 * SCREEN_WIDTH, 0.5 * SCREEN_HEIGHT) scene.add_widget(keyboard, Placement(0.5, 1, 0), Placement(0.5, 1, 0)) scene.add_widget(speechbubble, Placement(0.34, 0.23), Placement(0.4, 0.23), name='speech') scene.add_widget(drag_source, Placement(0.15, 0.25), Placement(0.25, 0.25)) scene.add_widget(drop_area, Placement(1, 0), Placement(1, 0)) scene.schedule(40, self._scene_1_hint, speechbubble) return scene
def _setup_fourth_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) overworld_img = 'overworld.png' if scene.ratio == Scene.RATIO_4_3: overworld_img = 'overworld-small.png' scene.add_widget( Gtk.Image.new_from_file(self.media_path(overworld_img)), Placement(0.85, 0.4, 0), Placement(0.8, 0.4, 0), ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('intro-gif-3.gif')), Placement(0.075, 0.5, 0), Placement(0.18, 0.60, 0), ) copy = ['Ready to go? Jump on in!'] scene.add_widget( SpeechBubble( text='\n'.join(copy), source=SpeechBubble.BOTTOM, scale=scene.scale_factor ), Placement(0.125, 0.13, 0), Placement(0.176, 0.25, 0), ) scene.add_widget( NextButton(), Placement(0.5, 0.92, 0), Placement(0.5, 0.92, 0), self.next_stage, key=Gdk.KEY_space ) return scene
def _setup_fourth_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path("blueprint-bg-4-3.png"), common_media_path("blueprint-bg-16-9.png")) scene.add_profile_icon() scene.add_widget( Gtk.Image.new_from_file(self.media_path("altar-complete.png")), Placement(0.5, 0.5, 1), Placement(0.5, 0.5, 1), ) scene.add_widget( NextButton(), Placement(0.5, 0.9, 0), Placement(0.5, 0.9, 0), self.fifth_scene, key=Gdk.KEY_space ) return scene
def _setup_connected_scene(self): scene = Scene() scene.set_background(self.media_path('space-2-bg-4-3.png'), self.media_path('space-2-bg-16-9.png')) scene.add_widget( Gtk.Image.new_from_file(self.media_path('spaceman.png')), Placement(0.9, 0.9, 0.65), Placement(0.9, 0.9, 0.75)) scene.add_widget( Gtk.Image.new_from_file(self.media_path('rocket.png')), Placement(0.697, 0.597, 0.8), Placement(0.695, 0.275)) copy = 'We have signal! Great work.' scene.add_widget( SpeechBubble(text=copy, source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.97, 0.57), Placement(0.95, 0.46)) scene.schedule(3, self.next_stage) return scene
def _setup_second_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) copy = [ 'Well done! You brought your', 'Kano to life! I\'m Judoka and I', 'will be your guide through the', 'world of Kano.' ] scene.add_widget( SpeechBubble( text='\n'.join(copy), source=SpeechBubble.LEFT, scale=scene.scale_factor ), Placement(0.72, 0.35), Placement(0.655, 0.3) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('intro-gif-1.gif')), Placement(0.33, 0.4, 0), Placement(0.405, 0.4, 0), ) scene.add_widget( NextButton(), Placement(0.5, 0.85, 0), Placement(0.5, 0.8, 0), self.third_scene, key=Gdk.KEY_space ) return scene
def _setup_fourth_scene(self): scene = Scene(self._ctl.main_window) scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) # Pass the callback of what we want to launch in the profile icon self._add_profile_icon(scene) self._add_world_icon(scene, offline=(not is_registered())) self._add_taskbar(scene) # Go through all the desktop icons and add them to the desktop # Either go through all files in a folder with a specific pattern, or # just list them in an array # All icons are in /usr/share/icons/Kano/88x88/apps # or /usr/share/kano-desktop/icons parent_dir = "/usr/share/kano-desktop/icons" parent_dir_2 = "/usr/share/icons/Kano/88x88/apps" self._apps_next_button_shown = False # Order the icons needed icon_info = [ ("snake", os.path.join(parent_dir, "snake.png")), ("pong", os.path.join(parent_dir, "pong.png")), ("minecraft", os.path.join(parent_dir, "make-minecraft.png")), ("music", os.path.join(parent_dir, "sonicpi.png")), ("internet", os.path.join(parent_dir, "internet-desktop.png")), ("apps", os.path.join(parent_dir, "apps.png")), ("home", os.path.join(parent_dir, "kano-homefolder.png")), ("art", os.path.join(parent_dir_2, "kano-draw.png")), ("terminal-quest", os.path.join(parent_dir_2, "linux-story.png")), ("scratch", os.path.join(parent_dir, "scratch.png")), ("video", os.path.join(parent_dir_2, "video.png")) #("plus", os.path.join(parent_dir, "plus-icon.png")) ] self._desktop_icons = { "snake": { "text": "Customize your own Snake game,\n" + "and share special gameboards.", "position": [0, 340], "source_align": 0.1 }, "pong": { "text": "You can make this classic game yourself,\n" + "with new rules, cheats, and powers.", "position": [0, 340], "source_align": 0.42 }, "minecraft": { "text": "Normal people play Minecraft.\n" + "On Kano, you can hack the game with code.", "position": [95, 340], "source_align": 0.5 }, "terminal-quest": { "text": "The Terminal talks to the computer's\n" + "brain directly. Use its powers to go on a quest.", "position": [0, 210], "source_align": 0.37 }, "music": { "text": "You can make sounds, beats, loops,\n" + "and songs on Kano.", "position": [290, 340], "source_align": 0.5 }, "art": { "text": "Ever drawn or painted?\n" + "You can create incredible artworks with code.", "position": [0, 210], "source_align": 0.07 }, "internet": { "text": "You can browse the web.", "position": [490, 360], "source_align": 0.5 }, "scratch": { "text": "You can play with code blocks.", "position": [167, 210], "source_align": 0.5 }, "home": { "text": "Look at your files and folders here.", "position": [550, 360], "source_align": 1.0 }, "apps": { "text": "Find even more apps here.", "position": [620, 360], "source_align": 0.5 }, "video": { "text": "YouTube", "position": [435, 250], "source_align": 0.5 } } fixed = Gtk.Fixed() fixed.set_size_request(1024, 720) scene.add_widget(fixed, Placement(0.5, 1.0, 0), Placement(0.5, 1.0, 0), name="icon_grid_fixed") icon_grid = Gtk.Grid() icon_grid.set_row_spacing(35) icon_grid.set_column_spacing(35) row = 1 column = 0 for info in icon_info: (name, f) = info icon = Gtk.Button() self._desktop_icons[name]['icon'] = Gtk.Image.new_from_file(f) self._desktop_icons[name]['bwicon'] = desaturate_image( Gtk.Image.new_from_file(f)) icon.set_image(self._desktop_icons[name]['bwicon']) attach_cursor_events(icon) icon.connect("clicked", self._change_apps_speechbubble_text, name, scene) icon_grid.attach(icon, column, row, 1, 1) column += 1 if column >= 7: column = 0 row -= 1 fixed.put(icon_grid, 40, 380) # Pack the speechbubble into a fixed so it the same distance from # apps for all resolutions. speechbubble_fixed = Gtk.Fixed() speechbubble_fixed.set_size_request(1024, 720) speechbubble_fixed.put( SpeechBubble(text='These are your Apps!\n' + 'You can make games, songs,\n' + 'artworks and more,\n' + 'then share them to World.', source=SpeechBubble.BOTTOM), 300, 100) scene.add_widget(speechbubble_fixed, Placement(0.5, 1), Placement(0.5, 1), name="app_speechbubble") return scene
def _setup_third_scene(self): self._toolbar_icons = { "home": { "text": "Click the Home button to\n" + "return to the desktop.", "position": [0, 100], "source_align": 0.2 }, "help": { "text": "If you need Help,\n" + "you can click here.", "position": [19, 100], "source_align": 0.5 }, "profile": { "text": "Here's where you can\n" + "sync your online Profile.", "position": [38, 100], "source_align": 0.5 }, "wifi": { "text": "You can change Internet\n" + "settings here.", "position": [75, 100], "source_align": 0.5 }, "updater": { "text": "Want updates?\n" + "Click on the Updater.", "position": [150, 100], "source_align": 0.5 }, "settings": { "text": "And this is where you can change\n" + "all the system Settings.", "position": [55, 100], "source_align": 0.7 }, "audio": { "text": "Control the volume\n" + "of the system.", "position": [150, 100], "source_align": 1.0 } } self._toolbar_next_button_shown = False scene = Scene(self._ctl.main_window) scene.set_background(common_media_path('blueprint-bg-4-3.png'), common_media_path('blueprint-bg-16-9.png')) self._add_profile_icon(scene) self._add_world_icon(scene, offline=(not is_registered())) # Pack the speechbubble into a fixed so it the same distance from # toolbar for all resolutions speechbubble_fixed = Gtk.Fixed() speechbubble_fixed.set_size_request(500, 400) speechbubble_fixed.put( SpeechBubble( text='This is your Taskbar!\n' + 'Click on the different widgets to find\n' + 'out more about what they do.', # 'Use its buttons to change settings,\n' + # 'get updates, and more.', source=SpeechBubble.BOTTOM), 0, 100) scene.add_widget(speechbubble_fixed, Placement(1, 1), Placement(1, 1), name="toolbar_speechbubble") self._add_taskbar(scene, attach_callbacks=True) return scene