File: editview.txt

package info (click to toggle)
python-wpy 0.53-0.1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 832 kB
  • ctags: 1,991
  • sloc: python: 8,624; makefile: 57; sh: 24
file content (76 lines) | stat: -rw-r--r-- 2,438 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class CEditView
__init__(self, templ, doc, frame)

Class CEditView is a view which supports interactive editing of its
contents.  An edit view displays multiple lines of text.  The edit
view controls its own drawing, so there is no OnDraw() message. An
edit view supports an insertion cursor and a selection.

Text is referenced by line number and by character number, both of which
start at zero.  The first character is line 0 character 0.  The insertion
cursor is at the character position following the cursor.  The selection
is from the first selected character to one past the last character.
For example, if line 123 is "012345678", and the insertion cursor is
between the "4" and "5", the position of the cursor is (123, 5).  If
"23456" is selected, the selection is (123, 2, 123, 7).

Instance Variables

wpyText, wpyChildList, wpySizeX/Y, wpyLocX/Y
wpy[HV]ScrollSize, wpy[HV]ScrollWinSize, wpy[HV]ScrollPos

wpyParent
	The parent of the view is the frame.

wpyDocument
	This is the document which this view is showing.

Methods

__init__(self, templ, doc, frame)
	The system creates the view, so the user never calls __init__
	directly.

Clear(self)
	Clear (delete) the current selection.

ClearAll(self)
	Clear (delete) the contents of the view.

EnableWindow(self, enabled)
	A disabled edit view is read-only.

GetLine(self, line_num), string
	Get the text at line "line_num".  Returns a string.  The
	line_num starts at zero, and is 0, 1, 2, ...

GetLineCount(self), int
	Return the number of lines in the view.  The minimum is 1.

GetSel(self), tuple
	Return the selection as the tuple (line1, char1, line2, char2).
	If there is no selection, return the position of the cursor
	as (line1, char1, line1, char1).

LineLength(self, line_num), int
	Return the length of the line at "line_num".

ReplaceSel(self, text)
	Replace the selection with "text".  If there is no selection,
	then insert "text" at the cursor.

SerializeIn(self, file)
	Read in the contents of the file object.

SerializeOut(self, file)
	Write the contents of the view to the file object.

SetSel(self, line1, char1, line2, char2)
	Set the selection.  If line1==line2 and char1==char2, then
	set the position of the cursor.

WpyAppend(self, text, newline)
	Write the string at the end of the edit view.  If newline is
	TRUE, add a line break after text.  The line break depends
	on the platform.  It is return/newline on Windows, and newline
	alone on Tk.