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

Removed the "all files are refs" error message and made the "no files, can't scan" message quicker. That's because when scanning iPhoto libraries with big libraries, the GUI would hang because these checks would involve loading the whole library.

This commit is contained in:
Virgil Dupras
2010-08-15 15:07:44 +02:00
parent c8827769b4
commit 36eccb7122
8 changed files with 18 additions and 20 deletions

View File

@@ -33,9 +33,6 @@ JOB_DELETE = 'job_delete'
class NoScannableFileError(Exception):
pass
class AllFilesAreRefError(Exception):
pass
class DupeGuru(RegistrableApplication, Broadcaster):
DEMO_LIMIT_DESC = "In the demo version, only 10 duplicates per session can be sent to the recycle bin, moved or copied."
@@ -347,12 +344,8 @@ class DupeGuru(RegistrableApplication, Broadcaster):
logging.info('Scanning %d files' % len(files))
self.results.groups = self.scanner.GetDupeGroups(files, j)
files = self.directories.get_files()
first_file = first(files)
if first_file is None:
if not self.directories.has_any_file():
raise NoScannableFileError()
if first_file.is_ref and all(f.is_ref for f in files):
raise AllFilesAreRefError()
self.results.groups = []
self._start_job(JOB_SCAN, do)

View File

@@ -76,6 +76,4 @@ class DupeGuru(app.DupeGuru):
return 0
except app.NoScannableFileError:
return 3
except app.AllFilesAreRefError:
return 1

View File

@@ -124,6 +124,13 @@ class Directories(object):
else:
return STATE_NORMAL
def has_any_file(self):
try:
next(self.get_files())
return True
except StopIteration:
return False
def load_from_file(self, infile):
try:
root = ET.parse(infile).getroot()