def show_masking_progress(): global masking_shown, mask_i, mask_stage mask_i += 1 if mask_i > mask_numbers[mask_stage]: mask_i -= mask_numbers[mask_stage] if mask_stage + 1 < len(mask_numbers): mask_stage += 1 mask_number = mask_numbers[mask_stage] if (time.time() - 0.1) > masking_shown: masking_shown = time.time() progress.draw_frame('masking sprites...', '%s/%s' % (mask_i, mask_number), mask_i / float(mask_number))
def unpack_data(): last_flipped = time.time() all_files_count = 955 i = 0 if os.path.exists('data.tgz'): tar = tarfile.open('data.tgz') for info in tar: i += 1 if (time.time() - last_flipped) > 0.1: progress.draw_frame('installing...', info.name, float(i) / all_files_count) last_flipped = time.time() if '..' in info.name or info.name.startswith('/'): raise IOError('unsafe file name') if info.isdir(): info = copy.copy(info) info.mode = 0o700 if osutil.is_android: tar.extract(info, "") os.remove('data.tgz') progress.draw_frame('', 'starting...', 1)
def unpack_data(): last_flipped = time.time() all_files_count = 455 i = 0 if os.path.exists('data.tgz'): tar = tarfile.open('data.tgz') for info in tar: i += 1 if (time.time() - last_flipped) > 0.1: progress.draw_frame('installing...', info.name, float(i) / all_files_count) last_flipped = time.time() if '..' in info.name or info.name.startswith('/'): raise IOError('unsafe file name') if info.isdir(): info = copy.copy(info) info.mode = 0o700 if osutil.is_android: tar.extract(info, "") os.remove('data.tgz') progress.draw_frame('', 'starting...', 1)
def ui_main(): progress.draw_frame('', 'loading tileset...', 1) freeciv.func.init_things() freeciv.func.init_mapcanvas_and_overview() main()