changeset 3c8e529eba17 in /home/hg/repos/gajim-plugins
author: Yann Leboulanger asterix@lagaule.org branches: details:gajim-plugins?cmd=changeset;node=3c8e529eba17 description: fix loading zip file under windows, ignore packs that can't be loaded. Fixes #114
diffstat:
emoticons_pack/emoticons_pack.py | 27 +++++++++++++++------------ emoticons_pack/manifest.ini | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-)
diffs (55 lines):
diff -r 3fb7dec776d0 -r 3c8e529eba17 emoticons_pack/emoticons_pack.py --- a/emoticons_pack/emoticons_pack.py Thu Oct 08 15:54:46 2015 +0200 +++ b/emoticons_pack/emoticons_pack.py Sat Oct 10 14:32:24 2015 +0200 @@ -282,24 +282,27 @@ conf.readfp(_file) for section in conf.sections(): # get icon - filename = conf.get(section, 'icon') - filename = os.path.join(section, filename) - zip_file = os.path.join(self.__path__, 'emoticons_pack.zip') - with zipfile.ZipFile(zip_file, 'r') as myzip: - icon_file = myzip.open(filename, mode='r') - data = icon_file.read() - pbl = gtk.gdk.PixbufLoader() - pbl.set_size(16, 16) - pbl.write(data) - pbl.close() - icon = pbl.get_pixbuf() + try: + filename = conf.get(section, 'icon') + filename = section + '/' + filename + zip_file = os.path.join(self.__path__, 'emoticons_pack.zip') + with zipfile.ZipFile(zip_file, 'r') as myzip: + icon_file = myzip.open(filename, mode='r') + data = icon_file.read() + pbl = gtk.gdk.PixbufLoader() + pbl.set_size(16, 16) + pbl.write(data) + pbl.close() + icon = pbl.get_pixbuf() + except Exception: + continue
authors = _('Unknown') converter = _('Unknown') if conf.has_option(section, 'authors'): authors = conf.get(section, 'authors') if conf.has_option(section, 'converter'): - authors = conf.get(section, 'converter') + converter = conf.get(section, 'converter')
self.model.append( [icon, section, diff -r 3fb7dec776d0 -r 3c8e529eba17 emoticons_pack/manifest.ini --- a/emoticons_pack/manifest.ini Thu Oct 08 15:54:46 2015 +0200 +++ b/emoticons_pack/manifest.ini Sat Oct 10 14:32:24 2015 +0200 @@ -1,7 +1,7 @@ [info] name: Emoticons pack short_name: emoticons_pack -version: 0.0.7 +version: 0.1 description: Install, update and view detailed legend of emoticons authors: Denis Fomin fominde@gmail.com homepage: http://trac-plugins.gajim.org/wiki/