def BfieldTb(self):
     self.w = BfieldTbWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()
class tooldemo(QMainWindow):
    def __init__(self, parent=None):
        super(tooldemo, self).__init__(parent)
        layout = QVBoxLayout()
        tb = self.addToolBar("File")

        icon = QIcon("images/Beam.png")
        #icon.iconSize(QSize(24, 24))
        convolution = QAction(icon,
                              "Convolve different images with the same beam",
                              self)
        #tb.setIconSize(QSize,(25,25))
        tb.addAction(convolution)
        convolution.triggered.connect(self.Conv)

        shifting = QAction(
            QIcon("images/CrossCorrelation.png"),
            "Shift two different images at two different frequencies using the 2D cross correlation method",
            self)
        tb.addAction(shifting)
        shifting.triggered.connect(self.Shift)

        shiftingComponent = QAction(
            QIcon("images/components.png"),
            "Shift two different images at two different frequencies using an optically thin component",
            self)
        tb.addAction(shiftingComponent)
        shiftingComponent.triggered.connect(self.ShiftComponent)

        spix = QAction(
            QIcon("images/Spix.png"),
            "Creates the spectral index map of two images at two different frequencies ",
            self)
        tb.addAction(spix)
        spix.triggered.connect(self.Spix)

        tb.addSeparator()

        turnover = QAction(
            QIcon("images/Turnover.png"),
            "Calculates de Turnover Frequency and Flux using multifrequency data",
            self)
        tb.addAction(turnover)
        turnover.triggered.connect(self.Spectrum)

        bfieldcoreshift = QAction(
            QIcon("images/Bfieldcoreshift.png"),
            "Calculates the magnetic field using the coreshift", self)
        tb.addAction(bfieldcoreshift)
        bfieldcoreshift.triggered.connect(self.BfieldCoreshift)

        bfieldpixel = QAction(
            QIcon("images/Bfieldsync.png"),
            "Calculates the magnetic field using the synchrotron spectrum",
            self)
        tb.addAction(bfieldpixel)
        bfieldpixel.triggered.connect(self.BfieldPixel)

        bfieldTb = QAction(
            QIcon("images/BfieldTb.png"),
            "Calculates the magnetic field using the brightness temperature",
            self)
        tb.addAction(bfieldTb)
        bfieldTb.triggered.connect(self.BfieldTb)

        tb.setIconSize(QSize(45, 45))

        # open = QAction(QIcon("open.bmp"),"open",self)
        #tb.addAction(open)
        #save = QAction(QIcon("save.bmp"),"save",self)
        #tb.addAction(save)
        #tb.actionTriggered[QAction].connect(self.toolbtnpressed)
        self.setLayout(layout)
        self.setGeometry(50, 50, 750, 600)
        self.setWindowTitle("Spix+Turnover")

        #tb.iconSize(QSize(24, 24))

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def toolbtnpressed(self, a):
        print "pressed tool button is", a.text()

    def Conv(self):
        self.w = ConvWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def Shift(self):
        self.w = ShiftWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def ShiftComponent(self):
        self.w = ShiftComponentsWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def Spix(self):
        self.w = SpixWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def Spectrum(self):
        self.w = SpectrumWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def BfieldCoreshift(self):
        self.w = BfieldcoreshiftWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def BfieldPixel(self):
        self.w = Bfieldpixel(self)
        self.setCentralWidget(self.w)
        self.w.show()

    def BfieldTb(self):
        self.w = BfieldTbWindow(self)
        self.setCentralWidget(self.w)
        self.w.show()
 def BfieldCoreshift(self):
     self.w = BfieldcoreshiftWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()
 def BfieldPixel(self):
     self.w = Bfieldpixel(self)
     self.setCentralWidget(self.w)
     self.w.show()
 def Spectrum(self):
     self.w = SpectrumWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()
 def Spix(self):
     self.w = SpixWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()
 def ShiftComponent(self):
     self.w = ShiftComponentsWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()
 def Shift(self):
     self.w = ShiftWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()
 def Conv(self):
     self.w = ConvWindow(self)
     self.setCentralWidget(self.w)
     self.w.show()