populse_mia.main

The first module used at the mia runtime.

Basically, this module is dedicated to the initialisation of the basic parameters and the various checks necessary for a successful launch of the mia’s GUI.

Functions

add_to_sys_path(path, name[, index])

Adds the specified path to the system path if it's a valid directory.

check_package(name)

Attempts to import a package by its name, logs the location of the package if successful, and logs an error if the package is missing.

main(args)

Make basic configuration check, then actual launch of Mia.

qt_message_handler(msg_type, context, message)

Custom Qt message handler to filter out specific unwanted messages and print the remaining ones to stderr.

populse_mia.main.add_to_sys_path(path, name, index=0)[source]

Adds the specified path to the system path if it’s a valid directory.

Parameters:
  • path – (pathlib.Path) The directory path to be added to the system path.

  • name – (str) The name of the package being added.

  • index – (int) The index at which to insert the pathinto sys.path. Defaults to 0.

Returns:

(bool) True if the path is a valid directory and was added to sys.path, False otherwise.

populse_mia.main.check_package(name)[source]

Attempts to import a package by its name, logs the location of the package if successful, and logs an error if the package is missing.

Parameters:

name – (str) The name of the package to be imported.

Returns:

(bool) True if the package is imported successfully; False if the package is missing.

populse_mia.main.main(args)[source]

Make basic configuration check, then actual launch of Mia.

Checks if Mia is called from the site / dist packages (user mode) or from a cloned git repository (developer mode).

~/.populse_mia/configuration_path.yml is mandatory, if it doesn’t exist or is corrupted, try to create one with a valid properties path.

  • If launched from a cloned git repository (developer mode):
    • the properties_path is the “properties_dev_path” parameter in ~/.populse_mia/configuration_path.yml

  • If launched from the site / dist packages (user mode):
    • the properties_path is the “properties_user_path” parameter in ~/.populse_mia/configuration_path.yml

Parameters:

args – (argparse.Namespace) The parsed command-line arguments.

Launches the verify_processes() function, then the launch_mia() function (Mia’s real launch).

populse_mia.main.qt_message_handler(msg_type, context, message)[source]

Custom Qt message handler to filter out specific unwanted messages and print the remaining ones to stderr.

Parameters:
  • msg_type – (QtMsgType) The type of Qt message (debug, warning, critical, etc. - unused).

  • context – (QMessageLogContext) Context information about where the message originated (unused).

  • message – (str) The log message string.