示例#1
0
    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
示例#2
0
    def _setup_help_power(self, scene):
        buttons = [{
            'label': 'TRY AGAIN',
            'callback': self.remove_overlays,
            'color': 'green'
        }, {
            'label': 'SKIP',
            'callback': self._ctl.next_stage,
            'color': 'grey'
        }]
        if hdmi_supported:
            buttons.insert(
                1, {
                    'label': 'USE TV SPEAKERS',
                    'callback': self._set_to_hdmi,
                    'color': 'blue'
                })

        scene.add_widget(Notebook(
            self, self.media_path('power.png'), 0.8, 0.5,
            'No light? Check the GPIO',
            ['The cable has to be connected to these', 'pins exactly.'],
            buttons),
                         Placement(0.5, 0.5, 0.0),
                         Placement(0.5, 0.5, 0.0),
                         modal=True,
                         name='help-power')
示例#3
0
    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
示例#4
0
    def _setup_first_scene(self):
        self._is_on = False

        self._scene = scene = Scene(self._ctl.main_window)

        scene.set_background(
            self.media_path('world-registration-scene-1600x1200.png'),
            self.media_path('world-registration-scene-1920x1080.png'))

        scene.add_profile_icon()

        scene.add_widget(
            Gtk.Image.new_from_file(
                self.media_path('rocket-animation-file-medium.gif')),
            Placement(0.05, 0.5), Placement(0.05, 0.5))

        scene.add_widget(
            Gtk.Image.new_from_file(
                self.media_path('world-widget-animation.gif')),
            Placement(0.95, 0.05, 0), Placement(0.95, 0.05, 0))

        # Launch the settings on top
        thread = threading.Thread(target=self.launch_registration)
        thread.daemon = True
        thread.start()

        return scene
示例#5
0
    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)
示例#6
0
    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
示例#7
0
 def _add_profile_icon(self, scene, callback=None, use_default=False):
     # We always want to add the widget to the same position in each screen
     scene.add_widget(ProfileIcon(use_default),
                      Placement(0.03, 0.05, 0),
                      Placement(0.03, 0.05, 0),
                      callback,
                      name="profile_icon")
示例#8
0
    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)
示例#9
0
    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
示例#10
0
    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'))

        self._scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('arrow-up.png')),
            Placement(0.5, 0.0, 1.0), Placement(0.5, 0.0, 1.0))

        self._scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('arrow-down.png')),
            Placement(0.5, 1.0, 1.0), Placement(0.5, 1.0, 1.0))

        self._scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('arrow-left.png')),
            Placement(0.0, 0.5, 1.0), Placement(0.0, 0.5, 1.0))

        self._scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('arrow-right.png')),
            Placement(1.0, 0.5, 1.0), Placement(1.0, 0.5, 1.0))

        self._scene.add_widget(Window1(self, self._ctl.next_stage,
                                       self.next_window),
                               Placement(0.5, 0.5, 1.0),
                               Placement(0.5, 0.5, 1.0),
                               modal=False,
                               name='window1')

        return scene
示例#11
0
    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
示例#12
0
    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
示例#13
0
    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
示例#14
0
    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
示例#15
0
    def _show_console(self, scene):
        scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('console.png')),
            Placement(0.5, 1.0),
            Placement(0.5, 1.0)
        )

        scene.add_widget(
            ConsoleScreen(self, scene, self._ctl.next_stage, self.help_power),
            Placement(0.5155, 0.918),
            Placement(0.5155, 0.918)
        )
示例#16
0
    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
示例#17
0
    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
示例#18
0
 def _setup_help_jack(self, scene):
     scene.add_widget(Notebook(self, self.media_path('jack.png'), 1.0, 0.5,
                               'Plug in the blue cable',
                               ['Check you\'ve plugged in the audio'],
                               [{
                                   'label': 'NEXT',
                                   'callback': self.help_leds,
                                   'color': 'green'
                               }]),
                      Placement(0.5, 0.5, 0.0),
                      Placement(0.5, 0.5, 0.0),
                      modal=True,
                      name='help-jack')
示例#19
0
    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
示例#20
0
    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
示例#21
0
    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
示例#22
0
    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
示例#23
0
 def _setup_help_power(self):
     self._scene.add_widget(
         Notebook(
             self,
             self.media_path('power.png'), 0.8, 0.5,
             'No light? Check the GPIO',
             ['The cable has to be connected to these',
              'pins exactly.'],
             [{'label': 'GOT IT', 'callback': self.remove_overlay, 'color': 'green'}]
         ),
         Placement(0.5, 0.5, 0.0),
         Placement(0.45, 0.5, 0.0),
         modal=True,
         name='help-power'
     )
示例#24
0
    def _char_creator_window(self):
        self._blur = self._create_blur()

        # Add watch cursor
        watch_cursor = Gdk.Cursor(Gdk.CursorType.WATCH)
        self._ctl.main_window.get_window().set_cursor(watch_cursor)

        self._first_scene.add_widget(self._blur, Placement(0, 0),
                                     Placement(0, 0))
        self._blur.get_style_context().add_class("blur")
        self._first_scene.show_all()

        while Gtk.events_pending():
            Gtk.main_iteration()

        CharacterWindow(self.second_scene)
示例#25
0
    def _show_console(self, scene):
        if self._console_on:
            return
        self._console_on = True

        scene.add_widget(Gtk.Image.new_from_file(
            self.media_path('console.png')),
                         Placement(0.5, 1.0),
                         Placement(0.5, 1.0),
                         name='console-bg')

        scene.add_widget(ConsoleScreen(self, scene, self._ctl.next_stage,
                                       self.help_jack),
                         Placement(0.5155, 0.918),
                         Placement(0.5155, 0.918),
                         name='console-screen')
示例#26
0
    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
示例#27
0
 def _setup_help_leds(self, scene):
     scene.add_widget(
         Notebook(self, self.media_path('troubleshooting-sound.png'), 0.5,
                  0.3, 'Can you see the blue light?', [
                      'If the power plugs are connected correctly,',
                      'you should see a blue light.'
                  ], [{
                      'label': 'YES',
                      'callback': self.remove_overlays,
                      'color': 'green'
                  }, {
                      'label': 'NO',
                      'callback': self.help_power,
                      'color': 'red'
                  }]),
         Placement(0.5, 0.5, 0.0),
         Placement(0.5, 0.5, 0.0),
         modal=True,
         name='help-leds')
示例#28
0
    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')
示例#29
0
    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
示例#30
0
    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