Esempio n. 1
0
    def setCurrentTurn(self, gameId, isCurrentTurn):
        '''
        Mark the label of the game indicating whether it is the players turn.
        
        
        @param gameId: Game ID of which this player has control
        @param isCurrentTurn: If True, mark the label bold.
        '''

        widget = self.games[gameId]

        box = self.notebook.get_tab_label(widget)
        label = box.get_children().pop(0)

        if isCurrentTurn:
            label.set_markup("<b>%s</b>" % label.get_text())

            #if self.optionmanager.get_default_bool_option(OPTION_SOUND_TURN, True):
            #    self.soundmanager.play(SOUND_GAME_OPTION)
            if self.optionmanager.get_default_bool_option(
                    OPTION_POPUP_TURN, True):
                p = gtkutil.Popup(title=gameId, text=_("Its your turn"))

        else:
            label.set_markup("%s" % label.get_text())
Esempio n. 2
0
 def gameOver(self):
     '''
     Game over
     
     Notify the user and then disable the buttons
     '''
     p = gtkutil.Popup(title=self.currentGameId, text=_('Game over'))
     self.leaveGame(button=None, clientLeaveGame=False)
Esempio n. 3
0
 def unpauseGame(self):
     '''
     Callback to unpause the game
     '''
     p = gtkutil.Popup(self.currentGameId, _("Game has been resumed."))
     self.saveButton.set_label(_("Save Game"))
     self.saveButton.disconnect(self.pauseHandlerId)
     self.pauseHandlerId = self.saveButton.connect("clicked",
                                                   self.doPauseGame)
Esempio n. 4
0
 def userJoinChat(self, user):
     '''
     Callback from ScrabbleClient when another user joins the chat room
     
     @param user: User joining chat
     '''
     o = manager.OptionManager()
     if not self.mainwindow.is_active():
         #if o.get_default_bool_option(constants.OPTION_SOUND_NEW_USER, True):
         #    self.mainwindow.soundmanager.play(constants.SOUND_MSG_OPTION)
         if o.get_default_bool_option(constants.OPTION_POPUP_NEW_USER, True):
             p = gtkutil.Popup( title=user, text='%s %s' % (user, lookup.SERVER_MESSAGE_LOOKUP[lookup.LOGGED_IN]))
     
     self.userList.append( [user] )
Esempio n. 5
0
    def pauseGame(self):
        '''
        Callback to pause the game
        '''

        self.startButton.hide()
        self.saveButton.set_sensitive(
            True)  #Enable save button, game is started

        p = gtkutil.Popup(self.currentGameId, _("Game is saved."))
        self.saveButton.set_label(_("Resume Game"))
        self.saveButton.disconnect(self.pauseHandlerId)
        self.pauseHandlerId = self.saveButton.connect("clicked",
                                                      self.doUnpauseGame)
        self.board.deactivate()
Esempio n. 6
0
    def notifyPrivateMessage(self, username):
        '''
        Notify the chat window that a message has been posted.
        
        If the window is not in focus, bold the label
        '''
        if self.notebook.page_num(
                self.messages[username]) != self.notebook.get_current_page():
            box = self.notebook.get_tab_label(self.messages[username])
            label = box.get_children().pop(0)
            label.set_markup("<b>%s</b>" % label.get_text())

        if not self.is_active():
            #if self.optionmanager.get_default_bool_option(OPTION_SOUND_MSG, True):
            #    self.soundmanager.play(SOUND_MSG_OPTION)
            if self.optionmanager.get_default_bool_option(
                    OPTION_POPUP_MSG, True):
                p = gtkutil.Popup(title=username,
                                  text=_("You have a new private message."))