changeset ac9c8fffc491 in /home/hg/repos/gajim
branches: gtk3 details:http://hg.gajim.org/gajim?cmd=changeset;node=ac9c8fffc491 description: coding standards
diffstat:
src/config.py | 266 +++++++++++++++++++++++++++++++-------------------------- 1 files changed, 143 insertions(+), 123 deletions(-)
diffs (truncated from 750 to 300 lines):
diff -r a4a064255eed -r ac9c8fffc491 src/config.py --- a/src/config.py Fri Aug 16 00:55:01 2013 +0400 +++ b/src/config.py Thu Aug 15 14:57:39 2013 +0200 @@ -1639,7 +1639,8 @@ gajim.connections[account].change_status(show, status)
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: gajim.connections[gajim.ZEROCONF_ACC_NAME].update_details() return @@ -1658,11 +1659,13 @@
def relog(account): 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 gajim.interface.roster.send_status(account, 'offline', - _('Be right back.')) - GLib.timeout_add(500, login, account, show_before, status_before) + _('Be right back.')) + GLib.timeout_add(500, login, account, show_before, + status_before)
def on_yes(checked, account): relog(account) @@ -1671,10 +1674,10 @@ self.resend(account) if self.current_account in gajim.connections: self.dialog = dialogs.YesNoDialog(_('Relogin now?'), - _('If you want all the changes to apply instantly, ' - 'you must relogin.'), on_response_yes=(on_yes, - self.current_account), on_response_no=(on_no, - self.current_account)) + _('If you want all the changes to apply instantly, ' + 'you must relogin.'), on_response_yes=(on_yes, + self.current_account), on_response_no=(on_no, + self.current_account)) elif self.resend_presence: self.resend(self.current_account)
@@ -1695,7 +1698,8 @@ else: iter_ = account = None 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 # Save config for previous account if needed cause focus_out event is # called after the changed event @@ -1713,8 +1717,8 @@ elif focused_widget_name == 'cert_entry1': func = self.on_cert_entry1_focus_out_event if func(focused_widget, None): - # Error detected in entry, don't change account, re-put cursor on - # previous row + # Error detected in entry, don't change account, + # re-put cursor on previous row self.select_account(self.current_account) return True self.window.set_focus(widget) @@ -1753,7 +1757,7 @@ def update_proxy_list(self): if self.current_account: our_proxy = gajim.config.get_per('accounts', self.current_account, - 'proxy') + 'proxy') else: our_proxy = ''
@@ -1773,7 +1777,8 @@ if not self.current_account: self.notebook.set_current_page(0) 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.init_zeroconf_account() self.ignore_events = False @@ -1786,38 +1791,39 @@
def init_zeroconf_account(self): active = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'active') + 'active') self.xml.get_object('enable_zeroconf_checkbutton2').set_active(active) if not gajim.HAVE_ZEROCONF: self.xml.get_object('enable_zeroconf_checkbutton2').set_sensitive( - False) + False) self.xml.get_object('zeroconf_notebook').set_sensitive(active) # General tab st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'autoconnect') + 'autoconnect') self.xml.get_object('autoconnect_checkbutton2').set_active(st)
list_no_log_for = gajim.config.get_per('accounts', - gajim.ZEROCONF_ACC_NAME, 'no_log_for').split() + gajim.ZEROCONF_ACC_NAME, 'no_log_for').split() if gajim.ZEROCONF_ACC_NAME in list_no_log_for: self.xml.get_object('log_history_checkbutton2').set_active(0) else: self.xml.get_object('log_history_checkbutton2').set_active(1)
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'sync_with_global_status') - self.xml.get_object('sync_with_global_status_checkbutton2').set_active(st) + 'sync_with_global_status') + self.xml.get_object('sync_with_global_status_checkbutton2').set_active( + st)
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'use_custom_host') + 'use_custom_host') self.xml.get_object('custom_port_checkbutton2').set_active(st) self.xml.get_object('custom_port_entry2').set_sensitive(st)
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'custom_port') + 'custom_port') if not st: gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'custom_port', '5298') + 'custom_port', '5298') st = '5298' self.xml.get_object('custom_port_entry2').set_text(str(st))
@@ -1833,7 +1839,7 @@
for opt in ('first_name', 'last_name', 'jabber_id', 'email'): st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, - 'zeroconf_' + opt) + 'zeroconf_' + opt) self.xml.get_object(opt + '_entry2').set_text(st)
def init_account_gpg(self): @@ -1850,7 +1856,7 @@ gpg_key_label = self.xml.get_object('gpg_key_label' + widget_name_add) gpg_name_label = self.xml.get_object('gpg_name_label' + widget_name_add) use_gpg_agent_checkbutton = self.xml.get_object( - 'use_gpg_agent_checkbutton' + widget_name_add) + 'use_gpg_agent_checkbutton' + widget_name_add)
if not keyid: use_gpg_agent_checkbutton.set_sensitive(False) @@ -1896,7 +1902,7 @@ password_entry.set_text(passstr)
jid = gajim.config.get_per('accounts', account, 'name') \ - + '@' + gajim.config.get_per('accounts', account, 'hostname') + + '@' + gajim.config.get_per('accounts', account, 'hostname') self.xml.get_object('jid_entry1').set_text(jid) self.ignore_events = False
@@ -1923,36 +1929,38 @@ else: spinbutton.set_range(0, 127) spinbutton.set_value(gajim.config.get_per('accounts', account, - 'priority')) + 'priority'))
# Connection tab use_env_http_proxy = gajim.config.get_per('accounts', account, - 'use_env_http_proxy') + 'use_env_http_proxy') self.xml.get_object('use_env_http_proxy_checkbutton1').set_active( - use_env_http_proxy) + use_env_http_proxy) self.xml.get_object('proxy_hbox1').set_sensitive(not use_env_http_proxy)
warn_when_insecure_ssl = gajim.config.get_per('accounts', account, - 'warn_when_insecure_ssl_connection') + 'warn_when_insecure_ssl_connection') self.xml.get_object('warn_when_insecure_connection_checkbutton1').\ - set_active(warn_when_insecure_ssl) + set_active(warn_when_insecure_ssl)
self.xml.get_object('send_keepalive_checkbutton1').set_active( - gajim.config.get_per('accounts', account, 'keep_alives_enabled')) + gajim.config.get_per('accounts', account, 'keep_alives_enabled'))
use_custom_host = gajim.config.get_per('accounts', account, - 'use_custom_host') + 'use_custom_host') self.xml.get_object('custom_host_port_checkbutton1').set_active( - use_custom_host) + use_custom_host) custom_host = gajim.config.get_per('accounts', account, 'custom_host') if not custom_host: 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) custom_port = gajim.config.get_per('accounts', account, 'custom_port') if not custom_port: 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(str(custom_port))
# Personal tab @@ -1965,22 +1973,23 @@ self.xml.get_object('gpg_choose_button1').set_sensitive(False)
# General tab - self.xml.get_object('autoconnect_checkbutton1').set_active(gajim.config.\ - get_per('accounts', account, 'autoconnect')) + self.xml.get_object('autoconnect_checkbutton1').set_active( + gajim.config.get_per('accounts', account, 'autoconnect')) self.xml.get_object('autoreconnect_checkbutton1').set_active(gajim. - config.get_per('accounts', account, 'autoreconnect')) + config.get_per('accounts', account, 'autoreconnect'))
list_no_log_for = gajim.config.get_per('accounts', account, - 'no_log_for').split() + 'no_log_for').split() if account in list_no_log_for: self.xml.get_object('log_history_checkbutton1').set_active(False) else: self.xml.get_object('log_history_checkbutton1').set_active(True)
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( - gajim.config.get_per('accounts', account, 'use_ft_proxies')) + gajim.config.get_per('accounts', account, 'use_ft_proxies'))
def on_add_button_clicked(self, widget): """ @@ -1990,7 +1999,7 @@ gajim.interface.instances['account_creation_wizard'].window.present() else: gajim.interface.instances['account_creation_wizard'] = \ - AccountCreationWizardWindow() + AccountCreationWizardWindow()
def on_remove_button_clicked(self, widget): """ @@ -2002,7 +2011,7 @@ account = self.current_account if len(gajim.events.get_events(account)): dialogs.ErrorDialog(_('Unread events'), - _('Read all pending events before removing this account.')) + _('Read all pending events before removing this account.')) return
if gajim.config.get_per('accounts', account, 'is_zeroconf'): @@ -2028,13 +2037,13 @@ if not account in gajim.interface.instances: gajim.interface.instances[account] = {} gajim.interface.instances[account]['remove_account'] = \ - RemoveAccountWindow(account) + RemoveAccountWindow(account) if win_opened: dialogs.ConfirmationDialog( - _('You have opened chat in account %s') % account, - _('All chat and groupchat windows will be closed. Do you want to ' - 'continue?'), - on_response_ok = (remove, account)) + _('You have opened chat in account %s') % account, + _('All chat and groupchat windows will be closed. Do you want to ' + 'continue?'), + on_response_ok = (remove, account)) else: remove(account)
@@ -2044,52 +2053,54 @@ active = gajim.config.get_per('accounts', self.current_account, 'active') if active and gajim.connections[self.current_account].connected != 0: dialogs.ErrorDialog( - _('You are currently connected to the server'), - _('To change the account name, you must be disconnected.')) + _('You are currently connected to the server'), + _('To change the account name, you must be disconnected.')) return if len(gajim.events.get_events(self.current_account)): dialogs.ErrorDialog(_('Unread events'), - _('To change the account name, you must read all pending ' - 'events.')) + _('To change the account name, you must read all pending ' + 'events.')) return # Get the new name def on_renamed(new_name, old_name): if new_name in gajim.connections: dialogs.ErrorDialog(_('Account Name Already Used'), - _('This name is already used by another of your accounts. ' - 'Please choose another name.')) + _('This name is already used by another of your accounts. '