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
a52bae75
Kaydet (Commit)
a52bae75
authored
Agu 21, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove usage of rexec in tkinter demo.
üst
3cabbeb0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
ss1.py
Demo/tkinter/guido/ss1.py
+13
-16
No files found.
Demo/tkinter/guido/ss1.py
Dosyayı görüntüle @
a52bae75
...
...
@@ -4,7 +4,6 @@ import os
import
re
import
sys
import
cgi
import
rexec
from
xml.parsers
import
expat
LEFT
,
CENTER
,
RIGHT
=
"LEFT"
,
"CENTER"
,
"RIGHT"
...
...
@@ -33,16 +32,16 @@ class Sheet:
def
__init__
(
self
):
self
.
cells
=
{}
# {(x, y): cell, ...}
self
.
rexec
=
rexec
.
RExec
()
m
=
self
.
rexec
.
add_module
(
'__main__'
)
m
.
cell
=
self
.
cellvalue
m
.
cells
=
self
.
multicellvalue
m
.
sum
=
sum
self
.
ns
=
dict
(
cell
=
self
.
cellvalue
,
cells
=
self
.
multicellvalue
,
sum
=
sum
,
)
def
cellvalue
(
self
,
x
,
y
):
cell
=
self
.
getcell
(
x
,
y
)
if
hasattr
(
cell
,
'recalc'
):
return
cell
.
recalc
(
self
.
rexec
)
return
cell
.
recalc
(
self
.
ns
)
else
:
return
cell
...
...
@@ -144,7 +143,7 @@ class Sheet:
self
.
reset
()
for
cell
in
self
.
cells
.
values
():
if
hasattr
(
cell
,
'recalc'
):
cell
.
recalc
(
self
.
rexec
)
cell
.
recalc
(
self
.
ns
)
def
display
(
self
):
maxx
,
maxy
=
self
.
getsize
()
...
...
@@ -164,7 +163,7 @@ class Sheet:
if
x
<=
0
or
y
<=
0
:
continue
if
hasattr
(
cell
,
'recalc'
):
cell
.
recalc
(
self
.
rexec
)
cell
.
recalc
(
self
.
ns
)
if
hasattr
(
cell
,
'format'
):
text
,
alignment
=
cell
.
format
()
assert
isinstance
(
text
,
str
)
...
...
@@ -317,7 +316,7 @@ class BaseCell:
Subclasses may but needn't provide the following APIs:
cell.reset() -- prepare for recalculation
cell.recalc(
rexec
) -> value -- recalculate formula
cell.recalc(
ns
) -> value -- recalculate formula
cell.format() -> (value, alignment) -- return formatted value
cell.xml() -> string -- return XML
"""
...
...
@@ -331,7 +330,7 @@ class NumericCell(BaseCell):
self
.
fmt
=
fmt
self
.
alignment
=
alignment
def
recalc
(
self
,
rexec
):
def
recalc
(
self
,
ns
):
return
self
.
value
def
format
(
self
):
...
...
@@ -372,7 +371,7 @@ class StringCell(BaseCell):
self
.
fmt
=
fmt
self
.
alignment
=
alignment
def
recalc
(
self
,
rexec
):
def
recalc
(
self
,
ns
):
return
self
.
text
def
format
(
self
):
...
...
@@ -398,13 +397,11 @@ class FormulaCell(BaseCell):
def
reset
(
self
):
self
.
value
=
None
def
recalc
(
self
,
rexec
):
def
recalc
(
self
,
ns
):
if
self
.
value
is
None
:
try
:
# A hack to evaluate expressions using true division
rexec
.
r_exec
(
"from __future__ import division
\n
"
+
"__value__ = eval(
%
s)"
%
repr
(
self
.
translated
))
self
.
value
=
rexec
.
r_eval
(
"__value__"
)
self
.
value
=
eval
(
self
.
translated
,
ns
)
except
:
exc
=
sys
.
exc_info
()[
0
]
if
hasattr
(
exc
,
"__name__"
):
...
...
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