Commit 8c50df8e authored by Dicson's avatar Dicson

First commit

parents
from clickable_nicknames import ClickableNicknames
# -*- 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_)
from plugin import JuickPlugin
This diff is collapsed.
This diff is collapsed.
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 ссылки, ники, аватары и картинки"
# 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 ""
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
from set_location import SetLocationPlugin
This diff is collapsed.
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
# 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:"
# 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"