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


Python InfoBar.InfoBarMessage类代码示例

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


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

示例1: offerError

    def offerError(self, offer, error):
        log.debug("Human.offerError: self=%s error=%s %s" %
                  (self, error, offer))
        assert offer.type in ACTION_NAMES
        actionName = ACTION_NAMES[offer.type]
        if error == ACTION_ERROR_NONE_TO_ACCEPT:
            heading = _("Unable to accept %s") % actionName.lower()
            text = _("Probably because it has been withdrawn.")
        elif error == ACTION_ERROR_NONE_TO_DECLINE or \
                error == ACTION_ERROR_NONE_TO_WITHDRAW:
            # If the offer was not there, it has probably already been either
            # declined or withdrawn.
            return
        else:
            heading = _("%s returns an error") % actionName
            text = ERROR_MESSAGES[error]

        content = InfoBar.get_message_content(heading, text,
                                              Gtk.STOCK_DIALOG_WARNING)

        def response_cb(infobar, response, message):
            message.dismiss()

        message = InfoBarMessage(Gtk.MessageType.WARNING, content, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.gmwidg.showMessage(message)
开发者ID:TPNguyen,项目名称:pychess,代码行数:27,代码来源:Human.py

示例2: response_cb

 def response_cb (infobar, response, message):
     if response == gtk.RESPONSE_ACCEPT:
         #self.emit("offer", offer)
     message.dismiss()
 message = InfoBarMessage(gtk.MESSAGE_INFO, content, response_cb)
 message.add_button(InfoBarMessageButton(_("Resend"), gtk.RESPONSE_ACCEPT))
 message.add_button(InfoBarMessageButton(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL))
 self._show_message(message)
开发者ID:btrent,项目名称:knave,代码行数:8,代码来源:Human.py

示例3: hurry

 def hurry (self):
     title = _("Your opponent asks you to hurry!")
     text = _("Generally this means nothing, as the game is time-based, but if you want to please your opponent, perhaps you should get going.")
     content = InfoBar.get_message_content(title, text, Gtk.STOCK_DIALOG_INFO)
     def response_cb (infobar, response, message):
         message.dismiss()
     message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
     message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE, Gtk.ResponseType.CANCEL))
     self.gmwidg.showMessage(message)
开发者ID:sally0813,项目名称:pychess,代码行数:9,代码来源:Human.py

示例4: offerWithdrawn

 def offerWithdrawn (self, offer):
     log.debug("Human.offerWithdrawn: self=%s %s" % (self, offer))
     assert offer.type in ACTION_NAMES
     heading = _("%s was withdrawn by your opponent") % ACTION_NAMES[offer.type]
     text = _("Your opponent seems to have changed their mind.")
     content = InfoBar.get_message_content(heading, text, Gtk.STOCK_DIALOG_INFO)
     def response_cb (infobar, response, message):
         message.dismiss()
     message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
     message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE, Gtk.ResponseType.CANCEL))
     self.gmwidg.showMessage(message)
开发者ID:sally0813,项目名称:pychess,代码行数:11,代码来源:Human.py

示例5: our_seeks_removed

    def our_seeks_removed(self, glm):
        label = Gtk.Label(label=_("Your seeks have been removed"))

        def response_cb(infobar, response, message):
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.INFO, label, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages.append(message)
        self.infobar.push_message(message)
开发者ID:leogregianin,项目名称:pychess,代码行数:12,代码来源:__init__.py

示例6: nonoWhileExamine

    def nonoWhileExamine(self, bm):
        label = Gtk.Label(_("You can't touch this! You are examining a game."))

        def response_cb(infobar, response, message):
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.INFO, label, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages.append(message)
        self.infobar.push_message(message)
开发者ID:leogregianin,项目名称:pychess,代码行数:12,代码来源:__init__.py

示例7: player_lagged

 def player_lagged (self, bm, player):
     if player in self.gamemodel.ficsplayers:
         content = get_infobarmessage_content(player,
                                              _(" has lagged for 30 seconds"),
                                              self.gamemodel.ficsgame.game_type)
         def response_cb (infobar, response, message):
             message.dismiss()
             return False
         message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
         message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                 Gtk.ResponseType.CANCEL))
         self.showMessage(message)
     return False
开发者ID:sally0813,项目名称:pychess,代码行数:13,代码来源:gamewidget.py

示例8: player_on_noplay

    def player_on_noplay(self, bm, player):
        text = _(" noplay listing you")
        content = get_infobarmessage_content(player, text)

        def response_cb(infobar, response, message):
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages.append(message)
        self.infobar.push_message(message)
开发者ID:leogregianin,项目名称:pychess,代码行数:13,代码来源:__init__.py

示例9: matchDeclined

    def matchDeclined(self, bm, player):
        text = _(" has declined your offer for a match")
        content = get_infobarmessage_content(player, text)

        def response_cb(infobar, response, message):
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages.append(message)
        self.infobar.push_message(message)
开发者ID:leogregianin,项目名称:pychess,代码行数:13,代码来源:__init__.py

示例10: offerDeclined

 def offerDeclined (self, offer):
     log.debug("Human.offerDeclined: self=%s %s" % (self, offer))
     assert offer.type in ACTION_NAMES
     heading = _("%s was declined by your opponent") % ACTION_NAMES[offer.type]
     text = _("Resend %s?" % ACTION_NAMES[offer.type].lower())
     content = InfoBar.get_message_content(heading, text, Gtk.STOCK_DIALOG_INFO)
     def response_cb (infobar, response, message):
         if response == Gtk.ResponseType.ACCEPT:
             self.emit("offer", offer)
         message.dismiss()
     message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
     message.add_button(InfoBarMessageButton(_("Resend"), Gtk.ResponseType.ACCEPT))
     message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE, Gtk.ResponseType.CANCEL))
     self.gmwidg.showMessage(message)
开发者ID:sally0813,项目名称:pychess,代码行数:14,代码来源:Human.py

示例11: req_not_fit_formula

    def req_not_fit_formula(self, bm, player, formula):
        content = get_infobarmessage_content2(
            player, _(" uses a formula not fitting your match request:"),
            formula)

        def response_cb(infobar, response, message):
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages.append(message)
        self.infobar.push_message(message)
开发者ID:leogregianin,项目名称:pychess,代码行数:14,代码来源:__init__.py

示例12: opp_not_out_of_time

 def opp_not_out_of_time (self, bm):
     if self.gamemodel.remote_player.time <= 0:
         content = get_infobarmessage_content2(
             self.gamemodel.remote_ficsplayer,
             _(" is lagging heavily but hasn't disconnected"),
             _("Continue to wait for opponent, or try to adjourn the game?"),
             gametype=self.gamemodel.ficsgame.game_type)
         def response_cb (infobar, response, message):
             if response == 2:
                 self.gamemodel.connection.client.run_command("adjourn")
             message.dismiss()
             return False
         message = InfoBarMessage(Gtk.MessageType.QUESTION, content, response_cb)
         message.add_button(InfoBarMessageButton(_("Wait"), Gtk.ResponseType.CANCEL))
         message.add_button(InfoBarMessageButton(_("Adjourn"), 2))
         self.showMessage(message)
     return False
开发者ID:sally0813,项目名称:pychess,代码行数:17,代码来源:gamewidget.py

示例13: offer

    def offer(self, offer):
        log.debug("Human.offer: self=%s %s" % (self, offer))
        assert offer.type in OFFER_MESSAGES

        if self.gamemodel.players[1 - self.color].__type__ is LOCAL:
            self.emit("accept", offer)
            return

        heading, text, takes_param = OFFER_MESSAGES[offer.type]
        if takes_param:
            param = offer.param
            if offer.type == TAKEBACK_OFFER and \
                    self.gamemodel.players[1 - self.color].__type__ != REMOTE:
                param = self.gamemodel.ply - offer.param
            heading = heading % param
            text = text % param

        def response_cb(infobar, response, message):
            if response == Gtk.ResponseType.ACCEPT:
                self.emit("accept", offer)
            elif response == Gtk.ResponseType.NO:
                self.emit("decline", offer)
            message.dismiss()

        content = InfoBar.get_message_content(heading, text,
                                              Gtk.STOCK_DIALOG_QUESTION)
        message = InfoBarMessage(Gtk.MessageType.QUESTION, content,
                                 response_cb)
        message.add_button(InfoBarMessageButton(
            _("Accept"), Gtk.ResponseType.ACCEPT))
        message.add_button(InfoBarMessageButton(
            _("Decline"), Gtk.ResponseType.NO))
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.gmwidg.showMessage(message)
开发者ID:TPNguyen,项目名称:pychess,代码行数:35,代码来源:Human.py

示例14: on_seek_updated

    def on_seek_updated(self, glm, message_text):
        if "manual accept" in message_text:
            message_text.replace("to manual accept", _("to manual accept"))
        elif "automatic accept" in message_text:
            message_text.replace("to automatic accept",
                                 _("to automatic accept"))
        if "rating range now" in message_text:
            message_text.replace("rating range now", _("rating range now"))
        label = Gtk.Label(label=_("Seek updated") + ": " + message_text)

        def response_cb(infobar, response, message):
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.INFO, label, response_cb)
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages.append(message)
        self.infobar.push_message(message)
开发者ID:leogregianin,项目名称:pychess,代码行数:19,代码来源:__init__.py

示例15: onChallengeAdd

    def onChallengeAdd(self, challenges, challenge):
        log.debug("%s" % challenge,
                  extra={"task": (self.connection.username, "onChallengeAdd")})
        SoundTab.playAction("aPlayerChecks")

        # TODO: differentiate between challenges and manual-seek-accepts
        # (wait until seeks are comparable FICSSeek objects to do this)
        # Related: http://code.google.com/p/pychess/issues/detail?id=206
        if challenge.adjourned:
            text = _(" would like to resume your adjourned <b>%(time)s</b> " +
                     "<b>%(gametype)s</b> game.") % \
                {"time": challenge.display_timecontrol,
                 "gametype": challenge.game_type.display_text}
        else:
            text = _(" challenges you to a <b>%(time)s</b> %(rated)s <b>%(gametype)s</b> game") \
                % {"time": challenge.display_timecontrol,
                   "rated": challenge.display_rated.lower(),
                   "gametype": challenge.game_type.display_text}
            if challenge.color:
                text += _(" where <b>%(player)s</b> plays <b>%(color)s</b>.") \
                    % {"player": challenge.player.name,
                       "color": _("white") if challenge.color == "white" else _("black")}
            else:
                text += "."
        content = get_infobarmessage_content(challenge.player,
                                             text,
                                             gametype=challenge.game_type)

        def callback(infobar, response, message):
            if response == Gtk.ResponseType.ACCEPT:
                self.connection.om.acceptIndex(challenge.index)
            elif response == Gtk.ResponseType.NO:
                self.connection.om.declineIndex(challenge.index)
            message.dismiss()
            return False

        message = InfoBarMessage(Gtk.MessageType.QUESTION, content, callback)
        message.add_button(InfoBarMessageButton(
            _("Accept"), Gtk.ResponseType.ACCEPT))
        message.add_button(InfoBarMessageButton(
            _("Decline"), Gtk.ResponseType.NO))
        message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
                                                Gtk.ResponseType.CANCEL))
        self.messages[hash(challenge)] = message
        self.infobar.push_message(message)

        txi = self.store.prepend(
            [challenge, challenge.player.getIcon(gametype=challenge.game_type),
             self.chaPix, challenge.player.name +
             challenge.player.display_titles(), challenge.player_rating,
             challenge.display_rated, challenge.game_type.display_text,
             challenge.display_timecontrol, challenge.sortable_time,
             self.textcolor_normal(), get_challenge_tooltip_text(challenge)])
        self.challenges[hash(challenge)] = txi
        self.__updateActiveSeeksLabel()
        self.widgets["seektreeview"].scroll_to_cell(self.store.get_path(txi))
开发者ID:teacoffee2017,项目名称:pychess,代码行数:56,代码来源:SeekListPanel.py


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