BVB Source Codes

voltron Show main.py Source code

Return Download voltron: download main.py Source code - Download voltron Source code - Type:.py
  1. import os
  2. import argparse
  3. import logging
  4. import traceback
  5. import logging
  6. import logging.config
  7.  
  8. import voltron
  9. from .view import *
  10. from .core import *
  11.  
  12. log = logging.getLogger('main')
  13.  
  14.  
  15. def main(debugger=None):
  16.     voltron.setup_logging('main')
  17.  
  18.     # Set up command line arg parser
  19.     parser = argparse.ArgumentParser()
  20.     parser.register('action', 'parsers', AliasedSubParsersAction)
  21.     parser.add_argument('--debug', '-d', action='store_true', help='print debug logging')
  22.     parser.add_argument('-o', action='append', help='override config variable', default=[])
  23.     top_level_sp = parser.add_subparsers(title='subcommands', description='valid subcommands', dest='subcommand')
  24.     top_level_sp.required = True
  25.     view_parser = top_level_sp.add_parser('view', help='display a view', aliases=('v'))
  26.     view_parser.register('action', 'parsers', AliasedSubParsersAction)
  27.     view_sp = view_parser.add_subparsers(title='views', description='valid view types', help='additional help', dest='view')
  28.     view_sp.required = True
  29.  
  30.     # Set up a subcommand for each view class
  31.     pm = PluginManager()
  32.     pm.register_plugins()
  33.     for plugin in pm.view_plugins:
  34.         pm.view_plugins[plugin].view_class.configure_subparser(view_sp)
  35.  
  36.     # Parse args
  37.     args = parser.parse_args()
  38.     if args.debug:
  39.         voltron.config['general']['debug_logging'] = True
  40.         voltron.setup_logging('main')
  41.     voltron.config.update(options=dict((tuple(x.split('=')) for x in args.o)))
  42.  
  43.     # Instantiate and run the appropriate module
  44.     inst = args.func(args, loaded_config=voltron.config)
  45.     inst.pm = pm
  46.     try:
  47.         inst.run()
  48.     except Exception as e:
  49.         log.exception("Exception running module {}: {}".format(inst.__class__.__name__, traceback.format_exc()))
  50.         print("Encountered an exception while running the view '{}':\n{}".format(inst.__class__.__name__, traceback.format_exc()))
  51.     except KeyboardInterrupt:
  52.         suppress_exit_log = True
  53.     inst.cleanup()
  54.  
downloadmain.py Source code - Download voltron Source code
Related Source Codes/Software:
IGListKit - A data-driven UICollectionView framework for build... 2017-01-11
androidmvp - MVP Android Example 2017-01-11
svelte - The magical disappearing UI framework ... 2017-01-11
kcptun - A Simple UDP Tunnel Based On KCP 2017-01-11
poisontap - Exploits locked/password protected computers over ... 2017-01-10
ecma262 - Status, process, and documents for ECMA262 ... 2017-01-11
react-native-elements - React Native Elements UI Toolkit 2017-01-11
tensorflow-zh - Google new open source ai system TensorFlow Chines... 2017-01-11
forum - Blue light (the Lantern) the official BBS 2017-01-11
socketcluster - Highly scalable realtime framework ... 2017-01-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top