Add a reload file feature to the python "Scripter" plugin of krita
ClosedPublic

Authored by arvindpinto on Feb 25 2018, 6:38 PM.

Details

Summary

I have added a "Reload File" action to the scripter plugin. This allows you to reload the currently active file when it has been edited outside the scripter interface.

Reasoning:
I was preparing a python script. I realised that I may want to use a text editor e.g. Kate to edit my py script externally or a python IDE. I then noticed that Scripter does not detect any file changes. Currently to reload file contents I had to either close and open the file using Scripter or exit the Scripter window and relaunch it from Tools->Scripts->Scripter.

Both of these methods are slow. So I added a "Reload File" feature so a user can just press Alt+R or use the menu entry to load the external changes back into Scripter.

Test Plan

case 1: When a document is open:

  1. Create a py file in scripter and save it
  2. Open the same py file in an external text editor
  3. Make changes in the external editor and save it
  4. Press Alt + R or use the "Reload File" menu item.

Expected result: The text in the editor in the Scripter's ui should be updated with the changes made externally

case2: when there is no active document (E.g. when you use the "New" action of Scripter):

  1. Press Alt + R or use the "Reload File" menu item.

Expected result: A messagebox with an error sign informing the user to open a file first should appear

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
arvindpinto created this revision.Feb 25 2018, 6:38 PM
Restricted Application added a subscriber: woltherav. · View Herald TranscriptFeb 25 2018, 6:38 PM
arvindpinto requested review of this revision.Feb 25 2018, 6:38 PM
rempt accepted this revision.Feb 27 2018, 9:02 AM
rempt added a subscriber: rempt.

Nice, works perfectly! I'd prefer it if the button were on the toolbar, too, though!

This revision is now accepted and ready to land.Feb 27 2018, 9:02 AM
This revision was automatically updated to reflect the committed changes.

Ok I can try that. I agree a button is nice too along with the shortcut.