Integrate with OptionsWindow... not sure it should be modal

This commit is contained in:
Barry Warsaw 1998-03-10 00:17:01 +00:00
parent 31ac518dd7
commit f67575d69d

View file

@ -7,6 +7,7 @@ import ColorDB
from ChipWidget import ChipWidget from ChipWidget import ChipWidget
from TypeinWidget import TypeinWidget from TypeinWidget import TypeinWidget
from StripWidget import StripWidget from StripWidget import StripWidget
from OptionsWidget import OptionsWidget
@ -52,7 +53,8 @@ class PyncheWidget(Pmw.MegaWidget):
def __init__(self, colordb, parent=None, **kw): def __init__(self, colordb, parent=None, **kw):
self.__colordb = colordb self.__colordb = colordb
self.__parent = parent self.__parent = parent
self.__about = None self.__about_dialog = None
self.__options_dialog = None
options = (('color', (128, 128, 128), self.__set_color), options = (('color', (128, 128, 128), self.__set_color),
('delegate', None, None), ('delegate', None, None),
@ -73,17 +75,27 @@ class PyncheWidget(Pmw.MegaWidget):
label='Quit', label='Quit',
command=self.__quit, command=self.__quit,
accelerator='Alt-Q') accelerator='Alt-Q')
parent.bind('<Alt-q>', self.__quit)
parent.bind('<Alt-Q>', self.__quit)
self.__menubar.addmenu('Help', None, side=RIGHT) self.__menubar.addmenu('Help', None, side=RIGHT)
self.__menubar.addmenuitem('Help', self.__menubar.addmenuitem('Help',
type=COMMAND, type=COMMAND,
label='About...', label='About...',
command=self.__popup_about, command=self.__popup_about,
accelerator='Alt-A') accelerator='Alt-A')
parent.bind('<Alt-q>', self.__quit)
parent.bind('<Alt-Q>', self.__quit)
parent.bind('<Alt-a>', self.__popup_about) parent.bind('<Alt-a>', self.__popup_about)
parent.bind('<Alt-A>', self.__popup_about) parent.bind('<Alt-A>', self.__popup_about)
self.__menubar.addmenu('Edit', None)
self.__menubar.addmenuitem('Edit',
type=COMMAND,
label='Options...',
command=self.__popup_options,
accelerator='Alt-O')
parent.bind('<Alt-o>', self.__popup_options)
parent.bind('<Alt-O>', self.__popup_options)
# create color selectors # create color selectors
group = Pmw.Group(parent, tag_text='Variations') group = Pmw.Group(parent, tag_text='Variations')
group.pack(side=TOP, expand=YES, fill=BOTH) group.pack(side=TOP, expand=YES, fill=BOTH)
@ -174,14 +186,22 @@ class PyncheWidget(Pmw.MegaWidget):
self.__parent.quit() self.__parent.quit()
def __popup_about(self, event=None): def __popup_about(self, event=None):
if not self.__about: if not self.__about_dialog:
Pmw.aboutversion('1.0') Pmw.aboutversion('1.0')
Pmw.aboutcopyright('Copyright (C) 1998 Barry A. Warsaw\n' Pmw.aboutcopyright('Copyright (C) 1998 Barry A. Warsaw\n'
'All rights reserved') 'All rights reserved')
Pmw.aboutcontact('For information about Pynche contact:\n' Pmw.aboutcontact('For information about Pynche contact:\n'
'Barry A. Warsaw\n' 'Barry A. Warsaw\n'
'email: bwarsaw@python.org') 'email: bwarsaw@python.org')
self.__about = Pmw.AboutDialog( self.__about_dialog = Pmw.AboutDialog(
applicationname='Pynche -- the PYthonically Natural\n' applicationname='Pynche -- the PYthonically Natural\n'
'Color and Hue Editor') 'Color and Hue Editor')
self.__about.show() self.__about_dialog.show()
def __popup_options(self, event=None):
if not self.__options_dialog:
self.__options_dialog = OptionsWidget()
self.__options_dialog.activate()
# now gather up the new options
self.__typein.set_update_on_typing(
self.__options_dialog.get_value('typing'))