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)
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)
>
> but I think this cannot be the whole story. As mentioned, I previously had
>
> WEIGHT Bold
>
> as per the documentation
> https://leo-editor.github.io/leo-editor/customizing.html#style-lines
>
> should I actually be using a number here?
>
> Thanks, J^n
>
>
>
> On Wednesday, October 30, 2024 at 3:58:51 PM UTC jkn wrote:
>
>> Hi all
>> I've just upgraded to PyQt6 (v6.7.3, on Linux), so that I could run a
>> more recent Leo with the new layouts.
>>
>> That is going OK, but my tree-declutter settings appear not to be working
>> any longer.
>>
>> ie: I have a pattern which sets
>>
>> WEIGHT Bold
>>
>> and this is not having the desired effect on the node headline. the
>> 'matching' pattern at the front is not being displayed, so that part is
>> working.
>>
>> I note that another tree-declutter pattern, with both colour and weight
>> changes:
>>
>> FG red
>> WEIGHT Bold
>>
>> is showing the red, but not the bold...
>>
>> Do I need to update another part of PyQt to re-instate this behaviour?
>>
>> Thanks, Jon N
>>
>
--
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/193756cd-511d-4a3e-b3bc-23ee6db8009bn%40googlegroups.com.