[length_notifier] 1.4.9

Fix spin setting in config dialog
This commit is contained in:
wurstsalat
2023-11-12 23:47:34 +01:00
parent 73ed25d655
commit 119b70091a
2 changed files with 6 additions and 26 deletions

View File

@@ -18,11 +18,9 @@ from __future__ import annotations
from typing import Any from typing import Any
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from gi.repository import GObject
from gi.repository import Gtk from gi.repository import Gtk
from gajim.gtk.settings import SettingsDialog from gajim.gtk.settings import SettingsDialog
from gajim.gtk.settings import SpinSetting
from gajim.gtk.const import Setting from gajim.gtk.const import Setting
from gajim.gtk.const import SettingKind from gajim.gtk.const import SettingKind
from gajim.gtk.const import SettingType from gajim.gtk.const import SettingType
@@ -42,14 +40,14 @@ class LengthNotifierConfigDialog(SettingsDialog):
self.plugin = plugin self.plugin = plugin
jids = self.plugin.config['JIDS'] or '' jids = self.plugin.config['JIDS'] or ''
settings = [ settings = [
Setting('MessageLengthSpinSetting', # type: ignore Setting(SettingKind.SPIN,
_('Message Length'), _('Message Length'),
SettingType.VALUE, SettingType.VALUE,
self.plugin.config['MESSAGE_WARNING_LENGTH'], str(self.plugin.config['MESSAGE_WARNING_LENGTH']),
callback=self._on_setting, callback=self._on_setting,
data='MESSAGE_WARNING_LENGTH', data='MESSAGE_WARNING_LENGTH',
desc=_('Message length at which the highlight is shown'), desc=_('Message length at which the highlight is shown'),
props={'range_': (1, 1000)}, props={'range_': (1, 1000, 1)},
), ),
Setting(SettingKind.COLOR, Setting(SettingKind.COLOR,
_('Color'), _('Color'),
@@ -74,28 +72,10 @@ class LengthNotifierConfigDialog(SettingsDialog):
_('Length Notifier Configuration'), _('Length Notifier Configuration'),
Gtk.DialogFlags.MODAL, Gtk.DialogFlags.MODAL,
settings, settings,
'', '')
extend=[('MessageLengthSpinSetting', # type: ignore
SizeSpinSetting)])
def _on_setting(self, value: Any, data: Any) -> None: def _on_setting(self, value: Any, data: Any) -> None:
if isinstance(value, str): if isinstance(value, str):
value.strip() value.strip()
self.plugin.config[data] = value self.plugin.config[data] = value
self.plugin.update() self.plugin.update()
class SizeSpinSetting(SpinSetting):
__gproperties__ = {
'setting-value': (int,
'Size',
'',
1,
1000,
140,
GObject.ParamFlags.READWRITE),
}
def __init__(self, *args: Any, **kwargs: Any) -> None:
SpinSetting.__init__(self, *args, **kwargs)

View File

@@ -13,8 +13,8 @@
"win32" "win32"
], ],
"requirements": [ "requirements": [
"gajim>=1.5.0" "gajim>=1.8.2"
], ],
"short_name": "length_notifier", "short_name": "length_notifier",
"version": "1.4.8" "version": "1.4.9"
} }