mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
dgse cocoa: fixed quirks created by the hsfs move.
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40203
This commit is contained in:
parent
cf44c93013
commit
4d7f032889
@ -242,8 +242,11 @@ class DupeGuru(app.DupeGuru):
|
|||||||
return [len(g.dupes) for g in self.results.groups]
|
return [len(g.dupes) for g in self.results.groups]
|
||||||
elif tag == 1: #Directories
|
elif tag == 1: #Directories
|
||||||
try:
|
try:
|
||||||
|
if node_path:
|
||||||
path = self.get_folder_path(node_path)
|
path = self.get_folder_path(node_path)
|
||||||
subfolders = self.directories.get_subfolders(path)
|
subfolders = self.directories.get_subfolders(path)
|
||||||
|
else:
|
||||||
|
subfolders = self.directories
|
||||||
return [len(self.directories.get_subfolders(path)) for path in subfolders]
|
return [len(self.directories.get_subfolders(path)) for path in subfolders]
|
||||||
except IndexError: # node_path out of range
|
except IndexError: # node_path out of range
|
||||||
return []
|
return []
|
||||||
@ -269,7 +272,8 @@ class DupeGuru(app.DupeGuru):
|
|||||||
elif tag == 1: #Directories
|
elif tag == 1: #Directories
|
||||||
try:
|
try:
|
||||||
path = self.get_folder_path(node_path)
|
path = self.get_folder_path(node_path)
|
||||||
return [path[-1], self.directories.get_state(path)]
|
name = unicode(path) if len(node_path) == 1 else path[-1]
|
||||||
|
return [name, self.directories.get_state(path)]
|
||||||
except IndexError: # node_path out of range
|
except IndexError: # node_path out of range
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -62,13 +62,17 @@ class Directories(object):
|
|||||||
if not any(p[:len(from_path)] == from_path for p in self.states):
|
if not any(p[:len(from_path)] == from_path for p in self.states):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
subdir_paths = [from_path + name for name in io.listdir(from_path) if io.isdir(from_path + name)]
|
filepaths = set()
|
||||||
for subdir_path in subdir_paths:
|
|
||||||
for file in self._get_files(subdir_path):
|
|
||||||
yield file
|
|
||||||
if state != STATE_EXCLUDED:
|
if state != STATE_EXCLUDED:
|
||||||
for file in fs.get_files(from_path, fileclasses=self.fileclasses):
|
for file in fs.get_files(from_path, fileclasses=self.fileclasses):
|
||||||
file.is_ref = state == STATE_REFERENCE
|
file.is_ref = state == STATE_REFERENCE
|
||||||
|
filepaths.add(file.path)
|
||||||
|
yield file
|
||||||
|
subpaths = [from_path + name for name in io.listdir(from_path)]
|
||||||
|
# it's possible that a folder (bundle) gets into the file list. in that case, we don't want to recurse into it
|
||||||
|
subfolders = [p for p in subpaths if not io.islink(p) and io.isdir(p) and p not in filepaths]
|
||||||
|
for subfolder in subfolders:
|
||||||
|
for file in self._get_files(subfolder):
|
||||||
yield file
|
yield file
|
||||||
except (EnvironmentError, fs.InvalidPath):
|
except (EnvironmentError, fs.InvalidPath):
|
||||||
pass
|
pass
|
||||||
|
@ -174,6 +174,10 @@ def get_files(path, fileclasses=[File]):
|
|||||||
raise InvalidPath(path)
|
raise InvalidPath(path)
|
||||||
|
|
||||||
def get_all_files(path, fileclasses=[File]):
|
def get_all_files(path, fileclasses=[File]):
|
||||||
subfolders = [path + name for name in io.listdir(path) if not io.islink(path + name) and io.isdir(path + name)]
|
files = get_files(path, fileclasses=fileclasses)
|
||||||
|
filepaths = set(f.path for f in files)
|
||||||
|
subpaths = [path + name for name in io.listdir(path)]
|
||||||
|
# it's possible that a folder (bundle) gets into the file list. in that case, we don't want to recurse into it
|
||||||
|
subfolders = [p for p in subpaths if not io.islink(p) and io.isdir(p) and p not in filepaths]
|
||||||
subfiles = flatten(get_all_files(subpath, fileclasses=fileclasses) for subpath in subfolders)
|
subfiles = flatten(get_all_files(subpath, fileclasses=fileclasses) for subpath in subfolders)
|
||||||
return subfiles + get_files(path, fileclasses=fileclasses)
|
return subfiles + files
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
import objc
|
import objc
|
||||||
from AppKit import *
|
from AppKit import *
|
||||||
|
|
||||||
from dupeguru import app_se_cocoa, scanner
|
from dupeguru_se.app_cocoa import DupeGuru
|
||||||
|
from dupeguru import scanner
|
||||||
|
|
||||||
# Fix py2app imports with chokes on relative imports
|
# Fix py2app imports with chokes on relative imports
|
||||||
from dupeguru import app, app_cocoa, data, directories, engine, export, ignore, results, scanner
|
from dupeguru_se import fs, data
|
||||||
from hsfs import auto, stats, tree
|
from dupeguru import app, app_cocoa, data, directories, engine, export, ignore, results, fs
|
||||||
from hsfs.phys import bundle
|
|
||||||
from hsutil import conflict
|
from hsutil import conflict
|
||||||
|
|
||||||
class PyApp(NSObject):
|
class PyApp(NSObject):
|
||||||
@ -22,7 +22,7 @@ class PyApp(NSObject):
|
|||||||
class PyDupeGuru(PyApp):
|
class PyDupeGuru(PyApp):
|
||||||
def init(self):
|
def init(self):
|
||||||
self = super(PyDupeGuru,self).init()
|
self = super(PyDupeGuru,self).init()
|
||||||
self.app = app_se_cocoa.DupeGuru()
|
self.app = DupeGuru()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
#---Directories
|
#---Directories
|
||||||
|
@ -19,6 +19,7 @@ from dupeguru import fs
|
|||||||
from dupeguru.app_cocoa import DupeGuru as DupeGuruBase
|
from dupeguru.app_cocoa import DupeGuru as DupeGuruBase
|
||||||
from dupeguru.directories import Directories as DirectoriesBase, STATE_EXCLUDED
|
from dupeguru.directories import Directories as DirectoriesBase, STATE_EXCLUDED
|
||||||
from . import data
|
from . import data
|
||||||
|
from .fs import Bundle as BundleBase
|
||||||
|
|
||||||
if NSWorkspace.sharedWorkspace().respondsToSelector_('typeOfFile:error:'): # Only from 10.5
|
if NSWorkspace.sharedWorkspace().respondsToSelector_('typeOfFile:error:'): # Only from 10.5
|
||||||
def is_bundle(str_path):
|
def is_bundle(str_path):
|
||||||
@ -55,6 +56,6 @@ class Directories(DirectoriesBase):
|
|||||||
|
|
||||||
class DupeGuru(DupeGuruBase):
|
class DupeGuru(DupeGuruBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
app_cocoa.DupeGuru.__init__(self, data, 'dupeGuru', appid=4)
|
DupeGuruBase.__init__(self, data, 'dupeGuru', appid=4)
|
||||||
self.directories = Directories()
|
self.directories = Directories()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user