summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJust van Rossum <just@lettererror.com>1999-02-27 17:18:30 (GMT)
committerJust van Rossum <just@lettererror.com>1999-02-27 17:18:30 (GMT)
commit127100531dd17a6863b008847ae11042e866ff82 (patch)
treef8231cb14aaba737a91da1716a2f437fff3085b3 /Mac
parentf4b0681d90776f28e4e940c8ddb7035367c0fcf0 (diff)
downloadcpython-127100531dd17a6863b008847ae11042e866ff82.zip
cpython-127100531dd17a6863b008847ae11042e866ff82.tar.gz
cpython-127100531dd17a6863b008847ae11042e866ff82.tar.bz2
added "Save options" menu to popup so users can set the creator of scripts -- jvr
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Tools/IDE/PyEdit.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py
index 01e7ed6..1b935f5 100644
--- a/Mac/Tools/IDE/PyEdit.py
+++ b/Mac/Tools/IDE/PyEdit.py
@@ -186,6 +186,8 @@ class Editor(W.Window):
def makeoptionsmenu(self):
menuitems = [('Font settingsŠ', self.domenu_fontsettings),
+ ("Save optionsŠ", self.domenu_options),
+ '-',
('\0' + chr(self.run_as_main) + 'Run as __main__', self.domenu_toggle_run_as_main),
('Modularize', self.domenu_modularize),
('Browse namespaceŠ', self.domenu_browsenamespace),
@@ -263,6 +265,11 @@ class Editor(W.Window):
self.editgroup.editor.setfontsettings(fontsettings)
self.editgroup.editor.settabsettings(tabsettings)
+ def domenu_options(self, *args):
+ rv = SaveOptions(self._creator)
+ if rv:
+ self._creator = rv
+
def clicklinefield(self):
if self._currentwidget <> self.linefield:
self.linefield.select(1)
@@ -619,6 +626,55 @@ class Editor(W.Window):
def selectline(self, lineno, charoffset = 0):
self.editgroup.editor.selectline(lineno - 1, charoffset)
+class _saveoptions:
+
+ def __init__(self, creator):
+ self.rv = None
+ self.w = w = W.ModalDialog((240, 140), 'Save options')
+ radiobuttons = []
+ w.label = W.TextBox((8, 8, 80, 18), "File creator:")
+ w.ide_radio = W.RadioButton((8, 22, 80, 18), "IDE", radiobuttons, self.ide_hit)
+ w.interp_radio = W.RadioButton((8, 42, 80, 18), "Interpreter", radiobuttons, self.interp_hit)
+ w.other_radio = W.RadioButton((8, 62, 50, 18), "Other:", radiobuttons)
+ w.other_creator = W.EditText((62, 62, 40, 20), creator, self.otherselect)
+ w.cancelbutton = W.Button((-180, -30, 80, 16), "Cancel", self.cancelbuttonhit)
+ w.okbutton = W.Button((-90, -30, 80, 16), "Done", self.okbuttonhit)
+ w.setdefaultbutton(w.okbutton)
+ if creator == 'Pyth':
+ w.interp_radio.set(1)
+ elif creator == 'Pide':
+ w.ide_radio.set(1)
+ else:
+ w.other_radio.set(1)
+ w.bind("cmd.", w.cancelbutton.push)
+ w.open()
+
+ def ide_hit(self):
+ self.w.other_creator.set("Pide")
+
+ def interp_hit(self):
+ self.w.other_creator.set("Pyth")
+
+ def otherselect(self, *args):
+ sel_from, sel_to = self.w.other_creator.getselection()
+ creator = self.w.other_creator.get()[:4]
+ creator = creator + " " * (4 - len(creator))
+ self.w.other_creator.set(creator)
+ self.w.other_creator.setselection(sel_from, sel_to)
+ self.w.other_radio.set(1)
+
+ def cancelbuttonhit(self):
+ self.w.close()
+
+ def okbuttonhit(self):
+ self.rv = self.w.other_creator.get()[:4]
+ self.w.close()
+
+
+def SaveOptions(creator):
+ s = _saveoptions(creator)
+ return s.rv
+
def _escape(where, what) :
return string.join(string.split(where, what), '\\' + what)