=== modified file 'doc/pykhtml.htm'
--- doc/pykhtml.htm 2007-07-14 19:27:31 +0000
+++ doc/pykhtml.htm 2007-07-15 13:30:27 +0000
@@ -17,7 +17,7 @@
A Browser is the main class you use to navigate around and visit different pages. Have a look at Browser.load and Browser.document to access basic use.
-Get a reference to the document (see
dom.Document) for the currently loaded page. It contains all the tasty methods for walking the DOM tree like getElementById / getElementsByTagName, and methods for browsing to other linked pages.
+Get a reference to the document (see
dom.Document) for the currently loaded page. It contains all the tasty methods for walking the DOM tree like getElementById/getElementsByTagName, and methods for browsing to other linked pages.
Evaluate a piece of JavaScript. The 'this' parameter, if specified, of type dom.Node, is the DOM node to be used when the javascript refers to 'this'. The return type should be casted to the appropriate Python type. If not, it will be a Qt QVariant.
Load a webpage in the browser. It takes as parameters the URI of the page to load, and a callable object to call when the page has loaded. This callback will be given the browser object as a reference unless you set Browser.referencelessCallbacks to True.
Browse to a new location. You probably don't want to set this directly as you'll receive no notification when the page has loaded. Have a look at
Browser.load instead.
=== modified file 'pykhtml/__init__.py'
--- pykhtml/__init__.py 2007-07-14 19:27:31 +0000
+++ pykhtml/__init__.py 2007-07-15 13:30:27 +0000
@@ -362,6 +362,15 @@
self.onNextLoad = callback
self.location = uri
+ def _setOnNextLoad(self, callback):
+ if self.loadFunction:
+ self.disconnect(self.part, qt.SIGNAL("docCreated()"), self._slotDocCreated)
+ self.loadFunction = callback
+ self.connect(self.part, qt.SIGNAL("docCreated()"), self._slotDocCreated)
+ def _getOnNextLoad(self):
+ return self.loadFunction
+ onNextLoad = property(_getOnNextLoad, _setOnNextLoad, None, "If you're going to do something that will inadvertently cause PyKHTML to browse to a new page and you want a function to be called when the page is loaded, set onNextLoad to the function")
+
def eval(self, script, this=None):
""" Evaluate a piece of JavaScript. The 'this' parameter, if specified, of type dom.Node, is the DOM node to be used when the javascript refers to 'this'. The return type should be casted to the appropriate Python type. If not, it will be a Qt QVariant. """
if this is None:
@@ -372,15 +381,6 @@
#print value.type()
return _variantToPython(value)
- def _setOnNextLoad(self, callback):
- if self.loadFunction:
- self.disconnect(self.part, qt.SIGNAL("docCreated()"), self._slotDocCreated)
- self.loadFunction = callback
- self.connect(self.part, qt.SIGNAL("docCreated()"), self._slotDocCreated)
- def _getOnNextLoad(self):
- return self.loadFunction
- onNextLoad = property(_getOnNextLoad, _setOnNextLoad, None, "If you're going to do something that will inadvertently cause PyKHTML to browse to a new page and you want a function to be called when the page is loaded, set onNextLoad to the function")
-
def _installJavaScriptOverrides(self):
""" Passing of alert(...) and prompt(...) back to Python """
# overwrite alert/prompt so that they fire events
@@ -486,16 +486,14 @@
@property
def source(self):
- #print [x for x in dir(self.part) if x.lower().count("source") or x.lower().count("doc")]
return str(self.part.documentSource())
@property
def document(self):
- """ Get a reference to the document (see [[dom.Document]]) for the currently loaded page. It contains all the tasty methods for walking the DOM tree like getElementById / getElementsByTagName, and methods for browsing to other linked pages. """
+ """ Get a reference to the document (see [[dom.Document]]) for the currently loaded page. It contains all the tasty methods for walking the DOM tree like getElementById/getElementsByTagName, and methods for browsing to other linked pages. """
return dom.Document(self.part.htmlDocument(), self)
-
+
def _null(*args):
- # null func
pass
=== modified file 'todo.txt'
--- todo.txt 2007-05-21 15:09:20 +0000
+++ todo.txt 2007-07-15 13:30:27 +0000
@@ -2,7 +2,7 @@
* PyKHTML Todo List *
**********************
- + Redirect alert(), prompt(), and confirm() to Python -- without the luxury of calling into KJS
+ + More extensive use has made it clear that cancelling is important in real life examples. I think onNextLoad has to be updated accordingly so that it can accept either a URL as it has so far or a simple struct of the form (successCallback, timeLimit, timeoutCallback)
+ Tutorials
+ More unit tests: KWallet/cookies and 'the rest'
+ Inheritance diagrams in the documentation (JS based?)