From 59a621bd8706ea276f8f9fae24af71c5c1b36473 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Wed, 2 Jan 2013 17:30:54 +0400 Subject: [PATCH] fix some CursorType --- src/chat_control.py | 2 +- src/conversation_textview.py | 6 ++++-- src/groupchat_control.py | 4 ++-- src/gui_interface.py | 3 ++- src/htmltextview.py | 10 +++++----- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 29aa2b781..a2bd86248 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1293,7 +1293,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): if not self.conv_textview.auto_scrolling: self.conv_textview.stop_scrolling() self.was_at_the_end = (adjustment.get_upper() - adjustment.get_value() \ - - adjustment.page_size) < 18 + - adjustment.get_page_size()) < 18 if self.resource: jid = self.contact.get_full_jid() else: diff --git a/src/conversation_textview.py b/src/conversation_textview.py index d02fd244a..06e7ed800 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -30,6 +30,7 @@ from threading import Timer # for smooth scrolling from gi.repository import Gtk +from gi.repository import Gdk from gi.repository import GdkPixbuf from gi.repository import Pango from gi.repository import GObject @@ -663,16 +664,17 @@ class ConversationTextview(GObject.GObject): tags = self.tv.get_iter_at_location(x, y).get_tags() if self.change_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 tag_table = self.tv.get_buffer().get_tag_table() over_line = False xep0184_warning = False + for tag in tags: if tag in (tag_table.lookup('url'), tag_table.lookup('mail'), \ tag_table.lookup('xmpp'), tag_table.lookup('sth_at_sth')): self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor( - Gdk.Cursor.new(Gdk.HAND2)) + Gdk.Cursor.new(Gdk.CursorType.HAND2)) self.change_cursor = True elif tag == tag_table.lookup('focus-out-line'): over_line = True diff --git a/src/groupchat_control.py b/src/groupchat_control.py index fe276c202..023795914 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -2583,11 +2583,11 @@ class GroupchatControl(ChatControlBase): self.tooltip.hide_tooltip() 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 return 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 # as it was before setting the timeout if props and self.tooltip.id == props[0]: diff --git a/src/gui_interface.py b/src/gui_interface.py index 156ac5587..2aea36174 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -1758,7 +1758,7 @@ class Interface: self.roster.draw_contact(jid, account) if w: 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 if isinstance(ctrl, ChatControlBase): tv = ctrl.conv_textview @@ -2102,6 +2102,7 @@ class Interface: gc_control = GroupchatControl(mw, contact, account, is_continued=is_continued) mw.new_tab(gc_control) + mw.set_active_tab(gc_control) def new_private_chat(self, gc_contact, account, session=None): conn = gajim.connections[account] diff --git a/src/htmltextview.py b/src/htmltextview.py index b668466c2..ab6411ae7 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -824,7 +824,7 @@ class HtmlTextView(Gtk.TextView): def __leave_event(self, widget, event): if self._changed_cursor: 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 def show_tooltip(self, tag): @@ -857,13 +857,13 @@ class HtmlTextView(Gtk.TextView): self.tooltip.hide_tooltip() if not self._changed_cursor and anchor_tags: 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.tooltip.timeout = GObject.timeout_add(500, self.show_tooltip, anchor_tags[0]) elif self._changed_cursor and not anchor_tags: 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 return False @@ -963,14 +963,14 @@ if __name__ == '__main__': tags = htmlview.tv.get_iter_at_location(x, y).get_tags() if change_cursor: htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor( - Gdk.Cursor.new(Gdk.XTERM)) + Gdk.Cursor.new(Gdk.CursorType.XTERM)) change_cursor = None tag_table = htmlview.tv.get_buffer().get_tag_table() for tag in tags: try: if tag.is_anchor: htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor( - Gdk.Cursor.new(Gdk.HAND2)) + Gdk.Cursor.new(Gdk.CursorType.HAND2)) change_cursor = tag elif tag == tag_table.lookup('focus-out-line'): over_line = True