Daniel Brötzmann pushed to branch newcontrol at gajim / gajim
Commits:
-
3d8ac70c
by wurstsalat at 2022-07-29T19:40:43+02:00
5 changed files:
- gajim/data/gui/chat_control.ui
- − gajim/data/gui/groupchat_control.ui
- gajim/gtk/builder.pyi
- gajim/gtk/controls/base.py
- gajim/gtk/controls/groupchat.py
Changes:
| ... | ... | @@ -4,22 +4,21 @@ |
| 4 | 4 | <requires lib="gtk+" version="3.24"/>
|
| 5 | 5 | <object class="GtkBox" id="control_box">
|
| 6 | 6 | <property name="can-focus">True</property>
|
| 7 | - <property name="margin-start">7</property>
|
|
| 8 | - <property name="margin-end">7</property>
|
|
| 9 | - <property name="spacing">1</property>
|
|
| 10 | 7 | <child>
|
| 11 | 8 | <object class="GtkOverlay" id="overlay">
|
| 12 | 9 | <property name="visible">True</property>
|
| 13 | 10 | <property name="can-focus">False</property>
|
| 14 | 11 | <child>
|
| 15 | - <object class="GtkBox">
|
|
| 16 | - <property name="visible">True</property>
|
|
| 17 | - <property name="can-focus">False</property>
|
|
| 18 | - <property name="orientation">vertical</property>
|
|
| 12 | + <object class="GtkBox" id="conv_view_box">
|
|
| 13 | + <property name="can-focus">True</property>
|
|
| 14 | + <property name="margin-start">7</property>
|
|
| 15 | + <property name="margin-end">7</property>
|
|
| 16 | + <property name="spacing">3</property>
|
|
| 19 | 17 | <child>
|
| 20 | 18 | <object class="GtkOverlay" id="conv_view_overlay">
|
| 21 | 19 | <property name="visible">True</property>
|
| 22 | 20 | <property name="can-focus">False</property>
|
| 21 | + <property name="hexpand">True</property>
|
|
| 23 | 22 | <child>
|
| 24 | 23 | <placeholder/>
|
| 25 | 24 | </child>
|
| ... | ... | @@ -27,9 +26,12 @@ |
| 27 | 26 | <packing>
|
| 28 | 27 | <property name="expand">False</property>
|
| 29 | 28 | <property name="fill">True</property>
|
| 30 | - <property name="position">2</property>
|
|
| 29 | + <property name="position">0</property>
|
|
| 31 | 30 | </packing>
|
| 32 | 31 | </child>
|
| 32 | + <child>
|
|
| 33 | + <placeholder/>
|
|
| 34 | + </child>
|
|
| 33 | 35 | </object>
|
| 34 | 36 | <packing>
|
| 35 | 37 | <property name="index">-1</property>
|
| ... | ... | @@ -74,7 +76,7 @@ |
| 74 | 76 | <property name="can-focus">False</property>
|
| 75 | 77 | <property name="valign">start</property>
|
| 76 | 78 | <property name="vexpand">True</property>
|
| 77 | - <property name="label" translatable="yes">Drop files or contacts</property>
|
|
| 79 | + <property name="label" translatable="yes">Drop Files or Contacts</property>
|
|
| 78 | 80 | <property name="wrap">True</property>
|
| 79 | 81 | <property name="max-width-chars">40</property>
|
| 80 | 82 | <style>
|
| 1 | -<?xml version="1.0" encoding="UTF-8"?>
|
|
| 2 | -<!-- Generated with glade 3.38.2 -->
|
|
| 3 | -<interface>
|
|
| 4 | - <requires lib="gtk+" version="3.24"/>
|
|
| 5 | - <object class="GtkBox" id="control_box">
|
|
| 6 | - <property name="can-focus">True</property>
|
|
| 7 | - <child>
|
|
| 8 | - <object class="GtkOverlay" id="overlay">
|
|
| 9 | - <property name="visible">True</property>
|
|
| 10 | - <property name="can-focus">False</property>
|
|
| 11 | - <child>
|
|
| 12 | - <object class="GtkBox">
|
|
| 13 | - <property name="can-focus">True</property>
|
|
| 14 | - <property name="margin-start">7</property>
|
|
| 15 | - <property name="margin-end">7</property>
|
|
| 16 | - <property name="spacing">3</property>
|
|
| 17 | - <child>
|
|
| 18 | - <object class="GtkOverlay" id="conv_view_overlay">
|
|
| 19 | - <property name="visible">True</property>
|
|
| 20 | - <property name="can-focus">False</property>
|
|
| 21 | - <property name="hexpand">True</property>
|
|
| 22 | - <child>
|
|
| 23 | - <placeholder/>
|
|
| 24 | - </child>
|
|
| 25 | - </object>
|
|
| 26 | - <packing>
|
|
| 27 | - <property name="expand">False</property>
|
|
| 28 | - <property name="fill">True</property>
|
|
| 29 | - <property name="position">0</property>
|
|
| 30 | - </packing>
|
|
| 31 | - </child>
|
|
| 32 | - <child>
|
|
| 33 | - <object class="GtkRevealer" id="roster_revealer">
|
|
| 34 | - <property name="visible">True</property>
|
|
| 35 | - <property name="can-focus">False</property>
|
|
| 36 | - <property name="transition-type">none</property>
|
|
| 37 | - <child>
|
|
| 38 | - <placeholder/>
|
|
| 39 | - </child>
|
|
| 40 | - </object>
|
|
| 41 | - <packing>
|
|
| 42 | - <property name="expand">False</property>
|
|
| 43 | - <property name="fill">True</property>
|
|
| 44 | - <property name="position">1</property>
|
|
| 45 | - </packing>
|
|
| 46 | - </child>
|
|
| 47 | - </object>
|
|
| 48 | - <packing>
|
|
| 49 | - <property name="index">-1</property>
|
|
| 50 | - </packing>
|
|
| 51 | - </child>
|
|
| 52 | - </object>
|
|
| 53 | - <packing>
|
|
| 54 | - <property name="expand">True</property>
|
|
| 55 | - <property name="fill">True</property>
|
|
| 56 | - <property name="position">1</property>
|
|
| 57 | - </packing>
|
|
| 58 | - </child>
|
|
| 59 | - </object>
|
|
| 60 | - <object class="GtkBox" id="drop_area">
|
|
| 61 | - <property name="name">DropArea</property>
|
|
| 62 | - <property name="visible">True</property>
|
|
| 63 | - <property name="can-focus">False</property>
|
|
| 64 | - <property name="no-show-all">True</property>
|
|
| 65 | - <property name="opacity">0.90</property>
|
|
| 66 | - <property name="hexpand">True</property>
|
|
| 67 | - <property name="vexpand">True</property>
|
|
| 68 | - <property name="orientation">vertical</property>
|
|
| 69 | - <property name="spacing">18</property>
|
|
| 70 | - <child>
|
|
| 71 | - <object class="GtkImage">
|
|
| 72 | - <property name="visible">True</property>
|
|
| 73 | - <property name="can-focus">False</property>
|
|
| 74 | - <property name="valign">end</property>
|
|
| 75 | - <property name="vexpand">True</property>
|
|
| 76 | - <property name="icon-name">mail-attachment-symbolic</property>
|
|
| 77 | - <property name="icon_size">6</property>
|
|
| 78 | - </object>
|
|
| 79 | - <packing>
|
|
| 80 | - <property name="expand">False</property>
|
|
| 81 | - <property name="fill">True</property>
|
|
| 82 | - <property name="position">0</property>
|
|
| 83 | - </packing>
|
|
| 84 | - </child>
|
|
| 85 | - <child>
|
|
| 86 | - <object class="GtkLabel">
|
|
| 87 | - <property name="visible">True</property>
|
|
| 88 | - <property name="can-focus">False</property>
|
|
| 89 | - <property name="valign">start</property>
|
|
| 90 | - <property name="vexpand">True</property>
|
|
| 91 | - <property name="label" translatable="yes">Drop Files or Contacts</property>
|
|
| 92 | - <property name="wrap">True</property>
|
|
| 93 | - <property name="max-width-chars">40</property>
|
|
| 94 | - <style>
|
|
| 95 | - <class name="bold16"/>
|
|
| 96 | - </style>
|
|
| 97 | - </object>
|
|
| 98 | - <packing>
|
|
| 99 | - <property name="expand">False</property>
|
|
| 100 | - <property name="fill">True</property>
|
|
| 101 | - <property name="position">1</property>
|
|
| 102 | - </packing>
|
|
| 103 | - </child>
|
|
| 104 | - </object>
|
|
| 105 | -</interface> |
| ... | ... | @@ -209,24 +209,12 @@ class ChatBannerBuilder(Builder): |
| 209 | 209 | |
| 210 | 210 | |
| 211 | 211 | class ChatControlBuilder(Builder):
|
| 212 | - drop_area: Gtk.Box
|
|
| 213 | - formattings_menu: Gtk.Menu
|
|
| 214 | - bold: Gtk.MenuItem
|
|
| 215 | - italic: Gtk.MenuItem
|
|
| 216 | - strike: Gtk.MenuItem
|
|
| 217 | - chat_control_hbox: Gtk.Box
|
|
| 212 | + control_box: Gtk.Box
|
|
| 218 | 213 | overlay: Gtk.Overlay
|
| 219 | - textview_box: Gtk.Box
|
|
| 214 | + conv_view_box: Gtk.Box
|
|
| 220 | 215 | conv_view_overlay: Gtk.Overlay
|
| 221 | - hbox: Gtk.Box
|
|
| 222 | - emoticons_button: Gtk.MenuButton
|
|
| 223 | - formattings_button: Gtk.MenuButton
|
|
| 224 | - settings_menu: Gtk.MenuButton
|
|
| 225 | - authentication_button: Gtk.Button
|
|
| 226 | - lock_image: Gtk.Image
|
|
| 227 | - encryption_menu: Gtk.MenuButton
|
|
| 228 | - sendfile_button: Gtk.Button
|
|
| 229 | - send_message_button: Gtk.Button
|
|
| 216 | + roster_revealer: Gtk.Revealer
|
|
| 217 | + drop_area: Gtk.Box
|
|
| 230 | 218 | |
| 231 | 219 | |
| 232 | 220 | class ChatListRowBuilder(Builder):
|
| ... | ... | @@ -401,56 +389,6 @@ class GroupchatConfigBuilder(Builder): |
| 401 | 389 | error_label: Gtk.Label
|
| 402 | 390 | |
| 403 | 391 | |
| 404 | -class GroupchatControlBuilder(Builder):
|
|
| 405 | - drop_area: Gtk.Box
|
|
| 406 | - formattings_menu: Gtk.Menu
|
|
| 407 | - bold: Gtk.MenuItem
|
|
| 408 | - italic: Gtk.MenuItem
|
|
| 409 | - strike: Gtk.MenuItem
|
|
| 410 | - groupchat_control_hbox: Gtk.Box
|
|
| 411 | - overlay: Gtk.Overlay
|
|
| 412 | - stack: Gtk.Stack
|
|
| 413 | - groupchat_control_vbox: Gtk.Box
|
|
| 414 | - textview_box: Gtk.Box
|
|
| 415 | - conv_view_overlay: Gtk.Overlay
|
|
| 416 | - hbox: Gtk.Box
|
|
| 417 | - quick_invite_button: Gtk.Button
|
|
| 418 | - settings_menu: Gtk.MenuButton
|
|
| 419 | - authentication_button: Gtk.Button
|
|
| 420 | - lock_image: Gtk.Image
|
|
| 421 | - encryption_menu: Gtk.MenuButton
|
|
| 422 | - sendfile_button: Gtk.Button
|
|
| 423 | - emoticons_button: Gtk.MenuButton
|
|
| 424 | - send_message_button: Gtk.Button
|
|
| 425 | - formattings_button: Gtk.MenuButton
|
|
| 426 | - roster_revealer: Gtk.Revealer
|
|
| 427 | - nickname_entry: Gtk.Entry
|
|
| 428 | - nickname_change_button: Gtk.Button
|
|
| 429 | - password_set_button: Gtk.Button
|
|
| 430 | - password_entry: Gtk.Entry
|
|
| 431 | - captcha_set_button: Gtk.Button
|
|
| 432 | - captcha_box: Gtk.Box
|
|
| 433 | - remove_bookmark_button: Gtk.Button
|
|
| 434 | - retry_button: Gtk.Button
|
|
| 435 | - close_button: Gtk.Button
|
|
| 436 | - error_label: Gtk.Label
|
|
| 437 | - error_heading: Gtk.Label
|
|
| 438 | - captcha_close_button: Gtk.Button
|
|
| 439 | - captcha_try_again_button: Gtk.Button
|
|
| 440 | - captcha_error_label: Gtk.Label
|
|
| 441 | - kick_label: Gtk.Label
|
|
| 442 | - kick_participant_button: Gtk.Button
|
|
| 443 | - kick_reason_entry: Gtk.Entry
|
|
| 444 | - ban_label: Gtk.Label
|
|
| 445 | - ban_participant_button: Gtk.Button
|
|
| 446 | - ban_reason_entry: Gtk.Entry
|
|
| 447 | - destroy_button: Gtk.Button
|
|
| 448 | - destroy_alternate_entry: Gtk.Entry
|
|
| 449 | - destroy_reason_entry: Gtk.Entry
|
|
| 450 | - invite_grid: Gtk.Grid
|
|
| 451 | - invite_button: Gtk.Button
|
|
| 452 | - |
|
| 453 | - |
|
| 454 | 392 | class GroupchatCreationBuilder(Builder):
|
| 455 | 393 | account_liststore: Gtk.ListStore
|
| 456 | 394 | stack: Gtk.Stack
|
| ... | ... | @@ -1040,8 +978,6 @@ def get_builder(file_name: Literal['groupchat_affiliation.ui'], widgets: list[st |
| 1040 | 978 | @overload
|
| 1041 | 979 | def get_builder(file_name: Literal['groupchat_config.ui'], widgets: list[str] = ...) -> GroupchatConfigBuilder: ...
|
| 1042 | 980 | @overload
|
| 1043 | -def get_builder(file_name: Literal['groupchat_control.ui'], widgets: list[str] = ...) -> GroupchatControlBuilder: ...
|
|
| 1044 | -@overload
|
|
| 1045 | 981 | def get_builder(file_name: Literal['groupchat_creation.ui'], widgets: list[str] = ...) -> GroupchatCreationBuilder: ...
|
| 1046 | 982 | @overload
|
| 1047 | 983 | def get_builder(file_name: Literal['groupchat_details.ui'], widgets: list[str] = ...) -> GroupchatDetailsBuilder: ...
|
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | from typing import Any
|
| 29 | 29 | from typing import Optional
|
| 30 | 30 | from typing import Union
|
| 31 | +from typing import cast
|
|
| 31 | 32 | |
| 32 | 33 | import os
|
| 33 | 34 | import logging
|
| ... | ... | @@ -117,8 +118,8 @@ def __init__(self, widget_name: str, account: str, jid: JID) -> None: |
| 117 | 118 | |
| 118 | 119 | self.control_id: str = str(uuid.uuid4())
|
| 119 | 120 | |
| 120 | - self.xml = get_builder(f'{widget_name}.ui')
|
|
| 121 | - self.widget: Gtk.Box = self.xml.get_object('control_box')
|
|
| 121 | + self.xml = get_builder('chat_control.ui')
|
|
| 122 | + self.widget = cast(Gtk.Box, self.xml.get_object('control_box'))
|
|
| 122 | 123 | |
| 123 | 124 | # Drag and drop
|
| 124 | 125 | self.xml.overlay.add_overlay(self.xml.drop_area)
|
| ... | ... | @@ -85,11 +85,14 @@ def __init__(self, account: str, jid: JID) -> None: |
| 85 | 85 | self._groupchat_state = GroupchatState(self.contact)
|
| 86 | 86 | self.xml.conv_view_overlay.add_overlay(self._groupchat_state)
|
| 87 | 87 | |
| 88 | + self._roster_revealer = Gtk.Revealer()
|
|
| 89 | + self.xml.conv_view_box.add(self._roster_revealer)
|
|
| 90 | + |
|
| 88 | 91 | self.roster = GroupchatRoster(self.account, self.room_jid, self)
|
| 89 | - self.xml.roster_revealer.add(self.roster)
|
|
| 92 | + self._roster_revealer.add(self.roster)
|
|
| 90 | 93 | |
| 91 | 94 | show_roster = app.settings.get('hide_groupchat_occupants_list')
|
| 92 | - self.xml.roster_revealer.set_reveal_child(show_roster)
|
|
| 95 | + self._roster_revealer.set_reveal_child(show_roster)
|
|
| 93 | 96 | app.settings.connect_signal(
|
| 94 | 97 | 'hide_groupchat_occupants_list', self._show_roster)
|
| 95 | 98 | self.roster.connect('row-activated', self._on_roster_row_activated)
|
| ... | ... | @@ -149,8 +152,8 @@ def _show_roster(self, show_roster: bool, *args: Any) -> None: |
| 149 | 152 | transition = Gtk.RevealerTransitionType.SLIDE_RIGHT
|
| 150 | 153 | if show_roster:
|
| 151 | 154 | transition = Gtk.RevealerTransitionType.SLIDE_LEFT
|
| 152 | - self.xml.roster_revealer.set_transition_type(transition)
|
|
| 153 | - self.xml.roster_revealer.set_reveal_child(show_roster)
|
|
| 155 | + self._roster_revealer.set_transition_type(transition)
|
|
| 156 | + self._roster_revealer.set_reveal_child(show_roster)
|
|
| 154 | 157 | |
| 155 | 158 | def _on_roster_row_activated(self,
|
| 156 | 159 | _roster: GroupchatRoster,
|