Category Archives: PyPN

Programmer’s Notepad - Calculator Part 2

This time we’re going to use a PyPN script to evaluate maths expressions. We’re cheating a little, because we’re just going to ask python to evaluate a string and get a number back out.

import pn, scintilla

@script(”Calculator”)
def DoMaths():
s = scintilla.Scintilla(pn.CurrentDoc())

if s.SelectionEnd - s.SelectionStart < 1:
[...]

Programmer’s Notepad - a Calculator?!

One of the recent feature requests for Programmer’s Notepad was to add the ability in PN to perform basic numeric conversions, e.g. decimal to hex. Also the ability to evaluate simple mathematical expressions like 2+3=.
With the PyPN extension this is very easy, and the required features can even be bound to keyboard shortcuts.
Number Conversions:
The first [...]

Build 667 and PyPN 0.5

A new development build is available on Sourceforge, get it here:
Download PN 2.0.7.667
Also: Zip Distribution | Portable Edition Zip
This build introduces the global scheme management changes that have been promised for a long time. This means that (where the schemes have been updated already) you can change a single colour and have keywords, numbers, properties [...]

Tabs to Spaces with PyPN

Want to convert your tabs to spaces and annoyed that your editor author hasn’t implemented that feature in a handy menu item yet?
Add a PyPN script to do it:
import pn
import scintilla
from pypn.decorators import script

def SetTarget(e, x, y):
e.TargetStart = x
e.TargetEnd = y

@script(”Tabs to Spaces”, “Text”)
def TabsToSpaces():
editor = scintilla.Scintilla(pn.CurrentDoc())

tabSpaces = editor.TabWidth
spaces = “”
for x in range(tabSpaces):
spaces = [...]

PyPN: Upload to FTP

Over in the forums, MurphyMc shows a sample bit of script that will upload your current file to FTP using Python via a PyPN script. It currently hard-codes site/user/pass etc. but these could easily be retrieved from elsewhere (potentially even project properties in the future).
Save To FTP Script
It’s easy to imagine how this could be [...]

PyPN: Validate Your Xml

Have you tried playing with PyPN and PN’s scripts system yet? If not, then perhaps you should. A large number of requests on PN’s Feature Requests tracker could be implemented as scripts. Some perhaps not so elegantly as if they were built in, others perfectly.
To start looking at ways that PyPN enhances Programmer’s Notepad, let’s [...]

PN 2.0.7.610 and PyPN 0.3 Released

I’m pleased to announce that the current development build on SourceForge of PN 2 is now 2.0.7.610 which contains just minor fixes from .609 to make working with extensions better. PyPN 0.3 adds a number of features over the first two releases and also several bugfixes.
Download PN 2.0.7.610
Download PyPN 0.3
Remember you’ll need Python 2.4 installed [...]

Announcing pyPN-0.1

I finally got some time to clean up and zip up the current pyPN bits and have uploaded them to the web site:
http://www.pnotepad.org/files/pypn-0.1.zip
You will need the latest development build of PN (2.0.7.608 at the time of writing) and Python 2.4 to use this.
What is pyPN?
pyPN is the first extension for Programmer’s [...]

PyPN

I’m making progress with the Python scripting system, and am getting close to releasing a new testing build that has this functionality enabled. This won’t be for the weak of heart because I suspect there will be all sorts of problems to iron out.
Adding a new python script to be run is easy, there is [...]