#!/usr/bin/env python
# generated by wxGlade 0.4.1 on Tue Feb 13 08:17:19 2007

import wx

import  wx.html as  html
import  wx.lib.wxpTag

#from Main import opj

#----------------------------------------------------------------------

# This shows how to catch the OnLinkClicked non-event.  (It's a virtual
# method in the C++ code...)
class MyHtmlWindow(html.HtmlWindow):
    def __init__(self, parent, id):#, log):
        html.HtmlWindow.__init__(self, parent, id)

        if "gtk2" in wx.PlatformInfo:
            self.SetStandardFonts()
        #self.LoadPage('http://www.google.com')

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.Panel(self, -1)
        self.html = MyHtmlWindow(self.panel_1, -1)
        self.LoadURL = wx.Button(self.panel_1, -1, "Load URL")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnLoadURLButton, self.LoadURL)
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("frame_1")
        self.SetSize((600, 500))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        grid_sizer_1 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_1.Add(self.html, 1, wx.EXPAND, 0)
        grid_sizer_1.Add(self.LoadURL, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
        self.panel_1.SetAutoLayout(True)
        self.panel_1.SetSizer(grid_sizer_1)
        grid_sizer_1.Fit(self.panel_1)
        grid_sizer_1.SetSizeHints(self.panel_1)
        grid_sizer_1.AddGrowableRow(0)
        grid_sizer_1.AddGrowableCol(0)
        sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
        self.SetAutoLayout(True)
        self.SetSizer(sizer_1)
        self.Layout()
        # end wxGlade

    def OnLoadURLButton(self, event): # wxGlade: MyFrame.<event_handler>
        dlg = wx.TextEntryDialog(self, "Enter a URL")

        if dlg.ShowModal():
            url = dlg.GetValue()
            self.html.LoadPage(url)

        dlg.Destroy()

# end of class MyFrame


class MyApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        frame_1 = MyFrame(None, -1, "")
        self.SetTopWindow(frame_1)
        frame_1.Show()
        return 1

# end of class MyApp

if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()
