Textpad tooltips howto
Created by .
Last modified on 2003/08/01.
TextPad from Helios Software Solutions (http://textpad.com)
is an excellent tool for working with Python and Zope-files.
Besides support for text coloring of common Python and Zope syntaxes
it is possible to setup "Tools" that run a program or a script.
The output from such a execution can be conneced to a RegExp
that makes lines hyperlinks to Files and Lines according to
the output.
Use a python script (NEW):
I have updated this HowTo with a Python script that keeps
track on the last row read from the stupid log file.
It makes TextPad only show the last error message (the file is
context dependant so it shows the last message for the folder where
the current file (the currently active file in Textpad).
You find the script here
Here's how its done
- Configure -> Preferrences... (crtl-Q,P)
- Select "Tools" and "Add" -> DOSCommand (or select Program to run a python script)
- Enter "Stupid Log File" as the DOS Command (or select python.exe).
- Press "Apply".
- There should now be a item named "Stupid Log File" (or "Python") under the Tools item in the tree list. Select it.
- Replace "Stupid Log File" in Parameters with "type C:\mypath\to\stupidlogfile". (For the "ReadStupiedLogFile.py" python script see bellow)
- Make sure "Capture output" is check.
- Enter the following regular expression " File ["]\([^"]\)["],.line \([0-9]+\)"
- The RegEx above defines two group (filename and linenummer), to tell Textpad which is which, select Registers: File = 1 and Line = 2.
- Exit the dialog and look under Tools, there should be a "Stupid Log File" and it has a CTRL-? behide it. This is the accelator key.
- Either press the accelator key or select the menu to execute the tool.
- You will now get a new text document "Command Results", it should contain the content of you stupid log file and if the stupid log file contains traceback messages you should be able to click on them.
Use the following Python code to send traceback to the stupid log file:
from zLOG import LOG, ERROR
from sys import exc_info
LOG("Error", ERROR, "Error", error=exc_info())
ReadStupiedLogFile.py
Settings for ReadStupiedLogFile.py:
- Command: C:\EasyPublisher17\bin\python.exe
- Parameters: C:\EasyPublisher17\ReadStupidLogFile.py stupid_log_file=C:\EasyPublisher17\slf.log FILE=$File FILEDIR=$FileDir
(FILE and FILEDIR is optional, you don't need them. They are just there to illustrate how they can be used.)
- Initial Folder: $FileDir
- Capture Output: YES
- Save All Documents: YES
- Regular Expression: " File ["]\([^"]\)["],.line \([0-9]+\)" (without the surounding "-characters)
- Register: File: 1, Line: 2
Now there is probably allot of funky stuff that can be done with Textpad tools. For instance can get it to start python with current file as the script: Just add a new (Program) tool and as the progam use the path to the python.exe and as the parameters give it $File (an internal variabe in Textpad indicating the current file).
See the Textpad help file for more info.
|