On Apr 19, 2005, at 5:13 AM, Sells, Fred wrote:
> I use it and I edit (infrequently) outside the resource editor. When
> that
> happens, I use the resource editor to load and save to get it in sync.
> I
> have a very slight preference toward a separate module/script run from
> the
> command line. It would facilitate making the tool more robust and
> making it
> easier for users to customize to meet their needs.
As a general rule, my own preference is to not add a lot of extra
infrequently used menu items to any of the standard PythonCard tools.
As an alternative, I added "scriptlets" to the codeEditor a long time
ago, which are simply scripts of anything that can be run in the shell
and that could include a standard Python module along with a call to
run a particular function. There are some examples in the codeEditor
scriptlets directory such as insertDateAndTime.py
import time
now = time.localtime(time.time())
dateStr = time.strftime("%A, %B %d, %Y, %I:%M %p", now)
comp.document.ReplaceSelection(dateStr)
You can think of scriptlets as "macros" if you want and there is even
support in the codeEditor for making menu items that run these
scriptlets, it just isn't documented, nor is there a UI for managing
the menu, I just never seem to get around to writing it, even though it
is a minor amount of code and UI for the dialog. As an example, I have
the following line in my pythoncard_config\codeeditor\user.config.txt
file which menu item with Ctrl+1 as a shortcut in the Shell menu:
'macros': [{'filename':
'C:
\\python\\PythonCard\\tools\\codeEditor\\scriptlets\\insertDateAndTime.p
y', 'key: 'Ctrl+1', 'label': 'insertDateAndTime'}],
The line is just another key/value pair in the dictionary.
The reason I bring this up is that the resourceEditor should probably
have the same scriptlets support and with a dialog to easily allow
people to add and remove items from the menu you can have whatever
macros you want.
ka
|