sync pyglet

This commit is contained in:
shenjack 2023-07-12 16:11:06 +08:00
parent 5e6fee7353
commit 70f2a30b88
2 changed files with 20 additions and 1 deletions

View File

@ -78,6 +78,12 @@ class CocoaScreen(Screen):
self.height = mode.height self.height = mode.height
def restore_mode(self): 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.CGDisplaySetDisplayMode(self._cg_display_id, self._default_mode.cgmode, None)
quartz.CGDisplayRelease(self._cg_display_id) quartz.CGDisplayRelease(self._cg_display_id)

View File

@ -1327,7 +1327,7 @@ class BorderedRectangle(ShapeBase):
as a tuple of 3 or 4 ints in the range of 0-255. RGB 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. colors will be treated as having an opacity of 255.
`border_color` : (int, int, int, int) `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 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. 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, self._vertex_list.position[:] = (ix1, iy1, ix2, iy1, ix2, iy2, ix1, iy2,
bx1, by1, bx2, by1, bx2, by2, bx1, by2) 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 @property
def width(self): def width(self):
"""The width of the rectangle. """The width of the rectangle.