-
Notifications
You must be signed in to change notification settings - Fork 2
/
penalty_ui.py
246 lines (238 loc) · 12.3 KB
/
penalty_ui.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'penalty.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import os
class Ui_Penalty(object):
def setupUi(self, Penalty):
Penalty.setObjectName("Penalty")
Penalty.resize(1359, 500)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Penalty)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.teamLeftButton = QtWidgets.QRadioButton(Penalty)
font = QtGui.QFont()
font.setPointSize(15)
self.teamLeftButton.setFont(font)
self.teamLeftButton.setObjectName("teamLeftButton")
self.horizontalLayout.addWidget(self.teamLeftButton)
self.teamRightButton = QtWidgets.QRadioButton(Penalty)
font = QtGui.QFont()
font.setPointSize(15)
self.teamRightButton.setFont(font)
self.teamRightButton.setObjectName("teamRightButton")
if(os.path.isfile("quadballlive_api/penalty_team.txt")):
penalty_team_tk = open("quadballlive_api/penalty_team.txt", "r").read()
if(penalty_team_tk == "a"):
self.teamLeftButton.setChecked(True)
self.teamRightButton.setChecked(False)
elif(penalty_team_tk == "b"):
self.teamLeftButton.setChecked(False)
self.teamRightButton.setChecked(True)
else:
self.teamLeftButton.setChecked(False)
self.teamRightButton.setChecked(False)
self.horizontalLayout.addWidget(self.teamRightButton)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.frame = QtWidgets.QFrame(Penalty)
font = QtGui.QFont()
font.setPointSize(15)
self.frame.setFont(font)
self.frame.setObjectName("frame")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.frame)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.blueButton = QtWidgets.QRadioButton(self.frame)
font = QtGui.QFont()
font.setPointSize(10)
self.blueButton.setFont(font)
self.blueButton.setObjectName("blueButton")
self.horizontalLayout_2.addWidget(self.blueButton)
self.yellowButton = QtWidgets.QRadioButton(self.frame)
font = QtGui.QFont()
font.setPointSize(10)
self.yellowButton.setFont(font)
self.yellowButton.setObjectName("yellowButton")
self.horizontalLayout_2.addWidget(self.yellowButton)
self.yellowejectionButton = QtWidgets.QRadioButton(self.frame)
font = QtGui.QFont()
font.setPointSize(10)
self.yellowejectionButton.setFont(font)
self.yellowejectionButton.setObjectName("yellowejectionButton")
self.horizontalLayout_2.addWidget(self.yellowejectionButton)
self.redButton = QtWidgets.QRadioButton(self.frame)
font = QtGui.QFont()
font.setPointSize(10)
self.redButton.setFont(font)
self.redButton.setObjectName("redButton")
self.horizontalLayout_2.addWidget(self.redButton)
self.ejectionButton = QtWidgets.QRadioButton(self.frame)
font = QtGui.QFont()
font.setPointSize(10)
self.ejectionButton.setFont(font)
self.ejectionButton.setObjectName("ejectionButton")
self.horizontalLayout_2.addWidget(self.ejectionButton)
if(os.path.isfile("quadballlive_api/penalty_card.txt")):
penalty_card_tk = open("quadballlive_api/penalty_card.txt", "r")
penalty_card = penalty_card_tk.read()
if(penalty_card == "blue"):
self.blueButton.setChecked(True)
self.yellowButton.setChecked(False)
self.yellowejectionButton.setChecked(False)
self.redButton.setChecked(False)
self.ejectionButton.setChecked(False)
elif(penalty_card == "yellow"):
self.blueButton.setChecked(False)
self.yellowButton.setChecked(True)
self.yellowejectionButton.setChecked(False)
self.redButton.setChecked(False)
self.ejectionButton.setChecked(False)
elif(penalty_card == "yellowejection"):
self.blueButton.setChecked(False)
self.yellowButton.setChecked(False)
self.yellowejectionButton.setChecked(True)
self.redButton.setChecked(False)
self.ejectionButton.setChecked(False)
elif(penalty_card == "red"):
self.blueButton.setChecked(False)
self.yellowButton.setChecked(False)
self.yellowejectionButton.setChecked(False)
self.redButton.setChecked(True)
self.ejectionButton.setChecked(False)
elif(penalty_card == "ejection"):
self.blueButton.setChecked(False)
self.yellowButton.setChecked(False)
self.yellowejectionButton.setChecked(False)
self.redButton.setChecked(False)
self.ejectionButton.setChecked(True)
else:
self.blueButton.setChecked(False)
self.yellowButton.setChecked(False)
self.yellowejectionButton.setChecked(False)
self.redButton.setChecked(False)
self.ejectionButton.setChecked(False)
self.horizontalLayout_4.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3.addWidget(self.frame)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.label = QtWidgets.QLabel(Penalty)
font = QtGui.QFont()
font.setPointSize(10)
self.label.setFont(font)
self.label.setObjectName("label")
self.horizontalLayout_5.addWidget(self.label)
self.input_number = QtWidgets.QLineEdit(Penalty)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.input_number.sizePolicy().hasHeightForWidth())
self.input_number.setSizePolicy(sizePolicy)
if(os.path.isfile("quadballlive_api/penalty_playernumber.txt")):
input_number_tk = open("quadballlive_api/penalty_playernumber.txt", "r")
self.input_number.setText(input_number_tk.read())
self.input_number.setObjectName("input_number")
self.horizontalLayout_5.addWidget(self.input_number)
self.label_2 = QtWidgets.QLabel(Penalty)
font = QtGui.QFont()
font.setPointSize(10)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.horizontalLayout_5.addWidget(self.label_2)
self.list_players = QtWidgets.QComboBox(Penalty)
self.list_players.setObjectName("list_players")
self.horizontalLayout_5.addWidget(self.list_players)
self.verticalLayout_2.addLayout(self.horizontalLayout_5)
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.input_number.textChanged.connect(self.NumberInputHandler)
if(os.path.isfile("quadballlive_api/penalty_playernumber.txt")):
self.list_players.setEnabled(False)
if(os.stat("quadballlive_api/penalty_playernumber.txt").st_size == 0):
self.list_players.setEnabled(True)
self.label_3 = QtWidgets.QLabel(Penalty)
font = QtGui.QFont()
font.setPointSize(10)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.horizontalLayout_6.addWidget(self.label_3)
self.input_reason = QtWidgets.QLineEdit(Penalty)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.input_reason.sizePolicy().hasHeightForWidth())
self.input_reason.setSizePolicy(sizePolicy)
self.input_reason.setObjectName("input_reason")
if(os.path.isfile("quadballlive_api/penalty_reason.txt")):
input_reason_tk = open("quadballlive_api/penalty_reason.txt", "r")
self.input_reason.setText(input_reason_tk.read())
self.horizontalLayout_6.addWidget(self.input_reason)
self.label_4 = QtWidgets.QLabel(Penalty)
font = QtGui.QFont()
font.setPointSize(10)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.horizontalLayout_6.addWidget(self.label_4)
self.list_reasons = QtWidgets.QComboBox(Penalty)
self.list_reasons.setObjectName("list_reasons")
self.horizontalLayout_6.addWidget(self.list_reasons)
self.input_reason.textChanged.connect(self.ReasonInputHandler)
if(os.path.isfile("quadballlive_api/penalty_reason.txt")):
self.list_reasons.setEnabled(False)
if(os.stat("quadballlive_api/penalty_reason.txt").st_size == 0):
self.list_reasons.setEnabled(True)
self.verticalLayout_2.addLayout(self.horizontalLayout_6)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem)
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_7.addItem(spacerItem1)
self.cancelButton = QtWidgets.QPushButton(Penalty)
self.cancelButton.setObjectName("cancelButton")
self.horizontalLayout_7.addWidget(self.cancelButton)
self.okButton = QtWidgets.QPushButton(Penalty)
self.okButton.setObjectName("okButton")
self.horizontalLayout_7.addWidget(self.okButton)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_7.addItem(spacerItem2)
self.verticalLayout_2.addLayout(self.horizontalLayout_7)
self.retranslateUi(Penalty)
self.cancelButton.clicked.connect(Penalty.accept)
self.okButton.clicked.connect(Penalty.ok)
self.teamLeftButton.clicked.connect(Penalty.team_chosen)
self.teamRightButton.clicked.connect(Penalty.team_chosen)
QtCore.QMetaObject.connectSlotsByName(Penalty)
def NumberInputHandler(self):
if(self.input_number.text() == ""):
self.list_players.setEnabled(True)
else:
self.list_players.setEnabled(False)
def ReasonInputHandler(self):
if(self.input_reason.text() == ""):
self.list_reasons.setEnabled(True)
else:
self.list_reasons.setEnabled(False)
def retranslateUi(self, Penalty):
_translate = QtCore.QCoreApplication.translate
Penalty.setWindowTitle(_translate("Penalty", "Penalty"))
self.teamLeftButton.setText(_translate("Penalty", "Team Left"))
self.teamRightButton.setText(_translate("Penalty", "Team Right"))
self.blueButton.setText(_translate("Penalty", "Blue Card"))
self.yellowButton.setText(_translate("Penalty", "Yellow Card"))
self.yellowejectionButton.setText(_translate("Penalty", "Yellow, Ejection"))
self.redButton.setText(_translate("Penalty", "Red Card"))
self.ejectionButton.setText(_translate("Penalty", "Ejection"))
self.label.setText(_translate("Penalty", "Player number:"))
self.label_2.setText(_translate("Penalty", "OR choose Player:"))
self.label_3.setText(_translate("Penalty", "Give reason:"))
self.label_4.setText(_translate("Penalty", "OR choose one:"))
self.cancelButton.setText(_translate("Penalty", "Cancel"))
self.okButton.setText(_translate("Penalty", "Ok"))