Call Tip Color change
-
@nick-brown said in Call Tip Color change:
This is part of the settings I use in my startup.py pythonscript file:
for e in (editor1, editor2):
e.callTipSetBack((255, 255, 176))
e.callTipSetFore((0, 0, 0))Thanks for that! I was changing CallTip background as well but doing it with Scintilla styles (
callTipUseStyle
, and thenstyleSetFore|Back
) which needed to be reset every buffer change. So I had a PythonScript callback on buffer activation to (re)set my call tip new colors. I didn’t see this much simpler call in Scintilla docs. Saves me a line of code and then removing an entire script for buffer callback!Cheers.
-
@nick-brown said in Call Tip Color change:
for e in (editor1, editor2):
e.callTipSetBack((255, 255, 176))
e.callTipSetFore((0, 0, 0))Thank you. Now, I’m going to stick it in somewhere in the file below stderr, and hope for the best. I have no clue about Python, Python script, but I have the plugin installed, tried clicking on startup.py in the menu, was ignored, found the file in the plugin directory and am going to try and modify it. Let’s see what happens.
Lee
-
@lycan-thrope
::sigh:: I knew it would’nt be easy. Got to find something to read that explains the usage. I uncommentedsys.stdout = editor
and commentedsys.stdout = console
and I’m still getting the result, albeit not red, in the console only. It was the same when I hadn’t commented outsys.stdout = console
, so obviously there’s more to find out. :-(Thanks.
Lee
-
I would recommend creating a new
startup.py
instead of using the one that comes with the python script plugin itself.
Just go to plugins->python script->new script and save it asstartup.py
. Make sure the directory points to the …\plugins\CONFIG\pythonscript\scripts directory.Then copy and paste exactly what @Nick-Brown posted.
Whitespace is important for python!!!
Restart Npp -> doneIf you want to edit an existing script, hold down the CTRL key while clicking on the script and it will open in the editor instead of running.
EDIT: as first line put in
from Npp import editor1, editor2
-
@ekopalypse said in Call Tip Color change:
If you want to edit an existing script, hold down the CTRL key while clicking on the script and it will open in the editor instead of running.
WHAT - !?!? I’m learning quite a bit from this thread!
Cheers.
-
:-D - I have to admit it took me a while to find this in another thread too.
Seems to be a hidden gem :-) -
Thanks for helping. Unfortunately, the only result that happened earlier with the old startup, is that when I tried the calltip, it wouldn’t show. I rebooted NPP, read your last messsage, did that, and now I have two scripts in the menu.
Wish I’d seen your last tip sooner about how to edit it. :-). I had to go into the directory and get it prior to the post. I tried in Config to remove the extra from the menu, to no effect. It won’t let me remove it. Soo…I soldier on, will try a few more of your things and see what happens. :-(
Lee
-
You can call it startup.py because it automatically adds a [user] tag, but another name is just as good, but then you always have to start it manually. Only startup.py files are executed as soon as npp reports readiness to the plugin.
Have you checked in the console whether an error is displayed? -
@ekopalypse said in Call Tip Color change:
Have you checked in the console whether an error is displayed?
Yes I have, and unless it’s invisible, no error. :-)
Here’s what I have, so we’re on the same page. I put the import in, you suggested, I have the section Nick Brown suggested and this is what I have in screenshot so you can see the file as is:
I can get a screenshot of the console, if need be, but here is the result in my files using the Calltip with the settings that Nick has supplied, which I presume to be black text on a mild yellow background, per the r,g,b numbers:
As you can see, the default light gray on bright white.
I have to figure I’ve done something wrong, but what, I have no idea and am all ears. :-)
Lee
-
and after you saved it you restarted Npp?
-
is that now a new startup.py located in the plugins\config\pythonscript\scripts directory or the original from plugins\pythonscript\scripts directory?
-
@ekopalypse said in Call Tip Color change:
and after you saved it you restarted Npp?
Yes sir. After doing something like this, I usually reboot and restart in Admin mode in case I need to make changes and save the files. I just did it again, to be sure, and tried using the call tip again. I do have install on startup, so there should be no issue with it being loaded, as far as I can tell. Here’s a shot:
Lee
-
Is LAZY or ATSTARTUP set in the config?
-
@ekopalypse said in Call Tip Color change:
Is LAZY or ATSTARTUP set in the config?
ATSTARTUP. Else the console wouldn’t be shown, right? Now if it’s not loading the startup.py, that could be a problem, but not sure how to tell. The console is coming up and my assumption is that the startup.py is also starting up. Would that be an accurate assumption?
Lee
-
No, the console will(should) open always. Gimme a sec to test something.
-
@ekopalypse ,
Ok. Here’s a screenshot of my config Machine view:I can do what ever you suggest, if I am setup right. That is the question we’re looking at. :-)
Lee
-
-
I have no idea and am all ears.
One thing I do in my user
startup.py
(and could be done in the systemstartup.py
as well) is to add console writes to the beginning and end of the scriptexample user
startup.py
from Npp import * import sys console.write("Start of user startup.py\n") ... ... other commands here ... console.write("END of user startup.py\n\n")
If I see those two lines printed, then I know that the user
startup.py
actually ran; if they aren’t printed, then something went wrong.…
While I was typing this, there were more exchanges.
I usually reboot and restart in Admin mode
Reboot is unecessary for Notepad++ and plugins. They will do the same thing after reboot as after a complete exit and restart.
Do you mean “Run as Admin”, or do you mean you log in as the Administrator user after your reboot? Because the Administrator user will have a different
%AppData%
than your normal user, so the userstartup.py
won’t be in the right place.Also, you should really look at your Plugins > Python Script > Configuration like Eko showed:
If you have User Scripts selected and don’t see
startup.py
in the Scripts box (like Eko’s is empty), then you do not have any user scripts… which means, if you think you are editing the userstartup.py
like Eko suggested earlier, you are not. edit: if you’re intentionally just using systemstartup.py
, that is of course your perogative.At this point, showing us the screenshots of User Scripts and Machine Scripts, with
startup.py
visible in both (if they exist) would be great – oh, you’ve posted machine-scripts while I was writing this paragraph; along with the copy/paste of your current Debug Info , along with the exact location of thestartup.py
that you are editing. -
-
I “Run as Admin”, right click on starting NPP. I am in Admin mode, as far as I know, but still seem to have to open certain things “Run as Admin” when I want to save to admin only areas with applications. I could be wrong, however and it would be the first time. :-)
First debug info:
- Notepad++ v8.1.9.3 (64-bit)
- Build time : Dec 6 2021 - 19:21:37
- Path : C:\Program Files\Notepad++\notepad++.exe
- Command Line :
- Admin mode : ON
- Local Conf mode : OFF
- Cloud Config : OFF
- OS Name : Windows 10 Home (64-bit)
- OS Version : 2009
- OS Build : 19043.1466
- Current ANSI codepage : 1252
- Plugins : ComparePlugin.dll mimeTools.dll NppConverter.dll NppExport.dll NppXmlTreeviewPlugin.dll PythonScript.dll XMLTools.dll
This is the Config User Script section:
And this is the file location on the Header bar showing the path to the current file:
Lee