Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / lib / python2.4 / site-packages / Pmw / Pmw_1_2 / doc / porting.html
<html>
<head>
<meta name="description" content="Pmw - a toolkit for building high-level compound widgets in Python">
<meta name="content" content="python, megawidget, mega widget, compound widget, gui, tkinter">
<title>Porting between different versions of Pmw</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ee"
vlink="551a8b" alink="ff0000">
<h1 ALIGN="CENTER">Porting between different versions of Pmw</h1>
<p>
This document contains a brief guide to porting existing code
between different versions of Pmw. It includes significant
functionality changes but does not include bug fixes or compatible
enhancements. For details of all changes, see
<a href="changes.html">Changes to Pmw versions</a>.</p>
<p> <strong>Porting from 0.8.5 to 1.0, 1.1 and 1.2</strong></p>
<ul><li><p>Bug fix, documention and new features only. No
backwards-incompatible changes.</p>
</li></ul>
<p> <strong>Porting from 0.8.4 to 0.8.5</strong></p>
<ul><li><p>Bug fix release only. No interface changes.</p>
</li></ul>
<p> <strong>Porting from 0.8.3 to 0.8.4</strong></p>
<ul><li><p>Change the <code>setnaturalpagesize()</code> method of Pmw.NoteBook to
<code>setnaturalsize()</code> (to be consistent with Pmw.PanedWidget).</p>
</li>
<li><p>Change Pmw.excludefrombusycursor() to Pmw.setbusycursorattributes().
Replace busyCursorName option of Pmw.initialise() with
cursorName attribute of Pmw.setbusycursorattributes().</p>
</li>
<li><p>Several rarely used key bindings for Pmw.ScrolledListBox were
removed, changing the behaviour of the megawidget.</p>
</li></ul>
<p> <strong>Porting from 0.8.1 to 0.8.3</strong></p>
<ul><li><p>The megawidgets Pmw.NoteBookR and Pmw.NoteBookS have been
replaced by a new Pmw.NoteBook. The interfaces are not
compatible, so see the Pmw.NoteBook reference manual for
details.</p>
</li>
<li><p>Change the get() method of Pmw.OptionMenu to getcurselection()
and the remove() method of Pmw.PanedWidget to delete().</p>
</li>
<li><p>If you use <strong>'end'</strong>, <strong>'default'</strong> or <strong>None</strong> in calls to the
index() method of several megawidgets, change these to
<strong>Pmw.END</strong>, <strong>Pmw.DEFAULT</strong> and <strong>Pmw.SELECT</strong>, respectively.</p>
</li>
<li><p>The exclude argument has been removed from Pmw.showbusycursor().
Use Pmw.excludefrombusycursor() instead.</p>
</li>
<li><p>The names of some of the positional arguments in the following
methods have changed: MegaArchetype.createcomponent(),
ButtonBox.insert(), ButtonBox.add(), MenuBar.addcascademenu(),
MenuBar.addmenuitem() and RadioSelect.add().</p>
</li>
<li><p>The Pmw.maxfontwidth() function has been removed. Use the
<code>font_measure()</code> Tkinter method, or if that has not yet been
implemented:</p>
<dl><dd><pre> someWidget.tk.call('font', 'measure', someFont, 'W')</pre></dd></dl>
</li>
<li><p>The Pmw.fontexists() function has been removed. This is
because, since Tk8.0, all fonts exist, so it no longer has
any meaning.</p>
</li></ul>
<p> <strong>Porting from 0.8 to 0.8.1</strong></p>
<ul><li><p>The Blt.Graph now supports blt2.4i which is not backwards
compatible with blt2.1.</p>
</li></ul>
<p> <strong>Porting from 0.7 to 0.8</strong></p>
<ul><li><p>The <em>format</em> argument of Pmw.datestringtojdn() now defaults to
<strong>'ymd'</strong>. If you want to display dates with year, month and day
in a different order, add a <em>format</em> option to
Pmw.datestringtojdn() or to the <strong>datatype</strong> option of Pmw.Counter
or the <strong>validate</strong> option of Pmw.EntryField.</p>
</li>
<li><p>The justify() method from Pmw.ScrolledListBox has been removed.
Use the xview() or yview() methods instead.</p>
</li>
<li><p>Replace the getFrame() method of Pmw.ScrolledFrame with the
interior() method.</p>
</li>
<li><p>Replace the <strong>ringpadx</strong> and <strong>ringpady</strong> options of Pmw.Group by
padding the megawidget itself or by padding the children of the
megawidget. </p>
</li>
<li><p>Replace the canvasbind() and canvasunbind() methods of
Pmw.Balloon with tagbind() and tagunbind().</p>
</li>
<li><p>The return value of Pmw.EntryField <strong>command</strong> callback is now
ignored. Previously, if the callback destroyed the megawidget,
it was required to return the string <strong>'break'</strong>, to work around a
problem in the event handling mechanism in Tkinter. With python
1.5.2, Tkinter has been fixed. Therefore, user-supplied
callback functions should use Pmw.hulldestroyed to check if the
megawidget has been destroyed before performing any operations
on it.</p>
</li>
<li><p>If you require the <strong>'pmw1'</strong> fontScheme when running under
Microsoft Windows and Macintosh, you will need to set the Tk
font options manually.</p>
</li></ul>
<p> <strong>Porting from 0.6 to 0.7</strong></p>
<ul><li><p>Replace the <strong>maxwidth</strong> option of Pmw.EntryField with the <strong>'max'</strong>
field of the <strong>validate</strong> option.</p>
</li>
<li><p>To specify that there should be no validation performed for a
Pmw.EntryField, the <strong>validate</strong> option must be None, not <strong>''</strong> as
before.</p>
</li>
<li><p>The date and time values of the Pmw.EntryField <strong>validate</strong> option
(such as <strong>'date_dmy'</strong> and <strong>'time24'</strong>, etc) are no longer supported.
Instead use a dictionary as the value of the <strong>validate</strong> option
with <strong>'date'</strong> or <strong>'time'</strong> in the <strong>'validator'</strong> field. Include
other fields in the dictionary to further specify the
validation.</p>
</li>
<li><p>Pmw.Counter no longer supports the old date and time values for
the <strong>datatype</strong> option. Use a dictionary with a <strong>'counter'</strong>
field of <strong>'date'</strong> or <strong>'time'</strong> and other fields to further
specify the counting.</p>
</li>
<li><p>Pmw.Counter no longer supports the <strong>min</strong> and <strong>max</strong> options. Use
the Pmw.EntryField <strong>validate</strong> option instead.</p>
</li>
<li><p>The bbox method of Pmw.ScrolledListBox now refers to the bbox
method of the <strong>listbox</strong> component, not the <strong>hull</strong> component.</p>
</li>
<li><p>By default, Pmw.MenuBar now automatically adds hotkeys to menus
and menu items for keyboard traversal. To turn this off, use the
<code>hotkeys = 0</code> option.</p>
</li>
<li><p>The createcomponent() method now disallows the creation of
component names containing an underscore. If any component
names contain an underscore, rename them.</p>
</li></ul>
<p> <strong>Porting from 0.5 to 0.6</strong></p>
<p> To port applications using Pmw version 0.5 to version 0.6, make
sure you are using python1.5. Then, simply change any lines in
your application like this:</p>
<dl><dd><pre> from PmwLazy import Pmw</pre></dd></dl>
<p> to this:</p>
<dl><dd><pre> import Pmw</pre></dd></dl>
<p> Also, if you have added the <code>lib</code> directory of a specific version
of Pmw to <code>sys.path</code> or <code>PYTHONPATH</code>, this can be removed, as long
as Pmw can now be found from the default path, such as in the
python <code>site-packages</code> directory.</p>
<p> <strong>Porting from 0.2 to 0.4</strong></p>
<ul><li><p>To get Pmw.0.2 default fonts (helvetica with bold italic menus
and italic scales) initialise with:</p>
<dl><dd><pre> Pmw.initialise(fontScheme = 'pmw1')</pre></dd></dl>
<p> If no <strong>fontScheme</strong> is given, the standard Tk default fonts are used.</p>
</li>
<li><p>Remove all calls to setdefaultresources(), usual(), keep(),
renameoptions(), ignore() and defineoptiontypes().</p>
</li>
<li><p>Move call to defineoptions() to before call to base class
constructor, create optiondefs tuple from self.defineoptions
arguments, then call defineoptions().</p>
</li>
<li><p>Remove resource class and name from optiondefs.</p>
</li>
<li><p>The last element in the optiondefs tuple (callback function)
must be given (may be None).</p>
</li>
<li><p>Add to classes currently without any options:</p>
<dl><dd><pre> optiondefs = ()
self.defineoptions(kw, optiondefs)</pre></dd></dl>
</li>
<li><p>Use createcomponent() to create components - this replaces the
calls to the component widget constructor and to
registercomponent().</p>
</li>
<li><p>Do not inherit from Pmw.LabeledWidget. Instead, replace with
Pmw.MegaWidget with labelpos and labelmargin options and a call
to self.createlabel(). If calling createlabel(), must replace
pack() with grid().</p>
</li>
<li><p>When calling a megawidget constructor, include subcomponent name when
setting subcomponent options (eg labeltext -&gt; label_text)</p>
</li>
<li><p>The items option of ScrolledListBox is an initialisation option
only - use setlist() method after initialisation.</p>
</li>
<li><p>The <strong>autorelief</strong> option for Counter, EntryField, ScrolledText,
TextDialog has been removed.</p>
</li>
<li><p>ScrolledListBox.getcurselection() always returns a tuple of strings,
possibly of zero length.</p>
</li>
<li><p>Counter increment is always initialised to 1.</p>
</li>
<li><p>The <strong>'time'</strong> Counter <strong>datatype</strong> option has been replaced by
<strong>'timeN'</strong> and <strong>'time24'</strong>.</p>
</li>
<li><p>The <strong>'time'</strong> EntryField <strong>validate</strong> option has been replaced by
<strong>'timeN'</strong> and <strong>'time24'</strong>.</p>
</li>
<li><p>Replace call to initialise() with initialiseoptions(), removing
"kw" arg. This should always be the last line in a megawidget
constructor.</p>
</li>
<li><p>Replace hide() with withdraw().</p>
</li>
<li><p>Now need iconpos option for MessageDialogs with icon_bitmap option set.</p>
</li>
<li><p>Example megawidget class definition:</p>
</li></ul>
<dl><dd><pre>class MyBigWidget(Pmw.MegaWidget):
def __init__(self, parent = None, **kw):
# Define the megawidget options.
optiondefs = (
('errorbackground', 'pink', None),
('maxwidth', 0, self._myfunc),
('myinit', 'good', Pmw.INITOPT),
)
self.defineoptions(kw, optiondefs)
# Initialise the base class (after defining the options).
Pmw.MegaWidget.__init__(self, parent)
# Create the components.
interior = self.interior()
self._widget = self.createcomponent('component',
(('alias', 'component_alias'),), None,
Tkinter.Button, (interior,))
self._widget.grid(column=0, row=0, sticky='nsew')
self.createlabel(interior)
# Initialise instance variables.
self.deriveddummy = None
# Check keywords and initialise options.
self.initialiseoptions(MyBigWidget)
</pre></dd></dl>
<center><P ALIGN="CENTER">
<IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5>
</p></center>
<font size=-1>
<center><P ALIGN="CENTER">
Pmw 1.2 -
5 Aug 2003
- <a href="index.html">Home</a>
</p></center>
</font>
</body>
</html>