home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / plugins / promotestatus / promote.pyo (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.7 KB  |  56 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from common.statusmessage import StatusMessage
  5. from common import profile, pref
  6. import platform
  7. import wx
  8. from gui import skin
  9. from logging import getLogger
  10. log = getLogger('promote_status')
  11. PROMOTE_STATUS_PREF = 'plugins.promotestatus.initial_status'
  12.  
  13. def PROMOTE_STATUS_STRING():
  14.     import branding
  15.     url = branding.get('digsby.promote.url', 'digsby_promote', 'http://im.digsby.com')
  16.     return u'I use Digsby to manage IM + Email + Social Networks - ' + url
  17.  
  18.  
  19. class PromoteStatus(StatusMessage):
  20.     __slots__ = StatusMessage.__slots__[:]
  21.     __slots__.remove('message')
  22.     edit_toggle = False
  23.     
  24.     def __init__(self, message = None, status = None, editable = None, **kws):
  25.         None(StatusMessage.__init__, self = 'title', Promote Digsby! = 'status' if status is None else status, message = None, editable = False, edit_toggle = kws.get('edit_toggle', self.edit_toggle))
  26.  
  27.     message = property((lambda self: PROMOTE_STATUS_STRING()), (lambda self, val: pass))
  28.     
  29.     def icon(self):
  30.         return skin.get('statusicons.promote', None)
  31.  
  32.     icon = property(icon)
  33.  
  34.  
  35. def status_factory():
  36.     import common
  37.     if common.pref('social.use_global_status', default = False, type = bool):
  38.         return None
  39.     start_status = pref(PROMOTE_STATUS_PREF, 'available')
  40.     if start_status == 'idle':
  41.         start_status = 'available'
  42.     
  43.     return PromoteStatus(status = start_status)
  44.  
  45.  
  46. def on_before_status_change(status):
  47.     log.info('on_status_change')
  48.     if isinstance(status, PromoteStatus):
  49.         s = status.status
  50.         if pref(PROMOTE_STATUS_PREF, type = str, default = 'available') != s:
  51.             profile.prefs.__setitem__(PROMOTE_STATUS_PREF, s.lower())
  52.         
  53.     
  54.     return status
  55.  
  56.