Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
faffb3c2
by wurstsalat at 2022-03-15T12:45:34+01:00
-
47cc954a
by wurstsalat at 2022-03-15T13:30:07+01:00
4 changed files:
- gajim/data/gui/groupchat_creation.ui
- gajim/gtk/builder.pyi
- gajim/gtk/groupchat_creation.py
- pyrightconfig.json
Changes:
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 |
<column type="gchararray"/>
|
| 11 | 11 |
</columns>
|
| 12 | 12 |
</object>
|
| 13 |
- <object class="GtkOverlay" id="create_group_chat">
|
|
| 13 |
+ <object class="GtkStack" id="stack">
|
|
| 14 | 14 |
<property name="visible">True</property>
|
| 15 | 15 |
<property name="can-focus">False</property>
|
| 16 | 16 |
<child>
|
| ... | ... | @@ -350,20 +350,22 @@ |
| 350 | 350 |
</child>
|
| 351 | 351 |
</object>
|
| 352 | 352 |
<packing>
|
| 353 |
- <property name="index">-1</property>
|
|
| 353 |
+ <property name="name">create</property>
|
|
| 354 | 354 |
</packing>
|
| 355 | 355 |
</child>
|
| 356 |
- <child type="overlay">
|
|
| 357 |
- <object class="GtkBox" id="no_connection_box">
|
|
| 356 |
+ <child>
|
|
| 357 |
+ <object class="GtkBox">
|
|
| 358 |
+ <property name="visible">True</property>
|
|
| 358 | 359 |
<property name="can-focus">False</property>
|
| 359 |
- <property name="no-show-all">True</property>
|
|
| 360 |
- <property name="opacity">0.90</property>
|
|
| 360 |
+ <property name="opacity">0.9019607843137255</property>
|
|
| 361 | 361 |
<child>
|
| 362 | 362 |
<object class="GtkLabel">
|
| 363 | 363 |
<property name="visible">True</property>
|
| 364 | 364 |
<property name="can-focus">False</property>
|
| 365 | 365 |
<property name="label" translatable="yes">You are not connected</property>
|
| 366 |
+ <property name="justify">center</property>
|
|
| 366 | 367 |
<property name="wrap">True</property>
|
| 368 |
+ <property name="max-width-chars">30</property>
|
|
| 367 | 369 |
</object>
|
| 368 | 370 |
<packing>
|
| 369 | 371 |
<property name="expand">True</property>
|
| ... | ... | @@ -371,10 +373,11 @@ |
| 371 | 373 |
<property name="position">0</property>
|
| 372 | 374 |
</packing>
|
| 373 | 375 |
</child>
|
| 374 |
- <style>
|
|
| 375 |
- <class name="solid-background"/>
|
|
| 376 |
- </style>
|
|
| 377 | 376 |
</object>
|
| 377 |
+ <packing>
|
|
| 378 |
+ <property name="name">no-connection</property>
|
|
| 379 |
+ <property name="position">1</property>
|
|
| 380 |
+ </packing>
|
|
| 378 | 381 |
</child>
|
| 379 | 382 |
</object>
|
| 380 | 383 |
</interface>
|
| ... | ... | @@ -452,7 +452,7 @@ class GroupchatControlBuilder(Builder): |
| 452 | 452 |
|
| 453 | 453 |
class GroupchatCreationBuilder(Builder):
|
| 454 | 454 |
account_liststore: Gtk.ListStore
|
| 455 |
- create_group_chat: Gtk.Overlay
|
|
| 455 |
+ stack: Gtk.Stack
|
|
| 456 | 456 |
grid: Gtk.Grid
|
| 457 | 457 |
name_entry: Gtk.Entry
|
| 458 | 458 |
description_entry: Gtk.Entry
|
| ... | ... | @@ -464,7 +464,6 @@ class GroupchatCreationBuilder(Builder): |
| 464 | 464 |
public_radio: Gtk.RadioButton
|
| 465 | 465 |
spinner: Gtk.Spinner
|
| 466 | 466 |
create_button: Gtk.Button
|
| 467 |
- no_connection_box: Gtk.Box
|
|
| 468 | 467 |
|
| 469 | 468 |
|
| 470 | 469 |
class GroupchatDetailsBuilder(Builder):
|
| ... | ... | @@ -57,8 +57,9 @@ def __init__(self, account: Optional[str]) -> None: |
| 57 | 57 |
self.set_title(_('Create Group Chat'))
|
| 58 | 58 |
|
| 59 | 59 |
self._ui = get_builder('groupchat_creation.ui')
|
| 60 |
- self.add(self._ui.create_group_chat)
|
|
| 60 |
+ self.add(self._ui.stack)
|
|
| 61 | 61 |
|
| 62 |
+ self._account = account
|
|
| 62 | 63 |
self._destroyed: bool = False
|
| 63 | 64 |
|
| 64 | 65 |
self._create_entry_completion()
|
| ... | ... | @@ -76,10 +77,10 @@ def __init__(self, account: Optional[str]) -> None: |
| 76 | 77 |
|
| 77 | 78 |
if app.get_number_of_connected_accounts() == 0:
|
| 78 | 79 |
# This can happen under rare circumstances
|
| 79 |
- self._ui.no_connection_box.show()
|
|
| 80 |
+ self._ui.stack.set_visible_child_name('no-connection')
|
|
| 80 | 81 |
return
|
| 81 | 82 |
|
| 82 |
- self._account = self._update_accounts(account)
|
|
| 83 |
+ self._update_accounts(account)
|
|
| 83 | 84 |
|
| 84 | 85 |
self.set_focus(self._ui.address_entry)
|
| 85 | 86 |
|
| ... | ... | @@ -87,11 +88,13 @@ def _on_account_state(self, |
| 87 | 88 |
_event: Union[AccountConnected, AccountDisonnected]
|
| 88 | 89 |
) -> None:
|
| 89 | 90 |
any_account_connected = app.get_number_of_connected_accounts() > 0
|
| 90 |
- self._ui.no_connection_box.set_visible(not any_account_connected)
|
|
| 91 | 91 |
if any_account_connected:
|
| 92 |
- self._account = self._update_accounts()
|
|
| 92 |
+ self._ui.stack.set_visible_child_name('create')
|
|
| 93 |
+ self._update_accounts()
|
|
| 94 |
+ else:
|
|
| 95 |
+ self._ui.stack.set_visible_child_name('no-connection')
|
|
| 93 | 96 |
|
| 94 |
- def _update_accounts(self, account: Optional[str] = None) -> str:
|
|
| 97 |
+ def _update_accounts(self, account: Optional[str] = None) -> None:
|
|
| 95 | 98 |
accounts = app.get_enabled_accounts_with_labels(connected_only=True)
|
| 96 | 99 |
account_liststore = self._ui.account_combo.get_model()
|
| 97 | 100 |
assert isinstance(account_liststore, Gtk.ListStore)
|
| ... | ... | @@ -107,8 +110,8 @@ def _update_accounts(self, account: Optional[str] = None) -> str: |
| 107 | 110 |
account = accounts[0][0]
|
| 108 | 111 |
|
| 109 | 112 |
self._ui.account_combo.set_active_id(account)
|
| 113 |
+ self._account = account
|
|
| 110 | 114 |
self._fill_placeholders()
|
| 111 |
- return account
|
|
| 112 | 115 |
|
| 113 | 116 |
def _create_entry_completion(self) -> None:
|
| 114 | 117 |
entry_completion = Gtk.EntryCompletion()
|
| ... | ... | @@ -126,9 +129,9 @@ def _fill_placeholders(self) -> None: |
| 126 | 129 |
server = self._get_muc_service_jid()
|
| 127 | 130 |
|
| 128 | 131 |
self._ui.name_entry.set_placeholder_text(
|
| 129 |
- placeholder[0] + _(' (optional)...'))
|
|
| 132 |
+ _('e.g. %s') % placeholder[0])
|
|
| 130 | 133 |
self._ui.description_entry.set_placeholder_text(
|
| 131 |
- placeholder[1] + _(' (optional)...'))
|
|
| 134 |
+ _('e.g. %s' % placeholder[1]))
|
|
| 132 | 135 |
self._ui.address_entry.set_placeholder_text(
|
| 133 | 136 |
f'{placeholder[2]}@{server}')
|
| 134 | 137 |
|
| ... | ... | @@ -51,6 +51,7 @@ |
| 51 | 51 |
"gajim/gtk/file_transfer_send.py",
|
| 52 | 52 |
"gajim/gtk/groupchat_affiliation.py",
|
| 53 | 53 |
"gajim/gtk/groupchat_config.py",
|
| 54 |
+ "gajim/gtk/groupchat_creation.py",
|
|
| 54 | 55 |
"gajim/gtk/groupchat_details.py",
|
| 55 | 56 |
"gajim/gtk/groupchat_invitation.py",
|
| 56 | 57 |
"gajim/gtk/groupchat_inviter.py",
|