it is the getting of the argument, from eg:

# part of declutter-pattern
WEIGHT 700
or ?
WEIGHT Bold     # as per documentation

=> "arg = 700"

that is not working, I think.

On Thursday, October 31, 2024 at 1:15:28 PM UTC [email protected] wrote:

> On Thursday, October 31, 2024 at 7:45:05 AM UTC-4 Thomas Passin wrote:
>
> Either of these work in the sense of executing without producing an 
> error.  I haven't tried applying the font to see the results:
>
> from leo.core.leoQt import QtGui, QtWidgets
> QFont = QtGui.QFont
>
> newfont = QFont('Georgia')
> newfont.setWeight(QFont.Weight.Bold)
> # or
> newfont.setWeight(700)
>
>
> Now I've tried it and yes, I do get bold text.  That detour with arg = 
> getAttr() isn't needed.
>  
>
>
> On Wednesday, October 30, 2024 at 2:58:37 PM UTC-4 jkn wrote:
>
> ... I see that the values for the Weight enum for QFont.setWeight() seem 
> to have changed for PyQt6. It is now a scale of 1 to 1000, instead of 1 to 
> 99 as previously.
>
> https://doc.qt.io/qt-6/qfont.html#Weight-enum
>
> Changing this in qt_tree helps:
>
> --- a/leo/plugins/qt_tree.py 
> +++ b/leo/plugins/qt_tree.py 
> @@ -307,7 +307,7 @@ class LeoQtTree(leoFrame.LeoTree): 
>             elif cmd == 'WEIGHT': 
>  
>                 def weight_modifier(item: Item, param: str) -> None: 
> -                    arg = getattr(QtGui.QFont, param, 75) 
> +                    arg = getattr(QtGui.QFont, param, 700) # WAS 75 
>                     font = item.font(0) 
>                     font.setWeight(arg) 
>                     item.setFont(0, font)
>
>

-- 
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/cda77400-7c08-40aa-94e4-d435367f6b28n%40googlegroups.com.

Reply via email to