On Friday, November 1, 2024 at 5:52:08 AM UTC-4 jkn wrote:

Actually, assuming that the getattr() call *can* return a value in some 
circumstances, mumble mumble stylesheets, then presumably this is the fix?

                def weight_modifier(item: Item, param: str) -> None:
                    # attempt to turn eg 'Bold' into a stylesheet-derived 
value
                    arg = getattr(QtGui.QFont, param, None)


I've got it.  My brain finally woke up.  Here's what will make it work 
(tested):

arg = getattr(QtGui.QFont.*Weight*, param,  QtGui.QFont.Weight.Medium )

There's no need to build the translation mapping because if the *param* 
doesn't match in the getattr()call, it won't match in the mapping, either. 
I suppose you could try spell-checking against the weight names, but that's 
got to be overkill, doesn't it?  Go ahead (after trying it out) and put in 
an issue for this fix if you would.

This is a typical Qt5 -> Qt6 problem. They changed the location of many of 
the enums. I expect that this won't be the last to be found.

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/08a21ce8-4cba-4624-8178-496cdd388103n%40googlegroups.com.

Reply via email to