Beispiel #1
0
    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
Beispiel #2
0
    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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
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
Beispiel #6
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
Beispiel #7
0
    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
Beispiel #8
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
Beispiel #9
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
Beispiel #10
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
Beispiel #11
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
Beispiel #12
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'))

        if scene.ratio == scene.RATIO_4_3:
            scene.add_widget(
                Gtk.Image.new_from_file(self.media_path('machine-4-3.png')),
                Placement(0, 0, 1),
                Placement(0, 0, 1)
            )
        else:
            scene.add_widget(
                Gtk.Image.new_from_file(self.media_path('machine-16-9.png')),
                Placement(0, 0, 1),
                Placement(0, 0, 1)
            )

        scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('ok-button.png')),
            Placement(0.7, 0, 1),
            Placement(0.7, 0, 1),
            self.save_and_exit
        )

        scene.add_widget(
            Gtk.Image.new_from_file(self.media_path('help-button.png')),
            Placement(0.8, 0, 1),
            Placement(0.8, 0, 1),
            self.first_scene
        )

        scene.add_widget(
            ActiveImage(self.media_path('up-button.png'),
                        self.media_path('up-button.png'),
                        self.media_path('up-button.png')),
            Placement(0.5, 0.435, 1),
            Placement(0.51, 0.436, 1),
            self._overscan_ctl.zoom_out,
            key=Gdk.KEY_Up
        )

        scene.add_widget(
            ActiveImage(self.media_path('down-button.png'),
                        self.media_path('down-button.png'),
                        self.media_path('down-button.png')),
            Placement(0.5, 0.535, 1),
            Placement(0.51, 0.536, 1),
            self._overscan_ctl.zoom_in,
            key=Gdk.KEY_Down
        )

        self.show_notebook()

        return scene
Beispiel #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(
            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
Beispiel #14
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
Beispiel #15
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
Beispiel #16
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
Beispiel #17
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_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 __init__(self, text=None, buttons=None, source=BOTTOM,
                 source_align=0.5, scale=1.0):
        self._source = source
        self._source_align = source_align
        self._button_box = None
        self._scale = scale
        if buttons:
            for button in buttons:
                self.add_button(button[0], button[1])

        super(SpeechBubble, self).__init__()
        self.set_row_spacing(0)
        self.set_column_spacing(0)

        # The speech bubble triangle
        img_path = common_media_path("sb-{}.png".format(self._source))
        img = Gtk.Image.new_from_file(img_path)
        img = scale_image(img, scale)
        img.set_hexpand(False)
        img.set_vexpand(False)

        img_align = Gtk.Alignment()
        img_align.add(img)

        if self._source in [self.TOP, self.BOTTOM]:
            img_align.set(self._source_align, 0, 0, 0)
        else:
            img_align.set(0, self._source_align, 0, 0)

        # The background of the bubble
        self._bubble = Gtk.EventBox()
        self._bubble.get_style_context().add_class('speech-bubble')

        self.attach(self._bubble, 0, 0, 1, 1)

        if self._source == self.TOP:
            self.attach_next_to(img_align, self._bubble,
                                Gtk.PositionType.TOP, 1, 1)
        elif self._source == self.BOTTOM:
            self.attach_next_to(img_align, self._bubble,
                                Gtk.PositionType.BOTTOM, 1, 1)
        elif self._source == self.LEFT:
            self.attach_next_to(img_align, self._bubble,
                                Gtk.PositionType.LEFT, 1, 1)
        elif self._source == self.RIGHT:
            self.attach_next_to(img_align, self._bubble,
                                Gtk.PositionType.RIGHT, 1, 1)

        # Padding in of the bubble
        self._padded_bubble = Gtk.Alignment(hexpand=True, vexpand=True)
        self._padded_bubble.set(0.5, 0.5, 0, 0)
        vert = int(self._scale*25)
        horz = int(self._scale*35)
        self._padded_bubble.set_padding(vert, vert, horz, horz)
        self._bubble.add(self._padded_bubble)

        self._init_content(text)

        self.show_all()
Beispiel #19
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
Beispiel #20
0
    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
Beispiel #21
0
    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
Beispiel #22
0
    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
Beispiel #23
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
Beispiel #24
0
    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
Beispiel #25
0
    def add_arrow(self, direction, p43, p169, clicked_cb=None, key=None,
                  name=None, modal=False):

        click_label = Gtk.Label("CLICK")
        click_label.get_style_context().add_class("click_label")

        if direction in ["down", "left", "right", "up-right", "up-left"]:
            arrow_image = Gtk.Image.new_from_file(
                common_media_path(
                    'arrow-pi-screen-{}.gif'.format(direction)
                )
            )

        if direction == "down":
            box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
            box.pack_start(click_label, False, False, 0)
            box.pack_start(arrow_image, False, False, 0)

        elif direction == "up":
            box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
            box.pack_start(arrow_image, False, False, 0)
            box.pack_start(click_label, False, False, 0)

        elif direction == "left":
            box = Gtk.Box()
            box.pack_start(arrow_image, False, False, 0)
            box.pack_start(click_label, False, False, 0)

        elif direction == "right":
            box = Gtk.Box()
            box.pack_start(click_label, False, False, 0)
            box.pack_start(arrow_image, False, False, 0)
        else:
            box = Gtk.Box()
            box.pack_start(arrow_image, False, False, 0)

        self.add_widget(
            box,
            p43,
            p169,
            clicked_cb,
            key,
            name,
            modal
        )
Beispiel #26
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
Beispiel #27
0
    def __init__(self,
                 text=None,
                 buttons=None,
                 source=BOTTOM,
                 source_align=0.5,
                 scale=1.0):
        self._source = source
        self._source_align = source_align
        self._button_box = None
        self._scale = scale
        if buttons:
            for button in buttons:
                self.add_button(button[0], button[1])

        super(SpeechBubble, self).__init__()
        self.set_row_spacing(0)
        self.set_column_spacing(0)

        # The speech bubble triangle
        img_path = common_media_path("sb-{}.png".format(self._source))
        img = Gtk.Image.new_from_file(img_path)
        img = scale_image(img, scale)
        img.set_hexpand(False)
        img.set_vexpand(False)

        img_align = Gtk.Alignment()
        img_align.add(img)

        if self._source in [self.TOP, self.BOTTOM]:
            img_align.set(self._source_align, 0, 0, 0)
        else:
            img_align.set(0, self._source_align, 0, 0)

        # The background of the bubble
        self._bubble = Gtk.EventBox()
        self._bubble.get_style_context().add_class('speech-bubble')

        self.attach(self._bubble, 0, 0, 1, 1)

        if self._source == self.TOP:
            self.attach_next_to(img_align, self._bubble, Gtk.PositionType.TOP,
                                1, 1)
        elif self._source == self.BOTTOM:
            self.attach_next_to(img_align, self._bubble,
                                Gtk.PositionType.BOTTOM, 1, 1)
        elif self._source == self.LEFT:
            self.attach_next_to(img_align, self._bubble, Gtk.PositionType.LEFT,
                                1, 1)
        elif self._source == self.RIGHT:
            self.attach_next_to(img_align, self._bubble,
                                Gtk.PositionType.RIGHT, 1, 1)

        # Padding in of the bubble
        self._padded_bubble = Gtk.Alignment(hexpand=True, vexpand=True)
        self._padded_bubble.set(0.5, 0.5, 0, 0)
        vert = int(self._scale * 25)
        horz = int(self._scale * 35)
        self._padded_bubble.set_padding(vert, vert, horz, horz)
        self._bubble.add(self._padded_bubble)

        self._init_content(text)

        self.show_all()
Beispiel #28
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_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
Beispiel #29
0
    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
Beispiel #30
0
    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
Beispiel #31
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
Beispiel #32
0
 def __init__(self):
     super(NextButton,
           self).__init__(common_media_path('next-button.gif'),
                          common_media_path('next-button-hover.png'),
                          common_media_path('next-button-down.png'))
Beispiel #33
0
 def _get_local_avatar_path(self):
     return common_media_path("character_circ_ring.png")
 def __init__(self):
     super(NextButton, self).__init__(
         common_media_path('next-button.gif'),
         common_media_path('next-button-hover.png'),
         common_media_path('next-button-down.png')
     )