UpdateCheck¶
- class controllers.UpdateCheck¶
Bases:
handleUPDATECHECK - Controller for the Check for Update dialog.
- Constructor Summary
- UpdateCheck(mibModel, varargin)¶
UPDATECHECK - Constructor for the Check for Update dialog controller.
Syntax:
controller = controllers.UpdateCheck(mibModel) controller = controllers.UpdateCheck(mibModel, mibController)- Input Arguments:
mibModel - handle to the MibModel instance
mibController - (optional) handle to MibController; without it the Update button installs the new version but cannot restart MIB
- Output Arguments:
controller - handle to the constructed
UpdateCheckcontroller
- Property Summary
- mibController¶
handle to the view
- mibModel¶
- mibVersion¶
handle to MibController; optional, required only to restart MIB after an in-place update
- view¶
handle to the model
- Method Summary
- addCallbacks()¶
ADDCALLBACKS - Wire all widget callbacks and tooltips for the Update Check dialog.
- closeWindow()¶
CLOSEWINDOW - Close the Update Check dialog and fire CloseEvent.
- downloadBtn_Callback()¶
DOWNLOADBTN_CALLBACK - Open the platform-specific MIB download link in a browser.
HTTPS only, without a fallback to HTTP: browsers (Chrome: “Insecure download blocked”) refuse downloads over plain HTTP, and
webdoes not report such a refusal, so a fallback could never be triggered.
- recheckPeriodSpinner_Callback(hObject)¶
RECHECKPERIODSPINNER_CALLBACK - Save the recheck period preference.
- updateBtn_Callback()¶
UPDATEBTN_CALLBACK - Download and install a MIB update in-place (MATLAB mode only).
Prompts for the installation directory, downloads
MIB3_Matlab.zipto a temporary file and unzips it into the destination. The download goes over HTTPS; when that fails it is retried once over plain HTTP, and only the error of the HTTP attempt is shown.The zip contains the whole distribution with
mib\at its top level, so the suggested destination is the parent ofmibModel.mibPath; unzipping intomibPathitself would createmib\mib\and leave the running installation untouched.Cancel is honoured after the download, before the unzip, which is the only irreversible step; the download and the unzip themselves cannot be interrupted, so the dialog stops being cancelable once the unzip starts.
Files held open by MATLAB cannot be replaced;
unzipskips them with theMATLAB:io:archive:extractArchive:OverwriteOpenFilewarning and leaves them out of its returned list. This always hits the window icons (mib_icon_16px.pngof the dialogs,mib_icon_32px.pngof the main window): a uifigure keeps itsIconfile locked for the rest of the MATLAB session, even after it is deleted, so an update run at startup is affected as well. The warning ID is language independent; when it is the last warning of the unzip, the zip is extracted once more to a temporary folder to get its full file list, and the skipped files are named in the final message. Skipped icons are reported as harmless; anything else as a possible malfunction, with the advice to restart MATLAB and update again. A lock scan of the installation instead would take about 70 s.MIB is restarted only when the destination is the running installation and
mibControllerwas supplied; otherwise the running MIB stays open and the user is told where the new copy is. The restart closes the main window withAppContainer.close(), which runsMibController.exitProgramthroughCanCloseFcnexactly as the window close button does: preferences and user stats are saved and all child windows, this one included, are closed.exitProgrammust not be called directly - it is only the close request handler and leaves the main window open.close()is synchronous, so the new MIB is started afterwards from a single-shot timer: it is constructed once this callback has returned and released its handles to the old instance, not inside the callback of a window that no longer exists.
- updateWidgets()¶
UPDATEWIDGETS - Fetch the version file from the MIB server and populate the dialog.
Selects the appropriate URL by platform, fetches the text file, parses the version number and HTML sections, then updates
informationTextand theinformationEditHTML pane. The version file is read over HTTPS; when that fails (e.g. a proxy or an old Java without the server’s certificate chain) it is read again over plain HTTP, so an unreachable server costs up to two 4 s timeouts.informationTextis emphasized: bold, 4 points larger than the MIB font, word-wrapped and centered next to the image. Its background tells the outcome apart, using the tints ofutils.themeColors:panelGreen- a newer version is available; the release notes are shownpanelBlue- the running version is the latest; the general information section is shownpanelYellow- the version could not be determined (server not reachable, or no number before the first<html>of the version file); the release notes section, which for an unreachable server is the local “not detected” message, is shown. Without this case theNaNversion would fall through to “latest version”
utils.applyThemeColors(theThemeChangedFcnof the dialog) remaps these tints on a light/dark theme switch. Must run afterutils.fontSizeUpdate, which would reset the font size.