source/client/LiverpoolButtons.py
def ClickedButton(hand_view, pos):
    """  Carry out action after mouse clicked on button. """
    if hand_view.pickup_pile_sz > 0:
        if hand_view.pickup_pile.isOver(pos):
            hand_view.controller.pickUpPile(notes[0])
    if hand_view.draw_pile.isOver(pos):
        if hand_view.pickup_pile_sz > 0:
            hand_view.controller.drawWithBuyOption()  # use different method for Liverpool than HandAndFoot
        else:
            hand_view.controller.draw()              # unless pile is empty (at start of each round)
    elif hand_view.sort_al_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[2])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_ah_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[1])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_suit_al_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[4])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_suit_ah_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[3])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_status_btn.isOver(pos):
        hand_view.hand_info.sort(
            key=lambda wc: (wc.img_clickable.x + (wc.status * UIC.Disp_Width))
        )
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.play_prepared_cards_btn.isOver(pos):
        hand_view.controller.sharedBoardPrepAndPlay(hand_view.visible_scards)
    elif hand_view.clear_prepared_cards_btn.isOver(pos):
        hand_view.controller.clearPreparedCards()
        hand_view.hand_info = HandManagement.ClearPreparedCardsInHandView(hand_view.hand_info)
    elif hand_view.clear_selected_cards_btn.isOver(pos):
        HandManagement.ClearSelectedCards(hand_view.hand_info)
    elif hand_view.discard_action_btn.isOver(pos):
        discard_list = hand_view.gatherSelected()
        hand_view.discard_confirm = hand_view.discardConfirmation(hand_view.discard_confirm, discard_list)
    elif hand_view.heart_btn.isOver(pos):
        hand_view.controller.note = "Believe in the heart of the cards " + str(u"\u2665")
    # following two buttons only appear at beginning of round, used to notify server ready to begin round.
    elif hand_view.controller._state.round == -1 and hand_view.ready_yes_btn.isOver(pos):
        hand_view.controller.setReady(True)
        hand_view.last_round_hand = hand_view.hand_info
        hand_view.hand_info = []
        hand_view.ready_color_idx = 6  # color of outline will be: UIC.outline_colors(ready_color_idx)
        hand_view.not_ready_color_idx = 8  # color of outline will be: UIC.outline_colors(not_ready_color_idx)
    elif hand_view.controller._state.round == -1 and hand_view.ready_no_btn.isOver(pos):
        hand_view.controller.setReady(False)
        # if you don't want last round's hand to reappear, then
        # comment out line about 7 lines above this where hand_view.last_round_hand is defined
        hand_view.hand_info = hand_view.last_round_hand
        hand_view.ready_color_idx = 2  # color of outline will be: UIC.outline_colors(ready_color_idx)
        hand_view.not_ready_color_idx = 6  # color of outline will be: UIC.outline_colors(not_ready_color_idx)
    elif not hand_view.need_updated_buttons:
        #  loop through all the buttons which prepare cards by assigning them to a particular run or set
        for idx in range(len(hand_view.assign_cards_btns)):
            for jdx in range(hand_view.buttons_per_player):
                if hand_view.assign_cards_btns[idx][jdx].isOver(pos):
                    # put all selected cards in a list
                    hand_view.wr_crds_to_prep = hand_view.gatherSelected()
                    hand_view.controller.assignCardsToGroup((idx,jdx), hand_view.wr_crds_to_prep)
                    hand_view.prepped_cards = hand_view.controller.getPreparedCards()
                    for wrappedcard in hand_view.wr_crds_to_prep:
                        if wrappedcard.card in hand_view.prepped_cards:
                            wrappedcard.status = 2
                            wrappedcard.img_clickable.changeOutline(4)
    return
  Carry out action after mouse clicked on button. 
Carry out action after mouse clicked on button.
Carry out action after mouse clicked on button .
def ClickedButton(hand_view, pos):
    if hand_view.pickup_pile_sz > 0:
        if hand_view.pickup_pile.isOver(pos):
            hand_view.controller.pickUpPile(notes[0])
    if hand_view.draw_pile.isOver(pos):
        if hand_view.pickup_pile_sz > 0:
            hand_view.controller.drawWithBuyOption()  
        else:
            hand_view.controller.draw()              
    elif hand_view.sort_al_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[2])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_ah_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[1])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_suit_al_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[4])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_suit_ah_btn.isOver(pos):
        hand_view.hand_info.sort(key=lambda wc: wc.key[3])
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.sort_status_btn.isOver(pos):
        hand_view.hand_info.sort(
            key=lambda wc: (wc.img_clickable.x + (wc.status * UIC.Disp_Width))
        )
        hand_view.hand_info = HandManagement.RefreshXY(hand_view, hand_view.hand_info)
    elif hand_view.play_prepared_cards_btn.isOver(pos):
        hand_view.controller.sharedBoardPrepAndPlay(hand_view.visible_scards)
    elif hand_view.clear_prepared_cards_btn.isOver(pos):
        hand_view.controller.clearPreparedCards()
        hand_view.hand_info = HandManagement.ClearPreparedCardsInHandView(hand_view.hand_info)
    elif hand_view.clear_selected_cards_btn.isOver(pos):
        HandManagement.ClearSelectedCards(hand_view.hand_info)
    elif hand_view.discard_action_btn.isOver(pos):
        discard_list = hand_view.gatherSelected()
        hand_view.discard_confirm = hand_view.discardConfirmation(hand_view.discard_confirm, discard_list)
    elif hand_view.heart_btn.isOver(pos):
        hand_view.controller.note = "Believe in the heart of the cards " + str(u"\u2665")
    elif hand_view.controller._state.round == -1 and hand_view.ready_yes_btn.isOver(pos):
        hand_view.controller.setReady(True)
        hand_view.last_round_hand = hand_view.hand_info
        hand_view.hand_info = []
        hand_view.ready_color_idx = 6  
        hand_view.not_ready_color_idx = 8  
    elif hand_view.controller._state.round == -1 and hand_view.ready_no_btn.isOver(pos):
        hand_view.controller.setReady(False)
        hand_view.hand_info = hand_view.last_round_hand
        hand_view.ready_color_idx = 2  
        hand_view.not_ready_color_idx = 6  
    elif not hand_view.need_updated_buttons:
        for idx in range(len(hand_view.assign_cards_btns)):
            for jdx in range(hand_view.buttons_per_player):
                if hand_view.assign_cards_btns[idx][jdx].isOver(pos):
                    hand_view.wr_crds_to_prep = hand_view.gatherSelected()
                    hand_view.controller.assignCardsToGroup((idx,jdx), hand_view.wr_crds_to_prep)
                    hand_view.prepped_cards = hand_view.controller.getPreparedCards()
                    for wrappedcard in hand_view.wr_crds_to_prep:
                        if wrappedcard.card in hand_view.prepped_cards:
                            wrappedcard.status = 2
                            wrappedcard.img_clickable.changeOutline(4)
    return
def ClickedButton ( hand_view , pos ) : if hand_view . pickup_pile_sz > 0 : if hand_view . pickup_pile . isOver ( pos ) : hand_view . controller . pickUpPile ( notes [ 0 ] ) if hand_view . draw_pile . isOver ( pos ) : if hand_view . pickup_pile_sz > 0 : hand_view . controller . drawWithBuyOption ( ) else : hand_view . controller . draw ( ) elif hand_view . sort_al_btn . isOver ( pos ) : hand_view . hand_info . sort ( key = lambda wc : wc . key [ 2 ] ) hand_view . hand_info = HandManagement . RefreshXY ( hand_view , hand_view . hand_info ) elif hand_view . sort_ah_btn . isOver ( pos ) : hand_view . hand_info . sort ( key = lambda wc : wc . key [ 1 ] ) hand_view . hand_info = HandManagement . RefreshXY ( hand_view , hand_view . hand_info ) elif hand_view . sort_suit_al_btn . isOver ( pos ) : hand_view . hand_info . sort ( key = lambda wc : wc . key [ 4 ] ) hand_view . hand_info = HandManagement . RefreshXY ( hand_view , hand_view . hand_info ) elif hand_view . sort_suit_ah_btn . isOver ( pos ) : hand_view . hand_info . sort ( key = lambda wc : wc . key [ 3 ] ) hand_view . hand_info = HandManagement . RefreshXY ( hand_view , hand_view . hand_info ) elif hand_view . sort_status_btn . isOver ( pos ) : hand_view . hand_info . sort ( key = lambda wc : ( wc . img_clickable . x + ( wc . status * UIC . Disp_Width ) ) ) hand_view . hand_info = HandManagement . RefreshXY ( hand_view , hand_view . hand_info ) elif hand_view . play_prepared_cards_btn . isOver ( pos ) : hand_view . controller . sharedBoardPrepAndPlay ( hand_view . visible_scards ) elif hand_view . clear_prepared_cards_btn . isOver ( pos ) : hand_view . controller . clearPreparedCards ( ) hand_view . hand_info = HandManagement . ClearPreparedCardsInHandView ( hand_view . hand_info ) elif hand_view . clear_selected_cards_btn . isOver ( pos ) : HandManagement . ClearSelectedCards ( hand_view . hand_info ) elif hand_view . discard_action_btn . isOver ( pos ) : discard_list = hand_view . gatherSelected ( ) hand_view . discard_confirm = hand_view . discardConfirmation ( hand_view . discard_confirm , discard_list ) elif hand_view . heart_btn . isOver ( pos ) : hand_view . controller . note = "Believe in the heart of the cards " + str ( u"\u2665" ) elif hand_view . controller . _state . round == - 1 and hand_view . ready_yes_btn . isOver ( pos ) : hand_view . controller . setReady ( True ) hand_view . last_round_hand = hand_view . hand_info hand_view . hand_info = [ ] hand_view . ready_color_idx = 6 hand_view . not_ready_color_idx = 8 elif hand_view . controller . _state . round == - 1 and hand_view . ready_no_btn . isOver ( pos ) : hand_view . controller . setReady ( False ) hand_view . hand_info = hand_view . last_round_hand hand_view . ready_color_idx = 2 hand_view . not_ready_color_idx = 6 elif not hand_view . need_updated_buttons : for idx in range ( len ( hand_view . assign_cards_btns ) ) : for jdx in range ( hand_view . buttons_per_player ) : if hand_view . assign_cards_btns [ idx ] [ jdx ] . isOver ( pos ) : hand_view . wr_crds_to_prep = hand_view . gatherSelected ( ) hand_view . controller . assignCardsToGroup ( ( idx , jdx ) , hand_view . wr_crds_to_prep ) hand_view . prepped_cards = hand_view . controller . getPreparedCards ( ) for wrappedcard in hand_view . wr_crds_to_prep : if wrappedcard . card in hand_view . prepped_cards : wrappedcard . status = 2 wrappedcard . img_clickable . changeOutline ( 4 ) return
Carry out action after mouse clicked on button.
Carry out action after mouse clicked on button .
"""  Carry out action after mouse clicked on button. """ # use different method for Liverpool than HandAndFoot # unless pile is empty (at start of each round) # following two buttons only appear at beginning of round, used to notify server ready to begin round. # color of outline will be: UIC.outline_colors(ready_color_idx) # color of outline will be: UIC.outline_colors(not_ready_color_idx) # if you don't want last round's hand to reappear, then # comment out line about 7 lines above this where hand_view.last_round_hand is defined # color of outline will be: UIC.outline_colors(ready_color_idx) # color of outline will be: UIC.outline_colors(not_ready_color_idx) #  loop through all the buttons which prepare cards by assigning them to a particular run or set # put all selected cards in a list
hand_view
pos