Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed strings instead of enums for SType #454

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions p5/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#

from enum import Enum
from p5.core.constants import TESS, TRIANGLES, POINTS, LINES, LINE_STRIP, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP


"""Constants Variables for P5 sketches"""

Expand Down Expand Up @@ -202,16 +204,16 @@


# Shape types / kinds
class SType(Enum):
POINTS = "POINTS"
LINES = "LINES"
LINE_STRIP = "LINE_STRIP"
TRIANGLES = "TRIANGLES"
TRIANGLE_FAN = "TRIANGLE_FAN"
TRIANGLE_STRIP = "TRIANGLE_STRIP"
QUADS = "QUADS"
QUAD_STRIP = "QUAD_STRIP"
TESS = "TESS"
POINTS = "POINTS"
LINES = "LINES"
LINE_STRIP = "LINE_STRIP"
TRIANGLES = "TRIANGLES"
TRIANGLE_FAN = "TRIANGLE_FAN"
TRIANGLE_STRIP = "TRIANGLE_STRIP"
QUADS = "QUADS"
QUAD_STRIP = "QUAD_STRIP"
TESS = "TESS"



# Add all members of SType to global
Expand Down
5 changes: 3 additions & 2 deletions p5/sketch/Vispy2DRenderer/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from p5.pmath.vector import Point
from p5.pmath.utils import SINCOS
from p5.core import p5
from p5.core.constants import TESS, TRIANGLE_FAN

__all__ = ["PShape"]

Expand Down Expand Up @@ -105,7 +106,7 @@ def __init__(
children=None,
contours=tuple(),
vertices=tuple(),
shape_type=SType.TESS,
shape_type="TESS",
):
# basic properties of the shape
self._fill = None
Expand Down Expand Up @@ -475,7 +476,7 @@ def __init__(
self._stop_angle = stop_angle
self.arc_mode = mode

gl_type = SType.TESS if mode in ["OPEN", "CHORD"] else SType.TRIANGLE_FAN
gl_type = "TESS" if mode in ["OPEN", "CHORD"] else "TRIANGLE_FAN"
super().__init__(
fill_color=fill_color,
stroke_color=stroke_color,
Expand Down