[message_box_size] 1.4.2
This commit is contained in:
committed by
Philipp Hörist
parent
c400a7f2fc
commit
397e093ace
@@ -28,6 +28,7 @@ class MessageBoxSizeConfigDialog(SettingsDialog):
|
|||||||
|
|
||||||
def on_setting(self, value, data):
|
def on_setting(self, value, data):
|
||||||
self.plugin.config[data] = value
|
self.plugin.config[data] = value
|
||||||
|
self.plugin.set_input_height(value)
|
||||||
|
|
||||||
|
|
||||||
class SizeSpinSetting(SpinSetting):
|
class SizeSpinSetting(SpinSetting):
|
||||||
|
|||||||
@@ -1,25 +1,41 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
from gajim.gui.message_input import MessageInputTextView
|
||||||
|
|
||||||
from gajim.plugins import GajimPlugin
|
from gajim.plugins import GajimPlugin
|
||||||
from gajim.plugins.plugins_i18n import _
|
from gajim.plugins.plugins_i18n import _
|
||||||
|
|
||||||
from message_box_size.config_dialog import MessageBoxSizeConfigDialog
|
from message_box_size.config_dialog import MessageBoxSizeConfigDialog
|
||||||
|
|
||||||
|
|
||||||
class MsgBoxSizePlugin(GajimPlugin):
|
class MsgBoxSizePlugin(GajimPlugin):
|
||||||
def init(self):
|
def init(self) -> None:
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
self.description = _('Allows you to adjust the height'
|
self.description = _('Allows you to adjust the height '
|
||||||
' of the message input.')
|
'of the message input.')
|
||||||
self.config_dialog = partial(MessageBoxSizeConfigDialog, self)
|
self.config_dialog = partial(MessageBoxSizeConfigDialog, self)
|
||||||
self.gui_extension_points = {
|
self.gui_extension_points = {
|
||||||
'chat_control_base': (self._on_connect_chat_control,
|
'message_input': (self._on_message_input_created, None)
|
||||||
self._on_disconnect_chat_control)
|
|
||||||
}
|
}
|
||||||
self.config_default_values = {'HEIGHT': (20, ''),}
|
self.config_default_values = {
|
||||||
|
'HEIGHT': (20, ''),
|
||||||
|
}
|
||||||
|
self._message_input = None
|
||||||
|
|
||||||
def _on_connect_chat_control(self, control):
|
def _on_message_input_created(self,
|
||||||
control.msg_textview.set_size_request(-1, self.config['HEIGHT'])
|
message_input: MessageInputTextView
|
||||||
|
) -> None:
|
||||||
|
|
||||||
@staticmethod
|
self._message_input = message_input
|
||||||
def _on_disconnect_chat_control(control):
|
self.set_input_height(cast(int, self.config['HEIGHT']))
|
||||||
control.msg_textview.set_size_request(-1, -1)
|
|
||||||
|
def deactivate(self) -> None:
|
||||||
|
self.set_input_height(-1)
|
||||||
|
|
||||||
|
def set_input_height(self, height: int) -> None:
|
||||||
|
assert self._message_input is not None
|
||||||
|
self._message_input.set_size_request(-1, height)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
"win32"
|
"win32"
|
||||||
],
|
],
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"gajim>=1.4.0"
|
"gajim>=1.5.0"
|
||||||
],
|
],
|
||||||
"short_name": "message_box_size",
|
"short_name": "message_box_size",
|
||||||
"version": "1.4.1"
|
"version": "1.4.2"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user