pic_scanner.gui.models.windows.preferences.blueprint

Classes

BaseBlueprint

A base class for building blueprints.

BluePrint

A base class for building blueprints.

Functions

flag_lock(instance, flag_name)

Context manager to set and unset a private flag attribute in an instance.

Module Contents

class pic_scanner.gui.models.windows.preferences.blueprint.BaseBlueprint(auto_build: bool = False)

A base class for building blueprints.

This class is used to create blueprints for building GUI elements. A blueprint is a set of instructions that are used to build a GUI element.

Properties:

auto_build (bool):

A boolean value that determines whether the class should automatically build itself when instantiated.

building (bool):

A boolean value that determines whether the class is currently building itself.

is_built (bool):

A boolean value that determines whether the class has been built.

layout (list):

A list of elements that make up the layout of the class.

Parameters:

auto_build (bool)

build()

An abstract method that builds the class.

property auto_build
Returns the value of the `auto_build` attribute.

The auto_build attribute is a boolean value that determines whether the class should automatically build itself when instantiated.

Returns:

The value of the auto_build attribute.

Return type:

bool

property building
Returns the value of the `building` attribute.

The building attribute is a boolean value that determines whether the class is currently building itself.

Returns:

The value of the building attribute.

Return type:

bool

building()

Deletes the building attribute.

This method sets the building attribute to False.

Returns:

None

property is_built
Returns the value of the `is_built` attribute.

The is_built attribute is a boolean value that determines whether the class has been built.

Returns:

The value of the is_built attribute.

Return type:

bool

property layout
Returns the value of the `layout` attribute.

The layout attribute is a list of elements that make up the layout of the class.

Returns:

The value of the layout attribute.

Return type:

list

abstract build()

An abstract method that builds the class.

This method is called to build the class by creating and must be implemented by subclasses.

Returns:

None

pic_scanner.gui.models.windows.preferences.blueprint.flag_lock(instance, flag_name)

Context manager to set and unset a private flag attribute in an instance.

This context manager ensures that a specified private flag attribute in the given instance is set to True when entering the context and reset to False upon exiting the context. This is useful for indicating that an operation is in progress within a specific scope.

Parameters:
  • instance (object) – The instance containing the private flag attribute.

  • flag_name (str) – The name of the flag attribute (without leading underscore).

Raises:

AttributeError – If the instance does not have the specified private flag attribute.

Example usage:

handler = OperationHandler() with flag_lock(handler, ‘flag’):

# Perform some operation pass

This will automatically set handler._flag to True within the context and reset it to False when exiting the context.

class pic_scanner.gui.models.windows.preferences.blueprint.BluePrint(**kwargs)

Bases: pic_scanner.gui.models.element_bases.blueprint.BaseBlueprint

A base class for building blueprints.

This class is used to create blueprints for building GUI elements. A blueprint is a set of instructions that are used to build a GUI element.

Properties:

auto_build (bool):

A boolean value that determines whether the class should automatically build itself when instantiated.

building (bool):

A boolean value that determines whether the class is currently building itself.

is_built (bool):

A boolean value that determines whether the class has been built.

layout (list):

A list of elements that make up the layout of the class.

build()

An abstract method that builds the class.

property gui_settings_tab
build()

An abstract method that builds the class.

This method is called to build the class by creating and must be implemented by subclasses.

Returns:

None