Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
808fa499
Kaydet (Commit)
808fa499
authored
Haz 02, 1999
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes by Mark Hammond to allow using IDLE extensions in PythonWin as
well: make three dialog routines instance variables.
üst
d395aeea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
AutoIndent.py
Tools/idle/AutoIndent.py
+10
-9
No files found.
Tools/idle/AutoIndent.py
Dosyayı görüntüle @
808fa499
import
string
import
string
from
Tkinter
import
TclError
#
from Tkinter import TclError
import
tkMessageBox
#
import tkMessageBox
import
tkSimpleDialog
#
import tkSimpleDialog
# The default tab setting for a Text widget, in average-width characters.
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT
=
8
TK_TABWIDTH_DEFAULT
=
8
...
@@ -121,6 +121,7 @@ class AutoIndent:
...
@@ -121,6 +121,7 @@ class AutoIndent:
num_context_lines
=
50
,
500
,
5000000
num_context_lines
=
50
,
500
,
5000000
def
__init__
(
self
,
editwin
):
def
__init__
(
self
,
editwin
):
self
.
editwin
=
editwin
self
.
text
=
editwin
.
text
self
.
text
=
editwin
.
text
def
config
(
self
,
**
options
):
def
config
(
self
,
**
options
):
...
@@ -170,7 +171,7 @@ class AutoIndent:
...
@@ -170,7 +171,7 @@ class AutoIndent:
try
:
try
:
first
=
text
.
index
(
"sel.first"
)
first
=
text
.
index
(
"sel.first"
)
last
=
text
.
index
(
"sel.last"
)
last
=
text
.
index
(
"sel.last"
)
except
TclError
:
except
:
# Was catching TclError, but this doesnt work for
first
=
last
=
None
first
=
last
=
None
if
first
and
last
:
if
first
and
last
:
text
.
delete
(
first
,
last
)
text
.
delete
(
first
,
last
)
...
@@ -197,7 +198,7 @@ class AutoIndent:
...
@@ -197,7 +198,7 @@ class AutoIndent:
try
:
try
:
first
=
text
.
index
(
"sel.first"
)
first
=
text
.
index
(
"sel.first"
)
last
=
text
.
index
(
"sel.last"
)
last
=
text
.
index
(
"sel.last"
)
except
TclError
:
except
:
# Was catching TclError, but this doesnt work for
first
=
last
=
None
first
=
last
=
None
text
.
undo_block_start
()
text
.
undo_block_start
()
try
:
try
:
...
@@ -230,7 +231,7 @@ class AutoIndent:
...
@@ -230,7 +231,7 @@ class AutoIndent:
try
:
try
:
first
=
text
.
index
(
"sel.first"
)
first
=
text
.
index
(
"sel.first"
)
last
=
text
.
index
(
"sel.last"
)
last
=
text
.
index
(
"sel.last"
)
except
TclError
:
except
:
# Was catching TclError, but this doesnt work for
first
=
last
=
None
first
=
last
=
None
text
.
undo_block_start
()
text
.
undo_block_start
()
try
:
try
:
...
@@ -374,7 +375,7 @@ class AutoIndent:
...
@@ -374,7 +375,7 @@ class AutoIndent:
self
.
set_region
(
head
,
tail
,
chars
,
lines
)
self
.
set_region
(
head
,
tail
,
chars
,
lines
)
def
toggle_tabs_event
(
self
,
event
):
def
toggle_tabs_event
(
self
,
event
):
if
tkMessageBox
.
askyesno
(
if
self
.
editwin
.
askyesno
(
"Toggle tabs"
,
"Toggle tabs"
,
"Turn tabs "
+
(
"on"
,
"off"
)[
self
.
usetabs
]
+
"?"
,
"Turn tabs "
+
(
"on"
,
"off"
)[
self
.
usetabs
]
+
"?"
,
parent
=
self
.
text
):
parent
=
self
.
text
):
...
@@ -390,7 +391,7 @@ class AutoIndent:
...
@@ -390,7 +391,7 @@ class AutoIndent:
return
"break"
return
"break"
def
change_indentwidth_event
(
self
,
event
):
def
change_indentwidth_event
(
self
,
event
):
new
=
tkSimpleDialog
.
askinteger
(
new
=
self
.
editwin
.
askinteger
(
"Indent width"
,
"Indent width"
,
"New indent width (1-16)"
,
"New indent width (1-16)"
,
parent
=
self
.
text
,
parent
=
self
.
text
,
...
@@ -448,7 +449,7 @@ class AutoIndent:
...
@@ -448,7 +449,7 @@ class AutoIndent:
text
.
undo_block_stop
()
text
.
undo_block_stop
()
def
_asktabwidth
(
self
):
def
_asktabwidth
(
self
):
return
tkSimpleDialog
.
askinteger
(
return
self
.
editwin
.
askinteger
(
"Tab width"
,
"Tab width"
,
"Spaces per tab?"
,
"Spaces per tab?"
,
parent
=
self
.
text
,
parent
=
self
.
text
,
...
...
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