Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10496eb

Browse files
committed
Added handling for new options, fixed applet option setting
1 parent b072150 commit 10496eb

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

Mac/scripts/EditPythonPrefs.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
OVERRIDE_PATH_STRINGS_ID = 129
4747
OVERRIDE_DIRECTORY_ID = 129
4848
OVERRIDE_OPTIONS_ID = 129
49-
OVERRIDE_GUSI_ID = 10240
49+
OVERRIDE_GUSI_ID = 10241
5050

5151
# Things we know about the GUSI resource. Note the code knows these too.
5252
GUSIPOS_TYPE=0
@@ -86,7 +86,6 @@ def message(str = "Hello, world!", id = MESSAGE_ID):
8686
"""Show a simple alert with a text message"""
8787
d = GetNewDialog(id, -1)
8888
d.SetDialogDefaultItem(1)
89-
print 'd=', d
9089
tp, h, rect = d.GetDialogItem(2)
9190
SetDialogItemText(h, str)
9291
while 1:
@@ -187,8 +186,11 @@ def getoptions(id):
187186
try:
188187
opr = GetResource('Popt', id)
189188
except (MacOS.Error, Res.Error):
190-
return [0]*7, None
191-
return map(lambda x: ord(x), opr.data), opr
189+
return [0]*9, None
190+
options = map(lambda x: ord(x), opr.data)
191+
while len(options) < 9:
192+
options = options + [0]
193+
return options, opr
192194

193195
def getgusioptions(id):
194196
try:
@@ -301,8 +303,7 @@ def edit_preferences():
301303
gusi_opr.data = newdata
302304
gusi_opr.ChangedResource()
303305
else:
304-
print 'Created new GUSI option'
305-
ngusi_opr = Resource(gusi_opr.data)
306+
ngusi_opr = Resource(newdata)
306307
ngusi_opr.AddResource('GU\267I', GUSI_ID, '')
307308

308309
CloseResFile(preff_handle)
@@ -342,12 +343,12 @@ def edit_applet(name):
342343
saved_options = options[:]
343344

344345
creator, type, delaycons, gusi_opr = getgusioptions(OVERRIDE_GUSI_ID)
345-
if not opr:
346+
if not gusi_opr:
346347
if notfound:
347348
notfound = notfound + ', GUSI options'
348349
else:
349350
notfound = 'GUSI options'
350-
creator, type, delaycons, dummy = getgusioptions(GUSI_ID)
351+
creator, type, delaycons, gusi_opr = getgusioptions(GUSI_ID)
351352
saved_gusi_options = creator, type, delaycons
352353

353354
dummy = dummy2 = None # Discard them.
@@ -361,7 +362,7 @@ def edit_applet(name):
361362
if result == None:
362363
sys.exit(0)
363364

364-
pathlist, nfss, options = result
365+
pathlist, nfss, (options, creator, type, delaycons) = result
365366
if nfss != fss:
366367
fss_changed = 1
367368

@@ -396,12 +397,13 @@ def edit_applet(name):
396397

397398
if (creator, type, delaycons) != saved_gusi_options:
398399
newdata = setgusioptions(gusi_opr, creator, type, delaycons)
399-
if gusi_opr.HomeResFile == app_handle:
400+
id, type, name = gusi_opr.GetResInfo()
401+
if gusi_opr.HomeResFile() == app_handle and id == OVERRIDE_GUSI_ID:
400402
gusi_opr.data = newdata
401403
gusi_opr.ChangedResource()
402404
else:
403-
gusi_opr = Resource(gusi_opr.data)
404-
gusi_opr.AddResource('GU\267I', OVERRIDE_GUSI_ID, '')
405+
ngusi_opr = Resource(newdata)
406+
ngusi_opr.AddResource('GU\267I', OVERRIDE_GUSI_ID, '')
405407

406408
CloseResFile(app_handle)
407409

Mac/scripts/EditPythonPrefs.rsrc.hqx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ bDA"d)`#3"6-!#3"&!3i&&e4bB@0P)'PYF'pbG#"cG'&dC@ePER4cJJ#3"8N!#3"
4949
E!3d&(&0eF("bCA0c)'9iF(*PFh0TEfiJF(*TER4TEQF!N!9I!!N!F3%-"4K9EQ*
5050
eCQCPFQ9N)(0dC'peG#pcG'4PFR)!N!9e!!N!K`%,"40%C@*eCb"`BA*cCA)JEh9
5151
dF(9dC3#3"D!!(J#b!)`&#dj[FQeKE#"PH'PdF`#3"D!!S!#b!3S&#Q9bFQpb)'9
52-
iDA3!N!AJ!!S!m3%,K4Y%DA0KBQaP)'&bCf-[BA*RGL"PEA9X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