Formatting with black
This commit is contained in:
parent
d1c2be7d1f
commit
0017add342
152
Tetris2000.py
152
Tetris2000.py
@ -35,11 +35,11 @@ class Grid(QtWidgets.QWidget):
|
|||||||
COLUMNS = consts.GRID_DEFAULT_COLUMNS
|
COLUMNS = consts.GRID_DEFAULT_COLUMNS
|
||||||
STARTING_POSITION = Point(
|
STARTING_POSITION = Point(
|
||||||
consts.GRID_DEFAULT_COLUMNS // 2,
|
consts.GRID_DEFAULT_COLUMNS // 2,
|
||||||
consts.GRID_DEFAULT_ROWS // 2 + consts.GRID_INVISIBLE_ROWS
|
consts.GRID_DEFAULT_ROWS // 2 + consts.GRID_INVISIBLE_ROWS,
|
||||||
)
|
)
|
||||||
GRIDLINE_COLOR = consts.GRID_GRIDLINE_COLOR
|
GRIDLINE_COLOR = consts.GRID_GRIDLINE_COLOR
|
||||||
HARD_DROP_MOVEMENT = consts.GRID_HARD_DROP_MOVEMENT
|
HARD_DROP_MOVEMENT = consts.GRID_HARD_DROP_MOVEMENT
|
||||||
SPOTLIGHT = Point(*consts.GRID_SPOTLIGHT )
|
SPOTLIGHT = Point(*consts.GRID_SPOTLIGHT)
|
||||||
|
|
||||||
def __init__(self, frames):
|
def __init__(self, frames):
|
||||||
super().__init__(frames)
|
super().__init__(frames)
|
||||||
@ -78,7 +78,9 @@ class Grid(QtWidgets.QWidget):
|
|||||||
painter.setPen(self.GRIDLINE_COLOR)
|
painter.setPen(self.GRIDLINE_COLOR)
|
||||||
for x in (self.left + i * Block.side for i in range(self.COLUMNS + 1)):
|
for x in (self.left + i * Block.side for i in range(self.COLUMNS + 1)):
|
||||||
painter.drawLine(x, self.grid_top, x, self.bottom)
|
painter.drawLine(x, self.grid_top, x, self.bottom)
|
||||||
for y in (j * Block.side for j in range(consts.GRID_INVISIBLE_ROWS, self.ROWS + 1)):
|
for y in (
|
||||||
|
j * Block.side for j in range(consts.GRID_INVISIBLE_ROWS, self.ROWS + 1)
|
||||||
|
):
|
||||||
painter.drawLine(self.left, y, self.right, y)
|
painter.drawLine(self.left, y, self.right, y)
|
||||||
|
|
||||||
def paint_piece(self, painter, piece):
|
def paint_piece(self, painter, piece):
|
||||||
@ -339,7 +341,9 @@ class Matrix(Grid):
|
|||||||
mino.shine(glowing=2, delay=consts.ANIMATION_DELAY)
|
mino.shine(glowing=2, delay=consts.ANIMATION_DELAY)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
if all(mino.coord.y() < consts.GRID_INVISIBLE_ROWS for mino in self.piece.minoes):
|
if all(
|
||||||
|
mino.coord.y() < consts.GRID_INVISIBLE_ROWS for mino in self.piece.minoes
|
||||||
|
):
|
||||||
self.frames.game_over()
|
self.frames.game_over()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -372,7 +376,6 @@ class Matrix(Grid):
|
|||||||
else:
|
else:
|
||||||
self.frames.new_piece()
|
self.frames.new_piece()
|
||||||
|
|
||||||
|
|
||||||
def eliminate_phase(self):
|
def eliminate_phase(self):
|
||||||
"""
|
"""
|
||||||
Any Minos marked for removal, i.e., on the hit list,
|
Any Minos marked for removal, i.e., on the hit list,
|
||||||
@ -543,6 +546,7 @@ class AspectRatioWidget(QtWidgets.QWidget):
|
|||||||
self.layout().setStretch(1, widget_stretch)
|
self.layout().setStretch(1, widget_stretch)
|
||||||
self.layout().setStretch(2, outer_stretch)
|
self.layout().setStretch(2, outer_stretch)
|
||||||
|
|
||||||
|
|
||||||
class Stats(QtWidgets.QWidget):
|
class Stats(QtWidgets.QWidget):
|
||||||
"""
|
"""
|
||||||
Show informations relevant to the game being played is displayed on-screen.
|
Show informations relevant to the game being played is displayed on-screen.
|
||||||
@ -639,11 +643,11 @@ class Stats(QtWidgets.QWidget):
|
|||||||
|
|
||||||
self.temporary_text.emit(text + "\n{:n}".format(score))
|
self.temporary_text.emit(text + "\n{:n}".format(score))
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Combo
|
# Combo
|
||||||
# Bonus for complete lines on each consecutive lock downs
|
# Bonus for complete lines on each consecutive lock downs
|
||||||
# if nb_complete_lines:
|
# if nb_complete_lines:
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
if nb_complete_lines:
|
if nb_complete_lines:
|
||||||
self.combo += 1
|
self.combo += 1
|
||||||
if self.combo > 0:
|
if self.combo > 0:
|
||||||
@ -660,13 +664,13 @@ class Stats(QtWidgets.QWidget):
|
|||||||
else:
|
else:
|
||||||
self.combo = -1
|
self.combo = -1
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Back-to_back sequence
|
# Back-to_back sequence
|
||||||
# Two major bonus actions, such as two Tetrises, performed without
|
# Two major bonus actions, such as two Tetrises, performed without
|
||||||
# a Single, Double, or Triple Line Clear occurring between them.
|
# a Single, Double, or Triple Line Clear occurring between them.
|
||||||
# Bonus for Tetrises, T-Spin Line Clears, and Mini T-Spin Line Clears
|
# Bonus for Tetrises, T-Spin Line Clears, and Mini T-Spin Line Clears
|
||||||
# performed consecutively in a B2B sequence.
|
# performed consecutively in a B2B sequence.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
if (t_spin and nb_complete_lines) or nb_complete_lines == 4:
|
if (t_spin and nb_complete_lines) or nb_complete_lines == 4:
|
||||||
if self.back_to_back_scores is not None:
|
if self.back_to_back_scores is not None:
|
||||||
self.back_to_back_scores.append(score // 2)
|
self.back_to_back_scores.append(score // 2)
|
||||||
@ -822,7 +826,13 @@ class Frames(QtWidgets.QWidget):
|
|||||||
self.hold_queue, y, x, self.hold_queue.ROWS + 1, self.hold_queue.COLUMNS + 2
|
self.hold_queue, y, x, self.hold_queue.ROWS + 1, self.hold_queue.COLUMNS + 2
|
||||||
)
|
)
|
||||||
x += self.hold_queue.COLUMNS + 2
|
x += self.hold_queue.COLUMNS + 2
|
||||||
grid.addWidget(self.matrix, y, x, self.matrix.ROWS + consts.GRID_INVISIBLE_ROWS, self.matrix.COLUMNS + 2)
|
grid.addWidget(
|
||||||
|
self.matrix,
|
||||||
|
y,
|
||||||
|
x,
|
||||||
|
self.matrix.ROWS + consts.GRID_INVISIBLE_ROWS,
|
||||||
|
self.matrix.COLUMNS + 2,
|
||||||
|
)
|
||||||
x += self.matrix.COLUMNS + 3
|
x += self.matrix.COLUMNS + 3
|
||||||
grid.addWidget(
|
grid.addWidget(
|
||||||
self.next_piece, y, x, self.next_piece.ROWS + 1, self.next_piece.COLUMNS + 2
|
self.next_piece, y, x, self.next_piece.ROWS + 1, self.next_piece.COLUMNS + 2
|
||||||
@ -844,7 +854,9 @@ class Frames(QtWidgets.QWidget):
|
|||||||
self.matrix.drop_signal.connect(self.stats.update_drop_score)
|
self.matrix.drop_signal.connect(self.stats.update_drop_score)
|
||||||
self.matrix.lock_signal.connect(self.stats.update_score)
|
self.matrix.lock_signal.connect(self.stats.update_score)
|
||||||
|
|
||||||
self.set_background(os.path.join(consts.BG_IMAGE_DIR, consts.START_BG_IMAGE_NAME))
|
self.set_background(
|
||||||
|
os.path.join(consts.BG_IMAGE_DIR, consts.START_BG_IMAGE_NAME)
|
||||||
|
)
|
||||||
|
|
||||||
self.apply_settings()
|
self.apply_settings()
|
||||||
|
|
||||||
@ -879,8 +891,10 @@ class Frames(QtWidgets.QWidget):
|
|||||||
self.matrix.spotlight = Matrix.SPOTLIGHT
|
self.matrix.spotlight = Matrix.SPOTLIGHT
|
||||||
|
|
||||||
for sfx in (
|
for sfx in (
|
||||||
self.matrix.rotate_sfx, self.matrix.wall_sfx,
|
self.matrix.rotate_sfx,
|
||||||
self.stats.line_clear_sfx, self.stats.tetris_sfx
|
self.matrix.wall_sfx,
|
||||||
|
self.stats.line_clear_sfx,
|
||||||
|
self.stats.tetris_sfx,
|
||||||
):
|
):
|
||||||
sfx.setVolume(settings[s.SOUND][s.SFX_VOLUME])
|
sfx.setVolume(settings[s.SOUND][s.SFX_VOLUME])
|
||||||
|
|
||||||
@ -904,21 +918,19 @@ class Frames(QtWidgets.QWidget):
|
|||||||
self.resized_bg_image = self.resized_bg_image.scaled(
|
self.resized_bg_image = self.resized_bg_image.scaled(
|
||||||
self.size(),
|
self.size(),
|
||||||
QtCore.Qt.KeepAspectRatioByExpanding,
|
QtCore.Qt.KeepAspectRatioByExpanding,
|
||||||
QtCore.Qt.SmoothTransformation
|
QtCore.Qt.SmoothTransformation,
|
||||||
)
|
)
|
||||||
self.resized_bg_image = self.resized_bg_image.copy(
|
self.resized_bg_image = self.resized_bg_image.copy(
|
||||||
(self.resized_bg_image.width() - self.width()) // 2,
|
(self.resized_bg_image.width() - self.width()) // 2,
|
||||||
(self.resized_bg_image.height() - self.height()) // 2,
|
(self.resized_bg_image.height() - self.height()) // 2,
|
||||||
self.width(),
|
self.width(),
|
||||||
self.height()
|
self.height(),
|
||||||
)
|
)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, event):
|
||||||
painter = QtGui.QPainter(self)
|
painter = QtGui.QPainter(self)
|
||||||
painter.drawPixmap(
|
painter.drawPixmap(self.rect(), self.resized_bg_image)
|
||||||
self.rect(),
|
|
||||||
self.resized_bg_image)
|
|
||||||
|
|
||||||
def new_game(self):
|
def new_game(self):
|
||||||
if self.playing:
|
if self.playing:
|
||||||
@ -1045,21 +1057,22 @@ class Frames(QtWidgets.QWidget):
|
|||||||
msgbox.setIcon(QtWidgets.QMessageBox.Information)
|
msgbox.setIcon(QtWidgets.QMessageBox.Information)
|
||||||
if self.stats.score_total == self.stats.high_score:
|
if self.stats.score_total == self.stats.high_score:
|
||||||
msgbox.setText(
|
msgbox.setText(
|
||||||
self.tr(
|
self.tr("Congratulations!\nYou have the high score: {}").format(
|
||||||
"Congratulations!\nYou have the high score: {}"
|
locale.format(
|
||||||
).format(
|
"%i", self.stats.high_score, grouping=True, monetary=True
|
||||||
|
)
|
||||||
locale.format("%i", self.stats.high_score, grouping=True, monetary=True)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
qsettings.setValue(self.tr("High score"), self.stats.high_score)
|
qsettings.setValue(self.tr("High score"), self.stats.high_score)
|
||||||
else:
|
else:
|
||||||
msgbox.setText(
|
msgbox.setText(
|
||||||
self.tr(
|
self.tr("Score: {}\nHigh score: {}").format(
|
||||||
"Score: {}\nHigh score: {}"
|
locale.format(
|
||||||
).format(
|
"%i", self.stats.score_total, grouping=True, monetary=True
|
||||||
locale.format("%i", self.stats.score_total, grouping=True, monetary=True),
|
),
|
||||||
locale.format("%i", self.stats.high_score, grouping=True, monetary=True)
|
locale.format(
|
||||||
|
"%i", self.stats.high_score, grouping=True, monetary=True
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
msgbox.setDetailedText(self.stats.text(full_stats=True))
|
msgbox.setDetailedText(self.stats.text(full_stats=True))
|
||||||
@ -1178,12 +1191,15 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||||||
parent.frames.music.setVolume
|
parent.frames.music.setVolume
|
||||||
)
|
)
|
||||||
self.groups[s.SOUND].widgets[s.MUSIC_VOLUME].sliderPressed.connect(
|
self.groups[s.SOUND].widgets[s.MUSIC_VOLUME].sliderPressed.connect(
|
||||||
parent.frames.music.play)
|
parent.frames.music.play
|
||||||
|
)
|
||||||
self.groups[s.SOUND].widgets[s.MUSIC_VOLUME].sliderReleased.connect(
|
self.groups[s.SOUND].widgets[s.MUSIC_VOLUME].sliderReleased.connect(
|
||||||
parent.frames.music.pause)
|
parent.frames.music.pause
|
||||||
|
)
|
||||||
|
|
||||||
self.groups[s.SOUND].widgets[s.SFX_VOLUME].sliderReleased.connect(
|
self.groups[s.SOUND].widgets[s.SFX_VOLUME].sliderReleased.connect(
|
||||||
parent.frames.stats.line_clear_sfx.play)
|
parent.frames.stats.line_clear_sfx.play
|
||||||
|
)
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
@ -1261,7 +1277,7 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
splash_screen.finish(self);
|
splash_screen.finish(self)
|
||||||
|
|
||||||
def set_locale(self):
|
def set_locale(self):
|
||||||
app = QtWidgets.QApplication.instance()
|
app = QtWidgets.QApplication.instance()
|
||||||
@ -1296,18 +1312,23 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
s.MOVE_LEFT,
|
s.MOVE_LEFT,
|
||||||
qsettings.value(s.KEYBOARD + "/" + s.MOVE_LEFT, consts.DEFAULT_MOVE_LEFT_KEY),
|
qsettings.value(
|
||||||
|
s.KEYBOARD + "/" + s.MOVE_LEFT,
|
||||||
|
consts.DEFAULT_MOVE_LEFT_KEY,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.MOVE_RIGHT,
|
s.MOVE_RIGHT,
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.KEYBOARD + "/" + s.MOVE_RIGHT, consts.DEFAULT_MOVE_RIGHT_KEY
|
s.KEYBOARD + "/" + s.MOVE_RIGHT,
|
||||||
|
consts.DEFAULT_MOVE_RIGHT_KEY,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.ROTATE_CLOCKWISE,
|
s.ROTATE_CLOCKWISE,
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.KEYBOARD + "/" + s.ROTATE_CLOCKWISE, consts.DEFAULT_ROTATE_CLOCKWISE_KEY
|
s.KEYBOARD + "/" + s.ROTATE_CLOCKWISE,
|
||||||
|
consts.DEFAULT_ROTATE_CLOCKWISE_KEY,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -1319,21 +1340,29 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.SOFT_DROP,
|
s.SOFT_DROP,
|
||||||
qsettings.value(s.KEYBOARD + "/" + s.SOFT_DROP, consts.DEFAULT_SOFT_DROP_KEY),
|
qsettings.value(
|
||||||
|
s.KEYBOARD + "/" + s.SOFT_DROP,
|
||||||
|
consts.DEFAULT_SOFT_DROP_KEY,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.HARD_DROP,
|
s.HARD_DROP,
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.KEYBOARD + "/" + s.HARD_DROP, consts.DEFAULT_HARD_DROP_KEY
|
s.KEYBOARD + "/" + s.HARD_DROP,
|
||||||
|
consts.DEFAULT_HARD_DROP_KEY,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.HOLD,
|
s.HOLD,
|
||||||
qsettings.value(s.KEYBOARD + "/" + s.HOLD, consts.DEFAULT_HOLD_KEY),
|
qsettings.value(
|
||||||
|
s.KEYBOARD + "/" + s.HOLD, consts.DEFAULT_HOLD_KEY
|
||||||
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.PAUSE,
|
s.PAUSE,
|
||||||
qsettings.value(s.KEYBOARD + "/" + s.PAUSE, consts.DEFAULT_PAUSE_KEY),
|
qsettings.value(
|
||||||
|
s.KEYBOARD + "/" + s.PAUSE, consts.DEFAULT_PAUSE_KEY
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
@ -1346,7 +1375,8 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
s.AUTO_SHIFT_DELAY,
|
s.AUTO_SHIFT_DELAY,
|
||||||
int(
|
int(
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.DELAYS + "/" + s.AUTO_SHIFT_DELAY, consts.DEFAULT_AUTO_SHIFT_DELAY
|
s.DELAYS + "/" + s.AUTO_SHIFT_DELAY,
|
||||||
|
consts.DEFAULT_AUTO_SHIFT_DELAY,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1354,7 +1384,8 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
s.AUTO_REPEAT_RATE,
|
s.AUTO_REPEAT_RATE,
|
||||||
int(
|
int(
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.DELAYS + "/" + s.AUTO_REPEAT_RATE, consts.DEFAULT_AUTO_REPEAT_RATE
|
s.DELAYS + "/" + s.AUTO_REPEAT_RATE,
|
||||||
|
consts.DEFAULT_AUTO_REPEAT_RATE,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1368,14 +1399,18 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
(
|
(
|
||||||
s.MUSIC_VOLUME,
|
s.MUSIC_VOLUME,
|
||||||
int(
|
int(
|
||||||
qsettings.value(s.SOUND + "/" + s.MUSIC_VOLUME, consts.DEFAUT_MUSIC_VOLUME)
|
qsettings.value(
|
||||||
|
s.SOUND + "/" + s.MUSIC_VOLUME,
|
||||||
|
consts.DEFAUT_MUSIC_VOLUME,
|
||||||
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.SFX_VOLUME,
|
s.SFX_VOLUME,
|
||||||
int(
|
int(
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.SOUND + "/" + s.SFX_VOLUME, consts.DEFAULT_SFX_VOLUME
|
s.SOUND + "/" + s.SFX_VOLUME,
|
||||||
|
consts.DEFAULT_SFX_VOLUME,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1388,13 +1423,19 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
s.GHOST,
|
s.GHOST,
|
||||||
bool(qsettings.value(s.OTHER + "/" + s.GHOST, consts.DEFAULT_SHOW_GHOST)),
|
bool(
|
||||||
|
qsettings.value(
|
||||||
|
s.OTHER + "/" + s.GHOST,
|
||||||
|
consts.DEFAULT_SHOW_GHOST,
|
||||||
|
)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
s.SHOW_NEXT_QUEUE,
|
s.SHOW_NEXT_QUEUE,
|
||||||
bool(
|
bool(
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.OTHER + "/" + s.SHOW_NEXT_QUEUE, consts.DEFAULT_SHOW_NEXT_QUEUE
|
s.OTHER + "/" + s.SHOW_NEXT_QUEUE,
|
||||||
|
consts.DEFAULT_SHOW_NEXT_QUEUE,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1402,7 +1443,8 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
s.HOLD_ENABLED,
|
s.HOLD_ENABLED,
|
||||||
bool(
|
bool(
|
||||||
qsettings.value(
|
qsettings.value(
|
||||||
s.OTHER + "/" + s.HOLD_ENABLED, consts.DEFAULT_HOLD_ENABLED
|
s.OTHER + "/" + s.HOLD_ENABLED,
|
||||||
|
consts.DEFAULT_HOLD_ENABLED,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1438,7 +1480,7 @@ class Window(QtWidgets.QMainWindow):
|
|||||||
self,
|
self,
|
||||||
__title__,
|
__title__,
|
||||||
self.tr(
|
self.tr(
|
||||||
"""Tetris® clone by Adrien Malingrey
|
"""Tetris® clone by Adrien Malingrey
|
||||||
|
|
||||||
Tetris Game Design by Alekseï Pajitnov
|
Tetris Game Design by Alekseï Pajitnov
|
||||||
Graphism inspired by Tetris Effect
|
Graphism inspired by Tetris Effect
|
||||||
|
2
block.py
2
block.py
@ -36,7 +36,7 @@ class Block:
|
|||||||
|
|
||||||
def paint(self, painter, top_left_corner, spotlight):
|
def paint(self, painter, top_left_corner, spotlight):
|
||||||
p = top_left_corner + self.coord * Block.side
|
p = top_left_corner + self.coord * Block.side
|
||||||
block_center = Point(Block.side/2, Block.side/2)
|
block_center = Point(Block.side / 2, Block.side / 2)
|
||||||
self.center = p + block_center
|
self.center = p + block_center
|
||||||
spotlight = top_left_corner + Block.side * spotlight + block_center
|
spotlight = top_left_corner + Block.side * spotlight + block_center
|
||||||
self.glint = 0.15 * spotlight + 0.85 * self.center
|
self.glint = 0.15 * spotlight + 0.85 * self.center
|
||||||
|
1
point.py
1
point.py
@ -5,6 +5,7 @@
|
|||||||
from consts import CLOCKWISE
|
from consts import CLOCKWISE
|
||||||
from qt5 import QtCore
|
from qt5 import QtCore
|
||||||
|
|
||||||
|
|
||||||
class Point(QtCore.QPoint):
|
class Point(QtCore.QPoint):
|
||||||
"""
|
"""
|
||||||
Point of coordinates (x, y)
|
Point of coordinates (x, y)
|
||||||
|
3
qt5.py
3
qt5.py
@ -17,7 +17,8 @@ except ImportError as pyqt5_error:
|
|||||||
" pip3 install --user qdarkstyle\n"
|
" pip3 install --user qdarkstyle\n"
|
||||||
"or PySide2 :\n"
|
"or PySide2 :\n"
|
||||||
" pip3 install --user PySide2\n"
|
" pip3 install --user PySide2\n"
|
||||||
+ pyqt5_error.msg + "\n"
|
+ pyqt5_error.msg
|
||||||
|
+ "\n"
|
||||||
+ pyside2_error.msg
|
+ pyside2_error.msg
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -108,8 +108,7 @@ class Tetromino:
|
|||||||
Update the Grid if there is no drop trail
|
Update the Grid if there is no drop trail
|
||||||
"""
|
"""
|
||||||
return self._try_movement(
|
return self._try_movement(
|
||||||
(block.coord + Point(horizontally, vertically)
|
(block.coord + Point(horizontally, vertically) for block in self.minoes),
|
||||||
for block in self.minoes),
|
|
||||||
trail,
|
trail,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user