Author Topic: Dragging script icon results in no history/undo?  (Read 2970 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Dragging script icon results in no history/undo?
« on: 2012 June 05 18:47:36 »
I am trying resolve a script problem. This could be a script bug or a PI bug, I am not sure.

Attached is a test script. It applies the process ConvertToGrayScale to the target.

Open a RGB image as a target.

If you run this script via the Execute command in the Script Editor, or from the Script menu, then you will see the process listed in the target's history. The process is also undoable.

However if you apply this script by dragging its icon to the target, no history is created and the process is not undoable.

Should this script be doing something more to create history/undo when dragging? Or is this a PI bug?

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Dragging script icon results in no history/undo?
« Reply #1 on: 2012 June 07 00:29:20 »
Hi Mike,

Use the Parameters core object to know how your script is being executed. There are three possibilities:

- Executed directly without an instance, e.g. from the Script Editor.
- Executed on a view from an existing Script instance.
- Executed in the global context from an existing Script instance.

I have attached a modified version of your script that does exactly what you want. Let me know if this helps.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: Dragging script icon results in no history/undo?
« Reply #2 on: 2012 June 08 11:21:32 »
Hi Juan,

Your patch does not appear to solve the history/undo problem on Win 7 PI 01.07.06.0793 Starbuck (eng x86_64).

When Parameters.isViewTarget is true, your patch applies the conversion properly, of course, but unfortunately history/undo is still not available.

Thanks,
Mike
« Last Edit: 2012 June 08 13:41:12 by mschuster »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Dragging script icon results in no history/undo?
« Reply #3 on: 2012 June 08 18:02:06 »
Hi Mike,

Bug confirmed on all platforms. Actually, the processing history of the target image is updated with the executed processes. It is the history index that is not set to point after the last executed process (you can check this on the History Explorer window after running the script).

This bug is now fixed in PI version 1.8.0. Thanks for reporting it!
Juan Conejero
PixInsight Development Team
http://pixinsight.com/