ClickableNicknamesPlugin.gtk3 support
This commit is contained in:
@@ -1 +1 @@
|
|||||||
from clickable_nicknames import ClickableNicknames
|
from .clickable_nicknames import ClickableNicknames
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
from string import rstrip
|
from gi.repository import Gdk
|
||||||
from string import lstrip
|
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from plugins import GajimPlugin
|
from plugins import GajimPlugin
|
||||||
@@ -88,25 +87,26 @@ class Base(object):
|
|||||||
|
|
||||||
def on_textview_motion_notify_event(self, widget, event):
|
def on_textview_motion_notify_event(self, widget, event):
|
||||||
# change cursor on the nicks
|
# change cursor on the nicks
|
||||||
pointer_x, pointer_y = self.textview.tv.window.get_pointer()[0:2]
|
pointer_x, pointer_y = self.textview.tv.get_window(
|
||||||
x, y = self.textview.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
|
Gtk.TextWindowType.TEXT).get_pointer()[1:3]
|
||||||
pointer_x, pointer_y)
|
x, y = self.textview.tv.window_to_buffer_coords(Gtk.TextWindowType.TEXT,
|
||||||
|
pointer_x, pointer_y)
|
||||||
tags = self.textview.tv.get_iter_at_location(x, y).get_tags()
|
tags = self.textview.tv.get_iter_at_location(x, y).get_tags()
|
||||||
tag_table = self.textview.tv.get_buffer().get_tag_table()
|
tag_table = self.textview.tv.get_buffer().get_tag_table()
|
||||||
if self.change_cursor:
|
if self.change_cursor:
|
||||||
self.textview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
self.textview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.XTERM))
|
Gdk.Cursor.new(Gdk.CursorType.XTERM))
|
||||||
self.change_cursor = False
|
self.change_cursor = False
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag in [x[1] for x in self.tags_id]:
|
if tag in [x[1] for x in self.tags_id]:
|
||||||
self.textview.tv.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
|
self.textview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
gtk.gdk.Cursor(gtk.gdk.HAND2))
|
Gdk.Cursor.new(Gdk.CursorType.HAND2))
|
||||||
self.change_cursor = True
|
self.change_cursor = True
|
||||||
self.textview.on_textview_motion_notify_event(widget, event)
|
self.textview.on_textview_motion_notify_event(widget, event)
|
||||||
|
|
||||||
def insert_nick(self, texttag, widget, event, iter_, kind):
|
def insert_nick(self, texttag, widget, event, iter_, kind):
|
||||||
# insert nickname to message buffer
|
# insert nickname to message buffer
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
if event.type == Gdk.EventType.BUTTON_PRESS and event.button.button == 1:
|
||||||
# left mouse button clicked
|
# left mouse button clicked
|
||||||
begin_iter = iter_.copy()
|
begin_iter = iter_.copy()
|
||||||
# we get the begining of the tag
|
# we get the begining of the tag
|
||||||
@@ -117,7 +117,7 @@ class Base(object):
|
|||||||
while not end_iter.ends_tag(texttag):
|
while not end_iter.ends_tag(texttag):
|
||||||
end_iter.forward_char()
|
end_iter.forward_char()
|
||||||
buffer_ = self.textview.tv.get_buffer()
|
buffer_ = self.textview.tv.get_buffer()
|
||||||
word = buffer_.get_text(begin_iter, end_iter).decode('utf-8')
|
word = buffer_.get_text(begin_iter, end_iter, True)
|
||||||
nick = word.rstrip().rstrip(gajim.config.get('after_nickname'))
|
nick = word.rstrip().rstrip(gajim.config.get('after_nickname'))
|
||||||
if nick.startswith('* '):
|
if nick.startswith('* '):
|
||||||
nick = nick.lstrip('* ').split(' ')[0]
|
nick = nick.lstrip('* ').split(' ')[0]
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ version: 0.2.2
|
|||||||
description: Clickable nicknames in the conversation textview.
|
description: Clickable nicknames in the conversation textview.
|
||||||
authors: Denis Fomin <fominde@gmail.com>
|
authors: Denis Fomin <fominde@gmail.com>
|
||||||
homepage: http://trac-plugins.gajim.org/wiki/ClickableNicknamesPlugin
|
homepage: http://trac-plugins.gajim.org/wiki/ClickableNicknamesPlugin
|
||||||
max_gajim_version: 0.15.9
|
min_gajim_version: 0.15.10
|
||||||
|
|||||||
Reference in New Issue
Block a user