示例#1
0
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.halParameters("xml/" + setup_name + "_default.xml")
    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"
示例#2
0
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.halParameters("xml/" + setup_name + "_default.xml")
    parameters.set("setup_name", setup_name)
    hardware = params.hardware("xml/" + setup_name + "_hardware.xml")

    found = False
    for module in hardware.get("modules").getSubXMLObjects():
        if (module.get("hal_type") == module_type):
            a_module = __import__(module.get("module_name"), globals(), locals(), [setup_name], -1)
            a_class = getattr(a_module, module.get("class_name"))
            instance = a_class(module.get("parameters", False), 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"
示例#3
0
def reader(filename):
    no_ext_name = os.path.splitext(filename)[0]

    # Look for XML file.
    if os.path.exists(no_ext_name + ".xml"):
        xml = parameters.parameters(no_ext_name + ".xml", recurse = True)

    # If it does not exist, then create the xml object
    # from the .inf file.
    elif os.path.exists(no_ext_name + ".inf"):
        xml = infToXmlObject(no_ext_name + ".inf")

    else:
        raise IOError("Could not find an associated .xml or .inf file for " + filename)

    file_type = xml.get("film.filetype")

    if (file_type == ".dax"):
        return DaxReader(filename, xml)
    elif (file_type == ".spe"):
        return SpeReader(filename, xml)
    elif (file_type == ".tif"): 
        return TifReader(filename, xml)
    else:
        print file_type, "is not a recognized file type"
    raise IOError("only .dax, .spe and .tif are supported (case sensitive..)")
示例#4
0
def reader(filename):
    no_ext_name = os.path.splitext(filename)[0]    
    xml = parameters.parameters(no_ext_name + ".xml")
    file_type = xml.get("film.filetype")
    if (file_type == ".dax"):
        return DaxReader(filename, xml)
    elif (file_type == ".spe"):
        return SpeReader(filename, xml)
    elif (file_type == ".tif"): 
        return TifReader(filename, xml)
    else:
        print file_type, "is not a recognized file type"
        raise IOError("only .dax, .spe and .tif are supported (case sensitive..)")
示例#5
0
# ----------------------------------------------------------------------------------------
# Runtime code: Kilroy is meant to be run as a stand alone
# ----------------------------------------------------------------------------------------                                
if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)

    # Show splash screen (to allow for valve initialization)
    splash_pix = QtGui.QPixmap("kilroy_splash.jpg")
    splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()
    time.sleep(.1) # Define minimum startup time

    # Load parameters
    if len(sys.argv) == 2:
        parameters = params.parameters(sys.argv[1])
    else:
        parameters = params.parameters("kilroy_settings_default.xml")

    # Create instance of StandAlone class
    window = StandAlone(parameters)

    # Remove splash screen
    splash.hide()

    # Run main app
    window.show()
    sys.exit(app.exec_())
示例#6
0
        font.setPointSize(8)
        app.setFont(font)

    # 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.halParameters(sys.argv[3])
    else:
        parameters = params.parameters("settings_default.xml")
        setup_name = parameters.get("setup_name")
        hardware = params.hardware("xml/" + setup_name + "_hardware.xml")
        parameters = params.halParameters("xml/" + setup_name + "_default.xml")
    params.setSetupName(parameters, setup_name)

    # Start logger.
    hdebug.startLogging(parameters.get("film.directory") + "logs/", "hal4000")

    # Load app.
    window = Window(hardware, parameters)
    window.toggleSettings()
    splash.hide()
    window.show()

    app.exec_()
示例#7
0
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.halParameters(sys.argv[3])
    else:
        parameters = params.parameters("settings_default.xml")
        setup_name = parameters.get("setup_name")
        hardware = params.hardware("xml/" + setup_name + "_hardware.xml")
        parameters = params.halParameters("xml/" + setup_name + "_default.xml")
    params.setSetupName(parameters, setup_name)

    # Start logger.
    hdebug.startLogging(parameters.get("film.directory") + "logs/", "hal4000")

    # Load app.
    window = Window(hardware, parameters)
    window.toggleSettings()
    splash.hide()
    window.show()

    app.exec_()
示例#8
0
    # Load general settings.
    general_parameters = params.halParameters("settings_default.xml")

    # Load setup specific settings, just to get access to the
    # setup name and the film (and logging) directory.
    if (len(sys.argv) == 4):
        setup_name = sys.argv[1]
        hardware = params.hardware(sys.argv[2])
        setup_parameters_filename = sys.argv[3]
    else:
        setup_name = general_parameters.get("setup_name")
        hardware = params.hardware("xml/" + setup_name + "_hardware.xml")
        setup_parameters_filename = "xml/" + setup_name + "_default.xml"

    setup_parameters = params.parameters(setup_parameters_filename, True)

    # Update general parameters with specific settings that are needed at startup.
    general_parameters.set("setup_name", setup_name)
    general_parameters.set("film.directory",
                           setup_parameters.get("film.directory",
                                                general_parameters.get("film.directory")))
    extension = general_parameters.getp("film.extension")
    if setup_parameters.has("film.extension"):
        extension.setAllowed(setup_parameters.getp("film.extension").getAllowed())
    general_parameters.set("film.logfile",
                           setup_parameters.get("film.logfile",
                                                general_parameters.get("film.logfile")))

    # Start logger.
    hdebug.startLogging(general_parameters.get("film.directory") + "logs/", "hal4000")
示例#9
0
    # Load general settings.
    general_parameters = params.halParameters("settings_default.xml")

    # Load setup specific settings, just to get access to the
    # setup name and the film (and logging) directory.
    if (len(sys.argv) == 4):
        setup_name = sys.argv[1]
        hardware = params.hardware(sys.argv[2])
        setup_parameters_filename = sys.argv[3]
    else:
        setup_name = general_parameters.get("setup_name")
        hardware = params.hardware("xml/" + setup_name + "_hardware.xml")
        setup_parameters_filename = "xml/" + setup_name + "_default.xml"

    setup_parameters = params.parameters(setup_parameters_filename, True)

    # Update general parameters with specific settings that are needed at startup.
    general_parameters.set("setup_name", setup_name)
    general_parameters.set(
        "film.directory",
        setup_parameters.get("film.directory",
                             general_parameters.get("film.directory")))
    extension = general_parameters.getp("film.extension")
    if setup_parameters.has("film.extension"):
        extension.setAllowed(
            setup_parameters.getp("film.extension").getAllowed())
    general_parameters.set(
        "film.logfile",
        setup_parameters.get("film.logfile",
                             general_parameters.get("film.logfile")))