QPainter error on OSX

171 views
Skip to first unread message

pmm...@gmail.com

unread,
Oct 9, 2014, 9:27:33 AM10/9/14
to leo-e...@googlegroups.com
Hi All,

I've been a long time on and off again user of Leo.  My main impediment to consistent use has been variable cross-platform support, especially on OSX.

With PyQT well supported in recent Anaconda python distributions I've been interested in trying to make Leo part of my workflow again.

Pulling the latest code from Github, Leo mostly seems to run fine, but at startup I get the following warnings:

Painter::begin: Paint device returned engine == 0, type: 2
QPainter::end: Painter not active, aborted
reading settings in /Users/pmagwene/tmp/leo-editor/leo/doc/CheatSheet.leo
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::end: Painter not active, aborted
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::end: Painter not active, aborted

The main visible consequence of this seems to be that the arrows indicating that a node is a clone don't show up.  Since clones are one of the major reasons I want to use Leo this is frustrating.

Here's what Anaconda tells me about the sip and PyQt versions I'm using:

sip 4.15.5 py27_0
-----------------
file name   : sip-4.15.5-py27_0.tar.bz2
name        : sip
version     : 4.15.5

pyqt 4.10.4 py27_0
------------------
file name   : pyqt-4.10.4-py27_0.tar.bz2
name        : pyqt
version     : 4.10.4


Thanks for any help or insights in fixing this!

Cheers,
Paul



Terry Brown

unread,
Oct 9, 2014, 11:31:24 AM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 06:27:32 -0700 (PDT)
pmm...@gmail.com wrote:

> Hi All,
>
> I've been a long time on and off again user of Leo. My main
> impediment to consistent use has been variable cross-platform
> support, especially on OSX.
>
> With PyQT well supported in recent Anaconda python distributions I've
> been interested in trying to make Leo part of my workflow again.

Glad to have you back.

> Pulling the latest code from Github, Leo mostly seems to run fine,
> but at startup I get the following warnings:

Seeing the latest code from Github changes throughout the day, it's
good to report the build info. from the top of the log pane. I just
pushed:

Leo 4.11 final, build 20141009102742, Thu Oct 9 10:27:42 CDT 2014
Git repo info: branch = master, commit = 4cbf1a4ee52c

If you can test that version, it probably won't fix the problem but
might help isolate it.

Thanks,
Terry

pmm...@gmail.com

unread,
Oct 9, 2014, 11:51:52 AM10/9/14
to leo-e...@googlegroups.com


On Thursday, October 9, 2014 11:31:24 AM UTC-4, Terry wrote:
On Thu, 9 Oct 2014 06:27:32 -0700 (PDT)
pmm...@gmail.com wrote:

> Hi All,
>
> I've been a long time on and off again user of Leo.  My main
> impediment to consistent use has been variable cross-platform
> support, especially on OSX.
>
> With PyQT well supported in recent Anaconda python distributions I've
> been interested in trying to make Leo part of my workflow again.

Glad to have you back.

> Pulling the latest code from Github, Leo mostly seems to run fine,
> but at startup I get the following warnings:

Seeing the latest code from Github changes throughout the day, it's
good to report the build info. from the top of the log pane.  I just
pushed:

Leo 4.11 final, build 20141009102742, Thu Oct  9 10:27:42 CDT 2014
Git repo info: branch = master, commit = 4cbf1a4ee52c

If you can test that version, it probably won't fix the problem but
might help isolate it.



Hi Terry,

Thanks for the fast response. I just pulled the latest code from GitHub. Here's what my log window now says:

Leo Log Window
Leo 4.11 final, build 20141009102742, Thu Oct  9 10:27:42 CDT 2014
Git repo info: branch = master, commit = 4cbf1a4ee52c
Python 2.7.8, PyQt version 4.8.6
darwin


With the latest code, the error message changed slightly (and it repeats many more times than the previous error):

/Users/pmagwene/.leo/workbook.leo
QPainter::begin: Paint device returned engine == 0, type: 2
Failed to init. painter for icon
QPainter::begin: Paint device returned engine == 0, type: 2
Failed to init. painter for icon
QPainter::begin: Paint device returned engine == 0, type: 2
Failed to init. painter for icon
QPainter::begin: Paint device returned engine == 0, type: 2
Failed to init. painter for icon 
... repeats >50 times (while previous error only repeated a couple ) ....

Thanks for your help,
Paul

Terry Brown

unread,
Oct 9, 2014, 12:49:06 PM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 08:51:52 -0700 (PDT)
pmm...@gmail.com wrote:

> Hi Terry,
>
> Thanks for the fast response. I just pulled the latest code from
> GitHub. Here's what my log window now says:

Ok, thanks for testing that, it does confirm that the problem was in
the obvious place, but I'm not really sure where to go from there,
although there are some Mac specific notes at

http://qt-project.org/doc/qt-4.8/qpainter.html

that might be relevant.

Cheers -Terry

Terry Brown

unread,
Oct 9, 2014, 12:50:21 PM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 06:27:32 -0700 (PDT)
pmm...@gmail.com wrote:

> pyqt 4.10.4 py27_0
> ------------------
> file name : pyqt-4.10.4-py27_0.tar.bz2
> name : pyqt
> version : 4.10.4

p.s. I assume there's no easy option to use Qt 5?

Not a definite fix, but worth trying if it's easy.

Cheers -Terry

Terry Brown

unread,
Oct 9, 2014, 1:02:34 PM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 11:50:19 -0500
"'Terry Brown' via leo-editor" <leo-e...@googlegroups.com> wrote:

> p.s. I assume there's no easy option to use Qt 5?
>
> Not a definite fix, but worth trying if it's easy.

But before you try that it looks like there might be some things to
explore with QImage vs QPixmap and GIF vs PNG... so just wait for a new
Leo update for now :)

Cheers -Terry

Terry Brown

unread,
Oct 9, 2014, 2:08:25 PM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 12:02:31 -0500
"'Terry Brown' via leo-editor" <leo-e...@googlegroups.com> wrote:

> On Thu, 9 Oct 2014 11:50:19 -0500
> "'Terry Brown' via leo-editor" <leo-e...@googlegroups.com> wrote:
>
> > p.s. I assume there's no easy option to use Qt 5?
> >
> > Not a definite fix, but worth trying if it's easy.
>
> But before you try that it looks like there might be some things to
> explore with QImage vs QPixmap and GIF vs PNG... so just wait for a
> new Leo update for now :)

Ok, Paul, can you try

Leo 4.11 final, build 20141009130420, Thu Oct 9 13:04:20 CDT 2014
Git repo info: branch = master, commit = b2871365a99e

I just pushed - it renders into a QImage instead of a QPainter, because
the 4.x Qt docs. say:

Please note that the bitwise raster operation modes, denoted
with a RasterOp prefix, are only natively supported in the
X11 and raster paint engines. This means that the only
way to utilize these modes on the Mac is via a QImage.

not really sure if that's relevant or not, but it seems worth a shot.

Cheers -Terry


pmm...@gmail.com

unread,
Oct 9, 2014, 3:22:09 PM10/9/14
to leo-e...@googlegroups.com
Hi Terry,

Thanks for giving it a shot. Unfortunately, the error type changed but I'm still getting a QPainter error.

QPainter::begin: Paint device returned engine == 0, type: 3
Failed to init. painter for icon
QPainter::end: Painter not active, aborted
reading settings in /Users/pmagwene/tmp/leo-latest/leo-editor/leo/doc/CheatSheet.leo
QPainter::begin: Paint device returned engine == 0, type: 3
Failed to init. painter for icon
QPainter::end: Painter not active, aborted
QPainter::begin: Paint device returned engine == 0, type: 3
Failed to init. painter for icon
QPainter::end: Painter not active, aborted


In desperation I installed Python3 and Qt/PyQT from Homebrew and it worked! 

Leo 4.11 final, build 20141006073153, Mon Oct  6 07:31:53 CDT 2014
Git repo info: branch = master, commit = d4f2b2bcbec3
Python 3.4.2, PyQt version 4.8.6
darwin

Since qmake tells me I'm using the exact same Qt version (4.8.6) with both the Anaconda install and the Homebrew install, I'm guessing the difference lies in the PyQt build (4.11.1 in the case of Homebrew, 4.10.4 in the case of Anaconda).

Thanks for your help,
Paul





Terry Brown

unread,
Oct 9, 2014, 3:35:20 PM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 12:22:09 -0700 (PDT)
pmm...@gmail.com wrote:

> In desperation I installed Python3 and Qt/PyQT from Homebrew and it
> worked!

Great. The latest changes seem to have broken PyQt 4.7, so I'm
wondering if you'd mind trying

https://github.com/leo-editor/leo-editor/archive/master@%7B2%20days%20ago%7D.zip

(i.e. Leo two days ago) to see if that works for you too. If not, we
can preserve the changes, but if it does work, they're probably not
needed.

That link leads to a .zip called
leo-editor-757daaf5d31f2c0abb6f18801cc7d23188ee035a.zip, FYI

Thanks,
Terry

pmm...@gmail.com

unread,
Oct 9, 2014, 3:54:17 PM10/9/14
to leo-e...@googlegroups.com
On Thursday, October 9, 2014 3:35:20 PM UTC-4, Terry wrote:
On Thu, 9 Oct 2014 12:22:09 -0700 (PDT)
pmm...@gmail.com wrote:

> In desperation I installed Python3 and Qt/PyQT from Homebrew and it
> worked!

Great.  The latest changes seem to have broken PyQt 4.7, so I'm
wondering if you'd mind trying

https://github.com/leo-editor/leo-editor/archive/master@%7B2%20days%20ago%7D.zip

(i.e. Leo two days ago) to see if that works for you too.  If not, we
can preserve the changes, but if it does work, they're probably not
needed.


Terry,

I can confirm that Homebrew Python3 with PyQt 4.11.1 works fine on the master from 2 days ago.

Another bit of detail.  If I build a fresh  Anaconda virtual environment using the conda package manager and install PyQt5, I can get Leo to work properly as long as I disable the quicksearch and stickynotes plugins.  In case anybody is interested in exploring this, here's the relevant commands:

conda create -n pyqt5 python  # creates the new conda environment
source activate pyqt5
conda install -c https://conda.binstar.org/dsdale24 pyqt5
# to deactivate the conda virtualenv do `source deactivate` 


Cheers,
Paul


 

Terry Brown

unread,
Oct 9, 2014, 4:01:08 PM10/9/14
to leo-e...@googlegroups.com
On Thu, 9 Oct 2014 12:54:17 -0700 (PDT)
pmm...@gmail.com wrote:

> Terry,
>
> I can confirm that Homebrew Python3 with PyQt 4.11.1 works fine on
> the master from 2 days ago.

Ok, so if we drop the changes from QPixmap to QImage which somewhat
surprisingly breaks 4.7, that works for you now because you're using
Python3 with PyQt 4.11.1? I'm not sure if all plugins work with Python
3.x, so I guess I'm inclined to see if I can make one more change that
fixes 4.7, despite what I just said here and IRC about reverting.

Cheers -Terry

pmm...@gmail.com

unread,
Oct 9, 2014, 5:36:05 PM10/9/14
to leo-e...@googlegroups.com
Just to confirm.

Python3 with PyQT 4.11.1 works with all recent builds, utilizing either QPixmap and Qimage. This is what I'll probably use for my day-to-day needs.

Anaconda Python 2.7 with PyQT 5.3.1 also works with recent builds as long as several plugins that assume PyQt4 are disabled.

Thanks again,
Paul
Reply all
Reply to author
Forward
0 new messages