Exemple #1
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           'About SuperDoodle',
                           size=(400, 300))

        html = wx.html.HtmlWindow(self, -1)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        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.Layout()
        self.CentreOnParent(wx.BOTH)
Exemple #2
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        wx.CallAfter(html.LoadPage, "http://www.zhuanzhuan.com")
Exemple #3
0
 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()
Exemple #4
0
	def __init__(self, parent, id):
		wx.Frame.__init__(self, parent, id, size=(800,600))
		html = wx.html.HtmlWindow(self)
		if "gtk2" in wx.PlatformInfo:
			html.SetStandardFonts()
		
		html.LoadPage("http://localhost/index.html")
    def __init__(self, parent, title):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)

        wx.Frame.__init__(self, parent, -1, title, size=(1000, 600))

        html = wx.html.HtmlWindow(self)

        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

            self.textWidget = wx.TextCtrl(self,
                                          size=(985, 450),
                                          style=wx.TE_MULTILINE)
            self.textWidget.SetMaxLength(0)

            displayHTML_button = wx.Button(self,
                                           -1,
                                           "Display HTML",
                                           pos=(500, 500))

            self.Bind(wx.EVT_BUTTON,
                      self.display_HTML,
                      id=displayHTML_button.GetId())

        def display_HTML(self, e):
            raw_HTML = self.textWidget.GetValue()
            htmlViewerInstance = HtmlViewer(None, raw_HTML)
            htmlViewerInstance.Bind(wx.html.EVT_HTML_LINK_CLICKED,
                                    OnLinkClicked)
            htmlViewerInstance.Show()
Exemple #6
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600,400))
        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
            html.SetStandardFonts()

        wx.CallAfter(
            html.LoadPage, "http://wxwidgets.org/manuals/2.6.2/wx_wxbutton.html")
Exemple #7
0
 def __init__(self, parent, title):
     wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
     html = wx.html.HtmlWindow(self)
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     dlg = wx.TextEntryDialog(self, "Enter a URL", "HTMLWindow")
     if dlg.ShowModal() == wx.ID_OK:
         html.LoadPage(dlg.GetValue())
    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>.")
Exemple #9
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        wx.CallAfter(html.LoadPage,
                     "http://www.bitunion.org/thread-10185752-1-1.html")
Exemple #10
0
    def __init__(self, parent, title, haxedpage):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))

        thisHtml = html.HtmlWindow(self)

        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        thisHtml.SetPage(haxedpage)
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Html page", pos=(500,150), size=(650,400))
        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        wx.CallAfter(html.LoadPage, "current.html")
	def OnClose(self, event):
		self.Destroy()
Exemple #12
0
 def __init__(self, parent):
     wx.Frame.__init__(self,
                       parent,
                       wx.ID_ANY,
                       title=APP_TITLE + ' Documentation',
                       size=(800, 500))
     html = wxHTML(self)
     html.SetStandardFonts()
     about = 'res' + str(os.path.sep) + 'documentation.html'
     html.LoadPage(os.path.join(config.basedir, about))
Exemple #13
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
        self.CreateStatusBar()
        html = wx.html.HtmlWindow(self)

        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        html.SetRelatedFrame(self, self.GetTitle() + " -- %s")  #关联HTML到框架
        html.SetRelatedStatusBar(0)  #关联HTML到状态栏
        wx.CallAfter(html.LoadPage, "http://www.wxpython.org")
Exemple #14
0
 def __init__(self, parent):
     wx.Frame.__init__(self,
                       parent,
                       wx.ID_ANY,
                       title='About ' + APP_TITLE,
                       size=(400, 500))
     html = wxHTML(self)
     html.SetStandardFonts()
     about = 'res' + str(os.path.sep) + 'about.html'
     html.LoadPage(os.path.join(config.basedir, about))
Exemple #15
0
 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)
Exemple #16
0
    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, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
        self.CreateStatusBar()

        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        html.SetRelatedFrame(self, self.GetTitle() + " -- %s")
        html.SetRelatedStatusBar(0)

        wx.CallAfter(html.LoadPage,
                     "http://www.bitunion.org/thread-10185752-1-1.html")
Exemple #18
0
 def __init__(self, parent, title, userData=None):
     wx.Frame.__init__(self, parent, -1, title, size=(600, 500))
     self.parent = parent
     #self.CreateStatusBar()
     html = MyHtmlWin(self, parent)
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     html.SetRelatedFrame(self, self.GetTitle() + " -- %s")  #关联HTML到框架
     #html.SetRelatedStatusBar(0) #关联HTML到状态栏
     htmlStr = self.ParseData2Html(userData)
     wx.CallAfter(html.SetPage, htmlStr)
     self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
Exemple #19
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600,400))
        self.CreateStatusBar()
        
        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        html.SetRelatedFrame(self, self.GetTitle() + " -- %s")
        html.SetRelatedStatusBar(0)

        wx.CallAfter(
            html.LoadPage, "http://wxwidgets.org/manuals/2.6.2/wx_wxbutton.html")
Exemple #20
0
 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()
Exemple #21
0
 def __init__(self, parent):
     wx.Dialog.__init__(self, parent, -1, 'About the wxPython demo',)
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     py_version = sys.version.split()[0]
     html.SetPage(self.text % (wx.VERSION_STRING,
                               ", ".join(wx.PlatformInfo[1:]),
                               py_version
                               ))
     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)
Exemple #22
0
    def OnHelp(self, event):
        if self.HelpIsLive:
            dlg = self.HelpIsLive
        else:
            dlg = MyHelpDialog()

        html = wx.html.HtmlWindow(dlg,
                                  pos=(10, 10),
                                  size=(780, 430),
                                  style=wx.html.HW_SCROLLBAR_AUTO)
        html.SetStandardFonts()
        html.SetPage(exp_manpage.man_page)
        dlg.Show()
        self.HelpIsLive = dlg
        return
Exemple #23
0
    def OnAbout(self, event):
        about_dial = wx.Dialog(self, -1, "About", size=(300, 200))
        panel = wx.Panel(about_dial, -1)
        html = wx.html.HtmlWindow(panel)
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        html.SetStandardFonts()
        html.SetPage(
            "<center> <b> Drag&Drop </b>"
            "<br> <br>  Developper : Ludovic Lardies"
            "<br> <br>Contact : <a href=\"[email protected]\">[email protected]</a>"
            "</center>")

        main_sizer.Add(html, 1, wx.EXPAND, 10)
        panel.SetSizer(main_sizer)
        about_dial.ShowModal()
Exemple #24
0
 def __init__(self, parent, title, error_msg):
     wx.Dialog.__init__(
         self,
         parent,
         -1,
         'System Error',
     )
     html = wx.html.HtmlWindow(self, -1, size=(420, -1))
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     py_version = sys.version.split()[0]
     txt = self.text % (title, error_msg)
     html.SetPage(txt)
     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)
Exemple #25
0
    def __init__(self, event, page, title):

        displays = (wx.Display(i) for i in range(wx.Display.GetCount()))
        sizes = [display.GetGeometry().GetSize() for display in displays]
        displaySize = sizes[0].Get()
        xres, yres = displaySize[0] / 1.2, displaySize[1] / 1.2
        si = (xres / 6 * xres / yres, yres / 2)
        wx.Dialog.__init__(self,
                           None,
                           -1,
                           title,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           size=si)
        html = wx.html.HtmlWindow(self)
        self.SetMinSize((750, 400))
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        html.SetPage(page)
Exemple #26
0
    def __init__(self, parent, text):
        wx.Dialog.__init__(
            self,
            parent,
            -1,
            'GWiz Help',
        )
        html = wx.html.HtmlWindow(self, -1, size=(420, -1))
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        map = {
            'PY_VERSION': sys.version.split()[0],
            'WX_VERSION': wx.VERSION_STRING,
            'WX_PLATFORM': wx.PlatformInfo[1:]
        }

        #!!!KL modify this to scroll the text so that long help files will be
        #supported

        htmlCode = self.preamble + text + self.postamble

        t = Template(htmlCode)
        ##         print "htmlCode before:%s" % htmlCode
        try:
            htmlCode = t.safe_substitute(map)
        except TypeError:
            #!!!KL safe_substitue seems to throw an exception
            ##             print "exception TypeError"
            pass

##         print "htmlCode after:%s" % htmlCode

        html.SetPage(htmlCode)
        btn = html.FindWindowById(wx.ID_OK)
        ir = html.GetInternalRepresentation()
        html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
        self.SetClientSize(html.GetSize())
        self.CenterOnParent(wx.BOTH)
Exemple #27
0
    def __init__(self, parent=None):
        wx.Dialog.__init__(self, parent, -1, _('About wxGlade'))

        class HtmlWin(wx.html.HtmlWindow):
            def OnLinkClicked(self, linkinfo):
                href = linkinfo.GetHref()
                if href == 'show_license':
                    if config.license_file:
                        from wx.lib.dialogs import ScrolledMessageDialog
                        try:
                            license_file = codecs.open(
                                config.license_file, encoding='UTF-8')
                            dlg = ScrolledMessageDialog(
                                self,
                                license_file.read(),
                                _("wxGlade - License")
                                )
                            license_file.close()
                            dlg.ShowModal()
                            dlg.Destroy()
                        except IOError:
                            wx.MessageBox(
                                _('License file "LICENSE.txt" not found!\n'
                                  'You can get a copy at \n'
                                  'http://www.opensource.org/licenses/'
                                  'mit-license.php'),
                                _('Error'),
                                wx.OK | wx.CENTRE | wx.ICON_EXCLAMATION)
                    else:
                        wx.MessageBox(
                            _('License file "LICENSE.txt" not found!\n'
                              'You can get a copy at \n'
                              'http://www.opensource.org/licenses/'
                              'mit-license.php'),
                            _('Error'),
                            wx.OK | wx.CENTRE | wx.ICON_EXCLAMATION)
                elif href == 'show_credits':
                    if config.credits_file:
                        from wx.lib.dialogs import ScrolledMessageDialog
                        try:
                            credits_file = codecs.open(
                                config.credits_file, encoding='UTF-8')
                            dlg = ScrolledMessageDialog(
                                self,
                                credits_file.read(),
                                _("wxGlade - Credits")
                                )
                            credits_file.close()
                            dlg.ShowModal()
                            dlg.Destroy()
                        except IOError:
                            wx.MessageBox(
                                _('Credits file "CREDITS.txt" not found!'),
                                _('Error'),
                                wx.OK | wx.CENTRE | wx.ICON_EXCLAMATION)
                    else:
                        wx.MessageBox(
                            _('Credits file "CREDITS.txt" not found!'),
                            _('Error'),
                            wx.OK | wx.CENTRE | wx.ICON_EXCLAMATION)
                else:
                    import webbrowser
                    webbrowser.open(linkinfo.GetHref(), new=True)
        html = HtmlWin(self, -1, size=(400, 250))
        # 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()
Exemple #28
0
    def __init__(self, parent=None):
        wx.Dialog.__init__(self, parent, -1, _('About wxGlade'))

        class HtmlWin(wx.html.HtmlWindow):
            def OnLinkClicked(self, linkinfo):
                href = linkinfo.GetHref()
                if href == 'show_license':
                    from wx.lib.dialogs import ScrolledMessageDialog
                    try:
                        license = open(
                            os.path.join(common.wxglade_path, 'license.txt'))
                        dlg = ScrolledMessageDialog(self, license.read(),
                                                    _("wxGlade - License"))
                        license.close()
                        dlg.ShowModal()
                        dlg.Destroy()
                    except IOError:
                        wx.MessageBox(
                            _("Can't find the license!\n"
                              "You can get a copy at \n"
                              "http://www.opensource.org/licenses/"
                              "mit-license.php"), _("Error"),
                            wx.OK | wx.CENTRE | wx.ICON_EXCLAMATION)
                elif href == 'show_credits':
                    from wx.lib.dialogs import ScrolledMessageDialog
                    try:
                        credits = open(
                            os.path.join(common.wxglade_path, 'credits.txt'))
                        dlg = ScrolledMessageDialog(self, credits.read(),
                                                    _("wxGlade - Credits"))
                        credits.close()
                        dlg.ShowModal()
                        dlg.Destroy()
                    except IOError:
                        wx.MessageBox(_("Can't find the credits file!\n"),
                                      _("Oops!"),
                                      wx.OK | wx.CENTRE | wx.ICON_EXCLAMATION)
                else:
                    import webbrowser
                    webbrowser.open(linkinfo.GetHref(), new=True)

        html = HtmlWin(self, -1, size=(400, -1))
        if misc.check_wx_version(2, 5, 3):
            try:
                html.SetStandardFonts()
            except AttributeError:
                pass
        py_version = sys.version.split()[0]
        bgcolor = misc.color_to_string(self.GetBackgroundColour())
        icon_path = os.path.join(common.wxglade_path,
                                 'icons/wxglade_small.png')
        html.SetPage(
            self.text %
            (bgcolor, icon_path, common.version, py_version, 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()
Exemple #29
0
 def __init__(self, parent, title, filename, size):
     wx.Frame.__init__(self, parent, -1, title, size=size)
     html = wx.html.HtmlWindow(self)
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     html.LoadFile(filename)
Exemple #30
0
 def __init__(self, parent, title, txt):
     wx.Frame.__init__(self, parent, -1, title)
     html = wx.html.HtmlWindow(self)
     if "gtk2" in wx.PlatformInfo:
         html.SetStandardFonts()
     html.SetPage(txt)