agw.InfoBar - text layout issue

I still have a couple of issues with InfoBar.

1. I noticed the other day that InfoBar does not give available space to the text, i.e. I might end up with multiple lines even so there is enough space for the text.

I think it is due to the BoxSizer used, so I changed the sizer code in InfoBar.__init__ it to use a FlexGridSizer as follows:

         sizer = wx.FlexGridSizer(cols=4)
         sizer.AddF(self._icon, wx.SizerFlags().Centre().Border())
         sizer.Add(self._text, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
         sizer.AddStretchSpacer()
         sizer.AddF(self._button, wx.SizerFlags().Centre().Border())
         sizer.AddGrowableCol(1)
         self.SetSizer(sizer)

This is better, but now I have the problem that the text aligns to the top, instead of being in the vertical center of the IB, and I haven't figured out how to improve on that.

I tried to recreate this in the demo, but the behaviour is a bit different, i.e. the text is being cut off, and I can't figure out why it behaves differently, i.e. the text should go to multiple lines instead of being cut off.

2. When I use InfoBar on a dialog then I have the problem that it doesn't show, it actually stays hidden, I can make it show by calling dialog.Fit(), but this is not really what I like to do. Tried Layout/Update/Refresh and also sizer.SetItemMinSize but no success.

Note that when dialogs are initially started I do a Layout/Fit/SetMinSize and the user can then enlarge it as they like and then persist is resetting that size on next load.

Anyone has some other things I should try out?

Werner

Hi Werner,

I still have a couple of issues with InfoBar.

1. I noticed the other day that InfoBar does not give available space to the
text, i.e. I might end up with multiple lines even so there is enough space
for the text.

I think it is due to the BoxSizer used, so I changed the sizer code in
InfoBar.__init__ it to use a FlexGridSizer as follows:

   sizer = wx\.FlexGridSizer\(cols=4\)
   sizer\.AddF\(self\.\_icon, wx\.SizerFlags\(\)\.Centre\(\)\.Border\(\)\)
   sizer\.Add\(self\.\_text, 1, wx\.ALIGN\_CENTER\_VERTICAL|wx\.EXPAND\)
   sizer\.AddStretchSpacer\(\)
   sizer\.AddF\(self\.\_button, wx\.SizerFlags\(\)\.Centre\(\)\.Border\(\)\)
   sizer\.AddGrowableCol\(1\)
   self\.SetSizer\(sizer\)

This is better, but now I have the problem that the text aligns to the top,
instead of being in the vertical center of the IB, and I haven't figured out
how to improve on that.

I tried to recreate this in the demo, but the behaviour is a bit different,
i.e. the text is being cut off, and I can't figure out why it behaves
differently, i.e. the text should go to multiple lines instead of being cut
off.

Are you talking about wx.lib.agw.infobar? Because what I see in the
demo is the text wrapping as you enlarge/shrink the main frame window.

2. When I use InfoBar on a dialog then I have the problem that it doesn't
show, it actually stays hidden, I can make it show by calling dialog.Fit(),
but this is not really what I like to do. Tried Layout/Update/Refresh and
also sizer.SetItemMinSize but no success.

Can you build a minimalist sample using infobar in a dialog so I can
test what is going on? Assuming you are still talking about
wx.lib.agw.infobar.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 14 April 2012 17:24, Werner wrote:

Hi Andrea,

Hope you had a nice vacation.
  Are you talking about wx.lib.agw.infobar? Because what

I see in the
demo is the text wrapping as you enlarge/shrink the main frame
window.

2. When I use InfoBar on a dialog then I have the problem that it doesn't
show, it actually stays hidden, I can make it show by calling dialog.Fit(),
but this is not really what I like to do.  Tried Layout/Update/Refresh and
also sizer.SetItemMinSize but no success.
Can you build a minimalist sample using infobar in a dialog so I can
test what is going on? Assuming you are still talking about
wx.lib.agw.infobar.

Yes, it is agw.infobar.

Just renamed my changed version and did an update from SVN - (lots

of chances, did you work instead of enjoying the vacation).
For me it does not wrap,
checked that agw.infobar.py is correct one and I am running the
original code in the demo, can’t think of what else might be causing
this here.
Note that “long text the end” is not shown and the button is not
visible either.
I am running the wxPython 2.9.3.1 demo, are you on the same?
Werner

···

:wink:

:frowning:

Hi Werner,

Hi Andrea,

Hope you had a nice vacation.

Not bad, it was very relaxing :smiley:

Are you talking about wx.lib.agw.infobar? Because what I see in the demo
is the text wrapping as you enlarge/shrink the main frame window.

2. When I use InfoBar on a dialog then I have the problem that it doesn't
show, it actually stays hidden, I can make it show by calling dialog.Fit(),
but this is not really what I like to do. Tried Layout/Update/Refresh and
also sizer.SetItemMinSize but no success.

Can you build a minimalist sample using infobar in a dialog so I can
test what is going on? Assuming you are still talking about
wx.lib.agw.infobar.

Yes, it is agw.infobar.

Just renamed my changed version and did an update from SVN - (lots of
chances, did you work instead of enjoying the vacation :wink: ).

For me it does not wrap :frowning: , checked that agw.infobar.py is correct one
and I am running the original code in the demo, can't think of what else
might be causing this here.

I am running the wxPython 2.9.3.1 demo, are you on the same?

Yes, I am using 2.9.3.1 classic, on Windows 7 and Python 2.7.2. I attach a
couple of screenshots of what I am getting. I am not sure what the issue
may be here, as it appears we are doing exactly the same thing... are you
sure your demo is picking up the correct InfoBar/AGW stuff?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 22 April 2012 12:41, Werner wrote:

On 22/04/2012 12:03, Andrea Gavana wrote:

Hi Andrea,

···
          I am running the

wxPython 2.9.3.1 demo, are you on the same?

        Yes, I am using 2.9.3.1 classic, on Windows 7 and Python

2.7.2. I attach a couple of screenshots of what I am
getting. I am not sure what the issue may be here, as it
appears we are doing exactly the same thing… are you sure
your demo is picking up the correct InfoBar/AGW stuff?

Hi Andrea,

Attached is a smallish sample which shows the issue I have on a Dialog with InfoBar.

I wonder if I am doing something incorrect with regards on how I use the sized_controls, will keep debugging this thing and see if I can narrow it down.

Werner

infobardialogtest.py (2.05 KB)

Hi Werner,

Hi Andrea,

Attached is a smallish sample which shows the issue I have on a Dialog with
InfoBar.

I wonder if I am doing something incorrect with regards on how I use the
sized_controls, will keep debugging this thing and see if I can narrow it
down.

The infobar appears for me, the only issue I can see is that you have
to enlarge the dialog size (increase its height) in order to see the
infobar itself. I am not sure what is causing this, as I know nothing
of how sized_controls work. It probably is an issue with infobar
itself, but I'll try some simple sample *without* sized_controls and
see if anything changes.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 22 April 2012 15:09, Werner wrote:

Hi Andrea,

Hi Werner,

Hi Andrea,

Attached is a smallish sample which shows the issue I have on a Dialog with
InfoBar.

I wonder if I am doing something incorrect with regards on how I use the
sized_controls, will keep debugging this thing and see if I can narrow it
down.

The infobar appears for me, the only issue I can see is that you have
to enlarge the dialog size (increase its height) in order to see the
infobar itself. I am not sure what is causing this, as I know nothing
of how sized_controls work. It probably is an issue with infobar
itself, but I'll try some simple sample *without* sized_controls and
see if anything changes.

The sized_controls 'just' handle the sizer setup for you.

I created a second sample where I code the sizers by hand the same way the sc's do it (didn't bother with borders, but proportion, expand and sizer type are the same - unless I messed it up, but looking at it in the WIT it looks the same) and I see the same behaviour in both, i.e. the sizer does not resize to accommodate the InfoBar according to its status shown/not shown.

Can force it by doing a Fit on the Dialog but that is not really what I like to do as it "throws" away persist stuff.

Also tried with Layout/Refresh/Update on the different levels from the InfoBar up.

Looks like this is not really an InfoBar issue, more a sizer/dialog issue.

Anyone has an idea on how to have the InfoBar be visible by preferable enlarging the dialog and reducing size on hide.

Werner

infobardialogtestNoSC.py (2.68 KB)

infobardialogtest.py (2.13 KB)

···

On 22/04/2012 17:36, Andrea Gavana wrote:

On 22 April 2012 15:09, Werner wrote:

Hi,

I am still chasing two issues with agw.InfoBar.

1. the one on the dialog, where the dialog does not resize/layout

2. the incorrect wrap in some rare situations.

![deajiceh.png|575x41](upload://5WEnHAnXGtx7XslLhiXsh6a94bl.png)

I tried to reduce it but so far without any look.

When the above happens the InfoBar has:

- minsize(-1, -1)

- bestsize(246, 46)

- clientsize(1110, 46)

The AutoWrapStaticText has:

- minsize(-1, -1)

- bestsize(86, 45)

- clientsize(105, 45)

The spacer has:

size(845, 0)

I tried Layout, Refresh, Fit ...., but no success.

Anyone has any hint on how I can convince InfoBar to use the full

size for the AutoWrapStaticText widget.

Werner

Hi Andrea,

I am back on this issue and I have a fix, which I don't understand why it works but it does for me.

Change line 391 in wx.lib.agw.infobar.py from:

         sizer.Add(self._text, 2000000, wx.ALIGN_CENTER_VERTICAL)

to:

         sizer.Add(self._text, 200, wx.ALIGN_CENTER_VERTICAL)

The problem I had was that the spacer in the InfoBar took too much space and the message started to get wrapped to early, as can be see in the image below.

Actually any of the following proportion values work for me:
20, 200, 2000, 20000, 200000

but NOT 2000000

Werner

···

On 27/04/2012 11:43, Werner wrote:

Hi,

I am still chasing two issues with agw.InfoBar.

1. the one on the dialog, where the dialog does not resize/layout
2. the incorrect wrap in some rare situations.

I tried to reduce it but so far without any look.

When the above happens the InfoBar has:
- minsize(-1, -1)
- bestsize(246, 46)
- clientsize(1110, 46)

The AutoWrapStaticText has:
- minsize(-1, -1)
- bestsize(86, 45)
- clientsize(105, 45)

The spacer has:
size(845, 0)

I tried Layout, Refresh, Fit ...., but no success.

Anyone has any hint on how I can convince InfoBar to use the full size for the AutoWrapStaticText widget.

Werner
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I think I've seen an issue with very large proportion values before. There may be an overflow issue somewhere.

···

On 9/28/12 12:47 AM, Werner wrote:

Hi Andrea,

I am back on this issue and I have a fix, which I don't understand why
it works but it does for me.

Change line 391 in wx.lib.agw.infobar.py from:

         sizer.Add(self._text, 2000000, wx.ALIGN_CENTER_VERTICAL)

to:

         sizer.Add(self._text, 200, wx.ALIGN_CENTER_VERTICAL)

The problem I had was that the spacer in the InfoBar took too much space
and the message started to get wrapped to early, as can be see in the
image below.

Actually any of the following proportion values work for me:
20, 200, 2000, 20000, 200000

but NOT 2000000

--
Robin Dunn
Software Craftsman

Hi Werner,

Hi Andrea,

  I am back on this issue and I have a fix, which I don't understand

why it works but it does for me.

  Change line 391 in [wx.lib.agw.infobar.py](http://wx.lib.agw.infobar.py) from:



          sizer.Add(self._text, 2000000, wx.ALIGN_CENTER_VERTICAL)



  to:



          sizer.Add(self._text, 200, wx.ALIGN_CENTER_VERTICAL)



  The problem I had was that the spacer in the InfoBar took too much

space and the message started to get wrapped to early, as can be
see in the image below.

  Actually any of the following proportion values work for me:

  20, 200, 2000, 20000, 200000



  but NOT 2000000

Thanks for the analysis and the patch!! I have now committed your recommended fix to SVN.

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”

http://xoomer.alice.it/infinity77/

-------------------------------------------------------------

def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():

    send_message(email)
else:
    install_malware()
    erase_hard_drives()

-------------------------------------------------------------

···

On 28 September 2012 10:47, Werner wrote:

Hi Andrea,

···

On 28/09/2012 21:04, Andrea Gavana wrote:

Thanks for the analysis and the patch!! I have now committed your recommended fix to SVN.

You are just too fast.

Thanks
Werner