Background scrape/eject/refresh, PS1 PIC0 art polish, top-right logo, and updated screenshot
This commit is contained in:
+32
-17
@@ -937,25 +937,28 @@ def _make_pic0(title, description, esrb, QImage, QPainter, QPainterPath, QColor,
|
||||
QRectF, Qt, _save):
|
||||
W, H = 310, 180
|
||||
img = QImage(W, H, QImage.Format_ARGB32)
|
||||
img.fill(QColor(0, 0, 0, 0))
|
||||
|
||||
# Dark gradient backdrop.
|
||||
# Dark gradient backdrop clipped to a rounded card (transparent corners).
|
||||
grad = QLinearGradient(0, 0, 0, H)
|
||||
grad.setColorAt(0.0, QColor(38, 38, 40))
|
||||
grad.setColorAt(1.0, QColor(12, 12, 14))
|
||||
card = QPainterPath()
|
||||
card.addRoundedRect(QRectF(0, 0, W, H), 12, 12)
|
||||
|
||||
p = QPainter(img)
|
||||
p.setRenderHint(QPainter.Antialiasing, True)
|
||||
p.setRenderHint(QPainter.TextAntialiasing, True)
|
||||
p.fillRect(0, 0, W, H, grad)
|
||||
p.fillPath(card, grad)
|
||||
|
||||
# Rounded border.
|
||||
# Rounded card border.
|
||||
p.setPen(QPen(QColor(110, 110, 115), 1))
|
||||
p.setBrush(Qt.NoBrush)
|
||||
p.drawRoundedRect(QRectF(4, 4, W - 8, H - 8), 9, 9)
|
||||
p.drawPath(card)
|
||||
|
||||
# PlayStation button glyphs, top-right.
|
||||
_draw_ps_glyphs(p, W - 34, 12, 22, QColor(200, 200, 205), QRectF, QPointF,
|
||||
QPolygonF, QPen, Qt)
|
||||
_draw_ps_glyphs(p, W - 34, 12, 22, QRectF, QPointF, QPolygonF, QPen, Qt,
|
||||
QColor)
|
||||
|
||||
# Title (bold, upper-left). Shrink the font until the whole title fits, so
|
||||
# long names are shown in full instead of being cut with an ellipsis.
|
||||
@@ -977,6 +980,10 @@ def _make_pic0(title, description, esrb, QImage, QPainter, QPainterPath, QColor,
|
||||
p.drawText(QRectF(18, 16, title_width, 28), Qt.AlignLeft | Qt.AlignVCenter,
|
||||
title_text)
|
||||
|
||||
# Thin divider under the title (like the original PSN info board).
|
||||
p.setPen(QPen(QColor(255, 255, 255, 55), 1))
|
||||
p.drawLine(QPointF(18, 46), QPointF(W - 18, 46))
|
||||
|
||||
# Description (wrapped to at most 3 lines, last line elided).
|
||||
if description:
|
||||
f_desc = QFont("DejaVu Sans")
|
||||
@@ -985,7 +992,7 @@ def _make_pic0(title, description, esrb, QImage, QPainter, QPainterPath, QColor,
|
||||
p.setPen(QColor(215, 215, 215))
|
||||
fm = QFontMetrics(f_desc)
|
||||
lines = _wrap_elided(fm, description.strip(), W - 36, 3, Qt)
|
||||
y = 46
|
||||
y = 52
|
||||
for line in lines:
|
||||
p.drawText(QRectF(18, y, W - 36, 16), Qt.AlignLeft | Qt.AlignVCenter, line)
|
||||
y += 16
|
||||
@@ -1027,23 +1034,31 @@ def _wrap_elided(fm, text, width, max_lines, Qt):
|
||||
return lines[:max_lines]
|
||||
|
||||
|
||||
def _draw_ps_glyphs(p, x, y, size, color, QRectF, QPointF, QPolygonF, QPen, Qt):
|
||||
"""Draw the four PlayStation face-button glyphs in a 2x2 grid."""
|
||||
def _draw_ps_glyphs(p, x, y, size, QRectF, QPointF, QPolygonF, QPen, Qt, QColor):
|
||||
"""Draw the four PlayStation face-button glyphs in a 2x2 grid, using the
|
||||
official button colours (green triangle, red circle, blue cross, pink square)."""
|
||||
cell = size / 2.0
|
||||
pen = QPen(color, max(1.0, size / 14.0))
|
||||
pen.setCapStyle(Qt.RoundCap)
|
||||
pen.setJoinStyle(Qt.RoundJoin)
|
||||
p.setPen(pen)
|
||||
p.setBrush(Qt.NoBrush)
|
||||
# Triangle (top-left).
|
||||
|
||||
def _pen(color):
|
||||
pen = QPen(color, max(1.0, size / 14.0))
|
||||
pen.setCapStyle(Qt.RoundCap)
|
||||
pen.setJoinStyle(Qt.RoundJoin)
|
||||
return pen
|
||||
|
||||
# Triangle (top-left, green).
|
||||
p.setPen(_pen(QColor("#3F9B0F")))
|
||||
tri = QPolygonF([QPointF(x, y + cell), QPointF(x + cell, y), QPointF(x + cell, y + cell)])
|
||||
p.drawPolygon(tri)
|
||||
# Circle (top-right).
|
||||
# Circle (top-right, red).
|
||||
p.setPen(_pen(QColor("#DE1C18")))
|
||||
p.drawEllipse(QRectF(x + cell, y, cell, cell))
|
||||
# Cross (bottom-left).
|
||||
# Cross (bottom-left, blue).
|
||||
p.setPen(_pen(QColor("#287FC1")))
|
||||
p.drawLine(QPointF(x + 1, y + cell + 1), QPointF(x + cell - 1, y + size - 1))
|
||||
p.drawLine(QPointF(x + cell - 1, y + cell + 1), QPointF(x + 1, y + size - 1))
|
||||
# Square (bottom-right).
|
||||
# Square (bottom-right, pink).
|
||||
p.setPen(_pen(QColor("#C94E9B")))
|
||||
p.drawRect(QRectF(x + cell, y + cell, cell, cell))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user