def __init__(self, parent, Size, title, mode, data): wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=Size) html = wx.html.HtmlWindow(self) self.error = None self.code = 0 # if “gtk2″ in wx.PlatformInfo: # html.SetStandardFonts() ret = None if mode == 'code': ret = html.SetPage(data) elif mode == 'url': ret = html.LoadPage(data) elif mode == 'frontcode': html.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnURLClick) ret = html.SetPage(data) if ret is True: self.Show() elif ret is False: self.code = -1 if ret == None: self.error = 'Invalid mode b' elif ret is False: self.error = 'Error loading page'
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About SuperDoodle', size=(420, 380)) html = wx.html.HtmlWindow(self, -1) html.SetPage(self.text) button = wx.Button(self, wx.ID_OK, "Okay") # constraints for the html window lc = wx.LayoutConstraints() lc.top.SameAs(self, wx.Top, 5) lc.left.SameAs(self, wx.Left, 5) lc.bottom.SameAs(button, wx.Top, 5) lc.right.SameAs(self, wx.Right, 5) html.SetConstraints(lc) # constraints for the button lc = wx.LayoutConstraints() lc.bottom.SameAs(self, wx.Bottom, 5) lc.centreX.SameAs(self, wx.CentreX) lc.width.AsIs() lc.height.AsIs() button.SetConstraints(lc) self.SetAutoLayout(True) self.Layout() self.CentreOnParent(wx.BOTH)
def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(900,1000)) html = wxHTML(self) html.SetPage(myHTML)
def __init__(self, parent): super().__init__(parent=parent) self.parent = parent text = """ <html><body bgcolor="#F78181"><center> <table bgcolor="#FBFBEF" width="100%" cellspacing="0" cellpadding="0" border="1"> <tr><td align="center"><h1>Rubrica v3.0</h1></td></tr></table></center> <p><b>Rubrica</b> is a simple phone-book realized with:<br> <b>- wxPython 4.0</b> for Graphics<br> <b>- Sqlite</b> for database structure<br> <b>- SQLAlchemy</b> for Object Relation Mapping<br> I've tried to use a Model-View-Controller pattern-like.<br> web-site: <b>www.bancaldo.wordpress.com</b><br> last revision: may 17, 2015</p></body></html> """ html = wx.html.HtmlWindow(self) html.SetPage(text) self.btn_quit = GenBitmapTextButton(self, wx.ID_ANY, wx.Bitmap("%sexit.png" % IMG_PATH), 'Exit'.rjust(20), (350, 150)) self.btn_quit.SetBezelWidth(1) self.btn_quit.SetBackgroundColour(BTN_BG) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) sizer.Add(self.btn_quit, 0, wx.ALIGN_CENTER | wx.EXPAND, 5) self.SetSizer(sizer)
def __init__(self, parent=None): self.title = "About Rafiki (Beta)" wx.Dialog.__init__(self, wx.GetApp().TopWindow, id=wx.ID_ANY, title="About") html = wxHTML(self) html.SetPage(""" <h2>Rafiki Pre-Alpha</h2> <p> Rafiki is a program used to repeat certain (complicated) tasks. Typically these tasks involve using the mouse and keyboard. <br><br> Rafiki is programmable, which means you can design your own logic and steps that Rafiki will follow, based upon certain input.<br><br> Rafiki is also Open Source, released under the wxWindows licence.</p> <p>Created by Jarl <i>"slacky"</i> Holta.</p> <p><b>Requirements:</h3><br /></p> - <b><a href="http://www.python.org">Python 2.7</a></b><br> - <b><a href="http://www.wxpython.org">wxPython 2.8</a></b><br /> - <b><a href="http://pypi.python.org/pypi/Pillow/"> Python Imaging Library (pillow or PIL)</a></b> """) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, -1, flag=wx.EXPAND|wx.ALL, border=2) self.SetSizer(sizer) self.SetSize((550,300)) self.CentreOnParent(wx.BOTH)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About the ShowMeDo Image Viewer...', size=ABOUT_DIALOG_SIZE) html = wx.html.HtmlWindow(self) html.SetPage(self.text) # If a button has an ID of wx.ID_OK it will automatically close a wx.Dialog when pressed # create a 'button' object from wx.Button, give it the ID wx.ID_OK and text 'Okay' button = wx.Button(self, wx.ID_OK, 'Okay') # Create a BoxSizer which grows in the vertical direction sizer = wx.BoxSizer(wx.VERTICAL) # Add the html window, tell it to take a 100% portion of the *available* area # and to EXPAND in ALL directions. Use a border of 5 pixels around ALL sides of the button sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) # Add the button, ask it to grow by 0% #sizer.Add(button, 0) # also ask the button to align in the centre (my UK spelling!), with a 5 pixel border # around all sides sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5) # Tell our Dialog to use this new Sizer self.SetSizer(sizer) # Tell our Dialog to calculate the size of its items. Good practice to always do this self.Layout()
def OnFileViewHTML(self, evt): # Get an instance of the html file handler, use it to save the # document to a StringIO stream, and then display the # resulting html text in a dialog with a HtmlWindow. handler = rt.RichTextHTMLHandler() handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY) handler.SetFontSizeMapping([7, 9, 11, 12, 14, 22, 100]) import cStringIO stream = cStringIO.StringIO() if not handler.SaveStream(self.rtc.GetBuffer(), stream): return import wx.html dlg = wx.Dialog(self, title="HTML", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) html = wx.html.HtmlWindow(dlg, size=(500, 400), style=wx.BORDER_SUNKEN) html.SetPage(stream.getvalue()) btn = wx.Button(dlg, wx.ID_CANCEL) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.ALL | wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL | wx.CENTER, 10) dlg.SetSizer(sizer) sizer.Fit(dlg) dlg.ShowModal() handler.DeleteTemporaryImages()
def __init__(self, parent=None): wx.Dialog.__init__(self, parent, -1, _('About wxGlade')) html = wx.html.HtmlWindow(self, -1, size=(480, 250)) html.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked) # it's recommended at least for GTK2 based wxPython if "gtk2" in wx.PlatformInfo: html.SetStandardFonts() bgcolor = misc.color_to_string(self.GetBackgroundColour()) icon_path = os.path.join(config.icons_path, 'wxglade_small.png') html.SetPage(self.text % (bgcolor, icon_path, config.version, config.py_version, config.wx_version)) ir = html.GetInternalRepresentation() ir.SetIndent(0, wx.html.HTML_INDENT_ALL) html.SetSize((ir.GetWidth(), ir.GetHeight())) szr = wx.BoxSizer(wx.VERTICAL) szr.Add(html, 0, wx.TOP | wx.ALIGN_CENTER, 10) szr.Add(wx.StaticLine(self, -1), 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) szr2 = wx.BoxSizer(wx.HORIZONTAL) btn = wx.Button(self, wx.ID_OK, _("OK")) btn.SetDefault() szr2.Add(btn) if wx.Platform == '__WXGTK__': extra_border = 5 # border around a default button else: extra_border = 0 szr.Add(szr2, 0, wx.ALL | wx.ALIGN_RIGHT, 20 + extra_border) self.SetAutoLayout(True) self.SetSizer(szr) szr.Fit(self) self.Layout() if parent: self.CenterOnParent() else: self.CenterOnScreen()
def UpdWindow(self): """sync display with text buffer""" html = self.html html.SetPage(self.text) self.dirty = 0 # scroll to the end (x, y) = html.GetVirtualSize() html.Scroll(0, y)
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title) html = wx.html.HtmlWindow(self) if "gtk2" in wx.PlatformInfo: html.SetStandardFonts() html.SetPage("Here is some <b>formatted</b> <i><u>text</u></i> " "loaded from a <font color=\"red\">string</font>.")
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About PResto', size=(400, 300)) html = wx.html.HtmlWindow(self) html.SetPage(self.text) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout()
def __init__(self, parent, sInitText): wx.Dialog.__init__(self, parent, -1, 'About NXP Zigbee License Installer') html = wx.html.HtmlWindow(self, -1, size=(320, -1)) html.SetPage(self.text % sInitText) btn = html.FindWindowById(wx.ID_OK) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25)) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, "About C2PDF", size=(600, 400)) html = wx.html.HtmlWindow(self) html.SetPage(self.text) button = wx.Button(self, wx.ID_OK, "Ok") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.SetSizer(sizer) self.Layout()
def __init__(self, parent, loadNumber, mathsQNumber, startTime): print "windowsUpdateDialog.py initiated" self.name = "Windows Update Dialog" self.type = 1 self.click = "" self.count = 0 self.rowCount = 0 self.startTime = startTime self.height = 220 self.loadNumber = loadNumber self.mathsQNumber = mathsQNumber self.dialogID = "500000" self.dialogTag = "WINDOWS_UPDATE" self.responseLogContent = globalTracker.RESPONSECODE.responseLogBuffer # self.utils=utils self.dict = {} # change the status of dialog from 0(uninitialized) to 1(initialized) # if not dialogMsgPojo_ == None and isinstance(dialogMsgPojo_, dialogMsgPojo): self.dict["message"] = "Important Updates are available" # self.getHMTLFOrNameValue(dialogMsgPojo_.getNameValuePairList()) # # self.text = self.text_1 + self.text_3 + self.text_2 # # wx.Frame.__init__(self, parent, -1, 'Important Updates are available') # wx.Frame.SetSize(self, (420, self.height)) wx.Dialog.__init__(self, parent, -1, 'Important Updates are available') globalTracker.math.changeStatusFromUntoInitialized( mathsQNumber, loadNumber) wx.Dialog.SetSize(self, (420, self.height)) html = wx.html.HtmlWindow(self) html.SetPage(text % self.dict) self.Layout() self.buttonY = wx.Button(self, wx.ID_YES, "Yes") self.buttonY.Bind(wx.EVT_BUTTON, self.OnClickRestartNow, self.buttonY) self.buttonN = wx.Button(self, wx.ID_YES, "No") self.buttonN.Bind(wx.EVT_BUTTON, self.OnPostpone, self.buttonN) self.buttonN.SetFocus() self.Bind(wx.EVT_CLOSE, self.onClose) vSizer = wx.BoxSizer(wx.VERTICAL) vSizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) hSizer = wx.BoxSizer(wx.HORIZONTAL) hSizer.Add(wx.StaticText(self), 1) hSizer.Add(self.buttonY, 0, wx.ALIGN_RIGHT | wx.ALL, 5) hSizer.Add(self.buttonN, 0, wx.ALIGN_RIGHT | wx.ALL, 5) vSizer.Add(hSizer, 0, wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, 5) self.SetBackgroundColour("White") self.SetSizer(vSizer) self.Layout()
def add_http_panel(self, url, name): # https://client.eveonline.com/launcherv3 # DIV.overview>ARTICLE.news html = wx.html.HtmlWindow(self.nb) try: # TODO: async load data = requests.get(url).text except Exception as e: data = "Couldn't get %s:\n%s" % (url, str(e)) html.SetPage(data) self.nb.AddPage(html, name)
def __init__(self, parent): wx.Dialog.__init__(self, parent, wx.ID_ANY, "About BrewFlasher") html = HtmlWindow(self, wx.ID_ANY, size=(420, -1)) if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo: html.SetStandardFonts() txt = self.text.format(self._get_bundle_dir(), __version__) html.SetPage(txt) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25)) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, u'关于FT课程编辑器', size=(440, 400)) html = wx.html.HtmlWindow(self) html.SetPage(self.text) button = wx.Button(self, wx.ID_OK, u"确定") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre()
def __init__(self, parent, raw_HTML): wx.Frame.__init__(self, parent, -1, "HTML Viewer", size=(800, 600)) # Open a new HtmlWindow that is capable of rendering such content html = wx.html.HtmlWindow(self) if "gtk2" in wx.PlatformInfo: html.SetStandardFonts() # Load the selected file in the viewer html.SetPage(raw_HTML)
def __init__(self, parent, loadNumber, mathsQNumber): print "===> abodeupdatedialog.py initiated" self.dialogID = "500004" self.dialogTag = "ADOBE_FLASH_PLAYER_UPDATE" self.name = "update Adobe Flash Player dialog" self.type = 2 AdobeUpdateDialog.allResponses = "" AdobeUpdateDialog.allResponseCode = "" self.loadNumber = loadNumber self.mathsQNumber = mathsQNumber # panel=wx.Panel(parent) # panel.SetBackgroundColour("Green") wx.Dialog.__init__(self, parent=parent, id=-1, name='Update Adobe Flash Player') wx.Dialog.SetSize(self, (502, 304)) wx.Dialog.SetBackgroundColour(self, "#3E3E3E") globalTracker.math.changeStatusFromUntoInitialized( mathsQNumber, loadNumber) html = wx.html.HtmlWindow(self) self.text = self.text.replace( "IMG_SRC", globalTracker.propertyVar.phase3images + 'adobe.png') html.SetPage(self.text) self.Layout() self.Bind(wx.EVT_CLOSE, self.onClose) self.buttonY = wx.Button(self, wx.ID_YES, "Yes") self.buttonY.Bind(wx.EVT_BUTTON, self.OnClickRestartNow, self.buttonY) btn_font = wx.Font(7, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Consolas') self.buttonY.SetBackgroundColour("#3E3E3E") self.buttonN = wx.Button(self, wx.ID_NO, "No") self.buttonN.Bind(wx.EVT_BUTTON, self.OnPostpone, self.buttonN) self.buttonN.SetBackgroundColour("#3E3E3E") self.buttonN.SetFocus() vSizer = wx.BoxSizer(wx.VERTICAL) vSizer.Add(html, 1, wx.EXPAND, 0) hSizer = wx.BoxSizer(wx.HORIZONTAL) hSizer.Add(wx.StaticText(self), 1) hSizer.Add(self.buttonY, 0, wx.ALIGN_RIGHT | wx.ALL, 5) hSizer.Add(self.buttonN, 0, wx.ALIGN_RIGHT | wx.ALL, 5) vSizer.Add(hSizer, 0, wx.EXPAND | wx.ALIGN_RIGHT, 0) self.Layout() vSizer.FitInside(self) self.SetSizer(vSizer) wx.Dialog.FitInside(self) wx.Dialog.Layout(self)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, u'关于 PMManager v1.0', style=wx.DEFAULT_DIALOG_STYLE) html = HtmlWin(self) html.SetPage(self.text) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 20, ir.GetHeight() + 5)) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH)
def _create_contents(self, parent): if parent.GetParent() is not None: title = parent.GetParent().GetTitle() else: title = "" # Set the title. self.title = "About %s" % title # Load the image to be displayed in the about box. image = self.image.create_image() path = self.image.absolute_path # The additional strings. additions = '<br />'.join(self.additions) # The width of a wx HTML window is fixed (and is given in the # constructor). We set it to the width of the image plus a fudge # factor! The height of the window depends on the content. width = image.GetWidth() + 80 html = wx.html.HtmlWindow(parent, -1, size=(width, -1)) # Get the version numbers. py_version = sys.version[0:sys.version.find("(")] wx_version = wx.VERSION_STRING # Get the text of the OK button. if self.ok_label is None: ok = "OK" else: ok = self.ok_label # Set the page contents. html.SetPage(_DIALOG_TEXT % (path, additions, py_version, wx_version, ok)) # Make the 'OK' button the default button. ok_button = parent.FindWindowById( wx.ID_OK) #html.Window.FindWindowById(wx.ID_OK) ok_button.SetDefault() # Set the height of the HTML window to match the height of the content. internal = html.GetInternalRepresentation() html.SetSize((-1, internal.GetHeight())) # Make the dialog client area big enough to display the HTML window. # We add a fudge factor to the height here, although I'm not sure why # it should be necessary, the HTML window should report its required # size!?! width, height = html.GetSize().Get() parent.SetClientSize((width, height + 10))
def __init__(self, parent): wx.Frame.__init__(self, parent, -1, "Usage and Help", size=(640,600), pos=(400,100)) html = wx.html.HtmlWindow(self) html.SetPage(self.text) panel = wx.Panel(self, -1) button = wx.Button(panel, wx.ID_OK, "Close") self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.EXPAND|wx.ALL, 5) sizer.Add(panel, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.SetSizer(sizer) self.Layout()
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About wxRemind', size=(550, 630)) html = wx.html.HtmlWindow(self) html.SetPage(self.text) html.SetBackgroundColour(fcolor) button = wx.Button(self, wx.ID_OK, "OK") button.SetDefault() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5) sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.SetSizer(sizer) self.SetBackgroundColour(fcolor) self.Layout()
def __init__(self, parent, card, htmlist): self.htmlist = htmlist self.card = card self.parent = parent wx.MDIChildFrame.__init__(self, parent, -1, card.get_unumber()) html = wx.html.HtmlWindow(self) if "gtk2" in wx.PlatformInfo: html.SetStandardFonts() html.SetPage(self.mkhtext()) self.Bind(wx.EVT_WINDOW_DESTROY, self.on_window_destroy) self.Bind(wx.EVT_CHAR, self.on_char) self.parent.Raise() self.Show()
def __init__(self, parent): wx.Panel.__init__(self, parent) html = HtmlWindow(self) vers = {} vers["version"] = VersionInfos.VERSION_STRING html.SetPage(text % vers) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(html, 1, wx.EXPAND, 0) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="Help", size=(500,400)) html = wxHTML(self) html.SetPage( '' "<h2>Quasar<br>Help</h2>" "<p>Thanks for trying out Quasar web browser, It's nothing big yet, but we can dream right?" "<p>Not much to be said about usage as it pretty self explanatory if you ever used a computer.</p>" "<p>I'll appreciate my browser being used in a any unix like OS to avoid a lot of problems due to the crappiness of windows</p>" '<p>Thank You</p>' "<p>Go to any site by typing in the address and pressing go.</p>" '<p>Thank\'s again for using my program!</p>' )
def __init__(self, parent, size=(400, 200)): wx.Dialog.__init__(self, parent, -1, u'关于 Web Publisher v1.1', size=size, style=wx.DEFAULT_DIALOG_STYLE) html = HtmlWin(self) html.SetPage(self.text) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 20, ir.GetHeight() + 5)) #html.SetSize( (400, 320) ) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH)
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title=title, size=(600, 600)) html = wx.html.HtmlWindow(self) (path, tried) = self.findDocs() if path: html.LoadFile(path) else: html.SetPage( "<b>Error: cannot find documentation at any of the following locations</b><br><br>" + tried) self.Show()
def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="About Quasar", size=(500,400)) html = wxHTML(self) html.SetPage( "<h2>Quasar</h2>" "<p>Thanks for trying out this web browser, It's nothing big yet, but we can dream right?" "Any way your probably wondering about where I got the name right? No well either way I'm going to tell you, I'm a high functioning Physicist.</p>" "<p><b>Do the Physics, Quantum Physics</b></p>" '<p>WxPython is the GUI back end that runs this program</p>' '<p>Python is the programing language of this program and browser is the functions of this program.</p>' '<p>It was all designed by myself, <Anthony `Phystro` Karoki/p>' '<p>You can see more of my work on my website <a href="http://thehackerrealm.blogspot.com">thehackerrealm.blogspot.com</a></p>' '<p>This software is free to use, but please give credit when credit is due(simply mention the parts you used and my name and your good)</p>' )
def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(400, 400)) html = HtmlWindow(self, -1, size=(400, 400)) html.SetPage( '' "<h2>Reminder Rules</h2>" "<p>This aplication allows the user to easily create repeating reminders, presented as " "a notification or a question. To create a reminder of either type, first create a 'policy'. " "A policy is a set of general rules the aplication uses for creating reminders. " "Once the aplication has a policy to work with it creates a list of pending reminders, " "sorted in ascending order by date. To edit a policy simply double click it in the policy list.</p>" "<p><b>by Victor Gallagher</h3></p>" )