Patch #649184: Update to tix-8.1.4 RC3.

This commit is contained in:
Martin v. Löwis 2002-12-06 10:33:45 +00:00
parent 05d4d562d7
commit 468742878f
2 changed files with 73 additions and 18 deletions

View File

@ -1,5 +1,6 @@
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
# #
# Id: tixwidgets.py,v 1.7 2002/11/14 02:44:08 nnorwitz Exp
# $Id$ # $Id$
# #
# tixwidgets.py -- # tixwidgets.py --
@ -474,9 +475,9 @@ def MkScroll(nb, name):
w = nb.page(name) w = nb.page(name)
options='label.padX 4' options='label.padX 4'
sls = Tix.LabelFrame(w, label='tixScrolledListBox', options=options) sls = Tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options)
swn = Tix.LabelFrame(w, label='tixScrolledWindow', options=options) swn = Tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options)
stx = Tix.LabelFrame(w, label='tixScrolledText', options=options) stx = Tix.LabelFrame(w, label='Tix.ScrolledText', options=options)
MkSList(sls.frame) MkSList(sls.frame)
MkSWindow(swn.frame) MkSWindow(swn.frame)
@ -604,8 +605,8 @@ def MkManager(nb, name):
w = nb.page(name) w = nb.page(name)
options='label.padX 4' options='label.padX 4'
pane = Tix.LabelFrame(w, label='tixPanedWindow', options=options) pane = Tix.LabelFrame(w, label='Tix.PanedWindow', options=options)
note = Tix.LabelFrame(w, label='tixNoteBook', options=options) note = Tix.LabelFrame(w, label='Tix.NoteBook', options=options)
MkPanedWindow(pane.frame) MkPanedWindow(pane.frame)
MkNoteBook(note.frame) MkNoteBook(note.frame)
@ -716,8 +717,8 @@ def MkDirList(nb, name):
w = nb.page(name) w = nb.page(name)
options = "label.padX 4" options = "label.padX 4"
dir = Tix.LabelFrame(w, label='tixDirList', options=options) dir = Tix.LabelFrame(w, label='Tix.DirList', options=options)
fsbox = Tix.LabelFrame(w, label='tixExFileSelectBox', options=options) fsbox = Tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options)
MkDirListWidget(dir.frame) MkDirListWidget(dir.frame)
MkExFileWidget(fsbox.frame) MkExFileWidget(fsbox.frame)
dir.form(top=0, left=0, right='%40', bottom=-1) dir.form(top=0, left=0, right='%40', bottom=-1)

View File

@ -34,8 +34,6 @@
raise ImportError, "This version of Tix.py requires Tk 4.0 or higher" raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
import _tkinter # If this fails your Python may not be configured for Tk import _tkinter # If this fails your Python may not be configured for Tk
# TixVersion = float(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix
# WARNING - TixVersion is a limited precision floating point number
# Some more constants (for consistency with Tkinter) # Some more constants (for consistency with Tkinter)
WINDOW = 'window' WINDOW = 'window'
@ -241,7 +239,7 @@ def grid(self, xsize=0, ysize=0):
for x in y: for x in y:
z = z + (self.tk.getint(x),) z = z + (self.tk.getint(x),)
return z return z
self.tk.call('tixForm', 'grid', self._w, xsize, ysize) return self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
def info(self, option=None): def info(self, option=None):
if not option: if not option:
@ -497,6 +495,7 @@ class Balloon(TixWidget):
label Label label Label
message Message""" message Message"""
# FIXME: It should inherit -superclass tixShell
def __init__(self, master=None, cnf={}, **kw): def __init__(self, master=None, cnf={}, **kw):
# static seem to be -installcolormap -initwait -statusbar -cursor # static seem to be -installcolormap -initwait -statusbar -cursor
static = ['options', 'installcolormap', 'initwait', 'statusbar', static = ['options', 'installcolormap', 'initwait', 'statusbar',
@ -549,6 +548,7 @@ class ComboBox(TixWidget):
tick Button tick Button
cross Button : present if created with the fancy option""" cross Button : present if created with the fancy option"""
# FIXME: It should inherit -superclass tixLabelWidget
def __init__ (self, master=None, cnf={}, **kw): def __init__ (self, master=None, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixComboBox', TixWidget.__init__(self, master, 'tixComboBox',
['editable', 'dropdown', 'fancy', 'options'], ['editable', 'dropdown', 'fancy', 'options'],
@ -590,6 +590,7 @@ class Control(TixWidget):
entry Entry entry Entry
label Label""" label Label"""
# FIXME: It should inherit -superclass tixLabelWidget
def __init__ (self, master=None, cnf={}, **kw): def __init__ (self, master=None, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
self.subwidget_list['incr'] = _dummyButton(self, 'incr') self.subwidget_list['incr'] = _dummyButton(self, 'incr')
@ -620,6 +621,7 @@ class DirList(TixWidget):
hsb Scrollbar hsb Scrollbar
vsb Scrollbar""" vsb Scrollbar"""
# FIXME: It should inherit -superclass tixScrolledHList
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
@ -641,6 +643,7 @@ class DirTree(TixWidget):
hsb Scrollbar hsb Scrollbar
vsb Scrollbar""" vsb Scrollbar"""
# FIXME: It should inherit -superclass tixScrolledHList
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
@ -712,6 +715,7 @@ class DirSelectDialog(TixWidget):
---------- ----- ---------- -----
dirbox DirSelectDialog""" dirbox DirSelectDialog"""
# FIXME: It should inherit -superclass tixDialogShell
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixDirSelectDialog', TixWidget.__init__(self, master, 'tixDirSelectDialog',
['options'], cnf, kw) ['options'], cnf, kw)
@ -734,6 +738,7 @@ class ExFileSelectDialog(TixWidget):
---------- ----- ---------- -----
fsbox ExFileSelectBox""" fsbox ExFileSelectBox"""
# FIXME: It should inherit -superclass tixDialogShell
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixExFileSelectDialog', TixWidget.__init__(self, master, 'tixExFileSelectDialog',
['options'], cnf, kw) ['options'], cnf, kw)
@ -781,6 +786,7 @@ class FileSelectDialog(TixWidget):
btns StdButtonBox btns StdButtonBox
fsbox FileSelectBox""" fsbox FileSelectBox"""
# FIXME: It should inherit -superclass tixStdDialogShell
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixFileSelectDialog', TixWidget.__init__(self, master, 'tixFileSelectDialog',
['options'], cnf, kw) ['options'], cnf, kw)
@ -804,6 +810,7 @@ class FileEntry(TixWidget):
button Button button Button
entry Entry""" entry Entry"""
# FIXME: It should inherit -superclass tixLabelWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixFileEntry', TixWidget.__init__(self, master, 'tixFileEntry',
['dialogtype', 'options'], cnf, kw) ['dialogtype', 'options'], cnf, kw)
@ -814,7 +821,7 @@ def invoke(self):
self.tk.call(self._w, 'invoke') self.tk.call(self._w, 'invoke')
def file_dialog(self): def file_dialog(self):
# XXX return python object # FIXME: return python object
pass pass
class HList(TixWidget): class HList(TixWidget):
@ -1003,7 +1010,7 @@ def yview(self, *args):
apply(self.tk.call, (self._w, 'yview') + args) apply(self.tk.call, (self._w, 'yview') + args)
class InputOnly(TixWidget): class InputOnly(TixWidget):
"""InputOnly - Invisible widget. """InputOnly - Invisible widget. Unix only.
Subwidgets - None""" Subwidgets - None"""
@ -1131,7 +1138,7 @@ def raised(self):
return self.tk.call(self._w, 'raised') return self.tk.call(self._w, 'raised')
class NoteBookFrame(TixWidget): class NoteBookFrame(TixWidget):
"""Will be added when Tix documentation is available !!!""" # FIXME: This is dangerous to expose to be called on its own.
pass pass
class OptionMenu(TixWidget): class OptionMenu(TixWidget):
@ -1223,6 +1230,7 @@ class PopupMenu(TixWidget):
menubutton Menubutton menubutton Menubutton
menu Menu""" menu Menu"""
# FIXME: It should inherit -superclass tixShell
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
@ -1239,7 +1247,8 @@ def post_widget(self, widget, x, y):
class ResizeHandle(TixWidget): class ResizeHandle(TixWidget):
"""Internal widget to draw resize handles on Scrolled widgets.""" """Internal widget to draw resize handles on Scrolled widgets."""
# FIXME: This is dangerous to expose to be called on its own.
# Perhaps rename ResizeHandle to _ResizeHandle
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
# There seems to be a Tix bug rejecting the configure method # There seems to be a Tix bug rejecting the configure method
# Let's try making the flags -static # Let's try making the flags -static
@ -1265,6 +1274,7 @@ def show(self, widget):
class ScrolledHList(TixWidget): class ScrolledHList(TixWidget):
"""ScrolledHList - HList with automatic scrollbars.""" """ScrolledHList - HList with automatic scrollbars."""
# FIXME: It should inherit -superclass tixScrolledWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
cnf, kw) cnf, kw)
@ -1275,6 +1285,7 @@ def __init__(self, master, cnf={}, **kw):
class ScrolledListBox(TixWidget): class ScrolledListBox(TixWidget):
"""ScrolledListBox - Listbox with automatic scrollbars.""" """ScrolledListBox - Listbox with automatic scrollbars."""
# FIXME: It should inherit -superclass tixScrolledWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
@ -1284,6 +1295,7 @@ def __init__(self, master, cnf={}, **kw):
class ScrolledText(TixWidget): class ScrolledText(TixWidget):
"""ScrolledText - Text with automatic scrollbars.""" """ScrolledText - Text with automatic scrollbars."""
# FIXME: It should inherit -superclass tixScrolledWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
self.subwidget_list['text'] = _dummyText(self, 'text') self.subwidget_list['text'] = _dummyText(self, 'text')
@ -1293,6 +1305,7 @@ def __init__(self, master, cnf={}, **kw):
class ScrolledTList(TixWidget): class ScrolledTList(TixWidget):
"""ScrolledTList - TList with automatic scrollbars.""" """ScrolledTList - TList with automatic scrollbars."""
# FIXME: It should inherit -superclass tixScrolledWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
cnf, kw) cnf, kw)
@ -1303,6 +1316,7 @@ def __init__(self, master, cnf={}, **kw):
class ScrolledWindow(TixWidget): class ScrolledWindow(TixWidget):
"""ScrolledWindow - Window with automatic scrollbars.""" """ScrolledWindow - Window with automatic scrollbars."""
# FIXME: It should inherit -superclass tixScrolledWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
self.subwidget_list['window'] = _dummyFrame(self, 'window') self.subwidget_list['window'] = _dummyFrame(self, 'window')
@ -1315,6 +1329,7 @@ class Select(TixWidget):
Subwidgets are buttons added dynamically using the add method.""" Subwidgets are buttons added dynamically using the add method."""
# FIXME: It should inherit -superclass tixLabelWidget
def __init__(self, master, cnf={}, **kw): def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixSelect', TixWidget.__init__(self, master, 'tixSelect',
['allowzero', 'radio', 'orientation', 'labelside', ['allowzero', 'radio', 'orientation', 'labelside',
@ -1347,6 +1362,7 @@ class DialogShell(TixWidget):
Subwidgets - None""" Subwidgets - None"""
# FIXME: It should inherit from Shell
def __init__ (self,master=None,cnf={}, **kw): def __init__ (self,master=None,cnf={}, **kw):
TixWidget.__init__(self, master, TixWidget.__init__(self, master,
'tixDialogShell', 'tixDialogShell',
@ -1474,6 +1490,7 @@ class Tree(TixWidget):
data in a tree form. The user can adjust data in a tree form. The user can adjust
the view of the tree by opening or closing parts of the tree.""" the view of the tree by opening or closing parts of the tree."""
# FIXME: It should inherit -superclass tixScrolledWidget
def __init__(self, master=None, cnf={}, **kw): def __init__(self, master=None, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixTree', TixWidget.__init__(self, master, 'tixTree',
['options'], cnf, kw) ['options'], cnf, kw)
@ -1482,18 +1499,34 @@ def __init__(self, master=None, cnf={}, **kw):
self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
def autosetmode(self): def autosetmode(self):
'''This command calls the setmode method for all the entries in this
Tree widget: if an entry has no child entries, its mode is set to
none. Otherwise, if the entry has any hidden child entries, its mode is
set to open; otherwise its mode is set to close.'''
self.tk.call(self._w, 'autosetmode') self.tk.call(self._w, 'autosetmode')
def close(self, entrypath): def close(self, entrypath):
'''Close the entry given by entryPath if its mode is close.'''
self.tk.call(self._w, 'close', entrypath) self.tk.call(self._w, 'close', entrypath)
def getmode(self, entrypath): def getmode(self, entrypath):
'''Returns the current mode of the entry given by entryPath.'''
return self.tk.call(self._w, 'getmode', entrypath) return self.tk.call(self._w, 'getmode', entrypath)
def open(self, entrypath): def open(self, entrypath):
'''Open the entry given by entryPath if its mode is open.'''
self.tk.call(self._w, 'open', entrypath) self.tk.call(self._w, 'open', entrypath)
def setmode(self, entrypath, mode='none'): def setmode(self, entrypath, mode='none'):
'''This command is used to indicate whether the entry given by
entryPath has children entries and whether the children are visible. mode
must be one of open, close or none. If mode is set to open, a (+)
indicator is drawn next the the entry. If mode is set to close, a (-)
indicator is drawn next the the entry. If mode is set to none, no
indicators will be drawn for this entry. The default mode is none. The
open mode indicates the entry has hidden children and this entry can be
opened by the user. The close mode indicates that all the children of the
entry are now visible and the entry can be closed by the user.'''
self.tk.call(self._w, 'setmode', entrypath, mode) self.tk.call(self._w, 'setmode', entrypath, mode)
@ -1504,7 +1537,7 @@ class CheckList(TixWidget):
similarly to the Tk checkbutton or radiobutton widgets, except it is similarly to the Tk checkbutton or radiobutton widgets, except it is
capable of handling many more items than checkbuttons or radiobuttons. capable of handling many more items than checkbuttons or radiobuttons.
""" """
# FIXME: It should inherit -superclass tixTree
def __init__(self, master=None, cnf={}, **kw): def __init__(self, master=None, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixCheckList', TixWidget.__init__(self, master, 'tixCheckList',
['options'], cnf, kw) ['options'], cnf, kw)
@ -1513,25 +1546,38 @@ def __init__(self, master=None, cnf={}, **kw):
self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
def autosetmode(self): def autosetmode(self):
'''This command calls the setmode method for all the entries in this
Tree widget: if an entry has no child entries, its mode is set to
none. Otherwise, if the entry has any hidden child entries, its mode is
set to open; otherwise its mode is set to close.'''
self.tk.call(self._w, 'autosetmode') self.tk.call(self._w, 'autosetmode')
def close(self, entrypath): def close(self, entrypath):
'''Close the entry given by entryPath if its mode is close.'''
self.tk.call(self._w, 'close', entrypath) self.tk.call(self._w, 'close', entrypath)
def getmode(self, entrypath): def getmode(self, entrypath):
'''Returns the current mode of the entry given by entryPath.'''
return self.tk.call(self._w, 'getmode', entrypath) return self.tk.call(self._w, 'getmode', entrypath)
def open(self, entrypath): def open(self, entrypath):
'''Open the entry given by entryPath if its mode is open.'''
self.tk.call(self._w, 'open', entrypath) self.tk.call(self._w, 'open', entrypath)
def getselection(self, mode='on'): def getselection(self, mode='on'):
'''Mode can be on, off, default''' '''Returns a list of items whose status matches status. If status is
self.tk.call(self._w, 'getselection', mode) not specified, the list of items in the "on" status will be returned.
Mode can be on, off, default'''
c = self.tk.split(self.tk.call(self._w, 'getselection', mode))
return self.tk.splitlist(c)
def getstatus(self, entrypath): def getstatus(self, entrypath):
self.tk.call(self._w, 'getstatus', entrypath) '''Returns the current status of entryPath.'''
return self.tk.call(self._w, 'getstatus', entrypath)
def setstatus(self, entrypath, mode='on'): def setstatus(self, entrypath, mode='on'):
'''Sets the status of entryPath to be status. A bitmap will be
displayed next to the entry its status is on, off or default.'''
self.tk.call(self._w, 'setstatus', entrypath, mode) self.tk.call(self._w, 'setstatus', entrypath, mode)
@ -1690,6 +1736,7 @@ def FileTypeList(dict):
return s return s
# Still to be done: # Still to be done:
# tixIconView
class CObjView(TixWidget): class CObjView(TixWidget):
"""This file implements the Canvas Object View widget. This is a base """This file implements the Canvas Object View widget. This is a base
class of IconView. It implements automatic placement/adjustment of the class of IconView. It implements automatic placement/adjustment of the
@ -1697,4 +1744,11 @@ class of IconView. It implements automatic placement/adjustment of the
The scrollbars are adjusted so that the canvas is just large enough The scrollbars are adjusted so that the canvas is just large enough
to see all the objects. to see all the objects.
""" """
# FIXME: It should inherit -superclass tixScrolledWidget
pass
class ScrolledGrid(TixWidget):
'''Scrolled Grid widgets'''
# FIXME: It should inherit -superclass tixScrolledWidget
pass pass