home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import wx
- import wx.lib.activex as wx
- import comtypes.client as cc
- import sys
- if not hasattr(sys, 'frozen'):
- cc.GetModule('shdocvw.dll')
-
- from comtypes.gen import SHDocVw
- clsID = '{8856F961-340A-11D0-A96B-00C04FD705A2}'
- progID = 'Shell.Explorer.2'
- REFRESH_NORMAL = 0
- REFRESH_IFEXPIRED = 1
- REFRESH_CONTINUE = 2
- REFRESH_COMPLETELY = 3
- NAV_OpenInNewWindow = 1
- NAV_NoHistory = 2
- NAV_NoReadFromCache = 4
- NAV_NoWriteToCache = 8
- NAV_AllowAutosearch = 16
- NAV_BrowserBar = 32
- NAV_Hyperlink = 64
- NAV_EnforceRestricted = (128,)
- NAV_NewWindowsManaged = (256,)
- NAV_UntrustedForDownload = (512,)
- NAV_TrustedForActiveX = (1024,)
- NAV_OpenInNewTab = (2048,)
- NAV_OpenInBackgroundTab = (4096,)
- NAV_KeepWordWheelText = 8192
-
- class IEHtmlWindow(wx.lib.activex.ActiveXCtrl):
-
- def __init__(self, parent, id = -1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = 0, name = 'IEHtmlWindow'):
- wx.lib.activex.ActiveXCtrl.__init__(self, parent, progID, id, pos, size, style, name)
- self._canGoBack = False
- self._canGoForward = False
-
-
- def LoadString(self, html):
- if self.ctrl.Document is None:
- self.LoadUrl('about:blank')
-
- doc = self.ctrl.Document
- doc.write(html)
- doc.close()
-
-
- def LoadStream(self, stream):
- if self.ctrl.Document is None:
- self.LoadUrl('about:blank')
-
- doc = self.ctrl.Document
- for line in stream:
- doc.write(line)
-
- doc.close()
-
-
- def LoadUrl(self, URL, Flags = 0):
- return self.ctrl.Navigate2(URL, Flags)
-
-
- def GetStringSelection(self, asHTML = True):
- if self.ctrl.Document is None:
- return ''
-
- if not hasattr(sys, 'frozen'):
- cc.GetModule('mshtml.tlb')
-
- MSHTML = MSHTML
- import comtypes.gen
- doc = self.ctrl.Document.QueryInterface(MSHTML.IHTMLDocument2)
- sel = doc.selection
- range = sel.createRange()
- if asHTML:
- return range.htmlText
- else:
- return range.text
-
-
- def GetText(self, asHTML = True):
- if self.ctrl.Document is None:
- return ''
-
- if not hasattr(sys, 'frozen'):
- cc.GetModule('mshtml.tlb')
-
- MSHTML = MSHTML
- import comtypes.gen
- doc = self.ctrl.Document.QueryInterface(MSHTML.IHTMLDocument2)
- if not asHTML:
- return doc.body.innerText
-
- for idx in range(doc.all.length):
- item = doc.all.item(idx)
- if item is None:
- continue
-
- return item.outerHTML
-
- return ''
-
-
- def Print(self, showDialog = False):
- if showDialog:
- prompt = SHDocVw.OLECMDEXECOPT_PROMPTUSER
- else:
- prompt = SHDocVw.OLECMDEXECOPT_DONTPROMPTUSER
- self.ctrl.ExecWB(SHDocVw.OLECMDID_PRINT, prompt)
-
-
- def PrintPreview(self):
- self.ctrl.ExecWB(SHDocVw.OLECMDID_PRINTPREVIEW, SHDocVw.OLECMDEXECOPT_DODEFAULT)
-
-
- def GoBack(self):
- if self.CanGoBack():
- return self.ctrl.GoBack()
-
-
-
- def GoForward(self):
- if self.CanGoForward():
- return self.ctrl.GoForward()
-
-
-
- def CanGoBack(self):
- return self._canGoBack
-
-
- def CanGoForward(self):
- return self._canGoForward
-
-
- def GoHome(self):
- return self.ctrl.GoHome()
-
-
- def GoSearch(self):
- return self.ctrl.GoSearch()
-
-
- def Navigate(self, URL, Flags = 0, TargetFrameName = None, PostData = None, Headers = None):
- return self.ctrl.Navigate2(URL, Flags, TargetFrameName, PostData, Headers)
-
-
- def RefreshPage(self, Level = REFRESH_NORMAL):
- return self.ctrl.Refresh2(Level)
-
-
- def Stop(self):
- return self.ctrl.Stop()
-
-
- def Quit(self):
- return self.ctrl.Quit()
-
-
- def CommandStateChange(self, this, command, enable):
- if command == SHDocVw.CSC_NAVIGATEFORWARD:
- self._canGoForward = enable
-
- if command == SHDocVw.CSC_NAVIGATEBACK:
- self._canGoBack = enable
-
-
-
- def _get_Busy(self):
- return self.ctrl.Busy
-
- busy = property(_get_Busy, None)
-
- def _get_Document(self):
- return self.ctrl.Document
-
- document = property(_get_Document, None)
-
- def _get_LocationName(self):
- return self.ctrl.LocationName
-
- locationname = property(_get_LocationName, None)
-
- def _get_LocationURL(self):
- return self.ctrl.LocationURL
-
- locationurl = property(_get_LocationURL, None)
-
- def _get_ReadyState(self):
- return self.ctrl.ReadyState
-
- readystate = property(_get_ReadyState, None)
-
- def _get_Offline(self):
- return self.ctrl.Offline
-
-
- def _set_Offline(self, Offline):
- self.ctrl.Offline = Offline
-
- offline = property(_get_Offline, _set_Offline)
-
- def _get_Silent(self):
- return self.ctrl.Silent
-
-
- def _set_Silent(self, Silent):
- self.ctrl.Silent = Silent
-
- silent = property(_get_Silent, _set_Silent)
-
- def _get_RegisterAsBrowser(self):
- return self.ctrl.RegisterAsBrowser
-
-
- def _set_RegisterAsBrowser(self, RegisterAsBrowser):
- self.ctrl.RegisterAsBrowser = RegisterAsBrowser
-
- registerasbrowser = property(_get_RegisterAsBrowser, _set_RegisterAsBrowser)
-
- def _get_RegisterAsDropTarget(self):
- return self.ctrl.RegisterAsDropTarget
-
-
- def _set_RegisterAsDropTarget(self, RegisterAsDropTarget):
- self.ctrl.RegisterAsDropTarget = RegisterAsDropTarget
-
- registerasdroptarget = property(_get_RegisterAsDropTarget, _set_RegisterAsDropTarget)
-
- def _get_Type(self):
- return self.ctrl.Type
-
- type = property(_get_Type, None)
-
- if __name__ == '__main__':
- app = wx.App(False)
- frm = wx.Frame(None, title = 'AX Test Window')
- ie = IEHtmlWindow(frm)
- frm.Show()
- import wx.lib.inspection as wx
- wx.lib.inspection.InspectionTool().Show()
- app.MainLoop()
-
-