mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Removed logic duplication across toolkit code in "Open Selected" action.
This commit is contained in:
@@ -103,6 +103,10 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
path = Path(str_path)
|
||||
return fs.get_file(path, self.directories.fileclasses)
|
||||
|
||||
@staticmethod
|
||||
def _open_path(path):
|
||||
raise NotImplementedError()
|
||||
|
||||
@staticmethod
|
||||
def _recycle_dupe(dupe):
|
||||
raise NotImplementedError()
|
||||
@@ -224,6 +228,10 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
self.results.make_ref(dupe)
|
||||
changed_groups.add(g)
|
||||
|
||||
def open_selected(self):
|
||||
if self.selected_dupes:
|
||||
self._open_path(self.selected_dupes[0].path)
|
||||
|
||||
def remove_duplicates(self, duplicates):
|
||||
self.results.remove_duplicates(duplicates)
|
||||
|
||||
|
||||
@@ -49,6 +49,10 @@ class DupeGuru(app.DupeGuru):
|
||||
self.display_delta_values = False
|
||||
|
||||
#--- Override
|
||||
@staticmethod
|
||||
def _open_path(path):
|
||||
NSWorkspace.sharedWorkspace().openFile_(unicode(path))
|
||||
|
||||
@staticmethod
|
||||
def _recycle_dupe(dupe):
|
||||
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||
@@ -93,12 +97,6 @@ class DupeGuru(app.DupeGuru):
|
||||
copy_or_move_marked = demo_method(app.DupeGuru.copy_or_move_marked)
|
||||
delete_marked = demo_method(app.DupeGuru.delete_marked)
|
||||
|
||||
def OpenSelected(self):
|
||||
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||
if self.selected_dupes:
|
||||
path = unicode(self.selected_dupes[0].path)
|
||||
NSWorkspace.sharedWorkspace().openFile_(path)
|
||||
|
||||
def PurgeIgnoreList(self):
|
||||
self.scanner.ignore_list.Filter(lambda f,s:op.exists(f) and op.exists(s))
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class PyDupeGuruBase(PyApp):
|
||||
self.app.copy_or_move_marked(copy, destination, recreate_path)
|
||||
|
||||
def openSelected(self):
|
||||
self.app.OpenSelected()
|
||||
self.app.open_selected()
|
||||
|
||||
def removeMarked(self):
|
||||
self.app.results.perform_on_marked(lambda x:True, True)
|
||||
|
||||
Reference in New Issue
Block a user