iamLovingJerk / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

problem with newer pygtk #172

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Got the traceback below with released pychess using 

glib2 2.12.12
gtk2 2.10.11
pygtk 2.10.4
pygobject 2.13.1

If i change line #64 in BoardPeview.py
from
        self.widgets["mainvbox"].unparent()
to
        self.widgets["mainvbox"]    #.unparent()

it runs with a warning only.

tamas@tami:~$ pychess
Traceback (most recent call last):
  File "<string>", line 22, in ?
  File "/usr/lib/python2.4/site-packages/pychess/Main.py", line 13, in ?
    from pychess.widgets import ionest
  File "/usr/lib/python2.4/site-packages/pychess/widgets/ionest.py", line
79, in ?
    loadSidePanel = BoardPreview.BoardPreview()
  File "/usr/lib/python2.4/site-packages/pychess/widgets/BoardPreview.py",
line 65, in __init__
    self.add(self.widgets["mainvbox"])
TypeError: GtkContainer.add() argument 1 must be gtk.Widget, not None
Unhandled exception in thread started by <function _getInfo at 0xb62d6d4c>
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/pychess/Players/engines.py", line
76, in _getInfo
    en = engine(args, WHITE)
  File "/usr/lib/python2.4/site-packages/pychess/Players/CECP.py", line 33,
in __init__
    self.proto = CECProtocol (args[0], color)
TypeError: 'NoneType' object is not callable
Exception exceptions.AttributeError: "'CECPEngine' object has no attribute
'proto'" in  ignored
Unhandled exception in thread started by <function _getInfo at 0xb62d6d4c>
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/pychess/Players/engines.py", line
76, in _getInfo
    en = engine(args, WHITE)
  File "/usr/lib/python2.4/site-packages/pychess/Players/CECP.py", line 33,
in __init__
    self.proto = CECProtocol (args[0], color)
TypeError: 'NoneType' object is not callable
Exception exceptions.AttributeError: "'CECPEngine' object has no attribute
'proto'" in  ignored
Unhandled exception in thread started by <function _getInfo at 0xb62d6d4c>
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/pychess/Players/engines.py", line
76, in _getInfo
    en = engine(args, WHITE)
  File "/usr/lib/python2.4/site-packages/pychess/Players/CECP.py", line 33,
in __init__
    self.proto = CECProtocol (args[0], color)
TypeError: 'NoneType' object is not callable
Exception exceptions.AttributeError: "'CECPEngine' object has no attribute
'proto'" in  ignored

Original issue reported on code.google.com by gbtami on 8 May 2007 at 5:16

GoogleCodeExporter commented 9 years ago
0.7 has this pb too.

Original comment by gbtami on 8 May 2007 at 5:36

GoogleCodeExporter commented 9 years ago
Well, with 
glib2-2.12.9
gtk2-2.10.8
pygtk2-2.10.4
pygobject2-2.12.3

I get this warning when removing the unparent line:

/home/thomas/Programmering/python/skak/0.7/lib/pychess/widgets/BoardPreview.py:6
8:
GtkWarning: Attempting to add a widget with type GtkVBox to a container of type
GtkAlignment, but the widget is already inside a container of type GtkWindow, 
the
GTK+ FAQ at http://www.gtk.org/faq/ explains how to reparent a widget.
  self.add(self.widgets["mainvbox"])

And when I open the load game dialog the previewboard doesn't show up.

The error you posted was given to you in cases where you did have the unparent 
line,
correct?
It is strange how self.add(self.widgets["mainvbox"]) complains that
self.widgets["mainvbox"] but self.widgets["mainvbox"].unparent() doesn't seam 
to do.

The problem might however be related to this: http://www.gtk.org/faq/#AEN636
In which case it should be fixable by replacing the unparent line with
self.widgets["mainvbox"].get_parent().remove(self.widgets["mainvbox"])
or perhaps even self.widgets["mainvbox"].reparent(self)

All three versions work fine for me.

Original comment by lobais on 8 May 2007 at 8:14

GoogleCodeExporter commented 9 years ago
"The error you posted was given to you in cases where you did have the unparent 
line,
correct?"
Yes.

self.widgets["mainvbox"].get_parent().remove(self.widgets["mainvbox"])
doesn't worked(got tracaback).

self.widgets["mainvbox"].reparent(self)
worked with warning, and the preview was ok too.

Tried all with 0.7 svn.

Original comment by berad...@gmail.com on 9 May 2007 at 8:57

GoogleCodeExporter commented 9 years ago
After your last commit i tried it again, and pychess doesn't started again.
Then i rereaded all our conversation from beginning, and discovered my versions
doesn't match. pygobject 2.13.1 !!!
After downgrading pygobject to 2.12.3, your original code (unparent) worked 
without
any problem. So it was my bad. Sorry for misleading you!

Original comment by berad...@gmail.com on 5 Jun 2007 at 8:37

GoogleCodeExporter commented 9 years ago

Original comment by gbtami on 5 Jun 2007 at 8:40