def setupUi(self): self.horizontalLayout = QtGui.QHBoxLayout(self) self.horizontalLayout.setMargin(0) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") reason = self.tweet.author.verify_reason if self.tweet.author.verify_type == "personal": self.avatar = WAvatarLabel(WAvatarLabel.PERSONAL_VERIFY, reason) elif self.tweet.author.verify_type == "organization": self.avatar = WAvatarLabel(WAvatarLabel.ORGANIZATION_VERIFY, reason) else: self.avatar = WAvatarLabel(WAvatarLabel.NO_VERIFY) self.avatar.setObjectName("avatar") self.avatar.setPixmap(self.tweet.author.avatar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.avatar.sizePolicy().hasHeightForWidth()) self.avatar.setSizePolicy(sizePolicy) self.avatar.setAlignment(QtCore.Qt.AlignTop) self.avatar.clicked.connect(self._userClicked) self.verticalLayout_2.addWidget(self.avatar) self.time = SimpleLabel() self.time.setObjectName("time") sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.time.sizePolicy().hasHeightForWidth()) self.time.setSizePolicy(sizePolicy) self.verticalLayout_2.addWidget(self.time) self.verticalLayout_2.setAlignment(QtCore.Qt.AlignTop) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.username = QtGui.QLabel(self) self.username.setObjectName("username") self.username.setAlignment(QtCore.Qt.AlignTop) self.username.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) self.verticalLayout.addWidget(self.username) self.tweetText = WTweetLabel(self) self.tweetText.setObjectName("tweetText") self.tweetText.setAlignment(QtCore.Qt.AlignTop) self.tweetText.userClicked.connect(self._userTextClicked) self.tweetText.tagClicked.connect(self._tagClicked) self.verticalLayout.addWidget(self.tweetText) if self.tweet.thumbnail_pic and ("image" not in self.without): self.imageWidget = self._createImageLabel(self.tweet.thumbnail_pic) self.verticalLayout.addWidget(self.imageWidget) if self.tweet.original and ("original" not in self.without): self.originalLabel = self._createOriginalLabel() self.verticalLayout.addWidget(self.originalLabel) self.horizontalLayout.setStretch(1, 1) self.horizontalLayout.setStretch(2, 10) self.counterHorizontalLayout = QtGui.QHBoxLayout() self.counterHorizontalLayout.setObjectName("counterhorizontalLayout") self.horizontalSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.counterHorizontalLayout.addItem(self.horizontalSpacer) if WeRuntimeInfo().get("uid") == self.tweet.author.id: self.delete = self._createDeleteLabel() self.counterHorizontalLayout.addWidget(self.delete) if not (self.tweet.type == TweetItem.COMMENT): self.client = QtGui.QLabel() self.client.setText(self.tr("From: %s") % self.tweet.source) self.client.linkActivated.connect(lambda link: openLink(link)) self.counterHorizontalLayout.addWidget(self.client) self.retweet = self._createRetweetLabel() self.counterHorizontalLayout.addWidget(self.retweet) self.comment = self._createCommentLabel() self.counterHorizontalLayout.addWidget(self.comment) self.favorite = self._createFavoriteLabel() self.counterHorizontalLayout.addWidget(self.favorite) self.counterHorizontalLayout.setAlignment(QtCore.Qt.AlignTop) elif self.tweet.type == TweetItem.COMMENT: self.reply = self._createReplyLabel() self.counterHorizontalLayout.addWidget(self.reply) self.verticalLayout.addLayout(self.counterHorizontalLayout) self.horizontalLayout.addLayout(self.verticalLayout) self.setStyleSheet(""" QFrame#SingleTweetWidget { border-bottom: 2px solid palette(highlight); border-radius: 0px; padding: 2px; } """) self.username.setText(" " + self.tweet.author.name) text = QtCore.Qt.escape(self.tweet.text) text = self._create_mentions(text) text = self._create_html_url(text) text = self._create_hashtag(text) text = self._create_smiles(text) self.tweetText.setHtml(text) self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self._update_time) self._update_time()