Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorm32 <mak@trisoft.com.pl>2020-07-17 03:51:02 +0300
committerm32 <mak@trisoft.com.pl>2020-07-17 03:51:02 +0300
commit6b0d57a0d09588180ef16c227674315493911120 (patch)
tree0a5c2e5ab659327c864086cdc16e02765e036501 /python
parent5235654ef6ca137c91e9e5cd9c020d99f3d333c3 (diff)
remove multiple files at once
Diffstat (limited to 'python')
-rw-r--r--python/configs/plug/far2l/upanel.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/python/configs/plug/far2l/upanel.py b/python/configs/plug/far2l/upanel.py
index 98333528..f789da13 100644
--- a/python/configs/plug/far2l/upanel.py
+++ b/python/configs/plug/far2l/upanel.py
@@ -74,21 +74,23 @@ class Plugin(PluginVFS):
def DeleteFiles(self, PanelItem, ItemsNumber, OpMode):
item = self.ffi.cast('struct PluginPanelItem *', PanelItem)
- sname = self.f2s(item.FindData.lpwszFileName)
- found = None
+ snames = []
+ for i in range(ItemsNumber):
+ snames.append(self.f2s(item[i].FindData.lpwszFileName))
+ found = []
for i in range(len(self.names)):
- if self.f2s(self.names[i]) == sname:
- found = i
- if found is None:
+ if self.f2s(self.names[i]) in snames:
+ found.append(i)
+ if len(found) == 0:
return 0
- items = self.ffi.new("struct PluginPanelItem []", len(self.Items)-1)
+ items = self.ffi.new("struct PluginPanelItem []", len(self.Items)-len(found))
j = 0
for i in range(len(self.Items)):
- if i != found:
+ if i not in found:
items[j] = self.Items[i]
j += 1
- else:
- del self.names[i]
+ for i in sorted(found, reverse=True):
+ del self.names[i]
self.Items = items
self.info.Control(self.hplugin, self.ffic.FCTL_UPDATEPANEL, 0, 0)
self.info.Control(self.hplugin, self.ffic.FCTL_REDRAWPANEL, 0, 0)