coding standards
This commit is contained in:
parent
606738c4e2
commit
4a85730523
|
@ -1614,7 +1614,8 @@ class AccountsWindow:
|
||||||
gajim.connections[account].change_status(show, status)
|
gajim.connections[account].change_status(show, status)
|
||||||
|
|
||||||
def check_resend_relog(self):
|
def check_resend_relog(self):
|
||||||
if self.need_relogin and self.current_account == gajim.ZEROCONF_ACC_NAME:
|
if self.need_relogin and self.current_account == \
|
||||||
|
gajim.ZEROCONF_ACC_NAME:
|
||||||
if gajim.ZEROCONF_ACC_NAME in gajim.connections:
|
if gajim.ZEROCONF_ACC_NAME in gajim.connections:
|
||||||
gajim.connections[gajim.ZEROCONF_ACC_NAME].update_details()
|
gajim.connections[gajim.ZEROCONF_ACC_NAME].update_details()
|
||||||
return
|
return
|
||||||
|
@ -1633,11 +1634,13 @@ class AccountsWindow:
|
||||||
|
|
||||||
def relog(account):
|
def relog(account):
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
show_before = gajim.SHOW_LIST[gajim.connections[account].connected]
|
show_before = gajim.SHOW_LIST[gajim.connections[account].\
|
||||||
|
connected]
|
||||||
status_before = gajim.connections[account].status
|
status_before = gajim.connections[account].status
|
||||||
gajim.interface.roster.send_status(account, 'offline',
|
gajim.interface.roster.send_status(account, 'offline',
|
||||||
_('Be right back.'))
|
_('Be right back.'))
|
||||||
gobject.timeout_add(500, login, account, show_before, status_before)
|
gobject.timeout_add(500, login, account, show_before,
|
||||||
|
status_before)
|
||||||
|
|
||||||
def on_yes(checked, account):
|
def on_yes(checked, account):
|
||||||
relog(account)
|
relog(account)
|
||||||
|
@ -1667,7 +1670,8 @@ class AccountsWindow:
|
||||||
else:
|
else:
|
||||||
account = None
|
account = None
|
||||||
if self.current_account and self.current_account == account:
|
if self.current_account and self.current_account == account:
|
||||||
# We're comming back to our current account, no need to update widgets
|
# We're comming back to our current account, no need to update
|
||||||
|
# widgets
|
||||||
return
|
return
|
||||||
# Save config for previous account if needed cause focus_out event is
|
# Save config for previous account if needed cause focus_out event is
|
||||||
# called after the changed event
|
# called after the changed event
|
||||||
|
@ -1685,8 +1689,8 @@ class AccountsWindow:
|
||||||
elif focused_widget_name == 'cert_entry1':
|
elif focused_widget_name == 'cert_entry1':
|
||||||
func = self.on_cert_entry1_focus_out_event
|
func = self.on_cert_entry1_focus_out_event
|
||||||
if func(focused_widget, None):
|
if func(focused_widget, None):
|
||||||
# Error detected in entry, don't change account, re-put cursor on
|
# Error detected in entry, don't change account,
|
||||||
# previous row
|
# re-put cursor on previous row
|
||||||
self.select_account(self.current_account)
|
self.select_account(self.current_account)
|
||||||
return True
|
return True
|
||||||
self.window.set_focus(widget)
|
self.window.set_focus(widget)
|
||||||
|
@ -1745,7 +1749,8 @@ class AccountsWindow:
|
||||||
if not self.current_account:
|
if not self.current_account:
|
||||||
self.notebook.set_current_page(0)
|
self.notebook.set_current_page(0)
|
||||||
return
|
return
|
||||||
if gajim.config.get_per('accounts', self.current_account, 'is_zeroconf'):
|
if gajim.config.get_per('accounts', self.current_account,
|
||||||
|
'is_zeroconf'):
|
||||||
self.ignore_events = True
|
self.ignore_events = True
|
||||||
self.init_zeroconf_account()
|
self.init_zeroconf_account()
|
||||||
self.ignore_events = False
|
self.ignore_events = False
|
||||||
|
@ -1778,7 +1783,8 @@ class AccountsWindow:
|
||||||
|
|
||||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||||
'sync_with_global_status')
|
'sync_with_global_status')
|
||||||
self.xml.get_object('sync_with_global_status_checkbutton2').set_active(st)
|
self.xml.get_object('sync_with_global_status_checkbutton2').set_active(
|
||||||
|
st)
|
||||||
|
|
||||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||||
'use_custom_host')
|
'use_custom_host')
|
||||||
|
@ -1919,12 +1925,14 @@ class AccountsWindow:
|
||||||
custom_host = gajim.config.get_per('accounts', account, 'custom_host')
|
custom_host = gajim.config.get_per('accounts', account, 'custom_host')
|
||||||
if not custom_host:
|
if not custom_host:
|
||||||
custom_host = gajim.config.get_per('accounts', account, 'hostname')
|
custom_host = gajim.config.get_per('accounts', account, 'hostname')
|
||||||
gajim.config.set_per('accounts', account, 'custom_host', custom_host)
|
gajim.config.set_per('accounts', account, 'custom_host',
|
||||||
|
custom_host)
|
||||||
self.xml.get_object('custom_host_entry1').set_text(custom_host)
|
self.xml.get_object('custom_host_entry1').set_text(custom_host)
|
||||||
custom_port = gajim.config.get_per('accounts', account, 'custom_port')
|
custom_port = gajim.config.get_per('accounts', account, 'custom_port')
|
||||||
if not custom_port:
|
if not custom_port:
|
||||||
custom_port = 5222
|
custom_port = 5222
|
||||||
gajim.config.set_per('accounts', account, 'custom_port', custom_port)
|
gajim.config.set_per('accounts', account, 'custom_port',
|
||||||
|
custom_port)
|
||||||
self.xml.get_object('custom_port_entry1').set_text(unicode(custom_port))
|
self.xml.get_object('custom_port_entry1').set_text(unicode(custom_port))
|
||||||
|
|
||||||
# Personal tab
|
# Personal tab
|
||||||
|
@ -1937,8 +1945,8 @@ class AccountsWindow:
|
||||||
self.xml.get_object('gpg_choose_button1').set_sensitive(False)
|
self.xml.get_object('gpg_choose_button1').set_sensitive(False)
|
||||||
|
|
||||||
# General tab
|
# General tab
|
||||||
self.xml.get_object('autoconnect_checkbutton1').set_active(gajim.config.\
|
self.xml.get_object('autoconnect_checkbutton1').set_active(
|
||||||
get_per('accounts', account, 'autoconnect'))
|
gajim.config.get_per('accounts', account, 'autoconnect'))
|
||||||
self.xml.get_object('autoreconnect_checkbutton1').set_active(gajim.
|
self.xml.get_object('autoreconnect_checkbutton1').set_active(gajim.
|
||||||
config.get_per('accounts', account, 'autoreconnect'))
|
config.get_per('accounts', account, 'autoreconnect'))
|
||||||
|
|
||||||
|
@ -1950,7 +1958,8 @@ class AccountsWindow:
|
||||||
self.xml.get_object('log_history_checkbutton1').set_active(True)
|
self.xml.get_object('log_history_checkbutton1').set_active(True)
|
||||||
|
|
||||||
self.xml.get_object('sync_with_global_status_checkbutton1').set_active(
|
self.xml.get_object('sync_with_global_status_checkbutton1').set_active(
|
||||||
gajim.config.get_per('accounts', account, 'sync_with_global_status'))
|
gajim.config.get_per('accounts', account,
|
||||||
|
'sync_with_global_status'))
|
||||||
self.xml.get_object('use_ft_proxies_checkbutton1').set_active(
|
self.xml.get_object('use_ft_proxies_checkbutton1').set_active(
|
||||||
gajim.config.get_per('accounts', account, 'use_ft_proxies'))
|
gajim.config.get_per('accounts', account, 'use_ft_proxies'))
|
||||||
|
|
||||||
|
@ -2050,11 +2059,13 @@ class AccountsWindow:
|
||||||
gajim.block_signed_in_notifications[old_name]
|
gajim.block_signed_in_notifications[old_name]
|
||||||
gajim.groups[new_name] = gajim.groups[old_name]
|
gajim.groups[new_name] = gajim.groups[old_name]
|
||||||
gajim.gc_connected[new_name] = gajim.gc_connected[old_name]
|
gajim.gc_connected[new_name] = gajim.gc_connected[old_name]
|
||||||
gajim.automatic_rooms[new_name] = gajim.automatic_rooms[old_name]
|
gajim.automatic_rooms[new_name] = gajim.automatic_rooms[
|
||||||
|
old_name]
|
||||||
gajim.newly_added[new_name] = gajim.newly_added[old_name]
|
gajim.newly_added[new_name] = gajim.newly_added[old_name]
|
||||||
gajim.to_be_removed[new_name] = gajim.to_be_removed[old_name]
|
gajim.to_be_removed[new_name] = gajim.to_be_removed[old_name]
|
||||||
gajim.sleeper_state[new_name] = gajim.sleeper_state[old_name]
|
gajim.sleeper_state[new_name] = gajim.sleeper_state[old_name]
|
||||||
gajim.encrypted_chats[new_name] = gajim.encrypted_chats[old_name]
|
gajim.encrypted_chats[new_name] = gajim.encrypted_chats[
|
||||||
|
old_name]
|
||||||
gajim.last_message_time[new_name] = \
|
gajim.last_message_time[new_name] = \
|
||||||
gajim.last_message_time[old_name]
|
gajim.last_message_time[old_name]
|
||||||
gajim.status_before_autoaway[new_name] = \
|
gajim.status_before_autoaway[new_name] = \
|
||||||
|
@ -2078,7 +2089,8 @@ class AccountsWindow:
|
||||||
|
|
||||||
# ServiceCache object keep old property account
|
# ServiceCache object keep old property account
|
||||||
if hasattr(gajim.connections[old_name], 'services_cache'):
|
if hasattr(gajim.connections[old_name], 'services_cache'):
|
||||||
gajim.connections[old_name].services_cache.account = new_name
|
gajim.connections[old_name].services_cache.account = \
|
||||||
|
new_name
|
||||||
del gajim.interface.instances[old_name]
|
del gajim.interface.instances[old_name]
|
||||||
del gajim.interface.minimized_controls[old_name]
|
del gajim.interface.minimized_controls[old_name]
|
||||||
del gajim.nicks[old_name]
|
del gajim.nicks[old_name]
|
||||||
|
@ -2121,8 +2133,8 @@ class AccountsWindow:
|
||||||
ok_handler=(on_renamed, self.current_account))
|
ok_handler=(on_renamed, self.current_account))
|
||||||
|
|
||||||
def option_changed(self, option, value):
|
def option_changed(self, option, value):
|
||||||
return gajim.config.get_per('accounts', self.current_account, option) != \
|
return gajim.config.get_per('accounts', self.current_account, option) \
|
||||||
value
|
!= value
|
||||||
|
|
||||||
def on_jid_entry1_focus_out_event(self, widget, event):
|
def on_jid_entry1_focus_out_event(self, widget, event):
|
||||||
if self.ignore_events:
|
if self.ignore_events:
|
||||||
|
@ -2143,7 +2155,8 @@ class AccountsWindow:
|
||||||
self.current_account, 'anonymous_auth'):
|
self.current_account, 'anonymous_auth'):
|
||||||
if not widget.is_focus():
|
if not widget.is_focus():
|
||||||
pritext = _('Invalid Jabber ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
sectext = _('A Jabber ID must be in the form "user@servername".')
|
sectext = \
|
||||||
|
_('A Jabber ID must be in the form "user@servername".')
|
||||||
dialogs.ErrorDialog(pritext, sectext)
|
dialogs.ErrorDialog(pritext, sectext)
|
||||||
gobject.idle_add(lambda: widget.grab_focus())
|
gobject.idle_add(lambda: widget.grab_focus())
|
||||||
return True
|
return True
|
||||||
|
@ -2194,7 +2207,8 @@ class AccountsWindow:
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
password_entry = self.xml.get_object('password_entry1')
|
password_entry = self.xml.get_object('password_entry1')
|
||||||
password_entry.set_sensitive(active)
|
password_entry.set_sensitive(active)
|
||||||
gajim.config.set_per('accounts', self.current_account, 'savepass', active)
|
gajim.config.set_per('accounts', self.current_account, 'savepass',
|
||||||
|
active)
|
||||||
if active:
|
if active:
|
||||||
password = password_entry.get_text()
|
password = password_entry.get_text()
|
||||||
passwords.save_password(self.current_account, password)
|
passwords.save_password(self.current_account, password)
|
||||||
|
@ -2247,8 +2261,10 @@ class AccountsWindow:
|
||||||
if new_password is not None:
|
if new_password is not None:
|
||||||
gajim.connections[self.current_account].change_password(
|
gajim.connections[self.current_account].change_password(
|
||||||
new_password)
|
new_password)
|
||||||
if self.xml.get_object('save_password_checkbutton1').get_active():
|
if self.xml.get_object('save_password_checkbutton1').\
|
||||||
self.xml.get_object('password_entry1').set_text(new_password)
|
get_active():
|
||||||
|
self.xml.get_object('password_entry1').set_text(
|
||||||
|
new_password)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dialogs.ChangePasswordDialog(self.current_account, on_changed)
|
dialogs.ChangePasswordDialog(self.current_account, on_changed)
|
||||||
|
@ -2399,8 +2415,10 @@ class AccountsWindow:
|
||||||
wiget_name_ext = '2'
|
wiget_name_ext = '2'
|
||||||
else:
|
else:
|
||||||
wiget_name_ext = '1'
|
wiget_name_ext = '1'
|
||||||
gpg_key_label = self.xml.get_object('gpg_key_label' + wiget_name_ext)
|
gpg_key_label = self.xml.get_object('gpg_key_label' + \
|
||||||
gpg_name_label = self.xml.get_object('gpg_name_label' + wiget_name_ext)
|
wiget_name_ext)
|
||||||
|
gpg_name_label = self.xml.get_object('gpg_name_label' + \
|
||||||
|
wiget_name_ext)
|
||||||
use_gpg_agent_checkbutton = self.xml.get_object(
|
use_gpg_agent_checkbutton = self.xml.get_object(
|
||||||
'use_gpg_agent_checkbutton' + wiget_name_ext)
|
'use_gpg_agent_checkbutton' + wiget_name_ext)
|
||||||
if keyID[0] == _('None'):
|
if keyID[0] == _('None'):
|
||||||
|
@ -2409,17 +2427,18 @@ class AccountsWindow:
|
||||||
use_gpg_agent_checkbutton.set_sensitive(False)
|
use_gpg_agent_checkbutton.set_sensitive(False)
|
||||||
if self.option_changed('keyid', ''):
|
if self.option_changed('keyid', ''):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyname',
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
|
'keyname', '')
|
||||||
|
gajim.config.set_per('accounts', self.current_account, 'keyid',
|
||||||
'')
|
'')
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyid', '')
|
|
||||||
else:
|
else:
|
||||||
gpg_key_label.set_text(keyID[0])
|
gpg_key_label.set_text(keyID[0])
|
||||||
gpg_name_label.set_text(keyID[1])
|
gpg_name_label.set_text(keyID[1])
|
||||||
use_gpg_agent_checkbutton.set_sensitive(True)
|
use_gpg_agent_checkbutton.set_sensitive(True)
|
||||||
if self.option_changed('keyid', keyID[0]):
|
if self.option_changed('keyid', keyID[0]):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyname',
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
keyID[1])
|
'keyname', keyID[1])
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyid',
|
gajim.config.set_per('accounts', self.current_account, 'keyid',
|
||||||
keyID[0])
|
keyID[0])
|
||||||
|
|
||||||
|
@ -2432,7 +2451,7 @@ class AccountsWindow:
|
||||||
|
|
||||||
def on_edit_details_button1_clicked(self, widget):
|
def on_edit_details_button1_clicked(self, widget):
|
||||||
if self.current_account not in gajim.interface.instances:
|
if self.current_account not in gajim.interface.instances:
|
||||||
dialogs.ErrorDialog(_('No such account available'),
|
dlg = dialogs.ErrorDialog(_('No such account available'),
|
||||||
_('You must create your account before editing your personal '
|
_('You must create your account before editing your personal '
|
||||||
'information.'))
|
'information.'))
|
||||||
return
|
return
|
||||||
|
@ -2441,7 +2460,8 @@ class AccountsWindow:
|
||||||
if self.current_account not in gajim.connections or \
|
if self.current_account not in gajim.connections or \
|
||||||
gajim.connections[self.current_account].connected < 2:
|
gajim.connections[self.current_account].connected < 2:
|
||||||
dialogs.ErrorDialog(_('You are not connected to the server'),
|
dialogs.ErrorDialog(_('You are not connected to the server'),
|
||||||
_('Without a connection, you can not edit your personal information.'))
|
_('Without a connection, you can not edit your personal '
|
||||||
|
'information.'))
|
||||||
return
|
return
|
||||||
|
|
||||||
if not gajim.connections[self.current_account].vcard_supported:
|
if not gajim.connections[self.current_account].vcard_supported:
|
||||||
|
@ -2616,7 +2636,7 @@ class AccountsWindow:
|
||||||
self.xml.get_object('custom_port_entry2').set_sensitive(
|
self.xml.get_object('custom_port_entry2').set_sensitive(
|
||||||
widget.get_active())
|
widget.get_active())
|
||||||
self.on_checkbutton_toggled(widget, 'use_custom_host',
|
self.on_checkbutton_toggled(widget, 'use_custom_host',
|
||||||
account = self.current_account)
|
account=self.current_account)
|
||||||
if not widget.get_active():
|
if not widget.get_active():
|
||||||
self.xml.get_object('custom_port_entry2').set_text('5298')
|
self.xml.get_object('custom_port_entry2').set_text('5298')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue