Philipp Hörist pushed to branch mainwindow at gajim / gajim
Commits: c8f9d29f by lovetox at 2021-04-28T11:46:46+02:00 Remove old Roster code
- - - - - ac3006ee by lovetox at 2021-04-28T11:56:15+02:00 Move Controls to GTK folder
- - - - -
11 changed files:
- gajim/gtk/chat_stack.py - + gajim/gtk/controls/__init__.py - gajim/chat_control_base.py → gajim/gtk/controls/base.py - gajim/chat_control.py → gajim/gtk/controls/chat.py - gajim/groupchat_control.py → gajim/gtk/controls/groupchat.py - gajim/privatechat_control.py → gajim/gtk/controls/private.py - gajim/gtk/htmltextview.py - gajim/gtk/message_input.py - gajim/gtk/preferences.py - gajim/gui_interface.py - − gajim/roster_window.py
Changes:
===================================== gajim/gtk/chat_stack.py ===================================== @@ -16,9 +16,9 @@
from gi.repository import Gtk
-from gajim.chat_control import ChatControl -from gajim.groupchat_control import GroupchatControl -from gajim.privatechat_control import PrivateChatControl +from gajim.gui.controls.chat import ChatControl +from gajim.gui.controls.groupchat import GroupchatControl +from gajim.gui.controls.private import PrivateChatControl
log = logging.getLogger('gajim.gui.chatstack')
===================================== gajim/gtk/controls/__init__.py =====================================
===================================== gajim/chat_control_base.py → gajim/gtk/controls/base.py ===================================== @@ -91,7 +91,7 @@
################################################################################ -class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper): +class BaseControl(ChatCommandProcessor, CommandTools, EventHelper): """ A base class containing a banner, ConversationView, MessageInputTextView """ @@ -246,7 +246,7 @@ def __init__(self, widget_name, account, jid): self.encryption = self.get_encryption_state() self.conversation_view.encryption_enabled = self.encryption is not None
- # PluginSystem: adding GUI extension point for ChatControlBase + # PluginSystem: adding GUI extension point for BaseControl # instance object (also subclasses, eg. ChatControl or GroupchatControl) app.plugin_manager.gui_extension_point('chat_control_base', self)
===================================== gajim/chat_control.py → gajim/gtk/controls/chat.py ===================================== @@ -70,9 +70,9 @@
from gajim.command_system.implementation.hosts import ChatCommands from gajim.command_system.framework import CommandHost # pylint: disable=unused-import -from gajim.chat_control_base import ChatControlBase +from gajim.gui.controls.base import BaseControl
-log = logging.getLogger('gajim.chat_control') +log = logging.getLogger('gajim.gui.controls.chat')
class JingleObject: @@ -86,7 +86,7 @@ def __init__(self, state, update):
################################################################################ -class ChatControl(ChatControlBase): +class ChatControl(BaseControl): """ A control for standard 1-1 chat """ @@ -98,7 +98,7 @@ class ChatControl(ChatControlBase): COMMAND_HOST = ChatCommands # type: ClassVar[Type[CommandHost]]
def __init__(self, account, jid): - ChatControlBase.__init__(self, + BaseControl.__init__(self, 'chat_control', account, jid) @@ -852,7 +852,7 @@ def on_location_eventbox_enter_notify_event(self, _widget, _event):
def update_ui(self): # The name banner is drawn here - ChatControlBase.update_ui(self) + BaseControl.update_ui(self) self.update_toolbar() self._update_avatar() self.update_actions() @@ -916,7 +916,7 @@ def send_message(self, if message in ('', None, '\n'): return
- ChatControlBase.send_message(self, + BaseControl.send_message(self, message, type_='chat', xhtml=xhtml, @@ -945,7 +945,7 @@ def add_message(self, else: name = self.get_our_nick()
- ChatControlBase.add_message(self, + BaseControl.add_message(self, text, kind, name,
===================================== gajim/groupchat_control.py → gajim/gtk/controls/groupchat.py ===================================== @@ -54,7 +54,7 @@ from gajim.common.const import MUCJoinedState from gajim.common.structs import OutgoingMessage
-from gajim.chat_control_base import ChatControlBase +from gajim.gui.controls.base import BaseControl
from gajim.command_system.implementation.hosts import GroupChatCommands
@@ -75,10 +75,10 @@ from gajim.gui.util import open_window from gajim.gui.const import ControlType
-log = logging.getLogger('gajim.groupchat_control') +log = logging.getLogger('gajim.gui.controls.groupchat')
-class GroupchatControl(ChatControlBase): +class GroupchatControl(BaseControl):
_type = ControlType.GROUPCHAT
@@ -87,7 +87,7 @@ class GroupchatControl(ChatControlBase): COMMAND_HOST = GroupChatCommands
def __init__(self, account, jid): - ChatControlBase.__init__(self, + BaseControl.__init__(self, 'groupchat_control', account, jid) @@ -719,7 +719,7 @@ def add_message(self,
# self.check_focus_out_line()
- ChatControlBase.add_message(self, + BaseControl.add_message(self, text, kind, contact, @@ -1334,7 +1334,7 @@ def _close_control(self, reason=None):
def set_control_active(self, state): self.attention_flag = False - ChatControlBase.set_control_active(self, state) + BaseControl.set_control_active(self, state)
def _on_drag_data_received(self, widget, context, x, y, selection, target_type, timestamp): @@ -1363,7 +1363,7 @@ def _jid_not_blocked(self, bare_jid: str) -> bool: return not helpers.jid_is_blocked(self.account, fjid)
def _on_message_textview_key_press_event(self, widget, event): - res = ChatControlBase._on_message_textview_key_press_event( + res = BaseControl._on_message_textview_key_press_event( self, widget, event) if res: return True
===================================== gajim/privatechat_control.py → gajim/gtk/controls/private.py ===================================== @@ -27,7 +27,7 @@ from gajim.common import helpers from gajim.common.i18n import _
-from gajim.chat_control import ChatControl +from gajim.gui.controls.chat import ChatControl from gajim.command_system.implementation.hosts import PrivateChatCommands
from gajim.gui.dialogs import ErrorDialog
===================================== gajim/gtk/htmltextview.py ===================================== @@ -727,7 +727,7 @@ def __init__(self, account, standalone=False):
def _on_destroy(self, *args): # We restore the TextView’s drag destination to avoid a GTK warning - # when closing the control. ChatControlBase.shutdown() calls destroy() + # when closing the control. BaseControl.shutdown() calls destroy() # on the control’s main box, causing GTK to recursively destroy the # child widgets. GTK then tries to set a target list on the TextView, # resulting in a warning because the Widget has no drag destination.
===================================== gajim/gtk/message_input.py ===================================== @@ -98,7 +98,7 @@ def __init__(self):
def _on_destroy(self, *args): # We restore the TextView’s drag destination to avoid a GTK warning - # when closing the control. ChatControlBase.shutdown() calls destroy() + # when closing the control. BaseControl.shutdown() calls destroy() # on the control’s main box, causing GTK to recursively destroy the # child widgets. GTK then tries to set a target list on the TextView, # resulting in a warning because the Widget has no drag destination.
===================================== gajim/gtk/preferences.py ===================================== @@ -29,7 +29,7 @@ from gajim.common.multimedia_helpers import AudioOutputManager from gajim.common.multimedia_helpers import VideoInputManager
-from gajim.chat_control_base import ChatControlBase +from gajim.gui.controls.base import BaseControl
from .const import Setting from .const import SettingKind @@ -395,7 +395,7 @@ def _on_use_speller(value, *args): gspell_lang = Gspell.language_get_default() app.settings.set('speller_language', gspell_lang.get_code()) for ctrl in get_app_window('Preferences').get_all_controls(): - if isinstance(ctrl, ChatControlBase): + if isinstance(ctrl, BaseControl): ctrl.set_speller()
===================================== gajim/gui_interface.py ===================================== @@ -58,8 +58,8 @@ from gajim import gui_menu_builder from gajim.dialog_messages import get_dialog
-from gajim.chat_control_base import ChatControlBase -from gajim.groupchat_control import GroupchatControl +from gajim.gui.controls.base import BaseControl +from gajim.gui.controls.groupchat import GroupchatControl
from gajim.common import idle from gajim.common.zeroconf import connection_zeroconf @@ -1255,7 +1255,7 @@ def handle_event(self, account, fjid, type_): w.set_active_tab(ctrl) w.window.present() # Using isinstance here because we want to catch all derived types - if isinstance(ctrl, ChatControlBase): + if isinstance(ctrl, BaseControl): ctrl.scroll_to_end()
def show_groupchat(self, account, room_jid):
===================================== gajim/roster_window.py deleted ===================================== The diff for this file was not included because it is too large.
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/c16fbd33734f5955430cad87a89b3777...