diff --git a/direct/src/gui/DirectGuiGlobals.py b/direct/src/gui/DirectGuiGlobals.py index ba6de56013..167d2a99b4 100644 --- a/direct/src/gui/DirectGuiGlobals.py +++ b/direct/src/gui/DirectGuiGlobals.py @@ -103,9 +103,6 @@ BUTTON_ROLLOVER_STATE = PGButton.SRollover # 2 BUTTON_INACTIVE_STATE = PGButton.SInactive # 3 def getDefaultRolloverSound(): - global defaultRolloverSound - if defaultRolloverSound == None: - defaultRolloverSound = base.loadSfx("audio/sfx/GUI_rollover.wav") return defaultRolloverSound def setDefaultRolloverSound(newSound): @@ -113,9 +110,6 @@ def setDefaultRolloverSound(newSound): defaultRolloverSound = newSound def getDefaultClickSound(): - global defaultClickSound - if defaultClickSound == None: - defaultClickSound = base.loadSfx("audio/sfx/GUI_click.wav") return defaultClickSound def setDefaultClickSound(newSound): diff --git a/direct/src/gui/DirectOptionMenu.py b/direct/src/gui/DirectOptionMenu.py index fdf8f0016e..b37436b5c7 100644 --- a/direct/src/gui/DirectOptionMenu.py +++ b/direct/src/gui/DirectOptionMenu.py @@ -57,8 +57,11 @@ class DirectOptionMenu(DirectButton): # Check if item is highlighted on release and select it if it is self.popupMarker.bind(DGG.B1RELEASE, self.selectHighlightedIndex) # Make popup marker have the same click sound - self.popupMarker.guiItem.setSound( - DGG.B1PRESS + self.popupMarker.guiId, self['clickSound']) + if self['clickSound']: + self.popupMarker.guiItem.setSound( + DGG.B1PRESS + self.popupMarker.guiId, self['clickSound']) + else: + self.popupMarker.guiItem.clearSound(DGG.B1PRESS + self.popupMarker.guiId) # This is created when you set the menu's items self.popupMenu = None self.selectedIndex = None diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 6a638b2b72..9c88d8e6a7 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -199,7 +199,6 @@ class ShowBase(DirectObject.DirectObject): # stores a CollisionTraverser pointer here, we'll traverse it # in the collisionLoop task. self.shadowTrav = 0 - # in the collisionLoop task. self.cTrav = 0 self.cTravStack = Stack() # Ditto for an AppTraverser. @@ -351,6 +350,12 @@ class ShowBase(DirectObject.DirectObject): # dict of guiId to gui item, for tracking down leaks self.guiItems = {} + # optionally restore the default gui sounds from 1.7.2 and earlier + if ConfigVariableBool('orig-gui-sounds', False).getValue(): + from direct.gui import DirectGuiGlobals as DGG + DGG.setDefaultClickSound(self.loader.loadSfx("audio/sfx/GUI_click.wav")) + DGG.setDefaultRolloverSound(self.loader.loadSfx("audio/sfx/GUI_rollover.wav")) + # Now hang a hook on the window-event from Panda. This allows # us to detect when the user resizes, minimizes, or closes the # main window.