def AddUserItem(self, commnetId, commentsCount, likesCount, content, name, createdTime, floor, url="", path="", originalName="", title="", level=1): index = self.count() iwidget = QtComment(self) iwidget.id = commnetId iwidget.commentLabel.setText(content) iwidget.nameLabel.setText(name) iwidget.numLabel.setText("({})".format(commentsCount)) iwidget.starLabel.setText("({})".format(likesCount)) iwidget.levelLabel.setText(" LV" + str(level) + " ") iwidget.titleLabel.setText(" " + title + " ") if createdTime: timeArray, day = ToolUtil.GetDateStr(createdTime) if day >= 1: iwidget.dateLabel.setText("{}天前".format(str(day))) else: strTime = "{}:{}:{}".format(timeArray.tm_hour, timeArray.tm_min, timeArray.tm_sec) iwidget.dateLabel.setText("{}".format(strTime)) iwidget.indexLabel.setText("{}楼".format(str(floor))) item = QListWidgetItem(self) item.setSizeHint(iwidget.sizeHint()) self.setItemWidget(item, iwidget) if url and config.IsLoadingPicture: QtTask().AddDownloadTask(url, path, None, self.LoadingPictureComplete, True, index, True, self.GetName()) pass
def AddUserItem(self, content, name, createdTime, floor, url="", path="", originalName=""): index = self.count() iwidget = UserItemWidget(self) iwidget.commentLabel.setText(content) iwidget.label.setText(name) timeArray, day = ToolUtil.GetDateStr(createdTime) if day >= 1: iwidget.timeLabel.setText("{}天前".format(str(day))) else: strTime = "{}:{}:{}".format(timeArray.tm_hour, timeArray.tm_min, timeArray.tm_sec) iwidget.timeLabel.setText("{}".format(strTime)) iwidget.indexLabel.setText("{}楼".format(str(floor))) item = QListWidgetItem(self) item.setSizeHint(iwidget.sizeHint()) self.setItemWidget(item, iwidget) if url and path and config.IsLoadingPicture: QtTask().AddDownloadTask(url, path, None, self.LoadingPictureComplete, True, index, True, self.GetName()) pass