Comments (25)
I do some more seperation of files and fix it a little bit.
Original comment by [email protected]
on 18 Apr 2009 at 2:12
from pywebkitgtk.
Using a current WebKit checkout, I get pointer warnings when building (log
attached),
and then an attribute error trying to use it:
Traceback (most recent call last):
File "/tmp/tmp.py", line 71, in get_html
print browser.get_html ()
File "/tmp/tmp.py", line 56, in get_html
text = ctx.EvaluateScript ("document.documentElement.innerHTML")
File "jswebkit.pyx", line 208, in jswebkit.JSContext.EvaluateScript (jswebkit.c:2494)
File "jswebkit.pyx", line 78, in jswebkit.makeException (jswebkit.c:960)
File "jswebkit.pyx", line 137, in jswebkit.JSObject.__getattr__ (jswebkit.c:1628)
AttributeError: name
Original comment by [email protected]
on 23 Apr 2009 at 2:31
Attachments:
from pywebkitgtk.
For pointer warnings. If you know how to fix :)
I think it is an issue with whether ur python is built with an ucs2 or ucs4.
I build my python from scratch with ucs2, but it important all extension build
same way.
Problem is it appears that the unicode in the webkit JS library uses 2 byte per
char.
While ur python is ucs4 so it uses 4 byte. Most python are supposed to ucs4 (i
screw
up when i build mine). Also to be honest unicode kindof confuses me. I will be
installing the lastest version of ubuntu soon and it will have python2.6
installed
compiled as ucs4. I will then be able to check.If there is a unicode expert in
the
house :)
To check you can do this
http://www.egenix.com/products/python/mxBase/
Python Unicode Version (UCS2 vs. UCS4)
On Unix it is important to know whether you need to download a distribution for
a
narrow Unicode build of Python (UCS2) or a wide version (UCS4).
python -c "import sys;print(sys.maxunicode<66000)and'UCS2'or'UCS4'"
If you get errors such as "unresolved symbol PyUnicodeUCS2_AsEncodedString" when
trying to load an extension from the distribution, you have likely installed an
archive for a wrong Unicode version.
Original comment by [email protected]
on 23 Apr 2009 at 3:48
from pywebkitgtk.
Ah, you're right. I'm on python2.6 with UCS4 (==UTF-32), but in JSStringRef.h
JSChar
is unsigned short (==UTF-16)...doh!
Original comment by [email protected]
on 24 Apr 2009 at 8:23
from pywebkitgtk.
Here's a patch that should fix the unicode issue. I've only tested with ucs4
build,
but should work with ucs2 (please test). It also fixes / adds support for some
other
things as well.
Unicode stuff:
* Encode python strings to utf8 and construct JSStringRef with
JSStringCreateWithUTF8CString.
* Retrieve python string from JSStringRef with PyUnicode_DecodeUTF16 with string
length parameter doubled for ucs4.
In JSObject class:
* Change __setattr__ to allow setting new JS attributes rather just updating
those
already in self.propertyNames.
* Implement __setitem__ fully.
* Implement the iter protocol (__next__/next, __iter__).
* Implement __len__.
In JSFunction class:
* Change __call__ to collect remaining positional arguments into args, so that a
regular parameter list can be used with functions, e.g., window.alert(None,
"window")
In testjswebkit.py:
* Catch ^C, add delete_event callback, change method signatures to match new
__call__
signature.
Hope it helps. :)
Original comment by [email protected]
on 25 Apr 2009 at 6:47
from pywebkitgtk.
Oops. Here's the correct patch.
Original comment by [email protected]
on 25 Apr 2009 at 7:01
Attachments:
from pywebkitgtk.
I would like to include this as part of pywebkitgtk but wondering if anyone has
tried
to integrate this into the pywebkitgtk build?
Thanks,
Original comment by [email protected]
on 25 Apr 2009 at 10:47
from pywebkitgtk.
Played a bit with integrating it, but don't know enough about autotools or
python
extensions. I can get it to generate jswebkit.c, and build it and link it with
webkit.so (readelf shows the symbols present in webkit.so), but I don't know
how to
initialize the JS* classes in webkitmodule.c, so in python I only see the
classes
from the webkit namespace (and no jswebkit namespace either).
Original comment by [email protected]
on 26 Apr 2009 at 9:14
from pywebkitgtk.
Took all of MonkeeSage's patches and applied them. Fixed it so that I think it
should
work with both ucs2 and ucs4 compilied python.
Also fixed setup.py so that cflags and lib flags are not hard wired, but use
pkg-config to get them
@MonkeeSage you do not want to integrate in webkit, notice how this is listed
as a
defect not an enhancement (I messed up when i first created this). Seriously I
think
it is better seperate.
Original comment by [email protected]
on 28 Apr 2009 at 1:26
Attachments:
from pywebkitgtk.
Has there been any progress on this great idea? Some kind of pythonic API - as
mentioned in the OP - would be of course fine.
BTW: Based on your `testjswebkit.py` I made some lines to query google for a
search
term and return the response, using a gtk window, which isn't shown, because I
don't
know another way to access webkit's JS API...
http://paste.pocoo.org/show/117554/
Original comment by [email protected]
on 16 May 2009 at 1:56
from pywebkitgtk.
@Seb Li:
I think it would require a complete re-write to make a pythonic API. The current
incarnation of jswebkit is basically an extremely thin wrapper around JSObjects
that
does some metaprogramming trickery to expose their properties in a class/type
agnostic way. (I'm not complaining! jpjanecek did a great job!) To get a really
pythonic API I think some code generation from API definitions would be
required to
expose all the classes/attributes/properties to python in their proper
heirachies.
Ps. You don't need a GTK window at all, just call gtk.gdk.threads_enter() and
use a
gtk.gdk.mainloop.
Original comment by [email protected]
on 20 May 2009 at 5:59
from pywebkitgtk.
@Seb Li
It is a hack :)
Problem is also that with JS you can create methods / properties at runtime
which you
can add to the JS object.
You could create a python class / object at runtime which would reflect all of
this,
but then it would be a little slower.
Original comment by [email protected]
on 1 Jun 2009 at 8:48
from pywebkitgtk.
Original comment by [email protected]
on 4 Jun 2009 at 11:20
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from pywebkitgtk.
it looks fine.
Will it merge into pywebkitgtk?
Original comment by [email protected]
on 24 Jun 2009 at 3:11
from pywebkitgtk.
How to EvaluateScript a javascript function automatic , And how to
EvaluateScript a
JQuery script
Original comment by [email protected]
on 3 Jul 2009 at 9:34
from pywebkitgtk.
@minyuanyang
it can use
webkit.WebView.execute_script()
Original comment by [email protected]
on 3 Jul 2009 at 9:53
from pywebkitgtk.
@jhuangjiahua
Thank you , I like your job , That`s so great , Is there any document you have
done .
Original comment by [email protected]
on 4 Jul 2009 at 3:34
from pywebkitgtk.
guys, if you're looking to do a little bit more than just execute javascript
snippets, i.e. gain full access to DOM elements, then the javascript execution
route
is a dead end.
you want to look at #13 -
http://code.google.com/p/pywebkitgtk/issues/detail?id=13
and use a patched version of webkit (see #13 for details) which provides _full_
glib
/ gobject bindings to the webkit DOM model.
also, if you _just_ want to execute javascript from python, then look at either
python-spidermonkey or pyv8 - http://code.google.com/p/pyv8.
python-spidermonkey works on 64-bit as well as 32-bit systems; pyv8 is
blindingly
quick but only compiles on 32-bit at the moment because google is still
experimenting
creating the 64-bit version of v8.
Original comment by [email protected]
on 11 Jul 2009 at 3:21
from pywebkitgtk.
Hi, janecek,
I make a simple deb package in my ppa
https://launchpad.net/~huangjiahua/+archive/ppa/
This package does not conform to the new Python policy.
it said:
Please consider updating. Here is some documentation:
http://wiki.debian.org/DebianPython/NewPolicy
http://wiki.debian.org/DebianPythonFAQ
Original comment by [email protected]
on 12 Jul 2009 at 8:47
from pywebkitgtk.
@jhuangjiahua
The module is just a "hack" until webkit gets real dom support.
Peeking inside your files you seem to have made it work with python 3.0.
Which i have no idea how to do :)
If you could just merge the changes you have made into a proper setup.
Then just add your name as a contributor (if you want :))
The module is free as in beer :)
Then just attach ur fixed file.
Right now I am no longer working with gtkwebkit.
The module I make was just an experimental module.
Thanks :)
Original comment by [email protected]
on 19 Jul 2009 at 11:02
from pywebkitgtk.
I've been playing with this code for a few days now, and already managed to
extend it
so that you can define callbacks in Python and attach them to DOM events. I'd
like to
continue this work until we achieve full two-way integration between the Python
and
JavaScript interpreters, that is, it should be possible to make arbitrary Python
objects accessible from JavaScript and vice versa.
Now, I don't think that this bug is a good place to continue work on this. I'd
like
to create a project in launchpad.net, upload my current code there, and keep
working
using Bzr as a versioning system. Also, since jpjanecek seems to have placed
his code
in the Public Domain, I'd like to put my contributions under the LGPL. Would
you guys
(especially jpjanecek and jhuangjiahua) object to that? Of course, I can
rewrite the
whole thing from scratch, but I'd rather collaborate with you guys if you are
interested, of course giving credit where it is due.
Also, my plan would be to keep this separate from, but well integrated with,
pywebkitgtk. I'd also be interested to know if Jan would prefer it some other
way.
Original comment by [email protected]
on 22 Oct 2009 at 11:12
from pywebkitgtk.
@DonSoto
Sounds good to me :)
The part that i contributed is free as in beer, do what you want :).
As i mentioned before I am no longer working on the patch, I just made it as a
proof
of concept.
Basically the patch is a "bridge" from python to js.
It is very simple to do this in python since it is a "dynamic" language.
To go the other way from javascript to python you just have to reverse the
process.
This should be pretty easy since javascript is also a dynamic language.
The only problem I can see is that when the page "reloads" the javascript
context
might have changed. Again there are solutions to it :)
Anyway it would be great you guys do this.
Original comment by [email protected]
on 30 Oct 2009 at 8:48
from pywebkitgtk.
http://en.wikipedia.org/wiki/Gratis_versus_Libre
Ok I am wrong :)
Free beer is not the same as free speech.
Just to clarify, my parts of the code in the patch are LGPL.
I am sorry for any confusion i cause people.
Next time i make stuff i will clearly state it is LGPL to make it clear.
Original comment by [email protected]
on 30 Oct 2009 at 9:19
from pywebkitgtk.
It has taken me some more time than I expected, but here it is:
https://launchpad.net/pyjavascriptcore
No releases yet, so you have to download the trunk branch using bzr if you want
to
run it. The current code improves on several aspects of John's original code. It
makes the behavior of wrapped JavaScript objects much more standard and allows
for
exporting Python objects to the JavaScript environment. This way, you can use
Python
callables as JavaScript callbacks, among other things. I also created a
regression
test suite, which should help with code quality.
I hope to be able to make a tarball release soon. I'll be defending my PhD next
week,
though, so I'll be quite busy until then, but afterwards, I'll definitely have
more
time to work on this.
Finally, my offer to Jan regarding a better integration between this code and
PyWebKitGTK remains open, of course. I think we can discuss it here, if there's
interest. Other comments about my work should be made using Launchpad's bug
tracker,
as they don't pertain to this project anymore and would only cause noise here.
Original comment by [email protected]
on 9 Nov 2009 at 2:34
from pywebkitgtk.
Thanks Don. I'm very much interested to in this project and the integration
between pywebkitgtk and pyjsc. Feel
free to raise any integration issues you find here or in the mailing list.
I'd keep this bug open for a short while. Until then we'll continue the
discussions in the mailing list.
Original comment by [email protected]
on 10 Nov 2009 at 11:30
- Added labels: Priority-Low, Type-Other
- Removed labels: Priority-Medium, Type-Enhancement
from pywebkitgtk.
Related Issues (20)
- Patch to allow setting global proxy uri. HOT 7
- jqueryui various failures with demo/browser.py HOT 1
- Support SMIL animation HOT 1
- websocket support HOT 3
- Split DOM bindings according to feature
- Binding for webkit_get_default_session HOT 1
- need 'editing_began'
- window.webkitNotifications is not an object. HOT 1
- no xmlhttprequest for file:// protocol? HOT 1
- undefined symbol: soup_request_http_get_type
- Browser crashes when accessing certain sites HOT 1
- GObject Binding
- Can't Build WebKit Source... Geoclue not found. HOT 1
- Configure fails on mingw32 for windows HOT 1
- Crashes with external fonts
- t
- How to specify a proxy?
- Inspector is missing features.
- which version is the best match of webkit? HOT 2
- fails loading scripts in RHEL. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pywebkitgtk.