Exemple #1
0
    def _add_fr_line(self, username):
        '''
        Add a line to the friend scroll list.
        '''
        cadre = Cadre(DIM_FRL_CADRE, (0, 0))

        text_username = TextBox(DIM_L_USERNAME,
                                DX_L + DY_L,
                                text=username,
                                font=Font.f(45))

        button_requests = Button(DIM_L_BUTTON,
                                 POS_L_BUTTON,
                                 color=C.LIGHT_BLUE,
                                 text='Add',
                                 font=Font.f(30))

        scroll = self.get_component('s frs')

        scroll.add_line([cadre, text_username, button_requests])

        # set buttons logic
        line = scroll.get_line(-1)

        button_requests.set_logic(self._get_request_logic(line))
Exemple #2
0
    def _add_friend_line(self, username):
        '''
        Add a line to the friend scroll list.
        '''
        cadre = Cadre(DIM_CADRE_LINE, (0, 0))

        text_username = TextBox(Spec.DIM_MEDIUM_TEXT, (20, 10),
                                text=username,
                                font=Font.f(35))

        color = self._get_color_connected(username)

        form_connected = Form(DIM_CONN, POS_CONN, color)

        button_profil = Button(Spec.DIM_SMALL_BUTTON,
                               POS_PROFIL,
                               color=C.LIGHT_BLUE,
                               text="Profil",
                               font=Font.f(30))

        button_play = Button(Spec.DIM_SMALL_BUTTON,
                             POS_PLAY,
                             color=C.LIGHT_GREEN,
                             text="Play",
                             font=Font.f(30))

        notif = TextBox(Spec.DIM_NOTIF,
                        POS_NOTIF,
                        color=C.LIGHT_RED,
                        text_color=C.WHITE,
                        text='0',
                        font=Font.f(30))

        # add line
        scroll = self.get_component('s frs')

        scroll.add_line([
            cadre, text_username, form_connected, button_profil, button_play,
            notif
        ])

        # set buttons logic
        line = scroll.get_line(-1)

        button_profil.set_logic(self._get_profil_logic(line))
        button_play.set_logic(self._get_play_logic(line))

        # set notif state
        scroll.set_active_state(False, line=line, element=notif)
Exemple #3
0
    def _add_game_demand_line(self, username):
        '''
        Add a line to the game demand scroll list.
        '''
        cadre = Cadre(DIM_CADRE_LINE_DFR, (0, 0), color=C.XLIGHT_GREY)

        icon = Form(DIM_IMG,
                    POS_IMG,
                    color=C.XLIGHT_GREY,
                    surface=img_game,
                    with_font=True)

        text_username = TextBox(Spec.DIM_MEDIUM_TEXT,
                                POS_DFR_TEXT,
                                color=C.XLIGHT_GREY,
                                text=username,
                                font=Font.f(35),
                                centered=False)

        button_yes = Button(DIM_DFR_BUTT,
                            POS_YES,
                            color=C.LIGHT_GREEN,
                            surface=vu,
                            with_font=True)

        button_no = Button(DIM_DFR_BUTT,
                           POS_NO,
                           color=C.LIGHT_RED,
                           surface=cross,
                           with_font=True)

        # add line
        scroll = self.get_component('s dfrs')

        scroll.add_line([cadre, icon, text_username, button_yes, button_no])

        line = scroll.get_line(-1)

        # set buttons logic
        button_yes.set_logic(self._get_demand_game_logic(line, True))
        button_no.set_logic(self._get_demand_game_logic(line, False))