=== modified file 'doc/pykhtml.dom.htm' --- doc/pykhtml.dom.htm 2007-03-15 01:46:43 +0000 +++ doc/pykhtml.dom.htm 2007-03-25 22:53:54 +0000 @@ -90,7 +90,7 @@

__getitem__(self, name)

Inherited from Element
Get the value of the attribute with the given name.

__iter__(self)

Inherited from Node
Iterate over child nodes.

__setitem__(self, name, value)

Inherited from Element
Set the value of the attribute with the given name.
-

action (property)

The method with which this form is to be submitted (GET, POST, etc).
+

action (property)

The action for this form (the page to which data is to be submited).

addEvent(self, eventName, func, capture=False)

Inherited from Node
This lets you listen for certain events as they occur on the current element. Only particularly useful when listening for load events reaaally.

attributes (read-only property)

Inherited from Element

childNodes (read-only property)

Inherited from Node
For those that can't live without JavaScript DOM-compatible method names.
@@ -104,6 +104,7 @@

id (property)

Inherited from Element
The ID of this element.

innerHTML (property)

Inherited from Element
The HTML markup inside of this element. Notice that this property is writable, so you can change the markup if need be.

isA(self, klass)

Inherited from Node
Syntactic sugar for isinstance.
+

method (property)

The method with which this form is to be submitted (GET, POST, etc).

originalTagName (read-only property)

Inherited from Element
Like tagName but this won't convert things to lower. Only really useful if you're dealing with XML, which probably isn't the case anyway!

removeEvent(self, eventName, func, capture=False)

Inherited from Node
Removes events that you've added with Element.addEvent.

reset(self)

Reset the data in the form.
=== modified file 'pykhtml/__init__.py' --- pykhtml/__init__.py 2007-03-15 01:46:43 +0000 +++ pykhtml/__init__.py 2007-03-25 22:53:54 +0000 @@ -90,16 +90,18 @@ def _startGraphicalApplication(): global application, dialog - kdecore.KCmdLineArgs.init(sys.argv[:1], "PyKHTML", "PyKHTML Library", "9.9") - application = kdecore.KApplication() - global _config - _config = _ConfigurationHandler() - # the widget that will host the KHTMLParts - dialog = _PyKHTMLDialog(None) - application.setMainWidget(dialog) - if debugWithGUI: - dialog.show() - #dialog.layout = qt.QVBoxLayout(dialog) + if not application: + kdecore.KCmdLineArgs.init(sys.argv[:1], "PyKHTML", "PyKHTML Library", "9.9") + application = kdecore.KApplication() + global _config + _config = _ConfigurationHandler() + # the widget that will host the KHTMLParts + if not dialog: + dialog = _PyKHTMLDialog(None) + application.setMainWidget(dialog) + if debugWithGUI: + dialog.show() + #dialog.layout = qt.QVBoxLayout(dialog) def excepthook(type, value, trace): """ Our exception hook that prints out the traceback, powers down the pykhtml engine, and then exits """ @@ -146,10 +148,10 @@ usingXvfb = False if _supressQtDebug: qt.qInstallMsgHandler(_displayQtDebug) - _startGraphicalApplication() initSuccessful = True if registerExceptionHandler: sys.excepthook = excepthook + _startGraphicalApplication() def startEventLoop(): """ Starts the PyKHTML event loop. PyKHTML works with an asynchronous callback mechanism -- a little like Twisted does. Calls to open a new webpage aren't synchronous, as with urllib, for example. """ @@ -158,8 +160,10 @@ def stopEventLoop(): """ Stop the event loop and hence exit the scraper """ + global dialog dialog.deleteLater() - application.quit() + dialog = 0 + application.exit(0) class _Timer(qt.QTimer): @@ -215,6 +219,8 @@ self._passReferenceToCallbacks = True def _openURLRequest(self, url, urlArgs): + # setURLArgs to pass on form data and stuff + self.part.browserExtension().setURLArgs(urlArgs) self.location = str(url.url()) def _setPassReferenceToCallbacks(self, b): === modified file 'pykhtml/dom.py' --- pykhtml/dom.py 2007-03-15 01:46:43 +0000 +++ pykhtml/dom.py 2007-03-25 22:53:54 +0000 @@ -236,7 +236,7 @@ return str(self._.method().string()) def _setMethod(self, method): self._.setMethod(DOMString(method)) - action = property(_getMethod, _setMethod, None, "The method with which this form is to be submitted (GET, POST, etc)") + method = property(_getMethod, _setMethod, None, "The method with which this form is to be submitted (GET, POST, etc)") def submit(self, callback): """ Submit the form to the page specified in the action. The callback given is like one you would pass to [[pykthml.Browser.load]] """ @@ -259,7 +259,7 @@ @property def form(self): """ Get the form element this input resides in """ - return Form(self._.form()) + return Form(self._.form(), self.browser) def _getName(self): return str(self._.name().string())