Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
ac58d884 by wurstsalat at 2024-06-18T00:13:42+02:00
fix: DebugConsole: Fix filtering stanzas when combining accounts and types
- - - - -
1 changed file:
- gajim/gtk/debug_console.py
Changes:
=====================================
gajim/gtk/debug_console.py
=====================================
@@ -456,42 +456,51 @@ def _on_filter_destroyed(self, _widget: Gtk.Widget) ->
None:
def _on_clear(self, _button: Gtk.Button) -> None:
self._ui.protocol_view.get_buffer().set_text('')
- def _set_account(self, value: str, _data: Any) -> None:
- self._selected_account = value
- self._set_titlebar()
+ def _apply_filters(self) -> None:
+ table = self._ui.protocol_view.get_buffer().get_tag_table()
active_accounts = app.settings.get_active_accounts()
active_accounts.append('AccountWizard')
-
- table = self._ui.protocol_view.get_buffer().get_tag_table()
-
- if value == 'AllAccounts':
- for account in active_accounts:
- tag = table.lookup(account)
- if tag is not None:
- tag.set_property('invisible', False)
- return
-
for account in active_accounts:
tag = table.lookup(account)
- if tag is not None:
- tag.set_property('invisible', account != value)
+ if tag is None:
+ continue
- def _on_setting(self, value: bool, data: str) -> None:
- setattr(self, f'_{data}', value)
- value = not value
- table = self._ui.protocol_view.get_buffer().get_tag_table()
- tag = table.lookup(data)
- if tag is None:
- return
-
- if data in ('incoming', 'outgoing'):
- if value:
- tag.set_priority(table.get_size() - 1)
+ if self._selected_account == 'AllAccounts':
+ visible = True
else:
+ visible = account == self._selected_account
+
+ if visible:
tag.set_priority(0)
+ else:
+ tag.set_priority(table.get_size() - 1)
+
+ tag.set_property('invisible', not visible)
+
+ for data in ['presence', 'message', 'iq', 'stream', 'incoming',
'outgoing']:
+ visible = getattr(self, f'_{data}')
+
+ tag = table.lookup(data)
+ if tag is None:
+ continue
+
+ if data in ('incoming', 'outgoing'):
+ if visible:
+ tag.set_priority(0)
+ else:
+ tag.set_priority(table.get_size() - 1)
- tag.set_property('invisible', value)
+ tag.set_property('invisible', not visible)
+
+ def _set_account(self, value: str, _data: Any) -> None:
+ self._selected_account = value
+ self._set_titlebar()
+ self._apply_filters()
+
+ def _on_setting(self, value: bool, data: str) -> None:
+ setattr(self, f'_{data}', value)
+ self._apply_filters()
def _on_stanza_received(self, event: StanzaReceived):
self._print_stanza(event, 'incoming')
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ac58d8849f7cb3b269d5c76a39f23dd659ebbdd3
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ac58d8849f7cb3b269d5c76a39f23dd659ebbdd3
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]