UI tweaking
parent
984a540d72
commit
d97a643627
|
@ -165,17 +165,20 @@ class MenuBoard(BoxBoard):
|
|||
def __init__(self, width, height, parent=None):
|
||||
super().__init__(width, height, parent)
|
||||
|
||||
self.margin = 10
|
||||
self.spacing = 20
|
||||
w_spacing = (self.width - 2*self.margin) /3
|
||||
|
||||
self.diff_display = menu_grap.DifficultyDisplayer(parent=self)
|
||||
self.diff_display.setX(5)
|
||||
self.diff_display.setX(self.margin)
|
||||
self.diff_display.setY(self.geometry().height()/2-self.diff_display.height/2)
|
||||
self.timer_display = menu_grap.TimerDisplayer(parent=self)
|
||||
self.timer_display.setParent(self)
|
||||
self.timer_display.setX(self.geometry().width()/2)
|
||||
self.timer_display.setX(self.margin + w_spacing + self.spacing)
|
||||
self.timer_display.setY(self.geometry().height()/2-self.timer_display.height/2)
|
||||
self.score_display = menu_grap.HighScoreDisplayer(parent=self)
|
||||
self.score_display.setX(self.geometry().width()-5)
|
||||
self.score_display.setY(self.geometry().height()/2)
|
||||
|
||||
self.score_display.setX(self.width - self.margin)
|
||||
self.score_display.setY(self.height - self.margin)
|
||||
|
||||
self.show_children(False)
|
||||
self.toggle_anim(True)
|
||||
|
|
|
@ -197,6 +197,9 @@ class HighScoreDisplayer(QGraphicsObject):
|
|||
def paint(self, painter, style, widget=None):
|
||||
painter.setPen(self.box_pen)
|
||||
painter.drawRect(self.boundingRect())
|
||||
if not self.selected:
|
||||
painter.fillRect(-self.icon_size/4, -self.icon_size/4,
|
||||
-self.icon_size/2, -self.icon_size/2, Qt.white)
|
||||
|
||||
def hoverEnterEvent(self, ev):
|
||||
if not self.selected:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont
|
||||
from PyQt5.QtWidgets import (QWidget, QLineEdit, QHBoxLayout, QGridLayout, QVBoxLayout,
|
||||
from PyQt5.QtWidgets import (QWidget, QLineEdit, QHBoxLayout, QGridLayout, QVBoxLayout, QSizePolicy,
|
||||
QPushButton, QLabel)
|
||||
from PyQt5.QtCore import (QAbstractAnimation, QObject, QPointF, Qt, QRectF, QLineF,
|
||||
QPropertyAnimation, pyqtProperty, pyqtSignal, QSizeF, QTimer)
|
||||
|
@ -24,6 +24,7 @@ class HighScoreBoard(QWidget):
|
|||
self.current_difficulty = hs.DIFFICULTIES[1]
|
||||
self.layout = QVBoxLayout(self)
|
||||
self.layout.setAlignment(Qt.AlignCenter)
|
||||
self.layout.addWidget(QLabel('Score Board', self, alignment=Qt.AlignCenter))
|
||||
self.diff_switch = DifficultySwitch()
|
||||
self.layout.addLayout(self.diff_switch)
|
||||
self.score_grid = ScoreGrid()
|
||||
|
@ -67,13 +68,16 @@ class DifficultySwitch(QHBoxLayout):
|
|||
self.max_length = max(len(diff) for diff in hs.DIFFICULTIES)
|
||||
self.full_text = ''.join(d.center(self.max_length) for d in circular_text[::-1])
|
||||
left_btn = QPushButton('<')
|
||||
left_btn.setFixedSize(20, 20)
|
||||
self.difficulty_display = QLabel('Normal')
|
||||
self.difficulty_display.setAlignment(Qt.AlignCenter)
|
||||
right_btn = QPushButton('>')
|
||||
right_btn.setFixedSize(20, 20)
|
||||
|
||||
self.addWidget(left_btn)
|
||||
self.addWidget(self.difficulty_display)
|
||||
self.addWidget(right_btn)
|
||||
self.layout().setStretch(1, 2)
|
||||
|
||||
self.shift_direction = FORWARD
|
||||
self.show_pos = self.max_length * len(hs.DIFFICULTIES)
|
||||
|
|
|
@ -183,8 +183,8 @@ class SudokuGrid(BaseSudokuItem):
|
|||
|
||||
def mousePressEvent(self, event):
|
||||
if not (self.freeze and self.drawn):
|
||||
w = (self.mouse_w + 0.5) * self.cell_width - 5
|
||||
h = (self.mouse_h + 0.5) * self.cell_height + 5
|
||||
w = (self.mouse_w + 0.5) * self.cell_width
|
||||
h = (self.mouse_h + 0.5) * self.cell_height
|
||||
|
||||
if not self.sudoku_grid.get_cell_status(self.mouse_h, self.mouse_w) == sdk.FIXED:
|
||||
self.buttonClicked.emit(w, h)
|
||||
|
|
Loading…
Reference in New Issue