def __init__(self, frame): wx.Panel.__init__(self, frame, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.frame = frame # XXX: MAY simplify setting self.cwdJust use os.getcwd(). */ self.cwd = os.path.split(sys.argv[0])[0] if not self.cwd: self.cwd = os.getcwd() if frame: self.titleBase = frame.GetTitle() self.statusbar = self.frame.CreateStatusBar() self.printer = html.HtmlEasyPrinting(frame_title) self.box = wx.BoxSizer(wx.VERTICAL) subbox_1 = wx.BoxSizer(wx.HORIZONTAL) self.prev_btn = wx.Button(self, -1, 'Previous Page') self.Bind(wx.EVT_BUTTON, self.on_prev_page, self.prev_btn) subbox_1.Add(self.prev_btn, 5, wx.GROW | wx.ALL, 2) self.next_btn = wx.Button(self, -1, 'Next Page') self.Bind(wx.EVT_BUTTON, self.on_next_page, self.next_btn) subbox_1.Add(self.next_btn, 5, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, 'Help') self.Bind(wx.EVT_BUTTON, self.on_help, btn) subbox_1.Add(btn, 5, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, 'Search the word(s)') self.Bind(wx.EVT_BUTTON, self.on_word_enter, btn) subbox_1.Add(btn, 5, wx.GROW | wx.ALL, 2) lbl = wx.StaticText(self, -1, 'Word(s): ', style=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM) subbox_1.Add(lbl, 5, wx.GROW | wx.ALL, 2) self.search_word = wx.TextCtrl(self, -1, '', style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.on_word_enter, self.search_word) self.search_word.Bind(wx.EVT_LEFT_UP, self.on_mouse_up) subbox_1.Add(self.search_word, 20, wx.GROW | wx.ALL, 2) self.box.Add(subbox_1, 0, wx.GROW) self.nb = NB(self) self.box.Add(self.nb, 1, wx.GROW) self.SetSizer(self.box) self.SetAutoLayout(True)
def __init__(self, parent, path): wx.Frame.__init__(self, parent, -1, size=wx.Size(700, 610)) self.path = path self.SetBackgroundColour(wx.Colour(255, 225, 153)) self.html = html.HtmlWindow(self, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.html.SetRelatedFrame(self, u" %s ") #self.html.SetRelatedStatusBar(0) self.printer = html.HtmlEasyPrinting() self.box = wx.BoxSizer(wx.VERTICAL) subbox = wx.BoxSizer(wx.HORIZONTAL) icones = [(u"maison", u"Page d'accueil.", self.OnHome), (u"gauche", u"Page precedente.", self.OnBack), (u"droite", u"Page suivante.", self.OnForward), (u"print", u"Imprimer la page.", self.OnPrint)] for i in range(len(icones)): icone = icones[i] bmp = png(icone[0]) bouton = wx.BitmapButton(self, -1, bmp, style=wx.NO_BORDER) bouton.SetBackgroundColour(self.GetBackgroundColour()) subbox.Add(bouton, 0, wx.ALL, 5) bouton.SetToolTipString(icone[1]) bouton.Bind(wx.EVT_BUTTON, icone[2]) self.box.Add(subbox, 0) self.box.Add(self.html, 1, wx.GROW) self.SetSizer(self.box) self.SetAutoLayout(True) self.OnHome(None)
def __init__(self, parent, frame, file): "Constructor for HtmlPanel." wx.Panel.__init__(self, parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.frame = frame self.file = file self.cwd = os.path.split(sys.argv[0])[0] if not self.cwd: self.cwd = os.getcwd() if frame: self.titleBase = frame.GetTitle() self.html = HtmlWindow(self, -1) self.html.SetRelatedFrame(frame, self.titleBase + " -- %s") self.html.SetRelatedStatusBar(0) self.printer = html.HtmlEasyPrinting() buttonSizer = self.CreateBrowserButtons() self.SetSizer(buttonSizer) self.SetAutoLayout(True) self.Fit() self.OnShowDefault(None)
def __init__(self, parent, frame, log): wx.Panel.__init__(self, parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.log = log self.frame = frame self.cwd = os.path.dirname(__file__) if not self.cwd: self.cwd = os.getcwd() os.chdir(self.cwd) if frame: self.titleBase = frame.GetTitle() html.HtmlWindow.AddFilter(MyHtmlFilter(log)) self.html = MyHtmlWindow(self, -1, log) self.html.SetRelatedFrame(frame, self.titleBase + " -- %s") self.html.SetRelatedStatusBar(0) self.printer = html.HtmlEasyPrinting() self.box = wx.BoxSizer(wx.VERTICAL) self.box.Add(self.html, 1, wx.GROW) subbox = wx.BoxSizer(wx.HORIZONTAL) btn = wx.Button(self, -1, "Load File") self.Bind(wx.EVT_BUTTON, self.OnLoadFile, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, "Load URL") self.Bind(wx.EVT_BUTTON, self.OnLoadURL, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, "With Widgets") self.Bind(wx.EVT_BUTTON, self.OnWithWidgets, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, "Back") self.Bind(wx.EVT_BUTTON, self.OnBack, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, "Forward") self.Bind(wx.EVT_BUTTON, self.OnForward, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, "Print") self.Bind(wx.EVT_BUTTON, self.OnPrint, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) btn = wx.Button(self, -1, "View Source") self.Bind(wx.EVT_BUTTON, self.OnViewSource, btn) subbox.Add(btn, 1, wx.GROW | wx.ALL, 2) self.box.Add(subbox, 0, wx.GROW) self.SetSizer(self.box) self.SetAutoLayout(True) # A button with this ID is created on the widget test page. self.Bind(wx.EVT_BUTTON, self.OnOk, id=wx.ID_OK) self.OnShowDefault(None)