Tidy up
parent
35d9ce13f2
commit
b019aa2f28
|
@ -1,13 +1,10 @@
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont
|
from PyQt5.QtGui import QPen
|
||||||
from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem,
|
from PyQt5.QtWidgets import QSizePolicy, QGraphicsWidget
|
||||||
QGraphicsLineItem, QGraphicsRectItem, QGraphicsObject,
|
from PyQt5.QtCore import (QAbstractAnimation, Qt, QLineF, QPropertyAnimation, pyqtProperty,
|
||||||
QGraphicsItemGroup, QGraphicsPathItem, QGraphicsLinearLayout)
|
pyqtSignal, QSizeF)
|
||||||
from PyQt5.QtCore import (QAbstractAnimation, QObject, QPointF, Qt, QRectF, QLineF,
|
|
||||||
QPropertyAnimation, pyqtProperty, pyqtSignal, QSizeF)
|
|
||||||
|
|
||||||
from . import sudoku_graphics as sdk_grap
|
from . import sudoku_graphics as sdk_grap
|
||||||
from . import menu_graphics as menu_grap
|
from . import menu_graphics as menu_grap
|
||||||
from general import extras
|
|
||||||
|
|
||||||
|
|
||||||
class BoxBoard(QGraphicsWidget):
|
class BoxBoard(QGraphicsWidget):
|
||||||
|
@ -67,7 +64,6 @@ class BoxBoard(QGraphicsWidget):
|
||||||
for line in self.line_order:
|
for line in self.line_order:
|
||||||
if line.length() > 1:
|
if line.length() > 1:
|
||||||
painter.drawLine(line)
|
painter.drawLine(line)
|
||||||
#super().paint(painter, style, widget)
|
|
||||||
|
|
||||||
# Defining the length to be drawn as a pyqtProperty
|
# Defining the length to be drawn as a pyqtProperty
|
||||||
@pyqtProperty(float)
|
@pyqtProperty(float)
|
||||||
|
|
|
@ -2,18 +2,16 @@
|
||||||
This module contains all kinds of animated buttons
|
This module contains all kinds of animated buttons
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont
|
|
||||||
from PyQt5.Qt import QApplication, QTimer
|
|
||||||
from PyQt5.QtWidgets import (QGraphicsScene, QGraphicsView, QGraphicsItem,
|
|
||||||
QGraphicsLineItem, QGraphicsRectItem, QGraphicsObject,
|
|
||||||
QGraphicsItemGroup, QGraphicsPathItem)
|
|
||||||
from PyQt5.QtCore import (QAbstractAnimation, QObject, QPointF, Qt, QRectF, QLineF,
|
|
||||||
QPropertyAnimation, pyqtProperty, pyqtSignal)
|
|
||||||
from general import extras
|
|
||||||
import sys
|
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
from PyQt5.QtCore import (QAbstractAnimation, Qt, QRectF, QLineF,
|
||||||
|
QPropertyAnimation, pyqtProperty, pyqtSignal)
|
||||||
|
from PyQt5.QtGui import QPen
|
||||||
|
from PyQt5.QtWidgets import (QGraphicsObject)
|
||||||
|
|
||||||
|
from general import extras
|
||||||
|
|
||||||
RANDOMCHAR = "~!@#$%^&*()_+`-=[]\{}|;:'<>,./?\""
|
RANDOMCHAR = "~!@#$%^&*()_+`-=[]\{}|;:'<>,./?\""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
This module contains the components that make up the menu Board
|
This module contains the components that make up the menu Board
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont
|
|
||||||
from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem,
|
|
||||||
QGraphicsLineItem, QGraphicsRectItem, QGraphicsObject, QGraphicsProxyWidget,
|
|
||||||
QGraphicsLinearLayout, QGraphicsLayoutItem, QGraphicsScene, QGraphicsView,)
|
|
||||||
from PyQt5.QtCore import (QAbstractAnimation, QObject, QPointF, Qt, QRectF, QLineF,
|
|
||||||
QPropertyAnimation, pyqtProperty, pyqtSignal, QSizeF, QTimer)
|
|
||||||
from PyQt5.Qt import QApplication
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from PyQt5.Qt import QApplication
|
||||||
|
from PyQt5.QtCore import (Qt, QRectF, pyqtSignal, QSizeF, QTimer)
|
||||||
|
from PyQt5.QtGui import QPainter, QBrush, QPen
|
||||||
|
from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem,
|
||||||
|
QGraphicsObject, QGraphicsProxyWidget,
|
||||||
|
QGraphicsScene, QGraphicsView, )
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import buttons
|
import buttons
|
||||||
import scoreboard as scb
|
import scoreboard as scb
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont
|
|
||||||
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)
|
|
||||||
from PyQt5.Qt import QApplication
|
|
||||||
import sys
|
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from PyQt5.Qt import QApplication
|
||||||
|
from PyQt5.QtCore import (QAbstractAnimation, Qt, QPropertyAnimation, pyqtProperty, pyqtSignal, QTimer)
|
||||||
|
from PyQt5.QtWidgets import (QWidget, QLineEdit, QHBoxLayout, QGridLayout, QVBoxLayout, QPushButton, QLabel)
|
||||||
|
|
||||||
if not __name__ == "__main__":
|
if not __name__ == "__main__":
|
||||||
sys.path.append("~/PycharmProjects/sudoku")
|
sys.path.append("~/PycharmProjects/sudoku")
|
||||||
|
hs_file = "/home/eyt21/PycharmProjects/sudoku/general/highscore.txt"
|
||||||
|
else:
|
||||||
|
hs_file = "./sudoku/general/highscore.txt"
|
||||||
|
|
||||||
from general import highscore as hs
|
from general import highscore as hs
|
||||||
|
|
||||||
|
@ -150,7 +151,7 @@ class ScoreGrid(QGridLayout):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
try:
|
try:
|
||||||
self.highscore_list = hs.read_highscore_file("/home/eyt21/PycharmProjects/sudoku/general/highscore.txt")
|
self.highscore_list = hs.read_highscore_file(hs_file)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Cannot open file', e)
|
print('Cannot open file', e)
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,17 @@
|
||||||
This module contains the components that make up the Sudoku Board
|
This module contains the components that make up the Sudoku Board
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont
|
import numpy as np
|
||||||
from PyQt5.QtWidgets import QGraphicsItem, QGraphicsObject
|
|
||||||
from PyQt5.QtCore import (QAbstractAnimation, QPointF, Qt, QRectF, QLineF,
|
from PyQt5.QtCore import (QAbstractAnimation, QPointF, Qt, QRectF, QLineF,
|
||||||
QPropertyAnimation, pyqtProperty, pyqtSignal)
|
QPropertyAnimation, pyqtProperty, pyqtSignal)
|
||||||
|
from PyQt5.QtGui import QPen, QFont
|
||||||
|
from PyQt5.QtWidgets import QGraphicsItem, QGraphicsObject
|
||||||
|
|
||||||
from gameplay import sudoku_gameplay as sdk
|
from gameplay import sudoku_gameplay as sdk
|
||||||
from general.extras import bound_value
|
from general.extras import bound_value
|
||||||
from . import buttons
|
from . import buttons
|
||||||
from . import menu_graphics as menu_grap
|
from . import menu_graphics as menu_grap
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
|
|
||||||
class BaseSudokuItem(QGraphicsObject):
|
class BaseSudokuItem(QGraphicsObject):
|
||||||
|
|
||||||
|
|
11
main.py
11
main.py
|
@ -1,10 +1,7 @@
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont, QTransform, QWheelEvent
|
from PyQt5.QtGui import QPainter, QBrush
|
||||||
from PyQt5.Qt import QApplication, QTimer
|
from PyQt5.Qt import QApplication
|
||||||
from PyQt5.QtWidgets import (QGraphicsScene, QGraphicsView, QGraphicsItem,
|
from PyQt5.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsWidget, QGraphicsLinearLayout
|
||||||
QGraphicsLineItem, QGraphicsRectItem, QGraphicsObject,
|
from PyQt5.QtCore import Qt
|
||||||
QGraphicsItemGroup, QGraphicsWidget, QGraphicsLinearLayout)
|
|
||||||
from PyQt5.QtCore import (QAbstractAnimation, QObject, QPoint, QPointF, Qt, QRectF,QLineF,
|
|
||||||
QPropertyAnimation, pyqtProperty, pyqtSignal)
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from graphic_components import board
|
from graphic_components import board
|
||||||
|
|
Loading…
Reference in New Issue