OK sometimes it is good to describe a problem and oft it will happen to find out the solution by yourself. The solution is:

self.printMenue[myComposerView] = PrintMenue(self.iface, myComposerView)

self.printMenue has to be a dictionary as well. Now it works.

Regards
Horst


Am 31.08.2011 11:37, schrieb Düster Horst:
Hi

My aim is to add an additional toolBar with one button the all ComposerWindows 
I open. I created the following code to achieve that.

   def __init__(self, iface):
     self.composerWindow = {}
     self.myPrintAction = {}
     myApp = self.iface.mainWindow()
     QObject.connect(myApp, SIGNAL("composerAdded(QgsComposerView*)"), 
self.initPrintEnvironment)

   def initPrintEnvironment(self,  myComposerView):
       self.printMenue = PrintMenue(self.iface,  myComposerView)
       self.composerWindow[myComposerView] = myComposerView.composerWindow()
       myToolBar = QToolBar()
       self.myPrintAction[myComposerView] = QAction(QIcon(), "SO!GIS Print",  
self.composerWindow[myComposerView])
       myToolBar.addAction(self.myPrintAction[myComposerView])
       self.composerWindow[myComposerView].addToolBar(myToolBar)
       QObject.connect(self.myPrintAction[myComposerView], 
SIGNAL("triggered()"), self.printMenue.run)


The code logic works fine when I open the first composer window. A new toolbaar 
with one button and the text SO!GIS Print is created. Click on this button 
starts the expected printMenue. The composer 1 window is still open. Now I open 
a second composer window. Everything works fine in this window. But now when I 
switch back to composer1 window. A click on the does nothing. I can open 
composer windows as much as I like. Only the last created composer window has a 
functioning button.

Im not shure weather it is as problem of my code or the problem is hidden 
deeper in the QGIS code.

Ill apprecciate an help or hint.

Regards
Horst

------------------------------------------------

Dr. Horst Düster

Kanton Solothurn
Bau- und Justizdepartement
Amt für Geoinformation
Rötistrasse 4
CH-4501 Solothurn

Telefon ++41(0)32 627 25 32
Telefax ++41(0)32 627 22 14

mailto:[email protected]
http://www.agi.so.ch
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

--
Dr. Horst Düster
Burchacker 6
CH-4556 Aeschi

Tel.: +41 (0) 62 961 03 74
Mobil: +41 (0) 76 408 51 06
eMail: [email protected]
skype: horstduester
Web: www.kappasys.ch
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to