Example #1
0
def main():
    from tests.testapp import testapp
    app = testapp()
    f = wx.Frame(None)
    w = wx.webview.WebView(f)
    w.Bind(wx.webview.EVT_WEBVIEW_CONSOLE_MESSAGE, on_console_message)

    from gui.infobox.infoboxapp import init_host, set_hosted_content

    account = MockAccount()

    init_host(w)

    def do_set_content():
        for x in xrange(100):
            set_hosted_content(w, account)

    def on_load(e):
        if e.GetState() == wx.webview.WEBVIEW_LOAD_ONLOAD_HANDLED:
            pass
    w.Bind(wx.webview.EVT_WEBVIEW_LOAD, on_load)

    set_content_button = wx.Button(f, -1, 'set content')
    set_content_button.Bind(wx.EVT_BUTTON, lambda e: do_set_content())

    hsizer = wx.BoxSizer(wx.HORIZONTAL)
    hsizer.Add(set_content_button)

    f.Sizer = wx.BoxSizer(wx.VERTICAL)
    f.Sizer.AddMany([(hsizer, 0, wx.EXPAND), (w, 1, wx.EXPAND)])

    f.Show()

    app.MainLoop()
Example #2
0
def main():
    from tests.testapp import testapp
    app = testapp()
    f = wx.Frame(None)
    w = wx.webview.WebView(f)
    w.Bind(wx.webview.EVT_WEBVIEW_CONSOLE_MESSAGE, on_console_message)

    from gui.infobox.infoboxapp import init_host, set_hosted_content

    account = MockAccount()

    init_host(w)

    def do_set_content():
        for x in xrange(100):
            set_hosted_content(w, account)

    def on_load(e):
        if e.GetState() == wx.webview.WEBVIEW_LOAD_ONLOAD_HANDLED:
            pass

    w.Bind(wx.webview.EVT_WEBVIEW_LOAD, on_load)

    set_content_button = wx.Button(f, -1, 'set content')
    set_content_button.Bind(wx.EVT_BUTTON, lambda e: do_set_content())

    hsizer = wx.BoxSizer(wx.HORIZONTAL)
    hsizer.Add(set_content_button)

    f.Sizer = wx.BoxSizer(wx.VERTICAL)
    f.Sizer.AddMany([(hsizer, 0, wx.EXPAND), (w, 1, wx.EXPAND)])

    f.Show()

    app.MainLoop()
Example #3
0
        def infobox():
            from gui.toolbox import Monitor
            from gui.infobox.infobox import DEFAULT_INFOBOX_WIDTH
            from gui.infobox.infoboxapp import init_host, set_hosted_content

            f = wx.Frame(None)
            size = (DEFAULT_INFOBOX_WIDTH, Monitor.GetFromWindow(f).ClientArea.height * .75)
            f.SetClientSize(size)

            w = wx.webview.WebView(f)

            init_host(w)
            set_hosted_content(w, MockTwitterAccount(twitter))
            f.Show()