Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
73db9f99
by wurstsalat at 2022-12-10T11:24:07+01:00
-
7ee6b8b9
by wurstsalat at 2022-12-10T11:24:33+01:00
-
a9894439
by wurstsalat at 2022-12-10T11:25:05+01:00
-
ba5ef575
by wurstsalat at 2022-12-10T13:12:05+01:00
-
8e7dbb69
by wurstsalat at 2022-12-10T13:12:19+01:00
-
a82b744d
by wurstsalat at 2022-12-10T13:15:55+01:00
-
5131ebf8
by wurstsalat at 2022-12-10T13:15:55+01:00
-
7272cc30
by wurstsalat at 2022-12-10T13:15:55+01:00
-
93e4ed5f
by wurstsalat at 2022-12-10T13:15:55+01:00
-
896be5ed
by wurstsalat at 2022-12-10T13:15:55+01:00
11 changed files:
- gajim/common/styling.py
- gajim/gtk/assistant.py
- gajim/gtk/component_search.py
- gajim/gtk/control.py
- gajim/gtk/filechoosers.py
- gajim/gtk/preferences.py
- gajim/gtk/roster_item_exchange.py
- gajim/gtk/synchronize_accounts.py
- gajim/plugins/gajimplugin.py
- gajim/plugins/pluginmanager.py
- pyproject.toml
Changes:
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | from __future__ import annotations
|
| 16 | 16 | |
| 17 | +from typing import Any
|
|
| 17 | 18 | from typing import Union
|
| 18 | 19 | from typing import Match
|
| 19 | 20 | from typing import Optional
|
| ... | ... | @@ -100,7 +101,7 @@ class MailAddress(BaseHyperlink): |
| 100 | 101 | class Block(StyleObject):
|
| 101 | 102 | |
| 102 | 103 | @classmethod
|
| 103 | - def from_match(cls, match: Match[str]) -> Block:
|
|
| 104 | + def from_match(cls: Any, match: Match[str]) -> Block:
|
|
| 104 | 105 | return cls(start=match.start(),
|
| 105 | 106 | end=match.end(),
|
| 106 | 107 | text=match.group(cls.name))
|
| ... | ... | @@ -23,9 +23,10 @@ |
| 23 | 23 | |
| 24 | 24 | from gi.repository import Gdk
|
| 25 | 25 | from gi.repository import Gtk
|
| 26 | -from gi.repository import Gio
|
|
| 27 | 26 | from gi.repository import GObject
|
| 28 | 27 | |
| 28 | +from gajim.common import app
|
|
| 29 | + |
|
| 29 | 30 | from .builder import get_builder
|
| 30 | 31 | from .util import EventHelper
|
| 31 | 32 | |
| ... | ... | @@ -51,7 +52,7 @@ def __init__(self, |
| 51 | 52 | transition_duration: int = 200) -> None:
|
| 52 | 53 | Gtk.ApplicationWindow.__init__(self)
|
| 53 | 54 | EventHelper.__init__(self)
|
| 54 | - self.set_application(Gio.Application.get_default())
|
|
| 55 | + self.set_application(app.app)
|
|
| 55 | 56 | self.set_position(Gtk.WindowPosition.CENTER)
|
| 56 | 57 | self.set_show_menubar(False)
|
| 57 | 58 | self.set_name('Assistant')
|
| ... | ... | @@ -144,8 +144,8 @@ def _search_result_received(self, |
| 144 | 144 | event: SearchResultReceivedEvent
|
| 145 | 145 | ) -> None:
|
| 146 | 146 | if event.data is None:
|
| 147 | - error_page = cast(Error, self.get_page('error'))
|
|
| 148 | - error_page.set_text(_('Error while receiving search results.'))
|
|
| 147 | + self.get_page('error').set_text(
|
|
| 148 | + _('Error while receiving search results.'))
|
|
| 149 | 149 | self.show_page('error')
|
| 150 | 150 | return
|
| 151 | 151 | |
| ... | ... | @@ -320,7 +320,7 @@ def _on_button_press(self, |
| 320 | 320 | assert store is not None
|
| 321 | 321 | assert path is not None
|
| 322 | 322 | iter_ = store.get_iter(path)
|
| 323 | - column_values = store[iter_]
|
|
| 323 | + column_values = cast(str, store[iter_])
|
|
| 324 | 324 | text = ' '.join(column_values)
|
| 325 | 325 | |
| 326 | 326 | jid = None
|
| ... | ... | @@ -496,7 +496,7 @@ def _on_jump_to_end(self, _button: Gtk.Button) -> None: |
| 496 | 496 | |
| 497 | 497 | def drag_data_file_transfer(self, selection: Gtk.SelectionData) -> None:
|
| 498 | 498 | app.window.activate_action('send-file',
|
| 499 | - GLib.Variant('as', selection.get_uris()))
|
|
| 499 | + GLib.Variant('as', selection.get_uris()))
|
|
| 500 | 500 | |
| 501 | 501 | def get_our_nick(self) -> str:
|
| 502 | 502 | if isinstance(self.contact, GroupchatParticipant):
|
| ... | ... | @@ -48,6 +48,15 @@ def _require_native() -> bool: |
| 48 | 48 | # Notes: Adding mime types to Gtk.FileFilter forces non-native dialogs
|
| 49 | 49 | |
| 50 | 50 | class BaseFileChooser:
|
| 51 | + |
|
| 52 | + _preview_size: tuple[int, int]
|
|
| 53 | + |
|
| 54 | + def add_filter(self, filter: Gtk.FileFilter) -> None:
|
|
| 55 | + pass
|
|
| 56 | + |
|
| 57 | + def set_filter(self, filter: Gtk.FileFilter) -> None:
|
|
| 58 | + pass
|
|
| 59 | + |
|
| 51 | 60 | def _on_response(self,
|
| 52 | 61 | dialog: Union[Gtk.FileChooser, Gtk.FileChooserNative],
|
| 53 | 62 | response: Gtk.ResponseType,
|
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 | |
| 15 | 15 | from __future__ import annotations
|
| 16 | + |
|
| 16 | 17 | from typing import Any
|
| 17 | 18 | from typing import Optional
|
| 18 | 19 | from typing import cast
|
| ... | ... | @@ -118,7 +119,7 @@ def get_ui(self): |
| 118 | 119 | def _add_prefs(self, prefs: list[tuple[str, type[PreferenceBox]]]):
|
| 119 | 120 | for ui_name, klass in prefs:
|
| 120 | 121 | pref_box = getattr(self._ui, ui_name)
|
| 121 | - pref = klass(self)
|
|
| 122 | + pref = klass(self) # pyright: ignore
|
|
| 122 | 123 | pref_box.add(pref)
|
| 123 | 124 | self._prefs[ui_name] = pref
|
| 124 | 125 |
| ... | ... | @@ -142,7 +142,11 @@ def _add(self) -> None: |
| 142 | 142 | self.show_all()
|
| 143 | 143 | assert isinstance(self._model, Gtk.ListStore)
|
| 144 | 144 | iter_ = self._model.append()
|
| 145 | - self._model.set(iter_, 0, True, 1, jid, 2, name, 3, groups)
|
|
| 145 | + self._model.set(iter_,
|
|
| 146 | + {0: True,
|
|
| 147 | + 1: jid,
|
|
| 148 | + 2: name,
|
|
| 149 | + 3: groups})
|
|
| 146 | 150 | |
| 147 | 151 | self._ui.accept_button.set_label(_('Add'))
|
| 148 | 152 | |
| ... | ... | @@ -169,7 +173,11 @@ def _modify(self) -> None: |
| 169 | 173 | self.show_all()
|
| 170 | 174 | assert isinstance(self._model, Gtk.ListStore)
|
| 171 | 175 | iter_ = self._model.append()
|
| 172 | - self._model.set(iter_, 0, True, 1, jid, 2, name, 3, groups)
|
|
| 176 | + self._model.set(iter_,
|
|
| 177 | + {0: True,
|
|
| 178 | + 1: jid,
|
|
| 179 | + 2: name,
|
|
| 180 | + 3: groups})
|
|
| 173 | 181 | |
| 174 | 182 | self._ui.accept_button.set_label(_('Modify'))
|
| 175 | 183 | |
| ... | ... | @@ -190,7 +198,11 @@ def _delete(self) -> None: |
| 190 | 198 | self.show_all()
|
| 191 | 199 | assert isinstance(self._model, Gtk.ListStore)
|
| 192 | 200 | iter_ = self._model.append()
|
| 193 | - self._model.set(iter_, 0, True, 1, jid, 2, name, 3, groups)
|
|
| 201 | + self._model.set(iter_,
|
|
| 202 | + {0: True,
|
|
| 203 | + 1: jid,
|
|
| 204 | + 2: name,
|
|
| 205 | + 3: groups})
|
|
| 194 | 206 | |
| 195 | 207 | self._ui.accept_button.set_label(_('Delete'))
|
| 196 | 208 |
| ... | ... | @@ -100,10 +100,8 @@ def _init_accounts(self) -> None: |
| 100 | 100 | iter_ = model.append()
|
| 101 | 101 | model.set(
|
| 102 | 102 | iter_,
|
| 103 | - 0,
|
|
| 104 | - remote_account,
|
|
| 105 | - 1,
|
|
| 106 | - app.get_hostname_from_account(remote_account))
|
|
| 103 | + {0: remote_account,
|
|
| 104 | + 1: app.get_hostname_from_account(remote_account)})
|
|
| 107 | 105 | |
| 108 | 106 | def _on_next_clicked(self, _button: Gtk.Button) -> None:
|
| 109 | 107 | selection = self._ui.accounts_treeview.get_selection()
|
| ... | ... | @@ -146,7 +144,10 @@ def _init_contacts(self): |
| 146 | 144 | for remote_jid in remote_jid_list:
|
| 147 | 145 | if remote_jid not in local_jid_list:
|
| 148 | 146 | iter_ = model.append()
|
| 149 | - model.set(iter_, 0, True, 1, remote_jid)
|
|
| 147 | + model.set(
|
|
| 148 | + iter_,
|
|
| 149 | + {0: True,
|
|
| 150 | + 1: remote_jid})
|
|
| 150 | 151 | |
| 151 | 152 | def _on_sync_toggled(self, cell: Gtk.CellRendererToggle, path: str) -> None:
|
| 152 | 153 | model = self._ui.contacts_treeview.get_model()
|
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | from gajim.common import configpaths
|
| 24 | 24 | from gajim.common.events import ApplicationEvent
|
| 25 | 25 | from gajim.common.ged import HandlerFuncT
|
| 26 | +from gajim.common.modules.base import BaseModule
|
|
| 26 | 27 | from gajim.common.types import PluginExtensionPoints
|
| 27 | 28 | |
| 28 | 29 | |
| ... | ... | @@ -77,8 +78,8 @@ class GajimPlugin: |
| 77 | 78 | events: list[ApplicationEvent] = []
|
| 78 | 79 | '''
|
| 79 | 80 | New network event classes to be registered in Network Events Controller.
|
| 80 | - |
|
| 81 | 81 | '''
|
| 82 | + modules: list[BaseModule] = []
|
|
| 82 | 83 | |
| 83 | 84 | def __init__(self) -> None:
|
| 84 | 85 | self.config = GajimPluginConfig(self)
|
| ... | ... | @@ -15,7 +15,9 @@ |
| 15 | 15 | from __future__ import annotations
|
| 16 | 16 | |
| 17 | 17 | from typing import Any
|
| 18 | +from typing import Callable
|
|
| 18 | 19 | from typing import Optional
|
| 20 | +from types import TracebackType
|
|
| 19 | 21 | |
| 20 | 22 | import os
|
| 21 | 23 | import sys
|
| ... | ... | @@ -712,7 +714,13 @@ def install_from_zip(self, |
| 712 | 714 | return self.add_plugin(manifest)
|
| 713 | 715 | |
| 714 | 716 | def delete_plugin_files(self, plugin_path: Path) -> None:
|
| 715 | - def on_error(func, path, error):
|
|
| 717 | + ErrorT = tuple[type[BaseException], BaseException, TracebackType]
|
|
| 718 | + |
|
| 719 | + def _on_error(func: Callable[..., Any],
|
|
| 720 | + path: Path,
|
|
| 721 | + error: ErrorT
|
|
| 722 | + ) -> None:
|
|
| 723 | + |
|
| 716 | 724 | if func is os.path.islink:
|
| 717 | 725 | # if symlink
|
| 718 | 726 | os.unlink(path)
|
| ... | ... | @@ -720,7 +728,7 @@ def on_error(func, path, error): |
| 720 | 728 | # access is denied or other
|
| 721 | 729 | raise PluginsystemError(str(error[1]))
|
| 722 | 730 | |
| 723 | - rmtree(plugin_path, False, on_error)
|
|
| 731 | + rmtree(plugin_path, False, _on_error)
|
|
| 724 | 732 | |
| 725 | 733 | def uninstall_plugin(self, plugin: GajimPlugin) -> None:
|
| 726 | 734 | '''
|
| ... | ... | @@ -54,6 +54,7 @@ include = [ |
| 54 | 54 | "gajim/common/setting_values.py",
|
| 55 | 55 | "gajim/common/sound.py",
|
| 56 | 56 | "gajim/common/storage/*",
|
| 57 | + "gajim/common/styling.py",
|
|
| 57 | 58 | "gajim/common/task_manager.py",
|
| 58 | 59 | "gajim/common/text_helpers.py",
|
| 59 | 60 | "gajim/gajim.py",
|
| ... | ... | @@ -66,6 +67,7 @@ include = [ |
| 66 | 67 | "gajim/gtk/app_side_bar.py",
|
| 67 | 68 | "gajim/gtk/application.py",
|
| 68 | 69 | "gajim/gtk/apply_button_box.py",
|
| 70 | + "gajim/gtk/assistant.py",
|
|
| 69 | 71 | "gajim/gtk/avatar.py",
|
| 70 | 72 | "gajim/gtk/avatar_selector.py",
|
| 71 | 73 | "gajim/gtk/blocking.py",
|
| ... | ... | @@ -93,6 +95,7 @@ include = [ |
| 93 | 95 | "gajim/gtk/emoji_data_gtk.py",
|
| 94 | 96 | "gajim/gtk/exception.py",
|
| 95 | 97 | "gajim/gtk/features.py",
|
| 98 | + "gajim/gtk/filechoosers.py",
|
|
| 96 | 99 | "gajim/gtk/file_transfer_selector.py",
|
| 97 | 100 | "gajim/gtk/groupchat_affiliation.py",
|
| 98 | 101 | "gajim/gtk/groupchat_config.py",
|
| ... | ... | @@ -123,6 +126,7 @@ include = [ |
| 123 | 126 | "gajim/gtk/password_dialog.py",
|
| 124 | 127 | "gajim/gtk/pep_config.py",
|
| 125 | 128 | "gajim/gtk/plugins.py",
|
| 129 | + "gajim/gtk/preferences.py",
|
|
| 126 | 130 | "gajim/gtk/preview.py",
|
| 127 | 131 | "gajim/gtk/preview_audio.py",
|
| 128 | 132 | "gajim/gtk/preview_audio_analyzer.py",
|
| ... | ... | @@ -131,6 +135,7 @@ include = [ |
| 131 | 135 | "gajim/gtk/remove_account.py",
|
| 132 | 136 | "gajim/gtk/resource_selector.py",
|
| 133 | 137 | "gajim/gtk/roster.py",
|
| 138 | + "gajim/gtk/roster_item_exchange.py",
|
|
| 134 | 139 | "gajim/gtk/search_view.py",
|
| 135 | 140 | "gajim/gtk/service_registration.py",
|
| 136 | 141 | "gajim/gtk/sidebar_switcher.py",
|
| ... | ... | @@ -139,6 +144,7 @@ include = [ |
| 139 | 144 | "gajim/gtk/status_message_selector.py",
|
| 140 | 145 | "gajim/gtk/status_selector.py",
|
| 141 | 146 | "gajim/gtk/structs.py",
|
| 147 | + "gajim/gtk/synchronize_accounts.py",
|
|
| 142 | 148 | "gajim/gtk/themes.py",
|
| 143 | 149 | "gajim/gtk/tooltips.py",
|
| 144 | 150 | "gajim/gtk/util.py",
|