|
wxMaxima
|
Runs the troubleshooting checks that need a Maxima or a gnuplot process. More...
#include <TroubleshootingRunner.h>
Data Structures | |
| class | Process |
| A wxProcess that tells its runner when it ended, and outlives it if need be. More... | |
| struct | Settings |
| What the runner needs to know to start Maxima and gnuplot. More... | |
Public Types | |
| using | ResultCallback = std::function< void(const wxm::TroubleshootingResult &)> |
Public Member Functions | |
| TroubleshootingRunner (const Settings &settings, ResultCallback onResult, std::function< void()> onFinished={}) | |
| ~TroubleshootingRunner () override | |
| Stops Maxima and gnuplot if they still run. | |
| void | Start () |
| Starts the checks; from now on a timer calls Poll() | |
| void | Poll () |
| Does whatever can be done now, without waiting. | |
| bool | IsFinished () const |
| True once every check this runner runs has been reported. | |
Static Public Member Functions | |
| static const std::set< wxm::TroubleshootingCheck > & | Checks () |
| The checks this runner runs, and only these. | |
Friends | |
| class | Process |
Runs the troubleshooting checks that need a Maxima or a gnuplot process.
It starts a Maxima of its own – with its own server, its own port and its own secret – rather than looking at the one the worksheet talks to: that one may be busy, may never have started, or may be the very thing that went wrong, and the checks must neither disturb a running calculation nor depend on one. The Maxima is started the way MaximaProcessManager starts the worksheet's one (same command line, same environment), so a problem that keeps the worksheet's Maxima from working keeps this one from working too, and is reported at the step where it happens.
The steps follow each other: find Maxima, open the server, start Maxima, wait for it to connect, wait for its first prompt, check that it authenticates, send wxMathML.lisp, ask it a few questions (where its temp directory and manuals are, which gnuplot it uses, whether it can load a package and draw), and stop it again. Then gnuplot draws a small png and pngcairo plot into Maxima's temp directory. A step that cannot be run since one before it failed is reported as skipped.
Everything happens in Poll(), driven by a timer once Start() was called, so nothing here blocks the GUI. Each result is reported as soon as it is known, through the callback passed to the constructor.
The answers to the questions are lines of the form "wxprobe-<key>=<value>" the Maxima prints (see wxm::TroubleshootingProbeValue()), which makes them easy to find among everything else Maxima prints, whether or not wxMathML.lisp has been loaded.
| void TroubleshootingRunner::Poll | ( | ) |