Exemple #1
0
 def _on_threads_selectionChanged(self, selection):
     indexes = selection.indexes()
     if len(indexes) == 0:
         self.messages.setPlainText('')
     else:
         index = indexes[0]
         thread = self._threadModel.get_thread(index)
         for i in range(self._channelModel.rowCount()):
             identity = self._channelModel.get_identity_by_row(i)
             if identity.profile.address.to_bytes() == thread.channel:
                 self.comboFrom2.setCurrentIndex(i)
                 break
         self.messages.setPlainText('')
         cursor = self.messages.textCursor()
         format = QTextCharFormat()
         format.setFontWeight(QFont.Bold)
         format.setFontPointSize(14)
         cursor.setCharFormat(format)
         first = True
         cursor.insertText(thread.subject.strip())
         for comment in thread.comments:
             charFormat = QTextCharFormat()
             blockFormat = QTextBlockFormat()
             blockFormat.setTopMargin(3.0)
             blockFormat.setBottomMargin(3.0)
             blockFormat.setBackground(QColor(0xdd, 0xdd, 0xdd))
             cursor.insertBlock(blockFormat, charFormat)
             cursor.insertImage(identicon.get(comment.creator, 8).toImage())
             cursor.setCharFormat(charFormat)
             if comment.creator:
                 address = wallet.Address.from_bytes(comment.creator)
                 cursor.insertText(' ' +
                                   self._core.wal.names.get(address.ripe))
             else:
                 cursor.insertText(' <unknown>')
             blockFormat = QTextBlockFormat()
             blockFormat.setTopMargin(3.0)
             blockFormat.setBottomMargin(3.0)
             cursor.insertBlock(blockFormat, charFormat)
             cursor.insertText(comment.text.strip())
             first = False
         thread.unread = 0
Exemple #2
0
 def _on_threads_selectionChanged(self, selection):
     indexes = selection.indexes()
     if len(indexes) == 0:
         self.messages.setPlainText('')
     else:
         index = indexes[0]
         thread = self._threadModel.get_thread(index)
         for i in range(self._channelModel.rowCount()):
             identity = self._channelModel.get_identity_by_row(i)
             if identity.profile.address.to_bytes() == thread.channel:
                 self.comboFrom2.setCurrentIndex(i)
                 break
         self.messages.setPlainText('')
         cursor = self.messages.textCursor()
         format = QTextCharFormat()
         format.setFontWeight(QFont.Bold)
         format.setFontPointSize(14)
         cursor.setCharFormat(format)
         first = True
         cursor.insertText(thread.subject.strip())
         for comment in thread.comments:
             charFormat = QTextCharFormat()
             blockFormat = QTextBlockFormat()
             blockFormat.setTopMargin(3.0)
             blockFormat.setBottomMargin(3.0)
             blockFormat.setBackground(QColor(0xdd, 0xdd, 0xdd))
             cursor.insertBlock(blockFormat, charFormat)
             cursor.insertImage(identicon.get(comment.creator, 8).toImage())
             cursor.setCharFormat(charFormat)
             if comment.creator:
                 address = wallet.Address.from_bytes(comment.creator)
                 cursor.insertText(' '+self._core.wal.names.get(address.ripe))
             else:
                 cursor.insertText(' <unknown>')
             blockFormat = QTextBlockFormat()
             blockFormat.setTopMargin(3.0)
             blockFormat.setBottomMargin(3.0)
             cursor.insertBlock(blockFormat, charFormat)
             cursor.insertText(comment.text.strip())
             first = False
         thread.unread = 0
Exemple #3
0
 def data(self, index, role=None):
     if role == Qt.DisplayRole:
         thread = self.get_thread(index)
         column = index.column()
         if column == 0:
             return thread.subject
     elif role == Qt.DecorationRole:
         thread = self.get_thread(index)
         column = index.column()
         if column == 0:
             return identicon.get(thread.creator, 8)
         else:
             return None
     elif role == Qt.FontRole:
         font = QFont()
         thread = self.get_thread(index)
         if thread.unread > 0:
             font.setBold(True)
         return font
     else:
         return None
Exemple #4
0
 def data(self, index, role=Qt.DisplayRole):
     if role == Qt.DisplayRole or role == Qt.EditRole:
         identity = self.identities[index.row()]
         column = index.column()
         if column == 0:
             return self.wal.names.get(identity.profile.address.ripe)
         elif column == 1:
             return identity.profile.address.to_str()
     elif role == Qt.DecorationRole:
         identity = self.identities[index.row()]
         column = index.column()
         if column == 0:
             return identicon.get(identity.profile.address.to_bytes())
         else:
             return None
     elif role == Qt.ForegroundRole:
         identity = self.identities[index.row()]
         column = index.column()
         if identity.type == wallet.IdentityType.normal:
             return QBrush(Qt.black)
         elif identity.type == wallet.IdentityType.channel:
             return QBrush(Qt.darkRed)
     else:
         return None