Commit 0fcfa328 authored by Tom Pillot's avatar Tom Pillot
Browse files

Improve scoreboard style

parent 39938868
QListWidget {
color: rgba(255, 255, 255, 222);
background-color: rgb(63, 81, 181);
color: rgba(0, 0, 0, 222);
background-color: rgb(245, 245, 246);
font-size: 25pt;
font-family: "Arial";
}
QListWidget::item {
margin-top: 10px;
border-style: none;
border-bottom: 1px solid #3F51B5;
}
QScrollBar {
width:0px;
width: 0px;
}
\ No newline at end of file
......@@ -32,10 +32,10 @@ class ScoreWindow(ScoreWindowUi):
self.timer.start(1000)
if self.time_edit.time() == qtc.QTime(0, 0, 0, 0):
if self.time_is_red:
self.time_edit.setStyleSheet("color: black")
self.time_edit.setStyleSheet("color: rgba(255, 255, 255, 222)")
self.time_is_red = False
else:
self.time_edit.setStyleSheet("color: red")
self.time_edit.setStyleSheet("color: #D32F2F")
self.time_is_red = True
else:
self.update_gui()
......@@ -71,9 +71,8 @@ class ScoreWindow(ScoreWindowUi):
# Show a message
self.list_widget.insertItem(0, team.name + " a rejoint la partie.")
# Keep the points item so the points can be modified later easily
team.points_item = points_item
self.table_widget.resizeRowsToContents()
self.table_widget.resizeColumnsToContents()
def refresh_webcam(self):
# Read an image from the webcam and detect the tags it contains
......
......@@ -13,18 +13,27 @@ class ScoreWindowUi(qtw.QMainWindow):
widget = qtw.QWidget(self)
self.setCentralWidget(widget)
# Change background color
palette = qtg.QPalette()
palette.setColor(qtg.QPalette.Background, qtg.QColor("#E0E1E0"))
self.setPalette(palette)
self.time_edit = qtw.QTimeEdit()
self.time_edit.setFont(qtg.QFont("Arial", 100, qtg.QFont.Bold))
self.time_edit.setDisplayFormat("mm:ss")
self.time_edit.setAlignment(qtc.Qt.AlignCenter)
self.time_edit.setFixedHeight(200)
self.time_edit.setDisabled(True) # The time can't be modified or selected
with open("game/time_edit.qss", "r") as f:
self.time_edit.setStyleSheet(f.read())
# The time edit needs to be inside a widget so that we can set the style of the widget and
# later when the font color of the time edit is changed, the widget style remains the same
self.time_widget = qtw.QWidget()
self.time_widget.setLayout(qtw.QVBoxLayout())
self.time_widget.layout().addWidget(self.time_edit)
with open("game/time_widget.qss", "r") as f:
self.time_widget.setStyleSheet(f.read())
self.list_widget = qtw.QListWidget()
self.list_widget.setFont(qtg.QFont("Arial", 25))
self.list_widget.setDisabled(True)
with open("game/list_widget.qss", "r") as f:
......@@ -38,12 +47,15 @@ class ScoreWindowUi(qtw.QMainWindow):
self.table_widget.setHorizontalHeaderItem(self.NAME, qtw.QTableWidgetItem("Nom"))
self.table_widget.setHorizontalHeaderItem(self.POINTS, qtw.QTableWidgetItem("Points"))
self.table_widget.setFont(qtg.QFont("Arial", 40, qtg.QFont.Bold))
self.table_widget.setEditTriggers(qtw.QAbstractItemView.NoEditTriggers)
# Hide vertical headers and set height for the rows
self.table_widget.verticalHeader().setVisible(False)
self.table_widget.verticalHeader().setSectionResizeMode(qtw.QHeaderView.Fixed)
self.table_widget.verticalHeader().setDefaultSectionSize(75)
# Prevent user from selecting and modifying the cells
self.table_widget.setEditTriggers(qtw.QAbstractItemView.NoEditTriggers)
self.table_widget.setFocusPolicy(qtc.Qt.NoFocus)
self.table_widget.setSelectionMode(qtw.QAbstractItemView.NoSelection)
# self.table_widget.setShowGrid(False)
with open("game/table_widget.qss", "r") as f:
self.setStyleSheet(f.read())
......@@ -59,7 +71,7 @@ class ScoreWindowUi(qtw.QMainWindow):
hlayout.addLayout(vlayout1)
vlayout2 = qtw.QVBoxLayout()
vlayout2.addWidget(self.time_edit, alignment=qtc.Qt.AlignCenter)
vlayout2.addWidget(self.time_widget, alignment=qtc.Qt.AlignCenter)
vlayout2.addLayout(hlayout)
widget.setLayout(vlayout2)
......
......@@ -2,7 +2,8 @@ QHeaderView::section {
color: rgba(255, 255, 255, 222);
background-color: rgb(63, 81, 181);
padding: 4px;
font-size: 14pt;
font-size: 24pt;
font-family: "Arial";
border-style: none;
border-bottom: 1px solid #fffff8;
border-right: 1px solid #fffff8;
......@@ -16,7 +17,14 @@ QHeaderView::section:vertical {
border-left: 1px solid #fffff8;
}
QScrollBar {
width: 0px;
height: 0px;
}
QTableWidget {
font-size: 36pt;
font-family: "Arial";
color: rgba(0, 0, 0, 222);
background-color: rgb(245, 245, 246);
}
\ No newline at end of file
QTimeEdit {
color: #EEF4FF;
color: rgba(255, 255, 255, 222);
background-color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #028BC3, stop:1 #7B4FB7);
border-radius: 10px;
font-size: 100pt;
font-family: "Arial";
font-weight: bold;
}
QTimeEdit::up-button {width: 0}
QTimeEdit::up-button {
width: 0;
}
QTimeEdit::down-button {width: 0}
\ No newline at end of file
QTimeEdit::down-button {
width: 0;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment