Various refactors to Module handlers and QOpenGLWidget lifespans.
Been meaning to address this for awhile.
The Module class in pykotor.common was in need of a refactor. Was difficult to tell where the logic was happening and where.
- This PR adds a few extra classes to properly abstract the differences between each .rim/.mod and cleans up the `reload_resources` method.
- Improve management of QOpenGLWidget lifespan. The ModuleRenderer should emit a signal when the QMainWindow instance is ready to start doing stuff with the gl context, the new signal `rendererInitialized` tells the QMainWindow class to show the window. Also adds a `shutdownRenderer`, `initializeRenderer`, `pauseRenderLoop`, `resumeRenderLoop`, and provides accurate error handling for when things go awry.
- Remove a deprecated `GL_TEXTURE_2D` call in `Scene.__init__`. Not sure what this was for but all the docs/stackoverflow posts I've read said it was deprecated, doesn't seem to break anything upon removal.
While I was doing this I cleaned up a bunch of arbitrary things that can't realistically be separated from this PR:
- Stop creating unnecessary lists everywhere when a simple iterable/generator object is feasable. Decreases memory/resource usage. Mostly apparent in the `Module` class and the `Installation` class.
- Modify more func calls to throw FileNotFoundError
- Replace most `errorlog.txt` manual log writes in favor of the new `get_root_logger().exception("error msg here")` handlers we've been using.
- Improve `Installation.locations`: now creates an interim dict for lookups in `check_list` which improves the speed by about 5x, at least in debug mode, probably less in compiled mode.
合并状态:已合并 合并于 2024-05-05 关闭于 2024-05-05 0 条评论