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.
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.