Exemple #1
0
    def createModel(self):
        model = QStandardItemModel(0, 7)
        model.setHeaderData(0, Qt.Horizontal, self.path_title)
        model.setHeaderData(1, Qt.Horizontal, self.sect_title)
        model.setHeaderData(2, Qt.Horizontal, self.subv_title)
        model.setHeaderData(3, Qt.Horizontal, self.wday_title)
        model.setHeaderData(4, Qt.Horizontal, self.date_title)
        model.setHeaderData(5, Qt.Horizontal, self.time_title)
        model.setHeaderData(6, Qt.Horizontal, self.ts_title)

        n = 0
        for i in mainWindow.sectionTable.selected:
            x = Section(settings.config[i])
            for j in x.snapshot_paths:
                snap = x.snapshot_info(j, printout=False)
                model.insertRow(n)
                model.setData(model.index(n, 0), j)
                model.setData(model.index(n, 1), x.name)
                model.setData(model.index(n, 2), x.subvolume)
                model.setData(model.index(n, 3), snap.wday)
                model.setData(model.index(n, 4), snap.date)
                model.setData(model.index(n, 5), snap.time)
                model.setData(model.index(n, 6), snap.ts)
            n = +1
        return model
Exemple #2
0
def snapshot_info():
    snap = args.snapshot_info
    if snap != '/':  # Prevent strip filesystem root.
        snap = snap.rstrip('/')
    else:
        clean_exit("Root directory can't be a snapshot!", BADSNAP)
    found = 0
    for i in settings.sections:
        x = Section(settings.config[i])
        if x.snapshot_info(snap):
            found =+ 1
    if not found:
        clean_exit('No section manages the snapshot: ' + snap, BADSNAP)