def init(self, parent): """ Finishes initializing the editor by creating the underlying toolkit widget. """ self.control = ie = iewin.IEHtmlWindow( parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.set_tooltip() factory = self.factory self.base_url = factory.base_url self.sync_value(factory.home, 'home', 'from') self.sync_value(factory.back, 'back', 'from') self.sync_value(factory.forward, 'forward', 'from') self.sync_value(factory.stop, 'stop', 'from') self.sync_value(factory.refresh, 'refresh', 'from') self.sync_value(factory.search, 'search', 'from') self.sync_value(factory.status, 'status', 'to') self.sync_value(factory.title, 'title', 'to') self.sync_value(factory.page_loaded, 'page_loaded', 'to') self.sync_value(factory.html, 'html', 'to') self.sync_value(factory.base_url_name, 'base_url', 'from') parent.Bind(iewin.EVT_StatusTextChange, self._status_modified, ie) parent.Bind(iewin.EVT_TitleChange, self._title_modified, ie) parent.Bind(iewin.EVT_DocumentComplete, self._page_loaded_modified, ie) parent.Bind(iewin.EVT_NewWindow2, self._new_window_modified, ie) parent.Bind(iewin.EVT_BeforeNavigate2, self._navigate_requested, ie)
def init(self, parent): """Finishes initializing the editor by creating the underlying toolkit widget. """ self.control = ie = iewin.IEHtmlWindow( parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE ) self.set_tooltip() factory = self.factory self.base_url = factory.base_url self.sync_value(factory.home, "home", "from") self.sync_value(factory.back, "back", "from") self.sync_value(factory.forward, "forward", "from") self.sync_value(factory.stop, "stop", "from") self.sync_value(factory.refresh, "refresh", "from") self.sync_value(factory.search, "search", "from") self.sync_value(factory.status, "status", "to") self.sync_value(factory.title, "title", "to") self.sync_value(factory.page_loaded, "page_loaded", "to") self.sync_value(factory.html, "html", "to") self.sync_value(factory.base_url_name, "base_url", "from") parent.Bind(iewin.EVT_StatusTextChange, ie, id=self._status_modified) parent.Bind(iewin.EVT_TitleChange, ie, id=self._title_modified) parent.Bind( iewin.EVT_DocumentComplete, ie, id=self._page_loaded_modified ) parent.Bind(iewin.EVT_NewWindow2, ie, id=self._new_window_modified) parent.Bind(iewin.EVT_BeforeNavigate2, ie, id=self._navigate_requested)
def __init__(self, pageURL): wx.Frame.__init__(self, None, size=(800, 600), style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW) self.Bind(wx.EVT_CLOSE, self.onClose) # Build the UI if webkit: try: self.htmlViewer = webkit.WebKitCtrl(self) except: self.htmlViewer = None if (not webkit or self.htmlViewer == None): if iewin: self.htmlViewer = iewin.IEHtmlWindow(self) self.htmlViewer.LoadURL = self.htmlViewer.LoadUrl else: self.htmlViewer = wx.html.HtmlWindow(self) self.htmlViewer.LoadURL = self.htmlViewer.LoadPage self.htmlViewer.GoBack = self.htmlViewer.HistoryBack self.htmlViewer.GoForward = self.htmlViewer.HistoryForward self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.mainSizer.Add(self.htmlViewer, 1, wx.EXPAND) self.SetSizer(self.mainSizer) # Set up the toolbar toolbar = wx.ToolBar(self) toolbar.SetToolBitmapSize(wx.Size(32, 32)) self.goBackTool = toolbar.AddLabelTool( wx.NewId(), gettext('Back'), wx.ArtProvider.GetBitmap(wx.ART_GO_BACK, wx.ART_TOOLBAR)) self.Bind(wx.EVT_TOOL, self.onGoBack, self.goBackTool) self.goForwardTool = toolbar.AddLabelTool( wx.NewId(), gettext('Forward'), wx.ArtProvider.GetBitmap(wx.ART_GO_FORWARD, wx.ART_TOOLBAR)) self.Bind(wx.EVT_TOOL, self.onGoForward, self.goForwardTool) toolbar.AddSeparator() self.goHomeTool = toolbar.AddLabelTool( wx.NewId(), gettext('Home'), wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR)) self.Bind(wx.EVT_TOOL, self.onGoHome, self.goHomeTool) self.showIndexTool = toolbar.AddLabelTool(wx.NewId(), gettext('Index'), self._loadBitmap('AtoZ.png')) self.Bind(wx.EVT_TOOL, self.onShowIndex, self.showIndexTool) toolbar.AddSeparator() self.searchControl = wx.SearchCtrl(toolbar, wx.NewId(), style=wx.TE_PROCESS_ENTER, size=wx.Size(200, 20)) self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.onSearch) self.Bind(wx.EVT_TEXT_ENTER, self.onSearch) toolbar.AddControl(self.searchControl) toolbar.Realize() self.SetToolBar(toolbar) self.pageURL = None self.showPage(pageURL)
def __init__(self, parent, id, pos, size, style, name): wx.Panel.__init__(self, parent, id, pos, size, style, name) log = [] self.log = log self.history = [] self.current = "http://wxPython.org/" sizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) self.ie = iewin.IEHtmlWindow(self) self.ie.LoadString(overview) btn = wx.Button(self, -1, "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, -1, "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, -1, "<--", style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, btn) btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2) #self.Bind(wx.EVT_UPDATE_UI, self.OnCheckCanGoBack, btn) btn = wx.Button(self, -1, "-->", style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, btn) btnSizer.Add(btn, 0, wx.EXPAND | wx.ALL, 2) #self.Bind(wx.EVT_UPDATE_UI, self.OnCheckCanGoForward, btn) btn = wx.Button(self, -1, "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, -1, "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, -1, "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, -1, self.current, style=wx.CB_DROPDOWN | wx.PROCESS_ENTER) 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.LoadUrl(self.current) self.location.Append(self.current) self.ie._set_AddressBar(True) self.SetSizer(sizer) # Since this is a wx.Window we have to call Layout ourselves self.Bind(wx.EVT_SIZE, self.OnSize) #Added this to make address bar work correctly self.Bind(iewin.EVT_NavigateComplete2, self.after_navigate)