当前位置: 首页>>代码示例>>Python>>正文


Python StringView.toHtmlString方法代码示例

本文整理汇总了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())
开发者ID:snowpunk,项目名称:amsn2,代码行数:32,代码来源:contact_list.py

示例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
开发者ID:test30,项目名称:amsn2,代码行数:24,代码来源:contact_list.py

示例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()))
开发者ID:snowpunk,项目名称:amsn2,代码行数:23,代码来源:contact_list.py


注:本文中的amsn2.core.views.StringView.toHtmlString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。