home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- import cgui
- import sys
- import wx
- import common
- import traceback
- from common import profile
- from digsbyipcaction.funcs import funccall
- from main import APP_ID
- TOP_BUDDIES_ENABLED = False
- SHOW_STATUS_ITEMS = True
-
- def buddylist_sorted(view):
- _update_jumplist()
-
-
- def status_set(status):
- if SHOW_STATUS_ITEMS:
- _set_jumplist_now()
-
-
- if getattr(sys, 'DEV', False):
- script = u'Digsby.py '
- else:
- script = u''
-
- def action(name, desc, label, icon = None):
- return (script + '--action=' + name, desc, label, icon)
-
-
- def get_status(name, service):
- return profile.blist.get_status(name, service)
-
-
- def buddy_item(buddy):
- status_icon = None
- ipc_call = funccall('chat', idstr = buddy.idstr())
- name = unicode(buddy.alias)
- desc = _('Chat with ') + name
- return action(ipc_call, desc, name, status_icon)
-
-
- def logging_enabled():
- if not getattr(logging_enabled, 'linked', False):
- logging_enabled.linked = True
-
- def on_log_ims_pref(val):
- _update_jumplist()
-
- common.profile.prefs.link('log.ims', on_log_ims_pref, callnow = False, obj = logging_enabled)
-
- return common.pref('log.ims')
-
- MAX_BUDDIES_IN_LOGSIZE_LIST = 7
-
- def _set_jumplist_now():
- popular_buddies = []
- if TOP_BUDDIES_ENABLED:
-
- try:
- popular_buddies = profile.blist.online_popular_buddies()
- except Exception:
- traceback.print_exc()
- except:
- None<EXCEPTION MATCH>Exception
-
-
- None<EXCEPTION MATCH>Exception
- set_app_jumplist(popular_buddies)
-
-
- def _update_jumplist():
- if not cgui.isWin7OrHigher():
- return None
-
- def on_timer():
- _set_jumplist_now()
-
-
- def after():
-
- try:
- t = buddylist_sorted.timer
- except AttributeError:
- t = buddylist_sorted.timer = wx.PyTimer(on_timer)
- on_timer()
-
- if not t.IsRunning():
- t.StartOneShot(6000)
-
-
- after = (wx.CallAfter,)(after)
-
-
- def _status_icons_for_status(status):
- skin = skin
- import gui
- status_icons = dict.fromkeys(('available', 'away', 'invisible'), None)
- checked = skin.get('appdefaults.icons.taskbarcheck', None)
- if checked is not None:
- checked = checked.PIL.Resized(16).WXB
-
- if status.invisible:
- status_icons['invisible'] = checked
- elif status.away:
- status_icons['away'] = checked
- elif status.available:
- status_icons['available'] = checked
-
- return status_icons
-
-
- def jumplist_status_items(current_status):
- status_icons = _status_icons_for_status(current_status)
-
- def status_action(name, label):
- tooltip = _('Change IM Status to %s') % label
- ipc = funccall('status', status = name)
- return action(ipc, tooltip, label, status_icons[name])
-
- return [
- status_action('available', _('Available')),
- status_action('away', _('Away')),
- status_action('invisible', _('Invisible'))]
-
-
- def set_app_jumplist(log_sizes = None):
-
- def after():
- skin = skin
- import gui
- TASKS = [
- action('globalstatus', _('Set your status on multiple networks'), _('Set Global Status'), skin.get('icons.globalstatus', None)),
- action('newim', _('Open the New IM window'), _('New IM...'), skin.get('AppDefaults.UnreadMessageIcon', None)),
- action('prefsdialog', _('Open the Digsby Preferences window'), _('Preferences...'))]
- if SHOW_STATUS_ITEMS:
- TASKS.append(None)
- TASKS.extend(jumplist_status_items(profile.status))
-
- TASKS.append(None)
- TASKS.append(action('exit', _('Close all windows and exit'), _('Exit Digsby'), skin.get('AppDefaults.JumpListCloseIcon', None)))
- jumplist = [
- (u'', TASKS)]
- if TOP_BUDDIES_ENABLED:
- logging = logging_enabled()
- jumplist.append((u'Top Buddies (by log size)', buddies))
-
- success = cgui.SetUpJumpList(APP_ID, jumplist)
- register_shutdown_hook()
-
- after = (wx.CallAfter,)(after)
-
- _did_register_shutdown_hook = False
-
- def register_shutdown_hook():
- global _did_register_shutdown_hook
- if _did_register_shutdown_hook:
- return None
- _did_register_shutdown_hook = True
- wx.GetApp().PreShutdown.append((lambda : cgui.SetUpJumpList(APP_ID, [])))
-
-