[Qgis-developer] Connecting composer closure with another window focus

Bernhard Ströbl bernhard.stroebl at jena.de
Mon Dec 16 06:17:53 PST 2013


Hi,

I often had the problem that connecting to a signal did not work, too. 
My solution always was to make the object which throws the signal an 
object of the class
so instead of
QgsComposerView....
try
self.QgsComposerView....

I have no idea if this is generally true neither can did I investigate 
why it worked in my cases

Bernhard

Am 16.12.2013 15:02, schrieb Vincent Damoy:
> Hi all,
>
> I'm running QGIS 2.0.1 on Ubuntu 12.04, 64 bits (installed with
> ubuntugis-unstable repository).
>
> I've created a form, which shows a composer when I click on a button.
> This form stays active while the composer is showed, but is located
> behind the QGIS main window.
> I'd like it to come back in front of the screen when the composer is
> closed by user.
>
> After several web searchs and tests, it seems that the following
> function works :
>
> /def operationOnTop(self): //
> //self.raise_() //
> //self.activateWindow()/
>
> My problem is to connect a « composer closed » signal with this function.
> I think the signal should be QgsComposerView.composerViewHide. I'm right ?
>
> * I tried to connect it with the above slot :
>
> /QgsComposerView.composerViewHide.connect(self.operationOnTop)/
>
> But QGIS returns :
> AttributeError: 'PyQt4.QtCore.pyqtSignal' object has no attribute 'connect'
> I can't understand this error message : all signals should have «
> connect » attribute, right ?
>
> * Trying with the old « connect » way :
>
> /self.connect(QgsComposerView(), QtCore.SIGNAL('composerViewHide'),
> self.operationOnTop)/
>
> My plugin doesn't crash during loading, but nothing happens when I close
> the composer.
> I've added « print 'operationOnTop' » to the end of the function, to
> test its loading. Apparently, the signal is not catched, as I have no
> return in the Python pannel.
>
> Can you see what I've missed in each case ?
>
> Any help would be greatly appreciated.
> Kind regards
>
>
> PS : I've tried to make the connection in the class constructor :
>
> /class OperationDialog(QtGui.QDialog): //
> //def __init__(self, iface): //
> //QtGui.QDialog.__init__(self) //
> //self.ui = Ui_operation() //
> //self.ui.setupUi(self) //
> //self.iface = iface //
> //self.canvas = self.iface.mapCanvas()//
> //…//
> //QgsComposerView.composerViewHide.connect(self.operationOnTop)//
> ///
> Should I put it in the function which creates the composer?
>
>
>
> --
>
> --
>
> ---------------------------
>
> Vincent Damoy - Responsable SIG
> Conservatoire d'Espaces Naturels du Nord et du Pas-de-Calais
> 152 bd de Paris - 62190 Lillers
> Tél : 03.21.54.75.00 - Fax : 03.21.54.56.07
> /*Pour adhérer au Conservatoire :*
> www.cen-npdc.org/nous-rejoindre/adherent.html/ 	
>
>
>
> 	/Pour le respect de l'environnement, n'imprimez ce message qu'en cas de
> nécessité !/ 	
>
>
>
>
> __________ Information from ESET Mail Security, version of virus
> signature database 9178 (20131216) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
> __________ Information from ESET Mail Security, version of virus signature database 9178 (20131216) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>



__________ Information from ESET Mail Security, version of virus signature database 9178 (20131216) __________

The message was checked by ESET Mail Security.
http://www.eset.com




More information about the Qgis-developer mailing list