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 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 success = False
if ocr_lang: if ocr_lang:
@ -117,6 +119,7 @@ def convert(input_filename, output_filename, ocr_lang, stdout_callback: Callable
return success return success
# From global_common: # From global_common:
# def validate_convert_to_pixel_output(self, common, output): # def validate_convert_to_pixel_output(self, common, output):

View file

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

View file

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

View file

@ -6,9 +6,7 @@ import dangerzone.util as dzutil
class SysTray(QtWidgets.QSystemTrayIcon): class SysTray(QtWidgets.QSystemTrayIcon):
def __init__( def __init__(self, gui_common: GuiCommon, app: Application):
self, gui_common: GuiCommon, app: Application
):
super(SysTray, self).__init__() super(SysTray, self).__init__()
self.gui_common = gui_common self.gui_common = gui_common
self.app = app 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 # Look for ./share relative to python file
prefix = _dev_root_path().joinpath("share") # e.g., /home/user/dangerzone/share prefix = _dev_root_path().joinpath("share") # e.g., /home/user/dangerzone/share
elif SYSTEM == "Darwin": 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 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": elif SYSTEM == "Linux":
prefix = pathlib.Path(sys.prefix).joinpath("share", "dangerzone") prefix = pathlib.Path(sys.prefix).joinpath("share", "dangerzone")
elif SYSTEM == "Windows": elif SYSTEM == "Windows":
@ -243,7 +247,7 @@ OCR_LANGUAGES = {
"Vietnamese": "vie", "Vietnamese": "vie",
"Welsh": "cym", "Welsh": "cym",
"Yiddish": "yid", "Yiddish": "yid",
"Yoruba": "yor" "Yoruba": "yor",
} }