Reformat with ruff format
This commit is contained in:
@@ -106,7 +106,6 @@ def get_dir_list(ftp: FTP_TLS) -> set[str]:
|
|||||||
|
|
||||||
|
|
||||||
def upload_file(ftp: FTP_TLS, filepath: Path) -> None:
|
def upload_file(ftp: FTP_TLS, filepath: Path) -> None:
|
||||||
|
|
||||||
name = filepath.name
|
name = filepath.name
|
||||||
console.print("Upload file", name)
|
console.print("Upload file", name)
|
||||||
with open(filepath, "rb") as f:
|
with open(filepath, "rb") as f:
|
||||||
@@ -114,7 +113,6 @@ def upload_file(ftp: FTP_TLS, filepath: Path) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def create_release_folder(ftp: FTP_TLS, packages_to_publish: list[PackageT]) -> None:
|
def create_release_folder(ftp: FTP_TLS, packages_to_publish: list[PackageT]) -> None:
|
||||||
|
|
||||||
folders = {manifest["short_name"] for manifest, _ in packages_to_publish}
|
folders = {manifest["short_name"] for manifest, _ in packages_to_publish}
|
||||||
dir_list = get_dir_list(ftp)
|
dir_list = get_dir_list(ftp)
|
||||||
missing_folders = folders - dir_list
|
missing_folders = folders - dir_list
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class AcronymsExpanderPlugin(GajimPlugin):
|
|||||||
self._save_acronyms(acronyms)
|
self._save_acronyms(acronyms)
|
||||||
|
|
||||||
def _on_buffer_changed(self, message_input: MessageInputTextView) -> None:
|
def _on_buffer_changed(self, message_input: MessageInputTextView) -> None:
|
||||||
|
|
||||||
if self._contact is None:
|
if self._contact is None:
|
||||||
# If no chat has been activated yet
|
# If no chat has been activated yet
|
||||||
return
|
return
|
||||||
@@ -160,7 +159,6 @@ class AcronymsExpanderPlugin(GajimPlugin):
|
|||||||
end: Gtk.TextIter,
|
end: Gtk.TextIter,
|
||||||
substitute: str,
|
substitute: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
self._replace_in_progress = True
|
self._replace_in_progress = True
|
||||||
buffer_.delete(start, end)
|
buffer_.delete(start, end)
|
||||||
buffer_.insert(start, substitute)
|
buffer_.insert(start, substitute)
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class ConfigBuilder(Gtk.Builder):
|
|||||||
|
|
||||||
class ConfigDialog(GajimAppWindow):
|
class ConfigDialog(GajimAppWindow):
|
||||||
def __init__(self, plugin: AcronymsExpanderPlugin, transient: Gtk.Window) -> None:
|
def __init__(self, plugin: AcronymsExpanderPlugin, transient: Gtk.Window) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="AcronymsConfigDialog",
|
name="AcronymsConfigDialog",
|
||||||
@@ -84,14 +83,12 @@ class ConfigDialog(GajimAppWindow):
|
|||||||
def _on_acronym_edited(
|
def _on_acronym_edited(
|
||||||
self, _renderer: Gtk.CellRendererText, path: str, new_text: str
|
self, _renderer: Gtk.CellRendererText, path: str, new_text: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
iter_ = self._ui.acronyms_store.get_iter(path)
|
iter_ = self._ui.acronyms_store.get_iter(path)
|
||||||
self._ui.acronyms_store.set_value(iter_, 0, new_text)
|
self._ui.acronyms_store.set_value(iter_, 0, new_text)
|
||||||
|
|
||||||
def _on_substitute_edited(
|
def _on_substitute_edited(
|
||||||
self, _renderer: Gtk.CellRendererText, path: str, new_text: str
|
self, _renderer: Gtk.CellRendererText, path: str, new_text: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
iter_ = self._ui.acronyms_store.get_iter(path)
|
iter_ = self._ui.acronyms_store.get_iter(path)
|
||||||
self._ui.acronyms_store.set_value(iter_, 1, new_text)
|
self._ui.acronyms_store.set_value(iter_, 1, new_text)
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ class AntiSpam(BaseModule):
|
|||||||
def _message_received(
|
def _message_received(
|
||||||
self, _con: Client, _stanza: Message, properties: MessageProperties
|
self, _con: Client, _stanza: Message, properties: MessageProperties
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
if properties.is_sent_carbon:
|
if properties.is_sent_carbon:
|
||||||
# Another device already sent a message
|
# Another device already sent a message
|
||||||
assert properties.jid
|
assert properties.jid
|
||||||
@@ -155,7 +154,6 @@ class AntiSpam(BaseModule):
|
|||||||
def _subscribe_received(
|
def _subscribe_received(
|
||||||
self, _con: Client, _stanza: Presence, properties: PresenceProperties
|
self, _con: Client, _stanza: Presence, properties: PresenceProperties
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
msg_from = properties.jid
|
msg_from = properties.jid
|
||||||
assert msg_from is not None
|
assert msg_from is not None
|
||||||
block_sub = self._config["block_subscription_requests"]
|
block_sub = self._config["block_subscription_requests"]
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ class ClientsIconsPlugin(GajimPlugin):
|
|||||||
def _get_image_and_client_name(
|
def _get_image_and_client_name(
|
||||||
self, contact: GroupchatParticipant | ResourceContact, _widget: Gtk.Widget
|
self, contact: GroupchatParticipant | ResourceContact, _widget: Gtk.Widget
|
||||||
) -> tuple[Gtk.Image, str] | None:
|
) -> tuple[Gtk.Image, str] | None:
|
||||||
|
|
||||||
disco_info = app.storage.cache.get_last_disco_info(contact.jid)
|
disco_info = app.storage.cache.get_last_disco_info(contact.jid)
|
||||||
if disco_info is None:
|
if disco_info is None:
|
||||||
return None
|
return None
|
||||||
@@ -86,7 +85,6 @@ class ClientsIconsPlugin(GajimPlugin):
|
|||||||
def _contact_tooltip_resource_populate(
|
def _contact_tooltip_resource_populate(
|
||||||
self, resource_box: Gtk.Box, resource: ResourceContact
|
self, resource_box: Gtk.Box, resource: ResourceContact
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
result = self._get_image_and_client_name(resource, resource_box)
|
result = self._get_image_and_client_name(resource, resource_box)
|
||||||
if result is None:
|
if result is None:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class ClientsIconsConfigDialog(SettingsDialog):
|
class ClientsIconsConfigDialog(SettingsDialog):
|
||||||
def __init__(self, plugin: ClientsIconsPlugin, parent: Gtk.Window) -> None:
|
def __init__(self, plugin: ClientsIconsPlugin, parent: Gtk.Window) -> None:
|
||||||
|
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
settings = [
|
settings = [
|
||||||
Setting(
|
Setting(
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class LengthNotifierConfigDialog(SettingsDialog):
|
class LengthNotifierConfigDialog(SettingsDialog):
|
||||||
def __init__(self, plugin: LengthNotifierPlugin, parent: Gtk.Window) -> None:
|
def __init__(self, plugin: LengthNotifierPlugin, parent: Gtk.Window) -> None:
|
||||||
|
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
jids = self.plugin.config["JIDS"] or ""
|
jids = self.plugin.config["JIDS"] or ""
|
||||||
if isinstance(jids, list):
|
if isinstance(jids, list):
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ Message length notifier plugin.
|
|||||||
:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it>
|
:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it>
|
||||||
:license: GPL
|
:license: GPL
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -71,8 +72,7 @@ class LengthNotifierPlugin(GajimPlugin):
|
|||||||
),
|
),
|
||||||
"JIDS": (
|
"JIDS": (
|
||||||
"",
|
"",
|
||||||
"Enable the plugin for selected XMPP addresses "
|
"Enable the plugin for selected XMPP addresses only (comma separated)",
|
||||||
"only (comma separated)",
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,6 @@ class LengthNotifierPlugin(GajimPlugin):
|
|||||||
def _message_actions_box_created(
|
def _message_actions_box_created(
|
||||||
self, message_actions_box: MessageActionsBox, gtk_box: Gtk.Box
|
self, message_actions_box: MessageActionsBox, gtk_box: Gtk.Box
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
self._message_action_box = message_actions_box
|
self._message_action_box = message_actions_box
|
||||||
self._actions_box_widget = gtk_box
|
self._actions_box_widget = gtk_box
|
||||||
self._create_counter()
|
self._create_counter()
|
||||||
@@ -121,7 +120,6 @@ class Counter(Gtk.Label):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self, message_input: MessageInputTextView, config: GajimPluginConfig
|
self, message_input: MessageInputTextView, config: GajimPluginConfig
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
Gtk.Label.__init__(self)
|
Gtk.Label.__init__(self)
|
||||||
self.set_tooltip_text(_("Number of typed characters"))
|
self.set_tooltip_text(_("Number of typed characters"))
|
||||||
self.add_css_class("dim-label")
|
self.add_css_class("dim-label")
|
||||||
@@ -168,7 +166,6 @@ class Counter(Gtk.Label):
|
|||||||
self._inverted_color = f"rgb({red}, {green}, {blue})"
|
self._inverted_color = f"rgb({red}, {green}, {blue})"
|
||||||
|
|
||||||
def _set_css(self) -> None:
|
def _set_css(self) -> None:
|
||||||
|
|
||||||
css = """
|
css = """
|
||||||
.length-warning {
|
.length-warning {
|
||||||
color: %s;
|
color: %s;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class MessageBoxSizeConfigDialog(SettingsDialog):
|
class MessageBoxSizeConfigDialog(SettingsDialog):
|
||||||
def __init__(self, plugin: MsgBoxSizePlugin, parent: Gtk.Window) -> None:
|
def __init__(self, plugin: MsgBoxSizePlugin, parent: Gtk.Window) -> None:
|
||||||
|
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
settings = [
|
settings = [
|
||||||
Setting(
|
Setting(
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class NowListenConfigDialog(SettingsDialog):
|
class NowListenConfigDialog(SettingsDialog):
|
||||||
def __init__(self, plugin: NowListenPlugin, parent: Gtk.Window) -> None:
|
def __init__(self, plugin: NowListenPlugin, parent: Gtk.Window) -> None:
|
||||||
|
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
settings = [
|
settings = [
|
||||||
Setting(
|
Setting(
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class NowListenPlugin(GajimPlugin):
|
|||||||
_keycode: int,
|
_keycode: int,
|
||||||
state: Gdk.ModifierType,
|
state: Gdk.ModifierType,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
if keyval != Gdk.KEY_n:
|
if keyval != Gdk.KEY_n:
|
||||||
return Gdk.EVENT_PROPAGATE
|
return Gdk.EVENT_PROPAGATE
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,7 @@ class Storage:
|
|||||||
%s
|
%s
|
||||||
PRAGMA user_version=1;
|
PRAGMA user_version=1;
|
||||||
END TRANSACTION;
|
END TRANSACTION;
|
||||||
""" % (
|
""" % (query)
|
||||||
query
|
|
||||||
)
|
|
||||||
self._con.executescript(transaction)
|
self._con.executescript(transaction)
|
||||||
|
|
||||||
def _migrate_database(self) -> None:
|
def _migrate_database(self) -> None:
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ TRUST_DATA = {
|
|||||||
|
|
||||||
class KeyDialog(GajimAppWindow):
|
class KeyDialog(GajimAppWindow):
|
||||||
def __init__(self, account: str, jid: JID, transient: Gtk.Window) -> None:
|
def __init__(self, account: str, jid: JID, transient: Gtk.Window) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="PGPKeyDialog",
|
name="PGPKeyDialog",
|
||||||
@@ -201,7 +200,6 @@ class TrustPopver(Gtk.Popover):
|
|||||||
|
|
||||||
|
|
||||||
class MenuOption(Gtk.ListBoxRow):
|
class MenuOption(Gtk.ListBoxRow):
|
||||||
|
|
||||||
type_: Trust | None
|
type_: Trust | None
|
||||||
icon: str
|
icon: str
|
||||||
label: str
|
label: str
|
||||||
@@ -223,7 +221,6 @@ class MenuOption(Gtk.ListBoxRow):
|
|||||||
|
|
||||||
|
|
||||||
class VerifiedOption(MenuOption):
|
class VerifiedOption(MenuOption):
|
||||||
|
|
||||||
type_ = Trust.VERIFIED
|
type_ = Trust.VERIFIED
|
||||||
icon = "security-high-symbolic"
|
icon = "security-high-symbolic"
|
||||||
label = _("Verified")
|
label = _("Verified")
|
||||||
@@ -234,7 +231,6 @@ class VerifiedOption(MenuOption):
|
|||||||
|
|
||||||
|
|
||||||
class NotTrustedOption(MenuOption):
|
class NotTrustedOption(MenuOption):
|
||||||
|
|
||||||
type_ = Trust.NOT_TRUSTED
|
type_ = Trust.NOT_TRUSTED
|
||||||
icon = "dialog-error-symbolic"
|
icon = "dialog-error-symbolic"
|
||||||
label = _("Not Trusted")
|
label = _("Not Trusted")
|
||||||
@@ -245,7 +241,6 @@ class NotTrustedOption(MenuOption):
|
|||||||
|
|
||||||
|
|
||||||
class DeleteOption(MenuOption):
|
class DeleteOption(MenuOption):
|
||||||
|
|
||||||
type_ = None
|
type_ = None
|
||||||
icon = "user-trash-symbolic"
|
icon = "user-trash-symbolic"
|
||||||
label = _("Delete")
|
label = _("Delete")
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ class KeyWizard(Gtk.Assistant):
|
|||||||
|
|
||||||
|
|
||||||
class WelcomePage(Gtk.Box):
|
class WelcomePage(Gtk.Box):
|
||||||
|
|
||||||
type_ = Gtk.AssistantPageType.INTRO
|
type_ = Gtk.AssistantPageType.INTRO
|
||||||
title = _("Welcome")
|
title = _("Welcome")
|
||||||
complete = True
|
complete = True
|
||||||
@@ -118,7 +117,6 @@ class WelcomePage(Gtk.Box):
|
|||||||
|
|
||||||
|
|
||||||
class RequestPage(Gtk.Box):
|
class RequestPage(Gtk.Box):
|
||||||
|
|
||||||
type_ = Gtk.AssistantPageType.INTRO
|
type_ = Gtk.AssistantPageType.INTRO
|
||||||
title = _("Request OpenPGP Key")
|
title = _("Request OpenPGP Key")
|
||||||
complete = False
|
complete = False
|
||||||
@@ -150,7 +148,6 @@ class RequestPage(Gtk.Box):
|
|||||||
|
|
||||||
|
|
||||||
class NewKeyPage(RequestPage):
|
class NewKeyPage(RequestPage):
|
||||||
|
|
||||||
type_ = Gtk.AssistantPageType.PROGRESS
|
type_ = Gtk.AssistantPageType.PROGRESS
|
||||||
title = _("Generating new Key")
|
title = _("Generating new Key")
|
||||||
complete = False
|
complete = False
|
||||||
@@ -203,7 +200,6 @@ class NewKeyPage(RequestPage):
|
|||||||
|
|
||||||
|
|
||||||
class SuccessfulPage(Gtk.Box):
|
class SuccessfulPage(Gtk.Box):
|
||||||
|
|
||||||
type_ = Gtk.AssistantPageType.SUMMARY
|
type_ = Gtk.AssistantPageType.SUMMARY
|
||||||
title = _("Setup successful")
|
title = _("Setup successful")
|
||||||
complete = True
|
complete = True
|
||||||
@@ -225,7 +221,6 @@ class SuccessfulPage(Gtk.Box):
|
|||||||
|
|
||||||
|
|
||||||
class ErrorPage(Gtk.Box):
|
class ErrorPage(Gtk.Box):
|
||||||
|
|
||||||
type_ = Gtk.AssistantPageType.SUMMARY
|
type_ = Gtk.AssistantPageType.SUMMARY
|
||||||
title = _("Setup failed")
|
title = _("Setup failed")
|
||||||
complete = True
|
complete = True
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ name = ENCRYPTION_NAME
|
|||||||
|
|
||||||
|
|
||||||
class OpenPGP(BaseModule):
|
class OpenPGP(BaseModule):
|
||||||
|
|
||||||
_nbxmpp_extends = "OpenPGP"
|
_nbxmpp_extends = "OpenPGP"
|
||||||
_nbxmpp_methods = [
|
_nbxmpp_methods = [
|
||||||
"set_keylist",
|
"set_keylist",
|
||||||
|
|||||||
@@ -75,10 +75,14 @@ class OpenPGPPlugin(GajimPlugin):
|
|||||||
self.gui_extension_points = {
|
self.gui_extension_points = {
|
||||||
"encrypt" + self.encryption_name: (self._encrypt_message, None),
|
"encrypt" + self.encryption_name: (self._encrypt_message, None),
|
||||||
"send_message" + self.encryption_name: (self._before_sendmessage, None),
|
"send_message" + self.encryption_name: (self._before_sendmessage, None),
|
||||||
"encryption_dialog"
|
"encryption_dialog" + self.encryption_name: (
|
||||||
+ self.encryption_name: (self._on_encryption_button_clicked, None),
|
self._on_encryption_button_clicked,
|
||||||
"encryption_state"
|
None,
|
||||||
+ self.encryption_name: (self._get_encryption_state, None),
|
),
|
||||||
|
"encryption_state" + self.encryption_name: (
|
||||||
|
self._get_encryption_state,
|
||||||
|
None,
|
||||||
|
),
|
||||||
"update_caps": (self._update_caps, None),
|
"update_caps": (self._update_caps, None),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,8 +137,7 @@ class OpenPGPPlugin(GajimPlugin):
|
|||||||
openpgp = self.get_openpgp_module(account)
|
openpgp = self.get_openpgp_module(account)
|
||||||
if openpgp.secret_key_available:
|
if openpgp.secret_key_available:
|
||||||
log.info(
|
log.info(
|
||||||
"%s => Publish keylist and public key "
|
"%s => Publish keylist and public key after plugin activation",
|
||||||
"after plugin activation",
|
|
||||||
account,
|
account,
|
||||||
)
|
)
|
||||||
openpgp.request_keylist()
|
openpgp.request_keylist()
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ class ConfigBuilder(Gtk.Builder):
|
|||||||
|
|
||||||
class PGPConfigDialog(GajimAppWindow):
|
class PGPConfigDialog(GajimAppWindow):
|
||||||
def __init__(self, plugin: PGPPlugin, transient: Gtk.Window) -> None:
|
def __init__(self, plugin: PGPPlugin, transient: Gtk.Window) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="PGPConfigDialog",
|
name="PGPConfigDialog",
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class KeyDialog(GajimAppWindow):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self, plugin: PGPPlugin, account: str, jid: JID, transient: Gtk.Window
|
self, plugin: PGPPlugin, account: str, jid: JID, transient: Gtk.Window
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="PGPKeyDialog",
|
name="PGPKeyDialog",
|
||||||
@@ -128,7 +127,6 @@ class ChooseGPGKeyDialog(GajimAppWindow):
|
|||||||
transient: Gtk.Window,
|
transient: Gtk.Window,
|
||||||
callback: Callable[[tuple[str, str] | None], None],
|
callback: Callable[[tuple[str, str] | None], None],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="PGPChooseKeyDialog",
|
name="PGPChooseKeyDialog",
|
||||||
|
|||||||
@@ -213,7 +213,6 @@ class PGPLegacy(BaseModule):
|
|||||||
callback: Callable[[OutgoingMessage], None],
|
callback: Callable[[OutgoingMessage], None],
|
||||||
always_trust: bool,
|
always_trust: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
text = message.get_text()
|
text = message.get_text()
|
||||||
assert text is not None
|
assert text is not None
|
||||||
|
|
||||||
@@ -263,7 +262,6 @@ class PGPLegacy(BaseModule):
|
|||||||
def _raise_message_not_sent(
|
def _raise_message_not_sent(
|
||||||
client: Client, message: OutgoingMessage, error: str
|
client: Client, message: OutgoingMessage, error: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
text = message.get_text()
|
text = message.get_text()
|
||||||
assert text is not None
|
assert text is not None
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ if BINARY is None or error:
|
|||||||
|
|
||||||
|
|
||||||
class PGPPlugin(GajimPlugin):
|
class PGPPlugin(GajimPlugin):
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.description = _("PGP encryption as per XEP-0027")
|
self.description = _("PGP encryption as per XEP-0027")
|
||||||
if error_msg:
|
if error_msg:
|
||||||
@@ -140,7 +139,6 @@ class PGPPlugin(GajimPlugin):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _on_not_trusted(event: PGPNotTrusted) -> None:
|
def _on_not_trusted(event: PGPNotTrusted) -> None:
|
||||||
|
|
||||||
def _on_response(response_id: str, do_not_ask_again: bool) -> None:
|
def _on_response(response_id: str, do_not_ask_again: bool) -> None:
|
||||||
if response_id == "accept":
|
if response_id == "accept":
|
||||||
event.on_yes(do_not_ask_again)
|
event.on_yes(do_not_ask_again)
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class ConfigBuilder(Gtk.Builder):
|
|||||||
|
|
||||||
class ConfigDialog(GajimAppWindow):
|
class ConfigDialog(GajimAppWindow):
|
||||||
def __init__(self, plugin: QuickRepliesPlugin, transient: Gtk.Window) -> None:
|
def __init__(self, plugin: QuickRepliesPlugin, transient: Gtk.Window) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="QuickRepliesConfigDialog",
|
name="QuickRepliesConfigDialog",
|
||||||
@@ -90,7 +89,6 @@ class ConfigDialog(GajimAppWindow):
|
|||||||
def _on_reply_edited(
|
def _on_reply_edited(
|
||||||
self, _renderer: Gtk.CellRendererText, path: str, new_text: str
|
self, _renderer: Gtk.CellRendererText, path: str, new_text: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
iter_ = self._ui.replies_store.get_iter(path)
|
iter_ = self._ui.replies_store.get_iter(path)
|
||||||
self._ui.replies_store.set_value(iter_, 0, new_text)
|
self._ui.replies_store.set_value(iter_, 0, new_text)
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class QuickRepliesPlugin(GajimPlugin):
|
|||||||
def _message_actions_box_created(
|
def _message_actions_box_created(
|
||||||
self, message_actions_box: MessageActionsBox, gtk_box: Gtk.Box
|
self, message_actions_box: MessageActionsBox, gtk_box: Gtk.Box
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
for action in self._actions:
|
for action in self._actions:
|
||||||
app.window.add_action(action)
|
app.window.add_action(action)
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ def parse(path: Path) -> tuple[str, str]:
|
|||||||
continue
|
continue
|
||||||
klass = node.attrib["class"]
|
klass = node.attrib["class"]
|
||||||
if klass.startswith("GtkSource"):
|
if klass.startswith("GtkSource"):
|
||||||
klass = f'GtkSource.{klass.removeprefix("GtkSource")}'
|
klass = f"GtkSource.{klass.removeprefix('GtkSource')}"
|
||||||
elif klass.startswith("Atk"):
|
elif klass.startswith("Atk"):
|
||||||
klass = f'Atk.{klass.removeprefix("Atk")}'
|
klass = f"Atk.{klass.removeprefix('Atk')}"
|
||||||
else:
|
else:
|
||||||
klass = f'Gtk.{klass.removeprefix("Gtk")}'
|
klass = f"Gtk.{klass.removeprefix('Gtk')}"
|
||||||
|
|
||||||
lines.append(ATTR % (id_.replace("-", "_"), klass))
|
lines.append(ATTR % (id_.replace("-", "_"), klass))
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ class ConfigBuilder(Gtk.Builder):
|
|||||||
|
|
||||||
class ConfigDialog(GajimAppWindow):
|
class ConfigDialog(GajimAppWindow):
|
||||||
def __init__(self, plugin: Triggers, transient: Gtk.Window) -> None:
|
def __init__(self, plugin: Triggers, transient: Gtk.Window) -> None:
|
||||||
|
|
||||||
GajimAppWindow.__init__(
|
GajimAppWindow.__init__(
|
||||||
self,
|
self,
|
||||||
name="TriggersConfigDialog",
|
name="TriggersConfigDialog",
|
||||||
@@ -467,7 +466,6 @@ class ConfigDialog(GajimAppWindow):
|
|||||||
self._set_treeview_string()
|
self._set_treeview_string()
|
||||||
|
|
||||||
def _on_recipient_type_combobox_changed(self, widget: Gtk.ComboBox) -> None:
|
def _on_recipient_type_combobox_changed(self, widget: Gtk.ComboBox) -> None:
|
||||||
|
|
||||||
if self._active_num < 0:
|
if self._active_num < 0:
|
||||||
return
|
return
|
||||||
recipient_type = RECIPIENT_TYPES[widget.get_active()]
|
recipient_type = RECIPIENT_TYPES[widget.get_active()]
|
||||||
@@ -578,7 +576,6 @@ class ConfigDialog(GajimAppWindow):
|
|||||||
def _on_use_it_toggled(
|
def _on_use_it_toggled(
|
||||||
self, widget: Gtk.CheckButton, opposite_widget: Gtk.CheckButton, option: str
|
self, widget: Gtk.CheckButton, opposite_widget: Gtk.CheckButton, option: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
if opposite_widget.get_active():
|
if opposite_widget.get_active():
|
||||||
opposite_widget.set_active(False)
|
opposite_widget.set_active(False)
|
||||||
@@ -591,7 +588,6 @@ class ConfigDialog(GajimAppWindow):
|
|||||||
def _on_disable_it_toggled(
|
def _on_disable_it_toggled(
|
||||||
self, widget: Gtk.CheckButton, opposite_widget: Gtk.CheckButton, option: str
|
self, widget: Gtk.CheckButton, opposite_widget: Gtk.CheckButton, option: str
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
if opposite_widget.get_active():
|
if opposite_widget.get_active():
|
||||||
opposite_widget.set_active(False)
|
opposite_widget.set_active(False)
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ class Triggers(GajimPlugin):
|
|||||||
check_func: Callable[..., bool],
|
check_func: Callable[..., bool],
|
||||||
apply_func: Callable[..., Any],
|
apply_func: Callable[..., Any],
|
||||||
) -> RuleResult:
|
) -> RuleResult:
|
||||||
|
|
||||||
result = RuleResult()
|
result = RuleResult()
|
||||||
|
|
||||||
rules_num = [int(item) for item in self.config]
|
rules_num = [int(item) for item in self.config]
|
||||||
@@ -290,7 +289,6 @@ class Triggers(GajimPlugin):
|
|||||||
def _excecute_notification_rules(
|
def _excecute_notification_rules(
|
||||||
self, result: RuleResult, event: Notification
|
self, result: RuleResult, event: Notification
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
if result.sound is False:
|
if result.sound is False:
|
||||||
event.sound = None
|
event.sound = None
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,11 @@ class _ReadableFile(Protocol):
|
|||||||
def read(self, size: int) -> bytes: ...
|
def read(self, size: int) -> bytes: ...
|
||||||
|
|
||||||
class StatusHandler:
|
class StatusHandler:
|
||||||
|
|
||||||
on_data_failure: Exception | None = ...
|
on_data_failure: Exception | None = ...
|
||||||
def __init__(self, gpg: GPG) -> None: ...
|
def __init__(self, gpg: GPG) -> None: ...
|
||||||
def handle_status(self, key: str, value: str) -> None: ...
|
def handle_status(self, key: str, value: str) -> None: ...
|
||||||
|
|
||||||
class Verify(StatusHandler):
|
class Verify(StatusHandler):
|
||||||
|
|
||||||
TRUST_EXPIRED: int = ...
|
TRUST_EXPIRED: int = ...
|
||||||
TRUST_UNDEFINED: int = ...
|
TRUST_UNDEFINED: int = ...
|
||||||
TRUST_NEVER: int = ...
|
TRUST_NEVER: int = ...
|
||||||
@@ -74,7 +72,6 @@ class ImportResultDict(TypedDict):
|
|||||||
text: str
|
text: str
|
||||||
|
|
||||||
class ImportResult(StatusHandler):
|
class ImportResult(StatusHandler):
|
||||||
|
|
||||||
counts: list[str] = ...
|
counts: list[str] = ...
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
results: list[ImportResultDict]
|
results: list[ImportResultDict]
|
||||||
@@ -92,12 +89,10 @@ ESCAPE_PATTERN: re.Pattern[Any] = ...
|
|||||||
BASIC_ESCAPES: dict[str, str] = ...
|
BASIC_ESCAPES: dict[str, str] = ...
|
||||||
|
|
||||||
class SendResult(StatusHandler):
|
class SendResult(StatusHandler):
|
||||||
|
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
def handle_status(self, key: str, value: str) -> None: ...
|
def handle_status(self, key: str, value: str) -> None: ...
|
||||||
|
|
||||||
class SearchKeys(StatusHandler, list[dict[Any, Any]]):
|
class SearchKeys(StatusHandler, list[dict[Any, Any]]):
|
||||||
|
|
||||||
UID_INDEX: int = ...
|
UID_INDEX: int = ...
|
||||||
FIELDS: list[str] = ...
|
FIELDS: list[str] = ...
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
@@ -108,7 +103,6 @@ class SearchKeys(StatusHandler, list[dict[Any, Any]]):
|
|||||||
def handle_status(self, key: str, value: str) -> None: ...
|
def handle_status(self, key: str, value: str) -> None: ...
|
||||||
|
|
||||||
class ListKeys(SearchKeys):
|
class ListKeys(SearchKeys):
|
||||||
|
|
||||||
UID_INDEX: int = ...
|
UID_INDEX: int = ...
|
||||||
FIELDS: list[str] = ...
|
FIELDS: list[str] = ...
|
||||||
def __init__(self, gpg: GPG) -> None: ...
|
def __init__(self, gpg: GPG) -> None: ...
|
||||||
@@ -126,7 +120,6 @@ class ScanKeys(ListKeys):
|
|||||||
class TextHandler: ...
|
class TextHandler: ...
|
||||||
|
|
||||||
class Crypt(Verify, TextHandler):
|
class Crypt(Verify, TextHandler):
|
||||||
|
|
||||||
data: bytes
|
data: bytes
|
||||||
ok: bool
|
ok: bool
|
||||||
status_detail: str
|
status_detail: str
|
||||||
@@ -137,7 +130,6 @@ class Crypt(Verify, TextHandler):
|
|||||||
def handle_status(self, key: str, value: str) -> None: ...
|
def handle_status(self, key: str, value: str) -> None: ...
|
||||||
|
|
||||||
class GenKey(StatusHandler):
|
class GenKey(StatusHandler):
|
||||||
|
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
def __init__(self, gpg: GPG) -> None: ...
|
def __init__(self, gpg: GPG) -> None: ...
|
||||||
def __nonzero__(self) -> bool: ...
|
def __nonzero__(self) -> bool: ...
|
||||||
@@ -145,7 +137,6 @@ class GenKey(StatusHandler):
|
|||||||
def handle_status(self, key: str, value: str) -> None: ...
|
def handle_status(self, key: str, value: str) -> None: ...
|
||||||
|
|
||||||
class AddSubkey(StatusHandler):
|
class AddSubkey(StatusHandler):
|
||||||
|
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
def __init__(self, gpg: GPG) -> None: ...
|
def __init__(self, gpg: GPG) -> None: ...
|
||||||
def __nonzero__(self) -> bool: ...
|
def __nonzero__(self) -> bool: ...
|
||||||
@@ -156,7 +147,6 @@ class ExportResult(GenKey):
|
|||||||
def handle_status(self, key: str, value: str) -> None: ...
|
def handle_status(self, key: str, value: str) -> None: ...
|
||||||
|
|
||||||
class DeleteResult(StatusHandler):
|
class DeleteResult(StatusHandler):
|
||||||
|
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
def __init__(self, gpg: GPG) -> None: ...
|
def __init__(self, gpg: GPG) -> None: ...
|
||||||
|
|
||||||
@@ -168,7 +158,6 @@ class DeleteResult(StatusHandler):
|
|||||||
class TrustResult(DeleteResult): ...
|
class TrustResult(DeleteResult): ...
|
||||||
|
|
||||||
class Sign(StatusHandler, TextHandler):
|
class Sign(StatusHandler, TextHandler):
|
||||||
|
|
||||||
returncode: int | None = ...
|
returncode: int | None = ...
|
||||||
def __init__(self, gpg: GPG) -> None: ...
|
def __init__(self, gpg: GPG) -> None: ...
|
||||||
def __nonzero__(self) -> bool: ...
|
def __nonzero__(self) -> bool: ...
|
||||||
@@ -188,7 +177,6 @@ HEX_DIGITS_RE: re.Pattern[Any] = ...
|
|||||||
PUBLIC_KEY_RE: re.Pattern[Any] = ...
|
PUBLIC_KEY_RE: re.Pattern[Any] = ...
|
||||||
|
|
||||||
class GPG:
|
class GPG:
|
||||||
|
|
||||||
error_map: None = ...
|
error_map: None = ...
|
||||||
decode_errors: str = ...
|
decode_errors: str = ...
|
||||||
buffer_size: int = ...
|
buffer_size: int = ...
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
class GpgError(Exception):
|
class GpgError(Exception):
|
||||||
|
|
||||||
error: Any | None
|
error: Any | None
|
||||||
context: str | None
|
context: str | None
|
||||||
result: Any | None
|
result: Any | None
|
||||||
|
|||||||
Reference in New Issue
Block a user