2009-06-01 09:55:11 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2009-05-24
|
2011-04-12 08:04:01 +00:00
|
|
|
# Copyright 2011 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
|
|
|
|
2011-09-20 22:40:27 +00:00
|
|
|
from core_se import __appname__
|
|
|
|
from core_se.app import DupeGuru as DupeGuruModel
|
2011-04-12 11:22:29 +00:00
|
|
|
from core.directories import Directories as DirectoriesBase, DirectoryState
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
from ..base.app import DupeGuru as DupeGuruBase
|
|
|
|
from .details_dialog import DetailsDialog
|
|
|
|
from .preferences import Preferences
|
|
|
|
from .preferences_dialog import PreferencesDialog
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2009-06-10 09:46:24 +00:00
|
|
|
class Directories(DirectoriesBase):
|
|
|
|
ROOT_PATH_TO_EXCLUDE = frozenset(['windows', 'program files'])
|
|
|
|
def _default_state_for_path(self, path):
|
|
|
|
result = DirectoriesBase._default_state_for_path(self, path)
|
|
|
|
if result is not None:
|
|
|
|
return result
|
|
|
|
if len(path) == 2 and path[1].lower() in self.ROOT_PATH_TO_EXCLUDE:
|
2011-04-12 11:22:29 +00:00
|
|
|
return DirectoryState.Excluded
|
2009-06-10 09:46:24 +00:00
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
class DupeGuru(DupeGuruBase):
|
2011-09-20 22:40:27 +00:00
|
|
|
MODELCLASS = DupeGuruModel
|
2010-04-07 16:04:58 +00:00
|
|
|
EDITION = 'se'
|
2009-06-01 09:55:11 +00:00
|
|
|
LOGO_NAME = 'logo_se'
|
2011-01-21 12:57:54 +00:00
|
|
|
NAME = __appname__
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2009-06-10 09:46:24 +00:00
|
|
|
def _setup(self):
|
|
|
|
self.directories = Directories()
|
|
|
|
DupeGuruBase._setup(self)
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
def _update_options(self):
|
|
|
|
DupeGuruBase._update_options(self)
|
2011-09-20 19:06:29 +00:00
|
|
|
self.model.scanner.min_match_percentage = self.prefs.filter_hardness
|
|
|
|
self.model.scanner.scan_type = self.prefs.scan_type
|
|
|
|
self.model.scanner.word_weighting = self.prefs.word_weighting
|
|
|
|
self.model.scanner.match_similar_words = self.prefs.match_similar
|
2009-06-01 09:55:11 +00:00
|
|
|
threshold = self.prefs.small_file_threshold if self.prefs.ignore_small_files else 0
|
2011-09-20 19:06:29 +00:00
|
|
|
self.model.scanner.size_threshold = threshold * 1024 # threshold is in KB. the scanner wants bytes
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def _create_details_dialog(self, parent):
|
|
|
|
return DetailsDialog(parent, self)
|
|
|
|
|
|
|
|
def _create_preferences(self):
|
|
|
|
return Preferences()
|
|
|
|
|
|
|
|
def _create_preferences_dialog(self, parent):
|
|
|
|
return PreferencesDialog(parent, self)
|
|
|
|
|