forked from ghtdak/qtreactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtrial.py
executable file
·41 lines (27 loc) · 981 Bytes
/
gtrial.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
from PyQt4 import QtGui, QtScript
from PyQt4.QtCore import QTimer, SIGNAL, QEventLoop
import qt4reactor
app = QtGui.QApplication(sys.argv)
qt4reactor.install()
from twisted.internet import reactor, task
class doNothing(object):
def __init__(self):
self.count = 0
self.running=False
def buttonClick(self):
if not self.running:
from twisted.scripts import trial
trial.run()
def run():
t=doNothing()
engine = QtScript.QScriptEngine()
button = QtGui.QPushButton()
scriptButton = engine.newQObject(button)
engine.globalObject().setProperty("button", scriptButton)
app.connect(button, SIGNAL("clicked()"), t.buttonClick)
engine.evaluate("button.text = 'Do Twisted Gui Trial'")
engine.evaluate("button.styleSheet = 'font-style: italic'")
engine.evaluate("button.show()")
app.exec_()
print 'fell off the bottom?...'