Fix plugin installation from zip

This commit is contained in:
Philipp Hörist 2017-06-25 20:42:15 +02:00
parent b5d3578e39
commit 6a49e2d869
2 changed files with 6 additions and 6 deletions

View File

@ -281,7 +281,7 @@ class PluginsWindow(object):
for i, row in enumerate(model):
if plugin == row[Column.PLUGIN]:
model.remove(model.get_iter((i, Column.PLUGIN)))
model.remove(row.iter)
break
iter_ = model.append([plugin, plugin.name, False,
@ -308,7 +308,7 @@ class PluginsWindow(object):
return
model = self.installed_plugins_model
iter_ = model.append([plugin, plugin.name, False,
plugin.activatable], self.get_plugin_icon(plugin))
plugin.activatable, self.get_plugin_icon(plugin)])
sel = self.installed_plugins_treeview.get_selection()
sel.select_iter(iter_)

View File

@ -573,7 +573,7 @@ class PluginManager(metaclass=Singleton):
def install_from_zip(self, zip_filename, owerwrite=None):
'''
Install plagin from zip and return plugin
Install plugin from zip and return plugin
'''
try:
zip_file = zipfile.ZipFile(zip_filename)
@ -595,7 +595,7 @@ class PluginManager(metaclass=Singleton):
# members not safe
raise PluginsystemError(_('Archive is malformed'))
if filename.endswith('/') and filename.find('/', 0, -1) < 0:
dirs.append(filename)
dirs.append(filename.strip('/'))
if 'manifest.ini' in filename.split('/')[1]:
manifest = True
if not manifest:
@ -614,8 +614,8 @@ class PluginManager(metaclass=Singleton):
zip_file.extractall(user_dir)
zip_file.close()
path = os.path.join(user_dir, dirs[0])
plugins = self.scan_dir_for_plugins(plugin_dir, False)
plugins = self.scan_dir_for_plugins(plugin_dir, package=True)
if not plugins:
return
self.add_plugin(plugins[0])