Browse Source

Add back ability to change default relief and frameSize of DirectDialog

rdb 10 years ago
parent
commit
2745f11b65
3 changed files with 14 additions and 7 deletions
  1. 4 3
      direct/src/gui/DirectDialog.py
  2. 8 4
      direct/src/gui/DirectGuiGlobals.py
  3. 2 0
      doc/ReleaseNotes

+ 4 - 3
direct/src/gui/DirectDialog.py

@@ -94,8 +94,8 @@ class DirectDialog(DirectFrame):
             ('text',              '',            None),
             ('text',              '',            None),
             ('text_align',        TextNode.ALeft,   None),
             ('text_align',        TextNode.ALeft,   None),
             ('text_scale',        0.06,          None),
             ('text_scale',        0.06,          None),
-            ('image',             None,          None),
-            ('relief',            DGG.RAISED,     None),
+            ('image',             DGG.getDefaultDialogGeom(), None),
+            ('relief',            DGG.getDefaultDialogRelief(), None),
             ('borderWidth',       (0.01, 0.01),  None),
             ('borderWidth',       (0.01, 0.01),  None),
             ('buttonTextList',    [],            DGG.INITOPT),
             ('buttonTextList',    [],            DGG.INITOPT),
             ('buttonGeomList',    [],            DGG.INITOPT),
             ('buttonGeomList',    [],            DGG.INITOPT),
@@ -316,7 +316,8 @@ class DirectDialog(DirectFrame):
         # reduce bottom by pad, button height and 2*button pad
         # reduce bottom by pad, button height and 2*button pad
         b = min(b - self['midPad'] - bpad[1] - bHeight - bpad[1], b) - pad[1]
         b = min(b - self['midPad'] - bpad[1] - bHeight - bpad[1], b) - pad[1]
         t = t + self['topPad'] + pad[1]
         t = t + self['topPad'] + pad[1]
-        self['frameSize'] = (l, r, b, t)
+        if self['frameSize'] is None:
+            self['frameSize'] = (l, r, b, t)
         self['image_scale'] = (r - l, 1, t - b)
         self['image_scale'] = (r - l, 1, t - b)
         # Center frame about text and buttons
         # Center frame about text and buttons
         self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5)
         self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5)

+ 8 - 4
direct/src/gui/DirectGuiGlobals.py

@@ -14,6 +14,7 @@ defaultFontFunc = TextNode.getDefaultFont
 defaultClickSound = None
 defaultClickSound = None
 defaultRolloverSound = None
 defaultRolloverSound = None
 defaultDialogGeom = None
 defaultDialogGeom = None
+defaultDialogRelief = PGFrameStyle.TBevelOut
 drawOrder = 100
 drawOrder = 100
 panel = None
 panel = None
 
 
@@ -132,13 +133,16 @@ def setDefaultFontFunc(newFontFunc):
 
 
 def getDefaultDialogGeom():
 def getDefaultDialogGeom():
     global defaultDialogGeom
     global defaultDialogGeom
-    if defaultDialogGeom == None:
-        defaultDialogGeom = loader.loadModel('models/gui/dialog_box_gui', okMissing = True)
     return defaultDialogGeom
     return defaultDialogGeom
 
 
-def setDefaultDialogGeom(newDialogGeom):
-    global defaultDialogGeom
+def getDefaultDialogRelief():
+    global defaultDialogRelief
+    return defaultDialogRelief
+
+def setDefaultDialogGeom(newDialogGeom, relief=None):
+    global defaultDialogGeom, defaultDialogRelief
     defaultDialogGeom = newDialogGeom
     defaultDialogGeom = newDialogGeom
+    defaultDialogRelief = relief
 
 
 def getDefaultDrawOrder():
 def getDefaultDrawOrder():
     return drawOrder
     return drawOrder

+ 2 - 0
doc/ReleaseNotes

@@ -67,6 +67,8 @@ Fixes for the Python API:
 * MouseWatcherGroup was erroneously not exposed in 1.9.0
 * MouseWatcherGroup was erroneously not exposed in 1.9.0
 * ShowBase no longer unmounts VFS when shutting down
 * ShowBase no longer unmounts VFS when shutting down
 * No longer requires setting PATH to import panda3d.*
 * No longer requires setting PATH to import panda3d.*
+* DirectDialog default geom is once again respected
+* DirectDialog no longer overrides custom frameSize
 * Fix WebcamVideo/MicrophoneAudio.getOptions() methods
 * Fix WebcamVideo/MicrophoneAudio.getOptions() methods
 
 
 Changes relating to the OpenGL renderer:
 Changes relating to the OpenGL renderer: