home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / gui / protocols / __init__.pyo (.txt) next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  3.0 KB  |  67 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from __future__ import with_statement
  5. from util import traceguard
  6. from gui.toolbox import GetTextFromUser
  7. from common import profile, pref
  8. import wx
  9.  
  10. def change_password(protocol, cb):
  11.     val = GetTextFromUser(_('Enter a new password for %s:' % protocol.username), _('Change Password'), default_value = protocol.password, password = True)
  12.     if val:
  13.         cb(val)
  14.     
  15.  
  16.  
  17. def remove_contact(contact, do_remove):
  18.     action_allowed = getattr(do_remove, 'action_allowed', (lambda c: True))
  19.     if not action_allowed(contact):
  20.         return None
  21.     
  22.     yes_default = pref('prompts.defaults.contacts.del_contact', type = bool, default = True)
  23.     more_flags = wx.NO_DEFAULT * (not yes_default)
  24.     if wx.YES == wx.MessageBox(_('Are you sure you want to delete contact %s?') % contact.name, _('Delete Contact'), style = wx.YES_NO | more_flags):
  25.         do_remove()
  26.     
  27.  
  28.  
  29. def remove_group(group, do_remove):
  30.     
  31.     try:
  32.         s = u'group "%s"' % group.name
  33.     except:
  34.         s = u'this group'
  35.  
  36.     yes_default = pref('prompts.defaults.contacts.del_group', type = bool, default = True)
  37.     more_flags = wx.NO_DEFAULT * (not yes_default)
  38.     if wx.YES == wx.MessageBox(_('WARNING!\n\nAll your contacts in this group will be deleted locally AND on the server.\n\nAre you sure you want to remove %s?') % s, _('Delete Group'), style = wx.YES_NO | wx.ICON_ERROR | more_flags):
  39.         do_remove()
  40.     
  41.  
  42.  
  43. def add_group():
  44.     group = GetTextFromUser(_('Please enter a group name:'), _('Add Group'))
  45.     if group is None or not group.strip():
  46.         return None
  47.     
  48.     protos = [ acct.connection for acct in profile.account_manager.connected_accounts ]
  49.     for proto in protos:
  50.         traceguard.__enter__()
  51.         
  52.         try:
  53.             proto.add_group(group)
  54.         finally:
  55.             pass
  56.  
  57.     
  58.  
  59.  
  60. def block_buddy(buddy, do_block):
  61.     yes_default = pref('prompts.defaults.contacts.block', type = bool, default = True)
  62.     more_flags = wx.NO_DEFAULT * (not yes_default)
  63.     if wx.YES == wx.MessageBox(_('Are you sure you want to block %s?') % buddy.name, _('Block Buddy'), style = wx.YES_NO | more_flags):
  64.         do_block()
  65.     
  66.  
  67.