Exemple #1
0
    def __init__(self, scrollable_list=None, data_sources=tuple(), *a, **k):
        super(ListComponent, self).__init__(*a, **k)
        self._data_sources = data_sources
        self._activation_task = task.Task()
        self._action_on_scroll_task = task.Task()
        self._scrollable_list = None
        self._scroller = ScrollComponent(parent=self)
        self._pager = ScrollComponent(parent=self)
        self.last_action_item = lambda: self._last_action_item
        self.item_formatter = DefaultItemFormatter()
        for c in (self._scroller, self._pager):
            for button in (c.scroll_up_button, c.scroll_down_button):
                button.color = b'List.ScrollerOn'
                button.pressed_color = None
                button.disabled_color = b'List.ScrollerOff'

        if scrollable_list == None:
            self.scrollable_list = ActionList(
                num_visible_items=len(data_sources))
        else:
            self.scrollable_list = scrollable_list
        self._scrollable_list.num_visible_items = len(data_sources)
        self._delay_activation = BooleanContext()
        self._selected_index_float = 0.0
        self._in_encoder_selection = BooleanContext(False)
        self._execute_action_task = self._tasks.add(
            task.sequence(task.delay(1), task.run(self._execute_action)))
        self._execute_action_task.kill()
        return
Exemple #2
0
 def _create_tasks(self, notification_time):
     duration = notification_time if notification_time is not None else self._default_notification_time
     self._notification_timeout_task = self._tasks.add(
         task.sequence(task.wait(duration), task.run(self.hide_notification)
                       )).kill() if duration != -1 else self._tasks.add(
                           task.Task())
     return
 def __init__(self, *a, **k):
     super(ActionWithSettingsComponent, self).__init__(*a, **k)
     self._is_showing_settings = False
     self._settings_task = task.Task()