本文整理汇总了Python中ui.UI.create方法的典型用法代码示例。如果您正苦于以下问题:Python UI.create方法的具体用法?Python UI.create怎么用?Python UI.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import create [as 别名]
def main():
try:
# set up and parse arguments
parser = argparse.ArgumentParser(description='Mozilla Powertool')
parser.add_argument('-d', '--device', type=str, nargs='+',
choices=['yocto','mozilla'], required=True,
help="specify ammeter device to use")
parser.add_argument('-p', '--path', type=str, default=None,
help="specify path to ammeter device (e.g. /dev/ttyACM0)")
parser.add_argument('-u', '--ui', type=str, default='tk',
choices=['tk','cli', 'web', 'simple'], help="specify which UI to use")
parser.add_argument('-f', '--file', type=str, default=None, help="test run config file")
parser.add_argument('-o', '--out', type=str, default=None, help="output data file")
parser.add_argument('-b', '--begin_experiments', action="store_true", help="begin experiments as soon as the UI has been displayed")
parser.add_argument('-s', '--show', type=str, default='current', help="name of the sample source to display")
args = parser.parse_args()
# create the sample source
source = SampleSource.create( args.device, args.path )
# create the test suite
suite = TestSuite.create( args.file )
# add the sample source
suite.addSource( source )
# create the saver
saver = TestSuiteSaver.create( args.out )
# create the displayer
ui = UI.create( args.ui, suite, args.begin_experiments, args.show )
# run the app
ui.run()
# save the data
saver.save( suite )
# shut down the sample source
source.close()
sys.exit(0)
except Exception, e:
frame = inspect.trace()[-1]
print >> sys.stderr, "\nException:\n from %s, line %d:\n %s\n" % (frame[1], frame[2], e)
parser.print_help()
sys.exit(1)
示例2: main
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import create [as 别名]
def main():
try:
# set up and parse arguments
parser = argparse.ArgumentParser(description='Mozilla Powertool')
parser.add_argument('-d', '--device', type=str, default=['mozilla','yocto'],
choices=['yocto','mozilla'], action='append',
help="specify ammeter device to use")
parser.add_argument('-p', '--path', type=str, default=None,
help="specify path to ammeter device (e.g. /dev/ttyACM0)")
parser.add_argument('-u', '--ui', type=str, required=True,
choices=['tk','cli'], default='cli', help="specify which UI to use")
parser.add_argument('-f', '--file', type=str, default=None, help="test run config file")
parser.add_argument('-o', '--out', type=str, default=None, help="output data file")
parser.add_argument('-s', '--show', type=str, default=None, help="name of the sample source to display")
args = parser.parse_args()
# create the sample source
source = SampleSource.create( args.device, args.path )
# create the test suite
suite = TestSuite.create( args.file )
# add the sample source
suite.addSource( source )
# create the saver
saver = TestSuiteSaver.create( args.out )
# create the displayer
ui = UI.create( args.ui, suite, args.show )
# run the app
ui.run()
# save the data
saver.save( suite )
# shut down the sample source
source.close()
sys.exit(0)
except Exception, e:
print("\nERROR: %s\n" % e)
parser.print_help()
sys.exit(1)