예제 #1
0
    def print_list(self, todos=[]):
        """Prints the entire todo list with information"""
        if not todos:
            safe_print(
                '{green}Congrats! 🙂{reset}'
                .format(
                    green=Fore.GREEN,
                    reset=Style.RESET_ALL,
                )
            )
            safe_print('There\'s nothing else to do. 🎉')
        else:
            self.print_todos(todos)

            no_items = len(todos)
            no_checked = len([t for t in todos if t['done'] ])
            print(
                '{info}{no_items:>2} items: {no_checked} completed, {no_unchecked} left{reset}'
                .format(
                    no_items=no_items,
                    no_checked=no_checked,
                    no_unchecked=(no_items - no_checked),
                    info=Fore.INFO,
                    reset=Style.RESET_ALL,
                )
            )
예제 #2
0
파일: __init__.py 프로젝트: Epic-R-R/tTodo
def check_python_version():
    if sys.version_info[0] < 3:
        from todo.utils.compatibility import safe_print
        from todo.utils.styles import Fore, Style
        safe_print('''
{warning}You need Python 3 to use this program.
{info}Download Python: {blue}https://www.python.org/downloads
{info}Learn more: {blue}https://github.com/Epic-R-R/tTodo{reset}
'''.format(
            fail=Fore.FAIL,
            bold=Style.BOLD,
            warning=Fore.WARNING,
            info=Fore.INFO,
            blue=Fore.BLUE,
            reset=Style.RESET_ALL,
        ))
        sys.exit(1)
예제 #3
0
파일: list.py 프로젝트: Epic-R-R/tTodo
 def print_todos(self, todos=[]):
     checked = lambda t: t['done']
     for todo in sorted(todos, key=checked):
         is_done = todo['done']
         status = ' ✓ ' if is_done else ' x '
         color = Fore.GREEN if is_done else Style.RESET_ALL
         background = Back.GREEN if is_done else Back.WHITE
         safe_print(
             ' {black}{background}{status}{reset}  {color}{title}{reset}'.
             format(
                 status=status,
                 title=todo['title'],
                 color=color,
                 black=Fore.BLACK,
                 background=background,
                 reset=Style.RESET_ALL,
             ))
예제 #4
0
 def print_todos(self, todos=[]):
     """Print all the todos"""
     checked = lambda t: t['done']
     for todo in sorted(todos, key=checked):
         is_done = todo['done']
         status = ' ✓ ' if is_done else ' x '
         color = Fore.GREEN if is_done else Style.RESET_ALL
         background = Back.GREEN if is_done else Back.WHITE
         safe_print(
             ' {black}{background}{status}{reset}  {color}{title}{reset}'
             .format(
                 status=status,
                 title=todo['title'],
                 color=color,
                 black=Fore.BLACK,
                 background=background,
                 reset=Style.RESET_ALL,
             )
         )
예제 #5
0
파일: list.py 프로젝트: Epic-R-R/tTodo
    def print_list(self, todos=[]):
        if not todos:
            safe_print('{green}Congrats!{reset}'.format(
                green=Fore.GREEN,
                reset=Style.RESET_ALL,
            ))
            safe_print('There\'s nothing else to do.')
        else:
            self.print_todos(todos)

            no_items = len(todos)
            no_checked = len([t for t in todos if t['done']])
            print(
                '{info}{no_items:>2} items: {no_checked} completed, {no_unchecked} left{reset}'
                .format(
                    no_items=no_items,
                    no_checked=no_checked,
                    no_unchecked=(no_items - no_checked),
                    info=Fore.INFO,
                    reset=Style.RESET_ALL,
                ))
예제 #6
0
def check_python_version():
    if sys.version_info[0] < 3:
        from todo.utils.compatibility import safe_print
        from todo.utils.styles import Fore, Style
        safe_print(
'''
{fail}{bold}\tUh oh!{reset}
{warning}You need Python 3 to use this program. 😕
{info}Download Python: {blue}https://www.python.org/downloads
{info}Learn more: {blue}https://github.com/francoischalifour/todo-cli{reset}
'''
            .format(
                fail=Fore.FAIL,
                bold=Style.BOLD,
                warning=Fore.WARNING,
                info=Fore.INFO,
                blue=Fore.BLUE,
                reset=Style.RESET_ALL,
            )
        )
        sys.exit(1)