def __init__(self,url=None,w=800,h=600,title="",fullscreen=False,
		headless=False,transparent=False,embedIn=None):
		"""
		See http://wiki.wxpython.org/SynchronisingToInternetExplorer?highlight=(activex)

		https://www.codeproject.com/articles/3365/embed-an-html-control-in-your-own-window-using-pla
		"""
		Browser.__init__(self,url,w,h,title,fullscreen,headless,transparent,embedIn)
		self._url=None
		clsid='{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}'
		module=EnsureModule(clsid,0,1,1)
		theClass=MakeActiveXClass(module.WebBrowser,eventObj=self)
		self.browser=theClass(self,-1)
		self.uiControl=wxFrame(None,-1,title)
		self.uiControl.SetAutoLayout(True)
		lc=wxLayoutConstraints()
		lc.right.SameAs(self.uiControl,wxRight)
		lc.left.SameAs(self.uiControl,wxLeft)
		lc.top.SameAs(self.uiControl,wxTop)
		lc.bottom.SameAs(self.uiControl,wxBottom)
		self.browser.SetConstraints(lc)
		app=wxApp()
		self.uiControl.Show(True)
		app.SetTopWindow(self.uiControl)
		if url is not None:
			self.url=url
Exemplo n.º 2
0
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        # this function creates a new class that can be used as
        # a wxWindow, but contains the given ActiveX control.
        ActiveXWrapper = MakeActiveXClass(acrobat.AcroPDF)

        # create an instance of the new class
        self.pdf = ActiveXWrapper(self, -1, style=wx.SUNKEN_BORDER)

        sizer.Add(self.pdf, 1, wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open PDF File")
        wx.EVT_BUTTON(self, btn.GetId(), self.OnOpenButton)
        btnSizer.Add(btn, 1, wx.EXPAND | wx.ALL, 5)

        btn = wx.Button(self, wx.NewId(), "<-- Previous Page")
        wx.EVT_BUTTON(self, btn.GetId(), self.OnPrevPageButton)
        btnSizer.Add(btn, 1, wx.EXPAND | wx.ALL, 5)

        btn = wx.Button(self, wx.NewId(), "Next Page -->")
        wx.EVT_BUTTON(self, btn.GetId(), self.OnNextPageButton)
        btnSizer.Add(btn, 1, wx.EXPAND | wx.ALL, 5)

        btnSizer.Add((50, -1), 2, wx.EXPAND)
        sizer.Add(btnSizer, 0, wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)

        wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
Exemplo n.º 3
0
        def __init__(self, *args, **kw):
            wx.Panel.__init__(self, *args, **kw)

            # Make a new class that derives from the WebBrowser class
            # in the COM module imported above.  This class also
            # derives from wxWindow and implements the machinery
            # needed to integrate the two worlds.
            _WebBrowserClass = MakeActiveXClass(_browserModule.WebBrowser)
            self.ie = _WebBrowserClass(self, -1)
            sizer = wx.BoxSizer()
            sizer.Add(self.ie, 1, wx.EXPAND)
            self.SetSizer(sizer)
Exemplo n.º 4
0
 def _createWidgets(self):
     # Make an ActiveX class for the MSHTML HTMLDocument
     theClass = MakeActiveXClass(mshtmlModule.HTMLDocument, eventObj=self)
     # Create an instance of that class
     self.mshtmlIHtmlDocumentCtrl = theClass(self,
                                             wx.ID_ANY,
                                             style=wx.NO_BORDER)
     # create custom Doc
     self.customDoc = self._createICustomDoc(self.mshtmlIHtmlDocumentCtrl)
     # create UI handler
     if self.customDoc:
         self.uiHandler = self._createIUiHandler(
             self.mshtmlIHtmlDocumentCtrl, self.customDoc)
         self.customDoc.SetUIHandler(
             win32com.server.util.wrap(self.uiHandler))  #@UndefinedVariable
Exemplo n.º 5
0
        "Fired when window has been sized."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_WINDOWRESIZE, varnames2dict(self.OnWindowResize.im_func.func_code.co_varnames[1:], locals())))
    def OnWindowMove(self):
        "Fired when window has been moved."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_WINDOWMOVE, varnames2dict(self.OnWindowMove.im_func.func_code.co_varnames[1:], locals())))
    def OnProgressChange(self, Progress=defaultNamedNotOptArg, ProgressMax=defaultNamedNotOptArg):
        "Fired when download progress is updated."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_PROGRESSCHANGE, varnames2dict(self.OnProgressChange.im_func.func_code.co_varnames[1:], locals())))
    def OnFrameNewWindow(self, URL=defaultNamedNotOptArg, Flags=defaultNamedNotOptArg, TargetFrameName=defaultNamedNotOptArg, PostData=defaultNamedNotOptArg, Headers=defaultNamedNotOptArg, Processed=defaultNamedNotOptArg):
        "Fired when a new window should be created."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_FRAMENEWWINDOW, varnames2dict(self.OnFrameNewWindow.im_func.func_code.co_varnames[1:], locals())))
    def OnStatusTextChange(self, Text=defaultNamedNotOptArg):
        "Statusbar text changed."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_STATUSTEXTCHANGE, varnames2dict(self.OnStatusTextChange.im_func.func_code.co_varnames[1:], locals())))
    def OnFrameNavigateComplete(self, URL=defaultNamedNotOptArg):
        "Fired when a new hyperlink is being navigated to in a frame."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_FRAMENAVIGATECOMPLETE, varnames2dict(self.OnFrameNavigateComplete.im_func.func_code.co_varnames[1:], locals())))
    def OnQuit(self, Cancel=defaultNamedNotOptArg):
        "Fired when application is quiting."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_CWB_QUIT, varnames2dict(self.OnQuit.im_func.func_code.co_varnames[1:], locals())))
    def OnNavigateComplete(self, URL=defaultNamedNotOptArg):
        "Fired when the document being navigated to becomes visible and enters the navigation stack."
        wx.PostEvent(self.eventhandler, wxComWebBrowserEvent(wxEVT_NAVIGATECOMPLETE, varnames2dict(self.OnNavigateComplete.im_func.func_code.co_varnames[1:], locals())))

wxComWebBrowserPtr = MakeActiveXClass(IEModule.WebBrowser)
class wxComWebBrowser(wxComWebBrowserPtr):
    def __init__(self, parent = None, id = -1, pos=wxDefaultPosition, size=wxDefaultSize, style=0, name=''):
        wxComWebBrowserPtr.__init__(self, parent, id, pos, size, style)
        self._eventObj = wxComWebBrowserEvents(self)
        self.SetName(name)
Exemplo n.º 6
0
    def __init__(self, parent, frame=None):
        wx.Window.__init__(self, parent)
        self.ie = None
        self.current = "http://wxPython.org/"
        self.frame = frame
        if frame:
            self.titleBase = frame.GetTitle()

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        # Make a new class that derives from the WebBrowser class in the
        # COM module imported above.  This class also derives from wxWindow and
        # implements the machinery needed to integrate the two worlds.
        theClass = MakeActiveXClass(browserModule.WebBrowser, eventObj=self)

        # Create an instance of that class
        self.ie = theClass(self, -1)

        btn = wx.Button(self, wx.NewId(), "Open", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnOpenButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        btn = wx.Button(self, wx.NewId(), "Home", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnHomeButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        btn = wx.Button(self, wx.NewId(), "<--", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        btn = wx.Button(self, wx.NewId(), "-->", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        btn = wx.Button(self, wx.NewId(), "Stop", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnStopButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        btn = wx.Button(self, wx.NewId(), "Search", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnSearchPageButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        btn = wx.Button(self, wx.NewId(), "Refresh", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnRefreshPageButton, btn)
        btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2)

        txt = wx.StaticText(self, -1, "Location:")
        btnSizer.Add(txt, 0, wx.CENTER | wx.ALL, 2)

        self.location = wx.ComboBox(self, wx.NewId(), "", style=wx.CB_DROPDOWN)
        self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location)
        self.location.Bind(wx.EVT_KEY_UP, self.OnLocationKey)
        self.location.Bind(wx.EVT_CHAR, self.IgnoreReturn)
        btnSizer.Add(self.location, 1, wx.EXPAND | wx.ALL, 2)

        sizer.Add(btnSizer, 0, wx.EXPAND)
        sizer.Add(self.ie, 1, wx.EXPAND)

        self.ie.Navigate2(self.current)
        self.location.Append(self.current)

        self.SetSizer(sizer)

        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
Exemplo n.º 7
0
import wx
from wx.lib.activexwrapper import MakeActiveXClass
import win32com.client.gencache

try:
    acrobatModule = win32com.client.gencache.EnsureModule(
          '{CA8A9783-280D-11CF-A24D-444553540000}', 0x0, 1, 3)
except Exception, error:
    raise ImportError, error

wxComPdfPtr = MakeActiveXClass(acrobatModule.Pdf)
class wxComPdf(wxComPdfPtr):
    def __init__(self, parent = None, id = -1, pos=wx.DefaultPosition, 
          size=wx.DefaultSize, style=0, name=''):
        wxComPdfPtr.__init__(self, parent, id, pos, size, style)
        self.SetName(name)