home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- import sys
- import wx
- import ctypes
-
- try:
- ctypes.windll.dwmapi
- except Exception:
- pass
-
- import gui.vista as gui
- import digsbysite
- import util
- import stdpaths
- from util.primitives.funcs import Delegate
- from util.primitives.mapping import Storage
-
- def discover_digsby_root():
- import os.path as os
- return os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
-
-
- def _isdigsbyroot(p):
- print >>sys.stderr, 'isdigsbyroot?', p
- return (p / 'res' / 'skins' / 'default').isdir()
-
-
- class TestApp(wx.App):
-
- def __enter__(self):
- pass
-
-
- def __exit__(self, exc_type, exc_value, tb):
- if exc_type is None:
- self.MainLoop()
-
-
-
- wxMSW = 'wxMSW' in wx.PlatformInfo
-
- def testapp(pypath = None, appname = 'Digsby', skinname = 'default', prefs = None, username = 'megazord', on_message = (lambda message: pass), plugins = True, logging = True):
- if wxMSW:
- preload_comctrls()
-
- import gettext
- import os.path as os
- import options
- (sys.opts, _args) = options.parser.parse_args()
- import logextensions
- digsbysite.COLORIZE_EXCEPTIONS = sys.opts.console_color
- gettext.install(appname, unicode = True)
- app = TestApp()
- app.SetAppName(appname)
- init = init
- import stdpaths
- init()
- if wxMSW:
- import gui.native.win.winutil as winutil
- winutil.disable_callback_filter()
-
- skin = skin
- import gui
- setuplogging = setuplogging
- import gui.toolbox
- if logging:
- import logging
- setuplogging(level = logging.INFO)
-
- wx.Log.SetActiveTarget(wx.LogStderr())
- app.PreShutdown = Delegate()
- if pypath is None:
- pypath = discover_digsby_root()
-
- sys.path.insert(0, pypath)
- skin.set_resource_paths([
- util.program_dir() / 'res',
- stdpaths.userdata,
- stdpaths.config])
- if plugins:
- init_plugins = init_plugins
- import main
- app.plugins = init_plugins()
- else:
- app.plugins = []
- skin.skininit(os.path.join(pypath, 'res'), skinname = skinname)
- ThreadPool = ThreadPool
- import util.threads.threadpool
- ThreadPool(5)
- flatten = flatten
- import prefs.prefsdata
- import syck
- ObservableDict = ObservableDict
- import util.observe
- prefs_path = os.path.join(pypath, 'res', 'defaults.yaml')
- prefs = None if prefs is not None else ObservableDict()
- prefs.update({
- 'appearance.skin': skinname,
- 'appearance.variant': None,
- 'debug.shell.font': shellfont() })
- import common
- common.set_active_prefs(prefs, { })
- ObservableDict = ObservableDict
- import util.observe
- sys.modules['digsbyprofile'] = Storage()
- import digsbyprofile
- default_notifications = default_notifications
- import common.notifications
- p = digsbyprofile.profile = Storage(name = username, username = username, prefs = prefs, on_message = on_message, notifications = default_notifications)
- f = file(prefs_path)
- defaults = Storage(flatten(syck.load(f)))
- f.close()
- user = ObservableDict(defaults)
- user.update(prefs)
- localprefs = localprefs
- import prefs.prefsdata
- import prefs
- p.defaultprefs = prefs.defaultprefs()
- p.localprefs = localprefs()
- import common
- common.setfakeprefs(user)
-
- def toggle_prefs(user = user, defaults = defaults):
- import prefs
- prefs.edit(user, defaults, None)
-
-
- def toggle_crust(app = app):
- if not getattr(app, 'crust', None):
- import gui.shell as gui
- wins = wx.GetTopLevelWindows()
- parent = None if wins else None
- app.crust = gui.shell.PyCrustFrame(None)
- if parent is not None:
- parent.crust = app.crust
-
- app.crust.Bind((wx.EVT_CLOSE,), (lambda evt: app.Exit()))
-
- app.crust.toggle_shown()
- if app.crust.IsShown():
- app.crust.crust.SetFocus()
-
-
-
- def on_key(e):
- code = e.GetKeyCode()
- if code == wx.WXK_F11:
- toggle_prefs()
- elif code == wx.WXK_F12:
- toggle_crust()
- elif code == wx.WXK_F5:
- skin = skin
- import gui
- skin.reload()
- else:
- e.Skip()
-
- app.Bind(wx.EVT_KEY_DOWN, on_key)
- app.toggle_crust = toggle_crust
- initialize_webkit = initialize_webkit
- SetStatusPrompt = SetStatusPrompt
- import main
- initialize_webkit()
- app.SetStatusPrompt = SetStatusPrompt
- return app
-
- if 'wxMSW' in wx.PlatformInfo:
-
- def preload_comctrls():
- windll = windll
- import ctypes
- windll.comctl32.InitCommonControls()
-
-
-
- def shellfont():
-
- try:
- import ctypes
- ctypes.windll.dwmapi
- except:
- font = 'Courier New'
-
- font = 'Consolas'
- return font
-
-