Compare commits
2 Commits
2929064f4d
...
d89c296d36
| Author | SHA1 | Date | |
|---|---|---|---|
| d89c296d36 | |||
| 6902f07161 |
@@ -60,11 +60,13 @@ class AgilitySphereGraphicsItem(SphereGraphicsItem):
|
||||
def __init__(self, x_pos: int, y_pos: int) -> None:
|
||||
super().__init__(x_pos, y_pos, Qt.GlobalColor.darkYellow)
|
||||
|
||||
|
||||
class EmptySphereGraphicsItem(SphereGraphicsItem):
|
||||
def __init__(self, x_pos: int, y_pos: int) -> None:
|
||||
self.SPHERE_WIDTH = 20
|
||||
super().__init__(x_pos, y_pos, Qt.GlobalColor.black)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def random_sphere_factory(x_pos: int, y_pos: int) -> SphereGraphicsItem:
|
||||
rand = random.random()
|
||||
@@ -78,6 +80,7 @@ def random_sphere_factory(x_pos: int, y_pos: int) -> SphereGraphicsItem:
|
||||
obj = EmptySphereGraphicsItem(x_pos, y_pos)
|
||||
return obj
|
||||
|
||||
|
||||
class ArcGraphicsItem(QGraphicsItem):
|
||||
"""Circle arc."""
|
||||
|
||||
@@ -111,7 +114,7 @@ class ArcGraphicsItem(QGraphicsItem):
|
||||
# must a more elegant way but it works
|
||||
if angle_end == 0:
|
||||
angle_end = 360
|
||||
self.draw_angle_end = int(abs(angle_end-angle_start) * 16)
|
||||
self.draw_angle_end = int(abs(angle_end - angle_start) * 16)
|
||||
logging.debug(
|
||||
"arc from %s:%s of %s from %s° to %s°",
|
||||
self.x_pos,
|
||||
|
||||
@@ -112,8 +112,8 @@ class LargeUltimaPattern(Pattern):
|
||||
y_pos=self.center_y,
|
||||
width=self.SPACE_BETWEEN_SPHERE * 2,
|
||||
angle_start=(i * 360 / sphere_on_circle) % 360,
|
||||
#angle_end=((i + 1) * 360 / sphere_on_circle) % 360,
|
||||
angle_end=(360 / sphere_on_circle ),
|
||||
# angle_end=((i + 1) * 360 / sphere_on_circle) % 360,
|
||||
angle_end=(360 / sphere_on_circle),
|
||||
parent=self,
|
||||
)
|
||||
)
|
||||
@@ -161,7 +161,7 @@ class SmallZPattern(Pattern):
|
||||
|
||||
sphere_on_circle = 6
|
||||
for i in range(sphere_on_circle):
|
||||
if i == 2 or i == 3:
|
||||
if i == 2 or i == 3 or i == 5 or i == 0:
|
||||
continue
|
||||
else:
|
||||
self.addToGroup(
|
||||
@@ -177,8 +177,16 @@ class SmallZPattern(Pattern):
|
||||
points = self.generate_circle_points(
|
||||
self.center_x, self.center_y, self.SPACE_BETWEEN_SPHERE, sphere_on_circle
|
||||
)
|
||||
self.addToGroup(
|
||||
LineGraphicsItem(self.center_x, self.center_y, points[1][0], points[1][1], self)
|
||||
)
|
||||
self.addToGroup(
|
||||
LineGraphicsItem(self.center_x, self.center_y, points[4][0], points[4][1], self)
|
||||
)
|
||||
# Remove left and right sphere
|
||||
del points[0]
|
||||
del points[2]
|
||||
for x, y in points:
|
||||
self.addToGroup(random_sphere_factory(x, y))
|
||||
|
||||
self.addToGroup(HPSphereGraphicsItem(self.center_x, self.center_y))
|
||||
@@ -1,9 +1,5 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from PySide6.QtGui import QPainter
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication,
|
||||
QGraphicsScene,
|
||||
QGraphicsView,
|
||||
QHBoxLayout,
|
||||
@@ -34,12 +30,3 @@ class Window(QWidget):
|
||||
|
||||
self.setLayout(vbox)
|
||||
self.show()
|
||||
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
)
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
app.exec()
|
||||
|
||||
19
main.py
Normal file
19
main.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from grid.ui.window import Window
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
def main():
|
||||
print("Hello from sphere-grid!")
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
)
|
||||
app = QApplication(sys.argv)
|
||||
w = Window() # noqa: F841
|
||||
app.exec()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -9,3 +9,7 @@ dependencies = [
|
||||
"pytest==8.3.3",
|
||||
"ruff==0.12.10",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=42"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
Reference in New Issue
Block a user