2016-05-29 01:54:25 +00:00
|
|
|
# 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
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2022-05-08 23:51:10 +00:00
|
|
|
from PyQt5.QtWidgets import QApplication, QDockWidget
|
2022-05-09 01:33:31 +00:00
|
|
|
from PyQt5.QtCore import Qt, QRect, QObject, pyqtSignal
|
2020-07-22 19:38:03 +00:00
|
|
|
from PyQt5.QtGui import QColor
|
2011-09-23 14:29:25 +00:00
|
|
|
|
2012-01-03 20:03:10 +00:00
|
|
|
from hscommon import trans
|
2022-05-09 01:33:31 +00:00
|
|
|
from hscommon.plat import ISLINUX
|
2016-05-30 02:37:38 +00:00
|
|
|
from core.app import AppMode
|
|
|
|
from core.scanner import ScanType
|
2022-05-08 23:51:10 +00:00
|
|
|
from hscommon.util import tryint
|
2022-05-09 01:33:31 +00:00
|
|
|
from qt.util import create_qsettings
|
2022-05-08 23:51:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_langnames():
|
2022-05-09 00:40:37 +00:00
|
|
|
tr = trans.trget("ui")
|
2022-05-08 23:51:10 +00:00
|
|
|
return {
|
|
|
|
"cs": tr("Czech"),
|
|
|
|
"de": tr("German"),
|
|
|
|
"el": tr("Greek"),
|
|
|
|
"en": tr("English"),
|
|
|
|
"es": tr("Spanish"),
|
|
|
|
"fr": tr("French"),
|
|
|
|
"hy": tr("Armenian"),
|
|
|
|
"it": tr("Italian"),
|
|
|
|
"ja": tr("Japanese"),
|
|
|
|
"ko": tr("Korean"),
|
|
|
|
"ms": tr("Malay"),
|
|
|
|
"nl": tr("Dutch"),
|
|
|
|
"pl_PL": tr("Polish"),
|
|
|
|
"pt_BR": tr("Brazilian"),
|
|
|
|
"ru": tr("Russian"),
|
|
|
|
"tr": tr("Turkish"),
|
|
|
|
"uk": tr("Ukrainian"),
|
|
|
|
"vi": tr("Vietnamese"),
|
|
|
|
"zh_CN": tr("Chinese (Simplified)"),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def _normalize_for_serialization(v):
|
|
|
|
# QSettings doesn't consider set/tuple as "native" typs for serialization, so if we don't
|
|
|
|
# change them into a list, we get a weird serialized QVariant value which isn't a very
|
|
|
|
# "portable" value.
|
|
|
|
if isinstance(v, (set, tuple)):
|
|
|
|
v = list(v)
|
|
|
|
if isinstance(v, list):
|
|
|
|
v = [_normalize_for_serialization(item) for item in v]
|
|
|
|
return v
|
|
|
|
|
|
|
|
|
|
|
|
def _adjust_after_deserialization(v):
|
|
|
|
# In some cases, when reading from prefs, we end up with strings that are supposed to be
|
|
|
|
# bool or int. Convert these.
|
|
|
|
if isinstance(v, list):
|
|
|
|
return [_adjust_after_deserialization(sub) for sub in v]
|
|
|
|
if isinstance(v, str):
|
|
|
|
# might be bool or int, try them
|
|
|
|
if v == "true":
|
|
|
|
return True
|
|
|
|
elif v == "false":
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
return tryint(v, v)
|
|
|
|
return v
|
|
|
|
|
|
|
|
|
|
|
|
class PreferencesBase(QObject):
|
|
|
|
prefsChanged = pyqtSignal()
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
QObject.__init__(self)
|
|
|
|
self.reset()
|
|
|
|
self._settings = create_qsettings()
|
|
|
|
|
|
|
|
def _load_values(self, settings):
|
|
|
|
# Implemented in subclasses
|
|
|
|
pass
|
|
|
|
|
|
|
|
def get_rect(self, name, default=None):
|
|
|
|
r = self.get_value(name, default)
|
|
|
|
if r is not None:
|
|
|
|
return QRect(*r)
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
|
|
|
|
def get_value(self, name, default=None):
|
|
|
|
if self._settings.contains(name):
|
|
|
|
result = _adjust_after_deserialization(self._settings.value(name))
|
|
|
|
if result is not None:
|
|
|
|
return result
|
|
|
|
else:
|
|
|
|
# If result is None, but still present in self._settings, it usually means a value
|
|
|
|
# like "@Invalid".
|
|
|
|
return default
|
|
|
|
else:
|
|
|
|
return default
|
|
|
|
|
|
|
|
def load(self):
|
|
|
|
self.reset()
|
|
|
|
self._load_values(self._settings)
|
|
|
|
|
|
|
|
def reset(self):
|
|
|
|
# Implemented in subclasses
|
|
|
|
pass
|
|
|
|
|
|
|
|
def _save_values(self, settings):
|
|
|
|
# Implemented in subclasses
|
|
|
|
pass
|
|
|
|
|
|
|
|
def save(self):
|
|
|
|
self._save_values(self._settings)
|
|
|
|
self._settings.sync()
|
|
|
|
|
|
|
|
def set_rect(self, name, r):
|
|
|
|
# About QRect conversion:
|
|
|
|
# I think Qt supports putting basic structures like QRect directly in QSettings, but I prefer not
|
|
|
|
# to rely on it and stay with generic structures.
|
|
|
|
if isinstance(r, QRect):
|
|
|
|
rect_as_list = [r.x(), r.y(), r.width(), r.height()]
|
|
|
|
self.set_value(name, rect_as_list)
|
|
|
|
|
|
|
|
def set_value(self, name, value):
|
|
|
|
self._settings.setValue(name, _normalize_for_serialization(value))
|
|
|
|
|
|
|
|
def saveGeometry(self, name, widget):
|
|
|
|
# We save geometry under a 7-sized int array: first item is a flag
|
|
|
|
# for whether the widget is maximized, second item is a flag for whether
|
|
|
|
# the widget is docked, third item is a Qt::DockWidgetArea enum value,
|
|
|
|
# and the other 4 are (x, y, w, h).
|
|
|
|
m = 1 if widget.isMaximized() else 0
|
|
|
|
d = 1 if isinstance(widget, QDockWidget) and not widget.isFloating() else 0
|
|
|
|
area = widget.parent.dockWidgetArea(widget) if d else 0
|
|
|
|
r = widget.geometry()
|
|
|
|
rect_as_list = [r.x(), r.y(), r.width(), r.height()]
|
|
|
|
self.set_value(name, [m, d, area] + rect_as_list)
|
|
|
|
|
|
|
|
def restoreGeometry(self, name, widget):
|
|
|
|
geometry = self.get_value(name)
|
|
|
|
if geometry and len(geometry) == 7:
|
|
|
|
m, d, area, x, y, w, h = geometry
|
|
|
|
if m:
|
|
|
|
widget.setWindowState(Qt.WindowMaximized)
|
|
|
|
else:
|
|
|
|
r = QRect(x, y, w, h)
|
|
|
|
widget.setGeometry(r)
|
|
|
|
if isinstance(widget, QDockWidget):
|
|
|
|
# Inform of the previous dock state and the area used
|
|
|
|
return bool(d), area
|
|
|
|
return False, 0
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
|
2010-01-13 14:25:15 +00:00
|
|
|
class Preferences(PreferencesBase):
|
2010-08-15 10:27:15 +00:00
|
|
|
def _load_values(self, settings):
|
|
|
|
get = self.get_value
|
2020-01-01 02:16:27 +00:00
|
|
|
self.filter_hardness = get("FilterHardness", self.filter_hardness)
|
|
|
|
self.mix_file_kind = get("MixFileKind", self.mix_file_kind)
|
2021-08-15 09:10:18 +00:00
|
|
|
self.ignore_hardlink_matches = get("IgnoreHardlinkMatches", self.ignore_hardlink_matches)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.use_regexp = get("UseRegexp", self.use_regexp)
|
|
|
|
self.remove_empty_folders = get("RemoveEmptyFolders", self.remove_empty_folders)
|
2023-01-06 05:01:16 +00:00
|
|
|
self.rehash_ignore_mtime = get("RehashIgnoreMTime", self.rehash_ignore_mtime)
|
|
|
|
self.include_exists_check = get("IncludeExistsCheck", self.include_exists_check)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.debug_mode = get("DebugMode", self.debug_mode)
|
2022-03-31 05:16:37 +00:00
|
|
|
self.profile_scan = get("ProfileScan", self.profile_scan)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.destination_type = get("DestinationType", self.destination_type)
|
|
|
|
self.custom_command = get("CustomCommand", self.custom_command)
|
|
|
|
self.language = get("Language", self.language)
|
2012-01-03 20:03:10 +00:00
|
|
|
if not self.language and trans.installed_lang:
|
|
|
|
self.language = trans.installed_lang
|
2021-08-18 02:04:09 +00:00
|
|
|
self.portable = get("Portable", False)
|
2022-01-25 01:14:30 +00:00
|
|
|
self.use_dark_style = get("UseDarkStyle", False)
|
2021-08-24 08:52:43 +00:00
|
|
|
self.use_native_dialogs = get("UseNativeDialogs", True)
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
self.tableFontSize = get("TableFontSize", self.tableFontSize)
|
2020-07-30 01:13:58 +00:00
|
|
|
self.reference_bold_font = get("ReferenceBoldFont", self.reference_bold_font)
|
2021-08-15 09:10:18 +00:00
|
|
|
self.details_dialog_titlebar_enabled = get("DetailsDialogTitleBarEnabled", self.details_dialog_titlebar_enabled)
|
|
|
|
self.details_dialog_vertical_titlebar = get(
|
|
|
|
"DetailsDialogVerticalTitleBar", self.details_dialog_vertical_titlebar
|
|
|
|
)
|
2020-07-21 01:52:15 +00:00
|
|
|
# On Windows and MacOS, use internal icons by default
|
2021-08-15 09:10:18 +00:00
|
|
|
self.details_dialog_override_theme_icons = (
|
|
|
|
get("DetailsDialogOverrideThemeIcons", self.details_dialog_override_theme_icons) if ISLINUX else True
|
|
|
|
)
|
|
|
|
self.details_table_delta_foreground_color = get(
|
|
|
|
"DetailsTableDeltaForegroundColor", self.details_table_delta_foreground_color
|
|
|
|
)
|
|
|
|
self.details_dialog_viewers_show_scrollbars = get(
|
|
|
|
"DetailsDialogViewersShowScrollbars", self.details_dialog_viewers_show_scrollbars
|
|
|
|
)
|
2020-07-22 19:38:03 +00:00
|
|
|
|
2021-08-15 09:10:18 +00:00
|
|
|
self.result_table_ref_foreground_color = get(
|
|
|
|
"ResultTableRefForegroundColor", self.result_table_ref_foreground_color
|
2020-01-01 02:16:27 +00:00
|
|
|
)
|
2021-08-15 09:10:18 +00:00
|
|
|
self.result_table_ref_background_color = get(
|
|
|
|
"ResultTableRefBackgroundColor", self.result_table_ref_background_color
|
2020-07-12 14:58:01 +00:00
|
|
|
)
|
2021-08-15 09:10:18 +00:00
|
|
|
self.result_table_delta_foreground_color = get(
|
|
|
|
"ResultTableDeltaForegroundColor", self.result_table_delta_foreground_color
|
2020-01-01 02:16:27 +00:00
|
|
|
)
|
2020-07-12 14:58:01 +00:00
|
|
|
|
2021-08-15 09:10:18 +00:00
|
|
|
self.resultWindowIsMaximized = get("ResultWindowIsMaximized", self.resultWindowIsMaximized)
|
|
|
|
self.resultWindowRect = self.get_rect("ResultWindowRect", self.resultWindowRect)
|
|
|
|
self.mainWindowIsMaximized = get("MainWindowIsMaximized", self.mainWindowIsMaximized)
|
|
|
|
self.mainWindowRect = self.get_rect("MainWindowRect", self.mainWindowRect)
|
|
|
|
self.directoriesWindowRect = self.get_rect("DirectoriesWindowRect", self.directoriesWindowRect)
|
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
self.recentResults = get("RecentResults", self.recentResults)
|
|
|
|
self.recentFolders = get("RecentFolders", self.recentFolders)
|
2020-07-30 23:32:29 +00:00
|
|
|
self.tabs_default_pos = get("TabsDefaultPosition", self.tabs_default_pos)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.word_weighting = get("WordWeighting", self.word_weighting)
|
|
|
|
self.match_similar = get("MatchSimilar", self.match_similar)
|
|
|
|
self.ignore_small_files = get("IgnoreSmallFiles", self.ignore_small_files)
|
|
|
|
self.small_file_threshold = get("SmallFileThreshold", self.small_file_threshold)
|
2021-08-27 10:35:54 +00:00
|
|
|
self.ignore_large_files = get("IgnoreLargeFiles", self.ignore_large_files)
|
|
|
|
self.large_file_threshold = get("LargeFileThreshold", self.large_file_threshold)
|
2021-06-21 17:03:21 +00:00
|
|
|
self.big_file_partial_hashes = get("BigFilePartialHashes", self.big_file_partial_hashes)
|
|
|
|
self.big_file_size_threshold = get("BigFileSizeThreshold", self.big_file_size_threshold)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.scan_tag_track = get("ScanTagTrack", self.scan_tag_track)
|
|
|
|
self.scan_tag_artist = get("ScanTagArtist", self.scan_tag_artist)
|
|
|
|
self.scan_tag_album = get("ScanTagAlbum", self.scan_tag_album)
|
|
|
|
self.scan_tag_title = get("ScanTagTitle", self.scan_tag_title)
|
|
|
|
self.scan_tag_genre = get("ScanTagGenre", self.scan_tag_genre)
|
|
|
|
self.scan_tag_year = get("ScanTagYear", self.scan_tag_year)
|
|
|
|
self.match_scaled = get("MatchScaled", self.match_scaled)
|
2024-02-19 15:19:33 +00:00
|
|
|
self.match_rotated = get("MatchRotated", self.match_rotated)
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
def reset(self):
|
|
|
|
self.filter_hardness = 95
|
|
|
|
self.mix_file_kind = True
|
|
|
|
self.use_regexp = False
|
2010-09-25 10:28:34 +00:00
|
|
|
self.ignore_hardlink_matches = False
|
2009-06-01 09:55:11 +00:00
|
|
|
self.remove_empty_folders = False
|
2023-01-06 05:01:16 +00:00
|
|
|
self.rehash_ignore_mtime = False
|
|
|
|
self.include_exists_check = True
|
2011-01-26 11:50:44 +00:00
|
|
|
self.debug_mode = False
|
2022-03-31 05:16:37 +00:00
|
|
|
self.profile_scan = False
|
2009-06-01 09:55:11 +00:00
|
|
|
self.destination_type = 1
|
2020-01-01 02:16:27 +00:00
|
|
|
self.custom_command = ""
|
|
|
|
self.language = trans.installed_lang if trans.installed_lang else ""
|
2022-01-25 01:14:30 +00:00
|
|
|
self.use_dark_style = False
|
2021-08-24 08:52:43 +00:00
|
|
|
self.use_native_dialogs = True
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2011-09-23 14:29:25 +00:00
|
|
|
self.tableFontSize = QApplication.font().pointSize()
|
2020-04-26 23:36:27 +00:00
|
|
|
self.reference_bold_font = True
|
2020-07-14 15:37:48 +00:00
|
|
|
self.details_dialog_titlebar_enabled = True
|
|
|
|
self.details_dialog_vertical_titlebar = True
|
2020-07-29 19:42:44 +00:00
|
|
|
self.details_table_delta_foreground_color = QColor(250, 20, 20) # red
|
2020-07-21 01:52:15 +00:00
|
|
|
# By default use internal icons on platforms other than Linux for now
|
|
|
|
self.details_dialog_override_theme_icons = False if not ISLINUX else True
|
2020-07-30 01:13:58 +00:00
|
|
|
self.details_dialog_viewers_show_scrollbars = True
|
2020-07-22 19:38:03 +00:00
|
|
|
self.result_table_ref_foreground_color = QColor(Qt.blue)
|
2021-05-21 23:52:41 +00:00
|
|
|
self.result_table_ref_background_color = QColor(Qt.lightGray)
|
2020-07-22 19:38:03 +00:00
|
|
|
self.result_table_delta_foreground_color = QColor(255, 142, 40) # orange
|
2011-01-15 15:29:35 +00:00
|
|
|
self.resultWindowIsMaximized = False
|
|
|
|
self.resultWindowRect = None
|
2010-08-15 10:27:15 +00:00
|
|
|
self.directoriesWindowRect = None
|
2020-07-12 14:58:01 +00:00
|
|
|
self.mainWindowRect = None
|
|
|
|
self.mainWindowIsMaximized = False
|
2011-01-13 15:20:03 +00:00
|
|
|
self.recentResults = []
|
2011-01-17 16:15:16 +00:00
|
|
|
self.recentFolders = []
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2020-07-31 14:59:34 +00:00
|
|
|
self.tabs_default_pos = True
|
2016-06-01 01:22:50 +00:00
|
|
|
self.word_weighting = True
|
|
|
|
self.match_similar = False
|
|
|
|
self.ignore_small_files = True
|
2020-01-01 02:16:27 +00:00
|
|
|
self.small_file_threshold = 10 # KB
|
2021-08-27 10:35:54 +00:00
|
|
|
self.ignore_large_files = False
|
|
|
|
self.large_file_threshold = 1000 # MB
|
2021-06-21 17:03:21 +00:00
|
|
|
self.big_file_partial_hashes = False
|
|
|
|
self.big_file_size_threshold = 100 # MB
|
2016-06-01 01:22:50 +00:00
|
|
|
self.scan_tag_track = False
|
|
|
|
self.scan_tag_artist = True
|
|
|
|
self.scan_tag_album = True
|
|
|
|
self.scan_tag_title = True
|
|
|
|
self.scan_tag_genre = False
|
|
|
|
self.scan_tag_year = False
|
|
|
|
self.match_scaled = False
|
2024-02-19 15:19:33 +00:00
|
|
|
self.match_rotated = False
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2010-08-15 10:27:15 +00:00
|
|
|
def _save_values(self, settings):
|
|
|
|
set_ = self.set_value
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("FilterHardness", self.filter_hardness)
|
|
|
|
set_("MixFileKind", self.mix_file_kind)
|
|
|
|
set_("IgnoreHardlinkMatches", self.ignore_hardlink_matches)
|
|
|
|
set_("UseRegexp", self.use_regexp)
|
|
|
|
set_("RemoveEmptyFolders", self.remove_empty_folders)
|
2023-01-06 05:01:16 +00:00
|
|
|
set_("RehashIgnoreMTime", self.rehash_ignore_mtime)
|
|
|
|
set_("IncludeExistsCheck", self.include_exists_check)
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("DebugMode", self.debug_mode)
|
2022-03-31 05:16:37 +00:00
|
|
|
set_("ProfileScan", self.profile_scan)
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("DestinationType", self.destination_type)
|
|
|
|
set_("CustomCommand", self.custom_command)
|
|
|
|
set_("Language", self.language)
|
2021-08-18 02:04:09 +00:00
|
|
|
set_("Portable", self.portable)
|
2022-01-25 01:14:30 +00:00
|
|
|
set_("UseDarkStyle", self.use_dark_style)
|
2021-08-24 08:52:43 +00:00
|
|
|
set_("UseNativeDialogs", self.use_native_dialogs)
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("TableFontSize", self.tableFontSize)
|
2020-07-30 01:13:58 +00:00
|
|
|
set_("ReferenceBoldFont", self.reference_bold_font)
|
|
|
|
set_("DetailsDialogTitleBarEnabled", self.details_dialog_titlebar_enabled)
|
|
|
|
set_("DetailsDialogVerticalTitleBar", self.details_dialog_vertical_titlebar)
|
|
|
|
set_("DetailsDialogOverrideThemeIcons", self.details_dialog_override_theme_icons)
|
|
|
|
set_("DetailsDialogViewersShowScrollbars", self.details_dialog_viewers_show_scrollbars)
|
|
|
|
set_("DetailsTableDeltaForegroundColor", self.details_table_delta_foreground_color)
|
|
|
|
set_("ResultTableRefForegroundColor", self.result_table_ref_foreground_color)
|
2020-08-12 19:37:29 +00:00
|
|
|
set_("ResultTableRefBackgroundColor", self.result_table_ref_background_color)
|
2020-07-30 01:13:58 +00:00
|
|
|
set_("ResultTableDeltaForegroundColor", self.result_table_delta_foreground_color)
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("ResultWindowIsMaximized", self.resultWindowIsMaximized)
|
2020-07-12 14:58:01 +00:00
|
|
|
set_("MainWindowIsMaximized", self.mainWindowIsMaximized)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.set_rect("ResultWindowRect", self.resultWindowRect)
|
2020-07-12 14:58:01 +00:00
|
|
|
self.set_rect("MainWindowRect", self.mainWindowRect)
|
2020-01-01 02:16:27 +00:00
|
|
|
self.set_rect("DirectoriesWindowRect", self.directoriesWindowRect)
|
|
|
|
set_("RecentResults", self.recentResults)
|
|
|
|
set_("RecentFolders", self.recentFolders)
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2020-07-30 23:32:29 +00:00
|
|
|
set_("TabsDefaultPosition", self.tabs_default_pos)
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("WordWeighting", self.word_weighting)
|
|
|
|
set_("MatchSimilar", self.match_similar)
|
|
|
|
set_("IgnoreSmallFiles", self.ignore_small_files)
|
|
|
|
set_("SmallFileThreshold", self.small_file_threshold)
|
2021-08-27 10:35:54 +00:00
|
|
|
set_("IgnoreLargeFiles", self.ignore_large_files)
|
|
|
|
set_("LargeFileThreshold", self.large_file_threshold)
|
2021-06-21 17:03:21 +00:00
|
|
|
set_("BigFilePartialHashes", self.big_file_partial_hashes)
|
|
|
|
set_("BigFileSizeThreshold", self.big_file_size_threshold)
|
2020-01-01 02:16:27 +00:00
|
|
|
set_("ScanTagTrack", self.scan_tag_track)
|
|
|
|
set_("ScanTagArtist", self.scan_tag_artist)
|
|
|
|
set_("ScanTagAlbum", self.scan_tag_album)
|
|
|
|
set_("ScanTagTitle", self.scan_tag_title)
|
|
|
|
set_("ScanTagGenre", self.scan_tag_genre)
|
|
|
|
set_("ScanTagYear", self.scan_tag_year)
|
|
|
|
set_("MatchScaled", self.match_scaled)
|
2024-02-19 15:19:33 +00:00
|
|
|
set_("MatchRotated", self.match_rotated)
|
2016-05-29 01:54:25 +00:00
|
|
|
|
|
|
|
# scan_type is special because we save it immediately when we set it.
|
2016-05-30 02:37:38 +00:00
|
|
|
def get_scan_type(self, app_mode):
|
2021-08-21 23:02:02 +00:00
|
|
|
if app_mode == AppMode.PICTURE:
|
|
|
|
return self.get_value("ScanTypePicture", ScanType.FUZZYBLOCK)
|
|
|
|
elif app_mode == AppMode.MUSIC:
|
|
|
|
return self.get_value("ScanTypeMusic", ScanType.TAG)
|
2016-05-30 02:37:38 +00:00
|
|
|
else:
|
2021-08-21 23:02:02 +00:00
|
|
|
return self.get_value("ScanTypeStandard", ScanType.CONTENTS)
|
2016-05-30 02:37:38 +00:00
|
|
|
|
|
|
|
def set_scan_type(self, app_mode, value):
|
2021-08-21 23:02:02 +00:00
|
|
|
if app_mode == AppMode.PICTURE:
|
2020-01-01 02:16:27 +00:00
|
|
|
self.set_value("ScanTypePicture", value)
|
2021-08-21 23:02:02 +00:00
|
|
|
elif app_mode == AppMode.MUSIC:
|
2020-01-01 02:16:27 +00:00
|
|
|
self.set_value("ScanTypeMusic", value)
|
2016-05-30 02:37:38 +00:00
|
|
|
else:
|
2020-01-01 02:16:27 +00:00
|
|
|
self.set_value("ScanTypeStandard", value)
|