From: mar77i Date: Fri, 14 Feb 2025 09:03:41 +0000 (+0100) Subject: make repeatbutton public to ui X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=536fd3c6f242cc98600f4e5e82c842ebde9101d3;p=zenbook_gui make repeatbutton public to ui --- diff --git a/bookpaint.py b/bookpaint.py index bfdd01a..cba34b7 100755 --- a/bookpaint.py +++ b/bookpaint.py @@ -10,6 +10,7 @@ sys.path.append(str(Path(__file__).parent)) from bookpaint.bookpaint import BookPaint with redirect_stdout(StringIO()): + # ruff: noqa: F401 import pygame # type: ignore BookPaint().run() diff --git a/bookpaint/bookpaint.py b/bookpaint/bookpaint.py index 3fd7307..aba202b 100644 --- a/bookpaint/bookpaint.py +++ b/bookpaint/bookpaint.py @@ -4,7 +4,7 @@ from pathlib import Path import pygame -from ui.ui import Button, Child, FPSWidget, Label, Modal, RepeatButton, Root +from ui import Button, Child, FPSWidget, Label, Modal, RepeatButton, Root from layout.layout import BarLayout from .draw_ui import DrawImage diff --git a/ui/__init__.py b/ui/__init__.py index 1f63194..d118659 100644 --- a/ui/__init__.py +++ b/ui/__init__.py @@ -13,7 +13,30 @@ from .rect import Rect from .root import Root from .scroll import Scroll from .slider import Slider -from .spinner import Spinner +from .spinner import RepeatButton, Spinner from .switch import Switch from .tab_bar import TabBar from .text_input import TextInput + +__all__ = [ + "Button", + "Child", + "DropDown", + "EventMethodDispatcher", + "FPSWidget", + "Icon", + "IconButton", + "Label", + "MessageBox", + "Modal", + "Parent", + "Rect", + "RepeatButton", + "Root", + "Scroll", + "Slider", + "Spinner", + "Switch", + "TabBar", + "TextInput", +] diff --git a/vectors/__init__.py b/vectors/__init__.py index 3d850b7..e547554 100644 --- a/vectors/__init__.py +++ b/vectors/__init__.py @@ -8,3 +8,17 @@ from .stroke_circle_segment import StrokeCircleSegment from .stroke_path import StrokePath from .stroke_round_line import StrokeRoundLine from .stroke_square_line import StrokeSquareLine + +__all__ = [ + "Shape", + "Shapes", + "Circle", + "Ellipse", + "Polygon", + "Rect", + "StrokeCircle", + "StrokeCircleSegment", + "StrokePath", + "StrokeRoundLine", + "StrokeSquareLine", +] diff --git a/vectors/base.py b/vectors/base.py index 5d4ccf8..637ac5d 100644 --- a/vectors/base.py +++ b/vectors/base.py @@ -11,7 +11,7 @@ class Shapes(Shape): self.shapes = list(shapes) def fit(self, pos, unit): - if type(self) != Shapes: + if type(self) is not Shapes: raise NotImplementedError return Shapes([s.fit(pos, unit) for s in self.shapes]) diff --git a/vectors/circle.py b/vectors/circle.py index e04b4a9..7b4eb33 100644 --- a/vectors/circle.py +++ b/vectors/circle.py @@ -1,3 +1,5 @@ +import pygame + from .base import Shape from .ellipse import Ellipse @@ -8,7 +10,7 @@ class Circle(Shape): self.radius = radius def fit(self, pos, unit): - if type(self) != Circle: + if type(self) is not Circle: raise NotImplementedError if unit[0] == unit[1]: return Circle( diff --git a/vectors/polygon.py b/vectors/polygon.py index a4b747b..0e6a785 100644 --- a/vectors/polygon.py +++ b/vectors/polygon.py @@ -8,7 +8,7 @@ class Polygon(Shape): self.points = list(points) def fit(self, pos, unit): - if type(self) != Polygon: + if type(self) is not Polygon: raise NotImplementedError return Polygon( [ diff --git a/vectors/stroke_circle.py b/vectors/stroke_circle.py index fdb12a9..c17e214 100644 --- a/vectors/stroke_circle.py +++ b/vectors/stroke_circle.py @@ -22,7 +22,7 @@ class StrokeCircle(StrokePath): ] def fit(self, pos, unit): - if type(self) != StrokeCircle: + if type(self) is not StrokeCircle: raise NotImplementedError return StrokeCircle( (pos[0] + self.center[0] * unit[0], pos[1] + self.center[1] * unit[1]), diff --git a/vectors/stroke_circle_segment.py b/vectors/stroke_circle_segment.py index d3eddd1..bdf0558 100644 --- a/vectors/stroke_circle_segment.py +++ b/vectors/stroke_circle_segment.py @@ -33,7 +33,7 @@ class StrokeCircleSegment(StrokeCircle): yield start_angle + a def fit(self, pos, unit): - if type(self) != StrokeCircleSegment: + if type(self) is not StrokeCircleSegment: raise NotImplementedError return StrokeCircleSegment( (pos[0] + self.center[0] * unit[0], pos[1] + self.center[1] * unit[1]), diff --git a/vectors/stroke_path.py b/vectors/stroke_path.py index 6ea9e80..c9a5179 100644 --- a/vectors/stroke_path.py +++ b/vectors/stroke_path.py @@ -25,7 +25,7 @@ class StrokePath: old = new def fit(self, pos, unit): - if type(self) != StrokePath: + if type(self) is not StrokePath: raise NotImplementedError return StrokePath( [ diff --git a/vectors/stroke_round_line.py b/vectors/stroke_round_line.py index df3e40a..eea860f 100644 --- a/vectors/stroke_round_line.py +++ b/vectors/stroke_round_line.py @@ -56,7 +56,7 @@ class StrokeRoundLine(Polygon): return ceil(pi / acos(1 - threshold / radius)) def fit(self, pos, unit): - if type(self) != StrokeRoundLine: + if type(self) is not StrokeRoundLine: raise NotImplementedError return StrokeRoundLine( (pos[0] + self.p1[0] * unit[0], pos[1] + self.p1[1] * unit[1]), diff --git a/vectors/stroke_square_line.py b/vectors/stroke_square_line.py index 975f0b8..e45050f 100644 --- a/vectors/stroke_square_line.py +++ b/vectors/stroke_square_line.py @@ -34,7 +34,7 @@ class StrokeSquareLine(Polygon): ] def fit(self, pos, unit): - if type(self) != StrokeSquareLine: + if type(self) is not StrokeSquareLine: raise NotImplementedError return StrokeSquareLine( (pos[0] + self.p1[0] * unit[0], pos[1] + self.p1[1] * unit[1]), diff --git a/zenbook_conf.py b/zenbook_conf.py index fd44ccb..0ed472d 100755 --- a/zenbook_conf.py +++ b/zenbook_conf.py @@ -10,6 +10,7 @@ sys.path.append(str(Path(__file__).parent)) from zenbook_conf.zenbook_conf import ZenbookConf with redirect_stdout(StringIO()): + # ruff: noqa: F401 import pygame # type: ignore ZenbookConf().run()