Re: [PyKDE] QAssistantClient and PyQt

2003-06-05 Thread Phil Thompson
On Wednesday 04 June 2003 6:01 pm, Peter Kropf wrote:
 I'm a bit confused about a problem that I'm having when using
 QAssistantClient from a Python program. Here's a snippet of the code that
 I'm using to test things out.

 import sys
 from qt import *

 class LaunchButton( QPushButton ):
 def __init__( self, *args ):
 apply( QPushButton.__init__, (self,) + args )
 self.setText( Launch )


 class TheWindow( QMainWindow ):
 def __init__( self, *args ):
 apply( QMainWindow.__init__, (self,) + args )

 self.button=LaunchButton( self )
 self.setCentralWidget( self.button )
 self.connect( self.button, SIGNAL( clicked() ), self.BeenClicked
 )

 self.qac = QAssistantClient( '' )
 self.connect( self.qac, SIGNAL( destroyed() ),
 self.qacDestroyed )
 self.connect( self.qac, SIGNAL( assistantOpened() ),
 self.qacOpened )
 self.connect( self.qac, SIGNAL( assistantClosed() ),
 self.qacClosed )
 self.connect( self.qac, SIGNAL( error() ),  
 self.qacError )

 self.toggle = True

 def qacDestroyed( self ):
 print 'qacDestroyed'

 def qacOpened( self ):
 print 'qacOpened'

 def qacClosed( self ):
 print 'qacClosed'

 def qacError( self ):
 print 'qacError'

 def BeenClicked( self ):
 if self.toggle:
 page = '/tools/qt/doc/html/assistant.html'
 self.toggle = False
 else:
 page = '/tools/qt/doc/html/assistant-4.html#3'
 self.toggle = True
 print 'Been clicked: ' + page
 self.qac.showPage( page )


 def main(args):
 app=QApplication( args )

 win=TheWindow( )
 win.show( )

 app.connect( app, SIGNAL( lastWindowClosed() ), app, SLOT( quit() )
 )
 app.exec_loop()


 if __name__==__main__:
 main( sys.argv )


 My problem occurs when connecting the error signal to a slot. At runtime, I
 receive these messages:

 QObject::connect: No such signal QAssistantClient::error()
 QObject::connect:  (sender name:   'unnamed')
 QObject::connect:  (receiver name: 'unnamed')

 But when I look through the QAssistantClient.cpp and
 sipqtQAssistantClient.cpp code, the error signal looks to be defined the
 same way the destroyed, assistantOpened and assistantClosed signals. What
 am I missing?

The signal's argument, ie. SIGNAL(error(const QString )).

Phil

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] QAssistantClient and PyQt

2003-06-05 Thread Hans-Peter Jansen
Hi Peter,

On Wednesday 04 June 2003 19:01, Peter Kropf wrote:
 I'm a bit confused about a problem that I'm having when using
 QAssistantClient from a Python program. Here's a snippet of the code
 that I'm using to test things out.

[...]

 But when I look through the QAssistantClient.cpp and
 sipqtQAssistantClient.cpp code, the error signal looks to be defined
 the same way the destroyed, assistantOpened and assistantClosed
 signals. What am I missing?

Since Phil was quicker, here is just the fixed source:

import sys 
from qt import * 

DOCBASE = /usr/lib/qt3/doc/html

class LaunchButton( QPushButton ): 
def __init__( self, *args ): 
apply( QPushButton.__init__, (self,) + args ) 
self.setText( Launch ) 


 

class TheWindow( QMainWindow ): 
def __init__( self, *args ): 
apply( QMainWindow.__init__, (self,) + args ) 


self.button=LaunchButton( self ) 
self.setCentralWidget( self.button ) 
self.connect( self.button, SIGNAL( clicked() ), self.BeenClicked ) 


self.qac = QAssistantClient( '' ) 
self.connect( self.qac, SIGNAL( destroyed() ),   self.qacDestroyed ) 
self.connect( self.qac, SIGNAL( assistantOpened() ), self.qacOpened ) 
self.connect( self.qac, SIGNAL( assistantClosed() ), self.qacClosed ) 
self.connect( self.qac, SIGNAL( error(const QString ) ), self.qacError ) 


self.toggle = True 


def qacDestroyed( self ): 
print 'qacDestroyed' 


def qacOpened( self ): 
print 'qacOpened' 


def qacClosed( self ): 
print 'qacClosed' 


def qacError( self, msg ): 
print 'qacError:', msg


def BeenClicked( self ): 
if self.toggle: 
page = DOCBASE + '/assistant.html' 
else: 
page = DOCBASE + '/assistant-4.html#3' 
self.toggle = not self.toggle
print 'Been clicked: ' + page 
self.qac.showPage( page ) 


 

def main(args): 
app=QApplication( args ) 


win=TheWindow( ) 
win.show( ) 


app.connect( app, SIGNAL( lastWindowClosed() ), app, SLOT( quit() ) ) 
app.exec_loop() 


 

if __name__==__main__: 
main( sys.argv ) 


___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde