remove lots of unnecessary if

if x: set(true) else: set(false)
become
set(x)
This commit is contained in:
Vincent Hanquez 2005-04-20 18:10:37 +00:00
parent 5c8314df93
commit c742cf8e10
1 changed files with 9 additions and 26 deletions

View File

@ -62,10 +62,7 @@ class Preferences_window:
def on_checkbutton_toggled(self, widget, config_name, \ def on_checkbutton_toggled(self, widget, config_name, \
change_sensitivity_widgets = None): change_sensitivity_widgets = None):
if widget.get_active(): gajim.config.set(config_name, widget.get_active())
gajim.config.set(config_name, True)
else:
gajim.config.set(config_name, False)
if change_sensitivity_widgets != None: if change_sensitivity_widgets != None:
for w in change_sensitivity_widgets: for w in change_sensitivity_widgets:
w.set_sensitive(widget.get_active()) w.set_sensitive(widget.get_active())
@ -479,31 +476,20 @@ class Preferences_window:
self.plugin.save_config() self.plugin.save_config()
def on_log_in_contact_checkbutton_toggled(self, widget): def on_log_in_contact_checkbutton_toggled(self, widget):
if widget.get_active(): gajim.config.set('lognotusr', widget.get_active())
gajim.config.set('lognotusr', True)
else:
gajim.config.set('lognotusr', False)
self.plugin.save_config() self.plugin.save_config()
def on_log_in_extern_checkbutton_toggled(self, widget): def on_log_in_extern_checkbutton_toggled(self, widget):
if widget.get_active(): gajim.config.set('lognotsep', widget.get_active())
gajim.config.set('lognotsep', True)
else:
gajim.config.set('lognotsep', False)
self.plugin.save_config() self.plugin.save_config()
def on_do_not_send_os_info_checkbutton_toggled(self, widget): def on_do_not_send_os_info_checkbutton_toggled(self, widget):
if widget.get_active(): gajim.config.set('do_not_send_os_info', widget.get_active())
gajim.config.set('do_not_send_os_info', True)
else:
gajim.config.set('do_not_send_os_info', False)
self.plugin.save_config() self.plugin.save_config()
def on_do_not_check_for_new_version_checkbutton_toggled(self, widget): def on_do_not_check_for_new_version_checkbutton_toggled(self, widget):
if widget.get_active(): gajim.config.set('do_not_check_for_new_version',
gajim.config.set('do_not_check_for_new_version', True) widget.get_active())
else:
gajim.config.set('do_not_check_for_new_version', False)
self.plugin.save_config() self.plugin.save_config()
def fill_msg_treeview(self): def fill_msg_treeview(self):
@ -1396,12 +1382,9 @@ class Accounts_window:
Account_modification_window(self.plugin, account) Account_modification_window(self.plugin, account)
def on_sync_with_global_status_checkbutton_toggled(self, widget): def on_sync_with_global_status_checkbutton_toggled(self, widget):
if widget.get_active(): gajim.config.set_per('accounts', account,
gajim.config.set_per('accounts', account, 'sync_with_global_status', \ 'sync_with_global_status',
False) not widget.get_active())
else:
gajim.config.set_per('accounts', account, 'sync_with_global_status', \
True)
def __init__(self, plugin): def __init__(self, plugin):
self.plugin = plugin self.plugin = plugin