def __init__(self): registry = Registry() self.firstLoad = [] self._rmap = {} self._map = { "3D Device Name": "d3d", "3DSound": "sound", "Back Buffers in Video RAM": "draw3d", "Display Bit Depth": "color", "Draw Cursor": "cursor", "Flip Surfaces": "surface", "Full Screen": "windowed", "Island Quality": "model", "Island Texture": "texture", "Music": "music", "savepath": "savepath", "UseJoystick": "joystick", "Wide View Angle": "wideangle" } # Create a reverse conversion map for k, v in self._map.items(): self._rmap[v] = k # Get the initial registry values for key in registry.readAll(): self.firstLoad.append( Utils.makeAction(self.convertKeyNames(key[0]), key[1]) ) # Connect the buttons to the queue self.responses = Responses(self)
class ReDirect: def __init__(self, newPath): self.registry = Registry() self.curPath = self.registry.readKey("savepath") self.newPath = newPath.replace("/", "\\") # Make sure the paths are different # TODO Display a message if self.curPath.lower() == self.newPath.lower(): return False # Make sure the new path exists if not os.path.exists(self.newPath): os.makedirs(self.newPath) # Update the registry key self.registry.writeKey("savepath", self.newPath) # Move the saves for f in self.__findSaves(): distutils.file_util.move_file( os.path.join(self.curPath, f), os.path.join(self.newPath, f) ) def __findSaves(self): for f in os.listdir(self.curPath): fl = f.lower() if fl.endswith(".gs") or fl.endswith(".gsi"): yield f
class ReDirect: def __init__(self, newPath): self.registry = Registry() self.curPath = self.registry.readKey("savepath") self.newPath = newPath.replace("/", "\\") # Make sure the paths are different # TODO Display a message if self.curPath.lower() == self.newPath.lower(): return False # Make sure the new path exists if not os.path.exists(self.newPath): os.makedirs(self.newPath) # Update the registry key self.registry.writeKey("savepath", self.newPath) # Move the saves for f in self.__findSaves(): distutils.file_util.move_file(os.path.join(self.curPath, f), os.path.join(self.newPath, f)) def __findSaves(self): for f in os.listdir(self.curPath): fl = f.lower() if fl.endswith(".gs") or fl.endswith(".gsi"): yield f
class Windower: def __init__(self, shouldEnable): self.registry = Registry() if shouldEnable: self.__enable() else: self.__disable() def __enable(self): self.registry.writeKey("3D Device Name", "Ramp Emulation") self.registry.writeKey("Full Screen", False, True) self.registry.writeKey("Back Buffers in Video RAM", False, True) self.registry.writeKey("Flip Surfaces", False, True) return True def __disable(self): self.registry.writeKey("Full Screen", True, True) return True
def __init__(self, shouldEnable): self.registry = Registry() if shouldEnable: self.__enable() else: self.__disable()