Ejemplo n.º 1
0
class LoginPageBaseModel(page_base.PageModel):
    """Common page model for the login page.
    """
    username = elements.TextInput(byset=by.By.ID, locator='username')
    password = elements.PasswordInput(byset=by.By.ID, locator='password')
    domain = elements.Select(byset=by.By.ID, locator='profile')
    login_btn = elements.Button(byset=by.By.CLASS_NAME, locator='btn-lg')
    page_body = elements.PageElement(by.By.TAG_NAME, 'body')
    msg_login_failed = ('Login failed. Please verify your login '
                        'information or contact the system administrator.')
    msg_login_failed2 = 'The user name or password is incorrect.'
Ejemplo n.º 2
0
class RemoveConfirmDlgModel(OkCancelDlgModel):
    """Page model for common removal confirmation dialog.
    """
    ok_btn = elements.Button(by.By.ID, 'RemoveConfirmationPopupView_OnRemove')
    cancel_btn = elements.Button(by.By.ID,
                                 'RemoveConfirmationPopupView_Cancel')
Ejemplo n.º 3
0
    def __init__(self, w, h):
        """

        Args:
            w (int): width of the screen.
            h (int): height of the screen.
        """
        # create buttons` functions

        # create screen elements
        self.container = elements.Container(0.180729 * w,
                                            0.312963 * h,
                                            0.625000 * w,
                                            0.375000 * h,
                                            color=colors.GRAY235,
                                            border_color=colors.GRAY92,
                                            border_size=0.001852 * h)

        self.title = elements.Text(0.192708 * w, 0.324074 * h, 'Game',
                                   assets.Font_Segoe_UI_Semilight,
                                   0.050925 * h, colors.GRAY66)

        text = "You successfully connected to the server.\n" \
               "Press start to spawn into the game and start playing.\n" \
               "Press exit to close the game."
        self.text = elements.Text(0.192708 * w, 0.393519 * h, text,
                                  assets.Font_Segoe_UI_Light, 0.046296 * h,
                                  colors.GRAY92)

        self.join_button = elements.Button(
            0.192708 * w,
            0.597222 * h,
            0.476042 * w,
            0.070370 * h,
            text='start',
            text_color=colors.GRAY92,
            regular=colors.GREEN_FL,
            hover=colors.GREEN_FLST,
            click=colors.GREEN_FLSTDE,
            font_name=assets.Font_Segoe_UI_Light,
            font_size=0.050926 * h)

        self.cancel_button = elements.Button(0.677083 * w,
                                             0.597222 * h,
                                             0.107292 * w,
                                             0.070370 * h,
                                             'exit',
                                             text_color=colors.GRAY235,
                                             regular=colors.RED68,
                                             hover=colors.RED54,
                                             click=colors.RED38,
                                             font_name=assets.primary_font,
                                             font_size=0.044444 * h)

        self.line = elements.Line(0.192708 * w,
                                  0.396296 * h,
                                  0.789583 * w,
                                  0.396296 * h,
                                  width=0.001852 * h,
                                  color=colors.GRAY173)

        # set rerendering
        self.join_button.need_rerender = True
        self.cancel_button.need_rerender = True

        # set update

        # set event handling
        self.join_button.need_events = True
        self.cancel_button.need_events = True

        # set closing

        # create subwindows

        # assign buttons their function

        # initialize variables
        super(GameStartSubwindow, self).__init__()

        # add screen elements to the elements array
        self.elements_objs.append(self.container)
        self.elements_objs.append(self.title)
        self.elements_objs.append(self.line)
        self.elements_objs.append(self.text)
        self.elements_objs.append(self.join_button)
        self.elements_objs.append(self.cancel_button)
Ejemplo n.º 4
0
    def __init__(self, w, h):
        """

        Args:
            w (int): width of the screen.
            h (int): height of the screen.
        """
        # create buttons` functions

        # create screen elements
        self.background = elements.Image(0,
                                         0,
                                         assets.primary_bg,
                                         scale=w / 1920.0)

        self.container = elements.Container(0.187500 * w,
                                            0.296296 * h,
                                            0.625000 * w,
                                            0.462963 * h,
                                            color=colors.GRAY235,
                                            border_color=colors.GRAY92,
                                            border_size=0.001852 * h)

        self.title = elements.Text(0.200000 * w, 0.305556 * h,
                                   'Multiplayer Connection',
                                   assets.Font_Segoe_UI_Semilight,
                                   0.050925 * h, colors.GRAY66)

        text = 'Please enter the server`s IP in the input box below.\n' \
               'Make sure the server is in your LAN or can be accessed\n' \
               'from the internet.'
        self.text = elements.Text(0.200000 * w, 0.376852 * h, text,
                                  assets.Font_Segoe_UI_Light, 0.046296 * h,
                                  colors.GRAY92)

        self.join_button = elements.Button(
            0.200000 * w,
            0.663889 * h,
            0.476042 * w,
            0.070370 * h,
            text='join',
            text_color=colors.GRAY92,
            regular=colors.GREEN_FL,
            hover=colors.GREEN_FLST,
            click=colors.GREEN_FLSTDE,
            font_name=assets.Font_Segoe_UI_Light,
            font_size=0.050926 * h)

        self.cancel_button = elements.Button(0.684375 * w,
                                             0.663889 * h,
                                             0.107292 * w,
                                             0.070370 * h,
                                             'cancel',
                                             text_color=colors.GRAY235,
                                             regular=colors.RED68,
                                             hover=colors.RED54,
                                             click=colors.RED38,
                                             font_name=assets.primary_font,
                                             font_size=0.044444 * h)

        self.line = elements.Line(0.200000 * w,
                                  0.379630 * h,
                                  0.770833 * w,
                                  0.379630 * h,
                                  width=0.001852 * h,
                                  color=colors.GRAY173)

        self.inputbox = elements.InputBox(0.200000 * w,
                                          0.571296 * h,
                                          0.592708 * w,
                                          0.070370 * h,
                                          'server`s ip',
                                          base_color=colors.GRAY235,
                                          active_color=colors.BLUE,
                                          inactive_color=colors.GRAY92,
                                          active_tcolor=colors.FLAT_BLUE,
                                          inactive_tcolor=colors.GRAY215,
                                          font_name=assets.primary_font,
                                          font_size=0.044444 * h,
                                          border_size=0.001852 * h)

        # set rerendering
        self.join_button.need_rerender = True
        self.cancel_button.need_rerender = True
        self.inputbox.need_rerender = True

        # set update

        # set event handling
        self.join_button.need_events = True
        self.cancel_button.need_events = True
        self.inputbox.need_events = True

        # set closing

        # create subwindows

        # assign buttons their function

        # initialize variables
        super(MultiplayerConnection, self).__init__()

        # add screen elements to the elements array
        self.elements_objs.append(self.background)
        self.elements_objs.append(self.container)
        self.elements_objs.append(self.title)
        self.elements_objs.append(self.line)
        self.elements_objs.append(self.text)
        self.elements_objs.append(self.inputbox)
        self.elements_objs.append(self.join_button)
        self.elements_objs.append(self.cancel_button)
Ejemplo n.º 5
0
    def __init__(self, w, h):
        """

        Args:
            w (int): width of the screen.
            h (int): height of the screen.
        """
        # create buttons` functions

        # create screen elements
        self.container = elements.Container(0.338541 * w,
                                            0.372222 * h,
                                            0.625 * w,
                                            0.447222 * h,
                                            color=colors.GRAY235,
                                            border_color=colors.GRAY92,
                                            border_size=0.001852 * h)

        self.title = elements.Text(0.348958 * w, 0.384259 * h, 'Multiplayer',
                                   assets.Font_Segoe_UI_Semilight,
                                   0.050925 * h, colors.GRAY66)

        text = 'This will start a multiplaer type game.\nIn this mode the ' \
               'player faces another human\nplayers. In this mode ' \
               'INTERNET CONNECTION IS\nNEEDED to play in this mode. '
        self.text = elements.Text(0.348958 * w, 0.472222 * h, text,
                                  assets.Font_Segoe_UI_Light, 0.046296 * h,
                                  colors.GRAY92)

        self.start_button = elements.Button(
            0.348958 * w,
            0.731481 * h,
            0.296875 * w,
            0.070370 * h,
            text='start',
            text_color=colors.GRAY92,
            regular=colors.GREEN_FL,
            hover=colors.GREEN_FLST,
            click=colors.GREEN_FLSTDE,
            font_name=assets.Font_Segoe_UI_Light,
            font_size=0.050926 * h)

        self.connect_button = elements.Button(
            0.656250 * w,
            0.731481 * h,
            0.296875 * w,
            0.070370 * h,
            text='connect',
            text_color=colors.GRAY92,
            regular=colors.GREEN_FL,
            hover=colors.GREEN_FLST,
            click=colors.GREEN_FLSTDE,
            font_name=assets.Font_Segoe_UI_Light,
            font_size=0.050926 * h)

        self.line = elements.Line(0.348958 * w,
                                  0.46 * h,
                                  0.947917 * w,
                                  0.46 * h,
                                  width=0.001852 * h,
                                  color=colors.GRAY173)

        # set rerendering
        self.connect_button.need_rerender = True
        self.start_button.need_rerender = True

        # set update

        # set event handling
        self.connect_button.need_events = True
        self.start_button.need_events = True

        # set closing

        # create subwindows

        # assign buttons their function

        # initialize variables
        super(MultiplayerInfo, self).__init__()

        # add screen elements to the elements array
        self.elements_objs.append(self.container)
        self.elements_objs.append(self.line)
        self.elements_objs.append(self.title)
        self.elements_objs.append(self.text)
        self.elements_objs.append(self.connect_button)
        self.elements_objs.append(self.start_button)
Ejemplo n.º 6
0
    def __init__(self, w, h):
        """

        Args:
            w (int): width of the screen.
            h (int): height of the screen.
        """

        # create buttons` functions
        def stop_running():
            """

            Returns:
                None
            """
            ctrlVars.running = False

        def show_singleplayer_win():
            """

            Returns:
                None
            """
            self.set_actives(self.singleplayer_win)

        def show_multiplayer_win():
            """

            Returns:
                None
            """
            self.set_actives(self.multiplayer_win)

        # create screen elements
        self.background = elements.Image(0,
                                         0,
                                         assets.primary_bg,
                                         scale=w / 1920.0)

        self.button_singleplayer = elements.Button(
            0.044270 * w,
            0.553703 * h,
            0.271354 * w,
            0.070370 * h,
            'singleplayer',
            text_color=colors.GRAY235,
            regular=colors.GRAY92,
            hover=colors.BLUE,
            click=colors.BLUE_BASIC,
            font_name=assets.primary_font,
            font_size=0.044444 * h,
            fnc=show_singleplayer_win)

        self.button_multiplayer = elements.Button(
            0.044270 * w,
            0.642592 * h,
            0.271354 * w,
            0.070370 * h,
            'multiplayer',
            text_color=colors.GRAY235,
            regular=colors.GRAY92,
            hover=colors.BLUE,
            click=colors.BLUE_BASIC,
            font_name=assets.primary_font,
            font_size=0.044444 * h,
            fnc=show_multiplayer_win)

        self.button_exit = elements.Button(0.044270 * w,
                                           0.731481 * h,
                                           0.271354 * w,
                                           0.070370 * h,
                                           'exit',
                                           text_color=colors.GRAY235,
                                           regular=colors.RED68,
                                           hover=colors.RED54,
                                           click=colors.RED38,
                                           fnc=stop_running,
                                           font_name=assets.primary_font,
                                           font_size=0.044444 * h)

        self.inputbox = elements.InputBox(0.034375 * w,
                                          0.372222 * h,
                                          0.291145 * w,
                                          0.075 * h,
                                          'nickname',
                                          base_color=colors.GRAY235,
                                          active_color=colors.BLUE,
                                          inactive_color=colors.GRAY92,
                                          active_tcolor=colors.FLAT_BLUE,
                                          inactive_tcolor=colors.GRAY215,
                                          font_name=assets.primary_font,
                                          font_size=0.044444 * h,
                                          border_size=0.001852 * h)

        self.buttons_container = elements.Container(0.034375 * w,
                                                    0.469444 * h,
                                                    0.291145 * w,
                                                    0.350925 * h,
                                                    color=colors.GRAY235,
                                                    border_color=colors.GRAY92,
                                                    border_size=0.001852 * h)

        self.game_text = elements.Text(0.103125 * w, 0.473148 * h,
                                       'Join a Game', assets.primary_font_bold,
                                       0.050925 * h, colors.GRAY92)

        self.name_text = elements.Text(0.034375 * w, 0.078703 * h,
                                       'Slither.all', assets.Font_Segoe_Script,
                                       0.185185 * h, colors.GRAY235)

        # set rerendering
        self.button_singleplayer.need_rerender = True
        self.button_multiplayer.need_rerender = True
        self.button_exit.need_rerender = True
        self.inputbox.need_rerender = True

        # set update

        # set event handling
        self.button_singleplayer.need_events = True
        self.button_multiplayer.need_events = True
        self.button_exit.need_events = True
        self.inputbox.need_events = True

        # set closing

        # create subwindows
        self.singleplayer_win = SingleplayerInfo(w, h)
        self.multiplayer_win = MultiplayerInfo(w, h)

        # assign buttons their function

        # initialize variables
        super(PrimaryScreen, self).__init__()

        # add screen elements to the elements array
        self.elements_objs.append(self.background)
        self.elements_objs.append(self.buttons_container)
        self.elements_objs.append(self.button_singleplayer)
        self.elements_objs.append(self.button_multiplayer)
        self.elements_objs.append(self.button_exit)
        self.elements_objs.append(self.inputbox)
        self.elements_objs.append(self.game_text)
        self.elements_objs.append(self.name_text)

        # add sub windows to windows array
        self.windows_objs.append(self.singleplayer_win)
        self.windows_objs.append(self.multiplayer_win)

        # set active sub windows
        self.set_actives()
Ejemplo n.º 7
0
                               font_name="Montserrat ExtraLight",
                               font_size=80,
                               x=width / 2,
                               y=height - height / 2.8,
                               anchor_x="center",
                               anchor_y="center")
score_label = pyglet.text.Label("",
                                font_name="Century Gothic",
                                font_size=140,
                                x=width / 2,
                                y=height / 2.2,
                                anchor_x="center",
                                anchor_y="center")

# BUTTON OBJECTS TO BE DISPLAYED IN THE OFF-GAME SCREENS
playbutton = elements.Button("Title_Play", width / 2, height / 1.92)
nextpage = elements.Button("Next", width / 2, height / 6)
nextchoice = elements.Button("Right_Arrow", width / 1.18, height / 2.7)
previouschoice = elements.Button("Left_Arrow", width / 7, height / 2.7)
easydiff = elements.Button("Easy", width / 2, height / 2.85)
mediumdiff = elements.Button("Medium", width / 2, height / 2.85)
harddiff = elements.Button("Hard", width / 2, height / 2.85)
yeschoice = elements.Button("Yes", width / 1.4, height // 5)
nochoice = elements.Button("No", width / 3.8, height // 5)
diffselect = elements.Button("Select_Diff", width / 2, height // 6)
exitbutton = elements.Button("Exit", width / 2, height // 5)

# GAMETIMER OBJECTS TO BE DISPLAYED DURING THE GAME
easytime = elements.GameTimer(1, 30)
mediumtime = elements.GameTimer(1, 00)
hardtime = elements.GameTimer(0, 30)