コード例 #1
0
ファイル: FrontEnd.py プロジェクト: IJOL/wotmods
class FrontEnd(object):
    onRead = EVNT()

    def __init__(self, service):
        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        startupinfo.wShowWindow = subprocess.SW_HIDE
        self.process = subprocess.Popen(service, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=False, startupinfo=startupinfo)
        self.stdin = self.process.stdin
        self.stdout = NBSR(self.process.stdout, self.process.stderr)

    def run(self, timeout = 4):

        def rund():
            while True:
                output = self.stdout.readline(timeout)
                if not output:
                    break
                self.on_read(output)

        t = threading.Thread(target=rund)
        t.start()

    def write(self, data):
        self.stdin.write(data + '\n')

    def on_read(self, data):
        self.onRead(data)
コード例 #2
0
ファイル: FrontEnd.py プロジェクト: whenisee/wotmods
class FrontEnd(object):
    onRead = EVNT()

    def __init__(self, service):
        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        startupinfo.wShowWindow = subprocess.SW_HIDE
        self.process = subprocess.Popen(service,
                                        stdin=subprocess.PIPE,
                                        stdout=subprocess.PIPE,
                                        stderr=subprocess.PIPE,
                                        universal_newlines=True,
                                        shell=False,
                                        startupinfo=startupinfo)
        self.stdin = self.process.stdin
        self.stdout = NBSR(self.process.stdout, self.process.stderr)

    def run(self, timeout=4):
        def rund():
            while True:
                output = self.stdout.readline(timeout)
                if not output:
                    break
                self.on_read(output)

        t = threading.Thread(target=rund)
        t.start()

    def write(self, data):
        self.stdin.write(data + '\n')

    def on_read(self, data):
        self.onRead(data)
コード例 #3
0
ファイル: FrontEnd.py プロジェクト: IJOL/wotmods
 def __init__(self, service):
     startupinfo = subprocess.STARTUPINFO()
     startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
     startupinfo.wShowWindow = subprocess.SW_HIDE
     self.process = subprocess.Popen(service, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=False, startupinfo=startupinfo)
     self.stdin = self.process.stdin
     self.stdout = NBSR(self.process.stdout, self.process.stderr)
コード例 #4
0
ファイル: FrontEnd.py プロジェクト: whenisee/wotmods
 def __init__(self, service):
     startupinfo = subprocess.STARTUPINFO()
     startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
     startupinfo.wShowWindow = subprocess.SW_HIDE
     self.process = subprocess.Popen(service,
                                     stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE,
                                     universal_newlines=True,
                                     shell=False,
                                     startupinfo=startupinfo)
     self.stdin = self.process.stdin
     self.stdout = NBSR(self.process.stdout, self.process.stderr)