ETO.Webview - get URL on Navigated Event

Hi Guys,

I’ve managed to subscribe python code to the Navigated Event in ETO.Webview

I’d like to read the URL in the event handler but can’t seem to find a way.

Any tips?


DK (1.7 KB)

import rhinoscriptsyntax as rs
import socket
from contextlib import closing
import scriptcontext
import Rhino
import Rhino.UI
import Eto as Eto
import Eto.Drawing as drawing
import Eto.Forms as forms
import time
import System
import urlparse

GO = False
address = ""

def Get_Address():
    with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
        s.bind(('', 0))
        s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        free_socket =  s.getsockname()[1]
    new_address = "" + str(free_socket) + "/"

def Launch_KUI(kui_address,width,height):
    my_webview = forms.WebView()
    my_webview.Url = System.Uri(kui_address)
    my_webview.Navigated += OnNavigated
    launcher = Eto.Forms.Form()
    launcher.Owner = Rhino.UI.RhinoEtoApp.MainWindow
    launcher.Title = page_title
    launcher.ClientSize = drawing.Size(width, height)
    launcher.Padding = drawing.Padding(2)
    launcher.Resizable = True
    launcher.Content = my_webview
    launcher.Closed += OnClosed

def OnClosed(*args):
    GO = False
    option = rs.MessageBox("""    The KaroroCAD contol window was closed

      Did you want to finish your session?

Press YES to close Rhino or NO to return to KaroroCAD""",324)
    if option == 6:
    if option == 7:
        GO = True
        Launch_KUI(address, width, height)

def OnNavigated(*agrs):
    rs.MessageBox("hello world")

page_title = title

if launch:
    GO = False
    address = Get_Address()
    GO = True
    Launch_KUI(address, width, height)