home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 September / maximum-cd-2009-09.iso / DiscContents / digsby_setup.exe / lib / wx / lib / iewin.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  8.5 KB  |  246 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import wx
  5. import wx.lib.activex as wx
  6. import comtypes.client as cc
  7. import sys
  8. if not hasattr(sys, 'frozen'):
  9.     cc.GetModule('shdocvw.dll')
  10.  
  11. from comtypes.gen import SHDocVw
  12. clsID = '{8856F961-340A-11D0-A96B-00C04FD705A2}'
  13. progID = 'Shell.Explorer.2'
  14. REFRESH_NORMAL = 0
  15. REFRESH_IFEXPIRED = 1
  16. REFRESH_CONTINUE = 2
  17. REFRESH_COMPLETELY = 3
  18. NAV_OpenInNewWindow = 1
  19. NAV_NoHistory = 2
  20. NAV_NoReadFromCache = 4
  21. NAV_NoWriteToCache = 8
  22. NAV_AllowAutosearch = 16
  23. NAV_BrowserBar = 32
  24. NAV_Hyperlink = 64
  25. NAV_EnforceRestricted = (128,)
  26. NAV_NewWindowsManaged = (256,)
  27. NAV_UntrustedForDownload = (512,)
  28. NAV_TrustedForActiveX = (1024,)
  29. NAV_OpenInNewTab = (2048,)
  30. NAV_OpenInBackgroundTab = (4096,)
  31. NAV_KeepWordWheelText = 8192
  32.  
  33. class IEHtmlWindow(wx.lib.activex.ActiveXCtrl):
  34.     
  35.     def __init__(self, parent, id = -1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = 0, name = 'IEHtmlWindow'):
  36.         wx.lib.activex.ActiveXCtrl.__init__(self, parent, progID, id, pos, size, style, name)
  37.         self._canGoBack = False
  38.         self._canGoForward = False
  39.  
  40.     
  41.     def LoadString(self, html):
  42.         if self.ctrl.Document is None:
  43.             self.LoadUrl('about:blank')
  44.         
  45.         doc = self.ctrl.Document
  46.         doc.write(html)
  47.         doc.close()
  48.  
  49.     
  50.     def LoadStream(self, stream):
  51.         if self.ctrl.Document is None:
  52.             self.LoadUrl('about:blank')
  53.         
  54.         doc = self.ctrl.Document
  55.         for line in stream:
  56.             doc.write(line)
  57.         
  58.         doc.close()
  59.  
  60.     
  61.     def LoadUrl(self, URL, Flags = 0):
  62.         return self.ctrl.Navigate2(URL, Flags)
  63.  
  64.     
  65.     def GetStringSelection(self, asHTML = True):
  66.         if self.ctrl.Document is None:
  67.             return ''
  68.         
  69.         if not hasattr(sys, 'frozen'):
  70.             cc.GetModule('mshtml.tlb')
  71.         
  72.         MSHTML = MSHTML
  73.         import comtypes.gen
  74.         doc = self.ctrl.Document.QueryInterface(MSHTML.IHTMLDocument2)
  75.         sel = doc.selection
  76.         range = sel.createRange()
  77.         if asHTML:
  78.             return range.htmlText
  79.         else:
  80.             return range.text
  81.  
  82.     
  83.     def GetText(self, asHTML = True):
  84.         if self.ctrl.Document is None:
  85.             return ''
  86.         
  87.         if not hasattr(sys, 'frozen'):
  88.             cc.GetModule('mshtml.tlb')
  89.         
  90.         MSHTML = MSHTML
  91.         import comtypes.gen
  92.         doc = self.ctrl.Document.QueryInterface(MSHTML.IHTMLDocument2)
  93.         if not asHTML:
  94.             return doc.body.innerText
  95.         
  96.         for idx in range(doc.all.length):
  97.             item = doc.all.item(idx)
  98.             if item is None:
  99.                 continue
  100.             
  101.             return item.outerHTML
  102.         
  103.         return ''
  104.  
  105.     
  106.     def Print(self, showDialog = False):
  107.         if showDialog:
  108.             prompt = SHDocVw.OLECMDEXECOPT_PROMPTUSER
  109.         else:
  110.             prompt = SHDocVw.OLECMDEXECOPT_DONTPROMPTUSER
  111.         self.ctrl.ExecWB(SHDocVw.OLECMDID_PRINT, prompt)
  112.  
  113.     
  114.     def PrintPreview(self):
  115.         self.ctrl.ExecWB(SHDocVw.OLECMDID_PRINTPREVIEW, SHDocVw.OLECMDEXECOPT_DODEFAULT)
  116.  
  117.     
  118.     def GoBack(self):
  119.         if self.CanGoBack():
  120.             return self.ctrl.GoBack()
  121.         
  122.  
  123.     
  124.     def GoForward(self):
  125.         if self.CanGoForward():
  126.             return self.ctrl.GoForward()
  127.         
  128.  
  129.     
  130.     def CanGoBack(self):
  131.         return self._canGoBack
  132.  
  133.     
  134.     def CanGoForward(self):
  135.         return self._canGoForward
  136.  
  137.     
  138.     def GoHome(self):
  139.         return self.ctrl.GoHome()
  140.  
  141.     
  142.     def GoSearch(self):
  143.         return self.ctrl.GoSearch()
  144.  
  145.     
  146.     def Navigate(self, URL, Flags = 0, TargetFrameName = None, PostData = None, Headers = None):
  147.         return self.ctrl.Navigate2(URL, Flags, TargetFrameName, PostData, Headers)
  148.  
  149.     
  150.     def RefreshPage(self, Level = REFRESH_NORMAL):
  151.         return self.ctrl.Refresh2(Level)
  152.  
  153.     
  154.     def Stop(self):
  155.         return self.ctrl.Stop()
  156.  
  157.     
  158.     def Quit(self):
  159.         return self.ctrl.Quit()
  160.  
  161.     
  162.     def CommandStateChange(self, this, command, enable):
  163.         if command == SHDocVw.CSC_NAVIGATEFORWARD:
  164.             self._canGoForward = enable
  165.         
  166.         if command == SHDocVw.CSC_NAVIGATEBACK:
  167.             self._canGoBack = enable
  168.         
  169.  
  170.     
  171.     def _get_Busy(self):
  172.         return self.ctrl.Busy
  173.  
  174.     busy = property(_get_Busy, None)
  175.     
  176.     def _get_Document(self):
  177.         return self.ctrl.Document
  178.  
  179.     document = property(_get_Document, None)
  180.     
  181.     def _get_LocationName(self):
  182.         return self.ctrl.LocationName
  183.  
  184.     locationname = property(_get_LocationName, None)
  185.     
  186.     def _get_LocationURL(self):
  187.         return self.ctrl.LocationURL
  188.  
  189.     locationurl = property(_get_LocationURL, None)
  190.     
  191.     def _get_ReadyState(self):
  192.         return self.ctrl.ReadyState
  193.  
  194.     readystate = property(_get_ReadyState, None)
  195.     
  196.     def _get_Offline(self):
  197.         return self.ctrl.Offline
  198.  
  199.     
  200.     def _set_Offline(self, Offline):
  201.         self.ctrl.Offline = Offline
  202.  
  203.     offline = property(_get_Offline, _set_Offline)
  204.     
  205.     def _get_Silent(self):
  206.         return self.ctrl.Silent
  207.  
  208.     
  209.     def _set_Silent(self, Silent):
  210.         self.ctrl.Silent = Silent
  211.  
  212.     silent = property(_get_Silent, _set_Silent)
  213.     
  214.     def _get_RegisterAsBrowser(self):
  215.         return self.ctrl.RegisterAsBrowser
  216.  
  217.     
  218.     def _set_RegisterAsBrowser(self, RegisterAsBrowser):
  219.         self.ctrl.RegisterAsBrowser = RegisterAsBrowser
  220.  
  221.     registerasbrowser = property(_get_RegisterAsBrowser, _set_RegisterAsBrowser)
  222.     
  223.     def _get_RegisterAsDropTarget(self):
  224.         return self.ctrl.RegisterAsDropTarget
  225.  
  226.     
  227.     def _set_RegisterAsDropTarget(self, RegisterAsDropTarget):
  228.         self.ctrl.RegisterAsDropTarget = RegisterAsDropTarget
  229.  
  230.     registerasdroptarget = property(_get_RegisterAsDropTarget, _set_RegisterAsDropTarget)
  231.     
  232.     def _get_Type(self):
  233.         return self.ctrl.Type
  234.  
  235.     type = property(_get_Type, None)
  236.  
  237. if __name__ == '__main__':
  238.     app = wx.App(False)
  239.     frm = wx.Frame(None, title = 'AX Test Window')
  240.     ie = IEHtmlWindow(frm)
  241.     frm.Show()
  242.     import wx.lib.inspection as wx
  243.     wx.lib.inspection.InspectionTool().Show()
  244.     app.MainLoop()
  245.  
  246.