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

Add UI preference to picture cache type under Qt

This commit is contained in:
Virgil Dupras
2016-11-22 02:41:43 +00:00
parent e4b6e12d4c
commit 76cc2000ab
4 changed files with 19 additions and 2 deletions

View File

@@ -4,7 +4,9 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtWidgets import QLabel
from hscommon.trans import trget
from qtlib.radio_box import RadioBox
from core.scanner import ScanType
from core.app import AppMode
@@ -28,10 +30,14 @@ class PreferencesDialog(PreferencesDialogBase):
self.widgetsVLayout.addWidget(self.ignoreHardlinkMatches)
self._setupAddCheckbox('debugModeBox', tr("Debug mode (restart required)"))
self.widgetsVLayout.addWidget(self.debugModeBox)
self.widgetsVLayout.addWidget(QLabel(tr("Picture cache mode:")))
self.cacheTypeRadio = RadioBox(self, items=["Sqlite", "Shelve"], spread=False)
self.widgetsVLayout.addWidget(self.cacheTypeRadio)
self._setupBottomPart()
def _load(self, prefs, setchecked):
setchecked(self.matchScaledBox, prefs.match_scaled)
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)
@@ -40,4 +46,5 @@ class PreferencesDialog(PreferencesDialogBase):
def _save(self, prefs, ischecked):
prefs.match_scaled = ischecked(self.matchScaledBox)
prefs.picture_cache_type = 'shelve' if self.cacheTypeRadio.selected_index == 1 else 'sqlite'