How to use the khal.ui.__init__.DateListBox.selected_date function in khal

To help you get started, we’ve selected a few khal 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 / khal / khal / ui / __init__.py View on Github external
def render(self, size, focus):
        if focus:
            self.body[0].set_attr_map({None: 'date header focused'})
        elif DateListBox.selected_date == self.date:
            self.body[0].set_attr_map({None: 'date header selected'})
        else:
            self.reset_style()
        return super().render(size, focus)
github pimutils / khal / khal / ui / __init__.py View on Github external
def render(self, a, focus):
        if focus:
            DateListBox.selected_date = None
        return super().render(a, focus)
github pimutils / khal / khal / ui / __init__.py View on Github external
def render(self, a, focus):
        if focus:
            DateListBox.selected_date = None
        return super().render(a, focus)
github pimutils / khal / khal / ui / __init__.py View on Github external
self.parent.calendar.base_widget.set_focus_date(dt.date.today())

        rval = super().keypress(size, key)
        self.clean()
        if key in ['up', 'down']:
            try:
                self._old_focus = self.focus_position
            except IndexError:
                pass
            day = self.body[self.body.focus].date

            # we need to save DateListBox.selected_date and reset it later, because
            # calling CalendarWalker.set_focus_date() calls back into
            # DayWalker().update_by_date() which actually sets selected_date
            # that's why it's called callback hell...
            currently_selected_date = DateListBox.selected_date
            self.set_focus_date_callback(day)  # TODO convert to callback
            DateListBox.selected_date = currently_selected_date
        return rval
github pimutils / khal / khal / ui / __init__.py View on Github external
def set_selected_date(self, day):
        """Mark `day` as selected

        :param day: day to mark as selected
        :type day: datetime.date
        """
        DateListBox.selected_date = day
        # we need to touch the title's content to make sure
        # that urwid re-renders the title
        title = self.body[0].original_widget
        title.set_text(title.get_text()[0])
github pimutils / khal / khal / ui / __init__.py View on Github external
def set_selected_date(self, day):
        """Mark `day` as selected

        :param day: day to mark as selected
        :type day: datetime.date
        """
        DateListBox.selected_date = day
        # we need to touch the title's content to make sure
        # that urwid re-renders the title
        title = self.body[0].original_widget
        title.set_text(title.get_text()[0])
github pimutils / khal / khal / ui / __init__.py View on Github external
self.parent.calendar.base_widget.set_focus_date(dt.date.today())

        rval = super().keypress(size, key)
        self.clean()
        if key in ['up', 'down']:
            try:
                self._old_focus = self.focus_position
            except IndexError:
                pass
            day = self.body[self.body.focus].date

            # we need to save DateListBox.selected_date and reset it later, because
            # calling CalendarWalker.set_focus_date() calls back into
            # DayWalker().update_by_date() which actually sets selected_date
            # that's why it's called callback hell...
            currently_selected_date = DateListBox.selected_date
            self.set_focus_date_callback(day)  # TODO convert to callback
            DateListBox.selected_date = currently_selected_date
        return rval
github pimutils / khal / khal / ui / __init__.py View on Github external
rval = super().keypress(size, key)
        self.clean()
        if key in ['up', 'down']:
            try:
                self._old_focus = self.focus_position
            except IndexError:
                pass
            day = self.body[self.body.focus].date

            # we need to save DateListBox.selected_date and reset it later, because
            # calling CalendarWalker.set_focus_date() calls back into
            # DayWalker().update_by_date() which actually sets selected_date
            # that's why it's called callback hell...
            currently_selected_date = DateListBox.selected_date
            self.set_focus_date_callback(day)  # TODO convert to callback
            DateListBox.selected_date = currently_selected_date
        return rval
github pimutils / khal / khal / ui / __init__.py View on Github external
def render(self, size, focus):
        if focus:
            self.body[0].set_attr_map({None: 'date header focused'})
        elif DateListBox.selected_date == self.date:
            self.body[0].set_attr_map({None: 'date header selected'})
        else:
            self.reset_style()
        return super().render(size, focus)
github pimutils / khal / khal / ui / __init__.py View on Github external
rval = super().keypress(size, key)
        self.clean()
        if key in ['up', 'down']:
            try:
                self._old_focus = self.focus_position
            except IndexError:
                pass
            day = self.body[self.body.focus].date

            # we need to save DateListBox.selected_date and reset it later, because
            # calling CalendarWalker.set_focus_date() calls back into
            # DayWalker().update_by_date() which actually sets selected_date
            # that's why it's called callback hell...
            currently_selected_date = DateListBox.selected_date
            self.set_focus_date_callback(day)  # TODO convert to callback
            DateListBox.selected_date = currently_selected_date
        return rval