Philipp Hörist pushed to branch newcontrol at gajim / gajim


Commits:
c6691245 by lovetox at 2022-08-04T22:31:33+02:00
refactor: Remove dead code

- - - - -
4eaa66c3 by lovetox at 2022-08-04T22:34:18+02:00
cs: fix double quotes

- - - - -


4 changed files:

- gajim/common/storage/archive.py
- gajim/gtk/chat_list_stack.py
- gajim/gtk/controls/base.py
- gajim/gtk/controls/chat.py


Changes:

=====================================
gajim/common/storage/archive.py
=====================================
@@ -998,10 +998,10 @@ def get_last_correctable_message(self,
                                      jid: JID,
                                      message_id: str
                                      ) -> Optional[LastConversationRow]:
-        """
+        '''
         Load the last correctable message of a conversation by message_id.
         Conditions: max 5 min old
-        """
+        '''
         jids = [jid]
         account_id = self.get_account_id(account)
         min_time = time.time() - 5 * 60


=====================================
gajim/gtk/chat_list_stack.py
=====================================
@@ -269,7 +269,7 @@ def _leave(is_checked: bool) -> None:
                 _('Leave Group Chat'),
                 _('Are you sure you want to leave this group chat?'),
                 _('If you close this chat, you will leave '
-                  '\'%s\'.') % contact.name,
+                  '"%s".') % contact.name,
                 _('_Do not ask me again'),
                 [DialogButton.make('Cancel'),
                  DialogButton.make('Accept',


=====================================
gajim/gtk/controls/base.py
=====================================
@@ -36,7 +36,6 @@
 import uuid
 
 from gi.repository import Gtk
-from gi.repository import Gdk
 from gi.repository import GLib
 
 from nbxmpp import JID
@@ -60,9 +59,6 @@
 from gajim.gui.conversation.view import ConversationView
 from gajim.gui.conversation.scrolled import ScrolledView
 from gajim.gui.conversation.jump_to_end_button import JumpToEndButton
-from gajim.gui.util import get_copy_modifier
-from gajim.gui.util import get_copy_modifier_keys
-from gajim.gui.util import get_hardware_key_codes
 from gajim.gui.builder import get_builder
 from gajim.gui.util import set_urgency_hint
 from gajim.gui.const import ControlType
@@ -77,22 +73,14 @@
 from gajim.command_system.implementation import standard  # noqa: F401
 from gajim.command_system.implementation import execute  # noqa: F401
 
-# This is needed so copying text from the conversation textview
-# works with different language layouts. Pressing the key c on a russian
-# layout yields another keyval than with the english layout.
-# So we match hardware keycodes instead of keyvals.
-# Multiple hardware keycodes can trigger a keyval like Gdk.KEY_c.
-KEYCODES_KEY_C = get_hardware_key_codes(Gdk.KEY_c)
-COPY_MODIFIER = get_copy_modifier()
-COPY_MODIFIER_KEYS = get_copy_modifier_keys()
 
 log = logging.getLogger('gajim.gui.controls.base')
 
 
 class BaseControl(ChatCommandProcessor, CommandTools, EventHelper):
-    """
+    '''
     A base class containing a banner, ConversationView, MessageInputTextView
-    """
+    '''
 
     _type: Optional[ControlType] = None
 
@@ -118,10 +106,6 @@ def __init__(self, widget_name: str, account: str, jid: 
JID) -> None:
         # Create ConversationView and connect signals
         self.conversation_view = ConversationView(self.account, self.contact)
 
-        id_ = self.conversation_view.connect(
-            'key-press-event', self._on_conversation_view_key_press)
-        self.handlers[id_] = self.conversation_view
-
         self._scrolled_view = ScrolledView()
         self._scrolled_view.add(self.conversation_view)
         self._scrolled_view.set_focus_vadjustment(Gtk.Adjustment())
@@ -239,40 +223,6 @@ def _on_message_moderated(self, event: 
events.MessageModerated) -> None:
         self.conversation_view.show_message_retraction(
             event.moderation.stanza_id, text)
 
-    def _on_conversation_view_key_press(self,
-                                        _listbox: ConversationView,
-                                        event: Gdk.EventKey
-                                        ) -> int:
-        if event.get_state() & Gdk.ModifierType.SHIFT_MASK:
-            if event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up):
-                return Gdk.EVENT_PROPAGATE
-
-        if event.keyval in COPY_MODIFIER_KEYS:
-            # Don’t route modifier keys for copy action to the Message Input
-            # otherwise pressing CTRL/META + c (the next event after that)
-            # will not reach the textview (because the Message Input would get
-            # focused).
-            return Gdk.EVENT_PROPAGATE
-
-        # if event.get_state() & COPY_MODIFIER:
-        # TODO
-        #     # Don’t reroute the event if it is META + c and the
-        #     # textview has a selection
-        #     if event.hardware_keycode in KEYCODES_KEY_C:
-        #         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
-        # self.msg_textview.grab_focus()
-        # self.msg_textview.get_toplevel().propagate_key_event(event)
-        return Gdk.EVENT_STOP
-
     @property
     def type(self) -> ControlType:
         assert self._type is not None


=====================================
gajim/gtk/controls/chat.py
=====================================
@@ -52,9 +52,9 @@
 
 
 class ChatControl(BaseControl):
-    """
+    '''
     A control for standard 1-1 chat
-    """
+    '''
     _type = ControlType.CHAT
 
     # Set a command host to bound to. Every command given through a chat will 
be



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/d6950498025c9b0d9b0ea271fb0ae027a14f70e5...4eaa66c3fc9f72ed60feb1021b9a77b53eae9d3a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/d6950498025c9b0d9b0ea271fb0ae027a14f70e5...4eaa66c3fc9f72ed60feb1021b9a77b53eae9d3a
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to