2009-06-01 09:55:11 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2009-05-03
|
2010-01-01 20:11:34 +00:00
|
|
|
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
#
|
2010-09-30 10:17:41 +00:00
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2009-08-05 08:59:46 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-01-13 14:25:15 +00:00
|
|
|
from qtlib.preferences import Preferences as PreferencesBase
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-01-13 14:25:15 +00:00
|
|
|
class Preferences(PreferencesBase):
|
2009-06-01 09:55:11 +00:00
|
|
|
# (width, is_visible)
|
|
|
|
COLUMNS_DEFAULT_ATTRS = []
|
|
|
|
|
|
|
|
def __init__(self):
|
2010-01-13 14:25:15 +00:00
|
|
|
PreferencesBase.__init__(self)
|
2009-06-01 09:55:11 +00:00
|
|
|
self.reset_columns()
|
|
|
|
|
2010-08-15 10:27:15 +00:00
|
|
|
def _load_specific(self, settings):
|
2009-06-01 09:55:11 +00:00
|
|
|
# load prefs specific to the dg edition
|
|
|
|
pass
|
|
|
|
|
2010-08-15 10:27:15 +00:00
|
|
|
def _load_values(self, settings):
|
|
|
|
get = self.get_value
|
2009-06-01 09:55:11 +00:00
|
|
|
self.filter_hardness = get('FilterHardness', self.filter_hardness)
|
|
|
|
self.mix_file_kind = get('MixFileKind', self.mix_file_kind)
|
2010-09-25 10:28:34 +00:00
|
|
|
self.ignore_hardlink_matches = get('IgnoreHardlinkMatches', self.ignore_hardlink_matches)
|
2009-06-01 09:55:11 +00:00
|
|
|
self.use_regexp = get('UseRegexp', self.use_regexp)
|
|
|
|
self.remove_empty_folders = get('RemoveEmptyFolders', self.remove_empty_folders)
|
2011-01-26 11:50:44 +00:00
|
|
|
self.debug_mode = get('DebugMode', self.debug_mode)
|
2009-06-01 09:55:11 +00:00
|
|
|
self.destination_type = get('DestinationType', self.destination_type)
|
2010-04-13 08:02:09 +00:00
|
|
|
self.custom_command = get('CustomCommand', self.custom_command)
|
2011-01-21 12:57:54 +00:00
|
|
|
self.language = get('Language', self.language)
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
widths = get('ColumnsWidth', self.columns_width)
|
|
|
|
# only set nonzero values
|
|
|
|
for index, width in enumerate(widths[:len(self.columns_width)]):
|
|
|
|
if width > 0:
|
|
|
|
self.columns_width[index] = width
|
|
|
|
self.columns_visible = get('ColumnsVisible', self.columns_visible)
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2011-01-15 15:29:35 +00:00
|
|
|
self.resultWindowIsMaximized = get('ResultWindowIsMaximized', self.resultWindowIsMaximized)
|
|
|
|
self.resultWindowRect = self.get_rect('ResultWindowRect', self.resultWindowRect)
|
2010-08-15 10:27:15 +00:00
|
|
|
self.detailsWindowRect = self.get_rect('DetailsWindowRect', self.detailsWindowRect)
|
|
|
|
self.directoriesWindowRect = self.get_rect('DirectoriesWindowRect', self.directoriesWindowRect)
|
2011-01-13 15:20:03 +00:00
|
|
|
self.recentResults = get('RecentResults', self.recentResults)
|
2011-01-17 16:15:16 +00:00
|
|
|
self.recentFolders = get('RecentFolders', self.recentFolders)
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
self.registration_code = get('RegistrationCode', self.registration_code)
|
|
|
|
self.registration_email = get('RegistrationEmail', self.registration_email)
|
2010-08-15 10:27:15 +00:00
|
|
|
self._load_specific(settings)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def _reset_specific(self):
|
|
|
|
# reset prefs specific to the dg edition
|
|
|
|
pass
|
|
|
|
|
|
|
|
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
|
2011-01-26 11:50:44 +00:00
|
|
|
self.debug_mode = False
|
2009-06-01 09:55:11 +00:00
|
|
|
self.destination_type = 1
|
2010-04-13 08:02:09 +00:00
|
|
|
self.custom_command = ''
|
2011-01-21 12:57:54 +00:00
|
|
|
self.language = ''
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2011-01-15 15:29:35 +00:00
|
|
|
self.resultWindowIsMaximized = False
|
|
|
|
self.resultWindowRect = None
|
2010-08-15 10:27:15 +00:00
|
|
|
self.detailsWindowRect = None
|
|
|
|
self.directoriesWindowRect = None
|
2011-01-13 15:20:03 +00:00
|
|
|
self.recentResults = []
|
2011-01-17 16:15:16 +00:00
|
|
|
self.recentFolders = []
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
self.registration_code = ''
|
|
|
|
self.registration_email = ''
|
|
|
|
self._reset_specific()
|
|
|
|
|
|
|
|
def reset_columns(self):
|
|
|
|
self.columns_width = [width for width, _ in self.COLUMNS_DEFAULT_ATTRS]
|
|
|
|
self.columns_visible = [visible for _, visible in self.COLUMNS_DEFAULT_ATTRS]
|
|
|
|
|
2010-08-15 10:27:15 +00:00
|
|
|
def _save_specific(self, settings):
|
2009-06-01 09:55:11 +00:00
|
|
|
# save prefs specific to the dg edition
|
|
|
|
pass
|
|
|
|
|
2010-08-15 10:27:15 +00:00
|
|
|
def _save_values(self, settings):
|
|
|
|
set_ = self.set_value
|
2009-06-01 09:55:11 +00:00
|
|
|
set_('FilterHardness', self.filter_hardness)
|
|
|
|
set_('MixFileKind', self.mix_file_kind)
|
2010-09-25 10:28:34 +00:00
|
|
|
set_('IgnoreHardlinkMatches', self.ignore_hardlink_matches)
|
2009-06-01 09:55:11 +00:00
|
|
|
set_('UseRegexp', self.use_regexp)
|
|
|
|
set_('RemoveEmptyFolders', self.remove_empty_folders)
|
2011-01-26 11:50:44 +00:00
|
|
|
set_('DebugMode', self.debug_mode)
|
2009-06-01 09:55:11 +00:00
|
|
|
set_('DestinationType', self.destination_type)
|
2010-04-13 08:02:09 +00:00
|
|
|
set_('CustomCommand', self.custom_command)
|
2009-06-01 09:55:11 +00:00
|
|
|
set_('ColumnsWidth', self.columns_width)
|
|
|
|
set_('ColumnsVisible', self.columns_visible)
|
2011-01-21 12:57:54 +00:00
|
|
|
set_('Language', self.language)
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2011-01-15 15:29:35 +00:00
|
|
|
set_('ResultWindowIsMaximized', self.resultWindowIsMaximized)
|
|
|
|
self.set_rect('ResultWindowRect', self.resultWindowRect)
|
2010-08-15 10:27:15 +00:00
|
|
|
self.set_rect('DetailsWindowRect', self.detailsWindowRect)
|
|
|
|
self.set_rect('DirectoriesWindowRect', self.directoriesWindowRect)
|
2011-01-13 15:20:03 +00:00
|
|
|
set_('RecentResults', self.recentResults)
|
2011-01-17 16:15:16 +00:00
|
|
|
set_('RecentFolders', self.recentFolders)
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
set_('RegistrationCode', self.registration_code)
|
|
|
|
set_('RegistrationEmail', self.registration_email)
|
2010-08-15 10:27:15 +00:00
|
|
|
self._save_specific(settings)
|
2009-06-01 09:55:11 +00:00
|
|
|
|