natcap.invest.ui.model

Classes related to the InVEST Model class.

class natcap.invest.ui.model.DatastackSaveOpts(datastack_type, use_relpaths, include_workspace, archive_path)

Bases: tuple

archive_path

Alias for field number 3

datastack_type

Alias for field number 0

include_workspace

Alias for field number 2

use_relpaths

Alias for field number 1

class natcap.invest.ui.model.WindowTitle(modelname='', filename='', modified='')

Bases: MockQObject

Object to manage the title string for a model window.

The title string is dependent on several characteristics:

  • The name of the model currently being run.

  • The filename (basename) of the current datastack file

  • Whether the datastack has been modified from the time it was last

    saved.

The window’s title is updated based on the state of three attributes. These attributes may be initialized by using the parameters to __init__(), or by updating the appropriate attribute after object creation:

When any attributes are changed, this object emits the title_changed signal with the new title string.

modelname

If a string, this is assumed to be the name of the model. If None, the string "InVEST" is assumed in the window title.

Type

string or None

filename

If a string, the filename to be displayed to the user in the title bar. No manipulations are performed on this filename; it will be used verbatim. If None, "new datastack" is assumed.

Type

string or None

modified

Whether the datastack file has been modified. If so, a '*' is displayed next to the datastack filename.

Type

bool

set_title_attr(name, value)

Attribute setter.

Set the given attribute and emit the title_changed signal with the new window title if the rendered title is different from the previous title.

Parameters
  • name (string) – the name of the attribute to set.

  • value – The new value for the attribute.

title_changed = <MagicMock name='mock.QtCore.Signal()' id='140108894629760'>
natcap.invest.ui.model.is_probably_datastack(filepath)

Check to see if the path provided is probably a datastack.

Parameters

filepath (string) – A path to a location on disk.

Returns

True if the path is likely to be a datastack. False otherwise.

natcap.invest.ui.model.wait_on_signal(signal, timeout=250)

Block loop until signal emitted, or timeout (ms) elapses.