Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long exceptions resize window #409

Open
snoyer opened this issue Aug 27, 2023 · 0 comments
Open

Long exceptions resize window #409

snoyer opened this issue Aug 27, 2023 · 0 comments

Comments

@snoyer
Copy link
Contributor

snoyer commented Aug 27, 2023

Exceptions with long messages will resize the "Current traceback" panel/widget, and, in turn, resize the whole application window.

Reproduction: raise ValueError("really "*64 + "long message")

cq-editor-before-exc
cq-editor-after-exc

Now obviously this is a made up example and stuff like that never happens in real life, right?

Well... pick any OCC method with a few overloads and call it wrong with cq's OCP package, OCP will helpfully list the overloads on multiple line in the exception message.

from OCP.ShapeExtend import ShapeExtend_WireData
ShapeExtend_WireData().Add("blah")
Traceback (most recent call last):
  File "/tmp/err.py", line 2, in <module>
    ShapeExtend_WireData().Add("blah")
TypeError: Add(): incompatible function arguments. The following argument types are supported:
    1. (self: OCP.ShapeExtend.ShapeExtend_WireData, edge: OCP.TopoDS.TopoDS_Edge, atnum: int = 0) -> None
    2. (self: OCP.ShapeExtend.ShapeExtend_WireData, wire: OCP.TopoDS.TopoDS_Wire, atnum: int = 0) -> None
    3. (self: OCP.ShapeExtend.ShapeExtend_WireData, wire: OCP.ShapeExtend.ShapeExtend_WireData, atnum: int = 0) -> None
    4. (self: OCP.ShapeExtend.ShapeExtend_WireData, shape: OCP.TopoDS.TopoDS_Shape, atnum: int = 0) -> None

Invoked with: <OCP.ShapeExtend.ShapeExtend_WireData object at 0x7f083cb08cb0>, 'blah'

...all of which ends up a single looooooooooooooong line in cq-editor
cq-editor-after-ocp-exc


Maybe there's some Qt options so the widget would clip the text instead of resizing itself?
Or if that's not possible the message should be truncated at an arbitrary length before displaying?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant