Mercurial > cpython-lru_cache-weakref
comparison Mac/scripts/EditPythonPrefs.py @ 6298:ebd099889721 legacy-trunk
Implemented balloon help for EditPythonPrefs
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Tue, 09 Sep 1997 13:58:19 +0000 |
| parents | f9fbde75c536 |
| children | 71281ff8c6a2 |
comparison
equal
deleted
inserted
replaced
| 6297:509474b88b01 | 6298:ebd099889721 |
|---|---|
| 13 import os | 13 import os |
| 14 import sys | 14 import sys |
| 15 import Res # For Res.Error | 15 import Res # For Res.Error |
| 16 import pythonprefs | 16 import pythonprefs |
| 17 import EasyDialogs | 17 import EasyDialogs |
| 18 import Help | |
| 18 | 19 |
| 19 # resource IDs in our own resources (dialogs, etc) | 20 # resource IDs in our own resources (dialogs, etc) |
| 20 MESSAGE_ID = 256 | 21 MESSAGE_ID = 256 |
| 21 | 22 |
| 22 DIALOG_ID = 511 | 23 DIALOG_ID = 511 |
| 24 OK_ITEM = 2 | 25 OK_ITEM = 2 |
| 25 CANCEL_ITEM = 3 | 26 CANCEL_ITEM = 3 |
| 26 DIR_ITEM = 4 | 27 DIR_ITEM = 4 |
| 27 TITLE_ITEM = 5 | 28 TITLE_ITEM = 5 |
| 28 OPTIONS_ITEM = 7 | 29 OPTIONS_ITEM = 7 |
| 30 HELP_ITEM = 9 | |
| 29 | 31 |
| 30 # The options dialog. There is a correspondence between | 32 # The options dialog. There is a correspondence between |
| 31 # the dialog item numbers and the option. | 33 # the dialog item numbers and the option. |
| 32 OPT_DIALOG_ID = 510 | 34 OPT_DIALOG_ID = 510 |
| 33 | 35 |
| 41 "debugging", | 43 "debugging", |
| 42 "keepopen", | 44 "keepopen", |
| 43 "keeperror", | 45 "keeperror", |
| 44 "nointopt", | 46 "nointopt", |
| 45 "noargs", | 47 "noargs", |
| 46 "delayconsole"] | 48 "delayconsole", |
| 49 None, None, None, None, None, None, None, None, # 11-18 are different | |
| 50 "oldexc", | |
| 51 "nosite"] | |
| 47 opt_dialog_dict = {} | 52 opt_dialog_dict = {} |
| 48 for i in range(len(opt_dialog_map)): | 53 for i in range(len(opt_dialog_map)): |
| 49 if opt_dialog_map[i]: | 54 if opt_dialog_map[i]: |
| 50 opt_dialog_dict[opt_dialog_map[i]] = i | 55 opt_dialog_dict[opt_dialog_map[i]] = i |
| 51 # 1 thru 10 are the options | 56 # 1 thru 10 are the options |
| 52 # The GUSI creator/type and delay-console | 57 # The GUSI creator/type and delay-console |
| 53 OD_CREATOR_ITEM = 11 | 58 OD_CREATOR_ITEM = 11 |
| 54 OD_TYPE_ITEM = 12 | 59 OD_TYPE_ITEM = 12 |
| 55 OD_OK_ITEM = 13 | 60 OD_OK_ITEM = 13 |
| 56 OD_CANCEL_ITEM = 14 | 61 OD_CANCEL_ITEM = 14 |
| 62 OD_HELP_ITEM = 22 | |
| 57 | 63 |
| 58 def optinteract(options): | 64 def optinteract(options): |
| 59 """Let the user interact with the options dialog""" | 65 """Let the user interact with the options dialog""" |
| 60 d = GetNewDialog(OPT_DIALOG_ID, -1) | 66 d = GetNewDialog(OPT_DIALOG_ID, -1) |
| 61 tp, h, rect = d.GetDialogItem(OD_CREATOR_ITEM) | 67 tp, h, rect = d.GetDialogItem(OD_CREATOR_ITEM) |
| 84 MacOS.SysBeep() | 90 MacOS.SysBeep() |
| 85 elif n == OD_CANCEL_ITEM: | 91 elif n == OD_CANCEL_ITEM: |
| 86 return | 92 return |
| 87 elif n in (OD_CREATOR_ITEM, OD_TYPE_ITEM): | 93 elif n in (OD_CREATOR_ITEM, OD_TYPE_ITEM): |
| 88 pass | 94 pass |
| 95 elif n == OD_HELP_ITEM: | |
| 96 onoff = Help.HMGetBalloons() | |
| 97 Help.HMSetBalloons(not onoff) | |
| 89 elif 1 <= n <= len(opt_dialog_map): | 98 elif 1 <= n <= len(opt_dialog_map): |
| 90 options[opt_dialog_map[n]] = (not options[opt_dialog_map[n]]) | 99 options[opt_dialog_map[n]] = (not options[opt_dialog_map[n]]) |
| 91 | 100 |
| 92 | 101 |
| 93 def interact(options, title): | 102 def interact(options, title): |
| 119 ## return [], pythondir | 128 ## return [], pythondir |
| 120 if n == DIR_ITEM: | 129 if n == DIR_ITEM: |
| 121 fss, ok = macfs.GetDirectory('Select python home folder:') | 130 fss, ok = macfs.GetDirectory('Select python home folder:') |
| 122 if ok: | 131 if ok: |
| 123 options['dir'] = fss | 132 options['dir'] = fss |
| 133 elif n == HELP_ITEM: | |
| 134 onoff = Help.HMGetBalloons() | |
| 135 Help.HMSetBalloons(not onoff) | |
| 124 if n == OPTIONS_ITEM: | 136 if n == OPTIONS_ITEM: |
| 125 noptions = options | 137 noptions = options |
| 126 for k in options.keys(): | 138 for k in options.keys(): |
| 127 noptions[k] = options[k] | 139 noptions[k] = options[k] |
| 128 noptions = optinteract(noptions) | 140 noptions = optinteract(noptions) |
