mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
support zipped plugins
This commit is contained in:
parent
02d2f67f6c
commit
d8772cca3f
1 changed files with 15 additions and 12 deletions
|
@ -200,24 +200,27 @@ class GetShared(QDialog):
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
open(os.path.join(dd, tit + ".media",
|
open(os.path.join(dd, tit + ".media",
|
||||||
os.path.basename(l)),"w").write(z.read(l))
|
os.path.basename(l)),"wb").write(z.read(l))
|
||||||
self.parent.loadDeck(dpath)
|
self.parent.loadDeck(dpath)
|
||||||
self.ok = True
|
self.ok = True
|
||||||
else:
|
else:
|
||||||
pd = self.parent.pluginsFolder()
|
pd = self.parent.pluginsFolder()
|
||||||
if z:
|
if z:
|
||||||
raise "nyi"
|
for l in z.infolist():
|
||||||
# for l in z.namelist():
|
if not l.file_size:
|
||||||
# try:
|
continue
|
||||||
# os.mkdir(os.path.join(pd, os.path.dirname(l)))
|
try:
|
||||||
# except OSError:
|
os.makedirs(os.path.join(
|
||||||
# pass
|
pd, os.path.dirname(l.filename)))
|
||||||
# open(os.path.join(pd, 2))
|
except OSError:
|
||||||
|
pass
|
||||||
|
open(os.path.join(pd, l.filename), "wb").\
|
||||||
|
write(z.read(l.filename))
|
||||||
else:
|
else:
|
||||||
open(os.path.join(pd, tit + ext), "wb").write(data)
|
open(os.path.join(pd, tit + ext), "wb").write(data)
|
||||||
|
self.ok = True
|
||||||
showInfo(_("Plugin downloaded. Please restart Anki."),
|
showInfo(_("Plugin downloaded. Please restart Anki."),
|
||||||
parent=self)
|
parent=self)
|
||||||
self.ok = True
|
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
|
|
Loading…
Reference in a new issue