This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpyqt_desktop_app.py
64 lines (43 loc) · 1.96 KB
/
pyqt_desktop_app.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os.path
import sys
from PyQt4 import QtGui,QtCore
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from common.Countly import Countly
class AppWindow(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.btnEvent = QtGui.QPushButton('Event Test', self)
self.btnEvent.setGeometry(QtCore.QRect(40, 30, 311, 21))
self.btnEvent.clicked.connect(self.handleClickEventButton)
self.textEdit = QtGui.QTextEdit(self)
self.textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit.setGeometry(QtCore.QRect(40, 70, 51, 21))
self.btnEventThread = QtGui.QPushButton('Event Thread Test', self)
self.btnEventThread.setGeometry(QtCore.QRect(90, 70, 261, 21))
self.btnEventThread.clicked.connect(self.handleClickEventThreadButton)
self.btnCrash = QtGui.QPushButton('Crash Test', self)
self.btnCrash.setGeometry(QtCore.QRect(40, 110, 311, 21))
self.btnCrash.clicked.connect(self.handleClickEventButton)
def handleClickEventButton(self):
countly.event("eventButtonClick", "true")
def handleClickEventThreadButton(self):
self.initCountly(int(self.textEdit.toPlainText()))
countly.event("eventThreadButtonClick", "true")
def handleCrashEventButton(self):
countly.event("crashButtonClick", "true")
def initCountly(self, thread_size):
global countly
countly = Countly("API_URL", "APP_KEY", thread_size, str(screen_resolution.width()) + "x" + str(screen_resolution.height()))
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
screen_resolution = app.desktop().screenGeometry()
window = AppWindow()
window.initCountly(0)
countly.event("start", "appstart")
width = 350
heigth = 150
window.resize(width, heigth)
window.move(300, 300)
window.setWindowTitle('Countly Simple PyQt App')
window.show()
sys.exit(app.exec_())