def show_mainmenu(self):
     self.Form = QtWidgets.QWidget()
     self.mainmenu = Mainmenu(self.Form)
    
     self.mainmenu.listWidget.itemClicked.connect(self.mainmenu.listwidgetclicked)
     self.mainmenu.listWidget.itemClicked.connect(self.show_chat)
     self.Form.show()
Exemple #2
0
 def __init__(self):
     pyglet.resource.path = ['../img']
     pyglet.resource.reindex()
     super(Hello, self).__init__()
     self.back = back()
     self.add(self.back)
     self.main = Mainmenu()
     self.add(self.main)
     self.i = 0
Exemple #3
0
def change_game_state():
    gs = globals.game_state_label

    if gs == globals.MAIN_MENU:
        globals.game_state = Mainmenu()
    elif gs == globals.RUNNING:
        globals.game_state = Game()
    elif gs == globals.GAME_OVER:
        globals.game_state = Gameover()
Exemple #4
0
 def __init__(self,window):
     """Constructor"""
     self.window = window
     self.fps = 30
     
     #Initialize player one and player two. 
     self.playerone = Person(0,
                             575-64,
                             Characters.megaman_right.value["hp"],
                             (500-64,575-64),
                             self.window,
                             Characters.megaman_right,
                             Direction.right,
                             6,
                             Controls.WASD,
                             Characters.megaman_right.value["spd"]) 
     self.playertwo = Person(900,
                             575-64,
                             Characters.megaman_left.value["hp"],
                             (500,575-64),
                             self.window,
                             Characters.megaman_left,
                             Direction.left,
                             6,
                             Controls.OKLColon,
                             Characters.megaman_left.value["spd"])
     
     #Initialize platforms.
     self.platforms = [Platform(275,self.window,platform),
                       Platform(425,self.window,platform),
                       Platform(575,self.window,platform)]
 
     #Initialize clock
     self.clock = pygame.time.Clock()
     
     #Initialize menu
     self.menu = Mainmenu(self.window)
def main():

    #Parsing level from parameters and parsing main config:

    level_name = None
    world_index = 0
    world = World(WORLDS[world_index])

    user_supplied_level = False

    parse_config()

    getlevel = False
    
    Variables.vdict["devmode"] = False

    if len(sys.argv) > 1:
        for arg in sys.argv:
          if getlevel:
            try:
              level_name = arg
              user_supplied_level = True
              end_trigger = END_NEXT_LEVEL
              menu_choice = MENU_QUIT
            except:
              error_message("Incorrect command line parameters")
              level_name = None
          elif arg == "-l":
            getlevel = True
          elif arg == "-dev":
            Variables.vdict["devmode"] = True
            Variables.vdict["verbose"] = True            
          elif arg == "-v":
            Variables.vdict["verbose"] = True

    #Initializing pygame and screen

    pygame.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
    caption = "Which way is up?"
    if (Variables.vdict["devmode"]):
      caption = caption + " - developer mode"
    pygame.display.set_caption(caption)

    apply_fullscreen_setting(screen)

    if (pygame.joystick.get_count() > 0):
      joystick = pygame.joystick.Joystick(0)
      joystick.init()
    else:
      joystick = None

    score = Score(0)

    done = False

    if not user_supplied_level:
      if (Variables.vdict["unlocked" + WORLDS[0]] == 0): # Nothing unlocked, go straight to the game
        end_trigger = END_NEXT_LEVEL
        menu_choice = MENU_QUIT
        level_name = world.get_level()
      else:                                      # Go to the menu first
        end_trigger = END_MENU
        menu_choice = 0

    bgscreen = None

    #Menu and level changing loop, actual game code is in game.py:

    while not done:
      if end_trigger == END_NEXT_LEVEL:
        if user_supplied_level:
          end_trigger = game.run(screen, level_name, world.index, score, joystick)
          if end_trigger == END_NEXT_LEVEL:
            user_supplied_level = False
            end_trigger = END_WIN
        else:
          end_trigger = game.run(screen, level_name, world.index, score, joystick)
          if end_trigger == END_NEXT_LEVEL:
            if world.is_next_level():
              level_name = world.get_level()
            else:
              end_trigger = END_WIN
          elif end_trigger == END_QUIT:
            display_bg("quit", screen)
            end_trigger = END_MENU
            bgscreen = screen.copy()
      if end_trigger == END_LOSE:
        display_bg("lose", screen)
        end_trigger = END_MENU
        menu_choice = world.index - 1
        bgscreen = screen.copy()
      elif end_trigger == END_WIN:
        display_bg("victory", screen)
        end_trigger = END_MENU
        menu_choice = 0
        bgscreen = screen.copy()
      elif end_trigger == END_QUIT or end_trigger == END_HARD_QUIT:
        done = True
      elif end_trigger == END_MENU:
        prev_score = score.score
        prev_time = score.time
        prev_levels = score.levels
        score = Score(0)
        if prev_score != 0:
          menu = Mainmenu(screen, prev_score, world, bgscreen, prev_time, prev_levels)
        else:
          menu = Mainmenu(screen, None, world, bgscreen)
        menu_choice = menu.run(menu_choice)
        if menu_choice == MENU_QUIT:
          end_trigger = END_QUIT
        elif menu_choice == MENU_SOUND:
          Variables.vdict["sound"] = not Variables.vdict["sound"]
          end_trigger = END_MENU
        elif menu_choice == MENU_DIALOGUE:
          Variables.vdict["dialogue"] = not Variables.vdict["dialogue"]
          end_trigger = END_MENU
        elif menu_choice == MENU_FULLSCREEN:
          Variables.vdict["fullscreen"] = not Variables.vdict["fullscreen"]
          end_trigger = END_MENU
          apply_fullscreen_setting(screen)
        elif menu_choice == MENU_WORLD:
          world_index += 1
          if world_index >= len(WORLDS):
            world_index = 0
          world = World(WORLDS[world_index])
          end_trigger = END_MENU
        else:
          level_name = world.get_level(menu_choice)
          end_trigger = END_NEXT_LEVEL

    write_config()
    write_log()

    return
Exemple #6
0
 def menu(self):
     mainmenu = Mainmenu(self.top)
     mainmenu.buttons(self)
Exemple #7
0
def test_resistor_under_limit():
    # the lower limit of resistors is 0 so if the user chooses a lower value then 0 a error will occure this test should fail
    underlimit = 0
    resistor = Mainmenu()
    number_under_resistors = resistor.Number_of_resistorsl(-1)
    assert number_under_resistors >= underlimit, "less than 0 resistors is not allowed"
Exemple #8
0
def test_resistor_over_limit():
    # the upper limit of resistors is 10 so if the user chooses a higher value then 10 a error will occure this test should fail
    overlimit = 10
    resistor = Mainmenu()
    number_over_resistors = resistor.Number_of_resistorso(11)
    assert number_over_resistors <= overlimit, "11 resistors or more is not allowed"
Exemple #9
0
def test_next_button_unclicked():
    # TESTS IF THE BUTTON IS NOT CLICK WILL RETURN A FALSE VALUE
    button_F = False
    button = Mainmenu()
    button_TF = button.Next_button(False)
    assert button_TF == button_F, "This should be True until the button is clicked"
Exemple #10
0
def test_calculation_choice_P():
    # the user will pick parallel and this test will confirm that parallel calculations will be used
    C_parallel = "parallel"
    calculation = Mainmenu()
    choice = calculation.Calculation_type("parallel")
    assert choice == C_parallel, "This will be true if the user chooses parallel circuit calculations"
Exemple #11
0
def test_calculation_choice_S():
    # the user will pick series and this test will confirm that series calculations will be used
    C_series = "series"
    calculation = Mainmenu()
    choice = calculation.Calculation_type("series")
    assert choice == C_series, "This will be True if the user chooses series circuit calculations"
Exemple #12
0
def test_next_button_clicked():
    # TESTS IF THE BUTTON IS CLICKED IT WILL RETURN A TRUE VALUE AFTER CLICKED
    button_T = True
    button = Mainmenu()
    button_TF = button.Next_button(True)
    assert button_TF == button_T, "This should be True after the button is clicked"
Exemple #13
0
'''
Created on Jan 3, 2019

@author: RayL
'''
import pygame
from game import Game  #Import game and main menu classes
from mainmenu import Mainmenu
pygame.init()  #Initialize pygame
window_x = 1000  #Window size
window_y = 600
window = pygame.display.set_mode((window_x, window_y))  #Create window
pygame.display.set_caption("Megaman Battles")
game = Game(window)  #Initialize game and mainmenu
menu = Mainmenu(window)

while True:  #Main Loop
    decision = menu.run(
    )  #Runs menu and returns 1,2, or 3. (Play, tutorial, or exit)
    if decision == 1:
        game.play()  #Play
        break
    elif decision == 2:
        menu.tutorial()  #Tutorial
    elif decision == 3:
        break  #Exit
Exemple #14
0
#2308 박교령
#군인과 군인을 기다리는 곰신들을 위해 만든 프로젝트이며 전역일 계산, 디데이 계산, 일기장, 군대용어퀴즈등을 이용할 수 있습니다.
#실행은 main.py에서 실행합니다.
from mainmenu import Mainmenu
print("■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□")
print("□                                                        ■")
print("■                                                        □")
print("□                   꽃신 신으러 가자~♬                  ■")
print("■                                                        □")
print("□                       ♥ @}---- ♥          by 교령이    ■")
print("■                                                        □")
print("□                                                        ■")
print("■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□")
o = Mainmenu()
o.main()