sized_control and wx.lib.agw.aui

41 views
Skip to first unread message

Werner

unread,
Sep 28, 2012, 8:24:59 AM9/28/12
to wxpytho...@googlegroups.com
Hi (probably Kevin and/or Andrea;-) ),

I have a layout using aui and the dialog and all panels are
sized_control version of these controls, all works well until I try to
manually detach/float one of the panels, when I try to do this I get
this exception:

dexternalimp.py, line 1246, in <module>
dlg.ShowModal()
_windows.py, line 805, in ShowModal
return _windows_.Dialog_ShowModal(*args, **kwargs)
dexternalimp.py, line 1224, in onImportVintButton
self.newWineDialog(self.dbItem, xmlLog)
dexternalimp.py, line 1200, in newWineDialog
dlg.view.ShowModal()
_windows.py, line 805, in ShowModal
return _windows_.Dialog_ShowModal(*args, **kwargs)
framemanager.py, line 9210, in OnMotion
self.OnMotion_ClickCaption(event)
framemanager.py, line 9382, in OnMotion_ClickCaption
self.Update()
framemanager.py, line 6409, in Update
frame = self.CreateFloatingFrame(self._frame, p)
framemanager.py, line 4237, in CreateFloatingFrame
return AuiFloatingFrame(parent, self, pane_info)
framemanager.py, line 2887, in __init__
size=pane.floating_size, style=style, name="auiFloatingFrame")
_windows.py, line 1081, in __init__
_windows_.MiniFrame_swiginit(self,_windows_.new_MiniFrame(*args,
**kwargs))
sized_controls.py, line 617, in AddChild
SizedParent.AddChild(self, child)
sized_controls.py, line 488, in AddChild
item = sizer.Add(child)

self = wx.lib.sized_controls.SizedPanel instance
child = wx._windows.MiniFrame

A SizedPanel has a sizer, so I don't understand why at this point for
some reason the sizer is gone.

Appreciate any tips on what might cause this.

Problem can be recreated by detaching e.g. the lower left panel when
running the attached code.

Werner

P.S.
I am using wxPython 2.9.4.0.b20120623 on Python 2.7.2 and AGW hasn't
been updated for a few month - will try that later today).

P.S.2
Andrea, could we take up the AUI tutorial idea again?
auitut02.py

Werner

unread,
Oct 8, 2012, 4:36:57 AM10/8/12
to wxpytho...@googlegroups.com
Hi,
Have been digging a bit more on this problem.

In wx.lib.aui.framemanager.py from about line 6226 we have this:

# delete old sizer first
self._frame.SetSizer(None)

# create a layout for all of the panes
sizer = self.LayoutAll(self._panes, self._docks, self._uiparts,
False)

If self._frame is a sizedControl this removes its sizer which then
causes the above error. self.LayoutAll is creating a new sizer which
later on will be used for self._frame.SetSizer(sizer) but it is too late
if control is a sizedControl.

Any tip on how I should go about to come up with a patch for this?

Ideally AUI should leave the sizer(s) managed by SizedControl alone,
especially as AUI uses a BoxSizer when creating the new sizer which
might not be what was used in the SizedControl.

Werner

Werner

unread,
Oct 18, 2012, 9:38:36 AM10/18/12
to wxpytho...@googlegroups.com
Any one has a suggestion on how to fix this, besides adding an
additional panel to just hold the sized_control - pretty ugly:-( .

Werner

Werner

unread,
Jan 31, 2013, 6:07:50 AM1/31/13
to wxpytho...@googlegroups.com
Hi Andrea,

On 08/10/2012 10:36, Werner wrote:
I guess a work around would be not to allow floating.

What is the reason that the sizer gets deleted and then rebuilt?

Any suggestions on how this should be fixed?

Werner

Werner

unread,
Jan 31, 2013, 7:51:25 AM1/31/13
to wxpytho...@googlegroups.com
I can fix the above exception by using a wx.Panel for the panel AUI is
managing. So, maybe aui.SetManagedWindow should check that managed
window is not a sized control window.

Now I have another little problem. I float two panes and I close the
dialog they belong to, the panes stay there and don't close, nor can I
do anything with them if I open the dialog again, i.e. can't unfloat,
nor are they usable in any way.

How do I ensure that floated panes close?

Werner

Werner

unread,
Feb 1, 2013, 4:35:15 AM2/1/13
to wxpytho...@googlegroups.com
Hi Andrea,

I think there is no real need to support sized_control as the window
which is managed by AUI.

The following patch just ensures that people don't use it, as errors are
not certainly obvious when one does use it.

Werner
auiAndSized.patch

Werner

unread,
Feb 17, 2013, 5:45:06 AM2/17/13
to wxpytho...@googlegroups.com
Ping:), maybe this slipped down on your todo pile and fell off:)
Werner
--
You received this message because you are subscribed to the Google
Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to wxpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



auiAndSized.patch

Andrea Gavana

unread,
Feb 17, 2013, 6:42:28 PM2/17/13
to wxpytho...@googlegroups.com
On 17 February 2013 11:45, Werner wrote:
> Ping:), maybe this slipped down on your todo pile and fell off:)
> Werner
>
>
> Hi Andrea,
>
> I think there is no real need to support sized_control as the window which
> is managed by AUI.
>
> The following patch just ensures that people don't use it, as errors are not
> certainly obvious when one does use it.

Thank you for the patch, I have uploaded it in SVN for both Classic and Phoenix.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://www.infinity77.net

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# ------------------------------------------------------------- #
Reply all
Reply to author
Forward
0 new messages