def next_stage(self): """ This callback is passed over to each stage to be called once it's over and the control should be handed to the subsequent one. """ if self._status.location is None: self._status.location = self._stages[0].id index = 0 else: index = self._get_stage_index(self._status.location) # Finish the previous tracking session if self._tracking_session is not None: session_end(self._tracking_session) self._main_window.set_key_events_handlers() if index is not None and index < len(self._stages) - 1: stage_ctl = self._stages[index + 1](self) self._status.location = self._stages[index + 1].id self._status.save() # Start a new tracking session self._tracking_session = session_start(stage_ctl.id, os.getpid()) stage_ctl.first_scene() trigger_led_speaker() else: self._status.completed = True self._status.save() track_action('init-flow-finished') Gtk.main_quit()
def _success_screen(self): self._win.remove_main_widget() title = _("Success!") description = _("You're connected") buttons = [ { 'label': _("OK"), 'color': 'green', 'type': 'KanoButton', 'callback': Gtk.main_quit } ] img_path = os.path.join(img_dir, "internet.png") # Track that user connected online track_action('internet-connection-established') self._win.set_main_widget( Template( title, description, buttons, self._win.is_plug(), img_path ) )
def first_scene(self): if is_monitor(): self._ctl.next_stage() return track_action('init-flow-overscan-needed') s1 = self._setup_first_scene() self._ctl.main_window.push(s1)
def troubleshoot_option(self): self._clear() screen = TroubleshootOrDisconnect(self._stage, self.troubleshoot_ethernet, self.are_you_sure) self._eb.add(screen) self._eb.show_all() track_action('init-flow-wifi-troubleshoot-triggered')
def second_scene(self): # TODO: uncomment before release # Jump directly at the end if we have internet if is_internet(): track_action('init-flow-connected-already') self.connected_scene() return s2 = self._setup_second_scene() self._ctl.main_window.push(s2)
def _expand(self, widget=None, event=None): ''' Shows the text box ''' self._x_button.show() self._ebox.show() self._gray_box.show() self._send.show() self._expanded = True (focusable, focus_widget) = self._input_widget.get_focusable_widget() if focusable: self.set_focus(focus_widget) # Add metrics to kano tracker track_action(self.app_name_opened)
def _success_screen(self): self._win.remove_main_widget() title = _("Success!") description = _("You're connected") buttons = [{ 'label': _("OK"), 'color': 'green', 'type': 'KanoButton', 'callback': Gtk.main_quit }] img_path = os.path.join(img_dir, "internet.png") # Track that user connected online track_action('internet-connection-established') self._win.set_main_widget( Template(title, description, buttons, self._win.is_plug(), img_path))
def first_stage(self): """ Runs the first stage. Note: The first stage is determined by the location variable from the status file, not necessarily the very first stage. """ if not self._status.debug_mode: if self._status.completed: self._return_value = self.NOT_FIRST_BOOT return False if os.path.exists(OLD_FIRST_BOOT_FILE): self._return_value = self.NOT_FIRST_BOOT self.complete() return False if self._should_skip_init_flow(): self.complete() return False self._main_window.set_key_events_handlers() if len(self._stages): index = 0 if self._status.location is not None: index = self._get_stage_index(self._status.location) track_data('init-flow-resumed', {'stage': self._status.location}) else: track_action('init-flow-started') stage_ctl = self._stages[index](self) stage_ctl.first_scene() else: raise RuntimeError('No flow stages available') self._tracking_session = session_start(stage_ctl.id, os.getpid()) return True
def help_power(self): track_action('init-flow-light-help-triggered') self._setup_help_power()
def new_try(self): self._tries += 1 if self._tries > 1: track_action('init-flow-wifi-retried')
def disconnected_scene(self): track_action('init-flow-disconnected') s4 = self._setup_disconnected_scene() self._ctl.main_window.push(s4)
def connected_scene(self): track_action('init-flow-connected') s3 = self._setup_connected_scene() self._ctl.main_window.push(s3)
def help_leds(self): track_action('init-flow-audio-help-triggered') self.remove_overlays() self._setup_help_leds(self._scene)
def _cb_wrapper(self, widget, cb, tracking_event=None): if tracking_event: track_action(tracking_event) cb() return True
def _is_screen_kit(): from kano_settings.system.display import is_screen_kit if is_screen_kit(): track_action('kano_screen_kit')