clean up window minimum size changes

This commit is contained in:
dessant 2015-06-20 21:35:09 +03:00
parent 59b768cf48
commit 70d8e27aa4
4 changed files with 21 additions and 13 deletions

View File

@ -135,6 +135,7 @@ class Touchtracer(FloatLayout):
label.pos = touch.pos
label.size = label.texture_size[0] + 20, label.texture_size[1] + 20
class TouchtracerApp(App):
title = 'Touchtracer'
icon = 'icon.png'

View File

@ -755,12 +755,14 @@ if not environ.get('KIVY_DOC_INCLUDE'):
elif version == 12:
Config.set('graphics', 'window_state', 'visible')
elif version == 13:
elif version == 13:
Config.set('graphics', 'minimum_width', '0')
Config.set('graphics', 'minimum_height', '0')
#elif version == 1:
# # add here the command for upgrading from configuration 0 to 1
#
# elif version == 1:
# # add here the command for upgrading from configuration 0 to 1
else:
# for future.
break

View File

@ -334,15 +334,21 @@ class WindowBase(EventDispatcher):
return False
minimum_width = NumericProperty(0)
'''The minimum_width to restrict the window to.
'''The minimum width to restrict the window to.
.. versionadded:: 1.9.1
:attr:`minimum_width` is a :class:`~kivy.properties.NumericProperty`,
defaults to 0.
'''
minimum_height = NumericProperty(0)
'''The minimum_height to restrict the window to.
'''The minimum height to restrict the window to.
.. versionadded:: 1.9.1
:attr:`minimum_height` is a :class:`~kivy.properties.NumericProperty`,
defaults to 0.
'''
size = AliasProperty(_get_size, _set_size, bind=('_size', ))

View File

@ -155,13 +155,12 @@ class WindowSDL(WindowBase):
280: 'pgup',
281: 'pgdown'}
self._mouse_buttons_down = set()
self.bind(
minimum_width=self._restrict_window,
minimum_height=self._restrict_window)
self.bind(minimum_width=self._restrict_window,
minimum_height=self._restrict_window)
def _restrict_window(self, *args):
self._win.set_minimum_size(self.minimum_width, self.minimum_height)
def create_window(self, *largs):
if self._fake_fullscreen:
@ -173,8 +172,8 @@ class WindowSDL(WindowBase):
if self.fullscreen == 'fake':
self.borderless = self._fake_fullscreen = True
Logger.warning("The 'fake' fullscreen option has been "
"deprecated, use Window.borderless or the "
"borderless Config option instead.")
"deprecated, use Window.borderless or the "
"borderless Config option instead.")
if not self.initialized:
@ -207,7 +206,7 @@ class WindowSDL(WindowBase):
self._win.set_border_state(self.borderless)
self._win.set_fullscreen_mode(self.fullscreen)
if self.minimum_width and self.minimum_height:
if self.minimum_width or self.minimum_height:
self._win.set_minimum_size(self.minimum_width, self.minimum_height)
super(WindowSDL, self).create_window()