From 70f2a30b8804ead153170a06e30845a63f83768c Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 12 Jul 2023 16:11:06 +0800 Subject: [PATCH] sync pyglet --- libs/pyglet/canvas/cocoa.py | 6 ++++++ libs/pyglet/shapes.py | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/libs/pyglet/canvas/cocoa.py b/libs/pyglet/canvas/cocoa.py index 30f01d6..b473d21 100644 --- a/libs/pyglet/canvas/cocoa.py +++ b/libs/pyglet/canvas/cocoa.py @@ -78,6 +78,12 @@ class CocoaScreen(Screen): self.height = mode.height def restore_mode(self): + match_attrs = ['width', 'height', 'depth', 'rate'] + current_mode = self.get_mode() + if all(getattr(current_mode, attr) == getattr(self._default_mode, attr) for + attr in match_attrs): + # Already in default mode + return quartz.CGDisplaySetDisplayMode(self._cg_display_id, self._default_mode.cgmode, None) quartz.CGDisplayRelease(self._cg_display_id) diff --git a/libs/pyglet/shapes.py b/libs/pyglet/shapes.py index d04ff4d..1c04ad4 100644 --- a/libs/pyglet/shapes.py +++ b/libs/pyglet/shapes.py @@ -1327,7 +1327,7 @@ class BorderedRectangle(ShapeBase): as a tuple of 3 or 4 ints in the range of 0-255. RGB colors will be treated as having an opacity of 255. `border_color` : (int, int, int, int) - The RGB or RGBA fill color of the rectangle, specified + The RGB or RGBA fill color of the border, specified as a tuple of 3 or 4 ints in the range of 0-255. RGB colors will be treated as having an opacity of 255. @@ -1410,6 +1410,19 @@ class BorderedRectangle(ShapeBase): self._vertex_list.position[:] = (ix1, iy1, ix2, iy1, ix2, iy2, ix1, iy2, bx1, by1, bx2, by1, bx2, by2, bx1, by2) + @property + def border(self): + """The border width of the rectangle. + + :return: float + """ + return self._border + + @border.setter + def border(self, width): + self._border = width + self._update_vertices() + @property def width(self): """The width of the rectangle.