#return _scaled_pixmap(pixmap, self.scale)

        #if role == Qt.TextAlignmentRole:
            #return Qt.AlignTop

        #return None

    #def _set_scale_pixmap_factor(self, scale_factor):
        #self.scale = scale_factor


#def _scaled_pixmap(pixmap, scale):
    #width = pixmap.width()
    #height = pixmap.height()
    #scaled_pixmap = pixmap.scaled(width * scale, height * scale,
                            #Qt.KeepAspectRatio, Qt.SmoothTransformation)

    #return scaled_pixmap


if __name__ == '__main__':
    from sys import argv, exit
    from table import TableModel, _get_image_paths_names

    app = QApplication(argv)
    model = TableModel()
    image_data = _get_image_paths_names(model)
    view = PhotoViewe(image_data)
    view.show()
    exit(app.exec_())
Esempio n. 2
0
import tableproxy
from table import TableModel

__all__ = ['TableModel']

TableModel = tableproxy.getProxy(TableModel)

if __name__ == "__main__":
    tab = TableModel([('a', str), ('b', str), ('c', str)])
    tab.insertRow(0)
    tab.insertRow(1)
    tab[0][0] = "apple"
    tab[0][1] = 2
    tab[0][2] = 3
    tab[1][0] = "orange"
    tab[1][1] = 5
    tab[1][2] = 3
    tab.printTable()

    print

    tab.insertColumn(1, [("extra", int), 10, 9])
    tab.printTable()

    print

    c = tab.takeColumn(1)
    tab.insertColumn(3, c)
    tab.printTable()

    print