Initial GUI multi-window opening via terminal

Allow opening multiple documents at the same time from the terminal
by calling

  $ dangerzone document1.pdf document2.pdf

It will open each document in its own window, making use of the
already existing 'multi-document multi-window' parallel conversion
implementation.
This commit is contained in:
deeplow 2022-10-13 15:55:03 +01:00
parent 1e16eca392
commit 89f5e99b0c
No known key found for this signature in database
GPG key ID: 577982871529A52A

View file

@ -4,7 +4,7 @@ import platform
import signal
import sys
import uuid
from typing import Dict, Optional
from typing import Dict, List, Optional
import click
import colorama
@ -49,9 +49,15 @@ class ApplicationWrapper(QtCore.QObject):
@click.command()
@click.argument("filename", required=False, callback=args.validate_input_filename)
@click.argument(
"filenames",
required=False,
nargs=-1,
type=click.UNPROCESSED,
callback=args.validate_input_filenames,
)
@errors.handle_document_errors
def gui_main(filename: Optional[str]) -> bool:
def gui_main(filenames: Optional[List[str]]) -> bool:
setup_logging()
if platform.system() == "Darwin":
@ -97,9 +103,10 @@ def gui_main(filename: Optional[str]) -> bool:
window.content_widget.doc_selection_widget.document_selected.emit()
# Open a new window if not filename is passed
if filename is None:
if filenames is None:
new_window()
else:
for filename in filenames:
new_window(filename)
# Open a new window, if all windows are closed