mirror of https://github.com/kivy/kivy.git
WindowBase: Change type of clearcolor property to ColorProperty. (#7647)
This commit is contained in:
parent
c11125ee4a
commit
6a20b0dd35
|
@ -341,7 +341,6 @@ class WindowBase(EventDispatcher):
|
||||||
_size = ListProperty([0, 0])
|
_size = ListProperty([0, 0])
|
||||||
_modifiers = ListProperty([])
|
_modifiers = ListProperty([])
|
||||||
_rotation = NumericProperty(0)
|
_rotation = NumericProperty(0)
|
||||||
_clearcolor = ObjectProperty([0, 0, 0, 1])
|
|
||||||
_focus = BooleanProperty(True)
|
_focus = BooleanProperty(True)
|
||||||
|
|
||||||
gl_backends_allowed = []
|
gl_backends_allowed = []
|
||||||
|
@ -457,19 +456,7 @@ class WindowBase(EventDispatcher):
|
||||||
:attr:`size` is an :class:`~kivy.properties.AliasProperty`.
|
:attr:`size` is an :class:`~kivy.properties.AliasProperty`.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def _get_clearcolor(self):
|
clearcolor = ColorProperty((0, 0, 0, 1))
|
||||||
return self._clearcolor
|
|
||||||
|
|
||||||
def _set_clearcolor(self, value):
|
|
||||||
if value is not None:
|
|
||||||
if type(value) not in (list, tuple):
|
|
||||||
raise Exception('Clearcolor must be a list or tuple')
|
|
||||||
if len(value) != 4:
|
|
||||||
raise Exception('Clearcolor must contain 4 values')
|
|
||||||
self._clearcolor = value
|
|
||||||
|
|
||||||
clearcolor = AliasProperty(_get_clearcolor, _set_clearcolor,
|
|
||||||
bind=('_clearcolor', ))
|
|
||||||
'''Color used to clear the window.
|
'''Color used to clear the window.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -487,8 +474,12 @@ class WindowBase(EventDispatcher):
|
||||||
|
|
||||||
.. versionadded:: 1.0.9
|
.. versionadded:: 1.0.9
|
||||||
|
|
||||||
:attr:`clearcolor` is an :class:`~kivy.properties.AliasProperty` and
|
:attr:`clearcolor` is an :class:`~kivy.properties.ColorProperty` and
|
||||||
defaults to (0, 0, 0, 1).
|
defaults to (0, 0, 0, 1).
|
||||||
|
|
||||||
|
.. versionchanged:: 2.1.0
|
||||||
|
Changed from :class:`~kivy.properties.AliasProperty` to
|
||||||
|
:class:`~kivy.properties.ColorProperty`.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# make some property read-only
|
# make some property read-only
|
||||||
|
@ -1428,13 +1419,13 @@ class WindowBase(EventDispatcher):
|
||||||
def clear(self):
|
def clear(self):
|
||||||
'''Clear the window with the background color'''
|
'''Clear the window with the background color'''
|
||||||
# XXX FIXME use late binding
|
# XXX FIXME use late binding
|
||||||
from kivy.graphics.opengl import glClearColor, glClear, \
|
from kivy.graphics import opengl as gl
|
||||||
GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT
|
gl.glClearColor(*self.clearcolor)
|
||||||
cc = self._clearcolor
|
gl.glClear(
|
||||||
if cc is not None:
|
gl.GL_COLOR_BUFFER_BIT
|
||||||
glClearColor(*cc)
|
| gl.GL_DEPTH_BUFFER_BIT
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT |
|
| gl.GL_STENCIL_BUFFER_BIT
|
||||||
GL_STENCIL_BUFFER_BIT)
|
)
|
||||||
|
|
||||||
def set_title(self, title):
|
def set_title(self, title):
|
||||||
'''Set the window title.
|
'''Set the window title.
|
||||||
|
|
Loading…
Reference in New Issue