May, 2008


28
May 08

Implementing Notepad’s .LOG Feature with PyPN

Notepad has a little-known feature where if you start a file with .LOG then every time the file is loaded the current date and time will be appended to the end of the file – allowing you to use a simple text file as a sort of diary.

A feature request came in for this and, pending a decision on whether to support it directly in Programmer’s Notepad, I decided to show how it could be implemented using the latest PyPN bits:

Updated: Fixed a couple of minor bugs thanks to Jeff Rivett:

import scintilla, pn, pypn.glue, time

oldDocLoad = pypn.glue.onDocLoad

def docLoad(doc):
    """ docLoad handler to implement notepad .LOG functionality"""

    # Get the edit component:
    s = scintilla.Scintilla(doc)

    # Get the first line:
    lineLength = s.LineLength(0)
    text = s.GetText(0, lineLength)

    # If we have .LOG then add a blank line and then the date and time
    if text.startswith(".LOG"):
        timestr = "\r\n\r\n" + time.asctime(time.localtime()) + "\r\n"
        s.AppendText(len(timestr), timestr)

        # Jump to the end of the document
        s.DocumentEnd()

    oldDocLoad(doc)

pypn.glue.onDocLoad = docLoad

Just drop this code in a file called dotlog.py under Programmer’s Notepad\scripts and you’ll have the .LOG functionality. This all uses the very latest 2.0.9 unstable bits and the related PyPN build.


28
May 08

Microsoft Source Analysis Released

My team at work uses a fantastic Visual Studio add-in called Source Analysis to ensure consistency in our C# code formatting, commenting and organisation.

Microsoft Source Analysis

Source Analysis has now been released for the whole world to use, for free! The free download is available at the MSDN Code Gallery:

Source Analysis at Code Gallery

There’s also a blog here:

Source Analysis Blog


28
May 08

Damien Guard’s Envy Code R Font Updated

Another update to Damien’s great coding font Envy Code R, now at preview 7. This time we get a bunch of hinting improvements (Damien paid big bucks for the software to do this, consider donating!) and improvements when the font is used with larger sizes. Envy Code R also contains all the box drawing characters so makes a good console font – Damien even includes a .reg file to set this up for you.

Here’s what it looks like editing some python code in Programmer’s Notepad 2.0.9 with the Murky theme:

Envy Code R - preview #7

Read more at Damien’s Blog


28
May 08

Programmer’s Notepad 2 0.9.794 Released

It’s time for a second 0.9 unstable release, bringing a number of bug fixes and new features:

  • Automatic Update Check – at launch Programmer’s Notepad checks in the background whether there is an update available and shows you a message if there is one.
  • Vista open and save dialogs are now used throughout when you’re running Vista, previous OS versions should be unaffected
  • Programmer’s Notepad is now marked as Vista-aware, meaning that reads and writes to Program Files and similar locations are no longer redirected to the Virtual Store.
  • Find in Files can now search all open files
  • PyPN update 0.9 fixes a couple of event handlers

The update check is a very commonly requested feature. The system understands the difference between stable and unstable releases so most users will only ever see stable updates.

Currently there’s no UI option to enable unstable update checks (there will be!) but you can enable them for yourself by setting this registry value (assuming you’re using a default PN install):

Key: HKEY_CURRENT_USER\Software\Echo Software\PN2\General Settings
Value (REG_DWORD): CheckForUnstableUpdates = 1

209

What else is new in the 0.9 series?

  1. File browser window
  2. Open files window
  3. New, far better regular expressions support (multiline is coming)
  4. More colour schemes (I’m currently using ZenBurn) and the base styles adapt better with the colour schemes
  5. New PyPN release with more event hooks
  6. More Vista control styling dotted around (when running on Vista!)

Downloads

Installer: http://pnotepad.googlecode.com/files/pn209794.exe
Zip: http://pnotepad.googlecode.com/files/pn209794.zip
Portable Zip: http://pnotepad.googlecode.com/files/portable-pn209794.zip
PyPN for Python 2.4: http://pnotepad.googlecode.com/files/pypn-0.9.794-py24.zip
PyPN for Python 2.5: http://pnotepad.googlecode.com/files/pypn-0.9.794-py25.zip