chiark / gitweb /
editor: put all the Tk work into a class.
authorSimon Tatham <anakin@pobox.com>
Sun, 13 Oct 2024 09:36:22 +0000 (10:36 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Sun, 13 Oct 2024 14:04:53 +0000 (15:04 +0100)
commit384c5a305c305e6d7075b68431bcf64cce38fe1c
treeaddf6614655c3d07fc6267bcd011784c53f690fe
parentcfab21f7a7e9dec99ebfbdfe42bd1376c250cc69
editor: put all the Tk work into a class.

The previous code organisation had a tiny 'Container' classlet that
held all the mutable variables, just so that all the event handler
functions could reach into it and modify it without having to faff
with 'global'.

But if you're going to make that much of a class, it makes more sense
to go further, and make all those functions _methods_ of the class. So
here's a reorganisation that wraps up the Tk code into a more or less
conventional class structure.

The patch for this commit looks like a total rewrite, but it's not
really: everything is indented further to the right (with a couple of
reflowings of long lines), and a lot of variables have a new 'self.'
on the front, but in other respects the code is substantially
unchanged.
editor