def __init__(self, parent, content, document): wx.Panel.__init__(self, parent, -1) mainframe = Globals.mainframe self.document = document self.mdhtmlview = True self.rendering = False box = wx.BoxSizer(wx.VERTICAL) self.chkAuto = wx.CheckBox(self, -1, tr("Stop auto updated")) box.Add(self.chkAuto, 0, wx.ALL, 2) if wx.Platform == '__WXMSW__': import wx.lib.iewin as iewin self.html = HtmlPage.IEHtmlWindow(self) if wx.VERSION < (2, 8, 8, 0): self.html.ie.Bind(iewin.EVT_DocumentComplete, self.OnDocumentComplete, self.html.ie) self.html.ie.Bind(iewin.EVT_ProgressChange, self.OnDocumentComplete, self.html.ie) else: self.html.ie.AddEventSink(self) else: self.html = HtmlPage.DefaultHtmlWindow(self) self.html.SetRelatedFrame(mainframe, mainframe.app.appname + " - Browser [%s]") self.html.SetRelatedStatusBar(0) self.tmpfilename = None self.load(content) if wx.Platform == '__WXMSW__': box.Add(self.html.ie, 1, wx.EXPAND|wx.ALL, 1) else: box.Add(self.html, 1, wx.EXPAND|wx.ALL, 1) self.SetSizer(box)
def createHtmlViewWindow(win, side, document): dispname = document.getShortFilename() obj = None for pagename, panelname, notebook, page in win.panel.getPages(): if is_htmlview(page, document): obj = page break if not obj: if win.document.documenttype == 'texteditor': from mixins import HtmlPage page = HtmlPage.HtmlImpactView(win.panel.createNotebook(side), document.getRawText()) page.document = win.document #save document object page.htmlview = True win.panel.addPage(side, page, dispname) win.panel.setImageIndex(page, 'html') return page else: obj.load(document.getRawText()) return obj
def __init__(self, parent, mainframe, filename, documenttype): self.initmixin() wx.SplitterWindow.__init__(self, parent, -1, style = wx.SP_LIVE_UPDATE ) DocumentBase.DocumentBase.__init__(self, parent, filename, documenttype) self.parent = parent self.mainframe = mainframe self.pref = mainframe.pref self.datas = RssDataPage(self, self.mainframe) self.view = HtmlPage.HtmlPage(self, mainframe, filename, documenttype) self.SetMinimumPaneSize(50) self.SplitHorizontally(self.datas, self.view, 250) self.publisher = pubsub.Publisher() self.publisher.subscribe(self.OnChangeHtml, 'change_html') self.data = [] self.guids = {}