View Single Post
Old 07-04-2009, 05:08 PM   #1 (permalink)
ETbyrne
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Arrow Python to PHP Translation Needed

Ok I have this python code and I need it translated to PHP super fast before my mother in law dies...

Code:
#!/usr/bin/env python

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

class Application(QObject):

	def __init__(self):
		QObject.__init__(self)
		self.setObjectName('Application')

	class Console(QObject):
		
		def __init__(self):
			QObject.__init__(self)
			self.setObjectName('Console')
		
		@pyqtSignature('QString')
		def display(self,text):
			print text
		
		@pyqtSignature("")
		def fortune(self):
			print "fortune called"
			return 23 # XXX: does not work

	
if __name__ == '__main__':
	
	app = QApplication(sys.argv)
	
	web = QWebView()
	web.setWindowTitle('My Application')
	web.resize(800,600)
	web.setHtml(QString("<a href=\"#\" onclick=\"Console.display('wow!')\">Hello, World!</a>"))
	
	frame = web.page().mainFrame()
	frame.addToJavaScriptWindowObject('Applicaiton',Application())
	frame.addToJavaScriptWindowObject('Console',Application.Console())
	
	web.show()
	
	sys.exit(app.exec_())
Now get going this is a life and death situation!!!
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote