cq: Format with black and isort
This commit is contained in:
@@ -21,11 +21,10 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from gajim.gtk.settings import SettingsDialog
|
||||
from gajim.gtk.const import Setting
|
||||
from gajim.gtk.const import SettingKind
|
||||
from gajim.gtk.const import SettingType
|
||||
|
||||
from gajim.gtk.settings import SettingsDialog
|
||||
from gajim.plugins.plugins_i18n import _
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -37,22 +36,26 @@ class MessageBoxSizeConfigDialog(SettingsDialog):
|
||||
|
||||
self.plugin = plugin
|
||||
settings = [
|
||||
Setting(SettingKind.SPIN,
|
||||
_('Height in pixels'),
|
||||
SettingType.VALUE,
|
||||
str(self.plugin.config['HEIGHT']),
|
||||
callback=self._on_setting,
|
||||
data='HEIGHT',
|
||||
desc=_('Size of message input in pixels'),
|
||||
props={'range_': (20, 200, 1)}),
|
||||
]
|
||||
Setting(
|
||||
SettingKind.SPIN,
|
||||
_("Height in pixels"),
|
||||
SettingType.VALUE,
|
||||
str(self.plugin.config["HEIGHT"]),
|
||||
callback=self._on_setting,
|
||||
data="HEIGHT",
|
||||
desc=_("Size of message input in pixels"),
|
||||
props={"range_": (20, 200, 1)},
|
||||
),
|
||||
]
|
||||
|
||||
SettingsDialog.__init__(self,
|
||||
parent,
|
||||
_('Message Box Size Configuration'),
|
||||
Gtk.DialogFlags.MODAL,
|
||||
settings,
|
||||
'')
|
||||
SettingsDialog.__init__(
|
||||
self,
|
||||
parent,
|
||||
_("Message Box Size Configuration"),
|
||||
Gtk.DialogFlags.MODAL,
|
||||
settings,
|
||||
"",
|
||||
)
|
||||
|
||||
def _on_setting(self, value: Any, data: Any) -> None:
|
||||
self.plugin.config[data] = value
|
||||
|
||||
@@ -21,7 +21,6 @@ from typing import cast
|
||||
from functools import partial
|
||||
|
||||
from gajim.gtk.message_input import MessageInputTextView
|
||||
|
||||
from gajim.plugins import GajimPlugin
|
||||
from gajim.plugins.plugins_i18n import _
|
||||
|
||||
@@ -31,23 +30,20 @@ from message_box_size.config_dialog import MessageBoxSizeConfigDialog
|
||||
class MsgBoxSizePlugin(GajimPlugin):
|
||||
def init(self) -> None:
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
self.description = _('Allows you to adjust the height '
|
||||
'of the message input.')
|
||||
self.description = _("Allows you to adjust the height " "of the message input.")
|
||||
self.config_dialog = partial(MessageBoxSizeConfigDialog, self)
|
||||
self.gui_extension_points = {
|
||||
'message_input': (self._on_message_input_created, None)
|
||||
"message_input": (self._on_message_input_created, None)
|
||||
}
|
||||
self.config_default_values = {
|
||||
'HEIGHT': (20, ''),
|
||||
"HEIGHT": (20, ""),
|
||||
}
|
||||
self._message_input = None
|
||||
|
||||
def _on_message_input_created(self,
|
||||
message_input: MessageInputTextView
|
||||
) -> None:
|
||||
def _on_message_input_created(self, message_input: MessageInputTextView) -> None:
|
||||
|
||||
self._message_input = message_input
|
||||
self.set_input_height(cast(int, self.config['HEIGHT']))
|
||||
self.set_input_height(cast(int, self.config["HEIGHT"]))
|
||||
|
||||
def deactivate(self) -> None:
|
||||
self.set_input_height(-1)
|
||||
|
||||
Reference in New Issue
Block a user