Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3e0bdbf8 by lovetox at 2020-09-06T20:28:16+02:00
Add helper method get_group_chat_nick()
- - - - -
2 changed files:
- gajim/common/helpers.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/common/helpers.py
=====================================
@@ -1430,3 +1430,16 @@ def ask_for_status_message(status, signin=False):
return app.settings.get('ask_offline_status')
return app.settings.get('always_ask_for_status_message')
+
+
+def get_group_chat_nick(account, room_jid):
+ nick = app.nicks[account]
+
+ client = app.get_client(account)
+
+ bookmark = client.get_module('Bookmarks').get_bookmark(room_jid)
+ if bookmark is not None:
+ if bookmark.nick is not None:
+ nick = bookmark.nick
+
+ return nick
=====================================
gajim/gui_interface.py
=====================================
@@ -76,6 +76,7 @@ from gajim.common import helpers
from gajim.common import passwords
from gajim.common import logging_helpers
from gajim.common.helpers import ask_for_status_message
+from gajim.common.helpers import get_group_chat_nick
from gajim.common.structs import MUCData
from gajim.common.nec import NetworkEvent
from gajim.common.i18n import _
@@ -1347,15 +1348,12 @@ class Interface:
@staticmethod
def _create_muc_data(account, room_jid, nick, password, config):
if not nick:
- nick = app.nicks[account]
+ nick = get_group_chat_nick(account, room_jid)
# Fetch data from bookmarks
- con = app.connections[account]
- bookmark = con.get_module('Bookmarks').get_bookmark(room_jid)
+ client = app.get_client(account)
+ bookmark = client.get_module('Bookmarks').get_bookmark(room_jid)
if bookmark is not None:
- if bookmark.nick is not None:
- nick = bookmark.nick
-
if bookmark.password is not None:
password = bookmark.password
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3e0bdbf8a4a52dde0ccfdd8192817ba6…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3e0bdbf8a4a52dde0ccfdd8192817ba6…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
da425e41 by lovetox at 2020-09-06T18:35:17+02:00
ChatControlBase: Fix infinite recursion
If the input textview is not sensitive it can’t get the focus. In that case propagate_key_event() would send the event again to the conversation textview. This would mean a recursion.
Fixes #10259
- - - - -
1 changed file:
- gajim/chat_control_base.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -266,6 +266,12 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
if textview.get_buffer().props.has_selection:
return Gdk.EVENT_PROPAGATE
+ if not self.msg_textview.get_sensitive():
+ # If the input textview is not sensitive it can’t get the focus.
+ # In that case propagate_key_event() would send the event again
+ # to the conversation textview. This would mean a recursion.
+ return Gdk.EVENT_PROPAGATE
+
# Focus the Message Input and resend the event
textview.unselect()
self.msg_textview.grab_focus()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/da425e411bd585ab2b3e1267dba62ff3…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/da425e411bd585ab2b3e1267dba62ff3…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3befd602 by lovetox at 2020-09-06T16:19:10+02:00
Settings: Allow bind_signal() to be inverted
- - - - -
2 changed files:
- gajim/common/settings.py
- gajim/gtk/settings.py
Changes:
=====================================
gajim/common/settings.py
=====================================
@@ -27,7 +27,6 @@ from pathlib import Path
from collections import namedtuple
from collections import defaultdict
-from gi.module import FunctionInfo
from gi.repository import GLib
from gajim import IS_PORTABLE
@@ -93,19 +92,26 @@ class _Settings:
def disconnect_signals(self, object_):
for _, handlers in self._callbacks.items():
for handler in list(handlers):
- if isinstance(handler, FunctionInfo):
+ if isinstance(handler, tuple):
continue
func = handler()
if func is None or func.__self__ is object_:
handlers.remove(handler)
- def bind_signal(self, setting, widget, func_name, account=None, jid=None):
+ def bind_signal(self,
+ setting,
+ widget,
+ func_name,
+ account=None,
+ jid=None,
+ inverted=False):
+
callbacks = self._callbacks[(setting, account, jid)]
func = getattr(widget, func_name)
- callbacks.append(func)
+ callbacks.append((func, inverted))
def _on_destroy(*args):
- callbacks.remove(func)
+ callbacks.remove((func, inverted))
widget.connect('destroy', _on_destroy)
@@ -114,7 +120,11 @@ class _Settings:
callbacks = self._callbacks[(setting, account, jid)]
for func in list(callbacks):
- if isinstance(func, FunctionInfo):
+ if isinstance(func, tuple):
+ func, inverted = func
+ if inverted:
+ value = not value
+
try:
func(value)
except Exception:
=====================================
gajim/gtk/settings.py
=====================================
@@ -195,16 +195,17 @@ class GenericSetting(Gtk.ListBoxRow):
if self.bind is None:
return
- app.settings.connect_signal(self.bind,
- self._on_setting_changed,
- account=self.account)
-
- value = app.settings.get_account_setting(self.account, self.bind)
- if self.inverted:
- value = not value
- self.set_sensitive(value)
+ app.settings.bind_signal(self.bind,
+ self,
+ 'set_sensitive',
+ account=self.account,
+ inverted=self.inverted)
+
+ if self.account is not None:
+ value = app.settings.get_account_setting(self.account, self.bind)
+ else:
+ value = app.settings.get(self.bind)
- def _on_setting_changed(self, value, *args):
if self.inverted:
value = not value
self.set_sensitive(value)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3befd6022a35eabb3e64c21c89b13911…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3befd6022a35eabb3e64c21c89b13911…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
6ab6bdaf by lovetox at 2020-09-06T12:19:14+02:00
Settings: Add bind_signal()
This allows to bind the value of a specific setting to a widget method
like set_sensitive() or set_visible()
- - - - -
738723c6 by lovetox at 2020-09-06T12:19:14+02:00
Settings: Pass func as string
- - - - -
1 changed file:
- gajim/common/settings.py
Changes:
=====================================
gajim/common/settings.py
=====================================
@@ -27,6 +27,7 @@ from pathlib import Path
from collections import namedtuple
from collections import defaultdict
+from gi.module import FunctionInfo
from gi.repository import GLib
from gajim import IS_PORTABLE
@@ -85,26 +86,51 @@ class _Settings:
# remove the func once it should not be called anymore
raise ValueError('Only bound methods can be connected')
+
func = weakref.WeakMethod(func)
self._callbacks[(setting, account, jid)].append(func)
def disconnect_signals(self, object_):
for _, handlers in self._callbacks.items():
for handler in list(handlers):
+ if isinstance(handler, FunctionInfo):
+ continue
func = handler()
if func is None or func.__self__ is object_:
handlers.remove(handler)
+ def bind_signal(self, setting, widget, func_name, account=None, jid=None):
+ callbacks = self._callbacks[(setting, account, jid)]
+ func = getattr(widget, func_name)
+ callbacks.append(func)
+
+ def _on_destroy(*args):
+ callbacks.remove(func)
+
+ widget.connect('destroy', _on_destroy)
+
def _notify(self, value, setting, account=None, jid=None):
log.info('Signal: %s changed', setting)
callbacks = self._callbacks[(setting, account, jid)]
for func in list(callbacks):
+ if isinstance(func, FunctionInfo):
+ try:
+ func(value)
+ except Exception:
+ log.exception('Error while executing signal callback')
+ continue
+
if func() is None:
callbacks.remove(func)
continue
+
+ func = func()
+ if func is None:
+ continue
+
try:
- func()(value, setting, account, jid)
+ func(value, setting, account, jid)
except Exception:
log.exception('Error while executing signal callback')
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/1b9ccad1636c7f59d5cadd22bb35e99…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/1b9ccad1636c7f59d5cadd22bb35e99…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
cbc7e8be by Andrey Gursky at 2020-09-06T10:36:55+02:00
ChatControlBase: Properly handle ENTER key if send_on_ctrl_enter is active
Fixes #10258
- - - - -
1 changed file:
- gajim/chat_control_base.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -894,6 +894,10 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
if not app.settings.get('send_on_ctrl_enter'):
textview.insert_newline()
return True
+ else:
+ if app.settings.get('send_on_ctrl_enter'):
+ textview.insert_newline()
+ return True
if not app.account_is_available(self.account):
# we are not connected
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/cbc7e8be076eb1200518af8cb8318aff…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/cbc7e8be076eb1200518af8cb8318aff…
You're receiving this email because of your account on dev.gajim.org.