ImagePlugin. Do not send image to GC.
This commit is contained in:
@@ -5,6 +5,7 @@ import os
|
|||||||
import base64
|
import base64
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
import chat_control
|
||||||
from plugins import GajimPlugin
|
from plugins import GajimPlugin
|
||||||
from plugins.helpers import log_calls
|
from plugins.helpers import log_calls
|
||||||
from common.xmpp.protocol import NS_XHTML_IM
|
from common.xmpp.protocol import NS_XHTML_IM
|
||||||
@@ -29,13 +30,15 @@ class ImagePlugin(GajimPlugin):
|
|||||||
self.first_run = True
|
self.first_run = True
|
||||||
|
|
||||||
@log_calls('ImagePlugin')
|
@log_calls('ImagePlugin')
|
||||||
def connect_with_chat_control(self, chat_control):
|
def connect_with_chat_control(self, control):
|
||||||
self.chat_control = chat_control
|
if not isinstance(control, chat_control.ChatControl):
|
||||||
control = Base(self, self.chat_control)
|
return
|
||||||
self.controls.append(control)
|
self.chat_control = control
|
||||||
|
base = Base(self, self.chat_control)
|
||||||
|
self.controls.append(base)
|
||||||
if self.first_run:
|
if self.first_run:
|
||||||
# ALT + N
|
# ALT + L
|
||||||
gtk.binding_entry_add_signal(chat_control.msg_textview,
|
gtk.binding_entry_add_signal(control.msg_textview,
|
||||||
gtk.keysyms.l, gtk.gdk.MOD1_MASK, 'mykeypress',
|
gtk.keysyms.l, gtk.gdk.MOD1_MASK, 'mykeypress',
|
||||||
int, gtk.keysyms.l, gtk.gdk.ModifierType, gtk.gdk.MOD1_MASK)
|
int, gtk.keysyms.l, gtk.gdk.ModifierType, gtk.gdk.MOD1_MASK)
|
||||||
self.first_run = False
|
self.first_run = False
|
||||||
@@ -81,6 +84,7 @@ class Base(object):
|
|||||||
send_button_pos - 1, 'expand', False)
|
send_button_pos - 1, 'expand', False)
|
||||||
id_ = self.button.connect('clicked', self.on_image_button_clicked)
|
id_ = self.button.connect('clicked', self.on_image_button_clicked)
|
||||||
chat_control.handlers[id_] = self.button
|
chat_control.handlers[id_] = self.button
|
||||||
|
chat_control.handlers[self.id_] = chat_control.msg_textview
|
||||||
self.button.show()
|
self.button.show()
|
||||||
|
|
||||||
def on_key_press(self, widget, event_keyval, event_keymod):
|
def on_key_press(self, widget, event_keyval, event_keymod):
|
||||||
@@ -141,3 +145,6 @@ class Base(object):
|
|||||||
def disconnect_from_chat_control(self):
|
def disconnect_from_chat_control(self):
|
||||||
actions_hbox = self.chat_control.xml.get_object('actions_hbox')
|
actions_hbox = self.chat_control.xml.get_object('actions_hbox')
|
||||||
actions_hbox.remove(self.button)
|
actions_hbox.remove(self.button)
|
||||||
|
if self.chat_control.handlers[self.id_].handler_is_connected(self.id_):
|
||||||
|
self.chat_control.handlers[self.id_].disconnect(self.id_)
|
||||||
|
del self.chat_control.handlers[self.id_]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Image
|
name: Image
|
||||||
short_name: image
|
short_name: image
|
||||||
version: 0.3
|
version: 0.4
|
||||||
description: This plugin is designed to send a small(0 - 40 kb) graphic image to your contact.
|
description: This plugin is designed to send a small(0 - 40 kb) graphic image to your contact.
|
||||||
Client on the other side must support XEP-0071: XHTML-IM and maintain the scheme data: URI.
|
Client on the other side must support XEP-0071: XHTML-IM and maintain the scheme data: URI.
|
||||||
Psi+ and Jabbim supported this.
|
Psi+ and Jabbim supported this.
|
||||||
|
|||||||
Reference in New Issue
Block a user