def runModule(module_type, setup_name=False): app = QtGui.QApplication(sys.argv) parameters = params.Parameters("settings_default.xml") if not setup_name: setup_name = parameters.get("setup_name") parameters = params.Parameters("xml/" + setup_name + "_default.xml", is_HAL=True) parameters.set("setup_name", setup_name) hardware = params.Hardware("xml/" + setup_name + "_hardware.xml") found = False for module in hardware.modules: if (module.hal_type == module_type): a_module = __import__(module.module_name, globals(), locals(), [setup_name], -1) a_class = getattr(a_module, module.class_name) instance = a_class(module.parameters, parameters, None) instance.newParameters(parameters) instance.show() found = True break if found: app.exec_() instance.cleanup() else: print module_type, "not found for", setup_name, "setup"
def newSettings(self, parameters_filename): # parse parameters file is_valid_xml = True try: parameters = params.Parameters(parameters_filename, is_HAL = True) except: is_valid_xml = False hdebug.logText("failed to parse parameters file " + parameters_filename) QtGui.QMessageBox.information(self, "Parameter file parsing error", traceback.format_exc()) if is_valid_xml: self.parameters_box.addParameters(parameters)
if __name__ == "__main__": app = QtGui.QApplication(sys.argv) # Splash Screen. pixmap = QtGui.QPixmap("splash.png") splash = QtGui.QSplashScreen(pixmap) splash.show() app.processEvents() # Load settings. if (len(sys.argv) == 4): setup_name = sys.argv[1] hardware = params.Hardware(sys.argv[2]) parameters = params.Parameters(sys.argv[3], is_HAL = True) else: parameters = params.Parameters("settings_default.xml") setup_name = parameters.get("setup_name") hardware = params.Hardware("xml/" + setup_name + "_hardware.xml") parameters = params.Parameters("xml/" + setup_name + "_default.xml", is_HAL = True) params.setSetupName(parameters, setup_name) # Start logger. hdebug.startLogging(parameters.get("directory") + "logs/", "hal4000") # Load app. window = Window(hardware, parameters) window.toggleSettings() splash.hide() window.show()
## monochrome # # @param screen_size The size of the screen. # @param color The image color. # # @return A monochrome QImage. # def monochrome(screen_size, color): image = QtGui.QImage(screen_size[0], screen_size[1], QtGui.QImage.Format_RGB32) painter = QtGui.QPainter(image) painter.setPen(QtGui.QColor(color, color, color)) painter.setBrush(QtGui.QColor(color, color, color)) painter.drawRect(0, 0, image.width(), image.height()) painter.end() return image if __name__ == '__main__': app = QtGui.QApplication(sys.argv) if (len(sys.argv) == 2): hardware = parameters.Parameters(sys.argv[1]) else: hardware = parameters.Parameters("settings.xml") dialog = HoloeyeDialog(hardware) dialog.show() sys.exit(app.exec_())
# # Handles the quit action, closes the window. # # @param boolean Dummy parameter. # @hdebug.debug def quit(self, boolean): self.close() if __name__ == "__main__": app = QtGui.QApplication(sys.argv) # Load settings. if (len(sys.argv) == 2): parameters = params.Parameters(sys.argv[1]) else: parameters = params.Parameters("settings_default.xml") # Start logger. hdebug.startLogging(parameters.directory + "logs/", "steve") # Load app. window = Window(parameters) window.show() app.exec_() # # The MIT License # # Copyright (c) 2013 Zhuang Lab, Harvard University
import camera.frame as frame # This file is available in the ZhuangLab storm-analysis project on github. import sa_library.datareader as datareader if (len(sys.argv) != 4): print "usage: <settings> <movie_in> <png_out>" exit() # Open movie & get size. data_file = datareader.inferReader(sys.argv[2]) [width, height, length] = data_file.filmSize() # Start spotCounter as a stand-alone application. app = QtGui.QApplication(sys.argv) parameters = params.Parameters(sys.argv[1], is_HAL=True) parameters.set("setup_name", "offline") parameters.set("x_pixels", width) parameters.set("y_pixels", height) parameters.set("x_bin", 1) parameters.set("y_bin", 1) spotCounter = SingleSpotCounter(parameters) spotCounter.newParameters(parameters, [[255, 255, 255]]) # Start driver. driver = OfflineDriver(spotCounter, data_file, sys.argv[3]) # Show window & start application. spotCounter.show()
self.createCommandList() self.updateEstimates() ## quit # # Handles the quit file action. # # @param boolean Dummy parameter. # @hdebug.debug def quit(self, boolean): self.close() if __name__ == "__main__": app = QtGui.QApplication(sys.argv) parameters = params.Parameters("settings_default.xml") # Start logger. #hdebug.startLogging(parameters.directory + "logs/", "dave") # Load app. window = Dave(parameters) window.show() app.exec_() # # The MIT License # # Copyright (c) 2013 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy