本文整理汇总了Python中editxt.application.Application.default_profile方法的典型用法代码示例。如果您正苦于以下问题:Python Application.default_profile方法的具体用法?Python Application.default_profile怎么用?Python Application.default_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.default_profile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import default_profile [as 别名]
def main(argv=list(sys.argv)):
try:
if "--test" in argv or "--pdb" in argv:
DEFAULT_LOGGING_CONFIG['handlers']['console']['level'] = 'DEBUG'
use_pdb = "--pdb" in argv
if use_pdb:
argv.remove("--pdb")
objc.setVerbose(1)
# make PyObjC use our exception handler
Debugging.installExceptionHandler = install_exception_handler
if "--test" in argv:
from editxt.test.runner import TestApplication
app = TestApplication(argv)
else:
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
from editxt.application import Application
argv = argv[1:] # drop program name
doc = __doc__.replace('Profile directory.',
'Profile directory [default: {}].'
.format(Application.default_profile()))
opts = docopt.docopt(doc, argv, version=editxt.__version__)
app = Application(opts.get('--profile'))
editxt.app = app
run(app, argv, use_pdb)
except Exception as err:
if len(logging.root.handlers) == 0:
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
log.error('unhandled error', exc_info=True)
sys.exit(1)
示例2: main
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import default_profile [as 别名]
def main(argv=list(sys.argv)):
logging_config = deepcopy(DEFAULT_LOGGING_CONFIG)
try:
if "--test" in argv or "--pdb" in argv:
logging_config['handlers']['console']['level'] = 'DEBUG'
use_pdb = "--pdb" in argv
if use_pdb:
argv.remove("--pdb")
platform_ = "test" if "--test" in argv else "mac"
platform.init(platform_, use_pdb)
if "--test" in argv:
from editxt.test.runner import TestApplication
app = TestApplication(argv)
else:
logging.config.dictConfig(logging_config)
from editxt.application import Application
argv = [a for a in argv if not a.startswith("-psn")] # OS X < 10.9 hack
argv = argv[1:] # drop program name
doc = __doc__.replace('Profile directory.',
'Profile directory [default: {}].'
.format(Application.default_profile()))
opts = docopt.docopt(doc, argv, version=editxt.__version__)
app = Application(opts.get('--profile'))
with app.logger() as errlog:
from editxt.platform.main import run
run(app, argv, errlog.unexpected_error, use_pdb)
except Exception as err:
exc_info = sys.exc_info()
if not logging.root.handlers:
logging.config.dictConfig(logging_config)
log.error('unhandled error', exc_info=exc_info)
sys.exit(1)