Here is how I configured my installation to let me either use or not use 
pyqt6. Obviously it's a Windows computer:

1. Create new directory.  I used %USERPROFILE%\.python\site-packages
2. Cut all the installed pyqt6 directories from the standard 
Lib\site-packages directory.
3. Paste the pyqy6 directories into the new .python\site-packages directory.

To run without pyqt6, I just launch Leo as usual.  To run using pyqt6, I 
set the PYTHONPATH environmental variable:

set PYTHONPATH=%USERPROFILE%\.python\site-packages

Now Leo will launch using pyqt6.

If you have copied all the pyqt6 install directories also, then pip will 
find them and be able to properly list pyqt6 as well as the pyqt5  that is 
in the standard location.
On Monday, April 12, 2021 at 5:24:50 PM UTC-4 [email protected] wrote:

> Typo:
> NoFrame = QtWidgets.QFrame.Shape.NoFrame if isQt6 else self.noFrame
>
> should be
>
> NoFrame = QtWidgets.QFrame.Shape.NoFrame if isQt6 else self.NoFrame 
>
> With this correction, it runs when only qt5 is available.
> On Monday, April 12, 2021 at 2:59:44 PM UTC-4 [email protected] wrote:
>
>> I got qt_text to work - at least on the surface - with these changes:
>>
>>             Sunken = QtWidgets.QFrame.Shadow.Sunken if isQt6 else 
>> self.Sunken
>>
>>         Raised = QtWidgets.QFrame.Shadow.Raised if isQt6 else 
>> self.StyledPanel
>>         NoFrame = QtWidgets.QFrame.Shape.NoFrame if isQt6 else 
>> self.noFrame
>>         self.setFrameStyle(Raised | Sunken)
>>         self.edit = e  # A QTextEdit
>>         e.setFrameStyle(NoFrame)
>>
>> Then I also needed to change in update():
>>
>>                    #width = self.fm.width(str(max(1000, 
>> self.highest_line))) + self.w_adjust
>>         if isQt6:
>>             width = self.fm.boundingRect(str(max(1000, 
>> self.highest_line))).width()
>>         else:
>>             width = self.fm.width(str(max(1000, self.highest_line))) + 
>> self.w_adjust
>>         if self.width() != width:
>>             self.setFixedWidth(width)
>>
>> With these changes. Leo opens outlines without crashing.  I notice that 
>> the gutter numbers have too much padding-left, so they are cut off on the 
>> right.  I don't know where that is set, so I didn't do anything about it.
>>
>> If you want, I can push these changes to my branch and do a PR.  It's 
>> probably easier for you to jsut copy them into yours.  Just let me know if 
>> you want the PR.
>>
>> Next up: VR3 won't load because
>>
>> viewrendered3.py requires QtWebKitWidgets.QWebView
>> pip install PyQtWebEngine
>>
>> But how to get this without stepping on the one for qt5?  Hmmm.
>>
>> On Monday, April 12, 2021 at 1:57:39 PM UTC-4 [email protected] wrote:
>>
>>> It failed because 
>>> LeoLineTextWidget' object has no attribute 'StyledPanel
>>>
>>> as expected ...
>>> On Monday, April 12, 2021 at 1:03:57 PM UTC-4 Edward K. Ream wrote:
>>>
>>>> On Monday, April 12, 2021 at 11:55:03 AM UTC-5 [email protected] wrote:
>>>>
>>>> Without testing it I don't think that will work. 
>>>>>
>>>>
>>>> From https://doc.qt.io/qt-6/qframe.html#details "The frame style is 
>>>> specified by a frame shape 
>>>> <https://doc.qt.io/qt-6/qframe.html#Shape-enum> and a shadow style 
>>>> <https://doc.qt.io/qt-6/qframe.html#Shadow-enum> that is used to 
>>>> visually separate the frame from surrounding widgets. These properties can 
>>>> be set together using the setFrameStyle 
>>>> <https://doc.qt.io/qt-6/qframe.html#setFrameStyle>() function..."
>>>>
>>>> The only way to know for sure is to test it. The qt6 documentation has 
>>>> proved unreliable in the past.
>>>>
>>>> Edward
>>>>
>>>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/leo-editor/3f9f3c39-678b-4b22-b1a2-183ab0e04cb9n%40googlegroups.com.

Reply via email to