Пример #1
0
    def update_to_tw():
        """
        Updates all tasks that differ from their TaskWarrior representation.
        """

        cache.reset()
        cache.load_tasks()
        cache.load_vwtasks()
        cache.save_tasks()
        cache.update_vwtasks_in_buffer()
        cache.evaluate_viewports()
Пример #2
0
    def update_to_tw():
        """
        Updates all tasks that differ from their TaskWarrior representation.
        """

        cache.reset()
        cache.load_tasks()
        cache.load_vwtasks()
        cache.save_tasks()
        cache.update_vwtasks_in_buffer()
        cache.evaluate_viewports()
Пример #3
0
    def update_from_tw():
        """
        Updates all the incomplete tasks in the vimwiki file if the info from TW is different.
        """

        cache.reset()
        cache.load_tasks()
        cache.load_vwtasks(buffer_has_authority=False)
        cache.update_vwtasks_from_tasks()
        cache.update_vwtasks_in_buffer()
        cache.evaluate_viewports()
Пример #4
0
    def update_from_tw():
        """
        Updates all the incomplete tasks in the vimwiki file if the info from TW is different.
        """

        cache.reset()
        cache.load_tasks()
        cache.load_vwtasks(buffer_has_authority=False)
        cache.load_viewports()
        cache.update_vwtasks_from_tasks()
        cache.update_vwtasks_in_buffer()
        cache.evaluate_viewports()
Пример #5
0
    def __init__(self):
        self.tw = cache.get_relevant_tw()

        # Reset cache, otherwise old line content may be used
        cache.reset()

        # Load the current tasks
        range_tasks = [cache[i] for i in util.selected_line_numbers()]
        self.tasks = [t for t in range_tasks if t is not None]

        if not self.tasks:
            print("No tasks selected.")
Пример #6
0
    def __init__(self):
        self.tw = cache.get_relevant_tw()

        # Reset cache, otherwise old line content may be used
        cache.reset()

        # Load the current tasks
        range_tasks = [cache[i] for i in util.selected_line_numbers()]
        self.tasks = [t for t in range_tasks if t is not None]

        if not self.tasks:
            print("No tasks selected.")
Пример #7
0
    def task_info_or_vimwiki_follow_link():
        # Reset the cache to use up-to-date buffer content
        cache.reset()

        # If the line under cursor contains task, toggle info
        # otherwise do the default VimwikiFollowLink
        position = util.get_current_line_number()

        if cache.vwtask[position] is not None:
            SelectedTasks().info()
        else:
            port = viewport.ViewPort.from_line(position, cache)
            if port is not None:
                Meta().inspect_viewport()
            else:
                vim.command('VimwikiFollowLink')
Пример #8
0
    def inspect_viewport(self):
        position = util.get_current_line_number()
        port = viewport.ViewPort.from_line(position, cache)

        if port.meta.get('visible') is False:
            cache.reset()
            cache.load_vwtasks()
            cache.load_tasks()

        template = (
            "ViewPort inspection:\n"
            "--------------------\n"
            "Name: {0}\n"
            "Filter used: {1}\n"
            "Defaults used: {2}\n"
            "Ordering used: {3}\n"
            "Matching taskwarrior tasks: {4}\n"
            "Displayed tasks: {5}\n"
            "Tasks to be added: {6}\n"
            "Tasks to be deleted: {7}\n"
        )

        if port is not None:
            # Load the tasks under the viewport
            port.load_tasks()

            to_add, to_del = port.get_tasks_to_add_and_del()

            # Fill in the interesting info in the template
            template_formatted = template.format(
                port.name,
                port.raw_filter,
                port.raw_defaults,
                port.sort,
                len(port.matching_tasks),
                len(port.tasks),
                ', '.join(map(unicode, to_add)),
                ', '.join(map(unicode, to_del)),
            )

            # Show in the split
            lines = template_formatted.splitlines()
            util.show_in_split(lines, activate_cursorline=True)
Пример #9
0
    def inspect_viewport(self):
        position = util.get_current_line_number()
        port = viewport.ViewPort.from_line(position, cache)

        if port.meta.get('visible') is False:
            cache.reset()
            cache.load_vwtasks()
            cache.load_tasks()

        template = (
            "ViewPort inspection:\n"
            "--------------------\n"
            "Name: {0}\n"
            "Filter used: {1}\n"
            "Defaults used: {2}\n"
            "Ordering used: {3}\n"
            "Matching taskwarrior tasks: {4}\n"
            "Displayed tasks: {5}\n"
            "Tasks to be added: {6}\n"
            "Tasks to be deleted: {7}\n"
        )

        if port is not None:
            # Load the tasks under the viewport
            port.load_tasks()

            to_add, to_del = port.get_tasks_to_add_and_del()

            # Fill in the interesting info in the template
            template_formatted = template.format(
                port.name,
                port.raw_filter,
                port.raw_defaults,
                port.sort,
                len(port.matching_tasks),
                len(port.tasks),
                ', '.join(map(unicode, to_add)),
                ', '.join(map(unicode, to_del)),
            )

            # Show in the split
            lines = template_formatted.splitlines()
            util.show_in_split(lines, activate_cursorline=True)