From 6902f071610933abbb26b557d5c5b8645f5ee5be Mon Sep 17 00:00:00 2001 From: Alexandre RIO Date: Sat, 6 Sep 2025 15:43:58 +0200 Subject: [PATCH] uv build local project dev --- grid/ui/items.py | 5 ++++- grid/ui/pattern.py | 4 ++-- grid/ui/window.py | 13 ------------- main.py | 19 +++++++++++++++++++ pyproject.toml | 4 ++++ uv.lock | 2 +- 6 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 main.py diff --git a/grid/ui/items.py b/grid/ui/items.py index 2bd3991..246eea4 100644 --- a/grid/ui/items.py +++ b/grid/ui/items.py @@ -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, diff --git a/grid/ui/pattern.py b/grid/ui/pattern.py index 02f6f23..8f0e4cd 100644 --- a/grid/ui/pattern.py +++ b/grid/ui/pattern.py @@ -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, ) ) diff --git a/grid/ui/window.py b/grid/ui/window.py index 378f1ea..18561cd 100644 --- a/grid/ui/window.py +++ b/grid/ui/window.py @@ -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() diff --git a/main.py b/main.py new file mode 100644 index 0000000..446e199 --- /dev/null +++ b/main.py @@ -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() diff --git a/pyproject.toml b/pyproject.toml index bc4910a..9a863db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,3 +9,7 @@ dependencies = [ "pytest==8.3.3", "ruff==0.12.10", ] + +[build-system] +requires = ["setuptools>=42"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/uv.lock b/uv.lock index bf41647..882eb15 100644 --- a/uv.lock +++ b/uv.lock @@ -142,7 +142,7 @@ wheels = [ [[package]] name = "sphere-grid" version = "0.1.0" -source = { virtual = "." } +source = { editable = "." } dependencies = [ { name = "pyside6" }, { name = "pytest" },