MKtlDesc:
Filter:
Modality-toolkit/Classes (extension) | Modality

MKtlDesc
ExtensionExtension

handling descriptions of interface devices in Modality

Description

MKtlDesc can read description files for hardware interface devices into MKtlDesc instances. Usually, this happens automatically when an MKtl is instantiated.

NOTE: The file syntax can be found at MKtl_description_files, element description keys can be found at Naming_conventions_in_element_descriptions.

Some examples:

Which devices are supported by Modality? Look at the webpage:

Folders:

Loading:

Global inspection:

Make an MKtlDesc from a desc filename

Class Methods

.defaultFolder

the path where the folder for MKtlDesc files lives.

.userFolder

the path where users can put personalized MKtlDesc files.

.folderName

the name of the defaultFolder and userFolder.

.descFolders

all descFolders within which to look for MKtlDesc files.

.addFolder

add a folder to descFolders

.openFolder

open folder(s) in descFolders by index.

.loadDescs

load matching descriptions in descFolders.

.allDescs

dict of all currently loaded descs

.postStatus

post status and name of all loaded descs

.postLoadable

post the filenames of descs that can be loaded

.postLoaded

post currently loaded descs

.descKeysUsed

collect all element keys used in loaded descs

.deviceTypesUsed

collect all device types used in loaded descs

.elementTypesUsed

collect all element types used in loaded descs

.notePair

make a pair of noteOn, noteOff elements

.notePairs

make pairs for a list of key, note pairs

.isValidDescDict

check whether dict is a valid description dict.

.new

create an MKtlDesc with a name, from a well-formed description file.

.at

access an MKtlDesc by name in the global repository

.fromFileName

create an MKtlDesc from a file.

Arguments:

filename

filename without path or extension, will be looked for in descfolders.

folderIndex

in which folder of descFolders to search the file

multi

flag whether to load multiple matching files

.fromDict

create an MKtlDesc from a well-formed description dict.

.findFile

find the filepath for a given desc name.

.fromPath

create an MKtlDesc from a full file path.

.web

get info for an MKtlDesc on the web

internal methods

.compExt

.descExt

legal extensions for filenames

.fileToIDDict

a dictionary that contains the idInfos for every desc file

.idInfoForFilename

find device idInfo for given filename

.filenamesForIDInfo

find filenames for a given device idInfo

.writeCache

.cacheName

.loadCache

.updateCache

support methods for cache of filenames and idInfos

.platformSpecific

Set false to disable platform specific replacements.

NOTE: This will break standard MKtl functionality and is only needed for rendering documentation!

Instance Methods

.idInfo

get the string by which the hardware device registers to the OS.

.protocol

get and set the hardware protocol of the device.

.deviceFilename

get the filename of the desc file

.testCode

returns code to test a controller with this description.

.openTestCode

Opens a Document with code to test a controller with this description.

.fullDesc

get MKtlDesc's properties, or set them from a dict fullDesc.elementsDesc contains the description of all elements

.elementsDesc

the hierarchical dict that contains the description of all elements

.elAt

access element descriptions hierarchically

.elementsDict

the flat dict that contains descriptions of all elements by compound lookup name

.dictAt

access element descriptions by compound hierarchic lookup name

.web

open a webview on the device's info page at Modality website.

.openFile

open the desc file from which the MKtlDesc was generated

.postInfo

post info on the device, if postElements = true, also info on the elements

.postElements

post info on the elements

.path

the path where file was read (if so)

.writeFile

not done yet - should eventually write a well-formed description file at path based on its current data.

Examples