[michele] position emots popup under cursor with Alt+E
This commit is contained in:
parent
b2d07fa5da
commit
b40b42b2e0
2 changed files with 7 additions and 1 deletions
|
@ -808,9 +808,14 @@ class Chat:
|
||||||
parent = self.message_textviews[jid]
|
parent = self.message_textviews[jid]
|
||||||
def set_emoticons_menu_position(w, parent=parent):
|
def set_emoticons_menu_position(w, parent=parent):
|
||||||
window = parent.get_window(gtk.TEXT_WINDOW_WIDGET)
|
window = parent.get_window(gtk.TEXT_WINDOW_WIDGET)
|
||||||
|
# get the window position
|
||||||
origin = window.get_origin()
|
origin = window.get_origin()
|
||||||
size = window.get_size()
|
size = window.get_size()
|
||||||
return (origin[0], origin[1] + size[1], 0)
|
buf = parent.get_buffer()
|
||||||
|
# get the cursor position
|
||||||
|
cursor = parent.get_iter_location(buf.get_iter_at_mark(buf.get_insert()))
|
||||||
|
cursor = parent.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, cursor.x, cursor.y)
|
||||||
|
return (origin[0] + cursor[0], origin[1] + size[1], 0)
|
||||||
self.emoticons_menu.popup(None, None, set_emoticons_menu_position, 1, 0)
|
self.emoticons_menu.popup(None, None, set_emoticons_menu_position, 1, 0)
|
||||||
elif event.keyval == gtk.keysyms.Page_Down:
|
elif event.keyval == gtk.keysyms.Page_Down:
|
||||||
if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN
|
if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN
|
||||||
|
|
|
@ -1110,6 +1110,7 @@ class Interface:
|
||||||
emot_file = gajim.config.get_per('emoticons', emot, 'path')
|
emot_file = gajim.config.get_per('emoticons', emot, 'path')
|
||||||
if not self.image_is_ok(emot_file):
|
if not self.image_is_ok(emot_file):
|
||||||
continue
|
continue
|
||||||
|
# This avoids duplicated emoticons with the same image eg. :) and :-)
|
||||||
if not emot_file in self.emoticons.values():
|
if not emot_file in self.emoticons.values():
|
||||||
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
|
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
|
||||||
if emot_file.endswith('.gif'):
|
if emot_file.endswith('.gif'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue