proposed patch, help wanted (style dialogs)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

proposed patch, help wanted (style dialogs)

Paul Franklin-5
I'd appreciate some help with another proposed patch.

This one turns both style dialogs into managed windows.

But I hit a little problem and I don't know if it's
something peculiar to my particular (old) Gtk setup, or
whether it's some gramps problem, or something else.

Basically, the parent dialog starts the child dialog if the
user wants to create or edit a (report's) style.  Both of
them are modal, since they utilize the foo.run() to get the
user's choice, and neither had any foo.show_all() call.

So I had to add a self.show() in both classes, to let the
parent class set the transient parent and so forth.

That worked fine for the parent dialog but in the child
dialog (the actual style editor) I noticed something funny.

The initial child dialog always came up showing all six tabs
defined in the Glade file, instead of just the three it
should be showing (general, font, and paragraph choices).

But then if I selected another style in that same editor
dialog, it only showed the correct three tabs.  And when I
then selected the original (top) style again, it too only
showed the correct three now.

So finally I discovered that if I modified the ManagedWindow
"show" method to /not/ do a "self.window.show_all()" if the
caller passed in a flag, then the "self.window.run()" in the
original code always showed me just the three correct tabs.

(There is a loop in the original code which calls hide() for
tabs which are not supposed to be visible, and it's getting
executed: "self.plist.select_row(0)" calls "change_display"
which calls "draw" and "show_pages".  But the ManagedWindow
show_all() seems to somehow be ignoring it.  Or whatever.)

So you can easily recreate my test condition.  Just apply
the attached patch and remove my "show_all=False" argument
from the self.show() call.

Of course, perhaps you'll tell me it's really needed?  8-)

There are a few things in the patch which strictly speaking
aren't needed to change the two classes into ManagedWindow
sub-classes (docstring changes, better error reporting, and
so on), but I didn't feel like splitting things out.  Sorry.

I also got rid of the delete-event signal in the Glade file
as that is handled in ManagedWindow.  But I added a "cancel"
signal for both classes, even though I made both a "pass".
So I could remove both of them if you tell me to, etc.

There is of course no hurry.

Thanks.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel

9795=styledialogs20170118B.patch (19K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: proposed patch, help wanted (style dialogs)

Paul Franklin-5
> I'd appreciate some help with another proposed patch.
>
> This one turns both style dialogs into managed windows.

PaulC suggested moving the self.show() up higher and that
seems to have done the trick.

I put it where it originally was since that was where the old
set_transient_for had been, but when I moved it up to just
after the set_window I no longer see all six tabs when I start
the editor.

Thanks!

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: proposed patch, help wanted (style dialogs)

Paul Franklin-5
Here is the hoped-final version of the patch.

I played around for a while trying to see if I could make
the two style dialogs be non-modal, until I remembered that
since the parent was called from a modal ReportDialog that
the new ManagedWindow code would always make it be modal no
matter what the style dialog code said.

So the only changes from my earlier attachment are that the
two self.show() lines are moved higher, as PaulC suggested.

Thanks.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel

9795=styledialogs20170121A.patch (17K) Download Attachment