home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 October / maximum-cd-2011-10.iso / DiscContents / digsby_setup.exe / lib / gui / protocols / oscargui.pyo (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2011-06-22  |  2.2 KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from gui.toolbox import GetTextFromUser
  5. import wx
  6. from logging import getLogger
  7. log = getLogger('oscargui')
  8.  
  9. def format_screenname(oscar, set):
  10.     oldval = str(oscar.self_buddy.nice_name)
  11.     while True:
  12.         val = GetTextFromUser(_('Enter a formatted screenname for %s.\n\nThe new screenname must be the same as the old one,\nexcept for changes in capitalization and spacing.') % oscar.username, caption = _('Edit Formatted Screenname'), default_value = oldval)
  13.         if val is None:
  14.             return None
  15.         if val.lower().replace(' ', '') == oldval.lower().replace(' ', ''):
  16.             print 'setting new formatted name', val
  17.             return set(str(val))
  18.         continue
  19.         val.lower().replace(' ', '') == oldval.lower().replace(' ', '')
  20.  
  21.  
  22. def set_account_email(oscar, set):
  23.     
  24.     def show(email = (None, None)):
  25.         if not email:
  26.             pass
  27.         val = GetTextFromUser(_('Enter an email address:'), _('Edit Account Email: %s') % oscar.self_buddy.name, default_value = '')
  28.         if val is None or not val.strip():
  29.             return None
  30.         log.info('setting new account email %r', val)
  31.         return set(val)
  32.  
  33.     timer = wx.PyTimer(show)
  34.     
  35.     def success(email):
  36.         if timer.IsRunning():
  37.             timer.Stop()
  38.             show(email)
  39.         else:
  40.             log.info('server response was too late: %r', email)
  41.  
  42.     
  43.     def error():
  44.         log.info('error retreiving account email for %r', oscar)
  45.         if timer.IsRunning():
  46.             timer.Stop()
  47.             show()
  48.         
  49.  
  50.     timer.StartOneShot(2000)
  51.     oscar.get_account_email(success = success, error = error)
  52.  
  53.