diff --git a/papers/commands/add_cmd.py b/papers/commands/add_cmd.py index 31cbcf5..1e27268 100644 --- a/papers/commands/add_cmd.py +++ b/papers/commands/add_cmd.py @@ -2,6 +2,7 @@ from .. import repo from .. import files from ..paper import Paper, NoDocumentFile, get_bibentry_from_string from ..configs import config +from ..uis import get_ui from .helpers import add_paper_with_docfile, extract_doc_path_from_bibdata @@ -25,7 +26,7 @@ def command(args): :param docfile: path (no url yet) to a pdf or ps file """ - ui = args.ui + ui = get_ui() bibfile = args.bibfile docfile = args.docfile tags = args.tags diff --git a/papers/commands/attach_cmd.py b/papers/commands/attach_cmd.py index e2c9741..1d48ad3 100644 --- a/papers/commands/attach_cmd.py +++ b/papers/commands/attach_cmd.py @@ -1,5 +1,6 @@ from .. import repo from ..configs import config +from ..uis import get_ui from .helpers import (add_references_argument, parse_reference, add_docfile_to_paper) @@ -22,7 +23,7 @@ def command(args): :param docfile: path (no url yet) to a pdf or ps file """ - ui = args.ui + ui = get_ui() copy = args.copy reference = args.reference document = args.document diff --git a/papers/commands/edit_cmd.py b/papers/commands/edit_cmd.py index 919162a..4bd59d4 100644 --- a/papers/commands/edit_cmd.py +++ b/papers/commands/edit_cmd.py @@ -3,6 +3,7 @@ from .. import repo from ..paper import get_bibentry_from_string, get_safe_metadata_from_content from .helpers import add_references_argument, parse_reference from ..configs import config +from ..uis import get_ui def parser(subparsers): @@ -16,7 +17,7 @@ def parser(subparsers): def command(args): - ui = args.ui + ui = get_ui() meta = args.meta reference = args.reference diff --git a/papers/commands/export_cmd.py b/papers/commands/export_cmd.py index d0422c7..0728f28 100644 --- a/papers/commands/export_cmd.py +++ b/papers/commands/export_cmd.py @@ -6,6 +6,7 @@ from .. import repo from .. import files from .helpers import parse_references, add_references_argument from ..configs import config +from ..uis import get_ui def parser(subparsers): parser = subparsers.add_parser('export', @@ -21,7 +22,7 @@ def command(args): :param bib_format (in 'bibtex', 'yaml') """ - ui = args.ui + ui = get_ui() bib_format = args.bib_format references = args.references diff --git a/papers/commands/import_cmd.py b/papers/commands/import_cmd.py index cb81fb9..1610c28 100644 --- a/papers/commands/import_cmd.py +++ b/papers/commands/import_cmd.py @@ -2,6 +2,7 @@ from .. import repo from ..paper import Paper from .helpers import add_paper_with_docfile, extract_doc_path_from_bibdata from ..configs import config +from ..uis import get_ui def parser(subparsers): parser = subparsers.add_parser('import', @@ -20,7 +21,7 @@ def command(args): :param bibpath: path (no url yet) to a bibliography file """ - ui = args.ui + ui = get_ui() bibpath = args.bibpath copy = args.copy diff --git a/papers/commands/init_cmd.py b/papers/commands/init_cmd.py index b758312..cfdb177 100644 --- a/papers/commands/init_cmd.py +++ b/papers/commands/init_cmd.py @@ -4,6 +4,7 @@ import os from ..repo import Repository from ..configs import config +from ..uis import get_ui from .. import color from .. import files @@ -21,7 +22,7 @@ def parser(subparsers): def command(args): """Create a .papers directory""" - ui = args.ui + ui = get_ui() path = args.path doc_dir = args.doc_dir diff --git a/papers/commands/list_cmd.py b/papers/commands/list_cmd.py index ca95e80..b0eda6e 100644 --- a/papers/commands/list_cmd.py +++ b/papers/commands/list_cmd.py @@ -3,6 +3,7 @@ from .. import repo from .. import color from . import helpers from ..configs import config +from ..uis import get_ui def parser(subparsers): @@ -17,7 +18,7 @@ def parser(subparsers): def command(args): - ui = args.ui + ui = get_ui() citekeys = args.citekeys query = args.query diff --git a/papers/commands/open_cmd.py b/papers/commands/open_cmd.py index 647a16a..ca989cf 100644 --- a/papers/commands/open_cmd.py +++ b/papers/commands/open_cmd.py @@ -3,6 +3,7 @@ import subprocess from .. import repo from ..paper import NoDocumentFile from ..configs import config +from ..uis import get_ui from .. import color from .helpers import add_references_argument, parse_reference @@ -18,7 +19,7 @@ def parser(subparsers): def command(args): - ui = args.ui + ui = get_ui() with_command = args.with_command reference = args.reference diff --git a/papers/commands/remove_cmd.py b/papers/commands/remove_cmd.py index 26ededd..abc2008 100644 --- a/papers/commands/remove_cmd.py +++ b/papers/commands/remove_cmd.py @@ -1,6 +1,7 @@ from .. import repo from .. import color from ..configs import config +from ..uis import get_ui from .helpers import add_references_argument, parse_references @@ -14,7 +15,7 @@ def parser(subparsers): def command(args): - ui = args.ui + ui = get_ui() force = args.force references = args.references diff --git a/papers/commands/tag_cmd.py b/papers/commands/tag_cmd.py index 5c6de9e..cfebd49 100644 --- a/papers/commands/tag_cmd.py +++ b/papers/commands/tag_cmd.py @@ -20,6 +20,7 @@ The different use cases are : from ..repo import Repository, InvalidReference from . import helpers from ..configs import config +from ..uis import get_ui def parser(subparsers): parser = subparsers.add_parser('tag', help="add, remove and show tags") @@ -67,7 +68,7 @@ def _tag_groups(tags): def command(args): """Add, remove and show tags""" - ui = args.ui + ui = get_ui() referenceOrTag = args.referenceOrTag tags = args.tags diff --git a/papers/commands/update_cmd.py b/papers/commands/update_cmd.py index 0bfd1f6..312cb63 100644 --- a/papers/commands/update_cmd.py +++ b/papers/commands/update_cmd.py @@ -3,6 +3,7 @@ import sys from .. import repo from .. import color from ..configs import config +from ..uis import get_ui from ..__init__ import __version__ def parser(subparsers): @@ -12,7 +13,7 @@ def parser(subparsers): def command(args): - ui = args.ui + ui = get_ui() code_version = __version__ repo_version = int(config().version) diff --git a/papers/commands/websearch_cmd.py b/papers/commands/websearch_cmd.py index 056a8ad..e3e1c76 100644 --- a/papers/commands/websearch_cmd.py +++ b/papers/commands/websearch_cmd.py @@ -1,6 +1,7 @@ import webbrowser import urllib +from ..uis import get_ui def parser(subparsers): parser = subparsers.add_parser('websearch', @@ -12,7 +13,7 @@ def parser(subparsers): def command(args): - ui = args.ui + ui = get_ui() search_string = args.search_string url = ("https://scholar.google.fr/scholar?q=%s&lr=" diff --git a/papers/files.py b/papers/files.py index 8a90632..1937870 100644 --- a/papers/files.py +++ b/papers/files.py @@ -12,7 +12,6 @@ from io import StringIO import yaml -from . import ui from . import color try: diff --git a/papers/papers_cmd.py b/papers/papers_cmd.py index f8c24fb..8df7bb9 100644 --- a/papers/papers_cmd.py +++ b/papers/papers_cmd.py @@ -71,8 +71,6 @@ def execute(raw_args = sys.argv): subparser = cmd_mod.parser(subparsers) # why do we return the subparser ? args = parser.parse_args(raw_args[1:]) - - args.ui = ui cmd = args.command del args.command