Today I meant to tear into both the Book and Mainwindow modules for major changes. As mentioned in Friday's post, mainwindow needs to stop keeping track of files as a dictionary {filename:path-to-file}. Instead, I worked out over the weekend, it must keep lists strictly of entire, absolute (non-relative) path-strings. Nevertheless, there are often times when the code, given a filepath, needs to get the basename from it and similar tasks handled, in Python, by members of os.path. There is an interesting comparison to be drawn between the facilities of os.path and Qt's QFile, QDir, and QFileInfo. Perhaps I'll find time to get into that tomorrow.
Because today I sat down at my desktop machine with its Cinema Display to do some development there. Most of the coding I've done so far this year has been performed slouched on my spine with my laptop on my tummy. But for making major changes spread over two biggish files, I wanted the big screen, better keyboard, and trackball of the desktop machine.
Almost immediately this ran into problems. Running any kind of test produced, first, an error on import regex, the extended regular expression module. Oh. Hadn't installed that on the big machine. Ok, do that: and then followed a half hour's digression attempting to get easy_install (misnomer!) and pip (it's not a pip) to work, and finally downloading the module from pypi and manually running its setup.
Restart and immediately... No module named hunspell. Oh, right. I never installed the hunspell interface on this machine. So do that. Almost immediately after, No module named blist. Oh. Right. So back to pypi and get the blist package and install it, and it produces a baffling error message. Its __init__.py imports blist._blist which is right there next to blist itself but Python can't seem to find it. In trying to figure that one out, I happened to notice that in /Library/Frameworks/Python/Versions, the link Current pointed to 2.7, not to 3.3, although 3.3 is being used. Hmm. sudo rm Current and suddenly blist imports like a charm.
Well, all righty then. Back to trying to run book_test. Oops, an error from code that's been working for weeks,
self.scroll_area.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
...produces an error, "QScrollArea object has no member setSizeAdjustPolicy. Well, it certainly does, or I wouldn'a coded it. Verify that by looking in the Qt Assistant. Yup, there it is, oh wait, "added in Qt 5.2". Ooooohhhh. Hastily enter in the Wing IDE Python window,
from PyQt.Qt import PYQT_VERSION_STR PYQT_VERSION_STR '5.1.1'
So although this machine has Qt 5.2, it has a back-level PyQt. Which means, it's time to upgrade the machine to PyQt/Qt 5.3. Download the latest Qt, Sip, PyQt, run their configure, make, and install steps. And there goes most of the rest of the afternoon. Sure glad I don't have an anxious manager wanting to know if I'm going to meet my delivery goal...
No comments:
Post a Comment