def _change_apps_speechbubble_text(self, widget, name, scene): scene.remove_widget("app_speechbubble") widget.set_image(self._desktop_icons[name]['icon']) if name in self._desktop_icons: text = self._desktop_icons[name]["text"] self._desktop_icons[name]['opened'] = True sb = SpeechBubble( text=text, source=SpeechBubble.BOTTOM, source_align=self._desktop_icons[name]["source_align"]) sb.connect('button-release-event', self._close_speechbubble, scene) fixed = Gtk.Fixed() fixed.set_size_request(1024, 720) fixed.put(sb, self._desktop_icons[name]["position"][0], self._desktop_icons[name]["position"][1]) scene.add_widget( fixed, Placement(0.5, 1, 0), Placement(0.5, 1, 0), name="app_speechbubble", ) for icon in self._desktop_icons.itervalues(): if not icon.has_key('opened') or not icon['opened']: return True if not self._apps_next_button_shown: self._apps_next_button_shown = True scene.add_widget(NextButton(), Placement(0.5, 0.3, 0), Placement(0.5, 0.4, 0), self.next_stage)
def _change_toolbar_speechbubble_text(self, widget, scene, name): scene.remove_widget("toolbar_speechbubble") if name in self._toolbar_icons: widget.set_image(self._toolbar_icons[name]["icon"]) text = self._toolbar_icons[name]["text"] position = self._toolbar_icons[name]["position"] source_align = self._toolbar_icons[name]["source_align"] self._toolbar_icons[name]['opened'] = True fixed = Gtk.Fixed() fixed.set_size_request(500, 300) sb = SpeechBubble(text=text, source=SpeechBubble.BOTTOM, source_align=source_align) sb.connect('button-release-event', self._close_speechbubble, scene) fixed.put(sb, position[0], position[1]) scene.add_widget(fixed, Placement(1.0, 1.0), Placement(1.0, 1.0), name="toolbar_speechbubble") # If the icon is in the toolbar, show the next button if not self._toolbar_next_button_shown: self._toolbar_next_button_shown = True scene.add_widget(NextButton(), Placement(0.5, 0.5, 0), Placement(0.5, 0.5, 0), self.fourth_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_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_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): self._scene = 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_widget( Gtk.Image.new_from_file( self.media_path('pi-complete.png') ), Placement(0.25, 0.0, 1.0), Placement(0.3, 0.0, 1.0) ) scene.add_widget( Gtk.Image.new_from_file( self.media_path('left-pointing-judoka.png') ), Placement(0.86, 0.67), Placement(0.75, 0.6) ) scene.add_widget( SpeechBubble( text='You set it up! Now it\'s time to play.', source=SpeechBubble.BOTTOM, scale=scene.scale_factor ), Placement(0.93, 0.38), Placement(0.79, 0.27) ) scene.schedule(3, self._ctl.next_stage) return scene
def _setup_first_scene(self): scene = self._setup_base_temple_scene() copy = [ 'Oh no, there\'s a boulder', 'in the way!' ] scene.add_widget( SpeechBubble( text='\n'.join(copy), source=SpeechBubble.BOTTOM, source_align=0.5, scale=scene.scale_factor ), Placement(0.85, 0.23), Placement(0.85, 0.23) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("altar-still.png")), Placement(0.41, 0.55, 1), Placement(0.41, 0.65, 1) ) scene.add_widget( NextButton(), Placement(0.5, 0.87, 0), Placement(0.5, 0.87, 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_second_scene(self): scene = self._setup_base_temple_scene() copy = [ 'But don\'t worry, you can', 'use Kano blocks to create code', 'to change what\'s around you.\n', 'Looks like there\'s one over there!' ] scene.add_widget( SpeechBubble( text='\n'.join(copy), source=SpeechBubble.BOTTOM, source_align=0.5, scale=scene.scale_factor ), Placement(0.88, 0.15, 0), Placement(0.88, 0.15, 0) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path("altar.gif")), Placement(0.41, 0.55, 1), Placement(0.41, 0.65, 1), self.third_scene ) return scene
def _setup_first_scene(self): self._first_scene = 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._first_scene, callback=self._char_creator_window, use_default=True) scene.add_widget(SpeechBubble(text="We made it to the desktop!\n" + "Click here to set up your profile", source=SpeechBubble.TOP, source_align=0.0), Placement(0.15, 0.2), Placement(0.035, 0.17), name="profile_icon_speechbubble") # Shortcut #scene.add_widget( # NextButton(), # Placement(0.5, 0.5, 0), # Placement(0.5, 0.5, 0), # self.second_scene #) return scene
def _setup_second_scene(self): self._second_scene = 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(self._second_scene) self._add_world_icon(scene, self._launch_login, offline=(not is_registered())) scene.add_widget(SpeechBubble(text="This is Kano World, where\n" "you can code with cool people,\n" "and get new apps.\n" "Click to continue.", source=SpeechBubble.TOP, source_align=1.0), Placement(0.8, 0.2), Placement(0.88, 0.2), name="world_icon_speechbubble") # Shortcut #scene.add_widget( # NextButton(), # Placement(0.5, 0.5, 0), # Placement(0.5, 0.5, 0), # self.third_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_first_scene(self): self._console_on = False self._scene = scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('audio-lab-bg-4-3.png'), self.media_path('audio-lab-bg-16-9.png')) scene.add_widget(ActiveImage(self.media_path('tab.png'), hover=self.media_path('tab-hover.png'), down=self.media_path('tab-down.png')), Placement(0.6555, 0.52), Placement(0.5485, 0.5935), [self._tab_clicked, scene], key=Gdk.KEY_Tab) scene.add_widget( Gtk.Image.new_from_file(self.media_path('judoka.png')), Placement(0.95, 0.9), Placement(0.95, 0.9)) copy = 'Press the TAB key to play a song!' scene.add_widget( SpeechBubble(text=copy, source=SpeechBubble.BOTTOM, source_align=0.8, scale=scene.scale_factor), Placement(0.95, 0.35), Placement(0.95, 0.45)) scene.schedule(40, self._show_hint, scene) return scene
def _setup_first_scene(self): self._scene = 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_widget( ActiveImage(self.media_path('keyboard.gif'), hover=self.media_path('keyboard-hover.gif')), Placement(0.43, 0.70), Placement(0.4, 0.79), self.next_stage ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('pi-keyboard.png')), Placement(0.67, 0), Placement(0.55, 0) ) scene.add_arrow( "right", Placement(0.25, 0.69, 0), Placement(0.28, 0.775, 0) ) scene.add_widget( Gtk.Image.new_from_file( common_media_path('down-right-pointing-judoka.png') ), Placement(0.15, 0.45), Placement(0.2, 0.5) ) scene.add_widget( SpeechBubble('CLICK on the keyboard dongle', scale=scene.scale_factor), Placement(0.07, 0.2), Placement(0.15, 0.18) ) ''' scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.5, 0.5), Placement(0.5, 0.5)) scene.add_widget( SpeechBubble('Time to set up the keyboard!', source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.49, 0.2), Placement(0.49, 0.2)) scene.schedule(3, self.next_stage) return scene
def _setup_first_scene(self): self._scene = 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_widget( Gtk.Image.new_from_file(self.media_path('pi-sound.png')), Placement(0.67, 0.0), Placement(0.5, 0.0) ) scene.add_widget( ActiveImage(self.media_path('audio.gif'), hover=self.media_path('audio-hover.gif')), Placement(0.542, 0.28), Placement(0.4468, 0.32), self.next_stage ) scene.add_arrow( "down", Placement(0.542, 0.05, 0), Placement(0.445, 0.13, 0) ) scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.2, 0.6), Placement(0.16, 0.6) ) sb = SpeechBubble('Let\'s make sure our sound\nis loud and clear.', scale=scene.scale_factor) scene.add_widget( sb, Placement(0.155, 0.3), Placement(0.12, 0.27) ) ''' scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.5, 0.5), Placement(0.5, 0.5)) sb = SpeechBubble('Let\'s make sure our sound\nis loud and clear.', source=SpeechBubble.BOTTOM, scale=scene.scale_factor) scene.add_widget(sb, Placement(0.49, 0.2), Placement(0.49, 0.2)) scene.schedule(3, self.next_stage) return scene
def _setup_first_scene(self): self._scene = 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_widget( ActiveImage(self.media_path('hdmi-cable.gif'), hover=self.media_path('hdmi-cable-hover.gif')), Placement(0.68, 0), Placement(0.6, 0), self._ctl.next_stage ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('HDMI-pi-image.png')), Placement(0.65, 0.15), Placement(0.52, 0.2) ) scene.add_arrow( "right", Placement(0.53, 0.21, 0), Placement(0.5, 0.21, 0) ) scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.18, 0.6), Placement(0.18, 0.6) ) scene.add_widget( SpeechBubble('CLICK on the yellow\nHDMI cable', scale=scene.scale_factor), Placement(0.09, 0.26), Placement(0.14, 0.26) ) ''' scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.5, 0.5), Placement(0.5, 0.5)) scene.add_widget( SpeechBubble('Let\'s set up your display!', source=SpeechBubble.BOTTOM, scale=scene.scale_factor), Placement(0.49, 0.2), Placement(0.49, 0.2)) scene.schedule(3, self._ctl.next_stage) 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(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 _place_judoka_into_scene(self, scene, happy=False): image = 'judoka-scared.png' copy = "Oh no bugs!\nClick on them quick to remove them." if happy: image = 'judoka.png' copy = 'Phew, thanks for cleaning up!' scene.add_widget(Gtk.Image.new_from_file(self.media_path(image)), Placement(0.9, 0.9), Placement(0.9, 0.9), name='judoka') speech_bubble = SpeechBubble(text=copy, source=SpeechBubble.RIGHT, source_align=0.0, scale=scene.scale_factor) scene.add_widget(speech_bubble, Placement(0.68, 0.68), Placement(0.75, 0.66), name='speech-bubble')
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('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_first_scene(self): self._is_on = False self._console_shown = False self._scene = scene = Scene(self._ctl.main_window) scene.set_background(self.media_path('off-4-3.png'), self.media_path('off-16-9.png')) # scene.add_profile_icon() scene.add_widget( Gtk.Image.new_from_file(self.media_path('judoka.png')), Placement(0.08, 0.9), Placement(0.12, 0.9) ) copy = 'Now let\'s check the lights work!\n\n' + \ 'Press the ON button to light up.' scene.add_widget( SpeechBubble(text=copy, source=SpeechBubble.BOTTOM, source_align=0.2, scale=scene.scale_factor), Placement(0.08, 0.5), Placement(0.12, 0.45) ) scene.add_character( Placement(0.95, 0.9, 0.62), Placement(0.95, 0.9, 0.62) ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('button.png')), Placement(0.5, 0.22), Placement(0.5, 0.22), [self._on_clicked, scene] ) 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_first_scene(self): self._scene = 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_arrow( "down", Placement(0.46, 0.31), Placement(0.46, 0.44) ) scene.add_widget( ActiveImage(self.media_path('wifi.gif'), hover=self.media_path('wifi-hover.gif')), Placement(0.48, 0.53), Placement(0.475, 0.6), self.next_stage ) scene.add_widget( Gtk.Image.new_from_file(self.media_path('Pi-wifi.png')), Placement(0.83, 0), Placement(0.73, 0) ) scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.19, 0.6), Placement(0.18, 0.6) ) sb = SpeechBubble('Let\'s set up WiFi', scale=scene.scale_factor) scene.add_widget( sb, Placement(0.17, 0.32), Placement(0.165, 0.28) ) ''' scene.add_widget( Gtk.Image.new_from_file(common_media_path('pi-judoka.png')), Placement(0.5, 0.5), Placement(0.5, 0.5) ) sb = SpeechBubble('Let\'s set up WiFi', source=SpeechBubble.BOTTOM, scale=scene.scale_factor) scene.add_widget( sb, Placement(0.49, 0.2), Placement(0.49, 0.2) ) # scene.schedule(20, self._show_hint, sb) scene.schedule(3, self.next_stage) 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
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