Fix config error when DirectGuiBase is imported before ShowBase

This commit is contained in:
rdb 2015-07-06 15:52:57 +02:00
parent 7c2822515b
commit 2514ca29d8

View File

@ -632,7 +632,7 @@ class DirectGuiBase(DirectObject.DirectObject):
""" """
# Need to tack on gui item specific id # Need to tack on gui item specific id
gEvent = event + self.guiId gEvent = event + self.guiId
if base.config.GetBool('debug-directgui-msgs', False): if get_config_showbase().GetBool('debug-directgui-msgs', False):
from direct.showbase.PythonUtil import StackTrace from direct.showbase.PythonUtil import StackTrace
print gEvent print gEvent
print StackTrace() print StackTrace()
@ -655,7 +655,7 @@ def setGuiGridSpacing(spacing):
# this should trigger off of __dev__, but it's not available at this point. # this should trigger off of __dev__, but it's not available at this point.
# __debug__ works because the production client is not __debug__ and the # __debug__ works because the production client is not __debug__ and the
# production AI doesn't create any GUI. # production AI doesn't create any GUI.
if config.GetBool('record-gui-creation-stack', __debug__): if get_config_showbase().GetBool('record-gui-creation-stack', __debug__):
# this will help track down the code that created DirectGui objects # this will help track down the code that created DirectGui objects
# call obj.printCreationStackTrace() to figure out what code created it # call obj.printCreationStackTrace() to figure out what code created it
DirectGuiBase = recordCreationStackStr(DirectGuiBase) DirectGuiBase = recordCreationStackStr(DirectGuiBase)
@ -668,8 +668,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
# Determine the default initial state for inactive (or # Determine the default initial state for inactive (or
# unclickable) components. If we are in edit mode, these are # unclickable) components. If we are in edit mode, these are
# actually clickable by default. # actually clickable by default.
#guiEdit = base.config.GetBool('direct-gui-edit', 0) guiEdit = get_config_showbase().GetBool('direct-gui-edit', 0)
guiEdit = config.GetBool('direct-gui-edit', 0)
if guiEdit: if guiEdit:
inactiveInitState = DGG.NORMAL inactiveInitState = DGG.NORMAL
else: else: