Version 3 of gnocl::webKit

Updated 2010-07-22 00:27:43 by jys

WJG (06/Jan/10) The Webkit [L1 ] opensource project provides powerful web browser engine which is easily wrapped to produce a Gnocl package. Here's a screenshot of it in action.

http://lh3.ggpht.com/_yaFgKvuZ36o/S0RuD-VzRoI/AAAAAAAAAMY/3jzsfq6ODvs/s800/Screenshot-Gnocl%20WebKit%20Demo.png

The following script shows how to get it running. As can be seen, rather than using a Tcl/Gnocl script to build the UI, this is now handled by loading a GtkBuilder XML description file create in Glade [L2 ].

#---------------
# test-webkit.tcl
#---------------
# Created by William J Giddings
# 06-Jan-10
#---------------
# Description:
#
#---------------

#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl
package require GnoclWebKit

set builderFile "browser.xml"
set builderFileObjects [gnocl::builder file $builderFile]
#---------------
# Register the widgets using their glade names.
#---------------
foreach item $builderFileObjects {
    foreach {gnocl builder} $item {}
    set $builder $gnocl
}

# create browser widget
set wk1 [gnocl::webKit -url "http://www.google.com"]

$hbox1 add $wk1 -fill {1 1} -expand 1

$window1 configure \
    -defaultHeight 400 \
    -defaultWidth 640 \
    -title "Gnocl WebKit Demo" \
    -onDestroy { exit }

$window1 show

gnocl::mainLoop

And, of course, the Glade builder file.

<?xml version="1.0"?>
<interface>
  <requires lib="gtk+" version="2.12"/>
  <object class="GtkWindow" id="window1">
    <property name="window_position">GTK_WIN_POS_CENTER</property>
    <child>
      <object class="GtkHBox" id="hbox1">
        <property name="visible">True</property>
        <child>
          <placeholder/>
        </child>
      </object>
    </child>
  </object>
</interface>

If anyone is interested in working on extending the functionality of the gnoclWebkit package then please let me know, I'd be happy to give whatever support is needed. The package is ready for download from the usual Sourceforge Gnocl repository [L3 ].

jys OMG, this is so fucking awesome! I'm really happy to finally see access to modern tools like WebKit in Tcl.