DEV Community

Cover image for Pycraft progress report
Tom Jebbo
Tom Jebbo

Posted on

Pycraft progress report

Hello there! Welcome to the third weekly summary of Pycraft progress!

Last week we started looking at how to add in translations to Pycraft, and had written two new modules, one for text formatting and one for translating text, this week we applied these modules for the first time to Pycraft as part of our 3-stage rollout:

Stage 1 consists of trying the new feature out on a single area of Pycraft, for translations this was the title “Pycraft” on the home screen. This will indicate any serious problems with our implementation. Fortunately for us, this went relatively smoothly – and this being the first time actually trying this in Pycraft we were pleased with just how well it went.

Stage 2 consists of applying the feature to an entire GUI, in this case the entire home screen. This starts to test how flexible the program is and unveils more minor bugs. In the case of translations for Pycraft, this is where we started to see some unexpected behaviour. But at this stage unexpected behaviour is ok, as it's what we want to see now. At this stage we can still relatively easily make changes to the implementation before we roll it out globally. And we are very happy we did this because there were some minor things we added in at this stage, like better logging and support for error messages – as well as a more intelligent way of figuring out if something is wrong. That would have been harder to add in later.

Stage 3 consists of rolling out this few features everywhere before rigorously testing it to make sure it works as expected everywhere.

This week In Pycraft we managed to get all 3 stages done, which was a great achievement. Although we pretty quickly realised a problem. Support for other alphabets like Cyrillic, Greek and Latin. The font we are using for Pycraft; “Book Antiqua”, does not support anything but the most common non-English characters, so we needed to identify a solution. No matter what we did at this stage, the solution wouldn’t be ideal, simply because Pycraft is so large that changing fonts would be very time consuming and introduce bugs. So naturally we chose the longest possible option, but we feel that it was the best choice. But before that, let's talk a bit about how Pycraft decides to use a different font.

Pycraft’s default font (“Book Antiqua”) supports only the English alphabet, so we chose an additional font from Google Fonts (called “Noto Sans”) which supports over 800 languages. This does significantly increase the size of the fonts folder in Pycraft, but it does a great job at filling in some of the missing characters. Because of the necessity to use two fonts, we had to make changes to how fonts get loaded.

Previously to Pycraft v0.9.6-3 we loaded up fonts individually when they were needed for each GUI in Pycraft. This isn’t ideal because it means making changes like this is tricky and more complicated than it needs to be, and it also adds unnecessary calls to Pycraft’s folder, and also slows down GUI loading. We identified that we only use a few sizes of font, mainly 60, 35, 30, 25, 20 and 15. So we load these fonts now at start-up, instead of when every GUI loads. We also load two fonts, “Book Antiqua” and “Noto Sans” in those sizes. Then the text rendering module we created last week can intelligently decide which one supports more characters and render text with the most ideal font.

This works very well and adds support to the 3 alphabets I listed earlier – Greek, Latin and Cyrillic – however some languages – notably Chinese and Japanese – still are not supported, and we are going to be looking into why and what we can do to fix this. Also, there are still some occasions where missing characters are used in some known languages, and we are working on ways to try and fix this too.

With translations out the way, it really leaves us with only a few things left to do before we roll out Pycraft v0.9.6-3, mainly improving docstrings, adding in customisations for seasonal events, adding more default colours to the theme customizer, adding back in the load screen for the game engine and improving controller support. This may sound like a long list, but this shouldn’t take too long to do. From there its mainly testing – and we have a lot to test given that this is one of the most significant updates to Pycraft for some time and many things have been changed or added in.

Starting from next week (24/10/2022 – DD/MM/YYYY) we will be changing how versioning works in Pycraft, this will be a big change, but we are hopeful that it makes Pycraft more accessible and easier to understand.

The current plan for Pycraft looks like this:

  • Changes to versioning
  • Additional theme colours
  • Seasonal events
  • Improving docstrings
  • Improving controller support
  • Adding in the load screen

Although we will not be specifying times or a completion date at this stage because delays could easily change this, and we don’t want to put too much stress on developers – or release Pycraft v0.9.6-3 in a state we are not satisfied with.

Attached below are some visual highlights from the last week of development!

Pycraft's settings menu (general) translated into Ukranian

Pycraft's settings menu (storage and permissions) translated into French

Top comments (0)