I’ve been working more on my project launcher tool and learning about parsing json and ini files. I’ve also started using classes in my scripts (about time!).
JSON and INI
In order to store information offline and allow max to access settings, I’ve had to read and write JSON and INI files in my script.
JSON is great to work with – works like a python dictionary in a text file.
INI can be frustrating, as the configparser module used to read it automatically sets all strings to lower case. Luckily I found a fix!
self.config = configparser.ConfigParser()
self.config.optionxform = str
Saving and Opening Files
I have a lot of opening and saving files in this tool, and one of the major issues was directing the user towards some more obscure files such as 3dsmax.exe and 3dsmax.ini. These are only set once, but can be a pain to find. os.getenv was very useful here, as it let me find both appdata and program files without any knowlege of the user’s paths.
Qt and PySide
I’ve been using Qt Designer and PySide for my ui needs. This has been really useful, as its allowed me to create lovley looking interfaces without having to work out where everything should go in code. Its also forced me to use classes, as each ui is a super class, derived from itself and the QMainWindow class from PySide. Having each ui wrapped up in a class is really neat, plus having class scope variables is incredibly helpful when communicating between various dialog boxes.