Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: faffb3c2 by wurstsalat at 2022-03-15T12:45:34+01:00 CreateGroupchatWindow: Improvements
- - - - - 47cc954a by wurstsalat at 2022-03-15T13:30:07+01:00 Update pyrightconfig
- - - - -
4 changed files:
- gajim/data/gui/groupchat_creation.ui - gajim/gtk/builder.pyi - gajim/gtk/groupchat_creation.py - pyrightconfig.json
Changes:
===================================== gajim/data/gui/groupchat_creation.ui ===================================== @@ -10,7 +10,7 @@ <column type="gchararray"/> </columns> </object> - <object class="GtkOverlay" id="create_group_chat"> + <object class="GtkStack" id="stack"> <property name="visible">True</property> <property name="can-focus">False</property> <child> @@ -350,20 +350,22 @@ </child> </object> <packing> - <property name="index">-1</property> + <property name="name">create</property> </packing> </child> - <child type="overlay"> - <object class="GtkBox" id="no_connection_box"> + <child> + <object class="GtkBox"> + <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="opacity">0.9019607843137255</property> <child> <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">You are not connected</property> + <property name="justify">center</property> <property name="wrap">True</property> + <property name="max-width-chars">30</property> </object> <packing> <property name="expand">True</property> @@ -371,10 +373,11 @@ <property name="position">0</property> </packing> </child> - <style> - <class name="solid-background"/> - </style> </object> + <packing> + <property name="name">no-connection</property> + <property name="position">1</property> + </packing> </child> </object> </interface>
===================================== gajim/gtk/builder.pyi ===================================== @@ -452,7 +452,7 @@ class GroupchatControlBuilder(Builder):
class GroupchatCreationBuilder(Builder): account_liststore: Gtk.ListStore - create_group_chat: Gtk.Overlay + stack: Gtk.Stack grid: Gtk.Grid name_entry: Gtk.Entry description_entry: Gtk.Entry @@ -464,7 +464,6 @@ class GroupchatCreationBuilder(Builder): public_radio: Gtk.RadioButton spinner: Gtk.Spinner create_button: Gtk.Button - no_connection_box: Gtk.Box
class GroupchatDetailsBuilder(Builder):
===================================== gajim/gtk/groupchat_creation.py ===================================== @@ -57,8 +57,9 @@ def __init__(self, account: Optional[str]) -> None: self.set_title(_('Create Group Chat'))
self._ui = get_builder('groupchat_creation.ui') - self.add(self._ui.create_group_chat) + self.add(self._ui.stack)
+ self._account = account self._destroyed: bool = False
self._create_entry_completion() @@ -76,10 +77,10 @@ def __init__(self, account: Optional[str]) -> None:
if app.get_number_of_connected_accounts() == 0: # This can happen under rare circumstances - self._ui.no_connection_box.show() + self._ui.stack.set_visible_child_name('no-connection') return
- self._account = self._update_accounts(account) + self._update_accounts(account)
self.set_focus(self._ui.address_entry)
@@ -87,11 +88,13 @@ def _on_account_state(self, _event: Union[AccountConnected, AccountDisonnected] ) -> None: any_account_connected = app.get_number_of_connected_accounts() > 0 - self._ui.no_connection_box.set_visible(not any_account_connected) if any_account_connected: - self._account = self._update_accounts() + self._ui.stack.set_visible_child_name('create') + self._update_accounts() + else: + self._ui.stack.set_visible_child_name('no-connection')
- def _update_accounts(self, account: Optional[str] = None) -> str: + def _update_accounts(self, account: Optional[str] = None) -> None: accounts = app.get_enabled_accounts_with_labels(connected_only=True) account_liststore = self._ui.account_combo.get_model() assert isinstance(account_liststore, Gtk.ListStore) @@ -107,8 +110,8 @@ def _update_accounts(self, account: Optional[str] = None) -> str: account = accounts[0][0]
self._ui.account_combo.set_active_id(account) + self._account = account self._fill_placeholders() - return account
def _create_entry_completion(self) -> None: entry_completion = Gtk.EntryCompletion() @@ -126,9 +129,9 @@ def _fill_placeholders(self) -> None: server = self._get_muc_service_jid()
self._ui.name_entry.set_placeholder_text( - placeholder[0] + _(' (optional)...')) + _('e.g. %s') % placeholder[0]) self._ui.description_entry.set_placeholder_text( - placeholder[1] + _(' (optional)...')) + _('e.g. %s' % placeholder[1])) self._ui.address_entry.set_placeholder_text( f'{placeholder[2]}@{server}')
===================================== pyrightconfig.json ===================================== @@ -51,6 +51,7 @@ "gajim/gtk/file_transfer_send.py", "gajim/gtk/groupchat_affiliation.py", "gajim/gtk/groupchat_config.py", + "gajim/gtk/groupchat_creation.py", "gajim/gtk/groupchat_details.py", "gajim/gtk/groupchat_invitation.py", "gajim/gtk/groupchat_inviter.py",
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/9b72433acc96b691a29d4288d90b1129...