filehandler

class FileHandler()

The file handler for vispa. One can add MenuItem() like objects, which can be used within a menu (like headless) or directly. getFileHandlers() then returns all registered file handlers with the property value set to the filename, which is given to the function as parameter. The handlers themself should update themself via the filename. Classes deriving from BaseView() can set the member property fileHandlers, which must be a list of MenuItem() like objects. These are automatically added to the file handler. Additionally. BaseView() adds spawn() to the handler so that inside callback() this.spawn can be used to easily spawn an instance.

addFileHandler(key, handler)

Add a single file handler with key.

addFileHandlers(handlers)

Add a dict of file handlers.

getFileHandlers(file)

Get all file handlers. Each is updated previously with handler.value = file.

getDefaultFileHandler(file)

Get the file handler with the highest position or null if it has no callback, e.g. for a divider or a header.

runDefaultHandler(file, view)

Runs the default file handler if available for the given view.

Arguments:
  • file (String) – The file to run the handler for.
  • view (BaseView) – The view that intends to open the file.