[now_listen] Type annotations, linting
This commit is contained in:
@@ -1 +1 @@
|
|||||||
from .now_listen import NowListenPlugin
|
from .now_listen import NowListenPlugin # type: ignore
|
||||||
|
|||||||
@@ -13,18 +13,26 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from gi.repository import Gtk
|
from __future__ import annotations
|
||||||
|
|
||||||
from gajim.gui.settings import SettingsDialog
|
from typing import Any
|
||||||
from gajim.gui.settings import SettingKind
|
from typing import TYPE_CHECKING
|
||||||
from gajim.gui.const import Setting
|
|
||||||
from gajim.gui.const import SettingType
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from gajim.plugins.plugins_i18n import _
|
from gajim.plugins.plugins_i18n import _
|
||||||
|
|
||||||
|
from gajim.gui.const import Setting
|
||||||
|
from gajim.gui.const import SettingKind
|
||||||
|
from gajim.gui.const import SettingType
|
||||||
|
from gajim.gui.settings import SettingsDialog
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..now_listen import NowListenPlugin
|
||||||
|
|
||||||
|
|
||||||
class NowListenConfigDialog(SettingsDialog):
|
class NowListenConfigDialog(SettingsDialog):
|
||||||
def __init__(self, plugin, parent):
|
def __init__(self, plugin: NowListenPlugin, parent: Gtk.Window) -> None:
|
||||||
|
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
settings = [
|
settings = [
|
||||||
@@ -32,11 +40,15 @@ class NowListenConfigDialog(SettingsDialog):
|
|||||||
_('Format string'),
|
_('Format string'),
|
||||||
SettingType.VALUE,
|
SettingType.VALUE,
|
||||||
self.plugin.config['format_string'],
|
self.plugin.config['format_string'],
|
||||||
callback=self.on_setting, data='format_string')
|
callback=self._on_setting, data='format_string')
|
||||||
]
|
]
|
||||||
|
|
||||||
SettingsDialog.__init__(self, parent, _('Now Listen Configuration'),
|
SettingsDialog.__init__(self,
|
||||||
Gtk.DialogFlags.MODAL, settings, None)
|
parent,
|
||||||
|
_('Now Listen Configuration'),
|
||||||
|
Gtk.DialogFlags.MODAL,
|
||||||
|
settings,
|
||||||
|
'')
|
||||||
|
|
||||||
def on_setting(self, value, data):
|
def _on_setting(self, value: Any, data: Any) -> None:
|
||||||
self.plugin.config[data] = value
|
self.plugin.config[data] = value
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ log = logging.getLogger('gajim.p.now_listen')
|
|||||||
|
|
||||||
|
|
||||||
class NowListenPlugin(GajimPlugin):
|
class NowListenPlugin(GajimPlugin):
|
||||||
def init(self):
|
def init(self) -> None:
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
self.description = _('Copy tune info of playing music to conversation '
|
self.description = _('Copy tune info of playing music to conversation '
|
||||||
'input box at cursor position (Alt + N)')
|
'input box at cursor position (Alt + N)')
|
||||||
|
|||||||
Reference in New Issue
Block a user