FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merged revisions 74507-74511,74517 via svnmerge from · python/cpython@bcd03df · GitHub

Repository navigation

Commit bcd03df

Browse files
committed
Merged revisions 74507-74511,74517 via svnmerge from
svn+ssh://pythondev/python/trunk ........ r74507 | guilherme.polo | 2009-08-18 10:23:08 -0300 (Tue, 18 Aug 2009) | 1 line Issue #1119673: Do not override Tkinter.Text methods when creating a ScrolledText. ........ r74508 | guilherme.polo | 2009-08-18 10:29:20 -0300 (Tue, 18 Aug 2009) | 1 line Issue #1250469: Fix the return value of Tix.PanedWindow.panes. ........ r74509 | guilherme.polo | 2009-08-18 10:33:30 -0300 (Tue, 18 Aug 2009) | 1 line Mark the "radio" option of Tix.CheckList as static. ........ r74510 | guilherme.polo | 2009-08-18 11:23:00 -0300 (Tue, 18 Aug 2009) | 1 line Issue #1522587: New constants and methods for the Tix.Grid widget. ........ r74511 | guilherme.polo | 2009-08-18 11:34:44 -0300 (Tue, 18 Aug 2009) | 1 line Fixes for Tix.Grid from issue #1522587. ........ r74517 | guilherme.polo | 2009-08-18 11:46:57 -0300 (Tue, 18 Aug 2009) | 1 line Issue #1356969: Add missing info methods in Tix.HList. ........
1 parent f290cb5 commit bcd03df

3 files changed

Lines changed: 134 additions & 21 deletions

File tree

‎Lib/tkinter/scrolledtext.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ def __init__(self, master=None, **kw):
2727
self.pack(side=LEFT, fill=BOTH, expand=True)
2828
self.vbar['command'] = self.yview
2929

30-
# Copy geometry methods of self.frame -- hack!
30+
# Copy geometry methods of self.frame without overriding Text
31+
# methods -- hack!
32+
text_meths = vars(Text).keys()
3133
methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
34+
methods = set(methods).difference(text_meths)
3235

3336
for m in methods:
3437
if m[0] != '_' and m != 'config' and m != 'configure':

‎Lib/tkinter/tix.py‎

Lines changed: 121 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@
4646
AUTO = 'auto'
4747
ACROSSTOP = 'acrosstop'
4848

49+
# A few useful constants for the Grid widget
50+
ASCII = 'ascii'
51+
CELL = 'cell'
52+
COLUMN = 'column'
53+
DECREASING = 'decreasing'
54+
INCREASING = 'increasing'
55+
INTEGER = 'integer'
56+
MAIN = 'main'
57+
MAX = 'max'
58+
REAL = 'real'
59+
ROW = 'row'
60+
S_REGION = 's-region'
61+
X_REGION = 'x-region'
62+
Y_REGION = 'y-region'
63+
4964
# Some constants used by Tkinter dooneevent()
5065
TCL_DONT_WAIT = 1 << 1
5166
TCL_WINDOW_EVENTS = 1 << 2
@@ -961,13 +976,23 @@ def indicator_size(self, entry):
961976
def info_anchor(self):
962977
return self.tk.call(self._w, 'info', 'anchor')
963978

979+
def info_bbox(self, entry):
980+
return self._getints(
981+
self.tk.call(self._w, 'info', 'bbox', entry)) or None
982+
964983
def info_children(self, entry=None):
965984
c = self.tk.call(self._w, 'info', 'children', entry)
966985
return self.tk.splitlist(c)
967986

968987
def info_data(self, entry):
969988
return self.tk.call(self._w, 'info', 'data', entry)
970989

990+
def info_dragsite(self):
991+
return self.tk.call(self._w, 'info', 'dragsite')
992+
993+
def info_dropsite(self):
994+
return self.tk.call(self._w, 'info', 'dropsite')
995+
971996
def info_exists(self, entry):
972997
return self.tk.call(self._w, 'info', 'exists', entry)
973998

@@ -1235,11 +1260,8 @@ def paneconfigure(self, entry, cnf={}, **kw):
12351260
self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw))
12361261

12371262
def panes(self):
1238-
names = self.tk.call(self._w, 'panes')
1239-
ret = []
1240-
for x in names:
1241-
ret.append(self.subwidget(x))
1242-
return ret
1263+
names = self.tk.splitlist(self.tk.call(self._w, 'panes'))
1264+
return [self.subwidget(x) for x in names]
12431265

12441266
class PopupMenu(TixWidget):
12451267
"""PopupMenu widget can be used as a replacement of the tk_popup command.
@@ -1551,7 +1573,7 @@ class CheckList(TixWidget):
15511573
# FIXME: It should inherit -superclass tixTree
15521574
def __init__(self, master=None, cnf={}, **kw):
15531575
TixWidget.__init__(self, master, 'tixCheckList',
1554-
['options'], cnf, kw)
1576+
['options', 'radio'], cnf, kw)
15551577
self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
15561578
self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
15571579
self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
@@ -1789,50 +1811,79 @@ def __init__(self, master=None, cnf={}, **kw):
17891811
TixWidget.__init__(self, master, 'tixGrid', static, cnf, kw)
17901812

17911813
# valid options as of Tk 8.4
1792-
# anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget, edit
1793-
# entryconfigure, format, geometryinfo, info, index, move, nearest, selection
1794-
# set, size, unset, xview, yview
1795-
# def anchor option ?args ...?
1814+
# anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget,
1815+
# edit, entryconfigure, format, geometryinfo, info, index, move, nearest,
1816+
# selection, set, size, unset, xview, yview
1817+
def anchor_clear(self):
1818+
"""Removes the selection anchor."""
1819+
self.tk.call(self, 'anchor', 'clear')
1820+
17961821
def anchor_get(self):
17971822
"Get the (x,y) coordinate of the current anchor cell"
17981823
return self._getints(self.tk.call(self, 'anchor', 'get'))
17991824

1800-
# def bdtype
1801-
# def delete dim from ?to?
1825+
def anchor_set(self, x, y):
1826+
"""Set the selection anchor to the cell at (x, y)."""
1827+
self.tk.call(self, 'anchor', 'set', x, y)
1828+
18021829
def delete_row(self, from_, to=None):
18031830
"""Delete rows between from_ and to inclusive.
18041831
If to is not provided, delete only row at from_"""
18051832
if to is None:
18061833
self.tk.call(self, 'delete', 'row', from_)
18071834
else:
18081835
self.tk.call(self, 'delete', 'row', from_, to)
1836+
18091837
def delete_column(self, from_, to=None):
18101838
"""Delete columns between from_ and to inclusive.
18111839
If to is not provided, delete only column at from_"""
18121840
if to is None:
18131841
self.tk.call(self, 'delete', 'column', from_)
18141842
else:
18151843
self.tk.call(self, 'delete', 'column', from_, to)
1816-
# def edit apply
1817-
# def edit set x y
1844+
1845+
def edit_apply(self):
1846+
"""If any cell is being edited, de-highlight the cell and applies
1847+
the changes."""
1848+
self.tk.call(self, 'edit', 'apply')
1849+
1850+
def edit_set(self, x, y):
1851+
"""Highlights the cell at (x, y) for editing, if the -editnotify
1852+
command returns True for this cell."""
1853+
self.tk.call(self, 'edit', 'set', x, y)
18181854

18191855
def entrycget(self, x, y, option):
18201856
"Get the option value for cell at (x,y)"
1857+
if option and option[0] != '-':
1858+
option = '-' + option
18211859
return self.tk.call(self, 'entrycget', x, y, option)
18221860

1823-
def entryconfigure(self, x, y, **kw):
1824-
return self.tk.call(self, 'entryconfigure', x, y, *self._options(None, kw))
1861+
def entryconfigure(self, x, y, cnf=None, **kw):
1862+
return self._configure(('entryconfigure', x, y), cnf, kw)
1863+
18251864
# def format
18261865
# def index
18271866

18281867
def info_exists(self, x, y):
18291868
"Return True if display item exists at (x,y)"
1830-
return bool(int(self.tk.call(self, 'info', 'exists', x, y)))
1869+
return self._getboolean(self.tk.call(self, 'info', 'exists', x, y))
18311870

18321871
def info_bbox(self, x, y):
18331872
# This seems to always return '', at least for 'text' displayitems
18341873
return self.tk.call(self, 'info', 'bbox', x, y)
18351874

1875+
def move_column(self, from_, to, offset):
1876+
"""Moves the the range of columns from position FROM through TO by
1877+
the distance indicated by OFFSET. For example, move_column(2, 4, 1)
1878+
moves the columns 2,3,4 to columns 3,4,5."""
1879+
self.tk.call(self, 'move', 'column', from_, to, offset)
1880+
1881+
def move_row(self, from_, to, offset):
1882+
"""Moves the the range of rows from position FROM through TO by
1883+
the distance indicated by OFFSET.
1884+
For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5."""
1885+
self.tk.call(self, 'move', 'row', from_, to, offset)
1886+
18361887
def nearest(self, x, y):
18371888
"Return coordinate of cell nearest pixel coordinate (x,y)"
18381889
return self._getints(self.tk.call(self, 'nearest', x, y))
@@ -1842,16 +1893,66 @@ def nearest(self, x, y):
18421893
# def selection includes
18431894
# def selection set
18441895
# def selection toggle
1845-
# def move dim from to offset
18461896

18471897
def set(self, x, y, itemtype=None, **kw):
18481898
args= self._options(self.cnf, kw)
18491899
if itemtype is not None:
18501900
args= ('-itemtype', itemtype) + args
18511901
self.tk.call(self, 'set', x, y, *args)
18521902

1853-
# def size dim index ?option value ...?
1854-
# def unset x y
1903+
def size_column(self, index, **kw):
1904+
"""Queries or sets the size of the column given by
1905+
INDEX. INDEX may be any non-negative
1906+
integer that gives the position of a given column.
1907+
INDEX can also be the string "default"; in this case, this command
1908+
queries or sets the default size of all columns.
1909+
When no option-value pair is given, this command returns a tuple
1910+
containing the current size setting of the given column. When
1911+
option-value pairs are given, the corresponding options of the
1912+
size setting of the given column are changed. Options may be one
1913+
of the follwing:
1914+
pad0 pixels
1915+
Specifies the paddings to the left of a column.
1916+
pad1 pixels
1917+
Specifies the paddings to the right of a column.
1918+
size val
1919+
Specifies the width of a column .
1920+
Val may be: "auto" -- the width of the column is set the
1921+
the widest cell in the column; a valid Tk screen distance
1922+
unit; or a real number following by the word chars
1923+
(e.g. 3.4chars) that sets the width of the column to the
1924+
given number of characters."""
1925+
return self.tk.split(self.tk.call(self._w, 'size', 'column', index,
1926+
*self._options({}, kw)))
1927+
1928+
def size_row(self, index, **kw):
1929+
"""Queries or sets the size of the row given by
1930+
INDEX. INDEX may be any non-negative
1931+
integer that gives the position of a given row .
1932+
INDEX can also be the string "default"; in this case, this command
1933+
queries or sets the default size of all rows.
1934+
When no option-value pair is given, this command returns a list con-
1935+
taining the current size setting of the given row . When option-value
1936+
pairs are given, the corresponding options of the size setting of the
1937+
given row are changed. Options may be one of the follwing:
1938+
pad0 pixels
1939+
Specifies the paddings to the top of a row.
1940+
pad1 pixels
1941+
Specifies the paddings to the the bottom of a row.
1942+
size val
1943+
Specifies the height of a row.
1944+
Val may be: "auto" -- the height of the row is set the
1945+
the highest cell in the row; a valid Tk screen distance
1946+
unit; or a real number following by the word chars
1947+
(e.g. 3.4chars) that sets the height of the row to the
1948+
given number of characters."""
1949+
return self.tk.split(self.tk.call(
1950+
self, 'size', 'row', index, *self._options({}, kw)))
1951+
1952+
def unset(self, x, y):
1953+
"""Clears the cell at (x, y) by removing its display item."""
1954+
self.tk.call(self._w, 'unset', x, y)
1955+
18551956

18561957
class ScrolledGrid(Grid):
18571958
'''Scrolled Grid widgets'''

‎Misc/NEWS‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ C-API
6565
Library
6666
-------
6767

68+
- Issue #1356969: Add missing info methods in tix.HList.
69+
70+
- Issue #1522587: New constants and methods for the tix.Grid widget.
71+
72+
- Issue #1250469: Fix the return value of tix.PanedWindow.panes.
73+
74+
- Issue #1119673: Do not override tkinter.Text methods when creating a
75+
ScrolledText.
76+
6877
- Issue #6665: Fix fnmatch to properly match filenames with newlines in them.
6978

7079
- Issue #1135: Add the XView and YView mix-ins to avoid duplicating

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL