changeset 22a03955065b in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=22a03955065b description: fix indentation and some pylint warning in roster_window.py
diffstat:
scripts/dev/run-pylint.py | 2 +- src/groupchat_control.py | 2 +- src/gtkgui_helpers.py | 2 +- src/gui_interface.py | 2 +- src/roster_window.py | 1139 ++++++++++++++++++++++++-------------------- 5 files changed, 623 insertions(+), 524 deletions(-)
diffs (truncated from 2949 to 300 lines):
diff -r 2dfa156a89c4 -r 22a03955065b scripts/dev/run-pylint.py --- a/scripts/dev/run-pylint.py Tue Feb 16 10:41:16 2010 +0100 +++ b/scripts/dev/run-pylint.py Wed Feb 17 11:32:55 2010 +0100 @@ -7,5 +7,5 @@ if os.getcwd().endswith('dev'): os.chdir('../../src/') # we were in scripts/dev
-os.system("pylint --include-ids=y --additional-builtins='_' --disable-msg=C0103,C0111,W0703,W0511,W0142 --disable-checker=design " + "".join(sys.argv[1:])) +os.system("pylint --include-ids=y --additional-builtins='_' --disable-msg=C0103,C0111,W0703,W0511,W0142,W0613,R0201 --disable-checker=design " + "".join(sys.argv[1:]))
diff -r 2dfa156a89c4 -r 22a03955065b src/groupchat_control.py --- a/src/groupchat_control.py Tue Feb 16 10:41:16 2010 +0100 +++ b/src/groupchat_control.py Wed Feb 17 11:32:55 2010 +0100 @@ -1125,7 +1125,7 @@ if status != '': status = helpers.reduce_chars_newlines(status, max_lines=1) # escape markup entities and make them small italic and fg color - color = gtkgui_helpers._get_fade_color(self.list_treeview, + color = gtkgui_helpers.get_fade_color(self.list_treeview, selected, focus) colorstring = "#%04x%04x%04x" % (color.red, color.green, color.blue) name += ('\n<span size="small" style="italic" foreground="%s">' diff -r 2dfa156a89c4 -r 22a03955065b src/gtkgui_helpers.py --- a/src/gtkgui_helpers.py Tue Feb 16 10:41:16 2010 +0100 +++ b/src/gtkgui_helpers.py Wed Feb 17 11:32:55 2010 +0100 @@ -561,7 +561,7 @@ hfile.Close() return False
-def _get_fade_color(treeview, selected, focused): +def get_fade_color(treeview, selected, focused): """ Get a gdk color that is between foreground and background in 0.3 0.7 respectively colors of the cell for the given treeview diff -r 2dfa156a89c4 -r 22a03955065b src/gui_interface.py --- a/src/gui_interface.py Tue Feb 16 10:41:16 2010 +0100 +++ b/src/gui_interface.py Wed Feb 17 11:32:55 2010 +0100 @@ -2758,7 +2758,7 @@ ### Other Methods ################################################################################
- def _change_awn_icon_status(self, status): + def change_awn_icon_status(self, status): if not dbus_support.supported: # do nothing if user doesn't have D-Bus bindings return diff -r 2dfa156a89c4 -r 22a03955065b src/roster_window.py --- a/src/roster_window.py Tue Feb 16 10:41:16 2010 +0100 +++ b/src/roster_window.py Wed Feb 17 11:32:55 2010 +0100 @@ -72,17 +72,17 @@
#(icon, name, type, jid, account, editable, second pixbuf) ( - C_IMG, # image to show state (online, new message etc) - C_NAME, # cellrenderer text that holds contact nickame - C_TYPE, # account, group or contact? - C_JID, # the jid of the row - C_ACCOUNT, # cellrenderer text that holds account name - C_MOOD_PIXBUF, - C_ACTIVITY_PIXBUF, - C_TUNE_PIXBUF, - C_LOCATION_PIXBUF, - C_AVATAR_PIXBUF, # avatar_pixbuf - C_PADLOCK_PIXBUF, # use for account row only + C_IMG, # image to show state (online, new message etc) + C_NAME, # cellrenderer text that holds contact nickame + C_TYPE, # account, group or contact? + C_JID, # the jid of the row + C_ACCOUNT, # cellrenderer text that holds account name + C_MOOD_PIXBUF, + C_ACTIVITY_PIXBUF, + C_TUNE_PIXBUF, + C_LOCATION_PIXBUF, + C_AVATAR_PIXBUF, # avatar_pixbuf + C_PADLOCK_PIXBUF, # use for account row only ) = range(11)
class RosterWindow: @@ -218,7 +218,8 @@ # It's the last one. # Go up if we are big brother parent_iter = model.iter_parent(contact_iter) - if parent_iter and model[parent_iter][C_TYPE] == 'contact': + if parent_iter and model[parent_iter][C_TYPE] == \ + 'contact': contact_iter = model.iter_next(parent_iter) else: # we tested all @@ -303,8 +304,8 @@
def add_account_contacts(self, account): """ - Add all contacts and groups of the given account to roster, draw them and - account + Add all contacts and groups of the given account to roster, draw them + and account """ self.starting = True jids = gajim.contacts.get_jid_list(account) @@ -357,9 +358,9 @@ contact.groups = big_brother_contact.get_shown_groups()[:]
for child_iter in parent_iters: - it = self.model.append(child_iter, (None, contact.get_shown_name(), - 'contact', contact.jid, account, None, None, None, None, None, - None)) + it = self.model.append(child_iter, (None, + contact.get_shown_name(), 'contact', contact.jid, account, + None, None, None, None, None, None)) added_iters.append(it) else: # We are a normal contact. Add us to our groups. @@ -372,9 +373,10 @@ # Group is not yet in roster, add it! child_iterA = self._get_account_iter(account, self.model) child_iterG = self.model.append(child_iterA, - [gajim.interface.jabber_state_images['16']['closed'], - gobject.markup_escape_text(group), - 'group', group, account, None, None, None, None, None, None]) + [gajim.interface.jabber_state_images['16']['closed'], + gobject.markup_escape_text(group), + 'group', group, account, None, None, None, None, None, + None]) self.draw_group(group, account)
if contact.is_transport(): @@ -400,7 +402,8 @@ if group not in gajim.groups[account]: gajim.groups[account][group] = {'expand': is_expanded}
- assert len(added_iters), '%s has not been added to roster!' % contact.jid + assert len(added_iters), '%s has not been added to roster!' % \ + contact.jid return added_iters
def _remove_entity(self, contact, account, groups=None): @@ -417,7 +420,8 @@ account -- the contacts account groups -- list of groups to remove the contact from. """ - iters = self._get_contact_iter(contact.jid, account, contact, self.model) + iters = self._get_contact_iter(contact.jid, account, contact, + self.model) assert iters, '%s shall be removed but is not in roster' % contact.jid
parent_iter = self.model.iter_parent(iters[0]) @@ -543,29 +547,28 @@ ok = self._remove_entity(_contact, _account) assert ok, '%s was not removed' % _jid assert len(self._get_contact_iter(_jid, _account, _contact, - self.model)) == 0, '%s is removed but still in roster' % _jid + self.model)) == 0, '%s is removed but still in roster' % _jid
if not family_in_roster: return False
assert old_big_jid, 'No Big Brother in nearby family % (Family: %)' % \ - (nearby_family, family) + (nearby_family, family) iters = self._get_contact_iter(old_big_jid, old_big_account, - old_big_contact, self.model) + old_big_contact, self.model) assert len(iters) > 0, 'Old Big Brother %s is not in roster anymore' % \ - old_big_jid - assert not self.model.iter_children(iters[0]),\ - 'Old Big Brother %s still has children' % old_big_jid + old_big_jid + assert not self.model.iter_children(iters[0]), \ + 'Old Big Brother %s still has children' % old_big_jid
ok = self._remove_entity(old_big_contact, old_big_account) assert ok, "Old Big Brother %s not removed" % old_big_jid assert len(self._get_contact_iter(old_big_jid, old_big_account, - old_big_contact, self.model)) == 0,\ - 'Old Big Brother %s is removed but still in roster' % old_big_jid + old_big_contact, self.model)) == 0, \ + 'Old Big Brother %s is removed but still in roster' % old_big_jid
return True
- def _recalibrate_metacontact_family(self, family, account): """ Regroup metacontact family if necessary @@ -573,11 +576,11 @@
brothers = [] nearby_family, big_brother_jid, big_brother_account = \ - self._get_nearby_family_and_big_brother(family, account) + self._get_nearby_family_and_big_brother(family, account) big_brother_contact = gajim.contacts.get_contact(big_brother_account, - big_brother_jid) - child_iters = self._get_contact_iter(big_brother_jid, big_brother_account, - model=self.model) + big_brother_jid) + child_iters = self._get_contact_iter(big_brother_jid, + big_brother_account, model=self.model) if child_iters: parent_iter = self.model.iter_parent(child_iters[0]) parent_type = self.model[parent_iter][C_TYPE] @@ -601,7 +604,8 @@ _account = child['account'] if _account == big_brother_account and _jid == big_brother_jid: continue - child_iters = self._get_contact_iter(_jid, _account, model=self.model) + child_iters = self._get_contact_iter(_jid, _account, + model=self.model) if not child_iters: continue parent_iter = self.model.iter_parent(child_iters[0]) @@ -625,13 +629,12 @@ jid = gajim.get_jid_from_account(account) contact = gajim.contacts.get_first_contact_from_jid(account, jid)
- assert len(self._get_contact_iter(jid, account, contact, self.model)) == \ - 0, 'Self contact %s already in roster' % jid + assert len(self._get_contact_iter(jid, account, contact, + self.model)) == 0, 'Self contact %s already in roster' % jid
child_iterA = self._get_account_iter(account, self.model) self.model.append(child_iterA, (None, gajim.nicks[account], - 'self_contact', jid, account, None, None, None, None, - None, None)) + 'self_contact', jid, account, None, None, None, None, None, None))
self.draw_completely(jid, account) self.draw_account(account) @@ -666,9 +669,9 @@ show_self_contact = gajim.config.get('show_self_contact') if show_self_contact == 'never': return - if (contact.resource != gajim.connections[account].server_resource and\ - show_self_contact == 'when_other_resource') or show_self_contact == \ - 'always': + if (contact.resource != gajim.connections[account].server_resource \ + and show_self_contact == 'when_other_resource') or \ + show_self_contact == 'always': return self._add_self_contact(account) return
@@ -689,7 +692,7 @@ contacts = self._add_metacontact_family(family, account) else: # We are a normal contact - contacts = [(contact, account),] + contacts = [(contact, account), ] self._add_entity(contact, account)
# Draw the contact and its groups contact @@ -746,18 +749,19 @@ else: self._remove_entity(contact, account)
- if backend and (not gajim.interface.msg_win_mgr.get_control(jid, account)\ - or force): + if backend and (not gajim.interface.msg_win_mgr.get_control(jid, + account) or force): # If a window is still opened: don't remove contact instance # Remove contact before redrawing, otherwise the old # numbers will still be show gajim.contacts.remove_jid(account, jid, remove_meta=True) if iters: rest_of_family = [data for data in family - if account != data['account'] or jid != data['jid']] + if account != data['account'] or jid != data['jid']] if rest_of_family: # reshow the rest of the family - brothers = self._add_metacontact_family(rest_of_family, account) + brothers = self._add_metacontact_family(rest_of_family, + account) for c, acc in brothers: self.draw_completely(c.jid, acc)
@@ -798,7 +802,8 @@ status = ''
if contact is None: - gc_control = gajim.interface.msg_win_mgr.get_gc_control(jid, account) + gc_control = gajim.interface.msg_win_mgr.get_gc_control(jid, + account) if gc_control: # there is a window that we can minimize gajim.interface.minimized_controls[account][jid] = gc_control @@ -808,9 +813,9 @@ else: name = jid.split('@')[0] # New groupchat - #GCMIN - contact = gajim.contacts.create_contact(jid=jid, account=account, name=name, - groups=[_('Groupchats')], show=show, status=status, sub='none') + contact = gajim.contacts.create_contact(jid=jid, account=account, + name=name, groups=[_('Groupchats')], show=show, status=status, + sub='none') gajim.contacts.add_contact(account, contact) self.add_contact(jid, account) else: @@ -847,10 +852,9 @@ """ contact = gajim.contacts.get_contact_with_highest_priority(account, jid) if contact is None: