Changeset 56205
- Timestamp:
- 10/09/08 19:27:14 (6 weeks ago)
- Location:
- wxPython/3rdParty/Editra
- Files:
-
- 2 modified
-
src/eclib/outbuff.py (modified) (9 diffs)
-
tests/controls/OutputBufferDemo.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wxPython/3rdParty/Editra/src/eclib/outbuff.py
r55987 r56205 190 190 self.SetMarginWidth(1, 0) 191 191 192 # To improve performance at cost of memory cache the document layout 192 193 self.SetLayoutCache(wx.stc.STC_CACHE_DOCUMENT) 193 194 self.SetUndoCollection(False) # Don't keep undo history … … 262 263 def AppendUpdate(self, value): 263 264 """Buffer output before adding to window. This method can safely be 264 called from non gui threads to add updates to the buffer. 265 called from non gui threads to add updates to the buffer, that will 266 be displayed durning the next idle period. 265 267 @param value: update string to append to stack 266 268 … … 642 644 if msg[0] in (109, errno.ESHUTDOWN): 643 645 return False 644 645 646 else: 646 647 # OSX and Unix nonblocking pipe read implementation … … 652 653 fcntl.fcntl(self._proc.stdout, 653 654 fcntl.F_SETFL, 654 flags| os.O_NONBLOCK)655 flags|os.O_NONBLOCK) 655 656 656 657 try: 657 if not select.select([self._proc.stdout], [], [], 1)[0]: 658 return True 659 660 read = self._proc.stdout.readline() 661 if read == '': 658 try: 659 if not select.select([self._proc.stdout], [], [], 1)[0]: 660 return True 661 662 read = self._proc.stdout.readline() 663 if read == '': 664 return False 665 except IOError: 662 666 return False 663 667 finally: … … 672 676 673 677 evt = OutputBufferEvent(edEVT_UPDATE_TEXT, self._parent.GetId(), result) 674 wx. CallAfter(wx.PostEvent,self._parent, evt)678 wx.PostEvent(self._parent, evt) 675 679 return True 676 680 … … 697 701 # Try to kill the group 698 702 try: 699 pgid = os.getpgid(pid) 700 os.killpg(pgid, signal.SIGKILL) 703 os.kill(pid, signal.SIGKILL) 701 704 except OSError, msg: 702 705 pass 703 706 704 707 # If still alive shoot it again 705 if self._proc.poll() !=None:708 if self._proc.poll() is not None: 706 709 try: 707 710 os.kill(-pid, signal.SIGKILL) … … 711 714 # Try and wait for it to cleanup 712 715 try: 713 os.waitpid( -pid, os.WNOHANG)716 os.waitpid(pid, os.WNOHANG) 714 717 except OSError, msg: 715 718 pass … … 738 741 739 742 use_shell = not subprocess.mswindows 740 if use_shell: 741 preexec_fn = os.setsid 742 else: 743 preexec_fn = None 744 745 self._proc = subprocess.Popen(command.strip(), stdout=subprocess.PIPE, 746 preexec_fn=preexec_fn, 747 stderr=subprocess.STDOUT, shell=use_shell, 748 cwd=self._cwd, env=self._env) 743 self._proc = subprocess.Popen(command.strip(), 744 stdout=subprocess.PIPE, 745 stderr=subprocess.STDOUT, 746 shell=use_shell, 747 cwd=self._cwd, 748 env=self._env) 749 749 750 750 evt = OutputBufferEvent(edEVT_PROCESS_START, 751 751 self._parent.GetId(), 752 752 command.strip()) 753 wx. CallAfter(wx.PostEvent,self._parent, evt)753 wx.PostEvent(self._parent, evt) 754 754 755 755 # Read from stdout while there is output from process … … 780 780 # Pack the exit code as the events value 781 781 evt = OutputBufferEvent(edEVT_PROCESS_EXIT, self._parent.GetId(), result) 782 wx. CallAfter(wx.PostEvent,self._parent, evt)782 wx.PostEvent(self._parent, evt) 783 783 784 784 def SetArgs(self, args): -
wxPython/3rdParty/Editra/tests/controls/OutputBufferDemo.py
r52085 r56205 105 105 # Spawn a new ProcessThread 106 106 combo = self.FindWindowById(ID_COMMAND) 107 self._buff.StartProcess( '%s' % combo.GetValue())107 self._buff.StartProcess(u'%s' % combo.GetValue()) 108 108 self.UpdateProcs() 109 109 else: … … 287 287 frame.SetSizer(sizer) 288 288 frame.SetInitialSize() 289 frame.SetStatusText("OutputBuffer test") 289 frame.SetStatusText("OutputBufferDemo: wxPython %s, Python %s" % \ 290 (wx.__version__, u".".join(str(x) for x in sys.version_info))) 290 291 frame.Show() 291 292 app.MainLoop()
