Пример #1
0
class Runner(wx.EvtHandler):

    def __init__(self, config, notebook):
        wx.EvtHandler.__init__(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.name = config.name
        self._timer = wx.Timer(self)
        self._config = config
        self._window = self._get_output_window(notebook)

    def _get_output_window(self, notebook):
        return _OutputWindow(notebook, self)

    def run(self):
        self._process = Process(self._config.command)
        self._process.start()
        self._timer.Start(500)

    def OnTimer(self, event=None):
        finished = self._process.is_finished()
        self._window.update_output(self._process.get_output(), finished)
        if finished:
            self._timer.Stop()

    def stop(self):
        try:
            self._process.stop()
        except Exception as err:
            wx.MessageBox(str(err), style=wx.ICON_ERROR)
Пример #2
0
class Runner(wx.EvtHandler):
    def __init__(self, config, notebook):
        wx.EvtHandler.__init__(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.name = config.name
        self._timer = wx.Timer(self)
        self._config = config
        self._window = self._get_output_window(notebook)

    def _get_output_window(self, notebook):
        return _OutputWindow(notebook, self)

    def run(self):
        self._process = Process(self._config.command)
        self._process.start()
        self._timer.Start(500)

    def OnTimer(self, event=None):
        finished = self._process.is_finished()
        self._window.update_output(self._process.get_output(), finished)
        if finished:
            self._timer.Stop()

    def stop(self):
        try:
            self._process.stop()
        except Exception as err:
            wx.MessageBox(str(err), style=wx.ICON_ERROR)
Пример #3
0
 def _create_process(self, command):
     proc = Process(command)
     proc.start()
     return proc
Пример #4
0
 def _create_process(self, command):
     proc = Process(command)
     proc.start()
     return proc