예제 #1
0
def main(top_block_cls=top_block, options=None):

    if StrictVersion("4.5.0") <= StrictVersion(
            Qt.qVersion()) < StrictVersion("5.0.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()
    start = time.time()

    def finish():
        end = time.time()
        print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
        print("transmission time: \t" + str(end - start) + "s")
        print("\tsamp rate: \t" + str(tb.samp_rate) + " samples/s")
        print("\tcarr freq: \t" + str(tb.freq) + "Hz")
        print("\tbandwidfffth: \t" + str(tb.bandwidth) + "Hz")
        tb.stop()
        tb.wait()
        QtCore.QCoreApplication.instance().quit()

    t = Timer(4, finish)
    t.start()  # after 30 seconds, "hello, world" will be printed

    qapp.exec_()
예제 #2
0
def main() -> None:
    from argparse import ArgumentParser

    check_versions()

    parser = ArgumentParser()
    parser.add_argument('script_path',
                        help='Path to Vapoursynth script',
                        type=Path,
                        nargs='?')
    parser.add_argument('-a',
                        '--external-args',
                        type=str,
                        help='Arguments that will be passed to scripts')
    args = parser.parse_args()

    if args.script_path is None:
        print('Script path required.')
        sys.exit(1)

    script_path = args.script_path.resolve()
    if not script_path.exists():
        print('Script path is invalid.')
        sys.exit(1)

    os.chdir(script_path.parent)
    app = Qt.QApplication(sys.argv)
    main_window = MainWindow()
    main_window.load_script(script_path, external_args=args.external_args)
    main_window.show()

    try:
        app.exec_()
    except Exception:  # pylint: disable=broad-except
        logging.error('app.exec_() exception')
예제 #3
0
def main(top_block_cls=TP1f, options=None):

    if StrictVersion("4.5.0") <= StrictVersion(
            Qt.qVersion()) < StrictVersion("5.0.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def sig_handler(sig=None, frame=None):
        Qt.QApplication.quit()

    signal.signal(signal.SIGINT, sig_handler)
    signal.signal(signal.SIGTERM, sig_handler)

    timer = Qt.QTimer()
    timer.start(500)
    timer.timeout.connect(lambda: None)

    def quitting():
        tb.stop()
        tb.wait()

    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #4
0
def main():
    # Para que lo nuestro sea considerado una aplicación tipo QT GUI
    qapp = Qt.QApplication(sys.argv)
    simulador_de_la_envolvente_compleja = flujograma()
    simulador_de_la_envolvente_compleja.start()
    # Para arranque la parte grafica
    qapp.exec_()
예제 #5
0
def main(filename):
    app = Qt.QApplication(sys.argv)
    win = AppWindow()

    is_hotdog = predict(filename) == "hotdog"
    win.show_image(filename, is_hotdog)
    sys.exit(app.exec_())
예제 #6
0
def main(top_block_cls=top_block, options=None):

    if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    #tb.show()

    while True:
        try:
            zmq_consumer()
        except Exception as e:
            print "Caught exception:"
            print e
        if not surviveException:
            raise

    def quitting():
        tb.stop()
        tb.wait()
    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #7
0
def main(top_block_cls=uhd_fft, options=None):
    if options is None:
        options, _ = argument_parser().parse_args()

    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls(antenna=options.antenna,
                       args=options.args,
                       fft_size=options.fft_size,
                       freq=options.freq,
                       gain=options.gain,
                       samp_rate=options.samp_rate,
                       spec=options.spec,
                       stream_args=options.stream_args,
                       update_rate=options.update_rate,
                       wire_format=options.wire_format)
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()

    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
def main(top_block_cls=video_sdl_test, options=None):
    if gr.enable_realtime_scheduling() != gr.RT_OK:
        print("Error: failed to enable real-time scheduling.")

    if StrictVersion("4.5.0") <= StrictVersion(
            Qt.qVersion()) < StrictVersion("5.0.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()

    tb.start()

    tb.show()

    def sig_handler(sig=None, frame=None):
        Qt.QApplication.quit()

    signal.signal(signal.SIGINT, sig_handler)
    signal.signal(signal.SIGTERM, sig_handler)

    timer = Qt.QTimer()
    timer.start(500)
    timer.timeout.connect(lambda: None)

    def quitting():
        tb.stop()
        tb.wait()

    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #9
0
파일: run.py 프로젝트: achicha/chat
    def main(self):
        connections = dict()
        users = dict()

        # Each client will create a new protocol instance
        self.ins = ChatServerProtocol(self.db_path, connections, users)

        # GUI
        app = Qt.QApplication(sys.argv)
        loop = QEventLoop(app)
        asyncio.set_event_loop(loop)  # NEW must set the event loop

        wnd = ServerMonitorWindow(server_instance=self.ins, parsed_args=self.args)
        wnd.show()

        with loop:
            coro = loop.create_server(lambda: self.ins, self.args["addr"], self.args["port"])
            server = loop.run_until_complete(coro)

            # Serve requests until Ctrl+C
            print('Serving on {}:{}'.format(*server.sockets[0].getsockname()))
            try:
                loop.run_forever()
            except KeyboardInterrupt:
                pass

            server.close()
            loop.run_until_complete(server.wait_closed())
            loop.close()
예제 #10
0
def gui_main(host, names_of_desired_widgets):
    params = []
    Qt.QApplication.setAttribute(Qt.Qt.AA_ShareOpenGLContexts)
    app = Qt.QApplication(params)

    scope, scope_properties = scope_client.client_main(host)
    main_window = scope_widgets.WidgetWindow(
        host=host,
        scope=scope,
        scope_properties=scope_properties,
        names_of_desired_widgets=names_of_desired_widgets)
    main_window.show()

    # install a custom signal handler so that when python receives control-c, QT quits
    signal.signal(signal.SIGINT, sigint_handler)
    # now arrange for the QT event loop to allow the python interpreter to
    # run occasionally. Otherwise it never runs, and hence the signal handler
    # would never get called.
    timer = Qt.QTimer()
    timer.start(100)
    # add a no-op callback for timeout. What's important is that the python interpreter
    # gets a chance to run so it can see the signal and call the handler.
    timer.timeout.connect(lambda: None)

    app.exec()
예제 #11
0
def main() -> None:
    from argparse import ArgumentParser

    logging.basicConfig(format='{asctime}: {levelname}: {message}',
                        style='{', level=MainWindow.LOG_LEVEL)
    logging.Formatter.default_msec_format = '%s.%03d'

    check_versions()

    parser = ArgumentParser()
    parser.add_argument('script_path', help='Path to Vapoursynth script',
                        type=Path, nargs='?')
    parser.add_argument('-a', '--external-args', type=str,
                        help='Arguments that will be passed to scripts')
    args = parser.parse_args()

    if args.script_path is None:
        print('Script path required.')
        sys.exit(1)

    script_path = args.script_path.resolve()
    if not script_path.exists():
        print('Script path is invalid.')
        sys.exit(1)

    os.chdir(script_path.parent)
    app = Qt.QApplication(sys.argv)
    main_window = MainWindow()
    main_window.load_script(script_path, external_args=args.external_args)
    main_window.show()

    try:
        app.exec_()
    except Exception:  # pylint: disable=broad-except
        logging.error('app.exec_() exception')
예제 #12
0
def main():
    # Admire!
    app = Qt.QApplication(sys.argv)
    gui = NeutronAnalysisGui()
    gui.setWindowTitle("Shared Listmode Analyser for Neutrons and Gammas")
    gui.show()
    sys.exit(app.exec_())
예제 #13
0
    def spawn_notification(self, data):
        eventTitle = data['eventTitle']
        eventDescription = data['eventDescription']

        app = Qt.QApplication(sys.argv)
        systemtray_icon = Qt.QSystemTrayIcon(Qt.QIcon("df"))
        systemtray_icon.show()
        systemtray_icon.showMessage(eventTitle, eventDescription)
예제 #14
0
def main(top_block_cls_1=Basestation_3,top_block_cls_2=Basestation_1,options=None):
    open('/home/capstone2021/Desktop/Capstone/fire_scout_system/ground_station/drone_ops.json','a').close()
    open('/home/capstone2021/Desktop/Gun software/file_receive/Text/Text_recie.txt','a').close()
    open('/home/capstone2021/Desktop/Gun software/file_receive/Jpg/Jpg_receive.jpg','a').close()
    qapp = Qt.QApplication(sys.argv)
    tb1 = top_block_cls_1()
    tb1.start()
    Jpg_count_number = 1
    Txt_count_number = 1
    filesize = 0
    filesize_1 = 0
    filesize_2 = 0
    while 1:
     	Deter_mode = os.path.getsize('/home/capstone2021/Desktop/Gun software/Mod_com.txt')
     	filesize = os.path.getsize('/home/capstone2021/Desktop/Capstone/fire_scout_system/ground_station/drone_ops.json')
	if filesize != 0:
		tb2 = top_block_cls_2()
	     	tb2.start()
            	time.sleep(2)
     	    	tb2.stop()

	    	os.remove('/home/capstone2021/Desktop/Capstone/fire_scout_system/ground_station/drone_ops.json')
	     	open('/home/capstone2021/Desktop/Capstone/fire_scout_system/ground_station/drone_ops.json','a').close()
		print('commond sent')
	filesize_1 = os.path.getsize('/home/capstone2021/Desktop/Gun software/file_receive/Text/Text_recie.txt')
	if filesize_1 != 0:
		if Deter_mode == 0:
			if Txt_count_number > 1 :
				os.remove('/home/capstone2021/Desktop/Gun software/Watch_dog.txt')
			open('/home/capstone2021/Desktop/Gun software/Watch_dog.txt','a').close()
			textFile = '/home/capstone2021/Desktop/Gun software/file_receive/Text/TxT_Receiver_%d.txt' % Txt_count_number
			shutil.move('/home/capstone2021/Desktop/Gun software/file_receive/Text/Text_recie.txt', textFile)
			time.sleep(1)
			with open('/home/capstone2021/Desktop/Gun software/file_receive/Text/TxT_Receiver_%d.txt' % Txt_count_number) as firstfile, open('/home/capstone2021/Desktop/Gun software/Watch_dog.txt','w') as secondfile:
				for line in firstfile:
					secondfile.write(line)
				secondfile.close()
			Txt_count_number += 1
			open('/home/capstone2021/Desktop/Gun software/file_receive/Text/Text_recie.txt','a').close()
			print ('get txt')
			tb1.stop()
			tb1 = top_block_cls_1()
			tb1.start()
		else :
			textFile = '/home/capstone2021/Desktop/Capstone/fire_scout_system/ground_station/received_data/new_image_%d.jpg' % Jpg_count_number
			
			Jpg_count_number += 1
			open('/home/capstone2021/Desktop/Gun software/file_receive/Text/Text_recie.txt','a').close()
			print ('get jpg')
			time.sleep(10)
			tb1.stop()
			shutil.move('/home/capstone2021/Desktop/Gun software/file_receive/Text/Text_recie.txt', textFile)
			
			tb1 = top_block_cls_1()
			tb1.start()
    tb1.stop()
예제 #15
0
def showMesh3DVista(mesh, data=None, **kwargs):
    """
    Make use of the actual 3D visualization tool kit

    Parameters
    ----------
    data: pg.Vector or np.ndarray
        Dictionary of cell values, sorted by key. The values need to be
        numpy arrays.

    Returns
    -------
    plotter: pyvista.Plotter
        The plotter from pyvista.
    gui: Show3D [None]
        The small gui based on pyvista. Note that this is returned as 'None'
        if gui is passed as 'False'.

    Note
    ----
    Not having PyQt5 installed results in displaying the first key
    (and values) from the dictionary.
    """
    hold = kwargs.pop('hold', False)
    cmap = kwargs.pop('cmap', 'viridis')
    notebook = kwargs.pop('notebook', _inlineBackend_)
    gui = kwargs.pop('gui', False)

    # add given data from argument
    if gui:
        app = Qt.QApplication(sys.argv)
        s3d = Show3D(app)
        s3d.addMesh(mesh, data, cmap=cmap, **kwargs)
        if not hold:
            s3d.wait()
        return s3d.plotter, s3d  # plotter, gui

    else:
        if notebook:
            pyvista.set_plot_theme('document')

        try:
            plotter = drawModel(None,
                                mesh,
                                data,
                                notebook=notebook,
                                cmap=cmap,
                                **kwargs)
        except Exception as e:
            print(e)
            pg.error("fix pyvista bindings")

        if not hold:
            plotter.show()
        return plotter, None
예제 #16
0
파일: main.py 프로젝트: MLaurentys/mac420
def main():

    parser = argparse.ArgumentParser()
    parser.add_argument("--glversion", help="use specific OpenGL version")
    parser.add_argument("--glsamples",
                        help="use specific number of samples for rendering")

    args = parser.parse_args()

    ## determine what OpenGL version to ask for
    if args.glversion:
        gl_major_version = int(args.glversion.split(".")[0])
        gl_minor_version = int(args.glversion.split(".")[1])
    else:
        gl_major_version = 4
        gl_minor_version = 0

    ## determine number of samples for multisampling
    if args.glsamples:
        gl_samples = int(args.glsamples)
    else:
        gl_samples = 8

    ## use desktop OpenGL and share contexts
    QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseDesktopOpenGL)
    QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_ShareOpenGLContexts)

    ## set up OpenGL version and profile requested
    glformat = Qt.QSurfaceFormat()
    glformat.setDepthBufferSize(24)
    glformat.setRedBufferSize(8)
    glformat.setGreenBufferSize(8)
    glformat.setBlueBufferSize(8)
    if "Darwin" not in platform.platform():
        glformat.setAlphaBufferSize(8)
    # glformat.setSamples(gl_samples)
    glformat.setStencilBufferSize(8)
    glformat.setSwapInterval(0)
    glformat.setVersion(gl_major_version, gl_minor_version)
    glformat.setProfile(Qt.QSurfaceFormat.CoreProfile)

    ## set default format
    Qt.QSurfaceFormat.setDefaultFormat(glformat)

    ## create Qt app
    app = Qt.QApplication(sys.argv)

    ## create main window and show
    mainWindow = MainWindow()
    mainWindow.show()

    ## run...
    sys.exit(app.exec_())

    print("End of story.")
예제 #17
0
 def __init__(self):
     from login import LoginWindow
     self.init_fields()
     self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     host = '127.0.0.1'  # socket.gethostname()
     port = 9999
     self.socket.connect((host, port))
     app = Qt.QApplication(sys.argv)
     window = LoginWindow(self)
     window.show()
     sys.exit(app.exec_())
예제 #18
0
def go(name):
    from PyQt5 import Qt
    app = Qt.QApplication([])

    mw = Qt.QLabel()
    mw.setAlignment(Qt.Qt.AlignCenter)
    mw.setMinimumSize(150, 50)
    mw.setText('Hello, ' + name)
    mw.show()

    app.exec()
예제 #19
0
def reg_printer(result_txt):
    app = Qt.QApplication([])
    te =QTextEdit()
    te.setHtml(result_txt.get(1.0,END).replace(';','<br>'))
    text = te.toPlainText()
    if(text==''):
      messagebox.showerror('Ошибка', 'Не выбран реестр')
      return 3
    printer = Qt.QPrinter()
    print_dialog = Qt.QPrintDialog(printer)
    if print_dialog.exec() == Qt.QDialog.Accepted:
        te.print(printer)
예제 #20
0
def main():
    app = Qt.QApplication(sys.argv)
    win = appwindow.AppWindow()

    wrap = DaemonWrapper()
    wrap.set_data_for_dispatcher(window=win)
    wrap.start()
    wrappers.Wrappers().set_daemon(wrap)

    log.info(__name__, 'started x')

    sys.exit(app.exec_())
예제 #21
0
def alert_high_diff():
    # df = ts.get_realtime_quotes('600196')
    df = ts.get_realtime_quotes(['600196', '600519', '300482'])
    print((df[['code', 'name', 'price', 'b1_v', 'b1_p', 'a1_v', 'a1_p']]))
    for index, row in df.iterrows():
        # 差价超过0.1%就预警
        if ((float(row['a1_p'])-float(row['b1_p']))/float(row['price'])) >= 0.001:
            print((row["name"], row["b1_p"]))
            app = Qt.QApplication(sys.argv)
            systemtray_icon = Qt.QSystemTrayIcon(Qt.QIcon('/path/to/image'))
            systemtray_icon.show()
            systemtray_icon.showMessage('Title', row["name"])
예제 #22
0
def main(top_block_cls=NsfWatch100, options=None):

    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #23
0
def useQt():
    """
    Let the Qt event loop spin the asyncio event loop.
    """
    import PyQt5.Qt as qt
    import quamash

    if isinstance(asyncio.get_event_loop(), quamash.QEventLoop):
        return
    if not qt.QApplication.instance():
        _qApp = qt.QApplication(sys.argv)
    loop = quamash.QEventLoop()
    asyncio.set_event_loop(loop)
def main(top_block_cls=test_corr_and_sync_tx, options=None):

    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #25
0
def AltNotification(heading, message, minutes):
	from PyQt5 import Qt
	import sys
	try:
		seconds = args.minutes*60
	except TypeError:
		seconds = default*60
				
	app = Qt.QApplication(sys.argv)
	systemtray_icon = Qt.QSystemTrayIcon(app)
	systemtray_icon.show()
	time.sleep(seconds)
	systemtray_icon.showMessage(heading, message)
예제 #26
0
def main(top_block_cls=top_block, options=None):

    if StrictVersion("4.5.0") <= StrictVersion(
            Qt.qVersion()) < StrictVersion("5.0.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    def server():
        # Here we define the UDP IP address as well as the port number that we have
        # already defined in the client python script.
        UDP_IP_ADDRESS = "127.0.0.1"
        UDP_PORT_NO = 52002

        serverSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        # One difference is that we will have to bind our declared IP address
        # and port number to our newly declared serverSock
        serverSock.bind((UDP_IP_ADDRESS, UDP_PORT_NO))
        return serverSock

    def fetch_new_messages():
        while True:
            response = serverSock.recvfrom(1024)
            if response:
                new_messages.append(response[0].decode())
            sleep(.2)

    def display_new_messages():
        while new_messages:
            text_area.appendPlainText(new_messages.pop(0))

    serverSock = server()
    new_messages = []
    thread = threading.Thread(target=fetch_new_messages,
                              name='Collecting messages')
    thread.setDaemon(True)
    thread.start()
    timer = QTimer()
    timer.timeout.connect(display_new_messages)
    timer.start(1000)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()

    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #27
0
def useQt():
    """
    Integrate asyncio and Qt loops:
    Let the Qt event loop spin the asyncio event loop
    (does not work with nested event loops in Windows)
    """
    import PyQt5.Qt as qt
    import quamash
    if isinstance(asyncio.get_event_loop(), quamash.QEventLoop):
        return
    if not qt.QApplication.instance():
        _ = qt.QApplication(sys.argv)
    loop = quamash.QEventLoop()
    asyncio.set_event_loop(loop)
예제 #28
0
def main(top_block_cls=ofdm_tx_virtualsource_qt, options=None):

    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()

    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()
예제 #29
0
def start_ui(signal_handlers):
    control_app = Qt.QApplication(sys.argv)
    control_app.setWindowIcon(QtGui.QIcon('resources/images/1000px-MBTA.png'))

    # Load main application window
    ui_application = MainAppWindow()

    # Handle termination signals
    signal.signal(signal.SIGINT, signal_handlers)
    signal.signal(signal.SIGTERM, signal_handlers)

    # Show main application window
    ui_application.show()
    return control_app, ui_application
예제 #30
0
def main(top_block_cls=constellation_soft_decoder, options=None):

    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()

    qapp.aboutToQuit.connect(quitting)
    qapp.exec_()