wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.34k stars 516 forks source link

InspectionTool crashes and cannot be recovered #2626

Closed komoto48g closed 3 weeks ago

komoto48g commented 1 month ago

Operating system: Windows 10 wxPython version & source: 4.2.2 (pypi) Python version & source: 3.12

Description of the problem: The wx.lib.inspection.InspectionTool crashed with Exception: "Bad perspective string" and cannot be displayed correctly again.

I haven't figured out what triggers this crash, but I found the workaround here: https://discuss.wxpython.org/t/inspectiontool-crashes-every-time/25805

Deleting the registry entry: [HKCU\Software\wxpyinspector\perspective] can solve this issue. However, an easier workaround would be preferable.

Traceback (most recent call last):
  ... (snip) ...
  File "C:\Python312\Lib\site-packages\wx\lib\inspection.py", line 105, in Show
    self._frame = InspectionFrame( parent=parent,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\wx\lib\inspection.py", line 201, in __init__
    self.LoadSettings(self.config)
  File "C:\Python312\Lib\site-packages\wx\lib\inspection.py", line 411, in LoadSettings
    self.mgr.LoadPerspective(perspective)
  File "C:\Python312\Lib\site-packages\wx\lib\agw\aui\framemanager.py", line 5291, in LoadPerspective
    pane = self.LoadPaneInfo(pane_part, pane)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\wx\lib\agw\aui\framemanager.py", line 5164, in LoadPaneInfo
    raise Exception("Bad perspective string")
Exception: Bad perspective string
komoto48g commented 4 weeks ago

This issue may be triggered when rolling back the wxPython version from 4.2.3a1 to 4.2.2. The perspective string that is generated by wxPython version 4.2.3a1:

layout2|name=info;caption=Object Info;minimode=1;state=134219520;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=100;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255|name=tree;caption=Widget Tree;minimode=1;state=134498300;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=280;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255|name=crust;caption=PyCrust;minimode=1;state=134481916;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255|dock_size(5,0,0)=202|dock_size(4,0,0)=239|dock_size(3,0,0)=160|

and 4.2.2:

layout2|name=info;caption=Object Info;state=134219520;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=100;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255|name=tree;caption=Widget Tree;state=134498300;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=280;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255|name=crust;caption=PyCrust;state=134481916;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=200;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255|dock_size(5,0,0)=202|dock_size(4,0,0)=239|dock_size(3,0,0)=160|

As a result, the new key minimode is considered an invalid perspective string.

swt2c commented 3 weeks ago

Seems to be because of this change: https://github.com/wxWidgets/Phoenix/commit/4115dd8b06b47090cd49fe6f1989f05881522745