Changeset 1548

Show
Ignore:
Timestamp:
10/23/08 17:19:43 (2 months ago)
Author:
astormont
Message:

WINE colours can now be set back to default -- new "unsetRegistry" function in wine.py also added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wine-doors/trunk/src/ui.py

    r1540 r1548  
    152152 
    153153        if preferences['winegtkcolours'] != wn_prefs['ck_winegtkcolours'].get_active(): 
    154             if wn_prefs['ck_winegtkcolours']
     154            if wn_prefs['ck_winegtkcolours'].get_active()
    155155                wine.SetColoursFromGtk() 
    156156            else: 
    157                 #FIXME: Change colours back. 
    158                 pass 
     157                wine.SetDefaultColours() 
    159158            preferences['winegtkcolours']= wn_prefs['ck_winegtkcolours'].get_active() 
    160159 
  • wine-doors/trunk/src/wine.py

    r1536 r1548  
    2727        import winethemefromgtk 
    2828        del winethemefromgtk 
     29 
     30    def SetDefaultColours( self ): 
     31        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "Background" ) 
     32        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "ButtonDkShadow" ) 
     33        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "ButtonFace" ) 
     34        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "ButtonHilight" ) 
     35        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "ButtonLight" ) 
     36        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "ButtonShadow" ) 
     37        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "ButtonText" ) 
     38        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "GrayText" ) 
     39        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "Hilight" ) 
     40        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "HilightText" ) 
     41        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "Window" ) 
     42        self.unsetRegistry( "HKCU\\Control Panel\\Colors", "WindowText" ) 
    2943 
    3044    def WineVersion( self ): 
     
    428442        f.write("["+path+"]\n") 
    429443        f.write("\""+key+"\"=\""+value+"\"\n") 
     444        f.close() 
     445        self.Execute("regedit", tmp_name); 
     446        os.remove(tmp_name) 
     447 
     448    def unsetRegistry(self, path, key=None): 
     449        """ 
     450        This is a hack for unsetting individual registry keys 
     451        it should make it relatively easy to implement lots of  
     452        registry hacks in the UI... 
     453        We clean up the input and will accept \\\\ or \\ and 
     454        we strip any square brackets too, then we generate 
     455        a regedit 4 file then pass it over to the execute method 
     456 
     457        Completely untested function 
     458        """ 
     459        path.replace("\\\\", "\\") 
     460        path.replace("[", "") 
     461        path.replace("]", "") 
     462        if path.find("HKLM") != -1: 
     463            path = path.replace("HKLM", "HKEY_LOCAL_MACHINE") 
     464        if path.find("HKCU") != -1: 
     465            path = path.replace("HKCU", "HKEY_CURRENT_USER") 
     466 
     467        __, tmp_name = tempfile.mkstemp(suffix='.reg')  
     468        f = open(tmp_name , "wt" ) 
     469        f.write("REGEDIT 4\n\n") 
     470        if key: 
     471            f.write("["+path+"]\n") 
     472            f.write("\""+key+"\"=-\n") 
     473        else: 
     474            f.write("[-"+path+"]\n") 
    430475        f.close() 
    431476        self.Execute("regedit", tmp_name);