core.lnp module

PyLNP main library.

class core.lnp.PyLNP[source]

Bases: object

PyLNP library class.

Acts as an abstraction layer between the UI and the Dwarf Fortress instance.

detect_basedir()[source]

Detects the location of Dwarf Fortress by walking up the directory tree.

static get_commandline_args()[source]

Responsible for the actual parsing of command line options.

initialize_df()[source]

Initializes the DF folder and related variables.

initialize_program()[source]

Initializes the main program (errorlog, path registration, etc.).

initialize_ui()[source]

Instantiates the UI object.

macos_check_translocated()[source]

Verify that macOS isn’t isolating our application.

parse_commandline()[source]

Parses and acts on command line options.

reload_program()[source]

Reloads the program to allow the user to change DF folders.

save_config()[source]

Saves LNP configuration.

class core.lnp.UI[source]

Bases: object

Specifies the interface required by the core PyLNP library for communicating with the user. Provided for reference; UIs do not need to inherit from this.

on_invalid_config(errors)[source]

Called before running DF if an invalid configuration is detected. <errors> contains a list of discovered problems, which should be shown to the user. A true return value will launch DF anyway; a false return value cancels.

on_program_running(path, is_df)[source]

Called when attempting to launch a program that is already running. <path> provides the path to the program that is being launched, so you can request a forced launch. <is_df> specifies if the program is DF (True) or a utility (False).

on_query_migration()[source]

When no saves are detected, this function will be called. This should provide the user with an option to import a previous DF install or starter pack into the newly selected DF version.

on_request_update_permission(interval)[source]

Called when PyLNP.json specifies a desired update interval but the user configuration does not hold a value for this. <interval> contains the number of days between update checks. A true return value will change the configuration to use the specified interval. A false return value will turn off automatic update checks.

on_update_available()[source]

Called when an update is available. Use this to show a notification and prompt the user for further action.

start()[source]

Notifies the UI to start. On return, PyLNP will terminate.