-
Notifications
You must be signed in to change notification settings - Fork 1
/
getspeaker.py
executable file
·94 lines (78 loc) · 2.09 KB
/
getspeaker.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
# -'''- coding: utf-8 -'''-
import sys
import subprocess
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtDeclarative import *
import PIL
import PIL.Image
import random
from time import sleep
import os
os.chdir(os.path.dirname(os.path.realpath(__file__)))
names = [
"Alain Mauer",
"alp",
"Andre Simon",
"AndreasZ",
"Lucco Giusti",
"Lukas Ruth",
"Christian Immler",
"Claus Brell",
"Claus Brell",
"Daniel Fett",
"dewomser",
"Florian Wesch",
"Florian Wesch",
"Friedemann Metzger",
"Gerhard Hepp",
"Gunter Pietzsch",
"Hans de Jong",
"Hans de Jong",
"Horatius Stream",
"Marco Mueller",
"Marco Mueller",
"Malte Schilling",
"Martina Gnaegy",
"Michael Stapelberg",
"Nico Maas",
"Nico Maas",
"Rainer Haffner und Tobias Wagner",
"Rainer Wieland",
"Tobias Blum",
"Till Maas"
]
random.shuffle(names)
class MyHandler(QObject):
def __init__(self, window, app, *args, **kwargs):
QObject.__init__(self, *args, **kwargs)
self.window = window
self.app = app
@Slot()
def shuffle(self):
if len(names) == 0:
name = "(Ende!)"
else:
name = names.pop()
window.rootContext().setContextProperty("latestWinnerName", name);
# Our main window
class MainWindow(QDeclarativeView):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setWindowTitle("Main Window")
# Renders 'view.qml'
self.setSource(QUrl.fromLocalFile('getspeaker.qml'))
# QML resizes to main window
self.setResizeMode(QDeclarativeView.SizeRootObjectToView)
if __name__ == '__main__':
# Create the Qt Application
app = QApplication(sys.argv)
# Create and show the main window
window = MainWindow()
window.setWindowFlags(Qt.FramelessWindowHint)
handler = MyHandler(window, app)
window.rootContext().setContextProperty("handler", handler)
window.showFullScreen()
# Run the main Qt loop
sys.exit(app.exec_())