diff options
author | Barry Warsaw <barry@python.org> | 1998-03-10 00:17:01 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-03-10 00:17:01 (GMT) |
commit | f67575d69df3a5bb7b69dc91a8da0617daa52907 (patch) | |
tree | 26129a8180d69daa78207c5d4675a992a1258c29 | |
parent | 31ac518dd76711b6982b3935943ea306e5838708 (diff) | |
download | cpython-f67575d69df3a5bb7b69dc91a8da0617daa52907.zip cpython-f67575d69df3a5bb7b69dc91a8da0617daa52907.tar.gz cpython-f67575d69df3a5bb7b69dc91a8da0617daa52907.tar.bz2 |
Integrate with OptionsWindow... not sure it should be modal
-rw-r--r-- | Tools/pynche/PyncheWidget.py | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py index f266755..73cbd37 100644 --- a/Tools/pynche/PyncheWidget.py +++ b/Tools/pynche/PyncheWidget.py @@ -7,6 +7,7 @@ import ColorDB from ChipWidget import ChipWidget from TypeinWidget import TypeinWidget from StripWidget import StripWidget +from OptionsWidget import OptionsWidget @@ -52,7 +53,8 @@ class PyncheWidget(Pmw.MegaWidget): def __init__(self, colordb, parent=None, **kw): self.__colordb = colordb self.__parent = parent - self.__about = None + self.__about_dialog = None + self.__options_dialog = None options = (('color', (128, 128, 128), self.__set_color), ('delegate', None, None), @@ -73,17 +75,27 @@ class PyncheWidget(Pmw.MegaWidget): label='Quit', command=self.__quit, accelerator='Alt-Q') + parent.bind('<Alt-q>', self.__quit) + parent.bind('<Alt-Q>', self.__quit) + self.__menubar.addmenu('Help', None, side=RIGHT) self.__menubar.addmenuitem('Help', type=COMMAND, label='About...', command=self.__popup_about, 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) + 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 group = Pmw.Group(parent, tag_text='Variations') group.pack(side=TOP, expand=YES, fill=BOTH) @@ -174,14 +186,22 @@ class PyncheWidget(Pmw.MegaWidget): self.__parent.quit() def __popup_about(self, event=None): - if not self.__about: + if not self.__about_dialog: Pmw.aboutversion('1.0') Pmw.aboutcopyright('Copyright (C) 1998 Barry A. Warsaw\n' 'All rights reserved') Pmw.aboutcontact('For information about Pynche contact:\n' 'Barry A. Warsaw\n' 'email: bwarsaw@python.org') - self.__about = Pmw.AboutDialog( + self.__about_dialog = Pmw.AboutDialog( applicationname='Pynche -- the PYthonically Natural\n' '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')) |