def editImageAction(self):
     if not hasattr(self.centralwidget, 'stampid'):
         noStampExist = QtGui.QMessageBox.information(self, version.AppName,
         "Please select a stamp to edit", QtGui.QMessageBox.Ok )
     else:
         self.editImageDialog = QtGui.QDialog()
         self.editImageDialog.setWindowTitle("Add/Edit Image")
         self.editImageDialog.setGeometry(300, 300, 290, 150)
         mainLayout = QtGui.QHBoxLayout()
         addImageButton = QtGui.QPushButton("Choose new image")
         deleteImageButton = QtGui.QPushButton("Delete current image")
         
         self.editImageDialog.setLayout(mainLayout)
         mainLayout.addWidget(addImageButton)
         mainLayout.addWidget(deleteImageButton)
         addImageButton.clicked.connect(partial(self.editImageActionWrapper,'update'))
         deleteImageButton.clicked.connect(partial(self.editImageActionWrapper,'delete'))
         self.editImageDialog.setStyleSheet("background-color: rgb(49,49,49);color: white;font-color: white;")
         
         self.editImageDialog.setModal(True)
         self.editImageDialog.setFixedSize(250, 50)
         self.editImageDialog.setWindowIcon(getIconPath('titleIcon.png'))
         self.editImageDialog.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint)
         self.editImageDialog.show()
    def addMenusandTools(self):
        self.menubar = self.menuBar()
        
        #actions for file menu        
        self.addAlbum = QtGui.QAction(getIconPath('new.png'),'&Create New Album', self)        
        self.addAlbum.setShortcut(QtGui.QKeySequence.New)
        self.addAlbum.setStatusTip('Add new album')
        self.addAlbum.triggered.connect(self.newAlbumAction)

        self.openExistingAlbum = QtGui.QAction(getIconPath('open.png'),'&Open Existing', self)        
        self.openExistingAlbum.setShortcut(QtGui.QKeySequence.Open)
        self.openExistingAlbum.setStatusTip('Open existing album')
        self.openExistingAlbum.triggered.connect(self.openAlbumAction)
 
        self.exitAction = QtGui.QAction(getIconPath('exit.png'),'&Exit', self)        
        self.exitAction.setShortcut(QtGui.QKeySequence.Quit)
        self.exitAction.setStatusTip('Exit application')
        self.exitAction.triggered.connect(self.close)

        #creating filemenu and adding actions
        self.fileMenu = self.menubar.addMenu('&File')
        self.fileMenu.addAction(self.addAlbum)
        self.fileMenu.addAction(self.openExistingAlbum)
        self.fileMenu.addAction(self.exitAction)

        #actions for album menu

        self.addStamp = QtGui.QAction(getIconPath('addStamps.png'),'&Add Stamp', self)
        self.addStamp.setShortcut(QtGui.QKeySequence.ZoomIn)
        self.addStamp.setStatusTip('Add new stamp to the current album')
        self.addStamp.setDisabled(True)
        self.addStamp.triggered.connect(self.addStampAction)

        self.exportPdf = QtGui.QAction(getIconPath('exportPdf.png'),'&Export as PDF', self)
        self.exportPdf.setShortcut(QtGui.QKeySequence.Print)
        self.exportPdf.setStatusTip('Save the current album as PDF')
        self.exportPdf.setDisabled(True)
        self.exportPdf.triggered.connect(self.exportToPdf)
		
        self.albumMenu = self.menubar.addMenu('&Album')
        self.albumMenu.addAction(self.addStamp)
        self.albumMenu.addAction(self.exportPdf)

        #actions for Stamp Menu

        self.editStamp = QtGui.QAction(getIconPath('editStamps.png'),'&Edit Stamp', self)
        self.editStamp.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.editStamp.setStatusTip('Edit details for the current selection')
        self.editStamp.setDisabled(True)
        self.editStamp.triggered.connect(self.editStampAction)

        self.editImage = QtGui.QAction(getIconPath('editImage.png'),'&Add/Edit Image', self)
        self.editImage.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.editImage.setStatusTip('Add/Edit image for the current selection')
        self.editImage.setDisabled(True)
        self.editImage.triggered.connect(self.editImageAction)
	
        self.deleteStamp = QtGui.QAction(getIconPath('deleteStamps.png'),'&Delete Stamp', self)
        self.deleteStamp.setShortcut(QtGui.QKeySequence.ZoomOut)
        self.deleteStamp.setStatusTip('Delete the current selection')
        self.deleteStamp.setDisabled(True)
        self.deleteStamp.triggered.connect(self.deleteStampAction)

        self.stampMenu = self.menubar.addMenu('&Stamp')
        self.stampMenu.addAction(self.editStamp)
        self.stampMenu.addAction(self.editImage)
        self.stampMenu.addAction(self.deleteStamp)
                
        #actions for View Menu

        self.nameView = QtGui.QAction(getIconPath('viewBy.png'),'&By Name', self)
        #self.nameView.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.nameView.setStatusTip('Group stamps by name')
        self.nameView.setDisabled(True)
        self.nameView.triggered.connect(partial(self.setView,'name'))

        self.yearView = QtGui.QAction(getIconPath('viewBy.png'),'&By Year', self)
        #self.yearView.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.yearView.setStatusTip('Group stamps by year')
        self.yearView.setDisabled(True)
        self.yearView.triggered.connect(partial(self.setView,'year'))

        self.countryView = QtGui.QAction(getIconPath('viewBy.png'),'&By Country', self)
        #self.countryView.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.countryView.setStatusTip('Group stamps by country')
        self.countryView.setDisabled(True)
        self.countryView.triggered.connect(partial(self.setView,'country'))

        self.conditionView = QtGui.QAction(getIconPath('viewBy.png'),'&By Condition', self)
        #self.conditionView.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.conditionView.setStatusTip('Group stamps by condition')
        self.conditionView.setDisabled(True)
        self.conditionView.triggered.connect(partial(self.setView,'condition'))

        self.viewMenu = self.menubar.addMenu('&View')
        self.viewMenu.addAction(self.nameView)
        self.viewMenu.addAction(self.yearView)
        self.viewMenu.addAction(self.countryView)
        self.viewMenu.addAction(self.conditionView)
                
        #----------------------------------------------------------------------------------------------------------------
        #define toolbar and add actions
        self.toolbar = self.addToolBar('Toolbar')
        self.toolbar.setMovable(False)
        self.toolbar.addAction(self.addAlbum)
        self.toolbar.addAction(self.openExistingAlbum)
        self.toolbar.addAction(self.exitAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.addStamp)
        self.toolbar.addAction(self.exportPdf)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.editStamp)
        self.toolbar.addAction(self.editImage)
        self.toolbar.addAction(self.deleteStamp)
    def setDisplays(self):
        self.setWindowTitle(version.AppName)
        self.setWindowIcon(getIconPath('titleIcon.png'))
        self.setFixedSize(800, 500)
        self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint)
        screen = QtGui.QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        self.setStyleSheet("""
           QMenuBar {
               background-color: rgb(49,49,49);
               color: rgb(255,255,255);
               
           }
 
           QMenuBar::item {
               background-color: rgb(49,49,49);
               color: rgb(255,255,255);
           }
 
           QMenuBar::item::selected {
               background-color: orange;
               color: white;
           }
 
           QMenu {
               background-color: rgb(49,49,49);
               color: rgb(255,255,255);
           }
           QMenu::item {
               background-color: rgb(49,49,49);
               color: white;
           }
 
           QMenu::item::selected {
               background-color: orange;
               color: white;
               
           }
           QToolBar {
               background-color: rgb(49,49,49);
               color: rgb(255,255,255);              
           }
           QToolBar::separator {
               background-color: rgb(49,49,49);
               color: orange;              
           }
           QWidget {
               background-color: rgb(49,49,49);
               color: white;
               font-color: white;
           }
           QDialog {
               background-color: rgb(49,49,49);
               color: white;
               font-color: white;
           }
           QProgressBar::chunk {
                 background-color: orange;               
                 
             }
           QFormLayout {
               background-color: rgb(49,49,49);
               color: white;
               font-color: white;
           }
           QTreeWidget {
               background-color: rgb(49,49,49);
               color: white;
               font-color: white;
           }
           QTreeWidget::item::selected {
               background-color: rgb(49,49,49);
               color: orange;
               font-color: white;
           }
           QTreeView::branch:open:has-children{
               image: url(icons/branchOpen.png);
            }
            QTreeView::branch:closed:has-children {
               image: url(icons/branchClosed.png);
            }
            QHeaderView::section {
                background-color: rgb(49,49,49);
               color: white;
            }
                     
       """)

        self.show()