Skip to content
Snippets Groups Projects
Commit 779ab728 authored by Dicson's avatar Dicson
Browse files

MsgBoxSizePlugin enabled

parent 6164063e
No related branches found
No related tags found
No related merge requests found
[info] [info]
name: Message Box Size name: Message Box Size
short_name: message_box_size short_name: message_box_size
#version: 0.1 version: 0.1
description: Allows you to adjust the height of the new message input field. description: Allows you to adjust the height of the new message input field.
authors: Denis Fomin <fominde@gmail.com> authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/JuickPlugin homepage: http://trac-plugins.gajim.org/wiki/JuickPlugin
...@@ -37,37 +37,24 @@ class MsgBoxSizePlugin(GajimPlugin): ...@@ -37,37 +37,24 @@ class MsgBoxSizePlugin(GajimPlugin):
class Base(object): class Base(object):
def __init__(self, plugin, chat_control): def __init__(self, plugin, chat_control):
if plugin.config['Do_not_resize']: chat_control.msg_textview.set_property('height-request',
chat_control.msg_textview.set_property('height-request', plugin.config['Message_box_size'])
plugin.config['Message_box_size'])
id_ = chat_control.msg_textview.connect('size-request', id_ = chat_control.msg_textview.connect('size-request',
self.size_request) self.size_request)
chat_control.handlers[id_] = chat_control.msg_textview chat_control.handlers[id_] = chat_control.msg_textview
self.chat_control = chat_control self.chat_control = chat_control
self.plugin = plugin self.plugin = plugin
self.scrolledwindow = chat_control.conv_scrolledwindow
def size_request(self, msg_textview, requisition): def size_request(self, msg_textview, requisition):
if msg_textview.window is None:
return
if self.plugin.config['Do_not_resize']: if self.plugin.config['Do_not_resize']:
self.chat_control.conv_scrolledwindow.set_property('height-request',
self.chat_control.conv_scrolledwindow.allocation.height)
self.chat_control.msg_scrolledwindow.set_property( self.chat_control.msg_scrolledwindow.set_property(
'vscrollbar-policy', gtk.POLICY_AUTOMATIC) 'vscrollbar-policy', gtk.POLICY_AUTOMATIC)
elif requisition.height > self.plugin.config['Message_box_size']:
msg_textview.set_property('height-request', requisition.height)
else: else:
if requisition.height < self.plugin.config['Message_box_size']: msg_textview.set_property('height-request',
allc = self.chat_control.msg_textview.allocation self.plugin.config['Message_box_size'])
allc.height = self.plugin.config['Message_box_size']
msg_textview.set_size_request(allc.width, allc.height)
else:
new_req = self.scrolledwindow.allocation.height - (
requisition.height - self.plugin.config['Message_box_size'])
if new_req > 1:
self.scrolledwindow.set_property('height-request', new_req)
self.chat_control.msg_textview.set_property('height-request', -1)
def disconnect_from_chat_control(self): def disconnect_from_chat_control(self):
pass pass
...@@ -82,7 +69,7 @@ class MsgBoxSizePluginConfigDialog(GajimPluginConfigDialog): ...@@ -82,7 +69,7 @@ class MsgBoxSizePluginConfigDialog(GajimPluginConfigDialog):
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['vbox1']) self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['vbox1'])
self.checkbutton = self.xml.get_object('checkbutton') self.checkbutton = self.xml.get_object('checkbutton')
self.spinbutton = self.xml.get_object('message_box_size') self.spinbutton = self.xml.get_object('message_box_size')
self.spinbutton.get_adjustment().set_all(20, 15, 320, 1, 10, 0) self.spinbutton.get_adjustment().set_all(20, 16, 200, 1, 10, 0)
vbox = self.xml.get_object('vbox1') vbox = self.xml.get_object('vbox1')
self.child.pack_start(vbox) self.child.pack_start(vbox)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment