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
85e69650
Kaydet (Commit)
85e69650
authored
Eki 01, 1998
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed toggle b/w hex and decimal
üst
d344165f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
TypeinViewer.py
Tools/pynche/TypeinViewer.py
+21
-4
No files found.
Tools/pynche/TypeinViewer.py
Dosyayı görüntüle @
85e69650
...
...
@@ -39,9 +39,24 @@ class TypeinViewer:
# Hex/Dec
self
.
__hex
=
Checkbutton
(
self
.
__frame
,
text
=
'Hexadecimal'
,
variable
=
self
.
__hexp
)
variable
=
self
.
__hexp
,
command
=
self
.
__togglehex
)
self
.
__hex
.
grid
(
row
=
4
,
column
=
0
,
columnspan
=
2
,
sticky
=
W
)
def
__togglehex
(
self
,
event
=
None
):
rstr
=
self
.
__x
.
get
()
gstr
=
self
.
__y
.
get
()
bstr
=
self
.
__z
.
get
()
if
self
.
__hexp
.
get
():
# it was decimal and is now hex
apply
(
self
.
update_yourself
,
tuple
(
map
(
int
,
(
rstr
,
gstr
,
bstr
))))
else
:
# it was hex and is now decimal
red
=
string
.
atoi
(
rstr
,
16
)
green
=
string
.
atoi
(
gstr
,
16
)
blue
=
string
.
atoi
(
bstr
,
16
)
self
.
update_yourself
(
red
,
green
,
blue
)
def
__normalize
(
self
,
event
=
None
):
ew
=
event
.
widget
contents
=
ew
.
get
()
...
...
@@ -55,9 +70,11 @@ class TypeinViewer:
v
=
string
.
atoi
(
contents
)
except
ValueError
:
v
=
None
# if value is not legal, delete the last character and ring the bell
# if value is not legal, delete the last character inserted and ring
# the bell
if
v
is
None
or
v
<
0
or
v
>
255
:
contents
=
contents
[:
-
1
]
i
=
ew
.
index
(
INSERT
)
contents
=
contents
[:
i
-
1
]
+
contents
[
i
:]
ew
.
bell
()
elif
self
.
__hexp
.
get
():
contents
=
hex
(
v
)
...
...
@@ -86,7 +103,7 @@ class TypeinViewer:
if
self
.
__hexp
.
get
():
redstr
,
greenstr
,
bluestr
=
map
(
hex
,
(
red
,
green
,
blue
))
else
:
redstr
,
greenstr
,
bluestr
=
map
(
int
,
(
red
,
green
,
blue
))
redstr
,
greenstr
,
bluestr
=
red
,
green
,
blue
self
.
__x
.
delete
(
0
,
END
)
self
.
__y
.
delete
(
0
,
END
)
self
.
__z
.
delete
(
0
,
END
)
...
...
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