populse_mia.tests.run_mia_test

This module is dedicated to populse_mia unit tests.

Contains:
Class:
  • LogCapture

  • TestMIACase

  • TestMIADataBrowser

  • TestMIAMainWindow

  • TestMIANodeController

  • TestMIAPipelineEditor

  • TestMIAPipelineManagerTab

  • Test_Z_MIAOthers

function:
  • add_to_syspath

  • qt_message_handler

Functions

add_to_syspath(path[, position, name])

Add a directory to sys.path if it exists and isn't already there.

qt_message_handler(mode, context, message)

Custom Qt message handler that filters out or cleans specific unwanted messages.

Classes

LogCapture()

Custom logging handler to capture log records for inspection during tests.

TestMIACase([methodName])

Parent class for the test classes of mia.

TestMIADataBrowser([methodName])

Tests for the data browser tab (DataBrowser).

TestMIAMainWindow([methodName])

Tests for the main window class (MainWindow).

TestMIANodeController([methodName])

Tests for the node controller, part of the pipeline manager tab.

TestMIAPipelineEditor([methodName])

Tests for the pipeline editor, part of the pipeline manager tab.

TestMIAPipelineManagerTab([methodName])

Tests the pipeline manager tab class, part of the homonym tab.

Test_Z_MIAOthers([methodName])

Tests for other parts of the MIA software that do not relate much with the other classes.

populse_mia.tests.run_mia_test.namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)[source]

Returns a new subclass of tuple with named fields.

>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__                   # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22)             # instantiate with positional args or keywords
>>> p[0] + p[1]                     # indexable like a plain tuple
33
>>> x, y = p                        # unpack like a regular tuple
>>> x, y
(11, 22)
>>> p.x + p.y                       # fields also accessible by name
33
>>> d = p._asdict()                 # convert to a dictionary
>>> d['x']
11
>>> Point(**d)                      # convert from a dictionary
Point(x=11, y=22)
>>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
Point(x=100, y=22)
class populse_mia.tests.run_mia_test.datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])

Bases: date

The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

astimezone()

tz -> convert to local time in new timezone tz

combine()

date, time -> datetime with same date and time fields

ctime()

Return ctime() style string.

date()

Return date object with same year, month and day.

dst()

Return self.tzinfo.dst(self).

fold
fromisoformat()

string -> datetime from a string in most ISO 8601 formats

fromtimestamp()

timestamp[, tz] -> tz’s local time from POSIX timestamp.

hour
isoformat()

[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to ‘T’. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’ and ‘microseconds’.

max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
microsecond
min = datetime.datetime(1, 1, 1, 0, 0)
minute
now()

Returns new datetime object representing current time local to tz.

tz

Timezone object.

If no tz is specified, uses local timezone.

replace()

Return datetime with new specified fields.

resolution = datetime.timedelta(microseconds=1)
second
strptime()

string, format -> new datetime parsed from a string (like time.strptime()).

time()

Return time object with same time but with tzinfo=None.

timestamp()

Return POSIX timestamp as float.

timetuple()

Return time tuple, compatible with time.localtime().

timetz()

Return time object with same time and tzinfo.

tzinfo
tzname()

Return self.tzinfo.tzname(self).

utcfromtimestamp()

Construct a naive UTC datetime from a POSIX timestamp.

utcnow()

Return a new datetime representing UTC day and time.

utcoffset()

Return self.tzinfo.utcoffset(self).

utctimetuple()

Return UTC time tuple, compatible with time.localtime().

class populse_mia.tests.run_mia_test.Path(*args, **kwargs)[source]

Bases: PurePath

PurePath subclass that can make system calls.

Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.

stat(*, follow_symlinks=True)[source]

Return the result of the stat() system call on this path, like os.stat() does.

lstat()[source]

Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.

exists(*, follow_symlinks=True)[source]

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.

is_dir()[source]

Whether this path is a directory.

is_file()[source]

Whether this path is a regular file (also True for symlinks pointing to regular files).

is_mount()[source]

Check if this path is a mount point

Whether this path is a symbolic link.

is_junction()[source]

Whether this path is a junction.

is_block_device()[source]

Whether this path is a block device.

is_char_device()[source]

Whether this path is a character device.

is_fifo()[source]

Whether this path is a FIFO.

is_socket()[source]

Whether this path is a socket.

samefile(other_path)[source]

Return whether other_path is the same or not as this file (as returned by os.path.samefile()).

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)[source]

Open the file pointed to by this path and return a file object, as the built-in open() function does.

read_bytes()[source]

Open the file in bytes mode, read it, and close the file.

read_text(encoding=None, errors=None)[source]

Open the file in text mode, read it, and close the file.

write_bytes(data)[source]

Open the file in bytes mode, write to it, and close the file.

write_text(data, encoding=None, errors=None, newline=None)[source]

Open the file in text mode, write to it, and close the file.

iterdir()[source]

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries ‘.’ and ‘..’ are not included.

_scandir()[source]
_make_child_relpath(name)[source]
glob(pattern, *, case_sensitive=None)[source]

Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.

rglob(pattern, *, case_sensitive=None)[source]

Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.

walk(top_down=True, on_error=None, follow_symlinks=False)[source]

Walk the directory tree from this directory, similar to os.walk().

__init__(*args, **kwargs)[source]
classmethod cwd()[source]

Return a new path pointing to the current working directory.

classmethod home()[source]

Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).

absolute()[source]

Return an absolute version of this path by prepending the current working directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file.

resolve(strict=False)[source]

Make the path absolute, resolving all symlinks on the way and also normalizing it.

owner()[source]

Return the login name of the file owner.

group()[source]

Return the group name of the file gid.

Return the path to which the symbolic link points.

touch(mode=438, exist_ok=True)[source]

Create this file with the given access mode, if it doesn’t exist.

mkdir(mode=511, parents=False, exist_ok=False)[source]

Create a new directory at this given path.

chmod(mode, *, follow_symlinks=True)[source]

Change the permissions of the path, like os.chmod().

lchmod(mode)[source]

Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.

Remove this file or link. If the path is a directory, use rmdir() instead.

rmdir()[source]

Remove this directory. The directory must be empty.

rename(target)[source]

Rename this path to the target path.

The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.

Returns the new Path instance pointing to the target path.

replace(target)[source]

Rename this path to the target path, overwriting if that path exists.

The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.

Returns the new Path instance pointing to the target path.

Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.

Make this path a hard link pointing to the same file as target.

Note the order of arguments (self, target) is the reverse of os.link’s.

expanduser()[source]

Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)

class populse_mia.tests.run_mia_test.RichJupyterWidget(**kwargs: Any)[source]

Bases: RichIPythonWidget

An JupyterWidget that supports rich text, including lists, images, and tables. Note that raw performance will be reduced compared to the plain text version.

_payload_source_plot = 'ipykernel.pylab.backend_payload.add_plot_payload'
_svg_warning_displayed = False
__init__(*args, **kw)[source]

Create a RichJupyterWidget.

_jpg_supported

A boolean (True, False) trait.

export_html()[source]

Shows a dialog to export HTML/XML in various formats.

Overridden in order to reset the _svg_warning_displayed flag prior to the export running.

_context_menu_make(pos)[source]

Reimplemented to return a custom context menu for images.

_pre_image_append(msg, prompt_number)[source]

Append the Out[] prompt and make the output nicer

Shared code for some the following if statement

_handle_execute_result(msg)[source]

Overridden to handle rich data types, like SVG.

_handle_display_data(msg)[source]

Overridden to handle rich data types, like SVG.

_is_latex_math(latex)[source]

Determine if a Latex string is in math mode

This is the only mode supported by qtconsole

_get_color(color)[source]

Get color from the current syntax style if loadable.

_append_latex(latex, before_prompt=False, metadata=None)[source]

Append latex data to the widget.

_append_jpg(jpg, before_prompt=False, metadata=None)[source]

Append raw JPG data to the widget.

_append_png(png, before_prompt=False, metadata=None)[source]

Append raw PNG data to the widget.

_append_svg(svg, before_prompt=False)[source]

Append raw SVG data to the widget.

_add_image(image)[source]

Adds the specified QImage to the document and returns a QTextImageFormat that references it.

_copy_image(name)[source]

Copies the ImageResource with ‘name’ to the clipboard.

_get_image(name)[source]

Returns the QImage stored as the ImageResource with ‘name’.

_get_image_tag(match, path=None, format='png')[source]

Return (X)HTML mark-up for the image-tag given by match.

Parameters:
  • match (re.SRE_Match) – A match to an HTML image tag as exported by Qt, with match.group(“Name”) containing the matched image ID.

  • path (string|None, optional [default None]) – If not None, specifies a path to which supporting files may be written (e.g., for linked images). If None, all images are to be included inline.

  • format ("png"|"svg"|"jpg", optional [default "png"]) – Format for returned or referenced images.

_insert_jpg(cursor, jpg, metadata=None)[source]

Insert raw PNG data into the widget.

_insert_png(cursor, png, metadata=None)[source]

Insert raw PNG data into the widget.

_insert_img(cursor, img, fmt, metadata=None)[source]

insert a raw image, jpg or png

_insert_svg(cursor, svg)[source]

Insert raw SVG data into the widet.

_save_image(name, format='PNG')[source]

Shows a save dialog for the ImageResource with ‘name’.

_all_trait_default_generators: dict[str, t.Any] = {'_display_banner': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, '_highlighter': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, '_jpg_supported': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'ansi_codes': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'banner': <traitlets.traitlets.DefaultHandler object>, 'buffer_size': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'clear_on_kernel_restart': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'config': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'confirm_restart': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'console_height': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'console_width': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'custom_edit': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'custom_interrupt': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'custom_restart': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'editor': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'editor_line': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'enable_calltips': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'execute_on_complete_input': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'font_family': <function ConsoleWidget._font_family_default>, 'font_size': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'gui_completion': <bound method TraitType.default of <traitlets.traitlets.Enum object>>, 'gui_completion_height': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'history_lock': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'in_prompt': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'include_other_output': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'input_sep': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'kernel_banner': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'kind': <bound method TraitType.default of <traitlets.traitlets.Enum object>>, 'lexer': <function FrontendWidget._lexer_default>, 'lexer_class': <function FrontendWidget._lexer_class_default>, 'log': <traitlets.traitlets.DefaultHandler object>, 'other_output_prefix': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'out_prompt': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'output_sep': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'output_sep2': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'override_shortcuts': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'paging': <bound method TraitType.default of <traitlets.traitlets.Enum object>>, 'parent': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'scrollbar_visibility': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'style_sheet': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'syntax_style': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>}
_descriptors = [<traitlets.traitlets.DefaultHandler object>, <traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.DefaultHandler object>, <traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.ValidateHandler object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Enum object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Enum object>, <traitlets.traitlets.Any object>, <traitlets.traitlets.DottedObjectName object>, <traitlets.traitlets.Any object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Enum object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>]
_instance_inits = [<bound method BaseDescriptor.instance_init of <traitlets.traitlets.DefaultHandler object>>, <bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method BaseDescriptor.instance_init of <traitlets.traitlets.DefaultHandler object>>, <bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method ValidateHandler.instance_init of <traitlets.traitlets.ValidateHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method BaseDescriptor.instance_init of <traitlets.traitlets.DottedObjectName object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>]
_static_immutable_initial_values: dict[str, t.Any] = {'_display_banner': False, '_highlighter': None, '_jpg_supported': False, 'ansi_codes': True, 'buffer_size': 500, 'clear_on_kernel_restart': True, 'confirm_restart': True, 'console_height': 25, 'console_width': 81, 'custom_edit': False, 'custom_interrupt': False, 'custom_restart': False, 'editor': '', 'editor_line': '', 'enable_calltips': True, 'execute_on_complete_input': True, 'font_size': 0, 'gui_completion_height': 0, 'history_lock': False, 'in_prompt': 'In [<span class="in-prompt-number">%i</span>]: ', 'include_other_output': False, 'input_sep': '\n', 'kernel_banner': '', 'other_output_prefix': '[remote] ', 'out_prompt': 'Out[<span class="out-prompt-number">%i</span>]: ', 'output_sep': '', 'output_sep2': '', 'override_shortcuts': False, 'parent': None, 'scrollbar_visibility': True, 'style_sheet': '', 'syntax_style': ''}
_trait_default_generators = {}
_traits: dict[str, t.Any] = {'_display_banner': <traitlets.traitlets.Bool object>, '_highlighter': <traitlets.traitlets.Instance object>, '_jpg_supported': <traitlets.traitlets.Bool object>, 'ansi_codes': <traitlets.traitlets.Bool object>, 'banner': <traitlets.traitlets.Unicode object>, 'buffer_size': <traitlets.traitlets.Int object>, 'clear_on_kernel_restart': <traitlets.traitlets.Bool object>, 'config': <traitlets.traitlets.Instance object>, 'confirm_restart': <traitlets.traitlets.Bool object>, 'console_height': <traitlets.traitlets.Int object>, 'console_width': <traitlets.traitlets.Int object>, 'custom_edit': <traitlets.traitlets.Bool object>, 'custom_interrupt': <traitlets.traitlets.Bool object>, 'custom_restart': <traitlets.traitlets.Bool object>, 'editor': <traitlets.traitlets.Unicode object>, 'editor_line': <traitlets.traitlets.Unicode object>, 'enable_calltips': <traitlets.traitlets.Bool object>, 'execute_on_complete_input': <traitlets.traitlets.Bool object>, 'font_family': <traitlets.traitlets.Unicode object>, 'font_size': <traitlets.traitlets.Int object>, 'gui_completion': <traitlets.traitlets.Enum object>, 'gui_completion_height': <traitlets.traitlets.Int object>, 'history_lock': <traitlets.traitlets.Bool object>, 'in_prompt': <traitlets.traitlets.Unicode object>, 'include_other_output': <traitlets.traitlets.Bool object>, 'input_sep': <traitlets.traitlets.Unicode object>, 'kernel_banner': <traitlets.traitlets.Unicode object>, 'kind': <traitlets.traitlets.Enum object>, 'lexer': <traitlets.traitlets.Any object>, 'lexer_class': <traitlets.traitlets.DottedObjectName object>, 'log': <traitlets.traitlets.Any object>, 'other_output_prefix': <traitlets.traitlets.Unicode object>, 'out_prompt': <traitlets.traitlets.Unicode object>, 'output_sep': <traitlets.traitlets.Unicode object>, 'output_sep2': <traitlets.traitlets.Unicode object>, 'override_shortcuts': <traitlets.traitlets.Bool object>, 'paging': <traitlets.traitlets.Enum object>, 'parent': <traitlets.traitlets.Instance object>, 'scrollbar_visibility': <traitlets.traitlets.Bool object>, 'style_sheet': <traitlets.traitlets.Unicode object>, 'syntax_style': <traitlets.traitlets.Unicode object>}
class populse_mia.tests.run_mia_test.TraitListObject(*args, **kwargs)[source]

Bases: TraitList

A specialization of TraitList with a default validator and notifier which provide bug-for-bug compatibility with the TraitListObject from Traits versions before 6.0.

Parameters:
  • trait (CTrait) – The trait that the list has been assigned to.

  • object (HasTraits) – The object the list belongs to.

  • name (str) – The name of the trait on the object.

  • value (iterable) – The initial value of the list.

trait

The trait that the list has been assigned to.

Type:

CTrait

object

The object the list belongs to.

Type:

HasTraits

name

The name of the trait on the object.

Type:

str

value

The initial value of the list.

Type:

iterable

__init__(trait, object, name, value)[source]
notifier(trait_list, index, removed, added)[source]

Converts and consolidates the parameters to a TraitListEvent and then fires the event.

Parameters:
  • trait_list (list) – The list

  • index (int or slice) – Index or slice that was modified

  • removed (list) – Values that were removed

  • added (list) – Values that were added

append(object)[source]

Append object to the end of the list.

Parameters:

object (any) – The object to append.

clear()[source]

Remove all items from list.

extend(iterable)[source]

Extend list by appending elements from the iterable.

Parameters:

iterable (iterable) – The elements to append.

insert(index, object)[source]

Insert object before index.

Parameters:
  • index (integer) – The position at which to insert.

  • object (object) – The object to insert.

pop(index=-1)[source]

Remove and return item at index (default last).

Parameters:

index (int, optional) – Index at which to remove item. If not given, the last item of the list is removed.

Returns:

item – The removed item.

Return type:

object

Raises:

IndexError – If list is empty or index is out of range.

remove(value)[source]

Remove first occurrence of value.

Notes

The value is not validated or converted before removal.

Parameters:

value (object) – Value to be removed.

Raises:

ValueError – If the value is not present.

_item_validator(value)[source]

Validate an item that’s being added to the list.

_validate_length(new_length)[source]

Validate the new length for a proposed operation.

Parameters:

new_length (int) – New length of the list.

Raises:

TraitError – If the proposed new length would violate the length constraints of the list.

class populse_mia.tests.run_mia_test.MagicMock(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]

Bases: MagicMixin, Mock

MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself.

If you use the spec or spec_set arguments then only magic methods that exist in the spec will be created.

Attributes and the return value of a MagicMock will also be MagicMocks.

mock_add_spec(spec, spec_set=False)[source]

Add a spec to a mock. spec can either be an object or a list of strings. Only attributes on the spec can be fetched as attributes from the mock.

If spec_set is True then only attributes on the spec can be set.

reset_mock(*args, return_value: bool = False, **kwargs)[source]

Restore the mock object to its initial state.

class populse_mia.tests.run_mia_test.Mock(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]

Bases: CallableMixin, NonCallableMock

Create a new Mock object. Mock takes several optional arguments that specify the behaviour of the Mock object:

  • spec: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an AttributeError.

    If spec is an object (rather than a list of strings) then mock.__class__ returns the class of the spec object. This allows mocks to pass isinstance tests.

  • spec_set: A stricter variant of spec. If used, attempting to set or get an attribute on the mock that isn’t on the object passed as spec_set will raise an AttributeError.

  • side_effect: A function to be called whenever the Mock is called. See the side_effect attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns DEFAULT, the return value of this function is used as the return value.

    If side_effect is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned.

  • return_value: The value returned when the mock is called. By default this is a new Mock (created on first access). See the return_value attribute.

  • unsafe: By default, accessing any attribute whose name starts with assert, assret, asert, aseert, or assrt raises an AttributeError. Additionally, an AttributeError is raised when accessing attributes that match the name of an assertion method without the prefix assert_, e.g. accessing called_once instead of assert_called_once. Passing unsafe=True will allow access to these attributes.

  • wraps: Item for the mock object to wrap. If wraps is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn’t exist will raise an AttributeError).

    If the mock has an explicit return_value set then calls are not passed to the wrapped object and the return_value is returned instead.

  • name: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks.

Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created.

populse_mia.tests.run_mia_test.patch(target, new=sentinel.DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *, unsafe=False, **kwargs)[source]

patch acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the target is patched with a new object. When the function/with statement exits the patch is undone.

If new is omitted, then the target is replaced with an AsyncMock if the patched object is an async function or a `MagicMock otherwise. If patch is used as a decorator and new is omitted, the created mock is passed in as an extra argument to the decorated function. If patch is used as a context manager the created mock is returned by the context manager.

target should be a string in the form ‘package.module.ClassName’. The target is imported and the specified object replaced with the new object, so the target must be importable from the environment you are calling patch from. The target is imported when the decorated function is executed, not at decoration time.

The spec and spec_set keyword arguments are passed to the MagicMock if patch is creating one for you.

In addition you can pass spec=True or spec_set=True, which causes patch to pass in the object being mocked as the spec/spec_set object.

new_callable allows you to specify a different class, or callable object, that will be called to create the new object. By default AsyncMock is used for async functions and MagicMock for the rest.

A more powerful form of spec is autospec. If you set autospec=True then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a TypeError if they are called with the wrong signature. For mocks replacing a class, their return value (the ‘instance’) will have the same spec as the class.

Instead of autospec=True you can pass autospec=some_object to use an arbitrary object as the spec instead of the one being replaced.

By default patch will fail to replace attributes that don’t exist. If you pass in create=True, and the attribute doesn’t exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don’t actually exist!

Patch can be used as a TestCase class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. patch finds tests by looking for method names that start with patch.TEST_PREFIX. By default this is test, which matches the way unittest finds tests. You can specify an alternative prefix by setting patch.TEST_PREFIX.

Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use “as” then the patched object will be bound to the name after the “as”; very useful if patch is creating a mock object for you.

Patch will raise a RuntimeError if passed some common misspellings of the arguments autospec and spec_set. Pass the argument unsafe with the value True to disable that check.

patch takes arbitrary keyword arguments. These will be passed to AsyncMock if the patched object is asynchronous, to MagicMock otherwise or to new_callable if specified.

patch.dict(…), patch.multiple(…) and patch.object(…) are available for alternate use-cases.

class populse_mia.tests.run_mia_test.Rename(format_string=None, **inputs)[source]

Bases: SimpleInterface, IOBase

Change the name of a file based on a mapped format string.

To use additional inputs that will be defined at run-time, the class constructor must be called with the format template, and the fields identified will become inputs to the interface.

Additionally, you may set the parse_string input, which will be run over the input filename with a regular expressions search, and will fill in additional input fields from matched groups. Fields set with inputs have precedence over fields filled in with the regexp match.

Examples

>>> from nipype.interfaces.utility import Rename
>>> rename1 = Rename()
>>> rename1.inputs.in_file = os.path.join(datadir, "zstat1.nii.gz") # datadir is a directory with exemplary files, defined in conftest.py
>>> rename1.inputs.format_string = "Faces-Scenes.nii.gz"
>>> res = rename1.run()          
>>> res.outputs.out_file         
'Faces-Scenes.nii.gz"            
>>> rename2 = Rename(format_string="%(subject_id)s_func_run%(run)02d")
>>> rename2.inputs.in_file = os.path.join(datadir, "functional.nii")
>>> rename2.inputs.keep_ext = True
>>> rename2.inputs.subject_id = "subj_201"
>>> rename2.inputs.run = 2
>>> res = rename2.run()          
>>> res.outputs.out_file         
'subj_201_func_run02.nii'        
>>> rename3 = Rename(format_string="%(subject_id)s_%(seq)s_run%(run)02d.nii")
>>> rename3.inputs.in_file = os.path.join(datadir, "func_epi_1_1.nii")
>>> rename3.inputs.parse_string = r"func_(?P<seq>\w*)_.*"
>>> rename3.inputs.subject_id = "subj_201"
>>> rename3.inputs.run = 2
>>> res = rename3.run()          
>>> res.outputs.out_file         
'subj_201_epi_run02.nii'         
input_spec

alias of RenameInputSpec

output_spec

alias of RenameOutputSpec

__init__(format_string=None, **inputs)[source]

Subclasses must implement __init__

_rename()[source]
_run_interface(runtime)[source]

Core function that executes interface

class populse_mia.tests.run_mia_test.Select(from_file=None, resource_monitor=None, ignore_exception=False, **inputs)[source]

Bases: IOBase

Basic interface class to select specific elements from a list

Examples

>>> from nipype.interfaces.utility import Select
>>> sl = Select()
>>> _ = sl.inputs.trait_set(inlist=[1, 2, 3, 4, 5], index=[3])
>>> out = sl.run()
>>> out.outputs.out
4
>>> _ = sl.inputs.trait_set(inlist=[1, 2, 3, 4, 5], index=[3, 4])
>>> out = sl.run()
>>> out.outputs.out
[4, 5]
input_spec

alias of SelectInputSpec

output_spec

alias of SelectOutputSpec

_list_outputs()[source]

List the expected outputs

class populse_mia.tests.run_mia_test.File(value=<traits.trait_type._NoDefaultSpecifiedType object>, exists=False, resolve=False, allow_compressed=True, extensions=None, **metadata)[source]

Bases: BasePath

Defines a trait whose value must be a file path.

>>> from nipype.interfaces.base import File, TraitedSpec, TraitError
>>> class A(TraitedSpec):
...     foo = File()
>>> a = A()
>>> a.foo
<undefined>
>>> a.foo = '/some/made/out/path/to/file'
>>> a.foo
'/some/made/out/path/to/file'
>>> class A(TraitedSpec):
...     foo = File(exists=False, resolve=True)
>>> a = A(foo='idontexist.txt')
>>> a.foo  
'.../idontexist.txt'
>>> class A(TraitedSpec):
...     foo = File(exists=True, resolve=True)
>>> a = A()
>>> a.foo = 'idontexist.txt'  
Traceback (most recent call last):
TraitError:
>>> open('idoexist.txt', 'w').close()
>>> a.foo = 'idoexist.txt'
>>> a.foo  
'.../idoexist.txt'
>>> class A(TraitedSpec):
...     foo = File('idoexist.txt')
>>> a = A()
>>> a.foo
<undefined>
>>> class A(TraitedSpec):
...     foo = File('idoexist.txt', usedefault=True)
>>> a = A()
>>> a.foo
'idoexist.txt'
>>> class A(TraitedSpec):
...     foo = File(exists=True, resolve=True, extensions=['.txt', 'txt.gz'])
>>> a = A()
>>> a.foo = 'idoexist.badtxt'  
Traceback (most recent call last):
TraitError:
>>> a.foo = 'idoexist.txt'
>>> a.foo  
'.../idoexist.txt'
>>> class A(TraitedSpec):
...     foo = File(extensions=['.nii', '.nii.gz'])
>>> a = A()
>>> a.foo = 'badext.txt'  
Traceback (most recent call last):
TraitError:
>>> class A(TraitedSpec):
...     foo = File(extensions=['.nii', '.nii.gz'])
>>> a = A()
>>> a.foo = 'goodext.nii'
>>> a.foo
'goodext.nii'
>>> a = A()
>>> a.foo = 'idontexist.000.nii'
>>> a.foo  
'idontexist.000.nii'
>>> a = A()
>>> a.foo = 'idontexist.000.nii.gz'
>>> a.foo  
'idontexist.000.nii.gz'
_is_file = True
__init__(value=<traits.trait_type._NoDefaultSpecifiedType object>, exists=False, resolve=False, allow_compressed=True, extensions=None, **metadata)[source]

Create a File trait.

_exts = None
validate(objekt, name, value, return_pathlike=False)[source]

Validate a value change.

class populse_mia.tests.run_mia_test.InputMultiObject(trait=None, value=None, minlen=0, maxlen=9223372036854775807, items=True, **metadata)[source]

Bases: MultiObject

Implements a user friendly traits that accepts one or more paths to files or directories. This is the input version which always returns a list. Default value of this trait is _Undefined. It does not accept empty lists.

XXX This should only be used as a final resort. We should stick to established Traits to the extent possible.

XXX This needs to be vetted by somebody who understands traits

>>> from nipype.interfaces.base import InputMultiObject, TraitedSpec
>>> class A(TraitedSpec):
...     foo = InputMultiObject(File(exists=False))
>>> a = A()
>>> a.foo
<undefined>
>>> a.foo = '/software/temp/foo.txt'
>>> a.foo
['/software/temp/foo.txt']
>>> a.foo = ['/software/temp/foo.txt']
>>> a.foo
['/software/temp/foo.txt']
>>> a.foo = ['/software/temp/foo.txt', '/software/temp/goo.txt']
>>> a.foo
['/software/temp/foo.txt', '/software/temp/goo.txt']
_items_event = <traits.ctrait.CTrait object>
class populse_mia.tests.run_mia_test.CAT12Segment(**inputs)[source]

Bases: SPMCommand

CAT12: Segmentation

This toolbox is an extension to the default segmentation in SPM12, but uses a completely different segmentation approach. The segmentation approach is based on an Adaptive Maximum A Posterior (MAP) technique without the need for a priori information about tissue probabilities. That is, the Tissue Probability Maps (TPM) are not used constantly in the sense of the classical Unified Segmentation approach (Ashburner et. al. 2005), but just for spatial normalization. The following AMAP estimation is adaptive in the sense that local variations of the parameters (i.e., means and variance) are modeled as slowly varying spatial functions (Rajapakse et al. 1997). This not only accounts for intensity inhomogeneities but also for other local variations of intensity. Additionally, the segmentation approach uses a Partial Volume Estimation (PVE) with a simplified mixed model of at most two tissue types (Tohka et al. 2004). We start with an initial segmentation into three pure classes: gray matter (GM), white matter (WM), and cerebrospinal fluid (CSF) based on the above described AMAP estimation. The initial segmentation is followed by a PVE of two additional mixed classes: GM-WM and GM-CSF. This results in an estimation of the amount (or fraction) of each pure tissue type present in every voxel (as single voxels - given by Another important extension to the SPM12 segmentation is the integration of the Dartel or Geodesic Shooting registration into the toolbox by an already existing Dartel/Shooting template in MNI space. This template was derived from 555 healthy control subjects of the IXI-database (http://www.brain-development.org) and provides the several Dartel or Shooting iterations. Thus, for the majority of studies the creation of sample-specific templates is not necessary anymore and is mainly recommended for children data.’};

http://www.neuro.uni-jena.de/cat12/CAT12-Manual.pdf#page=15

Examples

>>> path_mr = 'structural.nii'
>>> cat = CAT12Segment(in_files=path_mr)
>>> cat.run() 
input_spec

alias of CAT12SegmentInputSpec

output_spec

alias of CAT12SegmentOutputSpec

__init__(**inputs)[source]

Subclasses must implement __init__

_format_arg(opt, spec, val)[source]

Convert input to appropriate format for spm

_list_outputs()[source]

Determine the expected outputs based on inputs.

class populse_mia.tests.run_mia_test.Smooth(**inputs)[source]

Bases: SPMCommand

Use spm_smooth for 3D Gaussian smoothing of image volumes.

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=55

Examples

>>> import nipype.interfaces.spm as spm
>>> smooth = spm.Smooth()
>>> smooth.inputs.in_files = 'functional.nii'
>>> smooth.inputs.fwhm = [4, 4, 4]
>>> smooth.run() 
input_spec

alias of SmoothInputSpec

output_spec

alias of SmoothOutputSpec

_jobtype = 'spatial'
_jobname = 'smooth'
_format_arg(opt, spec, val)[source]

Convert input to appropriate format for SPM.

_list_outputs()[source]

Determine the expected outputs based on inputs.

class populse_mia.tests.run_mia_test.Threshold(**inputs)[source]

Bases: SPMCommand

Topological FDR thresholding based on cluster extent/size. Smoothness is estimated from GLM residuals but is assumed to be the same for all of the voxels.

Examples

>>> thresh = Threshold()
>>> thresh.inputs.spm_mat_file = 'SPM.mat'
>>> thresh.inputs.stat_image = 'spmT_0001.img'
>>> thresh.inputs.contrast_index = 1
>>> thresh.inputs.extent_fdr_p_threshold = 0.05
>>> thresh.run() 
input_spec

alias of ThresholdInputSpec

output_spec

alias of ThresholdOutputSpec

_gen_thresholded_map_filename()[source]
_gen_pre_topo_map_filename()[source]
_make_matlab_command(_)[source]

Generates a mfile to build job structure :param contents: a list of dicts generated by _parse_inputs

in each subclass

Parameters:

cwd (string) – default os.getcwd()

Returns:

mscript – contents of a script called by matlab

Return type:

string

aggregate_outputs(runtime=None)[source]

Collate expected outputs and apply output traits validation.

_list_outputs()[source]

Determine the expected outputs based on inputs.

class populse_mia.tests.run_mia_test.QCoreApplication(argv: List[str])

Bases: QObject

aboutToQuit

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

addLibraryPath(a0: str | None)
applicationDirPath() str
applicationFilePath() str
applicationName() str
applicationPid() int
applicationVersion() str
arguments() List[str]
closingDown() bool
event(self, a0: QEvent | None) bool
eventDispatcher() QAbstractEventDispatcher | None
exec() int
exec_() int
exit(returnCode: int = 0)
flush()
hasPendingEvents() bool
installNativeEventFilter(self, filterObj: QAbstractNativeEventFilter | None)
installTranslator(messageFile: QTranslator | None) bool
instance() QCoreApplication | None
isQuitLockEnabled() bool
isSetuidAllowed() bool
libraryPaths() List[str]
notify(self, a0: QObject | None, a1: QEvent | None) bool
organizationDomain() str
organizationName() str
postEvent(receiver: QObject | None, event: QEvent | None, priority: int = Qt.EventPriority.NormalEventPriority)
processEvents(flags: QEventLoop.ProcessEventsFlags | QEventLoop.ProcessEventsFlag = QEventLoop.ProcessEventsFlag.AllEvents)
processEvents(flags: QEventLoop.ProcessEventsFlags | QEventLoop.ProcessEventsFlag, maxtime: int) None
quit()
removeLibraryPath(a0: str | None)
removeNativeEventFilter(self, filterObj: QAbstractNativeEventFilter | None)
removePostedEvents(receiver: QObject | None, eventType: int = 0)
removeTranslator(messageFile: QTranslator | None) bool
sendEvent(receiver: QObject | None, event: QEvent | None) bool
sendPostedEvents(receiver: QObject | None = None, eventType: int = 0)
setApplicationName(application: str | None)
setApplicationVersion(version: str | None)
setAttribute(attribute: Qt.ApplicationAttribute, on: bool = True)
setEventDispatcher(eventDispatcher: QAbstractEventDispatcher | None)
setLibraryPaths(a0: Iterable[str | None])
setOrganizationDomain(orgDomain: str | None)
setOrganizationName(orgName: str | None)
setQuitLockEnabled(enabled: bool)
setSetuidAllowed(allow: bool)
startingUp() bool
testAttribute(attribute: Qt.ApplicationAttribute) bool
translate(context: str | None, sourceText: str | None, disambiguation: str | None = None, n: int = -1) str
class populse_mia.tests.run_mia_test.QEvent(type: QEvent.Type)
class populse_mia.tests.run_mia_test.QEvent(other: QEvent)

Bases: wrapper

ActionAdded = 114
ActionChanged = 113
ActionRemoved = 115
ActivationChange = 99
ApplicationActivate = 121
ApplicationActivated = 121
ApplicationDeactivate = 122
ApplicationDeactivated = 122
ApplicationFontChange = 36
ApplicationLayoutDirectionChange = 37
ApplicationPaletteChange = 38
ApplicationStateChange = 214
ApplicationWindowIconChange = 35
ChildAdded = 68
ChildPolished = 69
ChildRemoved = 71
Clipboard = 40
Close = 19
CloseSoftwareInputPanel = 200
ContentsRectChange = 178
ContextMenu = 82
CursorChange = 183
DeferredDelete = 52
DragEnter = 60
DragLeave = 62
DragMove = 61
Drop = 63
DynamicPropertyChange = 170
EnabledChange = 98
Enter = 10
EnterEditFocus = 150
EnterWhatsThisMode = 124
Expose = 206
FileOpen = 116
FocusAboutToChange = 23
FocusIn = 8
FocusOut = 9
FontChange = 97
Gesture = 198
GestureOverride = 202
GrabKeyboard = 188
GrabMouse = 186
GraphicsSceneContextMenu = 159
GraphicsSceneDragEnter = 164
GraphicsSceneDragLeave = 166
GraphicsSceneDragMove = 165
GraphicsSceneDrop = 167
GraphicsSceneHelp = 163
GraphicsSceneHoverEnter = 160
GraphicsSceneHoverLeave = 162
GraphicsSceneHoverMove = 161
GraphicsSceneMouseDoubleClick = 158
GraphicsSceneMouseMove = 155
GraphicsSceneMousePress = 156
GraphicsSceneMouseRelease = 157
GraphicsSceneMove = 182
GraphicsSceneResize = 181
GraphicsSceneWheel = 168
Hide = 18
HideToParent = 27
HoverEnter = 127
HoverLeave = 128
HoverMove = 129
IconDrag = 96
IconTextChange = 101
InputMethod = 83
InputMethodQuery = 207
KeyPress = 6
KeyRelease = 7
KeyboardLayoutChange = 169
LanguageChange = 89
LayoutDirectionChange = 90
LayoutRequest = 76
Leave = 11
LeaveEditFocus = 151
LeaveWhatsThisMode = 125
LocaleChange = 88
MacSizeChange = 177
MaxUser = 65535
MetaCall = 43
ModifiedChange = 102
MouseButtonDblClick = 4
MouseButtonPress = 2
MouseButtonRelease = 3
MouseMove = 5
MouseTrackingChange = 109
Move = 13
NativeGesture = 197
NonClientAreaMouseButtonDblClick = 176
NonClientAreaMouseButtonPress = 174
NonClientAreaMouseButtonRelease = 175
NonClientAreaMouseMove = 173
None_ = 0
OkRequest = 94
OrientationChange = 208
Paint = 12
PaletteChange = 39
ParentAboutToChange = 131
ParentChange = 21
PlatformPanel = 212
PlatformSurface = 217
Polish = 75
PolishRequest = 74
QueryWhatsThis = 123
ReadOnlyChange = 106
RequestSoftwareInputPanel = 199
Resize = 14
Scroll = 205
ScrollPrepare = 204
Shortcut = 117
ShortcutOverride = 51
Show = 17
ShowToParent = 26
SockAct = 50
StateMachineSignal = 192
StateMachineWrapped = 193
StatusTip = 112
StyleChange = 100
TabletEnterProximity = 171
TabletLeaveProximity = 172
TabletMove = 87
TabletPress = 92
TabletRelease = 93
TabletTrackingChange = 219
ThreadChange = 22
Timer = 1
ToolBarChange = 120
ToolTip = 110
ToolTipChange = 184
TouchBegin = 194
TouchCancel = 209
TouchEnd = 196
TouchUpdate = 195
class Type

Bases: int

UngrabKeyboard = 189
UngrabMouse = 187
UpdateLater = 78
UpdateRequest = 77
User = 1000
WhatsThis = 111
WhatsThisClicked = 118
Wheel = 31
WinEventAct = 132
WinIdChange = 203
WindowActivate = 24
WindowBlocked = 103
WindowDeactivate = 25
WindowIconChange = 34
WindowStateChange = 105
WindowTitleChange = 33
WindowUnblocked = 104
ZOrderChange = 126
accept(self)
ignore(self)
isAccepted(self) bool
registerEventType(hint: int = -1) int
setAccepted(self, accepted: bool)
spontaneous(self) bool
type(self) QEvent.Type
class populse_mia.tests.run_mia_test.QEventLoop(parent: QObject | None = None)

Bases: QObject

AllEvents = 0
ExcludeSocketNotifiers = 2
ExcludeUserInputEvents = 1
class ProcessEventsFlag

Bases: int

class ProcessEventsFlags
class ProcessEventsFlags(f: QEventLoop.ProcessEventsFlags | QEventLoop.ProcessEventsFlag)
class ProcessEventsFlags(a0: QEventLoop.ProcessEventsFlags)

Bases: simplewrapper

WaitForMoreEvents = 4
X11ExcludeTimers = 8
event(self, event: QEvent | None) bool
exec(self, flags: QEventLoop.ProcessEventsFlags = QEventLoop.AllEvents) int
exec_(self, flags: QEventLoop.ProcessEventsFlags = QEventLoop.AllEvents) int
exit(self, returnCode: int = 0)
isRunning(self) bool
processEvents(self, flags: QEventLoop.ProcessEventsFlags | QEventLoop.ProcessEventsFlag = QEventLoop.AllEvents) bool
processEvents(self, flags: QEventLoop.ProcessEventsFlags | QEventLoop.ProcessEventsFlag, maximumTime: int) None
quit(self)
wakeUp(self)
class populse_mia.tests.run_mia_test.QModelIndex
class populse_mia.tests.run_mia_test.QModelIndex(a0: QModelIndex)
class populse_mia.tests.run_mia_test.QModelIndex(a0: QPersistentModelIndex)

Bases: simplewrapper

child(self, arow: int, acolumn: int) QModelIndex
column(self) int
data(self, role: int = Qt.ItemDataRole.DisplayRole) Any
flags(self) Qt.ItemFlags
internalId(self) int
internalPointer(self) Any
isValid(self) bool
model(self) QAbstractItemModel | None
parent(self) QModelIndex
row(self) int
sibling(self, arow: int, acolumn: int) QModelIndex
siblingAtColumn(self, column: int) QModelIndex
siblingAtRow(self, row: int) QModelIndex
class populse_mia.tests.run_mia_test.QPoint
class populse_mia.tests.run_mia_test.QPoint(xpos: int, ypos: int)
class populse_mia.tests.run_mia_test.QPoint(a0: QPoint)

Bases: simplewrapper

dotProduct(p1: QPoint, p2: QPoint) int
isNull(self) bool
manhattanLength(self) int
setX(self, xpos: int)
setY(self, ypos: int)
transposed(self) QPoint
x(self) int
y(self) int
class populse_mia.tests.run_mia_test.Qt

Bases: simplewrapper

AA_CompressHighFrequencyEvents = 25
AA_CompressTabletEvents = 29
AA_DisableHighDpiScaling = 21
AA_DisableNativeVirtualKeyboard = 9
AA_DisableSessionManager = 31
AA_DisableShaderDiskCache = 27
AA_DisableWindowContextHelpButton = 30
AA_DontCheckOpenGLContextThreadAffinity = 26
AA_DontCreateNativeWidgetSiblings = 4
AA_DontShowIconsInMenus = 2
AA_DontShowShortcutsInContextMenus = 28
AA_DontUseNativeDialogs = 23
AA_DontUseNativeMenuBar = 6
AA_EnableHighDpiScaling = 20
AA_ForceRasterWidgets = 14
AA_ImmediateWidgetCreation = 0
AA_MSWindowsUseDirect3DByDefault = 1
AA_MacDontSwapCtrlAndMeta = 7
AA_MacPluginApplication = 5
AA_NativeWindows = 3
AA_PluginApplication = 5
AA_SetPalette = 19
AA_ShareOpenGLContexts = 18
AA_SynthesizeMouseForUnhandledTabletEvents = 24
AA_SynthesizeMouseForUnhandledTouchEvents = 12
AA_SynthesizeTouchForUnhandledMouseEvents = 11
AA_Use96Dpi = 8
AA_UseDesktopOpenGL = 15
AA_UseHighDpiPixmaps = 13
AA_UseOpenGLES = 16
AA_UseSoftwareOpenGL = 17
AA_UseStyleSheetPropagationInWidgetStyles = 22
AA_X11InitThreads = 10
ALT = 134217728
AbsoluteSize = 0
AccessibleDescriptionRole = 12
AccessibleTextRole = 11
ActionMask = 255
ActionsContextMenu = 2
ActiveWindowFocusReason = 3
AddToSelection = 1
AlignAbsolute = 16
AlignBaseline = 256
AlignBottom = 64
AlignCenter = 132
AlignHCenter = 4
AlignHorizontal_Mask = 31
AlignJustify = 8
AlignLeading = 1
AlignLeft = 1
AlignRight = 2
AlignTop = 32
AlignTrailing = 2
AlignVCenter = 128
AlignVertical_Mask = 480
class Alignment
class Alignment(f: Qt.Alignment | Qt.AlignmentFlag)
class Alignment(a0: Qt.Alignment)

Bases: simplewrapper

class AlignmentFlag

Bases: int

AllButtons = 134217727
AllDockWidgetAreas = 15
AllToolBarAreas = 15
AltModifier = 134217728
AnchorBottom = 5
AnchorHorizontalCenter = 1
AnchorLeft = 0
class AnchorPoint

Bases: int

AnchorRight = 2
AnchorTop = 3
AnchorVerticalCenter = 4
ApplicationActive = 4
class ApplicationAttribute

Bases: int

ApplicationHidden = 1
ApplicationInactive = 2
ApplicationModal = 2
ApplicationShortcut = 2
class ApplicationState

Bases: int

class ApplicationStates
class ApplicationStates(f: Qt.ApplicationStates | Qt.ApplicationState)
class ApplicationStates(a0: Qt.ApplicationStates)

Bases: simplewrapper

ApplicationSuspended = 0
ArrowCursor = 0
class ArrowType

Bases: int

AscendingOrder = 0
class AspectRatioMode

Bases: int

AutoColor = 0
AutoConnection = 0
AutoDither = 0
AutoText = 2
AvoidDither = 128
class Axis

Bases: int

BDiagPattern = 12
class BGMode

Bases: int

BackButton = 8
BackgroundColorRole = 8
BackgroundRole = 8
BacktabFocusReason = 2
BeginNativeGesture = 0
BevelJoin = 64
BitmapCursor = 24
BlankCursor = 10
BlockingQueuedConnection = 3
BottomDockWidgetArea = 8
BottomEdge = 8
BottomLeftCorner = 2
BottomLeftSection = 8
BottomRightCorner = 3
BottomRightSection = 6
BottomSection = 7
BottomToolBarArea = 8
class BrushStyle

Bases: int

BusyCursor = 16
BypassGraphicsProxyWidget = 536870912
BypassWindowManagerHint = 1024
CTRL = 67108864
CaseInsensitive = 0
CaseSensitive = 1
class CaseSensitivity

Bases: int

Ceil = 2
class CheckState

Bases: int

CheckStateRole = 10
Checked = 2
ChecksumIso3309 = 0
ChecksumItuV41 = 1
class ChecksumType

Bases: int

ClickFocus = 2
class ClipOperation

Bases: int

ClosedHandCursor = 18
CoarseTimer = 1
ColorOnly = 3
ConicalGradientPattern = 17
class ConnectionType

Bases: int

ContainsItemBoundingRect = 2
ContainsItemShape = 0
class ContextMenuPolicy

Bases: int

ControlModifier = 67108864
class CoordinateSystem

Bases: int

CopyAction = 1
class Corner

Bases: int

CoverWindow = 65
CrossCursor = 2
CrossPattern = 11
class CursorMoveStyle

Bases: int

class CursorShape

Bases: int

CustomContextMenu = 3
CustomCursor = 25
CustomDashLine = 6
CustomGesture = 256
CustomizeWindowHint = 33554432
DashDotDotLine = 5
DashDotLine = 4
DashLine = 2
class DateFormat

Bases: int

class DayOfWeek

Bases: int

DecorationRole = 1
DefaultContextMenu = 1
DefaultLocaleLongDate = 7
DefaultLocaleShortDate = 6
Dense1Pattern = 2
Dense2Pattern = 3
Dense3Pattern = 4
Dense4Pattern = 5
Dense5Pattern = 6
Dense6Pattern = 7
Dense7Pattern = 8
DescendingOrder = 1
Desktop = 17
DeviceCoordinates = 0
DiagCrossPattern = 14
Dialog = 3
DiffuseAlphaDither = 8
DiffuseDither = 0
DirectConnection = 1
DisplayRole = 0
class DockWidgetArea

Bases: int

DockWidgetArea_Mask = 15
class DockWidgetAreas
class DockWidgetAreas(f: Qt.DockWidgetAreas | Qt.DockWidgetArea)
class DockWidgetAreas(a0: Qt.DockWidgetAreas)

Bases: simplewrapper

DontStartGestureOnChildren = 1
DotLine = 3
DownArrow = 2
DragCopyCursor = 19
DragLinkCursor = 21
DragMoveCursor = 20
Drawer = 7
class DropAction

Bases: int

class DropActions
class DropActions(f: Qt.DropActions | Qt.DropAction)
class DropActions(a0: Qt.DropActions)

Bases: simplewrapper

class Edge

Bases: int

class Edges
class Edges(f: Qt.Edges | Qt.Edge)
class Edges(a0: Qt.Edges)

Bases: simplewrapper

EditRole = 2
ElideLeft = 0
ElideMiddle = 2
ElideNone = 3
ElideRight = 1
EndNativeGesture = 1
EnterKeyDefault = 0
EnterKeyDone = 2
EnterKeyGo = 3
EnterKeyNext = 6
EnterKeyPrevious = 7
EnterKeyReturn = 1
EnterKeySearch = 5
EnterKeySend = 4
class EnterKeyType

Bases: int

class EventPriority

Bases: int

ExactHit = 0
ExtraButton1 = 8
ExtraButton10 = 4096
ExtraButton11 = 8192
ExtraButton12 = 16384
ExtraButton13 = 32768
ExtraButton14 = 65536
ExtraButton15 = 131072
ExtraButton16 = 262144
ExtraButton17 = 524288
ExtraButton18 = 1048576
ExtraButton19 = 2097152
ExtraButton2 = 16
ExtraButton20 = 4194304
ExtraButton21 = 8388608
ExtraButton22 = 16777216
ExtraButton23 = 33554432
ExtraButton24 = 67108864
ExtraButton3 = 32
ExtraButton4 = 64
ExtraButton5 = 128
ExtraButton6 = 256
ExtraButton7 = 512
ExtraButton8 = 1024
ExtraButton9 = 2048
FDiagPattern = 13
FastTransformation = 0
class FillRule

Bases: int

class FindChildOption

Bases: int

class FindChildOptions
class FindChildOptions(f: Qt.FindChildOptions | Qt.FindChildOption)
class FindChildOptions(a0: Qt.FindChildOptions)

Bases: simplewrapper

FindChildrenRecursively = 1
FindDirectChildrenOnly = 0
FlatCap = 0
Floor = 3
class FocusPolicy

Bases: int

class FocusReason

Bases: int

FontRole = 6
ForbiddenCursor = 14
ForegroundRole = 9
ForeignWindow = 33
ForwardButton = 16
FramelessWindowHint = 2048
Friday = 5
FuzzyHit = 1
GestureCanceled = 4
GestureFinished = 3
class GestureFlag

Bases: int

class GestureFlags
class GestureFlags(f: Qt.GestureFlags | Qt.GestureFlag)
class GestureFlags(a0: Qt.GestureFlags)

Bases: simplewrapper

GestureStarted = 1
class GestureState

Bases: int

class GestureType

Bases: int

GestureUpdated = 2
class GlobalColor

Bases: int

GroupSwitchModifier = 1073741824
class HighDpiScaleFactorRoundingPolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Ceil = 2
Floor = 3
PassThrough = 5
Round = 1
RoundPreferFloor = 4
HighDpiScaleFactorRoundingPolicys

alias of HighDpiScaleFactorRoundingPolicy

HighEventPriority = 1
class HitTestAccuracy

Bases: int

HorPattern = 9
Horizontal = 1
IBeamCursor = 4
ISODate = 1
ISODateWithMs = 9
IgnoreAction = 0
IgnoreAspectRatio = 0
IgnoredGesturesPropagateToParent = 4
ImAbsolutePosition = 1024
ImAnchorPosition = 128
ImAnchorRectangle = 16384
ImCurrentSelection = 32
ImCursorPosition = 8
ImCursorRectangle = 2
ImEnabled = 1
ImEnterKeyType = 8192
ImFont = 4
ImHints = 256
ImInputItemClipRectangle = 32768
ImMaximumTextLength = 64
ImMicroFocus = 2
ImPlatformData = -2147483648
ImPreferredLanguage = 512
ImQueryAll = -1
ImQueryInput = 16570
ImSurroundingText = 16
ImTextAfterCursor = 4096
ImTextBeforeCursor = 2048
class ImageConversionFlag

Bases: int

class ImageConversionFlags
class ImageConversionFlags(f: Qt.ImageConversionFlags | Qt.ImageConversionFlag)
class ImageConversionFlags(a0: Qt.ImageConversionFlags)

Bases: simplewrapper

ImhDate = 128
ImhDialableCharactersOnly = 1048576
ImhDigitsOnly = 65536
ImhEmailCharactersOnly = 2097152
ImhExclusiveInputMask = -65536
ImhFormattedNumbersOnly = 131072
ImhHiddenText = 1
ImhLatinOnly = 8388608
ImhLowercaseOnly = 524288
ImhMultiLine = 1024
ImhNoAutoUppercase = 4
ImhNoEditMenu = 2048
ImhNoPredictiveText = 64
ImhNoTextHandles = 4096
ImhNone = 0
ImhPreferLatin = 512
ImhPreferLowercase = 32
ImhPreferNumbers = 8
ImhPreferUppercase = 16
ImhSensitiveData = 2
ImhTime = 256
ImhUppercaseOnly = 262144
ImhUrlCharactersOnly = 4194304
InitialSortOrderRole = 14
class InputMethodHint

Bases: int

class InputMethodHints
class InputMethodHints(f: Qt.InputMethodHints | Qt.InputMethodHint)
class InputMethodHints(a0: Qt.InputMethodHints)

Bases: simplewrapper

class InputMethodQueries
class InputMethodQueries(f: Qt.InputMethodQueries | Qt.InputMethodQuery)
class InputMethodQueries(a0: Qt.InputMethodQueries)

Bases: simplewrapper

class InputMethodQuery

Bases: int

IntersectClip = 2
IntersectsItemBoundingRect = 3
IntersectsItemShape = 1
InvertedLandscapeOrientation = 8
InvertedPortraitOrientation = 4
class ItemDataRole

Bases: int

class ItemFlag

Bases: int

class ItemFlags
class ItemFlags(f: Qt.ItemFlags | Qt.ItemFlag)
class ItemFlags(a0: Qt.ItemFlags)

Bases: simplewrapper

ItemIsAutoTristate = 64
ItemIsDragEnabled = 4
ItemIsDropEnabled = 8
ItemIsEditable = 2
ItemIsEnabled = 32
ItemIsSelectable = 1
ItemIsTristate = 64
ItemIsUserCheckable = 16
ItemIsUserTristate = 256
ItemNeverHasChildren = 128
class ItemSelectionMode

Bases: int

class ItemSelectionOperation

Bases: int

KeepAspectRatio = 1
KeepAspectRatioByExpanding = 2
class Key

Bases: int

Key_0 = 48
Key_1 = 49
Key_2 = 50
Key_3 = 51
Key_4 = 52
Key_5 = 53
Key_6 = 54
Key_7 = 55
Key_8 = 56
Key_9 = 57
Key_A = 65
Key_AE = 198
Key_Aacute = 193
Key_Acircumflex = 194
Key_AddFavorite = 16777408
Key_Adiaeresis = 196
Key_Agrave = 192
Key_Alt = 16777251
Key_AltGr = 16781571
Key_Ampersand = 38
Key_Any = 32
Key_Apostrophe = 39
Key_ApplicationLeft = 16777415
Key_ApplicationRight = 16777416
Key_Aring = 197
Key_AsciiCircum = 94
Key_AsciiTilde = 126
Key_Asterisk = 42
Key_At = 64
Key_Atilde = 195
Key_AudioCycleTrack = 16777478
Key_AudioForward = 16777474
Key_AudioRandomPlay = 16777476
Key_AudioRepeat = 16777475
Key_AudioRewind = 16777413
Key_Away = 16777464
Key_B = 66
Key_Back = 16777313
Key_BackForward = 16777414
Key_Backslash = 92
Key_Backspace = 16777219
Key_Backtab = 16777218
Key_Bar = 124
Key_BassBoost = 16777331
Key_BassDown = 16777333
Key_BassUp = 16777332
Key_Battery = 16777470
Key_Blue = 16777495
Key_Bluetooth = 16777471
Key_Book = 16777417
Key_BraceLeft = 123
Key_BraceRight = 125
Key_BracketLeft = 91
Key_BracketRight = 93
Key_BrightnessAdjust = 16777410
Key_C = 67
Key_CD = 16777418
Key_Calculator = 16777419
Key_Calendar = 16777444
Key_Call = 17825796
Key_Camera = 17825824
Key_CameraFocus = 17825825
Key_Cancel = 16908289
Key_CapsLock = 16777252
Key_Ccedilla = 199
Key_ChannelDown = 16777497
Key_ChannelUp = 16777496
Key_Clear = 16777227
Key_ClearGrab = 16777421
Key_Close = 16777422
Key_Codeinput = 16781623
Key_Colon = 58
Key_Comma = 44
Key_Community = 16777412
Key_Context1 = 17825792
Key_Context2 = 17825793
Key_Context3 = 17825794
Key_Context4 = 17825795
Key_ContrastAdjust = 16777485
Key_Control = 16777249
Key_Copy = 16777423
Key_Cut = 16777424
Key_D = 68
Key_DOS = 16777426
Key_Dead_A = 16781953
Key_Dead_Abovecomma = 16781924
Key_Dead_Abovedot = 16781910
Key_Dead_Abovereversedcomma = 16781925
Key_Dead_Abovering = 16781912
Key_Dead_Aboveverticalline = 16781969
Key_Dead_Acute = 16781905
Key_Dead_Belowbreve = 16781931
Key_Dead_Belowcircumflex = 16781929
Key_Dead_Belowcomma = 16781934
Key_Dead_Belowdiaeresis = 16781932
Key_Dead_Belowdot = 16781920
Key_Dead_Belowmacron = 16781928
Key_Dead_Belowring = 16781927
Key_Dead_Belowtilde = 16781930
Key_Dead_Belowverticalline = 16781970
Key_Dead_Breve = 16781909
Key_Dead_Capital_Schwa = 16781963
Key_Dead_Caron = 16781914
Key_Dead_Cedilla = 16781915
Key_Dead_Circumflex = 16781906
Key_Dead_Currency = 16781935
Key_Dead_Diaeresis = 16781911
Key_Dead_Doubleacute = 16781913
Key_Dead_Doublegrave = 16781926
Key_Dead_E = 16781955
Key_Dead_Grave = 16781904
Key_Dead_Greek = 16781964
Key_Dead_Hook = 16781921
Key_Dead_Horn = 16781922
Key_Dead_I = 16781957
Key_Dead_Invertedbreve = 16781933
Key_Dead_Iota = 16781917
Key_Dead_Longsolidusoverlay = 16781971
Key_Dead_Lowline = 16781968
Key_Dead_Macron = 16781908
Key_Dead_O = 16781959
Key_Dead_Ogonek = 16781916
Key_Dead_Semivoiced_Sound = 16781919
Key_Dead_Small_Schwa = 16781962
Key_Dead_Stroke = 16781923
Key_Dead_Tilde = 16781907
Key_Dead_U = 16781961
Key_Dead_Voiced_Sound = 16781918
Key_Dead_a = 16781952
Key_Dead_e = 16781954
Key_Dead_i = 16781956
Key_Dead_o = 16781958
Key_Dead_u = 16781960
Key_Delete = 16777223
Key_Direction_L = 16777305
Key_Direction_R = 16777312
Key_Display = 16777425
Key_Documents = 16777427
Key_Dollar = 36
Key_Down = 16777237
Key_E = 69
Key_ETH = 208
Key_Eacute = 201
Key_Ecircumflex = 202
Key_Ediaeresis = 203
Key_Egrave = 200
Key_Eisu_Shift = 16781615
Key_Eisu_toggle = 16781616
Key_Eject = 16777401
Key_End = 16777233
Key_Enter = 16777221
Key_Equal = 61
Key_Escape = 16777216
Key_Excel = 16777428
Key_Exclam = 33
Key_Execute = 16908291
Key_Exit = 16908298
Key_Explorer = 16777429
Key_F = 70
Key_F1 = 16777264
Key_F10 = 16777273
Key_F11 = 16777274
Key_F12 = 16777275
Key_F13 = 16777276
Key_F14 = 16777277
Key_F15 = 16777278
Key_F16 = 16777279
Key_F17 = 16777280
Key_F18 = 16777281
Key_F19 = 16777282
Key_F2 = 16777265
Key_F20 = 16777283
Key_F21 = 16777284
Key_F22 = 16777285
Key_F23 = 16777286
Key_F24 = 16777287
Key_F25 = 16777288
Key_F26 = 16777289
Key_F27 = 16777290
Key_F28 = 16777291
Key_F29 = 16777292
Key_F3 = 16777266
Key_F30 = 16777293
Key_F31 = 16777294
Key_F32 = 16777295
Key_F33 = 16777296
Key_F34 = 16777297
Key_F35 = 16777298
Key_F4 = 16777267
Key_F5 = 16777268
Key_F6 = 16777269
Key_F7 = 16777270
Key_F8 = 16777271
Key_F9 = 16777272
Key_Favorites = 16777361
Key_Finance = 16777411
Key_Find = 16777506
Key_Flip = 17825798
Key_Forward = 16777314
Key_G = 71
Key_Game = 16777430
Key_Go = 16777431
Key_Greater = 62
Key_Green = 16777493
Key_Guide = 16777498
Key_H = 72
Key_Hangul = 16781617
Key_Hangul_Banja = 16781625
Key_Hangul_End = 16781619
Key_Hangul_Hanja = 16781620
Key_Hangul_Jamo = 16781621
Key_Hangul_Jeonja = 16781624
Key_Hangul_PostHanja = 16781627
Key_Hangul_PreHanja = 16781626
Key_Hangul_Romaja = 16781622
Key_Hangul_Special = 16781631
Key_Hangul_Start = 16781618
Key_Hangup = 17825797
Key_Hankaku = 16781609
Key_Help = 16777304
Key_Henkan = 16781603
Key_Hibernate = 16777480
Key_Hiragana = 16781605
Key_Hiragana_Katakana = 16781607
Key_History = 16777407
Key_Home = 16777232
Key_HomePage = 16777360
Key_Hyper_L = 16777302
Key_Hyper_R = 16777303
Key_I = 73
Key_Iacute = 205
Key_Icircumflex = 206
Key_Idiaeresis = 207
Key_Igrave = 204
Key_Info = 16777499
Key_Insert = 16777222
Key_J = 74
Key_K = 75
Key_Kana_Lock = 16781613
Key_Kana_Shift = 16781614
Key_Kanji = 16781601
Key_Katakana = 16781606
Key_KeyboardBrightnessDown = 16777398
Key_KeyboardBrightnessUp = 16777397
Key_KeyboardLightOnOff = 16777396
Key_L = 76
Key_LastNumberRedial = 17825801
Key_Launch0 = 16777378
Key_Launch1 = 16777379
Key_Launch2 = 16777380
Key_Launch3 = 16777381
Key_Launch4 = 16777382
Key_Launch5 = 16777383
Key_Launch6 = 16777384
Key_Launch7 = 16777385
Key_Launch8 = 16777386
Key_Launch9 = 16777387
Key_LaunchA = 16777388
Key_LaunchB = 16777389
Key_LaunchC = 16777390
Key_LaunchD = 16777391
Key_LaunchE = 16777392
Key_LaunchF = 16777393
Key_LaunchG = 16777486
Key_LaunchH = 16777487
Key_LaunchMail = 16777376
Key_LaunchMedia = 16777377
Key_Left = 16777234
Key_Less = 60
Key_LightBulb = 16777405
Key_LogOff = 16777433
Key_M = 77
Key_MailForward = 16777467
Key_Market = 16777434
Key_Massyo = 16781612
Key_MediaLast = 16842751
Key_MediaNext = 16777347
Key_MediaPause = 16777349
Key_MediaPlay = 16777344
Key_MediaPrevious = 16777346
Key_MediaRecord = 16777348
Key_MediaStop = 16777345
Key_MediaTogglePlayPause = 16777350
Key_Meeting = 16777435
Key_Memo = 16777404
Key_Menu = 16777301
Key_MenuKB = 16777436
Key_MenuPB = 16777437
Key_Messenger = 16777465
Key_Meta = 16777250
Key_MicMute = 16777491
Key_MicVolumeDown = 16777502
Key_MicVolumeUp = 16777501
Key_Minus = 45
Key_Mode_switch = 16781694
Key_MonBrightnessDown = 16777395
Key_MonBrightnessUp = 16777394
Key_Muhenkan = 16781602
Key_Multi_key = 16781600
Key_MultipleCandidate = 16781629
Key_Music = 16777469
Key_MySites = 16777438
Key_N = 78
Key_New = 16777504
Key_News = 16777439
Key_No = 16842754
Key_Ntilde = 209
Key_NumLock = 16777253
Key_NumberSign = 35
Key_O = 79
Key_Oacute = 211
Key_Ocircumflex = 212
Key_Odiaeresis = 214
Key_OfficeHome = 16777440
Key_Ograve = 210
Key_Ooblique = 216
Key_Open = 16777505
Key_OpenUrl = 16777364
Key_Option = 16777441
Key_Otilde = 213
Key_P = 80
Key_PageDown = 16777239
Key_PageUp = 16777238
Key_ParenLeft = 40
Key_ParenRight = 41
Key_Paste = 16777442
Key_Pause = 16777224
Key_Percent = 37
Key_Period = 46
Key_Phone = 16777443
Key_Pictures = 16777468
Key_Play = 16908293
Key_Plus = 43
Key_PowerDown = 16777483
Key_PowerOff = 16777399
Key_PreviousCandidate = 16781630
Key_Print = 16777225
Key_Printer = 16908290
Key_Q = 81
Key_Question = 63
Key_QuoteDbl = 34
Key_QuoteLeft = 96
Key_R = 82
Key_Red = 16777492
Key_Redo = 16777508
Key_Refresh = 16777316
Key_Reload = 16777446
Key_Reply = 16777445
Key_Return = 16777220
Key_Right = 16777236
Key_Romaji = 16781604
Key_RotateWindows = 16777447
Key_RotationKB = 16777449
Key_RotationPB = 16777448
Key_S = 83
Key_Save = 16777450
Key_ScreenSaver = 16777402
Key_ScrollLock = 16777254
Key_Select = 16842752
Key_Semicolon = 59
Key_Send = 16777451
Key_Settings = 16777500
Key_Shift = 16777248
Key_Shop = 16777406
Key_SingleCandidate = 16781628
Key_Slash = 47
Key_Sleep = 16908292
Key_Space = 32
Key_Spell = 16777452
Key_SplitScreen = 16777453
Key_Standby = 16777363
Key_Stop = 16777315
Key_Subtitle = 16777477
Key_Super_L = 16777299
Key_Super_R = 16777300
Key_Support = 16777454
Key_Suspend = 16777484
Key_SysReq = 16777226
Key_T = 84
Key_THORN = 222
Key_Tab = 16777217
Key_TaskPane = 16777455
Key_Terminal = 16777456
Key_Time = 16777479
Key_ToDoList = 16777420
Key_ToggleCallHangup = 17825799
Key_Tools = 16777457
Key_TopMenu = 16777482
Key_TouchpadOff = 16777490
Key_TouchpadOn = 16777489
Key_TouchpadToggle = 16777488
Key_Touroku = 16781611
Key_Travel = 16777458
Key_TrebleDown = 16777335
Key_TrebleUp = 16777334
Key_U = 85
Key_UWB = 16777473
Key_Uacute = 218
Key_Ucircumflex = 219
Key_Udiaeresis = 220
Key_Ugrave = 217
Key_Underscore = 95
Key_Undo = 16777507
Key_Up = 16777235
Key_V = 86
Key_Video = 16777459
Key_View = 16777481
Key_VoiceDial = 17825800
Key_VolumeDown = 16777328
Key_VolumeMute = 16777329
Key_VolumeUp = 16777330
Key_W = 87
Key_WLAN = 16777472
Key_WWW = 16777403
Key_WakeUp = 16777400
Key_WebCam = 16777466
Key_Word = 16777460
Key_X = 88
Key_Xfer = 16777461
Key_Y = 89
Key_Yacute = 221
Key_Yellow = 16777494
Key_Yes = 16842753
Key_Z = 90
Key_Zenkaku = 16781608
Key_Zenkaku_Hankaku = 16781610
Key_Zoom = 16908294
Key_ZoomIn = 16777462
Key_ZoomOut = 16777463
Key_acute = 180
Key_brokenbar = 166
Key_cedilla = 184
Key_cent = 162
Key_currency = 164
Key_degree = 176
Key_diaeresis = 168
Key_division = 247
Key_exclamdown = 161
Key_guillemotleft = 171
Key_guillemotright = 187
Key_hyphen = 173
Key_iTouch = 16777432
Key_macron = 175
Key_masculine = 186
Key_mu = 181
Key_multiply = 215
Key_nobreakspace = 160
Key_notsign = 172
Key_onehalf = 189
Key_onequarter = 188
Key_onesuperior = 185
Key_ordfeminine = 170
Key_paragraph = 182
Key_periodcentered = 183
Key_plusminus = 177
Key_questiondown = 191
Key_registered = 174
Key_section = 167
Key_ssharp = 223
Key_sterling = 163
Key_threequarters = 190
Key_threesuperior = 179
Key_twosuperior = 178
Key_unknown = 33554431
Key_ydiaeresis = 255
Key_yen = 165
class KeyboardModifier

Bases: int

KeyboardModifierMask = -33554432
class KeyboardModifiers
class KeyboardModifiers(f: Qt.KeyboardModifiers | Qt.KeyboardModifier)
class KeyboardModifiers(a0: Qt.KeyboardModifiers)

Bases: simplewrapper

KeypadModifier = 536870912
LandscapeOrientation = 2
LastCursor = 21
class LayoutDirection

Bases: int

LayoutDirectionAuto = 2
LeftArrow = 3
LeftButton = 1
LeftDockWidgetArea = 1
LeftEdge = 2
LeftSection = 1
LeftToRight = 0
LeftToolBarArea = 1
LinearGradientPattern = 15
LinkAction = 4
LinksAccessibleByKeyboard = 8
LinksAccessibleByMouse = 4
LocalDate = 2
LocalTime = 0
LocaleDate = 3
LogicalCoordinates = 1
LogicalMoveStyle = 0
LowEventPriority = -1
META = 268435456
MODIFIER_MASK = -33554432
MPenCapStyle = 48
MPenJoinStyle = 448
MPenStyle = 15
MSWindowsFixedSizeDialogHint = 256
MSWindowsOwnDC = 512
MacWindowToolBarButtonHint = 268435456
MarkdownText = 3
MaskInColor = 0
class MaskMode

Bases: int

MaskOutColor = 1
MatchCaseSensitive = 16
MatchContains = 1
MatchEndsWith = 3
MatchExactly = 0
MatchFixedString = 8
class MatchFlag

Bases: int

class MatchFlags
class MatchFlags(f: Qt.MatchFlags | Qt.MatchFlag)
class MatchFlags(a0: Qt.MatchFlags)

Bases: simplewrapper

MatchRecursive = 64
MatchRegExp = 4
MatchRegularExpression = 9
MatchStartsWith = 2
MatchWildcard = 5
MatchWrap = 32
MaximizeUsingFullscreenGeometryHint = 4194304
MaximumSize = 2
MenuBarFocusReason = 6
MetaModifier = 268435456
MidButton = 4
MiddleButton = 4
MinimumDescent = 3
MinimumSize = 0
MiterJoin = 0
class Modifier

Bases: int

Monday = 1
MonoOnly = 2
class MouseButton

Bases: int

class MouseButtons
class MouseButtons(f: Qt.MouseButtons | Qt.MouseButton)
class MouseButtons(a0: Qt.MouseButtons)

Bases: simplewrapper

MouseEventCreatedDoubleClick = 1
class MouseEventFlag

Bases: int

class MouseEventFlags
class MouseEventFlags(f: Qt.MouseEventFlags | Qt.MouseEventFlag)
class MouseEventFlags(a0: Qt.MouseEventFlags)

Bases: simplewrapper

MouseEventNotSynthesized = 0
class MouseEventSource

Bases: int

MouseEventSynthesizedByApplication = 3
MouseEventSynthesizedByQt = 2
MouseEventSynthesizedBySystem = 1
MouseFocusReason = 0
MoveAction = 2
class NativeGestureType

Bases: int

class NavigationMode

Bases: int

NavigationModeCursorAuto = 3
NavigationModeCursorForceVisible = 4
NavigationModeKeypadDirectional = 2
NavigationModeKeypadTabOrder = 1
NavigationModeNone = 0
NoArrow = 0
NoBrush = 0
NoButton = 0
NoClip = 0
NoContextMenu = 0
NoDockWidgetArea = 0
NoDropShadowWindowHint = 1073741824
NoFocus = 0
NoFocusReason = 8
NoFormatConversion = 512
NoItemFlags = 0
NoModifier = 0
NoOpaqueDetection = 256
NoPen = 0
NoScrollPhase = 0
NoSection = 0
NoTabFocus = 0
NoTextInteraction = 0
NoToolBarArea = 0
NonModal = 0
NormalEventPriority = 0
OddEvenFill = 0
OffsetFromUTC = 2
OpaqueMode = 1
OpenHandCursor = 17
OrderedAlphaDither = 4
OrderedDither = 16
class Orientation

Bases: int

class Orientations
class Orientations(f: Qt.Orientations | Qt.Orientation)
class Orientations(a0: Qt.Orientations)

Bases: simplewrapper

OtherFocusReason = 7
PanGesture = 3
PanNativeGesture = 2
PartiallyChecked = 1
PassThrough = 5
class PenCapStyle

Bases: int

class PenJoinStyle

Bases: int

class PenStyle

Bases: int

PinchGesture = 4
PlainText = 0
PointingHandCursor = 13
Popup = 9
PopupFocusReason = 4
PortraitOrientation = 1
PreciseTimer = 0
PreferDither = 64
PreferredSize = 1
PreventContextMenu = 4
PrimaryOrientation = 0
QueuedConnection = 2
RFC2822Date = 8
RadialGradientPattern = 16
ReceivePartialGestures = 2
RelativeSize = 1
RepeatTile = 1
ReplaceClip = 1
ReplaceSelection = 0
RichText = 1
RightArrow = 4
RightButton = 2
RightDockWidgetArea = 2
RightEdge = 4
RightSection = 5
RightToLeft = 1
RightToolBarArea = 2
RotateNativeGesture = 5
Round = 1
RoundCap = 32
RoundJoin = 128
RoundPreferFloor = 4
RoundTile = 2
SHIFT = 33554432
Saturday = 6
class ScreenOrientation

Bases: int

class ScreenOrientations
class ScreenOrientations(f: Qt.ScreenOrientations | Qt.ScreenOrientation)
class ScreenOrientations(a0: Qt.ScreenOrientations)

Bases: simplewrapper

ScrollBarAlwaysOff = 1
ScrollBarAlwaysOn = 2
ScrollBarAsNeeded = 0
class ScrollBarPolicy

Bases: int

ScrollBegin = 1
ScrollEnd = 3
ScrollMomentum = 4
class ScrollPhase

Bases: int

ScrollUpdate = 2
Sheet = 5
ShiftModifier = 33554432
class ShortcutContext

Bases: int

ShortcutFocusReason = 5
SizeAllCursor = 9
SizeBDiagCursor = 7
SizeFDiagCursor = 8
class SizeHint

Bases: int

SizeHintRole = 13
SizeHorCursor = 6
class SizeMode

Bases: int

SizeVerCursor = 5
SmartZoomNativeGesture = 4
SmoothTransformation = 1
SolidLine = 1
SolidPattern = 1
class SortOrder

Bases: int

SplashScreen = 15
SplitHCursor = 12
SplitVCursor = 11
SquareCap = 16
StatusTipRole = 4
StretchTile = 0
StrongFocus = 11
SubWindow = 18
Sunday = 7
SvgMiterJoin = 256
SwipeGesture = 5
SwipeNativeGesture = 6
SystemLocaleDate = 2
SystemLocaleLongDate = 5
SystemLocaleShortDate = 4
TabFocus = 1
TabFocusAllControls = 255
class TabFocusBehavior

Bases: int

TabFocusListControls = 2
TabFocusReason = 1
TabFocusTextControls = 1
TapAndHoldGesture = 2
TapGesture = 1
TargetMoveAction = 32770
TaskButton = 32
TextAlignmentRole = 7
TextBrowserInteraction = 13
TextColorRole = 9
TextDate = 0
TextDontClip = 512
TextDontPrint = 16384
TextEditable = 16
TextEditorInteraction = 19
class TextElideMode

Bases: int

TextExpandTabs = 1024
class TextFlag

Bases: int

class TextFormat

Bases: int

TextHideMnemonic = 32768
TextIncludeTrailingSpaces = 134217728
class TextInteractionFlag

Bases: int

class TextInteractionFlags
class TextInteractionFlags(f: Qt.TextInteractionFlags | Qt.TextInteractionFlag)
class TextInteractionFlags(a0: Qt.TextInteractionFlags)

Bases: simplewrapper

TextJustificationForced = 65536
TextSelectableByKeyboard = 2
TextSelectableByMouse = 1
TextShowMnemonic = 2048
TextSingleLine = 256
TextWordWrap = 4096
TextWrapAnywhere = 8192
TexturePattern = 24
ThresholdAlphaDither = 0
ThresholdDither = 32
Thursday = 4
class TileRule

Bases: int

class TimeSpec

Bases: int

TimeZone = 3
class TimerType

Bases: int

TitleBarArea = 9
Tool = 11
class ToolBarArea

Bases: int

ToolBarArea_Mask = 15
class ToolBarAreas
class ToolBarAreas(f: Qt.ToolBarAreas | Qt.ToolBarArea)
class ToolBarAreas(a0: Qt.ToolBarAreas)

Bases: simplewrapper

ToolButtonFollowStyle = 4
ToolButtonIconOnly = 0
class ToolButtonStyle

Bases: int

ToolButtonTextBesideIcon = 2
ToolButtonTextOnly = 1
ToolButtonTextUnderIcon = 3
ToolTip = 13
ToolTipRole = 3
TopDockWidgetArea = 4
TopEdge = 1
TopLeftCorner = 0
TopLeftSection = 2
TopRightCorner = 1
TopRightSection = 4
TopSection = 3
TopToolBarArea = 4
TouchPointMoved = 2
TouchPointPressed = 1
TouchPointReleased = 8
class TouchPointState

Bases: int

class TouchPointStates
class TouchPointStates(f: Qt.TouchPointStates | Qt.TouchPointState)
class TouchPointStates(a0: Qt.TouchPointStates)

Bases: simplewrapper

TouchPointStationary = 4
class TransformationMode

Bases: int

TransparentMode = 0
Tuesday = 2
class UIEffect

Bases: int

UI_AnimateCombo = 3
UI_AnimateMenu = 1
UI_AnimateToolBox = 6
UI_AnimateTooltip = 4
UI_FadeMenu = 2
UI_FadeTooltip = 5
UI_General = 0
UNICODE_ACCEL = 0
UTC = 1
Unchecked = 0
UniqueConnection = 128
UpArrow = 1
UpArrowCursor = 1
UserRole = 256
VerPattern = 10
Vertical = 2
VeryCoarseTimer = 2
VisualMoveStyle = 1
WA_AcceptDrops = 78
WA_AcceptTouchEvents = 121
WA_AlwaysShowToolTips = 84
WA_AlwaysStackOnTop = 128
WA_AttributeCount = 132
WA_ContentsMarginsRespectsSafeArea = 130
WA_CustomWhatsThis = 47
WA_DeleteOnClose = 55
WA_Disabled = 0
WA_DontCreateNativeAncestors = 101
WA_DontShowOnScreen = 103
WA_ForceDisabled = 32
WA_ForceUpdatesDisabled = 59
WA_GrabbedShortcut = 50
WA_GroupLeader = 72
WA_Hover = 74
WA_InputMethodEnabled = 14
WA_InputMethodTransparent = 75
WA_InvalidSize = 45
WA_KeyCompression = 33
WA_KeyboardFocusChange = 77
WA_LaidOut = 7
WA_LayoutOnEntireRect = 48
WA_LayoutUsesWidgetRect = 92
WA_MSWindowsUseDirect3D = 94
WA_MacAlwaysShowToolWindow = 96
WA_MacBrushedMetal = 46
WA_MacFrameworkScaled = 117
WA_MacMetalStyle = 46
WA_MacMiniSize = 91
WA_MacNoClickThrough = 12
WA_MacNoShadow = 127
WA_MacNormalSize = 89
WA_MacOpaqueSizeGrip = 85
WA_MacShowFocusRect = 88
WA_MacSmallSize = 90
WA_MacVariableSize = 102
WA_Mapped = 11
WA_MouseNoMask = 71
WA_MouseTracking = 2
WA_Moved = 43
WA_NativeWindow = 100
WA_NoChildEventsForParent = 58
WA_NoChildEventsFromChildren = 39
WA_NoMousePropagation = 73
WA_NoMouseReplay = 54
WA_NoSystemBackground = 9
WA_NoX11EventCompression = 81
WA_OpaquePaintEvent = 4
WA_OutsideWSRange = 49
WA_PaintOnScreen = 8
WA_PaintUnclipped = 52
WA_PendingMoveEvent = 34
WA_PendingResizeEvent = 35
WA_PendingUpdate = 44
WA_QuitOnClose = 76
WA_Resized = 42
WA_RightToLeft = 56
WA_SetCursor = 38
WA_SetFont = 37
WA_SetLayoutDirection = 57
WA_SetLocale = 87
WA_SetPalette = 36
WA_SetStyle = 86
WA_SetWindowIcon = 53
WA_ShowWithoutActivating = 98
WA_StaticContents = 5
WA_StyleSheet = 97
WA_StyleSheetTarget = 131
WA_StyledBackground = 93
WA_TabletTracking = 129
WA_TintedBackground = 82
WA_TouchPadAcceptSingleTouchEvents = 123
WA_TranslucentBackground = 120
WA_TransparentForMouseEvents = 51
WA_UnderMouse = 1
WA_UpdatesDisabled = 10
WA_WState_CompressKeys = 61
WA_WState_ConfigPending = 64
WA_WState_Created = 60
WA_WState_ExplicitShowHide = 69
WA_WState_Hidden = 16
WA_WState_InPaintEvent = 62
WA_WState_OwnSizePolicy = 68
WA_WState_Polished = 66
WA_WState_Reparented = 63
WA_WState_Visible = 15
WA_WindowModified = 41
WA_WindowPropagation = 80
WA_X11DoNotAcceptFocus = 126
WA_X11NetWmWindowTypeCombo = 115
WA_X11NetWmWindowTypeDND = 116
WA_X11NetWmWindowTypeDesktop = 104
WA_X11NetWmWindowTypeDialog = 110
WA_X11NetWmWindowTypeDock = 105
WA_X11NetWmWindowTypeDropDownMenu = 111
WA_X11NetWmWindowTypeMenu = 107
WA_X11NetWmWindowTypeNotification = 114
WA_X11NetWmWindowTypePopupMenu = 112
WA_X11NetWmWindowTypeSplash = 109
WA_X11NetWmWindowTypeToolBar = 106
WA_X11NetWmWindowTypeToolTip = 113
WA_X11NetWmWindowTypeUtility = 108
WA_X11OpenGLOverlay = 83
WaitCursor = 3
Wednesday = 3
WhatsThisCursor = 15
WhatsThisRole = 5
WheelFocus = 15
class WhiteSpaceMode

Bases: int

WhiteSpaceModeUndefined = -1
WhiteSpaceNoWrap = 2
WhiteSpaceNormal = 0
WhiteSpacePre = 1
Widget = 0
class WidgetAttribute

Bases: int

WidgetShortcut = 0
WidgetWithChildrenShortcut = 3
WindingFill = 1
Window = 1
WindowActive = 8
WindowCloseButtonHint = 134217728
WindowContextHelpButtonHint = 65536
WindowDoesNotAcceptFocus = 2097152
class WindowFlags
class WindowFlags(f: Qt.WindowFlags | Qt.WindowType)
class WindowFlags(a0: Qt.WindowFlags)

Bases: simplewrapper

class WindowFrameSection

Bases: int

WindowFullScreen = 4
WindowFullscreenButtonHint = -2147483648
WindowMaximizeButtonHint = 32768
WindowMaximized = 2
WindowMinMaxButtonsHint = 49152
WindowMinimizeButtonHint = 16384
WindowMinimized = 1
WindowModal = 1
class WindowModality

Bases: int

WindowNoState = 0
WindowOverridesSystemGestures = 1048576
WindowShadeButtonHint = 131072
WindowShortcut = 1
class WindowState

Bases: int

class WindowStates
class WindowStates(f: Qt.WindowStates | Qt.WindowState)
class WindowStates(a0: Qt.WindowStates)

Bases: simplewrapper

WindowStaysOnBottomHint = 67108864
WindowStaysOnTopHint = 262144
WindowSystemMenuHint = 8192
WindowTitleHint = 4096
WindowTransparentForInput = 524288
class WindowType

Bases: int

WindowType_Mask = 255
X11BypassWindowManagerHint = 1024
XAxis = 0
XButton1 = 8
XButton2 = 16
YAxis = 1
ZAxis = 2
ZoomNativeGesture = 3
black = 2
blue = 9
color0 = 0
color1 = 1
convertFromPlainText(plain: str | None, mode: Qt.WhiteSpaceMode = Qt.WhiteSpacePre) str
cyan = 10
darkBlue = 15
darkCyan = 16
darkGray = 4
darkGreen = 14
darkMagenta = 17
darkRed = 13
darkYellow = 18
gray = 5
green = 8
lightGray = 6
magenta = 11
mightBeRichText(a0: str | None) bool
red = 7
transparent = 19
white = 3
yellow = 12
class populse_mia.tests.run_mia_test.QTimer(parent: QObject | None = None)

Bases: QObject

interval(self) int
isActive(self) bool
isSingleShot(self) bool
remainingTime(self) int
setInterval(self, msec: int)
setSingleShot(self, asingleShot: bool)
setTimerType(self, atype: Qt.TimerType)
singleShot(msec: int, slot: PYQT_SLOT)
singleShot(msec: int, timerType: Qt.TimerType, slot: PYQT_SLOT) None
start(self, msec: int)
start(self) None
stop(self)
timeout

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

timerEvent(self, a0: QTimerEvent | None)
timerId(self) int
timerType(self) Qt.TimerType
populse_mia.tests.run_mia_test.qInstallMessageHandler(a0: Callable[[QtMsgType, QMessageLogContext, str | None], None] | None) Callable[[QtMsgType, QMessageLogContext, str | None], None] | None
class populse_mia.tests.run_mia_test.QSignalSpy(signal: pyqtBoundSignal)
class populse_mia.tests.run_mia_test.QSignalSpy(obj: QObject | None, signal: QMetaMethod)

Bases: QObject

isValid(self) bool
signal(self) QByteArray
wait(self, timeout: int = 5000) bool
class populse_mia.tests.run_mia_test.QTest

Bases: simplewrapper

Click = 2
class KeyAction

Bases: int

Press = 0
class QTouchEventSequence(a0: QTest.QTouchEventSequence)

Bases: simplewrapper

commit(self, processEvents: bool = True)
move(self, touchId: int, pt: QPoint, window: QWindow | None = None) QTest.QTouchEventSequence
move(self, touchId: int, pt: QPoint, widget: QWidget | None) QTest.QTouchEventSequence
press(self, touchId: int, pt: QPoint, window: QWindow | None = None) QTest.QTouchEventSequence
press(self, touchId: int, pt: QPoint, widget: QWidget | None) QTest.QTouchEventSequence
release(self, touchId: int, pt: QPoint, window: QWindow | None = None) QTest.QTouchEventSequence
release(self, touchId: int, pt: QPoint, widget: QWidget | None) QTest.QTouchEventSequence
stationary(self, touchId: int) QTest.QTouchEventSequence
Release = 1
Shortcut = 3
keyClick(widget: QWidget | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1)
keyClick(widget: QWidget | None, key: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyClick(window: QWindow | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyClick(window: QWindow | None, key: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyClicks(widget: QWidget | None, sequence: str | None, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1)
keyEvent(action: QTest.KeyAction, widget: QWidget | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1)
keyEvent(action: QTest.KeyAction, widget: QWidget | None, ascii: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyEvent(action: QTest.KeyAction, window: QWindow | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyEvent(action: QTest.KeyAction, window: QWindow | None, ascii: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyPress(widget: QWidget | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1)
keyPress(widget: QWidget | None, key: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyPress(window: QWindow | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyPress(window: QWindow | None, key: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyRelease(widget: QWidget | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1)
keyRelease(widget: QWidget | None, key: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyRelease(window: QWindow | None, key: Qt.Key, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keyRelease(window: QWindow | None, key: str, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.NoModifier, delay: int = -1) None
keySequence(widget: QWidget | None, keySequence: QKeySequence | QKeySequence.StandardKey | str | None | int)
keySequence(window: QWindow | None, keySequence: QKeySequence | QKeySequence.StandardKey | str | None | int) None
mouseClick(widget: QWidget | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1)
mouseClick(window: QWindow | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1) None
mouseDClick(widget: QWidget | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1)
mouseDClick(window: QWindow | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1) None
mouseMove(widget: QWidget | None, pos: QPoint = QPoint(), delay: int = -1)
mouseMove(window: QWindow | None, pos: QPoint = QPoint(), delay: int = -1) None
mousePress(widget: QWidget | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1)
mousePress(window: QWindow | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1) None
mouseRelease(widget: QWidget | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1)
mouseRelease(window: QWindow | None, button: Qt.MouseButton, modifier: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers(), pos: QPoint = QPoint(), delay: int = -1) None
qSleep(ms: int)
qWait(ms: int)
qWaitForWindowActive(window: QWindow | None, timeout: int = 5000) bool
qWaitForWindowActive(widget: QWidget | None, timeout: int = 5000) bool
qWaitForWindowExposed(window: QWindow | None, timeout: int = 5000) bool
qWaitForWindowExposed(widget: QWidget | None, timeout: int = 5000) bool
touchEvent(widget: QWidget | None, device: QTouchDevice | None) QTest.QTouchEventSequence
touchEvent(window: QWindow | None, device: QTouchDevice | None) QTest.QTouchEventSequence
class populse_mia.tests.run_mia_test.QAction(parent: QObject | None = None)
class populse_mia.tests.run_mia_test.QAction(text: str | None, parent: QObject | None = None)
class populse_mia.tests.run_mia_test.QAction(icon: QIcon, text: str | None, parent: QObject | None = None)

Bases: QObject

AboutQtRole = 3
AboutRole = 4
class ActionEvent

Bases: int

ApplicationSpecificRole = 2
HighPriority = 256
Hover = 1
LowPriority = 0
class MenuRole

Bases: int

NoRole = 0
NormalPriority = 128
PreferencesRole = 5
class Priority

Bases: int

QuitRole = 6
TextHeuristicRole = 1
Trigger = 0
actionGroup(self) QActionGroup | None
activate(self, event: QAction.ActionEvent)
associatedGraphicsWidgets(self) List[QGraphicsWidget]
associatedWidgets(self) List[QWidget]
autoRepeat(self) bool
changed

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

data(self) Any
event(self, a0: QEvent | None) bool
font(self) QFont
hover(self)
hovered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

icon(self) QIcon
iconText(self) str
isCheckable(self) bool
isChecked(self) bool
isEnabled(self) bool
isIconVisibleInMenu(self) bool
isSeparator(self) bool
isShortcutVisibleInContextMenu(self) bool
isVisible(self) bool
menu(self) QMenu | None
menuRole(self) QAction.MenuRole
parentWidget(self) QWidget | None
priority(self) QAction.Priority
setActionGroup(self, group: QActionGroup | None)
setAutoRepeat(self, a0: bool)
setCheckable(self, a0: bool)
setChecked(self, a0: bool)
setData(self, var: Any)
setDisabled(self, b: bool)
setEnabled(self, a0: bool)
setFont(self, font: QFont)
setIcon(self, icon: QIcon)
setIconText(self, text: str | None)
setIconVisibleInMenu(self, visible: bool)
setMenu(self, menu: QMenu | None)
setMenuRole(self, menuRole: QAction.MenuRole)
setPriority(self, priority: QAction.Priority)
setSeparator(self, b: bool)
setShortcut(self, shortcut: QKeySequence | QKeySequence.StandardKey | str | None | int)
setShortcutContext(self, context: Qt.ShortcutContext)
setShortcutVisibleInContextMenu(self, show: bool)
setShortcuts(self, shortcuts: Iterable[QKeySequence | QKeySequence.StandardKey | str | None | int])
setShortcuts(self, a0: QKeySequence.StandardKey) None
setStatusTip(self, statusTip: str | None)
setText(self, text: str | None)
setToolTip(self, tip: str | None)
setVisible(self, a0: bool)
setWhatsThis(self, what: str | None)
shortcut(self) QKeySequence
shortcutContext(self) Qt.ShortcutContext
shortcuts(self) List[QKeySequence]
showStatusText(self, widget: QWidget | None = None) bool
statusTip(self) str
text(self) str
toggle(self)
toggled

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

toolTip(self) str
trigger(self)
triggered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

whatsThis(self) str
class populse_mia.tests.run_mia_test.QApplication(argv: List[str])

Bases: QGuiApplication

class ColorSpec

Bases: int

CustomColor = 1
ManyColor = 2
NormalColor = 0
aboutQt()
activeModalWidget() QWidget | None
activePopupWidget() QWidget | None
activeWindow() QWidget | None
alert(widget: QWidget | None, msecs: int = 0)
allWidgets() List[QWidget]
autoSipEnabled(self) bool
beep()
closeAllWindows()
colorSpec() int
cursorFlashTime() int
desktop() QDesktopWidget | None
doubleClickInterval() int
event(self, a0: QEvent | None) bool
exec() int
exec_() int
focusChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

focusWidget() QWidget | None
font() QFont
font(a0: QWidget | None) QFont
font(className: str | None) QFont
fontMetrics() QFontMetrics
globalStrut() QSize
isEffectEnabled(a0: Qt.UIEffect) bool
keyboardInputInterval() int
notify(self, a0: QObject | None, a1: QEvent | None) bool
palette() QPalette
palette(a0: QWidget | None) QPalette
palette(className: str | None) QPalette
setActiveWindow(act: QWidget | None)
setAutoSipEnabled(self, enabled: bool)
setColorSpec(a0: int)
setCursorFlashTime(a0: int)
setDoubleClickInterval(a0: int)
setEffectEnabled(a0: Qt.UIEffect, enabled: bool = True)
setFont(a0: QFont, className: str | None = None)
setGlobalStrut(a0: QSize)
setKeyboardInputInterval(a0: int)
setPalette(a0: QPalette, className: str | None = None)
setStartDragDistance(l: int)
setStartDragTime(ms: int)
setStyle(a0: QStyle | None)
setStyle(a0: str | None) QStyle | None
setStyleSheet(self, sheet: str | None)
setWheelScrollLines(a0: int)
setWindowIcon(icon: QIcon)
startDragDistance() int
startDragTime() int
style() QStyle | None
styleSheet(self) str
topLevelAt(p: QPoint) QWidget | None
topLevelAt(x: int, y: int) QWidget | None
topLevelWidgets() List[QWidget]
wheelScrollLines() int
widgetAt(p: QPoint) QWidget | None
widgetAt(x: int, y: int) QWidget | None
windowIcon() QIcon
class populse_mia.tests.run_mia_test.QDialog(parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags())

Bases: QWidget

Accepted = 1
class DialogCode

Bases: int

Rejected = 0
accept(self)
accepted

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

closeEvent(self, a0: QCloseEvent | None)
contextMenuEvent(self, a0: QContextMenuEvent | None)
done(self, a0: int)
eventFilter(self, a0: QObject | None, a1: QEvent | None) bool
exec(self) int
exec_(self) int
finished

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

isSizeGripEnabled(self) bool
keyPressEvent(self, a0: QKeyEvent | None)
minimumSizeHint(self) QSize
open(self)
reject(self)
rejected

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

resizeEvent(self, a0: QResizeEvent | None)
result(self) int
setModal(self, modal: bool)
setResult(self, r: int)
setSizeGripEnabled(self, a0: bool)
setVisible(self, visible: bool)
showEvent(self, a0: QShowEvent | None)
sizeHint(self) QSize
class populse_mia.tests.run_mia_test.QFileDialog(parent: QWidget | None, f: Qt.WindowFlags | Qt.WindowType)
class populse_mia.tests.run_mia_test.QFileDialog(parent: QWidget | None = None, caption: str | None = '', directory: str | None = '', filter: str | None = '')

Bases: QDialog

Accept = 3
class AcceptMode

Bases: int

AcceptOpen = 0
AcceptSave = 1
AnyFile = 0
Detail = 0
class DialogLabel

Bases: int

Directory = 2
DirectoryOnly = 4
DontConfirmOverwrite = 4
DontUseCustomDirectoryIcons = 128
DontUseNativeDialog = 16
DontUseSheet = 8
ExistingFile = 1
ExistingFiles = 3
class FileMode

Bases: int

FileName = 1
FileType = 2
HideNameFilterDetails = 64
List = 1
LookIn = 0
class Option

Bases: int

class Options
class Options(f: QFileDialog.Options | QFileDialog.Option)
class Options(a0: QFileDialog.Options)

Bases: simplewrapper

ReadOnly = 32
Reject = 4
ShowDirsOnly = 1
class ViewMode

Bases: int

accept(self)
acceptMode(self) QFileDialog.AcceptMode
changeEvent(self, e: QEvent | None)
currentChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

currentUrlChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

defaultSuffix(self) str
directory(self) QDir
directoryEntered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

directoryUrl(self) QUrl
directoryUrlEntered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

done(self, result: int)
fileMode(self) QFileDialog.FileMode
fileSelected

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

filesSelected

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

filter(self) QDir.Filters
filterSelected

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

static getExistingDirectory(parent: QWidget | None = None, caption: str | None = '', directory: str | None = '', options: QFileDialog.Options | QFileDialog.Option = QFileDialog.ShowDirsOnly) str
getExistingDirectoryUrl(parent: QWidget | None = None, caption: str | None = '', directory: QUrl = QUrl(), options: QFileDialog.Options | QFileDialog.Option = QFileDialog.ShowDirsOnly, supportedSchemes: Iterable[str | None] = []) QUrl
static getOpenFileName(parent: QWidget | None = None, caption: str | None = '', directory: str | None = '', filter: str | None = '', initialFilter: str | None = '', options: QFileDialog.Options | QFileDialog.Option = 0) Tuple[str, str]
static getOpenFileNames(parent: QWidget | None = None, caption: str | None = '', directory: str | None = '', filter: str | None = '', initialFilter: str | None = '', options: QFileDialog.Options | QFileDialog.Option = 0) Tuple[List[str], str]
getOpenFileUrl(parent: QWidget | None = None, caption: str | None = '', directory: QUrl = QUrl(), filter: str | None = '', initialFilter: str | None = '', options: QFileDialog.Options | QFileDialog.Option = 0, supportedSchemes: Iterable[str | None] = []) Tuple[QUrl, str]
getOpenFileUrls(parent: QWidget | None = None, caption: str | None = '', directory: QUrl = QUrl(), filter: str | None = '', initialFilter: str | None = '', options: QFileDialog.Options | QFileDialog.Option = 0, supportedSchemes: Iterable[str | None] = []) Tuple[List[QUrl], str]
static getSaveFileName(parent: QWidget | None = None, caption: str | None = '', directory: str | None = '', filter: str | None = '', initialFilter: str | None = '', options: QFileDialog.Options | QFileDialog.Option = 0) Tuple[str, str]
getSaveFileUrl(parent: QWidget | None = None, caption: str | None = '', directory: QUrl = QUrl(), filter: str | None = '', initialFilter: str | None = '', options: QFileDialog.Options | QFileDialog.Option = 0, supportedSchemes: Iterable[str | None] = []) Tuple[QUrl, str]
history(self) List[str]
iconProvider(self) QFileIconProvider | None
itemDelegate(self) QAbstractItemDelegate | None
labelText(self, label: QFileDialog.DialogLabel) str
mimeTypeFilters(self) List[str]
nameFilters(self) List[str]
open(self)
open(self, slot: PYQT_SLOT) None
options(self) QFileDialog.Options
proxyModel(self) QAbstractProxyModel | None
restoreState(self, state: QByteArray | bytes | bytearray) bool
saveFileContent(fileContent: QByteArray | bytes | bytearray, fileNameHint: str | None = '')
saveState(self) QByteArray
selectFile(self, filename: str | None)
selectMimeTypeFilter(self, filter: str | None)
selectNameFilter(self, filter: str | None)
selectUrl(self, url: QUrl)
selectedFiles(self) List[str]
selectedMimeTypeFilter(self) str
selectedNameFilter(self) str
selectedUrls(self) List[QUrl]
setAcceptMode(self, mode: QFileDialog.AcceptMode)
setDefaultSuffix(self, suffix: str | None)
setDirectory(self, directory: str | None)
setDirectory(self, adirectory: QDir) None
setDirectoryUrl(self, directory: QUrl)
setFileMode(self, mode: QFileDialog.FileMode)
setFilter(self, filters: QDir.Filters | QDir.Filter)
setHistory(self, paths: Iterable[str | None])
setIconProvider(self, provider: QFileIconProvider | None)
setItemDelegate(self, delegate: QAbstractItemDelegate | None)
setLabelText(self, label: QFileDialog.DialogLabel, text: str | None)
setMimeTypeFilters(self, filters: Iterable[str | None])
setNameFilter(self, filter: str | None)
setNameFilters(self, filters: Iterable[str | None])
setOption(self, option: QFileDialog.Option, on: bool = True)
setOptions(self, options: QFileDialog.Options | QFileDialog.Option)
setProxyModel(self, model: QAbstractProxyModel | None)
setSidebarUrls(self, urls: Iterable[QUrl])
setSupportedSchemes(self, schemes: Iterable[str | None])
setViewMode(self, mode: QFileDialog.ViewMode)
setVisible(self, visible: bool)
sidebarUrls(self) List[QUrl]
supportedSchemes(self) List[str]
testOption(self, option: QFileDialog.Option) bool
urlSelected

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

urlsSelected

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

viewMode(self) QFileDialog.ViewMode
class populse_mia.tests.run_mia_test.QLabel(parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags())
class populse_mia.tests.run_mia_test.QLabel(text: str | None, parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags())

Bases: QFrame

alignment(self) Qt.Alignment
buddy(self) QWidget | None
changeEvent(self, a0: QEvent | None)
clear(self)
contextMenuEvent(self, ev: QContextMenuEvent | None)
event(self, e: QEvent | None) bool
focusInEvent(self, ev: QFocusEvent | None)
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, ev: QFocusEvent | None)
hasScaledContents(self) bool
hasSelectedText(self) bool
heightForWidth(self, a0: int) int
indent(self) int
keyPressEvent(self, ev: QKeyEvent | None)
linkActivated

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

linkHovered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

margin(self) int
minimumSizeHint(self) QSize
mouseMoveEvent(self, ev: QMouseEvent | None)
mousePressEvent(self, ev: QMouseEvent | None)
mouseReleaseEvent(self, ev: QMouseEvent | None)
movie(self) QMovie | None
paintEvent(self, a0: QPaintEvent | None)
picture(self) QPicture | None
pixmap(self) QPixmap | None
selectedText(self) str
selectionStart(self) int
setAlignment(self, a0: Qt.Alignment | Qt.AlignmentFlag)
setBuddy(self, a0: QWidget | None)
setIndent(self, a0: int)
setMargin(self, a0: int)
setMovie(self, movie: QMovie | None)
setNum(self, a0: float)
setNum(self, a0: int) None
setPicture(self, a0: QPicture)
setPixmap(self, a0: QPixmap)
setScaledContents(self, a0: bool)
setSelection(self, a0: int, a1: int)
setText(self, a0: str | None)
setTextFormat(self, a0: Qt.TextFormat)
setTextInteractionFlags(self, flags: Qt.TextInteractionFlags | Qt.TextInteractionFlag)
setWordWrap(self, on: bool)
sizeHint(self) QSize
text(self) str
textFormat(self) Qt.TextFormat
textInteractionFlags(self) Qt.TextInteractionFlags
wordWrap(self) bool
class populse_mia.tests.run_mia_test.QMessageBox(parent: QWidget | None = None)
class populse_mia.tests.run_mia_test.QMessageBox(icon: QMessageBox.Icon, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.NoButton, parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint)

Bases: QDialog

Abort = 262144
AcceptRole = 0
ActionRole = 3
Apply = 33554432
ApplyRole = 8
ButtonMask = -769
class ButtonRole

Bases: int

Cancel = 4194304
Close = 2097152
Critical = 3
Default = 256
DestructiveRole = 2
Discard = 8388608
Escape = 512
FirstButton = 1024
FlagMask = 768
Help = 16777216
HelpRole = 4
class Icon

Bases: int

Ignore = 1048576
Information = 1
InvalidRole = -1
LastButton = 134217728
No = 65536
NoAll = 131072
NoButton = 0
NoIcon = 0
NoRole = 6
NoToAll = 131072
Ok = 1024
Open = 8192
Question = 4
RejectRole = 1
Reset = 67108864
ResetRole = 7
RestoreDefaults = 134217728
Retry = 524288
Save = 2048
SaveAll = 4096
class StandardButton

Bases: int

class StandardButtons
class StandardButtons(f: QMessageBox.StandardButtons | QMessageBox.StandardButton)
class StandardButtons(a0: QMessageBox.StandardButtons)

Bases: simplewrapper

Warning = 2
Yes = 16384
YesAll = 32768
YesRole = 5
YesToAll = 32768
about(parent: QWidget | None, caption: str | None, text: str | None)
aboutQt(parent: QWidget | None, title: str | None = '')
addButton(self, button: QAbstractButton | None, role: QMessageBox.ButtonRole)
addButton(self, text: str | None, role: QMessageBox.ButtonRole) QPushButton | None
addButton(self, button: QMessageBox.StandardButton) QPushButton | None
button(self, which: QMessageBox.StandardButton) QAbstractButton | None
buttonClicked

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

buttonRole(self, button: QAbstractButton | None) QMessageBox.ButtonRole
buttons(self) List[QAbstractButton]
changeEvent(self, a0: QEvent | None)
checkBox(self) QCheckBox | None
clickedButton(self) QAbstractButton | None
closeEvent(self, a0: QCloseEvent | None)
critical(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton
defaultButton(self) QPushButton | None
detailedText(self) str
escapeButton(self) QAbstractButton | None
event(self, e: QEvent | None) bool
icon(self) QMessageBox.Icon
iconPixmap(self) QPixmap
information(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton
informativeText(self) str
keyPressEvent(self, a0: QKeyEvent | None)
open(self)
open(self, slot: PYQT_SLOT) None
question(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton
removeButton(self, button: QAbstractButton | None)
resizeEvent(self, a0: QResizeEvent | None)
setCheckBox(self, cb: QCheckBox | None)
setDefaultButton(self, button: QPushButton | None)
setDefaultButton(self, button: QMessageBox.StandardButton) None
setDetailedText(self, text: str | None)
setEscapeButton(self, button: QAbstractButton | None)
setEscapeButton(self, button: QMessageBox.StandardButton) None
setIcon(self, a0: QMessageBox.Icon)
setIconPixmap(self, a0: QPixmap)
setInformativeText(self, text: str | None)
setStandardButtons(self, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton)
setText(self, a0: str | None)
setTextFormat(self, a0: Qt.TextFormat)
setTextInteractionFlags(self, flags: Qt.TextInteractionFlags | Qt.TextInteractionFlag)
setWindowModality(self, windowModality: Qt.WindowModality)
setWindowTitle(self, title: str | None)
showEvent(self, a0: QShowEvent | None)
standardButton(self, button: QAbstractButton | None) QMessageBox.StandardButton
standardButtons(self) QMessageBox.StandardButtons
standardIcon(icon: QMessageBox.Icon) QPixmap
text(self) str
textFormat(self) Qt.TextFormat
textInteractionFlags(self) Qt.TextInteractionFlags
warning(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton
class populse_mia.tests.run_mia_test.QPushButton(parent: QWidget | None = None)
class populse_mia.tests.run_mia_test.QPushButton(text: str | None, parent: QWidget | None = None)
class populse_mia.tests.run_mia_test.QPushButton(icon: QIcon, text: str | None, parent: QWidget | None = None)

Bases: QAbstractButton

autoDefault(self) bool
event(self, e: QEvent | None) bool
focusInEvent(self, a0: QFocusEvent | None)
focusOutEvent(self, a0: QFocusEvent | None)
hitButton(self, pos: QPoint) bool
initStyleOption(self, option: QStyleOptionButton | None)
isDefault(self) bool
isFlat(self) bool
keyPressEvent(self, a0: QKeyEvent | None)
menu(self) QMenu | None
minimumSizeHint(self) QSize
paintEvent(self, a0: QPaintEvent | None)
setAutoDefault(self, a0: bool)
setDefault(self, a0: bool)
setFlat(self, a0: bool)
setMenu(self, menu: QMenu | None)
showMenu(self)
sizeHint(self) QSize
class populse_mia.tests.run_mia_test.QTableWidgetItem(type: int = QTableWidgetItem.ItemType.Type)
class populse_mia.tests.run_mia_test.QTableWidgetItem(text: str | None, type: int = QTableWidgetItem.ItemType.Type)
class populse_mia.tests.run_mia_test.QTableWidgetItem(icon: QIcon, text: str | None, type: int = QTableWidgetItem.ItemType.Type)
class populse_mia.tests.run_mia_test.QTableWidgetItem(other: QTableWidgetItem)

Bases: wrapper

class ItemType

Bases: int

Type = 0
UserType = 1000
background(self) QBrush
checkState(self) Qt.CheckState
clone(self) QTableWidgetItem | None
column(self) int
data(self, role: int) Any
flags(self) Qt.ItemFlags
font(self) QFont
foreground(self) QBrush
icon(self) QIcon
isSelected(self) bool
read(self, in_: QDataStream)
row(self) int
setBackground(self, brush: QBrush | QColor | Qt.GlobalColor | QGradient)
setCheckState(self, state: Qt.CheckState)
setData(self, role: int, value: Any)
setFlags(self, aflags: Qt.ItemFlags | Qt.ItemFlag)
setFont(self, afont: QFont)
setForeground(self, brush: QBrush | QColor | Qt.GlobalColor | QGradient)
setIcon(self, aicon: QIcon)
setSelected(self, aselect: bool)
setSizeHint(self, size: QSize)
setStatusTip(self, astatusTip: str | None)
setText(self, atext: str | None)
setTextAlignment(self, alignment: int)
setToolTip(self, atoolTip: str | None)
setWhatsThis(self, awhatsThis: str | None)
sizeHint(self) QSize
statusTip(self) str
tableWidget(self) QTableWidget | None
text(self) str
textAlignment(self) int
toolTip(self) str
type(self) int
whatsThis(self) str
write(self, out: QDataStream)
class populse_mia.tests.run_mia_test.QWidget(parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags())

Bases: QObject, QPaintDevice

DrawChildren = 2
DrawWindowBackground = 1
IgnoreMask = 4
class RenderFlag

Bases: int

class RenderFlags
class RenderFlags(f: QWidget.RenderFlags | QWidget.RenderFlag)
class RenderFlags(a0: QWidget.RenderFlags)

Bases: simplewrapper

acceptDrops(self) bool
accessibleDescription(self) str
accessibleName(self) str
actionEvent(self, a0: QActionEvent | None)
actions(self) List[QAction]
activateWindow(self)
addAction(self, action: QAction | None)
addActions(self, actions: Iterable[QAction])
adjustSize(self)
autoFillBackground(self) bool
backgroundRole(self) QPalette.ColorRole
baseSize(self) QSize
changeEvent(self, a0: QEvent | None)
childAt(self, p: QPoint) QWidget | None
childAt(self, ax: int, ay: int) QWidget | None
childrenRect(self) QRect
childrenRegion(self) QRegion
clearFocus(self)
clearMask(self)
close(self) bool
closeEvent(self, a0: QCloseEvent | None)
contentsMargins(self) QMargins
contentsRect(self) QRect
contextMenuEvent(self, a0: QContextMenuEvent | None)
contextMenuPolicy(self) Qt.ContextMenuPolicy
create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)
createWindowContainer(window: QWindow | None, parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = 0) QWidget
cursor(self) QCursor
customContextMenuRequested

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
devType(self) int
dragEnterEvent(self, a0: QDragEnterEvent | None)
dragLeaveEvent(self, a0: QDragLeaveEvent | None)
dragMoveEvent(self, a0: QDragMoveEvent | None)
dropEvent(self, a0: QDropEvent | None)
effectiveWinId(self) PyQt5.sip.voidptr
ensurePolished(self)
enterEvent(self, a0: QEvent | None)
event(self, a0: QEvent | None) bool
find(a0: PyQt5.sip.voidptr) QWidget | None
focusInEvent(self, a0: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, a0: QFocusEvent | None)
focusPolicy(self) Qt.FocusPolicy
focusPreviousChild(self) bool
focusProxy(self) QWidget | None
focusWidget(self) QWidget | None
font(self) QFont
fontInfo(self) QFontInfo
fontMetrics(self) QFontMetrics
foregroundRole(self) QPalette.ColorRole
frameGeometry(self) QRect
frameSize(self) QSize
geometry(self) QRect
getContentsMargins(self)
grab(self, rectangle: QRect = QRect(QPoint(0, 0), QSize(-1, -1))) QPixmap
grabGesture(self, type: Qt.GestureType, flags: Qt.GestureFlags | Qt.GestureFlag = Qt.GestureFlags())
grabKeyboard(self)
grabMouse(self)
grabMouse(self, a0: QCursor | Qt.CursorShape) None
grabShortcut(self, key: QKeySequence | QKeySequence.StandardKey | str | None | int, context: Qt.ShortcutContext = Qt.WindowShortcut) int
graphicsEffect(self) QGraphicsEffect | None
graphicsProxyWidget(self) QGraphicsProxyWidget | None
hasFocus(self) bool
hasHeightForWidth(self) bool
hasMouseTracking(self) bool
hasTabletTracking(self) bool
height(self) int
heightForWidth(self, a0: int) int
hide(self)
hideEvent(self, a0: QHideEvent | None)
initPainter(self, painter: QPainter | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
inputMethodHints(self) Qt.InputMethodHints
inputMethodQuery(self, a0: Qt.InputMethodQuery) Any
insertAction(self, before: QAction | None, action: QAction | None)
insertActions(self, before: QAction | None, actions: Iterable[QAction])
isActiveWindow(self) bool
isAncestorOf(self, child: QWidget | None) bool
isEnabled(self) bool
isEnabledTo(self, a0: QWidget | None) bool
isFullScreen(self) bool
isHidden(self) bool
isLeftToRight(self) bool
isMaximized(self) bool
isMinimized(self) bool
isModal(self) bool
isRightToLeft(self) bool
isVisible(self) bool
isVisibleTo(self, a0: QWidget | None) bool
isWindow(self) bool
isWindowModified(self) bool
keyPressEvent(self, a0: QKeyEvent | None)
keyReleaseEvent(self, a0: QKeyEvent | None)
keyboardGrabber() QWidget | None
layout(self) QLayout | None
layoutDirection(self) Qt.LayoutDirection
leaveEvent(self, a0: QEvent | None)
locale(self) QLocale
lower(self)
mapFrom(self, a0: QWidget | None, a1: QPoint) QPoint
mapFromGlobal(self, a0: QPoint) QPoint
mapFromParent(self, a0: QPoint) QPoint
mapTo(self, a0: QWidget | None, a1: QPoint) QPoint
mapToGlobal(self, a0: QPoint) QPoint
mapToParent(self, a0: QPoint) QPoint
mask(self) QRegion
maximumHeight(self) int
maximumSize(self) QSize
maximumWidth(self) int
metric(self, a0: QPaintDevice.PaintDeviceMetric) int
minimumHeight(self) int
minimumSize(self) QSize
minimumSizeHint(self) QSize
minimumWidth(self) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseGrabber() QWidget | None
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, a0: QMouseEvent | None)
mouseReleaseEvent(self, a0: QMouseEvent | None)
move(self, a0: QPoint)
move(self, ax: int, ay: int) None
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)
nativeParentWidget(self) QWidget | None
nextInFocusChain(self) QWidget | None
normalGeometry(self) QRect
overrideWindowFlags(self, type: Qt.WindowFlags | Qt.WindowType)
overrideWindowState(self, state: Qt.WindowStates | Qt.WindowState)
paintEngine(self) QPaintEngine | None
paintEvent(self, a0: QPaintEvent | None)
palette(self) QPalette
parentWidget(self) QWidget | None
pos(self) QPoint
previousInFocusChain(self) QWidget | None
raise_(self)
rect(self) QRect
releaseKeyboard(self)
releaseMouse(self)
releaseShortcut(self, id: int)
removeAction(self, action: QAction | None)
render(self, target: QPaintDevice | None, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: QWidget.RenderFlags | QWidget.RenderFlag = QWidget.RenderFlags(QWidget.RenderFlag.DrawWindowBackground | QWidget.RenderFlag.DrawChildren))
render(self, painter: QPainter | None, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: QWidget.RenderFlags | QWidget.RenderFlag = QWidget.RenderFlags(QWidget.RenderFlag.DrawWindowBackground | QWidget.RenderFlag.DrawChildren)) None
repaint(self)
repaint(self, x: int, y: int, w: int, h: int) None
repaint(self, a0: QRect) None
repaint(self, a0: QRegion) None
resize(self, a0: QSize)
resize(self, w: int, h: int) None
resizeEvent(self, a0: QResizeEvent | None)
restoreGeometry(self, geometry: QByteArray | bytes | bytearray) bool
saveGeometry(self) QByteArray
screen(self) QScreen | None
scroll(self, dx: int, dy: int)
scroll(self, dx: int, dy: int, a2: QRect) None
setAcceptDrops(self, on: bool)
setAccessibleDescription(self, description: str | None)
setAccessibleName(self, name: str | None)
setAttribute(self, attribute: Qt.WidgetAttribute, on: bool = True)
setAutoFillBackground(self, enabled: bool)
setBackgroundRole(self, a0: QPalette.ColorRole)
setBaseSize(self, basew: int, baseh: int)
setBaseSize(self, s: QSize) None
setContentsMargins(self, left: int, top: int, right: int, bottom: int)
setContentsMargins(self, margins: QMargins) None
setContextMenuPolicy(self, policy: Qt.ContextMenuPolicy)
setCursor(self, a0: QCursor | Qt.CursorShape)
setDisabled(self, a0: bool)
setEnabled(self, a0: bool)
setFixedHeight(self, h: int)
setFixedSize(self, a0: QSize)
setFixedSize(self, w: int, h: int) None
setFixedWidth(self, w: int)
setFocus(self)
setFocus(self, reason: Qt.FocusReason) None
setFocusPolicy(self, policy: Qt.FocusPolicy)
setFocusProxy(self, a0: QWidget | None)
setFont(self, a0: QFont)
setForegroundRole(self, a0: QPalette.ColorRole)
setGeometry(self, a0: QRect)
setGeometry(self, ax: int, ay: int, aw: int, ah: int) None
setGraphicsEffect(self, effect: QGraphicsEffect | None)
setHidden(self, hidden: bool)
setInputMethodHints(self, hints: Qt.InputMethodHints | Qt.InputMethodHint)
setLayout(self, a0: QLayout | None)
setLayoutDirection(self, direction: Qt.LayoutDirection)
setLocale(self, locale: QLocale)
setMask(self, a0: QBitmap)
setMask(self, a0: QRegion) None
setMaximumHeight(self, maxh: int)
setMaximumSize(self, maxw: int, maxh: int)
setMaximumSize(self, s: QSize) None
setMaximumWidth(self, maxw: int)
setMinimumHeight(self, minh: int)
setMinimumSize(self, minw: int, minh: int)
setMinimumSize(self, s: QSize) None
setMinimumWidth(self, minw: int)
setMouseTracking(self, enable: bool)
setPalette(self, a0: QPalette)
setParent(self, parent: QWidget | None)
setParent(self, parent: QWidget | None, f: Qt.WindowFlags | Qt.WindowType) None
setShortcutAutoRepeat(self, id: int, enabled: bool = True)
setShortcutEnabled(self, id: int, enabled: bool = True)
setSizeIncrement(self, w: int, h: int)
setSizeIncrement(self, s: QSize) None
setSizePolicy(self, a0: QSizePolicy)
setSizePolicy(self, hor: QSizePolicy.Policy, ver: QSizePolicy.Policy) None
setStatusTip(self, a0: str | None)
setStyle(self, a0: QStyle | None)
setStyleSheet(self, styleSheet: str | None)
setTabOrder(a0: QWidget | None, a1: QWidget | None)
setTabletTracking(self, enable: bool)
setToolTip(self, a0: str | None)
setToolTipDuration(self, msec: int)
setUpdatesEnabled(self, enable: bool)
setVisible(self, visible: bool)
setWhatsThis(self, a0: str | None)
setWindowFilePath(self, filePath: str | None)
setWindowFlag(self, a0: Qt.WindowType, on: bool = True)
setWindowFlags(self, type: Qt.WindowFlags | Qt.WindowType)
setWindowIcon(self, icon: QIcon)
setWindowIconText(self, a0: str | None)
setWindowModality(self, windowModality: Qt.WindowModality)
setWindowModified(self, a0: bool)
setWindowOpacity(self, level: float)
setWindowRole(self, a0: str | None)
setWindowState(self, state: Qt.WindowStates | Qt.WindowState)
setWindowTitle(self, a0: str | None)
sharedPainter(self) QPainter | None
show(self)
showEvent(self, a0: QShowEvent | None)
showFullScreen(self)
showMaximized(self)
showMinimized(self)
showNormal(self)
size(self) QSize
sizeHint(self) QSize
sizeIncrement(self) QSize
sizePolicy(self) QSizePolicy
stackUnder(self, a0: QWidget | None)
statusTip(self) str
style(self) QStyle | None
styleSheet(self) str
tabletEvent(self, a0: QTabletEvent | None)
testAttribute(self, attribute: Qt.WidgetAttribute) bool
toolTip(self) str
toolTipDuration(self) int
underMouse(self) bool
ungrabGesture(self, type: Qt.GestureType)
unsetCursor(self)
unsetLayoutDirection(self)
unsetLocale(self)
update(self)
update(self, a0: QRect) None
update(self, a0: QRegion) None
update(self, ax: int, ay: int, aw: int, ah: int) None
updateGeometry(self)
updateMicroFocus(self)
updatesEnabled(self) bool
visibleRegion(self) QRegion
whatsThis(self) str
wheelEvent(self, a0: QWheelEvent | None)
width(self) int
winId(self) PyQt5.sip.voidptr
window(self) QWidget | None
windowFilePath(self) str
windowFlags(self) Qt.WindowFlags
windowHandle(self) QWindow | None
windowIcon(self) QIcon
windowIconChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

windowIconText(self) str
windowIconTextChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

windowModality(self) Qt.WindowModality
windowOpacity(self) float
windowRole(self) str
windowState(self) Qt.WindowStates
windowTitle(self) str
windowTitleChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

windowType(self) Qt.WindowType
x(self) int
y(self) int
populse_mia.tests.run_mia_test.add_to_syspath(path: Path, position: int = 1, name: str = '')[source]

Add a directory to sys.path if it exists and isn’t already there.

Parameters:
  • (Path) (path) – The directory path to be added to sys.path.

  • (int) (position) – The index at which to insert the path. Defaults to 1.

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

class populse_mia.tests.run_mia_test.PipelineNode(pipeline, name, process, **kwargs)[source]

Bases: ProcessNode

A special node to store the pipeline user-parameters

get_connections_through(plug_name, single=False)[source]

If the node has internal links (inside a pipeline, or in a switch or other custom connection node), return the “other side” of the internal connection to the selected plug. The returned plug may be in an internal node (in a pipeline), or in an external node connected to the node. When the node is “opaque” (no internal connections), it returns the input plug. When the node is inactive / disabled, it returns [].

Parameters:
  • plug_name (str) – plug to get connections with

  • single (bool) – if True, stop at the first connected plug. Otherwise return the list of all connected plugs.

Returns:

[(node, plug_name, plug), …] Returns [(self, plug_name, plug)] when the plug has no internal connection.

Return type:

connected_plug; list of tuples

class populse_mia.tests.run_mia_test.ProcessNode(pipeline, name, process, **kwargs)[source]

Bases: Node

Process node.

process

the process instance stored in the pipeline node

Type:

process instance

set_callback_on_plug()[source]
get_plug_value()[source]
set_plug_value()[source]
get_trait()[source]
__init__(pipeline, name, process, **kwargs)[source]

Generate a ProcessNode

Parameters:
  • pipeline (Pipeline (mandatory)) – the pipeline object where the node is added.

  • name (str (mandatory)) – the node name.

  • process (instance) – a process/interface instance.

  • kwargs (dict) – process default values.

set_callback_on_plug(plug_name, callback)[source]

Add an event when a plug change

Parameters:
  • plug_name (str (mandatory)) – a plug name

  • callback (@f (mandatory)) – a callback function

remove_callback_from_plug(plug_name, callback)[source]

Remove an event when a plug change

Parameters:
  • plug_name (str (mandatory)) – a plug name

  • callback (@f (mandatory)) – a callback function

get_plug_value(plug_name)[source]

Return the plug value

Parameters:

plug_name (str (mandatory)) – a plug name

Returns:

output – the plug value

Return type:

object

set_plug_value(plug_name, value, protected=None)[source]

Set the plug value

Parameters:
  • plug_name (str (mandatory)) – a plug name

  • value (object (mandatory)) – the plug value we want to set

  • protected (None or bool (tristate)) – if True or False, force the “protected” status of the plug. If None, keep it as is.

is_parameter_protected(plug_name)[source]

Tells whether the given parameter is protected or not

protect_parameter(plug_name, state=True)[source]

Protect the named parameter.

Protecting is not a real lock, it just marks the parameter a list of “protected” parameters. This is typically used to mark values that have been set manually by the user (using the ControllerWidget for instance) and that should not be later modified by automatic parameters tweaking (such as completion systems).

Protected parameters are listed in an additional trait, “protected_parameters”.

If the “state” parameter is False, then we will unprotect it (calling unprotect_parameter())

get_trait(trait_name)[source]

Return the desired trait

Parameters:

trait_name (str (mandatory)) – a trait name

Returns:

output – the trait named trait_name

Return type:

trait

is_job()[source]

if True, the node will be represented as a Job in Soma-Workflow. Otherwise the node is static and does not run.

requirements()[source]

Requirements reimplementation for a process node. This node delegates to its underlying process. see capsul.process.process.requirements()

check_requirements(environment='global', message_list=None)[source]

Reimplementation of capsul.pipeline.pipeline_nodes.Node.requirements() for a ProcessNode. This one delegates to its underlying process (or pipeline).

get_study_config()[source]

Get (or create) the StudyConfig this process belongs to

set_study_config(study_config)[source]

Get (or create) the StudyConfig this process belongs to

_process_deleted(process)[source]
property study_config
property completion_engine
class populse_mia.tests.run_mia_test.Switch(pipeline, name, inputs, outputs, make_optional=(), output_types=None)[source]

Bases: Node

Switch node to select a specific Process.

A switch commutes a group of inputs to its outputs, according to its “switch” trait value. Each group may be typically linked to a different process. Processes not “selected” by the switch are disabled, if possible. Values are also propagated through inputs/outputs of the switch (see below).

Inputs / outputs:

Say the switch “my_switch” has 2 outputs, “param1” and “param2”. It will be connected to the outputs of 2 processing nodes, “node1” and “node2”, both having 2 outputs: node1.out1, node1.out2, node2.out1, node2.out2. The switch will thus have 4 entries, in 2 groups, named for instance “node1” and “node2”. The switch will link the outputs of node1 or node2 to its outputs. The switch inputs will be named as follows:

  • 1st group: “node1_switch_param1”, “node1_switch_param2”

  • 2nd group: “node2_switch_param1”, “node2_switch_param2”

  • When my_switch.switch value is “node1”, my_switch.node1_switch_param1 is connected to my_switch.param1 and my_switch.node1_switch_param2 is connected to my_switch.param2. The processing node node2 is disabled (unselected).

  • When my_switch.switch value is “node2”, my_switch.node2_switch_param1 is connected to my_switch.param1 and my_switch.node2_switch_param2 is connected to my_switch.param2. The processing node node1 is disabled (unselected).

Values propagation:

  • When a switch is activated (its switch parameter is changed), the outputs will reflect the selected inputs, which means their values will be the same as the corresponding inputs.

  • But in many cases, parameters values will be given from the output (if the switch output is one of the pipeline outputs, this one will be visible from the “outside world, not the switch inputs). In this case, values set as a switch input propagate to its inputs.

  • An exception is when a switch input is linked to the parent pipeline inputs: its value is also visible from “outside” and should not be set via output values via the switch. In this specific case, output values are not propagated to such inputs.

Notes

Switch is normally not instantiated directly, but from a pipeline pipeline_definition method

_switch_values

the switch options

Type:

list

_outputs

the switch output parameters

Type:

list

See also

_switch_changed, _anytrait_changed, capsul.pipeline.pipeline.Pipeline.add_switch, capsul.pipeline.pipeline.Pipeline.pipeline_definition

_doc_path = 'api/pipeline.html#capsul.pipeline.pipeline_nodes.Switch'
__init__(pipeline, name, inputs, outputs, make_optional=(), output_types=None)[source]

Generate a Switch Node

Warning

The input plug names are built according to the following rule: <input_name>_switch_<output_name>

Parameters:
  • pipeline (Pipeline (mandatory)) – the pipeline object where the node is added

  • name (str (mandatory)) – the switch node name

  • inputs (list (mandatory)) – a list of options

  • outputs (list (mandatory)) – a list of output parameters

  • make_optional (sequence (optional)) – list of optional outputs. These outputs will be made optional in the switch output. By default they are mandatory.

  • output_types (sequence of traits (optional)) – If given, this sequence should have the same size as outputs. It will specify each switch output parameter type (as a standard trait). Input parameters for each input block will also have this type.

_switch_changed(old_selection, new_selection)[source]

Add an event to the switch trait that enables us to select the desired option.

Parameters:
  • old_selection (str (mandatory)) – the old option

  • new_selection (str (mandatory)) – the new option

connections()[source]

Returns the current internal connections between input and output plugs

Returns:

connections – list of internal connections [(input_plug_name, output_plug_name), …]

Return type:

list

_anytrait_changed(name, old, new)[source]

Add an event to the switch trait that enables us to select the desired option.

Propagates value through the switch, from in put to output if the switch state corresponds to this input, or from output to inputs.

Parameters:
  • name (str (mandatory)) – the trait name

  • old (str (mandatory)) – the old value

  • new (str (mandatory)) – the new value

get_connections_through(plug_name, single=False)[source]

If the node has internal links (inside a pipeline, or in a switch or other custom connection node), return the “other side” of the internal connection to the selected plug. The returned plug may be in an internal node (in a pipeline), or in an external node connected to the node. When the node is “opaque” (no internal connections), it returns the input plug. When the node is inactive / disabled, it returns [].

Parameters:
  • plug_name (str) – plug to get connections with

  • single (bool) – if True, stop at the first connected plug. Otherwise return the list of all connected plugs.

Returns:

[(node, plug_name, plug), …] Returns [(self, plug_name, plug)] when the plug has no internal connection.

Return type:

connected_plug; list of tuples

is_job()[source]

if True, the node will be represented as a Job in Soma-Workflow. Otherwise the node is static and does not run.

get_switch_inputs()[source]
classmethod configure_controller()[source]
configured_controller()[source]
classmethod build_node(pipeline, name, conf_controller)[source]
populse_mia.tests.run_mia_test.get_process_instance(process_or_id, study_config=None, **kwargs)[source]

Return a Process instance given an identifier.

Note that it is convenient to create a process from a StudyConfig instance: StudyConfig.get_process_instance()

The identifier is either:

  • a derived Process class.

  • a derived Process class instance.

  • a Nipype Interface instance.

  • a Nipype Interface class.

  • a string description of the class <module>.<class>.

  • a string description of a function to warp <module>.<function>.

  • a string description of a module containing a single process <module>

  • a string description of a pipeline <module>.<fname>.xml.

  • an XML filename for a pipeline.

  • a JSON filename for a pipeline.

  • a Python (.py) filename with process name in it: /path/process_source.py#ProcessName.

  • a Python (.py) filename for a file containing a single process.

Default values of the process instance are passed as additional parameters.

Parameters:
  • process_or_id (instance or class description (mandatory)) – a process/nipype interface instance/class or a string description.

  • study_config (StudyConfig instance (optional)) – A Process instance belongs to a StudyConfig framework. If not specified the study_config can be set afterwards.

  • kwargs – default values of the process instance parameters.

Returns:

result – an initialized process instance.

Return type:

Process

class populse_mia.tests.run_mia_test.ProcessCompletionEngine(process, name=None)[source]

Bases: HasTraits

Parameters completion from attributes for a process or pipeline node instance, in the context of a specific data organization.

ProcessCompletionEngine can be used directly for a pipeline, which merely delegates completion to its nodes, and has to be subclassed for a data organization framework on a node.

To get a completion engine, use:

completion_engine = ProcessCompletionEngine.get_completion_engine(
    node, name)

Note that this will assign permanently the ProcessCompletionEngine object to its associated node or process. To get and set the attributes set:

attributes = completion_engine.get_attribute_values()
print(attributes.user_traits().keys())
attributes.specific_process_attribute = 'a value'

Once attributes are set, to process with parameters completion:

completion_engine.complete_parameters()

It is possible to have complete_parameters() triggered automatically when attributes or switch nodes change. To set this up, use:

completion_engine.install_auto_completion()

ProcessCompletionEngine can (and should) be specialized, at least to provide the attributes set for a given process. A factory is used to create the correct type of ProcessCompletionEngine for a given process / name: ProcessCompletionEngineFactory

capsul.attributes.fom_completion_engine.FomProcessCompletionEngine is a specialization of ProcessCompletionEngine to manage File Organization Models (FOM).

get_completion_engine()[source]
get_attribute_values()[source]
complete_parameters()[source]
set_parameters()[source]
attributes_to_path()[source]
get_path_completion_engine()[source]
install_auto_completion()[source]
remove_auto_completion()[source]
__init__(process, name=None)[source]
_clear_node(wr)[source]

Called when the object behind the self.process proxy is about to be deleted

get_attribute_values()[source]

Get attributes Controller associated to a process or node

Returns:

  • attributes (ProcessAttributes instance)

  • The default implementation does nothing for a

  • single Process instance, and merges attributes from its children if

  • the process is a pipeline.

_get_linked_attributes()[source]
complete_parameters(process_inputs={}, complete_iterations=True)[source]

Completes file parameters from given inputs parameters, which may include both “regular” process parameters (file names) and attributes.

Parameters:
  • process_inputs (dict (optional)) – parameters to be set on the process. It may include “regular” process parameters, and attributes used for completion. Attributes should be in a sub-dictionary under the key “capsul_attributes”.

  • complete_iterations (bool (optional)) – if False, iteration nodes inside the pipeline will not run their own completion. Thus parameters for the iterations will not be correctly completed. However this has 2 advantages: 1. it prevents modification of the input pipeline, 2. it will not do iterations completion which will anyway be done (again) when building a workflow in ~capsul.pipeline.pipeline_workflow.workflow_from_pipeline.

attributes_to_path(parameter, attributes)[source]

Build a path from attributes for a given parameter in a process.

Parameters:
  • parameter (str)

  • attributes (ProcessAttributes instance (Controller))

set_parameters(process_inputs)[source]

Set the given parameters dict to the given process. process_inputs may include regular parameters of the underlying process, and attributes (capsul_attributes: dict).

attributes_changed(obj, name, old, new)[source]

Traits changed callback which triggers parameters update.

This method basically calls complete_parameters() (after some checks).

Users do not normally have to use it directly, it is used internally when install_auto_completion() has been called.

See install_auto_completion()

nodes_selection_changed(obj, name, old, new)[source]

Traits changed callback which triggers parameters update.

This method basically calls complete_parameters() (after some checks).

Users do not normally have to use it directly, it is used internally when install_auto_completion() has been called.

See install_auto_completion()

install_auto_completion()[source]

Monitor attributes changes and switches changes (which may influence attributes) and recompute parameters completion when needed.

remove_auto_completion()[source]

Remove attributes monitoring and auto-recomputing of parameters.

Reverts install_auto_completion()

get_path_completion_engine()[source]

Get a PathCompletionEngine object for the given process. The default implementation queries PathCompletionEngineFactory, but some specific ProcessCompletionEngine implementations may override it for path completion at the process level (FOMs for instance).

static get_completion_engine(process, name=None)[source]

Get a ProcessCompletionEngine instance for a given process/node within the framework of its StudyConfig factory function.

static _remove_completion_engine(process)[source]
static _del_process_callback(process)[source]
_get_schemas()[source]

Get schemas dictionary from process and its StudyConfig

_install_subprogress_moniotoring(subprocess_compl)[source]
_remove_subprogress_moniotoring(subprocess_compl)[source]
static _substep_completion_progress(self, substep_completion_engine, obj, name, old, new)[source]
remove_attributes()[source]

Clear attributes controller cache, to allow rebuilding it after a change. This is generally a callback attached to switches changes.

remove_switch_observers()[source]

Remove notification callbacks previously set to listen switches state changes.

class populse_mia.tests.run_mia_test.CapsulEngine(database_location, database, require)[source]

Bases: Controller

A CapsulEngine is the mandatory entry point of all software using Capsul. It contains objects to store configuration and metadata, defines execution environment(s) (possibly remote) and performs pipelines execution.

A CapsulEngine must be created using capsul.engine.capsul_engine function. For instance:

from capsul.engine import capsul_engine
ce = capsul_engine()

Or:

from capsul.api import capsul_engine
ce = capsul_engine()

By default, CapsulEngine only stores necessary configuration. But it may be necessary to modify the Python environment globally to apply this configuration. For instance, Nipype must be configured globally. If SPM is configured in CapsulEngine, it is necessary to explicitly activate the configuration in order to modify the global configuration of Nipype for SPM. This activation is done by explicitly activating the execution context of the capsul engine with the following code, inside a running process:

from capsul.engine import capsul_engine, activate_configuration
ce = capsul_engine()
# Nipype is not configured here
config = capsul_engine.settings.select_configurations(
    'global', {'nipype': 'any'})
activate_configuration(config)
# Nipype is configured here

Note

CapsulEngine is the replacement of the older StudyConfig, which is still present in Capsul 2.2 for backward compatibility, but will disappear in later versions. In Capsul 2.2 both objects exist, and are synchronized internally, which means that a StudyConfig object will also create a CapsulEngine, and the other way, and modifications in the StudyConfig object will change the corresponding item in CapsulEngine and vice versa. Functionalities of StudyConfig are moving internally to CapsulEngine, StudyConfig being merely a wrapper.

Using CapsulEngine

It is used to store configuration variables, and to handle execution within the configured context. The configuration has 2 independent axes: configuration modules, which provide additional configuration variables, and “environments” which typically represent computing resources.

Computing resources

Capsul is using Soma-Workflow to run processes, and is thus able to connect and execute on a remote computing server. The remote computing resource may have a different configuration from the client one (paths for software or data, available external software etc). So configurations specific to different computing resources should be handled in CapsulEngine. For this, the configuration section is split into several configuration entries, one for each computing resource.

As this is a little bit complex to handle at first, a “global” configuration (what we call “environment”) is used to maintain all common configuration options. It is typically used to work on the local machine, especially for users who only work locally.

Configuration is stored in a database (either internal or persistent), through the Settings object found in CapsulEngine.settings. Access and modification of settings should occur within a session block using with capsul_engine.settings as session. See the Settings class for details.

>>> from capsul.api import capsul_engine
>>> ce = capsul_engine()
>>> config = ce.settings.select_configurations('global')
>>> config = ce.global_config
>>> print(config)
{'capsul_engine': {'uses': {'capsul.engine.module.fsl': 'ALL',
  'capsul.engine.module.matlab': 'ALL',
  'capsul.engine.module.spm': 'ALL'}}}

Whenever a new computing resource is used, it can be added as a new environment key to all configuration operations.

Note that the settings store all possible configurations for all environments (or computing resources), but are not “activated”: this is only done at runtime in specific process execution functions: each process may need to select and use a different configuration from other ones, and activate it individually.

Process subclasses or instances may provide their configuration requirements via their requirements() method. This method returns a dictionary of request strings (one element per needed module) that will be used to select one configuration amongst the available settings entries of each required module.

configuration modules

The configuration is handled through a set of configuration modules. Each is dedicated for a topic (for instance handling a specific external software paths, or managing process parameters completion, etc). A module adds a settings table in the database, with its own variables, and is able to manage runtime configuration of programs, if needed, through its activate_configurations function. Capsul comes with a set of predefined modules: attributes, axon, fom, fsl, matlab, spm

Methods

__init__(self, database_location, database, config=None)[source]

The CapsulEngine constructor should not be called directly. Use capsul_engine() factory function instead.

property settings
property database
property database_location
property metadata_engine
load_modules(require)[source]

Call self.load_module for each required module. The list of modules to load is located in self.modules (if it is None, capsul.module.default_modules is used).

load_module(module_name)[source]

Load a module if it has not already been loaded (is this case, nothing is done)

A module is a fully qualified name of a Python module (as accepted by Python import statement). Such a module must define the two following functions (and may define two others, see below):

def load_module(capsul_engine, module_name): def set_environ(config, environ):

load_module of each module is called once before reading and applying the configuration. It can be used to add traits to the CapsulEngine in order to define the configuration options that are used by the module. Values of these traits are automatically stored in configuration in database when self.save() is used, and they are retrieved from database before initializing modules.

set_environ is called in the context of the processing (i.e. on the, possibly remote, machine that runs the pipelines). It receives the configuration as a JSON compatible dictionary (for instance a CapsulEngine attribute capsul_engine.spm.directory would be config[‘spm’][‘directory’]). The function must modify the environ dictionary to set the environment variables that must be defined for pipeline configuration. These variables are typically used by modules in capsul.in_context module to manage running external software with appropriate configuration.

set_named_directory(name, path)[source]
named_directory(name)[source]
named_directories()[source]
set_json_value(name, json_value)[source]
json_value(name)[source]
set_path_metadata(path, metadata, named_directory=None)[source]
path_metadata(path, named_directory=None)[source]
import_configs(environment, config_dict, cont_on_error=False)[source]

Import config values from a dictionary as given by Settings.select_configurations().

Compared to Settings.import_configs() this method (at CapsulEngine level) also loads the required modules.

get_process_instance(process_or_id, **kwargs)[source]

The only official way to get a process instance is to use this method. For now, it simply calls self.study_config.get_process_instance but it will change in the future.

get_iteration_pipeline(pipeline_name, node_name, process_or_id, iterative_plugs=None, do_not_export=None, make_optional=None, **kwargs)[source]

Create a pipeline with an iteration node iterating the given process.

Parameters:
Returns:

pipeline

Return type:

Pipeline instance

start(process, workflow=None, history=True, get_pipeline=False, **kwargs)[source]

Asynchronously start the execution of a process or pipeline in the connected computing environment. Returns an identifier of the process execution and can be used to get the status of the execution or wait for its termination.

TODO: if history is True, an entry of the process execution is stored in the database. The content of this entry is to be defined but it will contain the process parameters (to restart the process) and will be updated on process termination (for instance to store execution time if possible).

Parameters:
  • process (Process or Pipeline instance)

  • workflow (Workflow instance (optional - if already defined before call))

  • history (bool (optional)) – TODO: not implemented yet.

  • get_pipeline (bool (optional)) – if True, start() will return a tuple (execution_id, pipeline). The pipeline is normally the input pipeline (process) if it is actually a pipeline. But if the input process is a “single process”, it will be inserted into a small pipeline for execution. This pipeline will be the one actually run, and may be passed to wait() to set output parameters.

Returns:

  • execution_id (int) – execution identifier (actually a soma-workflow id)

  • pipeline (Pipeline instance (optional)) – only returned if get_pipeline is True.

connect(computing_resource)[source]

Connect the capsul engine to a computing resource

connected_to()[source]

Return the name of the computing resource this capsul engine is connected to or None if it is not connected.

disconnect()[source]

Disconnect from a computing resource.

executions()[source]

List the execution identifiers of all processes that have been started but not disposed in the connected computing resource. Raises an exception if the computing resource is not connected.

dispose(execution_id, conditional=False)[source]

Update the database with the current state of a process execution and free the resources used in the computing resource (i.e. remove the workflow from SomaWorkflow).

If conditional is set to True, then dispose is only done if the configuration does not specify to keep succeeded / failed workflows.

interrupt(execution_id)[source]

Try to stop the execution of a process. Does not wait for the process to be terminated.

wait(execution_id, timeout=-1, pipeline=None)[source]

Wait for the end of a process execution (either normal termination, interruption or error).

status(execution_id)[source]

Return a simple value with the status of an execution (queued, running, terminated, error, etc.)

detailed_information(execution_id)[source]

Return complete (and possibly big) information about a process execution.

call(process, history=True, *kwargs)[source]
check_call(process, history=True, **kwargs)[source]
raise_for_status(status, execution_id=None)[source]

Raise an exception if a process execution failed

exception populse_mia.tests.run_mia_test.WorkflowExecutionError(controller, workflow_id, status=None, workflow_kept=True, verbose=True)[source]

Bases: Exception

Exception class raised when a workflow execution fails. It holds references to the WorkflowController and the workflow id

__init__(controller, workflow_id, status=None, workflow_kept=True, verbose=True)[source]
class populse_mia.tests.run_mia_test.Pipeline(autoexport_nodes_parameters=None, **kwargs)[source]

Bases: Process

Pipeline containing Process nodes, and links between node parameters.

A Pipeline is normally subclassed, and its pipeline_definition() method is overloaded to define its nodes and links. pipeline_definition() will be called by the pipeline constructor.

from capsul.pipeline import Pipeline

class MyPipeline(Pipeline):

  def pipeline_definition(self):
      self.add_process('proc1', 'my_toolbox.my_process1')
      self.add_process('proc2', 'my_toolbox.my_process2')
      self.add_switch('main_switch', ['in1', 'in2'], ['out1', 'out2'])
      self.add_link('proc1.out1->main_switch.in1_switch_out1')
      self.add_link('proc1.out2->main_switch.in1_switch_out2')
      self.add_link('proc2.out1->main_switch.in2_switch_out1')
      self.add_link('proc2.out1->main_switch.in2_switch_out2')

After execution of pipeline_definition(), the inner nodes parameters which are not connected will be automatically exported to the parent pipeline, with names prefixed with their process name, unless they are listed in a special “do_not_export” list (passed to add_process() or stored in the pipeline instance).

>>> pipeline = MyPipeline()
>>> print(pipeline.proc1_input)
<undefined>

Nodes

A pipeline is made of nodes, and links between their parameters. Several types of nodes may be part of a pipeline:

  • process nodes (pipeline_nodes.ProcessNode) are the leaf nodes which represent actual processing bricks.

  • pipeline nodes (pipeline_nodes.PipelineNode) are sub-pipelines which allow to reuse an existing pipeline within another one

  • switch nodes (pipeline_nodes.Switch) allows to select values between several possible inputs. The switch mechanism also allows to select between several alternative processes or processing branches.

  • iterative process (:py:class:process_iteration.ProcessIteration`) represent parallel processing of the same pipeline on a set of parameters.

Note that you normally do not instantiate these nodes explicitly when building a pipeline. Rather programmers may call the add_process(), add_switch(), add_iterative_process() methods.

Nodes activation

Pipeline nodes may be enabled or disabled. Disabling a node will trigger a global pipeline nodes activation step, where all nodes which do not form a complete chain will be inactive. This way a branch may be disabled by disabling one of its nodes. This process is used by the switch system, which allows to select one processing branch between several, and disables the unselected ones.

Pipeline steps

Pipelines may define execution steps: they are user-oriented groups of nodes that are to be run together, or disabled together for runtime execution. They are intended to allow partial, or step-by-step execution. They do not work like the nodes enabling mechanism described above.

Steps may be defined within the pipeline_definition() method. See add_pipeline_step().

Note also that pipeline steps only act at the highest level: if a sub-pipeline has disabled steps, they will not be taken into account in the higher level pipeline execution, because executing by steps a part of a sub-pipeline within the context of a higher one does generally not make sense.

Main methods

  • pipeline_definition()

  • add_process()

  • add_switch()

  • add_custom_node()

  • add_iterative_process()

  • add_optional_output_switch()

  • add_processes_selection()

  • add_link()

  • remove_link()

  • export_parameter()

  • autoexport_nodes_parameters()

  • add_pipeline_step()

  • define_pipeline_steps()

  • define_groups_as_steps()

  • remove_pipeline_step()

  • enable_all_pipeline_steps()

  • disabled_pipeline_steps_nodes()

  • get_pipeline_step_nodes()

  • find_empty_parameters()

  • count_items()

nodes

a dictionary containing the pipeline nodes and where the pipeline node name is ‘’

Type:

dict {node_name: node}

workflow_list

a list of ordered nodes that can be executed

Type:

list

workflow_repr

a string representation of the workflow list <node_i>-><node_i+1>

Type:

str

Note

  • Type ‘Pipeline.help()’ for a full description of this process parameters.

  • Type ‘<Pipeline>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Pipeline>.get_output_spec()’ for a full description of this process output trait types.

_doc_path = 'api/pipeline.html#pipeline'
do_autoexport_nodes_parameters = True
hide_nodes_activation = True
__init__(autoexport_nodes_parameters=None, **kwargs)[source]

Initialize the Pipeline class

Parameters:

autoexport_nodes_parameters (bool) – if True (default) nodes containing pipeline plugs are automatically exported.

pipeline_definition()[source]

Define pipeline structure, nodes, sub-pipelines, switches, and links.

This method should be overloaded in subclasses, it does nothing in the base Pipeline class.

autoexport_nodes_parameters(include_optional=False)[source]

Automatically export nodes plugs to the pipeline.

Some parameters can be explicitly preserved from exportation if they are listed in the pipeline “do_not_export” variable (list or set).

Parameters:

include_optional (bool (optional)) – If True (the default), optional plugs are not exported Exception: optional output plugs of switches are exported (otherwise they are useless). It should probably be any single output plug of a node.

add_trait(name, trait)[source]

Add a trait to the pipeline

Parameters:
  • name (str (mandatory)) – the trait name

  • trait (trait instance (mandatory)) – the trait we want to add

remove_trait(name)[source]

Remove a trait to the pipeline

Parameters:

name (str (mandatory)) – the trait name

reorder_traits(names)[source]

Reimplementation of Controller method reorder_traits() so that we also reorder the pipeline node plugs.

_make_subprocess_context_name(name)[source]

build full contextual name on process instance

_set_subprocess_context_name(process, name)[source]

set full contextual name on process instance

add_process(name, process, do_not_export=None, make_optional=None, inputs_to_copy=None, inputs_to_clean=None, skip_invalid=False, **kwargs)[source]

Add a new node in the pipeline

Note about invalid nodes:

A pipeline can typically offer alternatives (through a switch) to different algorithmic nodes, which may have different dependencies, or may be provided through external modules, thus can be missing. To handle this, Capsul can be telled that a process node can be invalid (or missing) without otherwise interfering the rest of the pipeline. This is done using the “skip_invalid” option. When used, the process to be added is tested, and if its instantiation fails, it will not be added in the pipeline, but will not trigger an error. Instead the missing node will be marked as “allowed invalid”, and links and exports built using this node will silently do nothing. thus the pipeline will work normally, without the invalid node.

Such nodes are generally gathered through a switch mechanism. However the switch inputs should be restricted to actually available nodes. The recommended method is to check that nodes have actually been added in the pipeline. Then links can be made normally as if the nodes were all present:

self.add_process('method1', 'module1.Module1', skip_invalid=True)
self.add_process('method2', 'module2.Module2', skip_invalid=True)
self.add_process('method3', 'module3.Module3', skip_invalid=True)

input_params = [n for n in ['method1', 'method2', 'method3']
                if n in self.nodes]
self.add_switch('select_method', input_params, 'output')

self.add_link('method1.input->select_method.method1_switch_output')
self.add_link('method2.input->select_method.method2_switch_output')
self.add_link('method3.input->select_method.method3_switch_output')

A last note about invalid nodes:

When saving a pipeline (through the graphical editor typically), missing nodes will not be saved because they are not actually in the pipeline. So be careful to save only pipelines with full features.

Parameters:
  • name (str (mandatory)) – the node name (has to be unique).

  • process (Process (mandatory)) – the process we want to add. May be a string (‘module.process’), a process instance or a class.

  • do_not_export (list of str (optional)) – a list of plug names that we do not want to export.

  • make_optional (list of str (optional)) – a list of plug names that we do not want to export.

  • inputs_to_copy (list of str (optional)) – a list of item to copy.

  • inputs_to_clean (list of str (optional)) – a list of temporary items.

  • skip_invalid (bool) – if True, if the process is failing (cannot be instantiated), don’t throw an exception but instead don’t insert the node, and mark it as such in order to make add_link() to also silently do nothing. This option is useful for optional process nodes which may or may not be available depending on their dependencies, typically in a switch offering several alternative methods.

remove_node(node_name)[source]

Remove a node from the pipeline

add_iterative_process(name, process, iterative_plugs=None, do_not_export=None, make_optional=None, inputs_to_copy=None, inputs_to_clean=None, **kwargs)[source]

Add a new iterative node in the pipeline.

Parameters:
  • name (str (mandatory)) – the node name (has to be unique).

  • process (Process or str (mandatory)) – the process we want to add.

  • iterative_plugs (list of str (optional)) – a list of plug names on which we want to iterate. If None, all plugs of the process will be iterated.

  • do_not_export (list of str (optional)) – a list of plug names that we do not want to export.

  • make_optional (list of str (optional)) – a list of plug names that we do not want to export.

  • inputs_to_copy (list of str (optional)) – a list of item to copy.

  • inputs_to_clean (list of str (optional)) – a list of temporary items.

call_process_method(process_name, method, *args, **kwargs)[source]

Call a method of a process previously added with add_process or add_iterative_process.

Parameters:
  • process_name (str (mandatory)) – name given to the process node.

  • method (str (mandatory)) – name of the method to call.

add_switch(name, inputs, outputs, export_switch=True, make_optional=(), output_types=None, switch_value=None, opt_nodes=None)[source]

Add a switch node in the pipeline

Parameters:
  • name (str (mandatory)) – name for the switch node (has to be unique)

  • inputs (list of str (mandatory)) – names for switch inputs. Switch activation will select amongst them. Inputs names will actually be a combination of input and output, in the shape “input_switch_output”. This behaviour is needed when there are several outputs, and thus several input groups.

  • outputs (list of str (mandatory)) – names for outputs.

  • export_switch (bool (optional)) – if True, export the switch trigger to the parent pipeline with name as parameter name

  • make_optional (sequence (optional)) – list of optional outputs. These outputs will be made optional in the switch output. By default they are mandatory.

  • output_types (sequence of traits (optional)) – If given, this sequence should have the same size as outputs. It will specify each switch output parameter type (as a standard trait). Input parameters for each input block will also have this type.

  • switch_value (str (optional)) – Initial value of the switch parameter (one of the inputs names). Defaults to 1st input.

  • opt_nodes (bool or list) – tells that switch values are node names, and some of them may be optional and missing. In such a case, missing nodes are not added as inputs. If a list is passed, then it is a list of node names which length should match the number of inputs, and which order tells nodes related to inputs (in case inputs names are not directly node names).

Examples

>>> pipeline.add_switch('group_switch', ['in1', 'in2'],
                        ['out1', 'out2'])

will create a switch with 4 inputs and 2 outputs: inputs: “in1_switch_out1”, “in2_switch_out1”, “in1_switch_out2”, “in2_switch_out2” outputs: “out1”, “out2”

add_optional_output_switch(name, input, output=None)[source]

Add an optional output switch node in the pipeline

An optional switch activates or disables its input/output link according to the output value. If the output value is not None or Undefined, the link is active, otherwise it is inactive.

This kind of switch is meant to make a pipeline output optional, but still available for temporary files values inside the pipeline.

Ex:

A.output -> B.input

B.input is mandatory, but we want to make A.output available and optional in the pipeline outputs. If we directlty export A.output, then if the pipeline does not set a value, B.input will be empty and the pipeline run will fail.

Instead we can add an OptionalOutputSwitch between A.output and pipeline.output. If pipeline.output is set a valid value, then A.output and B.input will have the same valid value. If pipeline.output is left Undefined, then A.output and B.input will get a temporary value during the run.

Add an optional output switch node in the pipeline

Parameters:
  • name (str (mandatory)) – name for the switch node (has to be unique)

  • input (str (mandatory)) – name for switch input. Switch activation will select between it and a hidden input, “_none”. Inputs names will actually be a combination of input and output, in the shape “input_switch_output”.

  • output (str (optional)) – name for output. Default is the switch name

Examples

>>> pipeline.add_optional_output_switch('out1', 'in1')
>>> pipeline.add_link('node1.output->out1.in1_switch_out1')

See also

capsul.pipeline.pipeline_nodes.OptionalOutputSwitch

add_custom_node(name, node_type, parameters=None, make_optional=(), do_not_export=None, **kwargs)[source]

Inserts a custom node (Node subclass instance which is not a Process) in the pipeline.

Parameters:
  • node_type (str or Node subclass or Node instance) – node type to be built. Either a class (Node subclass) or a Node instance (the node will be re-instantiated), or a string describing a module and class.

  • parameters (dict or Controller or None) – configuration dict or Controller defining parameters needed to build the node. The controller should be obtained using the node class’s configure_node() static method, then filled with the desired values. If not given the node is supposed to be built with no parameters, which will not work for every node type.

  • make_optional (list or tuple) – parameters names to be made optional

  • do_not_export (list of str (optional)) – a list of plug names that we do not want to export.

  • kwargs (default values of node parameters)

Parse a link coming from export_parameter method.

Parameters:
  • link (str) – the link description of the form ‘node_from.plug_name->node_to.plug_name’

  • check (bool) – if True, check that the node and plug exist

Returns:

output – tuple containing the link description and instances

Return type:

tuple

Examples

>>> Pipeline.parse_link("node1.plug1->node2.plug2")
"node1", "plug1", <instance node1>, <instance plug1>,
"node2", "plug2", <instance node2>, <instance plug2>

For a pipeline node:

>>> Pipeline.parse_link("plug1->node2.plug2")
"", "plug1", <instance pipeline>, <instance plug1>,
"node2", "plug2", <instance node2>, <instance plug2>
parse_parameter(name, check=True)[source]

Parse parameter of a node from its description.

Parameters:
  • name (str) – the description plug we want to load ‘node.plug’

  • check (bool) – if True, check that the node and plug exist

Returns:

output – tuple containing the plug description and instances

Return type:

tuple

Add a link between pipeline nodes.

If the destination node is a switch, force the source plug to be not optional.

Parameters:
  • link (str or list/tuple) – link description. Its shape should be: “node.output->other_node.input”. If no node is specified, the pipeline itself is assumed. Alternatively the link can be (source_node, source_plug_name, dest_node, dest_plug_name)

  • weak_link (bool) – this property is used when nodes are optional, the plug information may not be generated.

  • allow_export (bool) – if True, if the link links from/to the pipeline node with a plug name which doesn’t exist, the plug will be created, and the function will act exactly like export_parameter. This may be a more convenient way of exporting/connecting pipeline plugs to several nodes without having to export the first one, then link the others.

  • value (any) – if given, set this value instead of the source plug value

Remove a link between pipeline nodes

Parameters:

link (str or list/tuple) – link description. Its shape should be: “node.output->other_node.input”. If no node is specified, the pipeline itself is assumed. Alternatively the link can be (source_node, source_plug_name, dest_node, dest_plug_name)

export_parameter(node_name, plug_name, pipeline_parameter=None, weak_link=False, is_enabled=None, is_optional=None, allow_existing_plug=None)[source]

Export a node plug at the pipeline level.

Parameters:
  • node_name (str (mandatory)) – the name of node containing the plug we want to export

  • plug_name (str (mandatory)) – the node plug name we want to export

  • pipeline_parameter (str (optional)) – the name to access this parameter at the pipeline level. Default None, the plug name is used

  • weak_link (bool (optional)) – this property is used when nodes are weak, FIXME: what does it exactly mean ? the plug information may not be generated.

  • is_enabled (bool (optional)) – a property to specify that it is not a user-parameter automatic generation)

  • is_optional (bool (optional)) – sets the exported parameter to be optional

  • allow_existing_plug (bool (optional)) – the same pipeline plug may be connected to several process plugs

_set_node_enabled(node_name, is_enabled)[source]

Method to enable or disabled a node

Parameters:
  • node_name (str (mandatory)) – the node name

  • is_enabled (bool (mandatory)) – the desired property

propagate_metadata(node, param, metadata)[source]

Set metadata on a node parameter, and propagate these values to the connected plugs.

Typically needed to propagate the “forbid_completion” metadata to avoid manuyally set values to be overridden by completion.

node may be a Node instance or a node name

all_nodes()[source]

Iterate over all pipeline nodes including sub-pipeline nodes.

Returns:

nodes – Iterates over all nodes

Return type:

Generator of Node

_check_local_node_activation(node)[source]

Try to activate a node and its plugs according to its state and the state of its direct neighbouring nodes.

Parameters:

node (Node (mandatory)) – node to check

Returns:

plugs_activated – list of (plug_name,plug) containing all plugs that have been activated

Return type:

list

_check_local_node_deactivation(node)[source]

Check plugs that have to be deactivated according to node activation state and to the state of its direct neighbouring nodes.

Parameters:

node (Node (mandatory)) – node to check

Returns:

plugs_deactivated – list of (plug_name,plug) containing all plugs that have been deactivated

Return type:

list

delay_update_nodes_and_plugs_activation()[source]
restore_update_nodes_and_plugs_activation()[source]
update_nodes_and_plugs_activation()[source]

Reset all nodes and plugs activations according to the current state of the pipeline (i.e. switch selection, nodes disabled, etc.). Activations are set according to the following rules.

workflow_graph(remove_disabled_steps=True, remove_disabled_nodes=True)[source]

Generate a workflow graph

Returns:

  • graph (topological_sort.Graph) – graph representation of the workflow from the current state of the pipeline

  • remove_disabled_steps (bool (optional)) – When set, disabled steps (and their children) will not be included in the workflow graph. Default: True

  • remove_disabled_nodes (bool (optional)) – When set, disabled nodes will not be included in the workflow graph. Default: True

workflow_ordered_nodes(remove_disabled_steps=True)[source]

Generate a workflow: list of process node to execute

Returns:

  • workflow_list (list of Process) – an ordered list of Processes to execute

  • remove_disabled_steps (bool (optional)) – When set, disabled steps (and their children) will not be included in the workflow graph. Default: True

_check_temporary_files_for_node(node, temp_files)[source]

Check temporary outputs and allocate files for them.

Temporary files or directories will be appended to the temp_files list, and the node parameters will be set to temp file names.

This internal function is called by the sequential execution, _run_process() (also used through __call__()). The pipeline state will be restored at the end of execution using _free_temporary_files().

Parameters:
  • node (Node) – node to check temporary outputs on

  • temp_files (list) – list of temporary files for the pipeline execution. The list will be modified (completed).

_free_temporary_files(temp_files)[source]

Delete and reset temp files after the pipeline execution.

This internal function is called at the end of _run_process() (sequential execution)

_run_process()[source]

Pipeline execution is managed by StudyConfig class. This method must not be called.

find_empty_parameters()[source]

Find internal File/Directory parameters not exported to the main input/output parameters of the pipeline with empty values. This is meant to track parameters which should be associated with temporary files internally.

Returns:

Each element is a list with 3 values: node, parameter_name, optional

Return type:

list

count_items()[source]

Count pipeline items to get its size.

Returns:

items – (nodes_count, processes_count, plugs_count, params_count, links_count, enabled_nodes_count, enabled_procs_count, enabled_links_count)

Return type:

tuple

pipeline_state()[source]

Return an object composed of basic Python objects that contains the whole structure and state of the pipeline. This object can be given to compare_to_state method in order to get the differences with a previously stored state. This is typically used in tests scripts.

Returns:

pipeline_state – todo

Return type:

dictionary

compare_to_state(pipeline_state)[source]

Returns the differences between this pipeline and a previously recorded state.

Returns:

differences – each element is a human readable string explaining one difference (e.g. ‘node “my_process” is missing’)

Return type:

list

Set callbacks when traits value change, and follow plugs links to debug links propagation and problems in it.

Parameters:
  • log_file (str (optional)) – file-like object to write links propagation in. If none is specified, a temporary file will be created for it.

  • handler (function (optional)) – Callback to be processed for debugging. If none is specified, the default pipeline debugging function will be used. This default handler prints traits changes and links to be processed in the log_file. The handler function will receive a prefix string, a node, and traits parameters, namely the object (process) owning the changed value, the trait name and value in this object.

  • prefix (str (optional)) – prefix to be prepended to traits names, typically the parent pipeline full name

Returns:

log_file

Return type:

the file object where events will be written in

Remove links debugging callbacks set by install_links_debug_handler

define_pipeline_steps(steps)[source]

Define steps in the pipeline. Steps are pipeline portions that form groups, and which can be enabled or disabled on a runtime basis (when building workflows).

Once steps are defined, their activation may be accessed through the “step” trait, which has one boolean property for each step:

Ex:

steps = OrderedDict()
steps['preprocessings'] = [
    'normalization',
    'bias_correction',
    'histo_analysis']
steps['brain_extraction'] = [
    'brain_segmentation',
    'hemispheres_split']
pipeline.define_pipeline_steps(steps)
>>> print(pipeline.pipeline_steps.preprocessings)
True
>>> pipeline.pipeline_steps.brain_extraction = False

See also add_pipeline_step()

Parameters:

steps (dict or preferably OrderedDict or SortedDictionary (mandatory)) – The steps dict keys are steps names, the values are lists of nodes names forming the step.

add_pipeline_step(step_name, nodes, enabled=True)[source]

Add a step definition to the pipeline (see also define_steps).

Steps are groups of pipeline nodes, which may be disabled at runtime. They are normally defined in a logical order regarding the workflow streams. They are different from pipelines in that steps are purely virtual groups, they do not have parameters.

Disabling a step acts differently as the pipeline node activation: other nodes are not inactivated according to their dependencies. Instead, those steps are not run.

Parameters:
  • step_name (string (mandatory)) – name of the new step

  • nodes (list or sequence) – nodes contained in the step (Node instances)

  • enabled (bool (optional)) – initial state of the step

remove_pipeline_step(step_name)[source]

Remove the given step

disabled_pipeline_steps_nodes()[source]

List nodes disabled for runtime execution

Returns:

disabled_nodes – list of pipeline nodes (Node instances) which will not run in a workflow created from this pipeline state.

Return type:

list

get_pipeline_step_nodes(step_name)[source]

Get the nodes in the given pipeline step

enable_all_pipeline_steps()[source]

Set all defined steps (using add_step() or define_steps()) to be enabled. Useful to reset the pipeline state after it has been changed.

_change_processes_selection(selection_name, selection_group)[source]
add_processes_selection(selection_parameter, selection_groups, value=None)[source]

Add a processes selection switch definition to the pipeline.

Selectors are a “different” kind of switch: one pipeline node set in a group is enabled, the others are disabled.

The selector has 2 levels:

selection_parameter selects a group.

A group contains a set of nodes which will be activated together. Groups are mutually exclusive.

Parameters:
  • selection_parameter (string (mandatory)) – name of the selector parameter: the parameter is added in the pipeline, and its value is the name of the selected group.

  • selection_groups (dict or OrderedDict) – nodes groups contained in the selector : {group_name: [Node names]}

  • value (str (optional)) – initial state of the selector (default: 1st group)

get_processes_selections()[source]

Get process_selection groups names (corresponding to selection parameters on the pipeline)

get_processes_selection_groups(selection_parameter)[source]

Get groups names involved in a processes selection switch

get_processes_selection_nodes(selection_parameter, group)[source]

Get nodes names involved in a processes selection switch with value group

set_study_config(study_config)[source]

Set a StudyConfig for the process. Note that it can only be done once: once a non-null StudyConfig has been assigned to the process, it should not change.

define_groups_as_steps(exclusive=True)[source]

Define parameters groups according to which steps they are connected to.

Parameters:

exclusive (bool (optional)) – if True, a parameter is assigned to a single group, the first step it is connected to. If False, a parameter is assigned all steps groups it is connected to.

check_requirements(environment='global', message_list=None)[source]

Reimplementation for pipelines of capsul.process.process.Process.check_requirements

A pipeline will return a list of unique configuration values.

rename_node(old_node_name, new_node_name)[source]

Change the name of the selected node and updates the pipeline.

Parameters:
  • old_node_name (str) – old node name

  • new_node_name (str) – new node name

populse_mia.tests.run_mia_test.workflow_from_pipeline(pipeline, study_config=None, disabled_nodes=None, jobs_priority=0, create_directories=True, environment='global', check_requirements=True, complete_parameters=False)[source]

Create a soma-workflow workflow from a Capsul Pipeline

Parameters:
  • pipeline (Pipeline (mandatory)) – a CAPSUL pipeline

  • study_config (StudyConfig (optional), or dict) – holds information about file transfers and shared resource paths. If not specified, it will be accessed through the pipeline.

  • disabled_nodes (sequence of pipeline nodes (Node instances) (optional)) – such nodes will be disabled on-the-fly in the pipeline, file transfers will be adapted accordingly (outputs may become inputs in the resulting workflow), and temporary files will be checked. If a disabled node was to produce a temporary files which is still used in an enabled node, then a ValueError exception will be raised. If disabled_nodes is not passed, they will possibly be taken from the pipeline (if available) using disabled steps: see Pipeline.define_steps()

  • jobs_priority (int (optional, default: 0)) – set this priority on soma-workflow jobs.

  • create_directories (bool (optional, default: True)) – if set, needed output directories (which will contain output files) will be created in a first job, which all other ones depend on.

  • environment (str (default: "global")) – configuration environment name (default: “global”). See capsul.engine.CapsulEngine and capsul.engine.settings.Settings.

  • check_requirements (bool (default: True)) – if True, check the pipeline nodes requirements in the capsul engine settings, and issue an exception if they are not met instead of proceeding with the workflow.

  • complete_parameters (bool (default: False)) – Perform parameters completion on the input pipeline while building the workflow. The default is False because we should avoid to do things several times when it’s already done, but in iteration nodes, completion needs to be done anyway for each iteration, so this option offers to do the rest of the “parent” pipeline completion.

Returns:

workflow – a soma-workflow workflow

Return type:

Workflow

class populse_mia.tests.run_mia_test.ProcessIteration(process, iterative_parameters, study_config=None, context_name=None)[source]

Bases: Process

Note

  • Type ‘ProcessIteration.help()’ for a full description of this process parameters.

  • Type ‘<ProcessIteration>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<ProcessIteration>.get_output_spec()’ for a full description of this process output trait types.

_doc_path = 'api/pipeline.html#processiteration'
__init__(process, iterative_parameters, study_config=None, context_name=None)[source]

Initialize the Process class.

_resize_outputs()[source]
change_iterative_plug(parameter, iterative=None)[source]

Change a parameter to be iterative (or non-iterative)

Parameters:
  • parameter (str) – parameter name

  • iterative (bool or None) – if None, the iterative state will be toggled. If True or False, the parameter state will be set accordingly.

_run_process()[source]

Runs the processings when the instance is called.

Either this _run_process() or get_commandline() must be defined in derived classes.

Note that _run_process() is called as a python function, on a Process instance. When using remote processing (cluster for instance), this means that the commandline which will run needs to be able to re- instantiate the same process: the process thus has to be stored in a file or python module which can be accessed from the remote machine, and python / capsul correctly installed and available on it.

get_commandline() at the contrary, can implement commandlines which are completely independent from Capsul, and from python.

Note

If both methods are not defined in the derived class a NotImplementedError error is raised.

On the other side, if both methods are overloaded, the process behavior in local sequential computing mode and in Soma-Workflow modes may be different.

set_study_config(study_config)[source]

Set a StudyConfig for the process. Note that it can only be done once: once a non-null StudyConfig has been assigned to the process, it should not change.

complete_iteration(iteration)[source]
class populse_mia.tests.run_mia_test.NipypeProcess(*args, **kwargs)[source]

Bases: FileCopyProcess

Base class used to wrap nipype interfaces.

Note

  • Type ‘NipypeProcess.help()’ for a full description of this process parameters.

  • Type ‘<NipypeProcess>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<NipypeProcess>.get_output_spec()’ for a full description of this process output trait types.

__init__(nipype_instance=None, use_temp_output_dir=None, *args, **kwargs)[source]

Initialize the NipypeProcess class.

NipypeProcess instance gets automatically an additional user trait ‘output_directory’.

This class also fix some lacks of the nipype version ‘0.10.0’.

NipypeProcess is normally not instantiated directly, but through the CapsulEngine factory, using a nipype interface name:

ce = capsul_engine()
npproc = ce.get_process_instance('nipype.interfaces.spm.Smooth')

However, it is now still possible to instantiate it directly, using a nipype interface class or instance:

npproc = NipypeProcess(nipype.interfaces.spm.Smooth)

NipypeProcess may be subclassed for specialized interfaces. In such a case, the subclass may provide:

  • (optionally) a class attribute _nipype_class_type to specify the

nipype interface class. If present the nipype interface class or instance will not be specified in the constructor call. * (optionally) a __postinit__() method which will be called in addition to the constructor, but later once the instance is correctly setup. This __postinit__ method allows to customize the new class instance. * (optionally) a class attribute _nipype_trait_mapping: a dict specifying a translation table between nipype traits names and the names they will get in the Process instance. By default, inputs get the same name as in their nipype interface, and outputs are prefixed with an underscore (‘_’) to avoid names collisions when a trait exists both in inputs and outputs in nipype. A special trait name _spm_script_file is also used in SPM interfaces to write the matlab script. It can also be translated to a different name in this dict.

Subclasses should preferably not define an __init__ method, because it may be called twice if no precaution is taken to avoid it (a __np_init_done__ instance attribute is set once init is done the first time).

Ex:

class Smooth(NipypeProcess):
    _nipype_class_type = spm.Smooth
    _nipype_trait_mapping = {
        'smoothed_files': 'smoothed_files',
        '_spm_script_file': 'spm_script_file'}

smooth = Smooth()
Parameters:
  • nipype_instance (nipype interface (mandatory, except from internals)) – the nipype interface we want to wrap in capsul.

  • use_temp_output_dir (bool or None) – use a temp working directory during processing

_nipype_interface

private attribute to store the nipye interface

Type:

Interface

_nipype_module

private attribute to store the nipye module name

Type:

str

_nipype_class

private attribute to store the nipye class name

Type:

str

_nipype_interface_name

private attribute to store the nipye interface name

Type:

str

requirements()[source]

Requirements needed to run the process. It is a dictionary which keys are config/settings modules and values are requests for them.

The default implementation returns an empty dict (no requirements), and should be overloaded by processes which actually have requirements.

Ex:

{'spm': 'version >= "12" and standalone == "True"')
set_output_directory(out_dir)[source]

Set the process output directory.

Parameters:

out_dir (str (mandatory)) – the output directory

set_usedefault(parameter, value)[source]

Set the value of the usedefault attribute on a given parameter.

Parameters:
  • parameter (str (mandatory)) – name of the parameter to modify.

  • value (bool (mandatory)) – value set to the usedefault attribute

_before_run_process()[source]

Method to copy files before executing the process.

_run_process()[source]

Method that do the processing when the instance is called.

Returns:

runtime – object containing the running results

Return type:

InterfaceResult

_after_run_process(run_process_result)[source]

Method to clean-up temporary workspace after process execution.

classmethod help(nipype_interface, returnhelp=False)[source]

Method to print the full wrapped nipype interface help.

Parameters:
  • cls (process class (mandatory)) – a nipype process class

  • nipype_instance (nipype interface (mandatory)) – a nipype interface object that will be documented.

  • returnhelp (bool (optional, default False)) – if True return the help string message, otherwise display it on the console.

class populse_mia.tests.run_mia_test.Input_Filter[source]

Bases: ProcessMIA

To filter the Data Browser tab or the output data of another brick

Please, see the complete documentation for the Input_Filter in the mia_processes website

Note

  • Type ‘Input_Filter.help()’ for a full description of this process parameters.

  • Type ‘<Input_Filter>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Input_Filter>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None, iteration=False)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters:
  • is_plugged – the state, linked or not, of the plugs.

  • iteration – the state, iterative or not, of the process.

Returns:

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class populse_mia.tests.run_mia_test.QItemSelectionModel(model: QAbstractItemModel | None = None)
class populse_mia.tests.run_mia_test.QItemSelectionModel(model: QAbstractItemModel | None, parent: QObject | None)

Bases: QObject

Clear = 1
ClearAndSelect = 3
Columns = 64
Current = 16
Deselect = 4
NoUpdate = 0
Rows = 32
Select = 2
SelectCurrent = 18
class SelectionFlag

Bases: int

class SelectionFlags
class SelectionFlags(f: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag)
class SelectionFlags(a0: QItemSelectionModel.SelectionFlags)

Bases: simplewrapper

Toggle = 8
ToggleCurrent = 24
clear(self)
clearCurrentIndex(self)
clearSelection(self)
columnIntersectsSelection(self, column: int, parent: QModelIndex = QModelIndex()) bool
currentChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

currentColumnChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

currentIndex(self) QModelIndex
currentRowChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

emitSelectionChanged(self, newSelection: QItemSelection, oldSelection: QItemSelection)
hasSelection(self) bool
isColumnSelected(self, column: int, parent: QModelIndex = QModelIndex()) bool
isRowSelected(self, row: int, parent: QModelIndex = QModelIndex()) bool
isSelected(self, index: QModelIndex) bool
model(self) QAbstractItemModel | None
modelChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

reset(self)
rowIntersectsSelection(self, row: int, parent: QModelIndex = QModelIndex()) bool
select(self, index: QModelIndex, command: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag)
select(self, selection: QItemSelection, command: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag) None
selectedColumns(self, row: int = 0) List[QModelIndex]
selectedIndexes(self) List[QModelIndex]
selectedRows(self, column: int = 0) List[QModelIndex]
selection(self) QItemSelection
selectionChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

setCurrentIndex(self, index: QModelIndex, command: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag)
setModel(self, model: QAbstractItemModel | None)
class populse_mia.tests.run_mia_test.QTreeView(parent: QWidget | None = None)

Bases: QAbstractItemView

allColumnsShowFocus(self) bool
autoExpandDelay(self) int
collapse(self, index: QModelIndex)
collapseAll(self)
collapsed

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

columnAt(self, x: int) int
columnCountChanged(self, oldCount: int, newCount: int)
columnMoved(self)
columnResized(self, column: int, oldSize: int, newSize: int)
columnViewportPosition(self, column: int) int
columnWidth(self, column: int) int
currentChanged(self, current: QModelIndex, previous: QModelIndex)
dataChanged(self, topLeft: QModelIndex, bottomRight: QModelIndex, roles: Iterable[int] = [])
dragMoveEvent(self, event: QDragMoveEvent | None)
drawBranches(self, painter: QPainter | None, rect: QRect, index: QModelIndex)
drawRow(self, painter: QPainter | None, options: QStyleOptionViewItem, index: QModelIndex)
drawTree(self, painter: QPainter | None, region: QRegion)
expand(self, index: QModelIndex)
expandAll(self)
expandRecursively(self, index: QModelIndex, depth: int = -1)
expandToDepth(self, depth: int)
expanded

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

expandsOnDoubleClick(self) bool
header(self) QHeaderView | None
hideColumn(self, column: int)
horizontalOffset(self) int
horizontalScrollbarAction(self, action: int)
indentation(self) int
indexAbove(self, index: QModelIndex) QModelIndex
indexAt(self, p: QPoint) QModelIndex
indexBelow(self, index: QModelIndex) QModelIndex
indexRowSizeHint(self, index: QModelIndex) int
isAnimated(self) bool
isColumnHidden(self, column: int) bool
isExpanded(self, index: QModelIndex) bool
isFirstColumnSpanned(self, row: int, parent: QModelIndex) bool
isHeaderHidden(self) bool
isIndexHidden(self, index: QModelIndex) bool
isRowHidden(self, row: int, parent: QModelIndex) bool
isSortingEnabled(self) bool
itemsExpandable(self) bool
keyPressEvent(self, event: QKeyEvent | None)
keyboardSearch(self, search: str | None)
mouseDoubleClickEvent(self, e: QMouseEvent | None)
mouseMoveEvent(self, event: QMouseEvent | None)
mousePressEvent(self, e: QMouseEvent | None)
mouseReleaseEvent(self, event: QMouseEvent | None)
moveCursor(self, cursorAction: QAbstractItemView.CursorAction, modifiers: Qt.KeyboardModifiers | Qt.KeyboardModifier) QModelIndex
paintEvent(self, e: QPaintEvent | None)
reexpand(self)
reset(self)
resetIndentation(self)
resizeColumnToContents(self, column: int)
rootIsDecorated(self) bool
rowHeight(self, index: QModelIndex) int
rowsAboutToBeRemoved(self, parent: QModelIndex, start: int, end: int)
rowsInserted(self, parent: QModelIndex, start: int, end: int)
rowsRemoved(self, parent: QModelIndex, first: int, last: int)
scrollContentsBy(self, dx: int, dy: int)
scrollTo(self, index: QModelIndex, hint: QAbstractItemView.ScrollHint = QAbstractItemView.EnsureVisible)
selectAll(self)
selectedIndexes(self) List[QModelIndex]
selectionChanged(self, selected: QItemSelection, deselected: QItemSelection)
setAllColumnsShowFocus(self, enable: bool)
setAnimated(self, enable: bool)
setAutoExpandDelay(self, delay: int)
setColumnHidden(self, column: int, hide: bool)
setColumnWidth(self, column: int, width: int)
setExpanded(self, index: QModelIndex, expand: bool)
setExpandsOnDoubleClick(self, enable: bool)
setFirstColumnSpanned(self, row: int, parent: QModelIndex, span: bool)
setHeader(self, header: QHeaderView | None)
setHeaderHidden(self, hide: bool)
setIndentation(self, i: int)
setItemsExpandable(self, enable: bool)
setModel(self, model: QAbstractItemModel | None)
setRootIndex(self, index: QModelIndex)
setRootIsDecorated(self, show: bool)
setRowHidden(self, row: int, parent: QModelIndex, hide: bool)
setSelection(self, rect: QRect, command: QItemSelectionModel.SelectionFlags | QItemSelectionModel.SelectionFlag)
setSelectionModel(self, selectionModel: QItemSelectionModel | None)
setSortingEnabled(self, enable: bool)
setTreePosition(self, logicalIndex: int)
setUniformRowHeights(self, uniform: bool)
setWordWrap(self, on: bool)
showColumn(self, column: int)
sizeHintForColumn(self, column: int) int
sortByColumn(self, column: int, order: Qt.SortOrder)
timerEvent(self, event: QTimerEvent | None)
treePosition(self) int
uniformRowHeights(self) bool
updateGeometries(self)
verticalOffset(self) int
viewportEvent(self, event: QEvent | None) bool
viewportSizeHint(self) QSize
visualRect(self, index: QModelIndex) QRect
visualRegionForSelection(self, selection: QItemSelection) QRegion
wordWrap(self) bool
class populse_mia.tests.run_mia_test.QMenu(parent: QWidget | None = None)
class populse_mia.tests.run_mia_test.QMenu(title: str | None, parent: QWidget | None = None)

Bases: QWidget

aboutToHide

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

aboutToShow

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

actionAt(self, a0: QPoint) QAction | None
actionEvent(self, a0: QActionEvent | None)
actionGeometry(self, a0: QAction | None) QRect
activeAction(self) QAction | None
addAction(self, action: QAction | None)
addMenu(self, menu: QMenu | None) QAction | None
addMenu(self, title: str | None) QMenu | None
addMenu(self, icon: QIcon, title: str | None) QMenu | None
addSection(self, text: str | None) QAction | None
addSection(self, icon: QIcon, text: str | None) QAction | None
addSeparator(self) QAction | None
changeEvent(self, a0: QEvent | None)
clear(self)
columnCount(self) int
defaultAction(self) QAction | None
enterEvent(self, a0: QEvent | None)
event(self, a0: QEvent | None) bool
exec(self) QAction | None
exec(self, pos: QPoint, action: QAction | None = None) QAction | None
exec(actions: Iterable[QAction], pos: QPoint, at: QAction | None = None, parent: QWidget | None = None) QAction | None
exec_(self) QAction | None
exec_(self, p: QPoint, action: QAction | None = None) QAction | None
exec_(actions: Iterable[QAction], pos: QPoint, at: QAction | None = None, parent: QWidget | None = None) QAction | None
focusNextPrevChild(self, next: bool) bool
hideEvent(self, a0: QHideEvent | None)
hideTearOffMenu(self)
hovered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

icon(self) QIcon
initStyleOption(self, option: QStyleOptionMenuItem | None, action: QAction | None)
insertMenu(self, before: QAction | None, menu: QMenu | None) QAction | None
insertSection(self, before: QAction | None, text: str | None) QAction | None
insertSection(self, before: QAction | None, icon: QIcon, text: str | None) QAction | None
insertSeparator(self, before: QAction | None) QAction | None
isEmpty(self) bool
isTearOffEnabled(self) bool
isTearOffMenuVisible(self) bool
keyPressEvent(self, a0: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)
menuAction(self) QAction | None
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, a0: QMouseEvent | None)
mouseReleaseEvent(self, a0: QMouseEvent | None)
paintEvent(self, a0: QPaintEvent | None)
popup(self, p: QPoint, action: QAction | None = None)
separatorsCollapsible(self) bool
setActiveAction(self, act: QAction | None)
setDefaultAction(self, a0: QAction | None)
setIcon(self, icon: QIcon)
setNoReplayFor(self, widget: QWidget | None)
setSeparatorsCollapsible(self, collapse: bool)
setTearOffEnabled(self, a0: bool)
setTitle(self, title: str | None)
setToolTipsVisible(self, visible: bool)
showTearOffMenu(self)
showTearOffMenu(self, pos: QPoint) None
sizeHint(self) QSize
timerEvent(self, a0: QTimerEvent | None)
title(self) str
toolTipsVisible(self) bool
triggered

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

wheelEvent(self, a0: QWheelEvent | None)
populse_mia.tests.run_mia_test.FIELD_TYPE_BOOLEAN

alias of bool

populse_mia.tests.run_mia_test.FIELD_TYPE_DATE

alias of date

populse_mia.tests.run_mia_test.FIELD_TYPE_DATETIME

alias of datetime

populse_mia.tests.run_mia_test.FIELD_TYPE_FLOAT

alias of float

populse_mia.tests.run_mia_test.FIELD_TYPE_INTEGER

alias of int

populse_mia.tests.run_mia_test.FIELD_TYPE_STRING

alias of str

populse_mia.tests.run_mia_test.FIELD_TYPE_TIME

alias of time

populse_mia.tests.run_mia_test.read_log(project, main_window)[source]

Display a progress bar for data loading and return loaded file paths.

This function shows the evolution of the progress bar while loading data files and returns a list of paths to each data file that was successfully loaded.

Parameters:
  • (Project) (project) – The current project instance in the software

  • (MainWindow) (main_window) – The software’s main window instance used to display the progress bar.

Return (list):

A list of paths to the data files (scans) that were successfully added.

class populse_mia.tests.run_mia_test.Project(project_root_folder, new_project)[source]

Bases: object

Class that handles projects and their associated database.

Parameters:
  • project_root_folder – project’s path

  • new_project – project’s object

__init__(project_root_folder, new_project)[source]

Initialization of the project class.

Parameters:
  • project_root_folder – project’s path

  • new_project – project’s object

add_clinical_tags()[source]

Add new clinical tags to the project.

Returns:

list of clinical tags that were added.

cleanup_orphan_bricks(bricks=None)[source]

Remove orphan bricks and their associated files from the database.

This method performs the following cleanup operations: 1. Removes obsolete brick documents from the brick collection 2. Removes orphaned file documents from both current and initial

collections

  1. Deletes the corresponding physical files from the filesystem

Parameters:

(str) (bricks) – list of brick IDs to check for orphans. If None, checks all bricks in the database.

cleanup_orphan_history()[source]

Remove orphan histories, their associated bricks, and files from the database.

This method performs three cleanup operations: 1. Removes obsolete history documents from the history collection 2. Removes orphaned brick documents from the brick collection 3. Removes orphaned file documents from both current and initial

collections, along with their corresponding physical files

cleanup_orphan_nonexisting_files(failed=False)[source]

Remove database entries for files that are missing on disk.

This method:
  • Retrieves filenames considered orphaned (see get_orphan_nonexisting_files),

  • Deletes their entries from both current and initial collections,

  • Attempts a defensive filesystem cleanup if the file still exists.

Parameters:

(bool) (failed) – Passed through to get_orphan_nonexisting_files to control orphan selection.

del_clinical_tags()[source]

Remove clinical tags from the project’s current and initial collections.

Iterates through predefined clinical tags and removes them from both collections if they exist in the current collection’s field names.

Return (list):

Clinical tags that were successfully removed.

files_in_project(files)[source]

Extract file/directory names from input that are within the project folder.

Recursively processes the input to find all file paths, handling nested data structures. Only paths within the project directory are included.

Parameters:

files

Input that may contain file paths. Can be: - str: A single file path - list/tuple/set: Collection of file paths or

nested structures

  • dict: Only values are processed, keys are ignored

Return (set):

Relative file paths that exist within the project folder, with paths normalized and made relative to the project directory

finished_bricks(engine, pipeline=None, include_done=False)[source]

Retrieve and process finished bricks from workflows and pipelines.

This method: 1. Gets finished bricks from workflows and optionally a specific

pipeline

  1. Filters them based on their presence in the Mia database

  2. Updates brick metadata with execution status and outputs

  3. Collects all output files that are within the project directory

Parameters:
  • engine – Engine instance for retrieving finished bricks

  • pipeline – Optional pipeline object to filter specific bricks

  • include_done – If True, includes all bricks regardless of execution status. If False, only includes “Not Done” bricks.

Return (dict):

Dictionary containing: - ‘bricks’: Dict mapping brick IDs to their metadata - ‘outputs’: Set of output file paths relative to project

directory

Contains:
Private function:
  • _update_dict: Merge two dictionaries by updating the first

    with the second

  • _collect_outputs: Recursively collects file paths from

    output values that are within the project directory.

get_data_history(path)[source]

Get the processing history for the given data file.

The history dict contains several elements: - parent_files: set of other data used (directly or indirectly) to

produce the data.

  • processes: processing bricks set from each ancestor data which

    lead to the given one. Elements are process (brick) UUIDs.

Parameters:

path – Path to the data file

Returns:

history (dict)

getDate()[source]

Return the date of creation of the project.

Return (str):

The date of creation of the project if it’s not Unnamed project, otherwise empty string

get_finished_bricks_in_pipeline(pipeline)[source]

Retrieves a dictionary of finished processes (bricks) from a given pipeline, including nested pipelines, if any.

Parameters:

Process) (pipeline (Pipeline or) – The pipeline or single process to analyze. If a single process is provided, it will be treated as a minimal pipeline.

Return (dict):

A dictionary where keys are process UUIDs (brick IDs) and values are dictionaries containing the associated process instances.

get_finished_bricks_in_workflows(engine)[source]

Return finished Soma-Workflow jobs indexed by their brick UUID.

A job is considered successful if its termination status is "finished_regularly". Any other termination status is treated as a failure. A workflow is marked as failed if at least one of its jobs did not finish successfully.

Parameters:

engine – Engine providing access to the Soma-Workflow controller.

Return (dict):

Mapping brick_uuid -> job_info where job_info contains: - workflow (int): Workflow identifier. - job: Soma-Workflow job instance. - job_id (int): Job identifier. - swf_status (tuple): Raw Soma-Workflow status

tuple.

  • running (bool): True of any job in the workflow

    is running

  • failed (bool): True if any job in the workflow

    failed.

getFilter(target_filter)[source]

Return a Filter object from its name.

Parameters:

(str) (target_filter) – Filter name

Return (Filter):

Filter object corresponding to the given name or None if not found

getFilterName()[source]

Input box to type the name of the filter to save.

Return (str):

Return the name typed by the user or None if cancelled

getName()[source]

Return the name of the project.

Return (str):

The name of the project if it’s not Unnamed project, otherwise empty string

get_orphan_bricks(bricks=None)[source]

Identifies orphan bricks and their associated weak files.

Parameters:

set) (bricks (list or) – A list or set of brick IDs to filter the search. If None, all bricks in the database are considered. Defaults to None.

Return (tuple):

A tuple containing two sets: - orphan (set): Brick IDs considered orphaned, meaning

they have no valid or existing outputs linked to the current database.

  • orphan_weak_files (set): Paths to weak files associated

    with orphaned bricks, such as script files or files that no longer exist.

get_orphan_history()[source]

Identifies orphaned history entries, their associated orphan bricks, and weak files.

Return (tuple):

A tuple containing three sets: - orphan_hist (set): IDs of history entries that are no longer

linked to any current document in the database.

  • orphan_bricks (set): IDs of bricks associated with orphaned

    history entries.

  • orphan_weak_files (set): Paths to weak files (e.g., script

    files or non-existent files) linked to orphaned history entries.

get_orphan_nonexisting_files(failed)[source]

Return filenames that are recorded in the database but missing on disk.

A file is considered “orphaned” if: - It does not exist on the filesystem, and - It is not associated with any existing bricks, unless failed is True (in which case brick association is ignored).

Parameters:

(bool) (failed) – If True, include files even if they are linked to existing bricks. If False, exclude such files.

Return (set):

A set of filenames from the database that are not found on the filesystem and are not associated with existing bricks.

getSortedTag()[source]

Return the sorted tag of the project.

Return (str):

Sorted tag of the project if it’s not Unnamed project, otherwise empty string

getSortOrder()[source]

Return the sort order of the project.

Return (str):

Sort order of the project if it’s not Unnamed project, otherwise empty string

hasUnsavedModifications()[source]

Return if the project has unsaved modifications or not.

Return (bool):

True if the project has pending modifications, False otherwise

init_filters()[source]

Initializes project filters by loading them from stored JSON files.

This method sets the currentFilter to a default empty filter and populates the filters list with Filter objects created

loadProperties()[source]

Loads the project properties from the ‘properties.yml’ file.

This method reads the project’s YAML properties file and returns its contents as a Python dictionary.

Return (dict):

A dictionary containing the project properties if successfully loaded, or None if an error occurs.

redo(table)[source]

Redo the last action made by the user on the project.

Parameters:

(QTableWidget) (table) – The table on which to apply the modifications.

Actions that can be redone:
  • add_tag

  • remove_tags

  • add_scans

  • modified_values

  • modified_visibilities

Raises:

(ValueError) – If an unknown action type is encountered.

reput_values(values)[source]

Re-put the value objects in the database.

Parameters:

(list) (values) – List of Value objects

saveConfig()[source]

Save the changes in the properties file.

save_current_filter(custom_filters)[source]

Save the current filter.

Parameters:

custom_filters – The customized filter

saveModifications()[source]

Save the pending operations of the project (actions still not saved).

setCurrentFilter(new_filter)[source]

Set the current filter of the project.

Parameters:

new_filter – New Filter object

setDate(date)[source]

Set the date of the project.

Parameters:

date – New date of the project

setName(name)[source]

Set the name of the project if it’s not Unnamed project, otherwise does nothing.

Parameters:

(str) (name) – New name of the project

setSortedTag(tag)[source]

Set the sorted tag of the project.

Parameters:

tag – New sorted tag of the project

setSortOrder(order)[source]

Set the sort order of the project.

Parameters:

order – New sort order of the project (ascending or descending)

undo(table)[source]

Undo the last action made by the user on the project.

Parameters:

table – Table on which to apply the modifications

Actions that can be undone:
  • add_tag

  • remove_tags

  • add_scans

  • modified_values

  • modified_visibilities

property unsavedModifications

Getter for _unsavedModifications.

unsaveModifications()[source]

Unsave the pending operations of the project.

update_db_for_paths(new_path=None)[source]

Update database paths when renaming or loading a project.

This method updates path references in the database when a project is renamed or loaded from a different location. It scans the HISTORY and BRICK collections to identify the old project path, then systematically replaces it with the new path.

The method looks for the old path in brick input/output fields and history pipeline XML data. If the old path contains ‘data/derived_data’, the method uses the portion before this segment as the base path.

Parameters:

(str) (new_path) – The new project path. If not provided, the current project folder path is used.

Contains:
Private method:
  • _update_json_data: Helper method to update paths in JSON

    data structures

class populse_mia.tests.run_mia_test.SavedProjects[source]

Bases: object

Handles all saved projects in the software.

- addSavedProject

Adds a new saved project.

- loadSavedProjects

Loads saved projects from ‘saved_projects.yml’.

- removeSavedProject

Removes a project from the config file.

- saveSavedProjects

Saves projects to ‘saved_projects.yml’.

__init__()[source]

Initializes the saved projects from ‘saved_projects.yml’.

savedProjects

Dictionary containing saved project paths.

Type:

dict

pathsList

List of saved project paths.

Type:

list

addSavedProject(newPath)[source]

Adds a project path or moves it to the front if it exists.

Parameters:

(str) (newPath) – Path of the new project.

Return (list):

Updated project paths list.

loadSavedProjects()[source]

Loads saved projects from ‘saved_projects.yml’, or creates a default file if missing.

Return (dict):

Loaded project paths.

removeSavedProject(path)[source]

Removes a project path from pathsList and updates the file.

Parameters:

(str) (path) – Path to remove.

saveSavedProjects()[source]

Writes savedProjects to ‘saved_projects.yml’.

class populse_mia.tests.run_mia_test.Config(properties_path=None)[source]

Bases: object

Object that handles the configuration of the software

Contains:

Methods:

  • _configure_matlab_only: Configures MATLAB without SPM

  • _configure_matlab_spm: Configures SPM and MATLAB

  • _configure_mcr_only: Configures MCR without SPM

  • _configure_standalone_spm: Configures standalone SPM and MCR

  • _disable_matlab_spm: Disables all MATLAB and SPM configurations

  • get_admin_hash: Get the value of the hash of the admin password

  • get_afni_path: Returns the path of AFNI

  • get_ants_path: Returns the path of ANTS

  • getBackgroundColor: Get background color

  • get_capsul_config: Get CAPSUL config dictionary

  • get_capsul_engine: Get a global CapsulEngine object used for all operations in MIA application

  • getChainCursors: Returns if the “chain cursors” checkbox of the mini-viewer is activated

  • get_freesurfer_setup: Get freesurfer path

  • get_fsl_config: Returns the path of the FSL config file

  • get_mainwindow_maximized: Get the maximized (full-screen) flag

  • get_mainwindow_size: Get the main window size

  • get_matlab_command: Returns Matlab command

  • get_matlab_path: Returns the path of Matlab’s executable

  • get_matlab_standalone_path: Returns the path of Matlab Compiler Runtime

  • get_max_projects: Returns the maximum number of projects displayed in the “Saved projects” menu

  • get_max_thumbnails: Get max thumbnails number at the data browser bottom

  • get_mri_conv_path: Returns the MRIManager.jar path

  • get_mrtrix_path: Returns mrtrix path

  • getNbAllSlicesMax: Returns the maximum number of slices to display in the mini viewer

  • get_opened_projects: Returns the opened projects

  • get_projects_save_path: Returns the folder where the projects are saved

  • get_properties_path: Returns the software’s properties path

  • get_referential: Returns boolean to indicate DataViewer referential

  • get_resources_path: Get the resources path

  • getShowAllSlices: Returns if the “show all slices” checkbox of the mini viewer is activated

  • getSourceImageDir: Get the source directory for project images

  • get_spm_path: Returns the path of SPM12 (license version)

  • get_spm_standalone_path: Returns the path of SPM12 (standalone version)

  • getTextColor: Return the text color

  • getThumbnailTag: Returns the tag that is displayed in the mini viewer

  • get_use_afni: Returns the value of “use afni” checkbox in the preferences

  • get_use_ants: Returns the value of “use ants” checkbox in the preferences

  • get_use_clinical: Returns the value of “clinical mode” checkbox in the preferences

  • get_use_freesurfer: Returns the value of “use freesurfer” checkbox in the preferences

  • get_use_fsl: Returns the value of “use fsl” checkbox in the preferences

  • get_use_matlab: Returns the value of “use matlab” checkbox in the preferences

  • get_use_matlab_standalone: Returns the value of “use matlab standalone” checkbox in the preferences

  • get_use_mrtrix: Returns the value of “use mrtrix” checkbox in the preferences

  • get_user_level: Get the user level in the Capsul config

  • get_user_mode: Returns the value of “user mode” checkbox in the preferences

  • get_use_spm: Returns the value of “use spm” checkbox in the preferences

  • get_use_spm_standalone: Returns the value of “use spm standalone” checkbox in the preferences

  • getViewerConfig: Returns the DataViewer configuration (neuro or radio), by default neuro

  • getViewerFramerate: Returns the DataViewer framerate for automatic time running images

  • isAutoSave: Checks if auto-save mode is activated

  • isControlV1: Checks if the selected display of the controller is of V1 type

  • isRadioView: Checks if miniviewer in radiological orientation (if not, then it is in neurological orientation)

  • loadConfig: Reads the config in the config.yml file

  • saveConfig: Saves the config to the config.yml file

  • set_admin_hash: Set the password hash

  • set_afni_path: Set the path of the AFNI

  • set_ants_path: Set the path of the ANTS

  • setAutoSave: Sets the auto-save mode

  • setBackgroundColor: Sets the background color

  • set_capsul_config: Set CAPSUL configuration dict into MIA config

  • setChainCursors: Set the “chain cursors” checkbox of the mini viewer

  • set_clinical_mode: Set the value of “clinical mode” in the preferences

  • setControlV1: Set controller display mode (True if V1)

  • set_freesurfer_setup: Set freesurfer path

  • set_fsl_config: Set the path of the FSL config file

  • set_mainwindow_maximized: Set the maximized (fullscreen) flag

  • set_mainwindow_size: Set main window size

  • set_matlab_path: Set the path of Matlab’s executable

  • set_matlab_standalone_path: Set the path of Matlab Compiler Runtime

  • set_max_projects: Set the maximum number of projects displayed in the “Saved projects” menu

  • set_max_thumbnails: Set max thumbnails number at the data browser bottom

  • set_mri_conv_path: Set the MRIManager.jar path

  • set_mrtrix_path: Set the path of mrtrix

  • setNbAllSlicesMax: Set the maximum number of slices to display in the mini viewer

  • set_opened_projects: Set the opened projects

  • set_projects_save_path: Set the folder where the projects are saved

  • set_radioView: Set the orientation in miniviewer (True for radiological, False for neurological orientation)

  • set_referential: Set the DataViewer referential

  • set_resources_path: Set the resources path

  • setShowAllSlices: Set the “show all slices” checkbox of the mini viewer

  • setSourceImageDir: Set the source directory for project images

  • set_spm_path: Set the path of SPM12 (license version)

  • set_spm_standalone_path: Set the path of SPM12 (standalone version)

  • setTextColor: Set the text color

  • setThumbnailTag: Set the tag that is displayed in the mini viewer

  • set_use_afni: Set the value of “use afni” checkbox in the preferences

  • set_use_ants: Set the value of “use ants” checkbox in the preferences

  • set_use_freesurfer: Set the value of “use freesurfer” checkbox in the preferences

  • set_use_fsl: Set the value of “use fsl” checkbox in the preferences

  • set_use_matlab: Set the value of “use matlab” checkbox in the preferences

  • set_use_matlab_standalone: Set the value of “use matlab standalone” checkbox in the preferences

  • set_use_mrtrix: Set the value of “use mrtrix” checkbox in the preferences

  • set_user_mode: Set the value of “user mode” checkbox in the preferences

  • set_use_spm: Set the value of “use spm” checkbox in the preferences

  • set_use_spm_standalone: Set the value of “use spm standalone” checkbox in the preferences

  • setViewerConfig: Set the Viewer configuration neuro or radio

  • setViewerFramerate: Set the Viewer frame rate for automatic running time images

  • update_capsul_config: Update a global CapsulEngine object used for all operations in MIA application

capsul_engine = None
__init__(properties_path=None)[source]

Initialization of the Config class

Parameters:

properties_path – (str) If provided, the configuration file will be loaded / saved from the given directory. Otherwise, the regular heuristics will be used to determine the config path. This option allows to use an alternative config directory (for tests for instance).

_configure_matlab_only(matlab_path: str) None[source]

Configures MATLAB without SPM, ensuring that only MATLAB is used.

Parameters:

matlab_path – (str) The directory path of the MATLAB installation.

_configure_matlab_spm(spm_dir, matlab_path)[source]

Configures SPM to use the specified SPM directory with a MATLAB installation.

Parameters:
  • spm_dir – (str) The directory path of the SPM installation.

  • matlab_path – (str) The directory path of the MATLAB installation.

_configure_mcr_only(mcr_dir: str) None[source]

Configures MATLAB Compiler Runtime (MCR) without SPM, ensuring that only MCR is used.

Parameters:

mcr_dir – (str) The directory path of the MATLAB Compiler Runtime (MCR).

_configure_standalone_spm(spm_dir, mcr_dir)[source]

Configures standalone SPM to use the specified SPM and MATLAB Compiler Runtime (MCR) directories.

Parameters:
  • spm_dir – (str) The directory path of the standalone SPM installation.

  • mcr_dir – (str) The directory path of the MATLAB Compiler Runtime (MCR).

_disable_matlab_spm() None[source]

Disables all MATLAB and SPM configurations, ensuring that neither MATLAB nor SPM is used.

get_admin_hash()[source]

Retrieves the hashed admin password from the configuration.

Returns:

The hashed admin password if found in config, False if not present in config.

get_afni_path()[source]

Get the AFNI path.

Returns:

(str) Path to AFNI, or “” if unknown.

get_ants_path()[source]

Get the ANTS path.

Returns:

(str) Path to ANTS, or “” if unknown.

getBackgroundColor()[source]

Get background color.

Returns:

(str) Background color, or “” if unknown.

get_capsul_config(sync_from_engine=True)[source]

Retrieve and construct the Capsul configuration dictionary.

This function builds a configuration dictionary for Capsul, incorporating settings for various neuroimaging tools and processing engines. It manages configurations for tools like SPM, FSL, FreeSurfer, MATLAB, AFNI, ANTs, and MRTrix.

The function first retrieves local settings for each tool from the Mia preferences, then constructs the appropriate configuration structure. If requested, it can synchronize the configuration with the current Capsul engine state.

Parameters:

sync_from_engine – (bool) If True, synchronizes the configuration with the current Capsul engine settings after building the base configuration.

Returns:

(dict) A nested dictionary containing the complete Capsul configuration, structured with the following main sections:

  • engine_modules: List of available processing modules

  • engine: Contains global and environment-specific settings, as well as configurations specific to certain tools (SPM, FSL, etc.)

Private functions:
  • _configure_spm: Configure SPM settings.

  • _configure_tool: Configure various neuroimaging settings (e.g. ‘fsl’, ‘afni’, etc.)

static get_capsul_engine()[source]

Get or create a global CapsulEngine singleton for Mia application operations.

The engine is created only once when first needed (lazy initialization). Subsequent calls return the same instance.

Returns:

(CapsulEngine) The global CapsulEngine instance.

getChainCursors()[source]

Get the value of the checkbox ‘chain cursor’ in miniviewer.

Returns:

(bool) Value of the checkbox.

get_freesurfer_setup()[source]

Get the freesurfer path.

Returns:

(str) Path to freesurfer, or “” if unknown.

get_fsl_config()[source]

Get the FSL config file path.

Returns:

(str) Path to the fsl/etc/fslconf/fsl.sh file.

get_mainwindow_maximized()[source]

Get the maximized (fullscreen) flag.

Returns:

(bool) Maximized (fullscreen) flag.

get_mainwindow_size()[source]

Get the main window size.

Returns:

(list) Main window size.

get_matlab_command()[source]

Retrieves the appropriate Matlab command based on the configuration.

Returns:

(str) The Matlab executable path or None if no path is specified.

get_matlab_path()[source]

Get the path to the matlab executable.

Returns:

(str) A path.

get_matlab_standalone_path()[source]

Get the path to matlab compiler runtime.

Returns:

(str) A path.

get_max_projects()[source]

Retrieves the maximum number of projects displayed in the “Saved projects” menu.

Returns:

(int) The maximum number of projects. Defaults to 5 if not specified.

get_max_thumbnails()[source]

Retrieves the maximum number of thumbnails displayed in the mini-viewer at the bottom of the data browser.

Returns:

(int) The maximum number of thumbnails. Defaults to 5 if not specified.

get_mri_conv_path()[source]

Get the MRIManager.jar path.

Returns:

(str) A path.

get_mrtrix_path()[source]

Get the mrtrix path.

Returns:

(str) A path.

getNbAllSlicesMax()[source]

Get number the maximum number of slices to display in the miniviewer.

Returns:

(int) Maximum number of slices to display in miniviewer.

get_opened_projects()[source]

Get opened projects.

Returns:

(list) Opened projects.

get_projects_save_path()[source]

Get the path where projects are saved.

Returns:

(str) A path.

get_properties_path()[source]

Retrieves the path to the folder containing the “processes” and “properties” directories of Mia.

The properties path is defined in the configuration_path.yml file, located in ~/.populse_mia.

  • In user mode, the path is retrieved from the properties_user_path parameter.

  • In developer mode, the path is retrieved from the properties_dev_path parameter.

If outdated parameters (mia_path, mia_user_path) are found, they are automatically updated in the configuration file.

Returns:

(str) The absolute path to the properties folder.

get_referential()[source]

Retrieves the chosen referential from the anatomist_2 data viewer.

Returns:

(str) “0” for World Coordinates, “1” for Image ref.

get_resources_path()[source]

Get the resources path.

Returns:

(str) A path.

getShowAllSlices()[source]

Get whether the show_all_slices parameters was enabled or not in the miniviewer.

Returns:

(bool) True if the show_all_slices parameters was enabled.

getSourceImageDir()[source]

Get the source directory for project images.

Returns:

(str) A path.

get_spm_path()[source]

Get the path of SPM.

Returns:

(str) A path.

get_spm_standalone_path()[source]

Get the path to the SPM12 standalone version.

Returns:

(str) A path.

getTextColor()[source]

Get the text color.

Returns:

(str) The text color.

getThumbnailTag()[source]

Get the tag of the thumbnail displayed in the miniviewer.

Returns:

(str) The tag of the thumbnail displayed in miniviewer.

get_use_afni()[source]

Get the value of “use afni” checkbox in the preferences.

Returns:

(bool) The value of “use afni” checkbox.

get_use_ants()[source]

Get the value of “use ants” checkbox in the preferences.

Returns:

(bool) The value of “use ants” checkbox.

get_use_clinical()[source]

Get the clinical mode in the preferences.

Returns:

(bool) The clinical mode.

get_use_freesurfer()[source]

Get the value of “use freesurfer” checkbox in the preferences.

Returns:

(bool) The value of “use freesurfer” checkbox.

get_use_fsl()[source]

Get the value of “use fsl” checkbox in the preferences.

Returns:

(bool) The value of “use fsl” checkbox.

get_use_matlab()[source]

Get the value of “use matlab” checkbox in the preferences.

Returns:

(bool) The value of “use matlab” checkbox.

get_use_matlab_standalone()[source]

Get the value of “use matlab standalone” checkbox in the preferences.

Returns:

(bool) The value of “use matlab standalone” checkbox.

get_use_mrtrix()[source]

Get the value of “use mrtrix” checkbox in the preferences.

Returns:

(bool) The value of “use mrtrix” checkbox.

get_user_level()[source]

Get the user level in the Capsul config.

Returns:

(int) The user level in the Capsul config.

get_user_mode()[source]

Get if user mode is disabled or enabled in the preferences.

Returns:

(bool) If True, the user mode is enabled.

get_use_spm()[source]

Get the value of “use spm” checkbox in the preferences.

Returns:

(bool) The value of “use spm” checkbox.

get_use_spm_standalone()[source]

Get the value of “use spm standalone” checkbox in the preferences.

Returns:

(bool) The value of “use spm standalone” checkbox.

getViewerConfig()[source]

Get the viewer config “neuro” or “radio”, “neuro” by default.

Returns:

(str) The viewer config (“neuro” or “radio”).

getViewerFramerate()[source]

Get the Viewer framerate.

Returns:

(str) The Viewer framerat (ex. “5”).

isAutoSave()[source]

Get if the auto-save mode is enabled or not.

Returns:

(bool) If True, auto-save mode is enabled.

isControlV1()[source]

Gets whether the controller display is of type V1.

Returns:

(bool) If True, V1 controller display.

isRadioView()[source]

Get if the display in miniviewer is in radiological orientation.

Returns:

(bool) If True, radiological orientation, otherwise neurological orientation.

loadConfig()[source]

Read the config from config.yml file.

Attempts to read an encrypted YAML configuration file from the properties directory, decrypt it using Fernet encryption, and parse it as YAML.

Returns:

(dict) Parsed configuration from the YAML file. Returns empty dict if parsing fails.

saveConfig()[source]

Save the current parameters in the config.yml file.

Encrypts and writes the current configuration (self.config) to config.yml using Fernet encryption. Creates the necessary directory structure if it doesn’t exist. After saving, updates the capsul configuration.

set_admin_hash(admin_hash)[source]

Set the password hash.

Parameters:

admin_hash – A string.

set_afni_path(path)[source]

Set the AFNI path.

Parameters:

path – (str) A path.

set_ants_path(path)[source]

Set the ANTS path

Parameters:

path – (str) A path.

setAutoSave(save)[source]

Set auto-save mode.

Parameters:

save – A boolean.

setBackgroundColor(color)[source]

Set background color and save configuration.

Parameters:

color – Color string (‘Black’, ‘Blue’, ‘Green’, ‘Grey’, ‘Orange’, ‘Red’, ‘Yellow’, ‘White’)

set_capsul_config(capsul_config_dict)[source]

Update Mia configuration with Capsul settings and synchronize tools configuration.

Called after editing Capsul config (via File > Mia preferences > Pipeline tab > Edit CAPSUL config) to synchronize Capsul settings with Mia preferences. Configures various neuroimaging tools (AFNI, ANTs, FSL, etc.) based on the Capsul engine configuration.

Parameters:

capsul_config_dict – Dictionary containing Capsul configuration.

Structure of capsul_config_dict:

{
    'engine': {
        'environment_name': {...configuration...}
    },
    'engine_modules': [...]
}
Private function:
  • _get_module_config: Extracts module configuration from the global Capsul configuration.

setChainCursors(chain_cursors)[source]

Set the value of the checkbox ‘chain cursor’ in the mini viewer.

Parameters:

chain_cursors – A boolean.

set_clinical_mode(clinical_mode)[source]

Enable or disable clinical mode.

Parameters:

clinical_mode – A boolean.

setControlV1(controlV1)[source]

Set controller display mode (True if V1).

Parameters:

controlV1 – A boolean.

set_freesurfer_setup(path)[source]

Set the freesurfer config file.

Parameters:

path – (str) Path to freesurfer/FreeSurferEnv.sh.

set_fsl_config(path)[source]

Set the FSL config file.

Parameters:

path – (str) Path to fsl/etc/fslconf/fsl.sh.

set_mainwindow_maximized(enabled)[source]

Set the maximized (full-screen) flag.

Parameters:

enabled – A boolean.

set_mainwindow_size(size)[source]

Set main window size.

Parameters:

size – A list of two integers.

set_matlab_path(path)[source]

Set the path of Matlab’s executable.

Parameters:

path – (str) A path.

set_matlab_standalone_path(path)[source]

Set the path of Matlab Compiler Runtime.

Parameters:

path – (str) A path.

set_max_projects(nb_max_projects)[source]

Set the maximum number of projects displayed in the “Saved projects” menu.

Parameters:

nb_max_projects – An integer.

set_max_thumbnails(nb_max_thumbnails)[source]

Set max thumbnails number at the data browser bottom.

Parameters:

nb_max_thumbnails – An integer.

set_mri_conv_path(path)[source]

Set the MRIManager.jar path.

Parameters:

path – (str) A path.

set_mrtrix_path(path)[source]

Set the mrtrix path.

Parameters:

path – (str) A path.

setNbAllSlicesMax(nb_slices_max)[source]

Set the number of slices to display in the mini-viewer.

Parameters:

nb_slices_max – (int) Maximum number of slices to display.

set_opened_projects(new_projects)[source]

Set the list of opened projects and saves the modification.

Parameters:

new_projects – (list[str]) A list of paths.

set_projects_save_path(path)[source]

Set the folder where the projects are saved.

Parameters:

path – (str) A path.

set_radioView(radio_view)[source]

Set the radiological / neurological orientation in mini viewer.

  • True for radiological

  • False for neurological

Parameters:

radio_view – A boolean.

set_referential(ref)[source]

Set the referential to “image Ref” or “World Coordinates” in anatomist_2 data viewer.

Parameters:

ref – (str) “0” for World Coordinates, “1” for Image Ref.

set_resources_path(path)[source]

Set the resources path.

Parameters:

path – (str) A path.

setShowAllSlices(show_all_slices)[source]

Set the show_all_slides setting in miniviewer.

Parameters:

show_all_slices – A boolean.

setSourceImageDir(source_image_dir)[source]

Set the source directory for project images.

Parameters:

source_image_dir – (str) A path.

set_spm_path(path)[source]

Set the path of SPM (license version).

Parameters:

path – (str) A path.

set_spm_standalone_path(path)[source]

Set the path of SPM (standalone version).

Parameters:

path – (str) A path.

setTextColor(color)[source]

Set text color and save configuration.

Parameters:

color – Color string (‘Black’, ‘Blue’, ‘Green’, ‘Grey’, ‘Orange’, ‘Red’, ‘Yellow’, ‘White’)

setThumbnailTag(thumbnail_tag)[source]

Set the tag that is displayed in the mini-viewer.

Parameters:

thumbnail_tag – A string.

set_use_afni(use_afni)[source]

Set the value of “use_afni” checkbox in the preferences.

Parameters:

use_afni – A boolean.

set_use_ants(use_ants)[source]

Set the value of “use_ants” checkbox in the preferences.

Parameters:

use_ants – A boolean.

set_use_freesurfer(use_freesurfer)[source]

Set the value of “use_freesurfer” checkbox in the preferences.

Parameters:

use_freesurfer – A boolean.

set_use_fsl(use_fsl)[source]

Set the value of “use_fsl” checkbox in the preferences.

Parameters:

use_fsl – A boolean.

set_use_matlab(use_matlab)[source]

Set the value of “use matlab” checkbox in the preferences.

Parameters:

use_matlab – A boolean.

set_use_matlab_standalone(use_matlab_standalone)[source]

Set the value of “use_matlab_standalone” checkbox in the preferences.

Parameters:

use_matlab – A boolean.

set_use_mrtrix(use_mrtrix)[source]

Set the value of “use_mrtrix” checkbox in the preferences.

Parameters:

use_mrtrix – A boolean.

set_user_mode(user_mode)[source]

Enable or disable user mode.

Parameters:

user_mode – A boolean.

set_use_spm(use_spm)[source]

Set the value of “use spm” checkbox in the preferences.

Parameters:

use_spm – A boolean.

set_use_spm_standalone(use_spm_standalone)[source]

Set the value of “use spm standalone” checkbox in the preferences.

Parameters:

use_spm_standalone – A boolean.

setViewerConfig(config_NeuRad)[source]

sets user’s configuration neuro or radio for data_viewer.

  • neuro: neurological

  • radio: radiological

Parameters:

config_NeuRad – A string.

setViewerFramerate(im_sec)[source]

sets user’s framerate for data_viewer.

Parameters:

im_sec – (int) Number of images per second.

update_capsul_config()[source]

Updates the global CapsulEngine object used for all operations in the Mia application.

The CapsulEngine is created once when needed and updated each time the configuration is saved. This method ensures that all necessary engine modules are loaded and configurations are properly imported from the saved settings.

Returns:

(capsul.engine.CapsulEngine) The updated CapsulEngine object, or None if the engine is not initialized.

class populse_mia.tests.run_mia_test.ModifyTable(project, value, types, scans, tags)[source]

Bases: QDialog

Dialog to modify cell contents containing lists in the data browser tab.

This dialog provides a user interface to edit cells that contain list values. It displays the list elements in a table and allows users to add or remove elements.

__init__(project, value, types, scans, tags)[source]

Initialize the ModifyTable dialog.

Parameters:
  • project – Instance of the current project

  • value – List of values in the cell to be modified

  • types – Allowed value types for validation

  • scans – Scan identifiers corresponding to rows

  • tags – Tag identifiers corresponding to columns

_convert_value(text, field_type)[source]

Convert a text value to the appropriate type based on field_type.

Parameters:
  • text – String value to convert

  • field_type – Database field type constant

Returns:

The converted value in the appropriate type

_show_error_message(value, type_problem)[source]

Display an error message for invalid values.

Parameters:
  • value – The invalid value

  • type_problem – The specific type that failed validation

add_item()[source]

Add a new element to the list with default value 0.

fill_table()[source]

Populate the table with the current list elements.

Configures the table dimensions, populates cells with values, and adjusts table size to fit content within reasonable bounds.

rem_last_item()[source]

Remove the last element of the list if there’s more than one element.

Lists must maintain at least one element.

update_table_values(test=False)[source]

Validate user input and update the database with new values.

Validates each value against specified types and updates the database only if all values are valid.

Parameters:

(bool) (test) – Flag for testing mode, defaults to False

class populse_mia.tests.run_mia_test.MainWindow(project, test=False, deleted_projects=None)[source]

Bases: QMainWindow

Initialize software appearance and define interactions with the user.

__init__(project, test=False, deleted_projects=None)[source]

Main window class, initializes the software appearance and defines interactions with the user.

Parameters:
  • project – Current project in the software.

  • test – Boolean indicating if the widget is launched from unit tests or not.

  • deleted_projects – Projects that have been deleted.

add_clinical_tags()[source]

Add the clinical tags to the database and the data browser.

check_database()[source]

Check if files in database have been modified since first import.

check_unsaved_modifications()[source]

Check if there are differences between the current project and the database.

Return (bool):

True if there are unsaved modifications, False otherwise

closeEvent(event)[source]

Override the QWidget closing event to check if there are unsaved modifications.

Parameters:

event – closing event

create_project_pop_up()[source]

Create a new project.

create_view_actions()[source]

Create the actions and their shortcuts in each menu

create_view_menus()[source]

Create the menu-bar view.

create_view_window()[source]

Create the main window view.

create_tabs()[source]

Create the tabs and initializes the DataBrowser and PipelineManager classes.

credits()[source]

Open the credits in a web browser

del_clinical_tags()[source]

Remove the clinical tags to the database and the data browser

delete_project()[source]

Open a pop-up to open a project and updates the recent projects list.

static documentation()[source]

Open the documentation in a web browser.

get_controller_version()[source]

Gives the value of the controller_version_changed attribute.

Returns:

Boolean

import_data()[source]

Import MRI data using the MRI File Manager and load it into the database.

This method performs the following steps: 1. Launches the MRI conversion software to convert MRI files to

Nifti/JSON format

  1. Attempts import with maximum heap size of 4096M, falls back to 1024M if needed

  2. Updates the database with newly imported scans

  3. Refreshes the data browser UI with new scan information

install_processes_pop_up(folder=False)[source]

Open the install processes pop-up.

Parameters:

folder – boolean, True if installing from a folder

static last_window_closed()[source]

Force exit the event loop after ipython console is closed.

If the ipython console has been run, something prevents Qt from quitting after the window is closed. The cause is not known yet. So: force exit the event loop.

open_project_pop_up()[source]

Open a dialog to select and open a project, updating recent projects list.

This method handles: 1. Checking for unsaved modifications in current project 2. Opening project selection dialog 3. Validating project path 4. Switching to new project 5. Updating clinical mode based on database fields 6. Updating database paths if project is external

open_recent_project()[source]

Open a recent project.

open_shell()[source]

Open an in-process Qt console (QtConsole) connected to this application.

This method creates a QtConsole widget that runs inside the current application process, allowing interactive inspection and manipulation of program internals such as the main window, project, and the QApplication instance. This console does not spawn a subprocess and fully integrates with the existing Qt event loop.

Features:
  • Provides access to key objects:
    • main_window: this MainWindow instance

    • project: if available, the current project object

    • app: the current QApplication instance

  • Interactive Python prompt

  • Stdout/stderr from the application will appear in the console

Dependencies:
  • qtconsole for the console widget

  • ipykernel for the in-process IPython kernel

  • IPython for interactive shell support

If any of these are missing, the console will not open, and a warning is logged.

Raises:

(RuntimeError) – if QApplication instance does not exist when calling this method

Returns (RichJupyterWidget):

the created QtConsole widget instance

package_library_pop_up()[source]

Open the package library pop-up

project_properties_pop_up()[source]

Open the project properties pop-up

redo()[source]

Redo the last action made by the user.

remove_raw_files_useless()[source]

Remove the useless raw files of the current project.

Close the database connection. The project is not valid any longer after this call.

save()[source]

Save either the current project or the current pipeline

save_as()[source]

Save either the current project or the current pipeline under a new name.

save_project_as()[source]

Open a pop-up to save the current project as

saveChoice()[source]

Check if the project needs to be ‘saved as’ or just ‘saved’.

see_all_projects()[source]

Open a pop-up to show the recent projects.

set_controller_version()[source]

Reverses the value of the controller_version_changed attribute.

From False to True and vice versa

setup_menu_actions(sources_images_dir)[source]

Initialize menu actions with icons and descriptions.

Parameters:

sources_images_dir – Directory containing source images for icons.

setup_window_size()[source]

Set the window size and maximize if needed.

software_preferences_pop_up()[source]

Open the Mia preferences pop-up.

switch_project(file_path, name)[source]

Check if it’s possible to open the selected project and quit the current one.

Parameters:
  • file_path – raw file_path

  • name – project name

Returns:

Boolean

tab_changed()[source]

Update the window when switching between application tab.

Updates the UI state and data when switching between Data Browser, Data Viewer, and Pipeline Manager tabs. Handles data synchronization, search state preservation, and unsaved changes warnings.

The method performs the following operations based on the selected tab: - Data Browser: Refreshes table data, preserves search state and

visualization settings

  • Data Viewer: Loads current viewer and updates document list

  • Pipeline Manager: Updates scan lists and handles unsaved

    modifications

undo()[source]

Reverts the last action performed by the user, depending on the active tab.

If the “Data Browser” tab is active, the undo operation is applied to the project’s database. If the “Pipeline Manager” tab is active, the pipeline manager’s undo function is invoked.

update_project(file_path, call_update_table=True)[source]

Updates the project after a database change.

This method updates the database, the window title, and the recent and saved projects menus.

Parameters:
  • (str) (file_path) – The file path of the new project.

  • (bool) (call_update_table) – Whether to update the table data. Defaults to True.

update_recent_projects_actions()[source]

Updates the list of recent projects in the UI.

Hides all recent project actions first, then updates and displays the most recent ones based on the configured maximum.

class populse_mia.tests.run_mia_test.PipelineEditor(project, main_window)[source]

Bases: PipelineDeveloperView

Graphical editor for creating, editing, and managing pipelines.

This view provides interactive tools to build pipeline graphs, connect nodes and plugs, edit node properties, and track modifications. It also handles persistence (save/export) and undo/redo history management.

pipeline_saved

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

pipeline_modified

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__(project, main_window)[source]

Initialize the PipelineEditor for visual pipeline development.

Sets up the pipeline editor with project context and initializes undo/redo functionality.

Parameters:

project – The current project instance containing pipeline data and configuration.

Parm main_window:

The main application window instance for UI integration.

Delete a link between two pipeline nodes.

Removes a connection between a source node’s output plug and a destination node’s input plug, updates the pipeline state, and records the action in history.

Parameters:
  • link – Link specification string in the format “source_node.output_plug->dest_node.input_plug”.If None, uses the current link stored in self._current_link.

  • from_undo – Whether this deletion is being performed as part of an undo operation. Affects history recording.

  • from_redo – Whether this deletion is being performed as part of a redo operation. Affects history recording.

Side Effects:
  • Updates self._current_link to the deleted link

  • Modifies self._current_link_def with link component references

  • Calls parent class’s _del_link() to perform actual deletion

  • Records action in history unless from undo/redo

_export_plug(pipeline_parameter=None, optional=None, weak_link=None, from_undo=False, from_redo=False, temp_plug_name=None, multi_export=False)[source]

Export a plug to a pipeline global input or output.

This method exports a node plug to the pipeline level, making it accessible as a pipeline parameter. It handles name conflicts, creates appropriate links, and maintains operation history for undo/redo functionality.

Parameters:
  • (str) (pipeline_parameter) – Name for the exported pipeline parameter. If None, prompts user for a name via dialog. Defaults to None.

  • (bool) (multi_export) – Whether the exported plug is optional. If None, derived from dialog checkbox or plug configuration. Defaults to None.

  • (bool) – Whether to create a weak link (doesn’t enforce execution order). If None, derived from dialog or defaults to False.

  • (bool) – True when called during an undo operation. Used to prevent circular history updates. Defaults to False.

  • (bool) – True when called during a redo operation. Used to prevent circular history updates. Defaults to False.

  • (tuple) (temp_plug_name) – A (node_name, plug_name) tuple specifying the plug to export. If None, uses self._temp_plug_name. Defaults to None.

  • (bool) – True when exporting multiple plugs simultaneously. Changes return behavior and error handling. Defaults to False.

Return (str):

When multi_export is True, returns the plug name on success or None on failure. When multi_export is False, returns None after updating the UI and history.

Raises:
  • TraitError – Logged as warning when plug export fails due to trait issues.

  • ValueError – Logged as warning when export fails due to invalid values.

Side Effects:
  • May display dialog boxes for user input

  • Updates pipeline structure and UI

  • Adds entry to operation history (unless from_undo/from_redo)

  • Shows status message in main window

Handle link release event and update pipeline history.

Called when a user releases a link in the pipeline editor. This method extends the parent class behavior by recording the link addition in the history and displaying a status message.

Parameters:

event – Mouse event corresponding to the link release.

_remove_plug(plug_names=None, from_undo=False, from_redo=False, from_export_plugs=False)[source]

Remove one or more plugs from the pipeline.

This method removes plugs from the pipeline, tracks their connections for potential undo/redo operations, and updates the application history unless called from an export operation.

Parameters:
  • plug_names – A tuple (node_name, plug_name) or list of such tuples specifying the plug(s) to remove. If None, uses self._temp_plug_name.

  • from_undo – Whether this method is being called from an undo operation.

  • from_redo – Whether this method is being called from a redo operation.

  • from_export_plugs – Whether this method is being called from an export plugs undo/redo operation. When True, history is not updated.

Note:

For each removed plug, stores [plug_info, connected_plugs, optional_flag] in the history for potential restoration.

Add a link between two nodes in the pipeline.

Creates a connection between a source node’s output plug and a destination node’s input plug. The link is represented as “node.plug->node.plug” format and added to the pipeline scene.

Parameters:
  • source – A tuple of (node_name, plug_name) for the source connection.

  • dest – A tuple of (node_name, plug_name) for the destination connection.

  • active – Whether the link is currently active/enabled.

  • weak – Whether the link is a weak reference that doesn’t enforce strict execution dependencies.

  • from_undo – Whether this action originates from an undo operation. Defaults to False.

  • from_redo – Whether this action originates from a redo operation. Defaults to False.

  • allow_export – Whether to allow this link in exported pipelines. Defaults to False.

Side Effects:
  • Adds the link to the pipeline scene

  • Updates the pipeline visualization

  • Records the action in history (unless from undo/redo)

  • Displays a status message in the main window

add_named_process(class_process, node_name=None, from_undo=False, from_redo=False, links=None)[source]

Add a process to the pipeline with optional link restoration.

This method adds a named process to the pipeline and configures it according to project settings. It also handles link restoration when the action is part of an undo/redo operation.

Parameters:
  • (str) (node_name) – The name of the process class to instantiate.

  • (str) – Custom name for the node. If None, the name is derived from the process’s context_name or name attribute. Defaults to None.

  • (bool) (from_redo) – Whether this action is part of an undo operation. Defaults to False.

  • (bool) – Whether this action is part of a redo operation. Defaults to False.

  • (list) (links) – List of link tuples to restore, where each tuple contains (source, dest, active, weak). Used during undo/redo operations. Defaults to None.

Side Effects:
  • Adds process to the pipeline

  • Configures project settings if applicable

  • Restores links if provided

  • Updates history for undo/redo

  • Updates UI status bar and buttons

check_modifications()[source]

Check and update pipeline nodes that have been modified.

This method iterates through all pipeline nodes and detects if the underlying process definition has changed (added/removed inputs/outputs).

When changes are detected, it:
  • Recreates the node with the updated process definition

  • Preserves the node’s position in the scene

  • Attempts to restore compatible links

  • Removes incompatible links and notifies the user

Side Effects:

Modifies self.scene.gnodes, self.scene.glinks, and pipeline.nodes. Displays a warning dialog if any links are removed.

del_node(node_name=None, from_undo=False, from_redo=False)[source]

Deletes a node from the pipeline and updates the GUI and history accordingly.

Parameters:
  • (str) (node_name) – The name of the node to delete. If not provided, the currently selected node is used.

  • (bool) (from_redo) – True if the deletion was triggered by an undo operation.

  • (bool) – True if the deletion was triggered by a redo operation.

export_node_plugs(node_name, inputs=True, outputs=True, optional=False, from_undo=False, from_redo=False)[source]

Export plugs (parameters) from a pipeline node to make them available externally.

This method identifies and exports node plugs that meet the specified criteria (input/output type, optional status, unlinked status) and are not in the pipeline’s exclusion list.

Parameters:
  • node_name – Name of the node whose plugs should be exported.

  • inputs – Whether to export input plugs. Defaults to True.

  • outputs – Whether to export output plugs. Defaults to True.

  • optional – Whether to include optional plugs in the export. Defaults to False.

  • from_undo – Whether this call originates from an undo operation. Defaults to False.

  • from_redo – Whether this call originates from a redo operation. Defaults to False.

Note:
  • Only unlinked plugs are exported (outputs without links_to, inputs without links_from)

  • Certain system plugs are automatically excluded (nodes_activation, selection_changed, etc.)

  • The operation is recorded in the history for undo/redo support

get_current_filename()[source]

Return the relative path to the last saved pipeline file.

Returns the relative path from the current working directory to the file where this pipeline was most recently saved. If the pipeline has never been saved, returns an empty string.

Return (str):

Relative path to the pipeline file, or empty string if never saved.

save_pipeline(filename=None)[source]

Save the pipeline to a Python file.

This method saves the current pipeline configuration to a file. If no filename is provided, it prompts the user with a file dialog. The method performs validation to ensure the filename is valid (doesn’t start with a digit, has .py extension) and checks user permissions.

Parameters:

(str) (filename) – Path where the pipeline should be saved. If None, a file dialog will be shown. Defaults to None.

Return (str):
The absolute path of the saved pipeline file,

or None if:

  • The pipeline is empty (fewer than 2 nodes)

  • The user cancelled the save dialog

  • The filename is invalid

  • The user lacks permission to overwrite an existing file

Note:
  • pipeline_saved: Signal emitted with the filename when save is

    successful.

update_history(history_maker, from_undo, from_redo)[source]

Update the undo/redo history after a pipeline action.

Manages the undo and redo stacks based on the action performed. When an action is undone, it’s moved to the redo stack. When a new action is performed (not from undo/redo), it’s added to the undo stack and complementary redo entries are cleaned up to maintain consistency.

Parameters:
  • history_maker – A list describing the action, where history_maker[0] is the action type (e.g., ‘add_process’, ‘delete_process’, ‘update_node_name’) and history_maker[1] is typically the affected node identifier.

  • (bool) (from_redo) – Whether this update stems from an undo operation. Defaults to False.

  • (bool) – Whether this update stems from a redo operation. Defaults to False.

Note:
  • ‘update_node_name’ actions are not added to the undo stack

  • Complementary actions (add/delete for the same process) are removed from the redo stack when a new action occurs

  • pipeline_modified: Signal emitted indicating the pipeline has been modified.

update_node_name(old_node, old_node_name, new_node_name, from_undo=False, from_redo=False)[source]

Update a node’s name in the pipeline, preserving all connections.

This method renames a node by: 1. Temporarily removing all links connected to the node 2. Renaming the node in the pipeline 3. Restoring all links with the updated node name 4. Recording the action in the history for undo/redo support

Parameters:
  • old_node – The node object to rename.

  • old_node_name – The current name of the node.

  • new_node_name – The desired new name for the node.

  • from_undo – Whether this action is being performed as part of an undo operation. Defaults to False.

  • from_redo – Whether this action is being performed as part of a redo operation. Defaults to False.

Side Effects:
  • Updates the pipeline’s node registry

  • Removes and recreates all links connected to the node

  • Updates pipeline activation states

  • Records action in history

  • Displays status message to user

update_plug_value(node_name, new_value, plug_name, value_type, from_undo=False, from_redo=False)[source]

Update a node’s plug value and record the change in history.

Updates the specified plug on the given node with a new value. The update is recorded in the history for undo/redo operations unless it’s already part of an undo/redo action.

Parameters:
  • node_name – The name of the node containing the plug.

  • new_value – The new value to assign to the plug. Will be cast to value_type unless from_undo or from_redo is True.

  • plug_name – The name of the plug to update.

  • value_type – The type constructor to apply to new_value (e.g., int, float, str). Ignored when from_undo or from_redo is True.

  • from_undo – If True, indicates this update is from an undo operation. Defaults to False.

  • from_redo – If True, indicates this update is from a redo operation. Defaults to False.

Side Effects:
  • Updates the plug value in the pipeline

  • Records the change in history (unless from undo/redo)

  • Displays a status message in the main window

  • Pops from the undo stack if from undo/redo

populse_mia.tests.run_mia_test.save_pipeline(pipeline, filename)[source]

Save a pipeline to a file in the appropriate format.

Automatically detects the output format based on the file extension. Supported formats are Python source (.py) and XML (.xml). If no recognized extension is provided, defaults to Python format.

Parameters:
  • pipeline – The pipeline object to serialize and save.

  • filename – Path to the output file. The extension determines the output format (.py or .xml).

Note:

Unrecognized extensions will default to Python source format (.py)

Examples

>>> save_pipeline(my_pipeline, "model.py")
>>> save_pipeline(my_pipeline, "config.xml")
>>> save_pipeline(my_pipeline, "output")  # Defaults to .py format
class populse_mia.tests.run_mia_test.RunProgress(pipeline_manager, settings=None)[source]

Bases: QWidget

A Qt widget for displaying and managing pipeline execution progress.

This widget provides a visual progress indicator and manages the lifecycle of pipeline execution through a worker thread. It handles user feedback, error reporting, and resource cleanup.

The widget integrates with a PipelineManagerTab to control pipeline execution, providing real-time feedback and graceful error handling.

Notes

pipeline_manager (PipelineManagerTab):

The pipeline manager instance that handles the pipeline operations.

progressbar (QProgressBar):

The progress bar widget to show execution progress.

worker (RunWorker):

The worker thread that runs the pipeline.

MIN_PROGRESS_WIDTH = 350
AUTO_CLOSE_DELAY_MS = 2000
__init__(pipeline_manager, settings=None)[source]

Initialize the RunProgress widget with a progress bar and worker thread.

Parameters:
  • (PipelineManagerTab) (pipeline_manager) – A PipelineManagerTab instance responsible for managing the pipeline.

  • (dict) (settings) – A dictionary of settings to customize pipeline iteration, default is None.

_determine_completion_message()[source]

Analyze execution results and determine appropriate user message.

Returns:

Dictionary containing message box configuration with keys: ‘icon’, ‘title’, and ‘text’.

_setup_ui() None[source]

Set up the user interface for the widget.

This method initializes an indeterminate progress bar with a predefined minimum width and places it inside a horizontal box layout, which is then assigned to the widget.

_show_completion_message(icon, title, text)[source]

Display execution completion message with auto-close timer.

Parameters:
  • (QMessageBox.Icon) (icon) – Message box icon type.

  • (str) (text) – Dialog window title.

  • (str) – Message content to display.

cleanup()[source]

Clean up resources and prepare for widget destruction.

Ensures the worker thread completes, disconnects signals, and releases resources. Should be called before widget destruction.

Note

This method blocks until the worker thread finishes.

end_progress()[source]

Handle completion of pipeline execution and show results.

Called automatically when the worker thread finishes. Restores the application cursor, evaluates execution status, and displays an appropriate message to the user.

The message dialog automatically closes after a brief delay.

start()[source]

Starts the worker thread to begin the pipeline execution process.

This method initiates the worker thread by calling its start method, which in turn triggers the execution of the pipeline.

stop_execution()[source]

Stops the execution of the pipeline by signaling the worker to interrupt.

This method sets the interrupt_request flag to True within the worker thread’s lock, which tells the worker to stop its execution. The method can be used to cancel the pipeline execution at any point during its run.

class populse_mia.tests.run_mia_test.PackageLibraryDialog(mia_main_window=None, parent=None)[source]

Bases: QDialog

Dialog for managing package library configurations.

This dialog allows users to add, remove, and delete packages from the process library. It provides interfaces for installing packages, updating the package tree, and saving configurations.

signal_save

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__(mia_main_window=None, parent=None)[source]

Initialize the PackageLibraryDialog.

Parameters:
  • mia_main_window – Reference to the main application window.

  • (QWidget) (parent) – Parent widget for the dialog.

_create_button(text, callback)[source]

Create a standardized button.

Parameters:
  • (str) (text) – Button text.

  • (callable) (callback) – Function to call when button is clicked.

Returns (QPushButton):

Configured button.

_create_install_buttons()[source]

Create buttons for installing processes.

Return (QHBoxLayout):

Layout with install process buttons.

_create_line_edit()[source]

Create and configure the line edit.

Return QLineEdit:

Configured line edit for package input.

_create_list_group(title, list_widget, reset_callback)[source]

Create a group box for a list with reset functionality.

Parameters:
  • (str) (title) – Group box title.

  • (QListWidget) (list_widget) – List widget to add to group.

  • (callable) (reset_callback) – Callback for reset button.

Return (QGroupBox):

Configured group box with list and reset button.

_create_list_widget()[source]

Create a list widget with extended selection mode.

Return (QListWidget):

Configured list widget.

_create_main_layout(install_layout, management_layout, user_mode)[source]

Create the main layout for the dialog.

Parameters:
  • (QHBoxLayout) (management_layout) – Layout for install buttons.

  • (QHBoxLayout) – Layout for package management buttons.

  • (bool) (user_mode) – Whether the application is in user mode.

Return (QHBoxLayout):

Main layout of the dialog.

_create_package_management_buttons(user_mode)[source]

Create buttons for package management.

Parameters:

(bool) (user_mode) – Whether the application is in user mode.

Return (QHBoxLayout):

Layout with package management buttons.

_create_save_cancel_layout()[source]

Create layout for save and cancel buttons.

Return (QHBoxLayout):

Layout with save and cancel buttons.

_create_status_label()[source]

Create and configure the status label.

Return (QLabel):

Configured status label.

_load_initial_configuration()[source]

Load initial package configuration.

_setup_ui()[source]

Set up the user interface components.

add_package(module_name, class_name=None, show_error=False, init_package_tree=False)[source]

Add a package and its modules to the package tree with comprehensive module and class discovery.

This method recursively discovers and adds packages, subpackages, and their classes to the package tree. It provides flexible options for package initialization and error handling.

Parameters:
  • (str) (class_name) – Fully qualified name of the module to add. Example: ‘myproject.processors’

  • (str) – Specific class name to focus on during package addition. If provided, only this class or its parent packages will be processed.

  • (bool) (init_package_tree) – Controls error reporting behavior. If True, displays error messages in a QMessageBox. If False, collects errors silently. Defaults to False.

  • (bool) – If True, reinitializes the entire package tree before adding the module. Defaults to False.

Return (List[str] | str):

A list of error messages encountered during package addition, or “No package selected!” if no module name is provided.

add_package_with_text(package_name=False, update_view=True)[source]

Add a package to the Package Library.

This method attempts to add a package or module to the library based on the provided package name. It supports adding packages with or without file extensions, and handles various import scenarios.

Parameters:
  • False) (package_name (str |) – Name of the package to add. If False (default), uses the text from the line edit widget.

  • (bool) (update_view) – Whether to update the package list view. Defaults to True.

delete_package(index=1, to_delete=None, remove=True, loop=False, from_pipeline_manager=False)[source]

Delete a package from the library (admin-only functionality).

This method removes the package from the package library tree, updates the __init__.py file, and deletes the package directory and files if they are empty.

Parameters:
  • (int) (index) – Recursive index for navigating modules. Defaults to 1.

  • (str) (to_delete) – The package/brick to delete (e.g., ‘test.Test’). Defaults to None.

  • (bool) (from_pipeline_manager) – Whether to remove the brick from the package tree. Defaults to True.

  • (bool) – Whether to delete silently without confirmation. Defaults to False.

  • (bool) – Whether deletion is initiated from pipeline manager. Defaults to False.

Return (list[str]):

A list of deleted packages/bricks.(classes).

delete_package_with_text(package_name='', update_view=True)[source]

Delete a package from the line edit’s text.

Parameters:
  • (str) (package_name) – The name of the package to delete. Defaults to the text in the line edit.

  • (bool) (update_view) – Whether to update the QListWidget after deletion. Defaults to True.

install_processes_pop_up(from_folder=False)[source]

Display the install processes pop-up.

Parameters:

(bool) (from_folder) – Whether the installation is from a folder. Defaults to False.

static load_config()[source]

Loads and returns the configuration from ‘process_config.yml’.

Return (dict | {}):

The configuration dictionary if successfully loaded, otherwise None in case of an error.

load_packages()[source]

Update the tree of the process library.

ok_clicked()[source]

Handles the click event when the ‘Apply Changes’ button is clicked.

remove_package(package)[source]

Removes a package from the package tree.

This method attempts to remove the specified package from the package library. If the package is not found, a warning message is displayed. The package tree is updated after a successful removal.

Parameters:

(str) (package) – The fully qualified module name (e.g., ‘nipype.interfaces.spm’).

Returns (bool):

True if the package was successfully removed, False if the package was not found or no package was provided.

remove_package_with_text(package_name='', update_view=True, tree_remove=True)[source]

Removes the specified package from the package tree and updates the view accordingly.

Parameters:
  • (str) (package_name) – The name of the package to remove. If not provided, the package name is taken from the line edit.

  • (bool) (tree_remove) – Whether to update the QListWidget view after removal. Defaults to True.

  • (bool) – Whether to remove the package from the tree. Defaults to True.

reset_action(itemlist, add)[source]

Resets a previous package addition or removal action.

Parameters:
  • (QListWidget) (itemlist) – The list widget containing items to reset.

  • (bool) (add) – If True, resets an addition by removing the package if it exists in the configuration. If False, re-adds the package.

save(close=True)[source]

Saves the package library configuration to process_config.yml.

This method updates the package information from the package library tree and writes it to the configuration file. Optionally, it can close the dialog after saving.

Parameters:

(bool) (close) – If True, closes the dialog after saving. Defaults to True.

update_config()[source]

Refreshes the process configuration and updates the package library.

This method reloads the configuration from ‘process_config.yml’, updates the package library attributes, and regenerates the package tree.

class populse_mia.tests.run_mia_test.DefaultValueListCreation(parent, type)[source]

Bases: QDialog

A dialog for creating or editing a list’s default value.

This widget allows users to input and manage a list of values based on a specified type (e.g., integers, floats, booleans, etc.).

__init__(parent, type)[source]

Initializes the DefaultValueListCreation dialog.

Parameters:
  • (DefaultValueQLineEdit) (parent) – The parent object.

  • (Type) (type) – The type of the list elements (e.g., int, float, str).

add_element()[source]

Adds a new empty element to the list.

Increases the number of columns in the table by one and adds an empty QTableWidgetItem for user input.

default_init_table()[source]

Initializes the table with a default value.

If no previous value exists, the table is set up with a single empty column to allow user input.

remove_element()[source]

Removes the last element from the list.

Ensures that at least one column remains to prevent an empty table. Adjusts the table size accordingly.

resize_table()[source]

Adjusts the size of the popup window based on the table content.

Dynamically resizes the table width and height based on the number of columns and rows, with a maximum width limit of 900 pixels.

update_default_value()[source]

Validates user input and updates the parent’s default value.

Converts table values to the specified list type, ensuring that each entry is valid. If any value is invalid, a warning message is displayed, and the update is aborted.

If all values are valid, they are stored in the parent widget, and the dialog is closed.

class populse_mia.tests.run_mia_test.PopUpAddPath(project, databrowser)[source]

Bases: QDialog

Dialog for adding a document to the project without using the MRI Files Manager (File > Import).

__init__(project, databrowser)[source]

Initializes the pop-up for adding a document.

Parameters:
  • (Project) (project) – The current project instance.

  • (DataBrowser) (databrowser) – The application’s data browser.

file_to_choose()[source]

Opens a file dialog for selecting documents.

find_type()[source]

Determines the document type when the file path changes.

save_path()[source]

Adds the selected document paths to the database and updates the UI.

class populse_mia.tests.run_mia_test.PopUpAddTag(databrowser, project)[source]

Bases: QDialog

Dialog for adding a new tag to the project.

This dialog allows users to create a new tag by specifying its name, default value, description, unit, and type.

signal_add_tag

Signal emitted when a new tag is successfully added

- _connect_signals

Connect signals to slots

- _setup_layouts

Set up the layout of UI elements

- _setup_ui

Set up the dialog UI elements

- _show_error

Display an error message box

- ok_action

Validates input fields and adds the new tag if valid

- on_activated

Updates form fields when tag type is changed

signal_add_tag

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__(databrowser, project)[source]

Initialize the dialog for adding a new tag.

Parameters:
  • databrowser – The data browser instance

  • project – The current project in the software

_connect_signals()[source]

Connect signals to slots.

_setup_layouts()[source]

Set up the layout of UI elements.

_setup_ui()[source]

Set up the dialog UI elements.

_show_error(text, informative_text)[source]

Display an error message box.

Parameters:
  • text – The main error message text

  • informative_text – The additional informative text

ok_action()[source]

Validate inputs and add the new tag if all fields are correct.

Performs validation on the tag name, type and default value to ensure they are valid before adding the tag to the project.

on_activated(text)[source]

Update the default value when the tag type changes.

Parameters:

text – The new type selected from combo box

class populse_mia.tests.run_mia_test.PopUpClosePipeline(pipeline_name)[source]

Bases: QDialog

Dialog displayed when closing a modified pipeline editor.

This dialog asks the user whether they want to save changes before closing the pipeline editor. It provides three options: save, don’t save, or cancel.

Signals:

save_as_signal: Emitted when the user chooses to save the pipeline. do_not_save_signal: Emitted when the user chooses not to save

the pipeline.

cancel_signal: Emitted when the user cancels the closing action.

bool_save_as

Indicates if the pipeline should be saved under a new name.

Type:

bool

bool_exit

Indicates if the editor can be closed.

Type:

bool

pipeline_name

Name of the pipeline being edited.

Type:

str

save_as_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

do_not_save_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

cancel_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__(pipeline_name)[source]

Initialize the dialog with the pipeline name.

Parameters:

(str) (pipeline_name) – Name of the pipeline (basename).

_connect_signals()[source]

Connect button signals to their respective slots.

_setup_ui()[source]

Set up the dialog’s user interface.

can_exit()[source]

Check if the editor can be closed.

Return (bool): True if the editor can be closed, False otherwise.

cancel_clicked()[source]

Handle the cancel button click.

Sets bool_exit to False, emits cancel_signal, and closes the dialog.

do_not_save_clicked()[source]

Handle the ‘Do not save’ button click.

Sets bool_exit to True, emits do_not_save_signal, and closes the dialog.

save_as_clicked()[source]

Handle the ‘Save’ button click.

Sets bool_save_as and bool_exit to True, emits save_as_signal, and closes the dialog.

class populse_mia.tests.run_mia_test.PopUpDeletedProject(deleted_projects)[source]

Bases: QMessageBox

Message box that displays a list of deleted, renamed, or moved projects.

This dialog appears when the software starts and detects that previously available projects are no longer accessible at their expected locations.

deleted_projects

List of project names that are no longer accessible.

Type:

list

__init__(deleted_projects)[source]

Initialize the message box with a list of inaccessible projects.

Parameters:

(list) (deleted_projects) – List of project names that are no longer accessible (deleted, renamed, or moved).

_connect_signals()[source]

Connect button signals to their respective slots.

_setup_message_box()[source]

Configure the message box appearance and content.

class populse_mia.tests.run_mia_test.PopUpDeleteProject(main_window)[source]

Bases: QDialog

Dialog for deleting selected projects.

Allows the user to select and delete one or more projects from the projects directory after confirmation.

__init__(main_window)[source]

Initializes the delete project dialog.

Parameters:

(QMainWindow) (main_window) – The main application window

_delete_project(project_path, opened_projects)[source]

Handles project deletion, updating application state accordingly.

Parameters:
  • (str) (project_path) – The path of the project to delete

  • (list) (opened_projects) – The list of currently opened projects

_setup_buttons()[source]

Creates and configures the dialog buttons.

_setup_layout()[source]

Configures the main layout of the dialog.

_setup_ui()[source]

Sets up the user interface components.

ok_clicked()[source]

Deletes the selected projects after user confirmation.

class populse_mia.tests.run_mia_test.PopUpInheritanceDict(values, node_name, plug_name, iterate)[source]

Bases: QDialog

Dialog for selecting tag inheritance between input and output plugs.

This dialog allows users to select which input plug should pass its tags to a specific output plug, or to choose to ignore tag inheritance altogether.

Methods:
  • _setup_buttons: Set up action buttons for the dialog

  • _setup_radio_buttons: Set up radio buttons for each input option

  • ok_clicked: Event when ok button is clicked

  • okall_clicked: Event when Ok all button is clicked

  • on_clicked: Event when radiobutton is clicked

  • ignoreall_clicked: Event when ignore all plugs button is clicked

  • ignore_clicked: Event when ignore button is clicked

  • ignore_node_clicked: Event when ignore all nodes button is clicked

__init__(values, node_name, plug_name, iterate)[source]

Initialize the inheritance selection dialog.

Parameters:
  • (dict) (values) – Dict mapping input names (keys) to their paths (values)

  • (str) (plug_name) – Name of the current node

  • (str) – Name of the current output plug

  • (bool) (iterate) – Boolean indicating if the choice applies to iterations

_setup_buttons(node_name, plug_name, layout)[source]

Set up action buttons for the dialog.

Parameters:
  • node_name – Name of the current node

  • plug_name – Name of the current output plug

  • layout – Layout to add the buttons to

_setup_radio_buttons(values, layout)[source]

Set up radio buttons for each input option.

Parameters:
  • values – Dict mapping input names to their paths

  • layout – Layout to add the radio buttons to

ok_clicked()[source]

Handle OK button click.

Accepts the dialog with current selection applied to current plug.

okall_clicked()[source]

Handle ‘OK for all output plugs’ button click.

Accepts the dialog with current selection applied to all output plugs.

on_clicked()[source]

Handle radio button selection event.

Updates the currently selected input value and key.

ignoreall_clicked()[source]

Handle ‘Ignore for all output plugs’ button click.

Accepts the dialog with tag inheritance ignored for all output plugs.

ignore_clicked()[source]

Handle Ignore button click.

Accepts the dialog with tag inheritance ignored for current plug.

ignore_node_clicked()[source]

Handle ‘Ignore for all nodes in the pipeline’ button click.

Accepts the dialog with tag inheritance ignored for the entire pipeline.

class populse_mia.tests.run_mia_test.PopUpNewProject[source]

Bases: QFileDialog

Dialog for creating a new project.

This dialog is displayed when the user wants to create a new project. It manages file selection and handles the creation process.

signal_create_project

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__()[source]

Initialize the new project dialog with appropriate settings.

get_filename(file_name_tuple)[source]

Process the selected filename and set up project attributes.

Parameters:

(tuple) (file_name_tuple) – Tuple containing the selected filename(s), obtained from the selectedFiles method

Note

If the file already exists, displays an error message. Otherwise, closes the dialog and emits signal_create_project.

class populse_mia.tests.run_mia_test.PopUpQuit(project)[source]

Bases: QDialog

Dialog to handle unsaved project modifications when closing the software.

Provides options to save, discard, or cancel the exit process. Is called when the user closes the software and the current project has been modified.

save_as_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

do_not_save_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

cancel_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__(project)[source]

Initialize the quit confirmation dialog.

Parameters:

project – Current project with unsaved modifications.

can_exit()[source]

Check if the application can exit.

Return (bool):

True if exit is allowed.

cancel_clicked()[source]

Handle cancel action by preventing exit.

do_not_save_clicked()[source]

Handle ‘do not save’ action by allowing exit without saving.

save_as_clicked()[source]

Handle save action by emitting save signal and allowing exit.

class populse_mia.tests.run_mia_test.PopUpRemoveScan(scan, size)[source]

Bases: QDialog

Dialog to confirm removal of a scan previously sent to the pipeline manager.

Provides options to remove or keep a scan, with additional ‘apply to all’ functionality when multiple scans are involved. Is called when the user wants to remove a scan that was previously sent to the pipeline manager.

__init__(scan, size)[source]

Initialize the remove scan confirmation dialog.

Parameters:
  • scan – Identifier of the scan to be potentially removed.

  • size – Total number of scans in the removal process.

cancel_clicked()[source]

Handle ‘Cancel’ action.

Sets stop flag to True and indicates no global action.

no_all_clicked()[source]

Handle ‘No to All’ action.

Sets stop flag to True and indicates a global ‘No’ action.

yes_all_clicked()[source]

Handle ‘Yes to All’ action.

Clears stop flag and indicates a global ‘Yes’ action.

yes_clicked()[source]

Handle ‘Yes’ action.

Clears both stop and repeat flags for a single item removal.

class populse_mia.tests.run_mia_test.PopUpSeeAllProjects(saved_projects, main_window)[source]

Bases: QDialog

A dialog window for displaying and managing saved projects.

This dialog allows users to view a list of saved projects, check their existence, and open a selected project.

__init__(saved_projects, main_window)[source]

Initialize the PopUpSeeAllProjects dialog.

Parameters:
  • saved_projects – Container with a list of project paths.

  • main_window – Main window.

checkState(path)[source]

Determine the icon based on project existence.

Parameters:

(str) (path) – Path to the project directory.

Returns:

QIcon: Green checkmark if project exists, red cross if not.

item_to_path()[source]

Returns the path of the first selected item.

Return (str):

Absolute path of the selected project, or empty string if no selection.

open_project()[source]

Attempt to switch to the selected project.

Opens the selected project in the main window if a valid project is chosen. Closes the dialog upon successful project switch.

class populse_mia.tests.run_mia_test.PopUpSelectTagCountTable(project, tags_to_display, tag_name_checked=None)[source]

Bases: PopUpTagSelection

A pop-up dialog for selecting a tag from a count table.

Allows users to choose a single tag from a list of available tags, with an option to pre-select a specific tag.

__init__(project, tags_to_display, tag_name_checked=None)[source]

Initialize the tag selection pop-up.

Parameters:
  • project – The current project context.

  • (list) (tags_to_display) – List of tags to be displayed for selection.

  • (str) (tag_name_checked) – Optional tag to be pre-checked on initialization.

ok_clicked()[source]

Determine the selected tag and close the dialog.

Finds the first checked item and sets it as the selected tag, then closes the dialog.

populse_mia.tests.run_mia_test.check_value_type(value, value_type, is_subvalue=False)[source]

Checks the type of new value in a table cell (QTableWidget).

Parameters:
  • (str) (value) – Value of the cell (always a str, can be a string representation of a list)

  • (type) (value_type) – Expected type (can be list[str], list[int], etc.)

  • (bool) (is_subvalue) – Whether the value is a subvalue of a list.

Returns:

True if the value is valid to replace the old one, False otherwise

populse_mia.tests.run_mia_test.table_to_database(value, value_type)[source]

Prepares the value to the database based on its type.

Parameters:
  • (Any) (value) – Value to convert.

  • (Type) (value_type) – Value type.

Return (Any):

The value converted for the database.

populse_mia.tests.run_mia_test.update_auto_inheritance(node, job=None)[source]

Automatically infer database tags for output parameters from input parameters.

  1. Single input case: When only one input parameter has a database

    value, all outputs inherit from this input.

  2. Multiple inputs with same value: When multiple inputs exist but

    have identical database values, fallback to single input behavior.

  3. Ambiguous case: When multiple inputs have different database

    values, track all possible inheritance sources for user resolution.

The process attribute auto_inheritance_dict is filled with these values. It’s a dict with the shape:

{output_filename: <input_spec>}

output_filename is the relative filename in the database

<input_spec> can be:

  • a string: filename

  • a dict:

    {input_param: input_filename}
    

auto_inheritance_dict is built automatically, and is used as a fallback to ProcessMIA inheritance_dict, built “manually” (specialized for each process) in the ProcessMIA.list_outputs() when the latter does not exist, or does not specify what an output inherits from.

If ambiguities still subsist, the Mia infrastructure will ask the user how to solve them, which is not very convenient, and error-prone, thus should be avoided.

Parameters:
  • node – The node (typically a process or process node) whose inputs and outputs are analyzed for tag inheritance.

  • job – An optional job object containing parameter values to override or populate the node’s inputs and outputs. Defaults to None.

Return (dict or None):

Auto-inheritance mapping if successful and no job provided, None if no inheritance can be determined or job is provided (in which case the job object is updated in-place).

populse_mia.tests.run_mia_test.verify_processes(nipypeVer, miaProcVer, capsulVer, Config)[source]

Install or update to the last version available on the station, for nipype, capsul and mia_processes processes libraries.

Parameters:
  • nipypeVer – nipype version currently installed (str).

  • miaProcVer – mia_processes version currently installed (str).

  • capsulVer – capsul version currently installed (str).

  • Config – The class that manages Mia’s configuration and properties.

By default, Mia provides three process libraries in the pipeline library (available in Pipeline Manager tab). The nipype, given as it is because it is developed by another team (https://github.com/nipy/nipype), and mia_processes, capsul which are developed under the umbrella of populse (https://github.com/populse/mia_processes). When installing Mia in user mode, these three libraries are automatically installed on the station. The idea is to use the versioning available with pypi (https://pypi.org/). Thus, it is sufficient for the user to change the version of the library installed on the station (pip install…) to also change the version available in Mia. Indeed, when starting Mia, the verify_processes function will update the nipype, capsul and mia_processes libraries in the pipeline library accordingly. Currently, it is mandatory to have nipype, capsul and mia_processes installed in the station. All this information, as well as the installed versions and package paths are saved in the properties_path/properties/process_config.yml file. When an upgrade or downgrade is performed for a package, the last configuration used by the user is kept (if a pipeline was visible, it remains so and vice versa). However, if a new pipeline is available in the new version it is automatically marked as visible in the library.

Contains:
Private function:
  • _deepCompDic: keep the previous config existing before packages update

populse_mia.tests.run_mia_test.verify_setup(Config, dev_mode, pypath=None, dot_mia_config='/home/econdami/.populse_mia/configuration_path.yml')[source]

Check and try to correct the configuration if necessary.

Parameters:
  • Config – The class that manages Mia’s configuration and properties.

  • (bool) (dev_mode) – the current developer mode. (True: dev, False: user)

  • (list) (pypath) – List of paths for the capsul config.

  • (str) (dot_mia_config) – Path to the configuration_path.yml file.

Contains:
Private function:
  • _browse_properties_path: the user define the properties_path

    parameter

  • _cancel_clicked: exit form Mia

  • _make_default_config: make default configuration

  • _save_yml_file: save data in a YAML file

  • _verify_miaConfig: check the config and try to fix if necessary

populse_mia.tests.run_mia_test.qt_message_handler(mode, context, message)[source]

Custom Qt message handler that filters out or cleans specific unwanted messages.

This function is used to suppress known, irrelevant Qt warnings during tests or execution. If a message exactly matches an unwanted message, it is ignored. If it contains an unwanted substring, that part is removed and the cleaned message is printed to stderr (if anything remains).

Parameters:
  • mode – The Qt message type (ignored here).

  • context – The context of the message (ignored here).

  • (str) (message) – The Qt debug/warning message to filter and display

class populse_mia.tests.run_mia_test.LogCapture[source]

Bases: Handler

Custom logging handler to capture log records for inspection during tests.

This handler stores emitted log records in a list, allowing assertions on log content, level, or message during unit tests.

__init__()[source]

Initializes the LogCapture handler.

Sets up an empty list to store log records.

emit(record)[source]

Appends a log record to the internal list.

Parameters:

(logging.LogRecord) (record) – The log record to store.

clear()[source]

Clears all captured log records.

class populse_mia.tests.run_mia_test.TestMIACase(methodName='runTest')[source]

Bases: TestCase

Parent class for the test classes of mia.

Contains:
Method:
  • add_visualized_tag: selects a tag to display with the “Visualized tags” pop-up

  • capture_logs: context manager to temporarily capture log records

  • clean_uts_packages: deleting the package added during the UTs or old one still existing

  • create_mock_jar: creates a mocked java (.jar) executable

  • execute_QDialogAccept: accept (close) a QDialog instance

  • find_item_by_data: looks for a QModelIndex whose contents correspond to the argument data

  • get_new_test_project: create a temporary project that can be safely modified

  • proclibview_nipype_state: give the state of nipype in the process

  • proclibview_nipype_reset_state: reset nipype to its initial state (before the start of the current test) in the process library view

  • restart_MIA: restarts MIA within a unit test

  • setUp: called automatically before each test method

  • setUpClass: called before tests in the individual class

  • suppress_all_output: Context manager to suppress all output

    during tests

  • tearDown: cleans up after each test method

  • tearDownClass: called after tests in the individual class

add_visualized_tag(widget, tag, timeout=5000)[source]

Selects a tag to display from the “Visualized tags” pop-up.

This method waits for the tag selection dialog to become available within the given timeout period, locates the specified tag in the tag list, selects it, and confirms the dialog.

Parameters:
  • widget – The input filter containing the dialog with visualized tags.

  • (str) (tag) – The tag name to select and visualize.

  • (int) (timeout) – Maximum time to wait for the dialog to appear, in milliseconds. Defaults to 5000 ms.

Raises:
  • RuntimeError – If the dialog or visualized tags widget is not found.

  • ValueError – If the specified tag is not found in the list.

capture_logs(logger_name, level=20)[source]

Context manager to temporarily capture log records from a specific logger.

Attaches a LogCapture handler to the specified logger and yields it, allowing inspection of emitted log records during the context block. Restores the logger’s original state after the block is executed.

Note: Capture a priority levels and all higher priority levels

(WARNING, ERROR, CRITICAL), but not lower priority levels. The logging levels have this hierarchy (from lowest to highest priority):

  • NOTSET (level 0) - Captures everything

  • DEBUG (10) - Lowest priority

  • INFO (20)

  • WARNING (30)

  • ERROR (40)

  • CRITICAL (50) - Highest priority

Parameters:
  • (str) (logger_name) – The name of the logger to capture logs from.

  • (int) (level) – The logging level to use during capture (default: logging.INFO).

Yields (LogCapture):

A custom log handler with a records attribute containing captured LogRecord entries.

clean_uts_packages(proc_lib_view)[source]

Remove all packages added specifically for unit tests from the given process library view.

This includes:
  • Any package whose name contains ‘UTs_processes’

  • The ‘Unit_test_pipeline’ entry within ‘User_processes’, if present

The method simulates user confirmation for deletion and triggers a Delete key press event to invoke the removal mechanism.

Parameters:

proc_lib_view – The process library view containing the package items. Expected to implement to_dict(), selectionModel(), and keyPressEvent().

create_mock_jar(path)[source]

Create a mock Java executable (.jar) for testing.

Parameters:

(str) (path) – Full path to the output .jar file.

Returns (int):

0 if creation succeeded, 1 otherwise.

execute_QDialogAccept()[source]

Accept (close) a QDialog window.

find_item_by_data(q_tree_view: QTreeView, data: str) QModelIndex | None[source]

Search for the first QModelIndex in the given QTreeView whose data matches the specified value.

Parameters:
  • (QTreeView) (q_tree_view) – The tree view to search within.

  • (str) (data) – The target data to match.

Returns (QModelIndex | None):

The matching index if found; otherwise, None.

get_new_test_project(name='test_project', light=False)[source]

Copies a test project where it can be safely modified.

  • The new project is created in the /tmp (/Temp) folder.

Parameters:
  • name – name of the directory containing the project (str)

  • light – True to copy a project with few documents (bool)

proclibview_nipype_state(proc_lib_view)[source]

Determine the state of the Nipype process library view.

This method inspects the provided process library view and returns a string describing the loading state of the Nipype modules.

Parameters:

proc_lib_view – The process library view object.

Returns (str or None):

A string representing the current state: - None: No processes loaded, or Nipype is not present. - ‘nipype’: Nipype is present, but ‘interfaces’ is not. - ‘nipype.interfaces’: ‘interfaces’ is present, but ‘DataGrabber’

is not.

  • ‘process_enabled’: ‘nipype.interfaces.DataGrabber’ is present.

proclibview_nipype_reset_state(main_window, ppl_manager, init_state)[source]

Resets the Nipype process library view in the package library popup to a specified initial state.

Parameters:
  • (QMainWindow) (main_window) – The main window containing the package library popup.

  • (PipelineManager) (ppl_manager) – The pipeline manager handling the process library.

  • None) (init_state (str or) –

    The desired reset state of the Nipype

    process view.

    • None: The library is either empty or ‘nipype’ is not loaded.

    • ’nipype’: Only ‘nipype’ is loaded.

    • ’nipype.interfaces’: ‘nipype.interfaces’ is loaded but

      not ‘DataGrabber’.

    • ’process_enabled’: ‘nipype.interfaces.DataGrabber’ is

      already loaded.

restart_MIA()[source]

Restarts MIA within a unit test.

  • Can be used to restart MIA after changing the controller version in Mia preferences.

setUp()[source]

Called before each test

classmethod setUpClass()[source]

Called once at the beginning of the class

suppress_all_output()[source]

Cross-platform suppression of all standard output and error, including C-level and OS-level messages.

tearDown()[source]

Cleans up after each test to ensure test isolation and prevent state leakage.

This method performs the following actions:
  • Closes and deletes the main window if it exists.

  • Clears the list of opened projects in the application config.

  • Closes and deletes all top-level Qt widgets.

  • Uses a safer event loop approach with exception handling.

  • Resets internal references to ensure proper garbage collection.

classmethod tearDownClass()[source]

Called once at the end of the class

_classSetupFailed = False
_class_cleanups = []
class populse_mia.tests.run_mia_test.TestMIADataBrowser(methodName='runTest')[source]

Bases: TestMIACase

Tests for the data browser tab (DataBrowser).

Contains:
Method:
  • assert_scans_present: Asserts that all expected scan names are

    present in the given list.

  • get_cell_text: Returns the text of the QLabel inside a cell

    widget.

  • get_db_and_databrowser_value: Returns current, initial DB values

    and UI value for a given tag.

  • get_visible_scans: Returns the list of scan names currently

    visible in the table.

  • suppress_item_changed_signal: Temporarily disconnects and

    reconnects the itemChanged signal.

  • test_add_path: Tests the popup to add a path.

  • test_add_tag: Tests the pop up adding a tag.

  • test_advanced_search: Tests the advanced search widget.

  • test_brick_history: Tests the brick history popup.

  • test_clear_cell: tests the method clearing cells

  • test_clone_tag: tests the pop up cloning a tag

  • test_count_table: tests the count table popup

  • test_mia_preferences: tests the Mia preferences popup

  • test_mini_viewer: selects scans and display them in the mini viewer

  • test_modify_table: tests the modify table module

  • test_multiple_sort: tests the multiple sort popup

  • test_multiple_sort_appendix: adds and removes tags in the data browser

  • test_openTagsPopUp: opens a pop-up to select the legend of the thumbnails

  • test_open_project: tests project opening

  • test_project_filter: tests project filter opening

  • test_project_properties: tests saved projects addition and removal

  • test_proj_remov_from_cur_proj: tests that the projects are removed from the list of current projects

  • test_rapid_search: tests the rapid search bar

  • test_remove_scan: tests scans removal in the DataBrowser

  • test_remove_tag: tests the popup removing user tags

  • test_reset_cell: tests the method resetting the selected cells

  • test_reset_column: tests the method resetting the columns selected

  • test_reset_row: test row reset

  • test_save_project: test opening & saving of a project

  • test_send_doc_to_pipeline_manager: tests the popup sending documents to the pipeline manager

  • test_set_value: tests the values modifications

  • test_show_brick_history: opens the history pop-up for scans with history related to a brick

  • test_sort: tests the sorting in the DataBrowser

  • test_table_data_add_columns: adds tag columns to the table data window

  • test_table_data_appendix: opens a project and tests miscellaneous methods of the table data view, in the data browser

  • test_table_data_context_menu: right clicks a scan to show the context menu table, and choses one option

  • test_undo_redo_databrowser: tests data browser undo/redo

  • test_unnamed_proj_soft_open: tests unnamed project creation at software opening

  • test_update_default_value: updates the values when a list of default values is created

  • test_utils: test the utils functions

  • test_visualized_tags: tests the popup modifying the visualized tags

assert_scans_present(scans, expected_subset)[source]

Asserts that all expected scan names are present in the given list.

get_cell_text(table, row, column, label_index=0)[source]

Utility method to retrieve the text of the QLabel inside a cell widget.

Parameters:
  • (QTableWidget) (table) – The table containing the cell.

  • (int) (label_index) – The row index.

  • (int) – The column index.

  • (int) – If multiple labels are present, which one to return. Default is 0 (first QLabel found).

Returns (str):

The text of the QLabel, or fails the test if not found.

get_db_and_databrowser_value(main_window, row_nb, tag)[source]

Fetches the current and initial values of a given tag from the database, along with the corresponding value and item from the data browser UI.

Parameters:
  • (QMainWindow) (main_window) – The main application window containing the project and data browser.

  • (int) (row_nb) – The row index in the data browser table.

  • (str) (tag) – The name of the tag (column) to retrieve.

Returns (tuple):

A 4-tuple containing: - value (Any): The current value from the database

(COLLECTION_CURRENT).

  • value_initial (Any): The initial value from the database

    (COLLECTION_INITIAL).

  • value_ui (str | None): The value displayed in the data browser

    UI, or None if not available.

  • item (QTableWidgetItem | None): The table item corresponding to

    the tag, or None if not found.

get_visible_scans()[source]

Returns the list of scan names currently visible in the table.

suppress_item_changed_signal(table_data)[source]

Temporarily disables the itemChanged signal to prevent unwanted slot execution during programmatic updates to the table data.

Parameters:

(QTableWidget) (table_data) – The data browser’s table widget whose itemChanged signal is to be suppressed.

Yields:

None. The context block is executed with the signal disconnected, and it is reconnected automatically afterward.

test_add_path()[source]

Tests importing a document into the project via the DataBrowser UI.

  • Verifies behavior of DataBrowser.add_path() and PopUpAddPath.

  • Mocks QFileDialog.getOpenFileNames and QMessageBox.show.

  • Checks:
    • Handling of empty or invalid fields.

    • Successful addition of a valid document.

    • Duplicate document addition behavior.

test_add_tag()[source]

Test the add tag functionality in the data browser.

This test verifies that: - Empty tag names are properly rejected - Duplicate tag names are properly rejected - Invalid default values for the selected type are rejected - Valid string tags are successfully added to the database and UI - List-type tags (Integer List) are properly created and displayed

Tests the advanced search widget.

test_brick_history()[source]

Tests the brick history popup.

test_clear_cell()[source]

Tests clearing a cell and ensuring value is removed from database.

test_clone_tag()[source]

Tests the pop-up for cloning a tag.

test_count_table()[source]

Tests the count table popup.

test_mia_preferences(mock_qmsgbox)[source]

Tests the MIA preferences popup with QMessageBox mocked.

test_mini_viewer()[source]

Tests MiniViewer functionality.

  • Displays scan information in the mini viewer box.

  • Verifies slider behavior and checkbox states.

test_modify_table()[source]

Test ModifyTable behavior with valid and invalid field types.

test_multiple_sort()[source]

Test the multiple sort popup functionality and resulting order.

test_multiple_sort_appendix()[source]

Test adding and removing tags in the multiple sort popup.

test_openTagsPopUp()[source]

Tests opening the tags selection popup in the MiniViewer.

  • Verifies integration between MiniViewer.openTagsPopUp and PopUpSelectTag.

  • Confirms filtering behavior in the tag selection list.

  • Ensures correct handling of tag selection and dialog interaction.

  • Tests: MiniViewer.openTagsPopUp

  • Indirectly tests: PopUpSelectTag

  • Mocks: PopUpSelectTag.exec_ using unittest.mock.patch

test_open_project()[source]

Tests that the project opens correctly, including expected UI title and document presence in the current and initial collections.

test_project_filter()[source]

Tests saving and applying a project filter.

  • Verifies:
    • DataBrowser.open_popup behavior

    • Project.save_current_filter functionality

  • Uses scoped mocks:
    • QMessageBox.exec (to bypass dialogs)

    • QInputDialog.getText (to simulate user input)

test_project_properties()[source]

Tests saved projects addition and removal.

  • Ensures that saved project paths are tracked properly.

  • Mocks SavedProjects.loadSavedProjects only within scope.

test_proj_remov_from_cur_proj()[source]

Tests that the current project is correctly removed from the list of opened projects after closing or switching.

  • Verifies that the current project path is listed in the opened projects.

Tests the rapid search bar behavior in the DataBrowser.

Steps: - Load a project with 9 scans. - Verify all scans are initially visible. - Filter scans using the search bar (e.g., “G1”). - Verify the filtered results. - Clear the filter using the cross button. - Verify all scans are shown again. - Test filtering using NOT_DEFINED_VALUE.

test_remove_scan()[source]

Tests the removal of scans from the database via the PipelineManagerTab.

  • Covered:
    • PipelineManagerTab.remove_scan

    • PopUpRemoveScan

  • Mocks:
    • PopUpRemoveScan.exec

test_remove_tag()[source]

Tests the tag removal popup in the data browser.

  • Verifies:
    • Tag is added correctly.

    • Tag list remains unchanged when removal popup is confirmed without selection.

    • Tag is removed when explicitly selected and confirmed.

test_reset_cell()[source]

Tests the method resetting the selected cells.

test_reset_column()[source]

Test that edit_table_data_values() properly updates column values, and reset_column() reverts them to their initial state.

test_reset_row()[source]

Tests row reset.

test_save_project()[source]

Test creating, saving, switching, and reopening a project, while mocking dialogs and preventing UI blocking.

test_send_doc_to_pipeline_manager()[source]

Test that documents (scans) can be sent from the data browser to the pipeline manager.

This includes:
  • Sending all scans (cancel and confirm cases)

  • Sending a manual selection of scans

  • Sending filtered scans using the search bar

All popup interactions are mocked to avoid GUI side effects.

test_set_value()[source]

Test modification of cell values in the data browser table.

This test verifies that both list values (BandWidth) and string values (Type) can be properly modified through the UI and that changes persist correctly in both the database and table display.

This test is redundant with the first part of test_reset_cell.

test_show_brick_history()[source]

Tests that the brick history pop-up opens correctly and allows navigation between scans through its interface.

Covers:
  • TableDataBrowser.show_brick_history()

  • PopUpShowHistory

Verifies:
  • Brick history pop-up is created on click.

  • Input scan button in the pop-up correctly selects the scan.

test_sort()[source]

Test sorting functionality in the DataBrowser table.

This test verifies that the DataBrowser table can be properly sorted by the BandWidth column in both ascending and descending order.

test_table_data_add_columns()[source]

Adds tag columns to the table data window.

  • Tests TableDataBrowser.add_columns.

test_table_data_appendix()[source]

Test various behaviors of the table data view in the data browser.

This includes verifying correct interaction with:
  • TableDataBrowser.on_cell_changed

  • TableDataBrowser.section_moved

  • TableDataBrowser.selectColumn

The test:
  • Opens a test project

  • Adds a scan via the add_path dialog

  • Mocks user interactions (dialogs)

  • Checks that editing cells updates or preserves values correctly

  • Tests column selection and header section movement

test_table_data_context_menu()[source]

Test that context menu actions correctly call their respective methods on the data table.

This covers both: - Confirm actions (that trigger a QMessageBox before executing) - Direct actions (executed immediately)

QMessageBox is auto-accepted by simulating a click on the OK button.

test_undo_redo_databrowser()[source]

Test undo and redo functionality in the DataBrowser across several operations.

This test verifies that user actions such as modifying a tag value, removing scans, adding/removing/cloning tags are correctly recorded in the project’s undo/redo stacks, and that the database and GUI reflect the expected changes after each undo/redo operation.

Tested operations include:
  1. Modifying a tag value (“BandWidth”) of a scan and undoing/redoing the change.

  2. Attempting to undo the deletion of a scan (should have no effect).

  3. Adding a new tag (“Test”) and verifying undo/redo toggles it properly.

  4. Removing an existing tag and checking undo/redo consistency.

5. Cloning an existing tag (“FOV”) to create a new one (“Test”), verifying values in both the database and DataBrowser.

Ensures:
  • Undo/redo stacks (project.undos and project.redos) are updated appropriately.

  • DataBrowser UI and internal database states remain synchronized.

  • Non-reversible operations (e.g., scan deletion) behave as expected.

test_unnamed_proj_soft_open()[source]

Test that an unnamed project is correctly initialized at software startup.

Verifies that:
  • The project instance is created and named “Unnamed project”.

  • The default tags in the ‘current’ collection are correctly set.

  • No documents exist in ‘current’ and ‘initial’ collections.

  • All expected collections are present.

  • The main window title reflects the unnamed project.

test_update_default_value()[source]

Test the update of default tag values for various input types via the DefaultValueListCreation mechanism.

This test verifies:
  • Table behavior for different input formats (empty string, non-empty string, valid list).

  • Addition, removal, and resizing of list elements.

  • Update behavior across multiple field types.

  • Error handling for invalid input types.

test_utils()[source]

Test utility functions for type checking and conversion from UI table strings to correctly typed Python values for various field types.

Functions tested:
  • check_value_type: validates if a string value matches a given

    field type.

  • table_to_database: converts a string value from the UI into a

    typed value suitable for storage in the database.

test_visualized_tags()[source]

Validate the tag visibility management system and its impact on the DataBrowser UI.

This test simulates user interaction with the tag visibility popup and verifies:

  • Default visible tags are correctly initialized.

  • UI column headers match backend tag visibility.

  • System tags (e.g., checksum, history) remain hidden.

  • Filename tag is always visible and in the first column.

  • Tags can be hidden and re-shown via the interface.

_classSetupFailed = False
_class_cleanups = []
class populse_mia.tests.run_mia_test.TestMIAMainWindow(methodName='runTest')[source]

Bases: TestMIACase

Tests for the main window class (MainWindow).

Contains:
Method:
  • test_check_database: checks if the database has changed since the scans were first imported

  • test_create_project_pop_up: tries to create a new project with a project already open.

  • test_files_in_project: tests whether or not a given file is part of the project.

  • test_import_data: opens a project and simulates importing a file from the MriConv java executable

  • test_open_project_pop_up: creates a test project and opens a project, including unsaved modifications.

  • test_open_recent_project: creates 2 test projects and opens one by the recent projects action.

  • test_package_library_dialog_add_pkg: creates a new project folder, opens the processes library and adds a package.

  • test_package_library_dialog_del_pkg: creates a new project folder, opens the processes library and deletes a package.

  • test_package_library_dialog_rmv_pkg: creates a new project folder, opens the processes library and removes a package.

  • test_package_library_others: Creates a new project folder, opens the processes library and adds a package.

  • test_popUpDeletedProject: adds a deleted projects to the projects list and launches mia.

  • test_popUpDeleteProject: creates a new project and deletes it.

  • test_see_all_projects: creates 2 projects and tries to open them through the all projects pop-up.

  • test_software_preferences_pop_up: opens the preferences pop up and changes parameters.

  • test_software_preferences_pop_up_config_file: opens the preferences pop up and changes parameters.

  • test_software_preferences_pop_up_modules_config: changes the configuration of AFNI, ANTS, FSL, SPM, mrtrix and MATLAB.

  • test_software_preferences_pop_up_validate: opens the preferences pop up for AFNI, ANTS, FSL, SPM, mrtrix and MATLAB.

  • test_switch_project: create project and switches to it.

  • test_tab_changed: switches between data browser, data viewer and pipeline manager.

test_check_database()[source]

Test detection of changes in the project’s database after file removal.

This test verifies that the application correctly identifies changes to the database, such as a missing file after import.

test_create_project_pop_up()[source]

Test project creation popup behavior under various conditions.

Verifies the MainWindow.create_project_pop_up method handles:
  • Project creation with unsaved modifications (triggers quit popup)

  • Project creation without configured projects folder (shows error)

  • Normal project creation flow with proper configuration

Components tested:

MainWindow.create_project_pop_up, PopUpNewProject

Mocked components:

PopUpQuit.exec, QMessageBox.exec, PopUpNewProject.exec

test_files_in_project()[source]

Test MainWindow.project.files_in_project method.

Verifies that the method correctly identifies which files belong to the project, handling invalid inputs and files both inside and outside the project directory.

test_import_data()[source]

Test importing data via the mocked MRI conversion process.

This test simulates opening a project, setting up a mock Java executable for MRI conversion, and importing a scan file into the project.

It verifies:
  • The integration with read_log (from data_loader.py)

  • Proper behavior of ImportProgress

Mocks within this test:
  • ImportWorker.start to prevent actual threading

  • ImportProgress.exec to run the worker directly

test_open_project_pop_up()[source]

Test the behavior of MainWindow.open_project_pop_up under different project state conditions, including:

  • No project save directory set

  • Project opened successfully

  • Project with unsaved modifications

Mocks the following components:
  • QMessageBox.exec

  • PopUpOpenProject.exec

  • PopUpQuit.exec

test_open_recent_project()[source]

Test opening a recent project via the ‘recent projects’ action.

This includes switching between two projects, saving one, verifying its presence in the recent projects list, and reopening it.

  • Tests: MainWindow.open_recent_project

test_package_library_dialog_add_pkg()[source]

Test adding and installing packages through the PackageLibraryDialog.

This test verifies the following: - Opening the package library dialog and adding a standard package. - Handling invalid or non-existent packages. - Installing a process package from a directory. - Validating error handling for invalid directories and import errors. - Saving and reloading a new pipeline using the installed process.

Mocks:
test_package_library_dialog_del_pkg()[source]

Test the behavior of the PackageLibraryDialog when deleting packages.

This test covers: - Adding and removing a known package

(nipype.interfaces.DataGrabber)

  • Ensuring deletion confirmations are handled correctly

  • Ensuring packages that can’t be deleted show proper warnings

  • Adding and deleting a user-defined process package (Unit_test_2)

Mocks: - QMessageBox.exec - QMessageBox.question

test_package_library_dialog_rmv_pkg()[source]

Test removing a package from the package library dialog.

This test:
  • Creates a new project.

  • Opens the process library and ensures a test package is installed.

  • Attempts to remove nonexistent and unspecified packages.

  • Removes a real package through the UI simulation.

  • Resets the library state and saves the configuration.

Mocks:
test_package_library_others()[source]

Test the behavior of the Package Library Manager dialog.

This test:
  • Creates a new light project.

  • Opens the Package Library Manager dialog via the main window.

  • Mocks a package tree structure and populates it into the library.

  • Closes the dialog after setup.

Targets:
  • PackageLibraryDialog behavior

test_popUpDeleteProject()[source]

Test the project deletion flow, including dialog behavior and config updates.

This test:
  • Creates a new test project and switches to it.

  • Attempts to delete the project without a configured save path (to test error handling).

  • Sets a valid save path and ensures the project is properly deleted.

  • Simulates user interaction with confirmation dialogs (e.g., “Yes to All”).

Notes

  • Not to be confused with test_popUpDeletedProject.

Targets:
  • MainWindow.delete_project

  • PopUpDeleteProject

test_popUpDeletedProject()[source]

Test that the application handles deleted projects properly.

This test:
  • Configures a custom project save directory.

  • Adds a non-existent (deleted) project path to saved_projects.yml.

  • Verifies the path is handled correctly by PopUpDeletedProject.

  • Ensures the project is removed from the saved projects list.

Target:
  • PopUpDeletedProject behavior

test_see_all_projects()[source]

Test the ‘See All Projects’ feature with two saved projects.

Validates:
  • Displaying projects in PopUpSeeAllProjects

  • Proper handling of missing project folders

  • Opening a selected existing project

Mocks:
  • PopUpSeeAllProjects.exec

  • QMessageBox.exec

test_software_preferences_pop_up()[source]

Test the software preferences pop-up window behavior.

This test covers:
  • The opening and interaction with the preferences dialog.

  • The reflection of config changes (e.g., enabling tools, setting paths).

  • Admin mode switching and password validation.

  • UI updates based on configuration flags.

Mocked methods:
  • QFileDialog.getOpenFileName

  • QFileDialog.getExistingDirectory

  • QInputDialog.getText

  • QDialog.exec

  • QMessageBox.exec

  • SettingsEditor.update_gui

  • capsul.api.capsul_engine

  • Config.set_capsul_config

test_software_preferences_pop_up_config_file()[source]

Test the behavior of the software preferences pop-up when modifying the config file and Capsul configuration.

This test verifies:
  • PopUpPreferences.edit_config_file

  • PopUpPreferences.findChar

  • PopUpPreferences.edit_capsul_config

Mocks:
  • QDialog.exec to simulate user interaction

  • SettingsEditor.update_gui to bypass GUI refresh

  • Config.set_capsul_config to simulate failure during config update

test_software_preferences_pop_up_modules_config()[source]

Tests the software module configuration via the Preferences pop-up.

This test verifies the proper behavior of the preferences configuration dialog for AFNI, ANTS, FSL, mrtrix, SPM, and MATLAB modules, including handling of valid and invalid executable paths.

Tests:
  • PopUpPreferences.validate_and_save

Mocks:
  • QMessageBox.show

test_software_preferences_pop_up_validate()[source]

Validates configuration changes via the software preferences pop-up.

This test simulates user interactions in the software preferences window without and with confirming via the ‘OK’ button. It verifies correct saving of settings related to:

  • Standalone modules (AFNI, ANTS, FSL, SPM, MRtrix, MATLAB, freesurfer)

  • UI and behavioral options (auto-save, radio view, admin/clinical mode)

  • Tests:
    • PopUpPreferences.validate_and_save

    • PopUpPreferences.ok_clicked

  • Mocks:
    • PopUpPreferences.show

    • PopUpPreferences.wrong_path

    • QMessageBox.show

test_switch_project()[source]

Tests switching to various project states using MainWindow.switch_project.

This test covers:
  • Switching to a valid Mia project

  • Handling non-existent project paths

  • Preventing switching to already-open projects

  • Ignoring invalid or malformed Mia projects

  • Tests: MainWindow.switch_project

  • Mocks: QMessageBox.exec (to bypass dialog confirmations)

test_tab_changed()[source]

Tests tab switching behavior in the main window.

Verifies that switching between:
  • Data browser

  • Data viewer

  • Pipeline manager

behaves as expected, including handling unsaved changes via a confirmation dialog.

  • Tests: MainWindow.tab_changed

  • Mocks: QMessageBox.exec

_classSetupFailed = False
_class_cleanups = []
class populse_mia.tests.run_mia_test.TestMIANodeController(methodName='runTest')[source]

Bases: TestMIACase

Tests for the node controller, part of the pipeline manager tab.

  • Tests: NodeController.

Contains:
Method:
  • create_mock_exec: create a mock function for PopUpSelectTagCountTable.exec_() that simulates user tag selection behavior.

  • test_attributes_filter: displays an attributes filter and modifies it.

  • test_capsul_node_controller: adds, changes and deletes processes using the capsul node controller.

  • test_display_filter: displays node parameters and a plug filter.

  • test_filter_widget: opens up the “FilterWidget()” to modify its parameters.

  • test_node_controller: adds, changes and deletes processes to the node controller.

  • test_plug_filter: displays a plug filter and modifies it

  • test_update_node_name: displays node parameters and updates its name.

create_mock_exec(tag_name)[source]

Create a mock function for PopUpSelectTagCountTable.exec_() that simulates user tag selection behavior.

This function returns a mock implementation that programmatically selects a specific tag from the popup’s list widget and triggers the OK action, simulating the user workflow without requiring actual UI interaction.

Parameters:

(str) (tag_name) – The name of the tag to select from the list. This should match the text of one of the items in the popup’s list widget.

Returns:

A mock function that can be used to replace exec_() method.

test_attributes_filter()[source]

Tests the display and modification of the attributes filter in the CapsulNodeController GUI.

This test performs the following:
  • Opens a test project and switches to it.

  • Adds a ‘Smooth’ process node to the pipeline editor.

  • Exports unconnected mandatory plugs for the new node.

  • Displays parameters of the ‘inputs’ node.

  • Opens the attributes filter dialog, selects a row, and confirms.

  • Reopens the dialog, performs a failed search, and confirms without selection.

Target:
  • CapsulNodeController.filter_attributes

  • AttributesFilter dialog interactions

test_capsul_node_controller()[source]

Validates the behavior of the CapsulNodeController for process management within a pipeline editor GUI.

This test simulates a realistic sequence of user interactions and verifies the following capabilities:

  • Adding two ‘Rename’ nodes to the pipeline (‘rename_1’ and ‘rename_2’)

  • Displaying and interacting with node parameters

  • Attempting to rename ‘rename_2’ to an existing name (should fail)

  • Renaming ‘rename_2’ to a new unique name (‘rename_3’) successfully

  • Deleting an existing node (‘rename_3’)

  • Exporting unconnected mandatory input plugs for a node

  • Setting input plug values using a test document

  • Executing the pipeline and expecting an error due to unexported output

  • Opening the attributes filter dialog, selecting a row, and confirming

  • Releasing and updating the process associated with the controller

Methods tested:
  • CapsulNodeController.update_node_name

  • CapsulNodeController.display_parameters

  • CapsulNodeController.filter_attributes

  • CapsulNodeController.release_process

  • CapsulNodeController.update_parameters

  • PipelineEditor.export_unconnected_mandatory_inputs

  • PipelineManager.runPipeline

Notes

  • The test assumes that running the pipeline raises an error because the output plug is not exported, which is intentional.

  • A QDialog.exec() mock is used to simulate dialog confirmation during pipeline execution.

test_display_filter()[source]

Tests the display and modification of node parameters and plug filters in the CapsulNodeController V1 interface.

Steps:
  • Ensures the GUI uses the V1 node controller.

  • Adds a ‘Threshold’ process to the pipeline.

  • Exports input plugs and sets the ‘synchronize’ input to 2.

  • Displays and validates the plug filter editor for ‘synchronize’.

  • Restores original GUI controller version after the test.

test_filter_widget()[source]

Tests the FilterWidget class used for filtering input data within a Capsul pipeline node.

This test:
  • Switches to the V1 node controller (if not already active)

  • Adds an Input_Filter process to the pipeline

  • Feeds in documents from a test project

  • Opens the filter widget for the added node

  • Performs various filtering actions:
    • Searching for documents by name

    • Toggling tag visibility

    • Filtering by a specific tag (mocking user interaction)

The FilterWidget is GUI-independent and works in both V1 and V2 node controller UIs. Only the V1 GUI is exercised here.

Mocks:
  • PopUpSelectTagCountTable.exec_()

test_node_controller()[source]
Tests the behavior of the V1 NodeController interface for:
  • Adding, renaming, and deleting nodes

  • Displaying and updating process parameters

  • Interacting with plug filters and values

Workflow:
  • Switches to V1 node controller mode if not already enabled

  • Opens a test project and adds two Rename processes as “rename_1” and “rename_2”

  • Attempts renaming “rename_2” to an existing name (fails) then to a unique one

  • Deletes the renamed node

  • Exports input/output plugs and tests plug interaction

  • Displays parameters and plug filters

  • Updates plug values with and without providing new values

  • Releases and refreshes the process

  • Restores the original node controller mode after testing

test_plug_filter()[source]

Tests plug filtering in the Node Controller V1 interface.

This test covers:
  • Switching to Node Controller V1 if not already enabled

  • Opening a test project and retrieving documents

  • Adding and configuring a ‘Smooth’ node in the pipeline

  • Displaying and modifying a plug filter

  • Searching and filtering table rows

  • Modifying visible tag columns

  • Verifying plug value assignment from filtered selections

test_update_node_name()[source]

Tests renaming of nodes in the pipeline and verifies the correct update or rejection of name changes based on naming conflicts.

This test ensures: - A node name can be changed via the NodeController interface. - Duplicate names are not accepted. - Node renaming preserves the connections (links) between nodes.

_classSetupFailed = False
_class_cleanups = []
class populse_mia.tests.run_mia_test.TestMIAPipelineEditor(methodName='runTest')[source]

Bases: TestMIACase

Tests for the pipeline editor, part of the pipeline manager tab.

Tests PipelineEditor.

Contains:
Method:
  • test_add_tab: adds tabs to the PipelineEditorTabs

  • test_close_tab: closes a tab in the PipelineEditorTabs

  • test_drop_process: adds a Nipype SPM Smooth process to the pipeline editor

  • test_export_plug: exports plugs and mocks dialog boxes

  • test_save_pipeline: creates a pipeline and tries to save it

  • test_update_plug_value: displays node parameters and updates a plug value

  • test_z_check_modif: opens a pipeline, modifies it and check the modifications

  • test_z_get_editor: gets the instance of an editor

  • test_z_get_filename: gets the relative path to a previously saved pipeline file

  • test_z_get_index: gets the index of an editor

  • test_z_get_tab_name: gets the tab name of the editor

  • test_z_load_pipeline: loads a pipeline

  • test_z_open_sub_pipeline: opens a sub_pipeline

  • test_z_set_current_editor: sets the current editor

  • test_zz_del_pack: deletes a brick created during UTs

test_add_tab()[source]

Test the addition of new tabs in the PipelineEditorTabs.

Ensures that:
  • A new tab increases the tab count.

  • Tabs are named incrementally as ‘New Pipeline’, ‘New Pipeline 1’, etc.

test_close_tab()[source]

Tests the PipelineEditor.close_tab() method under various conditions.

This method indirectly tests the behavior of the PopUpClosePipeline dialog when attempting to close tabs that are either unmodified or modified.

Scenarios covered:
  • Closing an unmodified tab (no dialog shown)

  • Closing a modified tab and choosing:
    • “Save As”

    • “Do Not Save”

    • “Cancel”

test_drop_process()[source]

Tests the addition of a Nipype SPM ‘Smooth’ process to the pipeline editor.

Verifies that dropping the ‘nipype.interfaces.spm.Smooth’ process at a specific position in the pipeline editor results in the creation of a node named ‘smooth_1’.

test_export_plug()[source]

Tests the export of plugs in the pipeline editor.

This test verifies:
  • Exporting a plug with no parameters.

  • Exporting a plug when a node is added.

  • Behavior when a plug is exported multiple times with overwrite confirmation.

  • Behavior when overwriting is denied and a new name is entered.

test_save_pipeline()[source]

Creates a pipeline and verifies various scenarios when saving it.

This test covers:
  • Saving an empty pipeline (should return None).

  • Saving with user cancellation (should return None).

  • Saving with filenames starting with a digit (should return None).

  • Saving without an extension (‘.py’ should be added automatically).

  • Saving with an incorrect extension (should be corrected to ‘.py’).

  • Handling restricted user mode where saving is not allowed.

  • Saving using an explicitly provided filename.

Targeted methods:
  • PipelineEditor.save_pipeline

  • PipelineEditorTabs.save_pipeline

  • save_pipeline function in pipeline_editor.py

Mocked:
  • QMessageBox.exec

  • QFileDialog.getSaveFileName

test_update_plug_value()[source]

Tests updating plug values through the node controller UI.

This test verifies that:
  • A process node (“threshold_1”) can be added and its parameters displayed.

  • Input and output plugs (“synchronize” and “_activation_forced”) can be updated through the GUI.

  • The internal pipeline state reflects these updated plug values.

  • Exported input plugs can also be modified and reflected correctly.

  • The test maintains the original node controller configuration (V1/V2).

Tested methods:
  • NodeController.get_index_from_plug_name

  • NodeController.update_plug_value

  • PipelineEditor.export_node_all_unconnected_inputs

  • ProcessNode.get_plug_value

Notes

  • This test specifically targets NodeController V1 behavior.

test_z_check_modif()[source]

Tests plug modification propagation when a pipeline is opened as a sub-process.

This test performs the following steps:
  • Loads a user-defined pipeline from a .py file, ensuring it contains a “smooth_1” node.

  • Opens a new tab and adds the above pipeline as a process (“test_pipeline_1_1”).

  • Adds two “Smooth” nodes and links them to form a processing chain.

  • Verifies correct connections between nodes.

  • Exports plugs from the original pipeline in the first tab and saves it.

  • Re-checks the second tab for updated plugs via check_modifications().

  • Asserts that the new plug (“fwhm”) is now present in “test_pipeline_1_1”.

Tested features:
  • Pipeline loading

  • Process instantiation from library

  • Node linking

  • Plug export and save

  • Detection of modifications in sub-pipeline processes

test_z_get_editor()[source]

Verify that editor instances in PipelineEditorTabs are correctly retrieved using various access methods.

Tests the following methods:
  • get_editor_by_index

  • get_current_editor

  • get_editor_by_tab_name

  • get_editor_by_file_name

test_z_get_filename()[source]

Tests retrieval of the filename associated with a pipeline editor tab.

  • Verifies:
    • PipelineEditorTabs.get_filename_by_index returns the correct

    absolute path for a loaded pipeline in a given tab index. - PipelineEditorTabs.get_filename_by_index returns None for a

    tab without a file.

    • PipelineEditorTabs.get_current_filename returns the correct absolute path of the currently selected tab’s pipeline.

  • Target methods:
    • PipelineEditorTabs.get_filename_by_index

    • PipelineEditorTabs.get_current_filename

test_z_get_index()[source]

Verifies that editor tab indices can be correctly retrieved by tab name, filename, and editor instance.

  • Tests:
    • PipelineEditorTabs.get_index_by_tab_name

    • PipelineEditorTabs.get_index_by_filename

    • PipelineEditorTabs.get_index_by_editor

The test performs the following steps:
  1. Loads a saved pipeline file into a new tab.

  2. Creates an additional empty pipeline in a second tab.

  3. Retrieves and checks tab indices using:
    • the tab name

    • the full file path

    • the editor instance

  4. Confirms that querying with an invalid name, path, or editor returns None.

test_z_get_tab_name()[source]

Verify that the tab names of pipeline editors are correctly retrieved.

This test checks both direct index-based retrieval and the currently selected tab name.

  • Tests:
    • PipelineEditorTabs.get_tab_name_by_index

    • PipelineEditorTabs.get_current_tab_name

test_z_load_pipeline()[source]

Loads a pipeline file into the editor and verifies its content.

  • Tests:
    • PipelineEditorTabs.load_pipeline

    • PipelineEditorTabs.get_current_pipeline

  • Verifies:
    • The pipeline is loaded correctly.

    • The node ‘smooth_1’ exists in the loaded pipeline.

test_z_open_sub_pipeline()[source]

Tests the ability to open a sub-pipeline in a new editor tab.

This test:
  • Adds the “Test_pipeline_1” process from the “User_processes” module.

  • Simulates a user click to insert the process into the current pipeline.

  • Opens the sub-pipeline associated with the inserted process.

  • Verifies that a new editor tab is created and named correctly.

  • Tests:
    • PipelineEditorTabs.open_sub_pipeline

    • PipelineEditorTabs.get_filename_by_index

test_z_set_current_editor()[source]

Tests setting the current editor using different criteria.

Validates that the active tab can be correctly switched using:
  • Tab name

  • Pipeline file name

  • Editor instance

Targets the following methods:
  • PipelineEditorTabs.set_current_editor_by_tab_name

  • PipelineEditorTabs.set_current_editor_by_file_name

  • PipelineEditorTabs.set_current_editor_by_editor

test_zz_del_pack()[source]

Deletes the ‘Test_pipeline_1’ brick from the package library and verifies its removal.

This test ensures that:
  • The brick ‘Test_pipeline_1’ exists before deletion.

  • The delete_package method removes it correctly.

  • The internal package tree reflects the deletion.

It also implicitly covers the functionality related to package removal.

_classSetupFailed = False
_class_cleanups = []
class populse_mia.tests.run_mia_test.TestMIAPipelineManagerTab(methodName='runTest')[source]

Bases: TestMIACase

Tests the pipeline manager tab class, part of the homonym tab.

Contains:
Method:
  • test_add_plug_value_to_database_list_type: adds a list type plug value to the database

  • test_add_plug_value_to_database_non_list_type: adds a non list type plug value to the database

  • test_add_plug_value_to_database_several_inputs: exports a non list type input plug and with several possible inputs

  • test_ask_iterated_pipeline_plugs: test the iteration dialog for each plug of a Rename process

  • test_build_iterated_pipeline: mocks methods and builds an iterated pipeline

  • test_check_requirements: checks the requirements for a given node

  • test_cleanup_older_init: tests the cleaning of old initialisations

  • test_complete_pipeline_parameters: test the pipeline parameters completion

  • test_delete_processes: deletes a process and makes the undo/redo

  • test_end_progress: creates a progress object and tries to end it

  • test_garbage_collect: collects the garbage of a pipeline

  • test_get_capsul_engine: gets the capsul engine of the pipeline

  • test_get_missing_mandatory_parameters: tries to initialize the pipeline with missing mandatory parameters

  • test_get_pipeline_or_process: gets a pipeline and a process from the pipeline_manager

  • test_initialize: mocks objects and initializes the workflow

  • test_register_completion_attributes: mocks methods of the pipeline manager and registers completion attributes

  • test_register_node_io_in_database: sets input and output parameters and registers them in database

  • test_remove_progress: removes the progress of the pipeline

  • test_run: creates a pipeline manager progress object and

    attempts to execute it in various cases

  • test_savePipeline: tries to save the pipeline over several

    conditions

  • test_save_pipeline_as: saves a pipeline under another name

  • test_set_anim_frame: runs the ‘rotatingBrainVISA.gif’ animation

  • test_show_status: shows the status of pipeline execution

  • test_stop_execution: shows the status window of the pipeline manager

  • test_undo_redo: tests the undo/redo feature

  • test_update_auto_inheritance: updates the job’s auto inheritance dict

  • test_update_inheritance: updates the job’s inheritance dict

  • test_update_node_list: initializes a workflow and adds a process to the “pipline_manager.node_list”

  • test_z_init_pipeline: initializes the pipeline

  • test_z_runPipeline: adds a processruns a pipeline

  • test_zz_del_pack: deletion of the brick created during UTs

test_add_plug_value_to_database_list_type()[source]

Tests adding a list-type plug value to the database from a process node.

This test:
  • Opens a test project.

  • Adds a ‘CAT12Segment’ process to the pipeline.

  • Exports its input/output plugs.

  • Assigns a list of files as input to the ‘in_files’ plug.

  • Simulates metadata attributes.

  • Calls add_plug_value_to_database() to register the plug values.

  • Verifies that both documents and their metadata are stored in the database.

  • Tests: PipelineManagerTab(QWidget).add_plug_value_to_database()

test_add_plug_value_to_database_non_list_type()[source]

Tests the behavior of add_plug_value_to_database() when handling a non-list input plug value in different contexts.

Scenarios covered:
  • Plug value is outside the project directory (should not be indexed)

  • Plug value is inside the project directory (should be indexed)

  • Plug value is already in the database (logs an info message)

  • Plug values with different file extensions (.nii.gz, .mat, .txt)

  • Handling of parent_files via auto_inheritance_dict and inheritance_dict

  • Adding and removing tags based on the inheritance information

  • Tests: PipelineManagerTab(QWidget).add_plug_value_to_database()

test_add_plug_value_to_database_several_inputs()[source]

Test add_plug_value_to_database under various inheritance and input conditions.

This test covers:
  • Identical parent file mappings in inheritance.

  • Distinct parent file mappings triggering inheritance pop-ups.

  • Predefined inheritance key using node name.

  • Predefined inheritance key using node name + plug value.

Also validates PopUpInheritanceDict interactive behavior across all buttons.

Tested:
  • PipelineManagerTab.add_plug_value_to_database

  • PopUpInheritanceDict interaction

test_ask_iterated_pipeline_plugs()[source]

Test the iteration dialog invocation on exported plugs of a pipeline.

This test:
  • Adds a ‘Rename’ process to the current pipeline editor.

  • Exports the mandatory input and output plugs of the ‘rename_1’ node.

  • Mocks the iteration dialog to simulate user rejection (dialog closed without acceptance).

  • Verifies that ask_iterated_pipeline_plugs returns None when the dialog is rejected.

Covers:
  • PipelineManagerTab.ask_iterated_pipeline_plugs

test_build_iterated_pipeline()[source]

Test ‘PipelineManagerTab.build_iterated_pipeline’.

Simulates building an iterated pipeline from a ‘Select’ process:
  • Adds a ‘Select’ process in the current pipeline editor.

  • Exports mandatory inputs and outputs for the node.

  • Mocks methods to simulate pipeline retrieval, user iteration choices, and process activation updates.

  • Verifies that the resulting pipeline is correctly built and mocks are invoked as expected.

Note

‘update_nodes_and_plugs_activation’ may not exist on the process, hence ‘create=True’ is used to safely mock it.

The test allows an expected exception message to be printed during execution.

test_check_requirements()[source]

Test the ‘PipelineManagerTab.check_requirements’ method.

This test simulates adding a ‘Select’ process to the current pipeline, appending the corresponding node’s process to the node list, and verifying that the requirements check returns the expected configuration.

Steps:
  • Add a ‘Select’ process as a node (‘select_1’) in the pipeline.

  • Append the process of ‘select_1’ to the pipeline manager’s node list.

  • Call ‘check_requirements’ to retrieve the configuration.

  • Assert the returned configuration is a dictionary containing the expected keys.

Raises:

AssertionError – If the configuration is not a dictionary or does not contain the expected keys.

test_cleanup_older_init()[source]

Test ‘PipelineManagerTab.cleanup_older_init’.

This test verifies that:
  • The brick list is properly processed for cleanup.

  • The relevant methods for deleting data and cleaning up orphan files

are called exactly once. - The ‘brick_list’ and ‘node_list’ are emptied after cleanup.

Steps:
  1. Append a mock brick ID and mock node to the pipeline manager.

  2. Mock dependent methods on the data browser and project.

  3. Call the method under test.

  4. Assert expected method calls and post-conditions.

test_complete_pipeline_parameters()[source]

Mocks a method of pipeline manager and completes the pipeline parameters.

  • Tests: PipelineManagerTab.complete_pipeline_parameters

test_delete_processes()[source]

Test deletion of a process node and verification of undo/redo functionality.

This test creates a pipeline with three connected ‘Smooth’ processes (smooth_1 -> smooth_2 -> smooth_3), deletes the middle node, and verifies:

  • The node is properly removed from the pipeline

  • Connected links are cleaned up

  • Undo operation restores the node and its connections

  • Redo operation removes the node again

test_end_progress()[source]

Tests RunProgress.end_progress under different worker execution states.

This test:
  • Initializes a RunProgress instance from the current pipeline manager.

  • Calls end_progress() when no exec_id is set on the worker.

  • Mocks exec_id and raise_for_status on the engine to validate success handling.

  • Mocks raise_for_status to raise WorkflowExecutionError to verify error handling.

test_garbage_collect()[source]

Tests ‘PipelineManagerTab.garbage_collect’ both in integrated and isolated contexts.

  • Integrated test: Verifies that invoking ‘garbage_collect’ sets the

    pipeline editor’s ‘initialized’ attribute to False.

  • Isolated test: In addition to the ‘initialized’ reset, verifies that

    dependent methods are called exactly once:

    • postprocess_pipeline_execution

    • update_user_buttons_states

test_get_capsul_engine()[source]

Tests ‘PipelineManagerTab.get_capsul_engine’ in both integrated and isolated contexts.

  • Integrated test: Ensures that calling ‘get_capsul_engine’ returns

    an instance of ‘CapsulEngine’.

  • Isolated test: Mocks ‘pipelineEditorTabs.get_capsul_engine’ to

    verify that it is called exactly once when invoked via ‘PipelineManagerTab.get_capsul_engine’.

test_get_missing_mandatory_parameters()[source]

Tests ‘PipelineManagerTab.get_missing_mandatory_parameters’.

This test simulates adding a ‘Rename’ process to the pipeline, exporting its mandatory input and output plugs, and checking for missing mandatory parameters at different stages.

Steps: 1. Add ‘Rename’ process to the pipeline. 2. Export the required input and output plugs. 3. Initialize the pipeline and check that two mandatory parameters are initially missing. 4. Set a value for one mandatory parameter (‘format_string’) and verify that only one mandatory parameter remains missing (‘in_file’).

test_get_pipeline_or_process()[source]

Test retrieving either a pipeline or a process from the pipeline manager.

  • Verifying that the pipeline is returned when no process node is selected.

  • Adding a ‘Rename’ process node and verifying that the method returns the corresponding NipypeProcess when a process is selected.

  • Tests: PipelineManagerTab.get_pipeline_or_process

test_initialize()[source]

Tests the initialize method of PipelineManagerTab.

This method:
  • Adds a Rename process to the pipeline editor.

  • Exports its mandatory input and output plugs.

  • Sets required parameters for the node.

  • Mocks the init_pipeline method to prevent segmentation faults.

  • Checks that initialization resets internal flags and dictionaries.

  • Induces an exception path by setting init_pipeline to None.

  • Tests: PipelineManagerTab.initialize

test_register_completion_attributes()[source]

Test the registration of completion attributes in the pipeline manager.

This method tests the behavior of the pipeline manager when registering completion attributes with and without provided attributes. It performs the following steps:

  1. Adds a Select process to the current pipeline.

  2. Exports mandatory input and output plugs.

  3. Sets plug values for input and output files.

  4. Mocks ‘get_capsul_engine’ to prevent errors during completion.

  5. Mocks ‘get_attribute_values().export_to_dict’ to return custom attributes.

  6. Calls ‘register_completion_attributes’ both without and with mocked attributes.

  7. Asserts the expected behavior in both scenarios.

test_register_node_io_in_database()[source]

Tests the registration of node input/output data in the project database for different types of process nodes.

Steps:
  1. Opens a new project and switches to it.

  2. Adds a Rename process node to the current pipeline.

  3. Exports mandatory inputs/outputs for the process.

  4. Sets plug values for the process and output nodes.

  5. Creates a workflow and job for the pipeline.

  6. Tests _register_node_io_in_database with:
    • NipypeProcess instance

    • ProcessNode instance

    • PipelineNode instance

    • Switch instance

    • Process with no outputs

Verifies:
  • Output file is correctly added to COLLECTION_CURRENT.

  • Output file is removed when expected.

  • Unsupported process types do not incorrectly register outputs.

Raises:

AssertionError – If any database check fails.

test_remove_progress()[source]

Verify that PipelineManagerTab.remove_progress correctly deletes the progress attribute.

This test creates a temporary RunProgress instance in the pipeline manager, invokes remove_progress, and ensures the attribute no longer exists.

Tests:

PipelineManagerTab.remove_progress

test_run()[source]

Tests the standard execution of a pipeline with mixed node types (process, sub-pipeline, switch).

This test verifies:
  • The pipeline runs correctly with valid nodes.

  • Expected INFO log messages are emitted during execution.

  • Error handling and interruption scenarios are covered.

Test Cases:
  1. Normal run: Validates INFO logs for pipeline execution.

  2. Mocked error: Simulates a post-processing error and checks warning logs.

  3. Interruption: Ensures interruption is logged correctly.

Tests:

RunWorker.run

test_savePipeline()[source]

Test the behavior of PipelineManagerTab.savePipeline under different conditions by mocking dependent methods.

This test simulates saving a pipeline in various scenarios:
  • Saving with no filename set (unchecked option).

  • Mocks ppl_edt_tabs.save_pipeline() to return a string.

  • Saving with a valid filename (unchecked option).

  • Aborting save via a QMessageBox (‘Abort’ clicked).

  • Confirming save via a QMessageBox (‘Yes’ clicked).

test_save_pipeline_as()[source]

Verify that saving a pipeline under a new name works correctly by mocking the underlying save_pipeline method.

This test ensures:
  • When no filename is provided, PipelineManagerTab.save_pipline_as completes without error and the status bar displays a warning.

  • When save_pipeline returns a non-empty filename, the method handles the renamed pipeline and the status bar confirms success.

Raises:

AssertionError – If the displayed status bar messages do not match the expected content.

test_set_anim_frame()[source]

Verify that _set_anim_frame updates the pipeline status action icon with the current frame of the animated GIF.

This test ensures that:
  1. The rotatingBrainVISA.gif file exists and can be loaded as a QMovie.

  2. The QMovie produces a valid first frame (non-null QPixmap).

  3. Calling _set_anim_frame sets the action’s icon.

  4. The resulting QAction icon matches the movie frame in size.

test_show_status()[source]

Tests the behavior of the pipeline status display in the PipelineManagerTab.

Indirectly validates:
  • StatusWidget.__init__

  • StatusWidget.toggle_soma_workflow

The test verifies that:
  • Initially, no status widget is present.

  • Calling show_status creates the widget with the checkbox unchecked and no associated swf_widget.

  • Toggling the checkbox enables/disables Soma-Workflow monitoring, creating and hiding the swf_widget accordingly.

test_stop_execution()[source]

Verify that stopping execution in the pipeline manager behaves as expected.

This test ensures that:
  • A RunProgress worker is created without an interrupt request.

  • Calling stop_execution logs both a “CANCEL” message and a “Pipeline execution interrupted” message at the INFO level.

  • The worker’s interrupt request flag is set to True after stopping.

Related test: PipelineManagerTab.test_show_status

test_undo_redo()[source]

Test the consistency and correctness of undo/redo operations in the pipeline editor.

This test verifies that the pipeline editor’s undo/redo stack correctly handles:

  • Node creation, deletion, and renaming

  • Plug export, removal, and value updates

  • Link creation, deletion, and restoration

  • Document deletion (in-memory only; disk behavior is not tested)

The test is robust and designed to prevent random crashes. It ensures that all operations are reversible and that the editor’s state remains consistent after each undo/redo cycle.

test_update_auto_inheritance()[source]

Test that PipelineManagerTab.update_auto_inheritance correctly sets the auto_inheritance_dict attribute of a job under different scenarios.

This test covers:
  • Adding a process and verifying that the job’s auto_inheritance_dict is created with the expected key/value mapping.

  • Handling multiple candidate inputs (ensuring correct key/value selection when outputs cannot be inferred automatically).

  • Behavior when the node lacks a project (the attribute should not exist).

  • Behavior when the node is not a valid Process (the attribute should not exist).

Raises:

AssertionError – If expectations about the existence, type, or contents of auto_inheritance_dict are not met.

test_update_inheritance()[source]

Verify that PipelineManagerTab.update_inheritance correctly updates a job’s inheritance dictionary based on the associated node.

Tests:

PipelineManagerTab.update_inheritance - Ensures that jobs do not initially have inheritance_dict

attribute

  • Validates update when the node name does not contain “Pipeline”.

  • Validates update when the node name contains “Pipeline”.

  • Validates update when the node’s inheritance history is recorded in the project.

test_update_node_list()[source]

Test that adding a process updates the PipelineManagerTab node list.

This test performs the following steps:
  1. Adds a Rename process to the pipeline editor.

  2. Exports the mandatory inputs and outputs for the process.

  3. Initializes the workflow from the pipeline.

  4. Verifies that the node_list is initially empty.

  5. Calls update_node_list and checks that the process is added.

Raises:

AssertionError – If the node list is not updated as expected.

test_z_init_pipeline()[source]

Verify initialization behavior of a pipeline in PipelineManagerTab.

This test covers several scenarios of pipeline initialization:
  • Creating a pipeline with a Rename process and verifying node setup.

  • Checking initialization when mandatory parameters are missing.

  • Handling initialization with mocked requirements and external package dependencies.

  • Simulating a ValueError raised by workflow_from_pipeline.

Target:

PipelineManagerTab.init_pipeline

test_z_runPipeline()[source]

Test running and interrupting a pipeline in PipelineManagerTab.

This test performs the following steps:
  1. Creates a new project folder and adds a sample document.

  2. Switches to the Pipeline Manager tab and adds a Rename process.

  3. Exports mandatory plugs and sets required plug values.

  4. Runs the pipeline while patching dialogs and worker execution.

  5. Verifies that the pipeline completes successfully and resources are released.

  6. Simulates a manual interruption before execution and verifies cleanup.

Components covered:
  • PipelineManagerTab.runPipeline

  • PipelineManagerTab.finish_execution

  • RunProgress

  • RunWorker

test_zz_del_pack()[source]

Ensure that a test package can be removed from the package library.

This test deletes the temporary brick created during previous unit tests (Test_pipeline_1 in User_processes) and verifies that the deletion logic in PackageLibraryDialog.delete_package works as expected.

_classSetupFailed = False
_class_cleanups = []
class populse_mia.tests.run_mia_test.Test_Z_MIAOthers(methodName='runTest')[source]

Bases: TestMIACase

Tests for other parts of the MIA software that do not relate much with the other classes.

Contains:
Method:
  • _mock_mouse_event: mock QMouseEvent for a right-click at

    position (0, 0)

  • test_check_setup: check that Mia’s configuration control is

    working correctly

  • test_iteration_table: plays with the iteration table

  • test_process_library: install the brick_test and then remove it

  • test_verify_processes: check that Mia’s processes control is

    working correctly (currently commented)

  • test_z_open_shell: opens Qt console and kill it afterwards.

_mock_mouse_event()[source]

Returns a mock QMouseEvent for a right-click at position (0, 0).

test_check_setup(mock_exec)[source]

Check that Mia’s configuration control is working correctly.

  • Tests: utils.verify_setup()

test_iteration_table(mock_exec, mock_pop_up)[source]

Opens a new project, initializes the pipeline iteration and changes its parameters.

  • Tests: IterationTable behavior without asynchronous dialogs.

  • Mocks: the execution of a PopUpSelectTagCountTable and a QDialog

test_process_library(mock_msgbox_exec, mock_msgbox_question, mock_menu_exec)[source]

Tests row insert, rename, delete in ProcessLibrary with mocking dialogs.

The process library is located at the left corner of the pipeline manager tab, where the list of available bricks is shown.

test_verify_processes()[source]

Check that Mia’s processes control is working correctly

  • Tests: utils.verify_processes()

test_z_open_shell()[source]

Test that MainWindow.open_shell() correctly opens an in-process QtConsole with an IPython kernel.

This test verifies:
  • A RichJupyterWidget is returned

  • The in-process kernel can execute code

  • Application internals are available in the kernel namespace

  • Multiple consoles can coexist safely

_classSetupFailed = False
_class_cleanups = []