Fixed the handling of plot images for python
ClosedPublic

Authored by asemke on Oct 13 2018, 8:08 AM.

Details

Summary

There were two major problems with the handling of the generated plot images for python:

  • using of a non-initialized boolean m_finished variable in PythonExpression which caused unstable results (plots are shown or not)
  • using of KDirWatch which monitored the whole temp directory for changes and which, in addition to performance problems because of the many changes in the temp folder, lead to strange side effects when a plot image generated in one python session was shown in another python session since both were monitoring the same temp folder.

This patch addresses both of these problems and also greatly simplifies the code:

  • QFileSystemWatcher is used to monitor one single file relevant for the plot image only
  • Moved the handling of images from PythonSession to PythonExpression and further simplified it. The code is similar to the handling of plot images for Maxima now.
  • QFileSystemWatcher* is part of Expression - here the proposal is to put this to the base class since this is needed for all backends (MaximaExpression, PythonExpression, etc.) and to move the code to using this new member in Expression step by step.
Test Plan

Different tests with matplotlib examples showing much more stable behavior in Cantor now with respect to the handling of plot images.

Diff Detail

Repository
R55 Cantor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
asemke created this revision.Oct 13 2018, 8:08 AM
Restricted Application added a project: KDE Edu. · View Herald TranscriptOct 13 2018, 8:08 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
asemke requested review of this revision.Oct 13 2018, 8:08 AM
asemke updated this revision to Diff 43521.Oct 13 2018, 8:16 AM
asemke updated this revision to Diff 43531.Oct 13 2018, 9:57 AM

Replaced setResult by addResult in PythonExpression::imageChanged().

sirgienko accepted this revision.Oct 13 2018, 9:58 AM
This revision is now accepted and ready to land.Oct 13 2018, 9:58 AM
This revision was automatically updated to reflect the committed changes.