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
diff options
context:
space:
mode:
authorm32 <grzegorz.makarewicz@gmail.com>2022-01-06 00:14:38 +0300
committerm32 <grzegorz.makarewicz@gmail.com>2022-01-06 00:14:38 +0300
commit46c0e563df9ac2f341647471ca120f6d3698e8ee (patch)
treea8a5cc1ca6e54b69c3e8e25bb4528c99e9429f1c /python/configs/plug
parente0fe8d2fcfab9090a97200418731d0f77352a26b (diff)
implemented GetFiles = functional temporary panel on local filesystem
Diffstat (limited to 'python/configs/plug')
-rw-r--r--python/configs/plug/plugins/upanel.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/configs/plug/plugins/upanel.py b/python/configs/plug/plugins/upanel.py
index dfea78d7..8c79bbfe 100644
--- a/python/configs/plug/plugins/upanel.py
+++ b/python/configs/plug/plugins/upanel.py
@@ -67,10 +67,12 @@ class Plugin(PluginVFS):
def PutFile(self, PanelItem, Move, SrcPath, OpMode):
fqname = os.path.join(SrcPath, self.f2s(PanelItem.FindData.lpwszFileName))
+ # increase C array
items = self.ffi.new("struct PluginPanelItem []", len(self.Items)+1)
for i in range(len(self.Items)):
items[i] = self.Items[i]
self.Items = items
+ # append element
self.names.append(self.s2f(fqname))
i = len(self.Items)-1
items[i].FindData = PanelItem.FindData
@@ -87,15 +89,32 @@ class Plugin(PluginVFS):
found.append(i)
if len(found) == 0:
return 0
+ # new array
items = self.ffi.new("struct PluginPanelItem []", len(self.Items)-len(found))
j = 0
for i in range(len(self.Items)):
if i not in found:
items[j] = self.Items[i]
j += 1
+ # delete
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)
return 0
+
+ def GetFiles(self, PanelItem, ItemsNumber, Move, DestPath, OpMode):
+ if ItemsNumber == 0 or Move:
+ return 0
+ item = self.ffi.cast('struct PluginPanelItem *', PanelItem)
+ DestPath = self.ffi.cast("wchar_t **", DestPath)
+ dpath = self.ffi.string(DestPath[0])
+ for i in range(ItemsNumber):
+ sqname = self.f2s(item[i].FindData.lpwszFileName)
+ dqname = os.path.join(dpath, sqname.split('/')[-1])
+ #log.debug('GetFiles OpMode={} source={} destination={}'.format(OpMode, sqname, dqname))
+ # just copy file, local filesystem only
+ data = open(sqname, 'rb').read()
+ open(dqname, 'wb').write(data)
+ return 1