DrPython: Help



Welcome to the DrPython documentation.

Written By: Daniel Pozmanter (drpython@bluebottle.com)

Copyright 2003-2004 Daniel Pozmanter

Utilizing:
   Python (Guido van Rossum et al.),
   wxPython (Robin Dunn),
   wxWidgets (Julian Smart et al.),
   Scintilla (Neil Hodgson).

Icons From:
   Klassic New Crisp Icons (Asif Ali Rizwaan),
   Sparkling (Flow)
   Noia (Carles Carbonell Bernado)
   Nuvola (David Vignoni)
   (Some Icons Were Either Created or Edited by Daniel Pozmanter.)

Table of Contents:

Introduction
Donate!

GNU General Public License

Credits
Thanks
North Star (Learn More, Help Out)

Installation
Support

Bookmarks
DrScript
Find/Replace
Find And Complete
Indentation and Tabs
Keyboard Shortcuts
Line Endings
Menu and Focus (Toggling)
Plugins
Pop Up Menu
Preferences
RegularExpressions
Running a Python Program
Shell Commands
StatusBar
ToolBar
Tracebacks


Notes



Introduction:

Just what is DrPython?

To start with, DrPython is a Development Environment.  It is essentially a text editor
with built in programming tools, like an integrated prompt, text manipulation, and syntax highlighting to name a few.
The intergrated prompt means when you run a python program, DrPython catches the output, takes input, and in general behaves like a console window (cmd.exe or rxvt for example).

DrPython was designed to be a cross-platform Python IDE.  The primary purpose was
for use in Education, to make teaching Python programming easier.
It was originally designed based roughly on DrScheme. 
DrPython is meant to play the same role for Python that DrScheme plays for scheme.

The development platform is Linux (Mandrake 9.2 is the current flavor)
It has been tested on various flavors of Linux (E.g. Mandrake, Debian), Windows 9x, Windows NT, Windows XP,
and Mac OS X.

Any platform which supports python 2.3+ and wxPython 2.5.1+ should work.

Is DrPython Free or What?

DrPython is both free and open source software.  This means you can download
DrPython for free, share it as much as you want, look through the source, whatever.
You can even take chunks of code and plop them into your own program
(so long as you give proper credit!).  You could even start your own
branch of drpython, or rewrite to code to work with another language.

The point of Free/Open Source Software is that the user has the power to
use their software as they wish.

The bummer side of this is that DrPython has no warranty.  So
if after using DrPython your computer becomes telekinetic and
blows up your refridgerator...You can send me a bug report.

DrPython is released under the GNU Public License.

DONATE!

If you want to show support for DrPython,send a donation our
way.  A single dollar would be delicious and nutritious:

Donate to Daniel Pozmanter

Donate to North Star


Back to the Top



Installation:

If you are reading this, DrPython should already be installed.
That being said, you need the following programs to run DrPython:
Python 2.0 or newer (tested with 2.2) and the corresponding wxPython.
It is really best to get the lastest version of Python and wxPython.

If you are having trouble running DrPython on Linux/Unix,
run the file drpython.lin,
or edit the first line of drpython.pyw or drpython.py to read:

#![ PATH TO PYTHON ]/python

(eg: #!/usr/bin/python)
(In other words, make the path absolute)

If you are still having trouble, go to the DrPython website
(http://www.sourceforge.net/projects/drpython/) and post to the help forum.


Back to the Top



Support:

Found a bug?  Want to see something change?  Have a feature request?
Stop by the DrPython Sourceforge Project Page.
Post in the forum, or formally submit a bug/feature request.
I highly recommend starting a discussion on possible features/changes.
Part of the power of open source is the power of the users and developers
to engage in discourse about a project, its design and its uses.

Back to the Top


Bookmarks:

Bookmarks are pretty straighforward:
There are Bookmarks,
and there are Bookmark Folders.

A Bookmark is either a file or directory.
When it is selected from the menu,
if it is a file, it is opened.
If it is a directory, an Open Dialog
in that directory pops up.

A Bookmark Folder may contain Bookmarks and/or Bookmark Folders.

You can only add a Bookmark Folder or Bookmark to a Bookmark Folder.

To Move a Bookmark or a Bookmark Folder (and all it's contents):
Single click on the item you want to move.
Drag it to the item you want it to go immediately after.
Dragging it to the any item in a folder will cause it to be added
directly after that item.
Dragging it to a folder will cause it to be the first item in that folder.

Back to the Top


Find/Replace:

This is a rather standard/straightforward dialog.
However there are some things that stick out.

Right clicking on the text field will yield a pop up
menu.  You can insert tab/newline/carraige returns,
perform clipboard operations, or clear the text.

You can also access Find/Replace History
via the pop up menu.

Back to the Top


Find And Complete:

This is a user initiated version of auto complete.
DrPython will search the current file for possible
completions to the word you are currently typing.
It will display these results in a small window.
Navigate by using the up and down arrows,
or to go faster, page up and page down to go faster,
or home and end to skip to the start and end of the list.

Hitting Enter or Tab will complete the current word
with the selection.

Context Sensitive:  Find And Complete stops
at the following characters (in addition to whitespace):
( ) < > [ ] { }
This means:
tree
dog(treat)

dogs

dog(tre

searching at "dog(tre" will yield:
"tree, treat".

However:

tree
dog(treat

dogs

dog(

searching at "dog(" will yield:
"dog(treat, dogs"

Note:  Find And Complete is case sensitive.

Back to the Top


Indentation and Tabs:

The "Use Tabs" option under "Document" in preferences tells DrPython
whether to use tabs (default) or spaces for autoindentation.
"Tab Width"  under "General" is how many spaces DrPython
should consider a "Tab" to be.

To see what characters the current document
uses for indentation, check the statusbar.

The "Whitespace" menu has entries that allow you
to set indentation to tabs or spaces.  Setting the
indentation for the document to tabs, for example,
will replace a set number of spaces with tabs.
This operation takes place at the beginning of each line.

Some programmers prefer (or were taught)
to use tabs ('\t') to indent blocks of code.  Some use spaces instead.

The whitespace menu let's you easily switch the type of
indentation used in the current file to the type you prefer to work with.

Note:  The ClassBrowser only works properly if the current file is
using the same type of indentation (tab character or spaces)
as is set as the default for DrPython in prefs.
DrPython will automatically check for this
when you open the Class Browser.
To fix a mixed file, use the
"Whitespace" menu under "Edit".

NOTE:  If the line endings are mixed, drpython
will not be able to properly fix the indentation.
Always set the line endings before setting
the indentation type.

Back to the Top


Keyboard Shortcuts:

You can set shortcuts by selecting "Customize Shortcuts"
from the Options menu.

Ignore Keys ignores the modifier keys listed.
Only modifier keys are valid.  This is primarily for operating systems
such as linux, where the "Meta" key is set to "num lock" by default,
and hence may always be on. 

Note: You can set shortcuts for DrScript menu items.
If you have not, or the shortcuts file is somehow out of sync
with the actual number of DrScripts, DrPython will simply
load the correct DrScripts, with no default shortcuts.
DrScript Shortcuts are stored separately from DrPython
Shortcuts.

If your shortcuts are not working, use "get key"
on a shortcut to see if a modifier key is constantly present.
On linux, "Meta" may be present.  If this is the case,
use "Ignore Keys" to set "Meta" as a key to ignore.

For a given shortcut, simply click the "Get Key" Button,
and press the keys you wish.  It will print the
modifiers detected, and the keycode.
When you are done, hit "Close", and the keystring
will be next to the shortcut.

Select "Update" to start using the key now.
Select "Save" to have DrPython remember the changes.

Note:  On some platforms some keys may not register,
and thus cannot be used as shortcuts.

The Defaults Are:

Ctrl + n :
Ctrl + o :
Ctrl + s :

F9:
F10:

F7 :                    
Ctrl + e :
Ctrl + d :

Ctrl + r :
Ctrl + f :
F3 :
Shift + F3:
Ctrl + g :

Ctrl + <Enter>

F6 :
F5 :
Ctrl + b
Ctrl + w

Ctrl + p :
Ctrl + Shift + p :

Ctrl + [
Ctrl + ]
Ctrl + i
Ctrl + Shift + i

F8

Ctrl + a
Ctrl + Shift + a
Ctrl + z
Ctrl + y
Ctrl + x
Ctrl + c
Ctrl + p
Ctrl + +
Ctrl + -
Ctrl + Shift + u
Ctrl + u
New Window
Open File
Save File

Select Previous Tab
Select Next Tab

Open a Python Interpreter
Run Current Program
End Current Program/Python Interpreter

Replace
Find
Find Next
Find Previous
Go To Line

Find And Complete

Toggle View Prompt
Toggle Maximize
Toggle Source Browser
Toggle View Whitespace

Print File
Print Prompt

Comment
UnComment
Indent
Dedent

View Python Docs

Select All
Select None
Undo
Redo
Cut
Copy
Paste
Zoom In
Zoom Out
Uppercase
Lowecase


Back to the Top



Line Endings:

Unix Mode: "\n", End Line
Windows Mode: "\r\n", Carriage Return, End Line
Mac Mode: "\r", Carriage Return
Windows mode can make linux hiccup. So Unix Mode is
the default (Windows seems to be fine with it.)

Note: Setting the Line Endings in Preferences does not affect
the current open file!


Back to the Top



Menu And Focus (Toggling):

Some menu items act on the Text Control currently with focus.
Toggle Whitespace Visible is one such item.

If the focus is on the File text control, then selecting
this menu item will cause the whitespace
to either become visible or invisible in that control.

If the focus is on the prompt, then the whitespace
will be toggled in the prompt.


Back to the Top



Pop Up Menu:

The Pop Up Menu is the menu that pop's up when you
right click on the Document, or the Prompt.  You can
customize this menu to handle DrPython functions,
DrScripts, or Plugins.

Note that each item on the Pop Up Menu must have a distinct
name for everything to work properly.

Back to the Top



Regular Expressions:

It is best to consult the python documentation
(Under Modules, "re").

In Short, Regular Expressions provide a fast
and powerful method for matching patterns of
text.  These can be quite useful in programs
you write, or simply to find and/or replace
text in a given file.

Back to the Top



Running a Python Program:

Open a file, click run, and you are set to go.
If your program takes arguments, select "Set Arguments" from the menu or toolbar.

Note the right field in the status bar tells you if the program is running.
Also note that the "End" button is enabled, and "Run", "Set Arguments",
and "Python Debugger" are disabled.

When the program has ended, the right status bar field goes blank,
"End" is disabled, and "Run", "Set Arguments",
and "Python Debugger" are enabled.


Back to the Top


Shell Commands:

To add a shell command, go to the DrScript menu,
under Add Script, and select "Shell Command".

Back to the Top



StatusBar:

The StatusBar displays some useful information:

the left bar displays

(current line) (current column)  (line ending type)  (insert/overtype)  (indentation type)

the right bar displays program/python status (for example):

"Running Python Interpreter".


Back to the Top



ToolBar:

A few notes on customizing the toolbar:

1.  When selecting a particular icon for a toolbar item,
select the toolbar item from the left list ("Current List"),
then click the "Change" button for the icon size you want.

2.  If you specify an icon, this will be loaded instead of
the default, and instead of any icon file loaded.

3.  If you select an icon that is a different size than the
selected size (16x16, 24x24), the toolbar will not display correctly.

Back to the Top



Tracebacks:

Tracebacks are the output the python interpreter produces
for an unhandled exception.  This output:

    Traceback (most recent call last):
      File "/mnt/win_e/docs/prog/drpython/drpython-3.1.2/drpython.py", line 1840, in OnGoTo
        v = int(v) - 1
    ValueError: invalid literal for int(): line number

Is produced if you type "line number" into the Goto dialog.

Now, DrPython handles this exception.  However DrPython displays Tracebacks in
its error dialogs (if there are any) for the purposes of transparency.

This way, if there is a bug it is easier to report it, and
if you are working on a DrScript or a Plugin, this makes it
easier to figure out what is going on.


Back to the Top



Notes:

DrPython cannot handle everything.
There are two things which will cause odd behavior:

If you do not have permission to write to your user's home directory,
or the replacement directories drpython will try if
your home directory does not exist (eg. "c:" or os.environ["APPDATA"]),
then drpython will not save preferences, and will not
keep a recent files list.

If you run a program with an infinite loop, things will get rather slow.
Hit the "End" button on the toolbar, or hit Ctrl+D to end the program being run.

Please note that if you type the color in for the font style dialog: Any bad characters (not 0-9 or A-F), will create a warning the moment you enter them. If the string is not properly formated ('#' followed by 6 characters), the sliders will be disabled. Upon hitting OK, any invalid color string will be ignored, and DrPython will revert to the last value for that color string.


Back to the Top