Embed Ace editor in a Python QT app

QT is an amazing framework, made all the more useful by having delightful Python bindings. QT supplies powerful tools to integrate host code with Javascript (web) frameworks, but they can be tricky to get started with. I wanted to integrate the Ace editor (written in Javascript) into my desktop Python program. Could I do it? …

Advertisements

Some macOS + Pyside2 tips

A live document, from the school of hard knocks ... Get macOS to use a fixed width font: setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) Get QTabWidget to have tabs on the left side and looking "professional" self.setDocumentMode(True) An epic can be written about the confusing behavior of menus on macOS, but the main reading material is https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar menu.setNativeMenuBar(False) # We …

Python3: subclassing int

Lying awake at night, existential questions cross your mind. What is my purpose? Is there a god? Can you subclass a Python3 int? Only the last one has an answer. You can indeed subclass an int, but there are a few subtleties. In short, in Python3 depending on whether the built in type is immutable …

Mixins!

Mixins are classes which are not meant to be used by themselves but instead are meant to be combined with other mixins on top of a base class to extend the functionality of that class. They are a great way to modularize code and make class features compose-able. Mixins are best explained using a simple …

Tests and code coverage in Python

Not only is Python a nice language but it has always had a lot of tooling around it. I've always taken advantage of Python's tooling around testing (okay, not always ...) and recently I began to pay attention to code coverage again. Python makes it all so simple and delicious. I have used nose in …

The wonder of c++ static analysis

I was working on some C++ code, much like the one in this screen shot, when once again my IDE told me about some issue it had found with the code. The messages appear milli-seconds after I type some code in convenient tooltips placed in context.  The messages are succinct, precise and usually contain enough information …