mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-02 03:26:25 -04:00
Updated kivymd
This commit is contained in:
parent
c6df8b851b
commit
abcf173cc8
160 changed files with 11617 additions and 6545 deletions
|
@ -2,6 +2,8 @@
|
|||
Controllers/WindowController
|
||||
============================
|
||||
|
||||
.. versionadded:: 1.0.0
|
||||
|
||||
Modules and classes that implement useful methods for getting information
|
||||
about the state of the current application window.
|
||||
|
||||
|
@ -33,16 +35,35 @@ Controlling the resizing direction of the application window
|
|||
|
||||
from kivy.core.window import Window
|
||||
from kivy.core.window.window_sdl2 import WindowSDL
|
||||
from kivy.metrics import dp
|
||||
|
||||
|
||||
class WindowController:
|
||||
def __init__(self):
|
||||
self.window_resizing_direction = "unknown"
|
||||
self.real_device_type = "unknown"
|
||||
self.__width = Window.width
|
||||
Window.bind(on_resize=self._on_resize)
|
||||
|
||||
def on_size(self, instance, size: list) -> None:
|
||||
"""Called when the application screen size changes."""
|
||||
|
||||
window_width = size[0]
|
||||
|
||||
if window_width < dp(500):
|
||||
self.real_device_type = "mobile"
|
||||
elif window_width < dp(1100):
|
||||
self.real_device_type = "tablet"
|
||||
else:
|
||||
self.real_device_type = "desktop"
|
||||
|
||||
def get_real_device_type(self) -> str:
|
||||
"""Returns the device type - 'mobile', 'tablet' or 'desktop'."""
|
||||
|
||||
return self.real_device_type
|
||||
|
||||
def get_window_width_resizing_direction(self) -> str:
|
||||
"""Return window width resizing direction - 'left' or 'right'"""
|
||||
"""Return window width resizing direction - 'left' or 'right'."""
|
||||
|
||||
return self.window_resizing_direction
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue