[Python-projects] PyQonsole as a Widget

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Mar 9 13:53:37 CET 2007


On Thursday 08 March à 14:03, Chad Brantly wrote:
> 
> On Mar 7, 2007, at 3:48 AM, Sylvain Thénault wrote:
> 
> >On Tuesday 06 March à 13:49, chadsjunkmail at mac.com wrote:
> >>I did a little more investigation.  See my results below:
> 
> >>>2) When we close down a shell, we get the following "Bad file
> >>>descriptor" error:
> >>>
> >>>>  File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/
> >>>>procctrl.py", line 203,
> >>>>in slotDoHousekeeping
> >>>>    process.processHasExited(status)
> >>>>  File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/pty_.py",
> >>>>line 285, in
> >>>>processHasExited
> >>>>    self.commClose()
> >>>>  File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/pty_.py",
> >>>>line 328, in
> >>>>commClose
> >>>>    fcntl(self.out[0], F_SETFL, os.O_NONBLOCK)
> >>>>IOError: [Errno 9] Bad file descriptor
> >>>>QSocketNotifier: invalid socket 6 and type 'Read', disabling...
> >>
> >>Similarly, it appears that the code is trying to flush a file that
> >>does not exist.  Should there be a check to make sure the file exists
> >>before trying to flush it?
> >
> >hum, this one sound weird. Don't you have a little test case
> >demonstrating the problem ?
> 
> Yes...If you just run pyqonsole and type exit in the shell you will  
> see the same error.  It seems like it isn't flushing properly when  
> you exit a shell.  Also, is there a way to pass a signal from  
> pyqonsole back to Qt when someone exits a shell?  Our consoles are  
> embedded in a QTabWidget, and we would like to close that tab when a  
> user exits the shell.  If needed, I could write a little test case to  
> demonstrate what we want.

actually I can't reproduce this. Which platform are you using ? A test
case would be welcome anyway.
 
> >>>Also, what is the proper way to change the foreground/background
> >>>colors of the console?  We have tried several things, and have been
> >>>able to change the colors by altering the Pyqonsole source, but we
> >>>really need to be able to set the colors at runtime.
> >
> >well, it's actually not easy right now and would need some refactoring
> >to be able to do so. Unfortunatly we don't have much time to spend on
> >pyqonsole at Logilab for the moment. Patches are welcome though ;)
> 
> Did you have any ideas about where to start on this?  We would be  
> happy to help contribute.

it seems that actually the main thing missing is a proper api to change
entries of the color_table attribute of the Widget class. There may be
other problems I don't think about right now though, but we may help if
needed.
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science



More information about the Python-Projects mailing list