def main_loop(app, is_root, back, runqtmain=True): from hscom import helpers as util from hsgui import guitools import sys hs = back.hs # NOQA # Allow for a IPython connection by passing the --cmd flag embedded = util.inIPython() if not embedded and util.get_flag('--cmd'): print('Embedding') util.embed() sys.exit(1) if not embedded and runqtmain: print('Running main loop') # If not in IPython run the QT main loop guitools.run_main_loop(app, is_root, back, frequency=100) signal_reset() print('hotspotter will exit')
#!/usr/bin/env python # TODO: ADD COPYRIGHT TAG from __future__ import print_function, division from hscom import helpers as util from hsdev import test_api from hsgui import guitools from os.path import join import multiprocessing if __name__ == '__main__': multiprocessing.freeze_support() app, is_root = guitools.init_qtapp() hs, back = test_api.main(defaultdb=None, preload=False, app=app) # Build the test db name work_dir = back.get_work_directory() new_dbname = 'scripted_test_db' new_dbdir = join(work_dir, new_dbname) # Remove it if it exists util.delete(new_dbdir) back.new_database(new_dbdir) back.import_images_from_file() guitools.run_main_loop(app, is_root, back, frequency=100)
eid = 'ex=61_nGxs=18' scripts.rrr() extr_enc_loc = scripts.extract_encounter(hs, eid) export_subdb_locals = extr_enc_loc['export_subdb_locals'] return extr_enc_loc, export_subdb_locals def do_generate_training(): generate_training.rrr() return generate_training.generate_detector_training_data(hs, (256, 448)) def do_import_database(): scripts.rrr() #from os.path import expanduser, join #workdir = expanduser('~/data/work') #other_dbdir = join(workdir, 'hsdb_exported_138_185_encounter_eid=1 nGxs=43') def vgd(): return generate_training.vgd(hs) #from PyQt4.QtCore import pyqtRemoveInputHook #from IPython.lib.inputhook import enable_qt4 #pyqtRemoveInputHook() #enable_qt4() exec(helpers.ipython_execstr()) sys.exit(1) if not embedded: # If not in IPython run the QT main loop guitools.run_main_loop(app, is_root, back, frequency=100) signal_reset()