d rats main module - wb8tyw/D-Rats GitHub Wiki

introduction

This is an attempt to document the data flow in the D-rats main Module.

The d-rats.py module is used for launching the d-rats program.

main setup

The main setup is run before the main function. Much of it probably should be moved into the main function.

A default "_" mapping to gettext is added for the pylance tool to not flag it as undefined.

A test of the spell module is done. As it is run before the log level is set to INFO, there is no visible output from this test, so it should probably be moved.

Then a functions to intercept the default exception handler for python are defined.

main

Gets platform specific from dplatform module to find the default config module. This is fetched now to provide defaults for the command line arguments.

Parses the optional command line arguments

  • --config, alternate config directory

  • --loglevel, alternate log level

  • --profile, run with the cprofile program

  • --safe, safe mode, ignore configuration

If the --config option is selected then a new configuration is loaded. Then the command line arguments are applied.

D-rats then sets up to intercept any exceptions that are not internally caught and bring up a dialog box about the exception asking if you want to continue or abort, etc.

I had this disabled for a while in my fork, and have just re-enabled it. I may end up disabling it again, or creating an option to disable it.