spreads API Reference

spreads package

This is the core package for spreads. Except for the spreads.cli and spreads.main modules (which contain the logic for the spread command-line application) everything in this package is UI-agnostic and designed to be used from plugins in the spreadsplug namespace.

It includes the following modules (in no particular order):

spreads.main
Core logic for application startup and parsing of command-line arguments
spreads.cli
Implementation of the command-line interface, i.e. the configure, capture, postprocess, output and wizard subcommands.
spreads.config
Classes for working with configuration, both per-workflow and application-wide. Most important for plugin developers is the spreads.config.OptionTemplate class, which allows for the UI-agnostic declaration of configuration options.
spreads.workflow
This is by far the largest module in the core and contains the spreads.workflow.Workflow class that is the central entity in the application. Also included are classes for representing single page entities and TOC-entries, as well as various signals that can be emitted by a workflow entity.
spreads.metadata
Contains the spreads.metadata.Metadata entity class that manages the reading and writing of metadata values.
spreads.plugin
The most important module for plugin authors. It contains the various interfaces (all inheriting from spreads.plugin.SpreadsPlugin) that plugins and device drivers can implement, as well as functions (intended for use by the core) to enumerate and initialize plugins and device drivers.
spreads.util
Various helper functions that can be useful for both plugin authors and the core. Also contains the various Exception subclasses used throughout the core and the plugin interface.
spreads.tkconfigure
Implementation of the graphical configuration dialog (accessible via the guiconfigure subcommand), using the Tkinter bindings from Python’s standard library.

Public plugin API (realized through a range of abstract classes) and utility functions for enumerating and loading plugins.

exception spreads.plugin.ExtensionException(message=None, extension=None)[source]

” Raised when something went wrong during plugin enumeration/ or instantiation.

__init__(message=None, extension=None)[source]
class spreads.plugin.SpreadsPlugin(config)[source]

Plugin base class.

on_progressed = <blinker.base.NamedSignal object at 0x7f832f689850; u'plugin:progressed'>
classmethod configuration_template()[source]

Allows a plugin to define its configuration keys.

The returned dictionary has to be flat (i.e. no nested dicts) and contain a OptionTemplate object for each key.

Example:

{
 'a_setting': OptionTemplate(value='default_value'),
 'another_setting': OptionTemplate(value=[1, 2, 3],
                                 docstring="A list of things"),
 # In this case, 'full-fat' would be the default value
 'milk': OptionTemplate(value=('full-fat', 'skim'),
                      docstring="Type of milk",
                      selectable=True),
}
Returns:dict with unicode -> spreads.config.OptionTemplate
__init__(config)[source]

Initialize the plugin.

Parameters:config (confit.ConfigView) – The global configuration object. If the plugin has a __name__ attribute, only the section with plugin-specific values gets stored in the config attribute
class spreads.plugin.DeviceFeatures[source]

Enum that provides various constants that DeviceDriver implementations can expose in their DeviceDriver.features tuple to declare support for one or more given features.

PREVIEW = <DeviceFeatures.PREVIEW: 1>

Device can grab a preview picture

IS_CAMERA = <DeviceFeatures.IS_CAMERA: 2>

Device class allows the operation of two devices simultaneously (mainly to be used by cameras, where each device is responsible for capturing a single page.

CAN_DISPLAY_TEXT = <DeviceFeatures.CAN_DISPLAY_TEXT: 3>

Device can display arbitrary messages on its screen

CAN_ADJUST_FOCUS = <DeviceFeatures.CAN_ADJUST_FOCUS: 4>

Device can read set its own focus distance and read out its autofocus

class spreads.plugin.DeviceDriver(config, device)[source]

Base class for device drivers.

Subclass to implement support for different devices.

features = ()

Tuple of DeviceFeatures constants that designate the features the device offers.

classmethod configuration_template()[source]

Returns some pre-defined options when the implementing devices has the DeviceFeatures.IS_CAMERA feature.

__init__(config, device)[source]

Set connection information and other properties.

Parameters:
  • config (spreads.confit.ConfigView) – spreads configuration
  • device (py:class:usb.core.Device) – USB device to use for the object
connected()[source]

Check if the device is still connected.

Return type:bool
set_target_page(target_page)[source]

Set the device target page, if applicable.

Parameters:target_page (unicode, one of odd or even) – The target page
prepare_capture()[source]

Prepare device for scanning.

What this means exactly is up to the implementation and the type of device, usually it involves things like switching into record mode and applying all relevant settings.

capture(path)[source]

Capture a single image with the device.

Parameters:path (pathlib.Path) – Path for the image
finish_capture()[source]

Tell device to finish capturing.

What this means exactly is up to the implementation and the type of device, with a camera it could e.g. involve retracting the lense.

update_configuration(updated)[source]

Update the device configuration.

The implementing device driver should propagate these updates to the hardware and make sure everything is applied correctly.

Parameters:updated (dict) – Updated configuration values
on_progressed = <blinker.base.NamedSignal object at 0x7f832f689850; u'plugin:progressed'>
class spreads.plugin.HookPlugin(config)[source]

Base class for HookPlugins.

Implement one of the available mixin classes (SubcommandHooksMixin, CaptureHooksMixin, py:class:TriggerHooksMixin, ProcessHooksMixin, OutputHooksMixin) to register for the appropriate hooks.

__init__(config)

Initialize the plugin.

Parameters:config (confit.ConfigView) – The global configuration object. If the plugin has a __name__ attribute, only the section with plugin-specific values gets stored in the config attribute
configuration_template()

Allows a plugin to define its configuration keys.

The returned dictionary has to be flat (i.e. no nested dicts) and contain a OptionTemplate object for each key.

Example:

{
 'a_setting': OptionTemplate(value='default_value'),
 'another_setting': OptionTemplate(value=[1, 2, 3],
                                 docstring="A list of things"),
 # In this case, 'full-fat' would be the default value
 'milk': OptionTemplate(value=('full-fat', 'skim'),
                      docstring="Type of milk",
                      selectable=True),
}
Returns:dict with unicode -> spreads.config.OptionTemplate
on_progressed = <blinker.base.NamedSignal object at 0x7f832f689850; u'plugin:progressed'>
class spreads.plugin.SubcommandHooksMixin[source]

Mixin for plugins that want to provide custom subcommands.

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

class spreads.plugin.CaptureHooksMixin[source]

Mixin for plugins that want to hook into the capture process.

prepare_capture(devices)[source]

Perform some action before capturing begins.

Parameters:devices (list of DeviceDriver) – The devices used for capturing
capture(devices, path)[source]

Perform some action after each successful capture.

Parameters:
finish_capture(devices, path)[source]

Perform some action after capturing has finished.

Parameters:
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

class spreads.plugin.TriggerHooksMixin[source]

Mixin for plugins that want to provice customized ways of triggering a capture.

start_trigger_loop(capture_callback)[source]
Start a thread that runs an event loop and periodically triggers
a capture by calling the capture_callback.
Parameters:capture_callback (function) – The function that triggers a capture
stop_trigger_loop()[source]

Stop the thread started by start_trigger_loop().

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

class spreads.plugin.ProcessHooksMixin[source]

Mixin for plugins that want to provide postprocessing functionality.

process(pages, target_path)[source]
Perform one or more actions that either modify the captured images
or generate a different output.
Parameters:
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

class spreads.plugin.OutputHooksMixin[source]

Mixin for plugins that want to create output files.

output(pages, target_path, metadata, table_of_contents)[source]

Assemble an output file from the pages.

Parameters:
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

spreads.plugin.available_plugins()[source]

Get the names of all installed plugins.

Returns:List of plugin names
spreads.plugin.get_plugins(*names)[source]

Get instantiated and configured plugin instances.

Parameters:names (unicode) – One or more plugin names
Returns:Mapping of plugin name to plugin instance
Return type:dict of unicode -> SpreadsPlugin
spreads.plugin.available_drivers()[source]

Get the names of all installed device drivers.

Returns:List of driver names
spreads.plugin.get_driver(driver_name)[source]

Get a device driver.

Parameters:driver_name (unicode) – Name of driver to instantiate
Returns:The driver class
Return type:DeviceDriver class
spreads.plugin.get_devices(config, force_reload=False)[source]

Get initialized and configured device instances.

Parameters:
Returns:

Device instances

Return type:

list of DeviceDriver objects

Central Workflow entity (and its signals) and various associated entities.

exception spreads.workflow.ValidationError(message=None, **kwargs)[source]

Raised when some kind of validation error occured.

Attr message:General error message
Attr errors:Mapping from field name to validation error message
__init__(message=None, **kwargs)[source]

Create new instance.

**kwargs should be a mapping from a field name to an error message.

class spreads.workflow.Page(raw_image, sequence_num=None, capture_num=None, page_label=None, processed_images=None)[source]

Entity that holds information about a single page.

Attr raw_image:The path to the raw image.
Attr processed_images:
 A dictionary of plugin names mapped to the path of a processed file.
Attr capture_num:
 The capture number of the page, i.e. at what position in the workflow it was recorded, including aborted and retaken shots.
Attr sequence_num:
 The sequence number of the page, i.e. at what position in the list of ‘good’ captures it is. Usually identical with the position in the containing pages list. Defaults to the capture number.
Attr page_label:
 A label for the page. Must be an integer, a string of digits or a roman numeral (e.g. 12, ‘12’, ‘XII’). Defaults to the sequence number.
__init__(raw_image, sequence_num=None, capture_num=None, page_label=None, processed_images=None)[source]
get_latest_processed(image_only=True)[source]

Get the least recent postprocessed file

Parameters:image_only (bool) – Only return image files (e.g. no OCR files)
Returns:Path to least recent postprocessed file
Return type:pathlib.Path
to_dict()[source]

Serialize entity to a dict.

Used by spreads.util.CustomJSONEncoder.

class spreads.workflow.TocEntry(title, start_page, end_page, children=None)[source]

Represent a ‘table of contents’ entry.

Attr title:Label/title of the entry
Attr start_page:
 First page of the entry
Attr end_page:First page no longer part of the entry
:attr children; Other TocEntry objects that designate a
sub-range of this entry
__init__(title, start_page, end_page, children=None)[source]
to_dict()[source]

Serialize entity to a dict.

Used by spreads.util.CustomJSONEncoder.

class spreads.workflow.Workflow(path, config=None, metadata=None)[source]

Core entity for managing scanning workflows.

Attr id:UUID for the workflow
Attr status:Current status. Keys are step (‘capture’, ‘process’ or ‘output’), step_progress (Progress as a value between 0 and 1) and prepared (whether capture is already prepared).
Attr path:Path to directory containing the workflow’s data.

:type path; pathlib.Path :attr bag: Underlying BagIt data structure :type bag: py:class:spreads.vendor.bagit.Bag :attr slug: ASCIIfied version of workflow title without spaces. :attr config: Configuration for the worklfow, takes precedence

over the global configuration).
Attr metadata:Metadata, contains at least a title field.
Attr pages:Pages available in the workflow
Attr table_of_contents:
 Table of contents entries in the workflow
Attr last_modified:
 Time of last modification
Attr devices:Active devices
Attr out_files:Generated output files
classmethod create(location, metadata=None, config=None)[source]

Create a new Workflow.

Parameters:
  • location (unicode or pathlib.Path) – Base directory that the workflow should be created in
  • metadata (dict) – Initial metadata for workflow. Must at least contain a title item.
  • config (dict or spreads.config.Configuration) – Initial configuration for workflow
Returns:

The new instance

Return type:

Workflow

classmethod find_all(location, key=u'slug', reload=False)[source]

List all workflows in the given location.

Parameters:
  • location (unicode or pathlib.Path) – Location where the workflows are located
  • key (str/unicode) – Attribute to use as key for returned dict
  • reload (bool) – Do not load workflows from cache
Returns:

All found workflows

Return type:

dict

classmethod find_by_id(location, id)[source]

Try to locate a workflow with the given id in a directory.

Parameters:
  • location (unicode or pathlib.Path) – Base directory that contains workflows to be searched among
  • id – ID of workflow to be searched for
Return type:

Workflow or None

classmethod find_by_slug(location, slug)[source]

Try to locate a workflow that matches a given slug in a directory.

Parameters:
  • location (unicode or pathlib.Path) – Base directory that contains workflows to be searched among
  • slug (unicode) – Slug of workflow to be searched for
Return type:

Workflow or None

classmethod remove(workflow)[source]

Delete a workflow from the disk and cache.

Parameters:workflow (Workflow) – Workflow to be deleted
__init__(path, config=None, metadata=None)[source]
remove_pages(*pages)[source]

Remove one or more pages from the workflow.

This will irrevocably remove the page metadata as well as all of its associated files, so use responsibly!

Parameters:pages (Page) – One or more pages to remove
crop_page(page, left, top, width=None, height=None, async=False)[source]

Crop a page’s raw image.

Parameters:
  • page – Page the raw image of which should be cropped
  • left – X coordinate of crop boundary
  • top – Y coordinate of crop boundary
  • width – Width of crop box
  • height – Height of crop box
  • async – Perform the cropping in a background thread
Returns:

The Future object when async was True

Return type:

concurrent.futures.Future

save()[source]

Persist all changes to the corresponding files on disk.

prepare_capture()[source]

Prepare capture on devices and initialize trigger plugins.

finish_capture()[source]

Wrap up capture process.

process()[source]

Run all captured pages through post-processing.

output()[source]

Assemble pages into output files.

update_configuration(values)[source]

Update the workflow’s configuration.

Metadata class and utility functions.

get_isbn_suggestions() and get_isbn_metadata() return a dictionary with the following keys (which corresponds to the Dublin Core field of the same name): creator, identifier, date, language.

spreads.metadata.get_isbn_suggestions(query)[source]

For a given query, return a list of metadata suggestions.

Parameters:query (unicode) – Search query
Returns:List of suggestions
Return type:list of dict
spreads.metadata.get_isbn_metadata(isbn)[source]
For a given valid ISBN number (-10 or -13) return the corresponding
metadata.
Parameters:isbn (unicode) – A valid ISBN-10 or ISBN-13
Returns:Metadata for ISBN
Return type:dict or None if ISBN is not valid or does not exist
class spreads.metadata.SchemaField(key, description=None, multivalued=False)[source]

Definition of a field in a metadata schema.

Attr key:Key/field name
Attr description:
 Description of the field
Attr multivalued:
 Whether the field can hold multiple values
__init__(key, description=None, multivalued=False)[source]
class spreads.metadata.Metadata(base_path)[source]

dict-like object that has a schema of metadata fields (currently hard-wired to Dublin Core) and persists all operations to a dcmeta.txt text file on the disk.

__init__(base_path)[source]
Create a new instance and try to load current values from an
existing file.
Parameters:base_path – Directory where dcmeta.txt should be stored

Configuration entities.

class spreads.config.OptionTemplate(value, docstring=None, selectable=False, advanced=False, depends=None)[source]

Definition of a configuration option.

Attr value:The default value for the option or a list of available options if :py:attr`selectable` is True
Attr docstring:A string explaining the configuration option
Attr selectable:
 Make the OptionTemplate a selectable, i.e. value contains a list or tuple of acceptable values for this option, with the first member being the default selection.
Attr advanced:Whether the option is an advanced option
Attr depends:Make option dependant of some other setting (if passed a dict) or another plugin (if passed a string)
__init__(value, docstring=None, selectable=False, advanced=False, depends=None)[source]
class spreads.config.Configuration(appname=u'spreads')[source]

Entity managing configuration state.

Uses confit.Configuration underneath the hood and follows its ‘overlay’-principle. Proxies __getitem__() and __setitem__() from it, so it can be used as a dict-like type.

__init__(appname=u'spreads')[source]

Create new instance and load default and current configuration.

Parameters:appname – Application name, configuration will be loaded from this name’s default configuration directory
keys()[source]

See confit.ConfigView.keys()

dump(filename=None, full=True, sections=None)[source]

See confit.Configuration.dump()

flatten()[source]

See confit.Configuration.flatten()

load_templates()[source]

Get all available configuration templates from the activated plugins.

Returns:Mapping from plugin name to template mappings.
Return type:dict unicode -> (dict unicode -> OptionTemplate)
cfg_path

Path to YAML file of the user-specific configuration.

Returns:Path
Return type:pathlib.Path
with_overlay(overlay)[source]

Get a new configuration that overlays the provided configuration over the present configuration.

Parameters:overlay (confit.ConfigSource or dict) – The configuration to be overlaid
Returns:A new, merged configuration
Return type:confit.Configuration
as_view()[source]

Return the Configuration as a confit.ConfigView instance.

load_defaults(overwrite=True)[source]

Load default settings from option templates.

Parameters:overwrite – Whether to overwrite already existing values
set_from_template(section, template, overwrite=True)[source]

Set default options from templates.

Parameters:
  • section (unicode) – Target section for settings
  • overwrite – Whether to overwrite already existing values
set_from_args(args)[source]

Apply settings from parsed command-line arguments.

Parameters:args (argparse.Namespace) – Parsed command-line arguments

Various utility functions and classes.

exception spreads.util.SpreadsException[source]

General exception

exception spreads.util.DeviceException[source]

Raised when a device-related error occured.

exception spreads.util.MissingDependencyException[source]

Raised when a dependency for a plugin is missing.

spreads.util.get_version()[source]

Get installed version via pkg_resources.

spreads.util.find_in_path(name)[source]

Find executable in $PATH.

Parameters:name (unicode) – name of the executable
Returns:Path to executable or None if not found
Return type:unicode or None
spreads.util.is_os(osname)[source]

Check if the current operating system matches the expected.

Parameters:osname – Operating system name as returned by platform.system()
Returns:Whether the OS matches or not
Return type:bool
spreads.util.check_futures_exceptions(futures)[source]
” Go through passed concurrent.futures._base.Future objects
and re-raise the first Exception raised by any one of them.
Parameters:futures (iterable with concurrent.futures._base.Future instances) – Iterable that contains the futures to be checked
spreads.util.get_free_space(path)[source]

Return free space on file-system underlying the passed path.

Parameters:path – Path on file-system the free space of which is desired.

:type path; unicode :return: Free space in bytes. :rtype: int

spreads.util.get_subprocess(cmdline, **kwargs)[source]

Get a subprocess.Popen instance.

On Windows systems, the process will be ran in the background and won’t open a cmd-window or appear in the taskbar. The function signature matches that of the subprocess.Popen initialization method.

spreads.util.wildcardify(pathnames)[source]
Try to generate a single path with wildcards that matches all
pathnames.
Parameters:pathnames – List of pathnames to find a wildcard string for
Returns:The wildcard string or None if none was found
Return type:unicode or None
spreads.util.diff_dicts(old, new)[source]

Get the difference between two dictionaries.

Parameters:
  • old (dict) – Dictionary to base comparison on
  • new (dict) – Dictionary to compare with
Returns:

A (possibly nested) dictionary containing all items from new that differ from the ones in old

Return type:

dict

spreads.util.slugify(text, delimiter=u'-')[source]

Generates an ASCII-only slug.

Code adapted from Flask snipped by Armin Ronacher: http://flask.pocoo.org/snippets/5/

Parameters:
  • text (unicode) – Text to create slug for
  • delimiter (unicode) – Delimiter to use in slug
Returns:

The generated slug

Return type:

unicode

class spreads.util.abstractclassmethod(func)[source]
New decorator class that implements the @abstractclassmethod decorator
added in Python 3.3 for Python 2.7.

Kudos to http://stackoverflow.com/a/13640018/487903

__init__(func)[source]
class spreads.util.ColourStreamHandler(stream=None)[source]

A colorized output StreamHandler

Kudos to Leigh MacDonald: http://goo.gl/Lpr6C5

is_tty

Check if we are using a “real” TTY. If we are not using a TTY it means that the colour output should be disabled.

Returns:Using a TTY status
Return type:bool
class spreads.util.EventHandler(level=0)[source]

Subclass of logging.Handler that emits a blinker.base.Signal whenever a new record is emitted.

on_log_emit = <blinker.base.NamedSignal object at 0x7f8330cef050; u'logrecord'>
spreads.util.get_data_dir(create=False)[source]

Return (and optionally create) the user’s default data directory.

Parameters:create (bool) – Create the data directory if it doesn’t exist
Returns:Path to the default data directory
Return type:unicode
spreads.util.colorize(text, color)[source]

Return text with a new ANSI foreground color.

Parameters:
  • text – Text to be wrapped
  • color (str (from colorama.ansi <http://git.io/9qnt0Q>)) – ANSI color to wrap text in
Returns:

Colorized text

class spreads.util.RomanNumeral(value, case=u'upper')[source]

Number type that represents integers as Roman numerals and that can be used in all arithmetic operations applicable to integers.

static is_roman(value)[source]

Check if value is a valid Roman numeral.

Parameters:value (unicode) – Value to be checked
Returns:Whether the value is valid or not
Return type:bool
__init__(value, case=u'upper')[source]

Create a new instance.

Parameters:value (int, unicode containing valid Roman numeral or RomanNumeral) – Value of the instance
class spreads.util.CustomJSONEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)[source]

Custom json.JSONEncoder.

Uses an object’s to_dict method if present for serialization.

Serializes pathlib.Path instances to the string representation of their relative path to a BagIt-compliant directory or their absolute path if not applicable.

Core logic for application startup and parsing of command-line arguments

spreads.main.add_argument_from_template(extname, key, template, parser, current_val)[source]

Add option from template to parser under the name key.

Templates with a boolean value type will create a –<key> or –no-<key> flag, depending on their current value.

Parameters:
  • extname – Name of the configuration section this option’s result should be stored in
  • key – Configuration key in section, will also determine the name of the argument.
  • template (spreads.config.OptionTemplate) – Template for the argument
  • parser (argparse.ArgumentParser) – Argument parser the argument should be added to
  • current_val – Current value of the option
spreads.main.main()[source]

Entry point for spread command-line application.

spreads.main.run()[source]

Setup the application and run subcommand

spreads.main.run_config_windows()[source]

Entry point to launch graphical configuration dialog on Windows.

spreads.main.run_service_windows()[source]

Entry point to launch web plugin server on Windows.

spreads.main.setup_logging(config)[source]

Conigure application-wide logger.

Parameters:config (spreads.config.Configuration) – Global configuration
spreads.main.setup_parser(config)[source]

Sets up an argparse.ArgumentParser instance with all options and subcommands that are available in the core and activated plugins.

Parameters:config (spreads.config.Configuration) – Current application configuration
Returns:Fully initialized argument parser
Return type:argparse.ArgumentParser
spreads.main.should_show_argument(template, active_plugins)[source]

Checks the spreads.config.OptionTemplate.depends attribute for dependencies on other plugins and validates them against the list of activated plugins.

We do not validate dependencies on other configuration settings because we don’t have access to the final state of the configuration at this time, since the configuration can potentially be changed by other command-line flags.

Parameters:
Returns:

Whether or not the argument should be displayed

Command-Line interface for configuration, capture, output and postprocessing.

spreads.cli.getch()[source]

Waits for a single character to be entered on stdin and returns it.

Returns:Character that was entered
Return type:str
spreads.cli.draw_progress(progress)[source]

Draw a progress bar to stdout.

Parameters:progress (float) – Progress value between 0 and 1
spreads.cli.configure(config)[source]

Configuration subcommand that runs through the various dialogs, builds a new configuration and writes it to disk.

Parameters:config (spreads.config.Configuration) – Currently active global configuration
spreads.cli.capture(config)[source]

Dialog to run through the capture process.

Parameters:config (spreads.config.Configuration) – Currently active global configuration
spreads.cli.postprocess(config)[source]

Launch postprocessing plugins and display their progress

Parameters:config (spreads.config.Configuration) – Currently active global configuration
spreads.cli.output(config)[source]

Launch output plugins and display their progress

Parameters:config (spreads.config.Configuration) – Currently active global configuration
spreads.cli.wizard(config)[source]

Launch every step in succession with the same configuration.

Parameters:config (spreads.config.Configuration) – Currently active global configuration

Graphical configuration dialog.

class spreads.tkconfigure.TkConfigurationWindow(spreads_config, master=None)[source]

Window that holds the dialog

__init__(spreads_config, master=None)[source]

Initialize Window with global configuration.

Parameters:spreads_config (spreads.config.Configuration) – Global configuration
update_plugin_config(plugins)[source]
Update list of activated plugins and load its default
configuration.
Parameters:plugins (list of unicode) – List of names of plugins to activate
on_update_driver(event)[source]

Callback for when the user selects a driver.

Updates the driver in the configuration and toggles the status of widgets that depend on certain device features.

Parameters:event (Tkinter.Event) – Event from Tkinter
on_update_plugin_selection(event)[source]

Callback for when the user toggles a plugin.

Tries to load the newly selected plugins. If loading fails, a dialog with the cause of failure will be displayed and the plugin will be highlighted in the list and made inactive. If successful, the plugin will be added to the ‘postprocessing order’ widget (if it implements spreads.plugin.ProcessHooksMixin) and the configuration will be updated.

Parameters:event (Tkinter.Event) – Event from Tkinter
on_process_plugin_move(event)[source]
Callback for when the user changes the position of a plugin in
the postprocessing order widget.

Updates the widget and writes the new order to the configuration.

Parameters:event (Tkinter.Event) – Event from Tkinter
create_driver_widgets()[source]

Create widgets for driver-related actions.

create_plugin_widgets()[source]

Create widgets for plugin-related actions.

load_values()[source]

Set widget state from configuration.

set_orientation(target)[source]

Set target page on a device.

Prompts the user to connect a device, prompts to retry or cancel on failure. If successful, updates the target page setting on the device.

Parameters:target (unicode, one of "odd" or "even") – Target page to set on device
configure_focus()[source]
Acquire auto-focus value from devices and update the configuration
with it.

Prompts the user to connect a device, asks for cancel/retry on failure. On successful connection, acquires focus and writes the value to the configuration.

save_config()[source]

Write configuration to disk.

spreads.tkconfigure.configure(config)[source]

Initialize and display configuration dialog.