1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Format all files with black correcting line length

This commit is contained in:
2021-08-15 04:10:18 -05:00
parent 9446f37fad
commit ffe6b7047c
80 changed files with 517 additions and 970 deletions

View File

@@ -5,14 +5,13 @@
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCore import Qt, QSize, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import (
QAbstractItemView, QSizePolicy, QGridLayout, QSplitter, QFrame)
from PyQt5.QtWidgets import QAbstractItemView, QSizePolicy, QGridLayout, QSplitter, QFrame
from PyQt5.QtGui import QResizeEvent
from hscommon.trans import trget
from ..details_dialog import DetailsDialog as DetailsDialogBase
from ..details_table import DetailsTable
from .image_viewer import (
ViewerToolBar, ScrollAreaImageViewer, ScrollAreaController)
from .image_viewer import ViewerToolBar, ScrollAreaImageViewer, ScrollAreaController
tr = trget("ui")
@@ -70,8 +69,7 @@ class DetailsDialog(DetailsDialogBase):
self.splitter.addWidget(self.tableView)
self.splitter.setStretchFactor(1, 1)
# Late population needed here for connections to the toolbar
self.vController.setupViewers(
self.selectedImageViewer, self.referenceImageViewer)
self.vController.setupViewers(self.selectedImageViewer, self.referenceImageViewer)
# self.setCentralWidget(self.splitter) # only as QMainWindow
self.setWidget(self.splitter) # only as QDockWidget
@@ -103,11 +101,11 @@ class DetailsDialog(DetailsDialogBase):
# Give the splitter a maximum height to reach. This is assuming that
# all rows below their headers have the same height
self.tableView.setMaximumHeight(
self.tableView.rowHeight(1)
* self.tableModel.model.row_count()
self.tableView.rowHeight(1) * self.tableModel.model.row_count()
+ self.tableView.verticalHeader().sectionSize(0)
# looks like the handle is taken into account by the splitter
+ self.splitter.handle(1).size().height())
+ self.splitter.handle(1).size().height()
)
DetailsDialogBase.show(self)
self.ensure_same_sizes()
self._update()
@@ -138,6 +136,7 @@ class DetailsDialog(DetailsDialogBase):
class EmittingFrame(QFrame):
"""Emits a signal whenever is resized"""
resized = pyqtSignal(QResizeEvent)
def resizeEvent(self, event):

View File

@@ -2,15 +2,24 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCore import (
QObject, Qt, QSize, QRectF, QPointF, QPoint, pyqtSlot, pyqtSignal, QEvent)
from PyQt5.QtCore import QObject, Qt, QSize, QRectF, QPointF, QPoint, pyqtSlot, pyqtSignal, QEvent
from PyQt5.QtGui import QPixmap, QPainter, QPalette, QCursor, QIcon, QKeySequence
from PyQt5.QtWidgets import (
QGraphicsView, QGraphicsScene, QGraphicsPixmapItem,
QToolBar, QToolButton, QAction, QWidget, QScrollArea,
QApplication, QAbstractScrollArea, QStyle)
QGraphicsView,
QGraphicsScene,
QGraphicsPixmapItem,
QToolBar,
QToolButton,
QAction,
QWidget,
QScrollArea,
QApplication,
QAbstractScrollArea,
QStyle,
)
from hscommon.trans import trget
from hscommon.plat import ISLINUX
tr = trget("ui")
MAX_SCALE = 12.0
@@ -50,8 +59,7 @@ class ViewerToolBar(QToolBar):
"actionZoomIn",
QKeySequence.ZoomIn,
QIcon.fromTheme("zoom-in")
if ISLINUX
and not self.parent.app.prefs.details_dialog_override_theme_icons
if ISLINUX and not self.parent.app.prefs.details_dialog_override_theme_icons
else QIcon(QPixmap(":/" + "zoom_in")),
tr("Increase zoom"),
controller.zoomIn,
@@ -60,8 +68,7 @@ class ViewerToolBar(QToolBar):
"actionZoomOut",
QKeySequence.ZoomOut,
QIcon.fromTheme("zoom-out")
if ISLINUX
and not self.parent.app.prefs.details_dialog_override_theme_icons
if ISLINUX and not self.parent.app.prefs.details_dialog_override_theme_icons
else QIcon(QPixmap(":/" + "zoom_out")),
tr("Decrease zoom"),
controller.zoomOut,
@@ -70,8 +77,7 @@ class ViewerToolBar(QToolBar):
"actionNormalSize",
tr("Ctrl+/"),
QIcon.fromTheme("zoom-original")
if ISLINUX
and not self.parent.app.prefs.details_dialog_override_theme_icons
if ISLINUX and not self.parent.app.prefs.details_dialog_override_theme_icons
else QIcon(QPixmap(":/" + "zoom_original")),
tr("Normal size"),
controller.zoomNormalSize,
@@ -80,12 +86,11 @@ class ViewerToolBar(QToolBar):
"actionBestFit",
tr("Ctrl+*"),
QIcon.fromTheme("zoom-best-fit")
if ISLINUX
and not self.parent.app.prefs.details_dialog_override_theme_icons
if ISLINUX and not self.parent.app.prefs.details_dialog_override_theme_icons
else QIcon(QPixmap(":/" + "zoom_best_fit")),
tr("Best fit"),
controller.zoomBestFit,
)
),
]
# TODO try with QWidgetAction() instead in order to have
# the popup menu work in the toolbar (if resized below minimum height)
@@ -95,13 +100,12 @@ class ViewerToolBar(QToolBar):
self.buttonImgSwap = QToolButton(self)
self.buttonImgSwap.setToolButtonStyle(Qt.ToolButtonIconOnly)
self.buttonImgSwap.setIcon(
QIcon.fromTheme('view-refresh',
self.style().standardIcon(QStyle.SP_BrowserReload))
if ISLINUX
and not self.parent.app.prefs.details_dialog_override_theme_icons
else QIcon(QPixmap(":/" + "exchange")))
self.buttonImgSwap.setText('Swap images')
self.buttonImgSwap.setToolTip('Swap images')
QIcon.fromTheme("view-refresh", self.style().standardIcon(QStyle.SP_BrowserReload))
if ISLINUX and not self.parent.app.prefs.details_dialog_override_theme_icons
else QIcon(QPixmap(":/" + "exchange"))
)
self.buttonImgSwap.setText("Swap images")
self.buttonImgSwap.setToolTip("Swap images")
self.buttonImgSwap.pressed.connect(self.controller.swapImages)
self.buttonImgSwap.released.connect(self.controller.swapImages)
@@ -207,11 +211,11 @@ class BaseController(QObject):
# than the ReferenceImageViewer by one pixel, which distorts the
# scaled down pixmap for the reference, hence we'll reuse its size here.
selected_size = self._updateImage(
self.selectedPixmap, self.scaledSelectedPixmap,
self.selectedViewer, None, same_group)
self.selectedPixmap, self.scaledSelectedPixmap, self.selectedViewer, None, same_group
)
self._updateImage(
self.referencePixmap, self.scaledReferencePixmap,
self.referenceViewer, selected_size, same_group)
self.referencePixmap, self.scaledReferencePixmap, self.referenceViewer, selected_size, same_group
)
if ignore_update:
self.selectedViewer.ignore_signal = False
@@ -229,12 +233,10 @@ class BaseController(QObject):
return target_size
# zoomed in state, expand
# only if not same_group, we need full update
scaledpixmap = pixmap.scaled(
target_size, Qt.KeepAspectRatioByExpanding, Qt.FastTransformation)
scaledpixmap = pixmap.scaled(target_size, Qt.KeepAspectRatioByExpanding, Qt.FastTransformation)
else:
# best fit, keep ratio always
scaledpixmap = pixmap.scaled(
target_size, Qt.KeepAspectRatio, Qt.FastTransformation)
scaledpixmap = pixmap.scaled(target_size, Qt.KeepAspectRatio, Qt.FastTransformation)
viewer.setImage(scaledpixmap)
return target_size
@@ -347,12 +349,8 @@ class BaseController(QObject):
self.selectedViewer.resetCenter()
self.referenceViewer.resetCenter()
target_size = self._updateImage(
self.selectedPixmap, self.scaledSelectedPixmap,
self.selectedViewer, None, True)
self._updateImage(
self.referencePixmap, self.scaledReferencePixmap,
self.referenceViewer, target_size, True)
target_size = self._updateImage(self.selectedPixmap, self.scaledSelectedPixmap, self.selectedViewer, None, True)
self._updateImage(self.referencePixmap, self.scaledReferencePixmap, self.referenceViewer, target_size, True)
self.centerViews()
self.parent.verticalToolBar.buttonZoomIn.setEnabled(False)
@@ -402,6 +400,7 @@ class BaseController(QObject):
class QWidgetController(BaseController):
"""Specialized version for QWidget-based viewers."""
def __init__(self, parent):
super().__init__(parent)
@@ -430,6 +429,7 @@ class QWidgetController(BaseController):
class ScrollAreaController(BaseController):
"""Specialized version fro QLabel-based viewers."""
def __init__(self, parent):
super().__init__(parent)
@@ -442,10 +442,8 @@ class ScrollAreaController(BaseController):
super().updateBothImages(same_group)
if not self.referenceViewer.isEnabled():
return
self.referenceViewer._horizontalScrollBar.setValue(
self.selectedViewer._horizontalScrollBar.value())
self.referenceViewer._verticalScrollBar.setValue(
self.selectedViewer._verticalScrollBar.value())
self.referenceViewer._horizontalScrollBar.setValue(self.selectedViewer._horizontalScrollBar.value())
self.referenceViewer._verticalScrollBar.setValue(self.selectedViewer._verticalScrollBar.value())
@pyqtSlot(QPoint)
def onDraggedMouse(self, delta):
@@ -518,6 +516,7 @@ class ScrollAreaController(BaseController):
class GraphicsViewController(BaseController):
"""Specialized version fro QGraphicsView-based viewers."""
def __init__(self, parent):
super().__init__(parent)
@@ -625,10 +624,8 @@ class GraphicsViewController(BaseController):
if ignore_update:
self.selectedViewer.ignore_signal = True
self._updateFitImage(
self.selectedPixmap, self.selectedViewer)
self._updateFitImage(
self.referencePixmap, self.referenceViewer)
self._updateFitImage(self.selectedPixmap, self.selectedViewer)
self._updateFitImage(self.referencePixmap, self.referenceViewer)
if ignore_update:
self.selectedViewer.ignore_signal = False
@@ -699,6 +696,7 @@ class GraphicsViewController(BaseController):
class QWidgetImageViewer(QWidget):
"""Use a QPixmap, but no scrollbars and no keyboard key sequence for navigation."""
# FIXME: panning while zoomed-in is broken (due to delta not interpolated right?
mouseDragged = pyqtSignal(QPointF)
mouseWheeled = pyqtSignal(float)
@@ -720,15 +718,13 @@ class QWidgetImageViewer(QWidget):
self.setMouseTracking(False)
def __repr__(self):
return f'{self._instance_name}'
return f"{self._instance_name}"
def connectMouseSignals(self):
if not self._dragConnection:
self._dragConnection = self.mouseDragged.connect(
self.controller.onDraggedMouse)
self._dragConnection = self.mouseDragged.connect(self.controller.onDraggedMouse)
if not self._wheelConnection:
self._wheelConnection = self.mouseWheeled.connect(
self.controller.scaleImagesBy)
self._wheelConnection = self.mouseWheeled.connect(self.controller.scaleImagesBy)
def disconnectMouseSignals(self):
if self._dragConnection:
@@ -746,7 +742,7 @@ class QWidgetImageViewer(QWidget):
painter.drawPixmap(self._rect.topLeft(), self._pixmap)
def resetCenter(self):
""" Resets origin """
"""Resets origin"""
# Make sure we are not still panning around
self._mousePanningDelta = QPointF()
self.update()
@@ -783,8 +779,7 @@ class QWidgetImageViewer(QWidget):
event.ignore()
return
self._mousePanningDelta += (
event.pos() - self._lastMouseClickPoint) * 1.0 / self.current_scale
self._mousePanningDelta += (event.pos() - self._lastMouseClickPoint) * 1.0 / self.current_scale
self._lastMouseClickPoint = event.pos()
if self._drag:
self.mouseDragged.emit(self._mousePanningDelta)
@@ -860,6 +855,7 @@ class QWidgetImageViewer(QWidget):
class ScalablePixmap(QWidget):
"""Container for a pixmap that scales up very fast, used in ScrollAreaImageViewer."""
def __init__(self, parent):
super().__init__(parent)
self._pixmap = QPixmap()
@@ -881,6 +877,7 @@ class ScalablePixmap(QWidget):
class ScrollAreaImageViewer(QScrollArea):
"""Implementation using a pixmap container in a simple scroll area."""
mouseDragged = pyqtSignal(QPoint)
mouseWheeled = pyqtSignal(float, QPointF)
@@ -921,7 +918,7 @@ class ScrollAreaImageViewer(QScrollArea):
self.setVisible(True)
def __repr__(self):
return f'{self._instance_name}'
return f"{self._instance_name}"
def toggleScrollBars(self, forceOn=False):
if not self.prefs.details_dialog_viewers_show_scrollbars:
@@ -938,11 +935,9 @@ class ScrollAreaImageViewer(QScrollArea):
def connectMouseSignals(self):
if not self._dragConnection:
self._dragConnection = self.mouseDragged.connect(
self.controller.onDraggedMouse)
self._dragConnection = self.mouseDragged.connect(self.controller.onDraggedMouse)
if not self._wheelConnection:
self._wheelConnection = self.mouseWheeled.connect(
self.controller.onMouseWheel)
self._wheelConnection = self.mouseWheeled.connect(self.controller.onMouseWheel)
def disconnectMouseSignals(self):
if self._dragConnection:
@@ -955,10 +950,8 @@ class ScrollAreaImageViewer(QScrollArea):
def connectScrollBars(self):
"""Only call once controller is connected."""
# Cyclic connections are handled by Qt
self._verticalScrollBar.valueChanged.connect(
self.controller.onVScrollBarChanged, Qt.UniqueConnection)
self._horizontalScrollBar.valueChanged.connect(
self.controller.onHScrollBarChanged, Qt.UniqueConnection)
self._verticalScrollBar.valueChanged.connect(self.controller.onVScrollBarChanged, Qt.UniqueConnection)
self._horizontalScrollBar.valueChanged.connect(self.controller.onHScrollBarChanged, Qt.UniqueConnection)
def contextMenuEvent(self, event):
"""Block parent's (main window) context menu on right click."""
@@ -987,7 +980,7 @@ class ScrollAreaImageViewer(QScrollArea):
event.ignore()
return
if self._drag:
delta = (event.pos() - self._lastMouseClickPoint)
delta = event.pos() - self._lastMouseClickPoint
self._lastMouseClickPoint = event.pos()
self.mouseDragged.emit(delta)
super().mouseMoveEvent(event)
@@ -1064,35 +1057,29 @@ class ScrollAreaImageViewer(QScrollArea):
"""After scaling, no mouse position, default to center."""
# scrollBar.setMaximum(scrollBar.maximum() - scrollBar.minimum() + scrollBar.pageStep())
self._horizontalScrollBar.setValue(
int(factor * self._horizontalScrollBar.value()
+ ((factor - 1) * self._horizontalScrollBar.pageStep() / 2)))
int(factor * self._horizontalScrollBar.value() + ((factor - 1) * self._horizontalScrollBar.pageStep() / 2))
)
self._verticalScrollBar.setValue(
int(factor * self._verticalScrollBar.value()
+ ((factor - 1) * self._verticalScrollBar.pageStep() / 2)))
int(factor * self._verticalScrollBar.value() + ((factor - 1) * self._verticalScrollBar.pageStep() / 2))
)
def adjustScrollBarsScaled(self, delta):
"""After scaling with the mouse, update relative to mouse position."""
self._horizontalScrollBar.setValue(
self._horizontalScrollBar.value() + delta.x())
self._verticalScrollBar.setValue(
self._verticalScrollBar.value() + delta.y())
self._horizontalScrollBar.setValue(self._horizontalScrollBar.value() + delta.x())
self._verticalScrollBar.setValue(self._verticalScrollBar.value() + delta.y())
def adjustScrollBarsAuto(self):
"""After panning, update accordingly."""
self.horizontalScrollBar().setValue(
self.horizontalScrollBar().value() - self._mousePanningDelta.x())
self.verticalScrollBar().setValue(
self.verticalScrollBar().value() - self._mousePanningDelta.y())
self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - self._mousePanningDelta.x())
self.verticalScrollBar().setValue(self.verticalScrollBar().value() - self._mousePanningDelta.y())
def adjustScrollBarCentered(self):
"""Just center in the middle."""
self._horizontalScrollBar.setValue(
int(self._horizontalScrollBar.maximum() / 2))
self._verticalScrollBar.setValue(
int(self._verticalScrollBar.maximum() / 2))
self._horizontalScrollBar.setValue(int(self._horizontalScrollBar.maximum() / 2))
self._verticalScrollBar.setValue(int(self._verticalScrollBar.maximum() / 2))
def resetCenter(self):
""" Resets origin """
"""Resets origin"""
self._mousePanningDelta = QPoint()
self.current_scale = 1.0
# self.scaleAt(1.0)
@@ -1127,6 +1114,7 @@ class ScrollAreaImageViewer(QScrollArea):
class GraphicsViewViewer(QGraphicsView):
"""Re-Implementation a full-fledged GraphicsView but is a bit buggy."""
mouseDragged = pyqtSignal()
mouseWheeled = pyqtSignal(float, QPointF)
@@ -1178,11 +1166,9 @@ class GraphicsViewViewer(QGraphicsView):
def connectMouseSignals(self):
if not self._dragConnection:
self._dragConnection = self.mouseDragged.connect(
self.controller.syncCenters)
self._dragConnection = self.mouseDragged.connect(self.controller.syncCenters)
if not self._wheelConnection:
self._wheelConnection = self.mouseWheeled.connect(
self.controller.onMouseWheel)
self._wheelConnection = self.mouseWheeled.connect(self.controller.onMouseWheel)
def disconnectMouseSignals(self):
if self._dragConnection:
@@ -1195,10 +1181,8 @@ class GraphicsViewViewer(QGraphicsView):
def connectScrollBars(self):
"""Only call once controller is connected."""
# Cyclic connections are handled by Qt
self._verticalScrollBar.valueChanged.connect(
self.controller.onVScrollBarChanged, Qt.UniqueConnection)
self._horizontalScrollBar.valueChanged.connect(
self.controller.onHScrollBarChanged, Qt.UniqueConnection)
self._verticalScrollBar.valueChanged.connect(self.controller.onVScrollBarChanged, Qt.UniqueConnection)
self._horizontalScrollBar.valueChanged.connect(self.controller.onHScrollBarChanged, Qt.UniqueConnection)
def toggleScrollBars(self, forceOn=False):
if not self.prefs.details_dialog_viewers_show_scrollbars:
@@ -1298,7 +1282,7 @@ class GraphicsViewViewer(QGraphicsView):
self.centerOn(self._centerPoint)
def resetCenter(self):
""" Resets origin """
"""Resets origin"""
self._mousePanningDelta = QPointF()
self.current_scale = 1.0
@@ -1345,10 +1329,8 @@ class GraphicsViewViewer(QGraphicsView):
def adjustScrollBarsScaled(self, delta):
"""After scaling with the mouse, update relative to mouse position."""
self._horizontalScrollBar.setValue(
self._horizontalScrollBar.value() + delta.x())
self._verticalScrollBar.setValue(
self._verticalScrollBar.value() + delta.y())
self._horizontalScrollBar.setValue(self._horizontalScrollBar.value() + delta.x())
self._verticalScrollBar.setValue(self._verticalScrollBar.value() + delta.y())
def sizeHint(self):
return self.viewport().rect().size()
@@ -1356,15 +1338,13 @@ class GraphicsViewViewer(QGraphicsView):
def adjustScrollBarsFactor(self, factor):
"""After scaling, no mouse position, default to center."""
self._horizontalScrollBar.setValue(
int(factor * self._horizontalScrollBar.value()
+ ((factor - 1) * self._horizontalScrollBar.pageStep() / 2)))
int(factor * self._horizontalScrollBar.value() + ((factor - 1) * self._horizontalScrollBar.pageStep() / 2))
)
self._verticalScrollBar.setValue(
int(factor * self._verticalScrollBar.value()
+ ((factor - 1) * self._verticalScrollBar.pageStep() / 2)))
int(factor * self._verticalScrollBar.value() + ((factor - 1) * self._verticalScrollBar.pageStep() / 2))
)
def adjustScrollBarsAuto(self):
"""After panning, update accordingly."""
self.horizontalScrollBar().setValue(
self.horizontalScrollBar().value() - self._mousePanningDelta.x())
self.verticalScrollBar().setValue(
self.verticalScrollBar().value() - self._mousePanningDelta.y())
self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - self._mousePanningDelta.x())
self.verticalScrollBar().setValue(self.verticalScrollBar().value() - self._mousePanningDelta.y())

View File

@@ -30,13 +30,15 @@ class File(PhotoBase):
image = QImage(str(self.path))
image = image.convertToFormat(QImage.Format_RGB888)
if type(orientation) == str:
logging.warning("Orientation for file '%s' was a str '%s', not an int.",
str(self.path), orientation)
logging.warning("Orientation for file '%s' was a str '%s', not an int.", str(self.path), orientation)
try:
orientation = int(orientation)
except Exception as e:
logging.exception("Skipping transformation because could not \
convert str to int. %s", e)
logging.exception(
"Skipping transformation because could not \
convert str to int. %s",
e,
)
return getblocks(image, block_count_per_side)
# MYSTERY TO SOLVE: For reasons I cannot explain, orientations 5 and 7 don't work for
# duplicate scanning. The transforms seems to work fine (if I try to save the image after

View File

@@ -21,19 +21,13 @@ class PreferencesDialog(PreferencesDialogBase):
def _setupPreferenceWidgets(self):
self._setupFilterHardnessBox()
self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
self._setupAddCheckbox(
"matchScaledBox", tr("Match pictures of different dimensions")
)
self._setupAddCheckbox("matchScaledBox", tr("Match pictures of different dimensions"))
self.widgetsVLayout.addWidget(self.matchScaledBox)
self._setupAddCheckbox("mixFileKindBox", tr("Can mix file kind"))
self.widgetsVLayout.addWidget(self.mixFileKindBox)
self._setupAddCheckbox(
"useRegexpBox", tr("Use regular expressions when filtering")
)
self._setupAddCheckbox("useRegexpBox", tr("Use regular expressions when filtering"))
self.widgetsVLayout.addWidget(self.useRegexpBox)
self._setupAddCheckbox(
"removeEmptyFoldersBox", tr("Remove empty folders on delete or move")
)
self._setupAddCheckbox("removeEmptyFoldersBox", tr("Remove empty folders on delete or move"))
self.widgetsVLayout.addWidget(self.removeEmptyFoldersBox)
self._setupAddCheckbox(
"ignoreHardlinkMatches",
@@ -52,45 +46,37 @@ class PreferencesDialog(PreferencesDialogBase):
def _setupDisplayPage(self):
super()._setupDisplayPage()
self._setupAddCheckbox("details_dialog_override_theme_icons",
tr("Override theme icons in viewer toolbar"))
self._setupAddCheckbox("details_dialog_override_theme_icons", tr("Override theme icons in viewer toolbar"))
self.details_dialog_override_theme_icons.setToolTip(
tr("Use our own internal icons instead of those provided by the theme engine"))
tr("Use our own internal icons instead of those provided by the theme engine")
)
# Prevent changing this on platforms where themes are unpredictable
self.details_dialog_override_theme_icons.setEnabled(False if not ISLINUX else True)
# Insert this right after the vertical title bar option
index = self.details_groupbox_layout.indexOf(self.details_dialog_vertical_titlebar)
self.details_groupbox_layout.insertWidget(
index + 1, self.details_dialog_override_theme_icons)
self._setupAddCheckbox("details_dialog_viewers_show_scrollbars",
tr("Show scrollbars in image viewers"))
self.details_groupbox_layout.insertWidget(index + 1, self.details_dialog_override_theme_icons)
self._setupAddCheckbox("details_dialog_viewers_show_scrollbars", tr("Show scrollbars in image viewers"))
self.details_dialog_viewers_show_scrollbars.setToolTip(
tr("When the image displayed doesn't fit the viewport, \
show scrollbars to span the view around"))
self.details_groupbox_layout.insertWidget(
index + 2, self.details_dialog_viewers_show_scrollbars)
tr(
"When the image displayed doesn't fit the viewport, \
show scrollbars to span the view around"
)
)
self.details_groupbox_layout.insertWidget(index + 2, self.details_dialog_viewers_show_scrollbars)
def _load(self, prefs, setchecked, section):
setchecked(self.matchScaledBox, prefs.match_scaled)
self.cacheTypeRadio.selected_index = (
1 if prefs.picture_cache_type == "shelve" else 0
)
self.cacheTypeRadio.selected_index = 1 if prefs.picture_cache_type == "shelve" else 0
# Update UI state based on selected scan type
scan_type = prefs.get_scan_type(AppMode.Picture)
fuzzy_scan = scan_type == ScanType.FuzzyBlock
self.filterHardnessSlider.setEnabled(fuzzy_scan)
setchecked(self.details_dialog_override_theme_icons,
prefs.details_dialog_override_theme_icons)
setchecked(self.details_dialog_viewers_show_scrollbars,
prefs.details_dialog_viewers_show_scrollbars)
setchecked(self.details_dialog_override_theme_icons, prefs.details_dialog_override_theme_icons)
setchecked(self.details_dialog_viewers_show_scrollbars, prefs.details_dialog_viewers_show_scrollbars)
def _save(self, prefs, ischecked):
prefs.match_scaled = ischecked(self.matchScaledBox)
prefs.picture_cache_type = (
"shelve" if self.cacheTypeRadio.selected_index == 1 else "sqlite"
)
prefs.details_dialog_override_theme_icons =\
ischecked(self.details_dialog_override_theme_icons)
prefs.details_dialog_viewers_show_scrollbars =\
ischecked(self.details_dialog_viewers_show_scrollbars)
prefs.picture_cache_type = "shelve" if self.cacheTypeRadio.selected_index == 1 else "sqlite"
prefs.details_dialog_override_theme_icons = ischecked(self.details_dialog_override_theme_icons)
prefs.details_dialog_viewers_show_scrollbars = ischecked(self.details_dialog_viewers_show_scrollbars)