示例#1
0
window.add(web)
window.set_default_size( 250, 100)
window.set_title("PyWebkit with CSS 3D ala Python")

#create a class available to javascript, by inheriting from JavascriptClass
import cube

#get the context for the javascript environment:
frame = web.get_main_frame()
context =frame.get_global_context()
from cube import YPR_Updater
YPR_Updater.web = web

#now create our class base on that context:
import cube
javascript.export_module(web.get_env(), cube)

            
#and show it!
window.show_all()
from pyggi.javascript import jquery
from pyggi import gobject
from pyggi.webkit3_enums import *


def change( index, obj):
    _ = jquery._
    logging.error("CHANGE!!!!!!!!")
    if index%3 == 0:
        color = "#CC%d%d%d%d"%(index,index, index, index)
    elif index%3 == 1:
示例#2
0
文件: testit.py 项目: lmmx/pywebkit3
#which by the nature of it being a GTK callback,
#will be executed in the main thread
web.on_view_ready(set_bg, "red")
gobject.timeout_add(1000, set_bg)
#add our web view to the main window, and set properties
window.add(web)
window.set_default_size(250, 100)
window.set_title("PyWebkit with CSS 3D ala Python")

#get the context for the javascript environment:
frame = web.get_main_frame()
context = frame.get_global_context()
#create a class available to javascript, The YPR_Updater class
#is made available to javascript simply by inheriting from JavascriptClass
#Javascript code can create a python YPR_Updater object view the
#"cube.YPR_Updater.new_ method
from cube import YPR_Updater
YPR_Updater.web = web

#now create all classes under cube by exporting that module:
#We must provide an execution context (environment) which is done
#via the get_env() call.  This will also initialize jQuery python
#interface module if not already initialized
import cube
javascript.export_module(web.get_env(), cube)
jq = jquery.initialize(web.get_env(), web.on_view_ready)

#and show it!
window.show_all()
gtk3.main()
示例#3
0
文件: testit.py 项目: nak/pywebkit3
web.load_uri("file://%s/test.html" % os.path.abspath(os.path.dirname(__file__)))

# create the containing window
window = gtk3.GtkWindow(gtk3.GTK_WINDOW_TOPLEVEL)
# close this app on close of the window:
window.connect("delete-event", gtk3.main_quit)

# get the context for the javascript environment:
context = web.get_main_frame().get_global_context()

# when web view is read, mak a callback to set_bg,
# which by the nature of it being a GTK callback,
# will be executed in the main thread
web.on_view_ready(set_bg, context, "red")
# gobject.timeout_add(1000, set_bg)
# add our web view to the main window, and set properties
window.add(web)
window.set_default_size(250, 100)
window.set_title("PyWebkit with CSS 3D ala Python")

# now create all classes under cube by exporting that module:
# We must provide an execution context (environment) which is done
# via the get_env() call.  This will also initialize jQuery python
# interface module if not already initialized
javascript.export_module(context, cube)  # exports every JavascriptClass defn in module 'cube'


# and show it!
window.show_all()
gtk3.main()
示例#4
0
             os.path.abspath(os.path.dirname(__file__)))

# create the containing window
window = gtk3.GtkWindow(gtk3.GTK_WINDOW_TOPLEVEL)
# close this app on close of the window:
window.connect("delete-event", gtk3.main_quit)

# get the context for the javascript environment:
context = web.get_main_frame().get_global_context()

# when web view is read, mak a callback to set_bg,
# which by the nature of it being a GTK callback,
# will be executed in the main thread
web.on_view_ready(set_bg, context, "red")
#gobject.timeout_add(1000, set_bg)
# add our web view to the main window, and set properties
window.add(web)
window.set_default_size(250, 100)
window.set_title("PyWebkit with CSS 3D ala Python")

# now create all classes under cube by exporting that module:
# We must provide an execution context (environment) which is done
# via the get_env() call.  This will also initialize jQuery python
# interface module if not already initialized
javascript.export_module(
    context, cube)  # exports every JavascriptClass defn in module 'cube'

#and show it!
window.show_all()
gtk3.main()