sized_control and wx.lib.agw.aui

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 (7.18 KB)

Hi,

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.

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

···

On 28/09/2012 14:24, Werner wrote:

Any one has a suggestion on how to fix this, besides adding an additional panel to just hold the sized_control - pretty ugly:-( .

Werner

···

On 08/10/2012 10:36, Werner wrote:

Hi,

On 28/09/2012 14:24, Werner wrote:

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.

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

Hi Andrea,

···

On 08/10/2012 10:36, Werner wrote:

Hi,

On 28/09/2012 14:24, Werner wrote:

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.

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.

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

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

···

On 31/01/2013 12:07, Werner wrote:

Hi Andrea,

On 08/10/2012 10:36, Werner wrote:

Hi,

On 28/09/2012 14:24, Werner wrote:

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.

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.

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?

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 (605 Bytes)

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.

Werner

auiAndSized.patch (605 Bytes)

···

--
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-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

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

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