当前位置: 首页>>代码示例>>Python>>正文


Python Logs.get_term_cols方法代码示例

本文整理汇总了Python中waflib.Logs.get_term_cols方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.get_term_cols方法的具体用法?Python Logs.get_term_cols怎么用?Python Logs.get_term_cols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在waflib.Logs的用法示例。


在下文中一共展示了Logs.get_term_cols方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: progress_line

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def progress_line(self, idx, total, col1, col2):
		"""
		Computes a progress bar line displayed when running ``waf -p``

		:returns: progress bar line
		:rtype: string
		"""
		if not sys.stderr.isatty():
			return ''

		n = len(str(total))

		Utils.rot_idx += 1
		ind = Utils.rot_chr[Utils.rot_idx % 4]

		pc = (100. * idx)/total
		fs = "[%%%dd/%%d][%%s%%2d%%%%%%s][%s][" % (n, ind)
		left = fs % (idx, total, col1, pc, col2)
		right = '][%s%s%s]' % (col1, self.timer, col2)

		cols = Logs.get_term_cols() - len(left) - len(right) + 2*len(col1) + 2*len(col2)
		if cols < 7:
			cols = 7

		ratio = ((cols * idx)//total) - 1

		bar = ('='*ratio+'>').ljust(cols)
		msg = Logs.indicator % (left, bar, right)

		return msg
开发者ID:blablack,项目名称:ams-lv2,代码行数:32,代码来源:Build.py

示例2: progress_line

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def progress_line(self, state, total, col1, col2):
		"""
		Compute the progress bar used by ``waf -p``
		"""
		if not sys.stderr.isatty():
			return ''

		n = len(str(total))

		Utils.rot_idx += 1
		ind = Utils.rot_chr[Utils.rot_idx % 4]

		pc = (100.*state)/total
		eta = str(self.timer)
		fs = "[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s][" % (n, n, ind)
		left = fs % (state, total, col1, pc, col2)
		right = '][%s%s%s]' % (col1, eta, col2)

		cols = Logs.get_term_cols() - len(left) - len(right) + 2*len(col1) + 2*len(col2)
		if cols < 7: cols = 7

		ratio = ((cols*state)//total) - 1

		bar = ('='*ratio+'>').ljust(cols)
		msg = Logs.indicator % (left, bar, right)

		return msg
开发者ID:kenmasumitsu,项目名称:waf,代码行数:29,代码来源:Build.py

示例3: __init__

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def __init__(self, ctx):
		optparse.OptionParser.__init__(self, conflict_handler="resolve", version='waf %s (%s)' % (Context.WAFVERSION, Context.WAFREVISION))

		self.formatter.width = Logs.get_term_cols()
		p = self.add_option
		self.ctx = ctx

		jobs = ctx.jobs()
		p('-j', '--jobs',     dest='jobs',    default=jobs, type='int', help='amount of parallel jobs (%r)' % jobs)
		p('-k', '--keep',     dest='keep',    default=0,     action='count', help='keep running happily even if errors are found')
		p('-v', '--verbose',  dest='verbose', default=0,     action='count', help='verbosity level -v -vv or -vvv [default: 0]')
		p('--nocache',        dest='nocache', default=False, action='store_true', help='ignore the WAFCACHE (if set)')
		p('--zones',          dest='zones',   default='',    action='store', help='debugging zones (task_gen, deps, tasks, etc)')

		gr = optparse.OptionGroup(self, 'configure options')
		self.add_option_group(gr)

		gr.add_option('-o', '--out', action='store', default='', help='build dir for the project', dest='out')
		gr.add_option('-t', '--top', action='store', default='', help='src dir for the project', dest='top')

		default_prefix = os.environ.get('PREFIX')
		if not default_prefix:
			if platform == 'win32':
				d = tempfile.gettempdir()
				default_prefix = d[0].upper() + d[1:]
				# win32 preserves the case, but gettempdir does not
			else:
				default_prefix = '/usr/local/'
		gr.add_option('--prefix', dest='prefix', default=default_prefix, help='installation prefix [default: %r]' % default_prefix)
		gr.add_option('--download', dest='download', default=False, action='store_true', help='try to download the tools if missing')


		gr = optparse.OptionGroup(self, 'build and install options')
		self.add_option_group(gr)

		gr.add_option('-p', '--progress', dest='progress_bar', default=0, action='count', help= '-p: progress bar; -pp: ide output')
		gr.add_option('--targets',        dest='targets', default='', action='store', help='task generators, e.g. "target1,target2"')

		gr = optparse.OptionGroup(self, 'step options')
		self.add_option_group(gr)
		gr.add_option('--files',          dest='files', default='', action='store', help='files to process, by regexp, e.g. "*/main.c,*/test/main.o"')

		default_destdir = os.environ.get('DESTDIR', '')
		gr = optparse.OptionGroup(self, 'install/uninstall options')
		self.add_option_group(gr)
		gr.add_option('--destdir', help='installation root [default: %r]' % default_destdir, default=default_destdir, dest='destdir')
		gr.add_option('-f', '--force', dest='force', default=False, action='store_true', help='force file installation')

		gr.add_option('--distcheck-args', help='arguments to pass to distcheck', default=None, action='store')
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:51,代码来源:Options.py

示例4: display_review_set

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def display_review_set(self, review_set):
		"""
		Return the string representing the review set specified.
		"""
		term_width = Logs.get_term_cols()
		lines = []
		for dest in review_options.keys():
			opt = review_options[dest]
			name = ", ".join(opt._short_opts + opt._long_opts)
			help = opt.help
			actual = None
			if dest in review_set: actual = review_set[dest]
			default = review_defaults[dest]
			lines.append(self.format_option(name, help, actual, default, term_width))
		return "Configuration:\n\n" + "\n\n".join(lines) + "\n"
开发者ID:AleemDev,项目名称:waf,代码行数:17,代码来源:review.py

示例5: progress_line

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def progress_line(self,state,total,col1,col2):
		n=len(str(total))
		Utils.rot_idx+=1
		ind=Utils.rot_chr[Utils.rot_idx%4]
		pc=(100.*state)/total
		eta=str(self.timer)
		fs="[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s]["%(n,n,ind)
		left=fs%(state,total,col1,pc,col2)
		right='][%s%s%s]'%(col1,eta,col2)
		cols=Logs.get_term_cols()-len(left)-len(right)+2*len(col1)+2*len(col2)
		if cols<7:cols=7
		ratio=int((cols*state)/total)-1
		bar=('='*ratio+'>').ljust(cols)
		msg=Utils.indicator%(left,bar,right)
		return msg
开发者ID:RunarFreyr,项目名称:waz,代码行数:17,代码来源:Build.py

示例6: progress_line

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
 def progress_line(self, state, total, col1, col2):
     if not sys.stderr.isatty():
         return ""
     n = len(str(total))
     Utils.rot_idx += 1
     ind = Utils.rot_chr[Utils.rot_idx % 4]
     pc = (100.0 * state) / total
     eta = str(self.timer)
     fs = "[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s][" % (n, n, ind)
     left = fs % (state, total, col1, pc, col2)
     right = "][%s%s%s]" % (col1, eta, col2)
     cols = Logs.get_term_cols() - len(left) - len(right) + 2 * len(col1) + 2 * len(col2)
     if cols < 7:
         cols = 7
     ratio = ((cols * state) // total) - 1
     bar = ("=" * ratio + ">").ljust(cols)
     msg = Logs.indicator % (left, bar, right)
     return msg
开发者ID:Grabli66,项目名称:Misanthrope,代码行数:20,代码来源:Build.py

示例7: __init__

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def __init__(self,ctx):
		optparse.OptionParser.__init__(self,conflict_handler="resolve",version='waf %s (%s)'%(Context.WAFVERSION,Context.WAFREVISION))
		self.formatter.width=Logs.get_term_cols()
		self.ctx=ctx
开发者ID:WU-ARL,项目名称:Emulated_NDN_Testbed_in_ONL,代码行数:6,代码来源:Options.py

示例8: __init__

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import get_term_cols [as 别名]
	def __init__(self, ctx, allow_unknown=False):
		optparse.OptionParser.__init__(self, conflict_handler='resolve', add_help_option=False,
			version='waf %s (%s)' % (Context.WAFVERSION, Context.WAFREVISION))
		self.formatter.width = Logs.get_term_cols()
		self.ctx = ctx
		self.allow_unknown = allow_unknown
开发者ID:afeldman,项目名称:waf,代码行数:8,代码来源:Options.py


注:本文中的waflib.Logs.get_term_cols方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。