[Python-projects] PyQonsole as a Widget

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Mar 7 10:48:22 CET 2007


On Tuesday 06 March à 13:49, chadsjunkmail at mac.com wrote:
> I did a little more investigation.  See my results below:
> 
> On Feb 27, 2007, at 3:07 PM, chadsjunkmail at mac.com wrote:
> 
> > We are using PyQonsole and PyQt to develop an application using
> > PyQonsole as a widget and have run into a few problems when we pass a
> > parent to Widget.

you're using qt3, right ?

> > 1) When we initiate Widget with a parent, we get the following error:
> >
> >> File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/widget.py",
> >> line 988, in focusInEvent
> >>     self.repaint(self._cursor_rect, True) TypeError: argument 1 of
> >> QWidget.repaint() has an invalid type
> 
> It seems that when you pass a parent to Widget, self._cursor_rect  
> does not exist the first time focusInEvent is called.  Maybe there  
> should be an "if self._cursor_rect:" befor line 988 in focusInEvent.

I've added such tests in the pyqonsole repository. You can check if it
fix your problem by downloading it using mercurial, the repository url
is http://www.logilab.org/src/pyqonsole
 
> > 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 ?
 
> > 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 ;)

-- 
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