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


Python views.StringView类代码示例

本文整理汇总了Python中amsn2.core.views.StringView的典型用法代码示例。如果您正苦于以下问题:Python StringView类的具体用法?Python StringView怎么用?Python StringView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StringView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __on_chat_send

    def __on_chat_send(self, entry, event_keyval, event_keymod):
        if (event_keyval == gtk.keysyms.Return):
            buffer = entry.get_buffer()
            start, end = buffer.get_bounds()
            msg = buffer.get_text(start, end)
            entry.clear()
            entry.grab_focus()
            if (msg == ''): return False

            color = self.button_color.get_color()
            hex8 = "%.2x%.2x%.2x" % ((color.red/0x101), (color.green/0x101), (color.blue/0x101))
            style = papyon.TextFormat.NO_EFFECT
            if self.button_bold.get_active(): style |= papyon.TextFormat.BOLD
            if self.button_italic.get_active():  style |= papyon.TextFormat.ITALIC
            if self.button_underline.get_active(): style |= papyon.TextFormat.UNDERLINE
            if self.button_strikethrough.get_active(): style |= papyon.TextFormat.STRIKETHROUGH
            font_name = self.button_font.get_font_name()
            font_family = pango.FontDescription(font_name).get_family()
            format = papyon.TextFormat(font=font_family, color=hex8, style=style)
            strv = StringView()
            strv.append_text(msg)
            self._amsn_conversation.send_message(strv, format)

        elif event_keyval == gtk.keysyms.Escape:
            self._parent.destroy()
开发者ID:BirdsAreSpies,项目名称:amsn2,代码行数:25,代码来源:chat_window.py

示例2: groupUpdated

    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,代码行数:30,代码来源:contact_list.py

示例3: __sendButton_cb

 def __sendButton_cb(self, button):
     msg = self.__input_tb.text_get(0)
     self.__input_tb.clear()
     strv = StringView()
     strv.appendText(msg)
     self._amsn_conversation.sendMessage(strv)
     self.__outputAppendMsg("/me says:\n"+msg+"\n")
开发者ID:lalitjsraks,项目名称:amsn2,代码行数:7,代码来源:chat_window.py

示例4: __switchFromPsmInput

 def __switchFromPsmInput(self, source):
     """ When in the editing state of psm, change back to the uneditable
     label state.
     """
     strv = StringView()
     strv.appendText(source.get_text())
     self._myview.psm = strv
     self.btnPsm.get_child().destroy()
     entry = self.psmlabel
     self.btnPsm.add(entry)
     entry.show()
开发者ID:JuanAntonioInfantes,项目名称:amsn2,代码行数:11,代码来源:contact_list.py

示例5: __switchFromNickInput

 def __switchFromNickInput(self, source):
     """ When in the editing state of nickname, change back to the uneditable
     label state.
     """
     strv = StringView()
     strv.appendText(source.get_text())
     self._myview.nick = strv
     self.btnNickname.get_child().destroy()
     entry = self.nicklabel
     self.btnNickname.add(entry)
     entry.show()
开发者ID:JuanAntonioInfantes,项目名称:amsn2,代码行数:11,代码来源:contact_list.py

示例6: __sendMessage

    def __sendMessage(self):
        # TODO: Switch to this when implemented
        """ msg = self.ui.inputWidget.toHtml()
        self.ui.inputWidget.clear()
        strv = StringView()
        strv.appendElementsFromHtml(msg) """

        msg = self.ui.inputWidget.toPlainText()
        self.ui.inputWidget.clear()
        strv = StringView()
        strv.appendText(unicode(msg))
        self._amsn_conversation.sendMessage(strv)
        self.ui.textEdit.append("<b>/me says:</b><br>"+unicode(msg)+"")
开发者ID:fcox,项目名称:amsn2,代码行数:13,代码来源:chat_window.py

示例7: __on_chat_send

    def __on_chat_send(self, entry, event_keyval, event_keymod):
        if event_keyval == gtk.keysyms.Return:
            buffer = entry.get_buffer()
            start, end = buffer.get_bounds()
            msg = buffer.get_text(start, end)
            entry.clear()
            entry.grab_focus()
            if msg == "":
                return False

        strv = StringView()
        strv.appendText(msg)
        self._amsn_conversation.sendMessage(strv)
开发者ID:kroogy,项目名称:amsn2,代码行数:13,代码来源:chat_window.py

示例8: __sendMessage

    def __sendMessage(self):
        # TODO: Switch to this when implemented
        """ msg = self.ui.inputWidget.toHtml()
        self.ui.inputWidget.clear()
        strv = StringView()
        strv.appendElementsFromHtml(msg) """

        msg = QString.fromUtf8(self.ui.inputWidget.toPlainText())
        self.ui.inputWidget.clear()
        strv = StringView()
        strv.appendText(str(msg))
        ## as we send our msg to the conversation:
        self._amsn_conversation.sendMessage(strv)
开发者ID:Arkael,项目名称:amsn2,代码行数:13,代码来源:chat_window.py

示例9: __sendMsg

    def __sendMsg(self, msg):
        bb = elementary.Bubble(self.parent)
        bb.label_set("TODO: MYSELF")
        bb.info_set("TODO: TIMESTAMP")
        #TODO: bb.icon_set()
        bb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
        bb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
        ab = elementary.AnchorBlock(self.parent)
        ab.text_set(msg)
        bb.content_set(ab)
        ab.show()
        self.outbx.pack_end(bb)
        bb.show()

        strv = StringView()
        strv.append_text(msg)
        self._amsn_conversation.send_message(strv)
开发者ID:Kjir,项目名称:amsn2,代码行数:17,代码来源:chat_window.py

示例10: __switchFromInput

    def __switchFromInput(self, source, isNew):
        """ When in the editing state of nickname and psm, change back
        to the uneditable label state.
        """
        if(isNew):
            if source is self.btnNickname.get_child():
                newText = source.get_text()
                strv = StringView()
                strv.appendText(newText)
                self._myview.nick = strv
            elif source is self.btnPsm.get_child():
                newText = source.get_text()
                strv = StringView()
                strv.appendText(newText)
                self._myview.psm = strv
        else:
            if source is self.btnNickname.get_child():  # User discards input
                newText = self.nicklabel.get_text()     # Old nickname
            elif source is self.btnPsm.get_child():
                newText = self.psmlabel.get_text()

        parentWidget    = source.get_parent()
        currWidget      = parentWidget.get_child()
        currWidget.disconnect(self.focusOutId)          # Else we trigger focus-out-event; segfault.

        parentWidget.remove(currWidget)
        entry = gtk.Label()
        entry.set_markup(newText)

        parentWidget.add(entry)
        entry.show()
        parentWidget.set_relief(gtk.RELIEF_NONE)        # remove cool elevated effect
开发者ID:Arkael,项目名称:amsn2,代码行数:32,代码来源:contact_list.py

示例11: group_added

    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,代码行数:22,代码来源:contact_list.py

示例12: __sendMessage

    def __sendMessage(self):
        # TODO: Switch to this when implemented
        """ msg = self.ui.inputWidget.toHtml()
        self.ui.inputWidget.clear()
        strv = StringView()
        strv.appendElementsFromHtml(msg) """

        msg = QString.fromUtf8(self.ui.inputWidget.toPlainText())
        self.ui.inputWidget.clear()
        color = self.color
        hex8 = "%.2x%.2x%.2x" % ((color.red()), (color.green()), (color.blue()))
        style = papyon.TextFormat.NO_EFFECT
        info = QFontInfo(self.font)
        if info.bold(): style |= papyon.TextFormat.BOLD
        if info.italic():  style |= papyon.TextFormat.ITALIC
        if self.font.underline(): style |= papyon.TextFormat.UNDERLINE
        if self.font.strikeOut(): style |= papyon.TextFormat.STRIKETHROUGH
        font_family = str(info.family())
        format = papyon.TextFormat(font=font_family, color=hex8, style=style)
        strv = StringView()
        strv.append_text(str(msg))
        ## as we send our msg to the conversation:
        self._amsn_conversation.send_message(strv, format)
开发者ID:Khaled62,项目名称:amsn2,代码行数:23,代码来源:chat_window.py

示例13: contactUpdated

    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,代码行数:21,代码来源:contact_list.py

示例14: sendMessage

 def sendMessage(self,smL):
     if smL[0]==self._uid:
         stmess = StringView()
         stmess.appendText(smL[1])
         self._amsn_conversation.sendMessage(stmess)
     return True
开发者ID:elkiller011,项目名称:amsn2,代码行数:6,代码来源:chat_window.py

示例15: __slotChangeNick

 def __slotChangeNick(self):
     sv = StringView()
     sv.appendText(str(self.ui.nickName.text()))
     self._amsn_core._profile.client.changeNick(sv)
开发者ID:Mindflyer,项目名称:amsn2,代码行数:4,代码来源:contact_list.py


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