本文整理汇总了Python中amsn2.core.views.StringView.toHtmlString方法的典型用法代码示例。如果您正苦于以下问题:Python StringView.toHtmlString方法的具体用法?Python StringView.toHtmlString怎么用?Python StringView.toHtmlString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amsn2.core.views.StringView
的用法示例。
在下文中一共展示了StringView.toHtmlString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: groupUpdated
# 需要导入模块: from amsn2.core.views import StringView [as 别名]
# 或者: from amsn2.core.views.StringView import toHtmlString [as 别名]
def groupUpdated(self, group):
if group.uid == 0:
group.uid = "0"
if group.uid not in self.groups:
return
gitem = self.__search_by_id(group.uid)
self._model.item(self._model.indexFromItem(gitem).row(), 3).setData(QVariant(group), Qt.DisplayRole)
gname = StringView()
gname = group.name
self._model.item((self._model.indexFromItem(gitem)).row(), 0).setText(
"<b>" + QString.fromUtf8(gname.toHtmlString()) + "</b>"
)
try:
cuids = self.contacts[group.uid]
except:
cuids = []
self.contacts[group.uid] = group.contact_ids.copy()
for cid in group.contact_ids:
if cid not in cuids:
gitem = self.__search_by_id(group.uid)
gitem.appendRow([QStandardItem(cid), QStandardItem(cid), QStandardItem("contact"), QStandardItem()])
# Remove unused contacts
for cid in cuids:
if cid not in self.contacts[group.uid]:
citem = self.__search_by_id(cid)
self._model.removeRow((self._model.indexFromItem(citem)).row())
示例2: group_added
# 需要导入模块: from amsn2.core.views import StringView [as 别名]
# 或者: from amsn2.core.views.StringView import toHtmlString [as 别名]
def group_added(self, group):
pi = self._model.invisibleRootItem()
# Adding Group Item
groupItem = QStandardItem()
gname = StringView()
gname = group.name
self._model.item(groupItem.row(), 0).setText('<b>'+QString.fromUtf8(gname.toHtmlString())+'</b>')
self._model.item(groupItem.row(), 1).setText(QString.fromUtf8(str(group.uid)))
pi.appendRow(groupItem)
for contact in group.contacts:
contactItem = QStandardItem()
cname = StringView()
cname = contact.name
self._model.item(contactItem.row(), 0).setText(QString.fromUtf8(cname.toHtmlString()))
self._model.item(contactItem.row(), 1).setText(QString.fromUtf8(str(contact.uid)))
groupItem.appendRow(contactItem)
self._contactDict[contact.uid] = contact
示例3: contactUpdated
# 需要导入模块: from amsn2.core.views import StringView [as 别名]
# 或者: from amsn2.core.views.StringView import toHtmlString [as 别名]
def contactUpdated(self, contact):
citem = self.__search_by_id(contact.uid)
if citem is None:
return
gitem = citem.parent()
if gitem is None:
return
dp = Image(self._parent._theme_manager, contact.dp)
dp = dp.to_size(28, 28)
# icon = Image(self._parent._theme_manager, contact.icon)
gitem.child(self._model.indexFromItem(citem).row(), 0).setData(QVariant(dp), Qt.DecorationRole)
# gitem.child(self._model.indexFromItem(citem).row(), 0).setData(QVariant(icon), Qt.DecorationRole)
gitem.child(self._model.indexFromItem(citem).row(), 3).setData(QVariant(contact), Qt.DisplayRole)
cname = StringView()
cname = contact.name
gitem.child(self._model.indexFromItem(citem).row(), 0).setText(QString.fromUtf8(cname.toHtmlString()))