Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Req.] Add UI indication of script running/not-running status #289

Open
alankilborn opened this issue Jun 13, 2023 · 2 comments
Open

Comments

@alankilborn
Copy link

Sometimes scripts are architected such that they take a measurable amount of time to run. This seems to go against an unwritten philosophy of scripting, specifically: Scripts should be short and do their work quickly. There, now I've written it. :-)

If a script does take a while to run (e.g. maybe it is doing a search that takes a really long time), then there is the possibility of a user continuing to edit the active Notepad++ file during the time that the script is modifying the same file, leading to potential conflicts and/or data corruption.

While I suppose it would be possible for the PS plugin to "lock out" user input while a script is running, this would be a rather drastic change to a long-existing way of operation, so that is not proposed.

But it might be nice if there was some visual way of indicating to the user that a script is currently running, and that maybe it isn't a good idea to keep working with Notepad++'s UI while this is happening. Perhaps the >>> prompt in the console window could be moved to the right and some sort of red/green "block" could be added to the left? Red would indicate "script running"; green would indicate "script not running". (This is definitely a spur-of-the moment thought just to put something in this issue. Other better ideas are certainly welcome)

Origins of this issue are some comments in another issue; for some background info see #288

@pryrt
Copy link
Contributor

pryrt commented Jun 13, 2023

The >>> might be good, but is it sufficient? Not everyone runs with the PythonScript Console visible. (Most of my scripts don't force it on, unless I'm debugging; and I don't have that window showing by default.)

My thought would be an icon on the toolbar: either one that only appears while the script is running, or one that changes the icon depending on the state (similar to the pushed/unpushed for builtin toolbar icons like the word-wrap or function-list): my original ideas were like red-light/green-light and walk/don't-walk icons, though I cannot decide whether red-light would mean the script was running (so it's not safe to manually edit) or wasn't running (so the script is "stopped") -- since I am not certain, I wouldn't be surprised if some fraction of the users were confused as to which meant which. Or maybe a yield triangle sign when it's running ("yield to the active script"). (If you don't like the icon being permanent, maybe have a toggleable setting, similar to Show Console, that would show or hide the script-status icon.)

Or maybe a simpler interface, as I suggested in #288, would be to just change the cursor to the IDC_WAIT cursor while the script is running, to get the well-recognized spinning hourglass.

@victorel-petrovich
Copy link

victorel-petrovich commented Jul 31, 2023

Since it's rare that scripts to run for so long, you'd expect it for the peculiar scripts, so perhaps one of the simplest ways is just add console.hide() at the start of the script, and console.show() at the end of it ? (Or reversly). And maybe making it write some output on console saying it's this particular script that ended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants