| | 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" ) |
|---|
| | 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") |
|---|