How to use the todoman.widgets.PrioritySelector function in todoman

To help you get started, we’ve selected a few todoman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pimutils / todoman / tests / test_widgets.py View on Github external
def test_priority_selector(default_formatter):
    selector = PrioritySelector(None, 5, default_formatter.format_priority)

    assert selector.label == 'medium'
    assert selector.priority == 5

    selector.keypress(10, 'right')
    assert selector.label == 'high'
    assert selector.priority == 1

    selector.keypress(10, 'left')
    selector.keypress(10, 'left')
    assert selector.label == 'low'
    assert selector.priority == 9

    selector.keypress(10, 'right')
    assert selector.label == 'medium'
    assert selector.priority == 5
github pimutils / todoman / todoman / interactive.py View on Github external
multiline=True,
        )
        self._location = widgets.ExtendedEdit(
            parent=self,
            edit_text=self.todo.location,
        )
        self._due = widgets.ExtendedEdit(
            parent=self,
            edit_text=self.formatter.format_datetime(self.todo.due),
        )
        self._dtstart = widgets.ExtendedEdit(
            parent=self,
            edit_text=self.formatter.format_datetime(self.todo.start),
        )
        self._completed = urwid.CheckBox("", state=self.todo.is_completed)
        self._priority = widgets.PrioritySelector(
            parent=self,
            priority=self.todo.priority,
            formatter_function=self.formatter.format_priority,
        )
github pimutils / todoman / todoman / interactive.py View on Github external
def _init_help_text(self):
        self._help_text = urwid.Text(
            '\n\n'
            'Global:\n'
            ' F1: Toggle help\n'
            ' Ctrl-C: Cancel\n'
            ' Ctrl-S: Save (only works if not a shell shortcut already)\n'
            '\n'
            'In Textfields:\n' + '\n'.join(
                ' {}: {}'.format(k, v) for k, v in widgets.ExtendedEdit.HELP
            ) + '\n\n'
            'In Priority Selector:\n' + '\n'.join(
                ' {}: {}'.format(k, v)
                for k, v in widgets.PrioritySelector.HELP
            )