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 WordProcessorImpl.WordProcessorImpl(system, config)

This is the abstract class which is the parent to each concrete class that knows how to control a Word Processor on some target system. Combined with the <no title> class this implements the Bridge Pattern

Parameters:

  • system: a <no title> object letting us control the remote system

  • config: a <no title> object containing the configuration for this user

close_all(save=False)

Exit the application, closing all documents. By default this will not save changes to documents, but this can be overriden if desired.

Parameters:

  • save: whether or not to save changes to documents if prompted

close_document(save=False)

Close the currently active document and switch to a random other open one if any are available. If this is the last open document it will cause Word to exit too. This will not save the document if prompted unless otherwise told to do so.

Parameters:

  • save: whether or not to save the changes if prompted

edit(text)

Type the given text into the currently active document.

Parameters:

  • text: the text to be typed to the current location in the file

insert_pic(path)

Insert a picture from an external file.

Parameters:

  • path: the path to an image file to include in the current document

load(path)

Load a file from the given path.

Parameters:

  • path: the path to the target path

new_document()

Open a new document in the open application

open2()

Open the application.

save()

Save the currently active document

save_as(path)

Save the currently active document to a new path.

Parameters:

  • path: the new path

WordProcessorImpl.get_word_processor(system, config, p_type=None)

This is a Factory function to build instances of subclasses of <no title> based on the given type or one found in the <no title> object.

Parameters:

  • system: a <no title> object letting objects interact with the remote system

  • config: a <no title> object defining all the attributes of the current user

  • p_type: optionally a Word Processor type to override that found in the config object

Return: an instance of a subclass of <no title> or None if no class matches the given type