coding standards

This commit is contained in:
Denis Fomin 2010-11-06 16:01:28 +03:00
parent 69578659a2
commit f1b9e29fe3

View file

@ -711,8 +711,8 @@ class ChangeStatusMessageDialog(TimeoutDialog):
message = helpers.remove_invalid_xml_chars(message)
msg = helpers.to_one_line(message)
if self.show:
gajim.config.set_per('statusmsg', '_last_' + self.show, 'message',
msg)
gajim.config.set_per('statusmsg', '_last_' + self.show,
'message', msg)
if self.show_pep:
gajim.config.set_per('statusmsg', '_last_' + self.show,
'activity', self.pep_dict['activity'])
@ -720,8 +720,8 @@ class ChangeStatusMessageDialog(TimeoutDialog):
'subactivity', self.pep_dict['subactivity'])
gajim.config.set_per('statusmsg', '_last_' + self.show,
'activity_text', self.pep_dict['activity_text'])
gajim.config.set_per('statusmsg', '_last_' + self.show, 'mood',
self.pep_dict['mood'])
gajim.config.set_per('statusmsg', '_last_' + self.show,
'mood', self.pep_dict['mood'])
gajim.config.set_per('statusmsg', '_last_' + self.show,
'mood_text', self.pep_dict['mood_text'])
else:
@ -777,11 +777,13 @@ class ChangeStatusMessageDialog(TimeoutDialog):
msg_name = msg_text_1l.decode('utf-8')
def on_ok2():
self.preset_messages_dict[msg_name] = [msg_text, self.pep_dict.get(
'activity'), self.pep_dict.get('subactivity'), self.pep_dict.get(
'activity_text'), self.pep_dict.get('mood'), self.pep_dict.get(
'mood_text')]
gajim.config.set_per('statusmsg', msg_name, 'message', msg_text_1l)
self.preset_messages_dict[msg_name] = [
msg_text, self.pep_dict.get('activity'),
self.pep_dict.get('subactivity'),
self.pep_dict.get('activity_text'),
self.pep_dict.get('mood'), self.pep_dict.get('mood_text')]
gajim.config.set_per('statusmsg', msg_name, 'message',
msg_text_1l)
gajim.config.set_per('statusmsg', msg_name, 'activity',
self.pep_dict.get('activity'))
gajim.config.set_per('statusmsg', msg_name, 'subactivity',
@ -1187,8 +1189,7 @@ class AboutDialog:
text = open(copying_file_path).read()
dlg.set_license(text)
dlg.set_comments('%s\n%s %s\n%s %s'
% (_('A GTK+ jabber client'), \
dlg.set_comments('%s\n%s %s\n%s %s' % (_('A GTK+ jabber client'),
_('GTK+ Version:'), self.tuple2str(gtk.gtk_version), \
_('PyGTK Version:'), self.tuple2str(gtk.pygtk_version)))
dlg.set_website('http://www.gajim.org/')
@ -2132,7 +2133,8 @@ class SubscriptionRequestWindow:
"""
menu = self.prepare_popup_menu()
menu.show_all()
gtkgui_helpers.popup_emoticons_under_button(menu, widget, self.window.window)
gtkgui_helpers.popup_emoticons_under_button(menu, widget,
self.window.window)
class JoinGroupchatWindow:
@ -2396,11 +2398,11 @@ class SynchroniseSelectAccountDialog:
self.accounts_treeview.set_model(model)
# columns
renderer = gtk.CellRendererText()
self.accounts_treeview.insert_column_with_attributes(-1,
_('Name'), renderer, text=0)
self.accounts_treeview.insert_column_with_attributes(-1, _('Name'),
renderer, text=0)
renderer = gtk.CellRendererText()
self.accounts_treeview.insert_column_with_attributes(-1,
_('Server'), renderer, text=1)
self.accounts_treeview.insert_column_with_attributes(-1, _('Server'),
renderer, text=1)
self.xml.connect_signals(self)
self.init_accounts()
@ -2421,8 +2423,8 @@ class SynchroniseSelectAccountDialog:
# Do not show the account we're sync'ing
continue
iter_ = model.append()
model.set(iter_, 0, remote_account, 1, gajim.get_hostname_from_account(
remote_account))
model.set(iter_, 0, remote_account, 1,
gajim.get_hostname_from_account(remote_account))
def on_cancel_button_clicked(self, widget):
self.dialog.destroy()
@ -2450,7 +2452,8 @@ class SynchroniseSelectContactsDialog:
def __init__(self, account, remote_account):
self.local_account = account
self.remote_account = remote_account
self.xml = gtkgui_helpers.get_gtk_builder('synchronise_select_contacts_dialog.ui')
self.xml = gtkgui_helpers.get_gtk_builder(
'synchronise_select_contacts_dialog.ui')
self.dialog = self.xml.get_object('synchronise_select_contacts_dialog')
self.contacts_treeview = self.xml.get_object('contacts_treeview')
model = gtk.ListStore(bool, str)
@ -2462,8 +2465,8 @@ class SynchroniseSelectContactsDialog:
self.contacts_treeview.insert_column_with_attributes(-1,
_('Synchronise'), renderer1, active=0)
renderer2 = gtk.CellRendererText()
self.contacts_treeview.insert_column_with_attributes(-1,
_('Name'), renderer2, text=1)
self.contacts_treeview.insert_column_with_attributes(-1, _('Name'),
renderer2, text=1)
self.xml.connect_signals(self)
self.init_contacts()
@ -3191,7 +3194,8 @@ class RosterItemExchangeWindow:
show_dialog = False
# Connect to gtk builder
self.xml = gtkgui_helpers.get_gtk_builder('roster_item_exchange_window.ui')
self.xml = gtkgui_helpers.get_gtk_builder(
'roster_item_exchange_window.ui')
self.window = self.xml.get_object('roster_item_exchange_window')
# Add Widgets.
@ -4118,8 +4122,7 @@ class PrivacyListsWindow:
'delete_privacy_list_button', 'open_privacy_list_button',
'new_privacy_list_button', 'new_privacy_list_entry',
'privacy_lists_refresh_button', 'close_privacy_lists_window_button'):
self.__dict__[widget_to_add] = self.xml.get_object(
widget_to_add)
self.__dict__[widget_to_add] = self.xml.get_object(widget_to_add)
self.draw_privacy_lists_in_combobox([])
self.privacy_lists_refresh()
@ -4351,8 +4354,7 @@ class SoundChooserDialog(FileChooserDialog):
if os.path.exists(path_to_snd_file):
callback(widget, path_to_snd_file)
FileChooserDialog.__init__(self,
title_text = _('Choose Sound'),
FileChooserDialog.__init__(self, title_text = _('Choose Sound'),
action = gtk.FILE_CHOOSER_ACTION_OPEN,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK),
@ -4524,7 +4526,8 @@ class AddSpecialNotificationDialog:
jid is the jid for which we want to add special notification (sound and
notification popups)
"""
self.xml = gtkgui_helpers.get_gtk_builder('add_special_notification_window.ui')
self.xml = gtkgui_helpers.get_gtk_builder(
'add_special_notification_window.ui')
self.window = self.xml.get_object('add_special_notification_window')
self.condition_combobox = self.xml.get_object('condition_combobox')
self.condition_combobox.set_active(0)
@ -4578,7 +4581,8 @@ class AdvancedNotificationsWindow:
'tab_opened', 'sound', 'sound_file', 'popup', 'auto_open',
'run_command', 'command', 'systray', 'roster', 'urgency_hint']
def __init__(self):
self.xml = gtkgui_helpers.get_gtk_builder('advanced_notifications_window.ui')
self.xml = gtkgui_helpers.get_gtk_builder(
'advanced_notifications_window.ui')
self.window = self.xml.get_object('advanced_notifications_window')
for w in ('conditions_treeview', 'config_vbox', 'event_combobox',
'recipient_type_combobox', 'recipient_list_entry', 'delete_button',
@ -4798,10 +4802,12 @@ class AdvancedNotificationsWindow:
if not iter_:
return
for opt in self.config_options:
val = gajim.config.get_per('notifications', str(self.active_num), opt)
val2 = gajim.config.get_per('notifications', str(self.active_num - 1),
val = gajim.config.get_per('notifications', str(self.active_num),
opt)
gajim.config.set_per('notifications', str(self.active_num), opt, val2)
val2 = gajim.config.get_per('notifications',
str(self.active_num - 1), opt)
gajim.config.set_per('notifications', str(self.active_num), opt,
val2)
gajim.config.set_per('notifications', str(self.active_num - 1), opt,
val)
@ -4817,10 +4823,12 @@ class AdvancedNotificationsWindow:
if not iter_:
return
for opt in self.config_options:
val = gajim.config.get_per('notifications', str(self.active_num), opt)
val2 = gajim.config.get_per('notifications', str(self.active_num + 1),
val = gajim.config.get_per('notifications', str(self.active_num),
opt)
gajim.config.set_per('notifications', str(self.active_num), opt, val2)
val2 = gajim.config.get_per('notifications',
str(self.active_num + 1), opt)
gajim.config.set_per('notifications', str(self.active_num), opt,
val2)
gajim.config.set_per('notifications', str(self.active_num + 1), opt,
val)
@ -4942,7 +4950,8 @@ class AdvancedNotificationsWindow:
gajim.config.set_per('notifications', str(self.active_num), option,
'no')
else:
gajim.config.set_per('notifications', str(self.active_num), option, '')
gajim.config.set_per('notifications', str(self.active_num),
option, '')
def on_disable_it_toggled(self, widget, oposite_widget, option):
if widget.get_active():
@ -4954,7 +4963,8 @@ class AdvancedNotificationsWindow:
gajim.config.set_per('notifications', str(self.active_num), option,
'yes')
else:
gajim.config.set_per('notifications', str(self.active_num), option, '')
gajim.config.set_per('notifications', str(self.active_num), option,
'')
def on_use_sound_cb_toggled(self, widget):
self.on_use_it_toggled(widget, self.disable_sound_cb, 'sound')
@ -5002,8 +5012,8 @@ class AdvancedNotificationsWindow:
self.on_disable_it_toggled(widget, self.use_auto_open_cb, 'auto_open')
def on_run_command_cb_toggled(self, widget):
gajim.config.set_per('notifications', str(self.active_num), 'run_command',
widget.get_active())
gajim.config.set_per('notifications', str(self.active_num),
'run_command', widget.get_active())
if widget.get_active():
self.command_entry.set_sensitive(True)
else:
@ -5107,8 +5117,8 @@ class TransformChatToMUC:
if gajim.connections[account].is_zeroconf:
continue
for jid in gajim.contacts.get_jid_list(account):
contact = \
gajim.contacts.get_contact_with_highest_priority(account, jid)
contact = gajim.contacts.get_contact_with_highest_priority(
account, jid)
contact_transport = gajim.get_transport_name_from_jid(jid)
# Add contact if it can be invited
if invitable(contact, contact_transport) and \
@ -5121,8 +5131,7 @@ class TransformChatToMUC:
# preselect treeview rows
if self.preselected_jids and jid in self.preselected_jids:
path = self.store.get_path(iter_)
self.guests_treeview.get_selection().\
select_path(path)
self.guests_treeview.get_selection().select_path(path)
# show all
self.window.show_all()
@ -5377,7 +5386,8 @@ class VoIPCallReceivedDialog(object):
# do the substitution
self.dialog.set_property('secondary-text',
_('%(contact)s wants to start %(type)s session with you. Do you want '
'to answer the call?') % {'contact': self.contact_text, 'type': types_text})
'to answer the call?') % {'contact': self.contact_text,
'type': types_text})
def add_contents(self, content_types):
for type_ in content_types: