mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 22:51:39 +00:00
[#194 state:fixed] Added the "Replace with symlink" deletion option.
This commit is contained in:
@@ -151,12 +151,12 @@ class DupeGuruME(DupeGuruBase):
|
||||
self.directories = Directories(fileclasses=self.directories.fileclasses)
|
||||
self.dead_tracks = []
|
||||
|
||||
def _do_delete(self, j, replace_with_hardlinks, direct_deletion):
|
||||
def _do_delete(self, j, *args):
|
||||
# XXX If I read correctly, Python 3.3 will allow us to go fetch inner function easily, so
|
||||
# we'll be able to replace "op" below with DupeGuruBase._do_delete.op.
|
||||
def op(dupe):
|
||||
j.add_progress()
|
||||
return self._do_delete_dupe(dupe, replace_with_hardlinks, direct_deletion)
|
||||
return self._do_delete_dupe(dupe, *args)
|
||||
|
||||
marked = [dupe for dupe in self.results.dupes if self.results.is_marked(dupe)]
|
||||
j.start_job(self.results.mark_count, tr("Sending dupes to the Trash"))
|
||||
@@ -169,10 +169,10 @@ class DupeGuruME(DupeGuruBase):
|
||||
pass
|
||||
self.results.perform_on_marked(op, True)
|
||||
|
||||
def _do_delete_dupe(self, dupe, replace_with_hardlinks, direct_deletion):
|
||||
def _do_delete_dupe(self, dupe, *args):
|
||||
if isinstance(dupe, ITunesSong):
|
||||
dupe.remove_from_library()
|
||||
DupeGuruBase._do_delete_dupe(self, dupe, replace_with_hardlinks, direct_deletion)
|
||||
DupeGuruBase._do_delete_dupe(self, dupe, *args)
|
||||
|
||||
def _create_file(self, path):
|
||||
if (self.directories.itunes_libpath is not None) and (path in self.directories.itunes_libpath[:-1]):
|
||||
|
||||
@@ -176,10 +176,10 @@ class DupeGuruPE(DupeGuruBase):
|
||||
DupeGuruBase.__init__(self, view, appdata)
|
||||
self.directories = Directories()
|
||||
|
||||
def _do_delete(self, j, replace_with_hardlinks, direct_deletion):
|
||||
def _do_delete(self, j, *args):
|
||||
def op(dupe):
|
||||
j.add_progress()
|
||||
return self._do_delete_dupe(dupe, replace_with_hardlinks, direct_deletion)
|
||||
return self._do_delete_dupe(dupe, *args)
|
||||
|
||||
self.deleted_aperture_photos = False
|
||||
marked = [dupe for dupe in self.results.dupes if self.results.is_marked(dupe)]
|
||||
@@ -202,7 +202,7 @@ class DupeGuruPE(DupeGuruBase):
|
||||
pass
|
||||
self.results.perform_on_marked(op, True)
|
||||
|
||||
def _do_delete_dupe(self, dupe, replace_with_hardlinks, direct_deletion):
|
||||
def _do_delete_dupe(self, dupe, *args):
|
||||
if isinstance(dupe, IPhoto):
|
||||
try:
|
||||
a = app('iPhoto')
|
||||
@@ -244,7 +244,7 @@ class DupeGuruPE(DupeGuruBase):
|
||||
except (CommandError, RuntimeError) as e:
|
||||
raise EnvironmentError(str(e))
|
||||
else:
|
||||
DupeGuruBase._do_delete_dupe(self, dupe, replace_with_hardlinks, direct_deletion)
|
||||
DupeGuruBase._do_delete_dupe(self, dupe, *args)
|
||||
|
||||
def _create_file(self, path):
|
||||
if (self.directories.iphoto_libpath is not None) and (path in self.directories.iphoto_libpath[:-1]):
|
||||
|
||||
@@ -13,8 +13,11 @@ class DeletionOptionsView(GUIObjectView):
|
||||
def show(self) -> bool: pass
|
||||
|
||||
class PyDeletionOptions(PyGUIObject):
|
||||
def setHardlink_(self, hardlink: bool):
|
||||
self.model.hardlink = hardlink
|
||||
def setLinkDeleted_(self, link_deleted: bool):
|
||||
self.model.link_deleted = link_deleted
|
||||
|
||||
def setUseHardlinks_(self, use_hardlinks: bool):
|
||||
self.model.use_hardlinks = use_hardlinks
|
||||
|
||||
def setDirect_(self, direct: bool):
|
||||
self.model.direct = direct
|
||||
|
||||
Reference in New Issue
Block a user