TLDR: I made a Game Collection Manager in Python/QT. Check it out.
A few months ago I wanted to play something from my collection, but I couldn’t decide what. I now have over 500 games in my collection, so it can be a bit overwhelming to choose. But since I already had my collection in a spreadsheet on Google docs, I thought what if I just download that as csv files and write a simple Python application that chooses for me. This idea eventually grew into a bigger project which manages a game collection. Oh and yeah, I didn’t actually play anything that day…
I decided that I wanted to learn how to use QT for Python (PySide2), so I set out to create the GUI in that. For the game chooser/randomizer project I used QT Designer to create the GUI and pyside2-uic to turn it into a Python file. I used emacs with Elpy as the editor. This was a ridiculously simple workflow, and I had a working application up and running in about an evening with some more polishing the next day. Here’s what the finished application looked like:
I had never really made use of GUI frameworks properly before, except for some Java Swing stuff in Netbeans. I had also tried to make something with GTK3 in Python earlier, but gave up pretty quickly. But this time something just clicked.
After I finished this simple randomizer I thought that now that I have the data downloaded and formatted as csv files, I could make a collection manager to handle the data. Obviously there are already applications like that, but just for fun. So I thought up a reasonable application structure for the project and set out to try to create it. At first using QT Designer as well, but I quickly decided to write the GUI by hand instead. Studying the QT Designer files converted into Python code, it didn’t seem to be so difficult to do by hand. And since this was mostly a project for learning Python/QT I thought it would be better to do it by hand.
The project quickly took shape and grew, and I learned more and more about the various widgets, views and models of QT. I also switched from emacs to PyCharm since emacs’ completion became super slow with PySide for some reason.
Initially the project used csv files for databases, displaying them in tables. But when I implemented a feature to import all games from a platform into the collection, for the user to more quickly add games they own from a platform, it became quite obvious that the way I had implemented reading from and writing to the csv files wasn’t very fast. Turns out that if there was ~50,000 rows in the database, it took about 35 seconds to update a cell. Obviously this wasn’t acceptable, so I started looking for other solutions.
I decided that an sqlite database would probably make more sense for this project. And as it turned out, QT has built in facilities for handling SQL databases. So I spent about a week refactoring the project to use sqlite3 rather than csv files. It felt like I would never get done, but in the end it was totally worth it. Now 50,000 rows of data is no issue, and updating a cell is blazingly fast. And searching is also incredibly quick regardless of how many rows there are. I also learned a ton by doing this rewrite.
After this I implemented new features such as filtering based on platform, region, etc, as well as the ability to import Steam libraries. There are still things left do do and polish, but it’s now quite feature complete and usable. Here are some pics of it:
Today I uploaded the project to GitHub finally. Check it out if you want.