Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gajim/gajim-plugins
  • lovetox/gajim-plugins
  • ag/gajim-plugins
  • FlorianMuenchbach/gajim-plugins
  • rom1dep/gajim-plugins
  • pitchum/gajim-plugins
  • wurstsalat/gajim-plugins
  • Dicson/gajim-plugins
  • andre/gajim-plugins
  • link2xt/gajim-plugins
  • marmistrz/gajim-plugins
  • Jens/gajim-plugins
  • muelli/gajim-plugins
  • asterix/gajim-plugins
  • orhideous/gajim-plugins
  • ngvelprz/gajim-plugins
  • appleorange1/gajim-plugins
  • Martin/gajim-plugins
  • maltel/gajim-plugins
  • Seve/gajim-plugins
  • evert-mouw/gajim-plugins
  • Yuki/gajim-plugins
  • mxre/gajim-plugins
  • ValdikSS/gajim-plugins
  • SaltyBones/gajim-plugins
  • comradekingu/gajim-plugins
  • ritzmann/gajim-plugins
  • genofire/gajim-plugins
  • jjrh/gajim-plugins
  • yarmak/gajim-plugins
  • PapaTutuWawa/gajim-plugins
  • weblate/gajim-plugins
  • XutaxKamay/gajim-plugins
  • nekk/gajim-plugins
  • principis/gajim-plugins
  • cbix/gajim-plugins
  • bodqhrohro/gajim-plugins
  • airtower-luna/gajim-plugins
  • toms/gajim-plugins
  • mesonium/gajim-plugins
  • lissine/gajim-plugins
  • anviar/gajim-plugins
42 results
Show changes
Showing
with 883 additions and 5 deletions
clients_icons/icons/conversations.png

1.82 KiB

clients_icons/icons/emacs.png

955 B

clients_icons/icons/jitsi.png

594 B

clients_icons/icons/leechcraft.png

3.38 KiB

clients_icons/icons/miranda_ng.png

827 B

clients_icons/icons/monal.png

1.59 KiB

clients_icons/icons/poezio.png

3.2 KiB

clients_icons/icons/sawim.png

1.32 KiB

clients_icons/icons/secugab.png

1.48 KiB

clients_icons/icons/yaxim.png

1.03 KiB

[info]
name: Clients icons
short_name: clients_icons
version: 3.1
description: Shows the client icons in the roster
and in groupchats.
For icons in tooltip support, you need to install Gajim r14117 or above.
authors = Denis Fomin <fominde@gmail.com>
version: 5.6
description: Shows the client icons in the roster and in groupchats.
authors: Denis Fomin <fominde@gmail.com>
Artem Klyop <art.klyop@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki/ClientsIconsPlugin
max_gajim_version: 0.16.9
from .colored_traceback import ColoredTracebackPlugin
colored_traceback/colored_traceback.png

582 B

# -*- coding: utf-8 -*-
##
from common import gajim
from plugins import GajimPlugin
from plugins.helpers import log_calls
import sys
import os
import traceback
import threading
from cStringIO import StringIO
have_pygments = True
try:
from pygments import highlight
from pygments.lexers import PythonConsoleLexer
from pygments.formatters import TerminalFormatter
test = PythonConsoleLexer.name
except ImportError:
have_pygments = False
import catcher
class ColoredTracebackPlugin(GajimPlugin):
@log_calls('ColoredTracebackPlugin')
def init(self):
self.config_dialog = None # ColoredTracebackPluginConfigDialog(self)
if not have_pygments:
self.available_text = _('Pygments are not available. '
'Install python-pygments.')
self.activatable = False
self._excepthook_save = None
@log_calls('ColoredTracebackPlugin')
def activate(self):
# gdb/kdm etc if we use startx this is not True
if os.name == 'nt' or sys.stderr.isatty():
self._exception_in_progress = threading.Lock()
self._excepthook_save = sys.excepthook
sys.excepthook = self._info
@log_calls('ColoredTracebackPlugin')
def deactivate(self):
if self._excepthook_save:
sys.excepthook = self._excepthook_save
def _info(self, type_, value, tb):
if not self._exception_in_progress.acquire(False):
# Exceptions have piled up, so we use the default exception
# handler for such exceptions
self._excepthook_save(type_, value, tb)
return
trace = StringIO()
traceback.print_exception(type_, value, tb, None, trace)
print highlight(trace.getvalue(), PythonConsoleLexer(),
TerminalFormatter())
self._exception_in_progress.release()
[info]
name: Colored traceback
short_name: colored_traceback
#version: 0.0.0
description: colored text for traceback in console
authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/
max_gajim_version: 0.16.9
from .emoticons_pack import EmoticonsPackPlugin
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkTextBuffer" id="textbuffer1">
<property name="text">Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization.</property>
</object>
<object class="GtkWindow" id="window1">
<child>
<object class="GtkHPaned" id="hpaned2">
<property name="width_request">600</property>
<property name="height_request">350</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">340</property>
<property name="position_set">True</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">6</property>
<property name="hscrollbar_policy">never</property>
<child>
<object class="GtkTreeView" id="available_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="search_column">1</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="set_name">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label">empty</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">Authors:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="authors_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">6</property>
<property name="label">&lt;empty&gt;</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Converted by:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="converter_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">6</property>
<property name="label">&lt;empty&gt;</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox9">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">Homepage:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="homepage_linkbutton">
<property name="label">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<child>
<object class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">Description:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox15">
<property name="visible">True</property>
<child>
<object class="GtkHButtonBox" id="hbuttonbox3">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="inslall_upgrade_button">
<property name="label" translatable="yes">Install/Upgrade</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<property name="image">image1</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_inslall_upgrade_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="legend_button">
<property name="label" translatable="yes">Legend</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<property name="image">image2</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_legend_button_clicked"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-dialog-info</property>
</object>
</interface>
[MacThemes2]
icon: Smile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Mac Themes 2 Smilies <br/>
<img src="preview.image"/>
</body>
authors: David Lanham
homepage: https://trac.gajim.org/wiki/MacThemes2
[Citters Emoticons from Psi]
icon: smile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Citters Emoticons from Psi<br/>
<img src="preview.image"/>
</body>
converter: churchyard (JID: churchyard@njs.netlab.cz)
homepage: https://trac.gajim.org/wiki/cittersemoticons
[EmotiPonies]
icon: pinkiesmile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
EmotiPonies <br/>
<img src="preview.image"/>
</body>
authors: midori-no-ink (Copyright (c) Hasbro, Inc.)
homepage: https://trac.gajim.org/wiki/EmotiPonies
[Google Talk Emoticons]
icon: equal_smile.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Google Talk Emoticons<br/>
<img src="preview.image"/>
</body>
converter: Chris Cook
homepage: https://trac.gajim.org/wiki/gtalkemoticons
[ICQ6 Emoticons]
icon: Smiley1.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
ICQ6 Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/ICQ6-emotions
[Kolobok Animated Emoticons]
icon: ab.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Kolobok Animated Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/kolobok-animated-emoticons
[Pidgin Emoticons]
icon: smile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Pidgin Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/PidginEmoticons
[Psynova qip's theme]
icon: ab.gif
authors: zOrg
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Psynova qip's theme<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/psynovaemoticons
[Yahoo Emoticons]
icon: equal_smile.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Yahoo Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/YahooEmoticons
[Nekomoticons]
icon: s01.jpg
authors: somik (http://somik.deviantart.com/)
converter: Dotterian (http://dotterian.ru/)
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Nekomoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/Nekomoticons
[Trollicons]
icon: Happy-EverythingWentBetterThanExpected.png
authors: Sagar Pandya
Chris Li
Jonathan E. Chen
converter: Matthieu L.
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Trollicons (Rage Icons for Gajim)<br/>
<img src="preview.image"/>
</body>
homepage: https://github.com/sagargp/trollicons/blob/master/readme.md#downloads
[Twemoji]
icon: 1f600.svg
authors: Twitter, Inc. and other contributors
converter: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Twemoji (Twitter Emoji for Gajim)<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/Twemoji
[Twemoji resized]
icon: 1f600.png
authors: Twitter, Inc. and other contributors
converter: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>, Thilo Molitor <thilo@eightysoft.de>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Twemoji (Twitter Emoji for Gajim)<br/>
The size of this Emojis is 24px and thus a bit more usable than those of the Twemoji packet (having a size of 48px)<br/>
Also the sorting is more intuitive (displaying all important emojis at the top of the emoticons dropdown).<br />
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/TwemojiResized
[Noto]
icon: 1f600.png
authors: Google Inc. and other contributors
converter: Tommaso Sardelli <lacapannadelloziotom@gmail.com>, Thilo Molitor <thilo@eightysoft.de>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
<h1>Noto Emoji for Gajim</h1>
<br/>
<p>The size of this Emojis is 24px in order to fit well with text size.</p>
<br/>
<img src="preview.image"/>
</body>
homepage: https://github.com/googlei18n/noto-emoji
emoticons_pack/emoticons_pack.png

840 B

# -*- coding: utf-8 -*-
##
import gtk
import pango
import gobject
import io
import ConfigParser
import os
import zipfile
import tempfile
from shutil import rmtree
import sys
import imp
from common import gajim
from plugins import GajimPlugin
from plugins.helpers import log_calls
from htmltextview import HtmlTextView
from conversation_textview import ConversationTextview
from dialogs import WarningDialog, HigDialog
(
C_PIXBUF,
C_NAME,
C_DESCRIPTION,
C_AUTHORS,
C_CONVERTER,
C_HOMEPAGE,
C_UPGRADE) = range(7)
class EmoticonsPackPlugin(GajimPlugin):
@log_calls('EmoticonsPackPlugin')
def init(self):
self.config_dialog = None # EmoticonsPackPluginConfigDialog(self)
self.window = None
self.model = None
self.connected_ids = {}
self.tmp_dir = ''
@log_calls('EmoticonsPackPlugin')
def activate(self):
self.pl_menuitem = gajim.interface.roster.xml.get_object(
'plugins_menuitem')
self.id_ = self.pl_menuitem.connect_after('activate', self.on_activate)
if 'plugins' in gajim.interface.instances:
self.on_activate(None)
@log_calls('EmoticonsPackPlugin')
def deactivate(self):
self.pl_menuitem.disconnect(self.id_)
if hasattr(self, 'page_num'):
self.notebook.remove_page(self.notebook.page_num(self.hpaned))
self.notebook.set_current_page(0)
for id_, widget in list(self.connected_ids.items()):
widget.disconnect(id_)
del self.page_num
def on_activate(self, widget):
if 'plugins' not in gajim.interface.instances:
return
if hasattr(self, 'page_num'):
# 'Available' tab exists
return
self.installed_plugins_model = gajim.interface.instances[
'plugins'].installed_plugins_model
self.notebook = gajim.interface.instances['plugins'].plugins_notebook
id_ = self.notebook.connect(
'switch-page', self.on_notebook_switch_page)
self.connected_ids[id_] = self.notebook
self.window = gajim.interface.instances['plugins'].window
id_ = self.window.connect('destroy', self.on_win_destroy)
self.connected_ids[id_] = self.window
self.Gtk_BUILDER_FILE_PATH = self.local_file_path('config_dialog.ui')
self.xml = gtk.Builder()
self.xml.set_translation_domain('gajim_plugins')
self.xml.add_objects_from_file(self.Gtk_BUILDER_FILE_PATH,
['hpaned2', 'image1', 'image2'])
self.hpaned = self.xml.get_object('hpaned2')
self.page_num = self.notebook.append_page(self.hpaned, gtk.Label(_(
'Emoticons')))
widgets_to_extract = (
'set_name', 'available_treeview', 'homepage_linkbutton',
'inslall_upgrade_button', 'authors_label', 'converter_label',)
for widget_name in widgets_to_extract:
setattr(self, widget_name, self.xml.get_object(widget_name))
self.model = gtk.ListStore(
gtk.gdk.Pixbuf, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)
self.available_treeview.set_model(self.model)
self.available_treeview.set_rules_hint(True)
self.model.set_sort_column_id(1, gtk.SORT_ASCENDING)
#self.progressbar.set_property('no-show-all', True)
renderer = gtk.CellRendererText()
col = gtk.TreeViewColumn(_('Name'))
cell = gtk.CellRendererPixbuf()
col.pack_start(cell, False)
col.add_attribute(cell, 'pixbuf', C_PIXBUF)
col.pack_start(renderer, True)
col.add_attribute(renderer, 'text', C_NAME)
col.set_property('expand', True)
col.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
self.available_treeview.append_column(col)
renderer = gtk.CellRendererToggle()
renderer.set_property('activatable', True)
renderer.connect('toggled', self.available_emoticons_toggled_cb)
col = gtk.TreeViewColumn(
_('Install /\nUpgrade'), renderer, active=C_UPGRADE)
col.set_property('expand', False)
col.set_resizable(False)
self.available_treeview.append_column(col)
selection = self.available_treeview.get_selection()
selection.connect(
'changed', self.available_emoticons_treeview_selection_changed)
selection.set_mode(gtk.SELECTION_SINGLE)
self.emoticons_description_textview = ConversationTextview(None)
sw = self.xml.get_object('scrolledwindow1')
sw.add(self.emoticons_description_textview.tv)
self.xml.connect_signals(self)
self.window.show_all()
def on_legend_button_clicked(self, widget):
self.xml.get_object('scrolledwindow1').get_children()[0].destroy()
treeview_selection = self.available_treeview.get_selection()
model, iter = treeview_selection.get_selected()
name = model.get_value(iter, C_NAME)
button = self.xml.get_object('legend_button')
if button.get_label() == _('Legend'):
button.set_label(_('Description'))
sys.path.append(os.path.join(self.tmp_dir, name))
import emoticons
imp.reload(emoticons)
self.emoticons_description_textview = gtk.TextView()
sw = self.xml.get_object('scrolledwindow1')
sw.add(self.emoticons_description_textview)
sw.show_all()
buff = self.emoticons_description_textview.get_buffer()
for icon in emoticons.emoticons:
icon_file = os.path.join(self.tmp_dir, name, icon)
with open(icon_file, 'rb') as _file:
data = _file.read()
pbl = gtk.gdk.PixbufLoader()
pbl.write(data)
pbl.close()
if icon.endswith('.gif'):
img = gtk.Image()
img.set_from_animation(pbl.get_animation())
img.show()
anchor = buff.create_child_anchor(buff.get_end_iter())
self.emoticons_description_textview.add_child_at_anchor(
img, anchor)
else:
buff.insert_pixbuf(buff.get_end_iter(), pbl.get_pixbuf())
text = ' , '.join(emoticons.emoticons[icon])
buff.insert(buff.get_end_iter(), text + '\n', -1)
self.emoticons_description_textview.set_property('sensitive', True)
sys.path.remove(os.path.join(self.tmp_dir, name))
else:
self.emoticons_description_textview = ConversationTextview(None)
sw = self.xml.get_object('scrolledwindow1')
sw.add(self.emoticons_description_textview.tv)
sw.show_all()
button.set_label(_('Legend'))
desc = _(model.get_value(iter, C_DESCRIPTION))
if not desc.startswith('<body '):
desc = '<body xmlns=\'http://www.w3.org/1999/xhtml\'>' + \
desc + ' </body>'
desc = desc.replace('preview.image', ('file:' + os.path.join(
self.tmp_dir, name, 'preview.png'))).replace('\n', '<br/>')
self.emoticons_description_textview.tv.display_html(
desc, self.emoticons_description_textview.tv,
self.emoticons_description_textview)
self.emoticons_description_textview.tv.set_property('sensitive', True)
def dict_to_html(self, dict_):
desc = ''
for icon in dict_:
acr = ' , '.join(dict_[icon])
desc += ' '+ icon + ' '+ acr + '\n'
return desc
def on_inslall_upgrade_clicked(self, widget):
self.inslall_upgrade_button.set_property('sensitive', False)
self.errors = ''
def on_error(func, path, error):
if func == os.path.islink:
# if symlink
os.unlink(path)
return
# access is denied or other
# WarningDialog(_('Can\'t remove dir'), error[1], self.window)
self.errors += str(error[1])
name_list = []
for i in range(len(self.model)):
if self.model[i][C_UPGRADE]:
name_list.append(self.model[i][C_NAME])
for name in name_list:
# remove dirs
target_dir = os.path.join(gajim.MY_EMOTS_PATH, name)
if os.path.isdir(target_dir):
rmtree(target_dir, False, on_error)
# unzip new files
zip_file = os.path.join(self.__path__, 'emoticons_pack.zip')
with zipfile.ZipFile(zip_file, 'r') as myzip:
namelist = myzip.namelist()
for n in namelist:
if not n.startswith(name):
continue
try:
icon_file = myzip.extract(n, path=gajim.MY_EMOTS_PATH)
except Exception as e:
self.errors += str(e)
# unset all checkbattons
for i in range(len(self.model)):
self.model[i][C_UPGRADE] = False
if self.errors:
WarningDialog(
_('Not fully installed'),
'Access is denied or other', self.window)
else:
# show dialog
dialog = HigDialog(
None, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, '',
_('All selected emoticons installed(upgraded)'))
dialog.set_modal(False)
dialog.set_transient_for(self.window)
dialog.popup()
def on_win_destroy(self, widget):
if hasattr(self, 'page_num'):
del self.page_num
if os.path.isdir(self.tmp_dir):
rmtree(self.tmp_dir, True)
def available_emoticons_toggled_cb(self, cell, path):
is_active = self.model[path][C_UPGRADE]
self.model[path][C_UPGRADE] = not is_active
dir_list = []
for i in range(len(self.model)):
if self.model[i][C_UPGRADE]:
dir_list.append(self.model[i][C_NAME])
if not dir_list:
self.inslall_upgrade_button.set_property('sensitive', False)
else:
self.inslall_upgrade_button.set_property('sensitive', True)
def on_notebook_switch_page(self, widget, page, page_num):
tab_label_text = self.notebook.get_tab_label_text(self.hpaned)
if tab_label_text != (_('Emoticons')):
return
self.model.clear()
self.fill_table()
self.select_root_iter()
def fill_table(self):
conf = ConfigParser.ConfigParser()
# read metadata from contents.ini
contents_path = os.path.join(self.__path__, 'contents.ini')
with open(contents_path) as _file:
conf.readfp(_file)
for section in conf.sections():
# get icon
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'):
converter = conf.get(section, 'converter')
self.model.append(
[icon, section,
conf.get(section, 'description'),
authors, converter,
conf.get(section, 'homepage'), False])
conf.remove_section(section)
def available_emoticons_treeview_selection_changed(self, treeview_selection):
model, iter = treeview_selection.get_selected()
button = self.xml.get_object('legend_button')
button.set_label(_('Legend'))
if iter:
set_name = model.get_value(iter, C_NAME)
if os.path.isdir(self.tmp_dir):
rmtree(self.tmp_dir, True)
self.tmp_dir = tempfile.mkdtemp()
# unzip new files
zip_file = os.path.join(self.__path__, 'emoticons_pack.zip')
with zipfile.ZipFile(zip_file, 'r') as myzip:
namelist = myzip.namelist()
for n in namelist:
if not n.startswith(set_name):
continue
myzip.extract(n, path=self.tmp_dir)
self.set_name.set_text(set_name)
self.authors_label.set_text(model.get_value(iter, C_AUTHORS))
self.converter_label.set_text(model.get_value(iter, C_CONVERTER))
self.homepage_linkbutton.set_uri(
model.get_value(iter, C_HOMEPAGE))
self.homepage_linkbutton.set_label(
model.get_value(iter, C_HOMEPAGE))
label = self.homepage_linkbutton.get_children()[0]
label.set_ellipsize(pango.ELLIPSIZE_END)
self.homepage_linkbutton.set_property('sensitive', True)
self.xml.get_object('scrolledwindow1').get_children()[0].destroy()
self.emoticons_description_textview = ConversationTextview(None)
sw = self.xml.get_object('scrolledwindow1')
sw.add(self.emoticons_description_textview.tv)
sw.show_all()
desc = _(model.get_value(iter, C_DESCRIPTION))
if not desc.startswith('<body '):
desc = '<body xmlns=\'http://www.w3.org/1999/xhtml\'>' + \
desc + ' </body>'
else:
desc = desc.replace('preview.image', ('file:' + os.path.join(
self.tmp_dir, set_name, 'preview.png')))
self.emoticons_description_textview.tv.display_html(desc,
self.emoticons_description_textview.tv,
self.emoticons_description_textview)
self.emoticons_description_textview.tv.set_property('sensitive', True)
else:
self.set_name.set_text('')
self.authors_label.set_text('')
self.homepage_linkbutton.set_uri('')
self.homepage_linkbutton.set_label('')
self.homepage_linkbutton.set_property('sensitive', False)
def select_root_iter(self):
if hasattr(self, 'page_num'):
selection = self.available_treeview.get_selection()
if selection.count_selected_rows() == 0:
root_iter = self.model.get_iter_first()
selection.select_iter(root_iter)
scr_win = self.xml.get_object('scrolledwindow2')
vadjustment = scr_win.get_vadjustment()
if vadjustment:
vadjustment.set_value(0)
#GObject.idle_add(self.available_treeview.grab_focus)