def onApply(self):
    emm = slicer.app.extensionsManagerModel()
    if emm.isExtensionInstalled('SlicerDMRI'):
        self.textBox.setHtml('<h4>SlicerDMRI is already installed.<h4>')
        self.applyButton.enabled = False
        return
    md = emm.retrieveExtensionMetadataByName('SlicerDMRI')
    if ((not md) or ('extension_id' not in md)):
        return self.onError()
    if emm.downloadAndInstallExtension(md['extension_id']):
        slicer.app.confirmRestart('Restart to complete SlicerDMRI installation?')
    else:
        self.onError()
def onApply(self):
    emm = slicer.app.extensionsManagerModel()
    if emm.isExtensionInstalled('SlicerDMRI'):
        self.textBox.setHtml('<h4>SlicerDMRI is already installed.<h4>')
        self.applyButton.enabled = False
        return
    md = emm.retrieveExtensionMetadataByName('SlicerDMRI')
    if ((not md) or ('extension_id' not in md)):
        return self.onError()
    if emm.downloadAndInstallExtension(md['extension_id']):
        slicer.app.confirmRestart('Restart to complete SlicerDMRI installation?')
    else:
        self.onError()