mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-04 12:41:50 +02:00
Run black dangerzone
to fix up style
This commit is contained in:
parent
ba516476de
commit
8eefbefa1a
6 changed files with 20 additions and 29 deletions
|
@ -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):
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue