Run black dangerzone to fix up style

This commit is contained in:
Guthrie McAfee Armstrong 2022-06-06 21:50:04 -04:00
parent ba516476de
commit 8eefbefa1a
No known key found for this signature in database
GPG key ID: ED4DAE89F08242D2
6 changed files with 20 additions and 29 deletions

View file

@ -32,7 +32,9 @@ def exec_container(args, stdout_callback: Callable[[str], None]) -> int:
return p.returncode
def convert(input_filename, output_filename, ocr_lang, stdout_callback: Callable[[str], None]):
def convert(
input_filename, output_filename, ocr_lang, stdout_callback: Callable[[str], None]
):
success = False
if ocr_lang:
@ -117,6 +119,7 @@ def convert(input_filename, output_filename, ocr_lang, stdout_callback: Callable
return success
# From global_common:
# def validate_convert_to_pixel_output(self, common, output):

View file

@ -45,9 +45,7 @@ class GuiCommon(object):
elif platform.system() == "Linux":
# Get the PDF reader command
args = shlex.split(
self.pdf_viewers[self.settings.get("open_app")]
)
args = shlex.split(self.pdf_viewers[self.settings.get("open_app")])
# %f, %F, %u, and %U are filenames or URLS -- so replace with the file to open
for i in range(len(args)):
if (

View file

@ -33,9 +33,7 @@ class MainWindow(QtWidgets.QMainWindow):
# Header
logo = QtWidgets.QLabel()
logo.setPixmap(
QtGui.QPixmap.fromImage(
QtGui.QImage(dzutil.get_resource_path("icon.png"))
)
QtGui.QPixmap.fromImage(QtGui.QImage(dzutil.get_resource_path("icon.png")))
)
header_label = QtWidgets.QLabel("dangerzone")
header_label.setFont(self.gui_common.fixed_font)
@ -52,9 +50,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.waiting_widget.finished.connect(self.waiting_finished)
# Content widget, contains all the window content except waiting widget
self.content_widget = ContentWidget(
self.gui_common, self.common
)
self.content_widget = ContentWidget(self.gui_common, self.common)
self.content_widget.close_window.connect(self.close)
# Only use the waiting widget if container runtime isn't available
@ -211,9 +207,7 @@ class ContentWidget(QtWidgets.QWidget):
self.doc_selection_widget.document_selected.connect(self.document_selected)
# Settings
self.settings_widget = SettingsWidget(
self.gui_common, self.common
)
self.settings_widget = SettingsWidget(self.gui_common, self.common)
self.doc_selection_widget.document_selected.connect(
self.settings_widget.document_selected
)
@ -222,9 +216,7 @@ class ContentWidget(QtWidgets.QWidget):
self.settings_widget.hide()
# Convert
self.convert_widget = ConvertWidget(
self.gui_common, self.common
)
self.convert_widget = ConvertWidget(self.gui_common, self.common)
self.convert_widget.close_window.connect(self._close_window)
self.doc_selection_widget.document_selected.connect(
self.convert_widget.document_selected
@ -399,9 +391,7 @@ class SettingsWidget(QtWidgets.QWidget):
else:
self.ocr_checkbox.setCheckState(QtCore.Qt.Unchecked)
index = self.ocr_combobox.findText(
self.gui_common.settings.get("ocr_language")
)
index = self.ocr_combobox.findText(self.gui_common.settings.get("ocr_language"))
if index != -1:
self.ocr_combobox.setCurrentIndex(index)
@ -551,9 +541,7 @@ class ConvertWidget(QtWidgets.QWidget):
# Label
self.error_image = QtWidgets.QLabel()
self.error_image.setPixmap(
QtGui.QPixmap.fromImage(
QtGui.QImage(dzutil.get_resource_path("error.png"))
)
QtGui.QPixmap.fromImage(QtGui.QImage(dzutil.get_resource_path("error.png")))
)
self.error_image.hide()

View file

@ -6,9 +6,7 @@ import dangerzone.util as dzutil
class SysTray(QtWidgets.QSystemTrayIcon):
def __init__(
self, gui_common: GuiCommon, app: Application
):
def __init__(self, gui_common: GuiCommon, app: Application):
super(SysTray, self).__init__()
self.gui_common = gui_common
self.app = app

View file

@ -40,9 +40,13 @@ def get_resource_path(filename: str | os.PathLike[str]) -> str:
# Look for ./share relative to python file
prefix = _dev_root_path().joinpath("share") # e.g., /home/user/dangerzone/share
elif SYSTEM == "Darwin":
bin_path = pathlib.Path(sys.executable) # /path/to/Dangerzone.app/Contents/MacOS/dangerzone[-cli]
bin_path = pathlib.Path(
sys.executable
) # /path/to/Dangerzone.app/Contents/MacOS/dangerzone[-cli]
app_path = bin_path.parent.parent # /path/to/Dangerzone.app/Contents
prefix = app_path.joinpath("Resources", "share") # /path/to/Dangerzone.app/Contents/Resources/share
prefix = app_path.joinpath(
"Resources", "share"
) # /path/to/Dangerzone.app/Contents/Resources/share
elif SYSTEM == "Linux":
prefix = pathlib.Path(sys.prefix).joinpath("share", "dangerzone")
elif SYSTEM == "Windows":
@ -243,7 +247,7 @@ OCR_LANGUAGES = {
"Vietnamese": "vie",
"Welsh": "cym",
"Yiddish": "yid",
"Yoruba": "yor"
"Yoruba": "yor",
}