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
9b1bfc88
Kaydet (Commit)
9b1bfc88
authored
Agu 16, 1991
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
minsize --> getminsize.
Added keyboard downcalls. (I mean keyboard focus policy and activate/deactivate)
üst
ce272986
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
18 deletions
+128
-18
Split.py
Lib/lib-stdwin/Split.py
+64
-9
Split.py
Lib/stdwin/Split.py
+64
-9
No files found.
Lib/lib-stdwin/Split.py
Dosyayı görüntüle @
9b1bfc88
# Generic Split implementation.
# Generic Split implementation.
# Use as a base class for other splits.
# Use as a base class for other splits.
# Derived classes should at least implement the methods that call
# Derived classes should at least implement the methods that call
# unimpl() below: minsize(), getbounds() and setbounds().
# unimpl() below:
get
minsize(), getbounds() and setbounds().
Error
=
'Split.Error'
# Exception
Error
=
'Split.Error'
# Exception
import
rect
import
rect
from
stdwinevents
import
*
class
Split
():
class
Split
():
#
#
...
@@ -20,7 +21,8 @@ class Split():
...
@@ -20,7 +21,8 @@ class Split():
self
.
keybd_interest
=
[]
self
.
keybd_interest
=
[]
self
.
timer_interest
=
[]
self
.
timer_interest
=
[]
self
.
altdraw_interest
=
[]
self
.
altdraw_interest
=
[]
self
.
mouse_focus
=
0
self
.
mouse_focus
=
None
self
.
keybd_focus
=
None
return
self
return
self
#
#
# Downcalls from parent to child
# Downcalls from parent to child
...
@@ -35,10 +37,14 @@ class Split():
...
@@ -35,10 +37,14 @@ class Split():
del
self
.
timer_interest
[:]
del
self
.
timer_interest
[:]
del
self
.
altdraw_interest
[:]
del
self
.
altdraw_interest
[:]
self
.
mouse_focus
=
None
self
.
mouse_focus
=
None
self
.
keybd_focus
=
None
#
#
def
minsize
(
self
,
m
):
return
unimpl
()
# Should ask children
def
getminsize
(
self
,
(
m
,
(
width
,
height
))):
def
getbounds
(
self
):
return
unimpl
()
return
unimpl
()
# Should ask children
def
setbounds
(
self
,
bounds
):
unimpl
()
# Should tell children
def
getbounds
(
self
):
return
unimpl
()
def
setbounds
(
self
,
bounds
):
unimpl
()
# Should tell children
#
#
def
realize
(
self
):
def
realize
(
self
):
for
child
in
self
.
children
:
for
child
in
self
.
children
:
...
@@ -53,15 +59,41 @@ class Split():
...
@@ -53,15 +59,41 @@ class Split():
for
child
in
self
.
altdraw_interest
:
for
child
in
self
.
altdraw_interest
:
child
.
altdraw
(
detail
)
child
.
altdraw
(
detail
)
#
#
# Keyboard focus handling (used internally)
# XXX This is not enough if two levels of splits
# XXX surround text fields!
#
def
set_keybd_focus
(
self
,
child
):
if
self
.
keybd_focus
<>
child
:
if
self
.
keybd_focus
:
self
.
keybd_focus
.
deactivate
()
self
.
keybd_focus
=
None
if
child
:
child
.
activate
()
self
.
keybd_focus
=
child
def
next_keybd_focus
(
self
):
if
not
self
.
keybd_interest
:
self
.
set_keybd_focus
(
None
)
return
if
self
.
keybd_focus
in
self
.
keybd_interest
:
i
=
self
.
keybd_interest
.
index
(
self
.
keybd_focus
)
i
=
(
i
+
1
)
%
len
(
self
.
keybd_interest
)
else
:
i
=
0
self
.
set_keybd_focus
(
self
.
keybd_interest
[
i
])
#
# Downcalls only made after certain upcalls
# Downcalls only made after certain upcalls
#
#
def
mouse_down
(
self
,
detail
):
def
mouse_down
(
self
,
detail
):
if
self
.
mouse_focus
:
if
self
.
mouse_focus
:
self
.
mouse_focus
.
mouse_down
(
detail
)
self
.
mouse_focus
.
mouse_down
(
detail
)
return
p
=
detail
[
0
]
p
=
detail
[
0
]
for
child
in
self
.
mouse_interest
:
for
child
in
self
.
mouse_interest
:
if
rect
.
pointinrect
(
p
,
child
.
getbounds
()):
if
rect
.
pointinrect
(
p
,
child
.
getbounds
()):
self
.
mouse_focus
=
child
self
.
mouse_focus
=
child
if
child
in
self
.
keybd_interest
:
self
.
set_keybd_focus
(
child
)
child
.
mouse_down
(
detail
)
child
.
mouse_down
(
detail
)
def
mouse_move
(
self
,
detail
):
def
mouse_move
(
self
,
detail
):
if
self
.
mouse_focus
:
if
self
.
mouse_focus
:
...
@@ -69,11 +101,26 @@ class Split():
...
@@ -69,11 +101,26 @@ class Split():
def
mouse_up
(
self
,
detail
):
def
mouse_up
(
self
,
detail
):
if
self
.
mouse_focus
:
if
self
.
mouse_focus
:
self
.
mouse_focus
.
mouse_up
(
detail
)
self
.
mouse_focus
.
mouse_up
(
detail
)
self
.
mouse_focus
=
0
self
.
mouse_focus
=
None
#
def
activate
(
self
):
if
self
.
keybd_focus
:
self
.
keybd_focus
.
activate
()
else
:
self
.
next_keybd_focus
()
def
deactivate
(
self
):
if
self
.
keybd_focus
:
self
.
keybd_focus
.
deactivate
()
#
#
def
keybd
(
self
,
type_detail
):
def
keybd
(
self
,
type_detail
):
for
child
in
self
.
keybd_interest
:
if
not
self
.
keybd_focus
:
child
.
keybd
(
type_detail
)
self
.
set_keybd_focus
(
self
.
keybd_interest
[
0
])
type
,
detail
=
type_detail
if
type
=
WE_COMMAND
and
detail
=
WC_TAB
and
\
len
(
self
.
keybd_interest
)
>
1
:
self
.
next_keybd_focus
()
return
self
.
keybd_focus
.
keybd
(
type_detail
)
#
#
def
timer
(
self
):
def
timer
(
self
):
for
child
in
self
.
timer_interest
:
for
child
in
self
.
timer_interest
:
...
@@ -98,13 +145,17 @@ class Split():
...
@@ -98,13 +145,17 @@ class Split():
if
child
in
self
.
altdraw_interest
:
if
child
in
self
.
altdraw_interest
:
self
.
altdraw_interest
.
remove
(
child
)
self
.
altdraw_interest
.
remove
(
child
)
if
child
=
self
.
mouse_focus
:
if
child
=
self
.
mouse_focus
:
self
.
mouse_focus
=
0
self
.
mouse_focus
=
None
if
child
=
self
.
keybd_focus
:
self
.
keybd_focus
=
None
#
#
def
need_mouse
(
self
,
child
):
def
need_mouse
(
self
,
child
):
if
child
not
in
self
.
mouse_interest
:
if
child
not
in
self
.
mouse_interest
:
self
.
mouse_interest
.
append
(
child
)
self
.
mouse_interest
.
append
(
child
)
self
.
parent
.
need_mouse
(
self
)
self
.
parent
.
need_mouse
(
self
)
def
no_mouse
(
self
,
child
):
def
no_mouse
(
self
,
child
):
if
child
=
self
.
mouse_focus
:
self
.
mouse_focus
=
None
if
child
in
self
.
mouse_interest
:
if
child
in
self
.
mouse_interest
:
self
.
mouse_interest
.
remove
(
child
)
self
.
mouse_interest
.
remove
(
child
)
if
not
self
.
mouse_interest
:
if
not
self
.
mouse_interest
:
...
@@ -114,7 +165,11 @@ class Split():
...
@@ -114,7 +165,11 @@ class Split():
if
child
not
in
self
.
keybd_interest
:
if
child
not
in
self
.
keybd_interest
:
self
.
keybd_interest
.
append
(
child
)
self
.
keybd_interest
.
append
(
child
)
self
.
parent
.
need_keybd
(
self
)
self
.
parent
.
need_keybd
(
self
)
if
not
self
.
keybd_focus
:
self
.
set_keybd_focus
(
child
)
def
no_keybd
(
self
,
child
):
def
no_keybd
(
self
,
child
):
if
child
=
self
.
keybd_focus
:
self
.
keybd_focus
=
None
# Don't call child.deactivate()
if
child
in
self
.
keybd_interest
:
if
child
in
self
.
keybd_interest
:
self
.
keybd_interest
.
remove
(
child
)
self
.
keybd_interest
.
remove
(
child
)
if
not
self
.
keybd_interest
:
if
not
self
.
keybd_interest
:
...
...
Lib/stdwin/Split.py
Dosyayı görüntüle @
9b1bfc88
# Generic Split implementation.
# Generic Split implementation.
# Use as a base class for other splits.
# Use as a base class for other splits.
# Derived classes should at least implement the methods that call
# Derived classes should at least implement the methods that call
# unimpl() below: minsize(), getbounds() and setbounds().
# unimpl() below:
get
minsize(), getbounds() and setbounds().
Error
=
'Split.Error'
# Exception
Error
=
'Split.Error'
# Exception
import
rect
import
rect
from
stdwinevents
import
*
class
Split
():
class
Split
():
#
#
...
@@ -20,7 +21,8 @@ class Split():
...
@@ -20,7 +21,8 @@ class Split():
self
.
keybd_interest
=
[]
self
.
keybd_interest
=
[]
self
.
timer_interest
=
[]
self
.
timer_interest
=
[]
self
.
altdraw_interest
=
[]
self
.
altdraw_interest
=
[]
self
.
mouse_focus
=
0
self
.
mouse_focus
=
None
self
.
keybd_focus
=
None
return
self
return
self
#
#
# Downcalls from parent to child
# Downcalls from parent to child
...
@@ -35,10 +37,14 @@ class Split():
...
@@ -35,10 +37,14 @@ class Split():
del
self
.
timer_interest
[:]
del
self
.
timer_interest
[:]
del
self
.
altdraw_interest
[:]
del
self
.
altdraw_interest
[:]
self
.
mouse_focus
=
None
self
.
mouse_focus
=
None
self
.
keybd_focus
=
None
#
#
def
minsize
(
self
,
m
):
return
unimpl
()
# Should ask children
def
getminsize
(
self
,
(
m
,
(
width
,
height
))):
def
getbounds
(
self
):
return
unimpl
()
return
unimpl
()
# Should ask children
def
setbounds
(
self
,
bounds
):
unimpl
()
# Should tell children
def
getbounds
(
self
):
return
unimpl
()
def
setbounds
(
self
,
bounds
):
unimpl
()
# Should tell children
#
#
def
realize
(
self
):
def
realize
(
self
):
for
child
in
self
.
children
:
for
child
in
self
.
children
:
...
@@ -53,15 +59,41 @@ class Split():
...
@@ -53,15 +59,41 @@ class Split():
for
child
in
self
.
altdraw_interest
:
for
child
in
self
.
altdraw_interest
:
child
.
altdraw
(
detail
)
child
.
altdraw
(
detail
)
#
#
# Keyboard focus handling (used internally)
# XXX This is not enough if two levels of splits
# XXX surround text fields!
#
def
set_keybd_focus
(
self
,
child
):
if
self
.
keybd_focus
<>
child
:
if
self
.
keybd_focus
:
self
.
keybd_focus
.
deactivate
()
self
.
keybd_focus
=
None
if
child
:
child
.
activate
()
self
.
keybd_focus
=
child
def
next_keybd_focus
(
self
):
if
not
self
.
keybd_interest
:
self
.
set_keybd_focus
(
None
)
return
if
self
.
keybd_focus
in
self
.
keybd_interest
:
i
=
self
.
keybd_interest
.
index
(
self
.
keybd_focus
)
i
=
(
i
+
1
)
%
len
(
self
.
keybd_interest
)
else
:
i
=
0
self
.
set_keybd_focus
(
self
.
keybd_interest
[
i
])
#
# Downcalls only made after certain upcalls
# Downcalls only made after certain upcalls
#
#
def
mouse_down
(
self
,
detail
):
def
mouse_down
(
self
,
detail
):
if
self
.
mouse_focus
:
if
self
.
mouse_focus
:
self
.
mouse_focus
.
mouse_down
(
detail
)
self
.
mouse_focus
.
mouse_down
(
detail
)
return
p
=
detail
[
0
]
p
=
detail
[
0
]
for
child
in
self
.
mouse_interest
:
for
child
in
self
.
mouse_interest
:
if
rect
.
pointinrect
(
p
,
child
.
getbounds
()):
if
rect
.
pointinrect
(
p
,
child
.
getbounds
()):
self
.
mouse_focus
=
child
self
.
mouse_focus
=
child
if
child
in
self
.
keybd_interest
:
self
.
set_keybd_focus
(
child
)
child
.
mouse_down
(
detail
)
child
.
mouse_down
(
detail
)
def
mouse_move
(
self
,
detail
):
def
mouse_move
(
self
,
detail
):
if
self
.
mouse_focus
:
if
self
.
mouse_focus
:
...
@@ -69,11 +101,26 @@ class Split():
...
@@ -69,11 +101,26 @@ class Split():
def
mouse_up
(
self
,
detail
):
def
mouse_up
(
self
,
detail
):
if
self
.
mouse_focus
:
if
self
.
mouse_focus
:
self
.
mouse_focus
.
mouse_up
(
detail
)
self
.
mouse_focus
.
mouse_up
(
detail
)
self
.
mouse_focus
=
0
self
.
mouse_focus
=
None
#
def
activate
(
self
):
if
self
.
keybd_focus
:
self
.
keybd_focus
.
activate
()
else
:
self
.
next_keybd_focus
()
def
deactivate
(
self
):
if
self
.
keybd_focus
:
self
.
keybd_focus
.
deactivate
()
#
#
def
keybd
(
self
,
type_detail
):
def
keybd
(
self
,
type_detail
):
for
child
in
self
.
keybd_interest
:
if
not
self
.
keybd_focus
:
child
.
keybd
(
type_detail
)
self
.
set_keybd_focus
(
self
.
keybd_interest
[
0
])
type
,
detail
=
type_detail
if
type
=
WE_COMMAND
and
detail
=
WC_TAB
and
\
len
(
self
.
keybd_interest
)
>
1
:
self
.
next_keybd_focus
()
return
self
.
keybd_focus
.
keybd
(
type_detail
)
#
#
def
timer
(
self
):
def
timer
(
self
):
for
child
in
self
.
timer_interest
:
for
child
in
self
.
timer_interest
:
...
@@ -98,13 +145,17 @@ class Split():
...
@@ -98,13 +145,17 @@ class Split():
if
child
in
self
.
altdraw_interest
:
if
child
in
self
.
altdraw_interest
:
self
.
altdraw_interest
.
remove
(
child
)
self
.
altdraw_interest
.
remove
(
child
)
if
child
=
self
.
mouse_focus
:
if
child
=
self
.
mouse_focus
:
self
.
mouse_focus
=
0
self
.
mouse_focus
=
None
if
child
=
self
.
keybd_focus
:
self
.
keybd_focus
=
None
#
#
def
need_mouse
(
self
,
child
):
def
need_mouse
(
self
,
child
):
if
child
not
in
self
.
mouse_interest
:
if
child
not
in
self
.
mouse_interest
:
self
.
mouse_interest
.
append
(
child
)
self
.
mouse_interest
.
append
(
child
)
self
.
parent
.
need_mouse
(
self
)
self
.
parent
.
need_mouse
(
self
)
def
no_mouse
(
self
,
child
):
def
no_mouse
(
self
,
child
):
if
child
=
self
.
mouse_focus
:
self
.
mouse_focus
=
None
if
child
in
self
.
mouse_interest
:
if
child
in
self
.
mouse_interest
:
self
.
mouse_interest
.
remove
(
child
)
self
.
mouse_interest
.
remove
(
child
)
if
not
self
.
mouse_interest
:
if
not
self
.
mouse_interest
:
...
@@ -114,7 +165,11 @@ class Split():
...
@@ -114,7 +165,11 @@ class Split():
if
child
not
in
self
.
keybd_interest
:
if
child
not
in
self
.
keybd_interest
:
self
.
keybd_interest
.
append
(
child
)
self
.
keybd_interest
.
append
(
child
)
self
.
parent
.
need_keybd
(
self
)
self
.
parent
.
need_keybd
(
self
)
if
not
self
.
keybd_focus
:
self
.
set_keybd_focus
(
child
)
def
no_keybd
(
self
,
child
):
def
no_keybd
(
self
,
child
):
if
child
=
self
.
keybd_focus
:
self
.
keybd_focus
=
None
# Don't call child.deactivate()
if
child
in
self
.
keybd_interest
:
if
child
in
self
.
keybd_interest
:
self
.
keybd_interest
.
remove
(
child
)
self
.
keybd_interest
.
remove
(
child
)
if
not
self
.
keybd_interest
:
if
not
self
.
keybd_interest
:
...
...
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