コード例 #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)

    general_parameters = params.halParameters("settings_default.xml")
    if setup_name:
        general_parameters.set("setup_name", setup_name)
    else:
        setup_name = general_parameters.get("setup_name")
    hardware = params.hardware("xml/" + setup_name + "_hardware.xml")

    found = False
    for module in hardware.get("modules").getProps():
        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), general_parameters, None)

            params.setDefaultParameters(general_parameters)
            setup_parameters = params.halParameters("xml/" + setup_name + "_default.xml")

            instance.newParameters(setup_parameters)
            instance.show()
            found = True
            break

    if found:
        app.exec_()
        instance.cleanup()
    else:
        print module_type, "not found for", setup_name, "setup"
コード例 #3
0
ファイル: standalone.py プロジェクト: ymsigal/storm-control
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"
コード例 #4
0
    # Set default font size for linux.
    if (sys.platform == "linux2"):
        font = QtGui.QFont()
        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()
コード例 #5
0
ファイル: hal-4000.py プロジェクト: BogdanBintu/storm-control
        self.parameters.set("film.notes", str(self.ui.notesEdit.toPlainText()))


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()