fix some CursorType
This commit is contained in:
parent
80f925f054
commit
59a621bd87
|
@ -1293,7 +1293,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
if not self.conv_textview.auto_scrolling:
|
if not self.conv_textview.auto_scrolling:
|
||||||
self.conv_textview.stop_scrolling()
|
self.conv_textview.stop_scrolling()
|
||||||
self.was_at_the_end = (adjustment.get_upper() - adjustment.get_value() \
|
self.was_at_the_end = (adjustment.get_upper() - adjustment.get_value() \
|
||||||
- adjustment.page_size) < 18
|
- adjustment.get_page_size()) < 18
|
||||||
if self.resource:
|
if self.resource:
|
||||||
jid = self.contact.get_full_jid()
|
jid = self.contact.get_full_jid()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
from threading import Timer # for smooth scrolling
|
from threading import Timer # for smooth scrolling
|
||||||
|
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import Gdk
|
||||||
from gi.repository import GdkPixbuf
|
from gi.repository import GdkPixbuf
|
||||||
from gi.repository import Pango
|
from gi.repository import Pango
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
|
@ -663,16 +664,17 @@ class ConversationTextview(GObject.GObject):
|
||||||
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
tags = self.tv.get_iter_at_location(x, y).get_tags()
|
||||||
if self.change_cursor:
|
if self.change_cursor:
|
||||||
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
Gdk.Cursor.new(Gdk.XTERM))
|
Gdk.Cursor.new(Gdk.CursorType.XTERM))
|
||||||
self.change_cursor = False
|
self.change_cursor = False
|
||||||
tag_table = self.tv.get_buffer().get_tag_table()
|
tag_table = self.tv.get_buffer().get_tag_table()
|
||||||
over_line = False
|
over_line = False
|
||||||
xep0184_warning = False
|
xep0184_warning = False
|
||||||
|
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag in (tag_table.lookup('url'), tag_table.lookup('mail'), \
|
if tag in (tag_table.lookup('url'), tag_table.lookup('mail'), \
|
||||||
tag_table.lookup('xmpp'), tag_table.lookup('sth_at_sth')):
|
tag_table.lookup('xmpp'), tag_table.lookup('sth_at_sth')):
|
||||||
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
Gdk.Cursor.new(Gdk.HAND2))
|
Gdk.Cursor.new(Gdk.CursorType.HAND2))
|
||||||
self.change_cursor = True
|
self.change_cursor = True
|
||||||
elif tag == tag_table.lookup('focus-out-line'):
|
elif tag == tag_table.lookup('focus-out-line'):
|
||||||
over_line = True
|
over_line = True
|
||||||
|
|
|
@ -2583,11 +2583,11 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
|
|
||||||
def show_tooltip(self, contact):
|
def show_tooltip(self, contact):
|
||||||
if not self.list_treeview.window:
|
if not self.list_treeview.get_window():
|
||||||
# control has been destroyed since tooltip was requested
|
# control has been destroyed since tooltip was requested
|
||||||
return
|
return
|
||||||
pointer = self.list_treeview.get_pointer()
|
pointer = self.list_treeview.get_pointer()
|
||||||
props = self.list_treeview.get_path_at_pos(pointer[1], pointer[2])
|
props = self.list_treeview.get_path_at_pos(pointer[0], pointer[1])
|
||||||
# check if the current pointer is at the same path
|
# check if the current pointer is at the same path
|
||||||
# as it was before setting the timeout
|
# as it was before setting the timeout
|
||||||
if props and self.tooltip.id == props[0]:
|
if props and self.tooltip.id == props[0]:
|
||||||
|
|
|
@ -1758,7 +1758,7 @@ class Interface:
|
||||||
self.roster.draw_contact(jid, account)
|
self.roster.draw_contact(jid, account)
|
||||||
if w:
|
if w:
|
||||||
w.set_active_tab(ctrl)
|
w.set_active_tab(ctrl)
|
||||||
w.window.window.focus(Gtk.get_current_event_time())
|
w.window.get_window().focus(Gtk.get_current_event_time())
|
||||||
# Using isinstance here because we want to catch all derived types
|
# Using isinstance here because we want to catch all derived types
|
||||||
if isinstance(ctrl, ChatControlBase):
|
if isinstance(ctrl, ChatControlBase):
|
||||||
tv = ctrl.conv_textview
|
tv = ctrl.conv_textview
|
||||||
|
@ -2102,6 +2102,7 @@ class Interface:
|
||||||
gc_control = GroupchatControl(mw, contact, account,
|
gc_control = GroupchatControl(mw, contact, account,
|
||||||
is_continued=is_continued)
|
is_continued=is_continued)
|
||||||
mw.new_tab(gc_control)
|
mw.new_tab(gc_control)
|
||||||
|
mw.set_active_tab(gc_control)
|
||||||
|
|
||||||
def new_private_chat(self, gc_contact, account, session=None):
|
def new_private_chat(self, gc_contact, account, session=None):
|
||||||
conn = gajim.connections[account]
|
conn = gajim.connections[account]
|
||||||
|
|
|
@ -824,7 +824,7 @@ class HtmlTextView(Gtk.TextView):
|
||||||
def __leave_event(self, widget, event):
|
def __leave_event(self, widget, event):
|
||||||
if self._changed_cursor:
|
if self._changed_cursor:
|
||||||
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
||||||
window.set_cursor(Gdk.Cursor.new(Gdk.XTERM))
|
window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
|
||||||
self._changed_cursor = False
|
self._changed_cursor = False
|
||||||
|
|
||||||
def show_tooltip(self, tag):
|
def show_tooltip(self, tag):
|
||||||
|
@ -857,13 +857,13 @@ class HtmlTextView(Gtk.TextView):
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
if not self._changed_cursor and anchor_tags:
|
if not self._changed_cursor and anchor_tags:
|
||||||
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
||||||
window.set_cursor(Gdk.Cursor.new(Gdk.HAND2))
|
window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND2))
|
||||||
self._changed_cursor = True
|
self._changed_cursor = True
|
||||||
self.tooltip.timeout = GObject.timeout_add(500, self.show_tooltip,
|
self.tooltip.timeout = GObject.timeout_add(500, self.show_tooltip,
|
||||||
anchor_tags[0])
|
anchor_tags[0])
|
||||||
elif self._changed_cursor and not anchor_tags:
|
elif self._changed_cursor and not anchor_tags:
|
||||||
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
window = widget.get_window(Gtk.TextWindowType.TEXT)
|
||||||
window.set_cursor(Gdk.Cursor.new(Gdk.XTERM))
|
window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
|
||||||
self._changed_cursor = False
|
self._changed_cursor = False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -963,14 +963,14 @@ if __name__ == '__main__':
|
||||||
tags = htmlview.tv.get_iter_at_location(x, y).get_tags()
|
tags = htmlview.tv.get_iter_at_location(x, y).get_tags()
|
||||||
if change_cursor:
|
if change_cursor:
|
||||||
htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
Gdk.Cursor.new(Gdk.XTERM))
|
Gdk.Cursor.new(Gdk.CursorType.XTERM))
|
||||||
change_cursor = None
|
change_cursor = None
|
||||||
tag_table = htmlview.tv.get_buffer().get_tag_table()
|
tag_table = htmlview.tv.get_buffer().get_tag_table()
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
try:
|
try:
|
||||||
if tag.is_anchor:
|
if tag.is_anchor:
|
||||||
htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
|
||||||
Gdk.Cursor.new(Gdk.HAND2))
|
Gdk.Cursor.new(Gdk.CursorType.HAND2))
|
||||||
change_cursor = tag
|
change_cursor = tag
|
||||||
elif tag == tag_table.lookup('focus-out-line'):
|
elif tag == tag_table.lookup('focus-out-line'):
|
||||||
over_line = True
|
over_line = True
|
||||||
|
|
Loading…
Reference in New Issue