]>
Commit | Line | Data |
---|---|---|
8fa876ca RD |
1 | # 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net) |
2 | # | |
3 | # o Updated for wx namespace | |
4 | # | |
5 | # 11/28/2003 - Jeff Grimmett (grimmtooth@softhome.net) | |
6 | # | |
7 | # o editor lib hasn't been hit by the renamer yet. | |
8 | # | |
9 | ||
10 | import wx | |
11 | import wx.lib.editor as editor | |
1b55cabf RD |
12 | |
13 | #---------------------------------------------------------------------- | |
14 | ||
15 | def runTest(frame, nb, log): | |
8fa876ca RD |
16 | win = wx.Panel(nb, -1) |
17 | ed = editor.wxEditor(win, -1, style=wx.SUNKEN_BORDER) | |
18 | box = wx.BoxSizer(wx.VERTICAL) | |
19 | box.Add(ed, 1, wx.ALL|wx.GROW, 1) | |
1b55cabf | 20 | win.SetSizer(box) |
1e4a197e | 21 | win.SetAutoLayout(True) |
1b55cabf RD |
22 | |
23 | ed.SetText(["", | |
24 | "This is a simple text editor, the class name is", | |
f0b0b7d4 | 25 | "wxEditor. Type a few lines and try it out.", |
1918b6f7 | 26 | "", |
8b9a4190 | 27 | "It uses Windows-style key commands that can be overridden by subclassing.", |
1918b6f7 RD |
28 | "Mouse select works. Here are the key commands:", |
29 | "", | |
30 | "Cursor movement: Arrow keys or mouse", | |
31 | "Beginning of line: Home", | |
32 | "End of line: End", | |
33 | "Beginning of buffer: Control-Home", | |
34 | "End of the buffer: Control-End", | |
35 | "Select text: Hold down Shift while moving the cursor", | |
36 | "Copy: Control-Insert, Control-C", | |
37 | "Cut: Shift-Delete, Control-X", | |
38 | "Paste: Shift-Insert, Control-V", | |
f0b0b7d4 | 39 | ""]) |
1b55cabf | 40 | |
1b55cabf RD |
41 | return win |
42 | ||
43 | #---------------------------------------------------------------------- | |
44 | ||
45 | ||
1918b6f7 RD |
46 | overview = """ |
47 | The wxEditor class implements a simple text editor using wxPython. You | |
48 | can create a custom editor by subclassing wxEditor. Even though much of | |
78e8819c | 49 | the editor is implemented in Python, it runs surprisingly smoothly on |
1918b6f7 | 50 | normal hardware with small files. |
1b55cabf | 51 | |
1918b6f7 RD |
52 | How to use it |
53 | ------------- | |
54 | The demo code (demo/wxEditor.py) shows how to use wxEditor as a simple text | |
55 | box. Use the SetText() and GetText() methods to set or get text from | |
56 | the component; these both use a list of strings. | |
57 | ||
58 | The samples/FrogEdit directory has an example of a simple text editor | |
59 | application that uses the wxEditor component. | |
60 | ||
61 | Subclassing | |
62 | ----------- | |
63 | To add or change functionality, you can subclass this | |
64 | component. One example of this might be to change the key | |
65 | Alt key commands. In that case you would (for example) override the | |
66 | SetAltFuncs() method. | |
1b55cabf | 67 | |
1b55cabf RD |
68 | """ |
69 | ||
70 | ||
71 | ||
6f48b1b5 RD |
72 | |
73 | if __name__ == '__main__': | |
74 | import sys,os | |
75 | import run | |
76 | run.main(['', os.path.basename(sys.argv[0])]) | |
77 |