Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2022-11-29 21:32:39 +0300
committerwurstsalat <mailtrash@posteo.de>2022-11-29 21:32:39 +0300
commit07fe999b95ffe49737c7b7d51fabb5bae58a5780 (patch)
tree53bde28b3de4a1e6f9bed3031463f73727f128dc /length_notifier/config_dialog.py
parent7de69ca41549a3c8b4fc538be10465bbfba181d8 (diff)
[length_notifier] Type annotations, linting
Diffstat (limited to 'length_notifier/config_dialog.py')
-rw-r--r--length_notifier/config_dialog.py38
1 files changed, 28 insertions, 10 deletions
diff --git a/length_notifier/config_dialog.py b/length_notifier/config_dialog.py
index dbfe8ea..7e1c096 100644
--- a/length_notifier/config_dialog.py
+++ b/length_notifier/config_dialog.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-#
# This file is part of Gajim.
#
# Gajim is free software: you can redistribute it and/or modify
@@ -15,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import annotations
+
+from typing import Any
+from typing import TYPE_CHECKING
+
from gi.repository import GObject
from gi.repository import Gtk
@@ -26,13 +29,20 @@ from gajim.gui.const import SettingType
from gajim.plugins.plugins_i18n import _
+if TYPE_CHECKING:
+ from .length_notifier import LengthNotifierPlugin
+
class LengthNotifierConfigDialog(SettingsDialog):
- def __init__(self, plugin, parent):
+ def __init__(self,
+ plugin: LengthNotifierPlugin,
+ parent: Gtk.Window
+ ) -> None:
+
self.plugin = plugin
jids = self.plugin.config['JIDS'] or ''
settings = [
- Setting('MessageLengthSpinSetting',
+ Setting('MessageLengthSpinSetting', # type: ignore
_('Message Length'),
SettingType.VALUE,
self.plugin.config['MESSAGE_WARNING_LENGTH'],
@@ -62,11 +72,13 @@ class LengthNotifierConfigDialog(SettingsDialog):
SettingsDialog.__init__(self, parent,
_('Length Notifier Configuration'),
- Gtk.DialogFlags.MODAL, settings, None,
- extend=[('MessageLengthSpinSetting',
+ Gtk.DialogFlags.MODAL,
+ settings,
+ '',
+ extend=[('MessageLengthSpinSetting', # type: ignore
SizeSpinSetting)])
- def _on_setting(self, value, data):
+ def _on_setting(self, value: Any, data: Any) -> None:
if isinstance(value, str):
value.strip()
self.plugin.config[data] = value
@@ -76,8 +88,14 @@ class LengthNotifierConfigDialog(SettingsDialog):
class SizeSpinSetting(SpinSetting):
__gproperties__ = {
- "setting-value": (int, 'Size', '', 1, 1000, 140,
- GObject.ParamFlags.READWRITE), }
+ 'setting-value': (int,
+ 'Size',
+ '',
+ 1,
+ 1000,
+ 140,
+ GObject.ParamFlags.READWRITE),
+ }
- def __init__(self, *args, **kwargs):
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
SpinSetting.__init__(self, *args, **kwargs)