def __init__(self, name): Singleton.__init__(self) self.path = ProfileHelper.get_path() + str(name) + '.json' self.name = name if os.path.isfile(self.path): with open(self.path, 'rb') as fl: data = fl.read() inst = LibToxEncryptSave.get_instance() try: if inst.is_data_encrypted(data): data = inst.pass_decrypt(data) info = json.loads(str(data, 'utf-8')) except Exception as ex: info = Settings.get_default_settings() log('Parsing settings error: ' + str(ex)) super(Settings, self).__init__(info) self.upgrade() else: super(Settings, self).__init__(Settings.get_default_settings()) self.save() smileys.SmileyLoader(self) p = pyaudio.PyAudio() self.audio = { 'input': p.get_default_input_device_info()['index'], 'output': p.get_default_output_device_info()['index'] }
def __init__(self, name): Singleton.__init__(self) self.path = ProfileHelper.get_path() + str(name) + '.json' self.name = name if os.path.isfile(self.path): with open(self.path, 'rb') as fl: data = fl.read() inst = ToxES.get_instance() try: if inst.is_data_encrypted(data): data = inst.pass_decrypt(data) info = json.loads(str(data, 'utf-8')) except Exception as ex: info = Settings.get_default_settings() log('Parsing settings error: ' + str(ex)) super(Settings, self).__init__(info) self.upgrade() else: super(Settings, self).__init__(Settings.get_default_settings()) self.save() smileys.SmileyLoader(self) self.locked = False self.closing = False self.unlockScreen = False p = pyaudio.PyAudio() input_devices = output_devices = 0 for i in range(p.get_device_count()): device = p.get_device_info_by_index(i) if device["maxInputChannels"]: input_devices += 1 if device["maxOutputChannels"]: output_devices += 1 self.audio = {'input': p.get_default_input_device_info()['index'] if input_devices else -1, 'output': p.get_default_output_device_info()['index'] if output_devices else -1, 'enabled': input_devices and output_devices}
def __init__(self, name): Singleton.__init__(self) self.path = ProfileHelper.get_path() + str(name) + '.json' self.name = name if os.path.isfile(self.path): with open(self.path, 'rb') as fl: data = fl.read() inst = ToxEncryptSave.get_instance() try: if inst.is_data_encrypted(data): data = inst.pass_decrypt(data) info = json.loads(str(data, 'utf-8')) except Exception as ex: info = Settings.get_default_settings() log('Parsing settings error: ' + str(ex)) super(Settings, self).__init__(info) self.upgrade() else: super(Settings, self).__init__(Settings.get_default_settings()) self.save() smileys.SmileyLoader(self) self.locked = False self.closing = False p = pyaudio.PyAudio() input_devices = output_devices = 0 for i in range(p.get_device_count()): device = p.get_device_info_by_index(i) if device["maxInputChannels"]: input_devices += 1 if device["maxOutputChannels"]: output_devices += 1 self.audio = {'input': p.get_default_input_device_info()['index'] if input_devices else -1, 'output': p.get_default_output_device_info()['index'] if output_devices else -1, 'enabled': input_devices and output_devices}
def __init__(self, name): Singleton.__init__(self) self.path = ProfileHelper.get_path() + str(name) + '.json' self.name = name if os.path.isfile(self.path): with open(self.path, 'rb') as fl: data = fl.read() inst = ToxEncryptSave.get_instance() try: if inst.is_data_encrypted(data): data = inst.pass_decrypt(data) info = json.loads(str(data, 'utf-8')) except Exception as ex: info = Settings.get_default_settings() log('Parsing settings error: ' + str(ex)) super(Settings, self).__init__(info) self.upgrade() else: super(Settings, self).__init__(Settings.get_default_settings()) self.save() smileys.SmileyLoader(self) p = pyaudio.PyAudio() self.locked = False self.audio = {'input': p.get_default_input_device_info()['index'], 'output': p.get_default_output_device_info()['index']}
def __init__(self): if hasattr(EventManager, "_singleton"): return key.set_repeat(DELAY, RATE) event.set_allowed(None) event.set_allowed([KEYDOWN, JOYBUTTONDOWN, JOYAXISMOTION, JOYBUTTONUP, PLAYER]) for i in range(joystick.get_count()): joystick.Joystick(i).init() # Information for joystick repeat. self._last_press = [None, None] self._last_press_start = [0, 0] self._last_press_times = [0, 0] # Maps key values to player numbers. self.players = { K_w: 0, K_a: 0, K_s: 0, K_d: 0, K_q: 0, K_e: 0, K_i: 1, K_j: 1, K_k: 1, K_l: 1, K_u: 1, K_o: 1, K_LEFT: 0, K_RIGHT: 0, K_UP: 0, K_DOWN: 0, K_SPACE: 0, K_KP_ENTER: 0, K_RETURN: 0, K_2: 1, K_1: 0, K_BACKSPACE: 1 } # Maps key values to internal event keys. self.events = { K_w: UP, K_a: LEFT, K_s: DOWN, K_d: RIGHT, K_q: ROT_CC, K_e: ROT_CW, K_i: UP, K_j: LEFT, K_k: DOWN, K_l: RIGHT, K_u: ROT_CC, K_o: ROT_CW, K_LEFT: LEFT, K_RIGHT: RIGHT, K_UP: UP, K_DOWN: DOWN, K_SPACE: ROT_CC, K_KP_ENTER: CONFIRM, K_RETURN: CONFIRM, K_2: CONFIRM, K_BACKSPACE: CONFIRM, K_1: CONFIRM } Singleton.__init__(self)
def __init__(self, path, name): Singleton.__init__(self) self._path = path + name + '.tox' self._directory = path # create /avatars if not exists: directory = path + 'avatars' if not os.path.exists(directory): os.makedirs(directory)
def __init__(self): BaseSocket.__init__(self) Singleton.__init__(self) self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.bind(config.proxy_bind) self.socket.listen(1) self.clientsocket = None self.clientaddr = ('', 0) self.serversocket = None loghandler.RootHandler() self.log = logging.getLogger('proxy') self.packlog = logging.getLogger('relay') self.packhandler = loghandler.PacketHandler(self.packlog) self.usablefds = [self] self.filters = {} # {modulename.functionname: function} self.enabledfilters = {} self.reload_modules()
def __init__(self): Singleton.__init__(self) loghandler.RootHandler(self) host, port = config.server self.conn = Connection(self, host, port, config.username) self.packhandler = self.conn.packhandler self.timers = TimerManager.get() self.storage = Storage.load() self.x = self.y = self.z = 0 self.stance = 0 self.yaw = 180 self.pitch = 180 self.grounded = 1 self.health = 0 self.players = {} # by eid self.path = None
def __init__(self): Singleton.__init__(self) self.list = [] self.by_name = {}
def __init__(self): Sprite.__init__(self) self._start = pygame.time.get_ticks() self.read_scores() Singleton.__init__(self)