slightly enhance MW's setup_configs

This commit is contained in:
Paul Franklin 2017-02-05 15:24:48 -08:00
parent 081095d333
commit 4284eb95a7

View File

@ -625,7 +625,8 @@ class ManagedWindow:
def setup_configs(self, config_base,
default_width, default_height,
default_horiz_position=None, default_vert_position=None):
default_horiz_position=None, default_vert_position=None,
p_width=None, p_height=None): # for fullscreen
"""
Helper method to setup the window's configuration settings
@ -636,13 +637,18 @@ class ManagedWindow:
@param default_horiz_position, default_vert_position: if either is None
then that position is centered on the parent, else explicitly set
@type default_horiz_position, default_vert_position: int or None
@param p_width, p_height: the parent's width and height
@type p_width, p_height: int or None
"""
self.width_key = config_base + '-width'
self.height_key = config_base + '-height'
self.horiz_position_key = config_base + '-horiz-position'
self.vert_position_key = config_base + '-vert-position'
(p_width, p_height) = self.parent_window.get_size()
(p_horiz, p_vert) = self.parent_window.get_position()
if p_width is None and p_height is None: # default case
(p_width, p_height) = self.parent_window.get_size()
(p_horiz, p_vert) = self.parent_window.get_position()
else:
p_horiz = p_vert = 0 # fullscreen
if default_horiz_position is None:
default_horiz_position = p_horiz + ((p_width - default_width) // 2)
if default_vert_position is None: