Monday, April 6, 2015

...after another, after another...

Ubuntu #3

So the problem trying to initialize the fonts was that when fonts.py read the monospaced font's size from QSettings, it got a string '13' instead of an int. Which QFont() didn't like, understandably. All I had to do was wrap an int() around it. Inexplicably, I had already done exactly that two lines earlier, for the general font's size value. Why didn't I do the same for the near-identical monospaced code? Anyway, that was easy.

Ubuntu #4

Next, playing around with PPQT run from source, I noted that there was no difference in the Word table sorting between the Respect Case switch on or off. That should be being handled by the natsort key generator. It works on Mac OS. I suspect that I will have to install the pyICU package, as I did on Mac OS.

Ubuntu #5

Also playing around I noted that there were only two misspelled words, and they were correctly spelled to my eye (ergo, the are probably in a bad-words list but I didn't check that), and when I added deliberate misspellings and nonsense words, and Refreshed the Word table, they didn't show up as misspelled.

What all that says is, the spell checking isn't working. When PPQT can't create a Hunspell object, it just silently passes all words as correct. Except those in the bad-words list. So I need to debug that.

Nuitka #2

Monday morning now. I sat down and tried to use Wing IDE to walk through the Nuitka code and set breakpoints where Kay suggested. Unfortunately, for some reason, the compiler starts out by re-invoking another copy of itself. And that copy of course doesn't see the breakpoints I set. So I had to insert print() statements instead. Which I did, enough to show, I hope, where the code goes wrong. It is trying to copy "qliboffscreen.dll" but has misplaced the full path to the source file. I put together a long note to Kay showing what I'd learned.

Ubuntu #1

Nobody had replied to my query to the Pyinstaller list about the bundled app dying trying to find something called "orig-prefix.txt". So I investigated further. Using Wing IDE's search in files method (could of course have use BBEdit's similar feature) I quickly found that "orig-prefix.txt" is a file that is only expected when running in a virtual environment. It's just a one-liner that the virtualenv command leaves in the local lib/ directory to point to the location of the original Python interpreter.

Ah, so that would be a difference from Mac OS; it is only in Ubuntu that I'm using virtualenv. So yes, fine, at the time that PyInstaller is bundling the app, it might need to look at this file. But there should be no need for it when actually running out of the bundle. It's completely irrelevant then. But something is looking for it.

Further investigation showed that what is happening is that the PyInstaller bootloader is in the process of loading all the built-in modules, and it hits one called site.py, apparently a standard, whose function is to initialize sys.path. That's suspicious right away, because in a bundled app, sys.path needs to be set up very particular ways by the PyInstaller bootloader. No generic module is going to get it right.

Anyway, this site.py has an attempt to open orig-prefix.txt about 5 lines in, not conditional, not in a try/except, just open that file by that name. That's very strange, because I don't think that file is normal to the standard Python implementation, only to virtualenv. I'm speculating that this is a version of site.py that is peculiar to virtualenv. In which case PyInstaller ought to know not to use it. PyInstaller has specific mention of virtualenv in its documentation, they recommend using it, so if it has this peculiarity, the developers ought to have known about it.

Anyway, I sent off a longer and more informative query to the PyInstaller list. Hopefully somebody will give me some guidance on this.

Ubuntu #4

Returned to the issue of sorting. It turns out since I went to the natsort package for sorting the Word table, the Respect Case sort is not behaving like it used to do. Back in the unnatural, or locale-not-aware days, these words would sort as follows:
['All','Ball','all','ball']
Now they sort as:
['All','all','Ball','ball']
and the only difference that turning off Respect Case (which adds the IGNORECASE option to the natsort key function) is to sort them like:
['all','All','ball','Ball']
and this (it turns out when I actually look) is true on MacOS as well as Ubuntu. So it isn't a bug, it's a feature.

It's a feature I could well do without, thankyouverymuch! It's very useful to be able to group all the uppercase initial words at one end of the list. That puts all the proper nouns together. Well it also mixes in among them, all the sentence-opening ordinary words: not only Arnold and Albuquerque, but also All and Any if they are capitalized. Anyway, I have written to Seth Morton, the natsort maintainer, to see if there is some way to restore the pure-ordinal behavior, while retaining the proper ordering of accented characters.

If there's no way to get that behavior back, I will add another filter, initial-cap, to the popup menu of filters.

Ubuntu #5

The spell checker is working perfectly now. I don't know what I saw Saturday, but it's gone now.

Mac OS #1

PyInstaller is working on Mac OS anyway, so I prepared a Mac bundle complete with the extras folder and a README and zipped it up and it came out to... 69 megabytes. Ye gods and little fishes! That is almost double the 39MB of the V1 bundle for Mac OS.

No comments: