mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
[#179 state:fixed] Added multiple-selection to the folder selection dialog and thus added the ability to remove multiple folders at once.
This commit is contained in:
@@ -77,15 +77,20 @@ class DirectoryTree(GUIObject, Tree):
|
||||
self.app.add_directory(path)
|
||||
|
||||
def remove_selected(self):
|
||||
selected_node = self.selected_node
|
||||
if selected_node is None:
|
||||
selected_paths = self.selected_paths
|
||||
if not selected_paths:
|
||||
return
|
||||
if selected_node.parent is self and selected_node.state != DirectoryState.Excluded:
|
||||
root_index = self.selected_path[0]
|
||||
self.app.remove_directory(root_index)
|
||||
to_delete = [path[0] for path in selected_paths if len(path) == 1]
|
||||
if to_delete:
|
||||
self.app.remove_directories(to_delete)
|
||||
else:
|
||||
newstate = DirectoryState.Normal if selected_node.state == DirectoryState.Excluded else DirectoryState.Excluded
|
||||
selected_node.state = newstate
|
||||
# All selected nodes or on second-or-more level, exclude them.
|
||||
nodes = self.selected_nodes
|
||||
newstate = DirectoryState.Excluded
|
||||
if all(node.state == DirectoryState.Excluded for node in nodes):
|
||||
newstate = DirectoryState.Normal
|
||||
for node in nodes:
|
||||
node.state = newstate
|
||||
|
||||
def update_all_states(self):
|
||||
for node in self:
|
||||
|
||||
Reference in New Issue
Block a user