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
7981ce57
Kaydet (Commit)
7981ce57
authored
Haz 11, 2002
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add a version of GvR's q&d python idle printing patch,
slightly tweaked and modified for the idlefork config system
üst
55ad7f84
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
3 deletions
+51
-3
Bindings.py
Lib/idlelib/Bindings.py
+2
-0
IOBinding.py
Lib/idlelib/IOBinding.py
+43
-2
config-keys.def
Lib/idlelib/config-keys.def
+3
-1
config-main.def
Lib/idlelib/config-main.def
+2
-0
configHandler.py
Lib/idlelib/configHandler.py
+1
-0
No files found.
Lib/idlelib/Bindings.py
Dosyayı görüntüle @
7981ce57
...
...
@@ -30,6 +30,8 @@ menudefs = [
(
'Save _As...'
,
'<<save-window-as-file>>'
),
(
'Save Co_py As...'
,
'<<save-copy-of-window-as-file>>'
),
None
,
(
'_Print window'
,
'<<print-window>>'
),
None
,
(
'_Close'
,
'<<close-window>>'
),
(
'E_xit'
,
'<<close-all-windows>>'
),
]),
...
...
Lib/idlelib/IOBinding.py
Dosyayı görüntüle @
7981ce57
...
...
@@ -6,9 +6,11 @@
# which will only understand the local convention.
import
os
import
tempfile
import
tkFileDialog
import
tkMessageBox
import
re
from
configHandler
import
idleConf
#$ event <<open-window-from-file>>
#$ win <Control-o>
...
...
@@ -22,6 +24,10 @@ import re
#$ win <Alt-s>
#$ unix <Control-x><Control-w>
#$ event <<print-window>>
#$ win <Control-p>
#$ unix <Control-x><Control-p>
#$ event <<save-copy-of-window-as-file>>
#$ win <Alt-Shift-s>
#$ unix <Control-x><w>
...
...
@@ -38,13 +44,15 @@ class IOBinding:
self
.
save_as
)
self
.
__id_savecopy
=
self
.
text
.
bind
(
"<<save-copy-of-window-as-file>>"
,
self
.
save_a_copy
)
self
.
__id_print
=
self
.
text
.
bind
(
"<<print-window>>"
,
self
.
print_window
)
def
close
(
self
):
# Undo command bindings
self
.
text
.
unbind
(
"<<open-window-from-file>>"
,
self
.
__id_open
)
self
.
text
.
unbind
(
"<<save-window>>"
,
self
.
__id_save
)
self
.
text
.
unbind
(
"<<save-window-as-file>>"
,
self
.
__id_saveas
)
self
.
text
.
unbind
(
"<<save-copy-of-window-as-file>>"
,
self
.
__id_savecopy
)
self
.
text
.
unbind
(
"<<print-window>>"
,
self
.
__id_print
)
# Break cycles
self
.
editwin
=
None
self
.
text
=
None
...
...
@@ -187,7 +195,40 @@ class IOBinding:
tkMessageBox
.
showerror
(
"I/O Error"
,
str
(
msg
),
master
=
self
.
text
)
return
0
def
print_window
(
self
,
event
):
tempfilename
=
None
if
self
.
get_saved
():
filename
=
self
.
filename
else
:
filename
=
tempfilename
=
tempfile
.
mktemp
()
if
not
self
.
writefile
(
filename
):
os
.
unlink
(
tempfilename
)
return
"break"
platform
=
os
.
name
printPlatform
=
1
if
platform
==
'posix'
:
#posix platform
command
=
idleConf
.
GetOption
(
'main'
,
'General'
,
'print-command-posix'
)
command
=
command
+
" 2>&1"
elif
platform
==
'nt'
:
#win32 platform
command
=
idleConf
.
GetOption
(
'main'
,
'General'
,
'print-command-win'
)
else
:
#no printing for this platform
printPlatform
=
0
if
printPlatform
:
#we can try to print for this platform
command
=
command
%
filename
pipe
=
os
.
popen
(
command
,
"r"
)
output
=
pipe
.
read
()
.
strip
()
status
=
pipe
.
close
()
if
status
:
output
=
"Printing failed (exit status 0x
%
x)
\n
"
%
status
+
output
if
output
:
output
=
"Printing command:
%
s
\n
"
%
repr
(
command
)
+
output
tkMessageBox
.
showerror
(
"Print status"
,
output
,
master
=
self
.
text
)
else
:
#no printing for this platform
message
=
"Printing is not enabled for this platform:
%
s"
%
platform
tkMessageBox
.
showinfo
(
"Print status"
,
message
,
master
=
self
.
text
)
return
"break"
def
fixlastline
(
self
):
c
=
self
.
text
.
get
(
"end-2c"
)
if
c
!=
'
\n
'
:
...
...
Lib/idlelib/config-keys.def
Dosyayı görüntüle @
7981ce57
...
...
@@ -26,12 +26,13 @@ open-module=<Alt-Key-m>
open-new-window=<Control-Key-n>
open-window-from-file=<Control-Key-o>
plain-newline-and-indent=<Control-Key-j>
print-window=<Control-Key-p>
redo=<Control-Shift-Key-z>
remove-selection=<Key-Escape>
save-copy-of-window-as-file=<Alt-Shift-Key-s>
save-window-as-file=<Control-Shift-Key-s>
save-window=<Control-Key-s>
select-all=<
Alt
-Key-a>
select-all=<
Control
-Key-a>
toggle-auto-coloring=<Control-Key-slash>
undo=<Control-Key-z>
find=<Control-Key-f>
...
...
@@ -59,6 +60,7 @@ open-module=<Control-Key-x><Control-Key-m>
open-new-window=<Control-Key-x><Control-Key-n>
open-window-from-file=<Control-Key-x><Control-Key-f>
plain-newline-and-indent=<Control-Key-j>
print-window=<Control-x><Control-Key-p>
python-docs=<Control-Key-h>
python-context-help=<Control-Shift-Key-h>
redo=<Alt-Key-z> <Meta-Key-z>
...
...
Lib/idlelib/config-main.def
Dosyayı görüntüle @
7981ce57
...
...
@@ -28,6 +28,8 @@
[General]
editor-on-startup= 1
print-command-posix=lpr %s
print-command-win=start /min notepad /p %s
[EditorWindow]
width= 80
...
...
Lib/idlelib/configHandler.py
Dosyayı görüntüle @
7981ce57
...
...
@@ -507,6 +507,7 @@ class IdleConf:
'<<open-new-window>>'
:
[
'<Control-n>'
],
'<<open-window-from-file>>'
:
[
'<Control-o>'
],
'<<plain-newline-and-indent>>'
:
[
'<Control-j>'
],
'<<print-window>>'
:
[
'<Control-p>'
],
'<<redo>>'
:
[
'<Control-y>'
],
'<<remove-selection>>'
:
[
'<Escape>'
],
'<<save-copy-of-window-as-file>>'
:
[
'<Alt-Shift-s>'
],
...
...
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