I've made some modifications to PythonWin's Grep functionality. At first I just wanted to add highlighting for the regex matches, but I guess I got carried away. :b I'll eventually submit it to SourceForge, so that Mark may include it in the official release if he wants. In the meantime, here's the current version: http://www.mediafire.com/file/mmjntzmjwmm/sgrepmdi.py

To test it, replace "pythonwin\pywin\framework\sgrepmdi.py". If anyone's got any more suggestions, fire away.

Here's a list of the changes so far:
   Functionality:
   - added match highlighting
   - replaced editboxes with combos to store MRU items
   - added keyboard handling:
     - Enter opens match (same as double-click)
     - AppMenu opens context menu (same as right-click)
   - added support for registry root key shorthands ('HKLM', 'HKCU', etc.)
   - added folder selection via common dlg
   - changed settings INI location to %AppData%;
originally it defaulted to %WinDir% which wouldn't allow writing in Vista
   - made richedit control readonly
   Code & UI:
   - added a couple of comments, docstrings, and constants
   - added SearchOptions, PathSet, IniFile
   - replaced list-based dir/file/mask traversal with a generator
   - added msgboxes for Open/Save errors
   - added specific types to except clauses
- replaced glob() with os.listdir() (glob() chokes on dirnames with square brackets)
   - replaced 'MS Sans Serif' dlg font with 'MS Shell Dlg'
   - tweaked dlg layouts and added a couple of icons
   BUGS:
- setting text format is off by 1 sometimes (e.g. XP vs. Vista); maybe richedit EOL related
   - saved results file has junk at the end and uses \n as EOL
   - dirs and files are not generated in sorted order
- context menu should be shown over the richedit cursor (not the mouse) when opened with the keyboard
   - right-clicking should move the caret before showing the context menu
   TODO:
   - tweak "More" dialog and rename to "Favorites"
   - keyboard: make Delete remove whole match line
- add options for fonts, colors, regex (e.g. highlight all matches, not just first)
   - test on Python 3

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to