Class Main

class imager.Main(**kwargs)

Instance is a controller for the primary application.

This controller manages all of the buttons and text fields of the application. It instantiates ImageProcessor (the student defined class), and uses that sub-controller to process images.

The View for this controller is defined in imager.kv.

Attributes

The attributes in Main are all fields, not properties, which cannot be easily documented. They exist only to hook up with the imager.kv file.

Methods

config()

Configures the application at start-up.

Controllers are responsible for initializing the application and creating all of the other objects. This method does just that. It loads the currently selected image file, creates an ImageArray for that file, creates an ImageProcessor to handle the array, and connects the ImageProcessor to the two ImagePanel objects.

error(msg)

Report an error to the user

param msg:the error message

Precondition: a string

The error message will take up most of the Window, and last until the user dismisses it.

do(trans, *args)

Perform a transformation on the image.

param trans:transformation method in ImageProcessor

Precondition : a reference to a method or function, not a string for its name

param args:list of arguments for transform

Precondition: a list or tuple with valid argument values

This method does not enforce its preconditions. Use with care.

hide()

Stores the hidden message in the image via steganography.

Calls the method from image_processor. Displays a pop-up if the method fails (i.e. returns False). Otherwise, message is now stored in the image.

reveal()

Reveal the hidden message in the image.

Calls the method from image_processor. Displays a pop-up if there is no message. Otherwise, places message in the text input box.

load()

Open a dialog to load an image file.

loadText()

Open a dialog to load a text file.

Hidden method to try loading large messages into the text field. Used for grading purposed on hide/reveal, as the clipboard does not work on all OSs

save()

Save the image in the current ImageArray to a file.

Table Of Contents

Previous topic

Documentation for A6: Imager

Next topic

Class ImageProcessor

This Page