<font size="6"><b>I am currently trying to run:</b></font><br><br><span style="font-family: courier new,monospace;">#!/usr/bin/env python</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># by patx | driver rowinggolfer </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># version fawn | GNU GPL v3</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># <a href="http://patx44.appspot.com/fastpatx">patx44.appspot.com/fastpatx</a></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># other helpers: azazel, trsh, </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># and people from #pyqt on freenode.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">import sys</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">import subprocess</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">import time</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">from buzhug import Base</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">from PyQt4 import QtCore, QtGui</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">from PyQt4 import QtWebKit</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">class fastpatx(QtGui.QWidget):</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def bookmarkfun(self):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    bookurl = self.lineEdit.text</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    bookdb = Base(&#39;faves&#39;).create((&#39;url&#39;,str),mode=&#39;open&#39;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    bookdb.insert(url=bookurl)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    bookwn = QtGui.QMessageBox.question(self,&quot;fastPATX&quot;,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        &quot;The page has been marked.&quot;,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        QtGui.QMessageBox.Ok)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def viewSrc(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    html = self.browser.page().mainFrame().toHtml()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        dialog = QtGui.QDialog(self)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        text = QtGui.QPlainTextEdit(dialog)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        text.setPlainText(html)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        ok = QtGui.QPushButton(dialog)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        ok.setText(&#39;&amp;Ok&#39;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        ok.setDefault(True)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(ok, QtCore.SIGNAL(&#39;clicked()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">             dialog.accept)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        layout = QtGui.QVBoxLayout()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        layout.addWidget(text)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        layout.addWidget(ok)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        dialog.setLayout(layout)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        dialog.exec_()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def goHome(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.browser.setUrl(QtCore.QUrl(&quot;<a href="http://www.google.com">http://www.google.com</a>&quot;))    </span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    def setCurl(self,url):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.curl=url</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.urlString=url.toString()</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def GoLink(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.browser.load(self.curl)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.page=self.browser.page()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.page.setLinkDelegationPolicy(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        QtWebKit.QWebPage.DelegateAllLinks)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def linkClicked(self,url):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.setCurl(url)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.GoLink()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def loadStarted(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        print &quot;loading page...&quot;,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    def loadFinished(self,arg):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        print &quot;load finished...&quot;,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        if arg:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            print &quot;sucess&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            print &quot;failed&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.offerDownload()</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def offerDownload(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        result=QtGui.QMessageBox.question(self,&quot;Download File&quot;,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        &quot;download file &lt;br /&gt;%s&quot;%self.urlString,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        QtGui.QMessageBox.Yes,<a href="http://QtGui.QMessageBox.No">QtGui.QMessageBox.No</a>)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        if result == QtGui.QMessageBox.Yes:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            p=subprocess.Popen([&#39;wget&#39;,self.urlString])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.browser.setHtml(&quot;&quot;&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&lt;h2&gt;Downloading your file...&lt;/h2&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&lt;hr&gt;Powered by &lt;a href=&quot;<a href="http://patx44.appspot.com">http://patx44.appspot.com</a>&quot;&gt;fastPATX&lt;/a&gt;.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&quot;&quot;&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            time.sleep(2)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def lineEdited(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.setCurl(QtCore.QUrl(self.lineEdit.text()))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.GoLink()</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def updateLineEdit(self,url):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.setCurl(url)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.lineEdit.setText(self.curl.toString())</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    def __init__(self):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        QtGui.QWidget.__init__(self)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.setCurl(QtCore.QUrl(&quot;<a href="http://www.google.com">http://www.google.com</a>&quot;))</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.lineEdit = QtGui.QLineEdit()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.pushButton = QtGui.QPushButton(&#39;Go&#39;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.homeButton = QtGui.QPushButton(&#39;Home&#39;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    self.srcButton = QtGui.QPushButton(&#39;Source&#39;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    self.bookmark = QtGui.QPushButton(&#39;Bookmark&#39;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.browser = QtWebKit.QWebView()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        tab = QtGui.QGridLayout()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        tab.setSpacing(5)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        tab.addWidget(self.browser, 0, 0, 1, 5)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        tab.addWidget(self.lineEdit, 2, 0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        tab.addWidget(self.pushButton, 2, 1)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        tab.addWidget(self.homeButton, 2, 2)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    tab.addWidget(self.srcButton, 2, 3)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    tab.addWidget(self.bookmark, 2, 4)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.setLayout(tab)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.setWindowTitle(&#39;fastPATX&#39;)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(self.lineEdit, QtCore.SIGNAL(&#39;returnPressed()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.lineEdited)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(self.pushButton, QtCore.SIGNAL(&#39;clicked()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.lineEdited)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    self.connect(self.homeButton, QtCore.SIGNAL(&#39;clicked()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">         self.goHome)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    self.connect(self.srcButton, QtCore.SIGNAL(&#39;clicked()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">         self.viewSrc)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    self.connect(self.bookmark, QtCore.SIGNAL(&#39;clicked()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">         self.bookmarkfun)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(self.browser, QtCore.SIGNAL(&#39;linkClicked (const QUrl&amp;)&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.linkClicked)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(self.browser, QtCore.SIGNAL(&#39;urlChanged (const QUrl&amp;)&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.updateLineEdit)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(self.browser, QtCore.SIGNAL(&#39;loadStarted ()&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.loadStarted)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.connect(self.browser, QtCore.SIGNAL(&#39;loadFinished (bool)&#39;),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.loadFinished)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.GoLink()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">           </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">app = QtGui.QApplication(sys.argv)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">win = fastpatx()</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">win.show()</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys.exit(app.exec_())</span><br clear="all"><br><font size="6"><b>I get the error:<br><br></b></font><span style="font-family: courier new,monospace;">  File &quot;fastpatx-fawn-alpha.py&quot;, line 21, in bookmarkfun</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    bookdb.insert(url=bookurl)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  File &quot;/usr/local/lib/python2.6/dist-packages/buzhug/buzhug.py&quot;, line 515, in insert</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    self._validate(k,v)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  File &quot;/usr/local/lib/python2.6/dist-packages/buzhug/buzhug.py&quot;, line 978, in _validate</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    %(k,self.fields[k],v,v.__class__)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">TypeError: Bad type for url : expected &lt;type &#39;str&#39;&gt;, got &lt;built-in method text of QLineEdit object at 0xa114cac&gt; &lt;type &#39;builtin_function_or_method&#39;&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">load finished... sucess</span><br><br><font size="6">What am I doing wrong? Please help!</font><br><br>-- <br>patx, python gui<br>