def load_all(self): if os.path.exists(self.all_pools_file_path): _pools = [] try: _pools = json.loads(readFile(self.all_pools_file_path)) except: pass for p in _pools: self._set_default_values(p) self.all_pools.append(p) fixed_pools = self._load_fixed_pools() for p1 in fixed_pools: pool_found = False for p2 in self.all_pools: if p1['id'] == p2['id']: # copy default/fixed mining properties p2['algo'] = p1['algo'] p2['name'] = p1['name'] p2['url'] = p1['url'] p2['is_fixed'] = True p2['is_mining'] = False if not p2['username'] else p2[ 'is_mining'] pool_found = True break if not pool_found: self._set_default_values(p1) p1['is_fixed'] = True self.all_pools.insert(0, p1)
def load(self): if os.path.exists(self.app_settings_filepath): try: self.settings = json.loads(readFile( self.app_settings_filepath)) except Exception, err: log("[AppSettings]>>> Load error:" + str(err), LEVEL_ERROR)
def load(self): if os.path.exists(self.wallet_info_filepath): try: _wallet_info = json.loads(readFile(self.wallet_info_filepath)) if os.path.exists(_wallet_info['wallet_filepath']): self.wallet_filepath = _wallet_info['wallet_filepath'] self.wallet_address = _wallet_info['wallet_address'] self.is_loaded = True return True except Exception, err: log("[WalletInfo]>>> Load error:" + str(err), LEVEL_ERROR) return False
def _check_file_integrity(app): ''' Check file integrity to make sure all resources loaded to webview won't be modified by an unknown party ''' for file_name, file_hash in file_hashes: file_path = os.path.normpath( os.path.join(app.property("ResPath"), file_name)) if not os.path.exists(file_path): return False data = readFile(file_path) print(file_path, hashlib.sha256(data).hexdigest().upper()) if hashlib.sha256(data).hexdigest().upper() != file_hash: return False return True