Nuitka: Nuitka does compile Cobro to an executable in a folder full of libs, and it runs just lovely. That's a win, but not a complete victory. First thing I did was to copy that folder to a USB stick and plug it into my laptop, which does not have the same level of libs on it. And it immediately failed trying to import Qt modules from the fixed path to the Qt distribution folder on the dev system. In other words, the copied libs have not been relativized.
There is code in the Nuitka compiler to do this. I could see it, and I inserted print statements (nice to have a compiler in source code one can hack on) to verify that it was being called, but only once, to relativize the links in the compiled cobro.exe. It also needs to be applied to every copied DLL. I wrote to the Nuitka dev list with this report. No reply as of today.
When that one thing is fixed, I will proceed to try to build a Mac App folder from it. Basically that's a folder with the .app suffix and some child folders like Frameworks, Resources, and Contents. Rather than try to educate myself on exactly what should be where in an app folder, I plan to pick a simple app, copy it, and basically replace its contents with the contents of the Nuitka output ("dist") folder.
PyInstaller: PyInstaller is capable of building a Mac App, and I tried doing that with Cobro. However, it ignored the options that should cause it to build one (--onefile --windowed). So maybe that feature isn't supported yet in the Python3 version? I wrote to its list to ask.
QWebEngineView: I did the really quite simple modification of Cobro to use QWebEngineView in place of QWebView. And ran it and... no messages! The QWebEngine browser does not produce any of the yucky incomprehensible stderr messages that QWebKit does. So that settles that; I shall have to use QWebEngine regardless of its shortcomings and missing features.
When I did this the first time I noted several missing features, and started a little string on the QWebEngine mailing list about them. But today I found yet another one. Although QWebEngineView claims to be a descendant of QWidget, it apparently does not support the keyPressEvent() handler. My QWebView-based widget had a keyPressEvent handler that worked quite well. In it, I trapped ctl-plus and ctl-minus to implement zooming, and ctl-[ and other keys for the "back" function. Same widget layout, only replacing the parent class, but control never enters my key event handler. So I wrote a query to the QWebEngine list asking about that.
I also had to change some of the code that sets up the Cobro fonts. It changes the font of the names of comics in the list to show their status, with bold for the ones that the user hasn't read yet. But suddenly, it didn't do that; NEWCOMIC status was not reflected in bold type. I proved to myself that the status was being set, and that the QListView was calling its list model's data() function for the Font role, and that the data() function was returning the QFont that had been prepared for the NEWCOMIC status as appropriate. But that wasn't bold.
The code couldn't be simpler. Given that qf is a QFont derived from the desired family (Comic Sans, of course), then:
FONTLIST[NEWCOMIC] = QFont(qf) FONTLIST[NEWCOMIC].setWeight(QFont.Bold)
That used to work. Now it didn't. Just to verify everything else was working as expected I changed it to
FONTLIST[NEWCOMIC] = QFont(qf) FONTLIST[NEWCOMIC].setUnderline(True)
Bingo, all unread comics showed up in the list with underlines. So the font was being set and given to the list view and applied. But setting the weight didn't make it bold. Well then,
FONTLIST[NEWCOMIC] = QFont(qf) FONTLIST[NEWCOMIC].setBold(True)
Nope. No boldness. The only thing that worked was to derive a bold variant direct from the QFontDatabase, so:
FONTLIST[NEWCOMIC] = fdb.font(family,'BOLD',16)
That got a bold QFont that displayed as bold. I have no idea why that was necessary.
Next, pending developments from Nuitka, I return to PPQT2 and finish up the Word panel Edit menu.
After writing the above, I spent another 2 hours configuring my Ubuntu 64-bit development VM with Python3.4, Qt5.4, Sip and PyQt5.4. Installed everything separately from the Ubuntu /usr tree, in my home directory and using a VirtualEnv. This because an earlier attempt to upgrade the installed PyQt caused the Ubuntu "Software Center" to quit working. It apparently has dependencies on the installed Python2 and PyQt4; change those in any way and it fails to launch with no message. So this time I've sandboxed my dev environment.
At the end, it wasn't finding PyQt5 to import it. But my brain is fried and I'm quitting for the day.
No comments:
Post a Comment