10a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
20a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
30a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# $Id$
40a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
50a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Tix.py -- Tix widget wrappers.
60a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
70a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#       For Tix, see http://tix.sourceforge.net
80a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
90a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#       - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#         based on an idea of Jean-Marc Lugrin (lugrin@ms.com)
110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# NOTE: In order to minimize changes to Tkinter.py, some of the code here
130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#       (TixWidget.__init__) has been taken from Tkinter (Widget.__init__)
140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#       and will break if there are major changes in Tkinter.
150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# The Tix widgets are represented by a class hierarchy in python with proper
170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# inheritance of base classes.
180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# As a result after creating a 'w = StdButtonBox', I can write
200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#              w.ok['text'] = 'Who Cares'
210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#    or              w.ok['bg'] = w['bg']
220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# or even       w.ok.invoke()
230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# etc.
240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Compare the demo tixwidgets.py to the original Tcl program and you will
260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# appreciate the advantages.
270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
290a8c90248264a8b26970b4473770bcc3df8515fJosh Gaofrom Tkinter import *
300a8c90248264a8b26970b4473770bcc3df8515fJosh Gaofrom Tkinter import _flatten, _cnfmerge, _default_root
310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# WARNING - TkVersion is a limited precision floating point number
330a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoif TkVersion < 3.999:
340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
360a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoimport _tkinter # If this fails your Python may not be configured for Tk
370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Some more constants (for consistency with Tkinter)
390a8c90248264a8b26970b4473770bcc3df8515fJosh GaoWINDOW = 'window'
400a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTEXT = 'text'
410a8c90248264a8b26970b4473770bcc3df8515fJosh GaoSTATUS = 'status'
420a8c90248264a8b26970b4473770bcc3df8515fJosh GaoIMMEDIATE = 'immediate'
430a8c90248264a8b26970b4473770bcc3df8515fJosh GaoIMAGE = 'image'
440a8c90248264a8b26970b4473770bcc3df8515fJosh GaoIMAGETEXT = 'imagetext'
450a8c90248264a8b26970b4473770bcc3df8515fJosh GaoBALLOON = 'balloon'
460a8c90248264a8b26970b4473770bcc3df8515fJosh GaoAUTO = 'auto'
470a8c90248264a8b26970b4473770bcc3df8515fJosh GaoACROSSTOP = 'acrosstop'
480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# A few useful constants for the Grid widget
500a8c90248264a8b26970b4473770bcc3df8515fJosh GaoASCII = 'ascii'
510a8c90248264a8b26970b4473770bcc3df8515fJosh GaoCELL = 'cell'
520a8c90248264a8b26970b4473770bcc3df8515fJosh GaoCOLUMN = 'column'
530a8c90248264a8b26970b4473770bcc3df8515fJosh GaoDECREASING = 'decreasing'
540a8c90248264a8b26970b4473770bcc3df8515fJosh GaoINCREASING = 'increasing'
550a8c90248264a8b26970b4473770bcc3df8515fJosh GaoINTEGER = 'integer'
560a8c90248264a8b26970b4473770bcc3df8515fJosh GaoMAIN = 'main'
570a8c90248264a8b26970b4473770bcc3df8515fJosh GaoMAX = 'max'
580a8c90248264a8b26970b4473770bcc3df8515fJosh GaoREAL = 'real'
590a8c90248264a8b26970b4473770bcc3df8515fJosh GaoROW = 'row'
600a8c90248264a8b26970b4473770bcc3df8515fJosh GaoS_REGION = 's-region'
610a8c90248264a8b26970b4473770bcc3df8515fJosh GaoX_REGION = 'x-region'
620a8c90248264a8b26970b4473770bcc3df8515fJosh GaoY_REGION = 'y-region'
630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Some constants used by Tkinter dooneevent()
650a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTCL_DONT_WAIT     = 1 << 1
660a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTCL_WINDOW_EVENTS = 1 << 2
670a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTCL_FILE_EVENTS   = 1 << 3
680a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTCL_TIMER_EVENTS  = 1 << 4
690a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTCL_IDLE_EVENTS   = 1 << 5
700a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTCL_ALL_EVENTS    = 0
710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# BEWARE - this is implemented by copying some code from the Widget class
730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#          in Tkinter (to override Widget initialization) and is therefore
740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#          liable to break.
750a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoimport Tkinter, os
760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Could probably add this to Tkinter.Misc
780a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass tixCommand:
790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """The tix commands provide access to miscellaneous  elements
800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    of  Tix's  internal state and the Tix application context.
810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Most of the information manipulated by these  commands pertains
820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    to  the  application  as a whole, or to a screen or
830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    display, rather than to a particular window.
840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    This is a mixin class, assumed to be mixed to Tkinter.Tk
860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    that supports the self.tk.call method.
870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """
880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_addbitmapdir(self, directory):
900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Tix maintains a list of directories under which
910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        the  tix_getimage  and tix_getbitmap commands will
920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        search for image files. The standard bitmap  directory
930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        is $TIX_LIBRARY/bitmaps. The addbitmapdir command
940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        adds directory into this list. By  using  this
950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        command, the  image  files  of an applications can
960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        also be located using the tix_getimage or tix_getbitmap
970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        command.
980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tix', 'addbitmapdir', directory)
1000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_cget(self, option):
1020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Returns  the  current  value  of the configuration
1030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        option given by option. Option may be  any  of  the
1040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        options described in the CONFIGURATION OPTIONS section.
1050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
1060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tix', 'cget', option)
1070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_configure(self, cnf=None, **kw):
1090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Query or modify the configuration options of the Tix application
1100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        context. If no option is specified, returns a dictionary all of the
1110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        available options.  If option is specified with no value, then the
1120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        command returns a list describing the one named option (this list
1130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        will be identical to the corresponding sublist of the value
1140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        returned if no option is specified).  If one or more option-value
1150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        pairs are specified, then the command modifies the given option(s)
1160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        to have the given value(s); in this case the command returns an
1170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        empty string. Option may be any of the configuration options.
1180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
1190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Copied from Tkinter.py
1200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if kw:
1210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = _cnfmerge((cnf, kw))
1220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        elif cnf:
1230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = _cnfmerge(cnf)
1240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf is None:
1250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = {}
1260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            for x in self.tk.split(self.tk.call('tix', 'configure')):
1270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                cnf[x[0][1:]] = (x[0][1:],) + x[1:]
1280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return cnf
1290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if isinstance(cnf, StringType):
1300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            x = self.tk.split(self.tk.call('tix', 'configure', '-'+cnf))
1310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return (x[0][1:],) + x[1:]
1320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(('tix', 'configure') + self._options(cnf))
1330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_filedialog(self, dlgclass=None):
1350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Returns the file selection dialog that may be shared among
1360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        different calls from this application.  This command will create a
1370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        file selection dialog widget when it is called the first time. This
1380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        dialog will be returned by all subsequent calls to tix_filedialog.
1390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        An optional dlgclass parameter can be passed to specified what type
1400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        of file selection dialog widget is desired. Possible options are
1410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        tix FileSelectDialog or tixExFileSelectDialog.
1420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
1430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if dlgclass is not None:
1440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call('tix', 'filedialog', dlgclass)
1450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
1460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call('tix', 'filedialog')
1470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_getbitmap(self, name):
1490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Locates a bitmap file of the name name.xpm or name in one of the
1500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        bitmap directories (see the tix_addbitmapdir command above).  By
1510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        using tix_getbitmap, you can avoid hard coding the pathnames of the
1520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        bitmap files in your application. When successful, it returns the
1530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        complete pathname of the bitmap file, prefixed with the character
1540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '@'.  The returned value can be used to configure the -bitmap
1550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        option of the TK and Tix widgets.
1560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
1570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tix', 'getbitmap', name)
1580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_getimage(self, name):
1600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Locates an image file of the name name.xpm, name.xbm or name.ppm
1610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        in one of the bitmap directories (see the addbitmapdir command
1620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        above). If more than one file with the same name (but different
1630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        extensions) exist, then the image type is chosen according to the
1640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        depth of the X display: xbm images are chosen on monochrome
1650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        displays and color images are chosen on color displays. By using
1660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        tix_ getimage, you can avoid hard coding the pathnames of the
1670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        image files in your application. When successful, this command
1680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        returns the name of the newly created image, which can be used to
1690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        configure the -image option of the Tk and Tix widgets.
1700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
1710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tix', 'getimage', name)
1720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_option_get(self, name):
1740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Gets  the options  maintained  by  the  Tix
1750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        scheme mechanism. Available options include:
1760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            active_bg       active_fg      bg
1780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            bold_font       dark1_bg       dark1_fg
1790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            dark2_bg        dark2_fg       disabled_fg
1800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            fg              fixed_font     font
1810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            inactive_bg     inactive_fg    input1_bg
1820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            input2_bg       italic_font    light1_bg
1830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            light1_fg       light2_bg      light2_fg
1840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            menu_font       output1_bg     output2_bg
1850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            select_bg       select_fg      selector
1860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            """
1870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # could use self.tk.globalgetvar('tixOption', name)
1880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tix', 'option', 'get', name)
1890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None):
1910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Resets the scheme and fontset of the Tix application to
1920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        newScheme and newFontSet, respectively.  This affects only those
1930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        widgets created after this call. Therefore, it is best to call the
1940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        resetoptions command before the creation of any widgets in a Tix
1950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        application.
1960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
1970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        The optional parameter newScmPrio can be given to reset the
1980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        priority level of the Tk options set by the Tix schemes.
1990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        Because of the way Tk handles the X option database, after Tix has
2010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        been has imported and inited, it is not possible to reset the color
2020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        schemes and font sets using the tix config command.  Instead, the
2030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        tix_resetoptions command must be used.
2040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """
2050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if newScmPrio is not None:
2060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio)
2070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
2080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call('tix', 'resetoptions', newScheme, newFontSet)
2090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2100a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Tk(Tkinter.Tk, tixCommand):
2110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Toplevel widget of Tix which represents mostly the main window
2120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    of an application. It has an associated Tcl interpreter."""
2130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, screenName=None, baseName=None, className='Tix'):
2140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        Tkinter.Tk.__init__(self, screenName, baseName, className)
2150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        tixlib = os.environ.get('TIX_LIBRARY')
2160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]')
2170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if tixlib is not None:
2180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib)
2190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
2200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Load Tix - this should work dynamically or statically
2210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # If it's static, tcl/tix8.1/pkgIndex.tcl should have
2220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        #               'load {} Tix'
2230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # If it's dynamic under Unix, tcl/tix8.1/pkgIndex.tcl should have
2240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        #               'load libtix8.1.8.3.so Tix'
2250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.eval('package require Tix')
2260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def destroy(self):
2280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # For safety, remove an delete_window binding before destroy
2290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.protocol("WM_DELETE_WINDOW", "")
2300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        Tkinter.Tk.destroy(self)
2310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# The Tix 'tixForm' geometry manager
2330a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Form:
2340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """The Tix Form geometry manager
2350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Widgets can be arranged by specifying attachments to other widgets.
2370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    See Tix documentation for complete details"""
2380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def config(self, cnf={}, **kw):
2400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call('tixForm', self._w, *self._options(cnf, kw))
2410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    form = config
2430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __setitem__(self, key, value):
2450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        Form.form(self, {key: value})
2460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def check(self):
2480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tixForm', 'check', self._w)
2490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def forget(self):
2510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call('tixForm', 'forget', self._w)
2520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def grid(self, xsize=0, ysize=0):
2540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if (not xsize) and (not ysize):
2550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            x = self.tk.call('tixForm', 'grid', self._w)
2560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            y = self.tk.splitlist(x)
2570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            z = ()
2580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            for x in y:
2590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                z = z + (self.tk.getint(x),)
2600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return z
2610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
2620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info(self, option=None):
2640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not option:
2650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call('tixForm', 'info', self._w)
2660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if option[0] != '-':
2670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            option = '-' + option
2680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call('tixForm', 'info', self._w, option)
2690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def slaves(self):
2710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return map(self._nametowidget,
2720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                   self.tk.splitlist(
2730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                       self.tk.call(
2740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                       'tixForm', 'slaves', self._w)))
2750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2780a8c90248264a8b26970b4473770bcc3df8515fJosh GaoTkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,)
2790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2800a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass TixWidget(Tkinter.Widget):
2810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """A TixWidget class is used to package all (or most) Tix widgets.
2820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Widget initialization is extended in two ways:
2840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao       1) It is possible to give a list of options which must be part of
2850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao       the creation command (so called Tix 'static' options). These cannot be
2860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao       given as a 'config' command later.
2870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao       2) It is possible to give the name of an existing TK widget. These are
2880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao       child widgets created automatically by a Tix mega-widget. The Tk call
2890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao       to create these widgets is therefore bypassed in TixWidget.__init__
2900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
2910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Both options are for use by subclasses only.
2920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """
2930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self, master=None, widgetName=None,
2940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                static_options=None, cnf={}, kw={}):
2950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Merge keywords and dictionary arguments
2960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if kw:
2970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = _cnfmerge((cnf, kw))
2980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
2990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = _cnfmerge(cnf)
3000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Move static options into extra. static_options must be
3020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # a list of keywords (or None).
3030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        extra=()
3040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # 'options' is always a static option
3060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if static_options:
3070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            static_options.append('options')
3080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
3090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            static_options = ['options']
3100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for k,v in cnf.items()[:]:
3120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            if k in static_options:
3130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                extra = extra + ('-' + k, v)
3140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                del cnf[k]
3150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.widgetName = widgetName
3170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        Widget._setup(self, master, cnf)
3180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # If widgetName is None, this is a dummy creation call where the
3200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # corresponding Tk widget has already been created by Tix
3210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if widgetName:
3220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(widgetName, self._w, *extra)
3230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Non-static options - to be done via a 'config' command
3250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf:
3260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            Widget.config(self, cnf)
3270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Dictionary to hold subwidget names for easier access. We can't
3290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # use the children list because the public Tix names may not be the
3300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # same as the pathname component
3310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list = {}
3320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # We set up an attribute access function so that it is possible to
3340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello'
3350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # when w is a StdButtonBox.
3360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # We can even do w.ok.invoke() because w.ok is subclassed from the
3370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # Button class if you go through the proper constructors
3380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __getattr__(self, name):
3390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if name in self.subwidget_list:
3400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.subwidget_list[name]
3410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        raise AttributeError, name
3420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def set_silent(self, value):
3440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Set a variable without calling its action routine"""
3450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call('tixSetSilent', self._w, value)
3460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def subwidget(self, name):
3480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Return the named subwidget (which must have been created by
3490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        the sub-class)."""
3500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        n = self._subwidget_name(name)
3510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not n:
3520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            raise TclError, "Subwidget " + name + " not child of " + self._name
3530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Remove header of name and leading dot
3540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        n = n[len(self._w)+1:]
3550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self._nametowidget(n)
3560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def subwidgets_all(self):
3580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Return all subwidgets."""
3590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        names = self._subwidget_names()
3600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not names:
3610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return []
3620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        retlist = []
3630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for name in names:
3640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            name = name[len(self._w)+1:]
3650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            try:
3660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                retlist.append(self._nametowidget(name))
3670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            except:
3680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                # some of the widgets are unknown e.g. border in LabelFrame
3690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                pass
3700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return retlist
3710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def _subwidget_name(self,name):
3730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Get a subwidget name (returns a String, not a Widget !)"""
3740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        try:
3750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call(self._w, 'subwidget', name)
3760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        except TclError:
3770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return None
3780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def _subwidget_names(self):
3800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Return the name of all subwidgets."""
3810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        try:
3820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            x = self.tk.call(self._w, 'subwidgets', '-all')
3830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.split(x)
3840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        except TclError:
3850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return None
3860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
3870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def config_all(self, option, value):
3880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Set configuration options for all subwidgets (and self)."""
3890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if option == '':
3900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return
3910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        elif not isinstance(option, StringType):
3920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            option = repr(option)
3930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not isinstance(value, StringType):
3940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            value = repr(value)
3950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        names = self._subwidget_names()
3960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for name in names:
3970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(name, 'configure', '-' + option, value)
3980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # These are missing from Tkinter
3990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def image_create(self, imgtype, cnf={}, master=None, **kw):
4000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not master:
4010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            master = Tkinter._default_root
4020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            if not master:
4030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                raise RuntimeError, 'Too early to create image'
4040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if kw and cnf: cnf = _cnfmerge((cnf, kw))
4050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        elif kw: cnf = kw
4060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        options = ()
4070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for k, v in cnf.items():
4080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            if hasattr(v, '__call__'):
4090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                v = self._register(v)
4100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            options = options + ('-'+k, v)
4110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return master.tk.call(('image', 'create', imgtype,) + options)
4120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def image_delete(self, imgname):
4130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        try:
4140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call('image', 'delete', imgname)
4150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        except TclError:
4160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # May happen if the root was destroyed
4170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            pass
4180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Subwidgets are child widgets created automatically by mega-widgets.
4200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# In python, we have to create these subwidgets manually to mirror their
4210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# existence in Tk/Tix.
4220a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass TixSubWidget(TixWidget):
4230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Subwidget class.
4240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    This is used to mirror child widgets automatically created
4260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    by Tix/Tk as part of a mega-widget in Python (which is not informed
4270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    of this)"""
4280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name,
4300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao               destroy_physically=1, check_intermediate=1):
4310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if check_intermediate:
4320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            path = master._subwidget_name(name)
4330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            try:
4340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                path = path[len(master._w)+1:]
4350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                plist = path.split('.')
4360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            except:
4370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                plist = []
4380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not check_intermediate:
4400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # immediate descendant
4410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            TixWidget.__init__(self, master, None, None, {'name' : name})
4420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
4430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # Ensure that the intermediate widgets exist
4440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            parent = master
4450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            for i in range(len(plist) - 1):
4460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                n = '.'.join(plist[:i+1])
4470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                try:
4480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                    w = master._nametowidget(n)
4490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                    parent = w
4500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                except KeyError:
4510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                    # Create the intermediate widget
4520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                    parent = TixSubWidget(parent, plist[i],
4530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                          destroy_physically=0,
4540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                          check_intermediate=0)
4550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # The Tk widget name is in plist, not in name
4560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            if plist:
4570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                name = plist[-1]
4580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            TixWidget.__init__(self, parent, None, None, {'name' : name})
4590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.destroy_physically = destroy_physically
4600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def destroy(self):
4620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # For some widgets e.g., a NoteBook, when we call destructors,
4630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # we must be careful not to destroy the frame widget since this
4640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # also destroys the parent NoteBook thus leading to an exception
4650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # in Tkinter when it finally calls Tcl to destroy the NoteBook
4660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for c in self.children.values(): c.destroy()
4670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if self._name in self.master.children:
4680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            del self.master.children[self._name]
4690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if self._name in self.master.subwidget_list:
4700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            del self.master.subwidget_list[self._name]
4710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if self.destroy_physically:
4720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # This is bypassed only for a few widgets
4730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call('destroy', self._w)
4740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Useful func. to split Tcl lists and return as a dict. From Tkinter.py
4770a8c90248264a8b26970b4473770bcc3df8515fJosh Gaodef _lst2dict(lst):
4780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    dict = {}
4790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    for x in lst:
4800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        dict[x[0][1:]] = (x[0][1:],) + x[1:]
4810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    return dict
4820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Useful class to create a display style - later shared by many items.
4840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Contributed by Steffen Kremser
4850a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass DisplayStyle:
4860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """DisplayStyle - handle configuration options shared by
4870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    (multiple) Display Items"""
4880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, itemtype, cnf={}, **kw):
4900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        master = _default_root              # global from Tkinter
4910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not master and 'refwindow' in cnf: master=cnf['refwindow']
4920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        elif not master and 'refwindow' in kw:  master= kw['refwindow']
4930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        elif not master: raise RuntimeError, "Too early to create display style: no root window"
4940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk = master.tk
4950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.stylename = self.tk.call('tixDisplayStyle', itemtype,
4960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                            *self._options(cnf,kw) )
4970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
4980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __str__(self):
4990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.stylename
5000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def _options(self, cnf, kw):
5020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if kw and cnf:
5030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = _cnfmerge((cnf, kw))
5040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        elif kw:
5050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            cnf = kw
5060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        opts = ()
5070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for k, v in cnf.items():
5080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            opts = opts + ('-'+k, v)
5090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return opts
5100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete(self):
5120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self.stylename, 'delete')
5130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __setitem__(self,key,value):
5150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self.stylename, 'configure', '-%s'%key, value)
5160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def config(self, cnf={}, **kw):
5180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return _lst2dict(
5190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.split(
5200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(
5210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                  self.stylename, 'configure', *self._options(cnf,kw))))
5220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __getitem__(self,key):
5240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self.stylename, 'cget', '-%s'%key)
5250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao######################################################
5280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao### The Tix Widget classes - in alphabetical order ###
5290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao######################################################
5300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5310a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Balloon(TixWidget):
5320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Balloon help widget.
5330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
5350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
5360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    label           Label
5370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    message         Message"""
5380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixShell
5400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
5410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # static seem to be -installcolormap -initwait -statusbar -cursor
5420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        static = ['options', 'installcolormap', 'initwait', 'statusbar',
5430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                  'cursor']
5440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw)
5450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label',
5460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                   destroy_physically=0)
5470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['message'] = _dummyLabel(self, 'message',
5480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                     destroy_physically=0)
5490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def bind_widget(self, widget, cnf={}, **kw):
5510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Bind balloon widget to another.
5520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        One balloon widget may be bound to several widgets at the same time"""
5530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw))
5540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def unbind_widget(self, widget):
5560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'unbind', widget._w)
5570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5580a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ButtonBox(TixWidget):
5590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ButtonBox - A container for pushbuttons.
5600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets are the buttons added with the add method.
5610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """
5620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
5630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixButtonBox',
5640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['orientation', 'options'], cnf, kw)
5650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add(self, name, cnf={}, **kw):
5670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Add a button with given name to box."""
5680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
5700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name] = _dummyButton(self, name)
5710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return btn
5720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self, name):
5740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if name in self.subwidget_list:
5750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(self._w, 'invoke', name)
5760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5770a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ComboBox(TixWidget):
5780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ComboBox - an Entry field with a dropdown menu. The user can select a
5790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    choice by either typing in the entry subwidget or selecting from the
5800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    listbox subwidget.
5810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
5830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
5840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    entry       Entry
5850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    arrow       Button
5860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    slistbox    ScrolledListBox
5870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    tick        Button
5880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    cross       Button : present if created with the fancy option"""
5890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
5900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixLabelWidget
5910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self, master=None, cnf={}, **kw):
5920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixComboBox',
5930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['editable', 'dropdown', 'fancy', 'options'],
5940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           cnf, kw)
5950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label')
5960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
5970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
5980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
5990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                                'slistbox')
6000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        try:
6010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
6020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
6030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        except TypeError:
6040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # unavailable when -fancy not specified
6050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            pass
6060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # align
6080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add_history(self, str):
6100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'addhistory', str)
6110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def append_history(self, str):
6130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'appendhistory', str)
6140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def insert(self, index, str):
6160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'insert', index, str)
6170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def pick(self, index):
6190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'pick', index)
6200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6210a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Control(TixWidget):
6220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Control - An entry field with value change arrows.  The user can
6230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    adjust the value by pressing the two arrow buttons or by entering
6240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the value directly into the entry. The new value will be checked
6250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    against the user-defined upper and lower limits.
6260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
6280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
6290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    incr       Button
6300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    decr       Button
6310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    entry       Entry
6320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    label       Label"""
6330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixLabelWidget
6350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self, master=None, cnf={}, **kw):
6360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
6370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['incr'] = _dummyButton(self, 'incr')
6380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['decr'] = _dummyButton(self, 'decr')
6390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label')
6400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
6410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def decrement(self):
6430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'decr')
6440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def increment(self):
6460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'incr')
6470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self):
6490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'invoke')
6500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def update(self):
6520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'update')
6530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6540a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass DirList(TixWidget):
6550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """DirList - displays a list view of a directory, its previous
6560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    directories and its sub-directories. The user can choose one of
6570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the directories displayed in the list or change to another directory.
6580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
6600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
6610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    hlist       HList
6620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    hsb              Scrollbar
6630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    vsb              Scrollbar"""
6640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledHList
6660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
6670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
6680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
6690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
6700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
6710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def chdir(self, dir):
6730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'chdir', dir)
6740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6750a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass DirTree(TixWidget):
6760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """DirTree - Directory Listing in a hierarchical view.
6770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Displays a tree view of a directory, its previous directories and its
6780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    sub-directories. The user can choose one of the directories displayed
6790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    in the list or change to another directory.
6800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
6820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
6830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    hlist           HList
6840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    hsb             Scrollbar
6850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    vsb             Scrollbar"""
6860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledHList
6880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
6890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
6900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
6910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
6920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
6930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def chdir(self, dir):
6950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'chdir', dir)
6960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
6970a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass DirSelectBox(TixWidget):
6980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """DirSelectBox - Motif style file select box.
6990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    It is generally used for
7000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the user to choose a file. FileSelectBox stores the files mostly
7010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    recently selected into a ComboBox widget so that they can be quickly
7020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    selected again.
7030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
7050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
7060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    selection       ComboBox
7070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    filter          ComboBox
7080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    dirlist         ScrolledListBox
7090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    filelist        ScrolledListBox"""
7100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
7120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
7130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
7140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
7150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7160a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ExFileSelectBox(TixWidget):
7170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ExFileSelectBox - MS Windows style file select box.
7180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    It provides an convenient method for the user to select files.
7190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
7210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
7220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    cancel       Button
7230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ok              Button
7240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    hidden       Checkbutton
7250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    types       ComboBox
7260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    dir              ComboBox
7270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    file       ComboBox
7280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    dirlist       ScrolledListBox
7290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    filelist       ScrolledListBox"""
7300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
7320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
7330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
7340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
7350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
7360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
7370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
7380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
7390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
7400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
7410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def filter(self):
7430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'filter')
7440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self):
7460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'invoke')
7470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Should inherit from a Dialog class
7500a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass DirSelectDialog(TixWidget):
7510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """The DirSelectDialog widget presents the directories in the file
7520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    system in a dialog window. The user can use this dialog window to
7530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    navigate through the file system to select the desired directory.
7540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
7560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
7570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    dirbox       DirSelectDialog"""
7580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixDialogShell
7600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
7610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixDirSelectDialog',
7620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options'], cnf, kw)
7630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
7640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # cancel and ok buttons are missing
7650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popup(self):
7670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popup')
7680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popdown(self):
7700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popdown')
7710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Should inherit from a Dialog class
7740a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ExFileSelectDialog(TixWidget):
7750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ExFileSelectDialog - MS Windows style file select dialog.
7760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    It provides an convenient method for the user to select files.
7770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
7790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
7800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    fsbox       ExFileSelectBox"""
7810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixDialogShell
7830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
7840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixExFileSelectDialog',
7850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options'], cnf, kw)
7860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
7870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popup(self):
7890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popup')
7900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popdown(self):
7920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popdown')
7930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
7940a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass FileSelectBox(TixWidget):
7950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ExFileSelectBox - Motif style file select box.
7960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    It is generally used for
7970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the user to choose a file. FileSelectBox stores the files mostly
7980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    recently selected into a ComboBox widget so that they can be quickly
7990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    selected again.
8000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
8020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
8030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    selection       ComboBox
8040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    filter          ComboBox
8050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    dirlist         ScrolledListBox
8060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    filelist        ScrolledListBox"""
8070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
8090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
8100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
8110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
8120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
8130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
8140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def apply_filter(self):              # name of subwidget is same as command
8160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'filter')
8170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self):
8190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'invoke')
8200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Should inherit from a Dialog class
8220a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass FileSelectDialog(TixWidget):
8230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """FileSelectDialog - Motif style file select dialog.
8240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
8260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
8270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    btns       StdButtonBox
8280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    fsbox       FileSelectBox"""
8290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixStdDialogShell
8310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
8320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixFileSelectDialog',
8330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options'], cnf, kw)
8340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
8350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
8360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popup(self):
8380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popup')
8390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popdown(self):
8410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popdown')
8420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8430a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass FileEntry(TixWidget):
8440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """FileEntry - Entry field with button that invokes a FileSelectDialog.
8450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    The user can type in the filename manually. Alternatively, the user can
8460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    press the button widget that sits next to the entry, which will bring
8470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    up a file selection dialog.
8480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
8500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
8510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    button       Button
8520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    entry       Entry"""
8530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixLabelWidget
8550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
8560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixFileEntry',
8570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['dialogtype', 'options'], cnf, kw)
8580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['button'] = _dummyButton(self, 'button')
8590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
8600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self):
8620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'invoke')
8630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def file_dialog(self):
8650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # FIXME: return python object
8660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        pass
8670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8680a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass HList(TixWidget, XView, YView):
8690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """HList - Hierarchy display  widget can be used to display any data
8700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    that have a hierarchical structure, for example, file system directory
8710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    trees. The list entries are indented and connected by branch lines
8720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    according to their places in the hierarchy.
8730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets - None"""
8750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
8770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixHList',
8780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['columns', 'options'], cnf, kw)
8790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add(self, entry, cnf={}, **kw):
8810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw))
8820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add_child(self, parent=None, cnf={}, **kw):
8840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not parent:
8850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            parent = ''
8860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(
8870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     self._w, 'addchild', parent, *self._options(cnf, kw))
8880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_set(self, entry):
8900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'anchor', 'set', entry)
8910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_clear(self):
8930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'anchor', 'clear')
8940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
8950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def column_width(self, col=0, width=None, chars=None):
8960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if not chars:
8970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call(self._w, 'column', 'width', col, width)
8980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
8990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return self.tk.call(self._w, 'column', 'width', col,
9000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                '-char', chars)
9010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete_all(self):
9030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', 'all')
9040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete_entry(self, entry):
9060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', 'entry', entry)
9070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete_offsprings(self, entry):
9090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', 'offsprings', entry)
9100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete_siblings(self, entry):
9120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', 'siblings', entry)
9130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dragsite_set(self, index):
9150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dragsite', 'set', index)
9160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dragsite_clear(self):
9180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dragsite', 'clear')
9190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dropsite_set(self, index):
9210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dropsite', 'set', index)
9220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dropsite_clear(self):
9240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dropsite', 'clear')
9250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def header_create(self, col, cnf={}, **kw):
9270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw))
9280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def header_configure(self, col, cnf={}, **kw):
9300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf is None:
9310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return _lst2dict(
9320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.split(
9330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.call(self._w, 'header', 'configure', col)))
9340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'header', 'configure', col,
9350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     *self._options(cnf, kw))
9360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def header_cget(self,  col, opt):
9380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'header', 'cget', col, opt)
9390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def header_exists(self,  col):
9410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'header', 'exists', col)
9420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def header_delete(self, col):
9440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'header', 'delete', col)
9450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def header_size(self, col):
9470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'header', 'size', col)
9480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def hide_entry(self, entry):
9500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'hide', 'entry', entry)
9510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def indicator_create(self, entry, cnf={}, **kw):
9530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(
9540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              self._w, 'indicator', 'create', entry, *self._options(cnf, kw))
9550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def indicator_configure(self, entry, cnf={}, **kw):
9570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf is None:
9580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return _lst2dict(
9590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.split(
9600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.call(self._w, 'indicator', 'configure', entry)))
9610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(
9620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              self._w, 'indicator', 'configure', entry, *self._options(cnf, kw))
9630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def indicator_cget(self,  entry, opt):
9650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'indicator', 'cget', entry, opt)
9660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def indicator_exists(self,  entry):
9680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call (self._w, 'indicator', 'exists', entry)
9690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def indicator_delete(self, entry):
9710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'indicator', 'delete', entry)
9720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def indicator_size(self, entry):
9740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'indicator', 'size', entry)
9750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_anchor(self):
9770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'anchor')
9780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_bbox(self, entry):
9800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self._getints(
9810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.call(self._w, 'info', 'bbox', entry)) or None
9820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_children(self, entry=None):
9840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        c = self.tk.call(self._w, 'info', 'children', entry)
9850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.splitlist(c)
9860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_data(self, entry):
9880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'data', entry)
9890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_dragsite(self):
9910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'dragsite')
9920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_dropsite(self):
9940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'dropsite')
9950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_exists(self, entry):
9970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'exists', entry)
9980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
9990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_hidden(self, entry):
10000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'hidden', entry)
10010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_next(self, entry):
10030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'next', entry)
10040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_parent(self, entry):
10060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'parent', entry)
10070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_prev(self, entry):
10090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'prev', entry)
10100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_selection(self):
10120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        c = self.tk.call(self._w, 'info', 'selection')
10130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.splitlist(c)
10140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def item_cget(self, entry, col, opt):
10160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'item', 'cget', entry, col, opt)
10170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def item_configure(self, entry, col, cnf={}, **kw):
10190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf is None:
10200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return _lst2dict(
10210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.split(
10220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.call(self._w, 'item', 'configure', entry, col)))
10230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'item', 'configure', entry, col,
10240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              *self._options(cnf, kw))
10250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def item_create(self, entry, col, cnf={}, **kw):
10270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(
10280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              self._w, 'item', 'create', entry, col, *self._options(cnf, kw))
10290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def item_exists(self, entry, col):
10310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'item', 'exists', entry, col)
10320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def item_delete(self, entry, col):
10340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'item', 'delete', entry, col)
10350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def entrycget(self, entry, opt):
10370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'entrycget', entry, opt)
10380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def entryconfigure(self, entry, cnf={}, **kw):
10400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf is None:
10410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return _lst2dict(
10420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.split(
10430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.call(self._w, 'entryconfigure', entry)))
10440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'entryconfigure', entry,
10450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              *self._options(cnf, kw))
10460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def nearest(self, y):
10480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'nearest', y)
10490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def see(self, entry):
10510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'see', entry)
10520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def selection_clear(self, cnf={}, **kw):
10540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw))
10550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def selection_includes(self, entry):
10570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'selection', 'includes', entry)
10580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def selection_set(self, first, last=None):
10600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'selection', 'set', first, last)
10610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def show_entry(self, entry):
10630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'show', 'entry', entry)
10640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10650a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass InputOnly(TixWidget):
10660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """InputOnly - Invisible widget. Unix only.
10670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets - None"""
10690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
10710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)
10720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10730a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass LabelEntry(TixWidget):
10740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """LabelEntry - Entry field with label. Packages an entry widget
10750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    and a label into one mega widget. It can beused be used to simplify
10760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the creation of ``entry-form'' type of interface.
10770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
10790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
10800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    label       Label
10810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    entry       Entry"""
10820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
10840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixLabelEntry',
10850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['labelside','options'], cnf, kw)
10860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label')
10870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
10880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10890a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass LabelFrame(TixWidget):
10900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """LabelFrame - Labelled Frame container. Packages a frame widget
10910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    and a label into one mega widget. To create widgets inside a
10920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    LabelFrame widget, one creates the new widgets relative to the
10930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    frame subwidget and manage them inside the frame subwidget.
10940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
10950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
10960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
10970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    label       Label
10980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    frame       Frame"""
10990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
11010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixLabelFrame',
11020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['labelside','options'], cnf, kw)
11030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label')
11040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['frame'] = _dummyFrame(self, 'frame')
11050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11070a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ListNoteBook(TixWidget):
11080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """A ListNoteBook widget is very similar to the TixNoteBook widget:
11090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    it can be used to display many windows in a limited space using a
11100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    notebook metaphor. The notebook is divided into a stack of pages
11110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    (windows). At one time only one of these pages can be shown.
11120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    The user can navigate through these pages by
11130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    choosing the name of the desired page in the hlist subwidget."""
11140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
11160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw)
11170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Is this necessary? It's not an exposed subwidget in Tix.
11180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane',
11190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                        destroy_physically=0)
11200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
11210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist')
11220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add(self, name, cnf={}, **kw):
11240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
11250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name] = TixSubWidget(self, name)
11260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.subwidget_list[name]
11270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def page(self, name):
11290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.subwidget(name)
11300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def pages(self):
11320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Can't call subwidgets_all directly because we don't want .nbframe
11330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        names = self.tk.split(self.tk.call(self._w, 'pages'))
11340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ret = []
11350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for x in names:
11360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            ret.append(self.subwidget(x))
11370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return ret
11380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def raise_page(self, name):              # raise is a python keyword
11400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'raise', name)
11410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11420a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Meter(TixWidget):
11430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """The Meter widget can be used to show the progress of a background
11440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    job which may take a long time to execute.
11450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """
11460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
11480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixMeter',
11490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options'], cnf, kw)
11500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11510a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass NoteBook(TixWidget):
11520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """NoteBook - Multi-page container widget (tabbed notebook metaphor).
11530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
11550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
11560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    nbframe       NoteBookFrame
11570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    <pages>       page widgets added dynamically with the add method"""
11580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
11600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
11610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
11620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                      destroy_physically=0)
11630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add(self, name, cnf={}, **kw):
11650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
11660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name] = TixSubWidget(self, name)
11670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.subwidget_list[name]
11680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete(self, name):
11700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', name)
11710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name].destroy()
11720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        del self.subwidget_list[name]
11730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def page(self, name):
11750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.subwidget(name)
11760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def pages(self):
11780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Can't call subwidgets_all directly because we don't want .nbframe
11790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        names = self.tk.split(self.tk.call(self._w, 'pages'))
11800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ret = []
11810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        for x in names:
11820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            ret.append(self.subwidget(x))
11830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return ret
11840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def raise_page(self, name):              # raise is a python keyword
11860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'raise', name)
11870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def raised(self):
11890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'raised')
11900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11910a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass NoteBookFrame(TixWidget):
11920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: This is dangerous to expose to be called on its own.
11930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    pass
11940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11950a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass OptionMenu(TixWidget):
11960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """OptionMenu - creates a menu button of options.
11970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
11980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidget       Class
11990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ---------       -----
12000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    menubutton      Menubutton
12010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    menu            Menu"""
12020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
12040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixOptionMenu',
12050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                ['labelside', 'options'], cnf, kw)
12060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
12070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
12080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add_command(self, name, cnf={}, **kw):
12100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw))
12110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add_separator(self, name, cnf={}, **kw):
12130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw))
12140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete(self, name):
12160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', name)
12170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def disable(self, name):
12190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'disable', name)
12200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def enable(self, name):
12220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'enable', name)
12230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12240a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass PanedWindow(TixWidget):
12250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """PanedWindow - Multi-pane container widget
12260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    allows the user to interactively manipulate the sizes of several
12270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    panes. The panes can be arranged either vertically or horizontally.The
12280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    user changes the sizes of the panes by dragging the resize handle
12290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    between two panes.
12300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
12320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
12330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    <panes>       g/p widgets added dynamically with the add method."""
12340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
12360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)
12370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # add delete forget panecget paneconfigure panes setsize
12390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add(self, name, cnf={}, **kw):
12400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
12410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name] = TixSubWidget(self, name,
12420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                 check_intermediate=0)
12430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.subwidget_list[name]
12440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete(self, name):
12460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', name)
12470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name].destroy()
12480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        del self.subwidget_list[name]
12490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def forget(self, name):
12510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'forget', name)
12520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def panecget(self,  entry, opt):
12540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'panecget', entry, opt)
12550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def paneconfigure(self, entry, cnf={}, **kw):
12570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if cnf is None:
12580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            return _lst2dict(
12590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.split(
12600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                self.tk.call(self._w, 'paneconfigure', entry)))
12610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw))
12620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def panes(self):
12640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        names = self.tk.splitlist(self.tk.call(self._w, 'panes'))
12650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return [self.subwidget(x) for x in names]
12660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12670a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass PopupMenu(TixWidget):
12680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """PopupMenu widget can be used as a replacement of the tk_popup command.
12690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    The advantage of the Tix PopupMenu widget is it requires less application
12700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    code to manipulate.
12710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets       Class
12740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    ----------       -----
12750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    menubutton       Menubutton
12760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    menu       Menu"""
12770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixShell
12790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
12800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
12810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
12820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
12830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def bind_widget(self, widget):
12850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'bind', widget._w)
12860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def unbind_widget(self, widget):
12880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'unbind', widget._w)
12890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def post_widget(self, widget, x, y):
12910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'post', widget._w, x, y)
12920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
12930a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ResizeHandle(TixWidget):
12940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Internal widget to draw resize handles on Scrolled widgets."""
12950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
12960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # There seems to be a Tix bug rejecting the configure method
12970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # Let's try making the flags -static
12980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        flags = ['options', 'command', 'cursorfg', 'cursorbg',
12990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                 'handlesize', 'hintcolor', 'hintwidth',
13000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                 'x', 'y']
13010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # In fact, x y height width are configurable
13020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixResizeHandle',
13030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           flags, cnf, kw)
13040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def attach_widget(self, widget):
13060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'attachwidget', widget._w)
13070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def detach_widget(self, widget):
13090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'detachwidget', widget._w)
13100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def hide(self, widget):
13120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'hide', widget._w)
13130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def show(self, widget):
13150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'show', widget._w)
13160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13170a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ScrolledHList(TixWidget):
13180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ScrolledHList - HList with automatic scrollbars."""
13190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
13210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
13220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
13230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           cnf, kw)
13240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
13250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
13260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
13270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13280a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ScrolledListBox(TixWidget):
13290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ScrolledListBox - Listbox with automatic scrollbars."""
13300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
13320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
13330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
13340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
13350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
13360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
13370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13380a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ScrolledText(TixWidget):
13390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ScrolledText - Text with automatic scrollbars."""
13400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
13420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
13430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
13440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['text'] = _dummyText(self, 'text')
13450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
13460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
13470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13480a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ScrolledTList(TixWidget):
13490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ScrolledTList - TList with automatic scrollbars."""
13500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
13520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
13530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
13540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           cnf, kw)
13550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
13560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
13570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
13580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13590a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ScrolledWindow(TixWidget):
13600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """ScrolledWindow - Window with automatic scrollbars."""
13610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
13630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
13640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
13650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['window'] = _dummyFrame(self, 'window')
13660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
13670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
13680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13690a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Select(TixWidget):
13700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Select - Container of button subwidgets. It can be used to provide
13710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    radio-box or check-box style of selection options for the user.
13720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets are buttons added dynamically using the add method."""
13740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixLabelWidget
13760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, cnf={}, **kw):
13770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixSelect',
13780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['allowzero', 'radio', 'orientation', 'labelside',
13790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                            'options'],
13800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           cnf, kw)
13810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label')
13820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def add(self, name, cnf={}, **kw):
13840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
13850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list[name] = _dummyButton(self, name)
13860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.subwidget_list[name]
13870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self, name):
13890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'invoke', name)
13900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13910a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Shell(TixWidget):
13920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Toplevel window.
13930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets - None"""
13950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
13970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw)
13980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
13990a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass DialogShell(TixWidget):
14000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Toplevel window, with popup popdown and center methods.
14010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    It tells the window manager that it is a dialog window and should be
14020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    treated specially. The exact treatment depends on the treatment of
14030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the window manager.
14040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets - None"""
14060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit from  Shell
14080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
14090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master,
14100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           'tixDialogShell',
14110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options', 'title', 'mapped',
14120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                            'minheight', 'minwidth',
14130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                            'parent', 'transient'], cnf, kw)
14140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popdown(self):
14160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popdown')
14170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def popup(self):
14190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'popup')
14200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def center(self):
14220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'center')
14230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14240a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass StdButtonBox(TixWidget):
14250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """
14260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
14280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixStdButtonBox',
14290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['orientation', 'options'], cnf, kw)
14300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
14310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
14320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
14330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['help'] = _dummyButton(self, 'help')
14340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def invoke(self, name):
14360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if name in self.subwidget_list:
14370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(self._w, 'invoke', name)
14380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14390a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass TList(TixWidget, XView, YView):
14400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """TList - Hierarchy display widget which can be
14410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    used to display data in a tabular format. The list entries of a TList
14420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    widget are similar to the entries in the Tk listbox widget. The main
14430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    differences are (1) the TList widget can display the list entries in a
14440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    two dimensional format and (2) you can use graphical images as well as
14450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    multiple colors and fonts for the list entries.
14460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets - None"""
14480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__ (self,master=None,cnf={}, **kw):
14500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)
14510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def active_set(self, index):
14530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'active', 'set', index)
14540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def active_clear(self):
14560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'active', 'clear')
14570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_set(self, index):
14590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'anchor', 'set', index)
14600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_clear(self):
14620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'anchor', 'clear')
14630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete(self, from_, to=None):
14650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'delete', from_, to)
14660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dragsite_set(self, index):
14680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dragsite', 'set', index)
14690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dragsite_clear(self):
14710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dragsite', 'clear')
14720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dropsite_set(self, index):
14740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dropsite', 'set', index)
14750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def dropsite_clear(self):
14770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'dropsite', 'clear')
14780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def insert(self, index, cnf={}, **kw):
14800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'insert', index, *self._options(cnf, kw))
14810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_active(self):
14830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'active')
14840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_anchor(self):
14860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'anchor')
14870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_down(self, index):
14890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'down', index)
14900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_left(self, index):
14920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'left', index)
14930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_right(self, index):
14950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'right', index)
14960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
14970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_selection(self):
14980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        c = self.tk.call(self._w, 'info', 'selection')
14990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.splitlist(c)
15000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_size(self):
15020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'size')
15030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_up(self, index):
15050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'info', 'up', index)
15060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def nearest(self, x, y):
15080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'nearest', x, y)
15090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def see(self, index):
15110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'see', index)
15120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def selection_clear(self, cnf={}, **kw):
15140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw))
15150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def selection_includes(self, index):
15170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'selection', 'includes', index)
15180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def selection_set(self, first, last=None):
15200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'selection', 'set', first, last)
15210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15220a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Tree(TixWidget):
15230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """Tree - The tixTree widget can be used to display hierarchical
15240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    data in a tree form. The user can adjust
15250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    the view of the tree by opening or closing parts of the tree."""
15260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
15280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
15290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixTree',
15300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options'], cnf, kw)
15310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
15320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
15330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
15340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def autosetmode(self):
15360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''This command calls the setmode method for all the entries in this
15370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     Tree widget: if an entry has no child entries, its mode is set to
15380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     none. Otherwise, if the entry has any hidden child entries, its mode is
15390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     set to open; otherwise its mode is set to close.'''
15400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'autosetmode')
15410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def close(self, entrypath):
15430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Close the entry given by entryPath if its mode is close.'''
15440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'close', entrypath)
15450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def getmode(self, entrypath):
15470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Returns the current mode of the entry given by entryPath.'''
15480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'getmode', entrypath)
15490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def open(self, entrypath):
15510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Open the entry given by entryPath if its mode is open.'''
15520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'open', entrypath)
15530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def setmode(self, entrypath, mode='none'):
15550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''This command is used to indicate whether the entry given by
15560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     entryPath has children entries and whether the children are visible. mode
15570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     must be one of open, close or none. If mode is set to open, a (+)
15580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     indicator is drawn next to the entry. If mode is set to close, a (-)
15590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     indicator is drawn next to the entry. If mode is set to none, no
15600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     indicators will be drawn for this entry. The default mode is none. The
15610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     open mode indicates the entry has hidden children and this entry can be
15620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     opened by the user. The close mode indicates that all the children of the
15630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     entry are now visible and the entry can be closed by the user.'''
15640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'setmode', entrypath, mode)
15650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Could try subclassing Tree for CheckList - would need another arg to init
15680a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass CheckList(TixWidget):
15690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """The CheckList widget
15700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    displays a list of items to be selected by the user. CheckList acts
15710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    similarly to the Tk checkbutton or radiobutton widgets, except it is
15720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    capable of handling many more items than checkbuttons or radiobuttons.
15730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """
15740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixTree
15750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
15760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixCheckList',
15770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                           ['options', 'radio'], cnf, kw)
15780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
15790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
15800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
15810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def autosetmode(self):
15830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''This command calls the setmode method for all the entries in this
15840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     Tree widget: if an entry has no child entries, its mode is set to
15850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     none. Otherwise, if the entry has any hidden child entries, its mode is
15860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     set to open; otherwise its mode is set to close.'''
15870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'autosetmode')
15880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def close(self, entrypath):
15900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Close the entry given by entryPath if its mode is close.'''
15910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'close', entrypath)
15920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def getmode(self, entrypath):
15940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Returns the current mode of the entry given by entryPath.'''
15950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'getmode', entrypath)
15960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
15970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def open(self, entrypath):
15980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Open the entry given by entryPath if its mode is open.'''
15990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'open', entrypath)
16000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def getselection(self, mode='on'):
16020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Returns a list of items whose status matches status. If status is
16030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     not specified, the list of items in the "on" status will be returned.
16040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     Mode can be on, off, default'''
16050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        c = self.tk.split(self.tk.call(self._w, 'getselection', mode))
16060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.splitlist(c)
16070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def getstatus(self, entrypath):
16090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Returns the current status of entryPath.'''
16100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self._w, 'getstatus', entrypath)
16110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def setstatus(self, entrypath, mode='on'):
16130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        '''Sets the status of entryPath to be status. A bitmap will be
16140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao     displayed next to the entry its status is on, off or default.'''
16150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'setstatus', entrypath, mode)
16160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao###########################################################################
16190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao### The subclassing below is used to instantiate the subwidgets in each ###
16200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao### mega widget. This allows us to access their methods directly.       ###
16210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao###########################################################################
16220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16230a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyButton(Button, TixSubWidget):
16240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16270a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyCheckbutton(Checkbutton, TixSubWidget):
16280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16310a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyEntry(Entry, TixSubWidget):
16320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16350a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyFrame(Frame, TixSubWidget):
16360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16390a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyLabel(Label, TixSubWidget):
16400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16430a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyListbox(Listbox, TixSubWidget):
16440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16470a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyMenu(Menu, TixSubWidget):
16480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16510a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyMenubutton(Menubutton, TixSubWidget):
16520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16550a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyScrollbar(Scrollbar, TixSubWidget):
16560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16590a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyText(Text, TixSubWidget):
16600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16630a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyScrolledListBox(ScrolledListBox, TixSubWidget):
16640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
16670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
16680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
16690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16700a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyHList(HList, TixSubWidget):
16710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16740a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyScrolledHList(ScrolledHList, TixSubWidget):
16750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
16780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
16790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
16800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16810a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyTList(TList, TixSubWidget):
16820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
16840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16850a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyComboBox(ComboBox, TixSubWidget):
16860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
16870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, ['fancy',destroy_physically])
16880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['label'] = _dummyLabel(self, 'label')
16890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
16900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
16910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
16920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
16930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                                                                'slistbox')
16940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        try:
16950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
16960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            #cross Button : present if created with the fancy option
16970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
16980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        except TypeError:
16990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            # unavailable when -fancy not specified
17000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            pass
17010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17020a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyDirList(DirList, TixSubWidget):
17030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
17060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
17070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17090a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyDirSelectBox(DirSelectBox, TixSubWidget):
17100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
17130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
17140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17150a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget):
17160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
17190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
17200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
17210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
17220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
17230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
17240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
17250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
17260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17270a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyFileSelectBox(FileSelectBox, TixSubWidget):
17280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
17310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
17320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
17330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
17340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17350a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyFileComboBox(ComboBox, TixSubWidget):
17360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')
17390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17400a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyStdButtonBox(StdButtonBox, TixSubWidget):
17410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
17440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
17450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
17460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.subwidget_list['help'] = _dummyButton(self, 'help')
17470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17480a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyNoteBookFrame(NoteBookFrame, TixSubWidget):
17490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=0):
17500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17520a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass _dummyPanedWindow(PanedWindow, TixSubWidget):
17530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master, name, destroy_physically=1):
17540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixSubWidget.__init__(self, master, name, destroy_physically)
17550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao########################
17570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao### Utility Routines ###
17580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao########################
17590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#mike Should tixDestroy be exposed as a wrapper? - but not for widgets.
17610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17620a8c90248264a8b26970b4473770bcc3df8515fJosh Gaodef OptionName(widget):
17630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    '''Returns the qualified path name for the widget. Normally used to set
17640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    default options for subwidgets. See tixwidgets.py'''
17650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    return widget.tk.call('tixOptionName', widget._w)
17660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Called with a dictionary argument of the form
17680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'}
17690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# returns a string which can be used to configure the fsbox file types
17700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# in an ExFileSelectBox. i.e.,
17710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}'
17720a8c90248264a8b26970b4473770bcc3df8515fJosh Gaodef FileTypeList(dict):
17730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    s = ''
17740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    for type in dict.keys():
17750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
17760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    return s
17770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# Still to be done:
17790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# tixIconView
17800a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass CObjView(TixWidget):
17810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """This file implements the Canvas Object View widget. This is a base
17820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    class of IconView. It implements automatic placement/adjustment of the
17830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    scrollbars according to the canvas objects inside the canvas subwidget.
17840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    The scrollbars are adjusted so that the canvas is just large enough
17850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    to see all the objects.
17860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    """
17870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
17880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    pass
17890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17910a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Grid(TixWidget, XView, YView):
17920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    '''The Tix Grid command creates a new window  and makes it into a
17930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    tixGrid widget. Additional options, may be specified on the command
17940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    line or in the option database to configure aspects such as its cursor
17950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    and relief.
17960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
17970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    A Grid widget displays its contents in a two dimensional grid of cells.
17980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Each cell may contain one Tix display item, which may be in text,
17990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    graphics or other formats. See the DisplayStyle class for more information
18000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    about Tix display items. Individual cells, or groups of cells, can be
18010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    formatted with a wide range of attributes, such as its color, relief and
18020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    border.
18030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    Subwidgets - None'''
18050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # valid specific resources as of Tk 8.4
18060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # editdonecmd, editnotifycmd, floatingcols, floatingrows, formatcmd,
18070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # highlightbackground, highlightcolor, leftmargin, itemtype, selectmode,
18080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # selectunit, topmargin,
18090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
18100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        static= []
18110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.cnf= cnf
18120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixGrid', static, cnf, kw)
18130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # valid options as of Tk 8.4
18150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget,
18160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # edit, entryconfigure, format, geometryinfo, info, index, move, nearest,
18170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # selection, set, size, unset, xview, yview
18180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_clear(self):
18190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Removes the selection anchor."""
18200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'anchor', 'clear')
18210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_get(self):
18230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        "Get the (x,y) coordinate of the current anchor cell"
18240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self._getints(self.tk.call(self, 'anchor', 'get'))
18250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def anchor_set(self, x, y):
18270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Set the selection anchor to the cell at (x, y)."""
18280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'anchor', 'set', x, y)
18290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete_row(self, from_, to=None):
18310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Delete rows between from_ and to inclusive.
18320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        If to is not provided,  delete only row at from_"""
18330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if to is None:
18340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(self, 'delete', 'row', from_)
18350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
18360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(self, 'delete', 'row', from_, to)
18370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def delete_column(self, from_, to=None):
18390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Delete columns between from_ and to inclusive.
18400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        If to is not provided,  delete only column at from_"""
18410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if to is None:
18420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(self, 'delete', 'column', from_)
18430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        else:
18440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            self.tk.call(self, 'delete', 'column', from_, to)
18450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def edit_apply(self):
18470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """If any cell is being edited, de-highlight the cell  and  applies
18480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        the changes."""
18490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'edit', 'apply')
18500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def edit_set(self, x, y):
18520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Highlights  the  cell  at  (x, y) for editing, if the -editnotify
18530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        command returns True for this cell."""
18540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'edit', 'set', x, y)
18550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def entrycget(self, x, y, option):
18570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        "Get the option value for cell at (x,y)"
18580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if option and option[0] != '-':
18590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            option = '-' + option
18600a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self, 'entrycget', x, y, option)
18610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def entryconfigure(self, x, y, cnf=None, **kw):
18630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self._configure(('entryconfigure', x, y), cnf, kw)
18640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def format
18660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def index
18670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18680a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_exists(self, x, y):
18690a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        "Return True if display item exists at (x,y)"
18700a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self._getboolean(self.tk.call(self, 'info', 'exists', x, y))
18710a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18720a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def info_bbox(self, x, y):
18730a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # This seems to always return '', at least for 'text' displayitems
18740a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.call(self, 'info', 'bbox', x, y)
18750a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18760a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def move_column(self, from_, to, offset):
18770a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Moves the range of columns from position FROM through TO by
18780a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        the distance indicated by OFFSET. For example, move_column(2, 4, 1)
18790a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        moves the columns 2,3,4 to columns 3,4,5."""
18800a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'move', 'column', from_, to, offset)
18810a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18820a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def move_row(self, from_, to, offset):
18830a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Moves the range of rows from position FROM through TO by
18840a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        the distance indicated by OFFSET.
18850a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5."""
18860a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'move', 'row', from_, to, offset)
18870a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18880a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def nearest(self, x, y):
18890a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        "Return coordinate of cell nearest pixel coordinate (x,y)"
18900a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self._getints(self.tk.call(self, 'nearest', x, y))
18910a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18920a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def selection adjust
18930a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def selection clear
18940a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def selection includes
18950a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def selection set
18960a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # def selection toggle
18970a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
18980a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def set(self, x, y, itemtype=None, **kw):
18990a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        args= self._options(self.cnf, kw)
19000a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        if itemtype is not None:
19010a8c90248264a8b26970b4473770bcc3df8515fJosh Gao            args= ('-itemtype', itemtype) + args
19020a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self, 'set', x, y, *args)
19030a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
19040a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def size_column(self, index, **kw):
19050a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Queries or sets the size of the column given by
19060a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        INDEX.  INDEX may be any non-negative
19070a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        integer that gives the position of a given column.
19080a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        INDEX can also be the string "default"; in this case, this command
19090a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        queries or sets the default size of all columns.
19100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        When no option-value pair is given, this command returns a tuple
19110a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        containing the current size setting of the given column.  When
19120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        option-value pairs are given, the corresponding options of the
19130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        size setting of the given column are changed. Options may be one
19140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        of the follwing:
19150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              pad0 pixels
19160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     Specifies the paddings to the left of a column.
19170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              pad1 pixels
19180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     Specifies the paddings to the right of a column.
19190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              size val
19200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     Specifies the width of a column.  Val may be:
19210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     "auto" -- the width of the column is set to the
19220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     width of the widest cell in the column;
19230a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     a valid Tk screen distance unit;
19240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     or a real number following by the word chars
19250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     (e.g. 3.4chars) that sets the width of the column to the
19260a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     given number of characters."""
19270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.split(self.tk.call(self._w, 'size', 'column', index,
19280a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                             *self._options({}, kw)))
19290a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
19300a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def size_row(self, index, **kw):
19310a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Queries or sets the size of the row given by
19320a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        INDEX. INDEX may be any non-negative
19330a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        integer that gives the position of a given row .
19340a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        INDEX can also be the string "default"; in this case, this command
19350a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        queries or sets the default size of all rows.
19360a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        When no option-value pair is given, this command returns a list con-
19370a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        taining the current size setting of the given row . When option-value
19380a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        pairs are given, the corresponding options of the size setting of the
19390a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        given row are changed. Options may be one of the follwing:
19400a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              pad0 pixels
19410a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     Specifies the paddings to the top of a row.
19420a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              pad1 pixels
19430a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     Specifies the paddings to the bottom of a row.
19440a8c90248264a8b26970b4473770bcc3df8515fJosh Gao              size val
19450a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     Specifies the height of a row.  Val may be:
19460a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     "auto" -- the height of the row is set to the
19470a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     height of the highest cell in the row;
19480a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     a valid Tk screen distance unit;
19490a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     or a real number following by the word chars
19500a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     (e.g. 3.4chars) that sets the height of the row to the
19510a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                     given number of characters."""
19520a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        return self.tk.split(self.tk.call(
19530a8c90248264a8b26970b4473770bcc3df8515fJosh Gao                    self, 'size', 'row', index, *self._options({}, kw)))
19540a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
19550a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def unset(self, x, y):
19560a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        """Clears the cell at (x, y) by removing its display item."""
19570a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.tk.call(self._w, 'unset', x, y)
19580a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
19590a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
19600a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass ScrolledGrid(Grid):
19610a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    '''Scrolled Grid widgets'''
19620a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
19630a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    # FIXME: It should inherit -superclass tixScrolledWidget
19640a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    def __init__(self, master=None, cnf={}, **kw):
19650a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        static= []
19660a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        self.cnf= cnf
19670a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        TixWidget.__init__(self, master, 'tixScrolledGrid', static, cnf, kw)
1968