diff --git a/src/chat.py b/src/chat.py index ce61ba07ca58a56285da03e47589b3d293fb3f12..4a5c0d10e2bf5073c214cd330f04bbfdb2a163f4 100644 --- a/src/chat.py +++ b/src/chat.py @@ -210,7 +210,7 @@ class Chat: color = gtk.gdk.colormap_get_system().alloc_color(color) # We set the color for when it's the current tab or not nickname.modify_fg(gtk.STATE_NORMAL, color) - if chatstate in ['inactive', 'gone']: + if chatstate in ('inactive', 'gone'): # Adjust color to be lighter against the darker inactive # background p = 0.4 @@ -615,7 +615,8 @@ class Chat: def new_tab(self, jid): #FIXME: text formating buttons will be hidden in 0.8 release - for w in ['bold_togglebutton', 'italic_togglebutton', 'underline_togglebutton']: + for w in ('bold_togglebutton', 'italic_togglebutton', + 'underline_togglebutton'): self.xmls[jid].get_widget(w).set_no_show_all(True) self.set_compact_view(self.always_compact_view) diff --git a/src/config.py b/src/config.py index 4a2c17336733bdfb7f5f66b7d2fbd0a4070c91e2..d4deb774ae5c5144fefa818a0802c5dbb88d9317 100644 --- a/src/config.py +++ b/src/config.py @@ -672,7 +672,7 @@ class PreferencesWindow: def update_text_tags(self): '''Update color tags in Opened Chat Windows''' for a in gajim.connections: - for kind in ['chats', 'gc']: + for kind in ('chats', 'gc'): windows = gajim.interface.windows[a][kind] if windows.has_key('tabbed'): windows['tabbed'].update_tags() @@ -683,7 +683,7 @@ class PreferencesWindow: def update_text_font(self): '''Update text font in Opened Chat Windows''' for a in gajim.connections: - for kind in ['chats', 'gc']: + for kind in ('chats', 'gc'): windows = gajim.interface.windows[a][kind] if windows.has_key('tabbed'): windows['tabbed'].update_font() @@ -717,7 +717,7 @@ class PreferencesWindow: self.on_preference_widget_font_set(widget, 'conversation_font') def on_reset_colors_button_clicked(self, widget): - for i in ['inmsgcolor', 'outmsgcolor', 'statusmsgcolor']: + for i in ('inmsgcolor', 'outmsgcolor', 'statusmsgcolor'): gajim.config.set(i, gajim.interface.default_values[i]) self.xml.get_widget('incoming_msg_colorbutton').set_color(\ @@ -1283,7 +1283,7 @@ _('To change the account name, you must be disconnected.')).get_response() gajim.events_for_ui[name] = gajim.events_for_ui[self.account] #upgrade account variable in opened windows - for kind in ['infos', 'chats', 'gc', 'gc_config']: + for kind in ('infos', 'chats', 'gc', 'gc_config'): for j in gajim.interface.windows[name][kind]: gajim.interface.windows[name][kind][j].account = name @@ -1879,7 +1879,7 @@ class ServiceRegistrationWindow(DataFormWindow): nbrow = 0 table = self.xml.get_widget('table') for name in self.infos.keys(): - if name in ['key', 'instructions', 'x', 'registered']: + if name in ('key', 'instructions', 'x', 'registered'): continue if not name: continue @@ -2849,7 +2849,8 @@ class FirstTimeWizardWindow: def get_widgets(self, prefix): widgets = {} - for widget in [ 'nick_entry', + for widget in ( + 'nick_entry', 'server_comboboxentry', 'pass_entry', 'save_password_checkbutton', @@ -2857,7 +2858,7 @@ class FirstTimeWizardWindow: 'proxyport_entry', 'proxyuser_entry', 'proxypass_entry', - 'jid_label' ]: + 'jid_label'): widgets[widget] = self.xml.get_widget(prefix + widget) return widgets diff --git a/src/dialogs.py b/src/dialogs.py index 6b60e40a371f320df41c7f28a660c7cd2de23656..e2a4965882def66edcf6fef512568069b733b902 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -109,7 +109,7 @@ class EditGroupsDialog: store = gtk.ListStore(str, bool) self.list.set_model(store) for g in gajim.groups[self.account].keys(): - if g in [_('Transports'), _('not in the roster')]: + if g in (_('Transports'), _('not in the roster')): continue iter = store.append() store.set(iter, 0, g) @@ -795,8 +795,8 @@ class PopupNotificationWindow: close_button.modify_bg(gtk.STATE_NORMAL, red) eventbox.modify_bg(gtk.STATE_NORMAL, red) event_description_label.set_text(txt) - elif event_type in [_('New Message'), _('New Single Message'), - _('New Private Message')]: + elif event_type in (_('New Message'), _('New Single Message'), + _('New Private Message')): dodgerblue = gtk.gdk.color_parse('dodgerblue') close_button.modify_bg(gtk.STATE_NORMAL, dodgerblue) eventbox.modify_bg(gtk.STATE_NORMAL, dodgerblue) @@ -818,7 +818,7 @@ class PopupNotificationWindow: close_button.modify_bg(gtk.STATE_NORMAL, bg_color) eventbox.modify_bg(gtk.STATE_NORMAL, bg_color) event_description_label.set_text(txt) - elif event_type in [_('File Transfer Completed'), _('File Transfer Stopped')]: + elif event_type in (_('File Transfer Completed'), _('File Transfer Stopped')): bg_color = gtk.gdk.color_parse('yellowgreen') close_button.modify_bg(gtk.STATE_NORMAL, bg_color) eventbox.modify_bg(gtk.STATE_NORMAL, bg_color) diff --git a/src/gajim-remote.py b/src/gajim-remote.py index 21b9a6cb6e7225c12450b0c9d1f7c137d7be911a..69ed9123ab6736e71ccfa6e2a023b76754c04620 100755 --- a/src/gajim-remote.py +++ b/src/gajim-remote.py @@ -224,7 +224,7 @@ the contact list of this account'), False) def print_result(self, res): ''' Print retrieved result to the output ''' if res is not None: - if self.command in ['open_chat', 'send_message']: + if self.command in ('open_chat', 'send_message'): if self.command == 'send_message': self.argv_len -= 2 @@ -327,10 +327,10 @@ Please specify account for sending the message.') % sys.argv[2]) def print_info(self, level, prop_dict): ''' return formated string from serialized vcard data ''' if prop_dict is None or type(prop_dict) \ - not in [dict, list, tuple]: + not in (dict, list, tuple): return '' ret_str = '' - if type(prop_dict) in [list, tuple]: + if type(prop_dict) in (list, tuple): ret_str = '' spacing = ' ' * level * 4 for val in prop_dict: @@ -428,7 +428,7 @@ Please specify account for sending the message.') % sys.argv[2]) _str += '\'' elif chr == '\"': _str += '\"' - elif chr in ['u', 'x'] and is_unicode: + elif chr in ('u', 'x') and is_unicode: slashes -= 1 _str += '\\' + chr else: @@ -469,7 +469,7 @@ Please specify account for sending the message.') % sys.argv[2]) else: break return (_dict, next[1:]) - elif first_char in ['[', '(']: # return list + elif first_char in ('[', '('): # return list _tuple = [] if value[1] == ']': return ([], value[2:]) @@ -486,7 +486,7 @@ Please specify account for sending the message.') % sys.argv[2]) break if next[0] == ',': value = next - elif next[0] in [']', ')']: + elif next[0] in (']', ')'): break return (_tuple, next[1:]) diff --git a/src/gajim.py b/src/gajim.py index 08eb8f3f59950e431653a6ab4bc5fe6f401a98ce..98eb5742a082656f8704ab23326d276056249cc3 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -194,7 +194,7 @@ class Interface: def handle_event_error_answer(self, account, array): #('ERROR_ANSWER', account, (id, jid_from. errmsg, errcode)) id, jid_from, errmsg, errcode = array - if unicode(errcode) in ['403', '406'] and id: + if unicode(errcode) in ('403', '406') and id: # show the error dialog ft = self.windows['file_transfers'] sid = id diff --git a/src/roster_window.py b/src/roster_window.py index ed4e82ed204b9553e476f3c5bdc1b1278a105e51..b5eebaca442c73885aefaaa9a774d6dd71203b8f 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -231,7 +231,7 @@ class RosterWindow: elif jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent img = state_images[contact.show] else: - if contact.sub in ['both', 'to']: + if contact.sub in ('both', 'to'): img = state_images[contact.show] else: if contact.ask == 'subscribe': @@ -1043,7 +1043,7 @@ class RosterWindow: sub_menu = gtk.Menu() status_menuitem.set_submenu(sub_menu) - for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']: + for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'): uf_show = helpers.get_uf_show(show, use_mnemonic = True) item = gtk.ImageMenuItem(uf_show) icon = state_images[show] @@ -2382,7 +2382,7 @@ _('If "%s" accepts this request you will know his status.') %jid) self.status_combobox.set_row_separator_func(self.iter_is_separator) - for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']: + for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'): uf_show = helpers.get_uf_show(show) liststore.append([uf_show, self.jabber_state_images[show], show, True]) # Add a Separator (self.iter_is_separator() checks on string SEPARATOR) diff --git a/src/systray.py b/src/systray.py index 0e5966d0ac83b34088e6f4ec2ba6ae796c5316cc..05a00ba082abd74ba557de25efcda2e3d034c7ba 100644 --- a/src/systray.py +++ b/src/systray.py @@ -131,7 +131,7 @@ class Systray: path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/') state_images = gajim.interface.roster.load_iconset(path) - for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']: + for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'): uf_show = helpers.get_uf_show(show, use_mnemonic = True) item = gtk.ImageMenuItem(uf_show) item.set_image(state_images[show]) diff --git a/src/systraywin32.py b/src/systraywin32.py index 86311eb7830a40f1bf8a59bf090d1eb9488d588b..7f8e8e231d9ba474a5e68b4ff282d4f51b137e94 100644 --- a/src/systraywin32.py +++ b/src/systraywin32.py @@ -268,7 +268,7 @@ class SystrayWin32(systray.Systray): nb = gajim.interface.roster.nb_unread for acct in gajim.connections: # in chat / groupchat windows - for kind in ['chats', 'gc']: + for kind in ('chats', 'gc'): jids = gajim.interface.windows[acct][kind] for jid in jids: if jid != 'tabbed': @@ -287,7 +287,7 @@ class SystrayWin32(systray.Systray): nb = gajim.interface.roster.nb_unread for acct in gajim.connections: # in chat / groupchat windows - for kind in ['chats', 'gc']: + for kind in ('chats', 'gc'): for jid in gajim.interface.windows[acct][kind]: if jid != 'tabbed': nb += gajim.interface.windows[acct][kind][jid].nb_unread[jid]