DirectDialog: The "frameSize" keyword is not respected

I’ve just discovered a small issue in DirectDialog.

To start with, I’m using the Ubuntu-Trusty 64-bit “dev” version of Panda (as downloaded from here), and am using that as the reference for code and line numbers, I believe.

The issue, then, is that the “frameSize” constructor keyword doesn’t seem to be respected: DirectDialog generates its own frame-size regardless of any values given via the keyword, from what I see. Setting the frame-size after construction seems to work as expected.

Specifically, the line that produces this appears to be line 319 of DirectDialog.py, in “configureDialog”:

self['frameSize'] = (l, r, b, t)

Having this line does make sense to me (it generates a reasonable dialogue-size given the controls within the frame, I believe)–as long as “frameSize” hasn’t been explicitly set. Perhaps a simple “is None” check would suffice–I’m inclined to suggest line 310 as a good position for it:

# Line 310
if self['frameSize'] is None:
        # The following is the extant code, I believe.
        # Resize frame to fit text and buttons
        l = min(bPos + bl, l) - pad[0]
        r = max(bMax + br, r) + pad[0]
        sidePad = self['sidePad']
        l -= sidePad
        r += sidePad
        # reduce bottom by pad, button height and 2*button pad
        b = min(b - self['midPad'] - bpad[1] - bHeight - bpad[1], b) - pad[1]
        t = t + self['topPad'] + pad[1]
        self['frameSize'] = (l, r, b, t)
        self['image_scale'] = (r - l, 1, t - b)
        # Center frame about text and buttons
        self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5)
        self.resetFrameSize()

Hmm, yeah, there have been other complaints about the changes to DirectDialog as well:
github.com/panda3d/panda3d/pull/40

I’ll take a closer look at it, perhaps we can find a better solution that will satisfy everyone.

Ah, I don’t really follow the bug-reports over there, so I wasn’t aware of that.

Hmm… Regarding the issue of having a more appealing default dialogue (when no geom is given), I’m inclined to think that a ridged relief looks decent, and, unlike a simple raised relief, doesn’t look like a giant button. Here’s a quick example (albeit one using an explicit frame-size):


The colour is just the colour that I’m using for that particular dialogue, and isn’t part of the suggestion.

The drop-shadow used is a simple DirectFrame hacked onto the dialogue as a proof-of-concept.

I like the idea (if I’m reading your comment over there correctly) of having the default geom be “None”, but allowing the developer to change this, thus allowing the developer to easily set a default geom for all non-custom dialogues.

Pushed a fix. Will be in 1.9.1.

Excellent, and thank you. :slight_smile: