Commit 6691d349 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Merge branch 'lazy-import'

parents 71e45f5a 8cd2afd0
...@@ -101,12 +101,9 @@ except ConfigError as config_error: ...@@ -101,12 +101,9 @@ except ConfigError as config_error:
error(str(config_error)) error(str(config_error))
sys.exit(1) sys.exit(1)
from topydo.commands.ArchiveCommand import ArchiveCommand
from topydo.commands.SortCommand import SortCommand
from topydo.lib import TodoFile from topydo.lib import TodoFile
from topydo.lib import TodoList from topydo.lib import TodoList
from topydo.lib import TodoListBase from topydo.lib import TodoListBase
from topydo.lib.ChangeSet import ChangeSet
from topydo.lib.Utils import escape_ansi from topydo.lib.Utils import escape_ansi
...@@ -178,6 +175,7 @@ class CLIApplicationBase(object): ...@@ -178,6 +175,7 @@ class CLIApplicationBase(object):
self.backup.add_archive(archive) self.backup.add_archive(archive)
if archive: if archive:
from topydo.commands.ArchiveCommand import ArchiveCommand
command = ArchiveCommand(self.todolist, archive) command = ArchiveCommand(self.todolist, archive)
command.execute() command.execute()
...@@ -209,6 +207,8 @@ class CLIApplicationBase(object): ...@@ -209,6 +207,8 @@ class CLIApplicationBase(object):
""" """
if config().backup_count() > 0 and p_command and not self.is_read_only(p_command): if config().backup_count() > 0 and p_command and not self.is_read_only(p_command):
call = [p_command.__module__.lower()[16:-7]] + p_args # strip "topydo.commands" and "Command" call = [p_command.__module__.lower()[16:-7]] + p_args # strip "topydo.commands" and "Command"
from topydo.lib.ChangeSet import ChangeSet
self.backup = ChangeSet(self.todolist, p_call=call) self.backup = ChangeSet(self.todolist, p_call=call)
command = p_command( command = p_command(
...@@ -237,6 +237,7 @@ class CLIApplicationBase(object): ...@@ -237,6 +237,7 @@ class CLIApplicationBase(object):
self._archive() self._archive()
if config().keep_sorted(): if config().keep_sorted():
from topydo.commands.SortCommand import SortCommand
self._execute(SortCommand, []) self._execute(SortCommand, [])
if self.backup: if self.backup:
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
from topydo.lib.Config import config from topydo.lib.Config import config
from topydo.lib.ExpressionCommand import ExpressionCommand from topydo.lib.ExpressionCommand import ExpressionCommand
from topydo.lib.IcalPrinter import IcalPrinter
from topydo.lib.JsonPrinter import JsonPrinter
from topydo.lib.PrettyPrinter import pretty_printer_factory from topydo.lib.PrettyPrinter import pretty_printer_factory
from topydo.lib.PrettyPrinterFilter import (PrettyPrinterHideTagFilter, from topydo.lib.PrettyPrinterFilter import (PrettyPrinterHideTagFilter,
PrettyPrinterIndentFilter) PrettyPrinterIndentFilter)
...@@ -58,9 +56,11 @@ class ListCommand(ExpressionCommand): ...@@ -58,9 +56,11 @@ class ListCommand(ExpressionCommand):
self.sort_expression = value self.sort_expression = value
elif opt == '-f': elif opt == '-f':
if value == 'json': if value == 'json':
from topydo.lib.JsonPrinter import JsonPrinter
self.printer = JsonPrinter() self.printer = JsonPrinter()
elif value == 'ical': elif value == 'ical':
if self._poke_icalendar(): if self._poke_icalendar():
from topydo.lib.IcalPrinter import IcalPrinter
self.printer = IcalPrinter(self.todolist) self.printer = IcalPrinter(self.todolist)
else: else:
self.printer = None self.printer = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment