ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class ModuleBrain.ModuleBrain(user, brain)

This is the abstract superclass for brains for specific modules.

Print()

Print the current selection/document/screen/whatever it means to this app.

exit(save=False)

Close the application

Parameters:

  • save: for modules that use it, whether to save before exiting

get_actions(base)

Load the actions this module will use, returning a <no title> instance.

Return: an instance of <no title> for the actions this Brain will perform

get_mod_name()

Return the module name which this brain maps to

get_user_apps()

For most modules our name is the same as the user app this uses so we will return that.

handle_negotiation(conn)

Negotiate with the potential partner on the other end of the connection. This is called after this brain posted to the whiteboard asking for partners to do a task. When someone offers to be such a partner the two sides have to agree to how it will actually be done, and whether or not it can be done.

is_ready()

Return: True if this module is in a ready state, False otherwise

is_user_app()

Return True iff the user needs to have this module name as an app

load_preaction_checks()

Attempt to find any suitable preaction checks for this module

open()

Open the user’s application

preaction_check()

This is a placeholder that defaults to doing nothing and saying it is ok to continue. Subclasses may well want to implement their own version of this. It is called just prior to invoking each action.

Instances should perform any extra steps that are required. One use of this would be, for example, to have a brain look for certain triggers like receiving an email from a certain sender that must be read as soon as it arrives.

If this function returns False the controller should not assume that the next action is safe to run.

Return: True if the next action can be run, False otherwise

reset_ready_state()

The module might have previously failed to run and be marked as “not ready” so this is a way for the main brain to clear that state when the next iteration is ready to begin.

should_use_iodine(domain)

Given a dest domain, decide whether or not the user should use iodine for this, and if so whether it should be a long- or short-running instance.

Parameters:

  • domain: the name of the domain that will be the target of iodine

Return: if iodine should not be started will return DO_NOT_START

If it should be started then immediately stopped: SHORT_START If it should be started and left running: LONG_START

start_iodine(shell, domain)

start the iodine client

start_listener()

Start listening for new multi-user organization connections.

stop_iodine(shell, domain)

stop the iodine client associated with the given domain