Ejemplo n.º 1
0
def main():
    args = parseCLI()

    if not HasyUtils.checkDistroVsPythonVersion(__file__):
        print("pyspViewer*.main: %s does not match distro (Debian-9, 10)" %
              __file__)
        return

    if os.getenv("DISPLAY") != ':0':
        QtGui.QApplication.setStyle('Cleanlooks')

    app = QtGui.QApplication(sys.argv)

    if args.fontSize is not None:
        font = QtGui.QFont('Sans Serif')
        font.setPixelSize(int(args.fontSize))
        app.setFont(font)

    o = PySpectra.pySpectraGuiClass.pySpectraGui(args.files)
    o.show()

    try:
        sys.exit(app.exec_())
    except Exception as e:
        print("pyspViewer.main, exception")
        print(repr(e))
Ejemplo n.º 2
0
def main(flagNoDoor):

    if not HasyUtils.checkDistroVsPythonVersion(__file__):
        print("pyspMonitor.main: %s does not match distro" % __file__)
        exit(255)

    for i in range(len(sys.argv)):
        if sys.argv[i] == '-m':
            del sys.argv[i]

    if os.getenv("DISPLAY") != ':0':
        QtGui.QApplication.setStyle('Cleanlooks')

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)

    if args.fontSize is not None:
        font = QtGui.QFont('Sans Serif')
        font.setPixelSize(int(args.fontSize))
        app.setFont(font)

    o = pysp.pyspMonitorClass.pyspMonitor(app, flagNoDoor)
    o.show()

    import PySpectra.pyspDoor

    try:
        door = taurus.Device(HasyUtils.getLocalDoorNames()[0])
    except Exception as e:
        print("SardanaMonitor.main: trouble connecting to door %s" %
              repr(HasyUtils.getLocalDoorNames()[0]))
        print(repr(e))
        sys.exit(255)

    try:
        sys.exit(app.exec_())
    except Exception as e:
        print(repr(e))
Ejemplo n.º 3
0
def main():

    if not HasyUtils.checkDistroVsPythonVersion(__file__):
        print("TngGui.main: %s does not match distro" % __file__)
        exit(255)

    args = parseCLI()

    if args.spectra:
        #
        # open spectra here to avoid x-errors on image exit
        #
        graPyspIfc.setSpectra(True)
    else:
        graPyspIfc.setSpectra(False)

    #
    # before you uncomment the following line check
    #   - whether you can create a pdf file via pysp
    #     this was the error message:
    #       File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1819, in __init__
    #         baseName = os.path.basename(sys.argv[0])

    #sys.argv = []

    #app = TaurusApplication( sys.argv)
    #
    # if .setStyle() is not called, if TngGui is running
    # locally (not via ssh), the function app.style().metaObject().className()
    # returns QGtkStyle. If this string is supplied to .setStyle()
    # a segmentation fault is generated, locally and remotely.
    # so for remote running we use 'Ceanlooks' which is quite OK.
    #
    if os.getenv("DISPLAY") != ':0':
        QtGui.QApplication.setStyle('Cleanlooks')

    app = QtGui.QApplication(sys.argv)

    if args.fontSize is not None:
        font = QtGui.QFont('Sans Serif')
        font.setPixelSize(int(args.fontSize))
        app.setFont(font)

    devs = devices.Devices(args)

    if args.mca:
        w = mcaWidget.mcaWidget(devices=devs, app=app)
        w.show()
    else:
        if len(devs.allMotors) == 1:
            w = tngGui.lib.tngGuiClass.launchMoveMotor(devs.allMotors[0], devs,
                                                       app)
            w.show()
        else:
            mainW = tngGui.lib.tngGuiClass.mainMenu(args, app, devs)
            mainW.show()

    try:
        sys.exit(app.exec_())
    except Exception as e:
        print(repr(e))