Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fb6bc00d
Commit
fb6bc00d
authored
Jul 06, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use self.text -- it's self now!
parent
a659c7e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
Demo/tkinter/guido/ManPage.py
Demo/tkinter/guido/ManPage.py
+18
-18
No files found.
Demo/tkinter/guido/ManPage.py
View file @
fb6bc00d
...
@@ -23,9 +23,9 @@ class EditableManPage(ScrolledText):
...
@@ -23,9 +23,9 @@ class EditableManPage(ScrolledText):
ScrolledText
.
__init__
(
self
,
master
,
cnf
)
ScrolledText
.
__init__
(
self
,
master
,
cnf
)
# Define tags for formatting styles
# Define tags for formatting styles
self
.
t
ext
.
t
ag_config
(
'bold'
,
{
'font'
:
BOLDFONT
})
self
.
tag_config
(
'bold'
,
{
'font'
:
BOLDFONT
})
self
.
t
ext
.
t
ag_config
(
'italic'
,
{
'font'
:
ITALICFONT
})
self
.
tag_config
(
'italic'
,
{
'font'
:
ITALICFONT
})
self
.
t
ext
.
t
ag_config
(
'underline'
,
{
'underline'
:
1
})
self
.
tag_config
(
'underline'
,
{
'underline'
:
1
})
# Create mapping from characters to tags
# Create mapping from characters to tags
self
.
tagmap
=
{
self
.
tagmap
=
{
...
@@ -37,9 +37,9 @@ class EditableManPage(ScrolledText):
...
@@ -37,9 +37,9 @@ class EditableManPage(ScrolledText):
# Parse nroff output piped through ul -i and append it to the
# Parse nroff output piped through ul -i and append it to the
# text widget
# text widget
def
parsefile
(
self
,
fp
):
def
parsefile
(
self
,
fp
):
save_cursor
=
self
.
text
[
'cursor'
]
save_cursor
=
self
[
'cursor'
]
self
.
text
[
'cursor'
]
=
'watch'
self
[
'cursor'
]
=
'watch'
self
.
text
.
update
()
self
.
update
()
ok
=
0
ok
=
0
empty
=
0
empty
=
0
nextline
=
None
nextline
=
None
...
@@ -80,15 +80,15 @@ class EditableManPage(ScrolledText):
...
@@ -80,15 +80,15 @@ class EditableManPage(ScrolledText):
j
=
i
j
=
i
p
=
propline
[
i
]
p
=
propline
[
i
]
self
.
insert_prop
(
line
[
j
:])
self
.
insert_prop
(
line
[
j
:])
self
.
text
[
'cursor'
]
=
save_cursor
self
[
'cursor'
]
=
save_cursor
def
insert_prop
(
self
,
str
,
prop
=
' '
):
def
insert_prop
(
self
,
str
,
prop
=
' '
):
here
=
self
.
text
.
index
(
AtInsert
())
here
=
self
.
index
(
AtInsert
())
self
.
text
.
insert
(
AtInsert
(),
str
)
self
.
insert
(
AtInsert
(),
str
)
for
tag
in
self
.
tagmap
.
values
():
for
tag
in
self
.
tagmap
.
values
():
self
.
t
ext
.
t
ag_remove
(
tag
,
here
,
AtInsert
())
self
.
tag_remove
(
tag
,
here
,
AtInsert
())
if
self
.
tagmap
.
has_key
(
prop
):
if
self
.
tagmap
.
has_key
(
prop
):
self
.
t
ext
.
t
ag_add
(
self
.
tagmap
[
prop
],
here
,
AtInsert
())
self
.
tag_add
(
self
.
tagmap
[
prop
],
here
,
AtInsert
())
# Readonly Man Page class -- disables editing, otherwise the same
# Readonly Man Page class -- disables editing, otherwise the same
class
ReadonlyManPage
(
EditableManPage
):
class
ReadonlyManPage
(
EditableManPage
):
...
@@ -98,13 +98,13 @@ class ReadonlyManPage(EditableManPage):
...
@@ -98,13 +98,13 @@ class ReadonlyManPage(EditableManPage):
EditableManPage
.
__init__
(
self
,
master
,
cnf
)
EditableManPage
.
__init__
(
self
,
master
,
cnf
)
# Make the text readonly
# Make the text readonly
self
.
text
.
bind
(
'<Any-KeyPress>'
,
self
.
modify_cb
)
self
.
bind
(
'<Any-KeyPress>'
,
self
.
modify_cb
)
self
.
text
.
bind
(
'<Return>'
,
self
.
modify_cb
)
self
.
bind
(
'<Return>'
,
self
.
modify_cb
)
self
.
text
.
bind
(
'<BackSpace>'
,
self
.
modify_cb
)
self
.
bind
(
'<BackSpace>'
,
self
.
modify_cb
)
self
.
text
.
bind
(
'<Delete>'
,
self
.
modify_cb
)
self
.
bind
(
'<Delete>'
,
self
.
modify_cb
)
self
.
text
.
bind
(
'<Control-h>'
,
self
.
modify_cb
)
self
.
bind
(
'<Control-h>'
,
self
.
modify_cb
)
self
.
text
.
bind
(
'<Control-d>'
,
self
.
modify_cb
)
self
.
bind
(
'<Control-d>'
,
self
.
modify_cb
)
self
.
text
.
bind
(
'<Control-v>'
,
self
.
modify_cb
)
self
.
bind
(
'<Control-v>'
,
self
.
modify_cb
)
def
modify_cb
(
self
,
e
):
def
modify_cb
(
self
,
e
):
pass
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment