Skip to content

Commit

Permalink
feat: color in the system
Browse files Browse the repository at this point in the history
  • Loading branch information
Yejining committed Feb 13, 2020
1 parent 8fb8533 commit 8bc0e2b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions gui/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setupUi(self, GameWindow):
GameWindow.resize(2057, 1255)
self.centralwidget = QtWidgets.QWidget(GameWindow)
self.centralwidget.setAutoFillBackground(False)
self.centralwidget.setStyleSheet("")
self.centralwidget.setStyleSheet("background-color: rgb(0, 0, 0);")
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -316,12 +316,11 @@ def setupUi(self, GameWindow):
QtCore.QMetaObject.connectSlotsByName(GameWindow)

self.initializeClass()
self.setCustomFont()

def retranslateUi(self, GameWindow):
_translate = QtCore.QCoreApplication.translate
GameWindow.setWindowTitle(_translate("GameWindow", "MainWindow"))
self.label_pupil.setText(_translate("GameWindow", "<html><head/><body><p><span style=\" font-size:36pt; color:#ffffff;\">Pupil Check</span></p></body></html>"))
self.label_count.setText(_translate("GameWindow", "<html><head/><body><p><span style=\" font-size:72pt;\">5</span></p></body></html>"))

def initializeClass(self):
self.card = Card()
Expand Down Expand Up @@ -377,6 +376,19 @@ def initializeClass(self):
self.card.seq_layout = self.horizontalLayout
self.card.game_layout = self.gridLayout_game

def setCustomFont(self):
font = QtGui.QFont("Times", 60, QtGui.QFont.Bold)

self.label_count.setFont(font)
self.label_count.setStyleSheet("color: white;")
for label in self.card.sequence:
label.setFont(font)
label.setStyleSheet("color: white;")
for i in range(5):
for j in range(5):
self.card.game[i][j].setFont(font)
self.card.game[i][j].setStyleSheet("background-color: rgb(160, 160, 160); color: white;")


if __name__ == "__main__":
import sys
Expand Down
1 change: 0 additions & 1 deletion src/game/GameWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def start(self, status, page):
self.on_time()

def splash(self, status):
print("splash")
self.change_status(status)
self.change_page(self.page_splash)
self.splash_timer = SplashTimer(status, self.label_count)
Expand Down
3 changes: 2 additions & 1 deletion src/tobii/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def in_process(self):
red, green, blue = self.rgb_to_black(red, green, blue)
self.set_rgb(red, green, blue)
if self.is_black():
self.label.setStyleSheet("background-color: rgb(0, 0, 0); color: black;")
self.terminate()
else:
red, green, blue = self.rgb_to_white(red, green, blue)
Expand Down Expand Up @@ -74,7 +75,7 @@ def rgb_to_white(self, red, green, blue):
def set_rgb(self, red, green, blue):
if red < 0 or green < 0 or blue < 0: return
if red > 255 or green > 255 or blue > 255: return
stylesheet = "background-color: rgb(%d, %d, %d);" % (red, green, blue)
stylesheet = "background-color: rgb(%d, %d, %d); color: white;" % (red, green, blue)
self.label.setStyleSheet(stylesheet)

def is_black(self):
Expand Down

0 comments on commit 8bc0e2b

Please sign in to comment.