Dialogs are collapsed by default

Bug #407357 reported by Christian González
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNUmed
Fix Released
Medium
shilbert

Bug Description

What I've seen since some versions of gnumed, is that many dialog windows, when they are started, are the smallest size they can be - you can't see any content in them and have to resize them to work with them.
Examples are:
* Kaptain Kirk -> Patient details -> Identity -> at upper list (names), press "+Add" button -> the dialog looks like in attached screenshot
* lower list as well (new external ID)
* same in Contacts, and many, many dialogs more.

maybe this is no gnumed related problem, as I could not find any problems in my quick overview of the code (although I am bad in Python and know even worse of wxWidgets) - but maybe the problem's related to wx?

Revision history for this message
Christian González (droetker) wrote :
Revision history for this message
shilbert (sebastian-hilbert) wrote : Re: [Bug 407357] Re: Dialogs are collapsed by default

Am Freitag 31 Juli 2009 15:55:45 schrieb Christian A. Reiter:
> ** Attachment added: "Screenshot of the collapsed dialog"
> http://launchpadlibrarian.net/29750841/Screenshot.png

I guess it has something to do with the size calculations. See here:

http://docs.wxwidgets.org/stable/wx_sizeroverview.html

Maybe one could use the sample you provided and set a minimum size. If that
holds true it is a very nice way for a beginner to get to know the code.

Sebastian

Revision history for this message
shilbert (sebastian-hilbert) wrote :

Am Freitag 31 Juli 2009 16:40:26 schrieb shilbert:
> Am Freitag 31 Juli 2009 15:55:45 schrieb Christian A. Reiter:
> > ** Attachment added: "Screenshot of the collapsed dialog"
> > http://launchpadlibrarian.net/29750841/Screenshot.png
>
> I guess it has something to do with the size calculations. See here:
>
Digging around in the code I found a few places to get started.
in wxGladeWidgets there is wxgExternalIDEditAreaPnl.py which is generated from
wxglade.

It houses a panel which has problems calculating a minimal size. When adding
self.SetMinSize((256, 154)) in __set_properties(self) it displays the text
fields ok but still hides the buttons.

Setting SetMinSize to 456,254 shows it large enough to house all controls.

The next file to look at is the gmDemographicWidgets.py which opens the dialog
on pressing 'Add'.

There is a helper function _add_id(self) which takes care of that. It calls a
gmEditArea instance so this should be the site to tackle.

Diving into gmEditArea I find a class cGenericEditAreaDlg derived from
wxgGenericEditAreaDlg

So I take a good look at wxgGenericEditAreaDlg

When I set self.SetMinSize((450, 280)) in __set_properties(self) it displays
the controls ok. As a benefit it displays all dialog that derive from
GenericEditAreaDlg large enough.

Mission accomplished.

Sebastian

Revision history for this message
shilbert (sebastian-hilbert) wrote :

Am Samstag 01 August 2009 10:45:16 schrieb shilbert:
> Am Freitag 31 Juli 2009 16:40:26 schrieb shilbert:
> > Am Freitag 31 Juli 2009 15:55:45 schrieb Christian A. Reiter:
> > > ** Attachment added: "Screenshot of the collapsed dialog"
> > > http://launchpadlibrarian.net/29750841/Screenshot.png
> >
> > I guess it has something to do with the size calculations. See here:
>
> So I take a good look at wxgGenericEditAreaDlg
>
> When I set self.SetMinSize((450, 280)) in __set_properties(self) it
> displays the controls ok. As a benefit it displays all dialog that derive
> from GenericEditAreaDlg large enough.

While this is one way to fix it it breaks the use of wxglade. For some reason
wxglade uses SetSize and not SetMinSize.

The dialog is not having a large enough size when using SetSize.

Manually editing the file wxgGenericEditAreaDlg will break things next time
this file is overwritten by wxglade.

To overcome this we need to make use of the files 'extra properties' for the
file wxgGenericEditAreaDlg.wxg

There use 'SetMinSize' for 'Property' and '(450, 280)' for 'Value'. That way
it will appear in the code during generating the *.py files

Sebastian

Revision history for this message
shilbert (sebastian-hilbert) wrote :

Am Samstag 01 August 2009 12:19:49 schrieb shilbert:

> There use 'SetMinSize' for 'Property' and '(450, 280)' for 'Value'. That
> way it will appear in the code during generating the *.py files

The property needs to be 'MinSize' , not 'SetMinize' since wxglade add 'Set'
as a prefix automatically

Sorry for that one :-)

Sebastian

Changed in gnumed:
assignee: nobody → shilbert (sebastian-hilbert)
importance: Undecided → High
status: New → Confirmed
status: Confirmed → Fix Committed
Revision history for this message
ncq (karsten-hilbert) wrote :

> > I guess it has something to do with the size calculations. See here:
> >
> Digging around in the code I found a few places to get started.
> in wxGladeWidgets there is wxgExternalIDEditAreaPnl.py which is generated
> from
> wxglade.
>
> It houses a panel which has problems calculating a minimal size. When
> adding
> self.SetMinSize((256, 154)) in __set_properties(self) it displays the text
> fields ok but still hides the buttons.

While this approach is technically correct it is nearly useless: the
next time that dialog is recreated your manual change will be over-
written and forgotten to be re-added.

Yes, there is a way to not make it be forgotten: place it outside
the markers which wxGlade leaves behind (after them, in this case)
but that is an ugly hack only to be used when *nothing else* works.

I am fairly sure that some creative setting of sizes and clicking
MinAdjustSize or whatever inside wxGlade will fix this, too, but
I haven't been able to take the time to see it through.

Alternatively it may be possible to resized/refit/relayout things
in the classes derived from the wxg* classes.

Also, on my platform, I rarely see the problem (I do see it, however).

> The next file to look at is the gmDemographicWidgets.py which opens the
> dialog
> on pressing 'Add'.
>
> There is a helper function _add_id(self) which takes care of that. It
> calls a
> gmEditArea instance so this should be the site to tackle.
>
> Diving into gmEditArea I find a class cGenericEditAreaDlg derived from
> wxgGenericEditAreaDlg
>
> So I take a good look at wxgGenericEditAreaDlg
>
> When I set self.SetMinSize((450, 280)) in __set_properties(self) it
> displays
> the controls ok. As a benefit it displays all dialog that derive from
> GenericEditAreaDlg large enough.
>
> Mission accomplished.

Lovely ! Good work ! Please do commit it.

Please do try to find a way to not do it in wxgGenericEditAreaDlg but
rather in cGenericEditAreaDlg, however ...

And claim the fame to fixing the bug, too !

Karsten
--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

Revision history for this message
ncq (karsten-hilbert) wrote :

> While this is one way to fix it it breaks the use of wxglade. For some
> reason
> wxglade uses SetSize and not SetMinSize.
>
> The dialog is not having a large enough size when using SetSize.
>
> Manually editing the file wxgGenericEditAreaDlg will break things next
> time
> this file is overwritten by wxglade.

Indeed.

> To overcome this we need to make use of the files 'extra properties' for
> the
> file wxgGenericEditAreaDlg.wxg
>
> There use 'SetMinSize' for 'Property' and '(450, 280)' for 'Value'. That
> way
> it will appear in the code during generating the *.py files

I'm impressed. Hehe :-)

Karsten

--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

Revision history for this message
Christian González (droetker) wrote :

I don't know the layout "manager" of wx, but the two dialogs I mentioned were just examples, in fact many are collapsed, at least under my Ubuntu.
Is tehre (within wx) a possibility (like under Qt) to automatically determine the size depending on the content? (I think not...)

Revision history for this message
ncq (karsten-hilbert) wrote :

> I don't know the layout "manager" of wx, but the two dialogs I mentioned
> were just examples, in fact many are collapsed, at least under my Ubuntu.
> Is tehre (within wx) a possibility (like under Qt) to automatically
> determine the size depending on the content? (I think not...)

There surely is and that's what the default behaviour is, too.

However, at the time the wx system does the initial calculation it
cannot yet know the final size because we use a generic container
dialog wrapping all sorts of panels. Those panels can be of any size
and get re-parented into the generic dialog wrapper after the fact.

There's bound to be some way involving Self.Layout() or some such
forcing a (wx-internal) Re-Layouting after inserting the specific
panel but I haven't gotten around to spending the time on tracking
that down. Primarly because for some reason under Debian there's
hardly any dialog that's getting the size wrong.

Karsten
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Revision history for this message
ncq (karsten-hilbert) wrote :

0.5.rc5

Changed in gnumed:
importance: High → Medium
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.