[wingide-users] script to generate HTML files for keymaps

Werner F. Bruhin werner.bruhin at free.fr
Wed Nov 14 03:11:13 EST 2012


Hi Mitchell,

On 13/11/2012 18:54, Mitchell L Model wrote:
> I just posted to http://wiki.wingware.com/ConvertKeymapsToHtml a modified version of a script originally written by Marcin Kasperski. The script reads the files in the Wing installation that define the keybindings for the various keyboard personalities and generates simple HTML files that list the bindings sorted by key. It also generates an HTML file for the bindings defined in the user's Wing preferences file. The generated HTML files are a useful reference for exploring the bindings provided by the keyboard personality you are using, as well as documentation of the ones you have overridden or added.
>
Sounds very interesting but for the moment I can't get it to run 
(Windows 7, WingIDE 4.1.9).

I did not have WINGHOME defined and got this exception:
TypeError: object of type 'NoneType' has no len()
File "c:\dev\aaWingTools\wing_keymap2html.py", line 145, in <module>
   report_keymap(keymap_name, KeymapFile.load(keymap_name))
File "c:\dev\aaWingTools\wing_keymap2html.py", line 51, in load
   obj = KeymapFile(keymap_name)
File "c:\dev\aaWingTools\wing_keymap2html.py", line 70, in __init__
   with open(os.path.join(keymap_location, fname)) as f:
File "c:\Python27\Lib\ntpath.py", line 96, in join
   assert len(path) > 0

Found that I need to set "keymap_location" at the beginning of the 
script - maybe enhance the exception to mention that and/or mention in 
on the wiki page.

After I changed it to the following I get this exception:
keymap_location = r"C:\Program Files (x86)\Wing IDE 4.1"  ??? Is this 
what is consider WINGHOME on Windows, i.e. WingIDE's program folder?

ConfigParser.NoSectionError: No section: 'user-preferences'
File "c:\dev\aaWingTools\wing_keymap2html.py", line 146, in <module>
   keymap = report_keymap('keymap.user', UserKeymap().load())
File "c:\dev\aaWingTools\wing_keymap2html.py", line 134, in load
   for key, value in evaluate(config.get('user-preferences', 
'gui.keymap-override')).items():
File "c:\Python27\Lib\ConfigParser.py", line 322, in get
   raise NoSectionError(section)

I don't have any custom key bindings (at least not yet), could that be 
the reason?

Werner




More information about the wingide-users mailing list