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

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from __future__ import with_statement
  5. import os
  6. import sys
  7. import wx
  8. import wx.py as py
  9. from util import traceguard
  10. from gui.toolbox import loadWindowPos, saveWindowPos
  11. __all__ = [
  12.     'PyCrustFrame']
  13. if hasattr(sys, 'gettotalrefcount'):
  14.     
  15.     def get_total_refcount():
  16.         return '-- totalrefs: %d' % sys.gettotalrefcount()
  17.  
  18. else:
  19.     
  20.     def get_total_refcount():
  21.         return ''
  22.  
  23.  
  24. class PyCrustFrame(wx.Frame):
  25.     
  26.     def __init__(self, parent = None, id_ = -1, title = 'Digsby Shell', standalone = False, name = 'Digsby Shell'):
  27.         wx.Frame.__init__(self, parent, id_)
  28.         self.SetTitle(self.ShellTitle)
  29.         self.Bind(wx.EVT_SHOW, self.on_show)
  30.         self.title_timer = (wx.PyTimer,)((lambda : self.SetTitle(self.ShellTitle)))
  31.         self.title_timer_interval = 500
  32.         
  33.         try:
  34.             import digsbyprofile
  35.             prefs = digsbyprofile.profile.prefs
  36.         except ImportError:
  37.             prefs = { }
  38.         except AttributeError:
  39.             prefs = { }
  40.  
  41.         py.editwindow.FACES['mono'] = prefs.get('debug.shell.font', 'Courier New')
  42.         if prefs.get('debug.shell.minimal', True):
  43.             crust = shell = py.shell.Shell(self)
  44.         else:
  45.             crust = py.crust.Crust(self, intro = 'Digsby Shell')
  46.             shell = crust.shell
  47.         wx.GetApp().shell_locals = shell.interp.locals
  48.         import common.commandline as common
  49.         shell.interp.locals.update(common.commandline.__dict__)
  50.         self.input = shell
  51.         if 'debug.shell.history.size' in prefs:
  52.             maxsize = prefs['debug.shell.history.size']
  53.             h = prefs['debug.shell.history.lines']
  54.             h = h[:maxsize]
  55.             prefs['debug.shell.history.lines'] = shell.history = h
  56.         
  57.         self.crust = crust
  58.         self.Bind(wx.EVT_CLOSE, self.on_close)
  59.         loadWindowPos(self)
  60.         self.standalone = standalone
  61.         traceguard.__enter__()
  62.         
  63.         try:
  64.             skin = skin
  65.             import gui
  66.             self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon').Inverted)
  67.         finally:
  68.             pass
  69.  
  70.  
  71.     
  72.     def FocusInput(self):
  73.         self.input.SetFocus()
  74.  
  75.     
  76.     def on_close(self, e = None):
  77.         if self.IsShown():
  78.             saveWindowPos(self)
  79.         
  80.         self.Show(False)
  81.         if self.standalone:
  82.             sys.exit()
  83.         
  84.  
  85.     
  86.     def on_show(self, shown):
  87.         shown.Skip()
  88.         if shown:
  89.             self.title_timer.Start(self.title_timer_interval, False)
  90.         else:
  91.             self.title_timer.Stop()
  92.  
  93.     if 'wxMSW' in wx.PlatformInfo:
  94.         
  95.         def ShellTitle(self):
  96.             return 'Digsby Shell -- %s -- (gdi: %s, user: %s) -- pid: %s %s' % (nicebytecount(memory_info().WorkingSetSize), count_gdi_objects(), count_user_objects(), os.getpid(), get_total_refcount())
  97.  
  98.         ShellTitle = property(ShellTitle)
  99.     else:
  100.         ShellTitle = 'Digsby Shell'
  101.     
  102.     def toggle_shown(self):
  103.         if self.IsShown():
  104.             self.on_close()
  105.         else:
  106.             self.Show()
  107.  
  108.  
  109. if 'wxMSW' in wx.PlatformInfo:
  110.     from gui.native.win.process import memory_info, count_gdi_objects, count_user_objects
  111.     from util import nicebytecount
  112.     import gc
  113.  
  114.