msg_box_size.py 967 Bytes
Newer Older
1
from functools import partial
Dicson's avatar
Dicson committed
2

3
from gajim.plugins import GajimPlugin
Philipp Hörist's avatar
Philipp Hörist committed
4
from gajim.plugins.plugins_i18n import _
5
from message_box_size.config_dialog import MessageBoxSizeConfigDialog
6

Dicson's avatar
Dicson committed
7 8 9

class MsgBoxSizePlugin(GajimPlugin):
    def init(self):
10
        # pylint: disable=attribute-defined-outside-init
Dicson's avatar
Dicson committed
11
        self.description = _('Allows you to adjust the height'
12 13
                             ' of the message input.')
        self.config_dialog = partial(MessageBoxSizeConfigDialog, self)
Dicson's avatar
Dicson committed
14
        self.gui_extension_points = {
15 16 17 18
            'chat_control_base': (self._on_connect_chat_control,
                                  self._on_disconnect_chat_control)
        }
        self.config_default_values = {'HEIGHT': (20, ''),}
Dicson's avatar
Dicson committed
19

20 21
    def _on_connect_chat_control(self, control):
        control.msg_textview.set_size_request(-1, self.config['HEIGHT'])
Dicson's avatar
Dicson committed
22

23 24 25
    @staticmethod
    def _on_disconnect_chat_control(control):
        control.msg_textview.set_size_request(-1, -1)