]> granicus.if.org Git - python/commitdiff
Added handling for new options, fixed applet option setting
authorJack Jansen <jack.jansen@cwi.nl>
Sat, 7 Sep 1996 17:01:47 +0000 (17:01 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sat, 7 Sep 1996 17:01:47 +0000 (17:01 +0000)
Mac/scripts/EditPythonPrefs.py
Mac/scripts/EditPythonPrefs.rsrc.hqx

index 48ed19cc37b8d70eda275b69208f1be98bfda663..3d7becead17e28ee592e4ec8532defd1d0c7e355 100644 (file)
@@ -46,7 +46,7 @@ GUSI_ID = 10240
 OVERRIDE_PATH_STRINGS_ID = 129
 OVERRIDE_DIRECTORY_ID = 129
 OVERRIDE_OPTIONS_ID = 129
-OVERRIDE_GUSI_ID = 10240
+OVERRIDE_GUSI_ID = 10241
 
 # Things we know about the GUSI resource. Note the code knows these too.
 GUSIPOS_TYPE=0
@@ -86,7 +86,6 @@ def message(str = "Hello, world!", id = MESSAGE_ID):
        """Show a simple alert with a text message"""
        d = GetNewDialog(id, -1)
        d.SetDialogDefaultItem(1)
-       print 'd=', d
        tp, h, rect = d.GetDialogItem(2)
        SetDialogItemText(h, str)
        while 1:
@@ -187,8 +186,11 @@ def getoptions(id):
        try:
                opr = GetResource('Popt', id)
        except (MacOS.Error, Res.Error):
-               return [0]*7, None
-       return map(lambda x: ord(x), opr.data), opr
+               return [0]*9, None
+       options = map(lambda x: ord(x), opr.data)
+       while len(options) < 9:
+               options = options + [0]
+       return options, opr
        
 def getgusioptions(id):
        try:
@@ -301,8 +303,7 @@ def edit_preferences():
                        gusi_opr.data = newdata
                        gusi_opr.ChangedResource()
                else:
-                       print 'Created new GUSI option'
-                       ngusi_opr = Resource(gusi_opr.data)
+                       ngusi_opr = Resource(newdata)
                        ngusi_opr.AddResource('GU\267I', GUSI_ID, '')
                                
        CloseResFile(preff_handle)
@@ -342,12 +343,12 @@ def edit_applet(name):
        saved_options = options[:]
        
        creator, type, delaycons, gusi_opr = getgusioptions(OVERRIDE_GUSI_ID)
-       if not opr:
+       if not gusi_opr:
                if notfound:
                        notfound = notfound + ', GUSI options'
                else:
                        notfound = 'GUSI options'
-                       creator, type, delaycons, dummy = getgusioptions(GUSI_ID)
+               creator, type, delaycons, gusi_opr = getgusioptions(GUSI_ID)
        saved_gusi_options = creator, type, delaycons
        
        dummy = dummy2 = None # Discard them.
@@ -361,7 +362,7 @@ def edit_applet(name):
        if result == None:
                sys.exit(0)
                
-       pathlist, nfss, options = result
+       pathlist, nfss, (options, creator, type, delaycons) = result
        if nfss != fss:
                fss_changed = 1
                
@@ -396,12 +397,13 @@ def edit_applet(name):
                        
        if (creator, type, delaycons) != saved_gusi_options:
                newdata = setgusioptions(gusi_opr, creator, type, delaycons)
-               if gusi_opr.HomeResFile == app_handle:
+               id, type, name = gusi_opr.GetResInfo()
+               if gusi_opr.HomeResFile() == app_handle and id == OVERRIDE_GUSI_ID:
                        gusi_opr.data = newdata
                        gusi_opr.ChangedResource()
                else:
-                       gusi_opr = Resource(gusi_opr.data)
-                       gusi_opr.AddResource('GU\267I', OVERRIDE_GUSI_ID, '')
+                       ngusi_opr = Resource(newdata)
+                       ngusi_opr.AddResource('GU\267I', OVERRIDE_GUSI_ID, '')
                        
        CloseResFile(app_handle)
 
index f199984a4645f7a21aff42b756b6365e37ede13e..506264e0c76acd18303853a923720421ea4e8f7e 100644 (file)
@@ -49,17 +49,17 @@ bDA"d)`#3"6-!#3"&!3i&&e4bB@0P)'PYF'pbG#"cG'&dC@ePER4cJJ#3"8N!#3"
 E!3d&(&0eF("bCA0c)'9iF(*PFh0TEfiJF(*TER4TEQF!N!9I!!N!F3%-"4K9EQ*
 eCQCPFQ9N)(0dC'peG#pcG'4PFR)!N!9e!!N!K`%,"40%C@*eCb"`BA*cCA)JEh9
 dF(9dC3#3"D!!(J#b!)`&#dj[FQeKE#"PH'PdF`#3"D!!S!#b!3S&#Q9bFQpb)'9
-iDA3!N!AJ!!S!m3%,K4Y%DA0KBQaP)'&bCf-[BA*RGL"PEA9XBA4TE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