Beispiel #1
0
 def loadPageThumbs(self):
     for row in range(0, BROWSER_GRID_HEIGHT):
         for col in range(0, BROWSER_GRID_WIDTH):
             if len(self.currentAlbum.photos)<= (
                         (BROWSER_THUMBS_PER_PAGE * (self.currentPage - 1)) + row*BROWSER_GRID_WIDTH + col):
                 self.imageLabels[row][col].setPixmap(QPixmap())
             else:
                 self.imageLabels[row][col].setPixmap(loadQPixMap(self.image, self.currentAlbum.photos[
                         (BROWSER_THUMBS_PER_PAGE * (self.currentPage - 1)) + row*BROWSER_GRID_WIDTH+col]
                                                                       .path, self.imageLabels[0][0].width(), self.imageLabels[0][0].height(), True))
                 self.imageLabels[row][col].adjustSize()
Beispiel #2
0
    def __init__(self, parent, path, comment, keywords):
        super(EditPhotoDialog, self).__init__(parent)
        controlframe = QFrame()
        self.image = None
        
        self.imgLabel = QLabel()
        #75 is a magic hack number for my netbook to get the buttons showing on the dlg box as well!
        self.imgLabel.setPixmap(loadQPixMap(self.image, path, self.imgLabel.width()-75, self.imgLabel.height()-75))
        self.imgLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        #self.imgLabel.setScaledContents = True
        self.imgLabel.setAlignment(Qt.AlignCenter)
        
        commentLabel = QLabel("Comment")
        self.commentEdit = QLineEdit(comment)
        keywordLabel = QLabel("Keyword")
        self.keywordEdit = QLineEdit(keywords)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        self.connect(buttonBox, SIGNAL("accepted()"), self, SLOT("accept()"))
        self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
        self.setWindowTitle("Edit Photo")

        grid = QGridLayout()
        grid.addWidget(commentLabel, 0, 0)
        grid.addWidget(self.commentEdit, 0, 1)
        grid.addWidget(keywordLabel, 1, 0)
        grid.addWidget(self.keywordEdit, 1, 1)

        grid.addWidget(buttonBox, 2, 0, 1, 2)
        controlframe.setLayout(grid)

        box = QVBoxLayout()
        
        box.addWidget(self.imgLabel)
        box.addWidget(controlframe)

        self.setLayout(box)