Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clickable_nicknames/__init__.py1
-rw-r--r--clickable_nicknames/clickable_nicknames.py137
-rw-r--r--juick/__init__.py1
-rw-r--r--juick/config_dialog.ui504
-rw-r--r--juick/favicon.pngbin0 -> 641 bytes
-rw-r--r--juick/juick_tag_button.pngbin0 -> 723 bytes
-rw-r--r--juick/locales/ru/LC_MESSAGES/JuickPlugin.mobin0 -> 4467 bytes
-rw-r--r--juick/plugin.py637
-rw-r--r--juick/po/JuickPlugin.po179
-rw-r--r--juick/po/JuickPlugin.pot177
-rw-r--r--juick/po/Makefile34
-rw-r--r--set_location/__init__.py1
-rw-r--r--set_location/config_dialog.ui487
-rw-r--r--set_location/locales/ru/LC_MESSAGES/setlocation.mobin0 -> 3780 bytes
-rw-r--r--set_location/po/Makefile34
-rw-r--r--set_location/po/setlocation.po154
-rw-r--r--set_location/po/setlocation.pot155
-rw-r--r--set_location/set_location.py98
18 files changed, 2599 insertions, 0 deletions
diff --git a/clickable_nicknames/__init__.py b/clickable_nicknames/__init__.py
new file mode 100644
index 0000000..bc61cbb
--- /dev/null
+++ b/clickable_nicknames/__init__.py
@@ -0,0 +1 @@
+from clickable_nicknames import ClickableNicknames
diff --git a/clickable_nicknames/clickable_nicknames.py b/clickable_nicknames/clickable_nicknames.py
new file mode 100644
index 0000000..3fe11ec
--- /dev/null
+++ b/clickable_nicknames/clickable_nicknames.py
@@ -0,0 +1,137 @@
+# -*- coding: utf-8 -*-
+
+import gtk
+from string import rstrip
+from string import lstrip
+
+from common import gajim
+from plugins import GajimPlugin
+from plugins.helpers import log_calls, log
+
+
+class ClickableNicknames(GajimPlugin):
+ name = u'Clickable Nicknames'
+ short_name = u'clickable_nicknames'
+ version = u'0.1'
+ description = _(u'''Clickable nicknames in the conversation textview.''')
+ authors = [u'Denis Fomin <fominde@gmail.com>']
+
+ homepage = u'http://bitbucket.org/dicson12/plugins/src/tip/clickable_nicknames/'
+
+ @log_calls('ClickableNicknamesPlugin')
+ def init(self):
+ self.config_dialog = None#ClickableNicknamesPluginConfigDialog(self)
+ self.gui_extension_points = {
+ 'chat_control_base' : (self.connect_with_chat_control,
+ self.disconnect_from_chat_control)}
+
+ self.is_active = None
+ self.gc_controls = {}
+
+ self.tag_names = []
+ colors = gajim.config.get('gc_nicknames_colors')
+ colors = colors.split(':')
+ for i, color in enumerate(colors):
+ tagname = 'gc_nickname_color_' + str(i)
+ self.tag_names.append(tagname)
+
+ @log_calls('ClickableNicknamesPlugin')
+ def activate(self):
+ for gc_control in gajim.interface.msg_win_mgr.get_controls('gc'):
+ # TODO support minimized groupchat
+ if gc_control not in self.gc_controls.keys():
+ control = Base(self, gc_control)
+ self.gc_controls[gc_control] = control
+ else:
+ self.gc_controls[gc_control].connect_signals()
+ self.is_active = True
+
+ @log_calls('ClickableNicknamesPlugin')
+ def deactivate(self):
+ for control in self.gc_controls.keys():
+ self.gc_controls[control].disconnect_from_chat_control()
+ self.gc_controls.clear()
+ self.is_active = None
+
+ @log_calls('ClickableNicknamesPlugin')
+ def connect_with_chat_control(self, chat_control):
+ if chat_control.widget_name != 'groupchat_control':
+ return
+ if self.is_active:
+ control = Base(self, chat_control)
+ self.gc_controls[chat_control] = control
+
+ @log_calls('ClickableNicknamesPlugin')
+ def disconnect_from_chat_control(self, chat_control):
+ pass
+
+class Base(object):
+ def __init__(self, plugin, chat_control):
+ self.plugin = plugin
+ self.chat_control = chat_control
+ self.textview = self.chat_control.conv_textview
+ self.tags_id = []
+ self.change_cursor = False
+ self.connect_signals()
+
+ def connect_signals(self):
+ # connect signals with textbuffer tags
+ self.tag_names = self.plugin.tag_names
+ tag_table = self.textview.tv.get_buffer().get_tag_table()
+ for name in self.tag_names:
+ tag = tag_table.lookup(name)
+ if tag:
+ id_ = tag.connect('event', self.insert_nick, name)
+ self.chat_control.handlers[id_] = tag
+ self.tags_id.append((id_, tag))
+
+ self.id_ = self.textview.tv.connect('motion_notify_event',
+ self.on_textview_motion_notify_event)
+ self.chat_control.handlers[self.id_] = self.textview.tv
+
+ def on_textview_motion_notify_event(self, widget, event):
+ # change cursor on the nicks
+ pointer_x, pointer_y = self.textview.tv.window.get_pointer()[0:2]
+ x, y = self.textview.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
+ pointer_x, pointer_y)
+ tags = self.textview.tv.get_iter_at_location(x, y).get_tags()
+ tag_table = self.textview.tv.get_buffer().get_tag_table()
+ if self.change_cursor:
+ self.textview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
+ gtk.gdk.Cursor(gtk.gdk.XTERM))
+ self.change_cursor = False
+ for tag in tags:
+ if tag in [x[1] for x in self.tags_id]:
+ self.textview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
+ gtk.gdk.Cursor(gtk.gdk.HAND2))
+ self.change_cursor = True
+ self.textview.on_textview_motion_notify_event(widget, event)
+
+ def insert_nick(self, texttag, widget, event, iter_, kind):
+ # insert nickname to message buffer
+ if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
+ # left mouse button clicked
+ begin_iter = iter_.copy()
+ # we get the begining of the tag
+ while not begin_iter.begins_tag(texttag):
+ begin_iter.backward_char()
+ end_iter = iter_.copy()
+ # we get the end of the tag
+ while not end_iter.ends_tag(texttag):
+ end_iter.forward_char()
+ buffer_ = self.textview.tv.get_buffer()
+ word = buffer_.get_text(begin_iter, end_iter).decode('utf-8')
+ nick = word.rstrip().rstrip(gajim.config.get('after_nickname'))
+ nick = nick.lstrip(gajim.config.get('before_nickname'))
+ nick = nick + gajim.config.get('gc_refer_to_nick_char') + ' '
+ message_buffer = self.chat_control.msg_textview.get_buffer()
+ message_buffer.insert_at_cursor(nick)
+ self.chat_control.msg_textview.grab_focus()
+
+ def disconnect_from_chat_control(self):
+ # disconnect signals from textbuffer tags
+ for item in self.tags_id:
+ if item[1].handler_is_connected(item[0]):
+ item[1].disconnect(item[0])
+ if self.textview.tv.handler_is_connected(self.id_):
+ self.textview.tv.disconnect(self.id_)
diff --git a/juick/__init__.py b/juick/__init__.py
new file mode 100644
index 0000000..af98aa7
--- /dev/null
+++ b/juick/__init__.py
@@ -0,0 +1 @@
+from plugin import JuickPlugin
diff --git a/juick/config_dialog.ui b/juick/config_dialog.ui
new file mode 100644
index 0000000..618adb4
--- /dev/null
+++ b/juick/config_dialog.ui
@@ -0,0 +1,504 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkWindow" id="window1">
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton">
+ <property name="label" translatable="yes">Show avatars in messages</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_checkbutton_toggled"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkCheckButton" id="only_author_avatar">
+ <property name="label" translatable="yes">Show avatar of post author only</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_only_author_ava_toggled"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="avatar_size_lebel">
+ <property name="visible">True</property>
+ <property name="xalign">0.029999999329447746</property>
+ <property name="label" translatable="yes">Avatar size</property>
+ <property name="ellipsize">start</property>
+ <property name="track_visited_links">False</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="avatar_size">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <property name="width_chars">6</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="avatar_size_value_changed"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_pic">
+ <property name="label" translatable="yes">Show juick picture preview</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_pic_toggled"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="preview_size_lebel">
+ <property name="visible">True</property>
+ <property name="xalign">0.029999999329447746</property>
+ <property name="label" translatable="yes">Preview size</property>
+ <property name="ellipsize">start</property>
+ <property name="track_visited_links">False</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="preview_size">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_text" translatable="yes">Preview size(10-512)</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <property name="width_chars">6</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="preview_size_value_changed"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0.029999999329447746</property>
+ <property name="label" translatable="yes">Juick link color</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="link_colorbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_text" translatable="yes">Juick link color</property>
+ <property name="color">#000000000000</property>
+ <signal name="color_set" handler="on_link_colorbutton_color_set"/>
+ </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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="border_width">1</property>
+ <property name="n_rows">13</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">2</property>
+ <child>
+ <object class="GtkEntry" id="menuitem1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_tag_button">
+ <property name="label" translatable="yes">Show juick tag button</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_tag_button_toggled"/>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">menuitem name:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">text will be inserted:</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Juick tag button menu options:</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem9">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem10">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text9">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="menuitem_text10">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="menuitem_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">6</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/juick/favicon.png b/juick/favicon.png
new file mode 100644
index 0000000..78020f9
--- /dev/null
+++ b/juick/favicon.png
Binary files differ
diff --git a/juick/juick_tag_button.png b/juick/juick_tag_button.png
new file mode 100644
index 0000000..d0ab0b7
--- /dev/null
+++ b/juick/juick_tag_button.png
Binary files differ
diff --git a/juick/locales/ru/LC_MESSAGES/JuickPlugin.mo b/juick/locales/ru/LC_MESSAGES/JuickPlugin.mo
new file mode 100644
index 0000000..21e21ba
--- /dev/null
+++ b/juick/locales/ru/LC_MESSAGES/JuickPlugin.mo
Binary files differ
diff --git a/juick/plugin.py b/juick/plugin.py
new file mode 100644
index 0000000..2753db0
--- /dev/null
+++ b/juick/plugin.py
@@ -0,0 +1,637 @@
+# -*- coding: utf-8 -*-
+
+import gtk
+import pango
+import re
+import os
+import time
+import gettext
+import locale
+import urllib
+from string import upper
+from string import rstrip
+
+from common import helpers
+from common import gajim
+from plugins import GajimPlugin
+from plugins.helpers import log_calls, log
+from plugins.gui import GajimPluginConfigDialog
+from conversation_textview import TextViewImage
+import gtkgui_helpers
+import common.xmpp
+
+locale_path = os.path.join(os.path.dirname(__file__), 'locales')
+if os.name != 'nt':
+ locale.bindtextdomain('JuickPlugin', locale_path)
+
+try:
+ gett = gettext.Catalog('JuickPlugin', locale_path)
+ _ = gett.gettext
+except:
+ pass
+
+class JuickPlugin(GajimPlugin):
+ name = u'Juick'
+ short_name = u'Juick'
+ version = u'0.2'
+ description = _(u'''Clickable juick links , juick nics, preview juick picturs.
+The key combination alt + up in the textbox allow insert the number of last message (comment or topic).''')
+ authors = [u'Denis Fomin <fominde@gmail.com>', u'evgen <drujebober@gmail.com>']
+
+ homepage = u'http://bitbucket.org/dicson12/plugins/src/tip/juick/'
+
+ @log_calls('JuickPlugin')
+ def init(self):
+ self.config_dialog = JuickPluginConfigDialog(self)
+ self.gui_extension_points = {
+ 'chat_control_base' : (self.connect_with_chat_control,
+ self.disconnect_from_chat_control)
+ }
+ self.config_default_values = {'SHOW_AVATARS': (False,''),
+ 'AVATAR_SIZE': (20, _('Avatar size(10-32)')),
+ 'SHOW_PREVIEW': (False,''),
+ 'PREVIEW_SIZE': (150, _('Preview size(10-512)')),
+ 'LINK_COLOR' : ('#B8833E', _('Juick link color')),
+ 'SHOW_TAG_BUTTON': (True,''),
+ 'ONLY_AUTHOR_AVATAR':(True,''),
+ 'MENUITEM1': ('tune',''), 'MENUITEM_TEXT1': ('*tune',''),
+ 'MENUITEM2': ('geo',''), 'MENUITEM_TEXT2': ('*geo',''),
+ 'MENUITEM3': ('gajim',''), 'MENUITEM_TEXT3': ('*gajim',''),
+ 'MENUITEM4': ('me',''), 'MENUITEM_TEXT4': ('/me',''),
+ 'MENUITEM5': ('',''), 'MENUITEM_TEXT5': ('',''),
+ 'MENUITEM6': ('',''), 'MENUITEM_TEXT6': ('',''),
+ 'MENUITEM7': ('',''), 'MENUITEM_TEXT7': ('',''),
+ 'MENUITEM8': ('',''), 'MENUITEM_TEXT8': ('',''),
+ 'MENUITEM9': ('',''), 'MENUITEM_TEXT9': ('',''),
+ 'MENUITEM10': ('',''), 'MENUITEM_TEXT10': ('',''),}
+ self.chat_control = None
+ self.controls = []
+ self.cache_path = os.path.join(gajim.AVATAR_PATH, 'juick')
+ if not os.path.isdir(self.cache_path):
+ os.makedirs(self.cache_path)
+
+ @log_calls('JuickPlugin')
+ def activate(self):
+ pass
+
+ @log_calls('JuickPlugin')
+ def deactivate(self):
+ pass
+
+ @log_calls('JuickPlugin')
+ def connect_with_chat_control(self, chat_control):
+ if chat_control.contact.jid != 'juick@juick.com':
+ return
+
+ self.chat_control = chat_control
+ control = Base(self, self.chat_control)
+ self.controls.append(control)
+
+ @log_calls('JuickPlugin')
+ def disconnect_from_chat_control(self, chat_control):
+ for control in self.controls:
+ control.disconnect_from_chat_control()
+ self.controls = []
+
+
+class Base(object):
+ def __init__(self, plugin, chat_control):
+ self.last_juick_num = ''
+ self.plugin = plugin
+ self.chat_control = chat_control
+ self.textview = self.chat_control.conv_textview
+ self.change_cursor = False
+
+ id_ = self.textview.tv.connect('button_press_event',
+ self.on_textview_button_press_event, self.textview)
+ chat_control.handlers[id_] = self.textview.tv
+
+ id_ = self.chat_control.msg_textview.connect('key_press_event',
+ self.mykeypress_event)
+ chat_control.handlers[id_] = self.chat_control.msg_textview
+
+ self.id_ = self.textview.tv.connect('motion_notify_event',
+ self.on_textview_motion_notify_event)
+ self.chat_control.handlers[self.id_] = self.textview.tv
+
+ # new buffer tags
+ color = self.plugin.config['LINK_COLOR']
+ buffer_ = self.textview.tv.get_buffer()
+ self.textview.tagSharpSlash = buffer_.create_tag('sharp_slash')
+ self.textview.tagSharpSlash.set_property('foreground', color)
+ self.textview.tagSharpSlash.set_property('underline',
+ pango.UNDERLINE_SINGLE)
+ id_ = self.textview.tagSharpSlash.connect('event',
+ self.juick_hyperlink_handler, 'sharp_slash')
+ chat_control.handlers[id_] = self.textview.tagSharpSlash
+
+ self.textview.tagJuickNick = buffer_.create_tag('juick_nick')
+ self.textview.tagJuickNick.set_property('foreground', color)
+ self.textview.tagJuickNick.set_property('underline',
+ pango.UNDERLINE_SINGLE)
+ id_ = self.textview.tagJuickNick.connect('event',
+ self.juick_hyperlink_handler, 'juick_nick')
+ chat_control.handlers[id_] = self.textview.tagJuickNick
+ self.textview.tagJuickPic = buffer_.create_tag('juick_pic')
+
+ self.create_patterns()
+ self.create_link_menu()
+ self.create_tag_menu()
+ self.create_buttons()
+
+ self.old_print_special_text = self.textview.print_special_text
+ self.textview.print_special_text = self.print_special_text
+
+ def create_patterns(self):
+ self.juick_post_uid = self.juick_nick = ''
+ self.juick_post_re = re.compile(r'#(\d+)')
+ self.juick_post_comment_re = re.compile(r'#(\d+)/(\d+)')
+ sharp_slash = r'#\d+(\/\d+)?'
+ if self.plugin.config['ONLY_AUTHOR_AVATAR']:
+ juick_nick = r'@[a-zA-Z0-9_@\.-]+:'
+ else:
+ juick_nick = r'@[a-zA-Z0-9_@:\.-]+'
+ juick_pic = r'http://i\.juick\.com/p/\d+\.jpg|http://i\.juick\.com/p/\d+\.JPG'
+ interface = gajim.interface
+ interface.sharp_slash_re = re.compile(sharp_slash)
+ self.juick_nick_re = interface.juick_nick_re = re.compile(juick_nick)
+ self.juick_pic_re = interface.juick_pic_re = re.compile(juick_pic)
+ juick_pattern = '|' + sharp_slash + '|' + juick_nick + '|' + juick_pic
+ interface.basic_pattern = interface.basic_pattern + juick_pattern
+ interface.emot_and_basic = interface.emot_and_basic + juick_pattern
+ interface._basic_pattern_re = re.compile(interface.basic_pattern,
+ re.IGNORECASE)
+ interface._emot_and_basic_re = re.compile(interface.emot_and_basic,
+ re.IGNORECASE + re.UNICODE)
+
+ def create_buttons(self):
+ # create juick button
+ actions_hbox = self.chat_control.xml.get_object('actions_hbox')
+ self.button = gtk.Button(label=None, stock=None, use_underline=True)
+ self.button.set_property('relief', gtk.RELIEF_NONE)
+ self.button.set_property('can-focus', False)
+ img = gtk.Image()
+ img_path = self.plugin.local_file_path('favicon.png')
+ pixbuf = gtk.gdk.pixbuf_new_from_file(img_path)
+ iconset = gtk.IconSet(pixbuf=pixbuf)
+ factory = gtk.IconFactory()
+ factory.add('juick', iconset)
+ factory.add_default()
+ img.set_from_stock('juick', gtk.ICON_SIZE_BUTTON)
+ self.button.set_image(img)
+ send_button = self.chat_control.xml.get_object('send_button')
+ send_button_pos = actions_hbox.child_get_property(send_button, 'position')
+ actions_hbox.add_with_properties(self.button, 'position',
+ send_button_pos - 1, 'expand', False)
+ id_ = self.button.connect('clicked', self.on_juick_button_clicked)
+ self.chat_control.handlers[id_] = self.button
+ self.button.show()
+ # create juick tag button
+ self.tag_button = gtk.Button(label=None, stock=None, use_underline=True)
+ self.tag_button.set_property('relief', gtk.RELIEF_NONE)
+ self.tag_button.set_property('can-focus', False)
+ img = gtk.Image()
+ img_path = self.plugin.local_file_path('juick_tag_button.png')
+ pixbuf = gtk.gdk.pixbuf_new_from_file(img_path)
+ iconset = gtk.IconSet(pixbuf=pixbuf)
+ factory.add('juick_tag', iconset)
+ factory.add_default()
+ img.set_from_stock('juick_tag', gtk.ICON_SIZE_BUTTON)
+ self.tag_button.set_image(img)
+ actions_hbox.add_with_properties(self.tag_button, 'position',
+ send_button_pos - 1, 'expand', False)
+ id_ = self.tag_button.connect('clicked', self.on_juick_tag_button_clicked)
+ self.chat_control.handlers[id_] = self.tag_button
+ self.tag_button.set_no_show_all(True)
+ self.tag_button.set_property('visible',
+ self.plugin.config['SHOW_TAG_BUTTON'])
+
+ def create_link_menu(self):
+ """
+ Create juick link context menu
+ """
+ self.juick_link_menu = gtk.Menu()
+
+ item = gtk.MenuItem(_('Reply to message'))
+ item.connect('activate', self.on_reply)
+ self.juick_link_menu.append(item)
+
+ menuitems = ((_('Unsubscribe from comments'), 'U #WORD'),
+ (_('Subscribe to message replies'), 'S #WORD'),
+ (_('Recommend post'), '! #WORD'),
+ (_('Show message with replies'), '#WORD+'),
+ (_('Delete post'), 'D #WORD'),)
+ for menuitem in menuitems:
+ item = gtk.MenuItem(menuitem[0])
+ item.connect('activate', self.send, menuitem[1])
+ self.juick_link_menu.append(item)
+
+ item = gtk.MenuItem(_('Open in browser'))
+ item.connect('activate', self.open_in_browser)
+ self.juick_link_menu.append(item)
+
+ menuitems = ((_('Show user\'s info'), 'NICK'),
+ (_('Show user\'s info and last 10 messages'), 'NICK+'),
+ (_('Subscribe to user\'s blog'), 'S NICK'),
+ (_('Unsubscribe from user\'s blog'), 'U NICK'),
+ (_('Add/delete user to/from your blacklist'), 'BL NICK'),)
+ for menuitem in menuitems:
+ item = gtk.MenuItem(menuitem[0])
+ item.connect('activate', self.send, menuitem[1])
+ self.juick_link_menu.append(item)
+
+ item = gtk.MenuItem(_('Send personal message'))
+ item.connect('activate', self.on_pm)
+ self.juick_link_menu.append(item)
+
+ def create_tag_menu(self):
+ """
+ Create juick tag button menu
+ """
+ self.menu = gtk.Menu()
+ for num in xrange(1,11):
+ menuitem = self.plugin.config['MENUITEM' + str(num)]
+ text = self.plugin.config['MENUITEM_TEXT' + str(num)]
+ if menuitem == '' or text == '':
+ continue
+ item = gtk.MenuItem(menuitem)
+ item.connect('activate', self.on_insert, text)
+ self.menu.append(item)
+ self.menu.show_all()
+
+ def juick_hyperlink_handler(self, texttag, widget, event, iter_, kind):
+ # handle message links( #12345 or #12345/6) and juick nicks
+ if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
+ # show popup menu (right mouse button clicked)
+ begin_iter = iter_.copy()
+ # we get the begining of the tag
+ while not begin_iter.begins_tag(texttag):
+ begin_iter.backward_char()
+ end_iter = iter_.copy()
+ # we get the end of the tag
+ while not end_iter.ends_tag(texttag):
+ end_iter.forward_char()
+
+ buffer_ = self.textview.tv.get_buffer()
+ word = buffer_.get_text(begin_iter, end_iter).decode('utf-8')
+ self.juick_post = word
+
+ post = self.juick_post_re.search(word)
+ nick = self.juick_nick_re.search(word)
+ if post is None and nick is None:
+ return
+ childs = self.juick_link_menu.get_children()
+ if post:
+ self.juick_post_full = gajim.interface.sharp_slash_re\
+ .search(word).group(0)
+ self.juick_post_uid = post.group(1)
+ for menuitem in xrange(7):
+ childs[menuitem].show()
+ for menuitem in xrange(7, 13):
+ childs[menuitem].hide()
+ if nick:
+ self.juick_nick = nick.group(0)
+ for menuitem in xrange(7):
+ childs[menuitem].hide()
+ for menuitem in xrange(7, 13):
+ childs[menuitem].show()
+ self.juick_link_menu.popup(None, None, None, event.button,
+ event.time)
+ if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
+ # insert message num or nick (left mouse button clicked)
+ begin_iter = iter_.copy()
+ # we get the begining of the tag
+ while not begin_iter.begins_tag(texttag):
+ begin_iter.backward_char()
+ end_iter = iter_.copy()
+ # we get the end of the tag
+ while not end_iter.ends_tag(texttag):
+ end_iter.forward_char()
+ buffer_ = self.textview.tv.get_buffer()
+ word = buffer_.get_text(begin_iter, end_iter).decode('utf-8')
+ if kind == 'sharp_slash':
+ self.on_insert(widget, word)
+ if kind == 'juick_nick':
+ self.on_insert(widget, 'PM %s' % word.rstrip(':'))
+
+ def print_special_text(self, special_text, other_tags, graphics=True):
+ if gajim.interface.sharp_slash_re.match(special_text):
+ # insert post num #123456//
+ buffer_, iter_, tag = self.get_iter_and_tag('sharp_slash')
+ buffer_.insert_with_tags(iter_, special_text, tag)
+ self.last_juick_num = special_text
+ return
+ if gajim.interface.juick_nick_re.match(special_text):
+ # insert juick nick @nickname////
+ buffer_, iter_, tag = self.get_iter_and_tag('juick_nick')
+ mark = buffer_.create_mark(None, iter_, True)
+ # insert juick nick
+ buffer_.insert_with_tags(iter_, special_text, tag)
+ if not self.plugin.config['SHOW_AVATARS']:
+ return
+ # insert avatars
+ conn = gajim.connections[self.chat_control.account]
+ id_ = conn.connection.getAnID()
+ to = 'juick@juick.com'
+ iq = common.xmpp.Iq('get', to=to)
+ a = iq.addChild(name = 'query',
+ namespace = 'http://juick.com/query#users')
+ special_text1 = special_text[1:].rstrip(':')
+ a.addChild(name='user', namespace = 'http://juick.com/user',
+ attrs={'uname': special_text1})
+ iq.setID(id_)
+ conn.connection.SendAndCallForResponse(iq, self._on_response,
+ {'mark':mark, 'special_text':special_text})
+ return
+ if gajim.interface.juick_pic_re.match(special_text) and \
+ self.plugin.config['SHOW_PREVIEW']:
+ # show pics preview
+ buffer_, iter_, tag = self.get_iter_and_tag('url')
+ mark = buffer_.create_mark(None, iter_, True)
+ buffer_.insert_with_tags(iter_, special_text, tag)
+ uid = special_text.split('p/')[1]
+ url = "http://i.juick.com/photos-512/%s" % uid
+ pixbuf = self.get_pixbuf_from_url(
+ url, self.plugin.config['PREVIEW_SIZE'])
+ if pixbuf:
+ # insert image
+ buffer_ = mark.get_buffer()
+ end_iter = buffer_.get_iter_at_mark(mark)
+ anchor = buffer_.create_child_anchor(end_iter)
+ img = TextViewImage(anchor, special_text)
+ img.set_from_pixbuf(pixbuf)
+ img.show()
+ self.textview.tv.add_child_at_anchor(img, anchor)
+ else:
+ self.old_print_special_text(special_text, other_tags, graphics)
+
+ def get_iter_and_tag(self, tag_name):
+ buffer_ = self.textview.tv.get_buffer()
+ ttable = buffer_.get_tag_table()
+ tag = ttable.lookup(tag_name)
+ return buffer_, buffer_.get_end_iter(), tag
+
+
+ def _on_response(self, a, resp, **kwargs):
+ # insert avatar to text mark
+ mark = kwargs['mark']
+ buffer_ = mark.get_buffer()
+ end_iter = buffer_.get_iter_at_mark(mark)
+ tags = resp.getTag('query')
+ if tags:
+ user = tags.getTag('user')
+ if not user:
+ return
+ uid = user.getAttr('uid')
+ pixbuf = self.get_avatar(uid)
+ if pixbuf:
+ anchor = buffer_.create_child_anchor(end_iter)
+ tooltype_text = kwargs['special_text'][1:].rstrip(':')
+ img = TextViewImage(anchor, tooltype_text)
+ img.set_from_pixbuf(pixbuf)
+ img.show()
+ self.textview.tv.add_child_at_anchor(img, anchor)
+
+ def get_avatar(self, uid):
+ # search avatar in cache or download from juick.com
+ pic = uid + '.png'
+ pic_path = os.path.join(self.plugin.cache_path, pic)
+ pic_path = pic_path.decode(locale.getpreferredencoding())
+ if os.path.isfile(pic_path):
+ pixbuf = gtk.gdk.pixbuf_new_from_file(pic_path)
+ if (time.time() - os.stat(pic_path).st_mtime) < 2419200:
+ return pixbuf
+ url = 'http://i.juick.com/as/%s.png' % uid
+ pixbuf = self.get_pixbuf_from_url(
+ url, self.plugin.config['AVATAR_SIZE'])
+ if pixbuf:
+ # save to cache
+ pixbuf.save(pic_path, 'png')
+ return pixbuf
+
+ def get_pixbuf_from_url(self, url, size):
+ # download avatar and resize him
+ # Returns pixbuf or False if broken image or not connected
+ try:
+ data = urllib.urlopen(url).read()
+ pix = gtk.gdk.PixbufLoader()
+ pix.write(data)
+ pix.close()
+ pixbuf = pix.get_pixbuf()
+ pixbuf, w, h = self.get_pixbuf_of_size(pixbuf, size)
+ except:
+ return False
+ return pixbuf
+
+ def get_pixbuf_of_size(self, pixbuf, size):
+ # Creates a pixbuf that fits in the specified square of sizexsize
+ # while preserving the aspect ratio
+ # Returns tuple: (scaled_pixbuf, actual_width, actual_height)
+ image_width = pixbuf.get_width()
+ image_height = pixbuf.get_height()
+
+ if image_width > image_height:
+ if image_width > size:
+ image_height = int(size/float(image_width)*image_height)
+ image_width =int(size)
+ else:
+ if image_height > size:
+ image_width = int(size/float(image_height)*image_width)
+ image_height = int(size)
+
+ crop_pixbuf = pixbuf.scale_simple(image_width, image_height,
+ gtk.gdk.INTERP_BILINEAR)
+ return (crop_pixbuf, image_width, image_height)
+
+ def on_textview_button_press_event(self, widget, event, obj):
+ obj.selected_phrase = ''
+
+ if event.button != 3:
+ return False
+
+ x, y = obj.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
+ int(event.x), int(event.y))
+ iter_ = obj.tv.get_iter_at_location(x, y)
+ tags = iter_.get_tags()
+
+ if tags:
+ for tag in tags:
+ tag_name = tag.get_property('name')
+ if tag_name in ('juick_nick', 'sharp_slash'):
+ return True
+
+ self.textview.on_textview_button_press_event(widget, event)
+
+ def on_textview_motion_notify_event(self, widget, event):
+ # Change the cursor to a hand when we are over a nicks or an post nums
+ pointer_x, pointer_y = self.textview.tv.window.get_pointer()[0:2]
+ x, y = self.textview.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
+ pointer_x, pointer_y)
+ tags = self.textview.tv.get_iter_at_location(x, y).get_tags()
+ tag_table = self.textview.tv.get_buffer().get_tag_table()
+ if self.change_cursor:
+ self.textview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
+ gtk.gdk.Cursor(gtk.gdk.XTERM))
+ self.change_cursor = False
+ for tag in tags:
+ if tag in (self.textview.tagSharpSlash, self.textview.tagJuickNick):
+ self.textview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
+ gtk.gdk.Cursor(gtk.gdk.HAND2))
+ self.change_cursor = True
+ self.textview.on_textview_motion_notify_event(widget, event)
+
+ def on_juick_button_clicked(self, widget):
+ """
+ Popup juick menu
+ """
+ menu = gtk.Menu()
+ menuitems = ((_('Show last messages from public timeline'), '#+'),
+ (_('Show last messages from your feed'), '#'),
+ (_('Show popular personal blogs'), '@'),
+ (_('Show popular tags'), '*'),
+ (_('Show your subscriptions'), 'S'),
+ (_('Delete last message'), 'D LAST'),
+ (_('Enable subscriptions delivery'), 'ON'),
+ (_('Disable subscriptions delivery'), 'OFF'),
+ (_('Show your blacklist'), 'BL'),
+ (_('Update "About" info from Jabber vCard'), 'VCARD'),
+ (_('Ping'), 'PING'),
+ (_('Login'), 'LOGIN'),
+ (_('HELP'), 'HELP'),)
+ for menuitem in menuitems:
+ item = gtk.MenuItem(menuitem[0])
+ item.connect('activate', self.send, menuitem[1])
+ menu.append(item)
+
+ menu.show_all()
+ gtkgui_helpers.popup_emoticons_under_button(menu, widget,
+ self.chat_control.parent_win)
+
+ def on_juick_tag_button_clicked(self, widget):
+ gtkgui_helpers.popup_emoticons_under_button(self.menu, widget,
+ self.chat_control.parent_win)
+
+ def send(self, widget, text):
+ msg = text.replace('WORD', self.juick_post_uid).replace(
+ 'NICK',self.juick_nick.rstrip(':'))
+ self.chat_control.send_message(msg)
+ self.chat_control.msg_textview.grab_focus()
+
+ def on_insert(self, widget, text):
+ """
+ Insert text to conversation input box, at cursor position
+ """
+ text = text.rstrip() + ' '
+ message_buffer = self.chat_control.msg_textview.get_buffer()
+ message_buffer.insert_at_cursor(text)
+ self.chat_control.msg_textview.grab_focus()
+
+ def on_reply(self, widget):
+ self.on_insert(widget, self.juick_post_full)
+
+ def on_pm(self, widget):
+ self.on_insert(widget, 'PM %s' % self.juick_nick.rstrip(':'))
+
+ def open_in_browser(self, widget):
+ post = self.juick_post_comment_re.search(self.juick_post)
+ url = None
+ if post is not None:
+ url = 'http://juick.com/%s#%s' % (post.group(1), post.group(2))
+ else:
+ post = self.juick_post_re.search(self.juick_post)
+ if post is not None:
+ url = 'http://juick.com/%s' % post.group(1)
+ if url is not None:
+ helpers.launch_browser_mailer('url', url)
+
+ def disconnect_from_chat_control(self):
+ self.textview.print_special_text = self.old_print_special_text
+ buffer_ = self.textview.tv.get_buffer()
+ tag_table = buffer_.get_tag_table()
+ if tag_table.lookup('sharp_slash'):
+ tag_table.remove(self.textview.tagSharpSlash)
+ tag_table.remove(self.textview.tagJuickNick)
+ tag_table.remove(self.textview.tagJuickPic)
+ actions_hbox = self.chat_control.xml.get_object('actions_hbox')
+ actions_hbox.remove(self.button)
+ actions_hbox.remove(self.tag_button)
+
+ def mykeypress_event(self, widget, event):
+ if event.keyval == gtk.keysyms.Up:
+ if event.state & gtk.gdk.MOD1_MASK: # Alt+UP
+ self.on_insert(widget, self.last_juick_num)
+ return True
+
+class JuickPluginConfigDialog(GajimPluginConfigDialog):
+ def init(self):
+ self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
+ 'config_dialog.ui')
+ self.xml = gtk.Builder()
+ self.xml.set_translation_domain('JuickPlugin')
+ self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
+ ['vbox1'])
+ self.checkbutton = self.xml.get_object('checkbutton')
+ self.avatar_size_spinbutton = self.xml.get_object('avatar_size')
+ self.avatar_size_spinbutton.get_adjustment().set_all(
+ 20, 10, 32, 1, 10, 0)
+ self.show_pic = self.xml.get_object('show_pic')
+ self.preview_size_spinbutton = self.xml.get_object('preview_size')
+ self.preview_size_spinbutton.get_adjustment().set_all(
+ 20, 10, 512, 1, 10, 0)
+ self.link_colorbutton = self.xml.get_object('link_colorbutton')
+ vbox = self.xml.get_object('vbox1')
+ self.child.pack_start(vbox)
+
+ self.xml.connect_signals(self)
+
+ def on_run(self):
+ self.checkbutton.set_active(self.plugin.config['SHOW_AVATARS'])
+ self.xml.get_object('only_author_avatar').set_active(
+ self.plugin.config['ONLY_AUTHOR_AVATAR'])
+ self.avatar_size_spinbutton.set_value(self.plugin.config['AVATAR_SIZE'])
+ self.show_pic.set_active(self.plugin.config['SHOW_PREVIEW'])
+ self.preview_size_spinbutton.set_value(
+ self.plugin.config['PREVIEW_SIZE'])
+ self.link_colorbutton.set_color(gtk.gdk.color_parse(
+ self.plugin.config['LINK_COLOR']))
+ self.xml.get_object('show_tag_button').set_active(
+ self.plugin.config['SHOW_TAG_BUTTON'])
+ for num in xrange(1,11):
+ self.xml.get_object('menuitem' + str(num)).set_text(
+ self.plugin.config['MENUITEM' + str(num)])
+ self.xml.get_object('menuitem_text' + str(num)).set_text(
+ self.plugin.config['MENUITEM_TEXT' + str(num)])
+
+ def on_checkbutton_toggled(self, checkbutton):
+ self.plugin.config['SHOW_AVATARS'] = checkbutton.get_active()
+
+ def on_only_author_ava_toggled(self, checkbutton):
+ self.plugin.config['ONLY_AUTHOR_AVATAR'] = checkbutton.get_active()
+ for control in self.plugin.controls:
+ control.create_patterns()
+
+ def avatar_size_value_changed(self, spinbutton):
+ self.plugin.config['AVATAR_SIZE'] = spinbutton.get_value()
+
+ def on_show_pic_toggled(self, checkbutton):
+ self.plugin.config['SHOW_PREVIEW'] = checkbutton.get_active()
+
+ def on_show_tag_button_toggled(self, checkbutton):
+ self.plugin.config['SHOW_TAG_BUTTON'] = checkbutton.get_active()
+ for control in self.plugin.controls:
+ control.tag_button.set_property('visible', checkbutton.get_active())
+
+ def preview_size_value_changed(self, spinbutton):
+ self.plugin.config['PREVIEW_SIZE'] = spinbutton.get_value()
+
+ def on_link_colorbutton_color_set(self, colorbutton):
+ color = colorbutton.get_color().to_string()
+ self.plugin.config['LINK_COLOR'] = color
+ for control in self.plugin.controls:
+ control.textview.tagSharpSlash.set_property('foreground', color)
+ control.textview.tagJuickNick.set_property('foreground', color)
+ def menuitem_changed(self, widget):
+ name = upper(gtk.Buildable.get_name(widget))
+ self.plugin.config[name] = widget.get_text()
+ for control in self.plugin.controls:
+ control.create_tag_menu()
diff --git a/juick/po/JuickPlugin.po b/juick/po/JuickPlugin.po
new file mode 100644
index 0000000..2c0e3c0
--- /dev/null
+++ b/juick/po/JuickPlugin.po
@@ -0,0 +1,179 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: JuickPlugin\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-09-08 21:59+0400\n"
+"PO-Revision-Date: \n"
+"Last-Translator: Fomin Denis <fominde@mail.ru>\n"
+"Language-Team: \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Russian\n"
+
+#: ../plugin.py:37
+msgid ""
+"Clickable juick links , juick nics, preview juick picturs.\n"
+"The key combination alt + up in the textbox allow insert the number of last message (comment or topic)."
+msgstr ""
+"Кликабельные Juick ссылки, ники, аватары и картинки.\n"
+"Комбинация клавиш alt+up позволяет в поле ввода вставить номер последнего сообщения(комментария или топика)."
+
+#: ../plugin.py:51
+msgid "Avatar size(10-32)"
+msgstr "Размер аватара(10-32)"
+
+#: ../plugin.py:53
+#: ../config_dialog.ui.h:5
+msgid "Preview size(10-512)"
+msgstr "Размер картинок(10-512)"
+
+#: ../plugin.py:54
+#: ../config_dialog.ui.h:2
+msgid "Juick link color"
+msgstr "Цвет Juick ссылок"
+
+#: ../plugin.py:220
+msgid "Reply to message"
+msgstr "Ответить на сообщение"
+
+#: ../plugin.py:224
+msgid "Unsubscribe from comments"
+msgstr "Отписаться от поста"
+
+#: ../plugin.py:225
+msgid "Subscribe to message replies"
+msgstr "Подписаться на пост"
+
+#: ../plugin.py:226
+msgid "Recommend post"
+msgstr "Рекомендовать пост"
+
+#: ../plugin.py:227
+msgid "Show message with replies"
+msgstr "Показать пост и ответы"
+
+#: ../plugin.py:228
+msgid "Delete post"
+msgstr "Удалить пост"
+
+#: ../plugin.py:234
+msgid "Open in browser"
+msgstr "Открыть в браузере"
+
+#: ../plugin.py:238
+msgid "Show user's info"
+msgstr "Показать информацию о пользователе"
+
+#: ../plugin.py:239
+msgid "Show user's info and last 10 messages"
+msgstr "Показать информацию о пользователе и последние 10 сообщений"
+
+#: ../plugin.py:240
+msgid "Subscribe to user's blog"
+msgstr "Подписаться"
+
+#: ../plugin.py:241
+msgid "Unsubscribe from user's blog"
+msgstr "Отписаться"
+
+#: ../plugin.py:242
+msgid "Add/delete user to/from your blacklist"
+msgstr "Добавить/Удалить пользователя в/из «Черный список» "
+
+#: ../plugin.py:248
+msgid "Send personal message"
+msgstr "Отослать пользователю личное сообщение"
+
+#: ../plugin.py:471
+msgid "Show last messages from public timeline"
+msgstr "Показать последние сообщения из общей ленты"
+
+#: ../plugin.py:472
+msgid "Show last messages from your feed"
+msgstr "Показать последние сообщения из вашей ленты"
+
+#: ../plugin.py:473
+msgid "Show popular personal blogs"
+msgstr "Показать популярные блоги"
+
+#: ../plugin.py:474
+msgid "Show popular tags"
+msgstr "Показать популярные теги"
+
+#: ../plugin.py:475
+msgid "Show your subscriptions"
+msgstr "Показать список всех блогов, на которые вы подписаны"
+
+#: ../plugin.py:476
+msgid "Delete last message"
+msgstr "Удалить вашу последнюю запись"
+
+#: ../plugin.py:477
+msgid "Enable subscriptions delivery"
+msgstr "Включить доставку сообщений"
+
+#: ../plugin.py:478
+msgid "Disable subscriptions delivery"
+msgstr "Отключить доставку сообщений"
+
+#: ../plugin.py:479
+msgid "Show your blacklist"
+msgstr "Показать «Черный список»"
+
+#: ../plugin.py:480
+msgid "Update \"About\" info from Jabber vCard"
+msgstr "Обновить \"About\" из vCard"
+
+#: ../plugin.py:481
+msgid "Ping"
+msgstr "Пинг"
+
+#: ../plugin.py:482
+msgid "Login"
+msgstr "Получить уникальную ссылку для авторизации на сайте"
+
+#: ../plugin.py:483
+msgid "HELP"
+msgstr "Показать краткую справку по командам"
+
+#: ../config_dialog.ui.h:1
+msgid "Avatar size"
+msgstr "Размер аватара"
+
+#: ../config_dialog.ui.h:3
+msgid "Juick tag button menu options:"
+msgstr "Опции кнопки для ввода тегов:"
+
+#: ../config_dialog.ui.h:4
+msgid "Preview size"
+msgstr "Размер картинок"
+
+#: ../config_dialog.ui.h:6
+msgid "Show avatar of post author only"
+msgstr "Показывать аватар только автора поста"
+
+#: ../config_dialog.ui.h:7
+msgid "Show avatars in messages"
+msgstr "Показывать аватары в сообщениях"
+
+#: ../config_dialog.ui.h:8
+msgid "Show juick picture preview"
+msgstr "Показывать картики в сообщениях"
+
+#: ../config_dialog.ui.h:9
+msgid "Show juick tag button"
+msgstr "Отображать кнопку для ввода тегов"
+
+#: ../config_dialog.ui.h:10
+msgid "menuitem name:"
+msgstr "название пункта меню:"
+
+#: ../config_dialog.ui.h:11
+msgid "text will be inserted:"
+msgstr "текст для вставки:"
+
+#~ msgid "Clickable juick links , juick nics, preview juick picturs"
+#~ msgstr "Кликабельные Juick ссылки, ники, аватары и картинки"
+
diff --git a/juick/po/JuickPlugin.pot b/juick/po/JuickPlugin.pot
new file mode 100644
index 0000000..b8e2f37
--- /dev/null
+++ b/juick/po/JuickPlugin.pot
@@ -0,0 +1,177 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-09-08 21:59+0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../plugin.py:37
+msgid ""
+"Clickable juick links , juick nics, preview juick picturs.\n"
+"The key combination alt + up in the textbox allow insert the number of last "
+"message (comment or topic)."
+msgstr ""
+
+#: ../plugin.py:51
+msgid "Avatar size(10-32)"
+msgstr ""
+
+#: ../plugin.py:53 ../config_dialog.ui.h:5
+msgid "Preview size(10-512)"
+msgstr ""
+
+#: ../plugin.py:54 ../config_dialog.ui.h:2
+msgid "Juick link color"
+msgstr ""
+
+#: ../plugin.py:220
+msgid "Reply to message"
+msgstr ""
+
+#: ../plugin.py:224
+msgid "Unsubscribe from comments"
+msgstr ""
+
+#: ../plugin.py:225
+msgid "Subscribe to message replies"
+msgstr ""
+
+#: ../plugin.py:226
+msgid "Recommend post"
+msgstr ""
+
+#: ../plugin.py:227
+msgid "Show message with replies"
+msgstr ""
+
+#: ../plugin.py:228
+msgid "Delete post"
+msgstr ""
+
+#: ../plugin.py:234
+msgid "Open in browser"
+msgstr ""
+
+#: ../plugin.py:238
+msgid "Show user's info"
+msgstr ""
+
+#: ../plugin.py:239
+msgid "Show user's info and last 10 messages"
+msgstr ""
+
+#: ../plugin.py:240
+msgid "Subscribe to user's blog"
+msgstr ""
+
+#: ../plugin.py:241
+msgid "Unsubscribe from user's blog"
+msgstr ""
+
+#: ../plugin.py:242
+msgid "Add/delete user to/from your blacklist"
+msgstr ""
+
+#: ../plugin.py:248
+msgid "Send personal message"
+msgstr ""
+
+#: ../plugin.py:471
+msgid "Show last messages from public timeline"
+msgstr ""
+
+#: ../plugin.py:472
+msgid "Show last messages from your feed"
+msgstr ""
+
+#: ../plugin.py:473
+msgid "Show popular personal blogs"
+msgstr ""
+
+#: ../plugin.py:474
+msgid "Show popular tags"
+msgstr ""
+
+#: ../plugin.py:475
+msgid "Show your subscriptions"
+msgstr ""
+
+#: ../plugin.py:476
+msgid "Delete last message"
+msgstr ""
+
+#: ../plugin.py:477
+msgid "Enable subscriptions delivery"
+msgstr ""
+
+#: ../plugin.py:478
+msgid "Disable subscriptions delivery"
+msgstr ""
+
+#: ../plugin.py:479
+msgid "Show your blacklist"
+msgstr ""
+
+#: ../plugin.py:480
+msgid "Update \"About\" info from Jabber vCard"
+msgstr ""
+
+#: ../plugin.py:481
+msgid "Ping"
+msgstr ""
+
+#: ../plugin.py:482
+msgid "Login"
+msgstr ""
+
+#: ../plugin.py:483
+msgid "HELP"
+msgstr ""
+
+#: ../config_dialog.ui.h:1
+msgid "Avatar size"
+msgstr ""
+
+#: ../config_dialog.ui.h:3
+msgid "Juick tag button menu options:"
+msgstr ""
+
+#: ../config_dialog.ui.h:4
+msgid "Preview size"
+msgstr ""
+
+#: ../config_dialog.ui.h:6
+msgid "Show avatar of post author only"
+msgstr ""
+
+#: ../config_dialog.ui.h:7
+msgid "Show avatars in messages"
+msgstr ""
+
+#: ../config_dialog.ui.h:8
+msgid "Show juick picture preview"
+msgstr ""
+
+#: ../config_dialog.ui.h:9
+msgid "Show juick tag button"
+msgstr ""
+
+#: ../config_dialog.ui.h:10
+msgid "menuitem name:"
+msgstr ""
+
+#: ../config_dialog.ui.h:11
+msgid "text will be inserted:"
+msgstr ""
diff --git a/juick/po/Makefile b/juick/po/Makefile
new file mode 100644
index 0000000..00e02fe
--- /dev/null
+++ b/juick/po/Makefile
@@ -0,0 +1,34 @@
+PYFILES = $(shell find ../ -type f -name "*.py")
+GLADEFILES = $(wildcard ../*.ui)
+POFILES = $(wildcard *.po)
+
+GLADEHFILES := $(GLADEFILES:.ui=.ui.h)
+
+help:
+ @echo "USAGE:"
+ @echo "make update - updates messages.pot and .po files"
+ @echo "make sr.po - updates sr.po file OR creates new one"
+ @echo " (replace 'sr' with your language code)"
+
+%.h: %
+ intltool-extract --type="gettext/glade" $*
+
+
+messages.pot: $(GLADEHFILES) $(PYFILES)
+ xgettext -k_ -kN_ -o JuickPlugin.pot $(PYFILES) $(GLADEHFILES) --from-code=utf-8
+
+%.po: messages.pot
+ @if test -f $@; then \
+ echo -n "Updating '$*' language ";\
+ msgmerge -U $@ JuickPlugin.pot;\
+ else \
+ msginit -l $*.UTF8 -o $@; \
+ fi
+ $(RM) $(GLADEHFILES)
+
+update: $(POFILES)
+
+clean:
+ $(RM) $(GLADEHFILES)
+
+.PHONY: update
diff --git a/set_location/__init__.py b/set_location/__init__.py
new file mode 100644
index 0000000..2e080ea
--- /dev/null
+++ b/set_location/__init__.py
@@ -0,0 +1 @@
+from set_location import SetLocationPlugin
diff --git a/set_location/config_dialog.ui b/set_location/config_dialog.ui
new file mode 100644
index 0000000..4f71c45
--- /dev/null
+++ b/set_location/config_dialog.ui
@@ -0,0 +1,487 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkWindow" id="window1">
+ <child>
+ <object class="GtkTable" id="config_table">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="n_rows">17</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">7</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">alt:</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">area:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">building:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">country:</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">countrycode:</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">description:</property>
+ </object>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">floor:</property>
+ </object>
+ <packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">locality:</property>
+ </object>
+ <packing>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">lat:</property>
+ </object>
+ <packing>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">lon:</property>
+ </object>
+ <packing>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">postalcode:</property>
+ </object>
+ <packing>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">region:</property>
+ </object>
+ <packing>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">room:</property>
+ </object>
+ <packing>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">street:</property>
+ </object>
+ <packing>
+ <property name="top_attach">13</property>
+ <property name="bottom_attach">14</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">text:</property>
+ </object>
+ <packing>
+ <property name="top_attach">14</property>
+ <property name="bottom_attach">15</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">uri:</property>
+ </object>
+ <packing>
+ <property name="top_attach">15</property>
+ <property name="bottom_attach">16</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="alt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Altitude in meters above or below sea level</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="area">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A named area such as a campus or neighborhood</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="building">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A specific building on a street or in an area</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="country">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">The nation where the user is located</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="countrycode">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">The ISO 3166 two-letter country code</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="description">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A natural-language name for or description of the location</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="floor">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A particular floor in a building</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="locality">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A locality within the administrative region, such as a town or city</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="lat">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Latitude in decimal degrees North</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="lon">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Longitude in decimal degrees East</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="postalcode">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A code used for postal delivery</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="region">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">An administrative region of the nation, such as a state or province</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="room">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A particular room in a building</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="street">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A thoroughfare within the locality, or a crossing of two thoroughfares</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">13</property>
+ <property name="bottom_attach">14</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="text">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A catch-all element that captures any other information about the location</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">14</property>
+ <property name="bottom_attach">15</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="uri">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A URI or URL pointing to information about the location</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="changed" handler="changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">15</property>
+ <property name="bottom_attach">16</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAspectFrame" id="aspectframe2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <property name="xalign">1</property>
+ <child>
+ <object class="GtkButton" id="apply">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="xalign">1</property>
+ <signal name="clicked" handler="on_apply_clicked"/>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-apply</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Apply</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">16</property>
+ <property name="bottom_attach">17</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/set_location/locales/ru/LC_MESSAGES/setlocation.mo b/set_location/locales/ru/LC_MESSAGES/setlocation.mo
new file mode 100644
index 0000000..827c044
--- /dev/null
+++ b/set_location/locales/ru/LC_MESSAGES/setlocation.mo
Binary files differ
diff --git a/set_location/po/Makefile b/set_location/po/Makefile
new file mode 100644
index 0000000..4acc40b
--- /dev/null
+++ b/set_location/po/Makefile
@@ -0,0 +1,34 @@
+PYFILES = $(shell find ../ -type f -name "*.py")
+GLADEFILES = $(wildcard ../*.ui)
+POFILES = $(wildcard *.po)
+
+GLADEHFILES := $(GLADEFILES:.ui=.ui.h)
+
+help:
+ @echo "USAGE:"
+ @echo "make update - updates messages.pot and .po files"
+ @echo "make sr.po - updates sr.po file OR creates new one"
+ @echo " (replace 'sr' with your language code)"
+
+%.h: %
+ intltool-extract --type="gettext/glade" $*
+
+
+messages.pot: $(GLADEHFILES) $(PYFILES)
+ xgettext -k_ -kN_ -o setlocation.pot $(PYFILES) $(GLADEHFILES) --from-code=utf-8
+
+%.po: messages.pot
+ @if test -f $@; then \
+ echo -n "Updating '$*' language ";\
+ msgmerge -U $@ setlocation.pot;\
+ else \
+ msginit -l $*.UTF8 -o $@; \
+ fi
+ $(RM) $(GLADEHFILES)
+
+update: $(POFILES)
+
+clean:
+ $(RM) $(GLADEHFILES)
+
+.PHONY: update
diff --git a/set_location/po/setlocation.po b/set_location/po/setlocation.po
new file mode 100644
index 0000000..3572c67
--- /dev/null
+++ b/set_location/po/setlocation.po
@@ -0,0 +1,154 @@
+# Language setlocation translations for PACKAGE package.
+# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# test <fominde@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: setlocation\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-09-05 22:11+0400\n"
+"PO-Revision-Date: 2010-09-05 22:54+0300\n"
+"Last-Translator: Fomin Denis <fominde@mail.ru>\n"
+"Language-Team: ru\n"
+"Language: setlocation\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../set_location.py:29
+msgid "Set information about the current geographical or physical location."
+msgstr "Позволяет установить текущее местоположение."
+
+#: ../config_dialog.ui.h:1
+msgid "A URI or URL pointing to information about the location"
+msgstr "URI или URL, указывающих на информации о местонахождении"
+
+#: ../config_dialog.ui.h:2
+msgid "A catch-all element that captures any other information about the location"
+msgstr "Всеобъемлющий элемент, который фиксирует любую другую информацию о местонахождении"
+
+#: ../config_dialog.ui.h:3
+msgid "A code used for postal delivery"
+msgstr "Код, используемый для почтовых отправлений"
+
+#: ../config_dialog.ui.h:4
+msgid "A locality within the administrative region, such as a town or city"
+msgstr "Населенный пункт в пределах административного района, например, деревни или города"
+
+#: ../config_dialog.ui.h:5
+msgid "A named area such as a campus or neighborhood"
+msgstr "Именованый участок как студенческий городок или окресности"
+
+#: ../config_dialog.ui.h:6
+msgid "A natural-language name for or description of the location"
+msgstr "Описание местоположения на родном языке"
+
+#: ../config_dialog.ui.h:7
+msgid "A particular floor in a building"
+msgstr "Этаж в здании"
+
+#: ../config_dialog.ui.h:8
+msgid "A particular room in a building"
+msgstr "Номер комнаты в здании"
+
+#: ../config_dialog.ui.h:9
+msgid "A specific building on a street or in an area"
+msgstr "Конкретные здания на улице или в районе"
+
+#: ../config_dialog.ui.h:10
+msgid "A thoroughfare within the locality, or a crossing of two thoroughfares"
+msgstr "Проезд в пределах местности, или пересечение двух улиц"
+
+#: ../config_dialog.ui.h:11
+msgid "Altitude in meters above or below sea level"
+msgstr "Высота в метрах выше или ниже уровня моря"
+
+#: ../config_dialog.ui.h:12
+msgid "An administrative region of the nation, such as a state or province"
+msgstr "Административный район страны, такой, как штат или область"
+
+#: ../config_dialog.ui.h:13
+msgid "Apply"
+msgstr "Применить"
+
+#: ../config_dialog.ui.h:14
+msgid "Latitude in decimal degrees North"
+msgstr "Широта в десятичных градусах"
+
+#: ../config_dialog.ui.h:15
+msgid "Longitude in decimal degrees East"
+msgstr "Долгота в десятичных градусах"
+
+#: ../config_dialog.ui.h:16
+msgid "The ISO 3166 two-letter country code"
+msgstr "ISO 3166 2-буквенный код страны"
+
+#: ../config_dialog.ui.h:17
+msgid "The nation where the user is located"
+msgstr "Страна, в которой находится пользователь"
+
+#: ../config_dialog.ui.h:18
+msgid "alt:"
+msgstr "высота:"
+
+#: ../config_dialog.ui.h:19
+msgid "area:"
+msgstr "район:"
+
+#: ../config_dialog.ui.h:20
+msgid "building:"
+msgstr "строение:"
+
+#: ../config_dialog.ui.h:21
+msgid "country:"
+msgstr "страна:"
+
+#: ../config_dialog.ui.h:22
+msgid "countrycode:"
+msgstr "код страны:"
+
+#: ../config_dialog.ui.h:23
+msgid "description:"
+msgstr "описание:"
+
+#: ../config_dialog.ui.h:24
+msgid "floor:"
+msgstr "этаж:"
+
+#: ../config_dialog.ui.h:25
+msgid "lat:"
+msgstr "широта:"
+
+#: ../config_dialog.ui.h:26
+msgid "locality:"
+msgstr "населенный пункт:"
+
+#: ../config_dialog.ui.h:27
+msgid "lon:"
+msgstr "долгота:"
+
+#: ../config_dialog.ui.h:28
+msgid "postalcode:"
+msgstr "индекс:"
+
+#: ../config_dialog.ui.h:29
+msgid "region:"
+msgstr "область:"
+
+#: ../config_dialog.ui.h:30
+msgid "room:"
+msgstr "комната(номер квартиры):"
+
+#: ../config_dialog.ui.h:31
+msgid "street:"
+msgstr "улица:"
+
+#: ../config_dialog.ui.h:32
+msgid "text:"
+msgstr "текст:"
+
+#: ../config_dialog.ui.h:33
+msgid "uri:"
+msgstr "uri:"
+
diff --git a/set_location/po/setlocation.pot b/set_location/po/setlocation.pot
new file mode 100644
index 0000000..0b385c5
--- /dev/null
+++ b/set_location/po/setlocation.pot
@@ -0,0 +1,155 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-09-05 22:11+0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../set_location.py:29
+msgid "Set information about the current geographical or physical location."
+msgstr ""
+
+#: ../config_dialog.ui.h:1
+msgid "A URI or URL pointing to information about the location"
+msgstr ""
+
+#: ../config_dialog.ui.h:2
+msgid ""
+"A catch-all element that captures any other information about the location"
+msgstr ""
+
+#: ../config_dialog.ui.h:3
+msgid "A code used for postal delivery"
+msgstr ""
+
+#: ../config_dialog.ui.h:4
+msgid "A locality within the administrative region, such as a town or city"
+msgstr ""
+
+#: ../config_dialog.ui.h:5
+msgid "A named area such as a campus or neighborhood"
+msgstr ""
+
+#: ../config_dialog.ui.h:6
+msgid "A natural-language name for or description of the location"
+msgstr ""
+
+#: ../config_dialog.ui.h:7
+msgid "A particular floor in a building"
+msgstr ""
+
+#: ../config_dialog.ui.h:8
+msgid "A particular room in a building"
+msgstr ""
+
+#: ../config_dialog.ui.h:9
+msgid "A specific building on a street or in an area"
+msgstr ""
+
+#: ../config_dialog.ui.h:10
+msgid "A thoroughfare within the locality, or a crossing of two thoroughfares"
+msgstr ""
+
+#: ../config_dialog.ui.h:11
+msgid "Altitude in meters above or below sea level"
+msgstr ""
+
+#: ../config_dialog.ui.h:12
+msgid "An administrative region of the nation, such as a state or province"
+msgstr ""
+
+#: ../config_dialog.ui.h:13
+msgid "Apply"
+msgstr ""
+
+#: ../config_dialog.ui.h:14
+msgid "Latitude in decimal degrees North"
+msgstr ""
+
+#: ../config_dialog.ui.h:15
+msgid "Longitude in decimal degrees East"
+msgstr ""
+
+#: ../config_dialog.ui.h:16
+msgid "The ISO 3166 two-letter country code"
+msgstr ""
+
+#: ../config_dialog.ui.h:17
+msgid "The nation where the user is located"
+msgstr ""
+
+#: ../config_dialog.ui.h:18
+msgid "alt:"
+msgstr ""
+
+#: ../config_dialog.ui.h:19
+msgid "area:"
+msgstr ""
+
+#: ../config_dialog.ui.h:20
+msgid "building:"
+msgstr ""
+
+#: ../config_dialog.ui.h:21
+msgid "country:"
+msgstr ""
+
+#: ../config_dialog.ui.h:22
+msgid "countrycode:"
+msgstr ""
+
+#: ../config_dialog.ui.h:23
+msgid "description:"
+msgstr ""
+
+#: ../config_dialog.ui.h:24
+msgid "floor:"
+msgstr ""
+
+#: ../config_dialog.ui.h:25
+msgid "lat:"
+msgstr ""
+
+#: ../config_dialog.ui.h:26
+msgid "locality:"
+msgstr ""
+
+#: ../config_dialog.ui.h:27
+msgid "lon:"
+msgstr ""
+
+#: ../config_dialog.ui.h:28
+msgid "postalcode:"
+msgstr ""
+
+#: ../config_dialog.ui.h:29
+msgid "region:"
+msgstr ""
+
+#: ../config_dialog.ui.h:30
+msgid "room:"
+msgstr ""
+
+#: ../config_dialog.ui.h:31
+msgid "street:"
+msgstr ""
+
+#: ../config_dialog.ui.h:32
+msgid "text:"
+msgstr ""
+
+#: ../config_dialog.ui.h:33
+msgid "uri:"
+msgstr ""
diff --git a/set_location/set_location.py b/set_location/set_location.py
new file mode 100644
index 0000000..522201b
--- /dev/null
+++ b/set_location/set_location.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+##
+
+from datetime import datetime
+import time
+import gtk
+import os
+import locale
+import gettext
+
+from plugins.gui import GajimPluginConfigDialog
+from plugins import GajimPlugin
+from plugins.helpers import log_calls, log
+from common import gajim
+
+locale_path = os.path.dirname(__file__) + '/locales'
+locale.bindtextdomain('setlocation', locale_path)
+try:
+ gett = gettext.Catalog('setlocation', locale_path)
+ _ = gett.gettext
+except:
+ pass
+
+class SetLocationPlugin(GajimPlugin):
+ name = u'Set Location'
+ short_name = u'set_location'
+ version = u'0.1'
+ description = _(
+ u'''Set information about the current geographical or physical location.''')
+ authors = [u'Denis Fomin <fominde@gmail.com>']
+ homepage = u'http://bitbucket.org/dicson12/plugins/src/tip/set_location/'
+
+ @log_calls('SetLocationPlugin')
+ def init(self):
+ self.config_dialog = SetLocationPluginConfigDialog(self)
+ self.config_default_values = {
+ 'alt': (1609,''),
+ 'area': ('Central Park', ''),
+ 'building': ('The Empire State Building',''),
+ 'country': ('United States', ''),
+ 'countrycode' : ('US', ''),
+ 'description' : ('Bill\'s house', ''),
+ 'floor' : ('102', ''),
+ 'lat' : (39.75, ''),
+ 'locality' : ('New York City', ''),
+ 'lon' : (-104.99, ''),
+ 'postalcode' : ('10027', ''),
+ 'region' : ('New York', ''),
+ 'room' : ('Observatory', ''),
+ 'street' : ('34th and Broadway', ''),
+ 'text' : ('Northwest corner of the lobby', ''),
+ 'uri' : ('http://beta.plazes.com/plazes/1940:jabber_inc', ''),}
+
+ @log_calls('SetLocationPlugin')
+ def activate(self):
+ self._data = {}
+ timestamp = time.time()
+ timestamp = datetime.utcfromtimestamp(timestamp)
+ timestamp = timestamp.strftime('%Y-%m-%dT%H:%MZ')
+ self._data['timestamp'] = timestamp
+ for name in self.config_default_values:
+ self._data[name] = self.config[name]
+ for acct in gajim.connections:
+ if gajim.connections[acct].connected == 0:
+ gajim.connections[acct].to_be_sent_location = self._data
+ else:
+ gajim.connections[acct].send_location(self._data)
+
+ @log_calls('SetLocationPlugin')
+ def deactivate(self):
+ self._data = {}
+ for acct in gajim.connections:
+ gajim.connections[acct].send_location(self._data)
+
+
+class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
+ def init(self):
+ self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
+ 'config_dialog.ui')
+ self.xml = gtk.Builder()
+ self.xml.set_translation_domain('setlocation')
+ self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
+ ['config_table'])
+ config_table = self.xml.get_object('config_table')
+ self.child.pack_start(config_table)
+ self.xml.connect_signals(self)
+
+ def on_run(self):
+ for name in self.plugin.config_default_values:
+ widget = self.xml.get_object(name)
+ widget.set_text(str(self.plugin.config[name]))
+
+ def changed(self, entry):
+ name = gtk.Buildable.get_name(entry)
+ self.plugin.config[name] = entry.get_text()
+
+ def on_apply_clicked(self, widget):
+ self.plugin.activate()