Exemple #1
0
    def __init__(self):
        super(MainApp, self).__init__()

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.home = os.path.expanduser('~/')
        self.FFMPEG = '/usr/local/bin/ffmpeg'
        self.FFPROBE = '/usr/local/bin/ffprobe'
        self.VIDEO_BR = '100k'
        self.AUDIO_BR = '48k'
        self.crf_lcd = ''
        self.ffmpeg_frame_size = [
            '160x120',
            '240x180',
            '320x240',
            '480x360',
            '640x360',
            '640x480',
            '720x480',
            '720x540',
            '768x576',
            '1280x720',
            '1980x1080'
        ]
        for size in self.ffmpeg_frame_size:
            self.ui.screen_size_opts.addItem(size)

        self.ui.ffmpeg_opts_edit.setText('-preset fast')
        self.ui.ffmpeg_loc_edit.setText(self.FFMPEG)
        self.ui.ffprobe_loc_edit.setText(self.FFPROBE)
        self.ui.abr_edit.setText(self.AUDIO_BR)
        self.ui.vbr_edit.setText(self.VIDEO_BR)
        # Connections
        self.ui.open_file_btn.clicked.connect(self.open_file)
        self.ui.scan_file_btn.clicked.connect(self.scan_file)
        self.ui.set_output_dir_btn.clicked.connect(self.set_proxy_dir)
        self.ui.build_btn.clicked.connect(self.create_proxy)

        self.ui.actionNew.triggered.connect(self.open_file)
        self.ui.actionScan.triggered.connect(self.scan_file)
        self.ui.actionSet_Proxy_Folder.triggered.connect(self.set_proxy_dir)
        self.ui.actionBuild.triggered.connect(self.create_proxy)
        self.ui.actionQuit.triggered.connect(self.close)

        self.scan_file_process = QtCore.QProcess(self)
        self.scan_file_process.readyReadStandardError.connect(self.scan_error)
        self.process_proxy = QtCore.QProcess(self)
        self.process_proxy.readyReadStandardError.connect(self.read_std_error)
        self.process_proxy.readyReadStandardOutput.connect(self.curr_status)
        self.process_proxy.finished.connect(self.process_completed)
Exemple #2
0
    def __init__(self, script_name):
        super(StreamHandler, self).__init__()

        self.script_name = script_name

        self.script_dir = os.path.join(config.analysisDirStreaming,
                                       self.script_name)
        self.exec_path = os.path.join(self.script_dir, 'main')

        self.oFile = open(os.path.join(self.script_dir, 'oFile'), 'w')
        self.eFile = open(os.path.join(self.script_dir, 'eFile'), 'w')

        self.streamProcess = QtCore.QProcess(self)
        self.streamProcess.setReadChannel(self.streamProcess.StandardError)
        self.readMoreTimer = QtCore.QTimer()
        self.readMoreTimer.setSingleShot(True)
        self.readMoreTimer.timeout.connect(self.routeStdErr)
        self.streamProcess.readyReadStandardError.connect(
            self.armReadMoreTimer)
        self.streamProcess.readyReadStandardOutput.connect(self.routeStdOut)
        self.streamProcess.finished.connect(self.streamFinishedHandler)

        # For parsing self.streamProcess's requests for hwif calls. Maps
        # from strings representing functions to the functions themselves,
        # and functions for converting other arguments from strings back into
        # real Python types (if applicable)
        self.hwif_calls = {
            'setSubsamples_byChip': [hwif.setSubsamples_byChip, int],
            'startStreaming_subsamples': [hwif.startStreaming_subsamples],
            'startStreaming_boardsamples': [hwif.startStreaming_boardsamples],
            'stopStreaming': [hwif.stopStreaming]
        }
Exemple #3
0
 def __init__(self):
     #Layout
     QtGui.QWidget.__init__(self)
     self.textBrowser = QtGui.QTextBrowser(self)
     self.lineEdit = QtGui.QLineEdit(self)
     self.startButton = QtGui.QPushButton("Start", self)
     self.stopButton = QtGui.QPushButton("Stop", self)
     self.stopButton.setEnabled(False)
     layout = QtGui.QGridLayout(self)
     layout.setSpacing(8)
     layout.addWidget(self.textBrowser, 0, 0)
     layout.addWidget(self.lineEdit, 1, 0)
     layout.addWidget(self.startButton, 1, 1)
     layout.addWidget(self.stopButton, 1, 2)
     #Connection
     self.connect(self.lineEdit, QtCore.SIGNAL("returnPressed()"),
                  self.startCommand)
     self.connect(self.startButton, QtCore.SIGNAL("clicked()"),
                  self.startCommand)
     self.connect(self.stopButton, QtCore.SIGNAL("clicked()"),
                  self.stopCommand)
     #Process
     self.process = QtCore.QProcess()
     self.connect(self.process, QtCore.SIGNAL("readyReadStdout()"),
                  self.readOutput)
     self.connect(self.process, QtCore.SIGNAL("readyReadStderr()"),
                  self.readErrors)
     self.connect(self.process, QtCore.SIGNAL("processExited()"),
                  self.resetButtons)
Exemple #4
0
    def __init__(self, command, projPath):
        """
        - Creates constructor for NgspiceWidget class.
        - Checks whether OS is linux or windows
        and creates NgSpice window accordingly.
        """
        QtGui.QWidget.__init__(self)
        self.obj_appconfig = Appconfig()
        self.process = QtCore.QProcess(self)
        self.terminal = QtGui.QWidget(self)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.terminal)

        print("Argument to ngspice command : ", command)
        # For Linux OS
        if platform.system() == 'Linux':
            self.command = "cd " + projPath + ";ngspice " + command
            # Creating argument for process
            self.args = ['-hold', '-e', self.command]
            self.process.start('xterm', self.args)
            self.obj_appconfig.process_obj.append(self.process)
            print(self.obj_appconfig.proc_dict)
            (self.obj_appconfig.proc_dict[
                self.obj_appconfig.current_project['ProjectName']].append(
                    self.process.pid()))

        # For Windows OS
        elif platform.system() == 'Windows':
            tempdir = os.getcwd()
            projPath = self.obj_appconfig.current_project["ProjectName"]
            os.chdir(projPath)
            self.command = "ngspice " + command
            self.process.start(self.command)
            os.chdir(tempdir)
    def __init__(self):
        super(MenuManager, self).__init__()

        self.contentsDoc = None
        self.assistantProcess = QtCore.QProcess()
        self.helpRootUrl = ''
        self.docDir = QtCore.QDir()
        self.imgDir = QtCore.QDir()

        self.info = {}
        self.window = None
        self.qmlRoot = None
        self.declarativeEngine = None

        self.ticker = None
        self.tickerInAnim = None
        self.upButton = None
        self.downButton = None
        self.helpEngine = None
        self.score = Score()
        self.currentMenu = "[no menu visible]"
        self.currentCategory = "[no category visible]"
        self.currentMenuButtons = "[no menu buttons visible]"
        self.currentInfo = "[no info visible]"
        self.currentMenuCode = -1
        self.readXmlDocument()
        self.initHelpEngine()
Exemple #6
0
    def initProcess(self):
        self.process = QtCore.QProcess(self)

        self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
        self.process.readyRead.connect(self.dataReady)
        self.process.started.connect(self.disableButtons)
        self.process.finished.connect(self.enableButtons)
Exemple #7
0
 def __init__(self, parent=None):
     super(PerformCmdThread, self).__init__(parent)
     # self.mis_dict = mis_dict #当前线程序号
     # self.cmdStr = parent.cmd
     self.keepRunning = True  #当前线程是否进行
     self.p = parent
     self.proc = QtCore.QProcess()
    def __init__(self, controller):

        # build (compilation) output buffer
        self.buffer = ""

        # controller
        self.controller = controller

        # initialize text environment
        #QtGui.QPlainTextEdit.__init__(self, parent)

        # set environment defaults initially
        #self.setUndoRedoEnabled(False)
        #self.setReadOnly(True)

        # defaults for text environment
        #textFont = "monospace"
        #textSize = 9
        #self.document().setDefaultFont(QtGui.QFont(textFont, textSize, QtGui.QFont.Normal))

        # set compiler
        self.compiler = ClangCompiler()

        # initial text environment contents
        #self.contents = ""
        self.process = QtCore.QProcess()

        # custom handles for process signals
        self.process.started.connect(self.on_started)
        self.process.readyReadStandardError.connect(self.on_stderr)
        self.process.error.connect(self.on_error)
        self.process.finished.connect(self.on_finished)
Exemple #9
0
    def runMakeInstall(self):
        print("run Make Install Called")
        try:
            if os.name == 'nt':
                self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME')
                cmd = self.msys_bin+"\\make.exe install"
            else:
                cmd = " make install"
            print("Running Make Install")
            path = os.getcwd()  # noqa
            try:
                self.process.close()
            except BaseException:
                pass

            self.process = QtCore.QProcess(self)
            self.process.start(cmd)
            self.process.finished.connect(self.createSchematicLib)
            QtCore.QObject.connect(
                self.process, QtCore.SIGNAL("readyReadStandardOutput()"),
                self, QtCore.SLOT("readAllStandard()")
            )
            os.chdir(self.cur_dir)

        except BaseException:
            print("There is error in 'make install' ")
            sys.exit()
Exemple #10
0
 def __init__(self, dialog, parent=None):
     Ui_MainWindow.__init__(self)
     self.ser = serial.Serial()
     self.setupUi(dialog)
     self.UART_getports()
     #		self.actionExit.mousePressEvent.connect(exit())
     self.pushButton_UartRefresh.clicked.connect(self.UART_getports)
     self.pushButton_UartConnect.clicked.connect(self.UART_connect)
     self.lineEdit_UartInput.returnPressed.connect(self.UART_send)
     self.pushButton_SpiRun.clicked.connect(self.SPI_run)
     self.SPI_process = QtCore.QProcess()
     self.SPI_process.readyRead.connect(self.SPI_dataReady)
     self.ft232h = 0
     self.gpio_init = 0
     try:
         self.FTDI_setup()
         self.GPIO_setup()
     except:
         print("[*] FTDI Board not detected ")
     self.checkBox_d0.clicked.connect(lambda: self.GPIO_handler(0))
     self.checkBox_d1.clicked.connect(lambda: self.GPIO_handler(1))
     self.checkBox_d2.clicked.connect(lambda: self.GPIO_handler(2))
     self.checkBox_d3.clicked.connect(lambda: self.GPIO_handler(3))
     self.checkBox_d4.clicked.connect(lambda: self.GPIO_handler(4))
     self.checkBox_d5.clicked.connect(lambda: self.GPIO_handler(5))
     self.checkBox_d6.clicked.connect(lambda: self.GPIO_handler(6))
     self.checkBox_d7.clicked.connect(lambda: self.GPIO_handler(7))
     self.InputMonitor = None
     self.pushButton_GpioStartInputMonitor.clicked.connect(
         self.GPIO_startmonitor)
     self.pushButton_I2cRun.clicked.connect(self.I2C_run)
     self.pushButton_JtagStartServer.clicked.connect(self.JTAG_startserver)
     self.JTAG_getcfg()
     self.pushButton_JtagConnect.clicked.connect(self.JTAG_telnetconnect)
     self.pushButton_JtagRunGdb.clicked.connect(self.JTAG_rungdb)
Exemple #11
0
    def initUI(self):
        self.uploadbtn = QtGui.QPushButton('Upload')
        self.uploadbtn.clicked.connect(self.uploadModle)
        self.exitbtn = QtGui.QPushButton('Exit')
        self.exitbtn.clicked.connect(self.closeWindow)
        self.browsebtn = QtGui.QPushButton('Browse')
        self.browsebtn.clicked.connect(self.browseFile)
        self.addbtn = QtGui.QPushButton('Add Files')
        self.addbtn.clicked.connect(self.addFiles)
        self.removebtn = QtGui.QPushButton('Remove Files')
        self.removebtn.clicked.connect(self.removeFiles)
        self.ledit = QtGui.QLineEdit(self)
        self.sedit = QtGui.QTextEdit(self)
        self.process = QtCore.QProcess(self)
        self.terminal = QtGui.QWidget(self)

        self.process.start('xterm', ['-into', str(self.terminal.winId())])

        #Creating gridlayout
        grid = QtGui.QGridLayout()
        grid.setSpacing(5)
        grid.addWidget(self.ledit, 1, 0)
        grid.addWidget(self.browsebtn, 1, 1)
        grid.addWidget(self.sedit, 2, 0, 4, 1)
        grid.addWidget(self.addbtn, 2, 1)
        grid.addWidget(self.removebtn, 3, 1)
        grid.addWidget(self.terminal, 6, 0, 10, 1)
        grid.addWidget(self.uploadbtn, 17, 0)
        grid.addWidget(self.exitbtn, 17, 1)

        self.setLayout(grid)
        self.setGeometry(300, 300, 600, 600)
        self.setWindowTitle("Ngspice Digital Model Creator")
        #self.setWindowIcon(QtGui.QIcon('logo.png'))
        self.show()
Exemple #12
0
class FilenameGetter(QtCore.QObject):
    p = QtCore.QProcess()
    gotFilename = QtCore.pyqtSignal(QtCore.QString)

    def __init__(self, exe, dest):
        QtCore.QObject.__init__(self)
        self.exe = exe
        self.dest = dest
        self.p.finished.connect(self.processFinished)
        self.p.setReadChannel(QtCore.QProcess.StandardOutput)

    def getFilename(self, url):
        self.p.kill()
        self.p.start(self.exe, ['-g', url])

    def processFinished(self):
        url = str(self.p.readAll()).strip()
        if url:
            url = QtCore.QString(self.dest + QtCore.QDir.separator() +
                                 basename(url) + '.flv')
            self.gotFilename.emit(url)

    def abort(self):
        self.p.kill()
        self.p.readAll()
    def __init__(self, parent, blender_file_name):
        super(Embed_Blender, self).__init__(parent)

        # Python module 'subprocess' would be fine too; this stays closer to C++ Qt.
        self.process = QtCore.QProcess(self)
        self.process.start('blenderplayer',
                           ['-i', str(self.winId()), blender_file_name])
Exemple #14
0
    def startProcess(self):
        self.ui.b_run.setEnabled(0)
        self.ui.b_stop.setEnabled(1)
        self.dispError = 1
        
        self.ui.l_title.setText('<b>&nbsp;'+os.path.split(self.filename)[1]+'&nbsp;&nbsp;&nbsp;&nbsp;</b><font color=#ccc><b>Started:</b> '+datetime.datetime.now().strftime('%I:%M:%S.%f'))
        self.ui.l_title.setStyleSheet('background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:0, stop:0 rgba(48, 85, 100, 255), stop:0.21267 rgba(61, 107, 127, 255), stop:0.831818 rgba(72, 127, 150, 255), stop:1 rgba(104, 166, 175, 255));color:white;border:1px solid rgba(130,130,130,200);padding:3px;')
        self.ui.tb_out.setStyleSheet('background-color:rgb(30,30,30);border-bottom-left-radius:5px;border-bottom-right-radius:5px;')
        self.ui.tb_out.setText('')
        self.listItem.setForeground(QtGui.QBrush(QtGui.QColor(48, 85, 100)))
        fnt = self.listItem.font()
        fnt.setItalic(1)
        self.listItem.setFont(fnt)
        
        self.process = QtCore.QProcess()
        self.process.waitForStarted(100)
        self.process.setReadChannel(QtCore.QProcess.StandardOutput)
        self.process.setWorkingDirectory(os.path.dirname(self.filename))
        
        self.process.readyReadStandardOutput.connect(self.readOutput)
        self.process.readyReadStandardError.connect(self.readErrors)
        self.process.finished.connect(self.finished)
        self.process.error.connect(self.processError)
        
##        args = str(self.ui.le_args.text())
##        cmd = str(self.ui.le_cmd.text())
##        if args != '': args = ' '+args
        
##        self.process.start(cmd,QtCore.QStringList(args.split()+[self.filename]))
##        print cmd+' "'+self.filename+'"'+args
##        self.actual_command = cmd+' '+self.filename+args
        self.actual_command = str(self.ui.le_cmd.text())
        self.process.start(self.ui.le_cmd.text())
        self.status = 'running'
Exemple #15
0
    def __init__(self, command, projPath):
        QtGui.QWidget.__init__(self)
        self.obj_appconfig = Appconfig()
        self.process = QtCore.QProcess(self)
        self.terminal = QtGui.QWidget(self)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.terminal)

        print "Argument to ngspice command : ", command

        print "\nngspice simulation starts : \n"

        if platform.system() == 'Linux':
            self.command = "cd " + projPath + " && ngspice " + command
            console_output = os.popen(self.command).read()
            self.obj_appconfig.print_info("NgSpice output: " + console_output)
            self.obj_appconfig.proc_dict[
                self.obj_appconfig.current_project['ProjectName']].append(
                    self.process.pid())

        elif platform.system() == 'Windows':
            tempdir = os.getcwd()
            projPath = self.obj_appconfig.current_project["ProjectName"]
            os.chdir(projPath)
            self.command = "ngspice " + command
            self.process.start(self.command)
            os.chdir(tempdir)

        print "\n simulation finished"
Exemple #16
0
    def show_help(self, help_topic=None):
        # open qt assistant for help
        if HelpHandler.help_process:
            if HelpHandler.help_process.state(
            ) == HelpHandler.help_process.NotRunning:
                HelpHandler.help_process.close()
                HelpHandler.help_process = None
        if not HelpHandler.help_process:
            HelpHandler.help_process = QtCore.QProcess()
            HelpHandler.help_process.start(
                HelpHandler.help_assistant_executable,
                HelpHandler.help_assistant_arguments)

        # If there is a help_topic specified as an argument, use it.
        # Otherwise if self.listen_here_for_help_key.help_topic is specified, use that topic.
        if not help_topic and hasattr(self.listen_here_for_help_key,
                                      "help_topic"):
            help_topic = self.listen_here_for_help_key.help_topic

        # If we found a topic, open it, otherwise help is already open from above, just leave it open.
        if help_topic:
            # Trim leading slashes and backslashes
            while help_topic.startswith('/') or help_topic.startswith('\\'):
                help_topic = help_topic[1:]

            # set to the right page
            help_command = QtCore.QByteArray()
            help_command.append("setSource qthelp://" + help_topic + '\n')
            HelpHandler.help_process.write(help_command)
Exemple #17
0
 def test_executable(cls, filename):
     cmd = cls.get_cmd(filename)
     process = QtCore.QProcess()
     process.start(cmd, ['--version'])
     success = process.waitForFinished()
     return success and process.exitCode(
     ) == QtCore.QProcess.NormalExit, cmd
Exemple #18
0
    def __init__(self,
                 exe='',
                 args=[],
                 onDataComes=None,
                 onErrorComes=None,
                 onCompletion=None):

        self.prc = QtCore.QProcess()
        self._exe = exe
        self._args = self._argStringList(args)
        self._onDataCames = onDataComes
        self._onErrorComes = onErrorComes
        self._onCompletion = onCompletion

        QtCore.QObject.connect(self.prc, QtCore.SIGNAL("started ()"),
                               self.sigStarted)
        QtCore.QObject.connect(
            self.prc, QtCore.SIGNAL("stateChanged (QProcess::ProcessState)"),
            self.sigStateChanged)
        #QtCore.QObject.connect(self.prc,QtCore.SIGNAL("readyReadStandardOutput ()"),self.sigReadStdOutput)
        QtCore.QObject.connect(self.prc,
                               QtCore.SIGNAL("readyReadStandardError ()"),
                               self.sigReadStdError)
        QtCore.QObject.connect(self.prc, QtCore.SIGNAL("readyRead ()"),
                               self.sigReadStdOutput)
        #QtCore.QObject.connect(self.prc,QtCore.SIGNAL("finished (int)"),self.sigFinished)
        QtCore.QObject.connect(
            self.prc, QtCore.SIGNAL("finished (int,QProcess::ExitStatus)"),
            self.sigFinished)
        QtCore.QObject.connect(self.prc,
                               QtCore.SIGNAL("error (QProcess::ProcessError)"),
                               self.sigError)
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Connect the Buttons
        QtCore.QObject.connect(self.ui.selectFileButton,
                               QtCore.SIGNAL("clicked()"), self.selectFile)
        QtCore.QObject.connect(self.ui.convertButton,
                               QtCore.SIGNAL("clicked()"), self.convert)

        # Connect the Radio Buttons
        QtCore.QObject.connect(self.ui.androidHDRadioButton,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.androidHDSelected)
        QtCore.QObject.connect(self.ui.androidQHDRadioButton,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.androidqHDSelected)
        QtCore.QObject.connect(self.ui.appleHDRadioButton,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.appleHDSelected)
        QtCore.QObject.connect(self.ui.appleFullHDRadioButton,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.appleFullHDSelected)

        # Draw Images
        self.drawImages()

        #Setup Process
        self.process = QtCore.QProcess(self)
        QtCore.QObject.connect(self.process, QtCore.SIGNAL("finished(int)"),
                               self.processCompleted)
        QtCore.QObject.connect(self.process,
                               QtCore.SIGNAL("readyReadStandardError()"),
                               self.readStdError)
Exemple #20
0
    def lanzaMotor(self, siMultiPV=False):
        self.motor = QtCore.QProcess()

        self.buffer = ""

        self.liOrdenes = []

        self.esperaOK = None

        self.lock = False

        configMotor = self.cpu.configMotor
        exe = configMotor.ejecutable()
        args = configMotor.argumentos()

        self.motor.setWorkingDirectory(os.path.abspath(os.path.dirname(exe)))
        self.motor.start(exe, args, mode=QtCore.QIODevice.Unbuffered | QtCore.QIODevice.ReadWrite)
        self.motor.waitForStarted()
        self.connect(self.motor, QtCore.SIGNAL("readyReadStandardOutput()"), self.readOutput)

        if siMultiPV:
            configMotor.liUCI.append(("MultiPV", str(configMotor.maxMultiPV)))

        self.orden_ok("uci", "uciok")

        for opcion, valor in configMotor.liUCI:
            if valor is None:
                orden = "setoption name %s" % opcion
            else:
                if opcion.upper() == "MULTIPV" and not siMultiPV:
                    continue
                orden = "setoption name %s value %s" % (opcion, valor)
            self.ready_ok(orden)

        self.runOrdenes()
    def sys_ini(self):
        wid = QtCore.QString.number(self.console.winId())
        self.process = QtCore.QProcess(self)
        args = [
            "-into",
            wid,
            "-bc",
            "-e",
            "\"./mendel.elf\"",
        ]
        self.process.start("xterm", args)
        time.sleep(7)
        socketStatus = sock.connect_ex("/tmp/socket")
        if socketStatus == 0:
            self.frameStatusController.setStyleSheet(
                "QWidget { background-color: %s }" %
                QtGui.QColor(0, 255, 0).name())
        else:
            self.frameStatusController.setStyleSheet(
                "QWidget { background-color: %s }" %
                QtGui.QColor(255, 0, 0).name())

        if (serPort.isOpen() == False):
            self.frameStatusSerial.setStyleSheet(
                "QWidget { background-color: %s }" %
                QtGui.QColor(255, 0, 0).name())
        else:
            self.frameStatusSerial.setStyleSheet(
                "QWidget { background-color: %s }" %
                QtGui.QColor(0, 255, 0).name())
Exemple #22
0
    def launch_merge_tool(self):
        items = self.conflicts_list.selectedItems()
        enabled, error_msg = self.is_merge_tool_launchable()
        if not enabled:
            return
        config = GlobalConfig()
        cmdline = config.find_merge_tool(
            unicode(self.merge_tools_combo.currentText()))
        file_id = str(items[0].data(0, QtCore.Qt.UserRole).toString())
        if not file_id:
            # bug https://bugs.launchpad.net/qbzr/+bug/655451
            return
        file_name = self.wt.abspath(self.wt.id2path(file_id))
        process = QtCore.QProcess(self)

        def qprocess_invoker(executable, args, cleanup):
            def qprocess_error(error):
                self.show_merge_tool_error(error)
                cleanup(process.exitCode())

            def qprocess_finished(exit_code, exit_status):
                cleanup(exit_code)

            self.connect(process,
                         QtCore.SIGNAL("error(QProcess::ProcessError)"),
                         qprocess_error)
            self.connect(process,
                         QtCore.SIGNAL("finished(int,QProcess::ExitStatus)"),
                         qprocess_finished)
            process.start(executable, args)

        mergetools.invoke(cmdline, file_name, qprocess_invoker)
Exemple #23
0
    def __plot(self):
        connection = sqlite3.connect('material_db_01')
        query = "SELECT * FROM materialien WHERE ID=" + str(self.currentRow +
                                                            1)
        result = connection.execute(query)
        self.proc = QtCore.QProcess(self)
        self.proc.setProcessChannelMode(self.proc.MergedChannels)
        # self.proc.start("octave test_epsmuekap_GUI.m " + str(self.spinBox.value()))
        # self.proc.readyReadStandardOutput.connect(lambda: self.readStdOutput(self.proc))
        for data in enumerate(result):
            self.proc.start("octave plot_epsmuekap_GUI.m " + str(data[1][3]) +
                            ' ' + str(data[1][4]) + ' ' + str(data[1][5]) +
                            ' ' + str(data[1][6]) + ' ' + str(data[1][7]) +
                            ' ' + str(data[1][8]) + ' ' + str(data[1][9]) +
                            ' ' + str(data[1][10]) + ' ' + str(data[1][11]) +
                            ' ' + str(data[1][12]) + ' ' + str(data[1][13]) +
                            ' ' + str(data[1][14]) + ' ' + str(data[1][15]) +
                            ' ' + str(data[1][16]) + ' ' + str(data[1][17]) +
                            ' ' + str(data[1][18]) + ' ' + str(data[1][19]) +
                            ' ' + str(data[1][20]) + ' ' + str(data[1][21]) +
                            ' ' + str(data[1][22]) + ' ' +
                            str(self.spinBox.value()))
            self.proc.readyReadStandardOutput.connect(
                lambda: self.readStdOutput(self.proc))
            print(data[1][3])  #bis data[1][22]

        self.accept()
Exemple #24
0
    def run_arduino_make(self):
        self.emit(QtCore.SIGNAL("compile_log"), "start_compile",
                  "%s" % self.file_to_compile)

        process = QtCore.QProcess(self)
        self.set_process_env(process)

        ## construct the command "sh /app_path/etc/arduino_make.sh compile" and execute in project_dir dir
        command = QtCore.QString("sh ")
        script_full_path = settings.app_path().absoluteFilePath(
            "etc/arduino_make.sh compile")
        command.append(script_full_path)
        #print "command=", command
        self.emit(QtCore.SIGNAL("compile_log"), "command",
                  QtCore.QString(command))

        process.start(command)
        if process.waitForStarted():
            process.waitForFinished()
            result = process.readAllStandardOutput()
            #print type(result), result
            error = process.readAllStandardError()
            #print type(error), error
            if error:
                self.emit(QtCore.SIGNAL("compile_log"), "error",
                          QtCore.QString(error))
            else:
                self.emit(QtCore.SIGNAL("compile_log"), "result",
                          QtCore.QString(result))
Exemple #25
0
    def __init__(self, command, projPath):
        QtGui.QWidget.__init__(self)
        self.obj_appconfig = Appconfig()
        self.process = QtCore.QProcess(self)
        self.terminal = QtGui.QWidget(self)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.terminal)

        print "Argument to ngspice command : ", command

        if platform.system() == 'Linux':
            self.command = "cd " + projPath + ";ngspice " + command
            #Creating argument for process
            #self.args = ['-into', str(self.terminal.winId()),'-hold','-e', self.command]
            self.args = ['-hold', '-e', self.command]
            self.process.start('xterm', self.args)
            self.obj_appconfig.process_obj.append(self.process)
            self.obj_appconfig.proc_dict[
                self.obj_appconfig.current_project['ProjectName']].append(
                    self.process.pid())

        elif platform.system() == 'Windows':
            tempdir = os.getcwd()
            projPath = self.obj_appconfig.current_project["ProjectName"]
            os.chdir(projPath)
            self.command = "ngspice " + command
            self.process.start(self.command)
            os.chdir(tempdir)
Exemple #26
0
class XStream(QtCore.QObject):
    _stdout = None
    _stderr = None
    process = QtCore.QProcess()
    messageWritten = QtCore.pyqtSignal(str)
    #messageWritten = str(process.readAllStandardOutput())
    def flush( self ):
        pass
    def fileno( self ):
        return -1
    def write( self, msg ):
        if ( not self.signalsBlocked() ):
            self.messageWritten.emit(str(msg))
    @staticmethod
    def stdout():
        if ( not XStream._stdout ):
            XStream._stdout = XStream()
            sys.stdout = XStream._stdout
        return XStream._stdout
    @staticmethod
    def stderr():
        if ( not XStream._stderr ):
            XStream._stderr = XStream()
            sys.stderr = XStream._stderr
        return XStream._stderr
Exemple #27
0
    def __init__(self, title, cmd, optionsInList, index, parent=None):
        QWidget.__init__(self, parent=None)
        # QThread.__init__(self, parent=None)
        self.setWindowTitle(title)
        self.cmd = cmd
        self.optionsInList = optionsInList
        self.index = index

        self.strCmd = str(cmd) + ' '
        for eachOption in optionsInList:
            self.strCmd += eachOption + ' '

        # create objects
        self.label = QLabel(self.tr('Executing the command:\n' + self.strCmd))
        self.label.setFixedWidth(640)
        self.label.setWordWrap(True)
        self.te = QTextEdit()

        # layout
        layout = QVBoxLayout(self)
        layout.addWidget(self.label)
        layout.addWidget(self.te)
        self.setLayout(layout)

        self.process = QtCore.QProcess(self)
 def _newProcess(self):
   process = QtCore.QProcess()
   process.setWorkingDirectory(self._tmpdir)
   process.setProcessChannelMode(process.MergedChannels)
   process.setReadChannel(process.StandardOutput)
   process.error.connect(self.errorHandler)
   process.readyReadStandardOutput.connect(self.readStdOut)
   return process
Exemple #29
0
 def __init__(self, config, parent=None):
     super(XTerm, self).__init__(parent)
     self.config = config
     self.process = QtCore.QProcess(self)
     atexit.register(self.kill)
     self.show_term()
     if config.getboolean("Applications", "maximized"):
         self.showMaximized()
Exemple #30
0
	def non_blocking(self):
		self.setMessage("Starting non blocking sleep")

		process = QtCore.QProcess(parent=self.win)
		process.setProcessChannelMode(process.ForwardedChannels)
		process.finished.connect(self.finished)
		# process.start('sleep', ['5'])
		process.start(SLEEP_CMD[0], SLEEP_CMD[1:])