4646OVERRIDE_PATH_STRINGS_ID = 129
4747OVERRIDE_DIRECTORY_ID = 129
4848OVERRIDE_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.
5252GUSIPOS_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
193195def 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\267 I' , 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\267 I' , OVERRIDE_GUSI_ID , '' )
405+ ngusi_opr = Resource (newdata )
406+ ngusi_opr .AddResource ('GU\267 I' , OVERRIDE_GUSI_ID , '' )
405407
406408 CloseResFile (app_handle )
407409
0 commit comments