def runginga(sys_argv): """Run this from command line. This does the following: * Set up custom STScI plugins. * Enforce Qt toolkit. * Pass command line arguments directly into Ginga. .. warning:: If the same plugin that is loaded here is also loaded via ``~/.ginga/ginga_config.py`` or command line, you will see duplicates! """ gpfx = 'ginga.qtw.plugins' # To load custom Qt plugins in Ginga namespace # Remove some Ginga default plugins. # Use this if we have custom plugins that replaces them. # Note: Unable to get this to work from within ginga_config.py # Example: # glb_plg_to_remove = ['WBrowser', 'RC', 'SAMP', 'IRAF'] glb_plg_to_remove = [] lcl_plg_to_remove = [] _remove_plugins(glb_plg_to_remove, gmain.global_plugins) _remove_plugins(lcl_plg_to_remove, gmain.local_plugins) # Add custom plugins. # If we use this, we do not have to use ginga_config.py global_plgs = [] local_plgs = [ Bunch(module='BackgroundSub', tab='BackgroundSub', ws='dialogs', pfx=gpfx), Bunch(module='DQInspect', tab='DQInspect', ws='dialogs', pfx=gpfx) ] gmain.global_plugins += global_plgs gmain.local_plugins += local_plgs # Enforce Qt (--toolkit or -t) new_argv = ['--toolkit=qt' if 'toolkit' in s else s for s in sys_argv] if '-t' in new_argv: new_argv[new_argv.index('-t') + 1] = 'qt' # Start Ginga gmain.reference_viewer(new_argv)
def run_stginga(sys_argv): """Run this from command line. This does the following: * Set up custom STScI plugins. * Enforce Qt toolkit. * Pass command line arguments directly into Ginga. .. warning:: If the same plugin that is loaded here is also loaded via ``~/.ginga/ginga_config.py`` or command line, you will see duplicates! """ from .plugin_info import _get_stginga_plugins # Remove some Ginga default plugins. # Use this if we have custom plugins that replaces them. # Note: Unable to get this to work from within ginga_config.py # Example: # glb_plg_to_remove = ['WBrowser', 'RC', 'SAMP', 'IRAF'] glb_plg_to_remove = [] lcl_plg_to_remove = [] _remove_plugins(glb_plg_to_remove, gmain.global_plugins) _remove_plugins(lcl_plg_to_remove, gmain.local_plugins) # Add custom plugins. # If we use this, we do not have to use ginga_config.py stglobal_plugins, stlocal_plugins = _get_stginga_plugins() gmain.global_plugins += stglobal_plugins gmain.local_plugins += stlocal_plugins # Enforce Qt (--toolkit or -t) new_argv = ['--toolkit=qt' if 'toolkit' in s else s for s in sys_argv] if '-t' in new_argv: new_argv[new_argv.index('-t') + 1] = 'qt' # Start Ginga gmain.reference_viewer(new_argv)
#!/usr/bin/env python # # ginga -- astronomical image viewer and toolkit # """ Usage: ginga --help ginga [options] [fitsfile] ... """ import sys from ginga import main, trcalc try: trcalc.use('opencv') except ImportError: pass if __name__ == "__main__": main.reference_viewer(sys.argv)