代码拉取完成,页面将自动刷新
同步操作将从 FasterThanLight/automatic_clicker_New_UI 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import math
from PySide6.QtCore import QRectF, QLine
from PySide6.QtGui import QColor, QPen, QPainter
from PySide6.QtWidgets import QGraphicsScene
class QDMGraphicsScene(QGraphicsScene):
def __init__(self, parent=None):
super().__init__(parent)
# self.scene = scene
# settings
self.grid_size = 20
self.grid_square = 4
self._color_background = QColor('#2E2E2E') # Darker gray for background
self._color_light = QColor('#4F4F4F') # Slightly lighter gray
self._color_dark = QColor('#000000') # Slightly darker gray
# Create pens
self._pen_light = QPen(self._color_light)
self._pen_light.setWidth(1)
self._pen_dark = QPen(self._color_dark)
self._pen_dark.setWidth(2)
# Set background color
self.setBackgroundBrush(self._color_background)
def setScene(self, width: float, height: float):
self.setSceneRect(-width // 2, -height // 2, width, height)
def drawBackground(self, painter: QPainter, rect: QRectF) -> None:
super().drawBackground(painter, rect)
# create grid
left = int(math.floor(rect.left()))
right = int(math.floor(rect.right()))
top = int(math.floor(rect.top()))
bottom = int(math.floor(rect.bottom()))
# compute all lines
first_left = left - (left % self.grid_size)
first_top = top - (top % self.grid_size)
lines_light, lines_dark = [], []
for x in range(first_left, right, self.grid_size):
if x % (self.grid_size * self.grid_square) == 0:
lines_dark.append(QLine(x, top, x, bottom))
else:
lines_light.append(QLine(x, top, x, bottom))
for y in range(first_top, bottom, self.grid_size):
if y % (self.grid_size * self.grid_square) == 0:
lines_dark.append(QLine(left, y, right, y))
else:
lines_light.append(QLine(left, y, right, y))
# draw lines
painter.setPen(self._pen_light)
painter.drawLines(lines_light)
painter.setPen(self._pen_dark)
painter.drawLines(lines_dark)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。