Esempio n. 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)
Esempio n. 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)
Esempio n. 3
0
 def _create_process(self, command):
     proc = Process(command)
     proc.start()
     return proc
Esempio n. 4
0
 def test_command_as_string(self):
     initial_command = 'python hupu count_args a1 a2<SPACE>2<SPACE>1 a3<SPACE>'
     processed_command = Process(initial_command)._command
     assert_equal(len(processed_command), len(initial_command.split()))
     assert_equal(processed_command[4], 'a2 2 1')
Esempio n. 5
0
 def run(self):
     self._process = Process(self._config.command)
     self._process.start()
     self._timer.Start(500)
Esempio n. 6
0
 def _create_process(self, command):
     proc = Process(command)
     proc.start()
     return proc
Esempio n. 7
0
 def run(self):
     self._process = Process(self._config.command)
     self._process.start()
     self._timer.Start(500)