コード例 #1
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    main = MainWindow()
    main.show()
    # allow all background tasks to run to completion.
    cothread.WaitForQuit()
    sys.exit(app.exec_())
コード例 #2
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    main = MainWindow()
    main.show()
    # Finally allow all background tasks to run to completion.
    cothread.WaitForQuit()  # Or some other blocking construct
    sys.exit(app.exec_())
コード例 #3
0
def main():
    qapp = cothread.iqt()
    key_filter = KeyFilter()
    qapp.installEventFilter(key_filter)

    # create and show form
    ui_viewer = uic.loadUi(os.path.join(os.path.dirname(__file__), 'viewer.ui'))
    # Bind code to form
    s = Viewer(ui_viewer, server)

    cothread.WaitForQuit()
コード例 #4
0
def try_prepare_locals(q, args):
    # This will start cothread in this thread
    import cothread
    cothread.input_hook._install_readline_hook(False)
    try:
        locals_d = prepare_locals(args)
    except Exception as e:
        q.put(e)
        raise
    else:
        q.put(locals_d)
    cothread.WaitForQuit(catch_interrupt=False)
コード例 #5
0
ファイル: epicsdatamonitor.py プロジェクト: huyong1979/aphla
def _test1():
    import time
    a = CaDataMonitor(
        ['V:2-SR:C02-BI:G2{PH1:245}SA:X', 'V:2-SR:C02-BI:G2{PH1:245}SA:Y'])
    print(a.data)

    print("A")

    a.closeMonitors()

    print("press Ctrl-C to quit")
    import cothread
    cothread.WaitForQuit()
コード例 #6
0
def main():
    """"""

    args = sys.argv

    # If Qt is to be used (for any GUI) then the cothread library needs to
    # be informed, before any work is done with Qt. Without this line
    # below, the GUI window will not show up and freeze the program.
    cothread.iqt()

    dialog = make(isModal=False, parentWindow=None)

    cothread.WaitForQuit()
    print(dialog.config_model.abstract.channel_ids)
コード例 #7
0
def main(args=None):

    # If Qt is to be used (for any GUI) then the cothread library needs to be informed,
    # before any work is done with Qt. Without this line below, the GUI window will not
    # show up and freeze the program.
    qtapp = cothread.iqt()
    '''
    app = CurrentMonitorApp()
    window = app.view
    window.show()
    '''
    app = make()

    cothread.WaitForQuit()
コード例 #8
0
def main(args):
    """ """

    #qapp = Qt.QApplication(args) # Necessary whether modal or non-modal

    #result = make(modal = True, output_type = TYPE_ELEMENT)

    #if result.has_key('dialog_result'): # When modal
        #app           = result['app']
        #dialog_result = result['dialog_result']

        #print dialog_result
        #print 'Length = ', len(dialog_result)


    #else: # When non-modal
        #app = result['app']
        #exit_status = qapp.exec_()
        #sys.exit(exit_status)

    cothread.iqt()

    result = make(modal=True, output_type=TYPE_ELEMENT)

    if result.has_key('dialog_result'): # When modal
        app           = result['app']
        dialog_result = result['dialog_result']

        print dialog_result
        print 'Length = ', len(dialog_result)


    else: # When non-modal
        app = result['app']
        #exit_status = qapp.exec_()
        #sys.exit(exit_status)

    cothread.WaitForQuit()
コード例 #9
0
ファイル: elemtuner.py プロジェクト: huyong1979/aphla
    def closeEvent(self, event):
        self.closePvMonitors()
        event.accept()

    def close(self):
        self.closePvMonitors()
        return True


if __name__ == "__main__":
    import sys
    hla.machines.initNSLS2VSRTxt()
    print("Good !")

    #app = QApplication(sys.argv)
    form = PvTunerDlg()
    form.resize(800, 600)

    #form._appendRecord("PL2G2C01A")
    form._appendRecord("PL2G2C01A.x")
    form._appendRecord("PL2G2C01A.y")
    form._appendRecord("CXH2G6C01B.x")
    form._updateMonitors()

    form.show()
    #app.exec_()

    cothread.WaitForQuit()

    #print "selected: ", form.result()
コード例 #10
0
ファイル: mleap.py プロジェクト: ChannelFinder/hla
def main(par=None):
    #app.setStyle(st)
    app.setOverrideCursor(QtGui.QCursor(Qt.WaitCursor))
    app.setWindowIcon(QIcon(":/mainwin_2.png"))

    splash_px = QtGui.QPixmap(':/splash_screen_1.png')
    splash = QtGui.QSplashScreen(splash_px, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_px.mask())
    splash.setWindowFlags(Qt.SplashScreen)
    #splash.setWindowFlags(Qt.WindowStaysOnTopHint)
    rect = app.desktop().availableGeometry()
    splash.move((rect.width() - splash_px.width()) / 2,
                (rect.height() - splash_px.height()) / 2)

    mlist = os.environ.get('APHLA_MACHINES', '').split(";")
    splash.showMessage("Initializing {0}".format(mlist),
                       Qt.AlignRight | Qt.AlignBottom)
    splash.show()
    #splash.raise_()
    app.processEvents()
    time.sleep(0.1)
    app.processEvents()

    if not mlist: mlist = aphla.machines.machines()
    machs, infos = [], []
    for m in mlist:
        splash.showMessage("Initializing {0}".format(m),
                           Qt.AlignRight | Qt.AlignBottom)
        app.processEvents()
        lat0, latdict = aphla.machines.load(m, return_lattices=True)
        infos.append("%s initialized" % m)
        splash.showMessage("Connecting to {0}".format(m),
                           Qt.AlignRight | Qt.AlignBottom)
        app.processEvents()
        pvs = set()
        for latname, latobj in latdict.items():
            splash.showMessage("checking {0}.{1}".format(m, latname),
                               Qt.AlignRight | Qt.AlignBottom)
            app.processEvents()
            for elem in latobj.getElementList("*"):
                pvs.update(elem.pv())

        # pv manager
        #pvm = CaDataMonitor(timeout=5)
        #pvm.addPv(pvs)
        machs.append((m, latdict, lat0, None))

        #infos.append("%d out of %d PVs are alive" % (
        #    pvm.activeCount(), len(pvm)))
        infos.append("pvm is disabled")

    splash.showMessage("Using {0} as default machine".format(m),
                       Qt.AlignRight | Qt.AlignBottom)
    app.processEvents()

    mwin = OrbitPlotMainWindow(machines=machs, infos=infos, iqt=app)
    mwin.setWindowTitle("mleap - a high level lattice viewer and editor")
    splash.showMessage("Window created", Qt.AlignRight | Qt.AlignBottom)
    #demo = QtGui.QMainWindow()
    #demo.raise_()
    #demo.setLattice(aphla.machines.getLattice('V2SR'))
    #demo.setWindowTitle("NSLS-II")
    #mwin.resize(1000,600)
    #print aphla.machines.lattices()
    splash.finish(mwin)
    mwin.showMaximized()
    app.processEvents()
    app.restoreOverrideCursor()
    mwin.tileSubWindowsHorizontally()
    # print app.style() # QCommonStyle
    #sys.exit(app.exec_())
    cothread.WaitForQuit()
コード例 #11
0
def _test1(pvs):
    a = CaDataMonitor(pvs)
    cothread.WaitForQuit()
コード例 #12
0
ファイル: beamreq.py プロジェクト: odino4ka49/BeamRequest
def main():
    app = cothread.iqt()
    ex = MainWin()
    ex.show()
    cothread.WaitForQuit()
コード例 #13
0
def main():
    cothread.iqt()
    the_ui = AccelGui()
    the_ui.ui.show()
    cothread.WaitForQuit()