def _run(self, reader, view_plugs, lock=False): try: self.q_app = QtGui.QApplication(sys.argv) view_plug_imp = [] for plug in view_plugs: view = ViewerPluginFactory().make(plug) view.set_reader(reader) view_plug_imp.append(view) self.gui = DirectViewWindow(view_plug_imp) self.gui.link_axis() self.gui.show() if lock: lock.release() sys.exit(self.q_app.exec_()) except SystemExit: print("Qt Window Thread finalized") self.gui.close()
def show(self, reader, view_plugs, q_app): ''' runs the app in the same thread''' try: if not q_app: run_it = False self.q_app = QtGui.QApplication(sys.argv) else: run_it = True self.q_app = q_app view_plug_imp = [] for plug in view_plugs: view = ViewerPluginFactory().make(plug) view.set_reader(reader) view_plug_imp.append(view) self.gui = DirectViewWindow(view_plug_imp) self.gui.link_axis() self.gui.show() if not run_it: sys.exit(self.q_app.exec_()) except SystemExit: print("Qt Window Thread finalized") self.gui.close()