Philipp Hörist pushed to branch newcontrol at gajim / gajim
Commits: 5b38645e by lovetox at 2022-06-28T20:00:20+02:00 Cleanup GUI files
- - - - -
7 changed files:
- gajim/data/gui/chat_control.ui - gajim/data/gui/groupchat_control.ui - gajim/gtk/controls/base.py - gajim/gtk/controls/chat.py - gajim/gtk/controls/groupchat.py - gajim/gtk/main.py - gajim/gtk/message_actions_box.py
Changes:
===================================== gajim/data/gui/chat_control.ui ===================================== @@ -2,82 +2,6 @@ <!-- Generated with glade 3.38.2 --> <interface> <requires lib="gtk+" version="3.24"/> - <object class="GtkBox" id="drop_area"> - <property name="name">DropArea</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="no-show-all">True</property> - <property name="opacity">0.90</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <property name="spacing">18</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="valign">end</property> - <property name="vexpand">True</property> - <property name="icon-name">mail-attachment-symbolic</property> - <property name="icon_size">6</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="valign">start</property> - <property name="vexpand">True</property> - <property name="label" translatable="yes">Drop files or contacts</property> - <property name="wrap">True</property> - <property name="max-width-chars">40</property> - <style> - <class name="bold16"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <object class="GtkMenu" id="formattings_menu"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <child> - <object class="GtkMenuItem" id="bold"> - <property name="name">bold</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Bold</property> - <signal name="activate" handler="_on_formatting_menuitem_activate" swapped="no"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="italic"> - <property name="name">italic</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Italic</property> - <signal name="activate" handler="_on_formatting_menuitem_activate" swapped="no"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="strike"> - <property name="name">strike</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Strike</property> - <signal name="activate" handler="_on_formatting_menuitem_activate" swapped="no"/> - </object> - </child> - </object> <object class="GtkBox" id="chat_control_hbox"> <property name="can-focus">True</property> <property name="margin-start">7</property> @@ -128,199 +52,7 @@ </packing> </child> <child> - <object class="GtkBox" id="hbox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkMenuButton" id="emoticons_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Show a list of emojis</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">face-smile-symbolic</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="formattings_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Format your message…</property> - <property name="relief">none</property> - <property name="popup">formattings_menu</property> - <property name="direction">up</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">format-text-bold-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <object class="GtkMenuButton" id="settings_menu"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">open-menu-symbolic</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack-type">end</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="authentication_button"> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="no-show-all">True</property> - <property name="relief">none</property> - <signal name="clicked" handler="_on_authentication_button_clicked" swapped="no"/> - <child> - <object class="GtkImage" id="lock_image"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon_size">1</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack-type">end</property> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="encryption_menu"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Choose encryption</property> - <property name="relief">none</property> - <child> - <placeholder/> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack-type">end</property> - <property name="position">6</property> - </packing> - </child> - <child> - <object class="GtkButton" id="sendfile_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">mail-attachment-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack-type">end</property> - <property name="position">7</property> - </packing> - </child> - <child> - <object class="GtkButton" id="send_message_button"> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="no-show-all">True</property> - <property name="tooltip-text" translatable="yes">Send Message</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">document-send</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack-type">end</property> - <property name="position">8</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> + <placeholder/> </child> </object> <packing> @@ -335,4 +67,49 @@ </packing> </child> </object> + <object class="GtkBox" id="drop_area"> + <property name="name">DropArea</property> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> + <property name="opacity">0.90</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">18</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">end</property> + <property name="vexpand">True</property> + <property name="icon-name">mail-attachment-symbolic</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">start</property> + <property name="vexpand">True</property> + <property name="label" translatable="yes">Drop files or contacts</property> + <property name="wrap">True</property> + <property name="max-width-chars">40</property> + <style> + <class name="bold16"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> </interface>
===================================== gajim/data/gui/groupchat_control.ui ===================================== @@ -47,37 +47,6 @@ </packing> </child> </object> - <object class="GtkMenu" id="formattings_menu"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <child> - <object class="GtkMenuItem" id="bold"> - <property name="name">bold</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Bold</property> - <signal name="activate" handler="_on_formatting_menuitem_activate" swapped="no"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="italic"> - <property name="name">italic</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Italic</property> - <signal name="activate" handler="_on_formatting_menuitem_activate" swapped="no"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="strike"> - <property name="name">strike</property> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Strike</property> - <signal name="activate" handler="_on_formatting_menuitem_activate" swapped="no"/> - </object> - </child> - </object> <object class="GtkBox" id="groupchat_control_hbox"> <property name="can-focus">True</property> <child> @@ -138,219 +107,7 @@ </packing> </child> <child> - <object class="GtkBox" id="hbox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkButton" id="quick_invite_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Invite Contacts…</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">list-add-symbolic</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - <class name="flat"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack-type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="settings_menu"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">open-menu-symbolic</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack-type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="authentication_button"> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="no-show-all">True</property> - <property name="relief">none</property> - <signal name="clicked" handler="_on_authentication_button_clicked" swapped="no"/> - <child> - <object class="GtkImage" id="lock_image"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon_size">1</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack-type">end</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="encryption_menu"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Choose encryption</property> - <property name="relief">none</property> - <child> - <placeholder/> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack-type">end</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="sendfile_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">mail-attachment-symbolic</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack-type">end</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="emoticons_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Show a list of emojis</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">face-smile-symbolic</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkButton" id="send_message_button"> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="no-show-all">True</property> - <property name="tooltip-text" translatable="yes">Send Message</property> - <property name="relief">none</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">document-send</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack-type">end</property> - <property name="position">6</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="formattings_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Format your message</property> - <property name="relief">none</property> - <property name="popup">formattings_menu</property> - <property name="direction">up</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">format-text-bold-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <style> - <class name="chatcontrol-actionbar-button"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">7</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> + <placeholder/> </child> </object> <packing>
===================================== gajim/gtk/controls/base.py ===================================== @@ -192,31 +192,6 @@ def __init__(self, widget_name: str, account: str, jid: JID) -> None: self._scrolled_view.connect('request-history', self.fetch_n_lines_history, 20)
- self._security_label_selector = SecurityLabelSelector( - account, self.contact) - self.xml.hbox.pack_start(self._security_label_selector, False, True, 0) - - self.msg_textview = MessageInputTextView() - - # Send message button - self.xml.send_message_button.set_action_name( - f'win.send-message-{self.control_id}') - self.xml.send_message_button.set_visible( - app.settings.get('show_send_message_button')) - app.settings.bind_signal( - 'show_send_message_button', - self.xml.send_message_button, - 'set_visible') - - self.msg_scrolledwindow = ScrolledWindow() - self.msg_scrolledwindow.set_margin_start(3) - self.msg_scrolledwindow.set_margin_end(3) - self.msg_scrolledwindow.get_style_context().add_class( - 'message-input-border') - self.msg_scrolledwindow.add(self.msg_textview) - - self.xml.hbox.pack_start(self.msg_scrolledwindow, True, True, 0) - # Keeps track of whether the ConversationView is populated self._chat_loaded: bool = False
@@ -459,8 +434,6 @@ def shutdown(self) -> None:
del self.conversation_view del self._scrolled_view - del self.msg_textview - del self.msg_scrolledwindow
self.widget.destroy() del self.widget @@ -824,23 +797,11 @@ def set_control_active(self, state: bool) -> None: if not self._chat_loaded: self.fetch_n_lines_history(self._scrolled_view, True, 20)
- if state: - self._security_label_selector.update() - - if self.msg_textview.has_text(): - self._client.get_module('Chatstate').set_chatstate( - self.contact, Chatstate.PAUSED) - else: - self._client.get_module('Chatstate').set_chatstate( - self.contact, Chatstate.ACTIVE) - else: - self._client.get_module('Chatstate').set_chatstate( - self.contact, Chatstate.INACTIVE) - def set_message_input_state(self, state: bool) -> None: - self.xml.formattings_button.set_sensitive(state) - self.msg_textview.set_sensitive(state) - self.msg_textview.set_editable(state) + return + # self.xml.formattings_button.set_sensitive(state) + # self.msg_textview.set_sensitive(state) + # self.msg_textview.set_editable(state)
@property def is_chat_loaded(self) -> bool:
===================================== gajim/gtk/controls/chat.py ===================================== @@ -88,8 +88,6 @@ def __init__(self, account: str, jid: JID) -> None: self.update_toolbar() self.update_ui()
- self.msg_textview.grab_focus() - # PluginSystem: adding GUI extension point for this ChatControl # instance object app.plugin_manager.gui_extension_point('chat_control', self)
===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -143,8 +143,8 @@ def __init__(self, account: str, jid: JID) -> None: self._subject_text = ''
# Groupchat invite - self.xml.quick_invite_button.set_action_name( - f'win.invite-{self.control_id}') + # self.xml.quick_invite_button.set_action_name( + # f'win.invite-{self.control_id}')
self._invite_box = GroupChatInviter(self.room_jid) self.xml.invite_grid.attach(self._invite_box, 0, 0, 1, 1)
===================================== gajim/gtk/main.py ===================================== @@ -433,6 +433,8 @@ def _on_window_motion_notify(self, if control is None: return
+ return + # TODO if self.get_property('has-toplevel-focus'): client = app.get_client(control.account) client.get_module('Chatstate').set_mouse_activity(
===================================== gajim/gtk/message_actions_box.py ===================================== @@ -37,6 +37,7 @@ from gajim.common.const import Direction from gajim.common.modules.contacts import GroupchatContact from gajim.common.types import ChatContactT +from gajim.gui.security_label_selector import SecurityLabelSelector
from .builder import get_builder from .dialogs import DialogButton @@ -75,6 +76,10 @@ def __init__(self) -> None: self._ui.send_message_button, 'set_visible')
+ # self._security_label_selector = SecurityLabelSelector( + # account, self._contact) + # self._ui.box.pack_start(self._security_label_selector, False, True, 0) + self.msg_textview = MessageInputTextView() self.msg_textview.get_buffer().connect('changed', self._on_buffer_changed) @@ -162,6 +167,22 @@ def switch_contact(self, contact: ChatContactT) -> None: self._set_encryption_details(encryption)
self._set_spell_checker_language(contact) + self._set_chatstate() + + def _set_chatstate(self) -> None: + return #TODO + if state: + self._security_label_selector.update() + + if self.msg_textview.has_text(): + self._client.get_module('Chatstate').set_chatstate( + self.contact, Chatstate.PAUSED) + else: + self._client.get_module('Chatstate').set_chatstate( + self.contact, Chatstate.ACTIVE) + else: + self._client.get_module('Chatstate').set_chatstate( + self.contact, Chatstate.INACTIVE)
def _set_encryption_state(self, state: str) -> None: action = app.window.lookup_action('set-encryption')
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/5b38645eeba89d9988b1f479baa778e6e...