mcplatform module¶
Copyright (c) 2010-2012 David Rio Vierra
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
class
mcplatform.
BaseWindowHandler
(*args, **kwargs)[source]¶ Abstract class for the platform specific window handlers. If initialized, this class casts a NotImplementedError.
-
desk_env
= 'windows'¶
-
-
mcplatform.
OSXVersionChecker
(name, compare)[source]¶ Rediculously complicated function to compare current System version to inputted version.
-
class
mcplatform.
WWindowHandler
(pos=(0, 0), size=(0, 0), mode=None)[source]¶ Bases:
mcplatform.BaseWindowHandler
Object to deal with Microsoft Window managers.
-
desk_env
= 'windows'¶
-
get_root_rect
()[source]¶ Return a four values tuple containing the position and size of the very first OS window object.
-
set_position
(pos, update=True)[source]¶ Set the window position. :pos: list or tuple: the new position (x, y).
-
set_size
(size, update=True)[source]¶ Set the window size. :size: list or tuple: the new size. :mode: bool: (re)set the pygame.display mode; self.mode must be a pygame display mode object. Raises a TypeError if something else than a list or a tuple is sent.
-
set_state
(state=1, size=(-1, -1), pos=(-1, -1), update=True)[source]¶ Set wheter the window is maximized or not, or minimized or full screen. If no argument is given, assume the state will be windowed and not maximized. If arguments are given, only the first is relevant. The other ones are ignored.
** Only maximized and normal states are implemented for now. **
State: valid arguments: ‘minimized’, MINIMIZED, 0. ‘normal’, NORMAL, 1: windowed, not maximized. ‘maximized’, MAXIMIZED, 2. ‘fullscreen, FULLSCREEN, 3.
Size: list, tuple: the new size; if (-1, -1) self.get_size() is used. If one element is -1 it is replaced by the corresponding valur from self.get_size(). Pos: list, tuple: the new position; if (-1, -1), self.get_position is used. If one element is -1 it is replaced by the corresponding valur from self.get_position(). Update: bool: whether to call the internal flush method.
-
-
mcplatform.
WindowHandler
¶ alias of
WWindowHandler
-
class
mcplatform.
XWindowHandler
(pos=(0, 0), size=(0, 0), mode=None)[source]¶ Bases:
mcplatform.BaseWindowHandler
Object to deal with XWindow managers (Linux).
-
desk_env
= 'windows'¶
-
get_root_rect
()[source]¶ Return a four values tuple containing the position and size of the very first OS window object.
-
set_position
(pos, update=True)[source]¶ Set the window position. :pos: list or tuple: the new position (x, y). :update: bool: wheteher to call the internal sync method.
-
set_size
(size, update=True)[source]¶ Set the window size. :size: list or tuple: the new size. Raises a TypeError if something else than a list or a tuple is sent.
-
set_state
(state=1, size=(-1, -1), pos=(-1, -1), update=True)[source]¶ Set wheter the window is maximized or not, or minimized or full screen. If no argument is given, assume the state will be windowed and not maximized. If arguments are given, only the first is relevant. The other ones are ignored.
** Only maximized and normal states are implemented for now. **
State: valid arguments: ‘minimized’, MINIMIZED, 0. ‘normal’, NORMAL, 1: windowed, not maximized. ‘maximized’, MAXIMIZED, 2. ‘fullscreen, FULLSCREEN, 3.
Size: list, tuple: the new size; if (-1, -1) self.get_size() is used. If one element is -1 it is replaced by the corresponding valur from self.get_size(). Pos: list, tuple: the new position; if (-1, -1), self.get_position is used. If one element is -1 it is replaced by the corresponding valur from self.get_position(). Update: bool: whether to call the internal flush method.
-