D16174: Fixed the handling of plot images for python

Alexander Semke noreply at phabricator.kde.org
Sat Oct 13 09:08:34 BST 2018


asemke created this revision.
asemke added a reviewer: Cantor.
asemke added a project: Cantor.
Herald added a project: KDE Edu.
Herald added a subscriber: kde-edu.
asemke requested review of this revision.

REVISION 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.

REPOSITORY
  R55 Cantor

REVISION DETAIL
  https://phabricator.kde.org/D16174

AFFECTED FILES
  src/backends/python/pythonexpression.cpp
  src/backends/python/pythonexpression.h
  src/backends/python/pythonsession.cpp
  src/backends/python/pythonsession.h
  src/lib/expression.cpp
  src/lib/expression.h

To: asemke, #cantor
Cc: kde-edu, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20181013/2747226f/attachment-0001.html>


More information about the kde-edu mailing list