def banner(title): title = title.upper() _height, width = get_window_size() title = '%s%s%s' % (config.banner_title_surrounding_left, C.banner_title(title), config.banner_title_surrounding_right) if 'left' == title_position: banner = ljust_colored(title, width, config.banner_separator) elif 'right' == title_position: banner = rjust_colored(title, width, config.banner_separator) else: banner = rjust_colored(title, (width + len(strip(title))) // 2, config.banner_separator) banner = ljust_colored(banner, width, config.banner_separator) return C.banner(banner)
def banner(title): title = title.upper() _height, width = get_window_size() title = '%s%s%s' % (config.banner_title_surrounding_left, C.banner_title(title), config.banner_title_surrounding_right) position = str(title_position) if 'left' == position: banner = ljust_colored(title, width, str(config.banner_separator)) elif 'right' == position: banner = rjust_colored(title, width, str(config.banner_separator)) else: banner = rjust_colored(title, (width + len(strip(title))) // 2, str(config.banner_separator)) banner = ljust_colored(banner, width, str(config.banner_separator)) return C.banner(banner)
def banner(title, target=sys.stdin, width=None): title = title.upper() if width is None: # auto width. In case of stdout, it's better to use stdin (b/c GdbOutputFile) _height, width = get_window_size( target=target if target != sys.stdout else sys.stdin) if title: title = '%s%s%s' % (config.banner_title_surrounding_left, C.banner_title(title), config.banner_title_surrounding_right) if 'left' == title_position: banner = ljust_colored(title, width, config.banner_separator) elif 'right' == title_position: banner = rjust_colored(title, width, config.banner_separator) else: banner = rjust_colored(title, (width + len(strip(title))) // 2, config.banner_separator) banner = ljust_colored(banner, width, config.banner_separator) return C.banner(banner)