mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
qt: move scan_type preference to main window
It leads to better discoverability of dupeguru's options and will make more sense after the big merge of all editions.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2009-05-17
|
||||
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
# Copyright 2016 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from core.scanner import ScanType
|
||||
@@ -11,18 +9,17 @@ from core.scanner import ScanType
|
||||
from ..base.preferences import Preferences as PreferencesBase
|
||||
|
||||
class Preferences(PreferencesBase):
|
||||
DEFAULT_SCAN_TYPE = ScanType.FuzzyBlock
|
||||
|
||||
def _load_specific(self, settings):
|
||||
get = self.get_value
|
||||
self.scan_type = get('ScanType', self.scan_type)
|
||||
self.match_scaled = get('MatchScaled', self.match_scaled)
|
||||
|
||||
|
||||
def _reset_specific(self):
|
||||
self.scan_type = ScanType.FuzzyBlock
|
||||
self.filter_hardness = 95
|
||||
self.match_scaled = False
|
||||
|
||||
|
||||
def _save_specific(self, settings):
|
||||
set_ = self.set_value
|
||||
set_('ScanType', self.scan_type)
|
||||
set_('MatchScaled', self.match_scaled)
|
||||
|
||||
|
||||
|
||||
@@ -13,13 +13,7 @@ from . import preferences
|
||||
tr = trget('ui')
|
||||
|
||||
class PreferencesDialog(PreferencesDialogBase):
|
||||
def __init__(self, parent, app):
|
||||
PreferencesDialogBase.__init__(self, parent, app)
|
||||
|
||||
self.scanTypeComboBox.currentIndexChanged[int].connect(self.scanTypeChanged)
|
||||
|
||||
def _setupPreferenceWidgets(self):
|
||||
self._setupScanTypeBox()
|
||||
self._setupFilterHardnessBox()
|
||||
self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
|
||||
self._setupAddCheckbox('matchScaledBox', tr("Match pictures of different dimensions"))
|
||||
@@ -37,20 +31,16 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
self._setupBottomPart()
|
||||
|
||||
def _load(self, prefs, setchecked):
|
||||
self._load_scan_type(prefs)
|
||||
setchecked(self.matchScaledBox, prefs.match_scaled)
|
||||
|
||||
# Update UI state based on selected scan type
|
||||
scan_type = prefs.scan_type
|
||||
fuzzy_scan = scan_type == ScanType.FuzzyBlock
|
||||
self.filterHardnessSlider.setEnabled(fuzzy_scan)
|
||||
|
||||
def _save(self, prefs, ischecked):
|
||||
self._save_scan_type(prefs)
|
||||
prefs.match_scaled = ischecked(self.matchScaledBox)
|
||||
|
||||
def resetToDefaults(self):
|
||||
self.load(preferences.Preferences())
|
||||
|
||||
#--- Events
|
||||
def scanTypeChanged(self, index):
|
||||
scan_options = self.app.model.scanner.get_scan_options()
|
||||
scan_type = scan_options[self.scanTypeComboBox.currentIndex()].scan_type
|
||||
fuzzy_scan = scan_type == ScanType.FuzzyBlock
|
||||
self.filterHardnessSlider.setEnabled(fuzzy_scan)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user