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
mobile-chrome-apps - Chrome apps on Android and iOS 2017-02-20
pycrumbs - Bits and bytes of Python from the Internet 2017-02-20
drupal - Verbatim mirror of the git.drupal.org repository f... 2017-02-20
elasticsearch-head - A web front end for an elastic search cluster 2017-02-19
launchrocket - A Mac PrefPane to manage all your Homebrew-install... 2017-02-19
jquery-boilerplate - A jump-start for jQuery plugins development ... 2017-02-19
MVVMReactiveCocoa - GitBucket iOS A 2017-02-19
ios-webkit-debug-proxy - A DevTools proxy (Chrome Remote Debugging Protocol... 2017-02-19
jump.js - A modern smooth scrolling library. ... 2017-02-19
GoSublime - A Golang plugin collection for SublimeText **3**, ... 2017-02-19

 Back to top