coding standards
This commit is contained in:
parent
8f9c097343
commit
b3d57ed5b1
|
@ -261,20 +261,21 @@ class RosterWindow:
|
||||||
if self.regroup:
|
if self.regroup:
|
||||||
# Merged accounts view
|
# Merged accounts view
|
||||||
show = helpers.get_global_show()
|
show = helpers.get_global_show()
|
||||||
self.model.append(None, [gajim.interface.jabber_state_images['16'][show],
|
self.model.append(None, [gajim.interface.jabber_state_images['16'][
|
||||||
_('Merged accounts'), 'account', '', 'all', None, None])
|
show], _('Merged accounts'), 'account', '', 'all', None, None])
|
||||||
else:
|
else:
|
||||||
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
||||||
our_jid = gajim.get_jid_from_account(account)
|
our_jid = gajim.get_jid_from_account(account)
|
||||||
|
|
||||||
tls_pixbuf = None
|
tls_pixbuf = None
|
||||||
if gajim.account_is_securely_connected(account):
|
if gajim.account_is_securely_connected(account):
|
||||||
tls_pixbuf = self.window.render_icon(gtk.STOCK_DIALOG_AUTHENTICATION,
|
# the only way to create a pixbuf from stock
|
||||||
gtk.ICON_SIZE_MENU) # the only way to create a pixbuf from stock
|
tls_pixbuf = self.window.render_icon(
|
||||||
|
gtk.STOCK_DIALOG_AUTHENTICATION, gtk.ICON_SIZE_MENU)
|
||||||
|
|
||||||
self.model.append(None, [gajim.interface.jabber_state_images['16'][show],
|
self.model.append(None, [gajim.interface.jabber_state_images['16'][
|
||||||
gobject.markup_escape_text(account),
|
show], gobject.markup_escape_text(account), 'account', our_jid,
|
||||||
'account', our_jid, account, None, tls_pixbuf])
|
account, None, tls_pixbuf])
|
||||||
|
|
||||||
self.draw_account(account)
|
self.draw_account(account)
|
||||||
|
|
||||||
|
@ -340,7 +341,7 @@ class RosterWindow:
|
||||||
parent_iters = self._get_contact_iter(big_brother_contact.jid,
|
parent_iters = self._get_contact_iter(big_brother_contact.jid,
|
||||||
big_brother_account, big_brother_contact, self.model)
|
big_brother_account, big_brother_contact, self.model)
|
||||||
assert len(parent_iters) > 0,\
|
assert len(parent_iters) > 0,\
|
||||||
"Big brother is not yet in roster!"
|
'Big brother is not yet in roster!'
|
||||||
|
|
||||||
# Do not confuse get_contact_iter
|
# Do not confuse get_contact_iter
|
||||||
# Sync groups of family members
|
# Sync groups of family members
|
||||||
|
@ -359,7 +360,7 @@ class RosterWindow:
|
||||||
if not groups:
|
if not groups:
|
||||||
groups = [_('General')]
|
groups = [_('General')]
|
||||||
for group in groups:
|
for group in groups:
|
||||||
child_iterG = self._get_group_iter(group, account, model = self.model)
|
child_iterG = self._get_group_iter(group, account, model=self.model)
|
||||||
if not child_iterG:
|
if not child_iterG:
|
||||||
# Group is not yet in roster, add it!
|
# Group is not yet in roster, add it!
|
||||||
child_iterA = self._get_account_iter(account, self.model)
|
child_iterA = self._get_account_iter(account, self.model)
|
||||||
|
@ -392,10 +393,9 @@ class RosterWindow:
|
||||||
if group not in gajim.groups[account]:
|
if group not in gajim.groups[account]:
|
||||||
gajim.groups[account][group] = {'expand': is_expanded}
|
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
|
return added_iters
|
||||||
|
|
||||||
|
|
||||||
def _remove_entity(self, contact, account, groups = None):
|
def _remove_entity(self, contact, account, groups = None):
|
||||||
'''Remove the given contact from roster data model.
|
'''Remove the given contact from roster data model.
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class RosterWindow:
|
||||||
|
|
||||||
'''
|
'''
|
||||||
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
|
assert iters, '%s shall be removed but is not in roster' % contact.jid
|
||||||
|
|
||||||
parent_iter = self.model.iter_parent(iters[0])
|
parent_iter = self.model.iter_parent(iters[0])
|
||||||
parent_type = self.model[parent_iter][C_TYPE]
|
parent_type = self.model[parent_iter][C_TYPE]
|
||||||
|
@ -418,7 +418,8 @@ class RosterWindow:
|
||||||
if groups:
|
if groups:
|
||||||
# Only remove from specified groups
|
# Only remove from specified groups
|
||||||
all_iters = iters[:]
|
all_iters = iters[:]
|
||||||
group_iters = [self._get_group_iter(group, account) for group in groups]
|
group_iters = [self._get_group_iter(group, account) for group in \
|
||||||
|
groups]
|
||||||
iters = [titer for titer in all_iters
|
iters = [titer for titer in all_iters
|
||||||
if self.model.iter_parent(titer) in group_iters]
|
if self.model.iter_parent(titer) in group_iters]
|
||||||
|
|
||||||
|
@ -441,7 +442,6 @@ class RosterWindow:
|
||||||
self.model.remove(i)
|
self.model.remove(i)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _add_metacontact_family(self, family, account):
|
def _add_metacontact_family(self, family, account):
|
||||||
'''Add the give Metacontact family to roster data model.
|
'''Add the give Metacontact family to roster data model.
|
||||||
|
|
||||||
|
@ -461,7 +461,8 @@ class RosterWindow:
|
||||||
nearby_family = [data for data in family
|
nearby_family = [data for data in family
|
||||||
if account == data['account']]
|
if account == data['account']]
|
||||||
|
|
||||||
big_brother_data = gajim.contacts.get_metacontacts_big_brother(nearby_family)
|
big_brother_data = gajim.contacts.get_metacontacts_big_brother(
|
||||||
|
nearby_family)
|
||||||
big_brother_jid = big_brother_data['jid']
|
big_brother_jid = big_brother_data['jid']
|
||||||
big_brother_account = big_brother_data['account']
|
big_brother_account = big_brother_data['account']
|
||||||
big_brother_contact = gajim.contacts.get_first_contact_from_jid(
|
big_brother_contact = gajim.contacts.get_first_contact_from_jid(
|
||||||
|
@ -469,7 +470,8 @@ class RosterWindow:
|
||||||
|
|
||||||
assert len(self._get_contact_iter(big_brother_jid, big_brother_account,
|
assert len(self._get_contact_iter(big_brother_jid, big_brother_account,
|
||||||
big_brother_contact, self.model)) == 0,\
|
big_brother_contact, self.model)) == 0,\
|
||||||
"Big brother %s already in roster \n Family: %s" % (big_brother_jid, family)
|
'Big brother %s already in roster \n Family: %s' % (big_brother_jid,
|
||||||
|
family)
|
||||||
self._add_entity(big_brother_contact, big_brother_account)
|
self._add_entity(big_brother_contact, big_brother_account)
|
||||||
|
|
||||||
brothers = []
|
brothers = []
|
||||||
|
@ -488,14 +490,13 @@ class RosterWindow:
|
||||||
|
|
||||||
assert len(self._get_contact_iter(_jid, _account, _contact, self.model)
|
assert len(self._get_contact_iter(_jid, _account, _contact, self.model)
|
||||||
) == 0, "%s already in roster. \n Family: " % (_jid, nearby_family)
|
) == 0, "%s already in roster. \n Family: " % (_jid, nearby_family)
|
||||||
self._add_entity(_contact, _account, big_brother_contact = big_brother_contact,
|
self._add_entity(_contact, _account, big_brother_contact = \
|
||||||
big_brother_account = big_brother_account)
|
big_brother_contact, big_brother_account=big_brother_account)
|
||||||
brothers.append((_contact, _account))
|
brothers.append((_contact, _account))
|
||||||
|
|
||||||
brothers.insert(0, (big_brother_contact, big_brother_account))
|
brothers.insert(0, (big_brother_contact, big_brother_account))
|
||||||
return brothers
|
return brothers
|
||||||
|
|
||||||
|
|
||||||
def _remove_metacontact_family(self, family, account):
|
def _remove_metacontact_family(self, family, account):
|
||||||
'''Remove the given Metacontact family from roster data model.
|
'''Remove the given Metacontact family from roster data model.
|
||||||
|
|
||||||
|
@ -522,8 +523,8 @@ class RosterWindow:
|
||||||
# Family might not be up to date.
|
# Family might not be up to date.
|
||||||
# Only try to remove what is actually in the roster
|
# Only try to remove what is actually in the roster
|
||||||
continue
|
continue
|
||||||
assert iters, "%s shall be removed but is not in roster \
|
assert iters, '%s shall be removed but is not in roster \
|
||||||
\n Family: %s" % (_jid, family)
|
\n Family: %s' % (_jid, family)
|
||||||
|
|
||||||
family_in_roster = True
|
family_in_roster = True
|
||||||
|
|
||||||
|
@ -538,28 +539,28 @@ class RosterWindow:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ok = self._remove_entity(_contact, _account)
|
ok = self._remove_entity(_contact, _account)
|
||||||
assert ok, "%s was not removed" % _jid
|
assert ok, '%s was not removed' % _jid
|
||||||
assert len(self._get_contact_iter(_jid, _account, _contact, self.model)) == 0,\
|
assert len(self._get_contact_iter(_jid, _account, _contact,
|
||||||
"%s is removed but still in roster" % _jid
|
self.model)) == 0, '%s is removed but still in roster' % _jid
|
||||||
|
|
||||||
if not family_in_roster:
|
if not family_in_roster:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
iters = self._get_contact_iter(old_big_jid, old_big_account, old_big_contact,
|
iters = self._get_contact_iter(old_big_jid, old_big_account,
|
||||||
self.model)
|
old_big_contact, self.model)
|
||||||
assert len(iters) > 0, "Old Big Brother %s is not in roster anymore" % old_big_jid
|
assert len(iters) > 0, 'Old Big Brother %s is not in roster anymore' % \
|
||||||
assert not self.model.iter_children(iters[0]),\
|
old_big_jid
|
||||||
"Old Big Brother %s still has children" % 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)
|
ok = self._remove_entity(old_big_contact, old_big_account)
|
||||||
assert ok, "Old Big Brother %s not removed" % old_big_jid
|
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,
|
assert len(self._get_contact_iter(old_big_jid, old_big_account,
|
||||||
self.model)) == 0,\
|
old_big_contact, self.model)) == 0,
|
||||||
"Old Big Brother %s is removed but still in roster" % old_big_jid
|
'Old Big Brother %s is removed but still in roster' % old_big_jid
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _add_self_contact(self, account):
|
def _add_self_contact(self, account):
|
||||||
'''Add account's SelfContact to roster and draw it and the account.
|
'''Add account's SelfContact to roster and draw it and the account.
|
||||||
|
|
||||||
|
@ -568,8 +569,8 @@ class RosterWindow:
|
||||||
jid = gajim.get_jid_from_account(account)
|
jid = gajim.get_jid_from_account(account)
|
||||||
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
||||||
|
|
||||||
assert len(self._get_contact_iter(jid, account, contact, self.model)) == 0,\
|
assert len(self._get_contact_iter(jid, account, contact, self.model)) == \
|
||||||
"Self contact %s already in roster" % jid
|
0, 'Self contact %s already in roster' % jid
|
||||||
|
|
||||||
child_iterA = self._get_account_iter(account, self.model)
|
child_iterA = self._get_account_iter(account, self.model)
|
||||||
self.model.append(child_iterA, (None, gajim.nicks[account],
|
self.model.append(child_iterA, (None, gajim.nicks[account],
|
||||||
|
@ -649,7 +650,8 @@ class RosterWindow:
|
||||||
def remove_contact(self, jid, account, force = False, backend = False):
|
def remove_contact(self, jid, account, force = False, backend = False):
|
||||||
'''Remove contact from roster.
|
'''Remove contact from roster.
|
||||||
|
|
||||||
Remove contact from all its group. Remove empty groups or redraw otherwise.
|
Remove contact from all its group. Remove empty groups or redraw
|
||||||
|
otherwise.
|
||||||
Draw the account.
|
Draw the account.
|
||||||
If it's a Metacontact, remove the whole family.
|
If it's a Metacontact, remove the whole family.
|
||||||
Do nothing if the contact is not in roster.
|
Do nothing if the contact is not in roster.
|
||||||
|
@ -739,7 +741,6 @@ class RosterWindow:
|
||||||
self.add_contact(jid, account)
|
self.add_contact(jid, account)
|
||||||
return contact
|
return contact
|
||||||
|
|
||||||
|
|
||||||
def remove_transport(self, jid, account):
|
def remove_transport(self, jid, account):
|
||||||
'''Remove transport from roster and redraw account and group.'''
|
'''Remove transport from roster and redraw account and group.'''
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
|
@ -759,7 +760,8 @@ class RosterWindow:
|
||||||
# Close chat window
|
# Close chat window
|
||||||
msg_win = gajim.interface.msg_win_mgr.get_window(contact.jid,
|
msg_win = gajim.interface.msg_win_mgr.get_window(contact.jid,
|
||||||
account)
|
account)
|
||||||
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(contact.jid, account):
|
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(
|
||||||
|
contact.jid, account):
|
||||||
msg_win.remove_tab(ctrl, msg_win.CLOSE_CLOSE_BUTTON)
|
msg_win.remove_tab(ctrl, msg_win.CLOSE_CLOSE_BUTTON)
|
||||||
else:
|
else:
|
||||||
need_readd = True
|
need_readd = True
|
||||||
|
@ -1034,7 +1036,8 @@ class RosterWindow:
|
||||||
nearby_family = [data for data in family
|
nearby_family = [data for data in family
|
||||||
if account == data['account']]
|
if account == data['account']]
|
||||||
|
|
||||||
big_brother_data = gajim.contacts.get_metacontacts_big_brother(nearby_family)
|
big_brother_data = gajim.contacts.get_metacontacts_big_brother(
|
||||||
|
nearby_family)
|
||||||
big_brother_jid = big_brother_data['jid']
|
big_brother_jid = big_brother_data['jid']
|
||||||
big_brother_account = big_brother_data['account']
|
big_brother_account = big_brother_data['account']
|
||||||
|
|
||||||
|
@ -1315,7 +1318,7 @@ class RosterWindow:
|
||||||
self.filtering = False
|
self.filtering = False
|
||||||
|
|
||||||
def contact_has_pending_roster_events(self, contact, account):
|
def contact_has_pending_roster_events(self, contact, account):
|
||||||
''' Return True if the contact or one if it resources has pending events'''
|
'''Return True if the contact or one if it resources has pending events'''
|
||||||
# jid has pending events
|
# jid has pending events
|
||||||
if gajim.events.get_nb_roster_events(account, contact.jid) > 0:
|
if gajim.events.get_nb_roster_events(account, contact.jid) > 0:
|
||||||
return True
|
return True
|
||||||
|
@ -1578,7 +1581,8 @@ class RosterWindow:
|
||||||
|
|
||||||
# If we already have chat windows opened, update them with new contact
|
# If we already have chat windows opened, update them with new contact
|
||||||
# instance
|
# instance
|
||||||
for chat_control in gajim.interface.msg_win_mgr.get_chat_controls(ji, account):
|
for chat_control in gajim.interface.msg_win_mgr.get_chat_controls(ji,
|
||||||
|
account):
|
||||||
chat_control.contact = contact1
|
chat_control.contact = contact1
|
||||||
|
|
||||||
def _change_awn_icon_status(self, status):
|
def _change_awn_icon_status(self, status):
|
||||||
|
@ -1666,7 +1670,8 @@ class RosterWindow:
|
||||||
Only performed if removal was requested before but the contact
|
Only performed if removal was requested before but the contact
|
||||||
still had pending events
|
still had pending events
|
||||||
'''
|
'''
|
||||||
contact_list = ((event.jid.split('/')[0], event.account) for event in event_list)
|
contact_list = ((event.jid.split('/')[0], event.account) for event in \
|
||||||
|
event_list)
|
||||||
|
|
||||||
for jid, account in contact_list:
|
for jid, account in contact_list:
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
@ -1800,15 +1805,16 @@ class RosterWindow:
|
||||||
text = _('Enter your password for account %s') % account
|
text = _('Enter your password for account %s') % account
|
||||||
if passwords.USER_HAS_GNOMEKEYRING and \
|
if passwords.USER_HAS_GNOMEKEYRING and \
|
||||||
not passwords.USER_USES_GNOMEKEYRING:
|
not passwords.USER_USES_GNOMEKEYRING:
|
||||||
text += '\n' + _('Gnome Keyring is installed but not correctly started\
|
text += '\n' + _('Gnome Keyring is installed but not \
|
||||||
(environment variable probably not correctly set)')
|
correctly started (environment variable probably not \
|
||||||
|
correctly set)')
|
||||||
w = dialogs.PassphraseDialog(_('Password Required'), text,
|
w = dialogs.PassphraseDialog(_('Password Required'), text,
|
||||||
_('Save password'))
|
_('Save password'))
|
||||||
passphrase, save = w.run()
|
passphrase, save = w.run()
|
||||||
if passphrase == -1:
|
if passphrase == -1:
|
||||||
if child_iterA:
|
if child_iterA:
|
||||||
self.model[child_iterA][0] = gajim.interface.jabber_state_images[
|
self.model[child_iterA][0] = \
|
||||||
'16']['offline']
|
gajim.interface.jabber_state_images['16']['offline']
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.change_status('offline')
|
gajim.interface.systray.change_status('offline')
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
|
@ -1838,9 +1844,9 @@ class RosterWindow:
|
||||||
while ctx is not None:
|
while ctx is not None:
|
||||||
if ctx.msgstate == gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED:
|
if ctx.msgstate == gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED:
|
||||||
disconnected = True
|
disconnected = True
|
||||||
gajim.otr_module.otrl_message_disconnect(gajim.connections[account].otr_userstates,
|
gajim.otr_module.otrl_message_disconnect(gajim.connections[
|
||||||
(gajim.otr_ui_ops,
|
account].otr_userstates, (gajim.otr_ui_ops,
|
||||||
{'account':account,'urgent':True}), ctx.accountname,
|
{'account': account,'urgent': True}), ctx.accountname,
|
||||||
ctx.protocol, ctx.username)
|
ctx.protocol, ctx.username)
|
||||||
ctx = ctx.next
|
ctx = ctx.next
|
||||||
if to:
|
if to:
|
||||||
|
@ -1893,7 +1899,8 @@ class RosterWindow:
|
||||||
win.redraw_tab(ctrl)
|
win.redraw_tab(ctrl)
|
||||||
|
|
||||||
gajim.contacts.remove_contact(account, contact)
|
gajim.contacts.remove_contact(account, contact)
|
||||||
elif contact.jid == gajim.get_jid_from_account(account) and show == 'offline':
|
elif contact.jid == gajim.get_jid_from_account(account) and \
|
||||||
|
show == 'offline':
|
||||||
# Our SelfContact went offline. Remove him
|
# Our SelfContact went offline. Remove him
|
||||||
self.remove_contact(contact.jid, account)
|
self.remove_contact(contact.jid, account)
|
||||||
|
|
||||||
|
@ -2663,7 +2670,8 @@ class RosterWindow:
|
||||||
keyID = keyID[0]
|
keyID = keyID[0]
|
||||||
keys[contact.jid] = keyID
|
keys[contact.jid] = keyID
|
||||||
|
|
||||||
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(contact.jid, account):
|
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(contact.jid,
|
||||||
|
account):
|
||||||
ctrl.update_ui()
|
ctrl.update_ui()
|
||||||
keys_str = ''
|
keys_str = ''
|
||||||
for jid in keys:
|
for jid in keys:
|
||||||
|
@ -2803,7 +2811,8 @@ class RosterWindow:
|
||||||
def on_groupchat_maximized(self, widget, jid, account):
|
def on_groupchat_maximized(self, widget, jid, account):
|
||||||
'''When a groupchat is maximised'''
|
'''When a groupchat is maximised'''
|
||||||
ctrl = gajim.interface.minimized_controls[account][jid]
|
ctrl = gajim.interface.minimized_controls[account][jid]
|
||||||
mw = gajim.interface.msg_win_mgr.get_window(ctrl.contact.jid, ctrl.account)
|
mw = gajim.interface.msg_win_mgr.get_window(ctrl.contact.jid,
|
||||||
|
ctrl.account)
|
||||||
if not mw:
|
if not mw:
|
||||||
mw = gajim.interface.msg_win_mgr.create_window(ctrl.contact,
|
mw = gajim.interface.msg_win_mgr.create_window(ctrl.contact,
|
||||||
ctrl.account, ctrl.type_id)
|
ctrl.account, ctrl.type_id)
|
||||||
|
@ -3094,7 +3103,8 @@ class RosterWindow:
|
||||||
return
|
return
|
||||||
status = model[active][2].decode('utf-8')
|
status = model[active][2].decode('utf-8')
|
||||||
statuses_unified = helpers.statuses_unified() # status "desync'ed" or not
|
statuses_unified = helpers.statuses_unified() # status "desync'ed" or not
|
||||||
if (active == 7 and statuses_unified) or (active == 9 and not statuses_unified):
|
if (active == 7 and statuses_unified) or (active == 9 and \
|
||||||
|
not statuses_unified):
|
||||||
# 'Change status message' selected:
|
# 'Change status message' selected:
|
||||||
# do not change show, just show change status dialog
|
# do not change show, just show change status dialog
|
||||||
status = model[self.previous_status_combobox_active][2].decode('utf-8')
|
status = model[self.previous_status_combobox_active][2].decode('utf-8')
|
||||||
|
@ -3663,14 +3673,15 @@ class RosterWindow:
|
||||||
dlg.checkbutton.set_active(True)
|
dlg.checkbutton.set_active(True)
|
||||||
|
|
||||||
|
|
||||||
def on_drop_in_group(self, widget, account, c_source, grp_dest, is_big_brother,
|
def on_drop_in_group(self, widget, account, c_source, grp_dest,
|
||||||
context, etime, grp_source = None):
|
is_big_brother, context, etime, grp_source = None):
|
||||||
if is_big_brother:
|
if is_big_brother:
|
||||||
# add whole metacontact to new group
|
# add whole metacontact to new group
|
||||||
self.add_contact_to_groups(c_source.jid, account, [grp_dest,])
|
self.add_contact_to_groups(c_source.jid, account, [grp_dest,])
|
||||||
# remove afterwards so the contact is not moved to General in the meantime
|
# remove afterwards so the contact is not moved to General in the
|
||||||
|
# meantime
|
||||||
if grp_dest != grp_source:
|
if grp_dest != grp_source:
|
||||||
self.remove_contact_from_groups(c_source.jid, account, [grp_source,])
|
self.remove_contact_from_groups(c_source.jid, account, [grp_source])
|
||||||
else:
|
else:
|
||||||
# Normal contact or little brother
|
# Normal contact or little brother
|
||||||
family = gajim.contacts.get_metacontacts_family(account,
|
family = gajim.contacts.get_metacontacts_family(account,
|
||||||
|
@ -3695,9 +3706,11 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
# Normal contact
|
# Normal contact
|
||||||
self.add_contact_to_groups(c_source.jid, account, [grp_dest,])
|
self.add_contact_to_groups(c_source.jid, account, [grp_dest,])
|
||||||
# remove afterwards so the contact is not moved to General in the meantime
|
# remove afterwards so the contact is not moved to General in the
|
||||||
|
# meantime
|
||||||
if grp_dest != grp_source:
|
if grp_dest != grp_source:
|
||||||
self.remove_contact_from_groups(c_source.jid, account, [grp_source,])
|
self.remove_contact_from_groups(c_source.jid, account,
|
||||||
|
[grp_source])
|
||||||
|
|
||||||
if context.action in (gtk.gdk.ACTION_MOVE, gtk.gdk.ACTION_COPY):
|
if context.action in (gtk.gdk.ACTION_MOVE, gtk.gdk.ACTION_COPY):
|
||||||
context.finish(True, True, etime)
|
context.finish(True, True, etime)
|
||||||
|
@ -3752,7 +3765,8 @@ class RosterWindow:
|
||||||
uri = data.strip()
|
uri = data.strip()
|
||||||
uri_splitted = uri.split() # we may have more than one file dropped
|
uri_splitted = uri.split() # we may have more than one file dropped
|
||||||
try:
|
try:
|
||||||
uri_splitted.remove('\0') # This is always the last element in windows
|
# This is always the last element in windows
|
||||||
|
uri_splitted.remove('\0')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
nb_uri = len(uri_splitted)
|
nb_uri = len(uri_splitted)
|
||||||
|
@ -3823,7 +3837,8 @@ class RosterWindow:
|
||||||
if grp_source in helpers.special_groups and \
|
if grp_source in helpers.special_groups and \
|
||||||
grp_source not in ('Not in Roster', 'Observers'):
|
grp_source not in ('Not in Roster', 'Observers'):
|
||||||
# a transport or a minimized groupchat was dragged
|
# a transport or a minimized groupchat was dragged
|
||||||
# we can add it to other accounts but not move it to another group, see below
|
# we can add it to other accounts but not move it to another group,
|
||||||
|
# see below
|
||||||
return
|
return
|
||||||
jid_source = data.decode('utf-8')
|
jid_source = data.decode('utf-8')
|
||||||
c_source = gajim.contacts.get_contact_with_highest_priority(
|
c_source = gajim.contacts.get_contact_with_highest_priority(
|
||||||
|
@ -3901,7 +3916,6 @@ class RosterWindow:
|
||||||
return self.transports_state_images[size][transport]
|
return self.transports_state_images[size][transport]
|
||||||
return gajim.interface.jabber_state_images[size]
|
return gajim.interface.jabber_state_images[size]
|
||||||
|
|
||||||
|
|
||||||
def make_transport_state_images(self, transport):
|
def make_transport_state_images(self, transport):
|
||||||
'''initialise opened and closed 'transport' iconset dict'''
|
'''initialise opened and closed 'transport' iconset dict'''
|
||||||
if gajim.config.get('use_transports_iconsets'):
|
if gajim.config.get('use_transports_iconsets'):
|
||||||
|
@ -3909,15 +3923,15 @@ class RosterWindow:
|
||||||
'16x16')
|
'16x16')
|
||||||
pixo, pixc = gtkgui_helpers.load_icons_meta()
|
pixo, pixc = gtkgui_helpers.load_icons_meta()
|
||||||
self.transports_state_images['opened'][transport] = \
|
self.transports_state_images['opened'][transport] = \
|
||||||
gtkgui_helpers.load_iconset(folder, pixo, transport = True)
|
gtkgui_helpers.load_iconset(folder, pixo, transport=True)
|
||||||
self.transports_state_images['closed'][transport] = \
|
self.transports_state_images['closed'][transport] = \
|
||||||
gtkgui_helpers.load_iconset(folder, pixc, transport = True)
|
gtkgui_helpers.load_iconset(folder, pixc, transport=True)
|
||||||
folder = os.path.join(helpers.get_transport_path(transport), '32x32')
|
folder = os.path.join(helpers.get_transport_path(transport), '32x32')
|
||||||
self.transports_state_images['32'][transport] = gtkgui_helpers.load_iconset(
|
self.transports_state_images['32'][transport] = \
|
||||||
folder, transport = True)
|
gtkgui_helpers.load_iconset(folder, transport=True)
|
||||||
folder = os.path.join(helpers.get_transport_path(transport), '16x16')
|
folder = os.path.join(helpers.get_transport_path(transport), '16x16')
|
||||||
self.transports_state_images['16'][transport] = gtkgui_helpers.load_iconset(
|
self.transports_state_images['16'][transport] = \
|
||||||
folder, transport = True)
|
gtkgui_helpers.load_iconset(folder, transport=True)
|
||||||
|
|
||||||
def update_jabber_state_images(self):
|
def update_jabber_state_images(self):
|
||||||
# Update the roster
|
# Update the roster
|
||||||
|
@ -3929,7 +3943,8 @@ class RosterWindow:
|
||||||
if model[titer][2] != '':
|
if model[titer][2] != '':
|
||||||
# If it's not change status message iter
|
# If it's not change status message iter
|
||||||
# eg. if it has show parameter not ''
|
# eg. if it has show parameter not ''
|
||||||
model[titer][1] = gajim.interface.jabber_state_images['16'][model[titer][2]]
|
model[titer][1] = gajim.interface.jabber_state_images['16'][model[
|
||||||
|
titer][2]]
|
||||||
titer = model.iter_next(titer)
|
titer = model.iter_next(titer)
|
||||||
# Update the systray
|
# Update the systray
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
|
@ -3951,7 +3966,8 @@ class RosterWindow:
|
||||||
show = gajim.SHOW_LIST[status]
|
show = gajim.SHOW_LIST[status]
|
||||||
else: # accounts merged
|
else: # accounts merged
|
||||||
show = helpers.get_global_show()
|
show = helpers.get_global_show()
|
||||||
self.model[child_iterA][C_IMG] = gajim.interface.jabber_state_images['16'][show]
|
self.model[child_iterA][C_IMG] = gajim.interface.jabber_state_images[
|
||||||
|
'16'][show]
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
### Style and theme related methods
|
### Style and theme related methods
|
||||||
|
@ -4205,7 +4221,8 @@ class RosterWindow:
|
||||||
if not force and not self.actions_menu_needs_rebuild:
|
if not force and not self.actions_menu_needs_rebuild:
|
||||||
return
|
return
|
||||||
new_chat_menuitem = self.xml.get_widget('new_chat_menuitem')
|
new_chat_menuitem = self.xml.get_widget('new_chat_menuitem')
|
||||||
single_message_menuitem = self.xml.get_widget('send_single_message_menuitem')
|
single_message_menuitem = self.xml.get_widget(
|
||||||
|
'send_single_message_menuitem')
|
||||||
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
||||||
muc_icon = gtkgui_helpers.load_icon('muc_active')
|
muc_icon = gtkgui_helpers.load_icon('muc_active')
|
||||||
if muc_icon:
|
if muc_icon:
|
||||||
|
@ -4562,8 +4579,8 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
pep_config.set_sensitive(False)
|
pep_config.set_sensitive(False)
|
||||||
pep_submenu.append(pep_config)
|
pep_submenu.append(pep_config)
|
||||||
pep_config.connect('activate', self.on_pep_services_menuitem_activate,
|
pep_config.connect('activate',
|
||||||
account)
|
self.on_pep_services_menuitem_activate, account)
|
||||||
img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES,
|
img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES,
|
||||||
gtk.ICON_SIZE_MENU)
|
gtk.ICON_SIZE_MENU)
|
||||||
pep_config.set_image(img)
|
pep_config.set_image(img)
|
||||||
|
@ -4731,7 +4748,8 @@ class RosterWindow:
|
||||||
group_message_to_all_item = gtk.MenuItem(_('To all users'))
|
group_message_to_all_item = gtk.MenuItem(_('To all users'))
|
||||||
send_group_message_submenu.append(group_message_to_all_item)
|
send_group_message_submenu.append(group_message_to_all_item)
|
||||||
|
|
||||||
group_message_to_all_online_item = gtk.MenuItem(_('To all online users'))
|
group_message_to_all_online_item = gtk.MenuItem(
|
||||||
|
_('To all online users'))
|
||||||
send_group_message_submenu.append(group_message_to_all_online_item)
|
send_group_message_submenu.append(group_message_to_all_online_item)
|
||||||
|
|
||||||
group_message_to_all_online_item.connect('activate',
|
group_message_to_all_online_item.connect('activate',
|
||||||
|
@ -4749,10 +4767,12 @@ class RosterWindow:
|
||||||
menu.append(invite_menuitem)
|
menu.append(invite_menuitem)
|
||||||
|
|
||||||
# Send Custom Status
|
# Send Custom Status
|
||||||
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
|
send_custom_status_menuitem = gtk.ImageMenuItem(
|
||||||
|
_('Send Cus_tom Status'))
|
||||||
# add a special img for this menuitem
|
# add a special img for this menuitem
|
||||||
if group in gajim.connections[account].blocked_groups:
|
if group in gajim.connections[account].blocked_groups:
|
||||||
send_custom_status_menuitem.set_image(gtkgui_helpers.load_icon('offline'))
|
send_custom_status_menuitem.set_image(gtkgui_helpers.load_icon(
|
||||||
|
'offline'))
|
||||||
send_custom_status_menuitem.set_sensitive(False)
|
send_custom_status_menuitem.set_sensitive(False)
|
||||||
else:
|
else:
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_NETWORK,
|
icon = gtk.image_new_from_stock(gtk.STOCK_NETWORK,
|
||||||
|
@ -4766,8 +4786,8 @@ class RosterWindow:
|
||||||
# icon MUST be different instance for every item
|
# icon MUST be different instance for every item
|
||||||
state_images = gtkgui_helpers.load_iconset(path)
|
state_images = gtkgui_helpers.load_iconset(path)
|
||||||
status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s))
|
status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s))
|
||||||
status_menuitem.connect('activate', self.on_send_custom_status, list_,
|
status_menuitem.connect('activate', self.on_send_custom_status,
|
||||||
s, group)
|
list_, s, group)
|
||||||
icon = state_images[s]
|
icon = state_images[s]
|
||||||
status_menuitem.set_image(icon)
|
status_menuitem.set_image(icon)
|
||||||
status_menuitems.append(status_menuitem)
|
status_menuitems.append(status_menuitem)
|
||||||
|
@ -5294,7 +5314,8 @@ class RosterWindow:
|
||||||
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
|
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
|
||||||
# add a special img for this menuitem
|
# add a special img for this menuitem
|
||||||
if blocked:
|
if blocked:
|
||||||
send_custom_status_menuitem.set_image(gtkgui_helpers.load_icon('offline'))
|
send_custom_status_menuitem.set_image(gtkgui_helpers.load_icon(
|
||||||
|
'offline'))
|
||||||
send_custom_status_menuitem.set_sensitive(False)
|
send_custom_status_menuitem.set_sensitive(False)
|
||||||
else:
|
else:
|
||||||
if gajim.interface.status_sent_to_users.has_key(account) and \
|
if gajim.interface.status_sent_to_users.has_key(account) and \
|
||||||
|
@ -5808,8 +5829,8 @@ class RosterWindow:
|
||||||
|
|
||||||
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)
|
uf_show = helpers.get_uf_show(show)
|
||||||
liststore.append([uf_show, gajim.interface.jabber_state_images['16'][show],
|
liststore.append([uf_show, gajim.interface.jabber_state_images['16'][
|
||||||
show, True])
|
show], show, True])
|
||||||
# Add a Separator (self._iter_is_separator() checks on string SEPARATOR)
|
# Add a Separator (self._iter_is_separator() checks on string SEPARATOR)
|
||||||
liststore.append(['SEPARATOR', None, '', True])
|
liststore.append(['SEPARATOR', None, '', True])
|
||||||
|
|
||||||
|
@ -5823,8 +5844,8 @@ class RosterWindow:
|
||||||
liststore.append(['SEPARATOR', None, '', True])
|
liststore.append(['SEPARATOR', None, '', True])
|
||||||
|
|
||||||
uf_show = helpers.get_uf_show('offline')
|
uf_show = helpers.get_uf_show('offline')
|
||||||
liststore.append([uf_show, gajim.interface.jabber_state_images['16']['offline'],
|
liststore.append([uf_show, gajim.interface.jabber_state_images['16'][
|
||||||
'offline', True])
|
'offline'], 'offline', True])
|
||||||
|
|
||||||
status_combobox_items = ['online', 'chat', 'away', 'xa', 'dnd',
|
status_combobox_items = ['online', 'chat', 'away', 'xa', 'dnd',
|
||||||
'invisible', 'separator1', 'change_status_msg', 'separator2',
|
'invisible', 'separator1', 'change_status_msg', 'separator2',
|
||||||
|
@ -5901,8 +5922,8 @@ class RosterWindow:
|
||||||
|
|
||||||
# signals
|
# signals
|
||||||
self.TARGET_TYPE_URI_LIST = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
TARGETS = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_APP | gtk.TARGET_SAME_WIDGET,
|
TARGETS = [('MY_TREE_MODEL_ROW',
|
||||||
0)]
|
gtk.TARGET_SAME_APP | gtk.TARGET_SAME_WIDGET, 0)]
|
||||||
TARGETS2 = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0),
|
TARGETS2 = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0),
|
||||||
('text/uri-list', 0, self.TARGET_TYPE_URI_LIST)]
|
('text/uri-list', 0, self.TARGET_TYPE_URI_LIST)]
|
||||||
self.tree.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, TARGETS,
|
self.tree.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, TARGETS,
|
||||||
|
|
Loading…
Reference in New Issue