def build_app(catalog_uri, zmq_address=None): from intake import Catalog catalog = Catalog(catalog_uri) # TODO Make search_result_row configurable. def search_result_row(entry): start = entry.metadata['start'] stop = entry.metadata['stop'] start_time = datetime.fromtimestamp(start['time']) duration = datetime.fromtimestamp(stop['time']) - start_time str_duration = str(duration) return {'Unique ID': start['uid'][:8], 'Transient Scan ID': str(start.get('scan_id', '-')), 'Plan Name': start.get('plan_name', '-'), 'Start Time': start_time.strftime('%Y-%m-%d %H:%M:%S'), 'Duration': str_duration[:str_duration.index('.')], 'Exit Status': '-' if stop is None else stop['exit_status']} app = QApplication([b'Bluesky Browser']) app.main_window = QMainWindow() central_widget = CentralWidget( catalog=catalog, zmq_address=zmq_address, search_result_row=search_result_row, menuBar=app.main_window.menuBar) app.main_window.setCentralWidget(central_widget) app.main_window.show() return app
def build_app(catalog_uri, zmq_address=None): catalog = Catalog(catalog_uri) app = QApplication([b'Bluesky Browser']) app.main_window = QMainWindow() central_widget = CentralWidget(catalog=catalog, zmq_address=zmq_address, menuBar=app.main_window.menuBar) app.main_window.setCentralWidget(central_widget) app.main_window.show() return app