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
d8b5942f
Kaydet (Commit)
d8b5942f
authored
Haz 14, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26386: Fixed ttk.TreeView selection operations with item id's
containing spaces.
üst
fc0a55fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
2 deletions
+65
-2
test_widgets.py
Lib/lib-tk/test/test_ttk/test_widgets.py
+59
-1
ttk.py
Lib/lib-tk/ttk.py
+3
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/lib-tk/test/test_ttk/test_widgets.py
Dosyayı görüntüle @
d8b5942f
...
...
@@ -2,7 +2,7 @@ import unittest
import
Tkinter
as
tkinter
from
Tkinter
import
TclError
import
ttk
from
test.test_support
import
requires
,
run_unittest
from
test.test_support
import
requires
,
run_unittest
,
have_unicode
,
u
import
sys
from
test_functions
import
MockTclObj
...
...
@@ -1486,6 +1486,60 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
value
)
def
test_selection
(
self
):
# item 'none' doesn't exist
self
.
assertRaises
(
tkinter
.
TclError
,
self
.
tv
.
selection_set
,
'none'
)
self
.
assertRaises
(
tkinter
.
TclError
,
self
.
tv
.
selection_add
,
'none'
)
self
.
assertRaises
(
tkinter
.
TclError
,
self
.
tv
.
selection_remove
,
'none'
)
self
.
assertRaises
(
tkinter
.
TclError
,
self
.
tv
.
selection_toggle
,
'none'
)
item1
=
self
.
tv
.
insert
(
''
,
'end'
)
item2
=
self
.
tv
.
insert
(
''
,
'end'
)
c1
=
self
.
tv
.
insert
(
item1
,
'end'
)
c2
=
self
.
tv
.
insert
(
item1
,
'end'
)
c3
=
self
.
tv
.
insert
(
item1
,
'end'
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
())
self
.
tv
.
selection_set
((
c1
,
item2
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c1
,
item2
))
self
.
tv
.
selection_set
(
c2
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c2
,))
self
.
tv
.
selection_add
((
c1
,
item2
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c1
,
c2
,
item2
))
self
.
tv
.
selection_add
(
item1
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
item1
,
c1
,
c2
,
item2
))
self
.
tv
.
selection_remove
((
item1
,
c3
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c1
,
c2
,
item2
))
self
.
tv
.
selection_remove
(
c2
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c1
,
item2
))
self
.
tv
.
selection_toggle
((
c1
,
c3
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c3
,
item2
))
self
.
tv
.
selection_toggle
(
item2
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c3
,))
self
.
tv
.
insert
(
''
,
'end'
,
id
=
'with spaces'
)
self
.
tv
.
selection_set
(
'with spaces'
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
'with spaces'
,))
self
.
tv
.
insert
(
''
,
'end'
,
id
=
'{brace'
)
self
.
tv
.
selection_set
(
'{brace'
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
'{brace'
,))
if
have_unicode
:
self
.
tv
.
insert
(
''
,
'end'
,
id
=
u
(
r'unicode\u20ac'
))
self
.
tv
.
selection_set
(
u
(
r'unicode\u20ac'
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
u
(
r'unicode\u20ac'
),))
self
.
tv
.
insert
(
''
,
'end'
,
id
=
'bytes
\xe2\x82\xac
'
)
self
.
tv
.
selection_set
(
'bytes
\xe2\x82\xac
'
)
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
u
(
r'bytes\u20ac'
)
if
have_unicode
else
'bytes
\xe2\x82\xac
'
,))
def
test_set
(
self
):
self
.
tv
[
'columns'
]
=
[
'A'
,
'B'
]
item
=
self
.
tv
.
insert
(
''
,
'end'
,
values
=
[
'a'
,
'b'
])
...
...
@@ -1612,5 +1666,9 @@ tests_gui = (
SizegripTest
,
TreeviewTest
,
WidgetTest
,
)
tests_gui
=
(
TreeviewTest
,
)
if
__name__
==
"__main__"
:
run_unittest
(
*
tests_gui
)
Lib/lib-tk/ttk.py
Dosyayı görüntüle @
d8b5942f
...
...
@@ -1394,7 +1394,9 @@ class Treeview(Widget, Tkinter.XView, Tkinter.YView):
def
selection
(
self
,
selop
=
None
,
items
=
None
):
"""If selop is not specified, returns selected items."""
return
self
.
tk
.
call
(
self
.
_w
,
"selection"
,
selop
,
items
)
if
isinstance
(
items
,
basestring
):
items
=
(
items
,)
return
self
.
tk
.
splitlist
(
self
.
tk
.
call
(
self
.
_w
,
"selection"
,
selop
,
items
))
def
selection_set
(
self
,
items
):
...
...
Misc/NEWS
Dosyayı görüntüle @
d8b5942f
...
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
-------
- Issue #26386: Fixed ttk.TreeView selection operations with item id's
containing spaces.
- Issue #25455: Fixed a crash in repr of cElementTree.Element with recursive tag.
Documentation
...
...
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