lineyka_manager.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:lineyka 作者: volodya-renderberg 项目源码 文件源码
def fill_project_table(self, table):
        #copy = db.studio() # self.db_studio
        self.db_group.get_list_projects()

        if not self.db_group.list_projects:
            return

        projects = []
        for key in self.db_group.list_projects.keys():
            projects.append({'name' : key,'status' : self.db_group.list_projects[key]['status'], 'path': self.db_group.list_projects[key]['path']})

        # get table data
        columns = ('name', 'status', 'path')
        num_row = len(projects)
        num_column = len(columns)
        headers = columns

        # make table
        table.setColumnCount(num_column)
        table.setRowCount(num_row)
        table.setHorizontalHeaderLabels(headers)


        # fill table
        for i, project in enumerate(projects):
            for j,key in enumerate(headers):
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(project[key])
                if key == 'name':
                    color = self.project_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)

                table.setItem(i, j, newItem)

        table.resizeRowsToContents()
        table.resizeColumnsToContents()

        print('fill project table')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号