示例#1
0
class FileList (QMainWindow):

    def __init__(self,parent=None):
        QWidget.__init__(self,parent)
        self.parent = parent
        self.setWindowFlags(Qt.Dialog)
        self.ui = Ui_List()
        self.ui.setupUi(self)
        self.lst = self.ui.lst_files
        self.populate()

    def populate(self):
        model = QStandardItemModel()
        
        f = open('settings/Files')
        line = f.readline()
        
        while line:
            size = int(f.readline())

            size = size / 1048576
            
            item = QStandardItem(line + "\nSize:" + str(size) + "MB\n\n")

            line = f.readline()

            
            
            item.setEditable(False)
            model.appendRow(item)
            
        f.close()

        self.lst.setModel(model)
示例#2
0
 def __init__(self,parent=None):
     QWidget.__init__(self,parent)
     self.parent = parent
     self.setWindowFlags(Qt.Dialog)
     self.ui = Ui_List()
     self.ui.setupUi(self)
     self.lst = self.ui.lst_files
     self.populate()